summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/commandhandler.cpp51
-rw-r--r--src/commandhandler.h8
-rw-r--r--src/gui/chatwindow.cpp3
-rw-r--r--src/gui/widgets/avatarlistbox.cpp5
4 files changed, 66 insertions, 1 deletions
diff --git a/src/commandhandler.cpp b/src/commandhandler.cpp
index 888451021..5211c64c3 100644
--- a/src/commandhandler.cpp
+++ b/src/commandhandler.cpp
@@ -35,6 +35,7 @@
#include "gui/gui.h"
#include "gui/outfitwindow.h"
#include "gui/shopwindow.h"
+#include "gui/socialwindow.h"
#include "gui/trade.h"
#include "gui/sdlfont.h"
@@ -259,6 +260,18 @@ void CommandHandler::handleCommand(const std::string &command, ChatTab *tab)
{
handleUptime(args, tab);
}
+ else if (type == "addattack")
+ {
+ handleAddAttack(args, tab);
+ }
+ else if (type == "removeattack" || type == "removeignoreattack")
+ {
+ handleRemoveAttack(args, tab);
+ }
+ else if (type == "addignoreattack")
+ {
+ handleAddIgnoreAttack(args, tab);
+ }
else if (tab->handleCommand(type, args))
{
// Nothing to do
@@ -978,6 +991,44 @@ void CommandHandler::handleUptime(const std::string &args _UNUSED_,
}
}
+void CommandHandler::handleAddAttack(const std::string &args,
+ ChatTab *tab _UNUSED_)
+{
+ if (!player_node || player_node->isInAttackList(args))
+ return;
+
+ player_node->removeAttackMob(args);
+ player_node->addAttackMob(args);
+
+ if (socialWindow)
+ socialWindow->updateAttackFilter();
+}
+
+void CommandHandler::handleRemoveAttack(const std::string &args,
+ ChatTab *tab _UNUSED_)
+{
+ if (!player_node || args.empty() || !player_node->isInAttackList(args))
+ return;
+
+ player_node->removeAttackMob(args);
+
+ if (socialWindow)
+ socialWindow->updateAttackFilter();
+}
+
+void CommandHandler::handleAddIgnoreAttack(const std::string &args,
+ ChatTab *tab _UNUSED_)
+{
+ if (!player_node || player_node->isInIgnoreAttackList(args))
+ return;
+
+ player_node->removeAttackMob(args);
+ player_node->addIgnoreAttackMob(args);
+
+ if (socialWindow)
+ socialWindow->updateAttackFilter();
+}
+
void CommandHandler::handleCacheInfo(const std::string &args _UNUSED_,
ChatTab *tab _UNUSED_)
{
diff --git a/src/commandhandler.h b/src/commandhandler.h
index 779a6e6fd..41811be89 100644
--- a/src/commandhandler.h
+++ b/src/commandhandler.h
@@ -274,6 +274,14 @@ class CommandHandler
void handleUptime(const std::string &args, ChatTab *tab);
+ void handleAddAttack(const std::string &args, ChatTab *tab _UNUSED_);
+
+ void handleRemoveAttack(const std::string &args,
+ ChatTab *tab _UNUSED_);
+
+ void handleAddIgnoreAttack(const std::string &args,
+ ChatTab *tab _UNUSED_);
+
void handleCacheInfo(const std::string &args, ChatTab *tab _UNUSED_);
bool parse2Int(const std::string &args, int *x, int *y);
diff --git a/src/gui/chatwindow.cpp b/src/gui/chatwindow.cpp
index 472c2b531..506257047 100644
--- a/src/gui/chatwindow.cpp
+++ b/src/gui/chatwindow.cpp
@@ -285,6 +285,9 @@ void ChatWindow::fillCommands()
mCommands.push_back("/info");
mCommands.push_back("/wait");
mCommands.push_back("/uptime");
+ mCommands.push_back("/addattack ");
+ mCommands.push_back("/removeattack ");
+ mCommands.push_back("/addignoreattack ");
}
void ChatWindow::resetToDefaultSize()
diff --git a/src/gui/widgets/avatarlistbox.cpp b/src/gui/widgets/avatarlistbox.cpp
index 8309ad156..f3bdb6a45 100644
--- a/src/gui/widgets/avatarlistbox.cpp
+++ b/src/gui/widgets/avatarlistbox.cpp
@@ -258,7 +258,10 @@ void AvatarListBox::draw(gcn::Graphics *gcnGraphics)
graphics->setColor(Theme::getThemeColor(Theme::TEXT));
// Draw Name
- graphics->drawText(text, 15, y);
+ if (a->getType() == MapItem::SEPARATOR)
+ graphics->drawText(text, 2, y);
+ else
+ graphics->drawText(text, 15, y);
if (a->getDisplayBold())
graphics->setFont(getFont());