echo $result; if (!$victim_alive) { if ($target != $username) { $gold_mod = 0.15; $loot = round($gold_mod * getGold($target)); subtractGold($target, $loot); addGold($username, $loot); addKills($username, 1); echo "You have killed {$target} with {$command}!<br>\n"; echo "You receive {$loot} gold from {$target}.<br>\n"; $added_bounty = floor($level_check / 5); if ($added_bounty > 0) { addBounty($username, $added_bounty * 25); echo "Your victim was much weaker than you. The townsfolk are angered. A bounty of " . $added_bounty * 25 . " gold has been placed on your head!<br>\n"; } else { if ($bounty = rewardBounty($username, $target)) { echo "You have received the {$bounty} gold bounty on {$target}'s head for your deeds!<br>\n"; $bounty_msg = "You have valiantly slain the wanted criminal, {$target}! For your efforts, you have been awarded {$bounty} gold!"; sendMessage("Village Doshin", $username, $bounty_msg); } } $target_message = "{$attacker_id} has killed you with {$command} on {$today} and taken {$loot} gold."; sendMessage($attacker_id, $target, $target_message); $attacker_message = "You have killed {$target} with {$command} on {$today} and taken {$loot} gold."; sendMessage($target, $username, $target_message); } else { $loot = 0; echo "You have comitted suicide!<br>\n"; } } $turns_to_take = $turns_to_take - $turn_cost;
function runBountyExchange($username, $defender) { // Bounty Increase equation: attacker'slevel-defender'slevel/5,roundeddown,times25goldperpoint $levelRatio = floor((getLevel($username) - getLevel($defender)) / 5); if ($levelRatio > 0) { $bountyIncrease = $levelRatio * 25; } else { $bountyIncrease = 0; } $bountyForAttacker = rewardBounty($username, $defender); //returns a value if bounty rewarded. if ($bountyForAttacker) { echo "You have received the {$bountyForAttacker} gold bounty on {$defender}'s head for your deeds!<br>\n"; $bounty_msg = "You have valiantly slain the wanted criminal, {$defender}! For your efforts, you have been awarded {$bountyForAttacker} gold!"; sendMessage("Village Doshin", $username, $bounty_msg); } else { if ($bountyIncrease > 0) { addBounty($username, $bountyIncrease); echo "Your victim was much weaker than you. The townsfolk are angered. A bounty of " . $bountyIncrease . " gold has been placed on your head!<br>\n"; } } }
$loot = 0; $suicided = true; } else { // Attacker killed someone else. $killed_target = true; $gold_mod = 0.15; $loot = round($gold_mod * get_gold($target->id())); subtract_gold($target->id(), $loot); add_gold($char_id, $loot); addKills($char_id, 1); $added_bounty = floor($level_check / 5); if ($added_bounty > 0) { addBounty($char_id, $added_bounty * 25); } else { // Can only receive bounty if you're not getting it on your own head. if ($bounty = rewardBounty($char_id, $target->vo->player_id)) { $bounty_msg = "You have valiantly slain the wanted criminal, {$target}! For your efforts, you have been awarded {$bounty} gold!"; sendMessage('Village Doshin', $username, $bounty_msg); } } $target_message = "{$attacker_id} has killed you with {$command} and taken {$loot} gold."; send_event($attacker_char_id, $target->id(), $target_message); $attacker_message = "You have killed {$target} with {$command} and taken {$loot} gold."; sendMessage($target->vo->uname, $username, $attacker_message); } } $turns_to_take = $turns_to_take - $turn_cost; if (!$covert && $player->hasStatus(STEALTH)) { $player->subtractStatus(STEALTH); $destealthed = true; }
function runBountyExchange($username, $defender) { // *** BOUNTY EQUATION *** $user_id = get_user_id($username); $defender_id = get_user_id($defender); // *** Bounty Increase equation: (attacker's level - defender's level) / an increment, rounded down *** $levelRatio = floor((getLevel($user_id) - getLevel($defender_id)) / 10); $bountyIncrease = min(25, max($levelRatio * 25, 0)); //Avoids negative increases, max of 30 gold, min of 0 $bountyForAttacker = rewardBounty($user_id, $defender_id); //returns a value if bounty rewarded. if ($bountyForAttacker) { // *** Reward bounty whenever available. *** return "You have received the {$bountyForAttacker} gold bounty on {$defender}'s head for your deeds!"; $bounty_msg = "You have valiantly slain the wanted criminal, {$defender}! For your efforts, you have been awarded {$bountyForAttacker} gold!"; sendMessage("Village Doshin", $username, $bounty_msg); } else { if ($bountyIncrease > 0) { // *** If Defender has no bounty and there was a level difference. *** addBounty($user_id, $bountyIncrease); return "Your victim was much weaker than you. The townsfolk are angered. A bounty of {$bountyIncrease} gold has been placed on your head!"; } else { return null; } } }