Beispiel #1
0
// *** ********* GET VARS FROM POST - OR GET ************* ***
$attacked = in('attacked');
// boolean for attacking again
$target = $attackee = either(in('target'), in('attackee'));
$username = get_username();
// Pulls from an internal source.
$attacker = $username;
// *** Target's stats. ***
$attackee_health = getHealth($target);
$attackee_level = getLevel($target);
$attackee_str = getStrength($target);
$attackee_status = getStatus($target);
// *** Attacker's stats. ***
$attacker_health = getHealth($username);
$attacker_level = getLevel($username);
$user_turns = getTurns($username);
$attacker_str = getStrength($username);
$attacker_status = getStatus($username);
$class = getClass($username);
// *** Attack System Initialization ***
$starting_attackee_health = $attackee_health;
$starting_turns = $user_turns;
$killpoints = 0;
// *** Starting state for killpoints. ***
$attack_turns = 1;
// *** Default cost, will go to zero if an error prevents combat. ***
$required_turns = $attack_turns;
$level_check = $attacker_level - $attackee_level;
$what = "";
// *** This will be the attack type string, e.g. "duel". ***
$loot = 0;
Beispiel #2
0
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with pFrog; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

*******************************************************************************/
require_once 'includes/common.php';
$title = "index";
require_once "includes/widgets/header.php";
$sql = "SELECT `id`, `username`, `registered`, `gold` FROM `users`";
$result = $db->query($sql);
while ($currentUser = $result->fetchRow()) {
    $turns = getTurns($currentUser['username']);
    $ranking = intval($turns['total'] * $currentUser['gold'] / 10000);
    $currentUser['ranking'] = $ranking;
    $leader_array[] = $currentUser;
}
$ranking = array();
foreach ($leader_array as $key => $row) {
    $ranking[$key] = $row['ranking'];
}
array_multisort($ranking, SORT_DESC, $leader_array);
startBox("About the leaderboard", BOX_YELLOW);
echo "This is a list of the current 30 best players, ordered by ";
popup("ranking", "help.php?topic=rankings");
echo ". There are proberbly lots of other players, but they dont qualify for the leaderboard, yet.";
echo "<br /><br />";
stopBox(BOX_YELLOW);
Beispiel #3
0
                 }
             }
         }
     }
 }
 if ($result) {
     // *** Message to display based on item type ***
     if ($item->getTargetDamage() > 0) {
         echo "{$target} takes {$item->getTargetDamage()} damage from your attack!<br><br>\n";
     } else {
         if ($item === $dimMak) {
             echo "The life force drains from {$target} and they drop dead before your eyes!.<br>\n";
         } else {
             if ($turns_change <= 0) {
                 echo "{$target}'s turns reduced by " . (0 - $turns_change) . ".<br>\n";
                 if (getTurns($target) <= 0) {
                     //Message when a target has no more turns to ice scroll away.
                     echo "{$target} no longer has any turns.<br>\n";
                 }
             } else {
                 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;
Beispiel #4
0
    $link_back = "<a href=\"player.php?player={$target}\">Player Detail</a>";
} else {
    $target = $username;
    $link_back = "<a href=\"skills.php\">Skills</a>";
}
$user_ip = $_SESSION['ip'];
$username_status = getStatus($username);
$class = getClass($username);
$target_hp = getHealth($target);
$target_ip = $sql->QueryItem("SELECT ip FROM players WHERE uname = '{$target}'");
$target_turns = $sql->QueryItem("SELECT turns FROM players WHERE uname = '{$target}'");
$level = getLevel($username);
$covert = false;
$victim_alive = true;
$attacker_id = $username;
$starting_turns = getTurns($username);
$ending_turns = null;
$level_check = $level - getLevel($target);
if ($username_status && $status_array['Stealth']) {
    $attacker_id = "A Stealthed Ninja";
}
// TODO: Make attackLegal use self_use param.
// TODO: Make attackLegal also check that the skill can be used on an outside target.
// *** Checks the skill use legality, as long as the target isn't self.
$params = array('required_turns' => $turn_cost, 'ignores_stealth' => $ignores_stealth, 'self_use' => $self_use);
$AttackLegal = new AttackLegal($username, $target, $params);
$attack_allowed = $AttackLegal->check();
$attack_error = $AttackLegal->getError();
if ($attack_error) {
    // Use AttackLegal if not attacking self.
    echo "<div class='ninja-notice'>{$attack_error}</div>";
Beispiel #5
0
$private = true;
$quickstat = "player";
$page_title = "NPC Battle Status";
include SERVER_ROOT . "interface/header.php";
?>

<span class="brownHeading">Battle Status</span>

<hr>

<?php 
$turn_cost = 1;
$attacked = in('attacked');
$victim = in('victim');
$random_encounter = rand(1, 200) == 200;
if (getTurns($username) > 0) {
    if ($attacked == 1) {
        // *** Bit to expect that it comes from the form. ***
        echo "Commencing Attack<br><br>\n";
        if (getStatus($username) && $status_array['Stealth']) {
            subtractStatus($username, STEALTH);
        }
        $attacker_str = getStrength($username);
        $attacker_health = getHealth($username);
        $attacker_gold = getGold($username);
        if ($random_encounter == true) {
            // *** ONI, M********a! ***
            // **********************************************************
            // *** Oni attack! Yay!                                   ***
            // *** They take turns and a kill and do a little damage. ***
            // **********************************************************
Beispiel #6
0
     $victim_alive = false;
     $targetResult = " be drained of your life-force and die!";
     $gold_mod = 0.25;
     //The Dim Mak takes away 25% of a targets' gold.
 }
 if ($turns_change !== null) {
     // Even if $turns_change is set to zero, let them know that.
     if ($turns_change > 0) {
         $resultMessage .= "__TARGET__ has gained back {$turns_change} turns!";
     } else {
         if ($turns_change === 0) {
             $resultMessage .= "__TARGET__ did not lose any turns!";
         } else {
             $resultMessage .= "__TARGET__ has lost " . abs($turns_change) . " turns!";
         }
         if (getTurns($target_id) <= 0) {
             //Message when a target has no more turns to remove.
             $resultMessage .= "  __TARGET__ no longer has any turns.";
         }
     }
 }
 if (empty($resultMessage) && !empty($result)) {
     $resultMessage = $result;
 }
 if (!$victim_alive) {
     // Target was killed by the item.
     if (!$self_use) {
         // *** SUCCESSFUL KILL, not self-use of an item ***
         $attacker_id = $player->hasStatus(STEALTH) ? "A Stealthed Ninja" : $username;
         if (!$gold_mod) {
             $gold_mod = 0.15;
Beispiel #7
0
            }
            echo "What once was dead shall rise again.<br>\n";
            echo "Current Kills: " . $startingKills . "<br>\n";
            echo "Adjusted Kills after returning to life: " . getKills($username) . "<br>\n";
        } elseif ($startingTurns > 0) {
            echo "What once was dead shall rise again.<br>\n";
            if ($startingTurns < $lostTurns && $startingTurns > 0) {
                $lostTurns = $startingTurns;
            }
            subtractTurns($username, $lostTurns);
            // *** Takes away necessary turns.
            setHealth($username, 100);
            subtractStatus($username, STEALTH + POISON + FROZEN + CLASS_STATE);
            echo "Since you have no kills, your resurrection will cost you part of your life time.";
            echo "Current Turns: " . $startingTurns . "<br>\n";
            echo "Adjusted Turns after returning to life: " . getTurns($username) . "<br>\n";
        } else {
            echo "You must wait for time to pass before you can return to life.";
            echo "Current Turns: " . $startingTurns . "<br>\n";
        }
    }
}
// *** end of resurrection ***
if ($healed == 1 || $max_heal == 1) {
    //If the user tried to heal themselves.
    //  ***  HEALING SECTION  ***
    $max_health = 150 + ($userLevel - 1) * 25;
    if ($max_heal == 1) {
        // Sets the heal_points when the heal-all button was hit.
        $heal_points = $startingGold;
    }
Beispiel #8
0
		<ul class = "mainmenu">
			<li><h3>Financial</h3></li>
			<li><a href="bank.php">bank</a></li>
			<li><a href="shop.php">shop</a></li>
			<li><a href="slaves.php">slaves</a></li>
			<li><a href="business.php">business</a></li>
		</ul>
		<ul class = "mainmenu">
			<li><h3>Account</h3></li>
			<li><a href="contacts.php">contacts</a></li>
			<li><a href="clans.php">clans</a></li>
			<li><a href="logout.php">logout</a></li>
		</ul>
	</div>
<?php 
    $turns = getTurns(Session::getUser()->getUsername());
    $gold = number_format(Session::getUser()->getData('gold'));
    echo '<p class = "status">';
    echo '<span class = "metric"><strong><img src = "resources/images/gold.png" /> ' . $gold . '</strong></span> ';
    echo '<span class = "metric"><strong><img src = "resources/images/turn.png" /> ' . $turns['remaining'] . '</strong></span> ';
    echo '<span class = "metric"><strong><img src = "resources/images/time.png" /> ' . $turns['time'] . '</strong></span>';
    echo "</p>";
} else {
    echo "<a href = \"register.php\">register</a> | ";
    echo "<a href = \"login.php\">login</a>";
}
?>

</div>

<div class = "page">
Beispiel #9
0
function changeTurns($who, $amount)
{
    if (abs($amount) > 0) {
        global $sql;
        $sql->Update("UPDATE players SET turns = turns + " . "CASE WHEN turns+{$amount} < 0 THEN turns*(-1) ELSE {$amount} END " . "WHERE uname  = '{$who}'");
        $new_turns = getTurns($who);
        return $new_turns;
    } else {
        return getTurns($who);
    }
}
Beispiel #10
0
function get_turns($username)
{
    return getTurns($username);
}