Gossip/Merchant/QuestLog: port Lua scripts, quest log update and quest cache insert
- Gossip quest lists, option/quest selection, IsLowLevel - Merchant item info/links/costs, buy/buyback/sell cursors, repair (CanUseItem, BuyItem, buyback price, pvp medal helpers) - Quest log: CGQuestLog::Update, FilterAndSortQuests, sort comparators, collapse/expand, watches, special item, 69 Script_* functions - QuestLog helpers: GetQuestIndex, IsQuestCompleteEx, HasNoObjectives, titles/tags/levels/sort ids, leaderboard counts, item drop counts - DBCache::AddItem generic template (quest cache records were dropped) Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
This commit is contained in:
@@ -554,6 +554,36 @@ void DBCache<T, TKey, THashKey>::AddItems(CDataStore* msg, bool single) {
|
||||
} while (--count);
|
||||
}
|
||||
|
||||
// VERIFY: 0168a135 manual
|
||||
// OFFSET: [0x0067E030]
|
||||
template <class T, class TKey, class THashKey>
|
||||
void DBCache<T, TKey, THashKey>::AddItem(T* item, TKey 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 = *item;
|
||||
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(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);
|
||||
}
|
||||
}
|
||||
|
||||
// VERIFY: e5e95050 manual
|
||||
// OFFSET: [0x0067A070]
|
||||
template <class T, class TKey, class THashKey>
|
||||
|
||||
@@ -151,6 +151,7 @@ bool Spell_C_TargetingSpellAllowsTerrain();
|
||||
bool Spell_C_CanTargetCorpse(const CGCorpse_C* corpse);
|
||||
bool Spell_C_CanTargetObject(const CGGameObject_C* object);
|
||||
bool Spell_C_IsTargeting();
|
||||
bool Spell_C_RangeCheckSelected(CGUnit_C* caster, const SpellRec* spell, WOWGUID target, uint8_t* inRange, int32_t a5, int32_t a6);
|
||||
extern PendingSpellCast* s_targetingSpell;
|
||||
extern uint32_t s_needTargets;
|
||||
int32_t Spell_C_IsCursorWorldObjectHousing();
|
||||
|
||||
@@ -1375,3 +1375,9 @@ int32_t CGItem_C::IsLocked(const LockRec* lock, int32_t itemLevel, int32_t* spel
|
||||
int32_t CGItem_C::GetRandomPropertyValue(int32_t slot) {
|
||||
return CGItem_C::GetRandomPropertyValue(slot, this->m_item->m_itemFieldRandomPropertiesId, this->GetRandomPropertyPoints());
|
||||
}
|
||||
|
||||
// VERIFY: eaccfb41 auto
|
||||
// OFFSET: 0x00708C10
|
||||
int32_t CGItem_C::CanBeUsed() {
|
||||
return this->GetEnchantmentSpell(0) != 0;
|
||||
}
|
||||
|
||||
@@ -65,6 +65,7 @@ class CGItem_C : public CGObject_C, public CGItem {
|
||||
uint32_t GetDisplayID() const;
|
||||
uint32_t GetEnchantmentTimeLeft(int32_t slot) const;
|
||||
int32_t UseItem(WOWGUID* target, int32_t a2);
|
||||
int32_t CanBeUsed();
|
||||
uint32_t GetExpirationTimeLeft() const;
|
||||
char* GetFullItemName(char* buffer, uint32_t size) const;
|
||||
uint32_t GetInventoryType() const;
|
||||
|
||||
@@ -76,6 +76,7 @@
|
||||
#include "WoW/Source/DB/Rec/AreaTableRec.h"
|
||||
#include "WoW/Source/Ui/CGTabardCreationFrame.h"
|
||||
#include <malloc.h>
|
||||
#include "WoW/Source/Ui/ReputationInfo.h"
|
||||
|
||||
struct GUILDUPDATETIMESTAMP {
|
||||
/* 0000 */ uint32_t m_guildId;
|
||||
@@ -5292,3 +5293,77 @@ int32_t __stdcall CGPlayer_C::OnQuestGiverQuestDetails(CDataStore* msg) {
|
||||
CGQuestInfo::AddReward(title, choiceItems, choiceDisplays, choiceCounts, numChoices, rewardItems, rewardDisplays, rewardCounts, numRewards, money, xp, honor, honorMultiplier, spell, spellCast, autoLaunched, suggestedGroupNum, rewardTitle, talents, arenaPoints, factionMask, factionIDs, factionValues, factionOverrides, flags);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// VERIFY: ba5bd839 manual
|
||||
// OFFSET: 0x006D2DE0
|
||||
void CGPlayer_C::BuyItem(WOWGUID vendor, const MerchantItem* item, uint32_t count, uint8_t a5) {
|
||||
if (!item) {
|
||||
return;
|
||||
}
|
||||
|
||||
CDataStore msg;
|
||||
msg.Put(static_cast<uint32_t>(CMSG_BUY_ITEM));
|
||||
msg.Put(vendor.m_guid);
|
||||
msg.Put(static_cast<uint32_t>(item->m_itemID));
|
||||
msg.Put(static_cast<uint32_t>(item->m_slot));
|
||||
msg.Put(count);
|
||||
msg.Put(a5);
|
||||
msg.Finalize();
|
||||
ClientServices::Send2(&msg);
|
||||
}
|
||||
|
||||
// VERIFY: 604e7050 manual
|
||||
// OFFSET: 0x006DC3F0
|
||||
int32_t CGPlayer_C::CanUseItem(const ItemStats_C* stats, int32_t& error) {
|
||||
error = ERR_MAX_VALUE;
|
||||
|
||||
if (!stats) {
|
||||
error = ERR_ITEM_NOT_FOUND;
|
||||
return 0;
|
||||
}
|
||||
|
||||
CGUnitData* unit = this->m_unit;
|
||||
|
||||
if (static_cast<int32_t>(stats->m_requiredLevel) > static_cast<int32_t>(unit->m_unitFieldLevel) || !((1 << (unit->m_unitFieldBytes0[1] - 1)) & stats->m_allowableClass) || !((1 << (unit->m_unitFieldBytes0[0] - 1)) & stats->m_allowableRace)) {
|
||||
error = ERR_CANT_USE_ITEM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t itemClass = static_cast<uint8_t>(stats->m_class);
|
||||
|
||||
if (itemClass < 17 && s_proficiency[itemClass] && !(s_proficiency[itemClass] & (1 << stats->m_subClass))) {
|
||||
error = ERR_PROFICIENCY_NEEDED;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (stats->m_requiredSkill && !(stats->m_flags[0] & 0x20040000)) {
|
||||
int32_t index = this->GetSkillIndex(stats->m_requiredSkill);
|
||||
|
||||
if (index < 0 || static_cast<int32_t>(this->GetSkillValue(index)) < static_cast<int32_t>(stats->m_requiredSkillRank)) {
|
||||
error = ERR_CANT_USE_ITEM;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (stats->m_requiredSpell && !this->IsSpellKnown(stats->m_requiredSpell) && !this->IsSpellSuperceded(stats->m_requiredSpell)) {
|
||||
error = ERR_CANT_USE_ITEM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (stats->m_requiredHonorRank && static_cast<int32_t>(this->m_player->m_playerFieldBytes[3]) < static_cast<int32_t>(stats->m_requiredHonorRank)) {
|
||||
error = ERR_CANT_USE_ITEM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (stats->m_requiredCityRank && !this->HasPvpMedal(static_cast<uint8_t>(stats->m_requiredCityRank))) {
|
||||
error = ERR_CANT_USE_ITEM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (stats->m_requiredReputationFaction && GetRepListRepValue(stats->m_requiredReputationFaction) < CGReputationInfo::m_reactionThresholds[stats->m_requiredReputationRank]) {
|
||||
error = ERR_CANT_USE_ITEM;
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -59,6 +59,8 @@ struct PlayerPendingItemExpiration : public TSLinkedNode<PlayerPendingItemExpira
|
||||
/* 0014 */ int32_t m_duration;
|
||||
};
|
||||
|
||||
struct MerchantItem;
|
||||
class ItemStats_C;
|
||||
class CGPlayer_C : public CGUnit_C, public CGPlayer {
|
||||
public:
|
||||
void DanceMoveAnimComplete();
|
||||
@@ -281,6 +283,10 @@ class CGPlayer_C : public CGUnit_C, public CGPlayer {
|
||||
int32_t OnSignedResults(CDataStore* msg);
|
||||
int32_t OnListInventory(CDataStore* msg);
|
||||
void RequestAllItemPurchaseData();
|
||||
float CalcRewardHonor(float honor);
|
||||
float GetQuestXPMultiplier();
|
||||
int32_t CanUseItem(const ItemStats_C* stats, int32_t& error);
|
||||
static void BuyItem(WOWGUID vendor, const MerchantItem* item, uint32_t count, uint8_t a5);
|
||||
int32_t OnItemRefundResult(CDataStore* msg);
|
||||
void DelKnownSpell(int32_t spellId, int32_t a3);
|
||||
bool VehicleAllowsInteraction() const;
|
||||
|
||||
@@ -144,3 +144,29 @@ int32_t CGPlayer::TotalRemoteFields() {
|
||||
bool CGPlayer::IsDrunk() {
|
||||
return this->m_player->m_playerBytes3[1] || this->m_player->m_playerFakeInebriation;
|
||||
}
|
||||
|
||||
// VERIFY: 343c96d1 manual
|
||||
// OFFSET: 0x00584B00
|
||||
uint32_t CGPlayer::GetBuybackPrice(uint32_t slot) {
|
||||
if (slot < 12) {
|
||||
return this->m_player->m_playerFieldBuybackPrice1[slot];
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// VERIFY: feec4401 manual
|
||||
// OFFSET: 0x0061DCB0
|
||||
bool CGPlayer::HasPvpMedal(uint8_t medal) {
|
||||
return (this->m_player->m_playerFieldPvpMedals & (1 << (medal - 1))) != 0;
|
||||
}
|
||||
|
||||
// VERIFY: d70d997f manual
|
||||
// OFFSET: 0x005E0870
|
||||
PlayerQuestLogEntry* CGPlayer::GetQuestLogEntry(uint32_t slot) {
|
||||
if (slot > 25) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return &this->m_player->m_playerQuestLog[slot];
|
||||
}
|
||||
|
||||
@@ -26,6 +26,9 @@ struct PlayerSkillInfo {
|
||||
|
||||
class CGPlayer {
|
||||
public:
|
||||
PlayerQuestLogEntry* GetQuestLogEntry(uint32_t slot);
|
||||
uint32_t GetBuybackPrice(uint32_t slot);
|
||||
bool HasPvpMedal(uint8_t medal);
|
||||
static const uint32_t s_mirrorFields[173];
|
||||
static const uint32_t s_localMirrorFields[870];
|
||||
|
||||
|
||||
@@ -277,3 +277,11 @@ float CGUnit::GetSpellCostMultiplier(int32_t schoolMask) const {
|
||||
|
||||
return result + 1.0f;
|
||||
}
|
||||
|
||||
// VERIFY: 43c5b8ef auto
|
||||
// OFFSET: 0x0058AAB0
|
||||
int32_t CGUnit::GetQuestGreenRange() const {
|
||||
static const int32_t s_questGreenRange[20] = { 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 };
|
||||
uint32_t band = static_cast<int32_t>(this->m_unit->m_unitFieldLevel) / 5;
|
||||
return band < 20 ? s_questGreenRange[band] : 8;
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ class CMovement_C;
|
||||
|
||||
class CGUnit {
|
||||
public:
|
||||
int32_t GetQuestGreenRange() const;
|
||||
static const uint32_t s_mirrorFieldIndices[123];
|
||||
|
||||
static uint32_t MirrorIndexFromFieldIndex(uint32_t fieldIndex);
|
||||
|
||||
@@ -97,6 +97,9 @@
|
||||
#include "WoW/Source/Ui/LootFrame.h"
|
||||
#include "WoW/Source/UIUtil/Cursor.h"
|
||||
|
||||
// STATIC: 0x00AD2AAC
|
||||
static const char* s_spellLinkColorString = "|cff71d5ff";
|
||||
|
||||
// STATIC: 0x00C5CF4C
|
||||
int32_t CGTooltip::s_objectType;
|
||||
|
||||
@@ -5831,3 +5834,38 @@ int32_t CGTooltip::SetItem(int32_t itemId, const WOWGUID* requester, const WOWGU
|
||||
this->CalculateSize();
|
||||
return needsUpdate;
|
||||
}
|
||||
|
||||
// VERIFY: 223b2ae6 auto
|
||||
// OFFSET: 0x0061E360
|
||||
const char* CGTooltip::GetItemHyperlinkString(int32_t itemId, uint32_t quality, int32_t enchant, int32_t randomPropertiesId, int32_t seed) {
|
||||
int32_t gems[3] = { 0 };
|
||||
return CGTooltip::CreateItemLink(itemId, quality, enchant, gems, randomPropertiesId, seed);
|
||||
}
|
||||
|
||||
// VERIFY: 2118de6f auto
|
||||
// OFFSET: 0x0061E5C0
|
||||
const char* CGTooltip::GetQuestLink(int32_t questId, int32_t level) {
|
||||
WOWGUID none = { 0 };
|
||||
QuestCache* quest = g_questDBCache.GetRecord(questId, none, nullptr, nullptr, false);
|
||||
|
||||
if (!quest) {
|
||||
return "";
|
||||
}
|
||||
|
||||
const char* color = CGTooltip::GetQuestDifficultyColorString(level);
|
||||
SStrPrintf(s_itemLink, sizeof(s_itemLink), "%s|Hquest:%d:%d|h[%s]|h%s", color, questId, quest->m_level, quest->m_name, *color ? "|r" : "");
|
||||
return s_itemLink;
|
||||
}
|
||||
|
||||
// VERIFY: 0e99f273 auto
|
||||
// OFFSET: 0x0061E4B0
|
||||
const char* CGTooltip::GetSpellLink(int32_t spellId) {
|
||||
SpellRec spell;
|
||||
|
||||
if (!g_spellDB.GetRecord(spellId, &spell)) {
|
||||
return "";
|
||||
}
|
||||
|
||||
SStrPrintf(s_itemLink, sizeof(s_itemLink), "%s|Hspell:%d|h[%s]|h%s", s_spellLinkColorString, spellId, spell.m_name, *s_spellLinkColorString ? "|r" : "");
|
||||
return s_itemLink;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,10 @@ class CGTooltip : public CSimpleFrame {
|
||||
static const char* GetItemQualityColorString(uint32_t quality);
|
||||
static const char* CreateItemLink(int32_t itemId, uint32_t quality, int32_t enchant, const int32_t* gems, int32_t randomPropertiesId, int32_t seed);
|
||||
static const char* GetItemHyperlinkString(CGItem_C* item);
|
||||
static const char* GetItemHyperlinkString(int32_t itemId, uint32_t quality, int32_t enchant, int32_t randomPropertiesId, int32_t seed);
|
||||
static const char* GetQuestDifficultyColorString(int32_t level);
|
||||
static const char* GetQuestLink(int32_t questId, int32_t level);
|
||||
static const char* GetSpellLink(int32_t spellId);
|
||||
static int32_t GetObjectType();
|
||||
static void RegisterScriptMethods(lua_State* L);
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ extern CVar* g_stopAutoAttackOnTargetChangeCVar;
|
||||
extern CVar* g_autoDismountCVar;
|
||||
extern CVar* g_autoDismountFlyingCVar;
|
||||
extern CVar* g_autoUnshiftCVar;
|
||||
extern CVar* s_cvQuestLogCollapseFilter;
|
||||
extern CVar* s_cvAutoRangedCombat;
|
||||
extern CVar* s_cvAutoFilledMultiCastSlots;
|
||||
extern CVar* g_threatWarningCVar;
|
||||
|
||||
@@ -15,6 +15,10 @@
|
||||
#include "WoW/Source/Object/ObjectClient/Unit_C.h"
|
||||
#include "WoW/Source/ObjectMgrClient/ObjectMgrClient.h"
|
||||
#include "WoW/Source/Ui/ChatFrame.h"
|
||||
#include "WoW/Source/Net/Types.h"
|
||||
|
||||
// STATIC: 0x00A12FD0
|
||||
static const int32_t s_questGreenRange[20] = { 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8 };
|
||||
|
||||
// STATIC: 0x00BFC968
|
||||
GossipQuestInfo CGGossipInfo::m_quests[32];
|
||||
@@ -194,7 +198,7 @@ void CGGossipInfo::SetGossipText(int32_t textId) {
|
||||
FrameScript_SignalEvent(SCRIPT_EVENT_GOSSIP_SHOW, nullptr);
|
||||
}
|
||||
|
||||
// VERIFY: 29396e6a manual
|
||||
// VERIFY: d88a5144 manual
|
||||
// OFFSET: 0x0058B1B0
|
||||
int32_t Packet_SMSG_GOSSIP_MESSAGE(void* param, NETMESSAGE msgId, uint32_t time, CDataStore* msg) {
|
||||
WOWGUID guid;
|
||||
@@ -251,7 +255,7 @@ int32_t Packet_SMSG_GOSSIP_MESSAGE(void* param, NETMESSAGE msgId, uint32_t time,
|
||||
GossipQuestInfo& quest = CGGossipInfo::m_quests[i];
|
||||
msg->Get(quest.m_questID);
|
||||
msg->Get(quest.m_icon);
|
||||
msg->Get(quest.m_level);
|
||||
msg->Get(reinterpret_cast<uint32_t&>(quest.m_level));
|
||||
msg->Get(quest.m_flags);
|
||||
|
||||
uint8_t repeatable = 0;
|
||||
@@ -263,3 +267,196 @@ int32_t Packet_SMSG_GOSSIP_MESSAGE(void* param, NETMESSAGE msgId, uint32_t time,
|
||||
CGGossipInfo::SetGossipText(textId);
|
||||
return 1;
|
||||
}
|
||||
|
||||
// VERIFY: a6fc8431 manual
|
||||
// OFFSET: 0x0058A5D0
|
||||
int32_t CGGossipInfo::GetNumAvailableQuests() {
|
||||
int32_t count = 0;
|
||||
|
||||
for (uint32_t i = 0; i < 32; i++) {
|
||||
if (!CGGossipInfo::m_quests[i].m_questID) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (CGGossipInfo::m_quests[i].m_icon != 3 && CGGossipInfo::m_quests[i].m_icon != 4) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
// VERIFY: 419ae02f auto
|
||||
// OFFSET: 0x0058A660
|
||||
GossipQuestInfo* CGGossipInfo::GetAvailableQuest(int32_t index) {
|
||||
int32_t found = 0;
|
||||
|
||||
for (uint32_t i = 0; i < 32; i++) {
|
||||
if (!CGGossipInfo::m_quests[i].m_questID) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (CGGossipInfo::m_quests[i].m_icon != 3 && CGGossipInfo::m_quests[i].m_icon != 4) {
|
||||
if (found == index) {
|
||||
return &CGGossipInfo::m_quests[i];
|
||||
}
|
||||
|
||||
found++;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// VERIFY: 16fb1584 manual
|
||||
// OFFSET: 0x0058A6C0
|
||||
int32_t CGGossipInfo::GetNumActiveQuests() {
|
||||
int32_t count = 0;
|
||||
|
||||
for (uint32_t i = 0; i < 32; i++) {
|
||||
if (!CGGossipInfo::m_quests[i].m_questID) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (CGGossipInfo::m_quests[i].m_icon == 3 || CGGossipInfo::m_quests[i].m_icon == 4) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
// VERIFY: d3d99b53 auto
|
||||
// OFFSET: 0x0058A750
|
||||
GossipQuestInfo* CGGossipInfo::GetActiveQuest(int32_t index) {
|
||||
int32_t found = 0;
|
||||
|
||||
for (uint32_t i = 0; i < 32; i++) {
|
||||
if (!CGGossipInfo::m_quests[i].m_questID) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (CGGossipInfo::m_quests[i].m_icon == 3 || CGGossipInfo::m_quests[i].m_icon == 4) {
|
||||
if (found == index) {
|
||||
return &CGGossipInfo::m_quests[i];
|
||||
}
|
||||
|
||||
found++;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// VERIFY: 19587bce manual
|
||||
// OFFSET: 0x0058ABA0
|
||||
int32_t CGQuestInfo::IsLowLevel(int32_t level) {
|
||||
if (level == -1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t band = static_cast<int32_t>(static_cast<CGPlayer_C*>(ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPEMASK_PLAYER, __FILE__, __LINE__))->m_unit->m_unitFieldLevel) / 5;
|
||||
int32_t range = band < 20 ? s_questGreenRange[band] : 8;
|
||||
return level + range < static_cast<int32_t>(static_cast<CGPlayer_C*>(ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPEMASK_PLAYER, __FILE__, __LINE__))->m_unit->m_unitFieldLevel);
|
||||
}
|
||||
|
||||
// VERIFY: 6deef597 manual
|
||||
// OFFSET: 0x0058AF10
|
||||
void CGGossipInfo::SelectGossipOption(int32_t index, const char* code, int32_t confirmed) {
|
||||
if (CGGossipInfo::m_textPending || index < 0 || index >= 32) {
|
||||
return;
|
||||
}
|
||||
|
||||
GossipOption& option = CGGossipInfo::m_options[index];
|
||||
|
||||
if (option.m_index == -1) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (option.m_boxText && !confirmed) {
|
||||
FrameScript_SignalEvent(SCRIPT_EVENT_GOSSIP_CONFIRM, "%d%s%d", index + 1, option.m_boxText, option.m_boxMoney);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((option.m_coded & 1) && (!code || !*code)) {
|
||||
FrameScript_SignalEvent(SCRIPT_EVENT_GOSSIP_ENTER_CODE, "%d", index + 1);
|
||||
return;
|
||||
}
|
||||
|
||||
CGPlayer_C* player = ClntObjMgrGetActivePlayerObj();
|
||||
|
||||
if (player && option.m_boxMoney > player->GetCoinage()) {
|
||||
CGGameUI::DisplayError(ERR_NOT_ENOUGH_MONEY);
|
||||
return;
|
||||
}
|
||||
|
||||
CDataStore msg;
|
||||
msg.Put(static_cast<uint32_t>(CMSG_GOSSIP_SELECT_OPTION));
|
||||
msg.Put(CGGossipInfo::m_gossip.m_guid);
|
||||
msg.Put(CGGossipInfo::unk_C016F8);
|
||||
msg.Put(static_cast<uint32_t>(option.m_index));
|
||||
|
||||
if (option.m_coded & 1) {
|
||||
msg.PutString(code);
|
||||
}
|
||||
|
||||
msg.Finalize();
|
||||
ClientServices::Send2(&msg);
|
||||
CGGossipInfo::ClearOptions();
|
||||
FrameScript_SignalEvent(SCRIPT_EVENT_GOSSIP_CONFIRM_CANCEL, nullptr);
|
||||
}
|
||||
|
||||
// VERIFY: b9f3085b manual
|
||||
// OFFSET: 0x0058B070
|
||||
void CGGossipInfo::SelectGossipAvailableQuest(int32_t index) {
|
||||
int32_t found = 0;
|
||||
|
||||
for (uint32_t i = 0; i < 32; i++) {
|
||||
GossipQuestInfo& quest = CGGossipInfo::m_quests[i];
|
||||
|
||||
if (!quest.m_questID) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (quest.m_icon == 3 || quest.m_icon == 4) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (found == index && ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPEMASK_PLAYER, __FILE__, __LINE__)) {
|
||||
WOWGUID gossip = CGGossipInfo::m_gossip;
|
||||
|
||||
if (quest.m_icon) {
|
||||
CGPlayer_C::QueryQuest(gossip, quest.m_questID);
|
||||
} else {
|
||||
CGPlayer_C::CompleteQuest(gossip, quest.m_questID);
|
||||
}
|
||||
}
|
||||
|
||||
found++;
|
||||
}
|
||||
}
|
||||
|
||||
// VERIFY: c971dae1 manual
|
||||
// OFFSET: 0x0058B120
|
||||
void CGGossipInfo::SelectGossipActiveQuest(int32_t index) {
|
||||
int32_t found = 0;
|
||||
|
||||
for (uint32_t i = 0; i < 32; i++) {
|
||||
GossipQuestInfo& quest = CGGossipInfo::m_quests[i];
|
||||
|
||||
if (!quest.m_questID) {
|
||||
break;
|
||||
}
|
||||
|
||||
if (quest.m_icon != 3 && quest.m_icon != 4) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (found == index && ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPEMASK_PLAYER, __FILE__, __LINE__)) {
|
||||
WOWGUID gossip = CGGossipInfo::m_gossip;
|
||||
CGPlayer_C::CompleteQuest(gossip, quest.m_questID);
|
||||
}
|
||||
|
||||
found++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ struct GossipOption {
|
||||
|
||||
struct GossipQuestInfo {
|
||||
/* 0000 */ uint32_t m_questID;
|
||||
/* 0004 */ uint32_t m_level;
|
||||
/* 0004 */ int32_t m_level;
|
||||
/* 0008 */ uint32_t m_flags;
|
||||
/* 000C */ uint32_t m_repeatable;
|
||||
/* 0010 */ uint32_t m_icon;
|
||||
@@ -27,6 +27,13 @@ struct GossipQuestInfo {
|
||||
|
||||
class CGGossipInfo {
|
||||
public:
|
||||
static int32_t GetNumAvailableQuests();
|
||||
static GossipQuestInfo* GetAvailableQuest(int32_t index);
|
||||
static int32_t GetNumActiveQuests();
|
||||
static GossipQuestInfo* GetActiveQuest(int32_t index);
|
||||
static void SelectGossipOption(int32_t index, const char* code, int32_t confirmed);
|
||||
static void SelectGossipAvailableQuest(int32_t index);
|
||||
static void SelectGossipActiveQuest(int32_t index);
|
||||
static GossipQuestInfo m_quests[32];
|
||||
static int32_t m_textPending;
|
||||
static void ClearOptions();
|
||||
@@ -40,14 +47,6 @@ class CGGossipInfo {
|
||||
static uint32_t m_gossipOptionsCount;
|
||||
};
|
||||
|
||||
int32_t Script_GetNumGossipAvailableQuests(lua_State* L);
|
||||
int32_t Script_GetNumGossipActiveQuests(lua_State* L);
|
||||
int32_t Script_GetGossipAvailableQuests(lua_State* L);
|
||||
int32_t Script_GetGossipActiveQuests(lua_State* L);
|
||||
int32_t Script_SelectGossipOption(lua_State* L);
|
||||
int32_t Script_SelectGossipAvailableQuest(lua_State* L);
|
||||
int32_t Script_SelectGossipActiveQuest(lua_State* L);
|
||||
int32_t Script_CloseGossip(lua_State* L);
|
||||
void GossipInfoRegisterScriptFunctions();
|
||||
|
||||
class CDataStore;
|
||||
|
||||
@@ -5,6 +5,10 @@
|
||||
#include "Engine/Source/lua-5.1/src/lua.h"
|
||||
#include "WoW/Source/ObjectMgrClient/ObjectMgrClient.h"
|
||||
#include "WoW/Source/Object/ObjectClient/Unit_C.h"
|
||||
#include "Engine/Source/FrameXML/LoadXML.h"
|
||||
#include "Engine/Source/lua-5.1/src/lauxlib.h"
|
||||
#include "WoW/Source/Ui/QuestFrame.h"
|
||||
#include "WoW/Source/Ui/QuestLog.h"
|
||||
|
||||
// STATIC: 0x00ACEF20
|
||||
static const char* s_gossipTypes[22] = {
|
||||
@@ -77,6 +81,141 @@ static int32_t Script_GetGossipOptions(lua_State* L) {
|
||||
return 2 * count;
|
||||
}
|
||||
|
||||
// VERIFY: 2c77e3ed manual
|
||||
// OFFSET: 0x0058A960
|
||||
static int32_t Script_GetNumGossipAvailableQuests(lua_State* L) {
|
||||
lua_pushnumber(L, CGGossipInfo::GetNumAvailableQuests());
|
||||
return 1;
|
||||
}
|
||||
|
||||
// VERIFY: 9166f232 manual
|
||||
// OFFSET: 0x0058A9A0
|
||||
static int32_t Script_GetNumGossipActiveQuests(lua_State* L) {
|
||||
lua_pushnumber(L, CGGossipInfo::GetNumActiveQuests());
|
||||
return 1;
|
||||
}
|
||||
|
||||
// VERIFY: 9e58002d auto
|
||||
// OFFSET: 0x0058AA40
|
||||
static int32_t Script_CloseGossip(lua_State* L) {
|
||||
WOWGUID none = { 0 };
|
||||
CGGossipInfo::SetGossip(none);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// VERIFY: 4fc9b751 auto
|
||||
// OFFSET: 0x0058B3A0
|
||||
static int32_t Script_GetGossipAvailableQuests(lua_State* L) {
|
||||
uint32_t total = static_cast<uint32_t>(CGGossipInfo::GetNumAvailableQuests());
|
||||
int32_t count = 0;
|
||||
|
||||
for (uint32_t i = 0; i < total; i++) {
|
||||
GossipQuestInfo* quest = CGGossipInfo::GetAvailableQuest(i);
|
||||
|
||||
if (!quest) {
|
||||
continue;
|
||||
}
|
||||
|
||||
lua_checkstack(L, 5);
|
||||
lua_pushstring(L, quest->m_title);
|
||||
lua_pushnumber(L, quest->m_level);
|
||||
|
||||
if (CGQuestInfo::IsLowLevel(quest->m_level)) {
|
||||
lua_pushnumber(L, 1.0);
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
}
|
||||
|
||||
if (quest->m_flags & 0x1000) {
|
||||
lua_pushnumber(L, 1.0);
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
}
|
||||
|
||||
if (quest->m_repeatable) {
|
||||
lua_pushnumber(L, 1.0);
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
}
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
return 5 * count;
|
||||
}
|
||||
|
||||
// VERIFY: 79e4bd10 manual
|
||||
// OFFSET: 0x0058B490
|
||||
static int32_t Script_GetGossipActiveQuests(lua_State* L) {
|
||||
uint32_t total = static_cast<uint32_t>(CGGossipInfo::GetNumActiveQuests());
|
||||
int32_t count = 0;
|
||||
|
||||
for (uint32_t i = 0; i < total; i++) {
|
||||
GossipQuestInfo* quest = CGGossipInfo::GetActiveQuest(i);
|
||||
|
||||
if (!quest) {
|
||||
continue;
|
||||
}
|
||||
|
||||
lua_checkstack(L, 4);
|
||||
lua_pushstring(L, quest->m_title);
|
||||
lua_pushnumber(L, quest->m_level);
|
||||
|
||||
if (CGQuestInfo::IsLowLevel(quest->m_level)) {
|
||||
lua_pushnumber(L, 1.0);
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
}
|
||||
|
||||
int32_t index = CGQuestLog::GetQuestIndex(quest->m_questID);
|
||||
|
||||
if (index > 0 && (CGQuestLog::IsQuestCompleteEx(index - 1, 1) || CGQuestLog::HasNoObjectives(index - 1))) {
|
||||
lua_pushnumber(L, 1.0);
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
}
|
||||
|
||||
count++;
|
||||
}
|
||||
|
||||
return 4 * count;
|
||||
}
|
||||
|
||||
// VERIFY: e59d4d4e manual
|
||||
// OFFSET: 0x0058B590
|
||||
static int32_t Script_SelectGossipOption(lua_State* L) {
|
||||
if (!lua_isnumber(L, 1)) {
|
||||
return luaL_error(L, "Usage: SelectGossipOption(index)");
|
||||
}
|
||||
|
||||
int32_t index = static_cast<int32_t>(lua_tonumber(L, 1)) - 1;
|
||||
int32_t confirmed = StringToBOOL(L, 3, 0);
|
||||
CGGossipInfo::SelectGossipOption(index, lua_tolstring(L, 2, nullptr), confirmed);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// VERIFY: 89ac0b6a manual
|
||||
// OFFSET: 0x0058B600
|
||||
static int32_t Script_SelectGossipAvailableQuest(lua_State* L) {
|
||||
if (!lua_isnumber(L, 1)) {
|
||||
return luaL_error(L, "Usage: SelectGossipAvailableQuest(index)");
|
||||
}
|
||||
|
||||
CGGossipInfo::SelectGossipAvailableQuest(static_cast<int32_t>(lua_tonumber(L, 1)) - 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// VERIFY: a699660e manual
|
||||
// OFFSET: 0x0058B670
|
||||
static int32_t Script_SelectGossipActiveQuest(lua_State* L) {
|
||||
if (!lua_isnumber(L, 1)) {
|
||||
return luaL_error(L, "Usage: SelectGossipActiveQuest(index)");
|
||||
}
|
||||
|
||||
CGGossipInfo::SelectGossipActiveQuest(static_cast<int32_t>(lua_tonumber(L, 1)) - 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// STATIC: 0x00ACEF78
|
||||
static FrameScript_Method s_ScriptFunctions[] = {
|
||||
{ "GetGossipText", &Script_GetGossipText },
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
#include "WoW/Source/DB/DBClient/DBCacheInstances.h"
|
||||
#include "WoW/Source/Ui/Tutorial.h"
|
||||
|
||||
// STATIC: 0x00BF90F8
|
||||
uint32_t CGMerchantInfo::m_buybackSlots[12];
|
||||
|
||||
// STATIC: 0x00BFA3F8
|
||||
uint32_t CGMerchantInfo::m_pendingItemStats;
|
||||
|
||||
@@ -108,3 +111,30 @@ void CGMerchantInfo::SetMerchant(WOWGUID merchant, const MerchantItem* items, in
|
||||
CGMerchantInfo::m_pendingItemStats = 0;
|
||||
FrameScript_SignalEvent(SCRIPT_EVENT_MERCHANT_SHOW, nullptr);
|
||||
}
|
||||
|
||||
// VERIFY: 3f87e2cf manual
|
||||
// OFFSET: 0x00584080
|
||||
MerchantItem* CGMerchantInfo::GetItem(int32_t index) {
|
||||
if (index >= 0 && index < CGMerchantInfo::m_numMerchantItems && CGMerchantInfo::m_merchant) {
|
||||
return &CGMerchantInfo::m_items[index];
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// VERIFY: f9ba7356 auto
|
||||
// OFFSET: 0x00584680
|
||||
ItemStats_C* CGMerchantInfo::GetItemStats(int32_t itemId) {
|
||||
if (!itemId) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WOWGUID merchant = CGMerchantInfo::m_merchant;
|
||||
ItemStats_C* stats = g_itemDBCache.GetRecord(itemId, merchant, MerchantItemStatsCallback, nullptr, false);
|
||||
|
||||
if (!stats) {
|
||||
CGMerchantInfo::m_pendingItemStats++;
|
||||
}
|
||||
|
||||
return stats;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include <cstdint>
|
||||
#include "WoW/Source/Object/WGUID.h"
|
||||
|
||||
class ItemStats_C;
|
||||
class CGItem_C;
|
||||
|
||||
struct lua_State;
|
||||
@@ -21,6 +22,9 @@ struct MerchantItem {
|
||||
|
||||
class CGMerchantInfo {
|
||||
public:
|
||||
static uint32_t m_buybackSlots[12];
|
||||
static MerchantItem* GetItem(int32_t index);
|
||||
static ItemStats_C* GetItemStats(int32_t itemId);
|
||||
static uint32_t m_pendingItemStats;
|
||||
static void SetMerchant(WOWGUID merchant, const MerchantItem* items, int32_t count);
|
||||
static void CloseMerchant();
|
||||
@@ -33,21 +37,6 @@ class CGMerchantInfo {
|
||||
static uint32_t m_numBuybackItems;
|
||||
};
|
||||
|
||||
int32_t Script_CloseMerchant(lua_State* L);
|
||||
int32_t Script_GetMerchantItemInfo(lua_State* L);
|
||||
int32_t Script_GetMerchantItemCostItem(lua_State* L);
|
||||
int32_t Script_GetBuybackItemInfo(lua_State* L);
|
||||
int32_t Script_GetBuybackItemLink(lua_State* L);
|
||||
int32_t Script_GetMerchantItemLink(lua_State* L);
|
||||
int32_t Script_PickupMerchantItem(lua_State* L);
|
||||
int32_t Script_BuyMerchantItem(lua_State* L);
|
||||
int32_t Script_BuybackItem(lua_State* L);
|
||||
int32_t Script_ShowMerchantSellCursor(lua_State* L);
|
||||
int32_t Script_ShowBuybackSellCursor(lua_State* L);
|
||||
int32_t Script_ShowRepairCursor(lua_State* L);
|
||||
int32_t Script_HideRepairCursor(lua_State* L);
|
||||
int32_t Script_GetRepairAllCost(lua_State* L);
|
||||
int32_t Script_RepairAllItems(lua_State* L);
|
||||
void MerchantRegisterScriptFunctions();
|
||||
|
||||
#endif
|
||||
|
||||
@@ -11,6 +11,22 @@
|
||||
#include "WoW/Source/DB/DBClient/DBCacheInstances.h"
|
||||
#include "WoW/Source/DB/Rec/ItemExtendedCostRec.h"
|
||||
#include "WoW/Source/Object/ItemStats.h"
|
||||
#include "Engine/Source/Base/CDataStore.h"
|
||||
#include "Engine/Source/FrameXML/LoadXML.h"
|
||||
#include "Engine/Source/Storm/H/storm.h"
|
||||
#include "WoW/Source/Magic/MagicClient/Spell_C.h"
|
||||
#include "WoW/Source/Object/ObjectClient/Item_C.h"
|
||||
#include "WoW/Source/Object/ObjectClient/Player_C.h"
|
||||
#include "WoW/Source/Object/Item.h"
|
||||
#include "WoW/Source/Object/Player.h"
|
||||
#include "WoW/Source/Ui/ArenaTeamInfo.h"
|
||||
#include "WoW/Source/Ui/GameUI.h"
|
||||
#include "WoW/Source/Ui/ReputationInfo.h"
|
||||
#include "WoW/Source/Ui/ScriptEvents.h"
|
||||
#include "WoW/Source/Ui/Types.h"
|
||||
#include "WoW/Source/UIUtil/Tooltip.h"
|
||||
#include "WoW/Source/WowServices/WDataStore.h"
|
||||
#include "WoW/Source/WowSvcs/WowSvcsClient/ClientServices.h"
|
||||
|
||||
// VERIFY: 32f102ca auto
|
||||
// OFFSET: 0x005841D0
|
||||
@@ -123,6 +139,611 @@ static int32_t Script_GetMerchantItemCostInfo(lua_State* L) {
|
||||
return 3;
|
||||
}
|
||||
|
||||
// VERIFY: 7a7ca74d auto
|
||||
// OFFSET: 0x005840B0
|
||||
static void BuybackItemStatsCallback(int32_t id, const WOWGUID& guid, void* param, bool success) {
|
||||
FrameScript_SignalEvent(SCRIPT_EVENT_MERCHANT_UPDATE, nullptr);
|
||||
}
|
||||
|
||||
// VERIFY: 77dd56c8 auto
|
||||
// OFFSET: 0x00584200
|
||||
static int32_t Script_GetMerchantItemLink(lua_State* L) {
|
||||
if (!lua_isnumber(L, 1)) {
|
||||
return luaL_error(L, "Usage: GetMerchantItemLink(index)");
|
||||
}
|
||||
|
||||
int32_t index = static_cast<int32_t>(lua_tonumber(L, 1)) - 1;
|
||||
|
||||
if (index < 0 || index >= CGMerchantInfo::m_numMerchantItems || !CGMerchantInfo::m_merchant) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
MerchantItem* item = &CGMerchantInfo::m_items[index];
|
||||
|
||||
if (!item || !item->m_itemID) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
WOWGUID none = { 0 };
|
||||
ItemStats_C* stats = g_itemDBCache.GetRecord(item->m_itemID, none, nullptr, nullptr, false);
|
||||
|
||||
if (!stats) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
lua_pushstring(L, CGTooltip::GetItemHyperlinkString(item->m_itemID, stats->m_quality, 0, 0, 0));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// VERIFY: ffebd45e auto
|
||||
// OFFSET: 0x00584390
|
||||
static int32_t Script_HideRepairCursor(lua_State* L) {
|
||||
if (CursorGetResetMode() == 17) {
|
||||
CursorSetResetMode(1);
|
||||
CursorSetMode(1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// VERIFY: a936bd94 auto
|
||||
// OFFSET: 0x005846D0
|
||||
static int32_t Script_CloseMerchant(lua_State* L) {
|
||||
CGMerchantInfo::CloseMerchant();
|
||||
return 0;
|
||||
}
|
||||
|
||||
// VERIFY: 64f4cf8a auto
|
||||
// OFFSET: 0x00584820
|
||||
static int32_t Script_GetMerchantItemCostItem(lua_State* L) {
|
||||
if (!lua_isnumber(L, 1) || !lua_isnumber(L, 2)) {
|
||||
return luaL_error(L, "Usage: GetMerchantItemCostItem(index, itemIndex)");
|
||||
}
|
||||
|
||||
int32_t index = static_cast<int32_t>(lua_tonumber(L, 1)) - 1;
|
||||
int32_t costIndex = static_cast<int32_t>(lua_tonumber(L, 2)) - 1;
|
||||
MerchantItem* item;
|
||||
ItemExtendedCostRec* cost;
|
||||
|
||||
if (index < 0 || index >= CGMerchantInfo::m_numMerchantItems || !CGMerchantInfo::m_merchant || !(item = &CGMerchantInfo::m_items[index]) || !item->m_itemID || !(cost = g_itemExtendedCostDB.GetRecord(item->m_extendedCostID))) {
|
||||
lua_pushnil(L);
|
||||
lua_pushnumber(L, 0.0);
|
||||
return 2;
|
||||
}
|
||||
|
||||
int32_t found = 0;
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < 5; i++) {
|
||||
if (!cost->m_itemID[i]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (found == costIndex) {
|
||||
break;
|
||||
}
|
||||
|
||||
found++;
|
||||
}
|
||||
|
||||
if (i >= 5) {
|
||||
lua_pushnil(L);
|
||||
lua_pushnumber(L, 0.0);
|
||||
return 2;
|
||||
}
|
||||
|
||||
WOWGUID none = { 0 };
|
||||
ItemStats_C* stats = g_itemDBCache.GetRecord(cost->m_itemID[i], none, BuybackItemStatsCallback, nullptr, true);
|
||||
|
||||
if (!stats) {
|
||||
lua_pushnil(L);
|
||||
lua_pushnumber(L, cost->m_itemCount[i]);
|
||||
return 2;
|
||||
}
|
||||
|
||||
const char* path = ClientDBStringLookup(3);
|
||||
char texture[260];
|
||||
SStrPrintf(texture, sizeof(texture), "%s%s%s", path, *path ? "\\" : "", CGItem_C::GetInventoryArt(stats->m_displayId));
|
||||
lua_pushstring(L, texture);
|
||||
lua_pushnumber(L, cost->m_itemCount[i]);
|
||||
lua_pushstring(L, CGTooltip::GetItemHyperlinkString(cost->m_itemID[i], stats->m_quality, 0, 0, 0));
|
||||
return 3;
|
||||
}
|
||||
|
||||
// VERIFY: 93965602 manual
|
||||
// OFFSET: 0x00584A60
|
||||
static int32_t Script_ShowRepairCursor(lua_State* L) {
|
||||
if (Spell_C_IsTargeting()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
CGUnit_C* unit = static_cast<CGUnit_C*>(ClntObjMgrObjectPtr(CGMerchantInfo::m_merchant, TYPEMASK_UNIT, __FILE__, __LINE__));
|
||||
|
||||
if (unit && (unit->m_unit->m_unitNpcFlags & 0x1000)) {
|
||||
CGGameUI::ClearCursor(1, 1);
|
||||
CursorSetResetMode(17);
|
||||
CursorSetMode(17);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// VERIFY: bc45f8d1 manual
|
||||
// OFFSET: 0x00584E10
|
||||
static int32_t Script_GetMerchantItemInfo(lua_State* L) {
|
||||
if (!lua_isnumber(L, 1)) {
|
||||
return luaL_error(L, "Usage: GetMerchantItemInfo(index)");
|
||||
}
|
||||
|
||||
int32_t index = static_cast<int32_t>(lua_tonumber(L, 1)) - 1;
|
||||
MerchantItem* item;
|
||||
|
||||
if (index < 0 || index >= CGMerchantInfo::m_numMerchantItems || !CGMerchantInfo::m_merchant || !(item = &CGMerchantInfo::m_items[index]) || !item->m_itemID) {
|
||||
lua_pushnil(L);
|
||||
lua_pushnil(L);
|
||||
lua_pushnumber(L, 0.0);
|
||||
lua_pushnumber(L, 1.0);
|
||||
lua_pushnumber(L, 0.0);
|
||||
lua_pushnumber(L, 1.0);
|
||||
lua_pushnil(L);
|
||||
return 7;
|
||||
}
|
||||
|
||||
ItemStats_C* stats = CGMerchantInfo::GetItemStats(item->m_itemID);
|
||||
|
||||
if (stats) {
|
||||
lua_pushstring(L, stats->GetName(0));
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
}
|
||||
|
||||
const char* path = ClientDBStringLookup(3);
|
||||
char texture[260];
|
||||
SStrPrintf(texture, sizeof(texture), "%s%s%s", path, *path ? "\\" : "", CGItem_C::GetInventoryArt(item->m_displayID));
|
||||
lua_pushstring(L, texture);
|
||||
lua_pushnumber(L, item->m_price);
|
||||
lua_pushnumber(L, item->m_buyCount);
|
||||
lua_pushnumber(L, item->m_maxCount);
|
||||
|
||||
CGPlayer_C* player = static_cast<CGPlayer_C*>(ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPEMASK_PLAYER, __FILE__, __LINE__));
|
||||
ItemExtendedCostRec* cost = g_itemExtendedCostDB.GetRecord(item->m_extendedCostID);
|
||||
bool affordable = false;
|
||||
|
||||
if (!cost || !cost->m_requiredArenaRating || (static_cast<uint32_t>(cost->m_arenaBracket) <= 2 && CGArenaTeamInfo::CheckPersonalAndTeamRating(cost->m_requiredArenaRating, cost->m_arenaBracket))) {
|
||||
affordable = true;
|
||||
}
|
||||
|
||||
int32_t error;
|
||||
|
||||
if ((player && stats && !player->CanUseItem(stats, error)) || !affordable) {
|
||||
lua_pushnil(L);
|
||||
} else {
|
||||
lua_pushnumber(L, 1.0);
|
||||
}
|
||||
|
||||
if (cost) {
|
||||
lua_pushnumber(L, 1.0);
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
}
|
||||
|
||||
return 7;
|
||||
}
|
||||
|
||||
// VERIFY: a814f0b1 manual
|
||||
// OFFSET: 0x00585070
|
||||
static int32_t Script_GetBuybackItemInfo(lua_State* L) {
|
||||
if (!lua_isnumber(L, 1)) {
|
||||
return luaL_error(L, "Usage: GetBuybackItemInfo(slot)");
|
||||
}
|
||||
|
||||
CGPlayer_C* player = static_cast<CGPlayer_C*>(ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPEMASK_PLAYER, __FILE__, __LINE__));
|
||||
uint32_t index = static_cast<uint32_t>(static_cast<int64_t>(lua_tonumber(L, 1)) - 1);
|
||||
uint32_t slot = index < CGMerchantInfo::m_numBuybackItems ? CGMerchantInfo::m_buybackSlots[index] : 0;
|
||||
CGItem_C* item;
|
||||
ItemStats_C* stats;
|
||||
WOWGUID none = { 0 };
|
||||
|
||||
if (player && slot && slot < static_cast<uint32_t>(player->m_bag.m_numSlots) && player->m_bag.m_slots[slot] && (item = player->m_bag.GetItemPointer(slot)) && (stats = g_itemDBCache.GetRecord(item->m_obj->m_entryID, none, BuybackItemStatsCallback, nullptr, false))) {
|
||||
char buffer[260];
|
||||
item->GetFullItemName(buffer, sizeof(buffer));
|
||||
lua_pushstring(L, buffer);
|
||||
|
||||
const char* path = ClientDBStringLookup(3);
|
||||
SStrPrintf(buffer, sizeof(buffer), "%s%s%s", path, *path ? "\\" : "", item->GetInventoryArt());
|
||||
lua_pushstring(L, buffer);
|
||||
lua_pushnumber(L, player->GetBuybackPrice(slot - 74));
|
||||
lua_pushnumber(L, item->m_item->m_itemFieldStackCount);
|
||||
lua_pushnumber(L, 0.0);
|
||||
|
||||
int32_t error;
|
||||
|
||||
if (!player->CanUseItem(stats, error)) {
|
||||
lua_pushnil(L);
|
||||
return 6;
|
||||
}
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
lua_pushnil(L);
|
||||
lua_pushnumber(L, 0.0);
|
||||
lua_pushnumber(L, 1.0);
|
||||
lua_pushnumber(L, 0.0);
|
||||
}
|
||||
|
||||
lua_pushnumber(L, 1.0);
|
||||
return 6;
|
||||
}
|
||||
|
||||
// VERIFY: c832bd12 manual
|
||||
// OFFSET: 0x005852C0
|
||||
static int32_t Script_GetBuybackItemLink(lua_State* L) {
|
||||
if (!lua_isnumber(L, 1)) {
|
||||
return luaL_error(L, "Usage: GetBuybackItemLink(slot)");
|
||||
}
|
||||
|
||||
CGPlayer_C* player = static_cast<CGPlayer_C*>(ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPEMASK_PLAYER, __FILE__, __LINE__));
|
||||
uint32_t index = static_cast<uint32_t>(lua_tonumber(L, 1)) - 1;
|
||||
uint32_t slot = index < CGMerchantInfo::m_numBuybackItems ? CGMerchantInfo::m_buybackSlots[index] : 0;
|
||||
|
||||
if (!player || !slot || slot >= static_cast<uint32_t>(player->m_bag.m_numSlots) || !player->m_bag.m_slots[slot]) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
CGItem_C* item = player->m_bag.GetItemPointer(slot);
|
||||
|
||||
if (!item) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
lua_pushstring(L, CGTooltip::GetItemHyperlinkString(item));
|
||||
return 1;
|
||||
}
|
||||
|
||||
// VERIFY: 3a995819 manual
|
||||
// OFFSET: 0x005853A0
|
||||
static int32_t Script_PickupMerchantItem(lua_State* L) {
|
||||
if (!ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPEMASK_PLAYER, __FILE__, __LINE__)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
WOWGUID cursorItem = CGGameUI::GetCursorItem();
|
||||
|
||||
if (cursorItem) {
|
||||
CGItem_C* item = static_cast<CGItem_C*>(ClntObjMgrObjectPtr(cursorItem, TYPEMASK_ITEM, __FILE__, __LINE__));
|
||||
|
||||
if (!item || !CGGameUI::m_stackSplit || item->m_item->m_itemFieldStackCount == CGGameUI::m_stackSplit) {
|
||||
CGPlayer_C::SellItem(CGMerchantInfo::m_merchant, cursorItem, CGGameUI::m_stackSplit);
|
||||
CGGameUI::ClearCursor(0, 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t index;
|
||||
MerchantItem* item;
|
||||
|
||||
if (!lua_isnumber(L, 1) || !(item = CGMerchantInfo::GetItem(index = static_cast<int32_t>(lua_tonumber(L, 1)) - 1)) || !item->m_slot) {
|
||||
CGGameUI::ClearCursor(1, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t itemId = item->m_itemID;
|
||||
|
||||
if (CGGameUI::GetCursorVirtualItem() == itemId) {
|
||||
CGGameUI::ClearCursor(1, 1);
|
||||
} else {
|
||||
CGGameUI::SetCursorVirtualItem(itemId, item->m_displayID, index, 5, 0);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// VERIFY: 1597625c manual
|
||||
// OFFSET: 0x005854C0
|
||||
static int32_t Script_BuyMerchantItem(lua_State* L) {
|
||||
if (!lua_isnumber(L, 1)) {
|
||||
return luaL_error(L, "Usage: BuyMerchantItem(index)");
|
||||
}
|
||||
|
||||
if (!ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPEMASK_PLAYER, __FILE__, __LINE__)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
CGGameUI::ClearCursor(1, 1);
|
||||
int32_t index = static_cast<int32_t>(lua_tonumber(L, 1)) - 1;
|
||||
int32_t count = 1;
|
||||
|
||||
if (lua_isnumber(L, 2) && static_cast<int32_t>(lua_tonumber(L, 2)) >= 1) {
|
||||
count = static_cast<int32_t>(lua_tonumber(L, 2));
|
||||
|
||||
if (count >= 255) {
|
||||
count = 255;
|
||||
}
|
||||
}
|
||||
|
||||
if (index < 0 || index >= CGMerchantInfo::m_numMerchantItems || !CGMerchantInfo::m_merchant) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
MerchantItem* item = &CGMerchantInfo::m_items[index];
|
||||
|
||||
if (item && item->m_slot) {
|
||||
CGPlayer_C::BuyItem(CGMerchantInfo::m_merchant, item, static_cast<uint8_t>(count), 1);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// VERIFY: e5e81d26 manual
|
||||
// OFFSET: 0x005855C0
|
||||
static int32_t Script_BuybackItem(lua_State* L) {
|
||||
if (!lua_isnumber(L, 1)) {
|
||||
return luaL_error(L, "Usage: BuybackItem(slot)");
|
||||
}
|
||||
|
||||
WOWGUID merchant = CGMerchantInfo::m_merchant;
|
||||
|
||||
if (!merchant) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t index = static_cast<uint32_t>(static_cast<int64_t>(lua_tonumber(L, 1)) - 1);
|
||||
uint32_t slot = index < CGMerchantInfo::m_numBuybackItems ? CGMerchantInfo::m_buybackSlots[index] : 0;
|
||||
CGPlayer_C* player = static_cast<CGPlayer_C*>(ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPEMASK_PLAYER, __FILE__, __LINE__));
|
||||
|
||||
if (player && slot && player->m_bag.GetItemGuid(slot)) {
|
||||
CDataStore msg;
|
||||
msg.Put(static_cast<uint32_t>(CMSG_BUY_BACK_ITEM));
|
||||
msg.Put(merchant.m_guid);
|
||||
msg.Put(slot);
|
||||
msg.Finalize();
|
||||
ClientServices::Send2(&msg);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// VERIFY: 7ad42e00 manual
|
||||
// OFFSET: 0x005856D0
|
||||
static int32_t Script_ShowMerchantSellCursor(lua_State* L) {
|
||||
if (Spell_C_IsTargeting() || CursorGetResetMode() != 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!lua_isnumber(L, 1)) {
|
||||
return luaL_error(L, "Usage: ShowMerchantSellCursor(index)");
|
||||
}
|
||||
|
||||
MerchantItem* item = CGMerchantInfo::GetItem(static_cast<int32_t>(lua_tonumber(L, 1)) - 1);
|
||||
|
||||
if (!item || !item->m_itemID) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
CGPlayer_C* player = ClntObjMgrGetActivePlayerObj();
|
||||
|
||||
if (!player) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (player->GetCoinage() < static_cast<uint32_t>(item->m_price)) {
|
||||
CursorSetMode(29);
|
||||
return 0;
|
||||
}
|
||||
|
||||
WOWGUID none = { 0 };
|
||||
ItemStats_C* stats = g_itemDBCache.GetRecord(item->m_itemID, none, nullptr, nullptr, false);
|
||||
|
||||
if (!stats) {
|
||||
CursorSetMode(3);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (stats->m_requiredReputationFaction && GetRepListRepValue(stats->m_requiredReputationFaction) < CGReputationInfo::m_reactionThresholds[stats->m_requiredReputationRank]) {
|
||||
CursorSetMode(29);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ItemExtendedCostRec* cost = g_itemExtendedCostDB.GetRecord(item->m_extendedCostID);
|
||||
|
||||
if (!cost) {
|
||||
CursorSetMode(3);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t unable = 0;
|
||||
|
||||
if (player->m_player->m_playerFieldArenaCurrency < static_cast<uint32_t>(cost->m_arenaPoints) || player->m_player->m_playerFieldHonorCurrency < static_cast<uint32_t>(cost->m_honorPoints)) {
|
||||
unable = 1;
|
||||
} else {
|
||||
for (uint32_t i = 0; i < 5; i++) {
|
||||
if (cost->m_itemID[i] && cost->m_itemCount[i] > 0 && player->m_bag.GetItemTypeCount(cost->m_itemID[i], 0) < cost->m_itemCount[i]) {
|
||||
unable = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (cost->m_requiredArenaRating && static_cast<uint32_t>(cost->m_arenaBracket) <= 2 && !CGArenaTeamInfo::CheckPersonalAndTeamRating(cost->m_requiredArenaRating, cost->m_arenaBracket)) {
|
||||
unable = 1;
|
||||
}
|
||||
|
||||
CursorSetMode(unable ? 29 : 3);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// VERIFY: 26f78e7c manual
|
||||
// OFFSET: 0x00585890
|
||||
static int32_t Script_ShowBuybackSellCursor(lua_State* L) {
|
||||
if (Spell_C_IsTargeting() || CursorGetResetMode() != 1) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!lua_isnumber(L, 1)) {
|
||||
return luaL_error(L, "Usage: ShowBuybackSellCursor(index)");
|
||||
}
|
||||
|
||||
uint32_t index = static_cast<uint32_t>(lua_tonumber(L, 1)) - 1;
|
||||
uint32_t slot = index < CGMerchantInfo::m_numBuybackItems ? CGMerchantInfo::m_buybackSlots[index] : 0;
|
||||
CGPlayer_C* player = static_cast<CGPlayer_C*>(ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPEMASK_PLAYER, __FILE__, __LINE__));
|
||||
|
||||
if (player && slot && player->m_bag.GetItemGuid(slot)) {
|
||||
uint32_t price = player->GetBuybackPrice(slot - 74);
|
||||
|
||||
if (player->GetCoinage() >= price) {
|
||||
CursorSetMode(3);
|
||||
return 0;
|
||||
}
|
||||
|
||||
CursorSetMode(29);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// VERIFY: 207bdc12 manual
|
||||
// OFFSET: 0x00585990
|
||||
static int32_t Script_GetRepairAllCost(lua_State* L) {
|
||||
CGUnit_C* merchant = static_cast<CGUnit_C*>(ClntObjMgrObjectPtr(CGMerchantInfo::m_merchant, TYPEMASK_UNIT, __FILE__, __LINE__));
|
||||
CGPlayer_C* player;
|
||||
|
||||
if (!merchant || !(merchant->m_unit->m_unitNpcFlags & 0x1000) || !(player = static_cast<CGPlayer_C*>(ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPEMASK_PLAYER, __FILE__, __LINE__)))) {
|
||||
lua_pushnumber(L, 0.0);
|
||||
return 1;
|
||||
}
|
||||
|
||||
CGBag_C* bag = &player->m_bag;
|
||||
uint32_t cost = 0;
|
||||
int32_t needsRepair = 0;
|
||||
|
||||
for (uint32_t i = 0; i <= 18; i++) {
|
||||
CGItem_C* item = bag->GetItemPointer(i);
|
||||
|
||||
if (item && (item->m_obj->m_type & TYPEMASK_ITEM) && !(item->m_item->m_itemFieldFlags & 0x8) && item->m_item->m_itemFieldMaxdurability) {
|
||||
cost += CGMerchantInfo::GetRepairCost(item);
|
||||
uint32_t durability = (item->m_item->m_itemFieldFlags & 0x8) ? 0 : item->m_item->m_itemFieldDurability;
|
||||
|
||||
if (!(item->m_item->m_itemFieldFlags & 0x8) && durability < item->m_item->m_itemFieldMaxdurability) {
|
||||
needsRepair = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t i = 23; i <= 38; i++) {
|
||||
CGItem_C* item = bag->GetItemPointer(i);
|
||||
|
||||
if (item && (item->m_obj->m_type & TYPEMASK_ITEM) && !(item->m_item->m_itemFieldFlags & 0x8) && item->m_item->m_itemFieldMaxdurability) {
|
||||
cost += CGMerchantInfo::GetRepairCost(item);
|
||||
uint32_t durability = (item->m_item->m_itemFieldFlags & 0x8) ? 0 : item->m_item->m_itemFieldDurability;
|
||||
|
||||
if (!(item->m_item->m_itemFieldFlags & 0x8) && durability < item->m_item->m_itemFieldMaxdurability) {
|
||||
needsRepair = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t i = 19; i <= 22; i++) {
|
||||
CGItem_C* container = bag->GetItemPointer(i);
|
||||
|
||||
if (!container || !container->GetBag()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
CGBag_C* containerBag = container->GetBag();
|
||||
|
||||
for (uint32_t j = 0; j < static_cast<uint32_t>(containerBag->m_numSlots); j++) {
|
||||
CGItem_C* item = containerBag->GetItemPointer(j);
|
||||
|
||||
if (item && (item->m_obj->m_type & TYPEMASK_ITEM) && !(item->m_item->m_itemFieldFlags & 0x8) && item->m_item->m_itemFieldMaxdurability) {
|
||||
cost += CGMerchantInfo::GetRepairCost(item);
|
||||
uint32_t durability = (item->m_item->m_itemFieldFlags & 0x8) ? 0 : item->m_item->m_itemFieldDurability;
|
||||
|
||||
if (!(item->m_item->m_itemFieldFlags & 0x8) && durability < item->m_item->m_itemFieldMaxdurability) {
|
||||
needsRepair = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
lua_pushnumber(L, cost);
|
||||
|
||||
if (needsRepair) {
|
||||
lua_pushnumber(L, 1.0);
|
||||
} else {
|
||||
lua_pushnil(L);
|
||||
}
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
// VERIFY: a91c8774 manual
|
||||
// OFFSET: 0x00585C90
|
||||
static int32_t Script_RepairAllItems(lua_State* L) {
|
||||
CGUnit_C* merchant = static_cast<CGUnit_C*>(ClntObjMgrObjectPtr(CGMerchantInfo::m_merchant, TYPEMASK_UNIT, __FILE__, __LINE__));
|
||||
|
||||
if (!merchant || !(merchant->m_unit->m_unitNpcFlags & 0x1000)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
CGPlayer_C* player = static_cast<CGPlayer_C*>(ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPEMASK_PLAYER, __FILE__, __LINE__));
|
||||
|
||||
if (!player) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t cost = 0;
|
||||
int32_t guildBank = StringToBOOL(L, 1, 0);
|
||||
CGBag_C* bag = &player->m_bag;
|
||||
|
||||
for (uint32_t i = 0; i <= 18; i++) {
|
||||
CGItem_C* item = bag->GetItemPointer(i);
|
||||
|
||||
if (item && (item->m_obj->m_type & TYPEMASK_ITEM) && !(item->m_item->m_itemFieldFlags & 0x8) && item->m_item->m_itemFieldMaxdurability) {
|
||||
cost += CGMerchantInfo::GetRepairCost(item);
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t i = 23; i <= 38; i++) {
|
||||
CGItem_C* item = bag->GetItemPointer(i);
|
||||
|
||||
if (item && (item->m_obj->m_type & TYPEMASK_ITEM) && !(item->m_item->m_itemFieldFlags & 0x8) && item->m_item->m_itemFieldMaxdurability) {
|
||||
cost += CGMerchantInfo::GetRepairCost(item);
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t i = 19; i <= 22; i++) {
|
||||
CGItem_C* container = player->m_bag.GetItemPointer(i);
|
||||
|
||||
if (!container || !container->GetBag()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
CGBag_C* containerBag = container->GetBag();
|
||||
|
||||
for (uint32_t j = 0; j < static_cast<uint32_t>(containerBag->m_numSlots); j++) {
|
||||
CGItem_C* item = containerBag->GetItemPointer(j);
|
||||
|
||||
if (item && (item->m_obj->m_type & TYPEMASK_ITEM) && !(item->m_item->m_itemFieldFlags & 0x8) && item->m_item->m_itemFieldMaxdurability) {
|
||||
cost += CGMerchantInfo::GetRepairCost(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!guildBank && cost > player->GetCoinage()) {
|
||||
CGGameUI::DisplayError(ERR_NOT_ENOUGH_MONEY);
|
||||
return 0;
|
||||
}
|
||||
|
||||
WDataStore msg;
|
||||
msg.Put(static_cast<uint32_t>(CMSG_REPAIR_ITEM));
|
||||
msg.Put(CGMerchantInfo::m_merchant.m_guid);
|
||||
msg.Put(static_cast<uint64_t>(0));
|
||||
msg.Put(static_cast<uint8_t>(guildBank != 0));
|
||||
msg.Finalize();
|
||||
ClientServices::Send2(&msg);
|
||||
return 0;
|
||||
}
|
||||
|
||||
// STATIC: 0x00ACED00
|
||||
static FrameScript_Method s_ScriptFunctions[] = {
|
||||
{ "CloseMerchant", &Script_CloseMerchant },
|
||||
|
||||
@@ -11,6 +11,12 @@
|
||||
#include "WoW/Source/Object/ObjectClient/Player_C.h"
|
||||
#include "WoW/Source/Ui/ChatFrame.h"
|
||||
|
||||
// STATIC: 0x00C01840
|
||||
int32_t CGQuestInfo::m_rewardFactionList[10];
|
||||
|
||||
// STATIC: 0x00C01818
|
||||
int32_t CGQuestInfo::m_rewardFactionAmounts[10];
|
||||
|
||||
// STATIC: 0x00C0D658
|
||||
int32_t CGQuestInfo::m_state;
|
||||
|
||||
@@ -353,3 +359,19 @@ void CGQuestInfo::AddReward(const char* title, const uint32_t* choiceItems, cons
|
||||
FrameScript_SignalEvent(SCRIPT_EVENT_QUEST_COMPLETE, nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
// VERIFY: c5b8f724 auto
|
||||
// OFFSET: 0x0058BB60
|
||||
void CGQuestInfo::InitRewRepFields(uint32_t index, int32_t faction, int32_t value, int32_t override) {
|
||||
if (index <= 4) {
|
||||
CGQuestInfo::m_rewardFactionIDs[index] = faction;
|
||||
CGQuestInfo::m_rewardFactionValues[index] = value;
|
||||
CGQuestInfo::m_rewardFactionOverrides[index] = override;
|
||||
}
|
||||
}
|
||||
|
||||
// VERIFY: 12701ac3 auto
|
||||
// OFFSET: 0x0058BB90
|
||||
void CGQuestInfo::InitRewRepShowMask(uint32_t mask) {
|
||||
CGQuestInfo::m_rewardFactionMask = mask;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,9 @@ struct QuestGiverQuest {
|
||||
|
||||
class CGQuestInfo {
|
||||
public:
|
||||
static int32_t m_rewardFactionList[10];
|
||||
static int32_t m_rewardFactionAmounts[10];
|
||||
static int32_t IsLowLevel(int32_t level);
|
||||
static int32_t m_state;
|
||||
static int32_t m_currentQuest;
|
||||
static int32_t m_autoLaunched;
|
||||
@@ -45,6 +48,8 @@ class CGQuestInfo {
|
||||
static void ClearState();
|
||||
static void ClearQuestItems();
|
||||
static void ProcessQuestLogRewardFactions();
|
||||
static void InitRewRepFields(uint32_t index, int32_t faction, int32_t value, int32_t override);
|
||||
static void InitRewRepShowMask(uint32_t mask);
|
||||
static void SetState(WOWGUID npc, WOWGUID inform, int32_t state, const char* text, int32_t questId, int32_t startCheat);
|
||||
static void SetLogDescription(const char* text);
|
||||
static void AddReward(const char* title, const uint32_t* choiceItems, const uint32_t* choiceDisplays, const uint32_t* choiceCounts, int32_t numChoices, const uint32_t* rewardItems, const uint32_t* rewardDisplays, const uint32_t* rewardCounts, int32_t numRewards, int32_t money, int32_t xp, uint32_t honor, float honorMultiplier, int32_t spell, int32_t spellCast, int32_t autoLaunched, int32_t suggestedGroupNum, int32_t rewardTitle, int32_t talents, int32_t arenaPoints, uint32_t factionMask, const uint32_t* factionIDs, const uint32_t* factionValues, const uint32_t* factionOverrides, uint32_t questFlags);
|
||||
|
||||
@@ -13,6 +13,29 @@
|
||||
#include "WoW/Source/Object/QuestCache.h"
|
||||
#include "WoW/Source/Ui/GameUI.h"
|
||||
#include "WoW/Source/Ui/MinimapFrame.h"
|
||||
#include "WoW/Source/Ui/ReputationInfo.h"
|
||||
#include "WoW/Source/Ui/ScriptEvents.h"
|
||||
#include <ctime>
|
||||
#include <cstdlib>
|
||||
#include <malloc.h>
|
||||
#include "Engine/Source/Storm/H/storm.h"
|
||||
#include "WoW/Source/DB/DBClient/DBClient.h"
|
||||
#include "WoW/Source/DB/Rec/AreaTableRec.h"
|
||||
#include "WoW/Source/DB/Rec/QuestInfoRec.h"
|
||||
#include "WoW/Source/DB/Rec/QuestSortRec.h"
|
||||
#include "WoW/Source/Object/ObjectClient/Item_C.h"
|
||||
|
||||
// STATIC: 0x00C23618
|
||||
int32_t CGQuestLog::m_sortTypes[25];
|
||||
|
||||
// STATIC: 0x00C23AD4
|
||||
uint32_t CGQuestLog::m_numSortTypes;
|
||||
|
||||
// STATIC: 0x00C23AEC
|
||||
int32_t CGQuestLog::m_questResetTime;
|
||||
|
||||
// STATIC: 0x00C23AF0
|
||||
uint8_t CGQuestLog::m_trackedQuestsLoaded;
|
||||
|
||||
// STATIC: 0x00C23AD0
|
||||
int32_t CGQuestLog::m_numQuest;
|
||||
@@ -195,3 +218,890 @@ void DisplayQuestFailed(int32_t id, const WOWGUID& guid, void* param, bool succe
|
||||
CGGameUI::DisplayError(ERR_QUEST_FAILED_S, quest->m_name);
|
||||
}
|
||||
}
|
||||
|
||||
// VERIFY: 6e014a22 auto
|
||||
// OFFSET: 0x005DE930
|
||||
void QuestQueryCallback(int32_t id, const WOWGUID& guid, void* param, bool success) {
|
||||
if (success) {
|
||||
Script_SendUniqueSignal(SCRIPT_EVENT_QUEST_LOG_UPDATE);
|
||||
} else {
|
||||
ConsoleWrite("Invalid quest log entry", DEFAULT_COLOR);
|
||||
}
|
||||
}
|
||||
|
||||
// VERIFY: 88d84110 auto
|
||||
// OFFSET: 0x005DEE30
|
||||
int32_t CGQuestLog::IsQuestFailed(uint32_t index) {
|
||||
return index < static_cast<uint32_t>(CGQuestLog::m_numQuest) && !CGQuestLog::m_quests[index].m_isHeader && CGQuestLog::m_quests[index].m_expired;
|
||||
}
|
||||
|
||||
// VERIFY: 1f30d3fb manual
|
||||
// OFFSET: 0x005DEEB0
|
||||
int32_t CGQuestLog::GetQuestIndex(int32_t questId) {
|
||||
for (int32_t i = 0; i < 50; i++) {
|
||||
if (!CGQuestLog::m_quests[i].m_isHeader && CGQuestLog::m_quests[i].m_questId == questId) {
|
||||
return i + 1;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// VERIFY: 728ea3e9 manual
|
||||
// OFFSET: 0x005E0EA0
|
||||
int32_t CGQuestLog::IsQuestCompleteEx(uint32_t index, int32_t a2) {
|
||||
if (index >= static_cast<uint32_t>(CGQuestLog::m_numQuest) || CGQuestLog::m_quests[index].m_isHeader) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
CGPlayer_C* player = static_cast<CGPlayer_C*>(ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPEMASK_PLAYER, __FILE__, __LINE__));
|
||||
|
||||
if (!player) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t slot = CGQuestLog::m_quests[index].m_logSlot;
|
||||
PlayerQuestLogEntry* entry = slot >= 0 && slot <= 25 ? &player->m_player->m_playerQuestLog[slot] : nullptr;
|
||||
WOWGUID none = { 0 };
|
||||
QuestCache* quest = g_questDBCache.GetRecord(CGQuestLog::m_quests[index].m_questId, none, QuestQueryCallback, nullptr, false);
|
||||
|
||||
if (!quest || !entry || (entry->m_state & 2) || CGQuestLog::IsQuestFailed(index)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint32_t special = quest->m_flags & 6;
|
||||
|
||||
if (!special && !quest->m_friendlyFactionId && !quest->m_hostileFactionId && !quest->m_rewardMoney) {
|
||||
int32_t hasObjectives = 0;
|
||||
|
||||
for (uint32_t i = 0; i < 4; i++) {
|
||||
if (quest->m_objectiveId[i]) {
|
||||
hasObjectives = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < 6; i++) {
|
||||
if (quest->m_collectItemId[i]) {
|
||||
hasObjectives = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (a2 && !hasObjectives && !quest->m_requiredPlayersKilled) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (special && !(entry->m_state & 1)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (quest->m_friendlyFactionId && GetRepListRepValue(quest->m_friendlyFactionId) < static_cast<int32_t>(quest->m_friendlyFactionAmount)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (quest->m_hostileFactionId && GetRepListRepValue(quest->m_hostileFactionId) > static_cast<int32_t>(quest->m_hostileFactionAmount)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (quest->m_rewardMoney < 0 && player->GetCoinage() < static_cast<uint32_t>(-quest->m_rewardMoney)) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < 4; i++) {
|
||||
if (quest->m_objectiveId[i] && entry->m_counts[i] < quest->m_objectiveRequiredCount[i]) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < 6; i++) {
|
||||
if (quest->m_collectItemId[i] && player->m_bag.GetItemTypeCount(quest->m_collectItemId[i], 8) < static_cast<int32_t>(quest->m_collectItemCount[i])) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
return static_cast<int32_t>(entry->m_counts[0]) >= static_cast<int32_t>(quest->m_requiredPlayersKilled);
|
||||
}
|
||||
|
||||
// VERIFY: 7a39ad3c manual
|
||||
// OFFSET: 0x005E10B0
|
||||
bool CGQuestLog::HasNoObjectives(uint32_t index) {
|
||||
if (index >= static_cast<uint32_t>(CGQuestLog::m_numQuest) || CGQuestLog::m_quests[index].m_isHeader) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CGPlayer_C* player = static_cast<CGPlayer_C*>(ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPEMASK_PLAYER, __FILE__, __LINE__));
|
||||
|
||||
if (!player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int32_t slot = CGQuestLog::m_quests[index].m_logSlot;
|
||||
PlayerQuestLogEntry* entry = static_cast<uint32_t>(slot) <= 25 ? &player->m_player->m_playerQuestLog[slot] : nullptr;
|
||||
WOWGUID none = { 0 };
|
||||
QuestCache* quest = g_questDBCache.GetRecord(CGQuestLog::m_quests[index].m_questId, none, QuestQueryCallback, nullptr, false);
|
||||
|
||||
if (!quest || !entry || (entry->m_state & 2) || CGQuestLog::IsQuestFailed(index)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < 4; i++) {
|
||||
if (quest->m_objectiveId[i]) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < 6; i++) {
|
||||
if (quest->m_collectItemId[i] && (quest->m_collectItemId[i] != quest->m_startingItemId || static_cast<int32_t>(quest->m_collectItemCount[i]) > 1)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return !quest->m_requiredPlayersKilled && !(quest->m_flags & 6) && !quest->m_friendlyFactionId && !quest->m_hostileFactionId && quest->m_rewardMoney >= 0;
|
||||
}
|
||||
|
||||
// VERIFY: e4a82c9a manual
|
||||
// OFFSET: 0x005DED30
|
||||
int32_t GetQuestSuggestedPlayers(int32_t index) {
|
||||
if (index < 0 || index >= CGQuestLog::m_numQuest || CGQuestLog::m_quests[index].m_isHeader) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
WOWGUID none = { 0 };
|
||||
QuestCache* quest = g_questDBCache.GetRecord(CGQuestLog::m_quests[index].m_questId, none, QuestQueryCallback, nullptr, false);
|
||||
|
||||
if (!quest) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return quest->m_suggestedPlayers;
|
||||
}
|
||||
|
||||
// VERIFY: 00b5ee18 manual
|
||||
// OFFSET: 0x005E0CC0
|
||||
void CGQuestLog::AbandonSelectedQuest() {
|
||||
if (!CGQuestLog::m_abandonQuest || !ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPEMASK_PLAYER, __FILE__, __LINE__)) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (int32_t i = 0; i < 50; i++) {
|
||||
if (!CGQuestLog::m_quests[i].m_isHeader && CGQuestLog::m_quests[i].m_questId == CGQuestLog::m_abandonQuest) {
|
||||
CGPlayer_C::QuestLogRemoveQuest(static_cast<uint8_t>(CGQuestLog::m_quests[i].m_logSlot));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// VERIFY: 45625162 manual
|
||||
// OFFSET: 0x005E1300
|
||||
int32_t GetNumQuestLeaderBoards(int32_t questId, void (*callback)(int32_t id, const WOWGUID& guid, void* param, bool success), void* param) {
|
||||
int32_t count = 0;
|
||||
WOWGUID none = { 0 };
|
||||
QuestCache* quest = g_questDBCache.GetRecord(questId, none, callback, param, false);
|
||||
|
||||
if (quest) {
|
||||
if (quest->m_endText[0]) {
|
||||
count = 1;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < 4; i++) {
|
||||
if (quest->m_objectiveId[i]) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < 6; i++) {
|
||||
if (static_cast<int32_t>(quest->m_collectItemId[i]) > 0 && (quest->m_collectItemId[i] != quest->m_startingItemId || static_cast<int32_t>(quest->m_collectItemCount[i]) > 1)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (quest->m_friendlyFactionId) {
|
||||
count++;
|
||||
}
|
||||
|
||||
if (quest->m_requiredPlayersKilled) {
|
||||
count++;
|
||||
}
|
||||
|
||||
if (count) {
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
return CGQuestLog::IsQuestCompleteEx(CGQuestLog::GetQuestIndex(questId) - 1, 1) ? 1 : count;
|
||||
}
|
||||
|
||||
// VERIFY: 390e816f manual
|
||||
// OFFSET: 0x005E1FF0
|
||||
int32_t CountQuestItemDropsNeeded(int32_t questId, void (*callback)(int32_t id, const WOWGUID& guid, void* param, bool success), void* param) {
|
||||
CGPlayer_C* player = static_cast<CGPlayer_C*>(ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPEMASK_PLAYER, __FILE__, __LINE__));
|
||||
|
||||
if (!player) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
int32_t count = 0;
|
||||
WOWGUID none = { 0 };
|
||||
QuestCache* quest = g_questDBCache.GetRecord(questId, none, callback, param, false);
|
||||
|
||||
if (quest) {
|
||||
for (uint32_t i = 0; i < 4; i++) {
|
||||
int32_t itemId = quest->m_intermediateItemId[i];
|
||||
|
||||
if (itemId > 0 && (static_cast<uint32_t>(itemId) != quest->m_startingItemId || static_cast<int32_t>(quest->m_intermediateItemCount[i]) > 1) && !player->m_bag.GetItemTypeCount(itemId, 8)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
|
||||
// VERIFY: 89b5e6a8 manual
|
||||
// OFFSET: 0x005E64D0
|
||||
int32_t CGQuestLog::AddQuestWatch(int32_t questId, int32_t duration) {
|
||||
int32_t now = static_cast<int32_t>(time(nullptr));
|
||||
int32_t i;
|
||||
|
||||
for (i = 0; i < 50; i++) {
|
||||
if (!CGQuestLog::m_quests[i].m_isHeader && CGQuestLog::m_quests[i].m_questId == questId) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i >= 50) {
|
||||
return now;
|
||||
}
|
||||
|
||||
for (uint32_t j = 0; j < CGQuestLog::m_numQuestWatches; j++) {
|
||||
if (CGQuestLog::m_questWatches[j].m_questId == questId) {
|
||||
if (CGQuestLog::m_questWatches[j].m_expireTime > 0) {
|
||||
CGQuestLog::m_questWatches[j].m_expireTime = duration ? now + duration : 0;
|
||||
}
|
||||
|
||||
return now;
|
||||
}
|
||||
}
|
||||
|
||||
if (CGQuestLog::m_numQuestWatches < 25) {
|
||||
uint32_t index = CGQuestLog::m_numQuestWatches;
|
||||
CGQuestLog::m_questWatches[index].m_questId = questId;
|
||||
CGQuestLog::m_questWatches[index].m_expireTime = duration ? duration + now : 0;
|
||||
CGQuestLog::m_numQuestWatches = index + 1;
|
||||
return CGQuestLog::SortQuestWatches();
|
||||
}
|
||||
|
||||
return now;
|
||||
}
|
||||
|
||||
// VERIFY: b5dd4e6f auto
|
||||
// OFFSET: 0x005DE8F0
|
||||
static void QuestQueryCounterCallback(int32_t id, const WOWGUID& guid, void* param, bool success) {
|
||||
if (!success) {
|
||||
ConsoleWrite("Invalid quest log entry", DEFAULT_COLOR);
|
||||
return;
|
||||
}
|
||||
|
||||
if (s_questCallbackCount == 0 || --s_questCallbackCount == 0) {
|
||||
CGQuestLog::Update(1);
|
||||
}
|
||||
}
|
||||
|
||||
// VERIFY: 51715ead manual
|
||||
// OFFSET: 0x005DEA60
|
||||
void CGQuestLog::RemoveQuestWatch(int32_t questId) {
|
||||
uint32_t count = CGQuestLog::m_numQuestWatches;
|
||||
uint32_t i;
|
||||
|
||||
if (!count) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (i = 0; CGQuestLog::m_questWatches[i].m_questId != questId; i++) {
|
||||
if (i + 1 >= CGQuestLog::m_numQuestWatches) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
for (; i < CGQuestLog::m_numQuestWatches - 1; i++) {
|
||||
CGQuestLog::m_questWatches[i].m_questId = CGQuestLog::m_questWatches[i + 1].m_questId;
|
||||
CGQuestLog::m_questWatches[i].m_expireTime = CGQuestLog::m_questWatches[i + 1].m_expireTime;
|
||||
}
|
||||
|
||||
CGQuestLog::m_questWatches[count - 1].m_questId = 0;
|
||||
CGQuestLog::m_numQuestWatches = count - 1;
|
||||
CGQuestLog::m_questWatches[count - 1].m_expireTime = 0;
|
||||
}
|
||||
|
||||
// VERIFY: cedecb8a auto
|
||||
// OFFSET: 0x005DEAE0
|
||||
int32_t GetQuestSortId(uint32_t index) {
|
||||
if (index >= static_cast<uint32_t>(CGQuestLog::m_numQuest)) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
int32_t sortType = CGQuestLog::m_quests[index].m_questId;
|
||||
|
||||
if (!CGQuestLog::m_quests[index].m_isHeader) {
|
||||
WOWGUID none = { 0 };
|
||||
QuestCache* quest = g_questDBCache.GetRecord(sortType, none, nullptr, nullptr, false);
|
||||
|
||||
if (!quest) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
sortType = quest->m_areaIdOrSortId;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < CGQuestLog::m_numSortTypes; i++) {
|
||||
if (CGQuestLog::m_sortTypes[i] == sortType) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
// VERIFY: d0925147 manual
|
||||
// OFFSET: 0x005DEC70
|
||||
const char* GetQuestTitleText(int32_t questId) {
|
||||
WOWGUID none = { 0 };
|
||||
QuestCache* quest = g_questDBCache.GetRecord(questId, none, QuestQueryCallback, nullptr, false);
|
||||
|
||||
if (!quest) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return quest->m_name;
|
||||
}
|
||||
|
||||
// VERIFY: f8dc9db0 manual
|
||||
// OFFSET: 0x005DECC0
|
||||
uint32_t IsDailyQuest(int32_t index) {
|
||||
if (index < 0 || index >= CGQuestLog::m_numQuest || CGQuestLog::m_quests[index].m_isHeader) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
WOWGUID none = { 0 };
|
||||
QuestCache* quest = g_questDBCache.GetRecord(CGQuestLog::m_quests[index].m_questId, none, QuestQueryCallback, nullptr, false);
|
||||
|
||||
if (!quest) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return quest->m_flags & 0x1000;
|
||||
}
|
||||
|
||||
// VERIFY: e94a9f5a manual
|
||||
// OFFSET: 0x005DEF60
|
||||
void CGQuestLog::ShiftQuestWatches(uint32_t from, uint32_t to) {
|
||||
int32_t step;
|
||||
|
||||
if (to > from && to < CGQuestLog::m_numQuestWatches) {
|
||||
step = 1;
|
||||
} else if (to < from && from < CGQuestLog::m_numQuestWatches) {
|
||||
step = -1;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
QuestWatch moved = CGQuestLog::m_questWatches[from];
|
||||
|
||||
for (uint32_t i = from; i != to; i += step) {
|
||||
CGQuestLog::m_questWatches[i] = CGQuestLog::m_questWatches[i + step];
|
||||
}
|
||||
|
||||
CGQuestLog::m_questWatches[to] = moved;
|
||||
}
|
||||
|
||||
// VERIFY: db83baeb manual
|
||||
// OFFSET: 0x005DFDC0
|
||||
static int32_t QSortQuestSortTypes(const void* a, const void* b) {
|
||||
int32_t sortA = *static_cast<const int32_t*>(a);
|
||||
int32_t sortB = *static_cast<const int32_t*>(b);
|
||||
|
||||
if (sortA == sortB) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!sortA) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (!sortB) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
char nameA[256] = { 0 };
|
||||
char nameB[256] = { 0 };
|
||||
|
||||
if (sortA >= 0) {
|
||||
AreaTableRec* area = g_areaTableDB.GetRecord(sortA);
|
||||
|
||||
if (area) {
|
||||
SStrCopy(nameA, area->m_areaName, sizeof(nameA));
|
||||
}
|
||||
} else {
|
||||
QuestSortRec* sort = g_questSortDB.GetRecord(-sortA);
|
||||
|
||||
if (sort) {
|
||||
SStrCopy(nameA, sort->m_sortName, sizeof(nameA));
|
||||
}
|
||||
}
|
||||
|
||||
if (sortB >= 0) {
|
||||
AreaTableRec* area = g_areaTableDB.GetRecord(sortB);
|
||||
|
||||
if (area) {
|
||||
SStrCopy(nameB, area->m_areaName, sizeof(nameB));
|
||||
}
|
||||
} else {
|
||||
QuestSortRec* sort = g_questSortDB.GetRecord(-sortB);
|
||||
|
||||
if (sort) {
|
||||
SStrCopy(nameB, sort->m_sortName, sizeof(nameB));
|
||||
}
|
||||
}
|
||||
|
||||
return SStrSortUTF8I(nameA, nameB, STORM_MAX_STR);
|
||||
}
|
||||
|
||||
// VERIFY: 651d4dbc manual
|
||||
// OFFSET: 0x005E0000
|
||||
const char* GetQuestTitle(int32_t index) {
|
||||
if (index < 0 || index >= CGQuestLog::m_numQuest) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
int32_t id = CGQuestLog::m_quests[index].m_questId;
|
||||
|
||||
if (!CGQuestLog::m_quests[index].m_isHeader) {
|
||||
return GetQuestTitleText(id);
|
||||
}
|
||||
|
||||
if (id > 0) {
|
||||
AreaTableRec* area = g_areaTableDB.GetRecord(id);
|
||||
|
||||
if (area) {
|
||||
return area->m_areaName;
|
||||
}
|
||||
} else if (id < 0) {
|
||||
QuestSortRec* sort = g_questSortDB.GetRecord(-id);
|
||||
|
||||
if (sort) {
|
||||
return sort->m_sortName;
|
||||
}
|
||||
} else {
|
||||
return "Missing header! (quest designers)";
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// VERIFY: 12e6b2ec manual
|
||||
// OFFSET: 0x005E0070
|
||||
const char* GetQuestTag(int32_t index) {
|
||||
if (index < 0 || index >= CGQuestLog::m_numQuest || CGQuestLog::m_quests[index].m_isHeader) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WOWGUID none = { 0 };
|
||||
QuestCache* quest = g_questDBCache.GetRecord(CGQuestLog::m_quests[index].m_questId, none, QuestQueryCallback, nullptr, false);
|
||||
QuestInfoRec* info;
|
||||
|
||||
if (!quest || !(info = g_questInfoDB.GetRecord(quest->m_infoId))) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return info->m_infoName;
|
||||
}
|
||||
|
||||
// VERIFY: 074af98c auto
|
||||
// OFFSET: 0x005E00E0
|
||||
int32_t CGQuestLog::IsSelectedQuestExpired() {
|
||||
uint32_t index = CGQuestLog::GetSelectedLogEntry();
|
||||
return index < static_cast<uint32_t>(CGQuestLog::m_numQuest) && !CGQuestLog::m_quests[index].m_isHeader && CGQuestLog::m_quests[index].m_expired;
|
||||
}
|
||||
|
||||
// VERIFY: f903a683 manual
|
||||
// OFFSET: 0x005E08F0
|
||||
static int32_t QSortQuestLogEntries(const void* a, const void* b) {
|
||||
QuestLogEntry entryA = *static_cast<const QuestLogEntry*>(a);
|
||||
QuestLogEntry entryB = *static_cast<const QuestLogEntry*>(b);
|
||||
int32_t idA = entryA.m_questId;
|
||||
int32_t idB = entryB.m_questId;
|
||||
int32_t headerA = entryA.m_isHeader;
|
||||
int32_t headerB = entryB.m_isHeader;
|
||||
WOWGUID none = { 0 };
|
||||
QuestCache* questA = headerA ? nullptr : g_questDBCache.GetRecord(idA, none, nullptr, nullptr, false);
|
||||
QuestCache* questB = headerB ? nullptr : g_questDBCache.GetRecord(idB, none, nullptr, nullptr, false);
|
||||
uint32_t sortA = 0;
|
||||
uint32_t sortB;
|
||||
uint32_t i;
|
||||
|
||||
if (headerA) {
|
||||
for (i = 0; i < 25 && CGQuestLog::m_sortTypes[i] != idA; i++) {
|
||||
}
|
||||
} else {
|
||||
if (!questA) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < 25 && CGQuestLog::m_sortTypes[i] != static_cast<int32_t>(questA->m_areaIdOrSortId); i++) {
|
||||
}
|
||||
}
|
||||
|
||||
if (i < 25) {
|
||||
sortA = i;
|
||||
}
|
||||
|
||||
if (headerB) {
|
||||
for (i = 0; i < 25 && CGQuestLog::m_sortTypes[i] != idB; i++) {
|
||||
}
|
||||
} else {
|
||||
if (!questB) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < 25 && CGQuestLog::m_sortTypes[i] != static_cast<int32_t>(questB->m_areaIdOrSortId); i++) {
|
||||
}
|
||||
}
|
||||
|
||||
sortB = i < 25 ? i : 0;
|
||||
int32_t hiddenA = !headerA && sortA < 25 && !((1 << sortA) & s_cvQuestLogCollapseFilter->m_intValue);
|
||||
int32_t hiddenB = !headerB && sortB < 25 && !((1 << sortB) & s_cvQuestLogCollapseFilter->m_intValue);
|
||||
|
||||
if (hiddenA) {
|
||||
if (hiddenB) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return 2 * hiddenA - 1;
|
||||
}
|
||||
|
||||
if (hiddenB) {
|
||||
return 2 * hiddenA - 1;
|
||||
}
|
||||
|
||||
if (sortA != sortB) {
|
||||
return sortA < sortB ? -1 : 1;
|
||||
}
|
||||
|
||||
if (headerA) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (headerB) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
int32_t levelA = questA->m_level;
|
||||
int32_t levelB = questB->m_level;
|
||||
CGPlayer_C* player = static_cast<CGPlayer_C*>(ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPEMASK_PLAYER, __FILE__, __LINE__));
|
||||
|
||||
if (player) {
|
||||
if (levelA == -1) {
|
||||
levelA = player->m_unit->m_unitFieldLevel;
|
||||
}
|
||||
|
||||
if (levelB == -1) {
|
||||
levelB = player->m_unit->m_unitFieldLevel;
|
||||
}
|
||||
}
|
||||
|
||||
if (levelA == levelB) {
|
||||
return SStrSortUTF8I(questA->m_name, questB->m_name, STORM_MAX_STR);
|
||||
}
|
||||
|
||||
return 2 * (levelA >= levelB) - 1;
|
||||
}
|
||||
|
||||
// VERIFY: 01ac7701 auto
|
||||
// OFFSET: 0x005E0B80
|
||||
void CGQuestLog::FilterAndSortQuests() {
|
||||
qsort(CGQuestLog::m_quests, CGQuestLog::m_numQuest, sizeof(QuestLogEntry), QSortQuestLogEntries);
|
||||
CGQuestLog::m_numShownQuests = CGQuestLog::m_numQuest;
|
||||
|
||||
for (uint32_t i = 0; i < static_cast<uint32_t>(CGQuestLog::m_numQuest); i++) {
|
||||
if (CGQuestLog::m_quests[i].m_isHeader) {
|
||||
continue;
|
||||
}
|
||||
|
||||
uint32_t sortId = GetQuestSortId(i);
|
||||
|
||||
if (sortId < 25 && !((1 << sortId) & s_cvQuestLogCollapseFilter->m_intValue)) {
|
||||
CGQuestLog::m_numShownQuests--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// VERIFY: 8af272a7 auto
|
||||
// OFFSET: 0x005E0C00
|
||||
void CGQuestLog::CollapseHeader(uint32_t index, int32_t collapse) {
|
||||
if (index < static_cast<uint32_t>(CGQuestLog::m_numQuest) && CGQuestLog::m_quests[index].m_isHeader) {
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < CGQuestLog::m_numSortTypes; i++) {
|
||||
if (CGQuestLog::m_sortTypes[i] == CGQuestLog::m_quests[index].m_questId) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == CGQuestLog::m_numSortTypes) {
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t filter = s_cvQuestLogCollapseFilter->m_intValue;
|
||||
int32_t bit = 1 << i;
|
||||
s_cvQuestLogCollapseFilter->Set(collapse ? filter & ~bit : filter | bit, true, false, false, true);
|
||||
} else {
|
||||
s_cvQuestLogCollapseFilter->Set((collapse != 0) - 1, true, false, false, true);
|
||||
}
|
||||
|
||||
CGQuestLog::FilterAndSortQuests();
|
||||
Script_SendUniqueSignal(SCRIPT_EVENT_QUEST_LOG_UPDATE);
|
||||
}
|
||||
|
||||
// VERIFY: 89bc5f8b manual
|
||||
// OFFSET: 0x005E0D20
|
||||
int32_t GetQuestLevel(int32_t questId) {
|
||||
WOWGUID none = { 0 };
|
||||
QuestCache* quest = g_questDBCache.GetRecord(questId, none, QuestQueryCallback, nullptr, false);
|
||||
|
||||
if (!quest) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
CGPlayer_C* player = static_cast<CGPlayer_C*>(ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPEMASK_PLAYER, __FILE__, __LINE__));
|
||||
|
||||
if (player && quest->m_level == 0xFFFFFFFF) {
|
||||
return player->m_unit->m_unitFieldLevel;
|
||||
}
|
||||
|
||||
return quest->m_level;
|
||||
}
|
||||
|
||||
// VERIFY: 92305a9d auto
|
||||
// OFFSET: 0x005E0DA0
|
||||
CGItem_C* CGQuestLog::GetQuestSpecialItem(uint32_t index) {
|
||||
if (index >= static_cast<uint32_t>(CGQuestLog::m_numQuest) || CGQuestLog::m_quests[index].m_isHeader) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
WOWGUID none = { 0 };
|
||||
QuestCache* quest = g_questDBCache.GetRecord(CGQuestLog::m_quests[index].m_questId, none, QuestQueryCallback, nullptr, false);
|
||||
|
||||
if (!quest || (!quest->m_startingItemId && !(quest->m_flags & 0x20000))) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CGPlayer_C* player = ClntObjMgrGetActivePlayerObj();
|
||||
|
||||
if (!player) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
CGBag_C* bag = &player->m_bag;
|
||||
CGItem_C* item = bag->FindItemOfType(quest->m_startingItemId, 0);
|
||||
|
||||
if (item && item->CanBeUsed()) {
|
||||
return item;
|
||||
}
|
||||
|
||||
if (!(quest->m_flags & 0x20000)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < 4; i++) {
|
||||
if (!quest->m_intermediateItemId[i]) {
|
||||
continue;
|
||||
}
|
||||
|
||||
item = bag->FindItemOfType(quest->m_intermediateItemId[i], 0);
|
||||
|
||||
if (item && item->CanBeUsed()) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// VERIFY: 716d0e51 manual
|
||||
// OFFSET: 0x005E28B0
|
||||
bool CGQuestLog::HasQuestPOI(int32_t questId) {
|
||||
if (!ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPEMASK_PLAYER, __FILE__, __LINE__) || questId <= 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < 25; i++) {
|
||||
if (CGQuestLog::m_questPOIs[i].m_questId == questId) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// VERIFY: 86468e46 manual
|
||||
// OFFSET: 0x005E6940
|
||||
void CGQuestLog::Update(int32_t a1) {
|
||||
if (!a1) {
|
||||
Script_SendUniqueSignal(SCRIPT_EVENT_QUEST_LOG_UPDATE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (s_questCallbackCount) {
|
||||
return;
|
||||
}
|
||||
|
||||
CGPlayer_C* player = static_cast<CGPlayer_C*>(ClntObjMgrObjectPtr(ClntObjMgrGetActivePlayer(), TYPEMASK_PLAYER, __FILE__, __LINE__));
|
||||
|
||||
if (!player) {
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t filter = s_cvQuestLogCollapseFilter->m_intValue;
|
||||
uint32_t numOldSortTypes = CGQuestLog::m_numSortTypes;
|
||||
int32_t* oldSortTypes = static_cast<int32_t*>(alloca(numOldSortTypes * sizeof(int32_t)));
|
||||
|
||||
for (uint32_t i = 0; i < CGQuestLog::m_numSortTypes; i++) {
|
||||
oldSortTypes[i] = CGQuestLog::m_sortTypes[i];
|
||||
|
||||
if ((1 << i) & filter) {
|
||||
oldSortTypes[i] = -oldSortTypes[i];
|
||||
}
|
||||
}
|
||||
|
||||
memset(CGQuestLog::m_quests, 0, sizeof(CGQuestLog::m_quests));
|
||||
memset(CGQuestLog::m_sortTypes, 0, sizeof(CGQuestLog::m_sortTypes));
|
||||
CGQuestLog::m_numQuest = 0;
|
||||
CGQuestLog::m_numSortTypes = 0;
|
||||
s_questCallbackCount = 0;
|
||||
int32_t numUnknown = 0;
|
||||
int32_t unknown[25] = { 0 };
|
||||
int32_t timeOffset = CGQuestLog::m_timeOffset;
|
||||
|
||||
for (uint32_t slot = 0; slot < 25; slot++) {
|
||||
PlayerQuestLogEntry* entry = slot > 25 ? nullptr : &player->m_player->m_playerQuestLog[slot];
|
||||
int32_t questId = entry->m_questId;
|
||||
|
||||
if (questId <= 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
WOWGUID none = { 0 };
|
||||
QuestCache* quest = g_questDBCache.GetRecord(questId, none, QuestQueryCounterCallback, nullptr, false);
|
||||
|
||||
if (!quest) {
|
||||
s_questCallbackCount++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!CGQuestLog::HasQuestPOI(questId)) {
|
||||
numUnknown++;
|
||||
unknown[slot] = questId;
|
||||
}
|
||||
|
||||
CGQuestLog::m_quests[CGQuestLog::m_numQuest].m_questId = questId;
|
||||
CGQuestLog::m_quests[CGQuestLog::m_numQuest].m_logSlot = slot;
|
||||
CGQuestLog::m_numQuest++;
|
||||
|
||||
if (entry->m_time && !(entry->m_state & 2) && timeOffset + static_cast<int32_t>(entry->m_time) - static_cast<int32_t>(time(nullptr)) - 1 < 0) {
|
||||
CGQuestLog::SetQuestExpired(CGQuestLog::m_numQuest - 1);
|
||||
}
|
||||
|
||||
uint32_t i;
|
||||
|
||||
for (i = 0; i < CGQuestLog::m_numSortTypes; i++) {
|
||||
if (CGQuestLog::m_sortTypes[i] == static_cast<int32_t>(quest->m_areaIdOrSortId)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (i == CGQuestLog::m_numSortTypes) {
|
||||
CGQuestLog::m_sortTypes[i] = quest->m_areaIdOrSortId;
|
||||
CGQuestLog::m_numSortTypes++;
|
||||
CGQuestLog::m_quests[CGQuestLog::m_numQuest].m_questId = quest->m_areaIdOrSortId;
|
||||
CGQuestLog::m_quests[CGQuestLog::m_numQuest].m_isHeader = 1;
|
||||
CGQuestLog::m_numQuest++;
|
||||
}
|
||||
}
|
||||
|
||||
qsort(CGQuestLog::m_sortTypes, CGQuestLog::m_numSortTypes, sizeof(int32_t), QSortQuestSortTypes);
|
||||
|
||||
for (uint32_t i = 0; i < CGQuestLog::m_numSortTypes; i++) {
|
||||
uint32_t j;
|
||||
|
||||
for (j = 0; j < numOldSortTypes; j++) {
|
||||
if (oldSortTypes[j] == CGQuestLog::m_sortTypes[i]) {
|
||||
filter &= ~(1 << i);
|
||||
break;
|
||||
}
|
||||
|
||||
if (oldSortTypes[j] == -CGQuestLog::m_sortTypes[i]) {
|
||||
filter |= 1 << i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (j >= numOldSortTypes) {
|
||||
filter |= 1 << i;
|
||||
}
|
||||
}
|
||||
|
||||
s_cvQuestLogCollapseFilter->Set(filter, true, false, false, true);
|
||||
CGQuestLog::FilterAndSortQuests();
|
||||
|
||||
if (!CGQuestLog::m_trackedQuestsLoaded && CGQuestLog::m_numQuest) {
|
||||
CGQuestLog::LoadTrackedQuests();
|
||||
}
|
||||
|
||||
bool found = true;
|
||||
|
||||
for (uint32_t i = 0; i < CGQuestLog::m_numQuestWatches; i++) {
|
||||
if (!found) {
|
||||
i--;
|
||||
}
|
||||
|
||||
found = false;
|
||||
|
||||
for (int32_t j = 0; j < CGQuestLog::m_numQuest; j++) {
|
||||
if (!CGQuestLog::m_quests[j].m_isHeader && CGQuestLog::m_quests[j].m_questId == CGQuestLog::m_questWatches[i].m_questId) {
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
CGQuestLog::RemoveQuestWatch(CGQuestLog::m_questWatches[i].m_questId);
|
||||
}
|
||||
}
|
||||
|
||||
Script_SendUniqueSignal(SCRIPT_EVENT_QUEST_LOG_UPDATE);
|
||||
|
||||
if (numUnknown) {
|
||||
CDataStore msg;
|
||||
msg.Put(static_cast<uint32_t>(CMSG_QUEST_POI_QUERY));
|
||||
msg.Put(static_cast<uint32_t>(numUnknown));
|
||||
|
||||
for (uint32_t i = 0; i < 25; i++) {
|
||||
if (unknown[i]) {
|
||||
msg.Put(static_cast<uint32_t>(unknown[i]));
|
||||
}
|
||||
}
|
||||
|
||||
msg.Finalize();
|
||||
ClientServices::Send2(&msg);
|
||||
}
|
||||
|
||||
if (CGQuestLog::m_nextQuestUpdate && static_cast<int32_t>(time(nullptr)) >= CGQuestLog::m_nextQuestUpdate) {
|
||||
CDataStore msg;
|
||||
msg.Put(static_cast<uint32_t>(CMSG_QUERY_TIME));
|
||||
msg.Finalize();
|
||||
ClientServices::Send2(&msg);
|
||||
CGQuestLog::m_nextQuestUpdate = 0;
|
||||
}
|
||||
}
|
||||
|
||||
+35
-46
@@ -7,6 +7,7 @@
|
||||
#include "WoW/Source/Object/WGUID.h"
|
||||
#include "WoW/Source/Net/Types.h"
|
||||
|
||||
class CGItem_C;
|
||||
class CDataStore;
|
||||
|
||||
struct lua_State;
|
||||
@@ -57,8 +58,42 @@ struct QuestWatch {
|
||||
/* 0008 */ uint32_t unk_0008;
|
||||
};
|
||||
|
||||
void QuestQueryCallback(int32_t id, const WOWGUID& guid, void* param, bool success);
|
||||
void ItemQueryCallback(int32_t id, const WOWGUID& guid, void* param, bool success);
|
||||
int32_t GetQuestSuggestedPlayers(int32_t index);
|
||||
int32_t GetQuestSortId(uint32_t index);
|
||||
const char* GetQuestTitleText(int32_t questId);
|
||||
const char* GetQuestTitle(int32_t index);
|
||||
const char* GetQuestTag(int32_t index);
|
||||
int32_t GetQuestLevel(int32_t questId);
|
||||
uint32_t IsDailyQuest(int32_t index);
|
||||
int32_t CalculateExperience(int32_t questId, int32_t level);
|
||||
int32_t GetNumQuestLeaderBoards(int32_t questId, void (*callback)(int32_t id, const WOWGUID& guid, void* param, bool success), void* param);
|
||||
int32_t CountQuestItemDropsNeeded(int32_t questId, void (*callback)(int32_t id, const WOWGUID& guid, void* param, bool success), void* param);
|
||||
|
||||
class CGQuestLog {
|
||||
public:
|
||||
static int32_t m_sortTypes[25];
|
||||
static uint32_t m_numSortTypes;
|
||||
static int32_t m_questResetTime;
|
||||
static uint8_t m_trackedQuestsLoaded;
|
||||
static void FilterAndSortQuests();
|
||||
static void LoadTrackedQuests();
|
||||
static bool HasQuestPOI(int32_t questId);
|
||||
static int32_t IsSelectedQuestExpired();
|
||||
static void RemoveQuestWatch(int32_t questId);
|
||||
static void ShiftQuestWatches(uint32_t from, uint32_t to);
|
||||
static CGItem_C* GetQuestSpecialItem(uint32_t index);
|
||||
static void UpdatePOIIcons();
|
||||
static int32_t GetQuestWorldMapAreaID(int32_t questId, int32_t* floor);
|
||||
static int32_t GetPOIQuestIDByVisibleIndex(int32_t index);
|
||||
static void AbandonSelectedQuest();
|
||||
static int32_t AddQuestWatch(int32_t questId, int32_t duration);
|
||||
static bool SortQuestWatches();
|
||||
static void CollapseHeader(uint32_t index, int32_t collapse);
|
||||
static int32_t GetQuestIndex(int32_t questId);
|
||||
static int32_t IsQuestFailed(uint32_t index);
|
||||
static bool HasNoObjectives(uint32_t index);
|
||||
static QuestLogEntry m_quests[50];
|
||||
static QuestPOIInfo m_questPOIs[25];
|
||||
static int32_t m_abandonQuest;
|
||||
@@ -89,58 +124,12 @@ class CGQuestLog {
|
||||
static void HandlePOIQueryResponse(CDataStore* msg);
|
||||
};
|
||||
|
||||
int32_t Script_GetQuestLogTitle(lua_State* L);
|
||||
int32_t Script_GetAbandonQuestItems(lua_State* L);
|
||||
int32_t Script_AbandonQuest(lua_State* L);
|
||||
int32_t Script_IsUnitOnQuest(lua_State* L);
|
||||
int32_t Script_GetQuestLogQuestText(lua_State* L);
|
||||
int32_t Script_GetNumQuestLeaderBoards(lua_State* L);
|
||||
int32_t Script_GetQuestLogLeaderBoard(lua_State* L);
|
||||
int32_t Script_GetNumQuestItemDrops(lua_State* L);
|
||||
int32_t Script_GetQuestLogItemDrop(lua_State* L);
|
||||
int32_t Script_GetQuestPOILeaderBoard(lua_State* L);
|
||||
int32_t Script_GetQuestLogTimeLeft(lua_State* L);
|
||||
int32_t Script_IsCurrentQuestFailed(lua_State* L);
|
||||
int32_t Script_GetNumQuestLogRewards(lua_State* L);
|
||||
int32_t Script_GetNumQuestLogChoices(lua_State* L);
|
||||
int32_t Script_GetQuestLogRewardInfo(lua_State* L);
|
||||
int32_t Script_GetQuestLogChoiceInfo(lua_State* L);
|
||||
int32_t Script_GetQuestLogItemLink(lua_State* L);
|
||||
int32_t Script_GetQuestLogSpellLink(lua_State* L);
|
||||
int32_t Script_GetQuestLogRewardMoney(lua_State* L);
|
||||
int32_t Script_GetQuestLogRewardXP(lua_State* L);
|
||||
int32_t Script_GetQuestLogRewardHonor(lua_State* L);
|
||||
int32_t Script_GetQuestLogRewardSpell(lua_State* L);
|
||||
int32_t Script_GetQuestLogRequiredMoney(lua_State* L);
|
||||
int32_t Script_QuestLogPushQuest(lua_State* L);
|
||||
int32_t Script_GetQuestIndexForTimer(lua_State* L);
|
||||
int32_t Script_CollapseQuestHeader(lua_State* L);
|
||||
int32_t Script_ExpandQuestHeader(lua_State* L);
|
||||
int32_t Script_AddQuestWatch(lua_State* L);
|
||||
int32_t Script_RemoveQuestWatch(lua_State* L);
|
||||
int32_t Script_GetQuestLogGroupNum(lua_State* L);
|
||||
int32_t Script_GetQuestResetTime(lua_State* L);
|
||||
int32_t Script_GetQuestLink(lua_State* L);
|
||||
int32_t Script_GetQuestLogRewardTitle(lua_State* L);
|
||||
int32_t Script_GetQuestLogRewardTalents(lua_State* L);
|
||||
int32_t Script_GetQuestLogRewardArenaPoints(lua_State* L);
|
||||
int32_t Script_GetQuestLogSpecialItemInfo(lua_State* L);
|
||||
int32_t Script_GetQuestLogSpecialItemCooldown(lua_State* L);
|
||||
int32_t Script_IsQuestLogSpecialItemInRange(lua_State* L);
|
||||
int32_t Script_UseQuestLogSpecialItem(lua_State* L);
|
||||
int32_t Script_ProcessQuestLogRewardFactions(lua_State* L);
|
||||
int32_t Script_GetQuestLogRewardFactionInfo(lua_State* L);
|
||||
int32_t Script_SortQuestWatches(lua_State* L);
|
||||
int32_t Script_ShiftQuestWatches(lua_State* L);
|
||||
int32_t Script_QuestMapUpdateAllQuests(lua_State* L);
|
||||
int32_t Script_GetQuestSortIndex(lua_State* L);
|
||||
int32_t Script_GetQuestWorldMapAreaID(lua_State* L);
|
||||
int32_t Script_QuestPOIUpdateTexture(lua_State* L);
|
||||
int32_t Script_QuestPOIUpdateIcons(lua_State* L);
|
||||
int32_t Script_QuestPOIGetIconInfo(lua_State* L);
|
||||
int32_t Script_QuestPOIGetQuestIDByIndex(lua_State* L);
|
||||
int32_t Script_QuestPOIGetQuestIDByVisibleIndex(lua_State* L);
|
||||
int32_t Script_GetQuestLogCompletionText(lua_State* L);
|
||||
void QuestLogRegisterScriptFunctions();
|
||||
void AddQuestPointDisplay();
|
||||
void DisplayQuestFailed(int32_t id, const WOWGUID& guid, void* param, bool success);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user