From c1eb10b19b4917d17d4b29e0cce4e149a1f8753d Mon Sep 17 00:00:00 2001 From: Vladyslav Date: Wed, 20 Jun 2018 19:34:05 +0300 Subject: [PATCH] Enable (Disable) Alliance invitation message +Now during the installation (or after installation in the admin panel) you can Enable (Disable) sending an in-game message to the player, if he was invited to the alliance. +Preparing the code for Enable (Disable) "New Alliance & Embassy Mechanics" NOTE 1: To play this version of the game, you need to reinstall the server OR you can simply add these lines of code into your file: GameEngine/config.php define("NEW_FUNCTIONS_ALLIANCE_INVITATION", True); define("NEW_FUNCTIONS_EMBASSY_MECHANICS", False); GameEngine/Admin/Mods/constant_format.tpl define("NEW_FUNCTIONS_ALLIANCE_INVITATION", %NEW_FUNCTIONS_ALLIANCE_INVITATION%); define("NEW_FUNCTIONS_EMBASSY_MECHANICS", %NEW_FUNCTIONS_EMBASSY_MECHANICS%); NOTE 2: pay special attention to the fact that these are two different records !!! If the records are entered incorrectly, you will receive a non-working code! NOTE 3: it is also necessary to follow the instructions with this change (if they were not previously executed) https://github.com/Shadowss/TravianZ/commit/11ae61c013d663304086ecfd5d845040ebf2f144 --- Admin/Templates/config.tpl | 42 +++++++++++++--------- Admin/Templates/editNewFunctions.tpl | 22 ++++++++++-- GameEngine/Admin/Mods/editAdminInfo.php | 4 +++ GameEngine/Admin/Mods/editExtraSet.php | 4 +++ GameEngine/Admin/Mods/editLogSet.php | 4 +++ GameEngine/Admin/Mods/editNewFunctions.php | 2 ++ GameEngine/Admin/Mods/editNewsboxSet.php | 5 ++- GameEngine/Admin/Mods/editPlusSet.php | 4 +++ GameEngine/Admin/Mods/editServerSet.php | 4 +++ GameEngine/Alliance.php | 5 ++- install/data/constant_format.tpl | 3 ++ install/process.php | 2 ++ install/templates/config.tpl | 18 ++++++++++ 13 files changed, 98 insertions(+), 21 deletions(-) diff --git a/Admin/Templates/config.tpl b/Admin/Templates/config.tpl index ddaa86a6..4970cbc7 100644 --- a/Admin/Templates/config.tpl +++ b/Admin/Templates/config.tpl @@ -179,24 +179,32 @@ if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN); - - - - - - -
New Mechanics and Functions
+ + + + + + +
New Mechanics and Functions
- - - - - - - - - -
Display oasis in profile ?Turns on or off the display of oases of each village in the player profileEnabled" : "Disabled"; ?>
+ + + + + + + + + + + + + + + + + +
Display oasis in profile ?Enable (Disable) the display of oases of each village in the player profileEnabled" : "Disabled"; ?>
Alliance invitation message ?Enable (Disable) sending an in-game message to the player, if he was invited to the allianceEnabled" : "Disabled"; ?>
New Alliance & Embassy Mechanics ?For this setting, you can find more information on the link: https://github.comEnabled" : "Disabled"; ?>
diff --git a/Admin/Templates/editNewFunctions.tpl b/Admin/Templates/editNewFunctions.tpl index a9ac52c4..ad3035ab 100644 --- a/Admin/Templates/editNewFunctions.tpl +++ b/Admin/Templates/editNewFunctions.tpl @@ -28,8 +28,26 @@ if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN); + + + + + + + + diff --git a/GameEngine/Admin/Mods/editAdminInfo.php b/GameEngine/Admin/Mods/editAdminInfo.php index 9b8f35db..4cfa11d9 100755 --- a/GameEngine/Admin/Mods/editAdminInfo.php +++ b/GameEngine/Admin/Mods/editAdminInfo.php @@ -49,6 +49,8 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $NEWSBOX3=(NEWSBOX3==false)? "false":"true"; $LIMIT_MAILBOX=(LIMIT_MAILBOX==false)? "false":"true"; $NEW_FUNCTIONS_OASIS = (NEW_FUNCTIONS_OASIS == false ? 'false' : 'true'); + $NEW_FUNCTIONS_ALLIANCE_INVITATION = (NEW_FUNCTIONS_ALLIANCE_INVITATION == false ? 'false' : 'true'); + $NEW_FUNCTIONS_EMBASSY_MECHANICS = (NEW_FUNCTIONS_EMBASSY_MECHANICS == false ? 'false' : 'true'); $text = file_get_contents("constant_format.tpl"); $text = preg_replace("'%ERRORREPORT%'", $ERRORREPORT, $text); @@ -125,6 +127,8 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%HOMEPAGE%'", HOMEPAGE, $text); $text = preg_replace("'%SERVER%'", SERVER, $text); $text = preg_replace("'%NEW_FUNCTIONS_OASIS%'", $NEW_FUNCTIONS_OASIS, $text); + $text = preg_replace("'%NEW_FUNCTIONS_ALLIANCE_INVITATION%'", $NEW_FUNCTIONS_ALLIANCE_INVITATION, $text); + $text = preg_replace("'%NEW_FUNCTIONS_EMBASSY_MECHANICS%'", $NEW_FUNCTIONS_EMBASSY_MECHANICS, $text); // PLUS settings need to be kept intact $text = preg_replace("'%PLUS_TIME%'", PLUS_TIME, $text); diff --git a/GameEngine/Admin/Mods/editExtraSet.php b/GameEngine/Admin/Mods/editExtraSet.php index d88046ba..e2dac2b3 100755 --- a/GameEngine/Admin/Mods/editExtraSet.php +++ b/GameEngine/Admin/Mods/editExtraSet.php @@ -48,6 +48,8 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $SUPPORT_MSGS_IN_ADMIN = (ADMIN_RECEIVE_SUPPORT_MESSAGES == false ? 'false' : 'true'); $ADMINS_RAIDABLE = (ADMIN_ALLOW_INCOMING_RAIDS == false ? 'false' : 'true'); $NEW_FUNCTIONS_OASIS = (NEW_FUNCTIONS_OASIS == false ? 'false' : 'true'); + $NEW_FUNCTIONS_ALLIANCE_INVITATION = (NEW_FUNCTIONS_ALLIANCE_INVITATION == false ? 'false' : 'true'); + $NEW_FUNCTIONS_EMBASSY_MECHANICS = (NEW_FUNCTIONS_EMBASSY_MECHANICS == false ? 'false' : 'true'); $text = file_get_contents("constant_format.tpl"); $text = preg_replace("'%ERRORREPORT%'", ERROR_REPORT, $text); @@ -122,6 +124,8 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%HOMEPAGE%'", HOMEPAGE, $text); $text = preg_replace("'%SERVER%'", SERVER, $text); $text = preg_replace("'%NEW_FUNCTIONS_OASIS%'", $NEW_FUNCTIONS_OASIS, $text); + $text = preg_replace("'%NEW_FUNCTIONS_ALLIANCE_INVITATION%'", $NEW_FUNCTIONS_ALLIANCE_INVITATION, $text); + $text = preg_replace("'%NEW_FUNCTIONS_EMBASSY_MECHANICS%'", $NEW_FUNCTIONS_EMBASSY_MECHANICS, $text); // PLUS settings need to be kept intact $text = preg_replace("'%PLUS_TIME%'", PLUS_TIME, $text); diff --git a/GameEngine/Admin/Mods/editLogSet.php b/GameEngine/Admin/Mods/editLogSet.php index 4341312d..c231c04d 100755 --- a/GameEngine/Admin/Mods/editLogSet.php +++ b/GameEngine/Admin/Mods/editLogSet.php @@ -44,6 +44,8 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $SUPPORT_MSGS_IN_ADMIN = (ADMIN_RECEIVE_SUPPORT_MESSAGES == false ? 'false' : 'true'); $ADMINS_RAIDABLE = (ADMIN_ALLOW_INCOMING_RAIDS == false ? 'false' : 'true'); $NEW_FUNCTIONS_OASIS = (NEW_FUNCTIONS_OASIS == false ? 'false' : 'true'); + $NEW_FUNCTIONS_ALLIANCE_INVITATION = (NEW_FUNCTIONS_ALLIANCE_INVITATION == false ? 'false' : 'true'); + $NEW_FUNCTIONS_EMBASSY_MECHANICS = (NEW_FUNCTIONS_EMBASSY_MECHANICS == false ? 'false' : 'true'); $text = file_get_contents("constant_format.tpl"); $text = preg_replace("'%ERRORREPORT%'", $ERRORREPORT, $text); @@ -122,6 +124,8 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%HOMEPAGE%'", HOMEPAGE, $text); $text = preg_replace("'%SERVER%'", SERVER, $text); $text = preg_replace("'%NEW_FUNCTIONS_OASIS%'", $NEW_FUNCTIONS_OASIS, $text); + $text = preg_replace("'%NEW_FUNCTIONS_ALLIANCE_INVITATION%'", $NEW_FUNCTIONS_ALLIANCE_INVITATION, $text); + $text = preg_replace("'%NEW_FUNCTIONS_EMBASSY_MECHANICS%'", $NEW_FUNCTIONS_EMBASSY_MECHANICS, $text); // PLUS settings need to be kept intact $text = preg_replace("'%PLUS_TIME%'", PLUS_TIME, $text); diff --git a/GameEngine/Admin/Mods/editNewFunctions.php b/GameEngine/Admin/Mods/editNewFunctions.php index f991d216..1323099f 100644 --- a/GameEngine/Admin/Mods/editNewFunctions.php +++ b/GameEngine/Admin/Mods/editNewFunctions.php @@ -106,6 +106,8 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%HOMEPAGE%'", HOMEPAGE, $text); $text = preg_replace("'%SERVER%'", SERVER, $text); $text = preg_replace("'%NEW_FUNCTIONS_OASIS%'", $_POST['new_functions_oasis'], $text); + $text = preg_replace("'%NEW_FUNCTIONS_ALLIANCE_INVITATION%'", $_POST['new_functions_alliance_invitation'], $text); + $text = preg_replace("'%NEW_FUNCTIONS_EMBASSY_MECHANICS%'", $_POST['new_functions_embassy_mechanics'], $text); // PLUS settings need to be kept intact $text = preg_replace("'%PLUS_TIME%'", PLUS_TIME, $text); diff --git a/GameEngine/Admin/Mods/editNewsboxSet.php b/GameEngine/Admin/Mods/editNewsboxSet.php index 2b4c3a38..4e83286e 100755 --- a/GameEngine/Admin/Mods/editNewsboxSet.php +++ b/GameEngine/Admin/Mods/editNewsboxSet.php @@ -45,12 +45,13 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $LOG_MARKET=(LOG_MARKET==false)? "false":"true"; $LOG_ILLEGAL=(LOG_ILLEGAL==false)? "false":"true"; - $LIMIT_MAILBOX=(LIMIT_MAILBOX==false)? "false":"true"; $INCLUDE_ADMIN=(INCLUDE_ADMIN==false)? "false":"true"; $SUPPORT_MSGS_IN_ADMIN = (ADMIN_RECEIVE_SUPPORT_MESSAGES == false ? 'false' : 'true'); $ADMINS_RAIDABLE = (ADMIN_ALLOW_INCOMING_RAIDS == false ? 'false' : 'true'); $NEW_FUNCTIONS_OASIS = (NEW_FUNCTIONS_OASIS == false ? 'false' : 'true'); + $NEW_FUNCTIONS_ALLIANCE_INVITATION = (NEW_FUNCTIONS_ALLIANCE_INVITATION == false ? 'false' : 'true'); + $NEW_FUNCTIONS_EMBASSY_MECHANICS = (NEW_FUNCTIONS_EMBASSY_MECHANICS == false ? 'false' : 'true'); $text = file_get_contents("constant_format.tpl"); $text = preg_replace("'%ERRORREPORT%'", $ERRORREPORT, $text); @@ -129,6 +130,8 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%HOMEPAGE%'", HOMEPAGE, $text); $text = preg_replace("'%SERVER%'", SERVER, $text); $text = preg_replace("'%NEW_FUNCTIONS_OASIS%'", $NEW_FUNCTIONS_OASIS, $text); + $text = preg_replace("'%NEW_FUNCTIONS_ALLIANCE_INVITATION%'", $NEW_FUNCTIONS_ALLIANCE_INVITATION, $text); + $text = preg_replace("'%NEW_FUNCTIONS_EMBASSY_MECHANICS%'", $NEW_FUNCTIONS_EMBASSY_MECHANICS, $text); // PLUS settings need to be kept intact $text = preg_replace("'%PLUS_TIME%'", PLUS_TIME, $text); diff --git a/GameEngine/Admin/Mods/editPlusSet.php b/GameEngine/Admin/Mods/editPlusSet.php index e71620a6..abe31b35 100644 --- a/GameEngine/Admin/Mods/editPlusSet.php +++ b/GameEngine/Admin/Mods/editPlusSet.php @@ -32,6 +32,8 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $SUPPORT_MSGS_IN_ADMIN = (ADMIN_RECEIVE_SUPPORT_MESSAGES == false ? 'false' : 'true'); $ADMINS_RAIDABLE = (ADMIN_ALLOW_INCOMING_RAIDS == false ? 'false' : 'true'); $NEW_FUNCTIONS_OASIS = (NEW_FUNCTIONS_OASIS == false ? 'false' : 'true'); + $NEW_FUNCTIONS_ALLIANCE_INVITATION = (NEW_FUNCTIONS_ALLIANCE_INVITATION == false ? 'false' : 'true'); + $NEW_FUNCTIONS_EMBASSY_MECHANICS = (NEW_FUNCTIONS_EMBASSY_MECHANICS == false ? 'false' : 'true'); // SERVER SETTINGS - we need to keep these intact $text = preg_replace("'%ERRORREPORT%'", ERROR_REPORT, $text); @@ -106,6 +108,8 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%HOMEPAGE%'", HOMEPAGE, $text); $text = preg_replace("'%SERVER%'", SERVER, $text); $text = preg_replace("'%NEW_FUNCTIONS_OASIS%'", $NEW_FUNCTIONS_OASIS, $text); + $text = preg_replace("'%NEW_FUNCTIONS_ALLIANCE_INVITATION%'", $NEW_FUNCTIONS_ALLIANCE_INVITATION, $text); + $text = preg_replace("'%NEW_FUNCTIONS_EMBASSY_MECHANICS%'", $NEW_FUNCTIONS_EMBASSY_MECHANICS, $text); // PLUS SETTINGS $text = preg_replace("'%PLUS_TIME%'", $_POST['plus_time'], $text); diff --git a/GameEngine/Admin/Mods/editServerSet.php b/GameEngine/Admin/Mods/editServerSet.php index c7b169bc..0a29cff4 100755 --- a/GameEngine/Admin/Mods/editServerSet.php +++ b/GameEngine/Admin/Mods/editServerSet.php @@ -43,6 +43,8 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $SUPPORT_MSGS_IN_ADMIN = (ADMIN_RECEIVE_SUPPORT_MESSAGES == false ? 'false' : 'true'); $ADMINS_RAIDABLE = (ADMIN_ALLOW_INCOMING_RAIDS == false ? 'false' : 'true'); $NEW_FUNCTIONS_OASIS = (NEW_FUNCTIONS_OASIS == false ? 'false' : 'true'); + $NEW_FUNCTIONS_ALLIANCE_INVITATION = (NEW_FUNCTIONS_ALLIANCE_INVITATION == false ? 'false' : 'true'); + $NEW_FUNCTIONS_EMBASSY_MECHANICS = (NEW_FUNCTIONS_EMBASSY_MECHANICS == false ? 'false' : 'true'); $text = file_get_contents("constant_format.tpl"); $text = preg_replace("'%ERRORREPORT%'", $_POST['error'], $text); @@ -117,6 +119,8 @@ $fh = fopen($myFile, 'w') or die("


Can't open file: GameEngine\con $text = preg_replace("'%HOMEPAGE%'", HOMEPAGE, $text); $text = preg_replace("'%SERVER%'", SERVER, $text); $text = preg_replace("'%NEW_FUNCTIONS_OASIS%'", $NEW_FUNCTIONS_OASIS, $text); + $text = preg_replace("'%NEW_FUNCTIONS_ALLIANCE_INVITATION%'", $NEW_FUNCTIONS_ALLIANCE_INVITATION, $text); + $text = preg_replace("'%NEW_FUNCTIONS_EMBASSY_MECHANICS%'", $NEW_FUNCTIONS_EMBASSY_MECHANICS, $text); // PLUS settings need to be kept intact $text = preg_replace("'%PLUS_TIME%'", PLUS_TIME, $text); diff --git a/GameEngine/Alliance.php b/GameEngine/Alliance.php index 9cfd8136..513c3dd4 100755 --- a/GameEngine/Alliance.php +++ b/GameEngine/Alliance.php @@ -245,7 +245,9 @@ class Alliance { // Log the notice $database->insertAlliNotice($session->alliance, '' . addslashes($session->username) . ' has invited ' . addslashes($UserData['username']) . ' into the alliance.'); // send invitation via in-game messages - $database->sendMessage( + if(NEW_FUNCTIONS_ALLIANCE_INVITATION == false) return; + else { + $database->sendMessage( $UserData['id'], 4, 'Alliance invitation.', @@ -256,6 +258,7 @@ class Alliance { 0, 0, true); + } } } diff --git a/install/data/constant_format.tpl b/install/data/constant_format.tpl index 51c40db8..75914a85 100644 --- a/install/data/constant_format.tpl +++ b/install/data/constant_format.tpl @@ -300,6 +300,9 @@ define("ADMIN_ALLOW_INCOMING_RAIDS", %ARAIDS%); // **** NEW MECHANICS AND FUNCTIONS **** // ///////////////////////////////////////////////// define("NEW_FUNCTIONS_OASIS", %NEW_FUNCTIONS_OASIS%); +define("NEW_FUNCTIONS_ALLIANCE_INVITATION", %NEW_FUNCTIONS_ALLIANCE_INVITATION%); +define("NEW_FUNCTIONS_EMBASSY_MECHANICS", %NEW_FUNCTIONS_EMBASSY_MECHANICS%); + ////////////////////////////////////////// // **** DO NOT EDIT SETTINGS **** // diff --git a/install/process.php b/install/process.php index 48a2c946..e2091f6a 100644 --- a/install/process.php +++ b/install/process.php @@ -144,6 +144,8 @@ class Process { //New Mechanics and Functions $findReplace["%NEW_FUNCTIONS_OASIS%"] = $_POST['new_functions_oasis']; + $findReplace["%NEW_FUNCTIONS_ALLIANCE_INVITATION%"] = $_POST['new_functions_alliance_invitation']; + $findReplace["%NEW_FUNCTIONS_EMBASSY_MECHANICS%"] = $_POST['new_functions_embassy_mechanics']; fwrite($gameConfig, str_replace(array_keys($findReplace), array_values($findReplace), $text)); diff --git a/install/templates/config.tpl b/install/templates/config.tpl index 0829cf28..6c06214d 100644 --- a/install/templates/config.tpl +++ b/install/templates/config.tpl @@ -282,6 +282,24 @@ echo "
Error creating constant.php +
+ + + + + + +
Display oasis in profile ?Turns on or off the display of oases of each village in the player profile +
Alliance invitation message ?Enable (Disable) sending an in-game message to the player, if he was invited to the alliance + +
New Alliance & Embassy Mechanics ?For this setting, you can find more information on the link: https://github.com +
Alliance invitation message: + +
New Alliance & Embassy Mechanics: + +