private function onTrollReward(SR_NPC $npc, SR_Player $player) { $max = $player->isRunner() ? Shadowcmd_lvlup::MAX_VAL_ATTRIBUTE_RUNNER : Shadowcmd_lvlup::MAX_VAL_ATTRIBUTE; $base = $player->getBase('magic'); if ($base >= $max) { $ny = 5000; $player->giveNuyen($ny); return $player->message($this->lang('reward_ny', array($ny))); // return $player->message('Larry hands you another 5000 nuyen!'); } $player->message($this->lang('reward1')); // $player->message('Larry leads you to a shamane: "This is our shamane, Srando, he can help you."'); $race = $player->getRace(); if ($race === 'Ork' || $race === 'Troll') { $player->message($this->lang('reward2', array($race))); // $player->message('The shamane says: "You are a strong '.$race.'. You just need to calm down sometime."'); $player->message($this->lang('reward3')); // $player->message('You are starting to argue, but the shamane continues: "If you calm you have more time to strengthen yourself. Focus yourself, and the path is clear."'); $player->message($this->lang('reward4')); // $player->message('The shamane touches your head: "Your mind is now clear from anything. You can focus yourself from now on."'); $player->message($this->lang('reward5')); // $player->message('Your character is now allowed to learn magic and spells.'); } else { $player->message($this->lang('reward5')); // $player->message('The shamane mumbles some magic spells and raises your base value for magic by 1.'); } $player->alterField('magic', 1); $player->modify(); return true; }
public function onSolveDuo(SR_Player $player) { $this->msg('solve2a'); $this->msg('solve2b'); // $player->message('The dwarfs look very pleased.'); // $player->message('"Thank you so much", Aron says, "For your help we have thought of a special reward..."'); $max = $player->isRunner() ? Shadowcmd_lvlup::MAX_VAL_SKILL_RUNNER : Shadowcmd_lvlup::MAX_VAL_SKILL; if ($player->getBase('melee') > $max) { $this->msg('solve2c', array(Shadowfunc::displayNuyen(5000))); $player->giveNuyenEvent(5000); // $player->message('You received another 5000 nuyen!'); } else { $this->msg('solve2d'); // $player->message('Your melee skill has increased by 1.'); $player->levelupField('melee', 1); // $player->modify(); } return true; }
public static function onKill(SR_Player $killer, SR_Player $victim) { if (!$killer->isHuman()) { return true; } if ($victim instanceof SR_HireNPC) { $column = 'npc'; } elseif ($victim instanceof SR_NPC) { $column = 'mob'; } else { if ($victim->isRunner()) { $column = 'runner'; } else { $column = 'human'; } } if (false === ($stats = self::getOrCreateStats($killer))) { return false; } return $stats->increase('sr4ps_kill_' . $column, 1); }
private function announceKilled(SR_Player $killer) { $famous = $this->isRunner() ? 'famous' : 'newbie'; $famous2 = $killer->isRunner() ? 'famous' : 'newbie'; $npchuman = $killer->isHuman() ? 'runner' : 'NPC'; $message = sprintf('[Shadowlamb] - The %s runner %s got killed by the %s %s %s', $famous, $this->getName(), $famous2, $npchuman, $killer->getName()); Shadowshout::sendGlobalMessage($message); }
public static function getMaxLevel(SR_Player $player, $field) { $runner = $player->isRunner(); if ($field === 'essence') { return 6; } if (in_array($field, SR_Player::$SKILL)) { return $runner ? self::MAX_VAL_SKILL_RUNNER : self::MAX_VAL_SKILL; } elseif (in_array($field, SR_Player::$ATTRIBUTE)) { return $runner ? self::MAX_VAL_ATTRIBUTE_RUNNER : self::MAX_VAL_ATTRIBUTE; } elseif (in_array($field, SR_Player::$KNOWLEDGE)) { return $runner ? self::MAX_VAL_KNOWLEDGE_RUNNER : self::MAX_VAL_KNOWLEDGE; } elseif (false !== ($spell = SR_Spell::getSpell($field))) { return $runner ? self::MAX_VAL_SPELL_RUNNER : self::MAX_VAL_SPELL; } else { return false; } }