$curr_attacker->increaseExperience($attacker_damage * 0.05); } else { $attacker_msg[] = '<span style="color:yellow;">' . $curr_attacker->getPlayerName() . '</span> does absolutely no damage this round. Send the worthless lout back to the academy!'; } $attacker_team_damage += $attacker_damage; $attacker_total_msg[] = $attacker_msg; //reset damage for each person and the array $attacker_damage = 0; $attacker_msg = array(); $curr_attacker->update(); $curr_attacker_ship->update_hardware(); } // recalc forces expiration date $forces->updateExpire(); // update forces $forces->update(); // echo the overall damage if ($attacker_team_damage > 0) { $attacker_msg[] = '<br>This team does a total of <span style="color:red;">$attacker_team_damage</span> damage in this round of combat.'; } else { $attacker_msg[] = '<br>This team does no damage at all. You call that a team? They need a better recruiter.'; } $attacker_total_msg[] = $attacker_msg; // info for the next page $container['force_msg'] = $force_msg; $container['attacker_total_msg'] = $attacker_total_msg; transfer('owner_id'); SmrPlayer::refreshCache(); SmrShip::refreshCache(); SmrForce::refreshCache(); forward($container);
function clearCaches() { SmrSector::clearCache(); SmrPlayer::clearCache(); SmrShip::clearCache(); SmrForce::clearCache(); SmrPort::clearCache(); }
function channel_msg_op_info($fp, $rdata, $account, $player) { if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s(.*)\\s:!op info\\s$/i', $rdata, $msg)) { $nick = $msg[1]; $user = $msg[2]; $host = $msg[3]; $channel = $msg[4]; echo_r('[OP_INFO] by ' . $nick . ' in ' . $channel); // get the op from db $db = new SmrMySqlDatabase(); $db->query('SELECT time FROM alliance_has_op WHERE alliance_id = ' . $player->getAllianceID() . ' AND game_id = ' . $player->getGameID()); if (!$db->nextRecord()) { fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', your leader has not scheduled an OP.' . EOL); return true; } // retrieve values $op_time = $db->getField('time'); // check that the op is in the future if ($op_time < time()) { fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', sorry. You missed the OP.' . EOL); return true; } // announce time left fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', the next scheduled op will be in ' . format_time($op_time - time()) . EOL); // have we signed up? $db->query('SELECT response FROM alliance_has_op_response WHERE alliance_id = ' . $player->getAllianceID() . ' AND game_id = ' . $player->getGameID() . ' AND account_id = ' . $player->getAccountID()); if ($db->nextRecord()) { switch ($db->getField('response')) { case 'YES': // get uncached ship $ship =& SmrShip::getShip($player, true); $op_turns = $player->getTurns() + floor(($op_time - $player->getLastTurnUpdate()) * $ship->getRealSpeed() / 3600); $msg = 'You are on the YES list and you will have '; if ($op_turns > $player->getMaxTurns()) { $msg .= 'max turns by then. If you do not move you\'ll waste ' . ($op_turns - $player->getMaxTurns()) . ' turns.'; } else { $msg .= $op_turns . ' turns by then.'; } fputs($fp, 'PRIVMSG ' . $channel . ' :' . $msg . EOL); break; case 'NO': fputs($fp, 'PRIVMSG ' . $channel . ' :You are on the NO list.' . EOL); break; case 'MAYBE': fputs($fp, 'PRIVMSG ' . $channel . ' :You are on the MAYBE list.' . EOL); break; } } else { fputs($fp, 'PRIVMSG ' . $channel . ' :You have not signed up for this one.' . EOL); } return true; } return false; }