summaryrefslogtreecommitdiff
path: root/src/net/ea/tradehandler.cpp
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2014-09-04 17:46:11 +0300
committerAndrei Karas <akaras@inbox.ru>2014-09-06 01:18:57 +0300
commit66c15abcf5af44cde75372a8089ac664f9308794 (patch)
tree928b58569bbcb5656ddce458d48bff14669051ae /src/net/ea/tradehandler.cpp
parente9cc6c1f66ef9fceafa1787616c981f656502bf0 (diff)
downloadmanaverse-66c15abcf5af44cde75372a8089ac664f9308794.tar.gz
manaverse-66c15abcf5af44cde75372a8089ac664f9308794.tar.bz2
manaverse-66c15abcf5af44cde75372a8089ac664f9308794.tar.xz
manaverse-66c15abcf5af44cde75372a8089ac664f9308794.zip
Move processTradeRequest from ea namespace into eathena and tmwa.
Diffstat (limited to 'src/net/ea/tradehandler.cpp')
-rw-r--r--src/net/ea/tradehandler.cpp90
1 files changed, 41 insertions, 49 deletions
diff --git a/src/net/ea/tradehandler.cpp b/src/net/ea/tradehandler.cpp
index d6715d4f6..5f507a01a 100644
--- a/src/net/ea/tradehandler.cpp
+++ b/src/net/ea/tradehandler.cpp
@@ -69,55 +69,6 @@ void TradeHandler::removeItem(const int slotNum A_UNUSED,
{
}
-void TradeHandler::processTradeRequest(Net::MessageIn &msg) const
-{
- // If a trade window or request window is already open, send a
- // trade cancel to any other trade request.
- //
- // Note that it would be nice if the server would prevent this
- // situation, and that the requesting player would get a
- // special message about the player being occupied.
- std::string tradePartnerNameTemp = msg.readString(24);
-
- if (player_relations.hasPermission(tradePartnerNameTemp,
- PlayerRelation::TRADE))
- {
- if (PlayerInfo::isTrading() || confirmDlg)
- {
- respond(false);
- return;
- }
-
- tradePartnerName = tradePartnerNameTemp;
- PlayerInfo::setTrading(true);
- if (tradeWindow)
- {
- if (tradePartnerName.empty() || tradeWindow->getAutoTradeNick()
- != tradePartnerName)
- {
- tradeWindow->clear();
- // TRANSLATORS: trade message
- confirmDlg = new ConfirmDialog(_("Request for Trade"),
- // TRANSLATORS: trade message
- strprintf(_("%s wants to trade with you, do"
- " you accept?"), tradePartnerName.c_str()),
- SOUND_REQUEST, true);
- confirmDlg->postInit();
- confirmDlg->addActionListener(&listener);
- }
- else
- {
- respond(true);
- }
- }
- }
- else
- {
- respond(false);
- return;
- }
-}
-
void TradeHandler::processTradeResponse(Net::MessageIn &msg) const
{
if (confirmDlg || tradePartnerName.empty()
@@ -281,4 +232,45 @@ void TradeHandler::processTradeComplete(Net::MessageIn &msg A_UNUSED)
PlayerInfo::setTrading(false);
}
+void TradeHandler::processTradeRequestContinue(const std::string &partner) const
+{
+ if (player_relations.hasPermission(partner,
+ PlayerRelation::TRADE))
+ {
+ if (PlayerInfo::isTrading() || confirmDlg)
+ {
+ respond(false);
+ return;
+ }
+
+ tradePartnerName = partner;
+ PlayerInfo::setTrading(true);
+ if (tradeWindow)
+ {
+ if (tradePartnerName.empty() || tradeWindow->getAutoTradeNick()
+ != tradePartnerName)
+ {
+ tradeWindow->clear();
+ // TRANSLATORS: trade message
+ confirmDlg = new ConfirmDialog(_("Request for Trade"),
+ // TRANSLATORS: trade message
+ strprintf(_("%s wants to trade with you, do"
+ " you accept?"), tradePartnerName.c_str()),
+ SOUND_REQUEST, true);
+ confirmDlg->postInit();
+ confirmDlg->addActionListener(&listener);
+ }
+ else
+ {
+ respond(true);
+ }
+ }
+ }
+ else
+ {
+ respond(false);
+ return;
+ }
+}
+
} // namespace Ea