public static function execute(SR_Player $player, array $args) { $bot = Shadowrap::instance($player); if (count($args) !== 2) { $bot->reply(Shadowhelp::getHelp($player, 'gmloot')); return false; } $target = Shadowrun4::getPlayerByShortName($args[0]); if ($target === -1) { $player->message('The username is ambigious.'); return false; } if ($target === false) { $player->message('The player is not in memory or unknown.'); return false; } if (false === $target->isCreated()) { $bot->reply(sprintf('The player %s has not started a game yet.', $args[0])); return false; } if (Common::isNumeric($args[1])) { $target->giveItems(Shadowfunc::randLoot($target, $args[1]), 'gmloot'); } else { } return true; }
public function onItemUse(SR_Player $player, array $args) { $player->message(sprintf('You open your present ... ')); $this->useAmount($player, 1); $items = array(); while (count($items) === 0) { $items = Shadowfunc::randLoot($player, 99999); } $player->giveItems($items, 'present'); return true; }
public function on_search(SR_Player $player, array $args) { $key = $this->getTempKey(); $attemp = $player->getTemp($key, 0); if ($attemp >= $this->getSearchMaxAttemps()) { $player->msg('1148'); // $player->message('Not again.'); return; } $attemp++; $player->setTemp($key, $attemp); $loot = array_merge(Shadowfunc::randLoot($player, $this->getSearchLevel(), array(), $this->getSearchChanceNone()), $this->getSearchLoot($player)); if (count($loot) > 0) { $player->msg('5185', array($this->getName())); // $player->message(sprintf('You search the %s...', $this->getName())); $player->giveItems($loot, 'searching ' . $this->getName()); } else { $player->msg('5186', array($this->getName())); // $player->message(sprintf('You search the %s... But find nothing.', $this->getName())); } }
public function gotKilledByHuman(SR_Player $player) { if ($this->isNPCDropping($player->getParty())) { $player = $player->getParty()->getKiller($player); $items = array_merge(Shadowfunc::randLoot($player, (int) $this->getBase('level'), $this->getNPCHighChanceDrops()), $this->generateNPCLoot($player)); $player->giveItems($items, 'looting ' . $this->getName()); } }