diff options
author | David Athay <ko2fan@gmail.com> | 2008-04-03 10:26:00 +0000 |
---|---|---|
committer | David Athay <ko2fan@gmail.com> | 2008-04-03 10:26:00 +0000 |
commit | 1bd3c1b9db33cb9dff2570f4224fae73970d5895 (patch) | |
tree | cbec38ef22773efa9082e0fec1c0021345a4a92c /src | |
parent | 3d9e141447b688c10e46e3dc8033dba26b902e00 (diff) | |
download | mana-1bd3c1b9db33cb9dff2570f4224fae73970d5895.tar.gz mana-1bd3c1b9db33cb9dff2570f4224fae73970d5895.tar.bz2 mana-1bd3c1b9db33cb9dff2570f4224fae73970d5895.tar.xz mana-1bd3c1b9db33cb9dff2570f4224fae73970d5895.zip |
Added right click to invite to guild
Diffstat (limited to 'src')
-rw-r--r-- | src/gui/popupmenu.cpp | 17 | ||||
-rw-r--r-- | src/localplayer.cpp | 17 | ||||
-rw-r--r-- | src/localplayer.h | 5 |
3 files changed, 39 insertions, 0 deletions
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index a1148379..dfd85815 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -81,6 +81,8 @@ void PopupMenu::showPopup(int x, int y, Being *being) mBrowserBox->addRow(strprintf(_("@@attack|Attack %s@@"), name.c_str())); //mBrowserBox->addRow("@@follow|Follow " + name + "@@"); //mBrowserBox->addRow("@@buddy|Add " + name + " to Buddy List@@"); + mBrowserBox->addRow(strprintf(_("@@guild|Invite %s@@"), name.c_str())); + //mBrowserBox->addRow(strprintf(_("@@party|Invite %s to join your party@@"), name.c_str())); } break; @@ -137,6 +139,21 @@ void PopupMenu::handleLink(const std::string& link) tradePartnerName = mBeing->getName(); } + // Guild action + else if (link == "guild" && + mBeing != NULL && + mBeing->getType() == Being::PLAYER) + { + player_node->invite(mBeing); + } + + /* + // Add player to your party + else if (link == "party") + { + } + */ + /* // Follow Player action else if (link == "follow") diff --git a/src/localplayer.cpp b/src/localplayer.cpp index aa3bb6ba..5cb77692 100644 --- a/src/localplayer.cpp +++ b/src/localplayer.cpp @@ -35,6 +35,7 @@ #include "log.h" #include "net/gameserver/player.h" +#include "net/chatserver/guild.h" #include "gui/gui.h" @@ -128,6 +129,22 @@ bool LocalPlayer::checkInviteRights(const std::string &guildName) return false; } +void LocalPlayer::invite(Being *being) +{ + // TODO: Allow user to choose which guild to invite being to + // For now, just invite to the first guild you have permissions to invite with + std::map<int, Guild*>::iterator itr = mGuilds.begin(); + std::map<int, Guild*>::iterator itr_end = mGuilds.end(); + for (; itr != itr_end; ++itr) + { + if (checkInviteRights(itr->second->getName())) + { + Net::ChatServer::Guild::invitePlayer(being->getName(), itr->second->getId()); + return; + } + } +} + void LocalPlayer::clearInventory() { mEquipment->clear(); diff --git a/src/localplayer.h b/src/localplayer.h index f325e19a..8ae8aa19 100644 --- a/src/localplayer.h +++ b/src/localplayer.h @@ -158,6 +158,11 @@ class LocalPlayer : public Player */ bool checkInviteRights(const std::string &guildName); + /** + * Invite a player to join guild + */ + void invite(Being* being); + void clearInventory(); void setInvItem(int index, int id, int amount); |