예제 #1
0
 public function onItemUse(SR_Player $player, array $args)
 {
     if ($player->isFighting()) {
         $player->message('You cannot use this item in combat.');
         return false;
     }
     $bot = Shadowrap::instance($player);
     $mods = $this->getItemModifiersB();
     $field = key($mods);
     $level = array_shift($mods);
     $key = "__SLMSCR_{$field}";
     if (false !== SR_PlayerVar::getVal($player, $key)) {
         return $bot->reply('You already read this master scroll.');
     }
     if ($player->getBase($field) < 0) {
         return $bot->reply("You have to learn {$field} in order to read a master scroll.");
     }
     if (!$this->useAmount($player, 1)) {
         return $bot->reply('Database error!');
     }
     if (false === $player->increaseField($field)) {
         return $bot->reply('Database error 2!');
     }
     if (false === SR_PlayerVar::setVal($player, $key, '1')) {
         return $bot->reply('Database error 3!');
     }
     $player->modify();
     return $bot->reply(sprintf('You read the %s and got your %s increased by 1.', $this->getItemName(), $field));
 }
예제 #2
0
파일: Mordak.php 프로젝트: sinfocol/gwf3
 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();
 }
예제 #3
0
 /**
  * Distribute bad karma to a player. Announce to him too.
  * @param SR_Player $player
  * @param float $add
  * @return true|false
  */
 public static function addBadKarma(SR_Player $player, $add)
 {
     $add = round($add, 2);
     # Sane?
     if ($add <= 0) {
         return true;
     }
     # Get fraction
     $fraction = SR_PlayerVar::getVal($player, '__SLBADKARMA', 0.0);
     # Add more
     $fraction += $add;
     # To ints
     $abk = (int) $fraction;
     $fraction -= $abk;
     # Full int?
     if ($abk >= 1) {
         # Save new int bad karma
         $bk = $player->getBase('bad_karma');
         $player->saveBase('bad_karma', $bk + $abk);
     }
     # Announce
     $player->msg('5036', array($add));
     // 		$player->message(sprintf('Your character has been punished with %s bad_karma.', $abk+$fraction));
     # Save fraction
     return SR_PlayerVar::setVal($player, '__SLBADKARMA', round($fraction, 2));
 }
예제 #4
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'));
 }
예제 #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'));
 }
예제 #6
0
파일: Storage1.php 프로젝트: sinfocol/gwf3
 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'));
 }
예제 #7
0
파일: Grove.php 프로젝트: sinfocol/gwf3
 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'));
     }
 }
예제 #8
0
파일: Clearing.php 프로젝트: sinfocol/gwf3
 public function onPullSword(SR_Player $player)
 {
     $p = $player->getParty();
     $numSkels = self::getNumSkeletons($player);
     $this->partyMessage($player, 'pulled1', array($player->getName()));
     $this->partyMessage($player, 'pulled2');
     $this->partyMessage($player, 'pulled3');
     $this->partyMessage($player, 'pulled4', array($numSkels));
     $skels = array();
     for ($i = 0; $i < $numSkels; $i++) {
         $skels[] = 'Forest_Skeleton';
     }
     SR_PlayerVar::setVal($player, self::SKELSKEY, '0');
     $p->fight(SR_NPC::createEnemyParty($skels));
 }
예제 #9
0
파일: Skeleton.php 프로젝트: sinfocol/gwf3
 public function getNPCLoot(SR_Player $player)
 {
     # Increase some temp counter
     $leader = $player->getParty()->getLeader();
     $kills = SR_PlayerVar::getVal($player, Forest_Clearing::SKELSKEY, '0');
     $kills++;
     SR_PlayerVar::setVal($player, Forest_Clearing::SKELSKEY, $kills);
     if ($kills >= Forest_Clearing::getNumSkeletons($leader)) {
         if (SR_PlayerVar::getVal($player, Forest_Clearing::SWORDKEY, '0') === '0') {
             SR_PlayerVar::setVal($player, Forest_Clearing::SWORDKEY, '1');
         }
     }
     # A bone \o/
     return array('Bone');
 }
예제 #10
0
파일: Ueberpunk.php 프로젝트: sinfocol/gwf3
 public function getNPCLoot(SR_Player $player)
 {
     $back = array();
     # Free scroll
     $key = 'RED_FIR_UBER';
     if ('0' === SR_PlayerVar::getVal($player, $key, '0')) {
         SR_PlayerVar::setVal($player, $key, '1');
         $back[] = 'ScrollOfWisdom';
     }
     # Free head
     $quest = SR_Quest::getQuest($player, 'Redmond_Ueberpunk');
     if ($quest->isInQuest($player) && false === $player->getInvItemByName('UeberpunkHead')) {
         $back[] = 'UeberpunkHead';
     }
     return $back;
 }
예제 #11
0
파일: MCJohnson.php 프로젝트: sinfocol/gwf3
 public function onNPCTalk(SR_Player $player, $word, array $args)
 {
     if (true === SR_Quest::getQuest($player, 'Chicago_OwlJohnsonRoundtrip')->onRoundtripShow($player, $this)) {
         return true;
     }
     if ($this->onNPCQuestTalk($player, $word, $args)) {
         return true;
     }
     $b = chr(2);
     switch ($word) {
         case 'bounty':
             if ($this->onNPCBountyTalk($player, $word, $args)) {
                 return true;
             }
             return $this->rply('bounty');
             // 				return $this->reply('You want to become a bountyhunter?');
         // 				return $this->reply('You want to become a bountyhunter?');
         case 'malois':
             $key = '_SLQCHW1';
             if (SR_PlayerVar::getVal($player, $key)) {
                 return $this->rply('malois');
                 // 					return $this->reply('This is all i know, and i shouldn\'t have told you that.');
             } else {
                 $this->rply('malois1');
                 // 					$this->reply('Malois? Isn\'t that the guy who claimed to be a Renraku proband and went to prison?');
                 $this->rply('malois2');
                 // 					$this->reply('Well ... that\'s probably not your business... Maybe i mean Matthew.');
                 $player->message($this->langNPC('malois3'));
                 // 					$player->message('You consider that being useful information.');
                 SR_PlayerVar::setVal($player, $key, 1);
             }
             return $this->rply('malois4');
             // 				return $this->reply('Listen chummer, it is not your business, and i would not put my hands in corp business like Renraku');
         // 				return $this->reply('Listen chummer, it is not your business, and i would not put my hands in corp business like Renraku');
         default:
             return $this->rply('default');
             // 				$this->reply("Yo chummer");
             // 				return true;
     }
 }
예제 #12
0
파일: TomRiddle.php 프로젝트: sinfocol/gwf3
 public function onQuestSolved(SR_Player $player, $word, array $args)
 {
     $val = SR_PlayerVar::getVal($player, 'TOMRIDDLE', '0');
     if ($val === '1') {
         return $this->rply('thx');
         // 			return $this->reply('Thank you. I will never forget the password again.');
     }
     $this->rply('wow');
     // 		$this->reply('Let me try it ... Oh gosh ... It works! Thank you so much ... Take this:');
     SR_PlayerVar::setVal($player, 'TOMRIDDLE', '1');
     $nuyen = 300;
     $player->giveNuyen($nuyen);
     $player->message($this->langNPC('reward', array(Shadowfunc::displayNuyen($nuyen))));
     // 		$player->message(sprintf('Tom hands you %s.', Shadowfunc::displayNuyen($nuyen)));
     if ($player->getBase('crypto') < 0) {
         $player->message($this->langNPC('learned'));
         // 			$player->message('You have learned a new knowledge: crypto.');
         $player->saveBase('crypto', 0);
         $player->modify();
     }
     return true;
 }
예제 #13
0
 public function onCityEnter(SR_Party $party)
 {
     $player = $party->getLeader();
     SR_PlayerVar::setVal($player, 'THQLVTRC', 0);
     return parent::onCityEnter($party);
 }
예제 #14
0
파일: SR_Bazar.php 프로젝트: sinfocol/gwf3
 private function onBuySlot(SR_Player $player)
 {
     $price = $this->calcBuySlotPrice($player);
     $avail_slots = $this->getBazarSlots($player);
     if ($player->getNuyen() < $price) {
         $player->msg('1063', array(Shadowfunc::displayNuyen($price), $player->displayNuyen()));
         // 			$player->message(sprintf('It would cost %s to purchase slot number %s, but you only have %s.', Shadowfunc::displayNuyen($price), $avail_slots+1, $player->displayNuyen()));
         return false;
     }
     if (false === $player->giveNuyen(-$price)) {
         $player->message('Database Error 1!');
         return false;
     }
     $ps = SR_PlayerVar::getVal($player, '__BAZAAR_SLOTS', 0);
     if (false === SR_PlayerVar::setVal($player, '__BAZAAR_SLOTS', $ps + 1)) {
         $player->message('Database Error 1!');
         return false;
     }
     $player->msg('5158', array(Shadowfunc::displayNuyen($price), $avail_slots + 1));
     // 		return $player->message(sprintf('You pay the fee of %s and now have %s bazar slots.', Shadowfunc::displayNuyen($price), $avail_slots+1));
 }
예제 #15
0
 public function setElevatorFlags(SR_Player $player, $bits, $bool = true)
 {
     $old = $this->getElevatorFlags($player);
     $new = $bool ? $old | $bits : $old & ~$bits;
     return SR_PlayerVar::setVal($player, $this->getElevatorKey(), $new);
 }
예제 #16
0
파일: Block1.php 프로젝트: sinfocol/gwf3
 public function on_write(SR_Player $player, array $args)
 {
     $bot = Shadowrap::instance($player);
     if (false === ($chalk = $player->getInvItemByName('Chalk', false)) && false === ($pen = $player->getInvItemByName('Pen', false))) {
         $bot->reply('You don\'t have anything to write on the prison wall, chummer.');
         return false;
     }
     if (count($args) === 0) {
         $bot->reply('You succesfully wrote nothing on the wall ... does not look too bad, you think to yourself.');
         return false;
     }
     $key = self::KEY_WRITE;
     $message = implode(' ', $args);
     if (false === ($written = SR_PlayerVar::getVal($player, $key))) {
         $re = '';
     } else {
         $re = 'RE';
     }
     if ($message === self::MSG_CHAPTER_III) {
         $this->onChapterIIIDone($player);
     }
     if (false === SR_PlayerVar::setVal($player, $key, $message)) {
         $bot->reply('DB ERROR 1');
         return false;
     }
     $bot->reply(sprintf('You successfully %swrote "%s" on the prison wall', $re, $message));
     return true;
 }
예제 #17
0
 private function onGiveScrolls(SR_Player $player)
 {
     $have = SR_PlayerVar::getVal($player, self::SCRL_COUNT, 0);
     $need = PHP_INT_MAX;
     $have_after = $this->giveQuesties($player, 'ScrollOfWisdom', $have, $need);
     $given = $have_after - $have;
     if ($given > 0) {
         $this->reply(sprintf('Thanks buddy, you now have given me %s scrolls iirc :)', $have_after));
         SR_PlayerVar::setVal($player, self::SCRL_COUNT, $have_after);
     } else {
         $this->reply('Hey, you don´t have a scroll.');
     }
     $player->unsetTemp(self::TMP_SCROLL);
 }
예제 #18
0
 public function getNPCLoot(SR_Player $player)
 {
     if ($this->arena_ny > 0) {
         $ny = $this->arena_ny;
         $player->msg('5125', array(Shadowfunc::displayNuyen($ny)));
         // 			$player->message(sprintf('You get a reward of %s for killing the enemy.', Shadowfunc::displayNuyen($ny)));
         $player->giveNuyen($ny);
     }
     if ($this->arena_key === NULL) {
         return array();
     }
     list($bit, $key) = explode(':', $this->arena_key);
     $bits = (int) SR_PlayerVar::getVal($player, $key, 0);
     $bits |= $bit;
     SR_PlayerVar::setVal($player, $key, $bits);
     return array();
 }