GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/net/eathena/searchstorerecv.cpp Lines: 0 47 0.0 %
Date: 2018-11-12 Branches: 0 16 0.0 %

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