本文整理汇总了PHP中Dog::getChannel方法的典型用法代码示例。如果您正苦于以下问题:PHP Dog::getChannel方法的具体用法?PHP Dog::getChannel怎么用?PHP Dog::getChannel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dog
的用法示例。
在下文中一共展示了Dog::getChannel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAutoTargetISO
private static function getAutoTargetISO()
{
if (false !== ($channel = Dog::getChannel())) {
return $channel->getLangISO();
} else {
return Dog::getUser()->getLangISO();
}
}
示例2: event_privmsg
/**
* We hook into PRIVMSG to record activity.
*/
public function event_privmsg()
{
if (!Dog::isTriggered()) {
if (false !== Dog::getUser()) {
Dog_Seen::record(Dog::getUser(), Dog::getChannel(), 'privmsg', $this->msg());
}
}
}
示例3: event_KICK
/**
* Rejoin on kick :)
*/
public function event_KICK()
{
$server = Dog::getServer();
if (Dog::argv(1) === $server->getNick()->getName()) {
if ($this->getConfig('kickjoin')) {
$server->joinChannel(Dog::getChannel());
}
}
}
示例4: on_slap_Pc
public function on_slap_Pc()
{
$message = $this->msgarg();
if ($message === '') {
return $this->showHelp('slap');
}
$channel = Dog::getChannel();
$origin = $channel->getName();
require $this->getPath() . 'slaps.php';
$server = Dog::getServer();
$user = Dog::getUser();
$damage = 10000;
list($adverb, $dmg_adv) = $this->getRandomItem($slaps['adverbs']);
$damage = $this->applyDamage($damage, $dmg_adv);
list($verb, $dmg_verb) = $this->getRandomItem($slaps['verbs']);
$damage = $this->applyDamage($damage, $dmg_verb);
list($adjective, $dmg_adj) = $this->getRandomItem($slaps['adjectives']);
$damage = $this->applyDamage($damage, $dmg_adj);
list($item, $dmg_item) = $this->getRandomItem($slaps['items']);
$damage = $this->applyDamage($damage, $dmg_item);
$damage = round($damage);
$target_name = Common::substrUntil($message, ' ');
# Check if a non record slap
$fake = false;
if (false === ($target = $this->getTarget($server, $target_name, $origin))) {
$fake = true;
} elseif (true !== ($remain = Dog_SlapHistory::maySlap($user->getID(), $target->getID(), $this->getTimeout()))) {
$fake = true;
} elseif (true !== ($toomuch = Dog_SlapHistory::maySlapMore($user->getID(), $this->getTimeout(), $this->getSlapsPerPlayer()))) {
$fake = true;
}
if ($target instanceof Dog_User) {
$target_name = Dog::softhyphe($target->getName());
}
$message = sprintf('%s %s %s %s with %s %s.', $user->getVar('user_name'), $adverb, $verb, $target_name, $adjective, $item);
# Insert slap
if ($fake === true) {
if (false === Dog_SlapHistory::slapTimeout($adverb, $dmg_adv, $verb, $dmg_verb, $adjective, $dmg_adj, $item, $dmg_item)) {
return GWF_HTML::err('ERR_DATABASE', __FILE__, __LINE__);
}
if (isset($remain) && $remain !== true) {
$malus = $this->getRemainMalus();
Dog_SlapUser::removePoints($user->getID(), $malus);
$message .= sprintf(' (%s remaining, Lost %d points).', GWF_Time::humanDuration($remain), $malus);
} elseif (isset($toomuch) && $toomuch !== true) {
$malus = $this->getPerPlayerMalus();
Dog_SlapUser::removePoints($user->getID(), $malus);
$message .= sprintf(' (more than %d slaps within %s. Lost %d points).', $this->getSlapsPerPlayer(), GWF_Time::humanDuration($this->getTimeout()), $malus);
}
} else {
if (false === Dog_SlapHistory::slap($user, $target, $adverb, $dmg_adv, $verb, $dmg_verb, $adjective, $dmg_adj, $item, $dmg_item, $damage)) {
return GWF_HTML::err('ERR_DATABASE', __FILE__, __LINE__);
}
$message .= ' (' . $damage . ' damage).';
}
$server->reply($message);
}
示例5: announceVideo
private function announceVideo(array $data)
{
// Pick ISO for channel?
if (false !== ($chan = Dog::getChannel())) {
$iso = $chan->getLangISO();
} else {
$iso = Dog::getUser()->getLangISO();
}
$vars = array($data['title'], GWF_TimeConvert::humanDurationISO($iso, $data['duration']), sprintf('%.02f', $data['rating']), number_format($data['views']), number_format($data['num_raters']));
Dog::reply($this->langISO($iso, 'video', $vars));
}
示例6: on_hang_Pc
public function on_hang_Pc()
{
$channel = Dog::getChannel();
if (false === isset($this->instances[$channel->getID()])) {
$config = array('solution_allowed_everytime' => $this->getConfig('solve_anytime', 'c') === '1', 'placeholder' => $this->getConfig('placeholder', 'c'), 'lives' => $this->getConfig('lives', 'c'), 'singleplayer' => $this->getConfig('singleplayer', 'c') === '1');
$this->instances[$channel->getID()] = new HangmanGame($config);
}
$hang = $this->instances[$channel->getID()];
$hang instanceof HangmanGame;
$this->reply($hang->onGuess(Dog::getUser()->getName(), $this->msgarg()));
}
示例7: 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);
}
示例8: collectorEnabled
public function collectorEnabled($collector = 'collect')
{
if (Dog::getUser() === false) {
return false;
}
$user = $this->getCollectConf($collector . '_user', 'u');
$chan = $this->getCollectConf($collector . '_chan', 'c');
$serv = $this->getCollectConf($collector . '_serv', 's');
$glob = $this->getCollectConf($collector . '_glob', 'g');
if (false !== Dog::getChannel()) {
return $this->collectorEnabledArray(array($user, $chan, $serv, $glob));
} else {
return $this->collectorEnabledArray(array($user, $serv, $glob));
}
}
示例9: 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.'));
// }
}
示例10: 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;
}
}
}
示例11: onGuess
/**
*
* @param string $user the username
* @param string|char $message the guess
* @return the answer
*/
public function onGuess($user, $message)
{
$message = trim($message);
if ($this->finish) {
if ($message === 'false') {
$this->CONFIG['solution_allowed_everytime'] = false;
}
$iso = Common::substrFrom($message, ' ', Dog::getChannel()->getLangISO());
$this->onStartGame($iso);
} elseif ($message === '') {
$this->sendOutput('The game has already started');
} else {
if (GWF_String::strlen($message) !== 1) {
$this->trySolution($user, $message);
} else {
$this->tryChar($user, $message);
}
if (GWF_String::toLower($this->grid) === GWF_String::tolower($this->solution)) {
$this->winGame($nick);
}
}
return $this->clearOutput();
}
示例12: array
<?php
$lang = array('en' => array('help' => 'Usage: %CMD%. Figure out who is to blame.', 'blame' => 'I blame %s.'));
$plugin = Dog::getPlugin();
# tehron'ed version
$goats = array_map(array('Dog', 'softhyphe'), array("spaceone", "spaceone", "spaceone"));
shuffle($goats);
$rand_keys = array_rand($goats, count($goats));
shuffle($goats);
if (false !== ($channel = Dog::getChannel()) && !strcasecmp($channel->getName(), '#revolutionelite')) {
$scapegoat = 'sabretooth';
} else {
$scapegoat = $goats[$rand_keys[rand(0, count($goats) - 1)]];
}
$plugin->rply('blame', array($scapegoat));
示例13: array
<?php
$lang = array('en' => array('help' => 'Usage: %CMD% [<triggers>]. Show or set the triggers configured for this channel/server. Needs admin/ircop to set it. Use %CMD% default to switch back to defaults.', 'chan' => 'This channel overrides triggers to %s.', 'chan_by_serv' => 'This channel uses the triggers from the server: %s.', 'chan_by_bot' => 'This channel uses the bot triggers: %s.', 'serv' => 'This server overrides triggers to %s.', 'serv_by_bot' => 'This server uses the bot triggers: %s.', 'chan_to_default' => 'This channel now uses the server or %BOT% triggers.', 'chan_to' => 'This channel now overrides triggers to %s.', 'serv_to_default' => 'This server now uses the %BOT% triggers.', 'serv_to' => 'This server now defaults triggers to %s.'));
$plugin = Dog::getPlugin();
$user = Dog::getUser();
$serv = Dog::getServer();
$chan = Dog::getChannel();
$argv = $plugin->argv();
$argc = count($argv);
if ($argc === 0) {
if ($chan !== false) {
if (NULL !== ($t = $chan->getTriggers())) {
$plugin->rply('chan', array($t));
} elseif (NULL !== ($t = $serv->getTriggers())) {
$plugin->rply('chan_by_serv', array($t));
} else {
$plugin->rply('chan_by_bot', array(Dog_Init::getTriggers()));
}
} else {
if (NULL !== ($t = $serv->getTriggers())) {
$plugin->rply('serv', array($t));
} else {
$plugin->rply('serv_by_bot', array(Dog_Init::getTriggers()));
}
}
} elseif ($argc === 1) {
if ($chan !== false) {
if ($argv[0] === 'default') {
$chan->saveVar('chan_triggers', NULL);
$plugin->rply('chan_to_default');
} else {
示例14: event_privmsg
public function event_privmsg()
{
$message = $this->msg();
# Triggered in channel?
if (false !== ($channel = Dog::getChannel())) {
if (strpos($this->getConfig('triggers', 'c'), $message[0]) !== false) {
Shadowrun4::onTrigger(Dog::getUser(), substr($message, 1));
}
} elseif (strpos($this->getConfig('servtrig', 's'), $message[0]) !== false) {
Shadowrun4::onTrigger(Dog::getUser(), substr($message, 1));
}
}
示例15: array
<?php
$lang = array('en' => array('help' => 'Usage: %CMD% [<channel>[!<SID>]]. Command %BOT% to leave a channel. IRCOps can utilize this across networks.', 'not_there' => 'The channel you are trying to leave ist not occupied by %BOT% at all.', 'parting' => 'I am leaving %s now, and won´t come back on my own.'), 'de' => array('help' => 'Nutze: %CMD% [<Kanal>[!<SID>]]. Befehle %BOT% einen Kanal zu verlassen. IRCOps können dies Netzwerkübergreifend erledigen.', 'not_there' => 'Der Kanal den Du verlassen möchtest wird ist %BOT% zur Zeit unbekannt.', 'parting' => 'Ich verlasse nun %s und komme auch nicht von selbst wieder.'));
$plugin = Dog::getPlugin();
$serv = Dog::getServer();
$user = Dog::getUser();
$argv = $plugin->argv();
$argc = count($argv);
if ($argc === 0) {
if (false === ($channel = Dog::getChannel())) {
return $plugin->showHelp();
}
} elseif ($argc === 1) {
if (false === ($channel = Dog::getOrLoadChannelByArg($argv[0]))) {
return Dog::rply('err_channel');
}
if ($channel->getSID() !== $serv->getID()) {
if (!Dog::hasPermission($serv, false, $user, 'i')) {
return Dog::noPermission('i');
}
}
} else {
return $plugin->showHelp();
}
# Do it!
$channel->saveOption(Dog_Channel::AUTO_JOIN, false);
$plugin->rply('parting', array($channel->displayLongName()));
$serv->partChannel($channel);