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

Line Branch Exec Source
1
/*
2
 *  The ManaPlus Client
3
 *  Copyright (C) 2011-2017  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
57
        // +++ need use ItemColorManager for colors
58
    }
59
}
60
61
void SearchStoreRecv::processSearchFailed(Net::MessageIn &msg)
62
{
63
    UNIMPLEMENTEDPACKET;
64
    const int result = msg.readUInt8("result");
65
    switch (result)
66
    {
67
        case 0:
68
            NotifyManager::notify(
69
                NotifyTypes::SEARCH_STORE_FAILED_NO_STORES);
70
            break;
71
        case 1:
72
            NotifyManager::notify(
73
                NotifyTypes::SEARCH_STORE_FAILED_MANY_RESULTS);
74
            break;
75
        case 2:
76
            NotifyManager::notify(
77
                NotifyTypes::SEARCH_STORE_FAILED_CANT_SEARCH_ANYMORE);
78
            break;
79
        case 3:
80
            NotifyManager::notify(
81
                NotifyTypes::SEARCH_STORE_FAILED_CANT_SEARCH_YET);
82
            break;
83
        case 4:
84
            NotifyManager::notify(
85
                NotifyTypes::SEARCH_STORE_FAILED_NO_INFORMATION);
86
            break;
87
        default:
88
            NotifyManager::notify(
89
                NotifyTypes::SEARCH_STORE_FAILED);
90
            break;
91
    }
92
}
93
94
void SearchStoreRecv::processSearchOpen(Net::MessageIn &msg)
95
{
96
    UNIMPLEMENTEDPACKET;
97
    msg.readInt16("effect");
98
    if (msg.getVersion() >= 20100701)
99
        msg.readUInt8("uses");
100
}
101
102
void SearchStoreRecv::processSearchClickAck(Net::MessageIn &msg)
103
{
104
    UNIMPLEMENTEDPACKET;
105
    msg.readInt16("x");
106
    msg.readInt16("y");
107
}
108
109
}  // namespace EAthena