Example #1
0
    $data = $target->dataWithClan();
    // Strip all fields but those allowed.
    $allowed = ['Name' => 'uname', 'Class' => 'class', 'Level' => 'level', 'Turns' => 'turns', 'Strength' => 'strength', 'Speed' => 'speed', 'Stamina' => 'stamina', 'Ki' => 'ki', 'Gold' => 'gold', 'Kills' => 'kills'];
    $res = array();
    foreach ($allowed as $header => $field) {
        $res[$header] = $data[$field];
    }
    return $res;
}
if (!$attack_error) {
    // Nothing to prevent the attack from happening.
    // Initial attack conditions are alright.
    $result = '';
    if ($command == 'Sight') {
        $covert = true;
        $sight_data = pull_sight_data($target);
        $display_sight_table = true;
    } elseif ($command == 'Steal') {
        $covert = true;
        $gold_decrease = min($target->gold(), rand(5, 50));
        add_gold($char_id, $gold_decrease);
        // *** This one actually adds the value.
        subtract_gold($target->id(), $gold_decrease);
        // *** Subtracts whatever positive value is put in.
        $msg = "{$attacker_id} stole {$gold_decrease} gold from you.";
        send_event($attacker_char_id, $target->id(), $msg);
        $generic_skill_result_message = "You have stolen {$gold_decrease} gold from __TARGET__!";
    } else {
        if ($command == 'Unstealth') {
            $state = 'unstealthed';
            if ($target->hasStatus(STEALTH)) {
Example #2
0
    $data = char_info($target_id);
    // Strip all fields but those allowed.
    $allowed = array('Name' => 'uname', 'Class' => 'class', 'Level' => 'level', 'Turns' => 'turns', 'Strength' => 'strength', 'Speed' => 'speed', 'Stamina' => 'stamina', 'Ki' => 'ki', 'Gold' => 'gold', 'Kills' => 'kills');
    $res = array();
    foreach ($allowed as $header => $field) {
        $res[$header] = $data[$field];
    }
    return $res;
}
if (!$attack_error) {
    // Nothing to prevent the attack from happening.
    // Initial attack conditions are alright.
    $result = '';
    if ($command == 'Sight') {
        $covert = true;
        $sight_data = pull_sight_data($target_id);
        $display_sight_table = true;
    } elseif ($command == 'Steal') {
        $covert = true;
        $gold_decrease = rand(1, 50);
        $target_gold = $target->vo->gold;
        $gold_decrease = $target_gold < $gold_decrease ? $target_gold : $gold_decrease;
        add_gold($char_id, $gold_decrease);
        // *** This one actually adds the value.
        subtract_gold($target->id(), $gold_decrease);
        // *** Subtracts whatever positive value is put in.
        $msg = "{$attacker_id} stole {$gold_decrease} gold from you.";
        send_event($attacker_char_id, $target->id(), $msg);
        $generic_skill_result_message = "You have stolen {$gold_decrease} gold from __TARGET__!";
    } else {
        if ($command == 'Unstealth') {