Ejemplo n.º 1
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) {
     $target_email_msg = "{$attacker_id} has used {$article} {$item->getName()} on you at {$today} and caused you to {$result}.";
Ejemplo n.º 2
0
         // *** DEFENDER KILLS ATTACKER! ***
         $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) {
Ejemplo n.º 3
0
                                 // *** 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";
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
 }
 if (getHealth($username) <= 0) {
Ejemplo n.º 4
0
<?php

require_once "../Utilities/functions.php";
error_reporting(E_ALL);
ini_set('display_errors', 1);
session_start();
header("Access-Control-Allow-Origin: *");
$cmd = getValue("cmd");
if ($cmd == "addGold") {
    $response = addGold();
    header('Content-type: application/json');
    echo json_encode($response);
} else {
    echo "\n  <html>\n    <body>\n      <h1>API</h1>\n      <ul>\n        <li>\n          <h2>command_name</h2>\n\n          <h3>Parameters:</h3>\n          <ul>\n            <li>parameter</li>\n            <li>parameter</li>\n            <li>...</li>\n          </ul>\n\n          <h3>Returns:</h3>\n          <p>desritpion of return value</p>\n\n          <h3>Example:</h3>\n          <p><a href='finename.php?query_string'>query_string</a></p>\n          <pre>\n            returned json\n          </pre>\n        </li>\n      </ul>\n    </body>\n  </html>\n  ";
}
function addGold()
{
    $response = getSessionValue("totalGold", 0);
    $addThis = getValue("gold");
    $response = $response + $addThis;
    setSessionValue("totalGold", $response);
    return $response;
}
Ejemplo n.º 5
0
  "Place your bet, call the coin in the air, and let's see who's lucky today!"
</div>

<hr>

<?php 
$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";
Ejemplo n.º 6
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;
}
Ejemplo n.º 7
0
<?php 
$work_multiplier = 30;
$description2 = "<div class=\"description\">\n" . "On your way back from the fields, you pass by a few young children " . "chasing grasshoppers in the tall grass.\n" . "<br><br>\n" . "The foreman hands you a small pouch of gold as he says " . "\"Care to put a little more work in? I'll keep paying you.\"\n" . "</div>\n";
$description1 = "<div class=\"description\">\n" . "On your way to the foreman's office, you pass by several workers " . "drenched in sweat from working in the heat all day.\n" . "<br><br>\n" . "The foreman barely looks up at you as he busies himself with paperwork " . "and a cigarette. \"So, how much work can we expect from you?\"\n" . "</div>\n";
$description = $description1;
$worked = intval(in('worked'));
if ($worked > 0) {
    $turns = getTurns($username);
    $gold = getGold($username);
    if ($worked > $turns) {
        $description .= "You have chosen to do more work than turns you have.<br>\n";
    } else {
        $new_gold = $worked * $work_multiplier;
        // *** calc amount worked ***
        $gold = addGold($username, $new_gold);
        $turns = subtractTurns($username, $worked);
        $description = $description2 . "You have worked for {$worked} turns and earned {$new_gold} gold.<br><br>\n";
    }
}
echo $description;
echo "<p>";
echo "You can earn money by working in the Village<br>\n";
echo "Village work will exchange turns for gold.<br>\n";
echo "The current work exchange rate: 1 Turn = " . $work_multiplier . " Gold.<br>\n";
echo "Work in the Village?<br>\n";
echo "<form id=\"work\" action=\"work.php\" method=\"post\" name=\"work\">\n";
echo "<div>\n";
echo "<input id=\"worked\" type=\"text\" size=\"3\" maxlength=\"3\" name=\"worked\" class=\"textField\">\n";
echo "<input id=\"workButton\" type=\"submit\" value=\"Turns\" name=\"workButton\" class=\"formButton\">\n";
echo "</div>\n";