summaryrefslogtreecommitdiff
path: root/src/gui/popupmenu.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2011-04-26 21:56:11 +0300
committerAndrei Karas <akaras@inbox.ru>2011-04-26 21:56:11 +0300
commit8f10444e4ce4a4e25455f0a3857edc7ca74631e8 (patch)
tree7917730822f7bc090adc6af482eab843c79a389c /src/gui/popupmenu.cpp
parent110134603554e06adab93a132ef8f82e55db68ad (diff)
downloadManaVerse-8f10444e4ce4a4e25455f0a3857edc7ca74631e8.tar.gz
ManaVerse-8f10444e4ce4a4e25455f0a3857edc7ca74631e8.tar.bz2
ManaVerse-8f10444e4ce4a4e25455f0a3857edc7ca74631e8.tar.xz
ManaVerse-8f10444e4ce4a4e25455f0a3857edc7ca74631e8.zip
Impliment 3 attack lists. (priority, attack, ignore)
Diffstat (limited to 'src/gui/popupmenu.cpp')
-rw-r--r--src/gui/popupmenu.cpp136
1 files changed, 115 insertions, 21 deletions
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index 7b0688587..ad0cb275f 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -254,19 +254,19 @@ void PopupMenu::showPopup(int x, int y, Being *being)
if (config.getBoolValue("enableAttackFilter"))
{
mBrowserBox->addRow("##3---");
- if (player_node->isInAttackList(name))
+ if (player_node->isInAttackList(name)
+ || player_node->isInIgnoreAttackList(name)
+ || player_node->isInPriorityAttackList(name))
{
mBrowserBox->addRow(
_("@@remove attack|Remove from attack list@@"));
}
- else if (player_node->isInIgnoreAttackList(name))
- {
- mBrowserBox->addRow(
- _("@@remove attack|Remove from ignore list@@"));
- }
else
{
mBrowserBox->addRow(
+ _("@@add attack priority|Add "
+ "to priority attack list@@"));
+ mBrowserBox->addRow(
_("@@add attack|Add to attack list@@"));
mBrowserBox->addRow(
_("@@add attack ignore|Add to ignore list@@"));
@@ -1165,6 +1165,15 @@ void PopupMenu::handleLink(const std::string &link,
socialWindow->updateAttackFilter();
}
}
+ else if (link == "add attack priority" && being)
+ {
+ if (player_node && being->getType() == Being::MONSTER)
+ {
+ player_node->addPriorityAttackMob(being->getName());
+ if (socialWindow)
+ socialWindow->updateAttackFilter();
+ }
+ }
else if (link == "add attack ignore" && being)
{
if (player_node && being->getType() == Being::MONSTER)
@@ -1203,6 +1212,36 @@ void PopupMenu::handleLink(const std::string &link,
}
}
}
+ else if (link == "priority moveup")
+ {
+ if (player_node)
+ {
+ int idx = player_node->getPriorityAttackMobIndex(mNick);
+ if (idx > 0)
+ {
+ std::list<std::string> mobs
+ = player_node->getPriorityAttackMobs();
+ std::list<std::string>::iterator it = mobs.begin();
+ std::list<std::string>::iterator it2 = mobs.begin();
+ while (it != mobs.end())
+ {
+ if (*it == mNick)
+ {
+ -- it2;
+ mobs.splice(it2, mobs, it);
+ player_node->setPriorityAttackMobs(mobs);
+ player_node->rebuildPriorityAttackMobs();
+ break;
+ }
+ ++ it;
+ ++ it2;
+ }
+
+ if (socialWindow)
+ socialWindow->updateAttackFilter();
+ }
+ }
+ }
else if (link == "attack movedown")
{
if (player_node)
@@ -1236,6 +1275,40 @@ void PopupMenu::handleLink(const std::string &link,
}
}
}
+ else if (link == "priority movedown")
+ {
+ if (player_node)
+ {
+ int idx = player_node->getPriorityAttackMobIndex(mNick);
+ int size = player_node->getPriorityAttackMobsSize();
+ if (idx + 1 < size)
+ {
+ std::list<std::string> mobs
+ = player_node->getPriorityAttackMobs();
+ std::list<std::string>::iterator it = mobs.begin();
+ std::list<std::string>::iterator it2 = mobs.begin();
+ while (it != mobs.end())
+ {
+ if (*it == mNick)
+ {
+ ++ it2;
+ if (it2 == mobs.end())
+ break;
+
+ mobs.splice(it, mobs, it2);
+ player_node->setPriorityAttackMobs(mobs);
+ player_node->rebuildPriorityAttackMobs();
+ break;
+ }
+ ++ it;
+ ++ it2;
+ }
+
+ if (socialWindow)
+ socialWindow->updateAttackFilter();
+ }
+ }
+ }
else if (link == "attack remove")
{
if (player_node)
@@ -1606,7 +1679,7 @@ void PopupMenu::showPopup(int x, int y, ProgressBar *b)
}
void PopupMenu::showAttackMonsterPopup(int x, int y, std::string name,
- bool isAttack)
+ int type)
{
if (!player_node)
return;
@@ -1619,27 +1692,48 @@ void PopupMenu::showAttackMonsterPopup(int x, int y, std::string name,
mBrowserBox->addRow(_("(default)"));
else
mBrowserBox->addRow(name);
- if (isAttack)
+ switch (type)
{
- int idx = player_node->getAttackMobIndex(name);
- int size = player_node->getAttackMobsSize();
- if (idx > 0)
+ case MapItem::ATTACK:
{
+ int idx = player_node->getAttackMobIndex(name);
+ int size = player_node->getAttackMobsSize();
+ if (idx > 0)
+ {
+ mBrowserBox->addRow(strprintf(
+ "@@attack moveup|%s@@", _("Move up")));
+ }
+ if (idx + 1 < size)
+ {
+ mBrowserBox->addRow(strprintf(
+ "@@attack movedown|%s@@", _("Move down")));
+ }
mBrowserBox->addRow(strprintf(
- "@@attack moveup|%s@@", _("Move up")));
+ "@@attack remove|%s@@", _("Remove")));
+ break;
}
- if (idx + 1 < size)
+ case MapItem::PRIORITY:
{
+ int idx = player_node->getPriorityAttackMobIndex(name);
+ int size = player_node->getPriorityAttackMobsSize();
+ if (idx > 0)
+ {
+ mBrowserBox->addRow(strprintf(
+ "@@priority moveup|%s@@", _("Move up")));
+ }
+ if (idx + 1 < size)
+ {
+ mBrowserBox->addRow(strprintf(
+ "@@priority movedown|%s@@", _("Move down")));
+ }
mBrowserBox->addRow(strprintf(
- "@@attack movedown|%s@@", _("Move down")));
+ "@@attack remove|%s@@", _("Remove")));
+ break;
}
- mBrowserBox->addRow(strprintf(
- "@@attack remove|%s@@", _("Remove")));
- }
- else
- {
- mBrowserBox->addRow(strprintf(
- "@@attack remove|%s@@", _("Remove")));
+ case MapItem::IGNORE:
+ mBrowserBox->addRow(strprintf(
+ "@@attack remove|%s@@", _("Remove")));
+ break;
}
mBrowserBox->addRow("##3---");