本文整理汇总了PHP中Dog::getServer方法的典型用法代码示例。如果您正苦于以下问题:PHP Dog::getServer方法的具体用法?PHP Dog::getServer怎么用?PHP Dog::getServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dog
的用法示例。
在下文中一共展示了Dog::getServer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: on_note_Pb
public function on_note_Pb()
{
$server = Dog::getServer();
$user = Dog::getUser();
$message = $this->msgarg();
$command = Common::substrUntil($message, ' ', $message);
$message = Common::substrFrom($message, ' ', '');
switch ($command) {
case 'send':
$out = $this->onSend($server, $user, $message);
break;
case 'read':
$out = $this->onRead($server, $user, $message);
break;
case 'delete':
$out = $this->onDelete($server, $user, $message);
break;
case 'search':
$out = $this->onSearch($server, $user, $message);
break;
default:
case 'help':
$this->onHelp();
return;
}
$this->reply($out);
}
示例2: on_autojoin_Ac
public function on_autojoin_Ac()
{
$user = Dog::getUser();
$server = Dog::getServer();
$argv = $this->argv();
$argc = count($argv);
# Invoked in channel.
switch ($argc) {
# .autojoin
case 0:
return $this->showStatus($channel);
# .autojoin on|#channel
# .autojoin on|#channel
case 1:
if (Dog_Var::isValid('b', $argv[0])) {
return $this->setEnabled($channel, Dog_Var::parseValue('b', $argv[0]));
} elseif (false === ($channel = Dog::getOrLoadChannelByArg($argv[0]))) {
return Dog::rply('err_channel');
} else {
return $this->showStatus($channel);
}
# .autojoin #wechall on
# .autojoin #wechall on
case 2:
if (false === ($channel = Dog::getOrLoadChannelByArg($argv[0]))) {
return Dog::rply('err_channel');
}
if (!Dog::hasPermission($server, $channel, $user, 'A')) {
return Dog::noPermission('s');
}
return $this->setEnabled($channel, Dog_Var::parseValue('b', $argv[1]));
}
$this->showHelp('autojoin');
}
示例3: on_peak_Lc
public function on_peak_Lc()
{
$channel = Dog::getChannel();
if (false === ($peak = Dog_ChannelPeak::getPeak($channel))) {
return Dog::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
$date = $peak->getVar('lcpeak_date');
$count = $peak->getVar('lcpeak_peak');
$count_now = $channel->getUserCount();
$age = GWF_Time::displayAge($date);
$date = GWF_Time::displayDate($date);
$args = array($count, $channel->getName(), Dog::getServer()->displayLongName(), $date, $age, $this->peekshowstring());
$this->rply('old_peak', $args);
}
示例4: onLocationGlobalMessage
public static function onLocationGlobalMessage(SR_Player $player, $key, $args = NULL)
{
$server = Dog::getServer();
$channel = Dog::getChannel();
$sid = $server->getID();
// $cid = $channel->getID();
$party = $player->getParty();
// $b = chr(2);
// $message = sprintf('%s in %s: "%s".', $player->getName(), $party->getLocation(), $message);
// $sent = 0;
foreach (Shadowrun4::getParties() as $pid => $p) {
// echo "party $pid\n";
if ($party->sharesLocation($p)) {
// echo "partyy $pid\n";
foreach ($p->getMembers() as $m) {
$m instanceof SR_Player;
if ($m->isCreated()) {
// if (false === ($u = $m->getUser()))
// {
// continue;
// }
// if (false === ($s = $u->getServer()))
// {
// continue;
// }
// $c = $s->getChannelByName('#shadowlamb');
// if ($sid === $s->getID())
// {
// if ( ($channel !== false) && ($channel->getUserByName($u->getName()) !== false) )
// {
// # TODO: fix this
// // continue; # player already read it in irc.
// }
// }
# send to player.
echo "Sending to {$m->getName()}\n";
$m->msg($key, $args);
// $m->message($message);
// $sent++;
}
}
}
}
// if ($sent > 0)
// {
// $player->message(sprintf('%s players on cross servers read your message inside the same location. Use #exit or privmsg/query/pm with the bot.'));
// }
}
示例5: on_greetmode_Sc
public function on_greetmode_Sc()
{
$channel = Dog::getChannel();
if (false === ($msg = Dog_GreetMSG::getGreetMsg(Dog::getServer(), $channel))) {
return Dog::err('ERR_DATABASE', array(__FILE__, __LINE__));
}
$argv = $this->argv();
$argc = count($argv);
if ($argc === 0) {
$this->showGreetMode($channel, $msg);
} elseif ($argc === 1) {
$this->setGreetMode($channel, $msg, $argv[0]);
} else {
$this->showHelp('greetmode');
}
}
示例6: dogplug_help_all
function dogplug_help_all($entry, $fullpath, $cutlen)
{
global $DPH_ALL;
$priv = $entry[0];
$chan = Dog::getChannel();
$serv = Dog::getServer();
$user = Dog::getUser();
$name = substr($entry, 0, -7);
if (false !== ($plug = Dog_Plugin::getPlugWithPerms($serv, $chan, $user, $name)) && $plug->isEnabled($serv, $chan)) {
$dir = substr($fullpath, $cutlen);
$dir = substr($dir, 0, strrpos($dir, '/'));
if (!isset($DPH_ALL[$dir])) {
$DPH_ALL[$dir] = array();
}
if (!array_search($name, $DPH_ALL[$dir], true)) {
$DPH_ALL[$dir][] = $name;
}
}
}
示例7: setVar
public static function setVar(array $vars, $scope = NULL, $varname, $value)
{
if (false === ($var = self::getVar($vars, $varname, $scope))) {
Dog::rply('err_unk_var');
} elseif (!self::isValid($var->getType(), $value)) {
Dog::rply('err_variabl', array($var->displayName(), $varname, $var->displayType()));
} elseif (!$var->hasPermission(Dog::getServer(), Dog::getChannel(), Dog::getUser())) {
Dog::noPermission($var->getPriv());
} elseif (false === ($oldval = $var->getValue())) {
Dog::err('ERR_DATABASE', array(__FILE__, __LINE__));
} elseif (!$var->setValue($value)) {
Dog::err('ERR_DATABASE', array(__FILE__, __LINE__));
} else {
Dog::rply('msg_set_var', array($var->displayName(), $varname, $oldval, $var->getValue()));
}
}
示例8: setup
private function setup()
{
return GDO::table('Dog_Nick')->insertAssoc(array('nick_id' => '0', 'nick_sid' => $this->getID(), 'nick_name' => Dog::getServer()->getNick()->getName(), 'nick_pass' => NULL, 'nick_options' => 0));
}
示例9: event_QUIT
public function event_QUIT()
{
if (false !== ($user = Dog::getUser())) {
Shadowrun4::onQuit(Dog::getServer(), Dog::getUser(), Dog::argv(0));
}
}
示例10: replyAction
public function replyAction($message)
{
return Dog::getServer()->replyAction($message);
}
示例11: map
public static function map($method_name, $args = NULL)
{
$server = Dog::getServer();
$channel = Dog::getChannel();
foreach (self::$MODULES as $module) {
$module instanceof Dog_Module;
if (method_exists($module, $method_name)) {
if ($module->isEnabled($server, $channel)) {
call_user_func(array($module, $method_name), $args);
}
}
}
}
示例12: array
<?php
$lang = array('en' => array('help' => '%CMD% <nickname>. Change the bot`s nickname.', 'curr' => 'My current nick here is %s.', 'ok' => 'Sending the NICK command...'));
$plugin = Dog::getPlugin();
$argv = $plugin->argv();
$argc = count($argv);
if ($argc === 0) {
$plugin->rply('curr', array(Dog::getNickname()));
} elseif ($argc === 1 && preg_match('/^[a-z0-9_]+$/i', $argv[0])) {
$plugin->rply('ok');
Dog::getServer()->sendRAW("NICK {$argv[0]}");
} else {
$plugin->showHelp();
}
示例13: probeServer
private function probeServer()
{
$server = Dog::getServer();
$this->sendNickservStatus($server, $server->getNick()->getName());
}
示例14: array
<?php
$lang = array('en' => array('help' => 'Usage: %CMD% <topic here ...>. Let %BOT% set the channels topic.'));
$plugin = Dog::getPlugin();
$argv = $plugin->argv();
$argc = count($argv);
if ($argc === 0) {
return $plugin->showHelp();
}
$channel = Dog::getChannel();
Dog::getServer()->sendRAW("TOPIC {$channel->getName()} :{$plugin->msg()}");
示例15: on_slapstats_Pb
public function on_slapstats_Pb()
{
$user = Dog::getUser();
$server = Dog::getServer();
$message = $this->msgarg();
if ($message === '') {
$user2 = $user;
} elseif (false === ($user2 = $server->getUserByName($message))) {
return 'This user is unknown';
}
$db = gdo_db();
$userid = $user2->getVar('user_id');
$lsh = GWF_TABLE_PREFIX . 'dog_slap_history';
$lsu = GWF_TABLE_PREFIX . 'dog_slap_user';
$query = "SELECT COUNT(*) c , SUM(lsh_damage) sum, slapu_malus malus, slapu_malus_c malus_c FROM {$lsh} LEFT JOIN {$lsu} ON slapu_uid={$userid} WHERE lsh_slapper={$userid}";
if (false === ($result = $db->queryFirst($query))) {
return 'This user has no stats yet.';
}
$count1 = $result['c'];
$dmg_deal = $result['sum'];
$malus = $result['malus'];
$malus_c = $result['malus_c'];
// list($count1, $dmg_deal, $malus, $malus_c) = $result;
$query = "SELECT COUNT(*) c, SUM(lsh_damage) sum FROM {$lsh} WHERE lsh_target={$userid}";
if (false === ($result = $db->queryFirst($query))) {
return 'This user has no stats yet.';
}
$count2 = $result['c'];
$dmg_take = $result['sum'];
// list($count2, $dmg_take) = $result;
// $count3 = $count1 - $count2;
$score = $dmg_deal - $dmg_take;
$score -= $malus;
if ($malus_c > 0) {
$malusmsg = sprintf(' %d Remainslaps (-%d points).', $malus_c, $malus);
} else {
$malusmsg = '';
}
$out = sprintf('%s has slapped other people %d times. Total damage caused: %d(%.02f in avg). The user got slapped %d times. Total damage taken: %d(%.02f in avg).%s This sums up to %d points.', $user2->getName(), $count1, $dmg_deal, $count1 == 0 ? 0 : $dmg_deal / $count1, $count2, $dmg_take, $count2 == 0 ? 0 : $dmg_take / $count2, $malusmsg, $score);
$this->reply($out);
}