feat: Admins can be attacked, raided and traded with via config option

This commit is contained in:
Martin Ambrus
2017-10-22 20:28:03 +02:00
parent d1ff824278
commit 53f54ce9e9
28 changed files with 61 additions and 20 deletions
+1 -1
View File
@@ -30,7 +30,7 @@ $date = $generator->procMtime($rep[0]['time']); ?>
<tr><td colspan="2" class="report_content">
<table cellpadding="1" cellspacing="1" id="trade"><thead><tr>
<td>&nbsp;</td>
<td>><?php echo $user_url;?> from the village <?php echo $from_url;?></td>
<td><?php echo $user_url;?> from the village <?php echo $from_url;?></td>
</tr></thead><tbody><tr>
<th>Resources</th>
<td>
+1 -1
View File
@@ -30,7 +30,7 @@ $date = $generator->procMtime($rep[0]['time']); ?>
<tr><td colspan="2" class="report_content">
<table cellpadding="1" cellspacing="1" id="trade"><thead><tr>
<td>&nbsp;</td>
<td>><?php echo $user_url;?> from the village <?php echo $from_url;?></td>
<td><?php echo $user_url;?> from the village <?php echo $from_url;?></td>
</tr></thead><tbody><tr>
<th>Resources</th>
<td>
+1 -1
View File
@@ -30,7 +30,7 @@ $date = $generator->procMtime($rep[0]['time']); ?>
<tr><td colspan="2" class="report_content">
<table cellpadding="1" cellspacing="1" id="trade"><thead><tr>
<td>&nbsp;</td>
<td>><?php echo $user_url;?> from the village <?php echo $from_url;?></td>
<td><?php echo $user_url;?> from the village <?php echo $from_url;?></td>
</tr></thead><tbody><tr>
<th>Resources</th>
<td>
+1 -1
View File
@@ -30,7 +30,7 @@ $date = $generator->procMtime($rep[0]['time']); ?>
<tr><td colspan="2" class="report_content">
<table cellpadding="1" cellspacing="1" id="trade"><thead><tr>
<td>&nbsp;</td>
<td>><?php echo $user_url;?> from the village <?php echo $from_url;?></td>
<td><?php echo $user_url;?> from the village <?php echo $from_url;?></td>
</tr></thead><tbody><tr>
<th>Resources</th>
<td>
+1 -1
View File
@@ -30,7 +30,7 @@ $date = $generator->procMtime($rep[0]['time']); ?>
<tr><td colspan="2" class="report_content">
<table cellpadding="1" cellspacing="1" id="trade"><thead><tr>
<td>&nbsp;</td>
<td>><?php echo $user_url;?> from the village <?php echo $from_url;?></td>
<td><?php echo $user_url;?> from the village <?php echo $from_url;?></td>
</tr></thead><tbody><tr>
<th>Resources</th>
<td>
+4
View File
@@ -398,6 +398,10 @@ if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN);
<td>Include Support Messages in Admin Mailbox</td>
<td><?php if(ADMIN_RECEIVE_SUPPORT_MESSAGES == true){ echo "<b><font color='Green'>Enabled</font></b>"; } else if(ADMIN_RECEIVE_SUPPORT_MESSAGES == false){ echo "<b><font color='Red'>Disabled</font></b>"; } ?></td>
</tr>
<tr>
<td>Allow Administrative Accounts to be Raided and Attacked</td>
<td><?php if(ADMIN_ALLOW_INCOMING_RAIDS == true){ echo "<b><font color='Green'>Yes</font></b>"; } else if(ADMIN_ALLOW_INCOMING_RAIDS == false){ echo "<b><font color='Red'>No</font></b>"; } ?></td>
</tr>
</table>
<?php
+10
View File
@@ -41,6 +41,7 @@ if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN);
</select>
</td>
</tr>
<tr>
<td>Include Support Messages in Admin Mailbox:</td>
<td>
<select name="admin_support_msgs">
@@ -49,6 +50,15 @@ if($_SESSION['access'] < 9) die(ACCESS_DENIED_ADMIN);
</select>
</td>
</tr>
<tr>
<td>Allow Administrative Accounts to be Raided and Attacked:</td>
<td>
<select name="admin_raidable">
<option value="True" <?php if (ADMIN_ALLOW_INCOMING_RAIDS==true) echo "selected";?>>True</option>
<option value="False" <?php if (ADMIN_ALLOW_INCOMING_RAIDS==false) echo "selected";?>>False</option>
</select>
</td>
</tr>
</tbody>
</table>
<br />
@@ -274,6 +274,9 @@ define("ADMIN_NAME", "%ANAME%");
// ***** Show Support Messages in Admin
define("ADMIN_RECEIVE_SUPPORT_MESSAGES", %ASUPPMSGS%);
// ***** Allow Admin accounts to be raided and attacked
define("ADMIN_ALLOW_INCOMING_RAIDS", %ARAIDS%);
//////////////////////////////////////////
+1
View File
@@ -100,6 +100,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
$text = preg_replace("'%AEMAIL%'", $_POST['aemail'], $text);
$text = preg_replace("'%ANAME%'", $_POST['aname'], $text);
$text = preg_replace("'%ASUPPMSGS%'", ($_POST['admin_support_msgs'] == 'True' ? 'true' : 'false'), $text);
$text = preg_replace("'%ARAIDS%'", ($_POST['admin_raidable'] == 'True' ? 'true' : 'false'), $text);
$text = preg_replace("'%UTRACK%'", "", $text);
$text = preg_replace("'%UTOUT%'", "", $text);
$text = preg_replace("'%DOMAIN%'", DOMAIN, $text);
+2
View File
@@ -37,6 +37,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
$LOG_ILLEGAL=(LOG_ILLEGAL==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');
$text = file_get_contents("constant_format.tpl");
$text = preg_replace("'%ERRORREPORT%'", ERROR_REPORT, $text);
@@ -96,6 +97,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
$text = preg_replace("'%AEMAIL%'", ADMIN_EMAIL, $text);
$text = preg_replace("'%ANAME%'", ADMIN_NAME, $text);
$text = preg_replace("'%ASUPPMSGS%'", $SUPPORT_MSGS_IN_ADMIN, $text);
$text = preg_replace("'%ARAIDS%'", $ADMINS_RAIDABLE, $text);
$text = preg_replace("'%UTRACK%'", "TRACK_USR", $text); // not in use, text only in a comment
$text = preg_replace("'%UTOUT%'", "USER_TIMEOUT", $text); // not in use, text only in a comment
$text = preg_replace("'%DOMAIN%'", DOMAIN, $text);
+2
View File
@@ -33,6 +33,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
$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');
$text = file_get_contents("constant_format.tpl");
$text = preg_replace("'%ERRORREPORT%'", $ERRORREPORT, $text);
@@ -96,6 +97,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
$text = preg_replace("'%AEMAIL%'", ADMIN_EMAIL, $text);
$text = preg_replace("'%ANAME%'", ADMIN_NAME, $text);
$text = preg_replace("'%ASUPPMSGS%'", $SUPPORT_MSGS_IN_ADMIN, $text);
$text = preg_replace("'%ARAIDS%'", $ADMINS_RAIDABLE, $text);
$text = preg_replace("'%UTRACK%'", "", $text);
$text = preg_replace("'%UTOUT%'", "", $text);
$text = preg_replace("'%DOMAIN%'", DOMAIN, $text);
+2
View File
@@ -40,6 +40,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
$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');
$text = file_get_contents("constant_format.tpl");
$text = preg_replace("'%ERRORREPORT%'", $ERRORREPORT, $text);
@@ -103,6 +104,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
$text = preg_replace("'%AEMAIL%'", ADMIN_EMAIL, $text);
$text = preg_replace("'%ANAME%'", ADMIN_NAME, $text);
$text = preg_replace("'%ASUPPMSGS%'", $SUPPORT_MSGS_IN_ADMIN, $text);
$text = preg_replace("'%ARAIDS%'", $ADMINS_RAIDABLE, $text);
$text = preg_replace("'%UTRACK%'", "", $text);
$text = preg_replace("'%UTOUT%'", "", $text);
$text = preg_replace("'%DOMAIN%'", DOMAIN, $text);
+2
View File
@@ -21,6 +21,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
$text = file_get_contents("constant_format.tpl");
$SUPPORT_MSGS_IN_ADMIN = (ADMIN_RECEIVE_SUPPORT_MESSAGES == false ? 'false' : 'true');
$ADMINS_RAIDABLE = (ADMIN_ALLOW_INCOMING_RAIDS == false ? 'false' : 'true');
// SERVER SETTINGS - we need to keep these intact
$text = preg_replace("'%ERRORREPORT%'", ERROR_REPORT, $text);
@@ -80,6 +81,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
$text = preg_replace("'%AEMAIL%'", ADMIN_EMAIL, $text);
$text = preg_replace("'%ANAME%'", ADMIN_NAME, $text);
$text = preg_replace("'%ASUPPMSGS%'", $SUPPORT_MSGS_IN_ADMIN, $text);
$text = preg_replace("'%ARAIDS%'", $ADMINS_RAIDABLE, $text);
$text = preg_replace("'%UTRACK%'", "TRACK_USR", $text); // not in use, text only in a comment
$text = preg_replace("'%UTOUT%'", "USER_TIMEOUT", $text); // not in use, text only in a comment
$text = preg_replace("'%DOMAIN%'", DOMAIN, $text);
+2
View File
@@ -32,6 +32,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
$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');
$text = file_get_contents("constant_format.tpl");
$text = preg_replace("'%ERRORREPORT%'", $_POST['error'], $text);
@@ -90,6 +91,7 @@ $fh = fopen($myFile, 'w') or die("<br/><br/><br/>Can't open file: GameEngine\con
$text = preg_replace("'%ARANK%'", $INCLUDE_ADMIN, $text);
$text = preg_replace("'%AEMAIL%'", ADMIN_EMAIL, $text);
$text = preg_replace("'%ASUPPMSGS%'", $SUPPORT_MSGS_IN_ADMIN, $text);
$text = preg_replace("'%ARAIDS%'", $ADMINS_RAIDABLE, $text);
$text = preg_replace("'%ANAME%'", ADMIN_NAME, $text);
$text = preg_replace("'%UTRACK%'", "", $text);
$text = preg_replace("'%UTOUT%'", "", $text);
+2 -2
View File
@@ -77,10 +77,10 @@ class Market
$this->onmarket = $database->getMarket($village->wid,0);
$this->maxcarry = ($session->tribe == 1)? 500 : (($session->tribe == 2)? 1000 : 750);
$this->maxcarry *= TRADER_CAPACITY;
if($building->getTypeLevel(28) != 0)
if($building->getTypeLevel(28) != 0)
{
$this->maxcarry *= $bid28[$building->getTypeLevel(28)]['attri'] / 100;
}
}
}
private function sendResource($post)
+1 -1
View File
@@ -182,7 +182,7 @@ class Units {
//check if banned/admin:
$villageOwner = $database->getVillageField($id,'owner');
$userAccess = $database->getUserField($villageOwner,'access',0);
if($userAccess == '0' or $userAccess == '8' or $userAccess == '9'){
if($userAccess == '0' or $userAccess == '8' or (!ADMIN_ALLOW_INCOMING_RAIDS && $userAccess == '9')){
$form->addError("error","Player is Banned. You can't attack him");
//break;
}
+2
View File
@@ -53,6 +53,8 @@ martinambrus changes:
41. NPC links added to units in Hero Mansion
42. fixed random attacks attacker tribe (Natars) when building Wonder of the World
43. players who post in an Alliance forum are now notified of each subsequent post in that topic via messages
44. editing troops in Admin now saves them when Enter is used instead of clicking on "Save" as well
45. added option into Admin config to allow Administrative accounts to be raided and attacked (which also permits trading with them via Market)
Shadowss changes:
+3 -3
View File
@@ -14,7 +14,7 @@ var carry = <?php echo $market->maxcarry; ?>;
//-->
</script>
<?php
$allres = $_POST['r1']+$_POST['r2']+$_POST['r3']+$_POST['r4'];
$allres = (int) $_POST['r1'] + (int) $_POST['r2'] + (int) $_POST['r3'] + (int) $_POST['r4'];
if($_POST['x']!="" && $_POST['y']!="" && is_numeric($_POST['x']) && is_numeric($_POST['y'])){
$getwref = $database->getVilWref($_POST['x'],$_POST['y']);
$checkexist = $database->checkVilExist($getwref);
@@ -29,7 +29,7 @@ $userAccess = $database->getUserField($villageOwner,'access',0);
}
$maxcarry = $market->maxcarry;
$maxcarry *= $market->merchantAvail();
if(isset($_POST['ft'])=='check' && $allres!=0 && $allres <= $maxcarry && ($_POST['x']!="" && $_POST['y']!="" or $_POST['dname']!="") && $checkexist && $userAccess == 2){
if(isset($_POST['ft'])=='check' && $allres!=0 && $allres <= $maxcarry && ($_POST['x']!="" && $_POST['y']!="" or $_POST['dname']!="") && $checkexist && ($userAccess == 2 || (ADMIN_ALLOW_INCOMING_RAIDS && $userAccess == 9))){
?>
<form method="POST" name="snd" action="build.php">
<input type="hidden" name="ft" value="mk1">
@@ -213,7 +213,7 @@ if(isset($_POST['ft'])=='check'){
$error = '<span class="error"><b>'.NO_COORDINATES_SELECTED.'</b></span>';
}elseif($getwref == $village->wid){
$error = '<span class="error"><b>'.CANNOT_SEND_RESOURCES.'</b></span>';
}elseif($userAccess == '0' or $userAccess == '8' or $userAccess == '9'){
}elseif($userAccess == '0' or $userAccess == '8' or (!ADMIN_ALLOW_INCOMING_RAIDS && $userAccess == '9')){
$error = '<span class="error"><b>'.BANNED_CANNOT_SEND_RESOURCES.'.</b></span>';
}elseif($_POST['r1']==0 && $_POST['r2']==0 && $_POST['r3']==0 && $_POST['r4']==0){
$error = '<span class="error"><b>'.RESOURCES_NO_SELECTED.'.</b></span>';
+2 -2
View File
@@ -515,7 +515,7 @@ if($type==18 or $type==19 or $type==20 or $type==21){
$data1 = mysqli_fetch_assoc($query1);
$query2 = mysqli_query($GLOBALS['link'],'SELECT * FROM `' . TB_PREFIX . 'users` WHERE `id` = ' . $data1['owner']);
$data2 = mysqli_fetch_assoc($query2);
if($data2['access']=='0' or $data2['access']=='8' or $data2['access']=='9') {
if($data2['access']=='0' or $data2['access']=='8' or (!ADMIN_ALLOW_INCOMING_RAIDS && $data2['access']=='9')) {
echo "&raquo; ".SENDTROOP." (".BAN.")";
} else if($data2['vac_mode']=='1') {
echo "&raquo; Send troops. (Vacation mode on)";
@@ -530,7 +530,7 @@ if($type==18 or $type==19 or $type==20 or $type==21){
<tr>
<td class="none">
<?php
if($data2['access']=='0' or $data2['access']=='8' or $data2['access']=='9') {
if($data2['access']=='0' or $data2['access']=='8' or (!ADMIN_ALLOW_INCOMING_RAIDS && $data2['access']=='9')) {
echo "&raquo; ".SENDMERC." (".BAN.")";
} else if($data2['vac_mode']=='1') {
echo "&raquo; Send merchant(s). (Vacation mode on)";
+1 -1
View File
@@ -30,7 +30,7 @@ if($database->getVillageField($dataarray[1],'name')!="??") {
<tr><td colspan="2" class="report_content">
<table cellpadding="1" cellspacing="1" id="trade"><thead><tr>
<td>&nbsp;</td>
<td>><?php echo $user_url;?> from the village <?php echo $from_url;?></td>
<td><?php echo $user_url;?> from the village <?php echo $from_url;?></td>
</tr></thead><tbody><tr>
<th>Resources</th>
<td>
+1 -1
View File
@@ -30,7 +30,7 @@ if($database->getVillageField($dataarray[1],'name')!="??") {
<tr><td colspan="2" class="report_content">
<table cellpadding="1" cellspacing="1" id="trade"><thead><tr>
<td>&nbsp;</td>
<td>><?php echo $user_url;?> from the village <?php echo $from_url;?></td>
<td><?php echo $user_url;?> from the village <?php echo $from_url;?></td>
</tr></thead><tbody><tr>
<th>Resources</th>
<td>
+1 -1
View File
@@ -30,7 +30,7 @@ if($database->getVillageField($dataarray[1],'name')!="??") {
<tr><td colspan="2" class="report_content">
<table cellpadding="1" cellspacing="1" id="trade"><thead><tr>
<td>&nbsp;</td>
<td>><?php echo $user_url;?> from the village <?php echo $from_url;?></td>
<td><?php echo $user_url;?> from the village <?php echo $from_url;?></td>
</tr></thead><tbody><tr>
<th>Resources</th>
<td>
+1 -1
View File
@@ -30,7 +30,7 @@ if($database->getVillageField($dataarray[1],'name')!="??") {
<tr><td colspan="2" class="report_content">
<table cellpadding="1" cellspacing="1" id="trade"><thead><tr>
<td>&nbsp;</td>
<td>><?php echo $user_url;?> from the village <?php echo $from_url;?></td>
<td><?php echo $user_url;?> from the village <?php echo $from_url;?></td>
</tr></thead><tbody><tr>
<th>Resources</th>
<td>
+1 -1
View File
@@ -30,7 +30,7 @@ if($database->getVillageField($dataarray[1],'name')!="??") {
<tr><td colspan="2" class="report_content">
<table cellpadding="1" cellspacing="1" id="trade"><thead><tr>
<td>&nbsp;</td>
<td>><?php echo $user_url;?> from the village <?php echo $from_url;?></td>
<td><?php echo $user_url;?> from the village <?php echo $from_url;?></td>
</tr></thead><tbody><tr>
<th>Resources</th>
<td>
+1 -1
View File
@@ -15,7 +15,7 @@
$t11 = 0;
$villageOwner = $database->getVillageField($wref,'owner');
$userAccess = $database->getUserField($villageOwner,'access',0);
if($userAccess != '0' && $userAccess != '8' && $userAccess != '9'){
if($userAccess != '0' && $userAccess != '8' && ($userAccess != '9' || (ADMIN_ALLOW_INCOMING_RAIDS && $userAccess == '9'))){
if($tribe == 1){ $uname = "u"; } elseif($tribe == 2){ $uname = "u1"; } elseif($tribe == 3){ $uname = "u2"; }elseif($tribe == 4){ $uname = "u3"; }else {$uname = "u4"; }
if($tribe == 1){ $uname1 = "u1"; } elseif($tribe == 2){ $uname1 = "u2"; } elseif($tribe == 3){ $uname1 = "u3"; }elseif($tribe == 4){ $uname1 = "u4"; }else {$uname1 = "u5"; }
if($tribe == 1){ $uname2 = ""; } elseif($tribe == 2){ $uname2 = "1"; } elseif($tribe == 3){ $uname2 = "2"; }elseif($tribe == 4){ $uname2 = "3"; }else {$uname2 = "4"; }
+3
View File
@@ -274,6 +274,9 @@ define("ADMIN_NAME", "%ANAME%");
// ***** Show Support Messages in Admin
define("ADMIN_RECEIVE_SUPPORT_MESSAGES", %ASUPPMSGS%);
// ***** Allow Admin accounts to be raided and attacked
define("ADMIN_ALLOW_INCOMING_RAIDS", %ARAIDS%);
//////////////////////////////////////////
+9
View File
@@ -269,6 +269,15 @@ echo "<div class=\"headline\"><span class=\"f10 c5\">Error creating constant.php
</select>
</td>
</tr>
<tr>
<td><span class="f9 c6">Allow Administrative Accounts to be Raided and Attacked:</span></td>
<td>
<select name="admin_raidable">
<option value="True" selected="selected">True</option>
<option value="False">False</option>
</select>
</td>
</tr>
</table>
</p>
<p>
-1
View File
@@ -1,5 +1,4 @@
- normalize forum tables - varchar is used for numeric values and is joined with int field
- make an option for admin to be raidable (in profile?)
- finish parts in Admin that are unfinished (mostly delete -X- buttons and Alliance settings)
- add batching logic to mehods which get called too frequently and multiple times (example - Message::sendMessage() now that is sends messages for each forum post)
- add PayPal listener to verify gold transactions imediatelly