ManaPlus
Functions
EAthena::ItemRecv Namespace Reference

Functions

void processItemDropped (Net::MessageIn &msg)
 
void processItemDropped2 (Net::MessageIn &msg)
 
void processItemMvpDropped (Net::MessageIn &msg)
 
void processItemVisible (Net::MessageIn &msg)
 
void processItemVisible2 (Net::MessageIn &msg)
 

Function Documentation

◆ processItemDropped()

void EAthena::ItemRecv::processItemDropped ( Net::MessageIn msg)

Definition at line 42 of file itemrecv.cpp.

43 {
44  const BeingId id = msg.readBeingId("id");
45  const int itemId = msg.readItemId("item id");
46  ItemTypeT itemType = ItemType::Unknown;
47  if (msg.getVersion() >= 20130000)
48  itemType = static_cast<ItemTypeT>(msg.readInt16("type"));
49  const Identified identified = fromInt(
50  msg.readUInt8("identify"), Identified);
51  const int x = msg.readInt16("x");
52  const int y = msg.readInt16("y");
53  const int subX = CAST_S32(msg.readInt8("subx"));
54  const int subY = CAST_S32(msg.readInt8("suby"));
55  const int amount = msg.readInt16("count");
56  if (packets_zero || packetVersion >= 20180418)
57  {
58  msg.readUInt8("show drop effect");
59  msg.readInt16("show effect mode");
60  }
61 
62  if (actorManager != nullptr)
63  {
65  itemId,
66  x, y,
67  itemType,
68  amount,
69  0,
71  identified,
73  subX, subY,
74  nullptr);
75  }
76 }
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 packets_zero
Definition: client.cpp:133
int packetVersion
Definition: client.cpp:125
bool Identified
Definition: identified.h:30
#define fromInt(val, name)
Definition: intdefines.h:46
const ItemColor ItemColor_one
Definition: itemcolor.h:30
ItemType ::T ItemTypeT
Definition: itemtype.h:43
bool msg(InputEvent &event)
Definition: chat.cpp:39
@ Unknown
Definition: itemtype.h:30

References actorManager, CAST_S32, ActorManager::createItem(), Damaged_false, fromInt, ItemColor_one, Actions::msg(), packets_zero, packetVersion, ItemType::Unknown, x, and y.

◆ processItemDropped2()

void EAthena::ItemRecv::processItemDropped2 ( Net::MessageIn msg)

Definition at line 78 of file itemrecv.cpp.

79 {
80  const BeingId id = msg.readBeingId("id");
81  const int itemId = msg.readInt16("item id"); // +++ need use int32
82  const ItemTypeT itemType = static_cast<ItemTypeT>(msg.readUInt8("type"));
83  const Identified identified = fromInt(
84  msg.readUInt8("identify"), Identified);
85  const Damaged damaged = fromBool(msg.readUInt8("attribute"), Damaged);
86  const uint8_t refine = msg.readUInt8("refine");
87  int cards[maxCards];
88  for (int f = 0; f < maxCards; f++)
89  cards[f] = msg.readUInt16("card"); // ++ need use int32
90  const int x = msg.readInt16("x");
91  const int y = msg.readInt16("y");
92  const int amount = msg.readInt16("amount");
93  const int subX = CAST_S32(msg.readInt8("subx"));
94  const int subY = CAST_S32(msg.readInt8("suby"));
95  // +++ probably need add drop effect fields?
96 
97  if (actorManager != nullptr)
98  {
100  itemId,
101  x, y,
102  itemType,
103  amount,
104  refine,
106  identified,
107  damaged,
108  subX, subY,
109  &cards[0]);
110  }
111 }
#define fromBool(val, name)
Definition: booldefines.h:49
#define maxCards
Definition: cards.h:25
static ItemColor getColorFromCards(const int *const cards)
bool Damaged
Definition: damaged.h:30

References actorManager, CAST_S32, ActorManager::createItem(), fromBool, fromInt, ItemColorManager::getColorFromCards(), maxCards, Actions::msg(), x, and y.

◆ processItemMvpDropped()

void EAthena::ItemRecv::processItemMvpDropped ( Net::MessageIn msg)

Definition at line 113 of file itemrecv.cpp.

114 {
116  msg.readInt16("len");
117  msg.readUInt8("type");
118  msg.readItemId("item id");
119  msg.readUInt8("len");
120  msg.readString(24, "name");
121  msg.readUInt8("monster name len");
122  msg.readString(24, "monster name");
123 }
#define UNIMPLEMENTEDPACKET
Definition: logger.h:56

References Actions::msg(), and UNIMPLEMENTEDPACKET.

◆ processItemVisible()

void EAthena::ItemRecv::processItemVisible ( Net::MessageIn msg)

Definition at line 125 of file itemrecv.cpp.

126 {
127  const BeingId id = msg.readBeingId("item object id");
128  const int itemId = msg.readItemId("item id");
129  const Identified identified = fromInt(
130  msg.readUInt8("identify"), Identified);
131  const int x = msg.readInt16("x");
132  const int y = msg.readInt16("y");
133  const int amount = msg.readInt16("amount");
134  const int subX = CAST_S32(msg.readInt8("sub x"));
135  const int subY = CAST_S32(msg.readInt8("sub y"));
136 
137  if (actorManager != nullptr)
138  {
140  itemId,
141  x, y,
143  amount,
144  0,
146  identified,
148  subX, subY,
149  nullptr);
150  }
151 }

References actorManager, CAST_S32, ActorManager::createItem(), Damaged_false, fromInt, ItemColor_one, Actions::msg(), ItemType::Unknown, x, and y.

◆ processItemVisible2()

void EAthena::ItemRecv::processItemVisible2 ( Net::MessageIn msg)

Definition at line 153 of file itemrecv.cpp.

154 {
155  const BeingId id = msg.readBeingId("item object id");
156  const int itemId = msg.readInt16("item id"); // +++ need use int32
157  const ItemTypeT itemType = static_cast<ItemTypeT>(
158  msg.readUInt8("type"));
159  const Identified identified = fromInt(
160  msg.readUInt8("identify"), Identified);
161  const Damaged damaged = fromBool(msg.readUInt8("attribute"), Damaged);
162  const uint8_t refine = msg.readUInt8("refine");
163  int cards[maxCards];
164  for (int f = 0; f < maxCards; f++)
165  cards[f] = msg.readUInt16("card"); // +++ need use int32
166  const int x = msg.readInt16("x");
167  const int y = msg.readInt16("y");
168  const int amount = msg.readInt16("amount");
169  const int subX = CAST_S32(msg.readInt8("sub x"));
170  const int subY = CAST_S32(msg.readInt8("sub y"));
171 
172  if (actorManager != nullptr)
173  {
175  itemId,
176  x, y,
177  itemType,
178  amount,
179  refine,
181  identified,
182  damaged,
183  subX, subY,
184  &cards[0]);
185  }
186 }

References actorManager, CAST_S32, ActorManager::createItem(), fromBool, fromInt, ItemColorManager::getColorFromCards(), maxCards, Actions::msg(), x, and y.