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 | |
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
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | src/gui/popupmenu.cpp | 17 | ||||
-rw-r--r-- | src/localplayer.cpp | 17 | ||||
-rw-r--r-- | src/localplayer.h | 5 | ||||
-rw-r--r-- | tmw.cbp | 5 |
5 files changed, 45 insertions, 4 deletions
@@ -1,3 +1,8 @@ +2008-04-02 David Athay <ko2fan@gmail.com> + + * src/localplayer.cpp, src/gui/popupmenu.cpp, src/localplayer.h, + tmw.cbp: Added ability to right click a player and invite to guild. + 2008-04-01 David Athay <ko2fan@gmail.com> * src/game.cpp, src/gui/guildwindow.h, src/gui/chat.cpp, 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); @@ -104,9 +104,6 @@ <Unit filename="src/configuration.h"> <Option target="default" /> </Unit> - <Unit filename="src/defines.h"> - <Option target="default" /> - </Unit> <Unit filename="src/engine.cpp" /> <Unit filename="src/engine.h"> <Option target="default" /> @@ -666,7 +663,7 @@ <Unit filename="src/resources/music.cpp" /> <Unit filename="src/resources/music.h"> <Option target="default" /> - </Unit> + </Unit> <Unit filename="src/resources/npcdb.cpp" /> <Unit filename="src/resources/npcdb.h"> <Option target="default" /> |