refactored the way of defining things ;). This is now persisted in the database :D

main
hecht 13 years ago
parent 5ee447997f
commit cbd536d7be

@ -5,10 +5,11 @@
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
*
*/
?>
<?php
define("CLANKAMPF", 2);
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/defines.inc.php');
defineIfNotDefined('CLANKAMPF', 2);
function getCharAttackSet($char_id, $type) {
$qry = null;

@ -6,8 +6,9 @@
*
*/
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/defines.inc.php');
define('MAX_CHARS_CLANSIGN', 8);
defineIfNotDefined('MAX_CHARS_CLANSIGN', 8);
$GLOBALS['clan_buffered_instances'] = array ();

@ -6,6 +6,7 @@
*
*/
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/defines.inc.php');
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/clan.inc.php');
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/attackenset.inc.php');
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/arena.inc.php');
@ -14,13 +15,13 @@ include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/semaphore.inc.php');
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/event.inc.php');
define("MIN_MEMBERS", 5);
define("MAX_OPEN_REQUESTS", 3);
define("DAVY_BACK_FIGHT", 1);
define("SURVIVAL", 2);
defineIfNotDefined('MIN_MEMBERS', 5);
defineIfNotDefined('MAX_OPEN_REQUESTS', 3);
defineIfNotDefined('DAVY_BACK_FIGHT', 1);
defineIfNotDefined('SURVIVAL', 2);
define("ATTACK_SET_DAVY_BACK_FIGHT", 2);
define("ATTACK_SET_SURVIVAL", 2);
defineIfNotDefined('ATTACK_SET_DAVY_BACK_FIGHT', 2);
defineIfNotDefined('ATTACK_SET_SURVIVAL', 2);
$GLOBALS['clan_challenge_buffered_instances'] = array ();

@ -0,0 +1,40 @@
<?php
/*
*
* @copyright (c) 2011 animegame.eu
* @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence
*
*/
include_once ($_SERVER['DOCUMENT_ROOT'].'ag/include/config/db.inc.php');
$GLOBALS['definesInitialized'] = FALSE;
function initializeDefines() {
$sql = 'SELECT * from defines';
$qry = mysql_query($sql);
while($row = mysql_fetch_assoc($qry)) {
if(!defined($row['key'])) {
define($row['key'], $row['value']);
}
}
$GLOBALS['definesInitialized'] = TRUE;
}
function defineIfNotDefined($key, $value) {
if(!$GLOBALS['definesInitialized']) {
initializeDefines();
}
if(!defined($key)) {
// we seem that we need to insert this key - value pair!
$sql = 'INSERT INTO defines(`key`, `value`) values(\''.$key.'\', \''.$value.'\')';
mysql_query($sql);
define($key, $value);
}
}
?>

@ -7,32 +7,33 @@
*/
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/user.inc.php');
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/defines.inc.php');
define('EVENT_TEST', 0);
define('EVENT_SCHATZ_SUCHE', 1);
define('EVENT_TURNIER', 2);
define('EVENT_KAMPF', 3);
define('EVENT_LIGA', 4);
define('EVENT_WANTED', 5);
define('EVENT_CLAN_FIGHT', 6);
defineIfNotDefined('EVENT_TEST', 0);
defineIfNotDefined('EVENT_SCHATZ_SUCHE', 1);
defineIfNotDefined('EVENT_TURNIER', 2);
defineIfNotDefined('EVENT_KAMPF', 3);
defineIfNotDefined('EVENT_LIGA', 4);
defineIfNotDefined('EVENT_WANTED', 5);
defineIfNotDefined('EVENT_CLAN_FIGHT', 6);
// The fights duration is fixed
define('DURATION_FIGHT', 0);
defineIfNotDefined('DURATIONTYPE_FIGHT', 0);
// The fights duration is resolved by the amount of rounds
define('DURATION_ROUND', 1);
defineIfNotDefined('DURATIONTYPE_ROUND', 1);
// The fights duration is fixed but the time ouf rounds is resolved!
define('DURATION_FIGHT_RESOLVED_ROUNDS', 2);
define('KEY_LOGE', 'LOGE');
define('KEY_SITZ', 'SITZ');
define('KEY_STEH', 'STEH');
define('KEY_EXP_CHAR1', 'EXP_CHAR1');
define('KEY_EXP_CHAR2', 'EXP_CHAR2');
define('KEY_GELD_CHAR1', 'GELD_CHAR1');
define('KEY_GELD_CHAR2', 'GELD_CHAR2');
define('KEY_AXP_CHAR1', 'AXP_CHAR1');
define('KEY_AXP_CHAR2', 'AXP_CHAR2');
define('KEY_ITM_CHAR1', 'ITM_CHAR1');
defineIfNotDefined('DURATIONTYPE_FIGHT_RESOLVED_ROUNDS', 2);
defineIfNotDefined('KEY_LOGE', 'LOGE');
defineIfNotDefined('KEY_SITZ', 'SITZ');
defineIfNotDefined('KEY_STEH', 'STEH');
defineIfNotDefined('KEY_EXP_CHAR1', 'EXP_CHAR1');
defineIfNotDefined('KEY_EXP_CHAR2', 'EXP_CHAR2');
defineIfNotDefined('KEY_GELD_CHAR1', 'GELD_CHAR1');
defineIfNotDefined('KEY_GELD_CHAR2', 'GELD_CHAR2');
defineIfNotDefined('KEY_AXP_CHAR1', 'AXP_CHAR1');
defineIfNotDefined('KEY_AXP_CHAR2', 'AXP_CHAR2');
defineIfNotDefined('KEY_ITM_CHAR1', 'ITM_CHAR1');
/**

@ -6,18 +6,19 @@
*
*/
//Konstanten
define("ADMIN", 1);
define("TESTER", 2);
define("ENTWICKLER", 3);
define("DESIGNER", 4);
define("WERBUNG_AN", 5);
define("INAKTIV_LOESCHSCHUTZ", 6);
define("AKTIV_LOESCHSCHUTZ", 7);
define("AKTIV_CHAT", 8);
include_once ($_SERVER['DOCUMENT_ROOT'] . 'ag/include/defines.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/parse.inc.php');
//Konstanten
defineIfNotDefined('ADMIN', 1);
defineIfNotDefined('TESTER', 2);
defineIfNotDefined('ENTWICKLER', 3);
defineIfNotDefined('DESIGNER', 4);
defineIfNotDefined('WERBUNG_AN', 5);
defineIfNotDefined('INAKTIV_LOESCHSCHUTZ', 6);
defineIfNotDefined('AKTIV_LOESCHSCHUTZ', 7);
defineIfNotDefined('AKTIV_CHAT', 8);
function getUserGroups($user) {
$qry = null;
$groups = array();

@ -6,18 +6,25 @@
*
*/
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf_wrapper.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/event.inc.php');
include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/char.inc.php');
//include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/kampf_wrapper.inc.php');
//include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/event.inc.php');
//include_once($_SERVER['DOCUMENT_ROOT'].'ag/include/char.inc.php');
$event_id = createEvent(EVENT_TEST);
//$event_id = createEvent(EVENT_TEST);
$charid = addParticipant($event_id, getChar(4113));
$charid = addParticipant($event_id, getChar(4162));
//$charid = addParticipant($event_id, getChar(4113));
//$charid = addParticipant($event_id, getChar(4162));
$combinedArray = calculateFight(getChar(4113), getChar(4162));
//$combinedArray = calculateFight(getChar(4113), getChar(4162));
//persistFight($event_id, $combinedArray);
include_once ($_SERVER['DOCUMENT_ROOT'].'ag/include/defines.inc.php');
defineIfNotDefined('TEST', 1);
echo TEST;
persistFight($event_id, $combinedArray);
?>

@ -2489,6 +2489,18 @@ CREATE TABLE `events` (
PRIMARY KEY (`event_id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
DROP TABLE IF EXISTS `defines`;
CREATE TABLE `defines` (
`key` VARCHAR(30) NOT NULL,
`value` VARCHAR(20) NOT NULL,
PRIMARY KEY (`key`)
)
ENGINE = InnoDB
CHARACTER SET utf8 COLLATE utf8_general_ci;
--
-- Dumping data for table `events`
--

Loading…
Cancel
Save