Tooltip: port item tooltips, item/name caches and hyperlinks
- CGTooltip::SetItem with section helpers, TooltipItemCallback, Script_SetBagItem, Script_SetInventoryItem, Script_SetHyperlink - DBCache AddItems/DenyItem/Invalidate; NameCache AddItem, reverse name index (non-owning key), NameCache::Copy - ItemLinkInfo::GetItemIdFromLink, CGMerchantInfo::GetRepairCost, CGUnit_C::GetPlayerDiscount, CGEquipmentManager::GetSetList/GetSetByID - item/player/enchant helpers used by the item tooltip - fix SetSpell callers passing the last rank arguments in the wrong order Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
@@ -69,16 +69,6 @@ bool DBCacheIsNullKey(const CWardenKey& key) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// INLINED
|
||||
uint32_t DBCacheHashKey(int32_t key) {
|
||||
return key;
|
||||
}
|
||||
|
||||
// INLINED
|
||||
uint32_t DBCacheHashKey(uint64_t key) {
|
||||
return static_cast<uint32_t>(key);
|
||||
}
|
||||
|
||||
// INLINED
|
||||
uint32_t DBCacheHashKey(const CWardenKey& key) {
|
||||
return key.Hash();
|
||||
|
||||
@@ -43,8 +43,8 @@ class DBCache : public Blizzard::Using::GlobalUse {
|
||||
TSLink<DBCACHEHASH> m_pendingLink;
|
||||
};
|
||||
|
||||
struct REVERSEENTRY : public TSHashObject<REVERSEENTRY, HASHKEY_STRI> {
|
||||
TKey m_id;
|
||||
struct REVERSEENTRY : public TSHashObject<REVERSEENTRY, HASHKEY_CONSTSTR> {
|
||||
T* m_record;
|
||||
};
|
||||
|
||||
/* 0008 */ TSHashTable<DBCACHEHASH, THashKey> m_entries;
|
||||
@@ -60,14 +60,14 @@ class DBCache : public Blizzard::Using::GlobalUse {
|
||||
/* 004C */ uint32_t m_queriesSent;
|
||||
/* 0050 */ uint32_t m_nextQueryTime;
|
||||
/* 0054 */ TSExplicitList<DBCACHEHASH, offsetof(DBCACHEHASH, m_pendingLink)> m_pending;
|
||||
/* 0060 */ TSHashTable<REVERSEENTRY, HASHKEY_STRI> m_reverse;
|
||||
/* 0060 */ TSHashTable<REVERSEENTRY, HASHKEY_CONSTSTR> m_reverse;
|
||||
|
||||
virtual void InvalidateIntKey(int32_t key);
|
||||
|
||||
DBCache(uint32_t signature, const char* fileName, uint32_t queryOpcode, uint32_t multipleQueryOpcode, bool sendRequester, bool enabled, uint32_t queriesPerMinute);
|
||||
~DBCache();
|
||||
void AddItem(T* item, TKey key);
|
||||
void AddItems(CDataStore* msg, bool notify);
|
||||
void AddItems(CDataStore* msg, bool single);
|
||||
void CancelCallback(TKey key, void (*callback)(int32_t id, const WOWGUID& guid, void* param, bool success), void* param);
|
||||
void Clear();
|
||||
void ClearPending();
|
||||
@@ -75,6 +75,9 @@ class DBCache : public Blizzard::Using::GlobalUse {
|
||||
T* GetRecord(TKey key, const WOWGUID& guid, void (*callback)(int32_t id, const WOWGUID& guid, void* param, bool success), void* param, bool unique);
|
||||
void Destroy();
|
||||
void Invalidate(TKey key);
|
||||
REVERSEENTRY* FindReverseEntry(const char* name);
|
||||
T* GetRecordByName(const char* name);
|
||||
void RemoveReverseEntry(const char* name);
|
||||
void ItemAdded(T* item);
|
||||
void Load();
|
||||
void RetryItem(TKey key);
|
||||
@@ -93,11 +96,19 @@ void DBCacheWriteKey(CDataStore& msg, const CWardenKey& key);
|
||||
bool DBCacheIsNullKey(int32_t key);
|
||||
bool DBCacheIsNullKey(uint64_t key);
|
||||
bool DBCacheIsNullKey(const CWardenKey& key);
|
||||
uint32_t DBCacheHashKey(int32_t key);
|
||||
uint32_t DBCacheHashKey(uint64_t key);
|
||||
uint32_t DBCacheHashKey(const CWardenKey& key);
|
||||
void GetCacheDirectory(char* path);
|
||||
|
||||
// INLINED
|
||||
inline uint32_t DBCacheHashKey(int32_t key) {
|
||||
return key;
|
||||
}
|
||||
|
||||
// INLINED
|
||||
inline uint32_t DBCacheHashKey(uint64_t key) {
|
||||
return static_cast<uint32_t>(key);
|
||||
}
|
||||
|
||||
// VERIFY: 8997838f auto
|
||||
// OFFSET: [0x00675C80, 0x00675DB0, 0x00675EE0, 0x00676010, 0x00676140, 0x00676270, 0x006763A0, 0x006764D0, 0x00676600, 0x00676730, 0x00676860, 0x00676990, 0x00676AC0, 0x00676BF0, 0x00676D20]
|
||||
template <class T, class TKey, class THashKey>
|
||||
@@ -473,4 +484,115 @@ void DBCache<T, TKey, THashKey>::VerifyAndUpdateVersion(uint32_t version) {
|
||||
this->m_version = version;
|
||||
}
|
||||
|
||||
// VERIFY: 27b57ae6 manual
|
||||
// OFFSET: [0x0067CBD0]
|
||||
template <class T, class TKey, class THashKey>
|
||||
void DBCache<T, TKey, THashKey>::AddItems(CDataStore* msg, bool single) {
|
||||
uint8_t count;
|
||||
|
||||
if (single) {
|
||||
count = 1;
|
||||
} else {
|
||||
msg->Get(count);
|
||||
|
||||
if (!count) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
bool denied = false;
|
||||
uint32_t id;
|
||||
msg->Get(id);
|
||||
|
||||
if (static_cast<int32_t>(id) < 0) {
|
||||
id &= 0x7FFFFFFF;
|
||||
denied = true;
|
||||
}
|
||||
|
||||
TKey key = id;
|
||||
|
||||
DBCACHEHASH* hash = this->m_entries.Ptr(DBCacheHashKey(key), key);
|
||||
|
||||
if (denied) {
|
||||
if (hash) {
|
||||
hash->m_dispatching = true;
|
||||
|
||||
for (DBCACHECALLBACK* node = hash->m_callbacks.Head(); node;) {
|
||||
DBCACHECALLBACK* next = hash->m_callbacks.Next(node);
|
||||
node->m_callback(key, node->m_guid, node->m_param, false);
|
||||
node = next;
|
||||
}
|
||||
|
||||
hash->m_dispatching = false;
|
||||
this->m_entries.Delete(hash);
|
||||
}
|
||||
} else {
|
||||
if (!hash) {
|
||||
hash = this->m_entries.New(DBCacheHashKey(key), key, 0, 0);
|
||||
}
|
||||
|
||||
hash->m_dispatching = true;
|
||||
hash->m_record.Unpack(msg);
|
||||
hash->m_loaded = true;
|
||||
hash->m_id = key;
|
||||
|
||||
for (DBCACHECALLBACK* node = hash->m_callbacks.Head(); node;) {
|
||||
DBCACHECALLBACK* next = hash->m_callbacks.Next(node);
|
||||
node->m_callback(key, node->m_guid, node->m_param, true);
|
||||
node = next;
|
||||
}
|
||||
|
||||
hash->m_callbacks.Clear();
|
||||
bool invalidate = hash->m_invalidatePending;
|
||||
hash->m_dispatching = false;
|
||||
|
||||
if (invalidate) {
|
||||
this->Invalidate(key);
|
||||
}
|
||||
}
|
||||
} while (--count);
|
||||
}
|
||||
|
||||
// VERIFY: e5e95050 manual
|
||||
// OFFSET: [0x0067A070]
|
||||
template <class T, class TKey, class THashKey>
|
||||
void DBCache<T, TKey, THashKey>::DenyItem(TKey key) {
|
||||
DBCACHEHASH* hash = this->m_entries.Ptr(DBCacheHashKey(key), key);
|
||||
|
||||
if (!hash) {
|
||||
return;
|
||||
}
|
||||
|
||||
hash->m_dispatching = true;
|
||||
|
||||
for (DBCACHECALLBACK* node = hash->m_callbacks.Head(); node;) {
|
||||
DBCACHECALLBACK* next = hash->m_callbacks.Next(node);
|
||||
node->m_callback(static_cast<int32_t>(key), node->m_guid, node->m_param, false);
|
||||
node = next;
|
||||
}
|
||||
|
||||
hash->m_dispatching = false;
|
||||
this->m_entries.Delete(hash);
|
||||
}
|
||||
|
||||
// VERIFY: 80ad7a9d auto
|
||||
// OFFSET: [0x0067A170]
|
||||
template <class T, class TKey, class THashKey>
|
||||
void DBCache<T, TKey, THashKey>::Invalidate(TKey key) {
|
||||
DBCACHEHASH* hash = this->m_entries.Ptr(DBCacheHashKey(key), key);
|
||||
|
||||
if (!hash) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hash->m_loaded) {
|
||||
this->DenyItem(key);
|
||||
} else if (hash->m_dispatching) {
|
||||
hash->m_invalidatePending = true;
|
||||
} else {
|
||||
this->m_entries.Delete(hash);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -517,3 +517,111 @@ void DBCache_ClearTemporaryCaches() {
|
||||
g_danceCache.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
// VERIFY: db411930 manual
|
||||
// OFFSET: 0x0066FFE0
|
||||
template <>
|
||||
DBCache<NameCache, uint64_t, CHashKeyGUID>::REVERSEENTRY* DBCache<NameCache, uint64_t, CHashKeyGUID>::FindReverseEntry(const char* name) {
|
||||
if (this->m_reverse.m_slotmask == 0xFFFFFFFF) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
uint32_t hashval = SStrHashHT(name);
|
||||
TSExplicitList<REVERSEENTRY>& list = this->m_reverse.m_slotlistarray[hashval & this->m_reverse.m_slotmask];
|
||||
|
||||
for (REVERSEENTRY* entry = list.Head(); entry; entry = list.Next(entry)) {
|
||||
if (entry->m_hashval == hashval && (entry->m_key.m_str == name || !SStrCmpUTF8I(entry->m_key.m_str, name, STORM_MAX_STR))) {
|
||||
return entry;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// VERIFY: 4c9eb627 auto
|
||||
// OFFSET: 0x006701F0
|
||||
template <>
|
||||
NameCache* DBCache<NameCache, uint64_t, CHashKeyGUID>::GetRecordByName(const char* name) {
|
||||
REVERSEENTRY* entry = this->FindReverseEntry(name);
|
||||
return entry ? entry->m_record : nullptr;
|
||||
}
|
||||
|
||||
// VERIFY: fd608d3a manual
|
||||
// OFFSET: 0x00678F20
|
||||
template <>
|
||||
void DBCache<NameCache, uint64_t, CHashKeyGUID>::RemoveReverseEntry(const char* name) {
|
||||
REVERSEENTRY* entry = this->FindReverseEntry(name);
|
||||
|
||||
if (!entry) {
|
||||
SErrSetLastError(87);
|
||||
return;
|
||||
}
|
||||
|
||||
this->m_reverse.Delete(entry);
|
||||
}
|
||||
|
||||
// VERIFY: a4de3f42 auto
|
||||
// OFFSET: 0x00680C20
|
||||
template <>
|
||||
void DBCache<NameCache, uint64_t, CHashKeyGUID>::ItemAdded(NameCache* item) {
|
||||
if (this->FindReverseEntry(item->m_name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t hashval = SStrHashHT(item->m_name);
|
||||
REVERSEENTRY* entry = this->m_reverse.InternalNewNode(hashval, 0, 0);
|
||||
entry->m_hashval = hashval;
|
||||
entry->m_key.m_str = item->m_name;
|
||||
entry->m_record = item;
|
||||
}
|
||||
|
||||
// VERIFY: 499cc0d7 auto
|
||||
// OFFSET: 0x0067A430
|
||||
template <>
|
||||
void DBCache<NameCache, uint64_t, CHashKeyGUID>::Invalidate(uint64_t key) {
|
||||
DBCACHEHASH* hash = this->m_entries.Ptr(DBCacheHashKey(key), key);
|
||||
|
||||
if (!hash) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!hash->m_loaded) {
|
||||
this->DenyItem(key);
|
||||
} else if (hash->m_dispatching) {
|
||||
hash->m_invalidatePending = true;
|
||||
} else {
|
||||
this->RemoveReverseEntry(hash->m_record.m_name);
|
||||
this->m_entries.Delete(hash);
|
||||
}
|
||||
}
|
||||
|
||||
// VERIFY: dcddca51 auto
|
||||
// OFFSET: 0x00680C60
|
||||
template <>
|
||||
void DBCache<NameCache, uint64_t, CHashKeyGUID>::AddItem(NameCache* item, uint64_t key) {
|
||||
DBCACHEHASH* hash = this->m_entries.Ptr(DBCacheHashKey(key), key);
|
||||
|
||||
if (!hash) {
|
||||
hash = this->m_entries.New(DBCacheHashKey(key), key, 0, 0);
|
||||
}
|
||||
|
||||
hash->m_dispatching = true;
|
||||
hash->m_record.Copy(*item);
|
||||
hash->m_loaded = true;
|
||||
hash->m_id = key;
|
||||
this->ItemAdded(&hash->m_record);
|
||||
|
||||
for (DBCACHECALLBACK* node = hash->m_callbacks.Head(); node;) {
|
||||
DBCACHECALLBACK* next = hash->m_callbacks.Next(node);
|
||||
node->m_callback(static_cast<int32_t>(key), node->m_guid, node->m_param, true);
|
||||
node = next;
|
||||
}
|
||||
|
||||
hash->m_callbacks.Clear();
|
||||
bool invalidate = hash->m_invalidatePending;
|
||||
hash->m_dispatching = false;
|
||||
|
||||
if (invalidate) {
|
||||
this->Invalidate(key);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,21 @@ extern DBCache<DanceCache, int32_t, HASHKEY_INT> g_danceCache;
|
||||
template <>
|
||||
void DBCache<NameCache, uint64_t, CHashKeyGUID>::ItemAdded(NameCache* item);
|
||||
|
||||
template <>
|
||||
void DBCache<NameCache, uint64_t, CHashKeyGUID>::Invalidate(uint64_t key);
|
||||
|
||||
template <>
|
||||
DBCache<NameCache, uint64_t, CHashKeyGUID>::REVERSEENTRY* DBCache<NameCache, uint64_t, CHashKeyGUID>::FindReverseEntry(const char* name);
|
||||
|
||||
template <>
|
||||
NameCache* DBCache<NameCache, uint64_t, CHashKeyGUID>::GetRecordByName(const char* name);
|
||||
|
||||
template <>
|
||||
void DBCache<NameCache, uint64_t, CHashKeyGUID>::RemoveReverseEntry(const char* name);
|
||||
|
||||
template <>
|
||||
void DBCache<NameCache, uint64_t, CHashKeyGUID>::AddItem(NameCache* item, uint64_t key);
|
||||
|
||||
void DBCache_ClearHandlers();
|
||||
void DBCache_Destroy();
|
||||
void DBCache_Idle();
|
||||
|
||||
@@ -62,6 +62,7 @@ class WowClientDB : public WowClientDB_Common<T>, public IDatabase<T> {
|
||||
T* GetRecord(int32_t id) const override;
|
||||
|
||||
WowClientDB();
|
||||
T* GetRecordByIndex(int32_t index) const;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
@@ -450,4 +451,15 @@ int32_t WowClientDB_RLE<T>::GetRecord(int32_t id, T* rec) const {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// VERIFY: 040a5e1f auto
|
||||
// OFFSET: [0x004D8580, 0x00514030]
|
||||
template <class T>
|
||||
T* WowClientDB<T>::GetRecordByIndex(int32_t index) const {
|
||||
if (index < 0 || index >= this->m_numRecords) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return &this->m_records[index];
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -37,6 +37,29 @@ void NameCache::Pack(CDataStore* msg) {
|
||||
msg->Put(this->m_class);
|
||||
}
|
||||
|
||||
// VERIFY: c6bdf007 manual
|
||||
// OFFSET: 0x006680C0
|
||||
NameCache& NameCache::Copy(const NameCache& other) {
|
||||
this->m_guid = other.m_guid;
|
||||
SStrCopy(this->m_name, other.m_name, sizeof(this->m_name));
|
||||
|
||||
if (other.m_declinedNames) {
|
||||
if (!this->m_declinedNames) {
|
||||
this->m_declinedNames = static_cast<NameCache::DeclinedNames*>(SMemAlloc(sizeof(NameCache::DeclinedNames), __FILE__, __LINE__, 0));
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < sizeof(this->m_declinedNames->m_names) / sizeof(this->m_declinedNames->m_names[0]); i++) {
|
||||
SStrCopy(this->m_declinedNames->m_names[i], other.m_declinedNames->m_names[i], sizeof(this->m_declinedNames->m_names[i]));
|
||||
}
|
||||
}
|
||||
|
||||
SStrCopy(this->m_realmName, other.m_realmName, sizeof(this->m_realmName));
|
||||
this->m_race = other.m_race;
|
||||
this->m_sex = other.m_sex;
|
||||
this->m_class = other.m_class;
|
||||
return *this;
|
||||
}
|
||||
|
||||
// VERIFY: d7e9cfe1 manual
|
||||
// OFFSET: 0x007F74A0
|
||||
void NameCache::Unpack(CDataStore* msg) {
|
||||
|
||||
@@ -26,6 +26,7 @@ class NameCache {
|
||||
|
||||
NameCache();
|
||||
~NameCache();
|
||||
NameCache& Copy(const NameCache& other);
|
||||
void Pack(CDataStore* msg);
|
||||
void Unpack(CDataStore* msg);
|
||||
char* FullName(char* buffer, uint32_t size);
|
||||
|
||||
@@ -3404,3 +3404,19 @@ int32_t Spell_C_GetMinMaxPoints(const SpellRec* spell, uint32_t effectIndex, int
|
||||
*maxPoints = CMath::ftrunc(high);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// VERIFY: 3cc995d6 auto
|
||||
// OFFSET: 0x007FD630
|
||||
int32_t Spell_C_GetTargetingSpell() {
|
||||
return s_targetingSpell ? s_targetingSpell->m_data.m_spellId : 0;
|
||||
}
|
||||
|
||||
// VERIFY: 8d996461 auto
|
||||
// OFFSET: 0x008090C0
|
||||
bool Spell_C_GetItemCooldown(CGItem_C* item, uint32_t* duration, uint32_t* start, uint32_t* enable) {
|
||||
if (!item) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return s_spellHistory[0].GetSpellCooldown(item->GetEnchantmentSpell(0), item->m_obj->m_entryID, duration, start, enable);
|
||||
}
|
||||
|
||||
@@ -215,6 +215,8 @@ void Spell_C_GetMinMaxPoints(const SpellRec* spell, uint32_t effectIndex, float*
|
||||
void Spell_C_GetMinMaxRange(CGUnit_C* caster, const SpellRec* spell, float* minRange, float* maxRange, int32_t friendly, CGObject_C* target);
|
||||
int32_t Spell_C_GetDuration(const SpellRec* spell, int32_t isPet, int32_t isUnit, int32_t noModifiers, int32_t applyHaste);
|
||||
bool Spell_C_HasNoReagentCost(CGPlayer_C* player, const SpellRec* spell);
|
||||
int32_t Spell_C_GetTargetingSpell();
|
||||
bool Spell_C_GetItemCooldown(CGItem_C* item, uint32_t* duration, uint32_t* start, uint32_t* enable);
|
||||
void Spell_C_SpellFailed(PendingSpellCast* cast, const SpellRec* spell, int32_t reason, int32_t a4, int32_t a5, bool a6);
|
||||
int32_t Spell_C_CastSpell(CGUnit_C* caster, int32_t spellId, const CGItem_C* item, WOWGUID target, PendingSpellCast* cast, bool a6);
|
||||
void UnitCombatLogCastStart(const WOWGUID& caster, const WOWGUID& target, int32_t spellId);
|
||||
|
||||
@@ -21,6 +21,9 @@ class CGItem {
|
||||
virtual uint32_t GetItemStaticFlags(int32_t a1) = 0;
|
||||
|
||||
int32_t IsUsable() const;
|
||||
uint32_t GetDurability() const;
|
||||
uint32_t GetMaxDurability() const;
|
||||
int32_t GetPetitionSignatures();
|
||||
};
|
||||
|
||||
struct ItemEnchantment {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "Engine/Source/Tempest/CImVector.h"
|
||||
#include "Engine/Source/FrameScript/FrameScript.h"
|
||||
#include "Engine/Source/Storm/H/storm.h"
|
||||
#include "Engine/Source/Tempest/CMath.h"
|
||||
#include "WoW/Source/DB/DBClient/DBCacheInstances.h"
|
||||
#include "WoW/Source/DB/DBClient/DBClient.h"
|
||||
#include "WoW/Source/DB/Rec/ItemRandomPropertiesRec.h"
|
||||
@@ -19,6 +20,11 @@
|
||||
#include "WoW/Source/Object/ItemStats.h"
|
||||
#include "WoW/Source/ObjectMgrClient/ObjectMgrClient.h"
|
||||
#include "WoW/Common/ComponentCore/CharacterComponent.h"
|
||||
#include "WoW/Source/DB/Rec/DurabilityCostsRec.h"
|
||||
#include "WoW/Source/DB/Rec/DurabilityQualityRec.h"
|
||||
#include "WoW/Source/DB/Rec/LockRec.h"
|
||||
#include "WoW/Source/DB/Rec/SpellRec.h"
|
||||
#include "WoW/Source/Magic/MagicClient/Spell_C.h"
|
||||
#include "WoW/Source/Object/ObjectClient/Player_C.h"
|
||||
#include "WoW/Source/Object/ObjectClient/Unit_C.h"
|
||||
#include "WoW/Source/Ui/ActionBarFrame.h"
|
||||
@@ -28,6 +34,7 @@
|
||||
#include "WoW/Source/Ui/PaperDollInfoFrame.h"
|
||||
#include "WoW/Source/Ui/QuestLog.h"
|
||||
#include "WoW/Source/Ui/ScriptEvents.h"
|
||||
#include "WoW/Source/Ui/SpellBookFrame.h"
|
||||
#include "WoW/Source/Ui/TradeFrame.h"
|
||||
#include "WoW/Source/Ui/TradeSkillFrame.h"
|
||||
#include "WoW/Source/WorldClient/FrameTime.h"
|
||||
@@ -1095,3 +1102,276 @@ const char* CGItem_C::GetInventoryArt() const {
|
||||
|
||||
return CGItem_C::GetInventoryArt(0);
|
||||
}
|
||||
|
||||
// VERIFY: 61c58006 manual
|
||||
// OFFSET: 0x00584AC0
|
||||
uint32_t CGItem::GetDurability() const {
|
||||
if (this->m_item->m_itemFieldFlags & 8) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return this->m_item->m_itemFieldDurability;
|
||||
}
|
||||
|
||||
// VERIFY: e00bdbda manual
|
||||
// OFFSET: 0x00584AE0
|
||||
uint32_t CGItem::GetMaxDurability() const {
|
||||
if (this->m_item->m_itemFieldFlags & 8) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return this->m_item->m_itemFieldMaxdurability;
|
||||
}
|
||||
|
||||
// VERIFY: d3247ea5 manual
|
||||
// OFFSET: 0x0061DC90
|
||||
int32_t CGItem::GetPetitionSignatures() {
|
||||
if (this->GetItemStaticFlags(0) & 0x2000) {
|
||||
return this->m_item->m_itemFieldEnchantment[0].m_duration;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// VERIFY: 5cea77df manual
|
||||
// OFFSET: 0x00707650
|
||||
int32_t CGItem_C::GetRandomPropertyValue(int32_t slot, int32_t randomPropertiesId, int32_t points) {
|
||||
float value = 0.0f;
|
||||
|
||||
if (randomPropertiesId < 0) {
|
||||
ItemRandomSuffixRec* suffix = g_itemRandomSuffixDB.GetRecord(-randomPropertiesId);
|
||||
uint32_t index = slot - 7;
|
||||
|
||||
if (suffix && static_cast<int32_t>(index) >= 0 && index < 5) {
|
||||
value = suffix->m_allocationPct[index] * 0.0001f * points;
|
||||
}
|
||||
}
|
||||
|
||||
return CMath::ftrunc(value);
|
||||
}
|
||||
|
||||
// VERIFY: bf61ad32 manual
|
||||
// OFFSET: 0x00707C60
|
||||
int32_t CGItem_C::GetEnchantmentSpell(int32_t effect) {
|
||||
SpellRec spell;
|
||||
int32_t spellId = 0;
|
||||
ItemStats_C* stats = g_itemDBCache.GetRecord(this->m_obj->m_entryID, WOWGUID{ 0 }, nullptr, nullptr, false);
|
||||
|
||||
if (!stats) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < 5; i++) {
|
||||
if (!stats->m_spellId[i] || stats->m_spellTrigger[i]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
bool match = !effect;
|
||||
|
||||
if (!match && g_spellDB.GetRecord(stats->m_spellId[i], &spell)) {
|
||||
for (uint32_t j = 0; j < 3; j++) {
|
||||
if (spell.m_effect[j] == effect) {
|
||||
match = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (match) {
|
||||
spellId = stats->m_spellId[i];
|
||||
|
||||
if (spellId) {
|
||||
return spellId;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t slot = 0; slot < 12; slot++) {
|
||||
SpellItemEnchantmentRec* enchant = g_spellItemEnchantmentDB.GetRecord(this->m_item->m_itemFieldEnchantment[slot].m_id);
|
||||
|
||||
if (enchant) {
|
||||
for (uint32_t i = 0; i < 3; i++) {
|
||||
if (enchant->m_effect[i] == 7) {
|
||||
spellId = enchant->m_effectArg[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (spellId) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return spellId;
|
||||
}
|
||||
|
||||
// VERIFY: 24e20657 manual
|
||||
// OFFSET: 0x00708540
|
||||
int32_t CGItem_C::GetRepairCost() {
|
||||
ItemStats_C* stats = g_itemDBCache.GetRecord(this->m_obj->m_entryID, WOWGUID{ 0 }, nullptr, nullptr, false);
|
||||
|
||||
if (!stats) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
CGItemData* item = this->m_item;
|
||||
|
||||
if ((item->m_itemFieldFlags & 8) || !item->m_itemFieldMaxdurability) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t durability = (item->m_itemFieldFlags & 8) ? 0 : item->m_itemFieldDurability;
|
||||
|
||||
if ((item->m_itemFieldFlags & 8) || durability >= item->m_itemFieldMaxdurability) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
DurabilityCostsRec* costs = g_durabilityCostsDB.GetRecord(stats->m_itemLevel);
|
||||
|
||||
if (!costs) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t itemClass = this->GetClassID();
|
||||
|
||||
if (itemClass != 2 && itemClass != 4) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t subClass = this->GetSubtypeID();
|
||||
int32_t cost;
|
||||
|
||||
if (itemClass == 2) {
|
||||
if (subClass > 21) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
cost = costs->m_weaponSubClassCost[subClass];
|
||||
} else {
|
||||
if (itemClass != 4 || subClass > 8) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
cost = costs->m_armorSubClassCost[subClass];
|
||||
}
|
||||
|
||||
DurabilityQualityRec* quality = g_durabilityQualityDB.GetRecordByIndex(2 * stats->m_quality + 1);
|
||||
|
||||
if (!quality) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t lost = this->GetMaxDurability() - this->GetDurability();
|
||||
int32_t result = CMath::fint_n(lost * quality->m_data * cost);
|
||||
return result ? result : 1;
|
||||
}
|
||||
|
||||
// VERIFY: 84e69779 manual
|
||||
// OFFSET: 0x007086B0
|
||||
int32_t CGItem_C::IsLocked(const LockRec* lock, int32_t itemLevel, int32_t* spellId, int32_t* skillValue, int32_t* requiredSkill, int32_t* lockIndex, CGItem_C** key, int32_t* entry) {
|
||||
int32_t locked = 0;
|
||||
SpellRec spell;
|
||||
|
||||
for (int32_t i = 0; i < 8; i++) {
|
||||
int32_t type = lock->m_type[i];
|
||||
|
||||
if (!type) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (type == 2) {
|
||||
locked = 1;
|
||||
|
||||
for (uint32_t j = 0; j < s_openLockSpells.m_count; j++) {
|
||||
g_spellDB.GetRecord(s_openLockSpells.m_data[j], &spell);
|
||||
|
||||
for (uint32_t effect = 0; effect < 3; effect++) {
|
||||
if (spell.m_effect[effect] != 33 || spell.m_effectMiscValue[effect] != lock->m_index[i]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int32_t required = lock->m_skill[i] ? lock->m_skill[i] : 5 * itemLevel;
|
||||
int32_t minPoints;
|
||||
int32_t maxPoints;
|
||||
Spell_C_GetMinMaxPoints(&spell, effect, &minPoints, &maxPoints, 0, 0, 0, 0);
|
||||
|
||||
if (spellId) {
|
||||
*spellId = s_openLockSpells.m_data[j];
|
||||
}
|
||||
|
||||
if (skillValue) {
|
||||
*skillValue = minPoints;
|
||||
}
|
||||
|
||||
if (requiredSkill) {
|
||||
*requiredSkill = required;
|
||||
}
|
||||
|
||||
if (lockIndex) {
|
||||
*lockIndex = lock->m_index[i];
|
||||
}
|
||||
|
||||
if (minPoints >= required) {
|
||||
if (entry) {
|
||||
*entry = i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (type == 3) {
|
||||
locked = 1;
|
||||
|
||||
g_spellDB.GetRecord(lock->m_index[i], &spell);
|
||||
|
||||
for (uint32_t effect = 0; effect < 3; effect++) {
|
||||
if (spell.m_effect[effect] == 33) {
|
||||
if (spellId) {
|
||||
*spellId = spell.m_id;
|
||||
}
|
||||
|
||||
if (entry) {
|
||||
*entry = i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
} else if (type == 1) {
|
||||
CGPlayer_C* player = static_cast<CGPlayer_C*>(ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPEMASK_PLAYER, __FILE__, __LINE__));
|
||||
|
||||
if (player) {
|
||||
locked = 1;
|
||||
CGItem_C* item = player->m_bag.FindItemOfType(lock->m_index[i], 0);
|
||||
|
||||
if (item) {
|
||||
if (spellId) {
|
||||
*spellId = item->GetEnchantmentSpell(0);
|
||||
}
|
||||
|
||||
if (key) {
|
||||
*key = item;
|
||||
}
|
||||
|
||||
if (entry) {
|
||||
*entry = i;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return locked;
|
||||
}
|
||||
|
||||
// VERIFY: bb164cd0 auto
|
||||
// OFFSET: 0x007089B0
|
||||
int32_t CGItem_C::GetRandomPropertyValue(int32_t slot) {
|
||||
return CGItem_C::GetRandomPropertyValue(slot, this->m_item->m_itemFieldRandomPropertiesId, this->GetRandomPropertyPoints());
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
class CClientObjCreate;
|
||||
class CImVector;
|
||||
class ItemStats_C;
|
||||
class LockRec;
|
||||
|
||||
struct INVENTORYART : public TSHashObject<INVENTORYART, HASHKEY_NONE> {
|
||||
/* 0018 */ char* m_texture;
|
||||
@@ -84,6 +85,10 @@ class CGItem_C : public CGObject_C, public CGItem {
|
||||
bool IsBound();
|
||||
void Unlock();
|
||||
static int32_t GetUseSpell(int32_t itemId);
|
||||
static int32_t GetRandomPropertyValue(int32_t slot, int32_t randomPropertiesId, int32_t points);
|
||||
static int32_t IsLocked(const LockRec* lock, int32_t itemLevel, int32_t* spellId, int32_t* skillValue, int32_t* requiredSkill, int32_t* lockIndex, CGItem_C** key, int32_t* entry);
|
||||
int32_t GetRandomPropertyValue(int32_t slot);
|
||||
int32_t GetRepairCost();
|
||||
int32_t GetEnchantmentSpell(int32_t a1);
|
||||
void GetSpellCooldownInfo(uint32_t& cooldown, uint32_t& categoryCooldown, uint32_t& category);
|
||||
bool IsBoundForTrade();
|
||||
|
||||
@@ -45,6 +45,8 @@
|
||||
#include "WoW/Source/Ui/ActionBarFrame.h"
|
||||
#include "WoW/Source/Ui/BarberShop.h"
|
||||
#include "Engine/Source/Os/TimeManager.h"
|
||||
#include "WoW/Source/DB/Rec/GemPropertiesRec.h"
|
||||
#include "WoW/Source/DB/Rec/ItemSetRec.h"
|
||||
#include "WoW/Source/Ui/ClassTrainerFrame.h"
|
||||
#include "WoW/Source/Ui/CommentatorFrame.h"
|
||||
#include "WoW/Source/Ui/GuildBankFrame.h"
|
||||
@@ -68,6 +70,7 @@
|
||||
#include <ctime>
|
||||
#include "WoW/Source/Object/GameObject.h"
|
||||
#include "WoW/Source/DB/Rec/LockRec.h"
|
||||
#include "WoW/Source/DB/Rec/SpellItemEnchantmentRec.h"
|
||||
#include "WoW/Source/WowSvcs/WowSvcsClient/FriendList.h"
|
||||
#include "_Triage/AreaList.h"
|
||||
|
||||
@@ -82,10 +85,6 @@ struct InitialSpellStruct {
|
||||
/* 0006 */ uint16_t unk_0006;
|
||||
};
|
||||
|
||||
struct InspectData {
|
||||
/* 0000 */ uint8_t unk_0000[1368];
|
||||
};
|
||||
|
||||
// STATIC: 0x00C9D33C
|
||||
static int32_t s_unk_C9D33C;
|
||||
|
||||
@@ -143,6 +142,9 @@ static WOWGUID s_giftWrapItem;
|
||||
// STATIC: 0x00C9EAE0
|
||||
static InspectData* s_inspectData;
|
||||
|
||||
// STATIC: 0x00C9EC78
|
||||
static InspectItem s_emptyInspectItem;
|
||||
|
||||
// STATIC: 0x00C9EAE4
|
||||
uint32_t CGPlayer_C::s_lastUpdatePVPSequence;
|
||||
|
||||
@@ -1098,6 +1100,12 @@ int32_t Packet_SMSG_SET_PROFICIENCY(void* param, NETMESSAGE msgId, uint32_t time
|
||||
return 1;
|
||||
}
|
||||
|
||||
// VERIFY: dfb6fe0a manual
|
||||
// OFFSET: 0x006CEB00
|
||||
bool CGPlayer_C::CanDualWield() {
|
||||
return s_dualWieldSpell != 0;
|
||||
}
|
||||
|
||||
// VERIFY: 37ec0ce6 auto
|
||||
// OFFSET: 0x006CED80
|
||||
int32_t __stdcall CGPlayer_C::OnLootItemNotify(CDataStore* msg) {
|
||||
@@ -2456,7 +2464,7 @@ void __stdcall CGPlayer_C::ClearAFK(int32_t force) {
|
||||
ClientServices::Send2(&msg);
|
||||
}
|
||||
|
||||
// VERIFY: 113486d4 manual
|
||||
// VERIFY: f4bf6af2 manual
|
||||
// OFFSET: 0x006E6B40
|
||||
CGPlayer_C::CGPlayer_C(uint32_t time, const CClientObjCreate& create)
|
||||
: CGUnit_C(time, create),
|
||||
@@ -2492,10 +2500,10 @@ CGPlayer_C::CGPlayer_C(uint32_t time, const CClientObjCreate& create)
|
||||
|
||||
this->m_combatModeTime = FrameTime::s_curTimeMs - 500;
|
||||
this->m_pvpCooldownTimestamp = 0;
|
||||
this->unk_1924[0] = 0;
|
||||
this->unk_1924[1] = 0;
|
||||
this->unk_1924[2] = 0;
|
||||
this->unk_1924[3] = 0;
|
||||
this->m_gemCounts[0] = 0;
|
||||
this->m_gemCounts[1] = 0;
|
||||
this->m_gemCounts[2] = 0;
|
||||
this->m_gemCounts[3] = 0;
|
||||
this->unk_1944 = 0;
|
||||
this->unk_1948 = 0;
|
||||
|
||||
@@ -4525,3 +4533,140 @@ float CGPlayer_C::GetModDamageDonePct(int32_t school) const {
|
||||
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
// VERIFY: 68b495c6 manual
|
||||
// OFFSET: 0x006DC550
|
||||
bool CGPlayer_C::MeetsItemSetSkill(const ItemSetRec* set) const {
|
||||
if (set->m_requiredSkill) {
|
||||
int32_t index = this->GetSkillIndex(set->m_requiredSkill);
|
||||
|
||||
if (index < 0 || static_cast<int32_t>(this->GetSkillValue(index)) < set->m_requiredSkillRank) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// VERIFY: 95312415 manual
|
||||
// OFFSET: 0x006DE360
|
||||
InspectItem* CGPlayer_C::GetInspectedItem(int32_t slot) {
|
||||
if (s_inspectData && s_inspectData->m_guid == this->m_obj->m_guid) {
|
||||
if (slot < 0) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (static_cast<uint32_t>(slot) < 19) {
|
||||
return &s_inspectData->m_items[slot];
|
||||
}
|
||||
}
|
||||
|
||||
if (slot < 0 || static_cast<uint32_t>(slot) >= 19) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
VisibleItem_C* visible = &this->m_player->m_playerVisibleItems[slot];
|
||||
|
||||
if (!visible) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
memset(&s_emptyInspectItem, 0, sizeof(s_emptyInspectItem));
|
||||
s_emptyInspectItem.m_itemId = abs(visible->m_itemId);
|
||||
s_emptyInspectItem.m_enchants[0] = visible->m_enchantment[0];
|
||||
s_emptyInspectItem.m_enchants[1] = visible->m_enchantment[1];
|
||||
|
||||
if (visible->m_itemId <= 0) {
|
||||
s_emptyInspectItem.m_flags |= 1;
|
||||
}
|
||||
|
||||
return &s_emptyInspectItem;
|
||||
}
|
||||
|
||||
// VERIFY: bd15a857 manual
|
||||
// OFFSET: 0x006DE490
|
||||
static void CountGemsItemCacheCallback(int32_t id, const WOWGUID& guid, void* param, bool success) {
|
||||
if (!success) {
|
||||
return;
|
||||
}
|
||||
|
||||
CGPlayer_C* player = static_cast<CGPlayer_C*>(ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPEMASK_PLAYER, __FILE__, __LINE__));
|
||||
|
||||
if (player) {
|
||||
player->CountEquippedGems();
|
||||
}
|
||||
}
|
||||
|
||||
// VERIFY: 456c3dda manual
|
||||
// OFFSET: 0x006DE4D0
|
||||
void CGPlayer_C::CountEquippedGems() {
|
||||
this->m_gemCounts[0] = 0;
|
||||
this->m_gemCounts[1] = 0;
|
||||
this->m_gemCounts[2] = 0;
|
||||
this->m_gemCounts[3] = 0;
|
||||
|
||||
for (uint32_t slot = 0; slot <= 18; slot++) {
|
||||
CGItem_C* item = nullptr;
|
||||
InspectItem* inspect = nullptr;
|
||||
|
||||
if (ClntObjMgrGetActivePlayer() == this->m_obj->m_guid) {
|
||||
item = this->m_bag.GetItemPointer(slot);
|
||||
|
||||
if (!item || !item->IsUsable()) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
inspect = this->GetInspectedItem(slot);
|
||||
|
||||
if (!inspect || !(inspect->m_flags & 1)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t socket = 2; socket <= 4; socket++) {
|
||||
int32_t enchantId;
|
||||
|
||||
if (ClntObjMgrGetActivePlayer() == this->m_obj->m_guid) {
|
||||
enchantId = (item->GetItemStaticFlags(0) & 0x2000) ? 0 : item->m_item->m_itemFieldEnchantment[socket].m_id;
|
||||
} else if (socket <= 11) {
|
||||
enchantId = inspect->m_enchants[socket];
|
||||
} else {
|
||||
enchantId = 0;
|
||||
}
|
||||
|
||||
SpellItemEnchantmentRec* enchant = g_spellItemEnchantmentDB.GetRecord(enchantId);
|
||||
|
||||
if (!enchant || !enchant->m_srcItemID) {
|
||||
continue;
|
||||
}
|
||||
|
||||
ItemStats_C* gem = g_itemDBCache.GetRecord(enchant->m_srcItemID, WOWGUID{ 0 }, &CountGemsItemCacheCallback, nullptr, false);
|
||||
|
||||
if (!gem) {
|
||||
continue;
|
||||
}
|
||||
|
||||
GemPropertiesRec* properties = g_gemPropertiesDB.GetRecord(gem->m_gemProperties);
|
||||
|
||||
if (!properties || !properties->m_type) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (properties->m_type & 1) {
|
||||
this->m_gemCounts[0]++;
|
||||
}
|
||||
|
||||
if (properties->m_type & 2) {
|
||||
this->m_gemCounts[1]++;
|
||||
}
|
||||
|
||||
if (properties->m_type & 4) {
|
||||
this->m_gemCounts[2]++;
|
||||
}
|
||||
|
||||
if (properties->m_type & 8) {
|
||||
this->m_gemCounts[3]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,23 @@ class CreatureModelDataRec;
|
||||
class SpellRec;
|
||||
class SpellVisualKitRec;
|
||||
|
||||
struct InspectItem {
|
||||
/* 0000 */ WOWGUID m_creator;
|
||||
/* 0008 */ int32_t m_itemId;
|
||||
/* 000C */ int32_t m_enchants [12];
|
||||
/* 003C */ int16_t m_randomPropertiesId;
|
||||
/* 003E */ uint16_t m_flags;
|
||||
/* 0040 */ uint32_t m_propertySeed;
|
||||
/* 0044 */ uint32_t unk_0044;
|
||||
};
|
||||
|
||||
struct InspectData {
|
||||
/* 0000 */ WOWGUID m_guid;
|
||||
/* 0008 */ InspectItem m_items [19];
|
||||
};
|
||||
|
||||
class ItemSetRec;
|
||||
|
||||
struct ITEMSWAP {
|
||||
/* 0000 */ WOWGUID m_guid;
|
||||
/* 0008 */ uint32_t unk_0008 [6];
|
||||
@@ -85,6 +102,7 @@ class CGPlayer_C : public CGUnit_C, public CGPlayer {
|
||||
static const char* GetHairCustomizationName();
|
||||
static uint32_t GetPendingMovie();
|
||||
static uint32_t GetProficiency(uint8_t itemClass);
|
||||
static bool CanDualWield();
|
||||
static void __stdcall GetQuestReward(const WOWGUID& questGiver, int32_t questId, int32_t reward);
|
||||
static void __stdcall GiveQuestItems(const WOWGUID& questGiver, int32_t questId);
|
||||
static int32_t IsGiftWrapping();
|
||||
@@ -163,7 +181,7 @@ class CGPlayer_C : public CGUnit_C, public CGPlayer {
|
||||
/* 18F0 */ CGBag_C m_bag;
|
||||
/* 1908 */ uint32_t unk_1908 [6];
|
||||
/* 1920 */ uint32_t m_clientStandState;
|
||||
/* 1924 */ uint32_t unk_1924 [4];
|
||||
/* 1924 */ int32_t m_gemCounts [4];
|
||||
/* 1934 */ uint32_t m_combatModeTime;
|
||||
/* 1938 */ WOWGUID m_combatTarget;
|
||||
/* 1940 */ uint32_t m_pvpCooldownTimestamp;
|
||||
@@ -218,6 +236,8 @@ class CGPlayer_C : public CGUnit_C, public CGPlayer {
|
||||
uint32_t GetSkillValue(int32_t index) const;
|
||||
const VisibleItem_C* GetVisibleItem(int32_t slot) const;
|
||||
int32_t GetModDamageDonePos(int32_t school) const;
|
||||
bool MeetsItemSetSkill(const ItemSetRec* set) const;
|
||||
InspectItem* GetInspectedItem(int32_t slot);
|
||||
int32_t GetModDamageDoneNeg(int32_t school) const;
|
||||
float GetModDamageDonePct(int32_t school) const;
|
||||
const CGItem_C* EquippedItemMeetSpellRequirements(const SpellRec* spell, uint32_t slotMask);
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
#include "WoW/Source/DB/Rec/VehicleSeatRec.h"
|
||||
#include "WoW/Source/DB/Rec/CreatureMovementInfoRec.h"
|
||||
#include "WoW/Source/DB/Rec/ItemDisplayInfoRec.h"
|
||||
#include "WoW/Source/DB/Rec/FactionRec.h"
|
||||
#include "WoW/Source/DB/Rec/FactionTemplateRec.h"
|
||||
#include "WoW/Source/DB/Rec/AreaTableRec.h"
|
||||
#include "WoW/Source/DB/Rec/AreaGroupRec.h"
|
||||
@@ -2957,6 +2958,39 @@ int32_t CGUnit_C::UnitReaction(const CGUnit_C* unit) const {
|
||||
return reaction;
|
||||
}
|
||||
|
||||
// VERIFY: 5eefb777 auto
|
||||
// OFFSET: 0x007279A0
|
||||
float CGUnit_C::GetPlayerDiscount(const CGUnit_C* unit) const {
|
||||
FactionTemplateRec* factionTemplate = g_factionTemplateDB.GetRecord(this->m_unit->m_unitFieldFactiontemplate);
|
||||
|
||||
if (!factionTemplate) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
FactionRec* faction = g_factionDB.GetRecord(factionTemplate->m_faction);
|
||||
|
||||
if (!faction || faction->m_reputationIndex < 0) {
|
||||
return 0.0f;
|
||||
}
|
||||
|
||||
switch (this->UnitReaction(unit)) {
|
||||
case 4:
|
||||
return 0.05f;
|
||||
|
||||
case 5:
|
||||
return 0.1f;
|
||||
|
||||
case 6:
|
||||
return 0.15f;
|
||||
|
||||
case 7:
|
||||
return 0.2f;
|
||||
|
||||
default:
|
||||
return 0.0f;
|
||||
}
|
||||
}
|
||||
|
||||
// VERIFY: 7c461897 auto
|
||||
// OFFSET: 0x00514050
|
||||
bool CGUnit_C::IsFriendly(const CGUnit_C* unit) const {
|
||||
|
||||
@@ -798,6 +798,7 @@ class CGUnit_C : public CGObject_C, public CGUnit {
|
||||
void UpdatePartyMemberPetState();
|
||||
void ExecuteClientControlUpdate(WOWGUID guid, uint8_t state);
|
||||
int32_t UnitReaction(const CGUnit_C* unit) const;
|
||||
float GetPlayerDiscount(const CGUnit_C* unit) const;
|
||||
void SetAttacking(WOWGUID guid);
|
||||
void UpdateObjectEffectMovementStates();
|
||||
void DestroyUnitMount(int32_t a2);
|
||||
|
||||
+3398
-36
File diff suppressed because it is too large
Load Diff
+62
-30
@@ -3,6 +3,7 @@
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
#include "Engine/Source/Base/CDataAllocator.h"
|
||||
#include "Engine/Source/Frame/CSimpleFrame.h"
|
||||
#include "Engine/Source/FrameScript/FrameScript_Object.h"
|
||||
@@ -24,27 +25,26 @@ class ItemLinkInfo {
|
||||
public:
|
||||
/* 0000 */ uint32_t m_itemId;
|
||||
/* 0004 */ uint32_t m_enchants [12];
|
||||
/* 0034 */ uint32_t m_gems [12];
|
||||
/* 0064 */ uint32_t m_gemEnchants [12];
|
||||
/* 0094 */ uint32_t unk_0094;
|
||||
/* 0098 */ uint32_t unk_0098;
|
||||
/* 0034 */ uint32_t m_enchantDurations [12];
|
||||
/* 0064 */ int32_t m_enchantCharges [12];
|
||||
/* 0094 */ uint32_t m_cooldown;
|
||||
/* 0098 */ int32_t m_proposedEnchant;
|
||||
/* 009C */ uint32_t unk_009C;
|
||||
/* 00A0 */ uint32_t unk_00A0;
|
||||
/* 00A4 */ uint32_t unk_00A4;
|
||||
/* 00A8 */ uint32_t unk_00A8;
|
||||
/* 00AC */ uint32_t unk_00AC;
|
||||
/* 00B0 */ uint32_t unk_00B0;
|
||||
/* 00B4 */ uint32_t unk_00B4;
|
||||
/* 00B8 */ int32_t unk_00B8;
|
||||
/* 00BC */ uint32_t unk_00BC;
|
||||
/* 00C0 */ uint32_t unk_00C0;
|
||||
/* 00C4 */ uint32_t unk_00C4;
|
||||
/* 00C8 */ uint32_t unk_00C8;
|
||||
/* 00CC */ uint32_t unk_00CC;
|
||||
/* 00D0 */ uint32_t unk_00D0;
|
||||
/* 00D4 */ int32_t unk_00D4;
|
||||
/* 00A0 */ WOWGUID m_creator;
|
||||
/* 00A8 */ WOWGUID m_giftCreator;
|
||||
/* 00B0 */ uint32_t m_propertySeed;
|
||||
/* 00B4 */ int32_t m_randomPropertiesId;
|
||||
/* 00B8 */ int32_t m_spellCharges;
|
||||
/* 00BC */ uint32_t m_wrapped;
|
||||
/* 00C0 */ uint32_t m_lockId;
|
||||
/* 00C4 */ uint32_t m_maxDurability;
|
||||
/* 00C8 */ uint32_t m_durability;
|
||||
/* 00CC */ int32_t m_level;
|
||||
/* 00D0 */ uint32_t m_stackCount;
|
||||
/* 00D4 */ int32_t m_maxStackCount;
|
||||
|
||||
void Clear();
|
||||
int32_t GetItemIdFromLink(const char* link);
|
||||
};
|
||||
|
||||
class CGTalentGroup_C;
|
||||
@@ -56,6 +56,29 @@ class CGUnit_C;
|
||||
class CImVector;
|
||||
class CSimpleFontString;
|
||||
|
||||
class CGPlayer_C;
|
||||
class ItemNameCache_C;
|
||||
class ItemSetRec;
|
||||
class ItemStats_C;
|
||||
class ScalingStatValuesRec;
|
||||
class SpellItemEnchantmentRec;
|
||||
class SpellRec;
|
||||
|
||||
struct ItemSetTooltipData {
|
||||
/* 0000 */ CGTooltip* m_tooltip;
|
||||
/* 0004 */ const ItemSetRec* m_set;
|
||||
/* 0008 */ ItemNameCache_C* m_items [17];
|
||||
/* 004C */ int32_t* m_equipped;
|
||||
/* 0050 */ uint8_t m_slotUsed [19];
|
||||
};
|
||||
|
||||
void TooltipItemCallback(int32_t id, const WOWGUID& guid, void* param, bool success);
|
||||
int32_t GetScalingStatBudget(const ScalingStatValuesRec* values, uint32_t flags);
|
||||
int32_t GetScalingStatArmor(const ScalingStatValuesRec* values, uint32_t flags);
|
||||
void GetScalingStatDamage(const ScalingStatValuesRec* values, uint32_t flags, float* minDamage, float* maxDamage);
|
||||
int32_t GetFeralAttackPower(const ItemStats_C* stats, float damage);
|
||||
int32_t GetEnchantmentConditionText(CGPlayer_C* player, const SpellItemEnchantmentRec* enchant, char* buffer, uint32_t size, int32_t newline);
|
||||
bool ResolveItemSetItem(ItemSetTooltipData* data, int32_t pass, int32_t itemId, int32_t slot);
|
||||
void TooltipUnitNameCallback(int32_t id, const WOWGUID& guid, void* param, bool success);
|
||||
void TooltipCorpseCallback(int32_t id, const WOWGUID& guid, void* param, bool success);
|
||||
void TooltipSpellCallback(int32_t id, const WOWGUID& guid, void* param, bool success);
|
||||
@@ -103,7 +126,7 @@ class CGTooltip : public CSimpleFrame {
|
||||
/* 0350 */ uint32_t unk_0350;
|
||||
/* 0354 */ uint32_t unk_0354;
|
||||
/* 0358 */ WOWGUID m_healthGuid;
|
||||
/* 0360 */ uint32_t unk_0360;
|
||||
/* 0360 */ int32_t m_itemId;
|
||||
/* 0364 */ int32_t m_spellId;
|
||||
/* 0368 */ uint32_t unk_0368;
|
||||
/* 036C */ uint32_t unk_036C;
|
||||
@@ -111,11 +134,10 @@ class CGTooltip : public CSimpleFrame {
|
||||
/* 0374 */ uint32_t unk_0374 [4];
|
||||
/* 0384 */ WowTime m_time;
|
||||
/* 03A4 */ uint32_t unk_03A4 [4];
|
||||
/* 03B4 */ uint32_t unk_03B4;
|
||||
/* 03B8 */ uint32_t unk_03B8;
|
||||
/* 03BC */ uint32_t unk_03BC;
|
||||
/* 03C0 */ uint32_t unk_03C0;
|
||||
/* 03C4 */ uint32_t unk_03C4;
|
||||
/* 03B4 */ int32_t m_itemNameOnly;
|
||||
/* 03B8 */ int32_t m_itemSocketPreview;
|
||||
/* 03BC */ int32_t m_itemCompare;
|
||||
/* 03C0 */ WOWGUID m_itemOwner;
|
||||
/* 03C8 */ int32_t m_pendingQueries;
|
||||
/* 03CC */ uint32_t m_fading;
|
||||
/* 03D0 */ float m_fadeTime;
|
||||
@@ -125,11 +147,11 @@ class CGTooltip : public CSimpleFrame {
|
||||
/* 03E0 */ float m_offsetX;
|
||||
/* 03E4 */ float m_offsetY;
|
||||
/* 03E8 */ ItemLinkInfo m_itemLinkInfo;
|
||||
/* 04C0 */ uint32_t unk_04C0;
|
||||
/* 04C4 */ uint32_t unk_04C4;
|
||||
/* 04C8 */ uint32_t unk_04C8;
|
||||
/* 04CC */ uint32_t unk_04CC;
|
||||
/* 04D0 */ uint32_t unk_04D0;
|
||||
/* 04C0 */ int32_t m_itemUseLinkInfo;
|
||||
/* 04C4 */ int32_t m_itemHideCharges;
|
||||
/* 04C8 */ int32_t m_itemMinimumLevel;
|
||||
/* 04CC */ int32_t m_itemSkipSellPrice;
|
||||
/* 04D0 */ int32_t m_itemDisplayedLevel;
|
||||
/* 04D4 */ FrameScript_Object::ScriptIx m_onTooltipSetDefaultAnchor;
|
||||
/* 04DC */ FrameScript_Object::ScriptIx m_onTooltipCleared;
|
||||
/* 04E4 */ FrameScript_Object::ScriptIx m_onTooltipAddMoney;
|
||||
@@ -172,11 +194,21 @@ class CGTooltip : public CSimpleFrame {
|
||||
void AddSkinnableText(CGUnit_C* unit, char* buffer, uint32_t size);
|
||||
static void GetSummonedByString(CGUnit_C* unit, char* buffer, uint32_t size);
|
||||
static void GetDurationString(char* buffer, uint32_t size, uint64_t time, const char* token, const char* prefix, int32_t roundUp, int32_t seconds);
|
||||
static void GetItemDurationString(char* buffer, uint32_t size, uint64_t time, const char* token);
|
||||
static void __stdcall FormatStringForXML(const char* text, char* buffer);
|
||||
static int32_t GetDisplayedScalingItemLevel(const ItemStats_C* stats, const ItemLinkInfo* link, WOWGUID target, int32_t minimumLevel);
|
||||
void AddMoney(int32_t money, int32_t maxMoney);
|
||||
void AddSpellReagents(const SpellRec* spell, const char* token, void (*callback)(int32_t id, const WOWGUID& guid, void* param, bool success));
|
||||
int32_t SetItemNoStats();
|
||||
static void GetFloatDurationString(char* buffer, uint32_t size, float time, const char* token, const char* prefix);
|
||||
int32_t AddTalentPrereqs(const TalentRec* talent, CGTalentGroup_C* group, int32_t isInspect, int32_t isPet, int32_t usePreview);
|
||||
void AddTalentLearnText(const TalentRec* talent, CGTalentGroup_C* group, int32_t prereqsMet, int32_t rank, int32_t maxRank, int32_t a7, int32_t a8, int32_t isPet, int32_t usePreview);
|
||||
int32_t SetQuest(int32_t questId);
|
||||
void SetGlyph(int32_t glyphId, int32_t spellId, int32_t a3, int32_t a4, int32_t a5);
|
||||
void SetTalent(const TalentRec* talent, CGTalentGroup_C* group, int32_t a3, int32_t a4, int32_t rank, int32_t a6, int32_t a7);
|
||||
int32_t SetAchievement(int32_t achievementId, uint64_t guid, bool completed, WowTime time, uint32_t criteria1, uint32_t criteria2, uint32_t criteria3, uint32_t criteria4, int32_t a10);
|
||||
int32_t SetSpell(int32_t spellId, int32_t brief, uint32_t cooldown, int32_t isPet, int32_t showRank, int32_t isInspect, int32_t a8, const TalentRec* talent, CGTalentGroup_C* talentGroup, int32_t append, int32_t usePreview, int32_t a13, int32_t rank, int32_t maxRank, int32_t showLearn);
|
||||
int32_t SetItem(int32_t itemId, int32_t* a2, WOWGUID* a3, int32_t a4, int32_t a5, int32_t a6, int32_t a7, uint64_t a8, int32_t a9, int32_t a10, int32_t a11, int32_t a12, int32_t a13, int32_t a14, int32_t a15);
|
||||
int32_t SetItem(int32_t itemId, const WOWGUID* requester, const WOWGUID* itemGuid, int32_t nameOnly, int32_t compare, int32_t useLinkInfo, int32_t append, WOWGUID owner, int32_t socketPreview, FILE* stream, int32_t hideCharges, const ItemLinkInfo* link, int32_t minimumLevel, int32_t skipLock, int32_t skipSellPrice);
|
||||
};
|
||||
|
||||
class CGItemStatsSummary {
|
||||
|
||||
@@ -15,19 +15,30 @@
|
||||
#include "WoW/Source/ObjectMgrClient/ObjectMgrClient.h"
|
||||
#include "WoW/Source/UIUtil/Types.h"
|
||||
#include "WoW/Source/Ui/SpellBookFrame.h"
|
||||
#include "WoW/Source/DB/DBClient/DBCacheInstances.h"
|
||||
#include "WoW/Source/Object/ObjectClient/Container_C.h"
|
||||
#include "WoW/Source/Ui/ContainerFrame.h"
|
||||
#include "WoW/Source/Ui/MerchantFrame.h"
|
||||
#include "WoW/Source/Ui/PaperDollInfoFrame.h"
|
||||
#include "WoW/Source/Ui/ScriptEvents.h"
|
||||
#include <cstdio>
|
||||
#include "WoW/Source/DB/DBClient/DBClient.h"
|
||||
#include "WoW/Source/DB/Rec/SpellRec.h"
|
||||
#include "WoW/Source/DB/Rec/TalentRec.h"
|
||||
#include "WoW/Source/Object/ObjectClient/UnitCombatLog_C.h"
|
||||
#include "WoW/Source/Ui/DanceStudio.h"
|
||||
#include "WoW/Source/Ui/TradeSkillFrame.h"
|
||||
|
||||
int32_t Script_AddFontStrings(lua_State* L);
|
||||
int32_t Script_GetAnchorType(lua_State* L);
|
||||
int32_t Script_SetAnchorType(lua_State* L);
|
||||
int32_t Script_AddTexture(lua_State* L);
|
||||
int32_t Script_SetHyperlink(lua_State* L);
|
||||
int32_t Script_SetAction(lua_State* L);
|
||||
int32_t Script_SetPetAction(lua_State* L);
|
||||
int32_t Script_SetShapeshift(lua_State* L);
|
||||
int32_t Script_SetPossession(lua_State* L);
|
||||
int32_t Script_TooltipSetTracking(lua_State* L);
|
||||
int32_t Script_SetGlyph(lua_State* L);
|
||||
int32_t Script_SetInventoryItem(lua_State* L);
|
||||
int32_t Script_SetLootItem(lua_State* L);
|
||||
int32_t Script_SetQuestItem(lua_State* L);
|
||||
int32_t Script_SetQuestLogItem(lua_State* L);
|
||||
@@ -37,7 +48,6 @@ int32_t Script_SetMerchantItem(lua_State* L);
|
||||
int32_t Script_SetMerchantCostItem(lua_State* L);
|
||||
int32_t Script_SetTradePlayerItem(lua_State* L);
|
||||
int32_t Script_SetTradeTargetItem(lua_State* L);
|
||||
int32_t Script_SetBagItem(lua_State* L);
|
||||
int32_t Script_SetUnit(lua_State* L);
|
||||
int32_t Script_SetUnitBuff(lua_State* L);
|
||||
int32_t Script_SetUnitDebuff(lua_State* L);
|
||||
@@ -406,7 +416,7 @@ static int32_t Script_AppendText(lua_State* L) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// VERIFY: 75c058fe manual
|
||||
// VERIFY: 2fd5996e manual
|
||||
// OFFSET: 0x006259E0
|
||||
static int32_t Script_SetSpell(lua_State* L) {
|
||||
CGTooltip* tooltip = static_cast<CGTooltip*>(FrameScript_GetObjectThis(L, CGTooltip::GetObjectType()));
|
||||
@@ -432,7 +442,7 @@ static int32_t Script_SetSpell(lua_State* L) {
|
||||
Spell_C_GetSpellCooldown(spellId, petSpell, &duration, &start, &enable);
|
||||
uint32_t cooldown = !enable || !start || !duration ? 0 : start + duration - OsGetAsyncTimeMs();
|
||||
|
||||
if (tooltip->SetSpell(spellId, 0, cooldown, petSpell, 0, 0, 0, nullptr, nullptr, 0, 0, 0, -1, -1, 0)) {
|
||||
if (tooltip->SetSpell(spellId, 0, cooldown, petSpell, 0, 0, 0, nullptr, nullptr, 0, 0, -1, -1, 0, 0)) {
|
||||
lua_pushnumber(L, 1.0);
|
||||
return 1;
|
||||
}
|
||||
@@ -442,7 +452,7 @@ static int32_t Script_SetSpell(lua_State* L) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// VERIFY: 6cc3f923 manual
|
||||
// VERIFY: ed4d980b manual
|
||||
// OFFSET: 0x00625B90
|
||||
static int32_t Script_SetSpellByID(lua_State* L) {
|
||||
CGTooltip* tooltip = static_cast<CGTooltip*>(FrameScript_GetObjectThis(L, CGTooltip::GetObjectType()));
|
||||
@@ -463,7 +473,7 @@ static int32_t Script_SetSpellByID(lua_State* L) {
|
||||
Spell_C_GetSpellCooldown(spellId, petSpell, &duration, &start, &enable);
|
||||
uint32_t cooldown = !enable || !start || !duration ? 0 : start + duration - OsGetAsyncTimeMs();
|
||||
|
||||
if (tooltip->SetSpell(spellId, 0, cooldown, petSpell, showRank, 0, 0, nullptr, nullptr, 0, 0, 0, -1, -1, 0)) {
|
||||
if (tooltip->SetSpell(spellId, 0, cooldown, petSpell, showRank, 0, 0, nullptr, nullptr, 0, 0, -1, -1, 0, 0)) {
|
||||
lua_pushnumber(L, 1.0);
|
||||
return 1;
|
||||
}
|
||||
@@ -473,6 +483,405 @@ static int32_t Script_SetSpellByID(lua_State* L) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// VERIFY: 6f832080 manual
|
||||
// OFFSET: 0x0062DAE0
|
||||
static int32_t Script_SetHyperlink(lua_State* L) {
|
||||
CGTooltip* tooltip = static_cast<CGTooltip*>(FrameScript_GetObjectThis(L, CGTooltip::GetObjectType()));
|
||||
|
||||
if (!lua_isstring(L, 2)) {
|
||||
const char* name = tooltip->GetName();
|
||||
luaL_error(L, "Usage: %s:SetHyperlink(link)", name ? name : "<unnamed>");
|
||||
return 0;
|
||||
}
|
||||
|
||||
const char* link = lua_tolstring(L, 2, nullptr);
|
||||
const char* cursor;
|
||||
|
||||
if ((cursor = SStrStr(link, "item:")) != nullptr) {
|
||||
int32_t itemId = SStrToInt(cursor + 5);
|
||||
|
||||
if (tooltip->m_isShown && itemId == tooltip->m_itemId) {
|
||||
tooltip->Hide();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (itemId > 0) {
|
||||
tooltip->m_itemLinkInfo.Clear();
|
||||
tooltip->m_itemLinkInfo.GetItemIdFromLink(link);
|
||||
WOWGUID requester = { 0 };
|
||||
WOWGUID itemGuid = { 0 };
|
||||
tooltip->SetItem(itemId, &requester, &itemGuid, 0, 0, 1, 0, WOWGUID{ 0 }, 0, nullptr, 1, &tooltip->m_itemLinkInfo, 0, 0, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((cursor = SStrStr(link, "enchant:")) != nullptr) {
|
||||
int32_t spellId = SStrToInt(cursor + 8);
|
||||
|
||||
if (tooltip->m_isShown && spellId == tooltip->m_spellId) {
|
||||
tooltip->Hide();
|
||||
return 0;
|
||||
}
|
||||
|
||||
SpellRec spell;
|
||||
|
||||
if (g_spellDB.GetRecord(spellId, &spell) && (spell.m_attributes & 0x20)) {
|
||||
tooltip->SetSpell(spellId, 0, 0, 0, 0, 0, 0, nullptr, nullptr, 0, 0, -1, -1, 0, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((cursor = SStrStr(link, "dance:")) != nullptr) {
|
||||
CGDanceStudio::LoadDance(SStrToInt(cursor + 6));
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((cursor = SStrStr(link, "spell:")) != nullptr) {
|
||||
int32_t spellId = SStrToInt(cursor + 6);
|
||||
|
||||
if (tooltip->m_isShown && spellId == tooltip->m_spellId) {
|
||||
tooltip->Hide();
|
||||
return 0;
|
||||
}
|
||||
|
||||
tooltip->SetSpell(spellId, 0, 0, 0, 0, 0, 0, nullptr, nullptr, 0, 0, -1, -1, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((cursor = SStrStr(link, "unit:")) != nullptr) {
|
||||
WOWGUID guid = StringToGuid(cursor + 5);
|
||||
|
||||
if (tooltip->m_isShown && guid == tooltip->m_unitGuid) {
|
||||
tooltip->Hide();
|
||||
return 0;
|
||||
}
|
||||
|
||||
WOWGUID healthGuid = { 0 };
|
||||
tooltip->SetUnit(guid, 0, healthGuid, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((cursor = SStrStr(link, "quest:")) != nullptr) {
|
||||
int32_t questId = SStrToInt(cursor + 6);
|
||||
|
||||
if (tooltip->m_isShown && questId == static_cast<int32_t>(tooltip->unk_0368)) {
|
||||
tooltip->Hide();
|
||||
return 0;
|
||||
}
|
||||
|
||||
tooltip->SetQuest(questId);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((cursor = SStrStr(link, "talent:")) != nullptr) {
|
||||
cursor += 7;
|
||||
TalentRec* talent = g_talentDB.GetRecord(SStrToInt(cursor));
|
||||
|
||||
if (!talent) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t rank = -1;
|
||||
const char* separator = SStrChr(cursor, ':');
|
||||
|
||||
if (separator) {
|
||||
rank = SStrToInt(separator + 1);
|
||||
}
|
||||
|
||||
tooltip->SetTalent(talent, nullptr, 0, 1, rank, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((cursor = SStrStr(link, "trade:")) != nullptr) {
|
||||
CGTradeSkillInfo::SetLink(cursor + 6);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((cursor = SStrStr(link, "achievement:")) != nullptr) {
|
||||
cursor += 12;
|
||||
int32_t achievementId = SStrToInt(cursor);
|
||||
|
||||
if (tooltip->m_isShown && achievementId == static_cast<int32_t>(tooltip->unk_036C)) {
|
||||
tooltip->Hide();
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint64_t guid = 0;
|
||||
WowTime time;
|
||||
int32_t completed = 0;
|
||||
uint32_t criteria1 = 0;
|
||||
uint32_t criteria2 = 0;
|
||||
uint32_t criteria3 = 0;
|
||||
uint32_t criteria4 = 0;
|
||||
const char* field = SStrChr(cursor, ':');
|
||||
|
||||
if (field) {
|
||||
field++;
|
||||
sscanf(field, "%I64X:", &guid);
|
||||
}
|
||||
|
||||
if ((field = SStrChr(field, ':')) != nullptr) {
|
||||
completed = SStrToInt(++field);
|
||||
}
|
||||
|
||||
if ((field = SStrChr(field, ':')) != nullptr) {
|
||||
time.m_month = SStrToInt(++field);
|
||||
}
|
||||
|
||||
if ((field = SStrChr(field, ':')) != nullptr) {
|
||||
time.m_monthDay = SStrToInt(++field);
|
||||
}
|
||||
|
||||
if ((field = SStrChr(field, ':')) != nullptr) {
|
||||
time.m_year = SStrToInt(++field);
|
||||
}
|
||||
|
||||
if ((field = SStrChr(field, ':')) != nullptr) {
|
||||
criteria1 = SStrToUnsigned(++field);
|
||||
}
|
||||
|
||||
if ((field = SStrChr(field, ':')) != nullptr) {
|
||||
criteria2 = SStrToUnsigned(++field);
|
||||
}
|
||||
|
||||
if ((field = SStrChr(field, ':')) != nullptr) {
|
||||
criteria3 = SStrToUnsigned(++field);
|
||||
}
|
||||
|
||||
const char* last = SStrChr(field, ':');
|
||||
|
||||
if (last) {
|
||||
criteria4 = SStrToUnsigned(last + 1);
|
||||
}
|
||||
|
||||
tooltip->SetAchievement(achievementId, guid, completed != 0, time, criteria1, criteria2, criteria3, criteria4, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ((cursor = SStrStr(link, "glyph:")) != nullptr) {
|
||||
cursor += 6;
|
||||
int32_t glyphId = SStrToInt(cursor);
|
||||
const char* separator = SStrChr(cursor, ':');
|
||||
|
||||
if (separator) {
|
||||
tooltip->SetGlyph(glyphId, SStrToInt(separator + 1), 1, 1, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
luaL_error(L, "%s:SetHyperlink(): Unknown link type", tooltip->GetDisplayName());
|
||||
return 0;
|
||||
}
|
||||
|
||||
// VERIFY: d3c4ca9b manual
|
||||
// OFFSET: 0x0062E050
|
||||
static int32_t Script_SetInventoryItem(lua_State* L) {
|
||||
CGTooltip* tooltip = static_cast<CGTooltip*>(FrameScript_GetObjectThis(L, CGTooltip::GetObjectType()));
|
||||
|
||||
if (!lua_isstring(L, 2)) {
|
||||
const char* name = tooltip->GetName();
|
||||
luaL_error(L, "Usage: %s:SetInventoryItem(unit, slot [, nameOnly])", name ? name : "<unnamed>");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t slot;
|
||||
|
||||
if (!lua_isnumber(L, 3) || ((slot = static_cast<int32_t>(lua_tonumber(L, 3) - 1.0)) < 0 || slot > 22) && (slot < 39 || slot > 66) && (slot < 67 || slot > 73) && (slot < 86 || slot > 117) && (slot < 118 || slot > 149) && slot != -1) {
|
||||
luaL_error(L, "Invalid inventory slot in SetInventoryItem");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t nameOnly = StringToBOOL(L, 4, 0);
|
||||
CGPlayer_C* unit = static_cast<CGPlayer_C*>(GetUnitFromName(lua_tolstring(L, 2, nullptr)));
|
||||
|
||||
if (!CGCharacterInfo::CanInspect(unit)) {
|
||||
lua_pushnil(L);
|
||||
lua_pushnil(L);
|
||||
lua_pushnumber(L, 0.0);
|
||||
return 3;
|
||||
}
|
||||
|
||||
if (slot == -1) {
|
||||
int32_t ammoId = CGCharacterInfo::GetActivePlayerAmmoID(unit);
|
||||
CGItem_C* ammo;
|
||||
|
||||
if (ammoId && (ammo = unit->GetBag()->FindItemOfType(ammoId, 0)) != nullptr) {
|
||||
WOWGUID itemGuid = ammo->m_obj->m_guid;
|
||||
WOWGUID requester = unit->m_obj->m_guid;
|
||||
tooltip->SetItem(ammoId, &requester, &itemGuid, 0, 0, 0, 0, WOWGUID{ 0 }, 0, nullptr, 0, nullptr, 0, 0, 0);
|
||||
lua_pushnumber(L, 1.0);
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
}
|
||||
|
||||
lua_pushnil(L);
|
||||
return 2;
|
||||
}
|
||||
|
||||
CGItem_C* item = unit->m_bag.GetItemPointer(slot);
|
||||
|
||||
if (!item) {
|
||||
InspectItem* inspected = unit->GetInspectedItem(slot);
|
||||
|
||||
if (!inspected || !inspected->m_itemId) {
|
||||
lua_pushnil(L);
|
||||
lua_pushnil(L);
|
||||
lua_pushnumber(L, 0.0);
|
||||
return 3;
|
||||
}
|
||||
|
||||
WOWGUID query = { 0 };
|
||||
g_itemDBCache.GetRecord(inspected->m_itemId, query, TooltipItemCallback, tooltip, false);
|
||||
ItemLinkInfo& link = tooltip->m_itemLinkInfo;
|
||||
link.Clear();
|
||||
link.m_randomPropertiesId = inspected->m_randomPropertiesId;
|
||||
|
||||
for (uint32_t i = 0; i < 12; i++) {
|
||||
link.m_enchants[i] = inspected->m_enchants[i];
|
||||
link.m_enchantDurations[i] = 0;
|
||||
link.m_enchantCharges[i] = 0;
|
||||
}
|
||||
|
||||
link.m_propertySeed = inspected->m_propertySeed;
|
||||
link.m_creator = inspected->m_creator;
|
||||
WOWGUID itemGuid = { 0 };
|
||||
WOWGUID requester = unit->m_obj->m_guid;
|
||||
tooltip->SetItem(inspected->m_itemId, &requester, &itemGuid, nameOnly, 0, 1, 0, unit->m_obj->m_guid, 0, nullptr, 0, nullptr, 0, 0, 0);
|
||||
lua_pushnumber(L, 1.0);
|
||||
lua_pushnil(L);
|
||||
lua_pushnumber(L, 0.0);
|
||||
return 3;
|
||||
}
|
||||
|
||||
int32_t result;
|
||||
|
||||
if (item->GetUsableSpellCharges() && !item->GetCurrentSpellCharges()) {
|
||||
WOWGUID requester = unit->m_obj->m_guid;
|
||||
WOWGUID itemGuid = item->m_obj->m_guid;
|
||||
result = tooltip->SetItem(item->m_obj->m_entryID, &requester, &itemGuid, nameOnly, 0, 0, 0, unit->m_obj->m_guid, 0, nullptr, 0, nullptr, 0, 0, 0);
|
||||
} else {
|
||||
uint32_t duration = 0;
|
||||
uint32_t start = 0;
|
||||
uint32_t enable = 0;
|
||||
Spell_C_GetItemCooldown(item, &duration, &start, &enable);
|
||||
|
||||
if (enable && duration && start) {
|
||||
tooltip->m_itemLinkInfo.Clear();
|
||||
tooltip->m_itemLinkInfo.m_cooldown = start + duration - OsGetAsyncTimeMs();
|
||||
tooltip->m_itemLinkInfo.m_spellCharges = item->GetCurrentSpellCharges();
|
||||
WOWGUID requester = unit->m_obj->m_guid;
|
||||
WOWGUID itemGuid = item->m_obj->m_guid;
|
||||
result = tooltip->SetItem(item->m_obj->m_entryID, &requester, &itemGuid, nameOnly, 0, 1, 0, unit->m_obj->m_guid, 0, nullptr, 0, nullptr, 0, 0, 0);
|
||||
} else {
|
||||
WOWGUID requester = unit->m_obj->m_guid;
|
||||
WOWGUID itemGuid = item->m_obj->m_guid;
|
||||
result = tooltip->SetItem(item->m_obj->m_entryID, &requester, &itemGuid, nameOnly, 0, 0, 0, unit->m_obj->m_guid, 0, nullptr, 0, nullptr, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
lua_pushnumber(L, 1.0);
|
||||
|
||||
if (result) {
|
||||
lua_pushnumber(L, 1.0);
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
}
|
||||
|
||||
lua_pushnumber(L, static_cast<uint32_t>(CGMerchantInfo::GetRepairCost(item)));
|
||||
return 3;
|
||||
}
|
||||
|
||||
// VERIFY: eb0546cd manual
|
||||
// OFFSET: 0x0062F420
|
||||
static int32_t Script_SetBagItem(lua_State* L) {
|
||||
CGTooltip* tooltip = static_cast<CGTooltip*>(FrameScript_GetObjectThis(L, CGTooltip::GetObjectType()));
|
||||
CGPlayer_C* player = static_cast<CGPlayer_C*>(ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPEMASK_PLAYER, __FILE__, __LINE__));
|
||||
|
||||
if (!player || !lua_isnumber(L, 2) || !lua_isnumber(L, 3)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t index = static_cast<int32_t>(lua_tonumber(L, 2)) - 1;
|
||||
CGBag_C* bag;
|
||||
|
||||
if (index == -1) {
|
||||
bag = &player->m_bag;
|
||||
} else {
|
||||
if (static_cast<uint32_t>(index) > 10) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
CGObject_C* container = ClntObjMgrObjectPtr(GetBagAtIndex(index), TYPEMASK_CONTAINER, __FILE__, __LINE__);
|
||||
|
||||
if (!container) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
bag = container->GetBag();
|
||||
}
|
||||
|
||||
if (!bag) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t slot = static_cast<int32_t>(lua_tonumber(L, 3)) - 1;
|
||||
|
||||
if (bag == &player->m_bag) {
|
||||
slot += 23;
|
||||
}
|
||||
|
||||
CGItem_C* item;
|
||||
|
||||
if (slot < 0 || slot >= bag->m_numSlots || (item = bag->GetItemPointer(slot)) == nullptr) {
|
||||
lua_pushnil(L);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t result;
|
||||
uint32_t duration;
|
||||
uint32_t start;
|
||||
uint32_t enable;
|
||||
|
||||
if ((item->GetUsableSpellCharges() && !item->GetCurrentSpellCharges()) || (duration = 0, start = 0, enable = 0, Spell_C_GetItemCooldown(item, &duration, &start, &enable), !enable || !duration || !start)) {
|
||||
WOWGUID requester = item->m_obj->m_guid;
|
||||
WOWGUID itemGuid = item->m_obj->m_guid;
|
||||
result = tooltip->SetItem(item->m_obj->m_entryID, &requester, &itemGuid, 0, 0, 0, 0, WOWGUID{ 0 }, 0, nullptr, 0, nullptr, 0, 0, 0);
|
||||
} else {
|
||||
ItemLinkInfo& link = tooltip->m_itemLinkInfo;
|
||||
link.Clear();
|
||||
|
||||
for (uint32_t i = 0; i < 12; i++) {
|
||||
link.m_enchants[i] = 0;
|
||||
link.m_enchantDurations[i] = 0;
|
||||
link.m_enchantCharges[i] = 0;
|
||||
}
|
||||
|
||||
link.m_cooldown = duration + start - OsGetAsyncTimeMs();
|
||||
link.m_proposedEnchant = 0;
|
||||
link.m_creator = item->m_item->m_itemFieldCreator;
|
||||
link.m_wrapped = (item->m_item->m_itemFieldFlags >> 3) & 1;
|
||||
link.m_giftCreator = item->m_item->m_itemFieldGiftcreator;
|
||||
link.m_spellCharges = item->GetCurrentSpellCharges();
|
||||
WOWGUID requester = item->m_obj->m_guid;
|
||||
WOWGUID itemGuid = item->m_obj->m_guid;
|
||||
result = tooltip->SetItem(item->m_obj->m_entryID, &requester, &itemGuid, 0, 0, 1, 0, WOWGUID{ 0 }, 0, nullptr, 0, nullptr, 0, 0, 0);
|
||||
}
|
||||
|
||||
int32_t repairCost = CGMerchantInfo::GetRepairCost(item);
|
||||
|
||||
if (result) {
|
||||
lua_pushnumber(L, 1.0);
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
}
|
||||
|
||||
lua_pushnumber(L, repairCost);
|
||||
return 2;
|
||||
}
|
||||
|
||||
// STATIC: 0x00AD2AE0
|
||||
static FrameScript_Method s_ScriptMethods[] = {
|
||||
{ "AddFontStrings", &Script_AddFontStrings },
|
||||
|
||||
@@ -4,6 +4,12 @@
|
||||
#include "WoW/Source/Ui/Types.h"
|
||||
#include "WoW/Source/WowSvcs/WowSvcsClient/ClientServices.h"
|
||||
#include "WoW/Source/Net/Types.h"
|
||||
#include "WoW/Source/Object/ObjectClient/Player_C.h"
|
||||
#include "WoW/Source/Object/Player.h"
|
||||
#include "WoW/Source/ObjectMgrClient/ObjectMgrClient.h"
|
||||
|
||||
// STATIC: 0x00A15ABC
|
||||
static const int32_t s_arenaBracketTypes[3] = { 2, 3, 5 };
|
||||
|
||||
// STATIC: 0x00ACF834
|
||||
int32_t CGArenaTeamInfo::m_showOffline = 1;
|
||||
@@ -92,3 +98,37 @@ void CGArenaTeamInfo::InitializeGame() {
|
||||
CGArenaTeamInfo::m_sortOrder[i].m_column = i;
|
||||
}
|
||||
}
|
||||
|
||||
// VERIFY: 04a71da4 manual
|
||||
// OFFSET: 0x005A37B0
|
||||
bool CGArenaTeamInfo::CheckPersonalAndTeamRating(uint32_t rating, int32_t bracket) {
|
||||
CGPlayer_C* player = static_cast<CGPlayer_C*>(ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPEMASK_PLAYER, __FILE__, __LINE__));
|
||||
|
||||
if (!player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < 3; i++) {
|
||||
uint32_t* info = &player->m_player->m_playerFieldArenaTeamInfo11[i * 7];
|
||||
|
||||
if (!info) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int32_t type = info[1];
|
||||
|
||||
if (type < s_arenaBracketTypes[bracket] || info[6] < rating) {
|
||||
continue;
|
||||
}
|
||||
|
||||
for (uint32_t j = 0; j < 3; j++) {
|
||||
ArenaTeam* team = &CGArenaTeamInfo::m_arenaTeams[j];
|
||||
|
||||
if (team && team->m_type == static_cast<uint32_t>(type) && team->m_rating >= rating) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ class CGArenaTeamInfo {
|
||||
static WOWGUID m_selectedMember;
|
||||
static void EnterWorld();
|
||||
static void InitializeGame();
|
||||
static bool CheckPersonalAndTeamRating(uint32_t rating, int32_t bracket);
|
||||
};
|
||||
|
||||
int32_t Script_GetArenaTeamRosterInfo(lua_State* L);
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
#include "Calendar.h"
|
||||
#include "WoW/Source/DB/DBClient/DBClient.h"
|
||||
#include "WoW/Source/DB/Rec/HolidayNamesRec.h"
|
||||
#include "WoW/Source/DB/Rec/HolidaysRec.h"
|
||||
#include "WoW/Source/WowSvcs/WowSvcsClient/ClientServices.h"
|
||||
|
||||
// STATIC: 0x00C207EC
|
||||
@@ -49,3 +52,16 @@ void CGCalendar::InitializeGame() {
|
||||
ClientServices::SetMessageHandler(SMSG_CALENDAR_SEND_NUM_PENDING, PH_CALENDAR_GROUP, nullptr);
|
||||
ClientServices::SetMessageHandler(SMSG_CALENDAR_CLEAR_PENDING_ACTION, PH_CALENDAR_GROUP, nullptr);
|
||||
}
|
||||
|
||||
// VERIFY: d8756e5f auto
|
||||
// OFFSET: 0x005B9430
|
||||
const char* GetHolidayName(int32_t holidayId) {
|
||||
HolidaysRec* holiday = g_holidaysDB.GetRecord(holidayId);
|
||||
|
||||
if (!holiday) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
HolidayNamesRec* name = g_holidayNamesDB.GetRecord(holiday->m_holidayNameID);
|
||||
return name ? name->m_name : nullptr;
|
||||
}
|
||||
|
||||
@@ -116,5 +116,6 @@ int32_t Script_CalendarCanSendInvite(lua_State* L);
|
||||
int32_t Script_CalendarCanAddEvent(lua_State* L);
|
||||
int32_t Script_OpenCalendar(lua_State* L);
|
||||
void CalendarRegisterScriptFunctions();
|
||||
const char* GetHolidayName(int32_t holidayId);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -16,6 +16,7 @@ int32_t Packet_SMSG_LEARNED_DANCE_MOVES(void* param, NETMESSAGE msgId, uint32_t
|
||||
class CGDanceStudio {
|
||||
public:
|
||||
static void InitializeGame();
|
||||
static void LoadDance(int32_t danceId);
|
||||
static void RegisterScriptFunctions();
|
||||
};
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include <new>
|
||||
#include "Engine/Source/Base/ObjectAlloc.h"
|
||||
#include "Engine/Source/Storm/H/storm.h"
|
||||
#include "Engine/Source/FrameScript/FrameScript.h"
|
||||
#include <cstring>
|
||||
#include "WoW/Source/WowSvcs/WowSvcsClient/ClientServices.h"
|
||||
|
||||
// STATIC: 0x00C1E95C
|
||||
@@ -21,6 +23,9 @@ int32_t CGEquipmentManager::m_pendingSetID;
|
||||
// STATIC: 0x00C1E908
|
||||
int32_t CGEquipmentManager::m_ignoredSlots[19];
|
||||
|
||||
// STATIC: 0x00ACFC00
|
||||
TSList<EQUIPMENT_SET_NODE> CGEquipmentManager::s_equipmentSets;
|
||||
|
||||
// VERIFY: 36e16d6a auto
|
||||
// OFFSET: 0x005AD690
|
||||
void CGEquipmentManager::EnterWorld() {
|
||||
@@ -64,3 +69,51 @@ void CGEquipmentManager::InitializeGame() {
|
||||
CGEquipmentManager::s_equipmentSetHeap = new (SMemAlloc(sizeof(uint32_t), __FILE__, __LINE__, 0)) uint32_t(ObjectAllocAddHeap(sizeof(EQUIPMENT_SET), 128, "EQUIPMENTSET", true));
|
||||
}
|
||||
}
|
||||
|
||||
// VERIFY: ecc66233 manual
|
||||
// OFFSET: 0x005AE380
|
||||
int32_t CGEquipmentManager::GetSetList(char* buffer, uint32_t size, const WOWGUID* item) {
|
||||
uint32_t remaining = size - 1;
|
||||
char* out = buffer;
|
||||
const char* separator = "";
|
||||
const char* delimiter = FrameScript_GetText("PLAYER_LIST_DELIMITER", -1, GENDER_NOT_APPLICABLE);
|
||||
|
||||
for (EQUIPMENT_SET_NODE* node = CGEquipmentManager::s_equipmentSets.Head(); node; node = CGEquipmentManager::s_equipmentSets.Next(node)) {
|
||||
EQUIPMENT_SET* set = node->m_set;
|
||||
|
||||
for (uint32_t i = 0; i < sizeof(set->m_items) / sizeof(set->m_items[0]); i++) {
|
||||
if (set->m_items[i] != *item) {
|
||||
continue;
|
||||
}
|
||||
|
||||
size_t nameLength = SStrLen(set->m_name);
|
||||
size_t separatorLength = SStrLen(separator);
|
||||
|
||||
if (separatorLength + nameLength > remaining) {
|
||||
break;
|
||||
}
|
||||
|
||||
memcpy(out, separator, separatorLength);
|
||||
out += separatorLength;
|
||||
memcpy(out, set->m_name, nameLength);
|
||||
out += nameLength;
|
||||
remaining -= nameLength + separatorLength;
|
||||
separator = delimiter;
|
||||
}
|
||||
}
|
||||
|
||||
*out = '\0';
|
||||
return buffer != out;
|
||||
}
|
||||
|
||||
// VERIFY: b88be2b9 manual
|
||||
// OFFSET: 0x005AE5C0
|
||||
const EQUIPMENT_SET* CGEquipmentManager::GetSetByID(int32_t id) {
|
||||
for (EQUIPMENT_SET_NODE* node = CGEquipmentManager::s_equipmentSets.Head(); node; node = CGEquipmentManager::s_equipmentSets.Next(node)) {
|
||||
if (node->m_set->m_id == id) {
|
||||
return node->m_set;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <cstdint>
|
||||
#include "WoW/Source/Object/WGUID.h"
|
||||
#include "WoW/Source/Net/Types.h"
|
||||
#include "Engine/Source/Storm/H/stpl.h"
|
||||
|
||||
class CDataStore;
|
||||
struct lua_State;
|
||||
@@ -19,6 +20,10 @@ struct EQUIPMENT_SET {
|
||||
/* 0230 */ uint32_t unk_0230;
|
||||
};
|
||||
|
||||
struct EQUIPMENT_SET_NODE : public TSLinkedNode<EQUIPMENT_SET_NODE> {
|
||||
/* 0008 */ EQUIPMENT_SET* m_set;
|
||||
};
|
||||
|
||||
int32_t Packet_SMSG_EQUIPMENT_SET_LIST(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
|
||||
int32_t Packet_SMSG_EQUIPMENT_SET_SAVED(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
|
||||
int32_t Packet_SMSG_EQUIPMENT_SET_USE_RESULT(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg);
|
||||
@@ -26,6 +31,7 @@ int32_t Packet_SMSG_EQUIPMENT_SET_USE_RESULT(void* param, NETMESSAGE msgId, uint
|
||||
class CGEquipmentManager {
|
||||
public:
|
||||
static uint32_t* s_equipmentSetHeap;
|
||||
static TSList<EQUIPMENT_SET_NODE> s_equipmentSets;
|
||||
static void EnterWorld();
|
||||
static uint8_t m_lastCanUseEquipmentSetsValue;
|
||||
static uint8_t m_swapPending;
|
||||
@@ -38,6 +44,7 @@ class CGEquipmentManager {
|
||||
static void InitializeGame();
|
||||
static void EquipSet(int32_t id);
|
||||
static void GetFullIconPath(int32_t id, char* buffer, uint32_t size);
|
||||
static int32_t GetSetList(char* buffer, uint32_t size, const WOWGUID* item);
|
||||
};
|
||||
|
||||
int32_t Script_SaveEquipmentSet(lua_State* L);
|
||||
|
||||
@@ -1 +1,48 @@
|
||||
#include "ItemSocketInfo.h"
|
||||
#include "WoW/Source/DB/DBClient/DBClient.h"
|
||||
#include "WoW/Source/DB/Rec/GemPropertiesRec.h"
|
||||
#include "WoW/Source/Object/ItemStats.h"
|
||||
|
||||
// STATIC: 0x00C20FC8
|
||||
WOWGUID CGItemSocketInfo::m_gemItems[3];
|
||||
|
||||
// VERIFY: c7291b92 manual
|
||||
// OFFSET: 0x005C48D0
|
||||
int32_t CGItemSocketInfo::GemMatchesSocket(const ItemStats_C* item, const ItemStats_C* gem, int32_t socket) {
|
||||
if (!item || !gem) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t color = item->m_socketColor[socket];
|
||||
|
||||
if (!color) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
GemPropertiesRec* properties = g_gemPropertiesDB.GetRecord(gem->m_gemProperties);
|
||||
|
||||
if (!properties) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t type = properties->m_type;
|
||||
int32_t match = 0;
|
||||
|
||||
if ((type & 1) && (color & 1)) {
|
||||
match = 1;
|
||||
}
|
||||
|
||||
if ((type & 2) && (color & 2)) {
|
||||
match = 1;
|
||||
}
|
||||
|
||||
if ((type & 4) && (color & 4)) {
|
||||
match = 1;
|
||||
}
|
||||
|
||||
if ((type & 8) && (color & 8)) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return match;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
#define WOW_SOURCE_UI_ITEMSOCKETINFO_H
|
||||
|
||||
#include <cstdint>
|
||||
#include "WoW/Source/Object/WGUID.h"
|
||||
|
||||
struct lua_State;
|
||||
|
||||
@@ -19,9 +20,14 @@ int32_t Script_GetSocketItemRefundable(lua_State* L);
|
||||
int32_t Script_GetSocketItemBoundTradeable(lua_State* L);
|
||||
void ItemSocketInfoRegisterScriptFunctions();
|
||||
|
||||
class ItemStats_C;
|
||||
|
||||
class CGItemSocketInfo {
|
||||
public:
|
||||
static WOWGUID m_gemItems[3];
|
||||
|
||||
static void EnterWorld();
|
||||
static int32_t GemMatchesSocket(const ItemStats_C* item, const ItemStats_C* gem, int32_t socket);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
#include "MerchantFrame.h"
|
||||
#include "Engine/Source/Tempest/CMath.h"
|
||||
#include "WoW/Source/Object/ObjectClient/Item_C.h"
|
||||
#include "WoW/Source/Object/ObjectClient/Player_C.h"
|
||||
#include "WoW/Source/Object/ObjectClient/Unit_C.h"
|
||||
#include "WoW/Source/ObjectMgrClient/ObjectMgrClient.h"
|
||||
|
||||
// STATIC: 0x00BFA3F0
|
||||
int32_t CGMerchantInfo::m_numMerchantItems;
|
||||
@@ -8,3 +13,33 @@ uint32_t CGMerchantInfo::m_numBuybackItems;
|
||||
|
||||
// STATIC: 0x00BF9128
|
||||
MerchantItem CGMerchantInfo::m_items[150];
|
||||
|
||||
// VERIFY: 4b63a9a7 manual
|
||||
// OFFSET: 0x00584150
|
||||
MerchantItem* CGMerchantInfo::FindItemById(int32_t itemId) {
|
||||
if (!CGMerchantInfo::m_merchant || !CGMerchantInfo::m_numMerchantItems) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < sizeof(CGMerchantInfo::m_items) / sizeof(CGMerchantInfo::m_items[0]); i++) {
|
||||
if (CGMerchantInfo::m_items[i].m_itemID == itemId) {
|
||||
return &CGMerchantInfo::m_items[i];
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// VERIFY: 7160c52f manual
|
||||
// OFFSET: 0x00584B20
|
||||
int32_t CGMerchantInfo::GetRepairCost(CGItem_C* item) {
|
||||
float multiplier = 1.0f;
|
||||
CGPlayer_C* player = static_cast<CGPlayer_C*>(ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPEMASK_PLAYER, __FILE__, __LINE__));
|
||||
CGUnit_C* merchant = static_cast<CGUnit_C*>(ClntObjMgrObjectPtr(CGMerchantInfo::m_merchant, TYPEMASK_UNIT, __FILE__, __LINE__));
|
||||
|
||||
if (player && merchant) {
|
||||
multiplier = 1.0f - merchant->GetPlayerDiscount(player);
|
||||
}
|
||||
|
||||
return CMath::fint_(static_cast<float>(static_cast<uint32_t>(item->GetRepairCost())) * multiplier);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@
|
||||
#include <cstdint>
|
||||
#include "WoW/Source/Object/WGUID.h"
|
||||
|
||||
class CGItem_C;
|
||||
|
||||
struct lua_State;
|
||||
|
||||
struct MerchantItem {
|
||||
@@ -20,6 +22,8 @@ struct MerchantItem {
|
||||
class CGMerchantInfo {
|
||||
public:
|
||||
static void EnterWorld();
|
||||
static MerchantItem* FindItemById(int32_t itemId);
|
||||
static int32_t GetRepairCost(CGItem_C* item);
|
||||
static MerchantItem m_items[150];
|
||||
static WOWGUID m_merchant;
|
||||
static int32_t m_numMerchantItems;
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#include "WoW/Source/DB/DBClient/DBClient.h"
|
||||
#include "WoW/Source/DB/Rec/AreaTableRec.h"
|
||||
#include "WoW/Source/DB/Rec/SpellDescriptionVariablesRec.h"
|
||||
#include "WoW/Source/DB/Rec/SpellItemEnchantmentRec.h"
|
||||
#include "WoW/Source/DB/Rec/SpellRadiusRec.h"
|
||||
#include "WoW/Source/DB/Rec/SpellRangeRec.h"
|
||||
#include "WoW/Source/DB/Rec/SpellRec.h"
|
||||
@@ -263,6 +264,47 @@ static int32_t SpellParserVariable(char* buffer, uint32_t size, const char** cur
|
||||
return 0;
|
||||
}
|
||||
|
||||
// VERIFY: 4b6e8371 manual
|
||||
// OFFSET: 0x00577260
|
||||
int32_t SpellItemEnchantmentParseText(const SpellItemEnchantmentRec* enchant, char* buffer, uint32_t size, int32_t value) {
|
||||
int32_t failed = 0;
|
||||
*buffer = '\0';
|
||||
const char* text = enchant->m_name;
|
||||
|
||||
for (const char* dollar = SStrChr(text, '$'); dollar && *dollar; dollar = SStrChr(text, '$')) {
|
||||
int32_t length = dollar - text;
|
||||
|
||||
if (dollar != text) {
|
||||
uint32_t bufferLength = SStrLen(buffer);
|
||||
SStrPack(buffer, text, size);
|
||||
|
||||
if (bufferLength + length < size) {
|
||||
buffer[bufferLength + length] = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
const char* cursor = dollar + 1;
|
||||
|
||||
if (*cursor == 'i') {
|
||||
char number[32];
|
||||
SStrPrintf(number, sizeof(number), "%d", value);
|
||||
SStrPack(buffer, number, size);
|
||||
|
||||
if (*cursor) {
|
||||
cursor++;
|
||||
}
|
||||
} else {
|
||||
SStrPack(buffer, "$", size);
|
||||
failed = 1;
|
||||
}
|
||||
|
||||
text = cursor;
|
||||
}
|
||||
|
||||
SStrPack(buffer, text, size);
|
||||
return failed == 0;
|
||||
}
|
||||
|
||||
// VERIFY: f4c9dae8 manual
|
||||
// OFFSET: 0x005796C0
|
||||
static bool SpellParserGetCondition(const char** cursor) {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
|
||||
class CGUnit_C;
|
||||
class NameCache;
|
||||
class SpellItemEnchantmentRec;
|
||||
class SpellRec;
|
||||
|
||||
struct SpellVariable {
|
||||
@@ -25,5 +26,6 @@ extern TSGrowableArray<SpellVariable> s_spellVariables;
|
||||
|
||||
void GenderConditional(char* buffer, uint32_t size, int32_t gender, const CGUnit_C* unit, const NameCache* name, const char** cursor);
|
||||
int32_t SpellParserParseText(const SpellRec* spell, char* buffer, uint32_t size, int32_t parsePet, int32_t parseUnit, int32_t spellLevel, int32_t useAuraDescription, int32_t scale, int32_t noModifiers);
|
||||
int32_t SpellItemEnchantmentParseText(const SpellItemEnchantmentRec* enchant, char* buffer, uint32_t size, int32_t value);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -134,5 +134,6 @@ int32_t FindSpellSlotByName(const char* name, const char* subtext, int32_t* petS
|
||||
int32_t GetSpellIdByName(const char* name, int32_t* petSpell);
|
||||
bool GetSlotFromLua(lua_State* L, uint32_t* slot, int32_t* petSpell, int32_t* type, int32_t allowName);
|
||||
bool HasPetSpell(int32_t spellId);
|
||||
extern TSGrowableArray<int32_t> s_openLockSpells;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -20,6 +20,7 @@ class CGTradeSkillInfo {
|
||||
static uint32_t m_recastTimes;
|
||||
static uint32_t m_pendingRecastTimes;
|
||||
static void RefreshList(int32_t a1);
|
||||
static void SetLink(const char* link);
|
||||
static void CommitPendingRecast(int32_t spellId);
|
||||
static void DoRecast(int32_t spellId);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user