summaryrefslogtreecommitdiff
path: root/src/net/ea
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2013-03-09 02:10:02 +0300
committerAndrei Karas <akaras@inbox.ru>2013-03-09 14:39:29 +0300
commit29c0c9e731694a40a6f2e41c6bdedb4b78e2b952 (patch)
treee944129f98e652f2bd9adbcf5cd273a8bbb9e528 /src/net/ea
parent0aca242db52695fa0804ac180fc7961b281b422a (diff)
downloadplus-29c0c9e731694a40a6f2e41c6bdedb4b78e2b952.tar.gz
plus-29c0c9e731694a40a6f2e41c6bdedb4b78e2b952.tar.bz2
plus-29c0c9e731694a40a6f2e41c6bdedb4b78e2b952.tar.xz
plus-29c0c9e731694a40a6f2e41c6bdedb4b78e2b952.zip
Add new notifications to guildhandler, guildmanager, inventoryhandler and partyhandler.
Diffstat (limited to 'src/net/ea')
-rw-r--r--src/net/ea/guildhandler.cpp43
-rw-r--r--src/net/ea/guildhandler.h2
-rw-r--r--src/net/ea/inventoryhandler.cpp5
-rw-r--r--src/net/ea/partyhandler.cpp93
-rw-r--r--src/net/ea/partyhandler.h2
5 files changed, 56 insertions, 89 deletions
diff --git a/src/net/ea/guildhandler.cpp b/src/net/ea/guildhandler.cpp
index 129ba931d..b521e313a 100644
--- a/src/net/ea/guildhandler.cpp
+++ b/src/net/ea/guildhandler.cpp
@@ -24,6 +24,7 @@
#include "actorspritemanager.h"
#include "configuration.h"
#include "localplayer.h"
+#include "notifymanager.h"
#include "gui/socialwindow.h"
@@ -78,27 +79,27 @@ void GuildHandler::processGuildCreateResponse(Net::MessageIn &msg)
{
case 0:
// Success
- SERVER_NOTICE(_("Guild created."))
+ NotifyManager::notify(NotifyManager::GUILD_CREATED);
break;
case 1:
// Already in a guild
- SERVER_NOTICE(_("You are already in guild."))
+ NotifyManager::notify(NotifyManager::GUILD_ALREADY);
break;
case 2:
// Unable to make (likely name already in use)
- SERVER_NOTICE(_("You are already in guild."))
+ NotifyManager::notify(NotifyManager::GUILD_ALREADY);
break;
case 3:
// Emperium check failed
- SERVER_NOTICE(_("Emperium check failed."))
+ NotifyManager::notify(NotifyManager::GUILD_EMPERIUM_CHECK_FAILED);
break;
default:
// Unknown response
- SERVER_NOTICE(_("Unknown server response."))
+ NotifyManager::notify(NotifyManager::GUILD_ERROR);
break;
}
}
@@ -406,23 +407,23 @@ void GuildHandler::processGuildInviteAck(Net::MessageIn &msg)
switch (flag)
{
case 0:
- guildTab->chatLog(_("Could not inivte user to guild."), BY_SERVER);
+ NotifyManager::notify(NotifyManager::GUILD_INVITE_FAILED);
break;
case 1:
- guildTab->chatLog(_("User rejected guild invite."), BY_SERVER);
+ NotifyManager::notify(NotifyManager::GUILD_INVITE_REJECTED);
break;
case 2:
- guildTab->chatLog(_("User is now part of your guild."), BY_SERVER);
+ NotifyManager::notify(NotifyManager::GUILD_INVITE_JOINED);
break;
case 3:
- guildTab->chatLog(_("Your guild is full."), BY_SERVER);
+ NotifyManager::notify(NotifyManager::GUILD_INVITE_FULL);
break;
default:
- guildTab->chatLog(_("Unknown guild invite response."), BY_SERVER);
+ NotifyManager::notify(NotifyManager::GUILD_INVITE_ERROR);
break;
}
}
@@ -445,7 +446,7 @@ void GuildHandler::processGuildLeave(Net::MessageIn &msg)
taGuild->removeFromMembers();
taGuild->clearMembers();
}
- SERVER_NOTICE(_("You have left the guild."))
+ NotifyManager::notify(NotifyManager::GUILD_LEFT);
delete guildTab;
guildTab = nullptr;
@@ -456,11 +457,7 @@ void GuildHandler::processGuildLeave(Net::MessageIn &msg)
}
else
{
- if (guildTab)
- {
- guildTab->chatLog(strprintf(_("%s has left your guild."),
- nick.c_str()), BY_SERVER);
- }
+ NotifyManager::notify(NotifyManager::GUILD_USER_LEFT, nick);
if (actorSpriteManager)
{
Being *const b = actorSpriteManager->findBeingByName(
@@ -493,7 +490,7 @@ void GuildHandler::processGuildExpulsion(Net::MessageIn &msg)
taGuild->removeFromMembers();
taGuild->clearMembers();
}
- SERVER_NOTICE(_("You were kicked from guild."));
+ NotifyManager::notify(NotifyManager::GUILD_KICKED);
delete guildTab;
guildTab = nullptr;
@@ -504,12 +501,7 @@ void GuildHandler::processGuildExpulsion(Net::MessageIn &msg)
}
else
{
- if (guildTab)
- {
- guildTab->chatLog(strprintf(_("%s has kicked from your guild."),
- nick.c_str()), BY_SERVER);
- }
-
+ NotifyManager::notify(NotifyManager::GUILD_USER_KICKED, nick);
if (actorSpriteManager)
{
Being *const b = actorSpriteManager->findBeingByName(
@@ -605,4 +597,9 @@ void GuildHandler::clear()
taGuild = nullptr;
}
+ChatTab *GuildHandler::getTab()
+{
+ return guildTab;
+}
+
} // namespace Ea
diff --git a/src/net/ea/guildhandler.h b/src/net/ea/guildhandler.h
index 128bf368d..65a6973ca 100644
--- a/src/net/ea/guildhandler.h
+++ b/src/net/ea/guildhandler.h
@@ -102,6 +102,8 @@ class GuildHandler : public Net::GuildHandler
void clear();
+ ChatTab *getTab();
+
protected:
bool showBasicInfo;
};
diff --git a/src/net/ea/inventoryhandler.cpp b/src/net/ea/inventoryhandler.cpp
index eceb194f9..9e751f27c 100644
--- a/src/net/ea/inventoryhandler.cpp
+++ b/src/net/ea/inventoryhandler.cpp
@@ -23,6 +23,7 @@
#include "net/ea/inventoryhandler.h"
#include "localplayer.h"
+#include "notifymanager.h"
#include "gui/ministatuswindow.h"
@@ -399,7 +400,7 @@ void InventoryHandler::processItemUseResponse(Net::MessageIn &msg)
if (msg.readInt8() == 0)
{
- SERVER_NOTICE(_("Failed to use item."))
+ NotifyManager::notify(NotifyManager::USE_FAILED);
}
else
{
@@ -565,7 +566,7 @@ void InventoryHandler::processPlayerEquip(Net::MessageIn &msg)
const int flag = msg.readInt8();
if (!flag)
- SERVER_NOTICE(_("Unable to equip."))
+ NotifyManager::notify(NotifyManager::EQUIP_FAILED);
else
mEquips.setEquipment(getSlot(equipType), index);
}
diff --git a/src/net/ea/partyhandler.cpp b/src/net/ea/partyhandler.cpp
index 41d0bdf00..7ab8ae5e8 100644
--- a/src/net/ea/partyhandler.cpp
+++ b/src/net/ea/partyhandler.cpp
@@ -24,6 +24,7 @@
#include "actorspritemanager.h"
#include "configuration.h"
#include "localplayer.h"
+#include "notifymanager.h"
#include "gui/socialwindow.h"
@@ -74,9 +75,9 @@ void PartyHandler::clear()
void PartyHandler::processPartyCreate(Net::MessageIn &msg)
{
if (msg.readInt8())
- SERVER_NOTICE(_("Could not create party."))
+ NotifyManager::notify(NotifyManager::PARTY_CREATE_FAILED);
else
- SERVER_NOTICE(_("Party successfully created."))
+ NotifyManager::notify(NotifyManager::PARTY_CREATED);
}
void PartyHandler::processPartyInfo(Net::MessageIn &msg)
@@ -128,11 +129,10 @@ void PartyHandler::processPartyInfo(Net::MessageIn &msg)
if (oldParty)
{
//member = Ea::taParty->getMember(id);
- if (Ea::partyTab && names.find(nick) == names.end())
+ if (names.find(nick) == names.end())
{
- Ea::partyTab->chatLog(strprintf(
- _("%s has joined your party."),
- nick.c_str()), BY_SERVER);
+ NotifyManager::notify(NotifyManager::PARTY_USER_JOINED,
+ nick);
}
}
PartyMember *member = Ea::taParty->addMember(id, nick);
@@ -166,29 +166,21 @@ void PartyHandler::processPartyInviteResponse(Net::MessageIn &msg)
switch (msg.readInt8())
{
case 0:
- Ea::partyTab->chatLog(strprintf(
- _("%s is already a member of a party."),
- nick.c_str()), BY_SERVER);
+ NotifyManager::notify(NotifyManager::PARTY_INVITE_ALREADY_MEMBER,
+ nick);
break;
case 1:
- Ea::partyTab->chatLog(strprintf(
- _("%s refused your invitation."),
- nick.c_str()), BY_SERVER);
+ NotifyManager::notify(NotifyManager::PARTY_INVITE_REFUSED, nick);
break;
case 2:
- Ea::partyTab->chatLog(strprintf(
- _("%s is now a member of your party."),
- nick.c_str()), BY_SERVER);
+ NotifyManager::notify(NotifyManager::PARTY_INVITE_DONE, nick);
break;
case 3:
- Ea::partyTab->chatLog(strprintf(
- _("%s can't join your party because party is "
- "full."), nick.c_str()), BY_SERVER);
+ NotifyManager::notify(NotifyManager::PARTY_INVITE_PARTY_FULL,
+ nick);
break;
default:
- Ea::partyTab->chatLog(strprintf(
- _("QQQ Unknown invite response for %s."),
- nick.c_str()), BY_SERVER);
+ NotifyManager::notify(NotifyManager::PARTY_INVITE_ERROR, nick);
break;
}
}
@@ -238,32 +230,19 @@ void PartyHandler::processPartySettings(Net::MessageIn &msg)
if (mShareExp == PARTY_SHARE)
break;
mShareExp = PARTY_SHARE;
- if (Ea::partyTab)
- {
- Ea::partyTab->chatLog(
- _("Experience sharing enabled."), BY_SERVER);
- }
+ NotifyManager::notify(NotifyManager::PARTY_EXP_SHARE_ON);
break;
case PARTY_SHARE_NO:
if (mShareExp == PARTY_SHARE_NO)
break;
mShareExp = PARTY_SHARE_NO;
- if (Ea::partyTab)
- {
- Ea::partyTab->chatLog(
- _("Experience sharing disabled."), BY_SERVER);
- }
+ NotifyManager::notify(NotifyManager::PARTY_EXP_SHARE_OFF);
break;
case PARTY_SHARE_NOT_POSSIBLE:
if (mShareExp == PARTY_SHARE_NOT_POSSIBLE)
break;
mShareExp = PARTY_SHARE_NOT_POSSIBLE;
- if (Ea::partyTab)
- {
- Ea::partyTab->chatLog(
- _("Experience sharing not possible."),
- BY_SERVER);
- }
+ NotifyManager::notify(NotifyManager::PARTY_EXP_SHARE_ERROR);
break;
default:
logger->log("QQQ Unknown party exp option: %d\n", exp);
@@ -276,35 +255,22 @@ void PartyHandler::processPartySettings(Net::MessageIn &msg)
if (mShareItems == PARTY_SHARE)
break;
mShareItems = PARTY_SHARE;
- if (Ea::partyTab)
- {
- Ea::partyTab->chatLog(
- _("Item sharing enabled."), BY_SERVER);
- }
+ NotifyManager::notify(NotifyManager::PARTY_ITEM_SHARE_ON);
break;
case PARTY_SHARE_NO:
if (mShareItems == PARTY_SHARE_NO)
break;
mShareItems = PARTY_SHARE_NO;
- if (Ea::partyTab)
- {
- Ea::partyTab->chatLog(
- _("Item sharing disabled."), BY_SERVER);
- }
+ NotifyManager::notify(NotifyManager::PARTY_ITEM_SHARE_OFF);
break;
case PARTY_SHARE_NOT_POSSIBLE:
if (mShareItems == PARTY_SHARE_NOT_POSSIBLE)
break;
mShareItems = PARTY_SHARE_NOT_POSSIBLE;
- if (Ea::partyTab)
- {
- Ea::partyTab->chatLog(
- _("Item sharing not possible."), BY_SERVER);
- }
+ NotifyManager::notify(NotifyManager::PARTY_ITEM_SHARE_ERROR);
break;
default:
- logger->log("QQQ Unknown party item option: %d\n",
- exp);
+ logger->log("QQQ Unknown party item option: %d\n", exp);
break;
}
}
@@ -352,7 +318,7 @@ void PartyHandler::processPartyLeave(Net::MessageIn &msg)
Ea::taParty->removeFromMembers();
Ea::taParty->clearMembers();
}
- SERVER_NOTICE(_("You have left the party."))
+ NotifyManager::notify(NotifyManager::PARTY_LEFT);
delete Ea::partyTab;
Ea::partyTab = nullptr;
@@ -362,12 +328,7 @@ void PartyHandler::processPartyLeave(Net::MessageIn &msg)
}
else
{
- if (Ea::partyTab)
- {
- Ea::partyTab->chatLog(strprintf(
- _("%s has left your party."),
- nick.c_str()), BY_SERVER);
- }
+ NotifyManager::notify(NotifyManager::PARTY_USER_LEFT, nick);
if (actorSpriteManager)
{
Being *const b = actorSpriteManager->findBeing(id);
@@ -441,11 +402,15 @@ void PartyHandler::processPartyMessage(Net::MessageIn &msg)
}
else
{
- Ea::partyTab->chatLog(strprintf(
- _("An unknown member tried to say: %s"),
- chatMsg.c_str()), BY_SERVER);
+ NotifyManager::notify(NotifyManager::PARTY_UNKNOWN_USER_MSG,
+ chatMsg);
}
}
}
+ChatTab *PartyHandler::getTab()
+{
+ return partyTab;
+}
+
} // namespace Ea
diff --git a/src/net/ea/partyhandler.h b/src/net/ea/partyhandler.h
index f9dde62b0..c113a6a3b 100644
--- a/src/net/ea/partyhandler.h
+++ b/src/net/ea/partyhandler.h
@@ -56,6 +56,8 @@ class PartyHandler : public Net::PartyHandler
void clear();
+ ChatTab *getTab();
+
virtual void processPartyCreate(Net::MessageIn &msg);
virtual void processPartyInfo(Net::MessageIn &msg);