Example #1
0
 /**
  * Take in a url parameter of work and try to convert it to gold
  */
 public function requestWork()
 {
     // Initialize variables to pass to the template.
     $work_multiplier = self::WORK_MULTIPLIER;
     $worked = positive_int(in('worked'));
     // No negative work.
     $earned_gold = null;
     $not_enough_energy = null;
     $recommended_to_work = $worked;
     $is_logged_in = is_logged_in();
     $char_id = self_char_id();
     $char = new Player($char_id);
     $turns = $char->turns();
     $gold = $char->gold();
     if ($worked > $turns) {
         $not_enough_energy = true;
     } else {
         $earned_gold = $worked * $work_multiplier;
         // calc amount worked
         $char->set_gold($gold + $earned_gold);
         $char->set_turns($turns - $worked);
         $char->save();
     }
     $gold_display = number_format($char->gold());
     $parts = ['recommended_to_work' => $recommended_to_work, 'work_multiplier' => $work_multiplier, 'is_logged_in' => $is_logged_in, 'gold_display' => $gold_display, 'worked' => $worked, 'earned_gold' => number_format($earned_gold), 'not_enough_energy' => $not_enough_energy];
     return $this->render($parts);
 }
Example #2
0
 public function setType($type)
 {
     $cast_type = positive_int($type);
     if ($cast_type != $type) {
         throw new Exception('Account: The account type set was inappropriate.');
     }
     $this->type = $cast_type;
     return $this->type;
 }
Example #3
0
 public function testPositiveInt()
 {
     $this->assertEquals(4, positive_int(4));
     $this->assertEquals(0, positive_int(-4));
     $this->assertEquals(0, positive_int(4.1));
     $this->assertEquals(0, positive_int(4.9));
     $this->assertEquals(0, positive_int(0));
     $this->assertEquals(0, positive_int('somestring'));
     $this->assertEquals(0, positive_int([]));
 }
Example #4
0
 /**
  * group char
  **/
 function testCreatePlayerObjectHasUsefulInfo()
 {
     $char = new Player($this->char_id);
     $this->assertTrue((bool) positive_int($char->health()));
     $this->assertTrue((bool) positive_int($char->speed()));
     $this->assertTrue((bool) positive_int($char->stamina()));
     $this->assertTrue((bool) positive_int($char->strength()));
     $this->assertTrue((bool) positive_int($char->level()));
     $this->assertNotEmpty($char->name());
     $this->assertTrue((bool) positive_int($char->damage()));
 }
Example #5
0
 public static function canKill($clone1, $clone2)
 {
     // Input is transformed into
     $id1 = $id2 = null;
     if (!$clone1 instanceof Player) {
         if ($clone1 == positive_int($clone1)) {
             $char1 = new Player($clone1);
         } elseif (is_string($clone1)) {
             $char1 = new Player($clone1);
         }
     } else {
         $char1 = $clone1;
     }
     if (!$clone2 instanceof Player) {
         if ($clone2 == positive_int($clone2)) {
             $char2 = new Player($clone2);
         } elseif (is_string($clone2)) {
             $char2 = new Player($clone2);
         }
     } else {
         $char2 = $clone2;
     }
     // Reject invalid/ninexistent characters
     if ($char1->id() === null || $char2->id() === null) {
         return false;
     }
     // Reject same character
     if ($char1->id() == $char2->id()) {
         return false;
     }
     // Don't clone kill admins.
     if ($char1->isAdmin() || $char2->isAdmin()) {
         return false;
     }
     // Reject inactive characters
     if (!$char1->isActive() || !$char2->isActive()) {
         return false;
     }
     // TODO: Reject inoperative characters
     // TODO: You can't clone kill yourself..
     $host = gethostname();
     $server_ip = gethostbyname($host);
     $untouchable_ips = ['127.0.0.1', '173.203.99.229', $server_ip, '', null];
     // Reject invalid custom ips
     if (in_array($char1->ip(), $untouchable_ips) || in_array($char2->ip(), $untouchable_ips)) {
         return false;
     }
     // If characters have the same joint account, and have been logged in recently...
     if ($char1->ip() === $char2->ip()) {
         // Activity was already tested above.
         return true;
     }
     return false;
 }
Example #6
0
function get_chats($chatlength = null)
{
    $chatlength = positive_int($chatlength);
    // Prevent negatives.
    $limit = $chatlength ? 'LIMIT :limit' : '';
    $bindings = array();
    if ($limit) {
        $bindings[':limit'] = $chatlength;
    }
    $chats = query_resultset("SELECT sender_id, uname, message, date, age(now(), date) AS ago FROM chat\n        JOIN players ON chat.sender_id = player_id ORDER BY chat_id DESC " . $limit, $bindings);
    return $chats;
}
Example #7
0
 public static function create($identity, $data = null)
 {
     $founder = $data['founder'] ? $data['founder'] : null;
     $desc = $data['description'] ? $data['description'] : '';
     $url = isset($data['clan_avatar_url']) ? $data['clan_avatar_url'] : null;
     $name = $identity;
     $new_clan_id = insert_query('insert into clan (clan_name, clan_avatar_url, clan_founder, description) values (:name, :url, :founder, :desc)', [':name' => $name, ':url' => $url, ':founder' => $founder, ':desc' => $desc], 'clan_clan_id_seq');
     if (!positive_int($new_clan_id)) {
         throw new \Exception('Clan not inserted into database properly!');
     }
     return ClanFactory::find($new_clan_id);
 }
Example #8
0
 /**
  * Command for current user to purchase a quantity of a specific item
  *
  * @param quantity int The quantity of the item to purchase
  * @param item string The identity of the item to purchase
  * @return Array
  */
 public function buy()
 {
     $in_quantity = in('quantity');
     $in_item = in('item');
     $gold = get_gold($this->sessionData['char_id']);
     $current_item_cost = 0;
     $no_funny_business = false;
     // Pull the item info from the database
     $item_costs = $this->itemForSaleCosts();
     $item = getItemByID(item_id_from_display_name($in_item));
     $quantity = whichever(positive_int($in_quantity), 1);
     $item_text = null;
     if ($item instanceof Item) {
         $item_text = $quantity > 1 ? $item->getPluralName() : $item->getName();
         $purchaseOrder = new PurchaseOrder();
         // Determine the quantity from input or as a fallback, default of 1.
         $purchaseOrder->quantity = $quantity;
         $purchaseOrder->item = $item;
         $potential_cost = isset($item_costs[$purchaseOrder->item->identity()]['item_cost']) ? $item_costs[$purchaseOrder->item->identity()]['item_cost'] : null;
         $current_item_cost = first_value($potential_cost, 0);
         $current_item_cost = $current_item_cost * $purchaseOrder->quantity;
         if (!$this->sessionData['char_id'] || !$purchaseOrder->item || $purchaseOrder->quantity < 1) {
             $no_funny_business = true;
         } else {
             if ($gold >= $current_item_cost) {
                 // Has enough gold.
                 try {
                     add_item($this->sessionData['char_id'], $purchaseOrder->item->identity(), $purchaseOrder->quantity);
                     subtract_gold($this->sessionData['char_id'], $current_item_cost);
                 } catch (\Exception $e) {
                     $invalid_item = $e->getMessage();
                     error_log('Invalid Item attempted :' . $invalid_item);
                     $no_funny_business = true;
                 }
             }
         }
     } else {
         $no_funny_business = true;
     }
     $parts = array('current_item_cost' => $current_item_cost, 'quantity' => $quantity, 'item_text' => $item_text, 'no_funny_business' => $no_funny_business, 'view_part' => 'buy');
     return $this->render($parts);
 }
 /**
  * Use an item on a target
  * @note /use/ is aliased to useItem externally because use is a php reserved keyword
  */
 public function useItem($give = false, $self_use = false)
 {
     // Formats are:
     // http://nw.local/item/self_use/amanita/
     // http://nw.local/item/use/shuriken/10/
     // http://nw.local/item/give/shuriken/10/
     // http://nw.local/item/use/shuriken/156001/
     $slugs = $this->parse_slugs($give, $self_use);
     // Pull the parsed slugs
     $link_back = $slugs['link_back'];
     $selfTarget = $slugs['selfTarget'];
     $item_in = $slugs['item_in'];
     // Item identifier, either it's id or internal name
     $in_target = $slugs['in_target'];
     $give = $slugs['give'];
     $target = $in_target;
     if (positive_int($in_target)) {
         $target_id = positive_int($target);
     } else {
         $target_id = get_char_id($target);
     }
     $give = in_array($give, array('on', 'Give'));
     $player = new Player(self_char_id());
     $victim_alive = true;
     $using_item = true;
     $item_used = true;
     $stealthLost = false;
     $error = false;
     $suicide = false;
     $kill = false;
     $repeat = false;
     $ending_turns = null;
     $turns_change = null;
     $turns_to_take = null;
     $gold_mod = NULL;
     $result = NULL;
     $targetResult = NULL;
     // result message to send to target of item use
     $targetName = '';
     $targetHealth = '';
     $bountyMessage = '';
     $resultMessage = '';
     $alternateResultMessage = '';
     if ($item_in == (int) $item_in && is_numeric($item_in)) {
         // Can be cast to an id.
         $item = $item_obj = getItemByID($item_in);
     } elseif (is_string($item_in)) {
         $item = $item_obj = $this->getItemByIdentity($item_in);
     } else {
         $item = null;
     }
     if (!is_object($item)) {
         return new RedirectResponse(WEB_ROOT . 'inventory?error=noitem');
     } else {
         $item_count = $this->itemCount($player->id(), $item);
         // Check whether use on self is occurring.
         $self_use = $selfTarget || $target_id === $player->id();
         if ($self_use) {
             $target = $player->name();
             $targetObj = $player;
         } else {
             if ($target_id) {
                 $targetObj = new Player($target_id);
                 $target = $targetObj->name();
             }
         }
         $starting_turns = $player->turns;
         $username_turns = $starting_turns;
         $username_level = $player->level;
         if ($targetObj instanceof Player && $targetObj->id()) {
             $targets_turns = $targetObj->turns;
             $targets_level = $targetObj->level;
             $target_hp = $targetObj->health;
         } else {
             $targets_turns = $targets_level = $target_hp = null;
         }
         $max_power_increase = 10;
         $level_difference = $targets_level - $username_level;
         $level_check = $username_level - $targets_level;
         $near_level_power_increase = $this->nearLevelPowerIncrease($level_difference, $max_power_increase);
         // Sets the page to link back to.
         if ($target_id && ($link_back == "" || $link_back == 'player') && $target_id != $player->id()) {
             $return_to = 'player';
         } else {
             $return_to = 'inventory';
         }
         // Exceptions to the rules, using effects.
         if ($item->hasEffect('wound')) {
             // Minor damage by default items.
             $item->setTargetDamage(rand(1, $item->getMaxDamage()));
             // DEFAULT, overwritable.
             // e.g. Shuriken slices, for some reason.
             if ($item->hasEffect('slice')) {
                 // Minor slicing damage.
                 $item->setTargetDamage(rand(1, max(9, $player->getStrength() - 4)) + $near_level_power_increase);
             }
             // Piercing weapon, and actually does any static damage.
             if ($item->hasEffect('pierce')) {
                 // Minor static piercing damage, e.g. 1-50 plus the near level power increase.
                 $item->setTargetDamage(rand(1, $item->getMaxDamage()) + $near_level_power_increase);
             }
             // Increased damage from damaging effects, minimum of 20.
             if ($item->hasEffect('fire')) {
                 // Major fire damage
                 $item->setTargetDamage(rand(20, $player->getStrength() + 20) + $near_level_power_increase);
             }
         }
         // end of wounds section.
         // Exclusive speed/slow turn changes.
         if ($item->hasEffect('slow')) {
             $item->setTurnChange(-1 * $this->caltropTurnLoss($targets_turns, $near_level_power_increase));
         } else {
             if ($item->hasEffect('speed')) {
                 $item->setTurnChange($item->getMaxTurnChange());
             }
         }
         $turn_change = $item_obj->getTurnChange();
         $itemName = $item->getName();
         $itemType = $item->getType();
         $article = self::getIndefiniteArticle($item_obj->getName());
         if ($give) {
             $turn_cost = 1;
             $using_item = false;
         } else {
             $turn_cost = $item->getTurnCost();
         }
         // Attack Legal section
         $attacker = $player->name();
         $params = ['required_turns' => $turn_cost, 'ignores_stealth' => $item_obj->ignoresStealth(), 'self_use' => $item->isSelfUsable()];
         assert(!!$selfTarget || $attacker != $target);
         $AttackLegal = new AttackLegal($player, $targetObj, $params);
         $attack_allowed = $AttackLegal->check();
         $attack_error = $AttackLegal->getError();
         // *** Any ERRORS prevent attacks happen here  ***
         if (!$attack_allowed) {
             //Checks for error conditions before starting.
             $error = 1;
         } else {
             if (is_string($item) || $target == "") {
                 $error = 2;
             } else {
                 if ($item_count < 1) {
                     $error = 3;
                 } else {
                     /**** MAIN SUCCESSFUL USE ****/
                     if ($give) {
                         $this->giveItem($player->name(), $target, $item->getName());
                         $alternateResultMessage = "__TARGET__ will receive your {$item->getName()}.";
                     } else {
                         if (!$item->isOtherUsable()) {
                             // If it doesn't do damage or have an effect, don't use up the item.
                             $resultMessage = $result = 'This item is not usable on __TARGET__, so it remains unused.';
                             $item_used = false;
                             $using_item = false;
                         } else {
                             if ($item->hasEffect('stealth')) {
                                 $targetObj->addStatus(STEALTH);
                                 $alternateResultMessage = "__TARGET__ is now stealthed.";
                                 $targetResult = ' be shrouded in smoke.';
                             }
                             if ($item->hasEffect('vigor')) {
                                 if ($targetObj->hasStatus(STR_UP1)) {
                                     $result = "__TARGET__'s body cannot become more vigorous!";
                                     $item_used = false;
                                     $using_item = false;
                                 } else {
                                     $targetObj->addStatus(STR_UP1);
                                     $result = "__TARGET__'s muscles experience a strange tingling.";
                                 }
                             }
                             if ($item->hasEffect('strength')) {
                                 if ($targetObj->hasStatus(STR_UP2)) {
                                     $result = "__TARGET__'s body cannot become any stronger!";
                                     $item_used = false;
                                     $using_item = false;
                                 } else {
                                     $targetObj->addStatus(STR_UP2);
                                     $result = "__TARGET__ feels a surge of power!";
                                 }
                             }
                             // Slow and speed effects are exclusive.
                             if ($item->hasEffect('slow')) {
                                 $turns_change = $item->getTurnChange();
                                 if ($targetObj->hasStatus(SLOW)) {
                                     // If the effect is already in play, it will have a decreased effect.
                                     $turns_change = ceil($turns_change * 0.3);
                                     $alternateResultMessage = "__TARGET__ is already moving slowly.";
                                 } else {
                                     if ($targetObj->hasStatus(FAST)) {
                                         $targetObj->subtractStatus(FAST);
                                         $alternateResultMessage = "__TARGET__ is no longer moving quickly.";
                                     } else {
                                         $targetObj->addStatus(SLOW);
                                         $alternateResultMessage = "__TARGET__ begins to move slowly...";
                                     }
                                 }
                                 if ($turns_change == 0) {
                                     $alternateResultMessage .= " You fail to take any turns from __TARGET__.";
                                 }
                                 $targetResult = " lose " . abs($turns_change) . " turns.";
                                 $targetObj->subtractTurns($turns_change);
                             } else {
                                 if ($item->hasEffect('speed')) {
                                     // Note that speed and slow effects are exclusive.
                                     $turns_change = $item->getTurnChange();
                                     if ($targetObj->hasStatus(FAST)) {
                                         // If the effect is already in play, it will have a decreased effect.
                                         $turns_change = ceil($turns_change * 0.5);
                                         $alternateResultMessage = "__TARGET__ is already moving quickly.";
                                     } else {
                                         if ($targetObj->hasStatus(SLOW)) {
                                             $targetObj->subtractStatus(SLOW);
                                             $alternateResultMessage = "__TARGET__ is no longer moving slowly.";
                                         } else {
                                             $targetObj->addStatus(FAST);
                                             $alternateResultMessage = "__TARGET__ begins to move quickly!";
                                         }
                                     }
                                     // Actual turn gain is 1 less because 1 is used each time you use an item.
                                     $targetResult = " gain {$turns_change} turns.";
                                     $targetObj->changeTurns($turns_change);
                                     // Still adding some turns.
                                 }
                             }
                             if ($item->getTargetDamage() > 0) {
                                 // *** HP Altering ***
                                 $alternateResultMessage .= " __TARGET__ takes " . $item->getTargetDamage() . " damage.";
                                 if ($self_use) {
                                     $result .= "You take " . $item->getTargetDamage() . " damage!";
                                 } else {
                                     if (strlen($targetResult) > 0) {
                                         $targetResult .= " You also";
                                         // Join multiple targetResult messages.
                                     }
                                     $targetResult .= " take " . $item->getTargetDamage() . " damage!";
                                 }
                                 $victim_alive = $targetObj->subtractHealth($item->getTargetDamage());
                                 // This is the other location that $victim_alive is set, to determine whether the death proceedings should occur.
                             }
                             if ($item->hasEffect('death')) {
                                 $targetObj->death();
                                 $resultMessage = "The life force drains from __TARGET__ and they drop dead before your eyes!";
                                 $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 ($targetObj->turns <= 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" : $player->name();
                                     if (!$gold_mod) {
                                         $gold_mod = 0.15;
                                     }
                                     $initial_gold = $targetObj->gold();
                                     $loot = floor($gold_mod * $initial_gold);
                                     $targetObj->set_gold($initial_gold - $loot);
                                     $player->set_gold($player->gold() + $loot);
                                     $player->save();
                                     $targetObj->save();
                                     $player->addKills(1);
                                     $kill = true;
                                     $bountyMessage = Combat::runBountyExchange($player->name(), $target);
                                     //Rewards or increases bounty.
                                 } else {
                                     $loot = 0;
                                     $suicide = true;
                                 }
                                 // Send mails if the target was killed.
                                 $this->sendKillMails($player->name(), $target, $attacker_id, $article, $item->getName(), $loot);
                             } else {
                                 // They weren't killed.
                                 $attacker_id = $player->name();
                             }
                             if (!$self_use && $item_used) {
                                 if (!$targetResult) {
                                     error_log('Debug: Issue 226 - An attack was made using ' . $item->getName() . ', but no targetResult message was set.');
                                 }
                                 // Notify targets when they get an item used on them.
                                 $message_to_target = "{$attacker_id} has used {$article} {$item->getName()} on you";
                                 if ($targetResult) {
                                     $message_to_target .= " and caused you to {$targetResult}";
                                 } else {
                                     $message_to_target .= '.';
                                 }
                                 send_event($player->id(), $target_id, str_replace('  ', ' ', $message_to_target));
                             }
                             // Unstealth
                             if (!$item->isCovert() && !$item->hasEffect('stealth') && $player->hasStatus(STEALTH)) {
                                 //non-covert acts
                                 $player->subtractStatus(STEALTH);
                                 $stealthLost = true;
                             } else {
                                 $stealthLost = false;
                             }
                         }
                     }
                     $targetName = $targetObj->uname;
                     $targetHealth = $targetObj->health;
                     $turns_to_take = 1;
                     if ($item_used) {
                         // *** remove Item ***
                         removeItem($player->id(), $item->getName(), 1);
                         // *** Decreases the item amount by 1.
                     }
                     if ($victim_alive && $using_item) {
                         $repeat = true;
                     }
                 }
             }
         }
         // *** Take away at least one turn even on attacks that fail to prevent page reload spamming ***
         if ($turns_to_take < 1) {
             $turns_to_take = 1;
         }
         $ending_turns = $player->subtractTurns($turns_to_take);
         assert($item->hasEffect('speed') || $ending_turns < $starting_turns || $starting_turns == 0);
         return ['template' => 'inventory_mod.tpl', 'title' => 'Use Item', 'parts' => get_defined_vars(), 'options' => ['body_classes' => 'inventory-use', 'quickstat' => 'player']];
     }
     // Item was not valid object
 }
Example #10
0
<?php

$alive = false;
$private = false;
if ($error = init($private, $alive)) {
    display_error($error);
} else {
    $admin_override_pass = '******';
    // Just a weak passphrase for simply confirming players.
    $admin_override_request = in('admin_override');
    $acceptable_admin_override = $admin_override_pass === $admin_override_request;
    $confirm = in('confirm');
    $aid = positive_int(in('aid'));
    $data = query_row('
	SELECT player_id, uname, accounts.verification_number as verification_number, CASE WHEN active = 1 THEN 1 ELSE 0 END AS active, accounts.active_email, 
	CASE WHEN accounts.confirmed = 1 THEN 1 ELSE 0 END as confirmed, status, member, days, ip, players.created_date 
	FROM accounts JOIN account_players ON _account_id = account_id JOIN players ON _player_id = player_id 
	WHERE account_id = :acctId', array(':acctId' => $aid));
    if (rco($data)) {
        $check = $data['verification_number'];
        $confirmed = $data['confirmed'];
        $active = $data['active'];
        $username = $data['uname'];
    } else {
        $active = $check = $confirmed = $username = null;
    }
    //debug($data, $confirm, $check, $confirmed);
    //debug($check, $confirm);
    $confirmation_confirmed = false;
    if ($confirmed == 1) {
        // Confirmation state from the database is already confirmed.
Example #11
0
function find_account_info_by_oauth($id, $provider = 'facebook')
{
    $id = positive_int($id);
    $account_info = query_row('select * from accounts where ( oauth_id = :id and oauth_provider = :provider ) 
		order by operational, type, created_date asc limit 1', array(':id' => $id, ':provider' => $provider));
    if (empty($account_info) || !$account_info['account_id']) {
        return false;
    } else {
        return $account_info;
    }
}
Example #12
0
 /**
  * group accountconf
  **/
 function testMakeSureThatNinjaAccountIsOperationalByDefault()
 {
     $ninja_id = ninja_id($this->test_ninja_name);
     $this->assertTrue(positive_int($ninja_id) > 0);
     $char_id = get_char_id($this->test_ninja_name);
     $this->assertTrue(positive_int($char_id) > 0);
     $account_id = account_id_by_ninja_id(ninja_id($this->test_ninja_name));
     $account_operational = query_item('select operational from accounts join account_players on account_id = _account_id
     		where _player_id = :char_id', array(':char_id' => $char_id));
     $this->assertTrue($ninja_id == $char_id);
     $this->assertTrue($account_id > 0);
     $this->assertTrue(positive_int($account_id) > 0);
     $this->assertTrue($account_operational, 'Account is not being set as operational by default when created');
 }
Example #13
0
            $ids = explode(',', $ids);
            foreach ($ids as $id) {
                $res[$id] = char_info($id, $admin_info = true);
            }
            return $res;
        }
    }
    public static function char_inventory($char_id)
    {
        return inventory_counts($char_id);
    }
}
// Redirect for any non-admins.
$char_id = self_char_id();
$self = null;
if (positive_int($char_id)) {
    $self = new Player($char_id);
}
if ($self instanceof Player && $self->isAdmin()) {
    // Admin possibilities start here.
    $view_char = null;
    $dupes = AdminViews::duped_ips();
    $stats = AdminViews::high_rollers();
    $npcs = NpcFactory::allNonTrivialNpcs();
    $trivial_npcs = NpcFactory::allTrivialNpcs();
    $char_name = in('char_name');
    if (is_string($char_name) && trim($char_name)) {
        $view_char = get_char_id($char_name);
    }
    // If a request is made to view a character's info, show it.
    $view_char = $view_char ? $view_char : in('view');
Example #14
0
 /**
  * group accountconf
  */
 function testMakeSureThatNinjaAccountIsOperationalByDefault()
 {
     $ninja_id = $this->test_ninja_id;
     $this->assertTrue(positive_int($ninja_id) > 0);
     $char_id = get_char_id($this->test_ninja_name);
     $this->assertTrue(positive_int($char_id) > 0);
     $account_operational = query_item('SELECT operational FROM accounts JOIN account_players ON account_id = _account_id WHERE _player_id = :char_id', [':char_id' => $char_id]);
     $this->assertTrue($ninja_id == $char_id);
     $this->assertTrue($account_operational, 'Account is not being set as operational by default when created');
 }