This commit is contained in:
aozhiwei 2023-05-23 19:30:46 +08:00
parent 20a73e64b4
commit d3674779c2
3 changed files with 5 additions and 4 deletions

View File

@ -1663,7 +1663,7 @@ void Human::AddItem(int item_id, int item_num)
#endif
if (IsPlayer()) {
cs::SMGetItemNotify notify_msg;
auto pair = notify_msg.add_items();
auto pair = notify_msg.add_old_items();
pair->set_key(item_id);
pair->set_value(item_num);
SendNotifyMsg(notify_msg);

View File

@ -671,7 +671,7 @@ void Player::ProcInteraction()
bool real_get_count = loot->count < old_count ? old_count - loot->count : loot->count;
bool found = false;
for (int i = 0; i < notify_msg.items().size(); ++i) {
auto pair = notify_msg.mutable_items(i);
auto pair = notify_msg.mutable_old_items(i);
if (pair->key() == loot->item_id) {
pair->set_value(pair->value() + real_get_count);
found = true;
@ -679,7 +679,7 @@ void Player::ProcInteraction()
}
}
if (!found) {
auto pair = notify_msg.add_items();
auto pair = notify_msg.add_old_items();
pair->set_key(loot->item_id);
pair->set_value(real_get_count);
}

View File

@ -1735,7 +1735,8 @@ message SMMatchMemberMsgNotify
//
message SMGetItemNotify
{
repeated MFPair items = 8; //key:id value:
repeated MFPair old_items = 8; //key:id value:
repeated MFTuple items = 1; //0id 1: 2:
}
//