summaryrefslogtreecommitdiff
path: root/src/gui/popupmenu.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-08-26 16:57:05 +0300
committerAndrei Karas <akaras@inbox.ru>2011-08-27 05:37:27 +0300
commit12bf548533867a2eb3a1c354b778ef7f9157322a (patch)
tree3cb6f61396f00a5d3fa280ecd9d99f309f06f4ca /src/gui/popupmenu.cpp
parent2e7bfc350d38e16b3d340f8e4ea69e6ff6748f5c (diff)
downloadmv-12bf548533867a2eb3a1c354b778ef7f9157322a.tar.gz
mv-12bf548533867a2eb3a1c354b778ef7f9157322a.tar.bz2
mv-12bf548533867a2eb3a1c354b778ef7f9157322a.tar.xz
mv-12bf548533867a2eb3a1c354b778ef7f9157322a.zip
Basic support for guild bot integration.
Not working context menu actions, chat commands, auto complete.
Diffstat (limited to 'src/gui/popupmenu.cpp')
-rw-r--r--src/gui/popupmenu.cpp77
1 files changed, 59 insertions, 18 deletions
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 61769bc7e..a3041fcf7 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -27,6 +27,7 @@
#include "being.h"
#include "dropshortcut.h"
#include "guild.h"
+#include "guildmanager.h"
#include "flooritem.h"
#include "graphics.h"
#include "item.h"
@@ -224,14 +225,22 @@ void PopupMenu::showPopup(int x, int y, Being *being)
{
mBrowserBox->addRow(strprintf(
"@@guild-kick|%s@@", _("Kick from guild")));
- mBrowserBox->addRow(strprintf("@@guild-pos|%s >@@",
- _("Change pos in guild")));
+ if (guild2->getServerGuild())
+ {
+ mBrowserBox->addRow(strprintf(
+ "@@guild-pos|%s >@@",
+ _("Change pos in guild")));
+ }
}
}
else
{
- mBrowserBox->addRow(strprintf(
- "@@guild|%s@@", _("Invite to guild")));
+ if (guild2->getServerGuild()
+ || (guildManager && guildManager->havePower()))
+ {
+ mBrowserBox->addRow(strprintf(
+ "@@guild|%s@@", _("Invite to guild")));
+ }
}
}
@@ -435,15 +444,26 @@ void PopupMenu::showPlayerPopup(int x, int y, std::string nick)
{
if (guild2->getMember(mNick))
{
- mBrowserBox->addRow(strprintf(
- "@@guild-kick|%s@@", _("Kick from guild")));
- mBrowserBox->addRow(strprintf(
- "@@guild-pos|%s >@@", _("Change pos in guild")));
+ if (guild2->getServerGuild() || (guildManager
+ && guildManager->havePower()))
+ {
+ mBrowserBox->addRow(strprintf(
+ "@@guild-kick|%s@@", _("Kick from guild")));
+ }
+ if (guild2->getServerGuild())
+ {
+ mBrowserBox->addRow(strprintf(
+ "@@guild-pos|%s >@@", _("Change pos in guild")));
+ }
}
else
{
- mBrowserBox->addRow(strprintf(
- "@@guild|%s@@", _("Invite to guild")));
+ if (guild2->getServerGuild() || (guildManager
+ && guildManager->havePower()))
+ {
+ mBrowserBox->addRow(strprintf(
+ "@@guild|%s@@", _("Invite to guild")));
+ }
}
}
@@ -725,16 +745,27 @@ void PopupMenu::showChatPopup(int x, int y, ChatTab *tab)
{
if (guild1->getId() == guild2->getId())
{
- mBrowserBox->addRow(strprintf(
- "@@guild-kick|%s@@", _("Kick from guild")));
- mBrowserBox->addRow(strprintf(
- "@@guild-pos|%s >@@", _("Change pos in guild")));
+ if (guild2->getServerGuild() || (guildManager
+ && guildManager->havePower()))
+ {
+ mBrowserBox->addRow(strprintf(
+ "@@guild-kick|%s@@", _("Kick from guild")));
+ }
+ if (guild2->getServerGuild())
+ {
+ mBrowserBox->addRow(strprintf("@@guild-pos|%s >@@",
+ _("Change pos in guild")));
+ }
}
}
else
{
- mBrowserBox->addRow(strprintf(
- "@@guild|%s@@", _("Invite to guild")));
+ if (guild2->getServerGuild() || (guildManager
+ && guildManager->havePower()))
+ {
+ mBrowserBox->addRow(strprintf(
+ "@@guild|%s@@", _("Invite to guild")));
+ }
}
}
}
@@ -897,7 +928,12 @@ void PopupMenu::handleLink(const std::string &link,
{
const Guild *guild = player_node->getGuild();
if (guild)
- Net::getGuildHandler()->invite(guild->getId(), mNick);
+ {
+ if (guild->getServerGuild())
+ Net::getGuildHandler()->invite(guild->getId(), mNick);
+ else if (guildManager)
+ guildManager->invite(mNick);
+ }
}
}
else if (link == "nuke" && being)
@@ -1263,7 +1299,12 @@ void PopupMenu::handleLink(const std::string &link,
{
const Guild *guild = player_node->getGuild();
if (guild)
- Net::getGuildHandler()->kick(guild->getMember(mNick));
+ {
+ if (guild->getServerGuild())
+ Net::getGuildHandler()->kick(guild->getMember(mNick));
+ else if (guildManager)
+ guildManager->kick(mNick);
+ }
}
}
else if (link == "enable highlight" && mTab)