function call_userpw_text() { global $id, $confirm, $level, $tool; include_once('inc/functions/resort_tools.php'); if (! user_has_access($tool)) { echo "Sorry, this page is restricted to ORKFiA Staff"; include_game_down(); exit; } echo "<form method=\"post\" action=\"".$_SERVER['REQUEST_URI']."\">"; ECHO "Input user id: <input name=id size=5><br>"; ECHO "<br><br>This function will randomize a new password and send it by mail."; ECHO "<br><br>"; ECHO "<input type=submit value=Save name=confirm>"; ECHO "</form>"; IF($confirm && $id) { $objUser = new clsUser ($id); $email = $objUser->get_preference(EMAIL); $password = generatePassword(); $cpassword = $password; mysql_query("UPDATE user SET password = sha1('$cpassword') WHERE id = $id"); $username = $objUser->get_user_info(USERNAME); mail("$email","ORKFiA New Password","Hello, \nYour password has been updated with a new one =) \n\nUsername: $username \nPassword: $password \n\n- The ORKFiA Team\n\n\nThis email is php generated, you cannot successfully reply." , "From: registration@orkfia.org\r\nX-Mailer: PHP/4.3.0\r\nX-Priority: Normal"); echo "User " . $id . " will have a new pw sent within minutes to: " . $email; } }
function call_mergers_text() { global $userid, $task, $mergerid, $checker, $listtribeid, $changedname, $declinereason, $local_stats, $tool; include_once 'inc/functions/resort_tools.php'; // we're abstracting the actual moving out to there include_once 'inc/staff/move.inc.php'; //if (! user_has_access($tool)) //{ // echo "Sorry, this page is restricted to ORKFiA Staff"; // include_game_down(); // exit; //} check_access($tool); $orkTime = date('YmdHis'); echo "<h2>Select task:</h2><br />| <a href='main.php?cat=game&page=resort_tools&tool=mergers&task=pending'>View Pending Mergers</a> | <a href='main.php?cat=game&page=resort_tools&tool=mergers&task=done'>View Done Mergers</a> | <a href='main.php?cat=game&page=resort_tools&tool=mergers&task=rejected'>View Declined Mergers</a> | <a href='main.php?cat=game&page=resort_tools&tool=mergers&task=requested'>View Requested Mergers</a> |<br /><br />"; if ($task == "changename") { // loads a form where you can change the requested name of a tribe $seek = mysql_query("SELECT newname FROM mergers WHERE id = {$mergerid}"); $seek = mysql_fetch_array($seek); echo "<form method=\"post\" action=\"main.php?cat=game&page=resort_tools&tool=mergers&task=changed&mergerid={$mergerid}\">"; echo "<br /><br /><table border=0 cellspacing=0 cellpadding=0 class='small'>"; echo "<tr class='header'><th colspan=2> Change Requested Name </th></tr>"; echo "<tr class='subheader'><th> Current Requested Name </th><td> New Name </td></tr>"; echo "<tr class='data'><th> {$seek['newname']} </th><td> <input type='text' name='changedname' maxLength='30'></td> </tr>"; echo "<tr class='data'><td colspan='2'><input type=submit value='Change requested name'></td></tr>"; echo "</table>"; echo "</form>"; } if ($task == "changed") { // the queries part for changing the requested name of a tribe //check if someone else already has that name first $changedname = quote_smart(strip_tags(trim($changedname))); $check = mysql_query("SELECT * FROM stats WHERE tribe = {$changedname} AND id != {$mergerid}"); if (mysql_num_rows($check) != 0) { echo "<br /><br />Some tribe is already using that name<br /><br />"; } else { $update = mysql_query("UPDATE mergers SET newname = {$changedname} WHERE id = {$mergerid}"); echo "<br /><br />The Requested tribe name is changed<br /><br />"; $task = "pending"; } } if ($task == "decline") { // loads a form where you can give a reason for not merging a tribe echo "<form method=\"post\" action=\"main.php?cat=game&page=resort_tools&tool=mergers&task=delete&mergerid={$mergerid}\">"; echo "<br /><br /><table border=0 cellspacing=0 cellpadding=0 class='small'>"; echo "<tr class='header'><th colspan=2> Decline Merge </th></tr>"; echo "<tr class='subheader'><th>Decline Reason</th></tr>"; echo "<tr class='data'><td><input type='text' name='declinereason' maxLength='100'></td></tr>"; echo "<tr class='data'><td><input type=submit value='Decline Merge'></td></tr>"; echo "</table>"; echo "</form>"; } if ($task == "delete") { // the queries part for the decline option $seek = mysql_query("SELECT * FROM mergers WHERE id = {$mergerid}"); $seek = mysql_fetch_array($seek); $message1 = "Your merge request to {$seek['target']} has been declined.<br />The reason for this is: {$declinereason} .<br />"; $message2 = "The merge from {$seek['oldname']}(#{$seek['origin']}) has been declined.<br />The reason for this is: {$declinereason} .<br />"; $bleh2 = mysql_query("SELECT id FROM stats WHERE type='elder' AND kingdom='{$seek['target']}'"); $bleh2 = mysql_fetch_array($bleh2); $sendmessage1 = mysql_query("INSERT INTO messages (id, for_user, from_user, date, subject, text, new, action) VALUES ('', '{$seek['tribe']}', '0', '" . $orkTime . "', 'Merge Request Declined', '" . $message1 . "', 'new', 'received')"); $sendmessage2 = mysql_query("INSERT INTO messages (id, for_user, from_user, date, subject, text, new, action) VALUES ('', '{$bleh2['id']}', '0', '" . $orkTime . "', 'Merge Request Declined', '" . $message2 . "', 'new', 'received')"); $update = mysql_query("UPDATE mergers SET request_status = 'declined', declined_reason = '{$declinereason}', mod_id = {$local_stats['id']} WHERE id = {$mergerid}"); $task = "pending"; } if ($task == "accept") { // doing the merge itself $fetch = mysql_query("Select * from mergers where id = {$mergerid}"); $fetch = mysql_fetch_array($fetch); $search = mysql_query("Select * from stats where id = {$fetch['tribe']}"); $search = mysql_fetch_array($search); $newname = "'" . $fetch['newname'] . "'"; //$update = mysql_query("UPDATE goods SET credits = 0, market_money = 0, market_food = 0, market_soldiers = 0, market_wood = 0 WHERE id = {$fetch['tribe']}"); //$update = mysql_query("UPDATE stats set kingdom = {$fetch['target']}, type = 'player', vote = 0, invested = 0, tribe = $newname where id = {$fetch['tribe']}"); //$update = mysql_query("UPDATE rankings_personal set alli_id = {$fetch['target']} where id = {$fetch['tribe']}"); mysql_query("UPDATE stats SET tribe = {$newname} where id = {$fetch['tribe']}"); move_tribe($fetch['tribe'], $fetch['target']); $update = mysql_query("UPDATE mergers set request_status = 'done', merge_time = '{$orkTime}', mod_id = '{$local_stats['id']}' where id = {$fetch['id']}"); $strSQL = mysql_query("INSERT INTO news (id, time, ip, type, duser, ouser, result, text, kingdom_text, kingdoma, kingdomb) VALUES ('', '{$orkTime}', '---', 'Mod Move', '0', '0', '1', '', '<font class = \"positive\">{$search['tribe']}(#{$fetch['origin']}) has been merged into {$newname}(#{$fetch['target']})! </font>', '{$fetch['origin']}', '{$fetch['target']}')"); echo "<br /><br />Merge was done =D<br /><br />"; $task = "pending"; } elseif ($task == "done") { // show list with all done mergers $fetch = mysql_query("SELECT * FROM mergers WHERE request_status = 'done' order by merge_time desc"); $mergers = array(); while ($arrmergers = mysql_fetch_array($fetch, MYSQL_ASSOC)) { $mergers[$arrmergers["id"]] = $arrmergers; } echo "<br /><br /><table border=0 cellspacing=0 cellpadding=0 class='big'>"; echo "<tr class='header'><th colspan='5'> Done Mergers </th></tr>"; echo "<tr class='subheader'><th> Merge Time </td><td> Tribe ID </td><td> Old Location </td><td> New Location </td><td> Staff </td></tr>"; foreach ($mergers as $strKey => $value) { $mod = mysql_query("SELECT name FROM stats WHERE id={$value['mod_id']}"); $mod = mysql_fetch_array($mod); echo "<tr class='data'><th> {$value['merge_time']} </th><td> {$value['tribe']} </td><td> {$value['oldname']}(#{$value['origin']}) </td><td> {$value['newname']}(#{$value['target']}) </td><td> {$mod['name']} </td></tr>"; } echo "</table>"; } elseif ($task == "rejected") { // show list with all rejected mergers and the reason to reject it $fetch = mysql_query("SELECT * FROM mergers WHERE request_status = 'declined' order by merge_time desc"); $mergers = array(); while ($arrmergers = mysql_fetch_array($fetch, MYSQL_ASSOC)) { $mergers[$arrmergers["id"]] = $arrmergers; } echo "<br /><br /><table border=0 cellspacing=0 cellpadding=0 class='big'>"; echo "<tr class='header'><th colspan=5> Declined Mergers </th></tr>"; echo "<tr class='subheader'><th> Merge Time </th><td> Tribe ID </td><td> Location </td><td> Staff </td><td> Reason </td></tr>"; foreach ($mergers as $strKey => $value) { $mod = mysql_query("SELECT name FROM stats WHERE id={$value['mod_id']}"); $mod = mysql_fetch_array($mod); echo "<tr class='data'><th> {$value['merge_time']} </th><td> {$value['tribe']} </td><td> {$value['oldname']}(#{$value['origin']}) </td><td> {$mod['name']} </td><td>{$value['declined_reason']}</td></tr>"; } echo "</table>"; } elseif ($task == "requested") { // show list with all mergers not accepted by the elder yet $fetch = mysql_query("SELECT * FROM mergers WHERE request_status = 'not ready' order by merge_time desc"); $mergers = array(); while ($arrmergers = mysql_fetch_array($fetch, MYSQL_ASSOC)) { $mergers[$arrmergers["id"]] = $arrmergers; } echo "<br /><br /><table border=0 cellspacing=0 cellpadding=0 class='big'>"; echo "<tr class='header'><th colspan=4> Requested Mergers </th></tr>"; echo "<tr class='subheader'><th> Merge Time </th><td> Tribe ID </td><td> Current Location </td><td> Wanted Location </td></tr>"; foreach ($mergers as $strKey => $value) { echo "<tr class='data'><th> {$value['merge_time']} </th><td> {$value['tribe']} </td><td> {$value['oldname']}(#{$value['origin']}) </td><td>{$value['newname']}(#{$value['target']})</td></tr>"; } echo "</table>"; } elseif ($task == "pending") { // show list of all tribes ready to get merged $fetch = mysql_query("SELECT * FROM mergers WHERE request_status = 'ready' order by merge_time desc"); $mergers = array(); while ($arrmergers = mysql_fetch_array($fetch, MYSQL_ASSOC)) { $mergers[$arrmergers["id"]] = $arrmergers; } echo "<br /><br />" . '<table border="0" cellspacing="0" cellpadding="0" class="big">' . '<tr class="header">' . '<th colspan="8">New Mergers</th>' . '</tr>' . '<tr class="subheader">' . '<th> Merge Time </th>' . '<td> Tribe ID </td>' . '<td> Old Location </td>' . '<td> New Location </td>' . '<td class="center"> §1 </td>' . '<td class="center"> Ruler<br />Age </td>' . '<td> War </td>' . '<td> Actions </td>' . '</tr>'; foreach ($mergers as $strKey => $value) { // $age = mysql_query("SELECT land FROM build WHERE id = $value[tribe]"); // $age = mysql_fetch_array($land); // $ltxt = $land['land']; $bExists = TRUE; $strSQL = "SELECT id FROM " . TBL_USER . " WHERE id = {$value['tribe']}"; $resSQL = mysql_query($strSQL); if (mysql_num_rows($resSQL) == 1) { $objTmpUser = new clsUser($value['tribe']); } else { $bExists = FALSE; } // 21 YEARS OLD ==================================================== if ($bExists) { $iHours = $objTmpUser->get_user_info(HOURS); } else { $iHours = 11808; } if (($iYears = ceil(($iHours + 192) / 12)) > 21) { $strTmpYears = '<span class="negative">' . $iYears . '</span>'; } else { $strTmpYears = '<span class="positive">' . $iYears . '</span>'; } // WEEKS JOINED < 6 ================================================ if ($bExists) { $strDate = $objTmpUser->get_gamestat(SIGNUP_TIME); } else { $strDate = '0000-00-00 00:00:00'; } if (ceil((strtotime($strDate) - strtotime('-6 weeks')) / 86400) < 0) { $strTmpSignup = '<span class="negative">Veteran</span>'; } else { $strTmpSignup = '<span class="positive">Novice</span>'; } include_once "inc/functions/war.php"; $seek1['war_target'] = war_target($value['origin']); $seek2['war_target'] = war_target($value['target']); $seek4 = mysql_query("Select count(id) as bleh from stats where kingdom = {$value['target']}"); $seek4 = mysql_fetch_array($seek4); if ($seek1['war_target'] > 0 || $seek2['war_target'] > 0) { $war = '<font class="negative">At War</font>'; } else { $war = '<font class="positive">Ok!</font>'; } if ($seek1['war_target'] > 0 || $seek2['war_target'] > 0 || $seek4['bleh'] >= MAX_ALLIANCE_SIZE) { $accept = "<font class=\"negative\">No Merging *</font>"; $show = true; } else { $accept = "<a href='main.php?cat=game&page=resort_tools&tool=mergers&task=accept&mergerid={$value['id']}'>Accept</a>"; } echo "<tr class='data'>\n <th class='bsdown'> {$value['merge_time']} </th>\n <td class='bsdown'> {$value['tribe']} </td>\n <td class='bsdown'> {$value['oldname']}(#{$value['origin']}) </td>\n <td class='bsdown'> {$value['newname']}(#{$value['target']}) </td>\n <td class='bsdown center'> " . $strTmpSignup . " </td>\n <td class='bsdown center'> " . $strTmpYears . " </td>\n <td class='bsdown'> {$war} </td>\n <td class='bsdown'> <a href='main.php?cat=game&page=resort_tools&tool=mergers&task=changename&mergerid={$value['id']}'>Change Name</a><br />\n {$accept}<br />\n <a href='main.php?cat=game&page=resort_tools&tool=mergers&task=decline&mergerid={$value['id']}'>Decline</a>\n </td>\n </tr>"; } echo "</table>"; if (isset($show)) { echo "* = The no merging means that his alliance or the alliance he want to go to is at war, or that the alliance he want to merge to is already at " . MAX_ALLIANCE_SIZE . " tribes.<br />"; } } }
function check_to_update($user) { //========================================================================== // Martel, July 09, 2006 // Use global src object if the source == the tribe triggering this update // (self update) //========================================================================== $objSrcUser =& $GLOBALS["objSrcUser"]; if ($user != $objSrcUser->get_userid()) { $objUser = new clsUser($user); } else { $objUser =& $objSrcUser; } //========================================================================== // Calculate updates owed //========================================================================== $Last_update_hour = $objUser->get_user_info(LAST_UPDATE_HOUR); $Last_update_day = $objUser->get_user_info(LAST_UPDATE_DAY); // $iTribeTick = $objUser->get_user_info(LAST_UPDATE_TICK); $day = date("d"); $hour = date("H"); $month = date("m"); $year = date("y"); $lmonth = $month - 1; if ($day < $Last_update_day) { if ($lmonth == 0) { $lmonth = 12; } if ($lmonth == 1 || $lmonth == 3 || $lmonth == 5 || $lmonth == 7 || $lmonth == 8 || $lmonth == 10 || $lmonth == 12) { $day = $day + 31; } elseif ($lmonth == 2) { if ($year % 4 == 0) { $day = $day + 29; } else { $day = $day + 28; } } elseif ($lmonth == 4 || $lmonth == 6 || $lmonth == 9 || $lmonth == 11) { $day = $day + 30; } } $iUpdatesOwed = ($day - $Last_update_day) * 24 + ($hour - $Last_update_hour); if ($iUpdatesOwed > 36) { $iUpdatesOwed = 36; } $objUser->set_user_info(LAST_UPDATE_DAY, date('d')); $objUser->set_user_info(LAST_UPDATE_HOUR, date('H')); // $objUser->set_user_info(LAST_UPDATE_TICK, $iGameTick); // Preparing for new method to count owed updates include_once 'inc/classes/clsGame.php'; $objGame = new clsGame(); // $iGameTick = $objGame->get_game_time(HOUR_COUNTER); // $iUpdatesOwed = floor($iGameTick - $iTribeTick); //========================================================================== // FORGET UPDATES - setting updatesOwed to 0 is permanent and will be saved // Until the new update system is implemented this is the only feasible way. //========================================================================== if ($objGame->get_game_switch(GLOBAL_PAUSE) == ON) { $iUpdatesOwed = 0; } // Tribes who are either killed, waiting to be reset or paused $strReset = $objUser->get_stat(RESET_OPTION); $blnKilled = $objUser->get_stat(KILLED); $iPaused = $objUser->get_user_info(PAUSE_ACCOUNT); if ($strReset == 'yes' || $blnKilled == 1) { $iUpdatesOwed = 0; } elseif ($iPaused > 0) { // Counter to see how long tribe has left in "forced" protection // Expl: only after these updates a tribe can choose to un-pause $iPaused -= $iUpdatesOwed; if ($iPaused <= 1) { $iPaused = 1; } // Save the last update info $objUser->set_user_info(PAUSE_ACCOUNT, $iPaused); } //========================================================================== // Time to hand out updates... //========================================================================== if ($iUpdatesOwed > 0) { // 6 Week limit for Infinity ORKFiA Martel, July 09, 2006 $iHours = $objUser->get_user_info(HOURS); $objRace = $objUser->get_race(); $intLifespan = $objRace->getLifespan(); // M: Perform near-death updates until the tribe is dead if ($iHours + $iUpdatesOwed > $intLifespan) { include_once 'inc/functions/tribe.php'; $blnReturn = FALSE; // Updates that should be used to determine chance of death $iMaxAfter100Owed = $iHours + $iUpdatesOwed - $intLifespan + $iUpdatesOwed; $iUpdatesAfter100Owed = min($iUpdatesOwed, $iMaxAfter100Owed); // Iterate through each update to see if it's time to die for ($i = 1; $i <= $iUpdatesAfter100Owed; $i++) { // Correct hour of news event $event = $iUpdatesAfter100Owed - $i; $event_time = date(TIMESTAMP_FORMAT, strtotime("-{$event} hours")); $iRand = rand(1, max(1, 24 - $iMaxAfter100Owed)); if ($iRand == 1) { // Give remaining updates to tribe $iUpdatesOwedBeforeDeath = $i + ($iUpdatesOwed - $iUpdatesAfter100Owed); call_update_script($iUpdatesOwedBeforeDeath, $objUser); // For use in Alliance News $iRulerAge = getRulerAge($objUser); $strTribe = $objUser->get_stat(TRIBE); // Code for death due to age $objUser->set_stat(KILLED, 1); obj_kill_user($objUser); // Alliance News $strAlliNews = "<b class=\"negative\">The ruler of " . $strTribe . " has died at an age of " . $iRulerAge . ".</b>"; $iShowAlli = $objUser->get_stat(ALLIANCE); // Tribe News $strTribeNews = "The death of the old and tired tribe ruler comes as " . "no surprise. Most citizens have left the lands, and " . "the leaderless military rampantly plundered what " . "they could. The citizens remaining wish to " . "contribute goods they hid to support your cause." . "<br /><br />" . $strAlliNews . "<br /><br />" . "Below are the news that your previous tribe recieved:"; $blnReturn = TRUE; } else { $strAlliNews = ''; $iShowAlli = ''; $strTribeNews = 'Leader, your age is becoming a problem! The citizens ' . 'are preparing for the worst and your general openly ' . 'disobey you.'; } $strSQL = 'INSERT INTO ' . "news" . ' SET ' . "time" . " = '{$event_time}', " . "type" . " = 'death', " . "duser" . " = {$user}, " . "result" . " = 1, " . "text" . " = '{$strTribeNews}', " . "kingdom_text" . " = '{$strAlliNews}', " . "kingdoma" . " = {$iShowAlli}"; mysql_query($strSQL); if ($blnReturn) { break; } } } // Vacation mode 48 hours (+6 hours enter-phase = 54 hours) if ($iPaused > 0 && $objUser->get_stat(KILLED) == 0) { // (Martel: paused accs will still age - "fair ranking" fix) $iNewHours = $objUser->get_user_info(HOURS) + $iUpdatesOwed; $objUser->set_user_info(HOURS, $iNewHours); // Only "forget" updates while in protection, not during enter-phase // Bug-fix February 27, 2008 Martel if ($iPaused <= 48) { $iUpdatesOwed = 0; } } //====================================================================== // Update Tribe // Martel: Moving this to a separate file - February 27, 2008 //====================================================================== require_once 'inc/functions/update_script.php'; generate_updates($objUser, $iUpdatesOwed); } }
function include_invade2_text() { global $ip; $objSrcUser =& $GLOBALS["objSrcUser"]; $arrSrcUser = $objSrcUser->get_user_infos(); $arrSrcStats = $objSrcUser->get_stats(); //========================================================================== // Secure user input from the invasion form //========================================================================== if (isset($_POST['TrgPlayer']) && !empty($_POST['TrgPlayer']) && $_POST['TrgPlayer'] != 'spacer') { // Selected Target $iTrgUserId = abs(intval($_POST['TrgPlayer'])); } else { echo $strDiv = '<div id="textMedium"><p>' . "Your army walk back to their homes, you should give them a " . "target next time!" . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . "Try Again ?" . "</a>" . '</p></div>'; include_game_down(); exit; } $arrWhite = array('1', '2', '3', '4', '5'); $arrWhite2 = array(1 => 'standard', 'raid', 'barren', 'hitnrun', 'bc'); // Selected Target if (isset($_POST['invade_type']) && in_array($_POST['invade_type'], $arrWhite)) { $iAttack = intval($_POST['invade_type']); } else { echo $strDiv = '<div id="textMedium"><p>' . "Your army walk back to their homes, you should give them a " . "target next time!" . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . "Try Again ?" . "</a>" . '</p></div>'; include_game_down(); exit; } // Army Sent $arrUnitVars = getUnitVariables($arrSrcStats[RACE]); $arrUnitOffence = $arrUnitVars['offence']; $arrUnitVar = $arrUnitVars['variables']; if (isset($_POST["arrArmySent"])) { $arrArmySent = $_POST["arrArmySent"]; foreach ($arrUnitOffence as $i => $iUnitOffence) { if ($iUnitOffence > 0) { $arrArmySent[$arrUnitVar[$i]] = max(0, intval($arrArmySent[$arrUnitVar[$i]])); } else { $arrArmySent[$arrUnitVar[$i]] = 0; } } } //========================================================================== // Verify attacker's status //========================================================================== obj_check_protection($objSrcUser, "invade"); $iTotalSentArmy = array_sum($arrArmySent); if ($iTotalSentArmy < 1) { echo $strDiv = '<div id="textMedium"><p>' . 'Sorry, but you did not send any units to battle.<br />' . 'This attack has been aborted.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . "Try Again ?" . "</a>" . '</p></div>'; include_game_down(); exit; } if (verifyArmyAvailable($objSrcUser, $arrArmySent) == 1) { echo $strDiv = '<div id="textMedium"><p>' . 'Sorry, you do not have that many units to send.<br />' . 'This attack has been aborted.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . "Try Again ?" . "</a>" . '</p></div>'; include_game_down(); exit; } if ($arrSrcStats[RACE] == "Oleg Hai" && verifyArmyAvailableOleg($objSrcUser, $arrArmySent) == 1) { $mercsTrainedThisHour = $objSrcUser->get_army_merc(MERC_T3); echo $strDiv = '<div id="textMedium"><p>' . "Sorry, but you did only train {$mercsTrainedThisHour} " . "mercs this update and that's the maximum you may use for an " . "attack.<br />" . "This attack has been aborted." . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . "Try Again ?" . "</a>" . '</p></div>'; include_game_down(); exit; } if ($arrSrcUser[NEXT_ATTACK] > 0) { echo $strDiv = '<div id="textMedium"><p>' . 'Sorry, but you cannot attack for at least ' . $arrSrcUser[NEXT_ATTACK] . ' more updates.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } if ($arrSrcUser[HOURS] < PROTECTION_HOURS) { echo $strDiv = '<div id="textMedium"><p>' . 'You are not allowed to attack while in protection!' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } //========================================================================== // Verify defender's status //========================================================================== include_once 'inc/functions/update.php'; check_to_update($iTrgUserId); $objTrgUser = new clsUser($iTrgUserId); $arrTrgStats = $objTrgUser->get_stats(); if ($arrTrgStats[ALLIANCE] == $objSrcUser->get_stat(ALLIANCE)) { echo $strDiv = '<div id="textMedium"><p>' . 'Sorry, honor before might. Do not attack into your own alliance.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } elseif ($objTrgUser->get_stat(ALLIANCE) < 11) { echo $strDiv = '<div id="textMedium"><p>' . 'I hope you did not think that you would get away with ' . 'attacking into a staff alliance, did you?' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } // Frost: Added a global protection mode include_once 'inc/classes/clsGame.php'; $objGame = new clsGame(); if ($objGame->get_game_switch(GLOBAL_PROTECTION) == 'on') { echo $strDiv = '<div id="textMedium"><p>' . 'Because of a global event all tribes in ORKFiA are under ' . 'protection. Please check the community forum for an announcement.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } $iTrgHours = $objTrgUser->get_user_info(HOURS); if ($iTrgHours < PROTECTION_HOURS) { $iTrgHoursRemaining = PROTECTION_HOURS - $iTrgHours; echo $strDiv = '<div id="textMedium"><p>' . 'It appears that the tribe you wish to target is still ' . 'materializing. Our general estimates that it will ' . 'take another ' . $iTrgHoursRemaining . ' updates for the area ' . 'to become a stable part of reality.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } if ($objTrgUser->get_stat(ALLIANCE) == 0) { echo $strDiv = '<div id="textMedium"><p>' . 'This player has either been deleted or suspended.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } // Frost: added jan -04 // Martel: updated July 08, 2006 if ($objTrgUser->get_stat(KILLED) == 1 || $objTrgUser->get_stat(RESET_OPTION) == 'yes') { echo $strDiv = '<div id="textMedium"><p>' . 'This tribe is dead.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } // Paused account Martel, July 13, 2006 if ($objTrgUser->isPaused()) { echo $strDiv = '<div id="textMedium"><p>' . 'This tribe is paused.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Return' . '</a>' . '</p></div>'; return; } // Blocking system - AI 11/02/2007 if (!clsBlock::isOpAllowed($objSrcUser, $objTrgUser)) { echo '<div id="textMedium"><p>' . 'Someone else from the same IP has already opped this tribe during the last 8 hours.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">Return</a>' . '</p></div>'; clsBlock::reportOp($objSrcUser, $objTrgUser, 'Attack: ' . $arrWhite2[$iAttack], false); return; } $iTrgLand = $objTrgUser->get_build(LAND); $iSrcLand = $objSrcUser->get_build(LAND); $breakoff = round($iSrcLand * 0.7); // Barren attack has 70% bottom feed limit if smaller than 2000 acres if ($iAttack == ATTACK_BARREN && $iTrgLand <= $breakoff && $iTrgLand < 2000) { echo $strDiv = '<div id="textMedium"><p>' . 'Sorry but you can not bash the small ones. Barren grabs are not ' . 'allowed against smaller tribes unless they are within 70% ' . 'of your own size.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Try Again ?' . '</a>' . '</p></div>'; include_game_down(); exit; } if ($iAttack == ATTACK_HNR && $iTrgLand < $iSrcLand) { echo $strDiv = '<div id="textMedium"><p>' . 'What kind of coward are you who try to make a Hit \'n\' Run ' . 'attack against a smaller tribe?' . '</p><p>' . 'Shame on you!' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Return' . '</a>' . '</p></div>'; include_game_down(); exit; } $quick_check = mysql_query("Select * from user where id = 1"); $quick_check = mysql_fetch_array($quick_check); if ($quick_check[STOPGAMETRIGGER] == 99) { echo $strDiv = '<div id="textMedium"><p>' . 'The game has been paused by staff, possibly due to technical ' . 'maintenance. Please look in the announcements ' . 'forum or the admin game message for more information.' . '</p><p>' . '<a href="main.php?cat=game&page=invade">' . 'Return' . '</a>' . '</p></div>'; include_game_down(); exit; } else { //====================================================================== // Do Battle //====================================================================== /* include the code for the attack about to be done */ include_once "inc/attacks/" . $arrWhite2[$iAttack] . ".php"; // Damadm00 19-03-2004, check here the result from the viking check // Martel: Notify thieves about attack only if not viking+25% luck if ($arrSrcStats[RACE] == 'Viking' && getVikingCheck() == 1) { $viking = 1; } else { $viking = 0; getMonitoringCheck($objSrcUser); } include_once 'inc/functions/military.php'; $defence = getArmyDefence($objTrgUser, $iAttack); $defence = $defence['total_home']; $offence = getSentOffence($objSrcUser, $arrArmySent); //Attacking Templars kills mystics, not thieves - AI $thieves = 'thieves'; if ($objTrgUser->get_stat(RACE) == 'Templar') { $thieves = 'mystics'; } // Eagle 30% auto force retreat feature if ($objTrgUser->get_stat(RACE) == "Eagle" && getEagleCheck() == 1) { doRetreat($objSrcUser, $objTrgUser, $arrArmySent, 1, 0); return; } elseif ($offence < $defence && $iAttack != ATTACK_HNR) { doRetreat($objSrcUser, $objTrgUser, $arrArmySent, 0, $viking); return; } elseif ($offence < $defence && $iAttack == ATTACK_HNR) { if ($offence > 0.5 * $defence) { if ($defence == 0) { $defence = 1; } $arrSrcArmyLost = getSrcLosses($objSrcUser, $arrArmySent, $offence / $defence, $arrWhite2[$iAttack]); $arrTrgArmyLost = getTrgLosses($objTrgUser, $objSrcUser, $offence / $defence, $arrWhite2[$iAttack]); $arrReport = doAttack($objSrcUser, $objTrgUser, $arrArmySent); } else { doRetreat($objSrcUser, $objTrgUser, $arrArmySent, 0, $viking); return; } } else { if ($defence == 0) { $defence = 1; } $arrSrcArmyLost = getSrcLosses($objSrcUser, $arrArmySent, $offence / $defence, $arrWhite2[$iAttack]); $arrTrgArmyLost = getTrgLosses($objTrgUser, $objSrcUser, $offence / $defence, $arrWhite2[$iAttack]); $arrReport = doAttack($objSrcUser, $objTrgUser, $arrArmySent); } // Spread Pestilence $arrSpreadPest = checkPestilence($objSrcUser, $objTrgUser); $pestSrc = $arrSpreadPest['attacker']; $pestTrg = $arrSpreadPest['defender']; //====================================================================== // Begin creating the invade report //====================================================================== $strTribe = stripslashes($objTrgUser->get_rankings_personal(TRIBE_NAME)); $iAlliance = $arrTrgStats[ALLIANCE]; $strReport = '<div id="textMedium">' . '<h2>' . "Invade Report" . '</h2>' . '<p>' . 'Your invasion of <strong>' . $strTribe . ' (#' . $iAlliance . ')</strong> was successful, ' . 'below follows a report from your general.' . '</p>'; //====================================================================== // Report: Gains //====================================================================== // Acres if (isset($arrReport['gained_acres']) && $arrReport['gained_acres'] != 0) { $strReport .= '<p>' . "Our army has gained control over " . "<strong>" . $arrReport['gained_acres'] . " acres</strong>. "; // Explored Acres if (isset($arrReport['explored_acres']) && $arrReport['explored_acres'] != 0) { $strReport .= "Also <strong>" . $arrReport['explored_acres'] . " acres</strong> was " . "explored and can be used to build on now."; } $strReport .= '</p>'; } // Citizens Killed (raid or hnr) if (isset($arrReport['killed_citizens']) && $arrReport['killed_citizens'] != 0) { $strReport .= '<p>' . "Our army storm into their lands, killing <strong>" . $arrReport['killed_citizens'] . "</strong> of their citizens." . '</p>'; } // Money (raid) if (isset($arrReport['gained_crowns']) && $arrReport['gained_crowns'] != 0) { $strReport .= '<p>' . "The army report having stolen <strong class=\"indicator\">" . number_format($arrReport['gained_crowns']) . " crowns</strong>." . '</p>'; } // Buildings Razed (blasphemy crusade) if (isset($arrReport['damaged_total']) && $arrReport['damaged_total'] != 0) { $strReport .= '<p>' . "Your loyal army charges into their lands, destroying <strong>" . $arrReport['damaged_total'] . " buildings</strong> of witchcraft " . "and deception. ("; // Academies if (isset($arrReport['damaged_academies']) && $arrReport['damaged_academies'] != 0) { $strReport .= " <strong>" . $arrReport['damaged_academies'] . " academies</strong>"; } // Guilds if (isset($arrReport['damaged_guilds']) && $arrReport['damaged_guilds'] != 0) { $strReport .= " <strong>" . $arrReport['damaged_guilds'] . " guilds</strong>"; } // Hideouts if (isset($arrReport['damaged_hideouts']) && $arrReport['damaged_hideouts'] != 0) { $strReport .= " <strong>" . $arrReport['damaged_hideouts'] . " hideouts</strong>"; } $strReport .= ').</p>'; } // Thieves Killed (blasphemy crusade) if (isset($arrReport['killed_thieves']) && $arrReport['killed_thieves'] != 0) { $strReport .= '<p>' . "Your general reports having killed <strong>" . $arrReport['killed_thieves'] . " {$thieves} of the enemy</strong>." . '</p>'; } // Fame Gained if (isset($arrReport['gained_fame']) && $arrReport['gained_fame'] != 0) { $strReport .= '<p>' . "This invasion gave our tribe <strong class=\"positive\">" . $arrReport['gained_fame'] . " fame</strong>." . '</p>'; } //====================================================================== // Begin enemy defence estimation (report) //====================================================================== if ($offence > $defence * 2) { $strReport .= '<p>' . "Our army is more than double the power of the " . "defending army, causing the enemy to run in fear. (Victory " . "by more than 100%)" . '</p>'; } elseif ($offence > $defence * 1.8) { $strReport .= '<p>' . "Our army is almost double the power of the defending " . "army. (Victory by more than 80%)" . '</p>'; } elseif ($offence > $defence * 1.6) { $strReport .= '<p>' . "Our army has easily broken the enemies defences, " . "overpowering them by more than 3 to 2. (Victory by more " . "than 60%)" . '</p>'; } elseif ($offence > $defence * 1.4) { $strReport .= '<p>' . "Our army has broken the enemies defences, overpowering " . "them by around 3 to 2. (Victory by more than 40%)" . '</p>'; } elseif ($offence > $defence * 1.2) { $strReport .= '<p>' . "Our army has broken through the line of defence, but it was " . "a hard battle. (Victory by more than 20%)" . '</p>'; } elseif ($offence > $defence * 1.1) { $strReport .= '<p>' . "Our army has broken through the line of defence, but it was " . "a very tough battle. (Victory by more than 10%)" . '</p>'; } elseif ($offence >= $defence) { $strReport .= '<p>' . "Our army fought hard, winning only after a lengthy and very " . "difficult battle. (Victory by less than 10%)" . '</p>'; } //====================================================================== // Report: Army Losses //====================================================================== $arrUnitVars = getUnitVariables($objSrcUser->get_stat(RACE)); $arrUnitNames = $arrUnitVars['output']; $strPlural = 's'; $strReport .= '<p>' . "The captains report that we have lost "; if ($arrSrcArmyLost[UNIT1] > 0) { $strReport .= $arrSrcArmyLost[UNIT1] . " " . $arrUnitNames[2] . $strPlural . ", "; } if ($arrSrcArmyLost[UNIT2] > 0) { if ($arrUnitNames[3] == 'Swordmen') { $strPlural = ''; } elseif ($arrUnitNames[3] == 'Pikemen') { $strPlural = ''; } $strReport .= $arrSrcArmyLost[UNIT2] . " " . $arrUnitNames[3] . $strPlural . ", "; } if ($arrSrcArmyLost[UNIT3] > 0) { if ($arrUnitNames[4] == 'Crossbowmen') { $strPlural = ''; } elseif ($arrUnitNames[4] == 'Longbowmen') { $strPlural = ''; } elseif ($arrUnitNames[4] == 'Mummy') { $arrUnitNames[4] = 'Mummie'; } $strReport .= $arrSrcArmyLost[UNIT3] . " " . $arrUnitNames[4] . $strPlural . ", "; } if ($arrSrcArmyLost[UNIT4] > 0) { if ($arrUnitNames[5] == 'Priestess') { $strPlural = ''; } $strReport .= $arrSrcArmyLost[UNIT4] . " " . $arrUnitNames[5] . $strPlural . ", "; } if ($arrSrcArmyLost[UNIT5] > 0) { if ($arrUnitNames[6] == 'Thief') { $arrUnitNames[6] = 'Thieve'; } $strReport .= $arrSrcArmyLost[UNIT5] . " " . $arrUnitNames[6] . $strPlural . ", "; } if (array_sum($arrSrcArmyLost) < 1) { $strReport .= " no military at all, "; } $totalkilled = round(array_sum($arrTrgArmyLost), -2); if ($totalkilled > 0) { $strReport .= " and they estimate the enemy's losses to be {$totalkilled} units"; if ($objSrcUser->get_stat(RACE) == "Undead") { $strReport .= ", who joined our cursed army as soldiers."; } } else { $strReport .= " and they estimate the enemy's losses to be near zero"; } $strReport .= '.</p>'; //====================================================================== // Report: Army available again //====================================================================== $wait = $objSrcUser->get_user_info(NEXT_ATTACK); $strReport .= '<p>' . "Our generals report our army will be able to attack again " . "in " . $wait . " updates. "; if ($wait > 4) { // Assuming that an attack with more than 4 hours is a BC or Hitnrun $wait -= 2; $strReport .= "However, our army will be home to defend our lands after " . $wait . " updates."; } $strReport .= '</p>'; //====================================================================== // Report: Pestilence //====================================================================== if ($pestSrc == "yes") { $strReport .= '<p>' . "<strong class=\"negative\">During your invasion your military " . "got infected with pestilence.</strong>" . '</p>'; } //====================================================================== // frost: added suicide detection | modified for age 18. only one update // loss of 25% citizens //====================================================================== $suicide = getSuicideCheck($objSrcUser, $arrArmySent); if ($arrSrcStats[RACE] != "Raven" && $suicide == 1) { $citz = $objSrcUser->get_pop(CITIZENS); $leavingCitz = floor($citz * 0.25); $strReport .= '<p>' . "<strong class=\"negative\">Your citizens are getting tired of " . "their tax money going to far-away military campaigns " . "instead of defending their homes. " . number_format($leavingCitz) . " citizens have left your lands.</strong>" . '</p>'; $objSrcUser->set_pop(CITIZENS, $citz - $leavingCitz); } //====================================================================== // Report: Viking Stealth Attack //====================================================================== if ($viking == 1) { $strReport .= '<p>' . "<strong class=\"positive\">You got lucky. Your location " . "doesn't end up in the news.</strong>" . '</p>'; } //====================================================================== // Report: War effects //====================================================================== require_once 'inc/functions/war.php'; $objSrcAlliance = $objSrcUser->get_alliance(); if (checkWarBetween($objSrcAlliance, $objTrgUser->get_stat(ALLIANCE))) { $objTrgAlliance = $objTrgUser->get_alliance(); if ($arrGains = testWarVictory($objSrcAlliance, $objTrgAlliance)) { // Append war-win message require_once 'inc/pages/war_room2.inc.php'; $strReport .= '<p><strong class="positive">Your alliance has won the war!</strong></p>' . getVictoryReport($arrGains); } } $strReport .= '<p>' . '<a href="main.php?cat=game&page=tribe">Continue</a>' . '</p>' . '</div>'; echo $strReport; //====================================================================== // Defender tribe news (damage report) //====================================================================== $srcDisplay = $arrSrcStats[TRIBE] . " (#" . $arrSrcStats[ALLIANCE] . ")"; $trgDisplay = $arrTrgStats[TRIBE] . " (#" . $arrTrgStats[ALLIANCE] . ")"; $strStrategy = $arrWhite2[$iAttack]; switch ($strStrategy) { case "standard": if ($viking == 0) { $strTrgTribe = "<span class=\"positive\">{$srcDisplay} has successfully marched into our lands and conquered " . $arrReport['gained_acres'] . " acres</span>"; $strTrgAlliance = "<span class=\"newsattack\">{$srcDisplay} has successfully marched into the lands of {$trgDisplay} and conquered " . $arrReport['gained_acres'] . " acres</span>"; } else { $strTrgTribe = "<span class=\"positive\">An unidentified tribe of vikings has successfully marched into our lands and conquered " . $arrReport['gained_acres'] . " acres</span>"; $strTrgAlliance = "<span class=\"newsattack\">An unidentified tribe of vikings has successfully marched into the lands of {$trgDisplay} and conquered " . $arrReport['gained_acres'] . " acres</span>"; } break; case "raid": if ($viking == 0) { $strTrgTribe = "<span class=\"positive\">{$srcDisplay} has successfully stormed into our lands and conquered " . $arrReport['gained_acres'] . " acres, stolen " . $arrReport['gained_crowns'] . " crowns and slaughtered " . $arrReport['killed_citizens'] . " citizens</span>"; $strTrgAlliance = "<span class=\"newsattack\">{$srcDisplay} has successfully stormed into the lands of {$trgDisplay} and conquered " . $arrReport['gained_acres'] . " acres, stolen " . $arrReport['gained_crowns'] . " crowns and slaughtered " . $arrReport['killed_citizens'] . " citizens</span>"; } else { $strTrgTribe = "<span class=\"positive\">An unidentified tribe of vikings has successfully stormed into our lands and conquered " . $arrReport['gained_acres'] . " acres, stolen " . $arrReport['gained_crowns'] . " crowns and slaughtered " . $arrReport['killed_citizens'] . " citizens</span>"; $strTrgAlliance = "<span class=\"newsattack\">An unidentified tribe of vikings has Successfully stormed into the lands of {$trgDisplay} and conquered " . $arrReport['gained_acres'] . " acres, stolen " . $arrReport['gained_crowns'] . " crowns and slaughtered " . $arrReport['killed_citizens'] . " citizens</span>"; } break; case "barren": if ($viking == 0) { $strTrgTribe = "<span class=\"newsattack\">{$srcDisplay} has successfully sneaked into our lands and claimed " . $arrReport['gained_acres'] . " acres</span>"; $strTrgAlliance = "<span class=\"newsattack\">{$srcDisplay} has successfully sneaked into the lands of {$trgDisplay} and claimed " . $arrReport['gained_acres'] . " acres</span>"; } else { $strTrgTribe = "<span class=\"newsattack\">An unidentified tribe of vikings has successfully sneaked into our lands and claimed " . $arrReport['gained_acres'] . " acres</span>"; $strTrgAlliance = "<span class=\"newsattack\">An unidentified tribe of vikings has successfully sneaked into the lands of {$trgDisplay} and claimed " . $arrReport['gained_acres'] . " acres</span>"; } break; case "bc": if ($viking == 0) { $strTrgTribe = "<span class=\"newsbc\">{$srcDisplay} has successfully charged into our lands and destroyed " . $arrReport['damaged_total'] . " buildings and killed " . $arrReport['killed_thieves'] . " {$thieves}. Our lands will be avaliable for building again after they have been cleared</span>"; $strTrgAlliance = "<span class=\"newsbc\">{$srcDisplay} has successfully charged into the lands of {$trgDisplay} and destroyed " . $arrReport['damaged_total'] . " buildings and slaughtered " . $arrReport['killed_thieves'] . " {$thieves}</span>"; } else { $strTrgTribe = "<span class=\"newsbc\">An unidentified tribe of vikings has successfully charged into our lands and destroyed " . $arrReport['damaged_total'] . " buildings and killed " . $arrReport['killed_thieves'] . " {$thieves}. Our lands will be avaliable for building again after they have been cleared</span>"; $strTrgAlliance = "<span class=\"newsbc\">An unidentified tribe of vikings has successfully charged into the lands of {$trgDisplay} and destroyed " . $arrReport['damaged_total'] . " buildings and killed " . $arrReport['killed_thieves'] . " {$thieves}</span>"; } break; case "hitnrun": $strAdd = ""; if ($offence >= $defence) { $strAdd = " and " . $arrReport['killed_citizens'] . " citizens"; } if ($viking == 0) { $strTrgTribe = "<span class=\"newsattack\">{$srcDisplay} has cowardly ambushed our lands, killing many troops" . $strAdd . "</span>"; $strTrgAlliance = "<span class=\"newsattack\">{$srcDisplay} has cowardly attacked and rained arrows over {$trgDisplay}, killing many troops" . $strAdd . "</span>"; } else { $strTrgTribe = "<span class=\"newsattack\">An unidentified tribe of vikings has cowardly ambushed our lands, killing many troops" . $strAdd . "</span></span>"; $strTrgAlliance = "<span class=\"newsattack\">An unidentified tribe of vikings has cowardly attacked and rained arrows over {$trgDisplay}, killing many troops" . $strAdd . "</span>"; } break; } $trgId = $objTrgUser->get_userid(); $srcId = $objSrcUser->get_userid(); $trgKd = $objTrgUser->get_stat(ALLIANCE); $srcKd = $objSrcUser->get_stat(ALLIANCE); if ($viking == 0) { $result = "INSERT INTO `news` VALUES ('', NOW(), '{$ip}', '{$strStrategy}', '{$trgId}', '{$srcId}', '1', " . quote_smart($strTrgTribe) . ", " . quote_smart($strTrgAlliance) . ",'{$trgKd}','{$srcKd}',1)"; } else { $result = "INSERT INTO `news` VALUES ('', NOW(), '{$ip}', '{$strStrategy}', '{$trgId}', '{$srcId}', '1', " . quote_smart($strTrgTribe) . ", " . quote_smart($strTrgAlliance) . ",'{$trgKd}',0,1)"; } mysql_query($result); $arrUnitVars = getUnitVariables($objTrgUser->get_stat(RACE)); $arrUnitNames = $arrUnitVars['output']; $strPlural = 's'; $strPlural2 = 's'; $strPlural3 = 's'; $strPlural4 = 's'; $strPlural5 = 's'; if ($arrUnitNames[3] == 'Swordmen') { $strPlural2 = ''; } elseif ($arrUnitNames[3] == 'Pikemen') { $strPlural2 = ''; } if ($arrUnitNames[4] == 'Crossbowmen') { $strPlural3 = ''; } elseif ($arrUnitNames[4] == 'Longbowmen') { $strPlural3 = ''; } elseif ($arrUnitNames[4] == 'Mummy') { $arrUnitNames[4] = 'Mummie'; } if ($arrUnitNames[5] == 'Priestess') { $strPlural4 = 'es'; } if ($arrUnitNames[6] == 'Thief') { $arrUnitNames[6] = 'Thieve'; } $strTrgNews = "A report has been collected, our losses are listed as follows: " . "<br />" . $arrUnitNames[2] . $strPlural . " killed: " . "<span class=\"negative\">" . $arrTrgArmyLost[UNIT1] . "</span>," . "<br />" . $arrUnitNames[3] . $strPlural2 . " killed: " . "<span class=\"negative\">" . $arrTrgArmyLost[UNIT2] . "</span>," . "<br />" . $arrUnitNames[4] . $strPlural3 . " killed: " . "<span class=\"negative\">" . $arrTrgArmyLost[UNIT3] . "</span>," . "<br />" . $arrUnitNames[5] . $strPlural4 . " killed: " . "<span class=\"negative\">" . $arrTrgArmyLost[UNIT4] . "</span>."; //Add mystic losses for templars - AI 24/04/2007 if ($arrTrgArmyLost[UNIT5] > 0) { $strTrgNews .= "<br />" . $arrUnitNames[6] . $strPlural5 . " killed: " . "<span class=\"negative\">" . $arrTrgArmyLost[UNIT5] . "</span>."; } if ($pestTrg == "yes") { $strTrgNews .= "<br />" . "<strong class=\"negative\">" . "During this invasion pestilence " . "was spread into our lands for 12 updates" . "</strong>."; } // create tribe news for attack mysql_query("INSERT INTO `news` (`id`, `time`, `ip`, `type`, `duser`, `ouser`, `result`, `text`, `kingdom_text`) VALUES ('', NOW(), '{$ip}', 'invade report', '{$arrTrgStats['id']}', '{$arrSrcStats['id']}', 1, '{$strTrgNews}', '')"); $orkTime = date(TIMESTAMP_FORMAT); $objTrgUser->set_user_info(LAST_NEWS, $orkTime); // Update target rankings include_once 'inc/functions/update_ranking.php'; doUpdateRankings($objTrgUser, 'yes'); // Log the op for blocking system - AI 11/02/2007 clsBlock::logOp($objSrcUser, $objTrgUser, 'Attack: ' . $arrWhite2[$iAttack]); } }
function get_sponsor_badge($iUserid) { $strImg = ''; // Check if user still exists in the DB $strSQL = "SELECT * FROM " . TBL_USER . " WHERE id = {$iUserid}"; if (mysql_num_rows(mysql_query($strSQL)) > 0) { // Sponsor Dragons $objTmpUser = new clsUser($iUserid); $strUsername = $objTmpUser->get_user_info(USERNAME); $resSQL = mysql_query("SELECT item_number as rank, quantity, option_selection1 as username, unix_timestamp, payment_gross as money FROM phpsuppo_3.paypal WHERE (item_name = 'One Week Sponsorship' OR item_name = 'Three Months Sponsorship') AND option_selection1 = '{$strUsername}' AND payment_status = 'Completed' ORDER BY unix_timestamp DESC LIMIT 1"); $arrPayPal = mysql_fetch_array($resSQL); $iRows = mysql_num_rows($resSQL); if ($iRows == 1) { $strRank = $arrPayPal['rank']; include_once 'inc/pages/sponsors.inc.php'; if (check_valid_sponsor($arrPayPal)) { $strPic = explode(" ", $strRank); $strPic = $strPic[1] . "_" . $strPic[0]; $strImg = HOST_PICS . strtolower($strPic) . '.gif'; $strImg = '<img src="' . $strImg . '" alt="' . $strRank . '" border="0">'; } } } return $strImg; }