-
Автор темы
- #1
1.Сначала нам надо получить LocalPlayerInventory
а)
b)
2.Далее создаём EconItem
3.Набираем EconItem и добавляем его в инвентарь
CPlayerInventory:
CEconItem (h):
CEconItem (cpp):
CSharedObjectTypeCache:
Атрибуты (возможно, кто-то будет использовать их)
Взято с
а)
Код:
auto LocalInventory = **reinterpret_cast<CPlayerInventory***>(Pattern::FindSignature("client.dll", "8B 3D ? ? ? ? 85 FF 74 1A") + 0x2);
Код:
g_CSInventoryManager = *reinterpret_cast<CSInventoryManager**>(Pattern::FindSignature("client.dll", "B9 ?? ?? ?? ?? 8D 44 24 10 89 54 24 14") + 0x1);
auto LocalInventory = g_CSInventoryManager->GetLocalPlayerInventory();
Код:
CPlayerInventory* CSInventoryManager::GetLocalPlayerInventory()
{
static auto local_inventory_offset = *reinterpret_cast<uintptr_t*>(Pattern::FindSignature("client.dll", "8B 8B ? ? ? ? E8 ? ? ? ? 89 44 24 18") + 0x2);
return *reinterpret_cast<CPlayerInventory**>(this + local_inventory_offset);
}
Код:
auto Item = GameUtils::CreateEconItem();
Код:
CEconItem* GameUtils::CreateEconItem()
{
static auto fnCreateSharedObjectSubclass_EconItem_
= reinterpret_cast<CEconItem*(__stdcall*)()>(
*reinterpret_cast<uintptr_t*>(Pattern::FindSignature("client.dll", "C7 45 ? ? ? ? ? C7 45 ? ? ? ? ? C7 45 ? ? ? ? ? C7 45 ? ? ? ? ? C7 45 ? ? ? ? ? C7 45 ? ? ? ? ? E8 ? ? ? ? 83 F8 FF 75 09 8D 45 E4 50 E8 ? ? ? ? 8D 45 E4 C7 45 ? ? ? ? ? 50 C7 45 ? ? ? ? ? C7 45 ? ? ? ? ? C7 45 ? ? ? ? ? C7 45 ? ? ? ? ? C7 45 ? ? ? ? ? C7 45 ? ? ? ? ? E8 ? ? ? ? 83 F8 FF 75 09 8D 45 E4 50 E8 ? ? ? ? 8D 45 E4 C7 45 ? ? ? ? ? 50 C7 45 ? ? ? ? ? C7 45 ? ? ? ? ? C7 45 ? ? ? ? ? C7 45 ? ? ? ? ? C7 45 ? ? ? ? ? C7 45 ? ? ? ? ? E8 ? ? ? ? 83 F8 FF 75 09 8D 45 E4 50 E8 ? ? ? ? 8D 45 E4 C7 45 ? ? ? ? ? 50 C7 45 ? ? ? ? ? C7 45 ? ? ? ? ? C7 45 ? ? ? ? ? C7 45 ? ? ? ? ? C7 45 ? ? ? ? ? C7 45 ? ? ? ? ? E8 ? ? ? ? 83 F8 FF 75 09 8D 45 E4 50 E8 ? ? ? ? 8D 45 E4") + 3)
);
return fnCreateSharedObjectSubclass_EconItem_();
}
uintptr_t GameUtils::GetItemSchema()
{
static auto fnGetItemSchema
= reinterpret_cast<uintptr_t(__stdcall*)()>(
Pattern::FindSignature("client.dll", "A1 ? ? ? ? 85 C0 75 53")
);
return fnGetItemSchema();
}
Код:
*Item->GetAccountID() = LocalInventory->GetSteamID();
*Item->GetDefIndex() = 1;
*Item->GetItemID() = RandomInt(1, 50000);
*Item->GetInventory() = 1;
*Item->GetFlags() = 0;
*Item->GetOriginalID() = 0;
Item->AddSticker(0, 4, 0, 1, 1);
Item->SetStatTrak(150);
Item->SetPaintKit(37);
Item->SetPaintSeed(0);
Item->SetPaintWear(0);
Item->SetOrigin(8);
Item->SetRarity(ITEM_RARITY_MYTHICAL);
Item->SetLevel(1);
Item->SetInUse(false);
Код:
LocalInventory->AddEconItem(Item, 1, 0, 1);
CPlayerInventory:
Код:
void CPlayerInventory::RemoveItem(uint64_t ID)
{
static auto fnRemoveItem
= reinterpret_cast<int(__thiscall*)(void*, int64_t)>(
Pattern::FindSignature("client.dll", "55 8B EC 83 E4 F8 56 57 FF 75 0C 8B F1")
);
fnRemoveItem(this, ID);
}
void CPlayerInventory::RemoveItem(CEconItem* item)
{
RemoveItem(*item->GetItemID());
GetBaseTypeCache()->RemoveObject(item);
}
void CPlayerInventory::ClearInventory()
{
auto BaseTypeCache = this->GetBaseTypeCache();
auto items = BaseTypeCache->GetEconItems();
for (auto item : items)
{
RemoveItem(*item->GetItemID());
BaseTypeCache->RemoveObject(item);
}
}
CSharedObjectTypeCache* CPlayerInventory::GetBaseTypeCache()
{
static auto fnGCSDK_CGCClient_FindSOCache
= reinterpret_cast<uintptr_t(__thiscall*)(uintptr_t, uint64_t, uint64_t, bool)>(
Pattern::FindSignature("client.dll", "55 8B EC 83 E4 F8 83 EC 1C 0F 10 45 08")
);
static auto fnGCSDK_CSharedObjectCache_CreateBaseTypeCache
= reinterpret_cast<CSharedObjectTypeCache*(__thiscall*)(uintptr_t, int)>(
Pattern::FindSignature("client.dll", "55 8B EC 51 53 56 8B D9 8D 45 08")
);
//g_GCClientSystem = **reinterpret_cast<uintptr_t**>(Pattern::FindSignature("client.dll", "8B 0D ? ? ? ? 6A 00 83 EC 10") + 0x2);
auto SOCahce = fnGCSDK_CGCClient_FindSOCache(g_Valve.g_GCClientSystem + 0x60, *reinterpret_cast<uint64_t*>(this + 0x8), *reinterpret_cast<uint64_t*>(this + 0x10), 0);
return fnGCSDK_CSharedObjectCache_CreateBaseTypeCache(SOCahce, 1);
}
uint32_t CPlayerInventory::GetSteamID()
{
return *reinterpret_cast<uint32_t*>(this + 0x8);
}
CUtlVector< C_EconItemView* >* CPlayerInventory::GetInventoryItems()
{
return reinterpret_cast<CUtlVector<C_EconItemView*>*>(this + 0x2C);
}
bool CPlayerInventory::AddEconItem(CEconItem* item, int a3, int a4, char a5)
{
static auto fnAddEconItem
= reinterpret_cast<C_EconItemView*(__thiscall*)(void*, CEconItem*, int, int, char)>(
Pattern::FindSignature("client.dll", "55 8B EC 83 E4 F8 A1 ? ? ? ? 83 EC 14 53 56 57 8B F9 8B 08")
);
GetBaseTypeCache()->AddObject(item);
auto ret = fnAddEconItem(this, item, a3, a4, a5);
if (ret)
{
auto i = GetInventoryItemByItemID(*item->GetItemID());
*reinterpret_cast<bool*>((uintptr_t)i + 0xA1) = 1;
}
return ret;
}
Код:
enum ItemQuality
{
ITEM_QUALITY_DEFAULT,
ITEM_QUALITY_GENUINE,
ITEM_QUALITY_VINTAGE,
ITEM_QUALITY_UNUSUAL,
ITEM_QUALITY_SKIN,
ITEM_QUALITY_COMMUNITY,
ITEM_QUALITY_DEVELOPER,
ITEM_QUALITY_SELFMADE,
ITEM_QUALITY_CUSTOMIZED,
ITEM_QUALITY_STRANGE,
ITEM_QUALITY_COMPLETED,
ITEM_QUALITY_UNK2,
ITEM_QUALITY_TOURNAMENT
};
enum ItemRarity
{
ITEM_RARITY_DEFAULT,
ITEM_RARITY_COMMON,
ITEM_RARITY_UNCOMMON,
ITEM_RARITY_RARE,
ITEM_RARITY_MYTHICAL,
ITEM_RARITY_LEGENDARY,
ITEM_RARITY_ANCIENT,
ITEM_RARITY_IMMORTAL
};
class CEconItem
{
unsigned short* GetEconItemData();
void UpdateEquippedState(unsigned int state);
public:
uint32_t * GetInventory();
uint32_t * GetAccountID();
uint16_t* GetDefIndex();
uint64_t* GetItemID();
uint64_t* GetOriginalID();
unsigned char* GetFlags();
void SetQuality(ItemQuality quality);
void SetRarity(ItemRarity rarity);
void SetOrigin(int origin);
void SetLevel(int level);
void SetInUse(bool in_use);
void SetCustomName(const char* name);
void SetCustomDesc(const char* name);
void SetPaintSeed(float seed);
void SetPaintKit(float kit);
void SetPaintWear(float wear);
void SetStatTrak(int val);
void AddSticker(int index, int kit, float wear, float scale, float rotation);
template<typename TYPE>
void SetAttributeValue(int index, TYPE val)
{
auto v15 = (DWORD*)GameUtils::GetItemSchema();
auto v16 = *(DWORD *)(v15[72] + 4 * index);
static auto fnSetDynamicAttributeValue
= reinterpret_cast<int(__thiscall*)(CEconItem*, DWORD, void*)>(
Pattern::FindSignature("client.dll", "55 8B EC 83 E4 F8 83 EC 3C 53 8B 5D 08 56 57 6A 00")
);
fnSetDynamicAttributeValue(this, v16, &val);
}
};
Код:
uint32_t* CEconItem::GetAccountID()
{
return reinterpret_cast<uint32_t*>(this + 0x1C);
}
uint64_t* CEconItem::GetItemID()
{
return reinterpret_cast<uint64_t*>(this + 0x8);
}
uint64_t* CEconItem::GetOriginalID()
{
return reinterpret_cast<uint64_t*>(this + 0x10);
}
uint16_t* CEconItem::GetDefIndex()
{
return reinterpret_cast<uint16_t*>(this + 0x24);
}
uint32_t* CEconItem::GetInventory()
{
return reinterpret_cast<uint32_t*>(this + 0x20);
}
unsigned char* CEconItem::GetFlags()
{
return reinterpret_cast<unsigned char*>(this + 0x30);
}
unsigned short* CEconItem::GetEconItemData()
{
return reinterpret_cast<unsigned short*>(this + 0x26);
}
void CEconItem::UpdateEquippedState(unsigned int state)
{
static auto fnUpdateEquippedState
= reinterpret_cast<int(__thiscall*)(CEconItem*, unsigned int)>(
Pattern::FindSignature("client.dll", "55 8B EC 8B 45 08 8B D0 C1 EA 10")
);
fnUpdateEquippedState(this, state);
}
void CEconItem::AddSticker(int index, int kit, float wear, float scale, float rotation)
{
SetAttributeValue<int>(113 + 4 * index, kit);
SetAttributeValue<float>(114 + 4 * index, wear);
SetAttributeValue<float>(115 + 4 * index, scale);
SetAttributeValue<float>(116 + 4 * index, rotation);
}
void CEconItem::SetStatTrak(int val)
{
SetAttributeValue<int>(80, 150);
SetAttributeValue<int>(81, 0);
SetQuality(ITEM_QUALITY_STRANGE);
}
void CEconItem::SetPaintKit(float kit)
{
SetAttributeValue<float>(6, kit);
}
void CEconItem::SetPaintSeed(float seed)
{
SetAttributeValue<float>(7, seed);
}
void CEconItem::SetPaintWear(float wear)
{
SetAttributeValue<float>(8, wear);
}
void CEconItem::SetQuality(ItemQuality quality)
{
auto data = *GetEconItemData();
*GetEconItemData() = data ^ (data ^ 32 * quality) & 0x1E0;
}
void CEconItem::SetRarity(ItemRarity rarity)
{
auto data = *GetEconItemData();
*GetEconItemData() = (data ^ (rarity << 11)) & 0x7800 ^ data;
}
void CEconItem::SetOrigin(int origin)
{
auto data = *GetEconItemData();
*GetEconItemData() = data ^ ((unsigned __int8)data ^ (unsigned __int8)origin) & 0x1F;
}
void CEconItem::SetLevel(int level)
{
auto data = *GetEconItemData();
*GetEconItemData() = data ^ (data ^ (level << 9)) & 0x600;
}
void CEconItem::SetInUse(bool in_use)
{
auto data = *GetEconItemData();
*GetEconItemData() = data & 0x7FFF | (in_use << 15);
}
void CEconItem::SetCustomName(const char* name)
{
static auto Address = Pattern::FindSignature("client.dll", "E8 ? ? ? ? 8B 46 78 C1 E8 0A A8 01 74 13 8B 46 34");
static auto fnSetCustomName
= reinterpret_cast<CEconItem*(__thiscall*)(void*, const char*)>(
*reinterpret_cast<uintptr_t*>(Address + 1) + Address + 5
);
fnSetCustomName(this, name);
}
void CEconItem::SetCustomDesc(const char* name)
{
static auto Address = Pattern::FindSignature("client.dll", "E8 ? ? ? ? 33 DB 39 5E 3C 7E 5E");
static auto fnSetCustomDesc
= reinterpret_cast<CEconItem*(__thiscall*)(void*, const char*)>(
*reinterpret_cast<uintptr_t*>(Address + 1) + Address + 5
);
fnSetCustomDesc(this, name);
}
Код:
void CSharedObjectTypeCache::AddObject(void* obj)
{
typedef void(__thiscall* tOriginal)(void*, void*);
call_vfunc<tOriginal>(this, 1)(this, obj);
}
void CSharedObjectTypeCache::RemoveObject(void* obj)
{
typedef void(__thiscall* tOriginal)(void*, void*);
call_vfunc<tOriginal>(this, 3)(this, obj);
}
std::vector<CEconItem*> CSharedObjectTypeCache::GetEconItems()
{
std::vector<CEconItem*> ret;
auto size = *reinterpret_cast<size_t*>(this + 0x18);
auto data = *reinterpret_cast<uintptr_t**>(this + 0x4);
for (size_t i = 0; i < size; i++)
ret.push_back(reinterpret_cast<CEconItem*>(data[i]));
return ret;
}
Код:
always tradable - 1
cannot trade - 2
referenced item id low - 3
referenced item id high - 4
set item texture prefab - 6
set item texture seed - 7
set item texture wear - 8
has silencer - 10
has burst mode - 13
cycletime when in burst mode - 14
time between burst shots - 15
unzoom after shot - 16
cycletime when zoomed - 17
cannot shoot underwater - 18
in game price - 19
primary clip size - 20
secondary clip size - 21
is full auto - 22
heat per shot - 23
addon scale - 24
tracer frequency - 25
max player speed - 26
max player speed alt - 27
armor ratio - 28
crosshair min distance - 29
crosshair delta distance - 30
penetration - 31
damage - 32
range - 33
range modifier - 34
bullets - 35
cycletime - 36
time to idle - 37
idle interval - 38
flinch velocity modifier large - 39
flinch velocity modifier small - 40
spread - 41
inaccuracy crouch - 42
inaccuracy stand - 43
inaccuracy jump - 44
inaccuracy land - 45
inaccuracy ladder - 46
inaccuracy fire - 47
inaccuracy move - 48
spread alt - 49
inaccuracy crouch alt - 50
inaccuracy stand alt - 51
inaccuracy jump alt - 52
inaccuracy land alt - 53
inaccuracy ladder alt - 54
inaccuracy fire alt - 55
inaccuracy move alt - 56
recovery time crouch - 57
recovery time stand - 58
recoil seed - 59
recoil angle - 60
recoil angle variance - 61
recoil magnitude - 62
recoil magnitude variance - 63
recoil angle alt - 64
recoil angle variance alt - 65
recoil magnitude alt - 66
recoil magnitude variance alt - 67
set supply crate series - 68
minutes played - 69
alternate icon - 70
season access - 71
disallow recycling - 72
upgrade threshold - 73
tradable after date - 75
is revolver - 76
elevate quality - 78
cycletime alt - 79
kill eater - 80
kill eater score type - 81
kill eater user 1 - 82
kill eater user score type 1 - 83
kill eater user 2 - 84
kill eater user score type 2 - 85
kill eater user 3 - 86
kill eater user score type 3 - 87
kill eater 2 - 88
kill eater score type 2 - 89
tracer frequency alt - 92
primary default clip size - 93
secondary default clip size - 94
recipe filter - 95
competitive kills - 97
competitive 3k - 98
competitive 4k - 99
competitive 5k - 101
competitive hsp - 102
competitive wins - 103
competitive mvps - 104
competitive minutes played - 105
match wins - 106
preferred sort - 107
custom name attr - 111
custom desc attr - 112
sticker slot 0 id - 113
sticker slot 0 wear - 114
sticker slot 0 scale - 115
sticker slot 0 rotation - 116
sticker slot 1 id - 117
sticker slot 1 wear - 118
sticker slot 1 scale - 119
sticker slot 1 rotation - 120
sticker slot 2 id - 121
sticker slot 2 wear - 122
sticker slot 2 scale - 123
sticker slot 2 rotation - 124
sticker slot 3 id - 125
sticker slot 3 wear - 126
sticker slot 3 scale - 127
sticker slot 3 rotation - 128
sticker slot 4 id - 129
sticker slot 4 wear - 130
sticker slot 4 scale - 131
sticker slot 4 rotation - 132
sticker slot 5 id - 133
sticker slot 5 wear - 134
sticker slot 5 scale - 135
sticker slot 5 rotation - 136
tournament event id - 137
tournament event stage id - 138
tournament event team0 id - 139
tournament event team1 id - 140
icon display model - 142
buymenu display model - 143
pedestal display model - 144
magazine model - 145
uid model - 146
stattrak model - 147
aimsight capable - 150
aimsight eye pos - 151
aimsight pivot angle - 154
aimsight speed up - 157
aimsight speed down - 158
aimsight looseness - 159
aimsight fov - 160
aimsight pivot forward - 161
gifter account id - 162
aimsight lens mask - 165
music id - 166
quest id - 168
quest points remaining - 169
quest reward lootlist - 170
quests complete - 171
operation kills - 172
operation 3k - 173
operation 4k - 174
operation 5k - 175
operation hsp - 176
operation mvps - 177
operation minutes played - 178
operation wins - 179
deployment date - 180
use after date - 182
expiration date - 183
campaign id - 184
campaign completion bitfield - 185
last campaign completion - 187
operation points - 188
zoom time 0 - 190
zoom time 1 - 191
zoom time 2 - 192
zoom fov 1 - 193
zoom fov 2 - 194
hide view model zoomed - 195
zoom levels - 196
kill award - 197
primary reserve ammo max - 199
secondary reserve ammo max - 200
campaign 1 completion bitfield - 208
campaign 1 last completed quest - 209
campaign 2 completion bitfield - 210
campaign 2 last completed quest - 211
campaign 3 completion bitfield - 212
campaign 3 last completed quest - 213
campaign 4 completion bitfield - 214
campaign 4 last completed quest - 215
campaign 5 completion bitfield - 216
campaign 5 last completed quest - 217
campaign 6 completion bitfield - 218
campaign 6 last completed quest - 219
operation bonus points - 220
prestige year - 221
issue date - 222
tournament mvp account id - 223
campaign 7 completion bitfield - 224
campaign 7 last completed quest - 225
campaign 8 completion bitfield - 226
campaign 8 last completed quest - 227
recovery time crouch final - 228
recovery time stand final - 229
recovery transition start bullet - 230
recovery transition end bullet - 231
sprays remaining - 232
spray tint id - 233
inaccuracy jump initial - 234
campaign 9 completion bitfield - 235
campaign 9 last completed quest - 236
operation drops awarded 1 - 237
operation xp awarded 0 - 238
operation xp awarded 1 - 239
operation drops awarded 0 - 240
attack movespeed factor - 242
allow hand flipping - 243
is melee weapon - 245
model right handed - 246
weapon weight - 247
wrong team msg - 248
itemflag select on empty - 249
itemflag no auto reload - 250
itemflag no auto switch empty - 251
itemflag limit in world - 252
itemflag exhaustible - 253
itemflag do hit location dmg - 254
itemflag no ammo pickups - 255
itemflag no item pickup - 256
inaccuracy reload - 257
throw velocity - 259
bot audible range - 261
rumble effect - 262
inaccuracy pitch shift - 263
inaccuracy alt sound threshold - 264
silencer model - 265
spread seed - 266
Взято с
Пожалуйста, авторизуйтесь для просмотра ссылки.
( Не в коем случае , не реклама )
Последнее редактирование: