1: <?php
2:
3: namespace Budabot\User\Modules;
4:
5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18:
19: class OrgMembersController {
20:
21: 22: 23: 24:
25: public $moduleName;
26:
27:
28: public $db;
29:
30:
31: public $text;
32:
33:
34: public $playerManager;
35:
36:
37: public $guildManager;
38:
39: 40: 41: 42:
43: public function orgmembers2Command($message, $channel, $sender, $sendto, $args) {
44: $guild_id = $args[1];
45:
46: $msg = "Getting org info...";
47: $sendto->reply($msg);
48:
49: $org = $this->guildManager->getById($guild_id);
50: if ($org === null) {
51: $msg = "Error in getting the org info. Either org does not exist or AO's server was too slow to respond.";
52: $sendto->reply($msg);
53: return;
54: }
55:
56: $sql = "SELECT * FROM players WHERE guild_id = ? AND dimension = '<dim>' ORDER BY name ASC";
57: $data = $this->db->query($sql, $guild_id);
58: $numrows = count($data);
59:
60: $blob = '';
61:
62: $currentLetter = '';
63: forEach ($data as $row) {
64: if ($currentLetter != $row->name[0]) {
65: $currentLetter = $row->name[0];
66: $blob .= "\n\n<header2>$currentLetter<end>\n";
67: }
68:
69: $blob .= "<tab><highlight>{$row->name}, {$row->guild_rank} (Level {$row->level}";
70: if ($row->ai_level > 0) {
71: $blob .= "<green>/{$row->ai_level}<end>";
72: }
73: $blob .= ", {$row->gender} {$row->breed} {$row->profession})<end>\n";
74: }
75:
76: $msg = $this->text->makeBlob("Org members for '$org->orgname' ($numrows)", $blob);
77: $sendto->reply($msg);
78: }
79: }
80:
81: