diff options
author | Jared Adams <jaxad0127@gmail.com> | 2009-04-15 13:10:38 -0600 |
---|---|---|
committer | Jared Adams <jaxad0127@gmail.com> | 2009-04-15 13:10:38 -0600 |
commit | e8a1b2386bb2c28cfce0eb28d7e7067d51bb6701 (patch) | |
tree | 6c9218f32675f9d401301172869c30488ab08b16 /src/gui/popupmenu.cpp | |
parent | 56c224050f10d976298cef98607aa3b3e56fcc99 (diff) | |
parent | 3d85a00ff2a33e22ba63d0b7dfc156d8076933e1 (diff) | |
download | mana-e8a1b2386bb2c28cfce0eb28d7e7067d51bb6701.tar.gz mana-e8a1b2386bb2c28cfce0eb28d7e7067d51bb6701.tar.bz2 mana-e8a1b2386bb2c28cfce0eb28d7e7067d51bb6701.tar.xz mana-e8a1b2386bb2c28cfce0eb28d7e7067d51bb6701.zip |
Merge branch 'master' of git@gitorious.org:tmw/mainline
Diffstat (limited to 'src/gui/popupmenu.cpp')
-rw-r--r-- | src/gui/popupmenu.cpp | 48 |
1 files changed, 31 insertions, 17 deletions
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp index e8af3122..5142482f 100644 --- a/src/gui/popupmenu.cpp +++ b/src/gui/popupmenu.cpp @@ -78,13 +78,16 @@ void PopupMenu::showPopup(int x, int y, Being *being) if (being->getType() != Being::UNKNOWN) mBrowserBox->addRow(_("@@name|Add name to chat@@")); + const std::string &name = being->getType() == Being::NPC ? + being->getName().substr(0, being->getName().size() + - 6) : being->getName(); + switch (being->getType()) { case Being::PLAYER: { // Players can be traded with. Later also follow and // add as buddy will be options in this menu. - const std::string &name = being->getName(); mBrowserBox->addRow(strprintf(_("@@trade|Trade With %s@@"), name.c_str())); mBrowserBox->addRow(strprintf(_("@@attack|Attack %s@@"), name.c_str())); @@ -109,7 +112,7 @@ void PopupMenu::showPopup(int x, int y, Being *being) break; } - //mBrowserBox->addRow(_("@@follow|Follow ") + name + "@@"); + //mBrowserBox->addRow(_(strprintf("@@follow|Follow %s@@"), name.c_str())); //mBrowserBox->addRow(_("@@buddy|Add ") + name + " to Buddy List@@"); mBrowserBox->addRow(strprintf(_("@@guild|Invite %s to join your guild@@"), name.c_str())); mBrowserBox->addRow(strprintf(_("@@party|Invite %s to join your party@@"), name.c_str())); @@ -123,7 +126,12 @@ void PopupMenu::showPopup(int x, int y, Being *being) case Being::NPC: // NPCs can be talked to (single option, candidate for removal // unless more options would be added) - mBrowserBox->addRow(_("@@talk|Talk To NPC@@")); + mBrowserBox->addRow(strprintf(_("@@talk|Talk To %s@@"), name.c_str())); + break; + + case Being::MONSTER: + // Monsters can be attacked + mBrowserBox->addRow(strprintf(_("@@attack|Attack %s@@"), name.c_str())); break; /*case Being::MONSTER: @@ -132,7 +140,7 @@ void PopupMenu::showPopup(int x, int y, Being *being) default: /* Other beings aren't interesting... */ - break; + return; } //browserBox->addRow("@@look|Look To@@"); @@ -145,11 +153,13 @@ void PopupMenu::showPopup(int x, int y, Being *being) void PopupMenu::showPopup(int x, int y, FloorItem *floorItem) { mFloorItem = floorItem; + mItem = floorItem->getItem(); mBrowserBox->clearRows(); // Floor item can be picked up (single option, candidate for removal) std::string name = ItemDB::get(mFloorItem->getItemId()).getName(); mBrowserBox->addRow(strprintf(_("@@pickup|Pick Up %s@@"), name.c_str())); + mBrowserBox->addRow(_("@@chat|Add to Chat@@")); //browserBox->addRow("@@look|Look To@@"); mBrowserBox->addRow("##3---"); @@ -181,9 +191,7 @@ void PopupMenu::handleLink(const std::string &link) } #ifdef EATHENA_SUPPORT // Attack action - else if (link == "attack" && - being && - being->getType() == Being::PLAYER) + else if (link == "attack" && being) { player_node->attack(being, true); } @@ -224,11 +232,6 @@ void PopupMenu::handleLink(const std::string &link) player_node->inviteToGuild(being); } #endif - // Add player to your party - else if (link == "party") - { - player_node->inviteToParty(dynamic_cast<Player*>(being)); - } /* // Follow Player action else if (link == "follow") @@ -244,10 +247,6 @@ void PopupMenu::handleLink(const std::string &link) buddyWindow->addBuddy(being->getName()); }*/ - else if (link == "name") - { - chatWindow->addInputText(being->getName()); - } // Pick Up Floor Item action else if ((link == "pickup") && mFloorItem) @@ -294,11 +293,26 @@ void PopupMenu::handleLink(const std::string &link) new ItemAmountWindow(ItemAmountWindow::ItemSplit, inventoryWindow, mItem); } + else if (link == "drop") { new ItemAmountWindow(ItemAmountWindow::ItemDrop, inventoryWindow, mItem); } + + else if (link == "party" && being && being->getType() == Being::PLAYER) + { + player_node->inviteToParty(dynamic_cast<Player*>(being)); + } + + else if (link == "name" && being) + { + const std::string &name = being->getType() == Being::NPC ? + being->getName().substr(0, + being->getName().size() - 6) : being->getName(); + chatWindow->addInputText(name); + } + else if (link == "admin-kick" && being && (being->getType() == Being::PLAYER || @@ -308,7 +322,7 @@ void PopupMenu::handleLink(const std::string &link) } // Unknown actions - else + else if (link != "cancel") { std::cout << link << std::endl; } |