ManaPlus
itemrecv.cpp
Go to the documentation of this file.
1 /*
2  * The ManaPlus Client
3  * Copyright (C) 2004-2009 The Mana World Development Team
4  * Copyright (C) 2009-2010 The Mana Developers
5  * Copyright (C) 2011-2019 The ManaPlus Developers
6  * Copyright (C) 2019-2021 Andrei Karas
7  *
8  * This file is part of The ManaPlus Client.
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program. If not, see <http://www.gnu.org/licenses/>.
22  */
23 
24 #include "net/tmwa/itemrecv.h"
25 
26 #include "actormanager.h"
27 
28 #include "net/messagein.h"
29 
30 #include "debug.h"
31 
32 namespace TmwAthena
33 {
34 
36 {
37  const BeingId id = msg.readBeingId("item object id");
38  const int itemId = msg.readInt16("item id");
39  const Identified identify = fromInt(msg.readUInt8("identify"), Identified);
40  const int x = msg.readInt16("x");
41  const int y = msg.readInt16("y");
42  const int subX = CAST_S32(msg.readInt8("sub x"));
43  const int subY = CAST_S32(msg.readInt8("sub y"));
44  const int amount = msg.readInt16("amount");
45 
46  if (actorManager != nullptr)
47  {
49  itemId,
50  x, y,
52  amount,
53  0,
55  identify,
57  subX, subY,
58  nullptr);
59  }
60 }
61 
63 {
64  const BeingId id = msg.readBeingId("item object id");
65  const int itemId = msg.readInt16("item id");
66  const Identified identified = fromInt(
67  msg.readUInt8("identify"), Identified);
68  const int x = msg.readInt16("x");
69  const int y = msg.readInt16("y");
70  const int amount = msg.readInt16("amount");
71  const int subX = CAST_S32(msg.readInt8("sub x"));
72  const int subY = CAST_S32(msg.readInt8("sub y"));
73 
74  if (actorManager != nullptr)
75  {
77  itemId,
78  x, y,
80  amount,
81  0,
83  identified,
85  subX, subY,
86  nullptr);
87  }
88 }
89 
90 } // namespace TmwAthena
ActorManager * actorManager
int BeingId
Definition: beingid.h:30
#define CAST_S32
Definition: cast.h:30
FloorItem * createItem(const BeingId id, const int itemId, const int x, const int y, const ItemTypeT itemType, const int amount, const int refine, const ItemColor color, const Identified identified, const Damaged damaged, const int subX, const int subY, const int *const cards)
const bool Damaged_false
Definition: damaged.h:30
bool Identified
Definition: identified.h:30
#define fromInt(val, name)
Definition: intdefines.h:46
const ItemColor ItemColor_one
Definition: itemcolor.h:30
bool msg(InputEvent &event)
Definition: chat.cpp:39
@ Unknown
Definition: itemtype.h:30
void processItemVisible(Net::MessageIn &msg)
Definition: itemrecv.cpp:62
void processItemDropped(Net::MessageIn &msg)
Definition: itemrecv.cpp:35