diff options
author | Andrei Karas <akaras@inbox.ru> | 2013-03-09 14:54:15 +0300 |
---|---|---|
committer | Andrei Karas <akaras@inbox.ru> | 2013-03-09 14:54:15 +0300 |
commit | e433cda19d0d1d305a7a069a7930c2c7cf852930 (patch) | |
tree | 27abfcc9b4bb1e755b2c66519ad0abbb51219528 /src | |
parent | 29c0c9e731694a40a6f2e41c6bdedb4b78e2b952 (diff) | |
download | manaplus-e433cda19d0d1d305a7a069a7930c2c7cf852930.tar.gz manaplus-e433cda19d0d1d305a7a069a7930c2c7cf852930.tar.bz2 manaplus-e433cda19d0d1d305a7a069a7930c2c7cf852930.tar.xz manaplus-e433cda19d0d1d305a7a069a7930c2c7cf852930.zip |
add new notifications to playerhandler.
Diffstat (limited to 'src')
-rw-r--r-- | src/net/ea/playerhandler.cpp | 13 | ||||
-rw-r--r-- | src/notifications.h | 9 | ||||
-rw-r--r-- | src/notifymanager.cpp | 6 |
3 files changed, 22 insertions, 6 deletions
diff --git a/src/net/ea/playerhandler.cpp b/src/net/ea/playerhandler.cpp index 8592b737b..b19121a00 100644 --- a/src/net/ea/playerhandler.cpp +++ b/src/net/ea/playerhandler.cpp @@ -25,6 +25,7 @@ #include "game.h" #include "localplayer.h" #include "party.h" +#include "notifymanager.h" #include "units.h" #include "gui/ministatuswindow.h" @@ -456,13 +457,13 @@ void PlayerHandler::processPlayerStatUpdate2(Net::MessageIn &msg) const int newMoney = msg.readInt32(); if (newMoney > oldMoney) { - SERVER_NOTICE(strprintf(_("You picked up %s."), - Units::formatCurrency(newMoney - oldMoney).c_str())) + NotifyManager::notify(NotifyManager::MONEY_GET, + Units::formatCurrency(newMoney - oldMoney)); } else if (newMoney < oldMoney) { - SERVER_NOTICE(strprintf(_("You spent %s."), - Units::formatCurrency(oldMoney - newMoney).c_str())) + NotifyManager::notify(NotifyManager::MONEY_SPENT, + Units::formatCurrency(oldMoney - newMoney).c_str()); } PlayerInfo::setAttribute(PlayerInfo::MONEY, newMoney); @@ -505,7 +506,7 @@ void PlayerHandler::processPlayerStatUpdate4(Net::MessageIn &msg) int points = PlayerInfo::getAttribute(PlayerInfo::CHAR_POINTS); points += oldValue - value; PlayerInfo::setAttribute(PlayerInfo::CHAR_POINTS, points); - SERVER_NOTICE(_("Cannot raise skill!")) + NotifyManager::notify(NotifyManager::SKILL_RAISE_ERROR); } PlayerInfo::setStatBase(type, value); @@ -623,7 +624,7 @@ void PlayerHandler::processPlayerArrowMessage(Net::MessageIn &msg) switch (type) { case 0: - SERVER_NOTICE(_("Equip arrows first.")) + NotifyManager::notify(NotifyManager::ARROWS_EQUIP_NEEDED); break; case 3: // arrows equiped diff --git a/src/notifications.h b/src/notifications.h index 26d9ef745..f73651a06 100644 --- a/src/notifications.h +++ b/src/notifications.h @@ -68,6 +68,10 @@ namespace NotifyManager PARTY_USER_LEFT, PARTY_UNKNOWN_USER_MSG, PARTY_USER_NOT_IN_PARTY, + MONEY_GET, + MONEY_SPENT, + SKILL_RAISE_ERROR, + ARROWS_EQUIP_NEEDED, TYPE_END }; @@ -76,6 +80,7 @@ namespace NotifyManager { EMPTY, INT, + STRING, GUILD, GUILD_STRING, PARTY, @@ -131,6 +136,10 @@ namespace NotifyManager {N_("%s has left your party."), PARTY_STRING}, {N_("An unknown member tried to say: %s"), PARTY_STRING}, {N_("%s is not in your party!"), PARTY_STRING}, + {N_("You picked up %s."), STRING}, + {N_("You spent %s."), STRING}, + {N_("Cannot raise skill!"), EMPTY}, + {N_("Equip arrows first."), EMPTY}, }; } #endif diff --git a/src/notifymanager.cpp b/src/notifymanager.cpp index dcbd18c8f..86fe58491 100644 --- a/src/notifymanager.cpp +++ b/src/notifymanager.cpp @@ -105,6 +105,12 @@ namespace NotifyManager const NotificationInfo &info = notifications[message]; switch (info.flags) { + case STRING: + { + localChatTab->chatLog(strprintf(gettext(info.text), + str.c_str()), BY_SERVER); + break; + } case GUILD_STRING: { ChatTab *const tab = getGuildTab(); |