private static function onGMNS(SR_Player $player, SR_Player $target, $arg) { $pid = $target->getID(); if (strtolower($arg) === 'on') { if (false === SR_NoShout::setNoShout($pid, -1)) { return false; } return $player->message(sprintf('Banned %s from shouting.', $target->getName())); } elseif (strtolower($arg) === 'off') { if (false === SR_NoShout::setShout($pid)) { return false; } return $player->message(sprintf('Allowed %s to shout again.', $target->getName())); } elseif (0 < ($seconds = GWF_TimeConvert::humanToSeconds($arg))) { if (false === SR_NoShout::setNoShout($pid, $seconds)) { return false; } return $player->message(sprintf('Banned %s from shouting for %s.', $target->getName(), GWF_TimeConvert::humanDuration($seconds))); } else { $player->message(Shadowhelp::getHelp($player, 'gmns')); return false; } }
public function onNPCBountyTalk(SR_Player $player, $word, array $args) { switch (count($args)) { case 1: $this->reply("Yes. Try #ttj bounty <player{server}> to see the bounty for a player. Try #ttj bounty <player{server}> <nuyen> to raise the bounty for a player."); return true; case 2: if (false === ($target = Shadowrun4::loadPlayerByName($args[1]))) { $this->reply("This player is unknown. Try #ttj <nickname{serverid}>."); } else { $this->reply(SR_Bounty::displayBountyPlayer($target)); } return true; case 3: if (false === ($target = Shadowrun4::loadPlayerByName($args[1]))) { $this->reply("This player is unknown. Try #ttj <nickname{serverid}>."); return true; } $nuyen = (int) $args[2]; $min_nuyen = SR_Bounty::getMinNuyen($target); if ($nuyen < $min_nuyen) { $this->reply(sprintf('The minimum bounty for %s is %s.', $target->getName(), Shadowfunc::displayNuyen($min_nuyen))); return true; } if (false === $player->pay($nuyen)) { $this->reply(sprintf("You don't seem to have %s.", Shadowfunc::displayNuyen($nuyen))); return false; } if (false === SR_Bounty::insertBounty($player, $target, $nuyen)) { $this->reply(sprintf('Database error in %s line %s.', __FILE__, __LINE__)); return false; } $bounty = Shadowfunc::displayNuyen($nuyen); $total = Shadowfunc::displayNuyen($target->getBase('bounty')); $target->message(sprintf("%s put a bounty on you: +%s = %s!", $player->getName(), $bounty, $total)); $this->reply(sprintf('You put a bounty of %s on %s. This is valid for %s. Total bounty for this chummer is %s now.', $bounty, $target->getName(), GWF_TimeConvert::humanDuration(SR_Bounty::TIMEOUT), $total)); return true; default: return false; } }
private function getTooltip(GWF_Module $mod, $varname, array $var) { switch ($var['mv_type']) { case 'int': $default_txt = $this->module->lang('tt_int', array($var['mv_min'], $var['mv_max'])); break; case 'text': $default_txt = $this->module->lang('tt_text', array($var['mv_min'], $var['mv_max'])); break; case 'bool': $default_txt = $this->module->lang('tt_bool'); break; case 'script': $default_txt = $this->module->lang('tt_script'); break; case 'time': $min = GWF_TimeConvert::humanDuration((int) $var['mv_min']); $max = GWF_TimeConvert::humanDuration((int) $var['mv_max']); $default_txt = $this->module->lang('tt_time', array($min, $max)); break; case 'float': $default_txt = $this->module->lang('tt_float', array($var['mv_min'], $var['mv_max'])); break; } $extkey = 'tt_cfg_' . $varname; if ($extkey === ($extend = $mod->lang($extkey))) { $extend = ''; } else { $extend = "\n" . $extend; } return $default_txt . $extend; }