1 |
|
|
/* |
2 |
|
|
* The ManaPlus Client |
3 |
|
|
* Copyright (C) 2011-2019 The ManaPlus Developers |
4 |
|
|
* Copyright (C) 2019-2021 Andrei Karas |
5 |
|
|
* |
6 |
|
|
* This file is part of The ManaPlus Client. |
7 |
|
|
* |
8 |
|
|
* This program is free software; you can redistribute it and/or modify |
9 |
|
|
* it under the terms of the GNU General Public License as published by |
10 |
|
|
* the Free Software Foundation; either version 2 of the License, or |
11 |
|
|
* any later version. |
12 |
|
|
* |
13 |
|
|
* This program is distributed in the hope that it will be useful, |
14 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 |
|
|
* GNU General Public License for more details. |
17 |
|
|
* |
18 |
|
|
* You should have received a copy of the GNU General Public License |
19 |
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 |
|
|
*/ |
21 |
|
|
|
22 |
|
|
#include "net/eathena/searchstorerecv.h" |
23 |
|
|
|
24 |
|
|
#include "logger.h" |
25 |
|
|
#include "notifymanager.h" |
26 |
|
|
|
27 |
|
|
#include "const/resources/item/cards.h" |
28 |
|
|
|
29 |
|
|
#include "enums/resources/notifytypes.h" |
30 |
|
|
|
31 |
|
|
#include "net/messagein.h" |
32 |
|
|
|
33 |
|
|
#include "debug.h" |
34 |
|
|
|
35 |
|
|
extern int itemIdLen; |
36 |
|
|
|
37 |
|
|
namespace EAthena |
38 |
|
|
{ |
39 |
|
|
|
40 |
|
|
void SearchStoreRecv::processSearchAck(Net::MessageIn &msg) |
41 |
|
|
{ |
42 |
|
|
UNIMPLEMENTEDPACKET; |
43 |
|
|
const int count = (msg.readInt16("len") - 7) / (104 + itemIdLen); |
44 |
|
|
msg.readUInt8("is first page"); |
45 |
|
|
msg.readUInt8("is next page"); |
46 |
|
|
msg.readUInt8("remain uses"); |
47 |
|
|
for (int f = 0; f < count; f ++) |
48 |
|
|
{ |
49 |
|
|
msg.readInt32("store id"); |
50 |
|
|
msg.readInt32("aoount id"); |
51 |
|
|
msg.readString(80, "store name"); |
52 |
|
|
msg.readItemId("item id"); |
53 |
|
|
msg.readUInt8("item type"); |
54 |
|
|
msg.readInt32("price"); |
55 |
|
|
msg.readInt16("amount"); |
56 |
|
|
msg.readUInt8("refine"); |
57 |
|
|
for (int d = 0; d < maxCards; d++) |
58 |
|
|
msg.readItemId("card"); |
59 |
|
|
if (msg.getVersion() >= 20150226) |
60 |
|
|
{ |
61 |
|
|
for (int d = 0; d < 5; d ++) |
62 |
|
|
{ |
63 |
|
|
msg.readInt16("option index"); |
64 |
|
|
msg.readInt16("option value"); |
65 |
|
|
msg.readUInt8("option param"); |
66 |
|
|
} |
67 |
|
|
} |
68 |
|
|
|
69 |
|
|
// +++ need use ItemColorManager for colors |
70 |
|
|
} |
71 |
|
|
} |
72 |
|
|
|
73 |
|
|
void SearchStoreRecv::processSearchFailed(Net::MessageIn &msg) |
74 |
|
|
{ |
75 |
|
|
UNIMPLEMENTEDPACKET; |
76 |
|
|
const int result = msg.readUInt8("result"); |
77 |
|
|
switch (result) |
78 |
|
|
{ |
79 |
|
|
case 0: |
80 |
|
|
NotifyManager::notify( |
81 |
|
|
NotifyTypes::SEARCH_STORE_FAILED_NO_STORES); |
82 |
|
|
break; |
83 |
|
|
case 1: |
84 |
|
|
NotifyManager::notify( |
85 |
|
|
NotifyTypes::SEARCH_STORE_FAILED_MANY_RESULTS); |
86 |
|
|
break; |
87 |
|
|
case 2: |
88 |
|
|
NotifyManager::notify( |
89 |
|
|
NotifyTypes::SEARCH_STORE_FAILED_CANT_SEARCH_ANYMORE); |
90 |
|
|
break; |
91 |
|
|
case 3: |
92 |
|
|
NotifyManager::notify( |
93 |
|
|
NotifyTypes::SEARCH_STORE_FAILED_CANT_SEARCH_YET); |
94 |
|
|
break; |
95 |
|
|
case 4: |
96 |
|
|
NotifyManager::notify( |
97 |
|
|
NotifyTypes::SEARCH_STORE_FAILED_NO_INFORMATION); |
98 |
|
|
break; |
99 |
|
|
default: |
100 |
|
|
NotifyManager::notify( |
101 |
|
|
NotifyTypes::SEARCH_STORE_FAILED); |
102 |
|
|
break; |
103 |
|
|
} |
104 |
|
|
} |
105 |
|
|
|
106 |
|
|
void SearchStoreRecv::processSearchOpen(Net::MessageIn &msg) |
107 |
|
|
{ |
108 |
|
|
UNIMPLEMENTEDPACKET; |
109 |
|
|
msg.readInt16("effect"); |
110 |
|
|
if (msg.getVersion() >= 20100701) |
111 |
|
|
msg.readUInt8("uses"); |
112 |
|
|
} |
113 |
|
|
|
114 |
|
|
void SearchStoreRecv::processSearchClickAck(Net::MessageIn &msg) |
115 |
|
|
{ |
116 |
|
|
UNIMPLEMENTEDPACKET; |
117 |
|
|
msg.readInt16("x"); |
118 |
|
|
msg.readInt16("y"); |
119 |
|
|
} |
120 |
|
|
|
121 |
|
|
} // namespace EAthena |