~ubuntu-branches/ubuntu/vivid/manaplus/vivid-proposed

« back to all changes in this revision

Viewing changes to src/net/eathena/tradehandler.cpp

  • Committer: Package Import Robot
  • Author(s): Patrick Matthäi
  • Date: 2014-10-12 12:23:57 UTC
  • mfrom: (1.1.36)
  • Revision ID: package-import@ubuntu.com-20141012122357-7836sgv1j1v02cs2
Tags: 1.4.10.11-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
#include "net/eathena/tradehandler.h"
24
24
 
25
25
#include "item.h"
 
26
#include "notifymanager.h"
26
27
 
27
28
#include "being/playerinfo.h"
28
29
 
33
34
 
34
35
#include "net/ea/eaprotocol.h"
35
36
 
 
37
#include "resources/notifytypes.h"
 
38
 
 
39
#include "utils/stringutils.h"
 
40
 
36
41
#include "debug.h"
37
42
 
38
43
extern Net::TradeHandler *tradeHandler;
54
59
        SMSG_TRADE_OK,
55
60
        SMSG_TRADE_CANCEL,
56
61
        SMSG_TRADE_COMPLETE,
 
62
        SMSG_TRADE_UNDO,
57
63
        0
58
64
    };
59
65
    handledMessages = _messages;
97
103
            processTradeComplete(msg);
98
104
            break;
99
105
 
 
106
        case SMSG_TRADE_UNDO:
 
107
            processTradeUndo(msg);
 
108
            break;
 
109
 
100
110
        default:
101
111
            break;
102
112
    }
163
173
 
164
174
void TradeHandler::processTradeResponse2(Net::MessageIn &msg) const
165
175
{
166
 
    msg.readUInt8("type");
 
176
    const uint8_t type = msg.readUInt8("type");
167
177
    msg.readInt32("char id");
168
178
    msg.readInt16("base level");
 
179
    processTradeResponseContinue(type);
169
180
}
170
181
 
171
182
void TradeHandler::processTradeItemAdd(Net::MessageIn &msg)
195
206
    }
196
207
}
197
208
 
 
209
void TradeHandler::processTradeItemAddResponse(Net::MessageIn &msg)
 
210
{
 
211
    msg.readInt16("index");
 
212
    const uint8_t res = msg.readUInt8("fail");
 
213
    switch (res)
 
214
    {
 
215
        case 0:  // Successfully added item
 
216
        case 9:  // silent added item
 
217
            if (tradeWindow)
 
218
            {
 
219
                // here need add cached item
 
220
//                tradeWindow->addItem2(item->getId(), true,
 
221
//                    quantity, item->getRefine(), item->getColor(),
 
222
//                    item->isEquipment());
 
223
            }
 
224
//            item->increaseQuantity(-quantity);
 
225
            break;
 
226
        case 1:
 
227
            // Add item failed - player overweighted
 
228
            NotifyManager::notify(NotifyTypes::
 
229
                TRADE_ADD_PARTNER_OVER_WEIGHT);
 
230
            break;
 
231
        case 2:
 
232
            NotifyManager::notify(NotifyTypes::TRADE_ADD_ERROR);
 
233
            break;
 
234
        default:
 
235
            NotifyManager::notify(NotifyTypes::TRADE_ADD_ERROR);
 
236
            logger->log("QQQ SMSG_TRADE_ITEM_ADD_RESPONSE: "
 
237
                        + toString(res));
 
238
            break;
 
239
    }
 
240
}
 
241
 
 
242
void TradeHandler::processTradeUndo(Net::MessageIn &msg A_UNUSED) const
 
243
{
 
244
    // +++ here need clear trade window from partner side?
 
245
}
 
246
 
198
247
}  // namespace EAthena