summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/actorsprite.cpp6
-rw-r--r--src/being.cpp5
-rw-r--r--src/client.cpp8
-rw-r--r--src/configuration.cpp2
-rw-r--r--src/event.h137
-rw-r--r--src/game.cpp22
-rw-r--r--src/gui/chat.cpp12
-rw-r--r--src/gui/chat.h2
-rw-r--r--src/gui/gui.cpp2
-rw-r--r--src/gui/inventorywindow.cpp16
-rw-r--r--src/gui/itemamount.cpp8
-rw-r--r--src/gui/ministatus.cpp4
-rw-r--r--src/gui/npcdialog.cpp20
-rw-r--r--src/gui/outfitwindow.cpp4
-rw-r--r--src/gui/popupmenu.cpp6
-rw-r--r--src/gui/skilldialog.cpp2
-rw-r--r--src/gui/statuswindow.cpp4
-rw-r--r--src/gui/viewport.cpp5
-rw-r--r--src/gui/widgets/itemcontainer.cpp6
-rw-r--r--src/item.cpp4
-rw-r--r--src/item.h4
-rw-r--r--src/itemshortcut.cpp6
-rw-r--r--src/localplayer.cpp6
-rw-r--r--src/net/manaserv/chathandler.cpp7
-rw-r--r--src/net/manaserv/generalhandler.cpp6
-rw-r--r--src/net/manaserv/inventoryhandler.cpp12
-rw-r--r--src/net/manaserv/npchandler.cpp30
-rw-r--r--src/net/manaserv/playerhandler.cpp2
-rw-r--r--src/net/tmwa/chathandler.cpp12
-rw-r--r--src/net/tmwa/gamehandler.cpp4
-rw-r--r--src/net/tmwa/generalhandler.cpp4
-rw-r--r--src/net/tmwa/inventoryhandler.cpp12
-rw-r--r--src/net/tmwa/npchandler.cpp24
-rw-r--r--src/net/tmwa/playerhandler.cpp2
-rw-r--r--src/net/tmwa/tradehandler.cpp2
-rw-r--r--src/playerinfo.cpp18
-rw-r--r--src/resources/theme.cpp2
37 files changed, 215 insertions, 213 deletions
diff --git a/src/actorsprite.cpp b/src/actorsprite.cpp
index e43d94e1..ea2b61c9 100644
--- a/src/actorsprite.cpp
+++ b/src/actorsprite.cpp
@@ -60,7 +60,7 @@ ActorSprite::~ActorSprite()
mUsedTargetCursor = NULL;
// Notify listeners of the destruction.
- Mana::Event event(EVENT_DESTROYED);
+ Mana::Event event(Mana::Event::Destroyed);
event.setActor("source", this);
event.trigger(CHANNEL_ACTORSPRITE);
}
@@ -256,7 +256,7 @@ void ActorSprite::updateStunMode(int oldMode, int newMode)
{
if (this == player_node)
{
- Mana::Event event(EVENT_STUN);
+ Mana::Event event(Mana::Event::Stun);
event.setInt("oldMode", oldMode);
event.setInt("newMode", newMode);
event.trigger(CHANNEL_ACTORSPRITE);
@@ -270,7 +270,7 @@ void ActorSprite::updateStatusEffect(int index, bool newStatus)
{
if (this == player_node)
{
- Mana::Event event(EVENT_UPDATESTATUSEFFECT);
+ Mana::Event event(Mana::Event::UpdateStatusEffect);
event.setInt("index", index);
event.setBool("newStatus", newStatus);
event.trigger(CHANNEL_ACTORSPRITE);
diff --git a/src/being.cpp b/src/being.cpp
index 4d682ab8..53bcf7d3 100644
--- a/src/being.cpp
+++ b/src/being.cpp
@@ -1229,7 +1229,8 @@ void Being::talkTo()
void Being::event(Channels channel, const Mana::Event &event)
{
if (channel == CHANNEL_CHAT &&
- (event.getName() == EVENT_BEING || event.getName() == EVENT_PLAYER) &&
+ (event.getType() == Mana::Event::Being
+ || event.getType() == Mana::Event::Player) &&
event.getInt("permissions") & PlayerRelation::SPEECH_FLOAT)
{
try
@@ -1243,7 +1244,7 @@ void Being::event(Channels channel, const Mana::Event &event)
{}
}
else if (channel == CHANNEL_CONFIG &&
- event.getName() == EVENT_CONFIGOPTIONCHANGED)
+ event.getType() == Mana::Event::ConfigOptionChanged)
{
if (getType() == PLAYER && event.getString("option") == "visiblenames")
{
diff --git a/src/client.cpp b/src/client.cpp
index 7dbbdc88..0752b70a 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -474,7 +474,7 @@ Client::Client(const Options &options):
listen(CHANNEL_CONFIG);
//TODO: fix having to fake a option changed event
- Mana::Event fakeevent(EVENT_CONFIGOPTIONCHANGED);
+ Mana::Event fakeevent(Mana::Event::ConfigOptionChanged);
fakeevent.setString("option", "fpslimit");
event(CHANNEL_CONFIG, fakeevent);
@@ -634,7 +634,7 @@ int Client::exec()
if (mState != mOldState)
{
{
- Mana::Event event(EVENT_STATECHANGE);
+ Mana::Event event(Mana::Event::StateChange);
event.setInt("oldState", mOldState);
event.setInt("newState", mState);
event.trigger(CHANNEL_CLIENT);
@@ -797,7 +797,7 @@ int Client::exec()
paths.init("paths.xml", true);
paths.setDefaultValues(getPathsDefaults());
- Mana::Event::trigger(CHANNEL_CLIENT, EVENT_DBSLOADING);
+ Mana::Event::trigger(CHANNEL_CLIENT, Mana::Event::LoadingDatabases);
// Load XML databases
ColorDB::load();
@@ -1075,7 +1075,7 @@ int Client::exec()
void Client::event(Channels channel, const Mana::Event &event)
{
if (channel == CHANNEL_CONFIG &&
- event.getName() == EVENT_CONFIGOPTIONCHANGED &&
+ event.getType() == Mana::Event::ConfigOptionChanged &&
event.getString("option") == "fpslimit")
{
const int fpsLimit = config.getIntValue("fpslimit");
diff --git a/src/configuration.cpp b/src/configuration.cpp
index 44fb6e2e..33c0cb5a 100644
--- a/src/configuration.cpp
+++ b/src/configuration.cpp
@@ -38,7 +38,7 @@ void Configuration::setValue(const std::string &key, const std::string &value)
ConfigurationObject::setValue(key, value);
// Notify listeners
- Mana::Event event(EVENT_CONFIGOPTIONCHANGED);
+ Mana::Event event(Mana::Event::ConfigOptionChanged);
event.setString("option", key);
event.trigger(CHANNEL_CONFIG);
}
diff --git a/src/event.h b/src/event.h
index 758d6b34..22b76c6f 100644
--- a/src/event.h
+++ b/src/event.h
@@ -44,61 +44,6 @@ enum Channels
CHANNEL_STORAGE
};
-enum Events
-{
- EVENT_ANNOUNCEMENT,
- EVENT_BEING,
- EVENT_CLOSE,
- EVENT_CLOSEALL,
- EVENT_CLOSESENT,
- EVENT_CONFIGOPTIONCHANGED,
- EVENT_CONSTRUCTED,
- EVENT_DBSLOADING,
- EVENT_DESTROYED,
- EVENT_DESTRUCTED,
- EVENT_DESTRUCTING,
- EVENT_DOCLOSEINVENTORY,
- EVENT_DODROP,
- EVENT_DOEQUIP,
- EVENT_DOMOVE,
- EVENT_DOSPLIT,
- EVENT_DOUNEQUIP,
- EVENT_DOUSE,
- EVENT_END,
- EVENT_ENGINESINITALIZED,
- EVENT_ENGINESINITALIZING,
- EVENT_GUIWINDOWSLOADED,
- EVENT_GUIWINDOWSLOADING,
- EVENT_GUIWINDOWSUNLOADED,
- EVENT_GUIWINDOWSUNLOADING,
- EVENT_INTEGERINPUT,
- EVENT_INTEGERINPUTSENT,
- EVENT_MAPLOADED,
- EVENT_MENU,
- EVENT_MENUSENT,
- EVENT_MESSAGE,
- EVENT_NEXT,
- EVENT_NEXTSENT,
- EVENT_NPCCOUNT,
- EVENT_PLAYER,
- EVENT_POST,
- EVENT_POSTCOUNT,
- EVENT_SENDLETTERSENT,
- EVENT_SERVERNOTICE,
- EVENT_STATECHANGE,
- EVENT_STORAGECOUNT,
- EVENT_STRINGINPUT,
- EVENT_STRINGINPUTSENT,
- EVENT_STUN,
- EVENT_TALKSENT,
- EVENT_TRADING,
- EVENT_UPDATEATTRIBUTE,
- EVENT_UPDATESTAT,
- EVENT_UPDATESTATUSEFFECT,
- EVENT_WHISPER,
- EVENT_WHISPERERROR
-};
-
namespace Mana
{
@@ -117,27 +62,77 @@ typedef std::map<Channels, ListenerSet > ListenMap;
class VariableData;
typedef std::map<std::string, VariableData *> VariableMap;
-#define SERVER_NOTICE(message) { \
-Mana::Event event(EVENT_SERVERNOTICE); \
-event.setString("message", message); \
-event.trigger(CHANNEL_NOTICES, event); }
-
class Event
{
public:
+ enum Type
+ {
+ Announcement,
+ Being,
+ Close,
+ CloseAll,
+ CloseSent,
+ ConfigOptionChanged,
+ Constructed,
+ LoadingDatabases,
+ Destroyed,
+ Destructed,
+ Destructing,
+ DoCloseInventory,
+ DoDrop,
+ DoEquip,
+ DoMove,
+ DoSplit,
+ DoUnequip,
+ DoUse,
+ End,
+ EnginesInitialized,
+ EnginesInitializing,
+ GuiWindowsLoaded,
+ GuiWindowsLoading,
+ GuiWindowsUnloaded,
+ GuiWindowsUnloading,
+ IntegerInput,
+ IntegerInputSent,
+ MapLoaded,
+ Menu,
+ MenuSent,
+ Message,
+ Next,
+ NextSent,
+ NpcCount,
+ Player,
+ Post,
+ PostCount,
+ SendLetterSent,
+ ServerNotice,
+ StateChange,
+ StorageCount,
+ StringInput,
+ StringInputSent,
+ Stun,
+ TalkSent,
+ Trading,
+ UpdateAttribute,
+ UpdateStat,
+ UpdateStatusEffect,
+ Whisper,
+ WhisperError
+ };
+
/**
* Makes an event with the given name.
*/
- Event(Events name)
- { mEventName = name; }
+ Event(Type type)
+ { mType = type; }
~Event();
/**
* Returns the name of the event.
*/
- Events getName() const
- { return mEventName; }
+ Type getType() const
+ { return mType; }
// Integers
@@ -303,8 +298,8 @@ public:
* Sends an empty event with the given name to all classes listening to the
* given channel.
*/
- static inline void trigger(Channels channel, Events name)
- { trigger(channel, Mana::Event(name)); }
+ static inline void trigger(Channels channel, Type type)
+ { trigger(channel, Mana::Event(type)); }
protected:
friend class Listener;
@@ -329,11 +324,15 @@ protected:
private:
static ListenMap mBindings;
- Events mEventName;
-
+ Type mType;
VariableMap mData;
};
} // namespace Mana
-#endif
+#define SERVER_NOTICE(message) { \
+Mana::Event event(Mana::Event::ServerNotice); \
+event.setString("message", message); \
+event.trigger(CHANNEL_NOTICES, event); }
+
+#endif // EVENT_H
diff --git a/src/game.cpp b/src/game.cpp
index 18e72b6d..787eadc9 100644
--- a/src/game.cpp
+++ b/src/game.cpp
@@ -128,7 +128,7 @@ ChatTab *localChatTab = NULL;
*/
static void initEngines()
{
- Mana::Event::trigger(CHANNEL_GAME, EVENT_ENGINESINITALIZING);
+ Mana::Event::trigger(CHANNEL_GAME, Mana::Event::EnginesInitializing);
actorSpriteManager = new ActorSpriteManager;
commandHandler = new CommandHandler;
@@ -138,7 +138,7 @@ static void initEngines()
particleEngine = new Particle(NULL);
particleEngine->setupEngine();
- Mana::Event::trigger(CHANNEL_GAME, EVENT_ENGINESINITALIZED);
+ Mana::Event::trigger(CHANNEL_GAME, Mana::Event::EnginesInitialized);
}
/**
@@ -146,7 +146,7 @@ static void initEngines()
*/
static void createGuiWindows()
{
- Mana::Event::trigger(CHANNEL_GAME, EVENT_GUIWINDOWSLOADING);
+ Mana::Event::trigger(CHANNEL_GAME, Mana::Event::GuiWindowsLoading);
setupWindow->clearWindowsForReset();
@@ -183,7 +183,7 @@ static void createGuiWindows()
NpcDialog::setup();
- Mana::Event::trigger(CHANNEL_GAME, EVENT_GUIWINDOWSLOADED);
+ Mana::Event::trigger(CHANNEL_GAME, Mana::Event::GuiWindowsLoaded);
}
#define del_0(X) { delete X; X = 0; }
@@ -193,7 +193,7 @@ static void createGuiWindows()
*/
static void destroyGuiWindows()
{
- Mana::Event::trigger(CHANNEL_GAME, EVENT_GUIWINDOWSUNLOADING);
+ Mana::Event::trigger(CHANNEL_GAME, Mana::Event::GuiWindowsUnloading);
del_0(localChatTab) // Need to do this first, so it can remove itself
del_0(chatWindow)
@@ -212,9 +212,9 @@ static void destroyGuiWindows()
del_0(specialsWindow)
del_0(socialWindow)
- Mana::Event::trigger(CHANNEL_NPC, EVENT_CLOSEALL); // Cleanup remaining NPC dialogs
+ Mana::Event::trigger(CHANNEL_NPC, Mana::Event::CloseAll); // Cleanup remaining NPC dialogs
- Mana::Event::trigger(CHANNEL_GAME, EVENT_GUIWINDOWSUNLOADED);
+ Mana::Event::trigger(CHANNEL_GAME, Mana::Event::GuiWindowsUnloaded);
}
Game *Game::mInstance = 0;
@@ -266,12 +266,12 @@ Game::Game():
setupWindow->setInGame(true);
- Mana::Event::trigger(CHANNEL_GAME, EVENT_CONSTRUCTED);
+ Mana::Event::trigger(CHANNEL_GAME, Mana::Event::Constructed);
}
Game::~Game()
{
- Mana::Event::trigger(CHANNEL_GAME, EVENT_DESTRUCTING);
+ Mana::Event::trigger(CHANNEL_GAME, Mana::Event::Destructing);
delete mWindowMenu;
@@ -289,7 +289,7 @@ Game::~Game()
mInstance = 0;
- Mana::Event::trigger(CHANNEL_GAME, EVENT_DESTRUCTED);
+ Mana::Event::trigger(CHANNEL_GAME, Mana::Event::Destructed);
}
static bool saveScreenshot()
@@ -990,7 +990,7 @@ void Game::changeMap(const std::string &mapPath)
delete mCurrentMap;
mCurrentMap = newMap;
- Mana::Event event(EVENT_MAPLOADED);
+ Mana::Event event(Mana::Event::MapLoaded);
event.setString("mapPath", mapPath);
event.trigger(CHANNEL_GAME);
}
diff --git a/src/gui/chat.cpp b/src/gui/chat.cpp
index 2ac5100d..fecf892a 100644
--- a/src/gui/chat.cpp
+++ b/src/gui/chat.cpp
@@ -379,29 +379,29 @@ void ChatWindow::event(Channels channel, const Mana::Event &event)
{
if (channel == CHANNEL_NOTICES)
{
- if (event.getName() == EVENT_SERVERNOTICE)
+ if (event.getType() == Mana::Event::ServerNotice)
localChatTab->chatLog(event.getString("message"), BY_SERVER);
}
else if (channel == CHANNEL_CHAT)
{
- if (event.getName() == EVENT_WHISPER)
+ if (event.getType() == Mana::Event::Whisper)
{
whisper(event.getString("nick"), event.getString("message"));
}
- else if (event.getName() == EVENT_WHISPERERROR)
+ else if (event.getType() == Mana::Event::WhisperError)
{
whisper(event.getString("nick"),
event.getString("error"), BY_SERVER);
}
- else if (event.getName() == EVENT_PLAYER)
+ else if (event.getType() == Mana::Event::Player)
{
localChatTab->chatLog(event.getString("message"), BY_PLAYER);
}
- else if (event.getName() == EVENT_ANNOUNCEMENT)
+ else if (event.getType() == Mana::Event::Announcement)
{
localChatTab->chatLog(event.getString("message"), BY_GM);
}
- else if (event.getName() == EVENT_BEING)
+ else if (event.getType() == Mana::Event::Being)
{
if (event.getInt("permissions") & PlayerRelation::SPEECH_LOG)
localChatTab->chatLog(event.getString("message"), BY_OTHER);
diff --git a/src/gui/chat.h b/src/gui/chat.h
index f546502c..211e7da7 100644
--- a/src/gui/chat.h
+++ b/src/gui/chat.h
@@ -158,7 +158,7 @@ class ChatWindow : public Window,
void mousePressed(gcn::MouseEvent &event);
void mouseDragged(gcn::MouseEvent &event);
- void event(Channels channel, const Mana::Event &event);
+ void event(Channels channel, const Mana::Event &event);
/**
* Scrolls the chat window
diff --git a/src/gui/gui.cpp b/src/gui/gui.cpp
index c0d1babf..500a2d74 100644
--- a/src/gui/gui.cpp
+++ b/src/gui/gui.cpp
@@ -61,7 +61,7 @@ class GuiConfigListener : public Mana::Listener
{
if (channel == CHANNEL_CONFIG)
{
- if (event.getName() == EVENT_CONFIGOPTIONCHANGED &&
+ if (event.getType() == Mana::Event::ConfigOptionChanged &&
event.getString("option") == "customcursor")
{
bool bCustomCursor = config.getBoolValue("customcursor");
diff --git a/src/gui/inventorywindow.cpp b/src/gui/inventorywindow.cpp
index 02801ced..39a9cf6e 100644
--- a/src/gui/inventorywindow.cpp
+++ b/src/gui/inventorywindow.cpp
@@ -195,19 +195,19 @@ void InventoryWindow::action(const gcn::ActionEvent &event)
return;
if (event.getId() == "activate")
- item->doEvent(EVENT_DOUSE);
+ item->doEvent(Mana::Event::DoUse);
else if (event.getId() == "equip")
{
if (item->isEquippable())
{
if (item->isEquipped())
- item->doEvent(EVENT_DOUNEQUIP);
+ item->doEvent(Mana::Event::DoUnequip);
else
- item->doEvent(EVENT_DOEQUIP);
+ item->doEvent(Mana::Event::DoEquip);
}
else
{
- item->doEvent(EVENT_DOUSE);
+ item->doEvent(Mana::Event::DoUse);
}
}
else if (event.getId() == "drop")
@@ -265,7 +265,7 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
return;
if (mInventory->isMainInventory())
{
- Mana::Event event(EVENT_DOMOVE);
+ Mana::Event event(Mana::Event::DoMove);
event.setItem("item", item);
event.setInt("amount", item->getQuantity());
event.setInt("source", Inventory::INVENTORY);
@@ -274,7 +274,7 @@ void InventoryWindow::mouseClicked(gcn::MouseEvent &event)
}
else
{
- Mana::Event event(EVENT_DOMOVE);
+ Mana::Event event(Mana::Event::DoMove);
event.setItem("item", item);
event.setInt("amount", item->getQuantity());
event.setInt("source", Inventory::STORAGE);
@@ -383,7 +383,7 @@ void InventoryWindow::close()
}
else
{
- Mana::Event event(EVENT_DOCLOSEINVENTORY);
+ Mana::Event event(Mana::Event::DoCloseInventory);
event.setInt("type", mInventory->getType());
event.trigger(CHANNEL_ITEM);
scheduleDelete();
@@ -392,7 +392,7 @@ void InventoryWindow::close()
void InventoryWindow::event(Channels channel, const Mana::Event &event)
{
- if (event.getName() == EVENT_UPDATEATTRIBUTE)
+ if (event.getType() == Mana::Event::UpdateAttribute)
{
int id = event.getInt("id");
if (id == TOTAL_WEIGHT ||
diff --git a/src/gui/itemamount.cpp b/src/gui/itemamount.cpp
index 85325c66..7d3931bf 100644
--- a/src/gui/itemamount.cpp
+++ b/src/gui/itemamount.cpp
@@ -47,14 +47,14 @@ void ItemAmountWindow::finish(Item *item, int amount, Usage usage)
tradeWindow->tradeItem(item, amount);
break;
case ItemDrop:
- item->doEvent(EVENT_DODROP, amount);
+ item->doEvent(Mana::Event::DoDrop, amount);
break;
case ItemSplit:
- item->doEvent(EVENT_DOSPLIT, amount);
+ item->doEvent(Mana::Event::DoSplit, amount);
break;
case StoreAdd:
{
- Mana::Event event(EVENT_DOMOVE);
+ Mana::Event event(Mana::Event::DoMove);
event.setItem("item", item);
event.setInt("amount", amount);
event.setInt("source", Inventory::INVENTORY);
@@ -64,7 +64,7 @@ void ItemAmountWindow::finish(Item *item, int amount, Usage usage)
break;
case StoreRemove:
{
- Mana::Event event(EVENT_DOMOVE);
+ Mana::Event event(Mana::Event::DoMove);
event.setItem("item", item);
event.setInt("amount", amount);
event.setInt("source", Inventory::STORAGE);
diff --git a/src/gui/ministatus.cpp b/src/gui/ministatus.cpp
index fae40d03..8093a893 100644
--- a/src/gui/ministatus.cpp
+++ b/src/gui/ministatus.cpp
@@ -123,7 +123,7 @@ void MiniStatusWindow::event(Channels channel, const Mana::Event &event)
{
if (channel == CHANNEL_ATTRIBUTES)
{
- if (event.getName() == EVENT_UPDATEATTRIBUTE)
+ if (event.getType() == Mana::Event::UpdateAttribute)
{
int id = event.getInt("id");
if (id == HP || id == MAX_HP)
@@ -142,7 +142,7 @@ void MiniStatusWindow::event(Channels channel, const Mana::Event &event)
}
else if (channel == CHANNEL_ACTORSPRITE)
{
- if (event.getName() == EVENT_UPDATESTATUSEFFECT)
+ if (event.getType() == Mana::Event::UpdateStatusEffect)
{
int index = event.getInt("index");
bool newStatus = event.getBool("newStatus");
diff --git a/src/gui/npcdialog.cpp b/src/gui/npcdialog.cpp
index 590001b0..799054ba 100644
--- a/src/gui/npcdialog.cpp
+++ b/src/gui/npcdialog.cpp
@@ -392,7 +392,7 @@ void NpcDialog::event(Channels channel, const Mana::Event &event)
if (channel != CHANNEL_CONFIG)
return;
- if (event.getName() == EVENT_CONFIGOPTIONCHANGED &&
+ if (event.getType() == Mana::Event::ConfigOptionChanged &&
event.getString("option") == "logNpcInGui")
{
mLogInteraction = config.getBoolValue("logNpcInGui");
@@ -512,13 +512,13 @@ void NpcEventListener::event(Channels channel,
if (channel != CHANNEL_NPC)
return;
- if (event.getName() == EVENT_MESSAGE)
+ if (event.getType() == Mana::Event::Message)
{
NpcDialog *dialog = getDialog(event.getInt("id"));
dialog->addText(event.getString("text"));
}
- else if (event.getName() == EVENT_MENU)
+ else if (event.getType() == Mana::Event::Menu)
{
NpcDialog *dialog = getDialog(event.getInt("id"));
@@ -528,7 +528,7 @@ void NpcEventListener::event(Channels channel,
for (int i = 1; i <= count; i++)
dialog->addChoice(event.getString("choice" + toString(i)));
}
- else if (event.getName() == EVENT_INTEGERINPUT)
+ else if (event.getType() == Mana::Event::IntegerInput)
{
NpcDialog *dialog = getDialog(event.getInt("id"));
@@ -538,7 +538,7 @@ void NpcEventListener::event(Channels channel,
dialog->integerRequest(defaultValue, min, max);
}
- else if (event.getName() == EVENT_STRINGINPUT)
+ else if (event.getType() == Mana::Event::StringInput)
{
NpcDialog *dialog = getDialog(event.getInt("id"));
@@ -551,7 +551,7 @@ void NpcEventListener::event(Channels channel,
dialog->textRequest("");
}
}
- else if (event.getName() == EVENT_NEXT)
+ else if (event.getType() == Mana::Event::Next)
{
int id = event.getInt("id");
NpcDialog *dialog = getDialog(id, false);
@@ -565,7 +565,7 @@ void NpcEventListener::event(Channels channel,
dialog->showNextButton();
}
- else if (event.getName() == EVENT_CLOSE)
+ else if (event.getType() == Mana::Event::Close)
{
int id = event.getInt("id");
NpcDialog *dialog = getDialog(id, false);
@@ -579,11 +579,11 @@ void NpcEventListener::event(Channels channel,
dialog->showCloseButton();
}
- else if (event.getName() == EVENT_CLOSEALL)
+ else if (event.getType() == Mana::Event::CloseAll)
{
NpcDialog::closeAll();
}
- else if (event.getName() == EVENT_END)
+ else if (event.getType() == Mana::Event::End)
{
int id = event.getInt("id");
NpcDialog *dialog = getDialog(id, false);
@@ -591,7 +591,7 @@ void NpcEventListener::event(Channels channel,
if (dialog)
dialog->close();
}
- else if (event.getName() == EVENT_POST)
+ else if (event.getType() == Mana::Event::Post)
{
new NpcPostDialog(event.getInt("id"));
}
diff --git a/src/gui/outfitwindow.cpp b/src/gui/outfitwindow.cpp
index 8da8914a..e54fed04 100644
--- a/src/gui/outfitwindow.cpp
+++ b/src/gui/outfitwindow.cpp
@@ -172,7 +172,7 @@ void OutfitWindow::wearOutfit(int outfit)
if (item && !item->isEquipped() && item->getQuantity())
{
if (item->isEquippable())
- item->doEvent(EVENT_DOEQUIP);
+ item->doEvent(Mana::Event::DoEquip);
}
}
}
@@ -341,7 +341,7 @@ void OutfitWindow::unequipNotInOutfit(int outfit)
Item *item = inventory->getItem(i);
if (item)
- item->doEvent(EVENT_DOUNEQUIP);
+ item->doEvent(Mana::Event::DoUnequip);
}
}
}
diff --git a/src/gui/popupmenu.cpp b/src/gui/popupmenu.cpp
index f5259c35..6c8662a0 100644
--- a/src/gui/popupmenu.cpp
+++ b/src/gui/popupmenu.cpp
@@ -269,13 +269,13 @@ void PopupMenu::handleLink(const std::string &link)
if (mItem->isEquippable())
{
if (mItem->isEquipped())
- mItem->doEvent(EVENT_DOUNEQUIP);
+ mItem->doEvent(Mana::Event::DoUnequip);
else
- mItem->doEvent(EVENT_DOEQUIP);
+ mItem->doEvent(Mana::Event::DoEquip);
}
else
{
- mItem->doEvent(EVENT_DOUSE);
+ mItem->doEvent(Mana::Event::DoUse);
}
}
else if (link == "chat")
diff --git a/src/gui/skilldialog.cpp b/src/gui/skilldialog.cpp
index 5b3314d1..dfded635 100644
--- a/src/gui/skilldialog.cpp
+++ b/src/gui/skilldialog.cpp
@@ -282,7 +282,7 @@ void SkillDialog::update()
void SkillDialog::event(Channels channel, const Mana::Event &event)
{
- if (event.getName() == EVENT_UPDATEATTRIBUTE)
+ if (event.getType() == Mana::Event::UpdateAttribute)
{
if (event.getInt("id") == SKILL_POINTS)
{
diff --git a/src/gui/statuswindow.cpp b/src/gui/statuswindow.cpp
index a3420f06..a37c30ba 100644
--- a/src/gui/statuswindow.cpp
+++ b/src/gui/statuswindow.cpp
@@ -219,7 +219,7 @@ StatusWindow::StatusWindow():
void StatusWindow::event(Channels channel, const Mana::Event &event)
{
- if (event.getName() == EVENT_UPDATEATTRIBUTE)
+ if (event.getType() == Mana::Event::UpdateAttribute)
{
switch(event.getInt("id"))
{
@@ -265,7 +265,7 @@ void StatusWindow::event(Channels channel, const Mana::Event &event)
break;
}
}
- else if (event.getName() == EVENT_UPDATESTAT)
+ else if (event.getType() == Mana::Event::UpdateStat)
{
int id = event.getInt("id");
diff --git a/src/gui/viewport.cpp b/src/gui/viewport.cpp
index 9d03cab5..d9693863 100644
--- a/src/gui/viewport.cpp
+++ b/src/gui/viewport.cpp
@@ -586,7 +586,8 @@ void Viewport::hideBeingPopup()
void Viewport::event(Channels channel, const Mana::Event &event)
{
- if (channel == CHANNEL_ACTORSPRITE && event.getName() == EVENT_DESTROYED)
+ if (channel == CHANNEL_ACTORSPRITE
+ && event.getType() == Mana::Event::Destroyed)
{
ActorSprite *actor = event.getActor("source");
@@ -597,7 +598,7 @@ void Viewport::event(Channels channel, const Mana::Event &event)
mHoverItem = 0;
}
else if (channel == CHANNEL_CONFIG &&
- event.getName() == EVENT_CONFIGOPTIONCHANGED)
+ event.getType() == Mana::Event::ConfigOptionChanged)
{
const std::string option = event.getString("option");
if (option == "ScrollLaziness" || option == "ScrollRadius")
diff --git a/src/gui/widgets/itemcontainer.cpp b/src/gui/widgets/itemcontainer.cpp
index 15fcbfe2..5b6788fa 100644
--- a/src/gui/widgets/itemcontainer.cpp
+++ b/src/gui/widgets/itemcontainer.cpp
@@ -346,7 +346,7 @@ void ItemContainer::mouseReleased(gcn::MouseEvent &event)
Item *item = getSelectedItem();
{
- Mana::Event event(EVENT_DOMOVE);
+ Mana::Event event(Mana::Event::DoMove);
event.setItem("item", item);
event.setInt("newIndex", index);
event.trigger(CHANNEL_ITEM);
@@ -418,7 +418,7 @@ void ItemContainer::keyAction()
mHighlightedIndex != -1)
{
Item *item = getSelectedItem();
- Mana::Event event(EVENT_DOMOVE);
+ Mana::Event event(Mana::Event::DoMove);
event.setItem("item", item);
event.setInt("newIndex", mHighlightedIndex);
event.trigger(CHANNEL_ITEM);
@@ -434,7 +434,7 @@ void ItemContainer::keyAction()
else if (mSelectedIndex != -1)
{
Item *item = getSelectedItem();
- Mana::Event event(EVENT_DOMOVE);
+ Mana::Event event(Mana::Event::DoMove);
event.setItem("item", item);
event.setInt("newIndex", mHighlightedIndex);
event.trigger(CHANNEL_ITEM);
diff --git a/src/item.cpp b/src/item.cpp
index fee7e86f..2043038b 100644
--- a/src/item.cpp
+++ b/src/item.cpp
@@ -72,14 +72,14 @@ void Item::setId(int id)
"unknown-item.png"));
}
-void Item::doEvent(Events eventName)
+void Item::doEvent(Mana::Event::Type eventName)
{
Mana::Event event(eventName);
event.setItem("item", this);
event.trigger(CHANNEL_ITEM);
}
-void Item::doEvent(Events eventName, int amount)
+void Item::doEvent(Mana::Event::Type eventName, int amount)
{
Mana::Event event(eventName);
event.setItem("item", this);
diff --git a/src/item.h b/src/item.h
index 24ee2fc5..294ac477 100644
--- a/src/item.h
+++ b/src/item.h
@@ -114,9 +114,9 @@ class Item
*/
int getInvIndex() const { return mInvIndex; }
- void doEvent(Events eventName);
+ void doEvent(Mana::Event::Type eventType);
- void doEvent(Events eventName, int amount);
+ void doEvent(Mana::Event::Type eventType, int amount);
/**
* Returns information about this item type.
diff --git a/src/itemshortcut.cpp b/src/itemshortcut.cpp
index 0e5abef8..51bd6b21 100644
--- a/src/itemshortcut.cpp
+++ b/src/itemshortcut.cpp
@@ -74,13 +74,13 @@ void ItemShortcut::useItem(int index)
if (item->getInfo().getEquippable())
{
if (item->isEquipped())
- item->doEvent(EVENT_DOUNEQUIP);
+ item->doEvent(Mana::Event::DoUnequip);
else
- item->doEvent(EVENT_DOEQUIP);
+ item->doEvent(Mana::Event::DoEquip);
}
else
{
- item->doEvent(EVENT_DOUSE);
+ item->doEvent(Mana::Event::DoUse);
}
}
}
diff --git a/src/localplayer.cpp b/src/localplayer.cpp
index 3e59e794..1e1d5de0 100644
--- a/src/localplayer.cpp
+++ b/src/localplayer.cpp
@@ -1109,7 +1109,7 @@ void LocalPlayer::event(Channels channel, const Mana::Event &event)
{
if (channel == CHANNEL_ACTORSPRITE)
{
- if (event.getName() == EVENT_DESTROYED)
+ if (event.getType() == Mana::Event::Destroyed)
{
ActorSprite *actor = event.getActor("source");
@@ -1122,7 +1122,7 @@ void LocalPlayer::event(Channels channel, const Mana::Event &event)
}
else if (channel == CHANNEL_ATTRIBUTES)
{
- if (event.getName() == EVENT_UPDATEATTRIBUTE)
+ if (event.getType() == Mana::Event::UpdateAttribute)
{
if (event.getInt("id") == EXP)
{
@@ -1135,7 +1135,7 @@ void LocalPlayer::event(Channels channel, const Mana::Event &event)
}
else if (channel == CHANNEL_CONFIG)
{
- if (event.getName() == EVENT_CONFIGOPTIONCHANGED &&
+ if (event.getType() == Mana::Event::ConfigOptionChanged &&
event.getString("option") == "showownname")
{
setShowName(config.getValue("showownname", 1));
diff --git a/src/net/manaserv/chathandler.cpp b/src/net/manaserv/chathandler.cpp
index 705795f4..07836c88 100644
--- a/src/net/manaserv/chathandler.cpp
+++ b/src/net/manaserv/chathandler.cpp
@@ -165,7 +165,8 @@ void ChatHandler::handleGameChatMessage(Net::MessageIn &msg)
std::string mes = being->getName() + " : " + chatMsg;
- Mana::Event event(being == player_node ? EVENT_PLAYER : EVENT_BEING);
+ Mana::Event event(being == player_node ? Mana::Event::Player
+ : Mana::Event::Being);
event.setString("message", mes);
event.setString("text", chatMsg);
event.setString("nick", being->getName());
@@ -233,7 +234,7 @@ void ChatHandler::handlePrivateMessage(Net::MessageIn &msg)
std::string userNick = msg.readString();
std::string chatMsg = msg.readString();
- Mana::Event event(EVENT_WHISPER);
+ Mana::Event event(Mana::Event::Whisper);
event.setString("nick", userNick);
event.setString("message", chatMsg);
event.trigger(CHANNEL_CHAT);
@@ -242,7 +243,7 @@ void ChatHandler::handlePrivateMessage(Net::MessageIn &msg)
void ChatHandler::handleAnnouncement(Net::MessageIn &msg)
{
std::string chatMsg = msg.readString();
- Mana::Event event(EVENT_ANNOUNCEMENT);
+ Mana::Event event(Mana::Event::Announcement);
event.setString("message", chatMsg);
event.trigger(CHANNEL_CHAT);
}
diff --git a/src/net/manaserv/generalhandler.cpp b/src/net/manaserv/generalhandler.cpp
index d2151307..f40b2bc2 100644
--- a/src/net/manaserv/generalhandler.cpp
+++ b/src/net/manaserv/generalhandler.cpp
@@ -176,7 +176,7 @@ void GeneralHandler::event(Channels channel,
{
if (channel == CHANNEL_CLIENT)
{
- if (event.getName() == EVENT_STATECHANGE)
+ if (event.getType() == Mana::Event::StateChange)
{
int newState = event.getInt("newState");
@@ -186,7 +186,7 @@ void GeneralHandler::event(Channels channel,
game->gameLoading();
}
}
- else if (event.getName() == EVENT_DBSLOADING)
+ else if (event.getType() == Mana::Event::LoadingDatabases)
{
Attributes::load();
Attributes::informItemDB();
@@ -194,7 +194,7 @@ void GeneralHandler::event(Channels channel,
}
else if (channel == CHANNEL_GAME)
{
- if (event.getName() == EVENT_GUIWINDOWSLOADED)
+ if (event.getType() == Mana::Event::GuiWindowsLoaded)
{
inventoryWindow->setSplitAllowed(true);
skillDialog->loadSkills("mana-skills.xml");
diff --git a/src/net/manaserv/inventoryhandler.cpp b/src/net/manaserv/inventoryhandler.cpp
index 5edf3597..56280f40 100644
--- a/src/net/manaserv/inventoryhandler.cpp
+++ b/src/net/manaserv/inventoryhandler.cpp
@@ -120,13 +120,13 @@ void InventoryHandler::event(Channels channel,
int index = item->getInvIndex();
- if (event.getName() == EVENT_DOEQUIP)
+ if (event.getType() == Mana::Event::DoEquip)
{
MessageOut msg(PGMSG_EQUIP);
msg.writeInt8(index);
gameServerConnection->send(msg);
}
- else if (event.getName() == EVENT_DOUNEQUIP)
+ else if (event.getType() == Mana::Event::DoUnequip)
{
MessageOut msg(PGMSG_UNEQUIP);
msg.writeInt8(index);
@@ -136,13 +136,13 @@ void InventoryHandler::event(Channels channel,
// for instance.
mEquips.setEquipment(index, 0, 0);
}
- else if (event.getName() == EVENT_DOUSE)
+ else if (event.getType() == Mana::Event::DoUse)
{
MessageOut msg(PGMSG_USE_ITEM);
msg.writeInt8(index);
gameServerConnection->send(msg);
}
- else if (event.getName() == EVENT_DODROP)
+ else if (event.getType() == Mana::Event::DoDrop)
{
int amount = event.getInt("amount", 1);
@@ -151,7 +151,7 @@ void InventoryHandler::event(Channels channel,
msg.writeInt8(amount);
gameServerConnection->send(msg);
}
- else if (event.getName() == EVENT_DOSPLIT)
+ else if (event.getType() == Mana::Event::DoSplit)
{
int amount = event.getInt("amount", 1);
@@ -165,7 +165,7 @@ void InventoryHandler::event(Channels channel,
gameServerConnection->send(msg);
}
}
- else if (event.getName() == EVENT_DOMOVE)
+ else if (event.getType() == Mana::Event::DoMove)
{
int newIndex = event.getInt("newIndex", -1);
diff --git a/src/net/manaserv/npchandler.cpp b/src/net/manaserv/npchandler.cpp
index ca7d7415..91e57c72 100644
--- a/src/net/manaserv/npchandler.cpp
+++ b/src/net/manaserv/npchandler.cpp
@@ -67,7 +67,7 @@ void NpcHandler::handleMessage(Net::MessageIn &msg)
switch (msg.getId())
{
case GPMSG_NPC_CHOICE:
- event = new Mana::Event(EVENT_MENU);
+ event = new Mana::Event(Mana::Event::Menu);
event->setInt("id", npcId);
while (msg.getUnreadLength())
{
@@ -79,7 +79,7 @@ void NpcHandler::handleMessage(Net::MessageIn &msg)
break;
case GPMSG_NPC_NUMBER:
- event = new Mana::Event(EVENT_INTEGERINPUT);
+ event = new Mana::Event(Mana::Event::IntegerInput);
event->setInt("id", npcId);
event->setInt("min", msg.readInt32());
event->setInt("max", msg.readInt32());
@@ -88,37 +88,37 @@ void NpcHandler::handleMessage(Net::MessageIn &msg)
break;
case GPMSG_NPC_STRING:
- event = new Mana::Event(EVENT_STRINGINPUT);
+ event = new Mana::Event(Mana::Event::StringInput);
event->setInt("id", npcId);
event->trigger(CHANNEL_NPC);
break;
case GPMSG_NPC_POST:
- event = new Mana::Event(EVENT_POST);
+ event = new Mana::Event(Mana::Event::Post);
event->setInt("id", npcId);
event->trigger(CHANNEL_NPC);
break;
case GPMSG_NPC_ERROR:
- event = new Mana::Event(EVENT_END);
+ event = new Mana::Event(Mana::Event::End);
event->setInt("id", npcId);
event->trigger(CHANNEL_NPC);
break;
case GPMSG_NPC_MESSAGE:
- event = new Mana::Event(EVENT_MESSAGE);
+ event = new Mana::Event(Mana::Event::Message);
event->setInt("id", npcId);
event->setString("text", msg.readString(msg.getUnreadLength()));
event->trigger(CHANNEL_NPC);
delete event;
- event = new Mana::Event(EVENT_NEXT);
+ event = new Mana::Event(Mana::Event::Next);
event->setInt("id", npcId);
event->trigger(CHANNEL_NPC);
break;
case GPMSG_NPC_CLOSE:
- event = new Mana::Event(EVENT_CLOSE);
+ event = new Mana::Event(Mana::Event::Close);
event->setInt("id", npcId);
event->trigger(CHANNEL_NPC);
break;
@@ -169,7 +169,7 @@ void NpcHandler::talk(int npcId)
msg.writeInt16(npcId);
gameServerConnection->send(msg);
- Mana::Event event(EVENT_TALKSENT);
+ Mana::Event event(Mana::Event::TalkSent);
event.setInt("npcId", npcId);
event.trigger(CHANNEL_NPC);
}
@@ -180,7 +180,7 @@ void NpcHandler::nextDialog(int npcId)
msg.writeInt16(npcId);
gameServerConnection->send(msg);
- Mana::Event event(EVENT_NEXTSENT);
+ Mana::Event event(Mana::Event::NextSent);
event.setInt("npcId", npcId);
event.trigger(CHANNEL_NPC);
}
@@ -191,7 +191,7 @@ void NpcHandler::closeDialog(int npcId)
msg.writeInt16(npcId);
gameServerConnection->send(msg);
- Mana::Event event(EVENT_CLOSESENT);
+ Mana::Event event(Mana::Event::CloseSent);
event.setInt("npcId", npcId);
event.trigger(CHANNEL_NPC);
}
@@ -203,7 +203,7 @@ void NpcHandler::menuSelect(int npcId, int choice)
msg.writeInt8(choice);
gameServerConnection->send(msg);
- Mana::Event event(EVENT_MENUSENT);
+ Mana::Event event(Mana::Event::MenuSent);
event.setInt("npcId", npcId);
event.setInt("choice", choice);
event.trigger(CHANNEL_NPC);
@@ -216,7 +216,7 @@ void NpcHandler::integerInput(int npcId, int value)
msg.writeInt32(value);
gameServerConnection->send(msg);
- Mana::Event event(EVENT_INTEGERINPUTSENT);
+ Mana::Event event(Mana::Event::IntegerInputSent);
event.setInt("npcId", npcId);
event.setInt("value", value);
event.trigger(CHANNEL_NPC);
@@ -229,7 +229,7 @@ void NpcHandler::stringInput(int npcId, const std::string &value)
msg.writeString(value);
gameServerConnection->send(msg);
- Mana::Event event(EVENT_STRINGINPUTSENT);
+ Mana::Event event(Mana::Event::StringInputSent);
event.setInt("npcId", npcId);
event.setString("value", value);
event.trigger(CHANNEL_NPC);
@@ -243,7 +243,7 @@ void NpcHandler::sendLetter(int npcId, const std::string &recipient,
msg.writeString(text);
gameServerConnection->send(msg);
- Mana::Event event(EVENT_SENDLETTERSENT);
+ Mana::Event event(Mana::Event::SendLetterSent);
event.setInt("npcId", npcId);
event.setString("recipient", recipient);
event.setString("text", text);
diff --git a/src/net/manaserv/playerhandler.cpp b/src/net/manaserv/playerhandler.cpp
index c071ca04..d3c8822b 100644
--- a/src/net/manaserv/playerhandler.cpp
+++ b/src/net/manaserv/playerhandler.cpp
@@ -65,7 +65,7 @@ void RespawnRequestListener::action(const gcn::ActionEvent &event)
{
Net::getPlayerHandler()->respawn();
- Mana::Event::trigger(CHANNEL_NPC, EVENT_CLOSEALL);
+ Mana::Event::trigger(CHANNEL_NPC, Mana::Event::CloseAll);
}
PlayerHandler::PlayerHandler()
diff --git a/src/net/tmwa/chathandler.cpp b/src/net/tmwa/chathandler.cpp
index 33826762..5dc1206f 100644
--- a/src/net/tmwa/chathandler.cpp
+++ b/src/net/tmwa/chathandler.cpp
@@ -82,7 +82,7 @@ void ChatHandler::handleMessage(Net::MessageIn &msg)
break;
case 0x01:
{
- Mana::Event event(EVENT_WHISPERERROR);
+ Mana::Event event(Mana::Event::WhisperError);
event.setString("nick", nick);
event.setString("error", strprintf(_("Whisper could "
"not be sent, %s is offline."), nick.c_str()));
@@ -91,7 +91,7 @@ void ChatHandler::handleMessage(Net::MessageIn &msg)
break;
case 0x02:
{
- Mana::Event event(EVENT_WHISPERERROR);
+ Mana::Event event(Mana::Event::WhisperError);
event.setString("nick", nick);
event.setString("error", strprintf(_("Whisper could "
"not be sent, ignored by %s."), nick.c_str()));
@@ -115,7 +115,7 @@ void ChatHandler::handleMessage(Net::MessageIn &msg)
{
if (player_relations.hasPermission(nick, PlayerRelation::WHISPER))
{
- Mana::Event event(EVENT_WHISPER);
+ Mana::Event event(Mana::Event::Whisper);
event.setString("nick", nick);
event.setString("message", chatMsg);
event.trigger(CHANNEL_CHAT);
@@ -174,7 +174,7 @@ void ChatHandler::handleMessage(Net::MessageIn &msg)
std::string reducedMessage = chatMsg;
chatMsg = removeColors(sender_name) + " : " + reducedMessage;
- Mana::Event event(EVENT_BEING);
+ Mana::Event event(Mana::Event::Being);
event.setString("message", chatMsg);
event.setString("text", reducedMessage);
event.setString("nick", sender_name);
@@ -205,7 +205,7 @@ void ChatHandler::handleMessage(Net::MessageIn &msg)
trim(chatMsg);
- Mana::Event event(EVENT_PLAYER);
+ Mana::Event event(Mana::Event::Player);
event.setString("message", mes);
event.setString("text", chatMsg);
event.setString("nick", player_node->getName());
@@ -217,7 +217,7 @@ void ChatHandler::handleMessage(Net::MessageIn &msg)
}
else
{
- Mana::Event event(EVENT_ANNOUNCEMENT);
+ Mana::Event event(Mana::Event::Announcement);
event.setString("message", chatMsg);
event.trigger(CHANNEL_CHAT);
}
diff --git a/src/net/tmwa/gamehandler.cpp b/src/net/tmwa/gamehandler.cpp
index 63f5fcec..3063c044 100644
--- a/src/net/tmwa/gamehandler.cpp
+++ b/src/net/tmwa/gamehandler.cpp
@@ -109,11 +109,11 @@ void GameHandler::event(Channels channel, const Mana::Event &event)
{
if (channel == CHANNEL_GAME)
{
- if (event.getName() == EVENT_ENGINESINITALIZED)
+ if (event.getType() == Mana::Event::EnginesInitialized)
{
Game::instance()->changeMap(mMap);
}
- else if (event.getName() == EVENT_MAPLOADED)
+ else if (event.getType() == Mana::Event::MapLoaded)
{
MessageOut outMsg(CMSG_MAP_LOADED);
}
diff --git a/src/net/tmwa/generalhandler.cpp b/src/net/tmwa/generalhandler.cpp
index 1935ad72..7000c96c 100644
--- a/src/net/tmwa/generalhandler.cpp
+++ b/src/net/tmwa/generalhandler.cpp
@@ -222,7 +222,7 @@ void GeneralHandler::event(Channels channel,
{
if (channel == CHANNEL_GAME)
{
- if (event.getName() == EVENT_GUIWINDOWSLOADED)
+ if (event.getType() == Mana::Event::GuiWindowsLoaded)
{
inventoryWindow->setSplitAllowed(false);
skillDialog->loadSkills("ea-skills.xml");
@@ -242,7 +242,7 @@ void GeneralHandler::event(Channels channel,
statusWindow->addAttribute(FLEE, _("% Evade"), false, "");
statusWindow->addAttribute(CRIT, _("% Critical"), false, "");
}
- else if (event.getName() == EVENT_GUIWINDOWSUNLOADING)
+ else if (event.getType() == Mana::Event::GuiWindowsUnloading)
{
socialWindow->removeTab(taGuild);
socialWindow->removeTab(taParty);
diff --git a/src/net/tmwa/inventoryhandler.cpp b/src/net/tmwa/inventoryhandler.cpp
index 1d99eca4..5ab6af08 100644
--- a/src/net/tmwa/inventoryhandler.cpp
+++ b/src/net/tmwa/inventoryhandler.cpp
@@ -436,7 +436,7 @@ void InventoryHandler::event(Channels channel,
{
if (channel == CHANNEL_ITEM)
{
- if (event.getName() == EVENT_DOCLOSEINVENTORY)
+ if (event.getType() == Mana::Event::DoCloseInventory)
{
// No need to worry about type
MessageOut outMsg(CMSG_CLOSE_STORAGE);
@@ -450,24 +450,24 @@ void InventoryHandler::event(Channels channel,
int index = item->getInvIndex() + INVENTORY_OFFSET;
- if (event.getName() == EVENT_DOEQUIP)
+ if (event.getType() == Mana::Event::DoEquip)
{
MessageOut outMsg(CMSG_PLAYER_EQUIP);
outMsg.writeInt16(index);
outMsg.writeInt16(0);
}
- else if (event.getName() == EVENT_DOUNEQUIP)
+ else if (event.getType() == Mana::Event::DoUnequip)
{
MessageOut outMsg(CMSG_PLAYER_UNEQUIP);
outMsg.writeInt16(index);
}
- else if (event.getName() == EVENT_DOUSE)
+ else if (event.getType() == Mana::Event::DoUse)
{
MessageOut outMsg(CMSG_PLAYER_INVENTORY_USE);
outMsg.writeInt16(index);
outMsg.writeInt32(item->getId()); // unused
}
- else if (event.getName() == EVENT_DODROP)
+ else if (event.getType() == Mana::Event::DoDrop)
{
int amount = event.getInt("amount", 1);
@@ -477,7 +477,7 @@ void InventoryHandler::event(Channels channel,
outMsg.writeInt16(index);
outMsg.writeInt16(amount);
}
- else if (event.getName() == EVENT_DOMOVE)
+ else if (event.getType() == Mana::Event::DoMove)
{
int newIndex = event.getInt("newIndex", -1);
diff --git a/src/net/tmwa/npchandler.cpp b/src/net/tmwa/npchandler.cpp
index 337226a9..85b3b284 100644
--- a/src/net/tmwa/npchandler.cpp
+++ b/src/net/tmwa/npchandler.cpp
@@ -83,14 +83,14 @@ void NpcHandler::handleMessage(Net::MessageIn &msg)
switch (msg.getId())
{
case SMSG_NPC_CHOICE:
- event = new Mana::Event(EVENT_MENU);
+ event = new Mana::Event(Mana::Event::Menu);
event->setInt("id", npcId);
parseMenu(event, msg.readString(msg.getLength() - 8));
event->trigger(CHANNEL_NPC);
break;
case SMSG_NPC_MESSAGE:
- event = new Mana::Event(EVENT_MESSAGE);
+ event = new Mana::Event(Mana::Event::Message);
event->setInt("id", npcId);
event->setString("text", msg.readString(msg.getLength() - 8));
event->trigger(CHANNEL_NPC);
@@ -98,28 +98,28 @@ void NpcHandler::handleMessage(Net::MessageIn &msg)
case SMSG_NPC_CLOSE:
// Show the close button
- event = new Mana::Event(EVENT_CLOSE);
+ event = new Mana::Event(Mana::Event::Close);
event->setInt("id", npcId);
event->trigger(CHANNEL_NPC);
break;
case SMSG_NPC_NEXT:
// Show the next button
- event = new Mana::Event(EVENT_NEXT);
+ event = new Mana::Event(Mana::Event::Next);
event->setInt("id", npcId);
event->trigger(CHANNEL_NPC);
break;
case SMSG_NPC_INT_INPUT:
// Request for an integer
- event = new Mana::Event(EVENT_INTEGERINPUT);
+ event = new Mana::Event(Mana::Event::IntegerInput);
event->setInt("id", npcId);
event->trigger(CHANNEL_NPC);
break;
case SMSG_NPC_STR_INPUT:
// Request for a string
- event = new Mana::Event(EVENT_STRINGINPUT);
+ event = new Mana::Event(Mana::Event::StringInput);
event->setInt("id", npcId);
event->trigger(CHANNEL_NPC);
break;
@@ -177,7 +177,7 @@ void NpcHandler::talk(int npcId)
outMsg.writeInt32(npcId);
outMsg.writeInt8(0); // Unused
- Mana::Event event(EVENT_TALKSENT);
+ Mana::Event event(Mana::Event::TalkSent);
event.setInt("npcId", npcId);
event.trigger(CHANNEL_NPC);
}
@@ -187,7 +187,7 @@ void NpcHandler::nextDialog(int npcId)
MessageOut outMsg(CMSG_NPC_NEXT_REQUEST);
outMsg.writeInt32(npcId);
- Mana::Event event(EVENT_NEXTSENT);
+ Mana::Event event(Mana::Event::NextSent);
event.setInt("npcId", npcId);
event.trigger(CHANNEL_NPC);
}
@@ -197,7 +197,7 @@ void NpcHandler::closeDialog(int npcId)
MessageOut outMsg(CMSG_NPC_CLOSE);
outMsg.writeInt32(npcId);
- Mana::Event event(EVENT_CLOSESENT);
+ Mana::Event event(Mana::Event::CloseSent);
event.setInt("npcId", npcId);
event.trigger(CHANNEL_NPC);
}
@@ -208,7 +208,7 @@ void NpcHandler::menuSelect(int npcId, int choice)
outMsg.writeInt32(npcId);
outMsg.writeInt8(choice);
- Mana::Event event(EVENT_MENUSENT);
+ Mana::Event event(Mana::Event::MenuSent);
event.setInt("npcId", npcId);
event.setInt("choice", choice);
event.trigger(CHANNEL_NPC);
@@ -220,7 +220,7 @@ void NpcHandler::integerInput(int npcId, int value)
outMsg.writeInt32(npcId);
outMsg.writeInt32(value);
- Mana::Event event(EVENT_INTEGERINPUTSENT);
+ Mana::Event event(Mana::Event::IntegerInputSent);
event.setInt("npcId", npcId);
event.setInt("value", value);
event.trigger(CHANNEL_NPC);
@@ -234,7 +234,7 @@ void NpcHandler::stringInput(int npcId, const std::string &value)
outMsg.writeString(value, value.length());
outMsg.writeInt8(0); // Prevent problems with string reading
- Mana::Event event(EVENT_STRINGINPUTSENT);
+ Mana::Event event(Mana::Event::StringInputSent);
event.setInt("npcId", npcId);
event.setString("value", value);
event.trigger(CHANNEL_NPC);
diff --git a/src/net/tmwa/playerhandler.cpp b/src/net/tmwa/playerhandler.cpp
index 725a00cc..64dda9d4 100644
--- a/src/net/tmwa/playerhandler.cpp
+++ b/src/net/tmwa/playerhandler.cpp
@@ -81,7 +81,7 @@ namespace {
viewport->closePopupMenu();
- Mana::Event::trigger(CHANNEL_NPC, EVENT_CLOSEALL);
+ Mana::Event::trigger(CHANNEL_NPC, Mana::Event::CloseAll);
}
} deathListener;
diff --git a/src/net/tmwa/tradehandler.cpp b/src/net/tmwa/tradehandler.cpp
index 034b959d..80249784 100644
--- a/src/net/tmwa/tradehandler.cpp
+++ b/src/net/tmwa/tradehandler.cpp
@@ -191,7 +191,7 @@ void TradeHandler::handleMessage(Net::MessageIn &msg)
// Successfully added item
if (item->isEquippable() && item->isEquipped())
{
- item->doEvent(EVENT_DOUNEQUIP);
+ item->doEvent(Mana::Event::DoUnequip);
}
tradeWindow->addItem(item->getId(), true, quantity);
diff --git a/src/playerinfo.cpp b/src/playerinfo.cpp
index 1915822f..9a1db45c 100644
--- a/src/playerinfo.cpp
+++ b/src/playerinfo.cpp
@@ -57,7 +57,7 @@ int mLevelProgress = 0;
void triggerAttr(int id, int old)
{
- Mana::Event event(EVENT_UPDATEATTRIBUTE);
+ Mana::Event event(Mana::Event::UpdateAttribute);
event.setInt("id", id);
event.setInt("oldValue", old);
event.setInt("newValue", mData.mAttributes.find(id)->second);
@@ -67,7 +67,7 @@ void triggerAttr(int id, int old)
void triggerStat(int id, const std::string &changed, int old1, int old2 = 0)
{
StatMap::iterator it = mData.mStats.find(id);
- Mana::Event event(EVENT_UPDATESTAT);
+ Mana::Event event(Mana::Event::UpdateStat);
event.setInt("id", id);
event.setInt("base", it->second.base);
event.setInt("mod", it->second.mod);
@@ -215,7 +215,7 @@ void setStorageCount(int count)
if (count != old)
{
- Mana::Event event(EVENT_STORAGECOUNT);
+ Mana::Event event(Mana::Event::StorageCount);
event.setInt("oldCount", old);
event.setInt("newCount", count);
event.trigger(CHANNEL_STORAGE);
@@ -236,7 +236,7 @@ void setNPCInteractionCount(int count)
if (count != old)
{
- Mana::Event event(EVENT_NPCCOUNT);
+ Mana::Event event(Mana::Event::NpcCount);
event.setInt("oldCount", old);
event.setInt("newCount", count);
event.trigger(CHANNEL_NPC);
@@ -255,7 +255,7 @@ void setNPCPostCount(int count)
if (count != old)
{
- Mana::Event event(EVENT_POSTCOUNT);
+ Mana::Event event(Mana::Event::PostCount);
event.setInt("oldCount", old);
event.setInt("newCount", count);
event.trigger(CHANNEL_NPC);
@@ -276,7 +276,7 @@ void setBuySellState(BuySellState buySellState)
if (buySellState != old)
{
- Mana::Event event(EVENT_STATECHANGE);
+ Mana::Event event(Mana::Event::StateChange);
event.setInt("oldState", old);
event.setInt("newState", buySellState);
event.trigger(CHANNEL_BUYSELL);
@@ -295,7 +295,7 @@ void setTrading(bool trading)
if (notify)
{
- Mana::Event event(EVENT_TRADING);
+ Mana::Event event(Mana::Event::Trading);
event.setBool("trading", trading);
event.trigger(CHANNEL_STATUS);
}
@@ -361,7 +361,7 @@ public:
{
if (channel == CHANNEL_CLIENT)
{
- if (event.getName() == EVENT_STATECHANGE)
+ if (event.getType() == Mana::Event::StateChange)
{
int newState = event.getInt("newState");
@@ -377,7 +377,7 @@ public:
}
else if (channel == CHANNEL_GAME)
{
- if (event.getName() == EVENT_DESTRUCTED)
+ if (event.getType() == Mana::Event::Destructed)
{
delete mInventory;
delete mEquipment;
diff --git a/src/resources/theme.cpp b/src/resources/theme.cpp
index 8de275ae..966f0e94 100644
--- a/src/resources/theme.cpp
+++ b/src/resources/theme.cpp
@@ -211,7 +211,7 @@ void Theme::updateAlpha()
void Theme::event(Channels channel, const Mana::Event &event)
{
if (channel == CHANNEL_CONFIG &&
- event.getName() == EVENT_CONFIGOPTIONCHANGED &&
+ event.getType() == Mana::Event::ConfigOptionChanged &&
event.getString("option") == "guialpha")
{
updateAlpha();