예제 #1
0
파일: php_Pb.php 프로젝트: sinfocol/gwf3
 function fetchFunctionDescription($func, $language = 'en')
 {
     global $message, $redirects;
     $notfoundtext = 'Nothing matches your query, try search:';
     Dog_Log::debug('phpmanual: fetching ' . $func . ' info');
     $res = GWF_HTTP::getFromUrl('http://' . ($language != 'en' ? $language . '.' : '') . 'php.net/' . $func, false, 'LAST_LANG=' . $language);
     if ($res === false) {
         return 'Timeout on contacting ' . ($language != 'en' ? $language . '.' : '') . 'php.net';
     }
     if (preg_match('/<span class=\\"refname\\">(.*?)<\\/span> &mdash; <span class=\\"dc\\-title\\">(.*?)<\\/span>/si', $res, $match)) {
         $match[2] = str_replace(array("\n", "\r"), ' ', strip_tags($match[2]));
         preg_match('/<div class=\\"methodsynopsis dc\\-description\\">(.*?)<\\/div>/si', $res, $descmatch);
         $decl = isset($descmatch[1]) ? strip_tags($descmatch[1]) : $match[1];
         $decl = html_entity_decode(str_replace(array("\n", "\r"), ' ', $decl));
         $decl = str_replace($func, "" . $func . "", $decl);
         $output = $decl . ' - ' . html_entity_decode($match[2]) . ' ( http://' . ($language != 'en' ? $language . '.' : '') . 'php.net/' . $func . ' )';
     } else {
         // if several possibilities
         $output = '';
         if (preg_match_all('/<a href=\\"\\/manual\\/[a-z]+\\/(?:.*?)\\.php\\">(?:<b>)?(.*?)(?:<\\/b>)?<\\/a><br/i', $res, $matches, PREG_SET_ORDER)) {
             if ($redirects++ < 2) {
                 return fetchFunctionDescription($matches[0][1]);
             } else {
                 return $notfoundtext . ' http://' . ($language != 'en' ? $language . '.' : '') . 'php.net/search.php?show=wholesite&pattern=' . $message;
             }
         } else {
             $output = $notfoundtext . ' http://' . ($language != 'en' ? $language . '.' : '') . 'php.net/search.php?show=wholesite&pattern=' . $func;
         }
     }
     return $output;
 }
예제 #2
0
 public function event_join()
 {
     $user = Dog::getUser();
     $server = Dog::getServer();
     $channel = Dog::getChannel();
     $cid = $channel->getID();
     if (Dog::isItself() || Dog_Greeting::hasBeenGreeted($user->getID(), $cid) || false === ($greeting = Dog_GreetMsg::getGreetMsg($server, $channel)) || $greeting->isDisabled()) {
         return;
     }
     $message = $greeting->getVar('dgm_msg');
     switch ($greeting->getGreetMode()) {
         case Dog_GreetMsg::MODE_CHAN:
             $server->sendPRIVMSG($channel->getName(), $user->getName() . ': ' . $message);
             break;
         case Dog_GreetMsg::MODE_NOTICE:
             $server->sendNOTICE($user->getName(), $message);
             break;
         case Dog_GreetMsg::MODE_PRIVMSG:
             $server->sendPRIVMSG($user->getName(), $message);
             break;
         default:
             Dog_Log::error('Invalid type of greeting in ' . __FILE__ . ' line ' . __LINE__ . '!');
             return;
     }
     Dog_Greeting::markGreeted($user->getID(), $cid);
 }
예제 #3
0
파일: Dog_Timer.php 프로젝트: sinfocol/gwf3
 public static function addTimer($func, $args, $delay, $repeat = true)
 {
     if ($delay < 0.2) {
         die(Dog_Log::critical("Timer has delay < 0.200!"));
     }
     self::$TIMERS[] = new self($func, $args, $delay, $repeat);
 }
예제 #4
0
파일: SR_Tower.php 프로젝트: sinfocol/gwf3
 /**
  * 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;
 }
예제 #5
0
파일: Dog_Auth.php 프로젝트: sinfocol/gwf3
 public static function connect(Dog_Server $server)
 {
     if (false === ($nick = self::getNickData($server))) {
         return Dog_Log::warn(sprintf('No nicks for %s.', $server->displayName()));
     }
     $server->addUser(Dog::getOrCreateUserByName($nick->getName()));
     $conn = $server->getConnection();
     return self::sendUser($conn, $server, $nick) && self::sendNick($conn, $server, $nick);
 }
예제 #6
0
 /**
  * Remove all items from array that are not a decision.
  * @param array $args
  * @return array
  */
 public static function filterDecisions(array &$args)
 {
     foreach ($args as $i => $arg) {
         if (!$arg instanceof SR_AIDecision) {
             Dog_Log::debug('filterDecisions argument is not a decision.');
             GWF_Debug::backtrace('filterDecisions argument is not a decision.', $args);
             unset($args[$i]);
         }
     }
     return $args;
 }
예제 #7
0
파일: Dog_IRCC.php 프로젝트: sinfocol/gwf3
 public function send($message)
 {
     // 		$message = str_replace(array("\r", "\n"), '', trim($message));
     $message = str_replace(array("\r", "\n"), '', $message);
     Dog_Log::server($this->server, $message, ' >>>> ');
     if (!fwrite($this->socket, "{$message}\r\n")) {
         $this->hard_disconnect();
         return false;
     }
     return true;
 }
예제 #8
0
파일: if.php 프로젝트: sinfocol/gwf3
 public static function decideCombat(SR_Player $player, array $args)
 {
     if (count($args) !== 3) {
         Dog_Log::debug(sprintf('Call to AI: if expects 3 args. %s given!', count($args)));
         return NULL;
     }
     if (self::evaluateExpression($args[0])) {
         return self::evaluateExpression($args[1]);
     } else {
         return self::evaluateExpression($args[2]);
     }
 }
예제 #9
0
파일: SR_AICMD.php 프로젝트: sinfocol/gwf3
 public static function combatTimer(SR_Player $player)
 {
     $ai = $player->getVar('sr4pl_combat_ai');
     if ($ai === NULL) {
         if ($player->isHuman()) {
             return;
         } else {
             $ai = self::DEFAULT_COMBAT_AI;
         }
     }
     //		$data = array();
     //		$total = 0;
     $decisions = array();
     $ai = explode(';', $ai);
     foreach ($ai as $func) {
         $func = trim($func);
         if (preg_match('/([a-z_]+)(\\([^\\)]+\\))?([-+*\\/]\\d+)?/i', $func, $matches)) {
             $funcname = $matches[1];
             $classname = 'ShadowAI_' . $funcname;
             if (class_exists($classname)) {
                 $args = isset($matches[1]) ? explode(',', $matches[1]) : NULL;
                 $multi = isset($matches[2]) ? $matches[2] : '*1';
                 $decision = call_user_func(array($classname, 'decideCombat'), $player, $args);
                 if ($decision !== NULL) {
                     $command = $decision[0];
                     $prefer = $decision[1];
                     $prefer = eval("{$prefer}{$multi};");
                     //						$chance = (int)($prefer*100);
                     //						$total += $chance;
                     //						$data[] = array($command, $chance);
                     $decisions[$command] = $prefer;
                 }
             } else {
                 Dog_Log::debug(sprintf('%s has an invalid AI method: %s.', $player->getName(), $funcname));
             }
         } else {
             Dog_Log::debug(sprintf('PREG MATCH FAILED: %s.', $func));
         }
     }
     # Best
     if (count($decisions) > 0) {
         arsort($decisions);
         $command = key($decisions);
         $player->combatPush($command);
     }
     # Rand
     //		if (false !== ($command = Shadowfunc::randomData($data, $total)))
     //		{
     //			$player->combatPush($command);
     //		}
 }
예제 #10
0
function dog_svn_info($key, $repo, $user = '', $pass = '', $displayurl = '', $channels = array())
{
    $keyshort = $key;
    $key = 'DOG_SVNINFO_REVISION_' . $key;
    $svninfo = new GWF_SvnInfo();
    $svninfo->setRepository($repo, $user, $pass);
    if (0 == ($currentRevision = $svninfo->getCurrentRevision())) {
        return Dog_Log::debug('Fetching current revision failed.');
    }
    $lastRevision = GWF_Settings::getSetting($key, $currentRevision);
    if ($currentRevision <= $lastRevision) {
        GWF_Settings::setSetting($key, $currentRevision);
        return;
    }
    $svnlog = $svninfo->getLog($lastRevision + 1, $currentRevision);
    foreach ($svnlog as $entry) {
        $msg = sprintf('[%s] New revision %s by %s: %s', $keyshort, $entry['version-name'], $entry['creator-displayname'], html_entity_decode($entry['comment']));
        if ($displayurl != '') {
            $msg .= ' ( ' . str_replace('%REV%', $entry['version-name'], $displayurl) . ' )';
        }
        if (count($channels) === 0) {
            # To all servers in the main channel
            foreach (DOG::getServers() as $server) {
                $server instanceof Dog_Server;
                $channels = $server->getChannels();
                if (count($channels) > 0) {
                    $channel = array_shift($channels);
                    $channel = $channel->getVar('chan_name');
                    $server->sendPRIVMSG($channel, $msg);
                }
            }
        } else {
            # To all servers in matching channels
            foreach (DOG::getServers() as $server) {
                $server instanceof Dog_Server;
                $channels_now = $server->getChannels();
                foreach ($channels_now as $channel) {
                    $channel instanceof Dog_Channel;
                    $channel = $channel->getName();
                    foreach ($channels as $c) {
                        if (!strcasecmp($c, $channel)) {
                            $server->sendPRIVMSG($channel, $msg);
                        }
                    }
                }
            }
        }
    }
    GWF_Settings::setSetting($key, $currentRevision);
}
예제 #11
0
 public static function onInstall($dropTable = false)
 {
     Dog_Log::debug(__METHOD__);
     $dir = Shadowrun4::getShadowDir();
     foreach (self::$TABLES as $classname) {
         require_once $dir . 'core/' . $classname . '.php';
         if (false !== ($table = GDO::table($classname))) {
             // 				Dog_Log::debug('SR_Install::onInstall('.$classname.')');
             if (false === $table->createTable($dropTable)) {
                 return false;
             }
         }
     }
     return true;
 }
예제 #12
0
 public function after_pull($repo_id, array $data)
 {
     // 		printf("DOGMOD_CVS::afterPull($repo_id): %s\n", print_r($data, true));
     $code = $data[0];
     $pullResult = $data[1];
     $this->pulling = false;
     if (!($repo = Dog_Repo::getByID($repo_id))) {
         Dog_Log::critical(GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__)));
         return;
     }
     if (!$repo->isNew($pullResult)) {
         return;
     }
     if (!$repo->storePullResult($pullResult)) {
         Dog_Log::critical(GWF_HTML::lang('ERR_DATABASE', array(__FILE__, __LINE__)));
         return;
     }
     $this->announce_commit($repo);
 }
예제 #13
0
 public static function updateScumStats(Dog_ScumGame $game)
 {
     $server = $game->getServer();
     $won = 1;
     $score = $game->getPlayerCountStart();
     foreach ($game->getWinners() as $name) {
         $score--;
         if (false === ($user = $server->getUserByName($name))) {
             Dog_Log::error('Can not find user ' . $name);
             continue;
         }
         $userid = $user->getID();
         if (false === ($row = self::getOrCreateStatsRow($userid))) {
             Dog_Log::error('Can not find stats for user ' . $name);
             continue;
         }
         $row->updateRow("scums_games=scums_games+1, scums_won=scums_won+{$won}, scums_score=scums_score+{$score}");
         $won = 0;
     }
 }
예제 #14
0
파일: mul.php 프로젝트: sinfocol/gwf3
 public static function decideCombat(SR_Player $player, array $args)
 {
     # NULL?
     if (count($args) === 0) {
         return NULL;
     }
     # ARG missing!
     if (count($args) === 1) {
         Dog_Log::debug(sprintf('Missing parameter for AI: mul.'));
         return $args[0];
     }
     # Is it a decision?
     $decision = $args[0];
     if (!$decision instanceof SR_AIDecision) {
         return $args[0] * $args[1];
     }
     # Multiply all the decisions!
     $decision instanceof SR_AIDecision;
     $decision->setPreference($decision->getPreference() * $args[1]);
     return $decision;
 }
예제 #15
0
파일: PRIVMSG.php 프로젝트: sinfocol/gwf3
# :gizmore!gizmore@localhost PRIVMSG Dog :.join #sr
if (false === ($user = Dog::getOrCreateUser())) {
    return;
}
$serv = Dog::getServer();
$serv->addUser($user);
$user = Dog::setupUser();
$chan = Dog::setupChannel();
if ($user === false) {
    return Dog::suppressModules();
}
# Log PRIVMSGs
$msg = Dog::getIRCMsg()->getArg(1);
if (Dog::getIRCMsg()->shouldLog()) {
    Dog_Log::user($user, $msg);
    Dog_Log::channel($chan, $msg);
}
# Exec Stuff
if (!$user->isBot()) {
    if ('' !== ($trigger = Common::substrUntil($msg, ' '))) {
        if (Dog_Init::isTrigger($serv, $chan, $trigger[0])) {
            if ($user->isFlooding()) {
                return;
            }
            Dog::setTriggered();
            $trigger = substr($trigger, 1);
            if (false !== ($plug = Dog_Plugin::getPlug($trigger))) {
                if (!$plug->isInScope($serv, $chan)) {
                    Dog::scopeError($plug->getScope());
                } elseif (!$plug->hasPermission($serv, $chan, $user)) {
                    Dog::permissionError($plug->getPriv());
예제 #16
0
파일: JOIN.php 프로젝트: sinfocol/gwf3
<?php

# :Dog!Dawg@localhost JOIN :#sr
$msg = Dog::getIRCMsg();
$serv = Dog::getServer();
if (false === ($user = Dog::getOrCreateUser())) {
    return Dog_Log::critical("Cannot create user!");
}
$serv->addUser($user);
if (false === Dog::setupUser()) {
    return Dog_Log::critical('Cannot setup user!');
}
$chan_name = $msg->getArg(0);
if (false === ($channel = $serv->getChannelByName($chan_name))) {
    if (false === ($channel = Dog_Channel::getOrCreate($serv, $chan_name))) {
        return;
    }
    $serv->addChannel($channel);
}
$channel->addUser($user);
if (false === Dog::setupChannel()) {
    Dog_Log::critical('Cannot setup channel.');
}
예제 #17
0
 private function discoverService($port)
 {
     $portname = basename($port, '.php');
     $W = $this;
     $ip = $this->curr_ip;
     $host = $this->curr_host;
     $username = $this->getCurrUsername();
     Dog_Log::logDebug(sprintf('Probe %s (%s) [%s] on port %s', $host, $ip, $username, $portname));
     include $port;
 }
예제 #18
0
 public static function init()
 {
     Dog_Log::debug(__METHOD__);
     static $inited = false;
     if ($inited === false) {
         $inited = true;
         Shadowlang::onLoadLanguage();
         Shadowrap::init();
         self::$sr_timestamp = GWF_CachedCounter::getCount('SR4_TIME');
         $path = self::getShadowDir();
         self::initCore($path);
         self::initCmds($path);
         Shadowcmd::init();
         self::initItems($path);
         // 			self::initQuests($path);
         self::initCityBases($path);
         self::initSpells($path);
         self::initCityQuests($path);
         self::initCityNPCs($path);
         self::initCityLocations($path);
         // 			self::initCities($path);
         self::initCityAfter();
         SR_Player::init();
         // 			require_once DOG_PATH.'Lamb_IRCFrom.php';
         // 			require_once DOG_PATH.'Lamb_IRCTo.php';
         if (defined('SL4_REALS')) {
             self::initRealNPCs();
         }
         Shadowcleanup::cleanup();
     }
 }
예제 #19
0
 /**
  * Spawn a copy of this NPC.
  * @return SR_NPC
  */
 public function spawn(SR_Party $party, SR_Party $attackers = NULL)
 {
     if (false === ($npc = self::createNPC($this->getNPCClassName(), $party, $attackers))) {
         Dog_Log::error(sprintf('SR_NPC::spawn() failed for NPC class: %s.', $this->getNPCClassName()));
         return false;
     }
     foreach ($this->getNPCEquipment() as $field => $itemname) {
         if (is_array($itemname)) {
             $itemname = Shadowfunc::randomListItem($itemname);
         }
         if (!in_array($field, SR_Player::$EQUIPMENT, true)) {
             Dog_Log::error(sprintf('NPC %s has invalid equipment type: %s.', $this->getNPCPlayerName(), $field));
             $npc->deletePlayer();
             return false;
         }
         if (false === ($item = SR_Item::createByName($itemname))) {
             Dog_Log::error(sprintf('NPC %s has invalid %s: %s.', $this->getNPCPlayerName(), $field, $itemname));
             $npc->deletePlayer();
             return false;
         }
         $item->changeOwnerAndPosition($npc->getID(), $field);
         $npc->setEquipment($field, $item);
     }
     foreach ($this->getNPCCyberware() as $itemname) {
         $npc->addCyberware(SR_Item::createByName($itemname));
     }
     foreach ($this->getNPCMountInventory() as $itemname) {
         $npc->putInMountInv(SR_Item::createByName($itemname));
     }
     $inv = array();
     foreach ($this->getNPCInventory() as $itemname) {
         if (false === ($item = SR_Item::createByName($itemname))) {
             Dog_Log::error(sprintf('NPC %s has invalid inventory item: %s.', $this->getNPCPlayerName(), $itemname));
             $npc->deletePlayer();
             return false;
         }
         $inv[] = $item;
     }
     $npc->giveItems($inv);
     $npc->saveSpellData($this->getNPCSpells());
     $npc->modify();
     $npc->healHP(10000);
     $npc->healMP(10000);
     return $npc;
 }
예제 #20
0
 private function getDescription($url)
 {
     # Get page content
     # TODO: Only download .txt and .html content!
     GWF_HTTP::setTimeout(10);
     GWF_HTTP::setConnectTimeout(3);
     $content = GWF_HTTP::getFromURL($url, true);
     GWF_HTTP::setTimeout();
     GWF_HTTP::setConnectTimeout();
     if ($content === false) {
         Dog_Log::error('Mod_Link::getDescription(): getFromURL() failed. URL: ' . $url);
         return false;
     }
     list($head, $content) = preg_split("/[\r\n]{4}/", $content, 2);
     $type = Common::regex('/Content-Type: *(.*)/Di', $head);
     echo $type . PHP_EOL;
     if (Common::startsWith($type, 'image')) {
         return array('image', $content);
     }
     # Get Title from html
     if (0 === preg_match('#< *title *>([^<]+)< */ *title *>#i', $content, $matches)) {
         return false;
     }
     $title = $this->decode($matches[1]);
     $descr = '';
     if (1 === preg_match('#(< *meta.*description[^>]*>)#i', $content, $matchesB)) {
         $tag = $matchesB[1];
         if (1 === preg_match('#content=["\']([^"\']+)["\']#', $tag, $matchesB)) {
             $descr = ' - ' . $this->decode($matchesB[1]);
         }
     }
     return array('html', $title . ' - ' . $descr);
 }
예제 #21
0
파일: 403.php 프로젝트: sinfocol/gwf3
<?php

# :irc.giz.org 403 Dog sr :Invalid channel name
Dog_Log::warn('Invalid channel name: ' . Dog::argv(1));
예제 #22
0
파일: SR_Spell.php 프로젝트: sinfocol/gwf3
 public function checkRequirements(SR_Player $player)
 {
     $back = '';
     foreach ($this->getRequirements() as $require => $level) {
         if (false !== ($spell = self::getSpell($require))) {
             if ($spell->getBaseLevel($player) < $level) {
                 $back .= sprintf(', %s level %s', $require, $level);
             }
         } elseif (in_array($require, SR_Player::$ATTRIBUTE)) {
             if ($player->getBase($require) < $level) {
                 $back .= sprintf(', %s level %s', $require, $level);
             }
         } elseif (in_array($require, SR_Player::$SKILL)) {
             if ($player->getBase($require) < $level) {
                 $back .= sprintf(', %s level %s', $require, $level);
             }
         } else {
             Dog_Log::error(sprintf('Unknown requirement for Spell "%s": %s.', $this->getName(), $require));
         }
     }
     return $back === '' ? false : substr($back, 2);
 }
예제 #23
0
파일: Dog_Var.php 프로젝트: sinfocol/gwf3
 /**
  * Parse config vars from a ####conf string.
  * Returns array of Dog_Var
  * @param string $string
  * @return array
  */
 public static function parseConfigVars($string, $module = NULL, $plugin = NULL)
 {
     $back = array();
     $csv = str_getcsv($string . ',,');
     $len = count($csv);
     for ($i = 0; $i < $len;) {
         if ('' === ($name = trim($csv[$i++]))) {
             Dog_Log::critical(sprintf('Empty config name in %s:%s.', $i - 1, $string));
             return $back;
         }
         $scope = @substr(strtolower(trim($csv[$i++])), 0, 1);
         if (strpos(self::SCOPES, $scope) === false) {
             Dog_Log::critical(sprintf('Invalid config scope "%s" in %s:%s.', $scope, $i - 1, $string));
             return $back;
         }
         $priv = @substr(strtolower(trim($csv[$i++])), 0, 1);
         if (strpos(Dog_IRCPriv::allChars(), $priv) === false) {
             Dog_Log::critical(sprintf('Invalid config privilege "%s" in %s:%s.', $priv, $i - 1, $string));
             return $back;
         }
         $type = @substr(strtolower(trim($csv[$i++])), 0, 1);
         if (strpos(self::TYPES, $type) === false) {
             Dog_Log::critical(sprintf('Invalid config type "%s" in %s:%s.', $type, $i - 1, $string));
             return $back;
         }
         if ('' === ($default = trim($csv[$i++]))) {
             Dog_Log::critical(sprintf('Empty default value in %s:%s.', $i - 1, $string));
             return $back;
         }
         if (!self::isValid($type, $default)) {
             Dog_Log::critical(sprintf('Invalid default value in %s:%s.', $i - 1, $string));
             return $back;
         }
         if ('' !== ($e1 = $csv[$i++]) || '' !== ($e1 = $csv[$i++])) {
             Dog_Log::critical('Invalid ####conf format. There have to be three consecutive comma to seperate vars.');
             return $back;
         }
         # Yay \o/
         $back[] = new self($name, $scope, $priv, $type, $default, $module, $plugin);
     }
     return $back;
 }
예제 #24
0
 private function logOutput($to, $message)
 {
     if ($this->isLogging()) {
         if (false !== ($channel = Dog::getChannel())) {
             Dog_Log::channel($channel, $message);
         }
         if (false !== ($user = $this->getUserByName($to))) {
             Dog_Log::user($user, $message);
         }
     }
 }
예제 #25
0
파일: SR_Item.php 프로젝트: sinfocol/gwf3
 /**
  * Use the amount of an item. Delete item when empty.
  * @param SR_Player $player
  * @param int $amount
  * @return true|false
  */
 public function useAmount(SR_Player $player, $amount = 1, $modify = true)
 {
     if ($amount > $this->getAmount()) {
         Dog_Log::error(sprintf('Item %s(%d) has not %d amount to use!', $this->getItemName(), $this->getID(), $amount));
         return false;
     }
     if (false === $this->increase('sr4it_amount', -$amount)) {
         Dog_Log::error(sprintf('Item %s(%d) can not decrease amount %d!', $this->getItemName(), $this->getID(), $amount));
         return false;
     }
     if ($modify) {
         $player->modify();
     }
     return $this->getAmount() < 1 ? $this->deleteItem($player) : true;
 }
예제 #26
0
파일: QUIT.php 프로젝트: sinfocol/gwf3
<?php

# :krashed__!~dig@mx.renome.ua QUIT :Excess Flood
if (false !== ($user = Dog::setupUser())) {
    Dog::getServer()->removeUser($user);
} else {
    Dog_Log::error('Cannot get use from quit');
    Dog_Log::error(Dog::getMessage());
}
예제 #27
0
파일: ERROR.php 프로젝트: sinfocol/gwf3
<?php

Dog_Log::error(Dog::getIRCMsg()->getArg(0));
예제 #28
0
 private function onBoardTimer(Dog_Forum $board)
 {
     if (false === ($entries = $board->fetchNewEntries(10))) {
         return Dog_Log::warn('Forum Board Activities corrupt!');
     }
     if (count($entries) > 0) {
         foreach (Dog::getServers() as $server) {
             $this->onBoardServerTimer($entries, $board, $server);
         }
         $board->updateDatestamp(array_pop($entries));
     }
 }
예제 #29
0
파일: SR_Player.php 프로젝트: sinfocol/gwf3
 private function looseItem(SR_Player $killer)
 {
     Dog_Log::debug(sprintf('%s could loose an item!', $this->getName()));
     $items = array_merge($this->sr4_equipment, $this->sr4_inventory);
     foreach ($items as $i => $item) {
         $item instanceof SR_Item;
         if ($item instanceof SR_Mount || !$item->isItemDropable()) {
             unset($items[$i]);
         }
     }
     if (0 !== ($rand = rand(0, count($items)))) {
         shuffle($items);
         $item = array_pop($items);
         $item instanceof SR_Item;
         if ($item->isEquipped($this)) {
             $this->unequip($item, false);
         }
         $this->removeFromInventory($item);
         $killer->giveItems(array($item), 'killing ' . $this->getName());
         $this->msg('5255', array($item->getAmount(), $item->getItemName()));
         // 			$this->message(sprintf('You lost your %s.', $item->getItemName()));
     }
 }
예제 #30
0
파일: SR_School.php 프로젝트: sinfocol/gwf3
 private function onLearn(SR_Player $player, $field, $price)
 {
     $have = false;
     $type = 'skill';
     if (false !== ($spell = SR_Spell::getSpell($field))) {
         $type = 'spell';
         if ($spell->getBaseLevel($player) > -1) {
             $have = true;
         }
     } elseif ($player->getBase($field) > -1) {
         $have = true;
     }
     if ($type !== 'spell') {
         if ($player->getBase($field) < -1) {
             $player->msg('1145', array($field));
             // 				$player->message(sprintf('Your character cannot learn %s.', $field));
             return false;
         }
     }
     if ($have === true) {
         $player->msg('1146', array($field));
         // 			$player->message(sprintf('You already learned the %s %s.', $type, $field));
         return false;
     }
     if ($type === 'spell') {
         if (false !== ($error = $spell->checkRequirements($player))) {
             $player->msg('1147', array($error));
             // 				$player->message(sprintf('You need %s to learn this spell.', $error));
             return false;
         }
     }
     $dp = Shadowfunc::displayNuyen($price);
     if (false === $player->pay($price)) {
         $player->msg('1063', array($dp, $player->displayNuyen()));
         // 			$player->message(sprintf('It cost %s to learn the %s %s, but you only have %s.', $dp, $type, $field, $player->displayNuyen()));
         return false;
     }
     if ($type === 'spell') {
         $player->levelupSpell($field, 1);
     } elseif ($type === 'skill') {
         $player->levelupFieldTo($field, 0);
     } else {
         $player->message('Database error!');
         return Dog_Log::error(sprintf('Learned field "%s" is neither a skill nor a spell!', $field));
     }
     // 		$player->modify();
     $player->msg('5184', array($dp, $field));
     // 		$player->message(sprintf('You pay %s and learned the %s %s.', $dp, $type, $field));
     return true;
 }