bot = &$bot; $this -> guild = array(); $this -> pgroup = array(); } /* This gets called on a tell with the command */ function tell($name, $msg) { $disponline = (($this -> bot -> guildbot) ? "both": "pgroup"); $this -> bot -> send_tell($name, $this -> online_msg($msg, $disponline)); } /* This gets called on a msg in the privgroup with the command */ function pgmsg($name, $msg) { if ($this -> bot -> is_member($name)) { $disponline = (($this -> bot -> guildbot) ? "both": "pgroup"); $this -> bot -> send_pgroup($this -> online_msg($msg, $disponline)); } } /* Gets called on a GC message */ function gc($name, $msg) { $disponline = (($this -> bot -> guildbot) ? "both": "pgroup"); $this -> bot -> send_gc($this -> online_msg($msg, $disponline)); } /* This gets called if someone joins the privgroup */ function pgjoin($name) { $this -> pgroup[$name] = $this -> whois($name); } /* This gets called if someone leaves the privgroup */ function pgleave($name) { if (isset($this -> pgroup[$name])) unset($this -> pgroup[$name]); } /* This gets called if a buddy logs on/off */ function buddy($name, $msg) { if ($this -> bot -> is_member($name)) { if ($msg == 1) $this -> guild[$name] = $this -> whois($name); else if (isset($this -> guild[$name])) unset($this -> guild[$name]); } } /* This gets called when bot disconnects */ function disconnect() { $this -> guild = array(); $this -> pgroup = array(); } /* This gets called when bot connects */ function connect() { $this -> connected = time() + 120; } /* Makes the message. */ function online_msg($msg, $what) { preg_match("/^" . $this -> bot -> commpre . "online (.+)$/i", $msg, $info); if ($info[1] == "all") $info[1] = ""; $guild = $this -> online_list($this -> guild, $info[1]); $pgroup = $this -> online_list($this -> pgroup, $info[1]); $online = ""; $msg = ""; if (($what == "both") || ($what == "guild")) { $online .= "::: " . $guild[0] . " members online in Guild :::\n" . $guild[1]; $online .= "\n------------------------------\n"; $msg .= "" . $guild[0] . " members online in Guild. "; } if (($what == "both") || ($what == "pgroup")) { $online .= "::: " . $pgroup[0] . " players in Privategroup :::\n" . $pgroup[1]; $msg .= "" . $pgroup[0] . " members in Privategroup. "; } $msg .= ":: " . $this -> bot -> make_blob("click to view", $online); return $msg; } /* Gets info on player */ function whois($name) { $second = (($this -> bot -> guildbot) ? "rank_name" : "guild"); $result = $this -> bot -> db -> select("SELECT nickname, level, $second, profession, id FROM members WHERE id = " . $this -> bot -> aoc -> get_uid($name)); if (empty($result)) { $content = $this -> bot -> get_site("http://www.anarchy-online.com/character/bio/d/" . $this -> bot -> dimension . "/name/" . strtolower($name) . "/bio.xml"); $result[0] = $name; $result[1] = $this -> bot -> xmlparse($content, "level"); $result[2] = $this -> bot -> xmlparse($content, "organization_name"); $result[3] = $this -> bot -> xmlparse($content, "profession"); $result[4] = $this -> bot -> aoc -> get_uid($name); $result[5] = $this -> bot -> xmlparse($content, "defender_rank_id"); } else { $result = $result[0]; $content = $this -> bot -> get_site("http://www.anarchy-online.com/character/bio/d/" . $this -> bot -> dimension . "/name/" . strtolower($name) . "/bio.xml"); $result[5] = $this -> bot -> xmlparse($content, "defender_rank_id"); } if (empty($result[3])) $result[3] = "Unknown"; if (empty($result[1])) $result[1] = "?"; if (empty($result[2])) $result[2] = "soloer"; if (empty($result[5])) $result[5] = "?"; $result[6] = "none"; return $result; } /* make the list of online players */ function online_list($online, $like) { $profgfx["Meta-Physicist"] = "16308"; $profgfx["Adventurer"] = "84203"; $profgfx["Engineer"] = "16252"; $profgfx["Soldier"] = "16237"; $profgfx["Keeper"] = "84197"; $profgfx["Shade"] = "39290"; $profgfx["Fixer"] = "16300"; $profgfx["Agent"] = "16186"; $profgfx["Trader"] = "117993"; $profgfx["Doctor"] = "44235"; $profgfx["Enforcer"] = "100998"; $profgfx["Bureaucrat"] = "16341"; $profgfx["Martial Artist"] = "16196"; $profgfx["Nano-Technician"] = "16283"; $prof_based = ""; $online_list = ""; $online_num = 0; if (!empty($online)) { foreach ($online as $player) { $prof_based[$player[3]][(sprintf("%03d", (220 - $player[1])) . $player[0])] = $player; } ksort($prof_based); foreach ($prof_based as $key => $prof) { if (preg_match("/" . $like . "/i", $key)) { $online_list .= "\n\n"; $online_list .= ""; $online_list .= " " . $key . "\n"; $online_list .= "\n"; ksort($prof); foreach ($prof as $player) { $admin = ""; $online_num++; $main = $this -> bot -> alts -> main($player[4]); $alts = $this -> bot -> alts -> get_alts($main); if ($this -> bot -> admin -> in_group($player[0], "superadmin")) { $admin = " :: Superadmin "; } else if ($this -> bot -> admin -> in_group($player[0], "admin")) { $admin = " :: Admin "; } else if ($this -> bot -> admin -> in_group($player[0], "raidleader")) { $admin = " :: Raidleader "; } if (empty($alts)) { $alts = ""; } else if ($main == $this -> bot -> aoc -> get_uname($player[4])) { $alts = ":: Alts ::"; } else { $alts = ":: " . $main . "'s Alts "; } if ($player[6] != "none") { $chatclient = "(" . $player[6] . ") "; } else { $chatclient = ""; } $online_list .= " - L " . $player[1] . " / AL " . $player[5] . " " . $player[0] . " (" . $player[2] . ") " . $admin . $chatclient . $alts . ""; if($this -> bot -> commands["tell"]["afk"] -> afk[$player[0]]) { $online_list .= ":: ( AFK )\n"; } else { $online_list .= "\n"; } } } } } return array($online_num, $online_list); } /* Is called if user is using a chat client... */ function chatclient($name, $type) { if (isset($this -> guild[$name])) { $this -> guild[$name][5] = $type; } if (isset($this -> pgroup[$name])) { $this -> pgroup[$name][5] = $type; } } } ?>