private function checkIDCards(SR_Player $player) { $p = $player->getParty(); $names = array(); foreach ($p->getMembers() as $member) { $member instanceof SR_Player; if (!$member->getInvItemByName('IDCard')) { $names[] = $member->getName(); } } if (count($names) > 0) { $this->rply('no_card', array(implode(', ', $names))); // $p->notice(sprintf("It seems like %s is/are missing an IDCard.", GWF_Array::implodeHuman($names))); $this->rply('everyone'); // $this->reply('Every person needs an own ID card. Move along.'); return; } $this->rply('revoke'); // $this->reply('These ID cards need to be revoked and you have to get a new one. I will also have to keep them for investigation. I may let you pass as your security level is below 2.'); $this->rply('hand'); // $p->notice("Each member hands an IDCard to the guards and you enter the Renraku tower."); foreach ($p->getMembers() as $member) { $member instanceof SR_Player; $card = $member->getInvItemByName('IDCard'); $card->useAmount($member, 1); } // Delete guards $this->getParty()->popAction(true); $p->popAction(false); $renraku = $player->getParty()->getLocationClass(); $renraku instanceof Seattle_Renraku; $renraku->beam($player, 'Renraku_Exit', SR_Party::ACTION_INSIDE); }
public function onEnter(SR_Player $player) { $p = $player->getParty(); # We know the mafia :) $quest = SR_Quest::getQuest($player, 'HiJack'); if ($quest->isAccepted($player)) { return parent::onEnter($player); } # Check how many guards have been killed in total $killed = 0; foreach ($p->getMembers() as $member) { $member instanceof SR_Player; $killed += SR_PlayerVar::getVal($member, 'mgkills', 0); } if ($killed >= 6) { return parent::onEnter($player); } # Guarded! foreach ($p->getMembers() as $member) { $member instanceof SR_Player; $member->message($this->lang($member, 'guarded')); } $guards = array(); for ($i = 0; $i < 6; $i++) { $guards[] = 'Vegas_MafiaGuard'; } SR_NPC::createEnemyParty($guards)->fight($p); return false; }
public function onEnter(SR_Player $player) { $party = $player->getParty(); $this->partyMessage($player, 'cracked'); // $party->notice('You easily manage to crack the rotten front door open...'); $this->teleportInside($player, 'OrkHQ_Exit'); }
/** * Beam a party to a target location. * @param SR_Player $player * @param string $target * @param string $action */ public function beam(SR_Player $player, $target = 'Redmond_Hotel', $action = 'inside') { if (false === ($location = Shadowrun4::getLocationByTarget($target))) { $player->message('Unknown location to beam to, report to gizmore!'); Dog_Log::error('Unknown $target "' . $target . '" for ' . __METHOD__ . ' in ' . __FILE__ . ' line ' . __LINE__ . '.'); return false; } $party = $player->getParty(); # City changed? $oldcity = $party->getCity(); $party->pushAction($action, $target); $newcity = $party->getCity(); if ($oldcity !== $newcity) { $city = $party->getCityClass(); $city->onCityEnter($party); } // if ($action === 'inside') // { // foreach ($party->getMembers() as $member) // { // $member->message($location->getEnterText($member)); // } // } $party->giveKnowledge('places', $target); return true; }
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(); }
public function onEnter(SR_Player $player) { $party = $player->getParty(); $dice = rand(0, 6); if ($dice < 2) { $this->partyMessage($player, 'lucky'); // $party->notice('You silently search the door and windows for an entrance. You were lucky and sneak in...'); $this->teleportInside($player, 'Hideout_Exit'); } else { if ($dice < 4) { $this->partyMessage($player, 'noluck'); // $party->notice('You silently search the door and windows for an entrance. You have no luck, everything\'s closed.'); } else { if ($dice < 6) { $this->partyMessage($player, 'fight2'); // $party->notice('You silently search the door and windows for an entrance. Two punks notice you and attack!'); SR_NPC::createEnemyParty('Redmond_Cyberpunk', 'Redmond_Cyberpunk')->fight($party, true); } else { $this->partyMessage($player, 'fight4'); // $party->notice('You take a look through the doors keyhole. A party of four punks opens the door and surprises you.'); SR_NPC::createEnemyParty('Redmond_Cyberpunk', 'Redmond_Cyberpunk', 'Redmond_Pinkhead', 'Redmond_Lamer')->fight($party, true); } } } }
public function onEnter(SR_Player $player) { $party = $player->getParty(); $player->message($this->lang($player, 'no_enter')); // $player->message('You cannot find any open entrance to the ship ... Yet.'); return false; }
public static function execute(SR_Player $player, array $args) { if ('' === ($message = trim(implode(' ', $args)))) { return false; } $p = $player->getParty(); $ep = $p->getEnemyParty(); $pname = $player->getName(); if ($p->isTalking() && $ep !== false) { $p->ntice('5085', array($pname, $message)); $ep->ntice('5085', array($pname, $message)); $p->setContactEta(60); $el = $ep->getLeader(); if ($el->isNPC()) { $ep->setContactEta(60); $el->onNPCTalkA($player, isset($args[0]) ? $args[0] : 'hello', $args); } } elseif ($p->isAtLocation()) { Shadowshout::onLocationGlobalMessage($player, '5085', array($pname, $message)); } elseif ($p->isFighting()) { $p->ntice('5085', array($pname, $message)); $ep->ntice('5085', array($pname, $message)); } else { $p->ntice('5085', array($pname, $message)); } return true; }
public static function onFight(SR_Player $player, SR_Party $ep) { $p = $player->getParty(); $l1 = $player->get('level'); $add = 0.0; foreach ($ep->getMembers() as $e) { $e instanceof SR_Player; if (!$e->isHuman()) { $add += 0.05; continue; } $badkarma = $e->getBase('bad_karma'); if ($badkarma > 0) { continue; } // $bounty = $e->getBase('sr4pl_bounty'); $l2 = $e->get('level'); $diff = $l1 - $l2; if ($diff < 0) { continue; } $add += round($diff / 100, 2); } self::addBadKarma($player, $add); }
protected static function onHPMP(SR_Player $player, $what, $key) { // $i = 1; $b = chr(2); // $bot = Shadowrap::instance($player); $party = $player->getParty(); $members = $party->getMembers(); $format = $player->lang('fmt_hp_mp'); $back = ''; foreach ($members as $member) { $member instanceof SR_Player; $hpmp = $member->getBase($what); $hpmmpm = $member->get('max_' . $what); $b2 = ''; $b1 = 0; if ($what === 'hp') { if ($member->needsHeal()) { $b2 = $b; $b1 = 1; } } elseif ($what === 'mp') { if ($member->getBase('magic') >= 0) { if ($member->needsEther()) { $b2 = $b; $b1 = 1; } } } $back .= sprintf($format, $member->getEnum(), $member->getName(), $hpmp, $hpmmpm, $b2, $b1); // $back .= sprintf(", %s-%s%s(%s/%s)%s", $b.($member->getEnum()).$b, $b2, $member->getName(), $hpmp, $hpmmpm, $b2); } return self::rply($player, $key, array(ltrim($back, ',; '))); // $bot->reply(sprintf('Your parties %s: %s.', $text, substr($back, 2))); // return true; }
public static function execute(SR_Player $player, array $args) { $p = $player->getParty(); if (false !== ($city = $p->getCityClass())) { if ($city->isDungeon()) { self::rply($player, '1035'); return false; // Shadowrap::instance($player)->reply('In dungeons you don\'t have mounts.'); } } // $i = 1; $format = $player->lang('fmt_sumlist'); $out = ''; $total = 0.0; $total_max = 0.0; foreach ($p->getMembers() as $member) { $member instanceof SR_Player; $mount = $member->getMount(); $we = $mount->calcMountWeight(); $max = $mount->getMountWeightB(); $total += $we; $total_max += $max; if ('' !== ($weight = $mount->displayWeight())) { // $weight = "({$weight})"; } $out .= sprintf($format, $member->getEnum(), $mount->getName(), $weight); // $out .= sprintf(", \x02%s\x02-%s%s", $member->getEnum(), $mount->getName(), $weight); } return self::rply($player, '5083', array(Shadowfunc::displayWeight($total), Shadowfunc::displayWeight($total_max), ltrim($out, ',; '))); // $message = sprintf('Party Mounts(%s/%s): %s.', Shadowfunc::displayWeight($total), Shadowfunc::displayWeight($total_max), substr($out, 2)); return Shadowrap::instance($player)->reply($message); }
public function onEnter(SR_Player $player) { $p = $player->getParty(); if ($p->getMin('level', true) < 1) { $this->partyMessage($player, 'afraid', array(1)); // $p->notice('You are too afraid to go in there. (Each party member needs a minimum level of 1)'); return true; } foreach ($p->getMembers() as $member) { $member instanceof SR_Player; if ($member->isHuman()) { $quest = SR_Quest::getQuest($member, 'Renraku_I'); $quest instanceof Quest_Renraku_I; if (false === $quest->checkOrk($player)) { $this->partyMessage($player, 'angryork'); // $p->notice('A big angry Ork shouts to you: "You not welcome here!" - The Ork attacks you with a tbs-pocket-knife.'); SR_NPC::createEnemyParty('Redmond_Ork')->fight($p, true); return true; } } } parent::onEnter($player); // $p->pushAction(SR_Party::ACTION_INSIDE); $b = chr(2); $c = Shadowrun4::SR_SHORTCUT; $this->partyMessage($player, 'enter1'); $this->partyMessage($player, 'enter2'); // $p->notice('The guys in there stare quiet at their drinks when you enter the Trolls\' Inn.'); // $p->notice('You see a barkeeper, a suspicious person in a dark corner, a soldier and some guests, mostly orks and trolls. One of the guests greets and beckons you.'); $this->partyHelpMessage($player, 'help'); // $p->help("Use {$b}{$c}ttb{$b}(arkeeper), {$b}{$c}ttg{$b}(uest), {$b}{$c}ttj{$b}(ohnson) and {$b}{$c}tts{$b}(oldier) to talk to the persons."); return true; }
public function cast(SR_Player $player, SR_Player $target, $level, $hits, SR_Player $potion_player) { // echo "Casting Firewall with level $level and $hits hits.\n"; # Firebolt ads 0.20 per level $firebolt = $potion_player->getSpell('firebolt'); $firebolt = $firebolt === false ? 0 : $firebolt->getLevel($potion_player); $firebolt = round($firebolt / 5, 1); $level += $firebolt; # Fireball ads 0.25 per level $fireball = $potion_player->getSpell('fireball'); $fireball = $fireball === false ? 0 : $fireball->getLevel($potion_player); $fireball = round($fireball / 4, 1); $level += $fireball; $line = $target->getY(); $damage = array(); $ep = $target->getParty(); foreach ($ep->getMembers() as $t) { $t instanceof SR_Player; $d = abs($line - $t->getY()); // echo "Distance to target is $d\n"; $l = $level - $d; if ($l >= 0) { $hits = $this->dice($potion_player, $t, $l); $damage[$t->getID()] = $this->calcFirewallDamage($player, $t, $level, $hits); } } $this->announceADV($player, $target, $level); Shadowfunc::multiDamage($player, $damage); return true; }
private function isMaloisHere(SR_Player $player) { if (false === ($party = $player->getParty())) { return false; } return $party->hasNPCNamed('Malois') || $party->hasConst('RESCUED_MALOIS') ? false : true; }
public function onItemUse(SR_Player $player, array $args) { # Have ATM? $p = $player->getParty(); if (!$p->isInsideLocation() || !$p->getLocationClass()->hasATM()) { $this->reply($player, "You are not inside a location with an ATM. Towers and dungeons usually don't have those."); return false; } # Fallback for credstick $amount = isset($args[1]) ? (int) $args[1] : 0; if (count($args) === 0) { $args = array('popy'); } # Do it! switch (strtolower($args[0])) { case 'pushy': return $this->onItemUsePush($player, $amount); case 'popy': return $this->onItemUsePop($player, $amount); case 'push': return $this->onItemUsePushi($player, $args); case 'view': return $this->onItemUseViewi($player, $args); default: $player->message('Try #u Holostick pushy <nuyen>. Try #u Holostick popy <nuyen>. Try #u Holostick push <item> [<amt>]. Try #u Holostick view [<pattern>] [<page>].'); return false; } }
public static function execute(SR_Player $player, array $args) { $p = $player->getParty(); if (false === ($location = $p->getLocationClass('outside'))) { return self::rply($player, '1031'); // return $player->message('This command only works when you are outside a location.'); } $bot = Shadowrap::instance($player); $loc = $location->getName(); if (count($args) > 1) { return $bot->reply(Shadowhelp::getHelp($player, 'hijack')); } $victims = array(); foreach (Shadowrun4::getParties() as $pa) { $pa instanceof SR_Party; if (false === ($city = $pa->getCityClass())) { continue; # not even city } # Hax! if ($city->isDungeon() && $city->getCityLocation() === $loc || $pa->getLocation('inside') === $loc) { foreach ($pa->getMembers() as $pl) { $pl instanceof SR_Player; if ($pl->hasEquipment('mount')) { $victims[] = $pl; } } } } if (count($victims) === 0) { self::rply($player, '5128'); return false; // return $player->message('You see no mounts from other players to rob.'); } $format = $player->lang('fmt_sumlist'); if (count($args) === 0) { $out = ''; foreach ($victims as $i => $victim) { $victim instanceof SR_Player; $mount = $victim->getMount(); $out .= sprintf($format, $i + 1, $victim->getName(), $mount->getName()); // $out .= sprintf(", \x02%s\x02-%s(%s)", ($i+1), $victim->getName(), $mount->getName()); } return self::rply($player, '5130', array(ltrim($out, ',; '))); // return $bot->reply(substr($out, 2)); } if (false === ($target = Shadowfunc::getTarget($victims, $args[0], true))) { self::rply($player, '5128'); // $player->message('You see no mounts from other players to rob.'); return false; } $mount = $target->getMount(); if ($mount->getMountWeight() === 0) { self::rply($player, '1037'); // $player->message('This mount cannot store anything.'); return false; } return $mount->initHijackBy($player); }
public function onConsume(SR_Player $player) { $m = array('alc' => 0.1); $player->addEffects(new SR_Effect(GWF_Time::ONE_HOUR * 1, $m)); $player->addEffects(new SR_Effect(GWF_Time::ONE_HOUR * 2, $m)); $player->addEffects(new SR_Effect(GWF_Time::ONE_HOUR * 3, $m)); $player->getParty()->notice(sprintf('%s drunk an alcopop and got alcoholized (+0.3).', $player->getName())); }
public function calcTicketPrice($price, SR_Player $player) { $neg = Common::clamp($player->get('negotiation'), 0, 10) * 0.01; $mc = $player->getParty()->getMemberCount(); $price = $price * $mc; $price = $price * (1.0 - $neg); return $price; }
public function onConsume(SR_Player $player) { $m = array('alc' => 0.1); $player->addEffects(new SR_Effect(GWF_Time::ONE_HOUR * 1, $m)); $player->addEffects(new SR_Effect(GWF_Time::ONE_HOUR * 2, $m)); $oldhp = $player->getHP(); $gain = $player->healHP(0.3); $player->getParty()->notice(sprintf('%s drank a beer and got alcoholized (+0.2) %s.', $player->getName(), Shadowfunc::displayHPGain($oldhp, $gain, $player->getMaxHP()))); }
private static function beamToRedmond(SR_Player $player) { $p = $player->getParty(); $xp = $player->getBase('xp'); $player->resetXP(); $player->msg('5299', array(self::BEAM_TARGET)); # Your XP stack got reset and you get beamed back to %s. $p->pushAction(SR_Party::ACTION_INSIDE, self::BEAM_TARGET); }
public static function execute(SR_Player $player, array $args) { return $player->getParty()->ntice('5084', array($player->getName(), implode(' ', $args))); // $b = chr(2); // $bot = Shadowrap::instance($player); // $message = sprintf('%s pm: "%s"', $b.$player->getName().$b, implode(' ', $args)); // $player->getParty()->notice($message); // return true; }
private static function giveKnowB(SR_Player $player, SR_Player $target, $what, $which) { if (false === $target->hasKnowledge($what, $which)) { $target->giveKnowledge($what, $which); $player->getParty()->ntice('5117', array($player->getName(), $target->getName(), $which)); // $player->getParty()->message($player, sprintf(' told %s about %s.', $target->getName(), $which)); } return true; }
public function onHacked(SR_Player $player, $hits) { $party = $player->getParty(); $player->message(sprintf('This computer is able to activate the elevator to floor 2 and 3.')); $elevator = Shadowrun4::getLocationByTarget('Renraku_Elevator'); $elevator instanceof Renraku_Elevator; $elevator->setElevatorFlagsParty($party, 6, true); $party->notice(sprintf('%s managed to unlock the elevator to floor 2 and 3.', $player->getName())); }
private function letsGO(SR_Player $player) { $party = $player->getParty(); if (false === ($malois = SR_NPC::createEnemyNPC(__CLASS__, $party))) { $player->message('ERROR!'); return false; } $party->notice('Malois says: "You made it! Quick! Let\'s go!"'); $this->getNPCCityClass()->setAlert($party, 9000000); return true; }
public function onNPCTalk(SR_Player $player, $word, array $args) { $player->message($this->langNPC('grunt')); // $player->message('The orks grunt.'); $this->rply('wtf'); // $this->reply("What the ..."); $p = $player->getParty(); $p->popAction(false); $ep = $this->getParty(); return $ep->fight($p, true); }
public function getScannerTarget(SR_Player $player, array $args) { $arg = isset($args[0]) ? $args[0] : ''; $p = $player->getParty(); if ($p->isFighting()) { return $this->getOffensiveTarget($player, $arg); } else { return $this->getFriendlyTarget($player, $arg); } return $target; }
private static function messagePartyFeelings(SR_Player $player) { $party = $player->getParty(); $enum = 1; $fmt = $player->lang('fmt_feel'); $out = ''; foreach ($party->getMembers() as $member) { $member instanceof SR_Player; $out .= vsprintf($fmt, self::argsForMember($member, $enum)); } $player->msg('5312', array(ltrim($out, ',; '))); }
private function onWereAttack(SR_Player $player) { $p = $player->getParty(); $mc = $p->getMemberCount(); $numEnemies = rand(2, 2 + $mc + 2); $numEnemies = Common::clamp($numEnemies, 2, SR_Party::MAX_MEMBERS); $enemies = array(); for ($i = 0; $i < $numEnemies; $i++) { $enemies[] = 'Forest_Werewolf'; } return $p->fight(SR_NPC::createEnemyNPC($enemies)); }
public function onEnter(SR_Player $player) { $p = $player->getParty(); foreach ($p->getMembers() as $member) { $member instanceof SR_Player; if (!$member->getInvItemByName('IDCardA')) { SR_NPC::createEnemyParty('Renraku_Guard', 'Renraku_Guard', 'Renraku_Guard')->talk($p, true); return true; } } return parent::onEnter($player); }
public static function execute(SR_Player $player, array $args) { $p = $player->getParty(); $back = ''; $format = $player->lang('fmt_xp'); # 1-gizmore L14(177/288xp) KA(5.4/12xp) foreach ($p->getMembers() as $member) { $member instanceof SR_Player; $back .= sprintf($format, $member->getEnum(), $member->getName(), $member->getBase('level'), round($member->getBase('xp_level'), 2), $member->getXPPerLevel(), round($member->getBase('xp'), 2), $member->getXPPerKarma()); } return self::rply($player, '5308', array(ltrim($back, '|,; '))); }