From cbd536d7be8fa9cc5536fb86b5855a892f40ee50 Mon Sep 17 00:00:00 2001 From: hecht Date: Sat, 8 Oct 2011 09:30:01 +0000 Subject: [PATCH] refactored the way of defining things ;). This is now persisted in the database :D --- ag/include/attackenset.inc.php | 7 +++--- ag/include/clan.inc.php | 3 ++- ag/include/clan_fights.inc.php | 13 +++++----- ag/include/defines.inc.php | 40 +++++++++++++++++++++++++++++++ ag/include/event.inc.php | 43 +++++++++++++++++----------------- ag/include/usergroup.inc.php | 21 +++++++++-------- ag/test.php | 23 +++++++++++------- db/animegame_svn.sql | 12 ++++++++++ 8 files changed, 113 insertions(+), 49 deletions(-) create mode 100644 ag/include/defines.inc.php diff --git a/ag/include/attackenset.inc.php b/ag/include/attackenset.inc.php index b31191f..8800128 100644 --- a/ag/include/attackenset.inc.php +++ b/ag/include/attackenset.inc.php @@ -5,10 +5,11 @@ * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public Licence * */ -?> - \ No newline at end of file diff --git a/ag/include/event.inc.php b/ag/include/event.inc.php index f6da500..d0d95e0 100644 --- a/ag/include/event.inc.php +++ b/ag/include/event.inc.php @@ -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'); /** diff --git a/ag/include/usergroup.inc.php b/ag/include/usergroup.inc.php index fa4725a..c5e3104 100644 --- a/ag/include/usergroup.inc.php +++ b/ag/include/usergroup.inc.php @@ -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(); diff --git a/ag/test.php b/ag/test.php index a0ae54c..a8bb764 100644 --- a/ag/test.php +++ b/ag/test.php @@ -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); ?> \ No newline at end of file diff --git a/db/animegame_svn.sql b/db/animegame_svn.sql index e5b2343..f76d77f 100644 --- a/db/animegame_svn.sql +++ b/db/animegame_svn.sql @@ -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` --