$db->query("UPDATE player SET experience = experience + {$gained_exp} WHERE account_id = {$killer_id} AND game_id = {$player->game_id}"); if ($debug) { print "defender xp<br>"; } $percentage = 20 + ($killed->level_id - $killer->level_id) / 2; if ($percentage > 0) { $killed_exp = round($killed->experience * $percentage / 100); $db->query("UPDATE player SET experience = experience - {$killed_exp} WHERE account_id = {$killed_id} AND game_id = {$player->game_id}"); } else { $killed_exp = 0; } if ($debug) { print "hof stats<br>"; } // update his stats $killer->update_stat("kills", 1); $killer->update_stat("kill_exp", $gained_exp); $killer->update_stat("traders_killed_exp", $killed->experience); if ($debug) { print "alliance updating stats<br>"; } //update alliance vs alliance $db->query("SELECT * FROM alliance_vs_alliance WHERE alliance_id_1 = {$killer->alliance_id} AND " . "alliance_id_2 = {$killed->alliance_id} AND game_id = {$killer->game_id}"); if ($db->next_record()) { $db->query("UPDATE alliance_vs_alliance SET kills = kills + 1 " . "WHERE game_id = {$killer->game_id} AND " . "alliance_id_1 = {$killer->alliance_id} AND " . "alliance_id_2 = {$killed->alliance_id}"); } else { $db->query("REPLACE INTO alliance_vs_alliance (game_id, alliance_id_1, alliance_id_2, kills) " . "VALUES ({$killer->game_id}, {$killer->alliance_id}, {$killed->alliance_id}, 1)"); } if ($debug) { print "alliance kills<br>"; }
} // add this to the outgoing message array $damage_msg[] = $msg . "."; } // end of 'do we have drones?' // print the overall damage if ($attacker_damage > 0) { // is port taken? if ($port->shields == 0 && $port->drones == 0 && $port->armor == 0) { $damage_msg[] = "Port defenses are <span style=\"color:red;\">DESTROYED!</span>"; //$damage_msg[] = "<br>Start<br>"; //itterate through since the last port reset $db->query("SELECT * FROM player_attacks_port WHERE game_id = " . SmrSession::$game_id . " AND sector_id = {$sector->sector_id} AND time < {$port->refresh_defense}"); while ($db->next_record()) { $update_attacker = new SMR_PLAYER($db->f("account_id"), SmrSession::$game_id); $update_attacker->update_stat("port_raids", 1); $update_attacker->update_stat("port_raid_levels", $db->f("level")); $port_original_level = $db->f("level"); $db2->query("DELETE FROM player_attacks_port WHERE game_id = " . SmrSession::$game_id . " AND sector_id = {$sector->sector_id} AND account_id = {$update_attacker->account_id}"); } // Attacker gets the port's money $curr_attacker->credits += $port->credits; $damage_msg[] = "<span style=\"color:yellow;\">{$curr_attacker->player_name}</span> claims <span style=\"color:yellow;\">{$port->credits}</span> credits."; $port->credits = 0; // news message if ($player->alliance_id != 0) { $attack_news = "Members of {$player->alliance_name}"; } else { $attack_news = $player->get_colored_name(); } $news_message = "{$attack_news} successfully raided the port located in sector {$player->sector_id}";
} // get values from container $amount = $var["amount"]; $account_id = $var["account_id"]; if (!$amount) { create_error("You must enter an amount"); } if ($amount < 0) { create_error("You must enter a positive amount"); } // take the bounty from the cash $player->credits -= $amount; $player->update(); $db2 = new SmrMySqlDatabase(); $db->query("SELECT * FROM bounty " . "WHERE game_id = {$player->game_id} AND " . "account_id = {$account_id} AND " . "claimer_id = 0 AND " . "type = '{$type}' LIMIT 1"); $time = time(); if ($db->nf()) { $db->next_record(); //$days = ($time - $db->f("time")) / 60 / 60 / 24; //$curr_amount = $db->f("amount") * pow(1.05,$days); $curr_amount = $db->f("amount"); $new_amount = $curr_amount + $amount; $db2->query("UPDATE bounty SET amount = {$new_amount}, time = {$time} WHERE game_id = {$player->game_id} AND account_id = {$account_id} AND claimer_id = 0 AND type = '{$type}'"); //print("Added bounty....$curr_amount + $amount<br>UPDATE bounty SET amount = $new_amount, time = $time WHERE game_id = $player->game_id AND account_id = $account_id AND type = '$type'"); } else { $db->query("INSERT INTO bounty (account_id, game_id, bounty_id, type, claimer_id, amount, time) VALUES ({$account_id}, {$player->game_id}, NULL, '{$type}' , 0, {$amount}, {$time})"); //print("First<br>INSERT INTO bounty (account_id, game_id, bounty_id, type, claimer_id, amount, time) VALUES ($account_id, $player->game_id, $bounty_id, '$type' , 0, $amount, $time)"); } $placed = new SMR_PLAYER($account_id, $player->game_id); $placed->update_stat("bounty_amount_on", $amount); forward($container);