Exemplo n.º 1
0
 public function getNPCLoot(SR_Player $player)
 {
     $leader = $player->getParty()->getLeader();
     $leader->giveItems(array(SR_Item::createByName(Forest_Clearing::THESWORD)), $this->getName());
     SR_PlayerVar::setVal($leader, Forest_Clearing::SWORDKEY, '2');
     return array();
 }
Exemplo n.º 2
0
 public static function execute(SR_Player $player, array $args)
 {
     return self::rply($player, '5241', array(SR_NPC::$NPC_COUNTER, Shadowrun4::getCityCount(), SR_Location::$LOCATION_COUNT, SR_Item::getTotalItemCount(), SR_Spell::getTotalSpellCount(), SR_Quest::getTotalQuestCount(), Shadowcmd::translate('stats')));
     // 		$bot = Shadowrap::instance($player);
     // 		$message = sprintf('In Shadowlamb v3 there are: %s different NPC in %s Areas with %s Locations. %s Items, %s Spells and %s Quests. Try #stats to show how many are playing.', SR_NPC::$NPC_COUNTER, Shadowrun4::getCityCount(), SR_Location::$LOCATION_COUNT, SR_Item::getTotalItemCount(), SR_Spell::getTotalSpellCount(), SR_Quest::getTotalQuestCount());
     // 		return $bot->reply($message);
 }
Exemplo n.º 3
0
 public function getSearchLoot(SR_Player $player)
 {
     if (rand(0, 2)) {
         return array(SR_Item::createByName('Bacon'));
     }
     return parent::getSearchLoot($player);
 }
Exemplo n.º 4
0
 public static function execute(SR_Player $player, array $args)
 {
     $bot = Shadowrap::instance($player);
     if (count($args) < 2 || count($args) > 3) {
         $bot->reply(Shadowhelp::getHelp($player, 'gmi'));
         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 (false === ($item = SR_Item::createByName($args[1]))) {
         $bot->reply(sprintf('The item %s could not be created.', $args[1]));
         return false;
     }
     if (isset($args[2])) {
         if (!$item->isItemStackable()) {
             $bot->reply('No amount for equipment!');
             return false;
         }
         $item->saveVar('sr4it_amount', intval($args[2]));
     }
     $b = chr(2);
     $target->giveItems(array($item), sprintf("{$b}[GM]_%s{$b}", $player->getName()));
     return true;
 }
Exemplo n.º 5
0
 public function getSearchLoot(SR_Player $player)
 {
     $amt = SR_PlayerVar::getVal($player, 'TR_HQ2_DR', 0);
     if ($amt > 1) {
         return parent::getSearchLoot($player);
     }
     SR_PlayerVar::setVal($player, 'TR_HQ2_DR', $amt + 1);
     return array(SR_Item::createByName('LargeBeer'));
 }
Exemplo n.º 6
0
 public function setOrk(SR_Player $player)
 {
     $data = $this->getQuestData();
     $data['ORK1'] = 1;
     $this->saveQuestData($data);
     $player->message($this->lang('orkmsg'));
     // 		$player->message('The Ork dies. You grab his knife. It has "Renraku" as initials.');
     $player->giveItems(array(SR_Item::createByName('Knife')), 'The Ork');
 }
Exemplo n.º 7
0
 public function getSearchLoot(SR_Player $player)
 {
     if (0 !== SR_PlayerVar::getVal($player, '__WCSLC2', 0)) {
         return array();
     }
     $player->message(sprintf('You search the garbage of Tom\'s habitat and find some interesting scrolls.'));
     SR_PlayerVar::setVal($player, '__WCSLC2', 1);
     return array(SR_Item::createByName('TomsScroll1'), SR_Item::createByName('TomsScroll2'), SR_Item::createByName('TomsScroll3'));
 }
Exemplo n.º 8
0
 public function onQuestSolve(SR_Player $player)
 {
     $nuyen = 750;
     $player->message($this->lang('hand_back', array($nuyen)));
     // 		$player->message('Malois sneakily hands you '.$nuyen.' Nuyen and a piece of paper.');
     $player->giveNuyen($nuyen);
     $note = SR_Item::createByName('Note');
     $player->giveItems(array($note));
 }
Exemplo n.º 9
0
 public function getSearchLoot(SR_Player $player)
 {
     $amt = SR_PlayerVar::getVal($player, 'TR_CE_1', 0);
     if ($amt >= 2) {
         return parent::getSearchLoot($player);
     }
     SR_PlayerVar::setVal($player, 'TR_CE_1', $amt + 1);
     return array(SR_Item::createByName('Wine'));
 }
Exemplo n.º 10
0
 private function onSparkleItem(SR_Player $player)
 {
     $items = array('Ring', 'Amulet', 'Earring', 'LO_Ring', 'Knife', 'Stiletto', 'TinfoilCap', 'TinfoilBelt', 'TinfoilSandals');
     $iname = Shadowfunc::randomListItem($items);
     if (false === ($item = SR_Item::createByName($iname))) {
         $player->message('DB Error 4');
         return false;
     }
     return $player->giveItems(array($item), $this->lang($player, 'from_lake'));
 }
Exemplo n.º 11
0
 public function onQuestSolve(SR_Player $player)
 {
     // 		$xp = 3;
     // 		$ny = 450;
     $player->message($this->lang('grats', array($this->getRewardNuyen(), $this->getRewardXP())));
     // 		$player->message('The biker says: "Haha chummer, good job. Take this." - He hands you '.$ny.' nuyen and a BikerHelmet. You also gained '.$xp.' XP.');
     // 		$player->giveXP($xp);
     // 		$player->giveNuyen($ny);
     $player->giveItems(array(SR_Item::createByName('BikerHelmet')));
 }
Exemplo n.º 12
0
 private function onRing(SR_Player $player)
 {
     if ('1' === SR_PlayerVar::getVal($player, self::KEY_RING, '0')) {
         $this->onDirt($player);
     } else {
         $this->partyMessage($player, 'dig3', array($player->getName()));
         SR_PlayerVar::setVal($player, self::KEY_RING, '1');
         $player->giveItems(array(SR_Item::createByName('KylesRing')), $this->lang($player, 'from_chest'));
     }
 }
Exemplo n.º 13
0
 public function getItemModifiersA(SR_Player $player)
 {
     $back = array();
     switch ($player->getRace()) {
         default:
             $back['attack'] = 5;
             $back['intelligence'] = 1.5;
             break;
     }
     return SR_Item::mergeModifiers(parent::getItemModifiersA($player), $back);
 }
Exemplo n.º 14
0
 public function onNPCTalk(SR_Player $player, $word, array $args)
 {
     $c = Shadowrun4::SR_SHORTCUT;
     $quest = SR_Quest::getQuest($player, 'Renraku_I');
     if (!$quest->isAccepted($player)) {
         $this->rply('intro1');
         $this->rply('intro2');
         // 			$this->reply('Hello chummer, are you alright? You have been asleep for 32 hours!' );
         // 			$this->reply('You are another victim of Renraku?');
         $player->giveKnowledge('words', 'Hello', 'Renraku');
         // 			$this->reply('You were saying something about Renraku... Don`t ask me why ... But ... Take this... And maybe wear some clothes... :S');
         $this->rply('intro3');
         $items = array(SR_Item::createByName('FirstAid'), SR_Item::createByName('Clothes'), SR_Item::createByName('Trousers'), SR_Item::createByName('Shoes'));
         $player->giveItems($items, $this->getName());
         $quest->accept($player);
         $player->help($this->langNPC('intro4'));
         $player->help($this->langNPC('intro5'));
         $player->help($this->langNPC('intro6'));
         // 			$player->help('Equip your items now with the #equip command. Try #(eq)uip 3, #(eq)uip Trousers and #eq Shoes.');
         // 			$player->help('Check your character with: #(s)tatus, #(i)nventory, #e(q)uipment. Examine items with #(ex)amine.');
         // 			$player->help('The first thing you should do after checking your equipment is to find new "#kp" in your current city with #(exp)lore.');
     } elseif ($word === 'renraku') {
         $this->rply('renraku1');
         $this->rply('renraku2');
         // 			$this->reply('Geez, you don`t even remember what Renraku is?');
         // 			$this->reply('Check out these links: http://www.intercom.net/user/logan1/raku.htm and http://shadowrun.wikia.com/index.php/Renraku_Computer_Systems, chiphead.');
     } elseif ($word === 'chiphead') {
         $this->rply('chiphead');
         // 			$this->reply('Yeah, chiphead... Oh you don`t have a headcomputer yet? Your hairstyle suggested it.');
     } elseif ($word === 'headcomputer') {
         $this->rply('headcomputer');
         // 			$this->reply('Chummer, you must be really confused... A headcomputer is an interface to connect you to computer terminals... Maybe get some '.$c.'sleep.');
     } elseif ($word === 'hello') {
         $this->rply('hello');
         // 			$this->reply('Yeah, hello. Do you need a Hotel room? Somehow I like you chummer, so you don`t need to pay.');
         $player->giveKnowledge('words', 'Yes');
         $player->giveKnowledge('words', 'No');
     } elseif ($word === 'yes') {
         $this->rply('yes');
         $player->giveKnowledge('words', 'Yes');
         // 			$this->reply('Oh yes, you need a room to rest. Just do '.$c.'sleep here. You don`t need to pay.');
     } elseif ($word === 'no') {
         $this->rply('no');
         $player->giveKnowledge('words', 'No');
         // 			$this->reply('Oh, alright, if you don`t need a room now. You can come back anytime.');
     } else {
         $this->rply('default');
         // 			$this->reply('Hello, chummer, I hope you are alright now?');
     }
 }
Exemplo n.º 15
0
 public static function execute(SR_Player $player, array $args)
 {
     $bot = Shadowrap::instance($player);
     $c = Shadowrun4::SR_SHORTCUT;
     $b = chr(2);
     if ($player->isCreated()) {
         $bot->rply('1171');
         // 			$bot->reply('Your character has been created already. You can type '.$c.'reset to start over.');
         return false;
     }
     $races2 = SR_Player::getHumanRaces();
     $races = implode(', ', $races2);
     $genders = implode(', ', array_keys(SR_Player::$GENDER));
     if (count($args) !== 2) {
         return self::onHelp($player, $races, $genders);
     }
     $race = strtolower($args[0]);
     if (!in_array($race, $races2, true)) {
         $bot->rply('1172', array($races));
         // 			$bot->reply('Your race is unknown or an NPC only race. Valid races: '.$races.'.');
         return false;
     }
     $gender = strtolower($args[1]);
     if (!SR_Player::isValidGender($gender)) {
         $bot->rply('1173', array($genders));
         // 			$bot->reply('Your gender is unknown. Valid genders: '.$genders.'.');
         return false;
     }
     $player->saveOption(SR_Player::CREATED, true);
     $player->saveVars(array('sr4pl_race' => $race, 'sr4pl_gender' => $gender));
     $player->initRaceGender();
     Shadowcmd_aslset::onASLSetRandom($player);
     $player->modify();
     $player->healHP(10000);
     $player->healMP(10000);
     $p = $player->getParty();
     $p->pushAction('inside', 'Redmond_Hotel');
     $player->msg('start_1');
     $player->msg('start_2');
     $player->msg('start_3');
     $player->hlp('start_4');
     $player->giveItems(array(SR_Item::createByName('Pen')));
     $player->giveKnowledge('words', 'Shadowrun');
     $player->giveKnowledge('words', 'Renraku');
     $player->giveKnowledge('places', 'Redmond_Hotel');
     Shadowcmd_gmm::sendGlobalMessage(sprintf('Welcome a new player: %s the %s %s.', $player->getName(), $player->getGender(), $player->getRace()));
     return true;
 }
Exemplo n.º 16
0
 public function on_reward(SR_Player $player, array $args)
 {
     $bot = Shadowrap::instance($player);
     if (count($args) !== 1) {
         $bot->reply($this->lang($player, 'usage'));
         // 			$bot->reply('Usage: #reward <attribute|skill>. Will create a new rune.');
         return false;
     }
     $f = strtolower($args[0]);
     if (isset(SR_Player::$SKILL[$f])) {
         $f = SR_Player::$SKILL[$f];
     }
     if (isset(SR_Player::$ATTRIBUTE[$f])) {
         $f = SR_Player::$ATTRIBUTE[$f];
     }
     if ($f === 'essence') {
         $min = 0.1;
         $max = 0.1;
     } elseif (in_array($f, SR_Player::$SKILL)) {
         $min = 0.2;
         $max = 0.6;
     } elseif (in_array($f, SR_Player::$ATTRIBUTE)) {
         $min = 0.4;
         $max = 0.8;
     } else {
         $bot->reply($this->lang($player, 'unknown'));
         // 			$bot->reply('This skill or attribute is unknown.');
         return false;
     }
     $itemname = 'Rune_of_' . $f . ':' . Shadowfunc::diceFloat($min, $max, 1);
     if (false === ($item = SR_Item::createByName($itemname))) {
         $bot->reply($this->lang($player, 'broken'));
         // 			$bot->reply('My smith hammer is broken!');
         return false;
     }
     $bot->reply($this->lang($player, 'cheers'));
     // 		$bot->reply('The dwarf cheers and get\'s to work.');
     $bot->reply($this->lang($player, 'received', array($itemname)));
     // 		$bot->reply("You received ${itemname}.");
     $key = self::REWARD_RUNES;
     $player->giveItems(array($item));
     $player->decreaseConst($key, -1);
     if (!$player->hasConst($key)) {
         $bot->reply($this->lang($player, 'rewarded'));
         // 			$bot->reply('You haved used all your #reward now.');
     }
     return true;
 }
Exemplo n.º 17
0
 private function onEventMushroom(SR_Party $party)
 {
     foreach ($party->getMembers() as $member) {
         $member instanceof SR_Player;
         if ($member->isHuman()) {
             $percent = 0.05;
             $luck = $member->get('luck');
             $percent += $luck / 200;
             if (Shadowfunc::dicePercent($percent)) {
                 $amt = rand(2, 4);
                 $member->giveItems(array(SR_Item::createByName('Bolete', $amt)));
                 $member->message($this->lang($member, 'mushrooms', array($amt)));
             }
         }
     }
 }
Exemplo n.º 18
0
 public function giveElectronicParts(SR_Player $player)
 {
     if (!$this->isInQuest($player)) {
         return array();
     }
     $data = $this->getQuestData();
     if (!isset($data['DROPPED'])) {
         $data['DROPPED'] = 0;
     }
     if ($data['DROPPED'] >= $this->getNeededAmount()) {
         return array();
     }
     $data['DROPPED']++;
     $this->saveQuestData($data);
     return array(SR_Item::createByName('ElectronicParts'));
 }
Exemplo n.º 19
0
 public function onLeaveLocation(SR_Party $party)
 {
     foreach ($party->getMembers() as $member) {
         $member instanceof SR_Player;
         # The heat is on?
         if (!$member->hasConst(self::KEY)) {
             continue;
         }
         if (false !== ($milk = $member->getInvItemByName('Milk', false, false))) {
             $amt = $milk->getAmount();
             if (false !== $member->deleteFromInventory($milk)) {
                 $member->message($this->lang($member, 'sour'));
                 $member->giveItems(array(SR_Item::createByName('SourMilk', $amt)));
             }
         }
     }
 }
Exemplo n.º 20
0
 public static function giveItem(SR_Player $player, SR_Player $target, $id, $amt = 1)
 {
     if ($amt < 1) {
         $player->msg('1038');
         // 			$player->message('Please give a positive amount of items.');
         return false;
     }
     if (false === ($item = $player->getInvItem($id))) {
         $player->msg('1029');
         // 			$player->message('You don`t have that item.');
         return false;
     }
     // 		if (false === $item->isItemTradeable())
     // 		{
     // 			$player->message('You are not allowed to trade this item.');
     // 			return false;
     // 		}
     if ($item->isItemStackable()) {
         if ($amt > $item->getAmount()) {
             $player->msg('1040', array($item->getItemName()));
             // 				$player->message(sprintf('You only have %d %s.', $item->getAmount(), $item->getName()));
             return false;
         }
         $giveItem = SR_Item::createByName($item->getItemName(), $amt, true);
         $item->useAmount($player, $amt);
     } else {
         if ($amt !== 1) {
             $player->message('Currently you can only give one equipment at a time.');
             return false;
         }
         $player->removeFromInventory($item);
         $giveItem = $item;
     }
     $busymsg = $player->isFighting() ? Shadowfunc::displayBusy($player->busy(SR_Player::GIVE_TIME)) : '';
     self::rply($player, '5115', array($amt, $giveItem->displayFullName($player), $target->getName(), $busymsg));
     // 		$player->message(sprintf('You gave %d %s to %s.%s', $amt, $giveItem->getName(), $target->getName(), $busymsg));
     $target->giveItems(array($giveItem), $player->getName());
     // 		if ($target instanceof SR_TalkingNPC)
     // 		{
     // 			$target->onNPCGive($player, $items);
     // 		}
     return true;
 }
Exemplo n.º 21
0
 public function checkQuest(SR_NPC $npc, SR_Player $player)
 {
     $given = $this->giveQuesties($player, $npc, 'BlackOrchid', 0, 1);
     if ($given > 0) {
         if (rand(0, 4) === 0) {
             $npc->reply($this->lang('yay1'));
             $player->message($this->lang('yay2'));
             $player->giveItems(array(SR_Item::createByName('WhiteOrchid')), $npc->getName());
             if ($this->isInQuest($player)) {
                 $this->onSolve($player);
             }
         } else {
             $npc->reply($this->lang('aww'));
         }
     } else {
         $npc->reply($this->lang('more'));
     }
     return true;
 }
Exemplo n.º 22
0
 public function getReward(SR_Player $player)
 {
     $possible = array(array('LO_Rune_of_attack:0.3', 'Rune_of_body:0.5'));
     if ($player->getBase('bows') >= 0) {
         $possible[] = array('SportBow_of_bows:1,attack:1', 'Ammo_Arrow', 'Ammo_Arrow');
     }
     if ($player->getBase('pistols') >= 0) {
         $possible[] = array('AresPredator_of_attack:1,max_dmg:1', 'Ammo_9mm');
     }
     if ($player->getBase('ninja') >= 0) {
         $possible[] = array('NinjaSword');
     }
     if ($player->getBase('magic') >= 0) {
         $possible[] = array('ElvenStaff_of_magic:2,max_hp:2');
     }
     $reward = $possible[array_rand($possible, 1)];
     $back = array();
     foreach ($reward as $itemname) {
         $back[] = SR_Item::createByName($itemname);
     }
     return $back;
 }
Exemplo n.º 23
0
 public function onNPCQuestTalkB(SR_TalkingNPC $npc, SR_Player $player, $word, array $args = NULL)
 {
     $need = $this->getNeededAmount();
     $ny = $this->getRewardNuyen();
     $dny = Shadowfunc::displayNuyen($ny);
     switch ($word) {
         case 'shadowrun':
             $npc->reply("I have to securely inform some friends with some message.");
             $npc->reply("Can you show a DataCrystal to all my friends?");
             break;
         case 'confirm':
             $npc->reply("Just show them to all the Johnsons.");
             break;
         case 'yes':
             $player->giveItems(array(SR_Item::createByName('DataCrystal')), 'Mr.Johnson');
             $npc->reply("Just show them to all the Johnsons.");
             break;
         case 'no':
             $npc->reply('ok');
             break;
     }
     return true;
 }
Exemplo n.º 24
0
 public function on_fill(SR_Player $player, array $args)
 {
     switch (count($args)) {
         case 0:
             $amt = 1;
             break;
         case 1:
             $amt = (int) $args[0];
             break;
         default:
             return $player->message(Shadowhelp::getHelp($player, 'fill'));
     }
     if (false === ($item = $player->getInvItem('EmptyBottle'))) {
         return $player->message('You don\'t have any empty bottles.');
     }
     if ($item->getAmount() < $amt) {
         return $player->message(sprintf('You only have %d empty bottles.', $item->getAmount()));
     }
     if (false === $item->useAmount($player, $amt)) {
         return $player->message('ERROR!');
     }
     return $player->giveItems(array(SR_Item::createByName('WaterBottle', $amt)), 'the well');
 }
Exemplo n.º 25
0
 public function checkQuest(SR_NPC $npc, SR_Player $player)
 {
     $have_before = $this->getAmount();
     $need = $this->getNeededAmount();
     $have = $this->giveQuesties($player, $npc, 'FairyStaff', $have_before, $need);
     if ($have > $have_before) {
         $npc->reply('Thank you a lot, chummer.');
         $this->saveAmount($have);
     }
     if ($have >= $need) {
         $npc->reply('Ok chummer, i will now tell you howto #brew potions.');
         $npc->reply('Simply use the #brew <spell> [<level>] command and have a WaterBottle ready.');
         if ($player->getBase('alchemy') < 0) {
             $player->message('You have learned the alchemy skill and unlocked the #brew command.');
             $player->saveBase('alchemy', 0);
             $player->modify();
         }
         $this->onSolve($player);
         $npc->reply('You know what ... i give you 4 WaterBottles for a startup.');
         $player->giveItems(array(SR_Item::createByName('WaterBottle', 4)));
     } else {
         $npc->reply(sprintf('I still need %d Fairy Staffs for my experiments.', $need - $have));
     }
 }
Exemplo n.º 26
0
 public function checkQuest(SR_NPC $npc, SR_Player $player)
 {
     if (!$this->isInQuest($player)) {
         return false;
     }
     if ($this->getAmount() >= $this->getNeededAmount()) {
         $npc->reply($this->lang('thanks'));
         // 			$npc->reply('Thank you very much!');
         $player->message($this->lang('reward'));
         // 			$player->message(sprintf('The elve cheers and hands out a glowing dark bow.'));
         $bow = SR_Item::createByName('DarkBow');
         $mod1 = SR_Rune::randModifier($player, 10);
         $mod2 = SR_Rune::randModifier($player, 10);
         $modifiers = SR_Rune::mergeModifiers($mod1, $mod2);
         $bow->addModifiers($modifiers);
         $player->giveItems(array($bow), $npc->getName());
         $this->onSolve($player);
         return true;
     } else {
         $npc->reply($this->lang('more', array($this->getAmount(), $this->getNeededAmount())));
         // 			$npc->reply(sprintf('I see you have punished %s of %s Angry Elves.', $this->getAmount(), $this->getNeededAmount()));
         return false;
     }
 }
Exemplo n.º 27
0
 private function onViewItem(SR_Clan $clan, SR_Player $player, $itemname, $amt)
 {
     if (false === ($item = SR_Item::createByName($itemname, $amt, false))) {
         $player->message('ITEM ERROR');
         return false;
     }
     $bot = Shadowrap::instance($player);
     return $bot->reply($item->getItemInfo($player));
 }
Exemplo n.º 28
0
 public function onUsePotion(SR_Player $player, array $args)
 {
     // 		echo "Using potion".implode(',', $args).PHP_EOL;
     $receive_bottle = true;
     $mods = $this->getItemModifiersB();
     $spellname = key($mods);
     $level = array_shift($mods);
     if (false === ($spell = SR_Spell::getSpell($spellname))) {
         $player->message('Unknown spell');
         return false;
     }
     $spell->setCaster($player);
     $spell->setMode(SR_Spell::MODE_POTION);
     if (count($args) === 0) {
         $args[] = '';
     }
     if ($spell->isOffensive()) {
         $receive_bottle = false;
         if (!$player->isFighting()) {
             $player->msg('1180');
             // 				$player->message('This potion works in combat only.');
             return false;
         }
     }
     if (false !== ($target = $spell->getTarget($player, $args, false))) {
         if (!$spell->isOffensive() && $target->getID() !== $player->getID()) {
             $player->msg('1181');
             // 				$player->message('You cannot inject potions into other peoples mouth\'.');
             return false;
         }
     }
     // 		echo "Using potion 2222 ".implode(',', $args).PHP_EOL;
     # Dummy player
     $mods['magic'] = false === isset($mods['magic']) ? $player->getBase('magic') : $mods['magic'];
     $mods['intelligence'] = false === isset($mods['intelligence']) ? $player->getBase('intelligence') : $mods['intelligence'];
     $mods['wisdom'] = false === isset($mods['wisdom']) ? $player->getBase('wisdom') : $mods['wisdom'];
     $dummy = new SR_Player(SR_Player::getPlayerData(0));
     $dummy->setVar('sr4pl_magic', $mods['magic']);
     $dummy->setVar('sr4pl_intelligence', $mods['intelligence']);
     $dummy->setVar('sr4pl_wisdom', $mods['wisdom']);
     $dummy->setSpellData(array($spellname => $level));
     $dummy->modify();
     $spell->setCaster($dummy);
     if (false === $spell->onCast($player, $args, $level)) {
         return false;
     }
     if ($receive_bottle) {
         $player->giveItems(array(SR_Item::createByName('EmptyBottle')));
     }
     return true;
 }
Exemplo n.º 29
0
 /**
  * Pop an item from your mount.
  * @param SR_Player $player
  * @param array $args
  */
 private static function on_pop(SR_Player $player, array $args)
 {
     if (self::inCombatOrDungeon($player)) {
         return false;
     }
     $bot = Shadowrap::instance($player);
     $mount = $player->getMount();
     array_shift($args);
     // 		if (0 === ($cnt = count($args)))
     // 		{
     // 			return self::on_show($player, $args);
     // 		}
     // 		if ($cnt > 2)
     // 		{
     // 			return self::on_help($player, $args);
     // 		}
     # Is Storage Mount?
     if (0 >= ($max = $mount->getMountWeight())) {
         self::rply($player, '1037');
         // 			$bot->reply(sprintf('You cannot store items in your %s.', $mount->getName()));
         return false;
     }
     # GetItem
     $itemname = array_shift($args);
     if (false === ($item = $player->getMountInvItem($itemname))) {
         self::rply($player, '1042');
         // 			$bot->reply('You don`t have that item in your mount.');
         return false;
     }
     $itemname = $item->getItemName();
     $ditemname = $item->displayFullName($player);
     $amt = isset($args[0]) ? intval(array_shift($args)) : 1;
     $collected = 0;
     # Pre-Amt
     if ($amt <= 0) {
         self::rply($player, '1038');
         // 			$bot->reply('Please pop a positve amount of items.');
         return false;
     }
     # Stack
     if ($item->isItemStackable()) {
         $have_amt = $item->getAmount();
         if ($amt > $have_amt) {
             self::rply($player, '1043', array($ditemname, $mount->getName()));
             // 				$bot->reply(sprintf('You don\'t have that much %s in your %s.', $itemname, $mount->getName()));
             return false;
         }
         if (false === ($item2 = SR_Item::createByName($itemname, $amt, true))) {
             $bot->reply(sprintf('Cannot create item in %s line %s.', __FILE__, __LINE__));
             return false;
         }
         if (false === $item->useAmount($player, $amt)) {
             $bot->reply(sprintf('Cannot use item amount in %s line %s.', __FILE__, __LINE__));
             return false;
         }
         // 			if ($item->getAmount() <= 0)
         // 			{
         // 				if (false === $player->removeFromMountInv($item))
         // 				{
         // 					$bot->reply(sprintf('Cannot remove from mount inventory in %s line %s.', __FILE__, __LINE__));
         // 				}
         // 			}
         $player->giveItem($item2);
         $collected = $amt;
     } else {
         $items2 = $player->getMountItems($itemname, $amt);
         foreach ($items2 as $item2) {
             if (false !== $player->removeFromMountInv($item2)) {
                 if (false !== $player->giveItem($item2)) {
                     $collected++;
                     if ($collected >= $amt) {
                         break;
                     }
                 }
             }
         }
     }
     // 		$player->updateInventory();
     $player->modify();
     $invid = -1;
     if (false !== ($invItem = $player->getInvItemByName($itemname))) {
         $invid = $invItem->getInventoryID();
     }
     return self::rply($player, '5081', array($collected, $ditemname, $mount->displayName($player), $invid));
     // 		$reply = sprintf('You collect %d %s from your %s and put it into your inventory.', $collected, $itemname, $mount->getName());
     // append inventory id if it can be determined
     // 		$invItem = $player->getInvItemByName($itemname);
     // 		if ($invItem !== false)
     // 		{
     // 			$reply .= sprintf(' Inventory ID: %d.', $invItem->getInventoryID());
     // 		}
     // 		return $bot->reply($reply);
 }
Exemplo n.º 30
0
 public function onHacked(SR_Player $player, $hits)
 {
     $player->message('You managed to create a backup from a big data server.');
     $player->giveItems(array(SR_Item::createByName('NySoftBackup')), 'hacking a computer');
 }