Mana
Loading...
Searching...
No Matches
guildtab.cpp
Go to the documentation of this file.
1/*
2 * The Mana Client
3 * Copyright (C) 2008-2009 The Mana World Development Team
4 * Copyright (C) 2009-2012 The Mana Developers
5 *
6 * This file is part of The Mana Client.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 */
21
23
24#include "chatlogger.h"
25#include "commandhandler.h"
26#include "guild.h"
27#include "localplayer.h"
28
29#include "net/net.h"
30#include "net/guildhandler.h"
31
32#include "resources/theme.h"
33
34#include "utils/gettext.h"
35
36namespace TmwAthena {
37
38extern Guild *taGuild;
39
45
46void GuildTab::handleInput(const std::string &msg)
47{
49}
50
52{
53 chatLog(_("/help > Display this help."));
54 chatLog(_("/invite > Invite a player to your guild"));
55 chatLog(_("/leave > Leave the guild you are in"));
56 chatLog(_("/kick > Kick someone from the guild you are in"));
57}
58
59bool GuildTab::handleCommand(const std::string &type, const std::string &args)
60{
61 if (type == "help")
62 {
63 if (args == "invite")
64 {
65 chatLog(_("Command: /invite <nick>"));
66 chatLog(_("This command invites <nick> to the guild you're in."));
67 chatLog(_("If the <nick> has spaces in it, enclose it in "
68 "double quotes (\")."));
69 }
70 else if (args == "leave")
71 {
72 chatLog(_("Command: /leave"));
73 chatLog(_("This command causes the player to leave the guild."));
74 }
75 else
76 return false;
77 }
78 else if (type == "create" || type == "new")
79 {
80 if (args.empty())
81 chatLog(_("Guild name is missing."), BY_SERVER);
82 else
84 }
85 else if (type == "invite")
86 {
88 }
89 else if (type == "leave")
90 {
92 }
93 else if (type == "kick")
94 {
96 }
97 else
98 return false;
99
100 return true;
101}
102
103void GuildTab::getAutoCompleteList(std::vector<std::string> &names) const
104{
105 if (taGuild)
106 taGuild->getNames(names);
107}
108
109void GuildTab::saveToLogFile(std::string &msg)
110{
111 if (chatLogger)
112 chatLogger->log("#Guild", msg);
113}
114
115} // namespace TmwAthena
ChatLogger * chatLogger
Chat log object.
Definition client.cpp:100
@ BY_SERVER
Definition chatwindow.h:50
void log(std::string str)
Enters a message in the log.
A tab for the chat window.
Definition chattab.h:36
void chatLog(std::string line, Own own=BY_SERVER, bool ignoreRecord=false)
Adds a line of text to our message list.
Definition chattab.cpp:111
Definition guild.h:55
void getNames(std::vector< std::string > &names) const
Definition guild.cpp:175
GuildMember * getMember(int id) const
Find a member by ID.
Definition guild.cpp:74
short getId() const
Get the id of the guild.
Definition guild.h:103
virtual void create(const std::string &name)=0
virtual void chat(int guildId, const std::string &text)=0
virtual void kick(GuildMember *member, std::string reason=std::string())=0
virtual void invite(int guildId, const std::string &name)=0
virtual void leave(int guildId)=0
void setTabColor(const gcn::Color *color)
Set the normal color fo the tab's text.
Definition tab.cpp:117
static const gcn::Color & getThemeColor(int type)
Gets the color associated with the type in the default palette (0).
Definition theme.cpp:313
@ GUILD
Definition theme.h:246
void handleInput(const std::string &msg) override
Definition guildtab.cpp:46
void saveToLogFile(std::string &msg) override
Definition guildtab.cpp:109
void showHelp() override
Add any extra help text to the output.
Definition guildtab.cpp:51
void getAutoCompleteList(std::vector< std::string > &names) const override
Definition guildtab.cpp:103
bool handleCommand(const std::string &type, const std::string &args) override
Handle special commands.
Definition guildtab.cpp:59
#define _(s)
Definition gettext.h:38
GuildHandler * getGuildHandler()
Definition net.cpp:85
Warning: buffers and other variables are shared, so there can be only one connection active at a time...
Guild * taGuild
Definition guildtab.cpp:38