-
Notifications
You must be signed in to change notification settings - Fork 9
/
forbidden_items.cpp
48 lines (42 loc) · 1.02 KB
/
forbidden_items.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include "config_new.h"
#include "zxmgr.h"
#include "srvmgr.h"
#include "lib\utils.hpp"
bool ItemRemover_CheckForbidden(byte* item)
{
return false;
/*
std::string item_name = *(const char**)(*(byte**)(item + 0x3C) + 4);
uint16_t item_count = *(uint16_t*)(item + 0x42);
if(item_name == "Potion Big Healing" ||
item_name == "Potion Medium Healing") return true;
return false;*/
}
std::vector<byte*> ItemRemover_Process(byte* unit)
{
std::vector<byte*> saved_items;
byte* pack = *(byte**)(unit + 0x7C);
if(!pack) return saved_items;
uint32_t index = 0;
byte* lp = *(byte**)(pack + 4);
byte* last_lp = NULL;
while(lp)
{
byte* item = *(byte**)(lp + 8);
uint16_t item_count = *(uint16_t*)(item + 0x42);
if(item_count && ItemRemover_CheckForbidden(item))
{
byte* p_item = zxmgr::GetItemFromPack(pack, index, item_count);
if(p_item)
{
saved_items.push_back(p_item);
if(last_lp) lp = last_lp;
else lp = *(byte**)(pack + 4);
}
}
last_lp = lp;
lp = *(byte**)(lp);
index++;
}
return saved_items;
}