GCC Code Coverage Report
Directory: src/ Exec Total Coverage
File: src/net/eathena/searchstorerecv.cpp Lines: 0 47 0.0 %
Date: 2018-07-14 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
namespace EAthena
35
{
36
37
void SearchStoreRecv::processSearchAck(Net::MessageIn &msg)
38
{
39
    UNIMPLEMENTEDPACKET;
40
    const int count = (msg.readInt16("len") - 7) / 106;
41
    msg.readUInt8("is first page");
42
    msg.readUInt8("is next page");
43
    msg.readUInt8("remain uses");
44
    for (int f = 0; f < count; f ++)
45
    {
46
        msg.readInt32("store id");
47
        msg.readInt32("aoount id");
48
        msg.readString(80, "store name");
49
        msg.readInt16("item id");
50
        msg.readUInt8("item type");
51
        msg.readInt32("price");
52
        msg.readInt16("amount");
53
        msg.readUInt8("refine");
54
        for (int d = 0; d < maxCards; d++)
55
            msg.readUInt16("card");
56
        if (msg.getVersion() >= 20150226)
57
        {
58
            for (int d = 0; d < 5; d ++)
59
            {
60
                msg.readInt16("option index");
61
                msg.readInt16("option value");
62
                msg.readUInt8("option param");
63
            }
64
        }
65
66
        // +++ need use ItemColorManager for colors
67
    }
68
}
69
70
void SearchStoreRecv::processSearchFailed(Net::MessageIn &msg)
71
{
72
    UNIMPLEMENTEDPACKET;
73
    const int result = msg.readUInt8("result");
74
    switch (result)
75
    {
76
        case 0:
77
            NotifyManager::notify(
78
                NotifyTypes::SEARCH_STORE_FAILED_NO_STORES);
79
            break;
80
        case 1:
81
            NotifyManager::notify(
82
                NotifyTypes::SEARCH_STORE_FAILED_MANY_RESULTS);
83
            break;
84
        case 2:
85
            NotifyManager::notify(
86
                NotifyTypes::SEARCH_STORE_FAILED_CANT_SEARCH_ANYMORE);
87
            break;
88
        case 3:
89
            NotifyManager::notify(
90
                NotifyTypes::SEARCH_STORE_FAILED_CANT_SEARCH_YET);
91
            break;
92
        case 4:
93
            NotifyManager::notify(
94
                NotifyTypes::SEARCH_STORE_FAILED_NO_INFORMATION);
95
            break;
96
        default:
97
            NotifyManager::notify(
98
                NotifyTypes::SEARCH_STORE_FAILED);
99
            break;
100
    }
101
}
102
103
void SearchStoreRecv::processSearchOpen(Net::MessageIn &msg)
104
{
105
    UNIMPLEMENTEDPACKET;
106
    msg.readInt16("effect");
107
    if (msg.getVersion() >= 20100701)
108
        msg.readUInt8("uses");
109
}
110
111
void SearchStoreRecv::processSearchClickAck(Net::MessageIn &msg)
112
{
113
    UNIMPLEMENTEDPACKET;
114
    msg.readInt16("x");
115
    msg.readInt16("y");
116
}
117
118
}  // namespace EAthena