summaryrefslogtreecommitdiff
path: root/src/gui/popupmenu.cpp
diff options
context:
space:
mode:
authorBjørn Lindeijer <bjorn@lindeijer.nl>2008-05-14 18:57:32 +0000
committerBjørn Lindeijer <bjorn@lindeijer.nl>2008-05-14 18:57:32 +0000
commit2d648c5dc29a1ceae154194c23c799c7076894b4 (patch)
treef6c31a30260b80713257be211b139263b3291098 /src/gui/popupmenu.cpp
parent41906acb990895831e3b2c39102f41c9b580ae10 (diff)
downloadmana-2d648c5dc29a1ceae154194c23c799c7076894b4.tar.gz
mana-2d648c5dc29a1ceae154194c23c799c7076894b4.tar.bz2
mana-2d648c5dc29a1ceae154194c23c799c7076894b4.tar.xz
mana-2d648c5dc29a1ceae154194c23c799c7076894b4.zip
Added ability to define friends, players you want to ignore or disregard and
configure whether trading is allowed. Based on new popup code, configuration improvements to store hierarchical data and a table model.
Diffstat (limited to 'src/gui/popupmenu.cpp')
-rw-r--r--src/gui/popupmenu.cpp52
1 files changed, 51 insertions, 1 deletions
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 8f93cb1e..f9bfe56d 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -38,6 +38,7 @@
#include "../item.h"
#include "../localplayer.h"
#include "../npc.h"
+#include "../player_relations.h"
#include "../resources/iteminfo.h"
#include "../resources/itemdb.h"
@@ -75,8 +76,29 @@ void PopupMenu::showPopup(int x, int y, Being *being)
// add as buddy will be options in this menu.
const std::string &name = mBeing->getName();
mBrowserBox->addRow("@@trade|Trade With " + name + "@@");
-
mBrowserBox->addRow("@@attack|Attack " + name + "@@");
+
+ mBrowserBox->addRow("##3---");
+
+ switch (player_relations.getRelation(name)) {
+ case PlayerRelation::NEUTRAL:
+ mBrowserBox->addRow("@@friend|Befriend " + name + "@@");
+
+ case PlayerRelation::FRIEND:
+ mBrowserBox->addRow("@@disregard|Disregard " + name + "@@");
+ mBrowserBox->addRow("@@ignore|Ignore " + name + "@@");
+ break;
+
+ case PlayerRelation::DISREGARDED:
+ mBrowserBox->addRow("@@unignore|Un-Ignore " + name + "@@");
+ mBrowserBox->addRow("@@ignore|Completely ignore " + name + "@@");
+ break;
+
+ case PlayerRelation::IGNORED:
+ mBrowserBox->addRow("@@unignore|Un-Ignore " + name + "@@");
+ break;
+ }
+
//mBrowserBox->addRow("@@follow|Follow " + name + "@@");
//mBrowserBox->addRow("@@buddy|Add " + name + " to Buddy List@@");
}
@@ -144,6 +166,34 @@ void PopupMenu::handleLink(const std::string& link)
player_node->attack(mBeing, true);
}
+ else if (link == "unignore" &&
+ mBeing != NULL &&
+ mBeing->getType() == Being::PLAYER)
+ {
+ player_relations.setRelation(mBeing->getName(), PlayerRelation::NEUTRAL);
+ }
+
+ else if (link == "ignore" &&
+ mBeing != NULL &&
+ mBeing->getType() == Being::PLAYER)
+ {
+ player_relations.setRelation(mBeing->getName(), PlayerRelation::IGNORED);
+ }
+
+ else if (link == "disregard" &&
+ mBeing != NULL &&
+ mBeing->getType() == Being::PLAYER)
+ {
+ player_relations.setRelation(mBeing->getName(), PlayerRelation::DISREGARDED);
+ }
+
+ else if (link == "friend" &&
+ mBeing != NULL &&
+ mBeing->getType() == Being::PLAYER)
+ {
+ player_relations.setRelation(mBeing->getName(), PlayerRelation::FRIEND);
+ }
+
/*
// Follow Player action
else if (link == "follow")