예제 #1
0
 public function hasToLeave()
 {
     if (!$this->hasConst(self::HIRE_END)) {
         return false;
     }
     return $this->getConst(self::HIRE_END) < Shadowrun4::getTime();
 }
예제 #2
0
파일: interval.php 프로젝트: sinfocol/gwf3
 public function ai_tick($function, $args = null)
 {
     if (0 < ($interval = $this->getInterval())) {
         if (Shadowrun4::getTime() % $interval === 0) {
             call_user_func_array($this->getArg(1), $this->getArg(2, array()));
         }
     }
 }
예제 #3
0
 public function resetTimer(SR_Player $player)
 {
     $time = Seattle::TIME_TO_DELAWARE + 60;
     $player->setConst('__AURIS_TIMEOUT', Shadowrun4::getTime() + $time);
     $player->message($this->lang('fluid', array(GWF_Time::humanDuration($time))));
     // 		$player->message(sprintf("Your pot of Auris is fluid for %s.", GWF_Time::humanDuration($time)));
     return true;
 }
예제 #4
0
 public function setAlert(SR_Party $party, $duration = 600, $announce = true)
 {
     $party->setTemp($this->getAlertKey($party), Shadowrun4::getTime() + $duration);
     if ($announce) {
         $party->ntice('5021');
         // 			$party->notice(sprintf('You hear the alarm sound!'));
     }
 }
예제 #5
0
 public static function isNoShout($pid)
 {
     $pid = (int) $pid;
     if (false === ($ends = self::table(__CLASS__)->selectVar('sr4ns_ends', "sr4ns_pid={$pid}"))) {
         return -1;
     }
     if ($ends == 0) {
         return GWF_Time::ONE_DAY;
     }
     return $ends - Shadowrun4::getTime();
 }
예제 #6
0
파일: whisper.php 프로젝트: sinfocol/gwf3
 private static function cleanupWhisper($pid)
 {
     $data = self::$WHISPER[$pid];
     if (count($data) < 2) {
         return;
     }
     $time = Shadowrun4::getTime() - self::WB_TIME;
     foreach ($data as $fid => $t) {
         if ($t < $time) {
             unset(self::$WHISPER[$pid][$fid]);
         }
     }
 }
예제 #7
0
파일: SR_Tell.php 프로젝트: sinfocol/gwf3
 public static function tell($pid, $msg)
 {
     // 		print('TELL: '.$msg.PHP_EOL);
     $pid = (int) $pid;
     $table = self::table(__CLASS__);
     if (false === $table->insertAssoc(array('sr4tl_pid' => $pid, 'sr4tl_time' => Shadowrun4::getTime(), 'sr4tl_msg' => $msg))) {
         return false;
     }
     $where = "sr4tl_pid={$pid}";
     $rows = $table->countRows($where);
     if ($rows > self::MAX_MSGS) {
         // @todo: This is currently broken Oo
         //			if (false === $table->deleteWhere($where, 'sr4tl_time ASC', NULL, 5, 0))
         //			{
         //				return false;
         //			}
     }
     return true;
 }
예제 #8
0
파일: fight.php 프로젝트: sinfocol/gwf3
 private static function checkKillProtection(SR_Player $player, SR_Party $ep)
 {
     $p = $player->getParty();
     // 		$ep = $p->getEnemyParty();
     if (SR_KillProtect::isKillProtectedRealNPCParty($ep)) {
         return false;
     }
     if (SR_KillProtect::isKillProtectedPartyLevel($p, $ep, $player, true)) {
         return false;
     }
     if (false !== ($time = SR_KillProtect::isKillProtectedParty($p, $ep))) {
         $wait = GWF_Time::humanDuration($time - Shadowrun4::getTime());
         self::rply($player, '1060', array($wait));
         // 			$player->message(sprintf('You cannot attack this party again. Please wait %s.', $wait));
         return false;
     }
     SR_BadKarma::onFight($player, $ep);
     return true;
 }
예제 #9
0
 private static function cleanupItems()
 {
     echo __METHOD__ . PHP_EOL;
     $players = GDO::table('SR_Player');
     $pids = $players->selectColumn('sr4pl_id');
     $items = GDO::table('SR_Item');
     $before = $items->countRows();
     if (false === ($result = $items->select('sr4it_id, sr4it_uid', 'sr4it_uid!=0'))) {
         echo GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         return;
     }
     $sr_time = Shadowrun4::getTime();
     while (false !== ($row = $items->fetch($result, GDO::ARRAY_N))) {
         if (!in_array($row[1], $pids, true)) {
             $items->deleteWhere("sr4it_id={$row[0]}");
         }
     }
     $items->free($result);
     $after = $items->countRows();
     printf("I removed %s items from the database and %s are left.\n", $before - $after, $after);
 }
예제 #10
0
파일: SR_Effect.php 프로젝트: sinfocol/gwf3
 public function isOver()
 {
     return $this->time_end < Shadowrun4::getTime();
 }
예제 #11
0
 public static function onKilled(SR_Player $killer, SR_Player $victim)
 {
     echo __METHOD__;
     return self::table(__CLASS__)->insertAssoc(array('sr4kp_killer' => $killer->getID(), 'sr4kp_victim' => $victim->getID(), 'sr4kp_srtime' => Shadowrun4::getTime() + self::getKillTime($killer, $victim)));
 }
예제 #12
0
파일: SR_Party.php 프로젝트: sinfocol/gwf3
 public function displayContactETA()
 {
     $duration = $this->getVar('sr4pa_contact_eta') - Shadowrun4::getTime();
     return $duration <= 0 ? '0s' : GWF_Time::humanDuration($duration);
 }
예제 #13
0
파일: SR_Player.php 프로젝트: sinfocol/gwf3
 public function getBusyLeft()
 {
     return $this->combat_eta - Shadowrun4::getTime();
 }
예제 #14
0
 public static function getEffects(SR_Player $player)
 {
     // 		$b = chr(2);
     $e = $player->getEffects();
     if (count($e) === 0) {
         return Shadowrun4::lang('none');
     }
     $sorted = array();
     foreach ($e as $effect) {
         $effect instanceof SR_Effect;
         $t = $effect->getTimeEnd();
         $raw = $effect->getModifiersRaw();
         foreach ($raw as $k => $v) {
             if (isset($sorted[$k])) {
                 $sorted[$k][0] += $v;
                 if ($t < $sorted[$k][1]) {
                     $sorted[$k][1] = $t;
                 }
             } else {
                 $sorted[$k] = array($v, $t);
             }
         }
     }
     $t2 = Shadowrun4::getTime();
     $format = Shadowrun4::lang('fmt_effect');
     $back = '';
     foreach ($sorted as $k => $data) {
         list($v, $t) = $data;
         $back .= sprintf($format, $k, $v, GWF_Time::humanDuration($t - $t2));
         // 			$back .= sprintf(', %s:%s(%s)', $b.$k.$b, $v, GWF_Time::humanDuration($t-$t2));
     }
     return ltrim($back, ',; ');
 }
예제 #15
0
파일: SR_Item.php 프로젝트: sinfocol/gwf3
 public function isBreaking()
 {
     if ($this->isItemStackable()) {
         return false;
     }
     $d = $this->getDuration();
     if ($d > 0) {
         return $d < Shadowrun4::getTime();
     } else {
         return false;
     }
 }
예제 #16
0
 public static function onAddStorage(SR_Clan $clan, SR_Player $player)
 {
     $event = new self(array('sr4ch_id' => '0', 'sr4ch_cid' => $clan->getID(), 'sr4ch_time' => Shadowrun4::getTime(), 'sr4ch_pname' => $player->getName(), 'sr4ch_action' => self::ADD_STORAGE, 'sr4ch_iname' => NULL, 'sr4ch_amt' => $clan->getMaxStorage()));
     return self::insertAndSend($clan, $event);
 }
예제 #17
0
파일: SR_Clan.php 프로젝트: sinfocol/gwf3
 /**
  * Make a player join this clan.
  * @param SR_Player $player
  */
 public function join(SR_Player $player)
 {
     $members = GDO::table('SR_ClanMembers');
     if (false === $members->insertAssoc(array('sr4cm_pid' => $player->getID(), 'sr4cm_cid' => $this->getID(), 'sr4cm_jointime' => Shadowrun4::getTime(), 'sr4cm_options' => '0'), true)) {
         return false;
     }
     if (false === $this->fixMembercount()) {
         return false;
     }
     return SR_ClanHistory::onJoin($this, $player);
 }