Пример #1
0
             if ($turns_change > 0) {
                 echo "{$target}'s turns increased by {$turns_change}.<br>\n";
             }
         }
     }
 }
 if (!$victim_alive) {
     // Target was killed by the item.
     if (getStatus($username) && $target != $username) {
         // *** SUCCESSFUL KILL ***
         $attacker_id = $status_array['Stealth'] ? "A Stealthed Ninja" : $username;
         if (!$gold_mod) {
             $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 {$article} {$item->getName()}!<br>\n";
         echo "You receive {$loot} gold from {$target}.<br>\n";
         runBountyExchange($username, $target);
         //Rewards or increases bounty.
     } else {
         $loot = 0;
         echo "You have comitted suicide!<br>\n";
     }
     send_kill_mails($username, $target, $attacker_id, $article, $item->getName(), $today, $loot);
 } else {
     $attacker_id = $username;
 }
 if ($target != $username) {
Пример #2
0
         $defenderKillpoints = 1;
         if ($duel) {
             // *** if they were dueling when they died ***
             $duel_log_msg = "{$username} has dueled {$attackee} and lost at {$today}.";
             sendMessage("SysMsg", "SysMsg", $duel_log_msg);
             sendLogOfDuel($username, $attackee, 0, $killpoints);
             // *** Makes a loss in the duel log. ***
         }
         addKills($attackee, $defenderKillpoints);
         // *** Adds a kill for the defender. ***
         subtractStatus($username, STEALTH + POISON + FROZEN + CLASS_STATE);
         if (!$simultaneousKill) {
             $loot = round($gold_mod * getGold($username));
             //Loot for defender if he lives.
             addGold($attackee, $loot);
             subtractGold($username, $loot);
         }
         $attackee_msg = "<div class='ninja-notice'>\n\t\t\t\tYou have killed {$username} in combat and taken {$loot} gold on {$today}.\n\t\t\t\t</div>";
         $attacker_msg = "DEATH: You have been killed by {$attackee} in combat and lost {$loot} gold on {$today}!";
         sendMessage($username, $attackee, $attackee_msg);
         sendMessage($attackee, $username, $attacker_msg);
         echo "<div class='ninja-error'>{$attackee} has killed you!</div>\n";
         echo "<div class='ninja-notice'>\n\t\t\t\tYou have been slain!  Go to the <a href=\"shrine.php\">Shrine</a> to return to the living.<br>\n\t\t\t\t</div>\n";
         if (!$simultaneousKill) {
             echo "{$attackee} has taken {$loot} gold from you.<br>\n";
         }
     }
     // *** END MAIN ATTACK AND DUELING SECTION ***
 }
 if (!$duel && getHealth($username) > 0 && getHealth($attackee) > 0) {
     // *** After any partial attack. ***
Пример #3
0
    if ($command == "Bribe") {
        switch (true) {
            case $bribe <= getGold($username) && $bribe > 0:
                subtractGold($username, $bribe);
                subtractBounty($username, $bribe / 2);
                $location = "Behind the Doshin Office";
                $description = "\"We'll see what we can do,\" one of the Doshin tells you as you hand off your gold. He then directs you out through a back alley.\n" . "<br><br>\n" . "You find yourself in a dark alley. A rat scurries by. To your left lies the main street of the village.\n";
                $quickstat = "player";
                break;
            case $bribe < 0:
                // A negative bribe was put in, which on the 21st of March, 2007, was a road to instant wealth, as a bribe of -456345 would increase both your bounty and your gold by 456345, so this will flag players as bugabusers until it becomes a standard-use thing.
                if (getGold($username) > 1000) {
                    $bountyGoesToNearlyZero = getBounty($username) * 0.7;
                    subtractBounty($username, $bountyGoesToNearlyZero);
                }
                subtractGold($username, floor(getGold($username) * 0.8));
                //Takes away 80% of the players gold.
                $location = "The Rat-infested Alley behind the Doshin Office";
                $description = "\"Trying to steal from the Doshin, eh!\" one of the men growls.<br>Where before there were only relaxing men idly ignoring their duties there are now unsheathed katanas and glaring eyes.<br>A group of the Doshin advance on you before you can escape and proceed to rough you up with fists and the hilts of their katana.  Finally, they take most of your gold and toss you into the alley behind the building.\n" . "<br><br>\n" . "Bruised and battered, you find yourself in a dark alley. A rat scurries by. To your left lies the main street of the village.\n";
                $quickstat = "player";
                break;
            default:
                echo "The Doshin ignore your ill-funded attempt to bribe them.\n";
                break;
        }
    }
}
echo "<div class=\"brownTitle\">{$location}</div>\n";
echo "<div class=\"description\">\n";
echo $description;
echo "</div>\n";
Пример #4
0
             }
         } else {
             // Normal attack on a single thief.
             echo "Thief sees you and prepares to defend!<br><br>\n";
             echo "<img src=\"images/characters/thief.png\" alt=\"Thief\">\n";
             $thief_attack = rand(0, 35);
             // *** Thief Damage  ***
             if (!subtractHealth($username, $thief_attack)) {
                 echo "Thief has slain you!<br>\n";
                 echo "Go to the <a href=\"shrine.php\">shrine</a> to resurrect.<br>\n";
             } else {
                 $thief_gold = rand(0, 40);
                 // *** Thief Gold ***
                 if ($thief_attack > 30) {
                     echo "Thief escaped and stole {$thief_gold} pieces of your gold!\n";
                     subtractGold($username, $thief_gold);
                 } else {
                     if ($thief_attack < 30) {
                         echo "The Thief is injured!<br>\n";
                         echo "Thief does {$thief_attack} points of damage!<br>\n";
                         echo "You have gained {$thief_gold} gold.<br> You have found a Shuriken on the thief!\n";
                         addGold($username, $thief_gold);
                         addItem($username, 'Shuriken', $quantity = 1);
                     }
                 }
                 echo "<br>\n";
                 echo "Beware the Ninja Thieves, they have entered this world to steal from all!<br>\n";
             }
         }
     }
 }
Пример #5
0
if (!$quantity || $quantity < 1) {
    $quantity = 1;
} else {
    if ($quantity > 1 && $item != "Shuriken") {
        $grammar = "s";
    }
}
$item_costs = array("Speed Scroll" => 225, "Fire Scroll" => 175, "Stealth Scroll" => 150, "Ice Scroll" => 125, "Shuriken" => 50);
if ($in_purchase == 1) {
    $current_item_cost = either($item_costs[$item], 0);
    $current_item_cost *= $quantity;
    if ($current_item_cost > $gold) {
        // Not enough gold.
        $description .= "<p>\"The total comes to {$current_item_cost} gold,\" the shopkeeper tells you.</p>";
        $description .= "<p>Unfortunately, you do not have that much gold.</p>";
    } else {
        // Has enough gold.
        addItem($username, $item, $quantity);
        $description .= "<p>The shopkeeper hands over {$quantity} " . $item . $grammar . ".</p>";
        $description .= "<p>\"Will you be needing anything else today?\" he asks you as he puts your gold in a safe.</p>";
        subtractGold($username, $current_item_cost);
    }
} else {
    // Default, before anything has been bought.
    $description .= "<p>You enter the village shop and the shopkeeper greets you with a watchful eye.</p>";
    $description .= "<p>As you browse his wares he says, \"Don't try anythin' you'd regret.\" and grins.</p>";
}
$parts = get_certain_vars(get_defined_vars(), array());
echo render_template('shop.tpl', $parts);
// Non-logged in template.
include SERVER_ROOT . "interface/footer.php";
Пример #6
0
$bet = intval(in('bet'));
$reward = "Fire Scroll";
echo "Welcome to the Casino, {$username}!<br>\n";
echo "<form id=\"coin_flip\" action=\"casino.php\" method=\"post\" name=\"coin_flip\">\n";
if ($bet >= 5 && $bet <= 1000) {
    if ($bet <= getGold($username)) {
        $answer = rand(1, 2);
        if ($answer == 1) {
            echo "<div class='ninja-notice'>You win!</div>\n";
            addGold($username, $bet);
            if ($bet == 1000) {
                addItem($username, $reward, 1);
            }
        } else {
            if ($answer == 2) {
                echo "<div class='ninja-notice'>You lose!</div>\n";
                subtractGold($username, $bet);
            }
        }
        echo "<br><a href=\"casino.php\">Try Again?</a><br>\n";
    } else {
        echo "You do not have that much gold.<br>\n";
    }
} else {
    echo "The minimum bet at this table is 5 gold.<br>\n";
    echo "The maximum bet at this table is 1,000 gold.<br>\n";
}
echo "Bet: <input id=\"bet\" type=\"text\" size=\"3\" maxlength=\"4\" name=\"bet\" class=\"textField\">\n";
echo "&nbsp;&nbsp;<input type=\"submit\" value=\"Place bet\" class=\"formButton\"><br>\n";
echo "Current Gold: " . getGold($username) . "<br>\n";
include SERVER_ROOT . "interface/footer.php";
Пример #7
0
 /**
  * Command for a user to reduce their bounty by paying their own gold
  *
  * @param bribe int The amount to spend on reducing bounty
  * @return Array
  */
 public function bribe()
 {
     $bribe = intval(in('bribe'));
     $error = 0;
     $quickstat = false;
     if ($bribe <= get_gold($this->sessionData['char_id']) && $bribe > 0) {
         subtract_gold($this->sessionData['char_id'], $bribe);
         subtractBounty($this->sessionData['char_id'], $bribe / 2);
         $location = 1;
         $quickstat = 'player';
     } else {
         if ($bribe < 0) {
             // Was a bug, now the doshin beats you up!  Yay!
             if (get_gold($this->sessionData['char_id']) > 1000) {
                 //  *** If they have more than 1000 gold, their bounty will be mostly removed by this event.
                 $bountyReduction = getBounty($this->sessionData['char_id']) * 0.7;
                 subtractBounty($this->sessionData['char_id'], $bountyReduction);
             }
             subtractGold($this->sessionData['username'], floor(getGold($this->sessionData['username']) * 0.8));
             //Takes away 80% of the players gold.
             $location = 2;
             $quickstat = 'player';
         } else {
             $location = 0;
             $error = 5;
         }
     }
     return $this->render(['error' => $error, 'quickstat' => $quickstat, 'location' => $location, 'command' => 'bribe']);
 }
Пример #8
0
            }
        } else {
            echo "You cannot heal with zero gold.<br>\n";
        }
    } else {
        echo "You must resurrect before you can heal.<br>\n";
    }
} else {
    if ($poisoned == 1) {
        //  *** POISON SECTION ***
        if (getHealth($username) > 0) {
            $cost = 50;
            //  the cost of curing poison is set here.
            if ($startingGold >= $cost) {
                if (getStatus($username) && $status_array['Poison']) {
                    subtractGold($username, $cost);
                    subtractStatus($username, POISON);
                    echo "You have been cured!<br>\n";
                } else {
                    echo "You are not ill.<br><br>\n";
                }
            } else {
                echo "You need more gold to remove poison.<br>\n";
            }
        } else {
            echo "You must resurrect before you can heal.<br>\n";
        }
    }
}
?>
</div> <!-- End of heal-result div -->
Пример #9
0
function takeGold($from, $to, $mod)
{
    global $sql;
    $victim_gold = getGold($from);
    $gold_change = round($victim_gold * $mod);
    $gold_change = $gold_change < 0 ? 0 : $gold_change;
    addGold($to, $gold_change);
    subtractGold($from, $gold_change);
    echo "{$to} has acquired {$gold_change} gold from {$from}.<br>\n";
    return $gold_change;
}