From 2d55a137fcf0463e1a70d98c3048a4e44c6b23fb Mon Sep 17 00:00:00 2001 From: ragnarok-clanker Date: Tue, 3 Nov 2026 14:40:29 +0000 Subject: [PATCH] Maintenance: [forced, user-approved] Family V1: remove the invented global g_luaScript and the session-as-script casts. 0x1738010 is Batch #10269 by ragnarok-clanker: forced by an admin (2 lower score(s), 6 changed function(s)); checked with 102 compiled unit(s), including every includer of Source/Script/LuaScript.h. --- Source/Client/Mode/GameMode.cpp | 10 +-- Source/Client/Mode/GameModeHandlers.cpp | 2 +- Source/Client/Mode/GameModePackets.cpp | 12 +-- Source/Contents/Actors/CharacterRender.cpp | 4 +- Source/Contents/Actors/Player.cpp | 4 +- .../Contents/Actors/SpriteDrawingPolicy.cpp | 6 +- .../Contents/Configuration/ServiceOptions.cpp | 5 +- Source/Contents/Effects/EZ2STREffect.cpp | 2 +- Source/Contents/Effects/EffectLists.cpp | 26 +++--- .../Contents/Effects/MonsterSkillEffects.cpp | 24 +++--- Source/Contents/EntryQueueMgr.cpp | 3 +- .../Contents/Jobs/JobNameInitialization.cpp | 2 +- Source/Contents/Party/AdventurerAgencyMgr.cpp | 2 +- Source/Contents/RenewQuestMgr.cpp | 6 +- Source/Contents/Skills/SkillLevelRegistry.cpp | 4 +- Source/Contents/SpriteLayerDrawing.cpp | 4 +- .../UserData/AccountLinkedUserDataMgr.cpp | 6 +- Source/Script/LuaScript.cpp | 6 +- Source/Script/LuaScript.h | 1 - Source/UI/Acceptance/UIChooseSellBuyWnd.cpp | 10 +-- Source/UI/Buttons/UIButton.cpp | 3 +- Source/UI/CashShop/UICashShopWnd.cpp | 4 +- Source/UI/Guild/UIAgitWnd.cpp | 2 +- Source/UI/Guild/UIGuildWnd.cpp | 2 +- Source/UI/Menu/UIMenuIconWnd.cpp | 2 +- Source/UI/Shortcuts/ShortcutCooldowns.cpp | 2 +- Source/UI/SkillDelayInfo/UISkillDelayInfo.cpp | 2 +- Source/UI/StylingShop/UIStylingShopWnd.cpp | 80 +++++++++---------- Source/UI/Text/UIAchWnd.cpp | 2 +- Source/UI/UICheckAttendanceWnd.cpp | 2 +- Source/UI/UIHotkeyGuideWnd.cpp | 3 +- Source/UI/UILapineBoxWnd.cpp | 10 +-- Source/UI/UILapineUpgradeBoxWnd.cpp | 10 +-- Source/UI/Window/FuncDrawWNDChar.cpp | 4 +- Source/UI/Window/UIControl.cpp | 3 +- Source/UI/Window/UIHotKeyWnd.cpp | 28 +++---- Source/UI/Window/UIMessageBox.cpp | 6 +- Source/UI/Window/UINewSkillListWnd.cpp | 14 ++-- Source/UI/Window/UIPartyBookingHelpWnd.cpp | 3 +- Source/UI/Window/UIRoMapWnd.cpp | 4 +- Source/UI/Window/UISecondCostumeWnd.cpp | 8 +- Source/UI/Window/UISeekPartyListWnd.cpp | 8 +- Source/UI/Window/UISeekPartyMBWnd.cpp | 9 ++- Source/UI/Window/UIWindowFactory.cpp | 2 +- 44 files changed, 177 insertions(+), 175 deletions(-) diff --git a/Source/Client/Mode/GameMode.cpp b/Source/Client/Mode/GameMode.cpp index eb90ac49..1878f9fa 100644 --- a/Source/Client/Mode/GameMode.cpp +++ b/Source/Client/Mode/GameMode.cpp @@ -127,7 +127,7 @@ int CGameMode::GetSkillAttackRange(int id, int level) { } int reduction = 0; - g_luaScript->Call("GetSkillAttackRange", "ddd>dd", id, level, skill.level, &range, &reduction); + g_session.m_hotkeyScript->Call("GetSkillAttackRange", "ddd>dd", id, level, skill.level, &range, &reduction); range += skill.unknown_001C - reduction; return range; } @@ -2651,7 +2651,7 @@ void CGameMode::UpdateBalloons() { thread_local GameModeEncryptedName name(source); text = name.Text(); } else { - text = CSkillInfo::DisplayName(*g_luaScript, shownSkill); + text = CSkillInfo::DisplayName(*g_session.m_hotkeyScript, shownSkill); } break; } @@ -5089,7 +5089,7 @@ void CGameMode::ProcessStatusIconTooltip(int x, int y) { int hasLimit = 0; int limitLine = -1; - g_luaScript->Call("GetTimeLimitInfo", "d>dd", id, &hasLimit, &limitLine); + g_session.m_hotkeyScript->Call("GetTimeLimitInfo", "d>dd", id, &hasLimit, &limitLine); std::string timeText; int activeId = id; @@ -5127,7 +5127,7 @@ void CGameMode::ProcessStatusIconTooltip(int x, int y) { red = 0; green = 0; blue = 0; - } while (!g_luaScript->Call("GetStateIconDescript", "dd>sddd", activeId, line, &text, &red, &green, &blue)); + } while (!g_session.m_hotkeyScript->Call("GetStateIconDescript", "dd>sddd", activeId, line, &text, &red, &green, &blue)); std::string description(text); if (description.size() == 0) { @@ -5198,7 +5198,7 @@ void CGameMode::ProcessStatusIconTooltip(int x, int y) { if (hasLimit != 0 && timeText.size() != 0 && limitLine != -1 && this->unknown_05D0) { const char* text = nullptr; - if (g_luaScript->Call("GetStateIconDescript", "dd>s", activeId, limitLine, &text)) { + if (g_session.m_hotkeyScript->Call("GetStateIconDescript", "dd>s", activeId, limitLine, &text)) { std::string description(text); description = FormatOwnedString(description.c_str(), timeText.c_str()); static_cast(this->unknown_05D0)->ChangeText(description.c_str(), limitLine - 1); diff --git a/Source/Client/Mode/GameModeHandlers.cpp b/Source/Client/Mode/GameModeHandlers.cpp index 51843fa5..da919fd0 100644 --- a/Source/Client/Mode/GameModeHandlers.cpp +++ b/Source/Client/Mode/GameModeHandlers.cpp @@ -1680,7 +1680,7 @@ void CGameMode::SpawnSkillWarningPlanes(std::uint32_t aid, std::uint16_t skillId int width = 0; int height = 0; - if (!g_luaScript->Call("GetSkillScale", "dd>dd", skillId, level, &width, &height)) { + if (!g_session.m_hotkeyScript->Call("GetSkillScale", "dd>dd", skillId, level, &width, &height)) { return; } diff --git a/Source/Client/Mode/GameModePackets.cpp b/Source/Client/Mode/GameModePackets.cpp index 9167988d..d04adabc 100644 --- a/Source/Client/Mode/GameModePackets.cpp +++ b/Source/Client/Mode/GameModePackets.cpp @@ -6677,7 +6677,7 @@ void CGameMode::ReceiveAgitNotice(unsigned char agitId, int first, int second) { char text[256] = {}; const char* agitName = nullptr; - g_luaScript->Call("get_agit_name", "d>s", agitId, &agitName); + g_session.m_hotkeyScript->Call("get_agit_name", "d>s", agitId, &agitName); sprintf_s(text, LookupMessage(3632), agitName, second, 100, first, 100); g_windowMgr.Confirm(text, 0, true, false, 0, "Message", 250, 130, 0); } @@ -6978,7 +6978,7 @@ void CGameMode::ReceiveRandomOptionSimulation(const unsigned char* packet) { std::fprintf(file, "\n%s\n", typeNames[type]); for (const RandomOptionSimulationRecord* option : options[type]) { const char* optionName = nullptr; - if (g_luaScript->Call("GetVarOptionName", "d>s", option->optionId, &optionName)) { + if (g_session.m_hotkeyScript->Call("GetVarOptionName", "d>s", option->optionId, &optionName)) { std::fprintf(file, "\t%s", ToUtf8(std::string(optionName), g_textCodePage).c_str()); if (type == 5) { std::fprintf( @@ -9259,7 +9259,7 @@ void CGameMode::ReceiveSkillFailure(const unsigned char* data) { if (HidesUseFailureMessage(packet->skillId) || !showMessage) { return; } - std::sprintf(text, LookupMessage(0x5B4), CSkillInfo::DisplayName(*g_luaScript, packet->skillId)); + std::sprintf(text, LookupMessage(0x5B4), CSkillInfo::DisplayName(*g_session.m_hotkeyScript, packet->skillId)); notice = text; break; case 5: @@ -9416,7 +9416,7 @@ void CGameMode::ReceiveSkillFailure(const unsigned char* data) { if (packet->value == 0) { std::sprintf(text, LookupMessage(0x618)); } else { - std::sprintf(text, LookupMessage(0x617), CSkillInfo::DisplayName(*g_luaScript, packet->value)); + std::sprintf(text, LookupMessage(0x617), CSkillInfo::DisplayName(*g_session.m_hotkeyScript, packet->value)); } notice = text; break; @@ -11289,7 +11289,7 @@ void NoticeSkillUse(CGameActor* target, CGameActor* source, std::uint16_t skillI message += text; } - const std::string skillName = CSkillInfo::DisplayName(*g_luaScript, skillId); + const std::string skillName = CSkillInfo::DisplayName(*g_session.m_hotkeyScript, skillId); StringFormat(text, sizeof(text), static_cast(-1), LookupMessage(1625), skillName.c_str()); message += text; if (!message.empty()) { @@ -15537,7 +15537,7 @@ void CGameMode::ReceiveRefineStatusGraded(const char* playerName, int itemId, un const char* signatureText = signature.Text(); const std::uint8_t functionSource[] = {0xB6, 0xA2, 0x4D, 0x4C, 0x66, 0x0C, 0x26, 0x81, 0xBB, 0xA8, 0x5B, 0x09}; thread_local EncryptedText function(functionSource); - g_luaScript->Call(function.Text(), signatureText, itemId, &job); + g_session.m_hotkeyScript->Call(function.Text(), signatureText, itemId, &job); if (job != 0) { item.unknown_0000[0] = 0x15; } diff --git a/Source/Contents/Actors/CharacterRender.cpp b/Source/Contents/Actors/CharacterRender.cpp index 04aa08c8..fa9d9d1b 100644 --- a/Source/Contents/Actors/CharacterRender.cpp +++ b/Source/Contents/Actors/CharacterRender.cpp @@ -226,7 +226,7 @@ std::list CCharacterRender::BuildDrawList(unsigned char if (direction > 7) { direction = 0; } - g_luaScript->Call("OffsetItemPos_GetOffsetForDoram", "ddd>dd", views[type], direction, this->unknown_0018[0], &doramX, &doramY); + g_session.m_hotkeyScript->Call("OffsetItemPos_GetOffsetForDoram", "ddd>dd", views[type], direction, this->unknown_0018[0], &doramX, &doramY); offsetX = doramX; offsetY = doramY; } @@ -369,7 +369,7 @@ std::list CCharacterRender::BuildDrawList(unsigned char const int direction = this->unknown_0040 % 8; if (views[type] > 0) { int priority = -1; - g_luaScript->Call("GetLayerPriority", "ddd>d", direction, type, views[type], &priority); + g_session.m_hotkeyScript->Call("GetLayerPriority", "ddd>d", direction, type, views[type], &priority); if (priority != -1) { SpriteLayerQuad entry; entry.quad = quad; diff --git a/Source/Contents/Actors/Player.cpp b/Source/Contents/Actors/Player.cpp index 0ef94f21..cb578128 100644 --- a/Source/Contents/Actors/Player.cpp +++ b/Source/Contents/Actors/Player.cpp @@ -413,7 +413,7 @@ void CGrannyPc::Slot15(int state, int resetPosition) { CGameActor::Slot15(weaponAllowed ? 9 : 2, resetPosition); this->unknown_0378 = AttackMotionLength(this->GetEffectiveJob(-1), this->unknown_0260, this->unknown_0440, weaponAllowed); bool usesArrow = false; - g_luaScript->Call("IsItemUsingArrow", "d>b", this->unknown_0440, &usesArrow); + g_session.m_hotkeyScript->Call("IsItemUsingArrow", "d>b", this->unknown_0440, &usesArrow); if (usesArrow == true) { CGameMode* mode = static_cast(g_modeMgr.GetGameMode()); (mode->*spawnArrow)(&this->render.position, this->hitTargetAid, this->unknown_0378 * this->render.speed, 0); @@ -4422,7 +4422,7 @@ void CPc::ChangeState(int state, int resetPosition) { weaponView = GetWeaponViewValue(weaponView); } bool usesArrow = false; - g_luaScript->Call("IsItemUsingArrow", "d>b", weaponView, &usesArrow); + g_session.m_hotkeyScript->Call("IsItemUsingArrow", "d>b", weaponView, &usesArrow); if (usesArrow == true) { if (this->Slot58() == true) { this->Slot59(false); diff --git a/Source/Contents/Actors/SpriteDrawingPolicy.cpp b/Source/Contents/Actors/SpriteDrawingPolicy.cpp index a1ec2970..0f2ef686 100644 --- a/Source/Contents/Actors/SpriteDrawingPolicy.cpp +++ b/Source/Contents/Actors/SpriteDrawingPolicy.cpp @@ -9,12 +9,12 @@ bool CCharacterRender::DrawOnTop() const { if (g_session.m_newRobeDrawOnTop == 1) { int unusedPriority = 1; - g_luaScript->Call( + g_session.m_hotkeyScript->Call( "_New_DrawOnTop", "ddddd>bd", this->unknown_00BC, this->unknown_0018[0], this->unknown_0010, this->unknown_0040, this->unknown_0044, &drawOnTop, &unusedPriority ); } else { - g_luaScript->Call("DrawOnTop", "ddddd>b", this->unknown_00BC, this->unknown_0018[0], this->unknown_0010, this->unknown_0040, this->unknown_0044, &drawOnTop); + g_session.m_hotkeyScript->Call("DrawOnTop", "ddddd>b", this->unknown_00BC, this->unknown_0018[0], this->unknown_0010, this->unknown_0040, this->unknown_0044, &drawOnTop); } return drawOnTop; @@ -24,5 +24,5 @@ bool CCharacterRender::DrawOnTop() const { // FUNCTION: fn_10111 bool CCharacterRender::SetRobe(int robe) { this->unknown_00BC = robe; - return g_luaScript->CallTable("TB_Layer_Priority", "IsHelmRobe", "d>b", robe, &this->unknown_00C0); + return g_session.m_hotkeyScript->CallTable("TB_Layer_Priority", "IsHelmRobe", "d>b", robe, &this->unknown_00C0); } diff --git a/Source/Contents/Configuration/ServiceOptions.cpp b/Source/Contents/Configuration/ServiceOptions.cpp index 456cc087..9b47b90e 100644 --- a/Source/Contents/Configuration/ServiceOptions.cpp +++ b/Source/Contents/Configuration/ServiceOptions.cpp @@ -100,9 +100,6 @@ static_assert(sizeof(GameSettings) == 0x58); // GLOBAL: gl_24579 ServiceOptions g_serviceOptions; -// GLOBAL: gl_24791 -LuaScript* g_luaScript; - // GLOBAL: gl_24569 const float g_jitterDistanceScale = 400.0f; @@ -1505,7 +1502,7 @@ extern const GUID g_defaultDrawGuidDX7 = {}; // OFFSET: 0x00DFE4E0 // FUNCTION: fn_23604 void CSession::LoadOptionInfo() { - g_luaScript->Call("SetCmdOnOffList", ""); + g_session.m_hotkeyScript->Call("SetCmdOnOffList", ""); ResourceExists("OptionInfo.lua", 1); g_textureFiltering = this->GetOptionInteger("Trilinear", 0); diff --git a/Source/Contents/Effects/EZ2STREffect.cpp b/Source/Contents/Effects/EZ2STREffect.cpp index 0d22ac6c..3b39d04c 100644 --- a/Source/Contents/Effects/EZ2STREffect.cpp +++ b/Source/Contents/Effects/EZ2STREffect.cpp @@ -90,7 +90,7 @@ float GetHatEffectOffsetX(int id, const char* name) { if (id >= 0x9B5) { double position = 0.0; - g_luaScript->Call("GetHatEfPosX", "d>l", id - 0x9B5, &position); + g_session.m_hotkeyScript->Call("GetHatEfPosX", "d>l", id - 0x9B5, &position); result = static_cast(offset + position); } diff --git a/Source/Contents/Effects/EffectLists.cpp b/Source/Contents/Effects/EffectLists.cpp index fb750977..b5e51d0d 100644 --- a/Source/Contents/Effects/EffectLists.cpp +++ b/Source/Contents/Effects/EffectLists.cpp @@ -1848,7 +1848,7 @@ bool EffectLists::RegisterAllocators() { return false; } - std::list hatEffects = g_luaScript->TableKeys("hatEffectTable", 14); + std::list hatEffects = g_session.m_hotkeyScript->TableKeys("hatEffectTable", 14); for (int hatEffect : hatEffects) { if (!this->RegisterAllocator(hatEffect + 2485, new (std::nothrow) CEffectAllocator)) { return false; @@ -5288,32 +5288,32 @@ void EffectLists::Update() { bool HasEffectScript(std::string path, std::string name) { bool exists = false; std::string versionKey = EmitterKey(name.substr(), "effect_version"); - g_luaScript->Call("IsExistValue", "s>b", versionKey.c_str(), &exists); + g_session.m_hotkeyScript->Call("IsExistValue", "s>b", versionKey.c_str(), &exists); if (exists) { return true; } std::string emitterKey = EmitterKey(name.substr(), "emitterInfo"); - g_luaScript->Call("IsExistValue", "s>b", emitterKey.c_str(), &exists); + g_session.m_hotkeyScript->Call("IsExistValue", "s>b", emitterKey.c_str(), &exists); return exists; } // OFFSET: 0x00B3B0A0 // FUNCTION: fn_18795 void ReadEffectScriptV1(std::string name) { - g_luaScript->Call("ReadEmitterInfoz_ver_1_0", "s", EmitterInfoKey(name.substr()).c_str()); - g_luaScript->Call("ReadEffectInfoz", "s", EffectFunctionName(name.substr()).c_str()); + g_session.m_hotkeyScript->Call("ReadEmitterInfoz_ver_1_0", "s", EmitterInfoKey(name.substr()).c_str()); + g_session.m_hotkeyScript->Call("ReadEffectInfoz", "s", EffectFunctionName(name.substr()).c_str()); } // OFFSET: 0x00B3B240 // FUNCTION: fn_18796 void ReadEffectScriptV2(std::string name) { - g_luaScript->Call("ReadEmitterInfoz", "s", EmitterKey(name.substr(), "emitterInfo").c_str()); - g_luaScript->Call("ReadMagicFloorInfoz", "s", EmitterKey(name.substr(), "magicfloorInfo").c_str()); - g_luaScript->Call("ReadEvilsPawInfoz", "s", EmitterKey(name.substr(), "evilsPawInfo").c_str()); - g_luaScript->Call("ReadAnimatedEmitterInfoz", "s", EmitterKey(name.substr(), "animatedEmitterInfo").c_str()); - g_luaScript->Call("ReadEZ2STRInfoz", "s", EmitterKey(name.substr(), "ez2strInfo").c_str()); - g_luaScript->Call("ReadWindEffectInfoz", "s", EmitterKey(name.substr(), "windEffectInfo").c_str()); + g_session.m_hotkeyScript->Call("ReadEmitterInfoz", "s", EmitterKey(name.substr(), "emitterInfo").c_str()); + g_session.m_hotkeyScript->Call("ReadMagicFloorInfoz", "s", EmitterKey(name.substr(), "magicfloorInfo").c_str()); + g_session.m_hotkeyScript->Call("ReadEvilsPawInfoz", "s", EmitterKey(name.substr(), "evilsPawInfo").c_str()); + g_session.m_hotkeyScript->Call("ReadAnimatedEmitterInfoz", "s", EmitterKey(name.substr(), "animatedEmitterInfo").c_str()); + g_session.m_hotkeyScript->Call("ReadEZ2STRInfoz", "s", EmitterKey(name.substr(), "ez2strInfo").c_str()); + g_session.m_hotkeyScript->Call("ReadWindEffectInfoz", "s", EmitterKey(name.substr(), "windEffectInfo").c_str()); } // OFFSET: 0x00B3AC30 @@ -5326,10 +5326,10 @@ void EffectLists::LoadMapEffectScript(bool reload) { std::string directory = "Lua Files\\EffectTool\\"; std::string name = CurrentMapScriptName(); std::string path = directory + name; - if (HasEffectScript(path.c_str(), name.substr()) || g_luaScript->Load(path.c_str(), true, false)) { + if (HasEffectScript(path.c_str(), name.substr()) || g_session.m_hotkeyScript->Load(path.c_str(), true, false)) { int version = 0; std::string versionKey = EmitterKey(name.substr(), "effect_version"); - g_luaScript->Call("GetValue", "s>d", versionKey.c_str(), &version); + g_session.m_hotkeyScript->Call("GetValue", "s>d", versionKey.c_str(), &version); switch (version) { case 0: case 1: diff --git a/Source/Contents/Effects/MonsterSkillEffects.cpp b/Source/Contents/Effects/MonsterSkillEffects.cpp index a79b7577..b3ef62a0 100644 --- a/Source/Contents/Effects/MonsterSkillEffects.cpp +++ b/Source/Contents/Effects/MonsterSkillEffects.cpp @@ -1053,7 +1053,7 @@ bool CFootprintEffect::Slot33() { void CFootprintEffect::Slot01() { char* leftFile = nullptr; char* rightFile = nullptr; - g_luaScript->Call("GetFootprintPngFile", "d>ss", this->unknown_00C4, &leftFile, &rightFile); + g_session.m_hotkeyScript->Call("GetFootprintPngFile", "d>ss", this->unknown_00C4, &leftFile, &rightFile); if (!leftFile || std::strlen(leftFile) == 0 || !rightFile || std::strlen(rightFile) == 0) { return; } @@ -1062,18 +1062,18 @@ void CFootprintEffect::Slot01() { this->unknown_00EC = rightFile; double scale = 5.0; - g_luaScript->Call("GetFootprintPngScale", "d>l", this->unknown_00C4, &scale); + g_session.m_hotkeyScript->Call("GetFootprintPngScale", "d>l", this->unknown_00C4, &scale); *reinterpret_cast(&this->unknown_0048) = static_cast(scale); int alpha = 250; - g_luaScript->Call("GetFootprintPngAplha", "d>d", this->unknown_00C4, &alpha); + g_session.m_hotkeyScript->Call("GetFootprintPngAplha", "d>d", this->unknown_00C4, &alpha); *reinterpret_cast(this->unknown_0054) = alpha; int duration = 10; - g_luaScript->Call("GetFootprintPngDuration", "d>d", this->unknown_00C4, &duration); + g_session.m_hotkeyScript->Call("GetFootprintPngDuration", "d>d", this->unknown_00C4, &duration); this->unknown_002C = duration; - g_luaScript->Call("GetFootprintStride", "d>l", this->unknown_00C4, &this->stepDistance); + g_session.m_hotkeyScript->Call("GetFootprintStride", "d>l", this->unknown_00C4, &this->stepDistance); this->unknown_0120 = 0.0f; } @@ -1210,13 +1210,13 @@ bool CFootprintStrEffect::Slot33() { void CFootprintStrEffect::Slot01() { char* leftFile = nullptr; char* rightFile = nullptr; - g_luaScript->Call("GetFootprintStrFileBottom", "d>ss", this->unknown_00C4, &leftFile, &rightFile); + g_session.m_hotkeyScript->Call("GetFootprintStrFileBottom", "d>ss", this->unknown_00C4, &leftFile, &rightFile); if (!IsNullOrEmpty(leftFile) && !IsNullOrEmpty(rightFile)) { this->unknown_00DC = leftFile; this->unknown_00F4 = rightFile; } - g_luaScript->Call("GetFootprintStrFileTop", "d>ss", this->unknown_00C4, &leftFile, &rightFile); + g_session.m_hotkeyScript->Call("GetFootprintStrFileTop", "d>ss", this->unknown_00C4, &leftFile, &rightFile); if (!IsNullOrEmpty(leftFile) && !IsNullOrEmpty(rightFile)) { this->unknown_010C = leftFile; this->unknown_0124 = rightFile; @@ -1227,11 +1227,11 @@ void CFootprintStrEffect::Slot01() { return; } - g_luaScript->Call("GetFootprintStrScale", "d>ll", this->unknown_00C4, &this->unknown_0140, &this->unknown_0148); - g_luaScript->Call("GetFootprintStrTopHeight", "d>l", this->unknown_00C4, &this->unknown_0150); - g_luaScript->Call("GetFootprintStride", "d>l", this->unknown_00C4, &this->unknown_0158); - g_luaScript->Call("GetFootprintStrGap", "d>l", this->unknown_00C4, &this->unknown_0160); - g_luaScript->Call("IsFootprintStrAdjustAngle", "d>b", this->unknown_00C4, &this->unknown_0168); + g_session.m_hotkeyScript->Call("GetFootprintStrScale", "d>ll", this->unknown_00C4, &this->unknown_0140, &this->unknown_0148); + g_session.m_hotkeyScript->Call("GetFootprintStrTopHeight", "d>l", this->unknown_00C4, &this->unknown_0150); + g_session.m_hotkeyScript->Call("GetFootprintStride", "d>l", this->unknown_00C4, &this->unknown_0158); + g_session.m_hotkeyScript->Call("GetFootprintStrGap", "d>l", this->unknown_00C4, &this->unknown_0160); + g_session.m_hotkeyScript->Call("IsFootprintStrAdjustAngle", "d>b", this->unknown_00C4, &this->unknown_0168); } // OFFSET: 0x00713830 diff --git a/Source/Contents/EntryQueueMgr.cpp b/Source/Contents/EntryQueueMgr.cpp index 4da98f47..5f4e4a6f 100644 --- a/Source/Contents/EntryQueueMgr.cpp +++ b/Source/Contents/EntryQueueMgr.cpp @@ -1,4 +1,5 @@ #include "Contents/EntryQueueMgr.h" +#include "Client/Session.h" #include "Contents/MessageTable.h" #include "Contents/Sound/SoundMgr.h" @@ -282,7 +283,7 @@ void CEntryQueueMgr::OnNotify(const EntryQueueNotice* notice) { // INLINED CEntryQueueMgr::CEntryQueueMgr() : current(nullptr), ready(0) { std::memset(&this->queueName, 0, sizeof(this->queueName) + sizeof(this->characterName)); - g_luaScript->Call("ReadEntryQueueList", ""); + g_session.m_hotkeyScript->Call("ReadEntryQueueList", ""); } // OFFSET: 0x00BA1DF0 diff --git a/Source/Contents/Jobs/JobNameInitialization.cpp b/Source/Contents/Jobs/JobNameInitialization.cpp index 3987f80b..349783cf 100644 --- a/Source/Contents/Jobs/JobNameInitialization.cpp +++ b/Source/Contents/Jobs/JobNameInitialization.cpp @@ -33,7 +33,7 @@ void CSession::InitJobNameTable() { const auto other = [&](int first, int end) { for (int id = first; id < end; ++id) { - g_luaScript->Call("ReqJobName", "d>s", id, &this->m_jobNameTable[id]); + g_session.m_hotkeyScript->Call("ReqJobName", "d>s", id, &this->m_jobNameTable[id]); } }; diff --git a/Source/Contents/Party/AdventurerAgencyMgr.cpp b/Source/Contents/Party/AdventurerAgencyMgr.cpp index 575ce633..31f46bd8 100644 --- a/Source/Contents/Party/AdventurerAgencyMgr.cpp +++ b/Source/Contents/Party/AdventurerAgencyMgr.cpp @@ -70,7 +70,7 @@ const std::vector& CAdventurerAgencyMgr::Entries() const { // OFFSET: 0x005CAA50 // FUNCTION: fn_03655 std::string CAdventurerAgencyMgr::ServiceUrl(int operation) const { - std::string url = ResolveAccountServiceBase(*g_luaScript, *g_session.m_hotkeyScript, g_serviceHost, g_servicePort, g_serviceOverrideKey); + std::string url = ResolveAccountServiceBase(*g_session.m_hotkeyScript, *g_session.m_hotkeyScript, g_serviceHost, g_servicePort, g_serviceOverrideKey); if (url.empty()) { return url; diff --git a/Source/Contents/RenewQuestMgr.cpp b/Source/Contents/RenewQuestMgr.cpp index 8af0c82c..372d8826 100644 --- a/Source/Contents/RenewQuestMgr.cpp +++ b/Source/Contents/RenewQuestMgr.cpp @@ -531,7 +531,7 @@ void CRenewQuestMgr::AddOngoingQuest(unsigned int id, RenewQuestOngoingInfo& inf const char* icon = nullptr; const char* title = nullptr; bool simpleView = true; - if (g_luaScript->Call("GetOngoingQuestInfoByID", "d>bsssssssddd", id, &simpleView, &title, &icon, &text3, &text4, &text5, &text6, + if (g_session.m_hotkeyScript->Call("GetOngoingQuestInfoByID", "d>bsssssssddd", id, &simpleView, &title, &icon, &text3, &text4, &text5, &text6, &text7, &unknown1, &unknown2, &type)) { info.m_title = title ? title : ""; info.m_icon = icon ? icon : ""; @@ -558,8 +558,8 @@ void CRenewQuestMgr::AddOngoingQuest(unsigned int id, RenewQuestOngoingInfo& inf } this->m_ongoingQuests[id] = info; - g_luaScript->Call("GetOngoingDescription", "d", id); - g_luaScript->Call("GetOngoingRewardInfo", "d", id); + g_session.m_hotkeyScript->Call("GetOngoingDescription", "d", id); + g_session.m_hotkeyScript->Call("GetOngoingRewardInfo", "d", id); } // OFFSET: 0x0067ACE0 diff --git a/Source/Contents/Skills/SkillLevelRegistry.cpp b/Source/Contents/Skills/SkillLevelRegistry.cpp index 6183cbe6..1dd53f13 100644 --- a/Source/Contents/Skills/SkillLevelRegistry.cpp +++ b/Source/Contents/Skills/SkillLevelRegistry.cpp @@ -33,10 +33,10 @@ void LoadSkillUseLevelRegistry() { int value; char name[100] = {}; const int character = g_session.unknown_0F50; - const char* skill = CSkillInfo::IdName(*g_luaScript, id); + const char* skill = CSkillInfo::IdName(*g_session.m_hotkeyScript, id); std::sprintf(name, "%s%d", skill, character); - if (RegQueryValueExA(handle, name, nullptr, &type, reinterpret_cast(&value), &size) != ERROR_SUCCESS || !CSkillInfo::UsesLevel(*g_luaScript, id)) { + if (RegQueryValueExA(handle, name, nullptr, &type, reinterpret_cast(&value), &size) != ERROR_SUCCESS || !CSkillInfo::UsesLevel(*g_session.m_hotkeyScript, id)) { return 0; } diff --git a/Source/Contents/SpriteLayerDrawing.cpp b/Source/Contents/SpriteLayerDrawing.cpp index 493072ab..0d03d889 100644 --- a/Source/Contents/SpriteLayerDrawing.cpp +++ b/Source/Contents/SpriteLayerDrawing.cpp @@ -195,7 +195,7 @@ void SpriteLayerRenderer::QueueQuad(int layer, const SpriteQuad* quad, const std const int direction = this->pc->render.previousAnimation - this->pc->render.animation; if (this->layerViews[layer] > 0) { int priority = -1; - g_luaScript->Call("GetLayerPriority", "ddd>d", direction, layer, this->layerViews[layer], &priority); + g_session.m_hotkeyScript->Call("GetLayerPriority", "ddd>d", direction, layer, this->layerViews[layer], &priority); if (priority == -1) { return; } @@ -536,7 +536,7 @@ std::pair SpriteLayerRenderer::GetItemOffset(int layer) { int x = 0; int y = 0; - g_luaScript->Call("OffsetItemPos_GetOffsetForDoram", "ddd>dd", this->layerViews[layer], direction, pc->unknown_0260, &x, &y); + g_session.m_hotkeyScript->Call("OffsetItemPos_GetOffsetForDoram", "ddd>dd", this->layerViews[layer], direction, pc->unknown_0260, &x, &y); return std::make_pair(x, y); } diff --git a/Source/Contents/UserData/AccountLinkedUserDataMgr.cpp b/Source/Contents/UserData/AccountLinkedUserDataMgr.cpp index c3f1fea9..35761743 100644 --- a/Source/Contents/UserData/AccountLinkedUserDataMgr.cpp +++ b/Source/Contents/UserData/AccountLinkedUserDataMgr.cpp @@ -80,7 +80,7 @@ void CAccountLinkedUserDataMgr::CompleteLoad( if (type == 1) { LoadWhisperBlockList(root["data"]); g_session.m_emotionHotkeys.Load(root["data"]); - g_userHotkeyMgr->LoadV2(*g_luaScript, root["data"]); + g_userHotkeyMgr->LoadV2(*g_session.m_hotkeyScript, root["data"]); } if (type == 1 || type == 2) { @@ -144,8 +144,8 @@ void CAccountLinkedUserDataMgr::Save() { emotions.Export(data); } - if (g_userHotkeyMgr->HasChanges(*g_luaScript)) { - g_userHotkeyMgr->Export(*g_luaScript, data); + if (g_userHotkeyMgr->HasChanges(*g_session.m_hotkeyScript)) { + g_userHotkeyMgr->Export(*g_session.m_hotkeyScript, data); } if (!data.isNull()) { diff --git a/Source/Script/LuaScript.cpp b/Source/Script/LuaScript.cpp index a3c67f2b..6dd0ae48 100644 --- a/Source/Script/LuaScript.cpp +++ b/Source/Script/LuaScript.cpp @@ -1256,7 +1256,7 @@ void LuaScript::Register(std::string name, int (*function)(lua_State*)) { int UIWindowMgr::GetHotkeyBehavior() { int behavior = -1; const int mode = static_cast(g_session.m_options.Get(10)); - g_luaScript->Call("GetBehaviorOfHotKey2", "ddd>d", mode, this->keyCode, this->modifierKey, &behavior); + g_session.m_hotkeyScript->Call("GetBehaviorOfHotKey2", "ddd>d", mode, this->keyCode, this->modifierKey, &behavior); if (behavior != -1) { return behavior; } @@ -1264,9 +1264,9 @@ int UIWindowMgr::GetHotkeyBehavior() { if (this->modifierKey == VK_SHIFT && !g_inputSuggestionsEnabled) { UIWindow* parent = this->hoverWindow ? this->hoverWindow->parent : nullptr; if (!parent || parent == this->window_01C8 || parent->geometry.visible == 0) { - const int count = HotkeyCount(*g_luaScript, 0); + const int count = HotkeyCount(*g_session.m_hotkeyScript, 0); for (int index = 0; index < count; ++index) { - const HotkeyInfo hotkey = GetHotkeyInfo(*g_luaScript, 0, index); + const HotkeyInfo hotkey = GetHotkeyInfo(*g_session.m_hotkeyScript, 0, index); if (hotkey.key1 == this->keyCode && g_session.m_shortcutSlots[index].unknown_0000 != 0) { return index; } diff --git a/Source/Script/LuaScript.h b/Source/Script/LuaScript.h index a6acbc3c..bce5b067 100644 --- a/Source/Script/LuaScript.h +++ b/Source/Script/LuaScript.h @@ -41,7 +41,6 @@ private: void Register(); }; -extern LuaScript* g_luaScript; extern std::map> g_kafraServiceMapList; struct MiniMapPosition; diff --git a/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp b/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp index d98dd9c9..efbef30e 100644 --- a/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp +++ b/Source/UI/Acceptance/UIChooseSellBuyWnd.cpp @@ -6942,13 +6942,13 @@ int UISkillDescribeWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, g_windowMgr.CloseWindow(10030); } - this->unknown_00EC = this->unknown_00D4 = skill.DisplayName(*g_luaScript); + this->unknown_00EC = this->unknown_00D4 = skill.DisplayName(*g_session.m_hotkeyScript); this->m_skillId = static_cast(skill.id); { CSkillInfo owned = g_session.LookupSkill(static_cast(a)); if (owned.available != 0 && owned.unknown_0014 != 0 && owned.level != 0) { char cost[64]; - if (skill.UseApAmount(*g_luaScript, owned.level) != 0) { + if (skill.UseApAmount(*g_session.m_hotkeyScript, owned.level) != 0) { std::sprintf(cost, " (Sp : %d, Ap : %d)", owned.unknown_0014, owned.unknown_0034); } else { std::sprintf(cost, " (Sp : %d)", owned.unknown_0014); @@ -6956,16 +6956,16 @@ int UISkillDescribeWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a, this->unknown_00EC.append(cost, std::strlen(cost)); } bool passive = false; - g_luaScript->Call("IsPassiveSkill", "d>b", static_cast(a), &passive); + g_session.m_hotkeyScript->Call("IsPassiveSkill", "d>b", static_cast(a), &passive); this->m_delayButton->Enable(!passive); this->m_text->Clear(); } - this->unknown_00BC = std::string("유저인터페이스\\item\\") + std::string(skill.IdName(*g_luaScript)) + ".bmp"; + this->unknown_00BC = std::string("유저인터페이스\\item\\") + std::string(skill.IdName(*g_session.m_hotkeyScript)) + ".bmp"; this->m_viewer->Clear(); const char* description = nullptr; - if (g_luaScript->Call("GetSkillDescript", "ddd>s", g_session.m_job, static_cast(a), b == 0 && c == 0 && d == 1, &description)) { + if (g_session.m_hotkeyScript->Call("GetSkillDescript", "ddd>s", g_session.m_job, static_cast(a), b == 0 && c == 0 && d == 1, &description)) { const std::string text = description; if (!text.empty()) { if (FindShopId(g_session, std::string()) != -1) { diff --git a/Source/UI/Buttons/UIButton.cpp b/Source/UI/Buttons/UIButton.cpp index c0c5a16c..dad539e3 100644 --- a/Source/UI/Buttons/UIButton.cpp +++ b/Source/UI/Buttons/UIButton.cpp @@ -1,4 +1,5 @@ #include "Client/Replay.h" +#include "Client/Session.h" #include "UI/Window/WindowPolicy.h" #include "UI/Window/UINewSelectCharWnd.h" #include "Contents/MessageTable.h" @@ -104,7 +105,7 @@ void UIButton::Slot28(int x, int y) { this->m_tooltip.clear(); } else { const char* text = nullptr; - if (g_luaScript->Call("GetBeHaviorOfWindow", "d>s", parent->geometry.id, &text)) { + if (g_session.m_hotkeyScript->Call("GetBeHaviorOfWindow", "d>s", parent->geometry.id, &text)) { this->m_tooltip.assign(text, std::strlen(text)); } } diff --git a/Source/UI/CashShop/UICashShopWnd.cpp b/Source/UI/CashShop/UICashShopWnd.cpp index c2c4a816..0075edda 100644 --- a/Source/UI/CashShop/UICashShopWnd.cpp +++ b/Source/UI/CashShop/UICashShopWnd.cpp @@ -992,13 +992,13 @@ int UICashShopWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argument return 0; case 0x22: if (g_session.unknown_5912) { - if (g_luaScript->Call("set_stoveshop_banner", "") == true) { + if (g_session.m_hotkeyScript->Call("set_stoveshop_banner", "") == true) { this->m_banner->CreateButtons(); this->m_secondBanner->CreateButtons(); this->Invalidate(); return 0; } - } else if (g_luaScript->Call("set_cashshop_banner", "") == true) { + } else if (g_session.m_hotkeyScript->Call("set_cashshop_banner", "") == true) { this->m_banner->CreateButtons(); this->Invalidate(); return 0; diff --git a/Source/UI/Guild/UIAgitWnd.cpp b/Source/UI/Guild/UIAgitWnd.cpp index ae7ef82c..45787ba4 100644 --- a/Source/UI/Guild/UIAgitWnd.cpp +++ b/Source/UI/Guild/UIAgitWnd.cpp @@ -155,7 +155,7 @@ int UIListBoxAgitMenu::SendMsg(UIWindow* sender, int message, std::intptr_t a, s GuildInfo* guildInfo = &g_guildInfo; uint16_t agitId = static_cast(guildInfo->GetUnknown0114(this->m_agitIndex)); - LuaScript* luaScript = g_luaScript; + LuaScript* luaScript = g_session.m_hotkeyScript; char* agitName = nullptr; luaScript->Call("get_agit_name", "d>s", agitId, &agitName); if (agitName != nullptr && strnlen(agitName, 256) != 0) { diff --git a/Source/UI/Guild/UIGuildWnd.cpp b/Source/UI/Guild/UIGuildWnd.cpp index be8125fe..a15d3698 100644 --- a/Source/UI/Guild/UIGuildWnd.cpp +++ b/Source/UI/Guild/UIGuildWnd.cpp @@ -1107,7 +1107,7 @@ void UIGuildInfoManageWnd::RefreshAgitList() { for (int index = 0; index < count; ++index) { const int agitId = g_guildInfo.GetUnknown0114(index); char* agitName = nullptr; - g_luaScript->Call("get_agit_name", "d>s", agitId, &agitName); + g_session.m_hotkeyScript->Call("get_agit_name", "d>s", agitId, &agitName); if (strnlen(agitName, 256) != 0) { this->m_agitList->AddLine(agitName); } diff --git a/Source/UI/Menu/UIMenuIconWnd.cpp b/Source/UI/Menu/UIMenuIconWnd.cpp index a99cb901..14ad6931 100644 --- a/Source/UI/Menu/UIMenuIconWnd.cpp +++ b/Source/UI/Menu/UIMenuIconWnd.cpp @@ -340,7 +340,7 @@ void UIMenuIcon::Slot27(int x, int y) { if (known) { const char* behavior = nullptr; - g_luaScript->Call("GetBeHaviorOfWindow", "d>s", behaviorId, &behavior); + g_session.m_hotkeyScript->Call("GetBeHaviorOfWindow", "d>s", behaviorId, &behavior); if (std::strlen(behavior) == 0) { this->m_tooltip = LookupMessage(message); } else { diff --git a/Source/UI/Shortcuts/ShortcutCooldowns.cpp b/Source/UI/Shortcuts/ShortcutCooldowns.cpp index df411053..ab84a884 100644 --- a/Source/UI/Shortcuts/ShortcutCooldowns.cpp +++ b/Source/UI/Shortcuts/ShortcutCooldowns.cpp @@ -699,7 +699,7 @@ void UISelCharForUServerWnd::Paint() { direction = 0; } - g_luaScript->Call("OffsetItemPos_GetOffsetForDoram", "ddd>dd", item, direction, g_session.SyncUnknown0E98(), &x, &y); + g_session.m_hotkeyScript->Call("OffsetItemPos_GetOffsetForDoram", "ddd>dd", item, direction, g_session.SyncUnknown0E98(), &x, &y); offsetX = x; offsetY = y; } diff --git a/Source/UI/SkillDelayInfo/UISkillDelayInfo.cpp b/Source/UI/SkillDelayInfo/UISkillDelayInfo.cpp index 9a3a06f1..fec375fd 100644 --- a/Source/UI/SkillDelayInfo/UISkillDelayInfo.cpp +++ b/Source/UI/SkillDelayInfo/UISkillDelayInfo.cpp @@ -518,7 +518,7 @@ void CUISkillDelayInfo::SetSkill(int skillId) { this->delayList->UpdateScrollBar(); const char* skillDescription = nullptr; - g_luaScript->Call("GetSkillDescript", "ddd>s", g_session.m_job, skillId, 0, &skillDescription); + g_session.m_hotkeyScript->Call("GetSkillDescript", "ddd>s", g_session.m_job, skillId, 0, &skillDescription); if (!IsNullOrEmpty(skillDescription)) { std::vector lines = Split(skillDescription, "\r\n"); if (!lines.empty()) { diff --git a/Source/UI/StylingShop/UIStylingShopWnd.cpp b/Source/UI/StylingShop/UIStylingShopWnd.cpp index 250a26c6..542ec1f0 100644 --- a/Source/UI/StylingShop/UIStylingShopWnd.cpp +++ b/Source/UI/StylingShop/UIStylingShopWnd.cpp @@ -293,7 +293,7 @@ int UIBasicStylingWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argu if (argument1 == 495) { int count = 0; - g_luaScript->Call("StylingShop_GetSizeInTable", "s>d", "HeadPalette", &count); + g_session.m_hotkeyScript->Call("StylingShop_GetSizeInTable", "s>d", "HeadPalette", &count); bool unselected = true; for (int i = 0; i < count; ++i) { @@ -301,7 +301,7 @@ int UIBasicStylingWnd::SendMsg(UIWindow* sender, int message, std::intptr_t argu unselected = false; bool coloring = true; if (g_session.IsDoramJob(g_session.GetDisplayJob()) == true) { - g_luaScript->Call("StylingShop_GetIsColoring_by_goods", "d>b", this->m_display->unknown_008C, &coloring); + g_session.m_hotkeyScript->Call("StylingShop_GetIsColoring_by_goods", "d>b", this->m_display->unknown_008C, &coloring); } if (coloring == true) { @@ -718,7 +718,7 @@ void UIStylingShopWnd::Paint() { // FUNCTION: fn_10320 void UIShowInfoWnd::CheckColoringGoods(bool* coloring) { if (g_session.IsDoramJob(g_session.GetDisplayJob()) == true) { - g_luaScript->Call("StylingShop_GetIsColoring_by_goods", "d>b", this->m_display->unknown_008C, coloring); + g_session.m_hotkeyScript->Call("StylingShop_GetIsColoring_by_goods", "d>b", this->m_display->unknown_008C, coloring); } const unsigned char* flags = this->unknown_00AD; @@ -758,11 +758,11 @@ void UIDisplayCharacter::LoadCostumes() { this->job = g_session.m_bodyCostume; int count = 0; - if (g_luaScript->Call("StylingShop_GetCostumeSize", "d>d", job, &count) == true) { + if (g_session.m_hotkeyScript->Call("StylingShop_GetCostumeSize", "d>d", job, &count) == true) { int value = 0; int key = 0; for (int i = 0; i < count; ++i) { - if (g_luaScript->Call("StylingShop_GetChangeCostume", "dd>dd", job, value, &key, &value) == true) { + if (g_session.m_hotkeyScript->Call("StylingShop_GetChangeCostume", "dd>dd", job, value, &key, &value) == true) { this->m_jobs.emplace(key, value); } } @@ -869,7 +869,7 @@ void ToggleStylingAccessory(int itemId, int slot) { // FUNCTION: fn_10379 void UIDisplayCharacter::SelectNextStyle(const char* table, int* goods) { int size = 0; - g_luaScript->Call("StylingShop_GetSizeInTable", "s>d", table, &size); + g_session.m_hotkeyScript->Call("StylingShop_GetSizeInTable", "s>d", table, &size); if (size == 0) { return; } @@ -884,12 +884,12 @@ void UIDisplayCharacter::SelectNextStyle(const char* table, int* goods) { } int sequence = 0; - g_luaScript->Call("StylingShop_GetSeqnumber_by_goods", "sd>d", table, *goods, &sequence); + g_session.m_hotkeyScript->Call("StylingShop_GetSeqnumber_by_goods", "sd>d", table, *goods, &sequence); ++sequence; if (sequence > size) { sequence = 1; } - g_luaScript->Call("StylingShop_GetSeqnumber_by_goods", "sd>d", table, sequence, goods); + g_session.m_hotkeyScript->Call("StylingShop_GetSeqnumber_by_goods", "sd>d", table, sequence, goods); if (g_session.GetDisplayJob() > JT_2004_JOB_BEGIN && g_session.GetDisplayJob() <= JT_THIEF_H && *goods == 0 && g_session.m_bodyStyle == 1) { *goods = 1; @@ -900,7 +900,7 @@ void UIDisplayCharacter::SelectNextStyle(const char* table, int* goods) { // FUNCTION: fn_10380 void UIDisplayCharacter::SelectPreviousStyle(const char* table, int* goods) { int size = 0; - g_luaScript->Call("StylingShop_GetSizeInTable", "s>d", table, &size); + g_session.m_hotkeyScript->Call("StylingShop_GetSizeInTable", "s>d", table, &size); if (size == 0) { return; } @@ -914,7 +914,7 @@ void UIDisplayCharacter::SelectPreviousStyle(const char* table, int* goods) { } int sequence = 0; - g_luaScript->Call("StylingShop_GetSeqnumber_by_goods", "sd>d", table, *goods, &sequence); + g_session.m_hotkeyScript->Call("StylingShop_GetSeqnumber_by_goods", "sd>d", table, *goods, &sequence); --sequence; if (sequence < 1) { sequence = size; @@ -922,7 +922,7 @@ void UIDisplayCharacter::SelectPreviousStyle(const char* table, int* goods) { if (sequence <= 0) { sequence = 1; } - g_luaScript->Call("StylingShop_GetGoods", "sd>d", table, sequence, goods); + g_session.m_hotkeyScript->Call("StylingShop_GetGoods", "sd>d", table, sequence, goods); if (g_session.GetDisplayJob() > JT_2004_JOB_BEGIN && g_session.GetDisplayJob() <= JT_THIEF_H && *goods == 0 && g_session.m_bodyStyle == 1) { *goods = 1; @@ -1004,25 +1004,25 @@ bool UIShowInfoWnd::CheckPayment(const int& index, const int& zeny, const int& i void UIShowInfoWnd::GetPayment(const int& type, int* zeny, int* itemId, int* costumeItemId) { switch (type) { case 1: - g_luaScript->Call("StylingShop_GetPayment_by_goods", "sd>ddd", this->m_display->GetStyleTable(type).c_str(), this->m_display->unknown_0094, zeny, itemId, costumeItemId); + g_session.m_hotkeyScript->Call("StylingShop_GetPayment_by_goods", "sd>ddd", this->m_display->GetStyleTable(type).c_str(), this->m_display->unknown_0094, zeny, itemId, costumeItemId); break; case 2: - g_luaScript->Call("StylingShop_GetPayment_by_goods", "sd>ddd", this->m_display->GetStyleTable(type).c_str(), this->m_display->unknown_008C, zeny, itemId, costumeItemId); + g_session.m_hotkeyScript->Call("StylingShop_GetPayment_by_goods", "sd>ddd", this->m_display->GetStyleTable(type).c_str(), this->m_display->unknown_008C, zeny, itemId, costumeItemId); break; case 3: - g_luaScript->Call("StylingShop_GetPayment_by_goods", "sd>ddd", this->m_display->GetStyleTable(type).c_str(), this->m_display->unknown_0098, zeny, itemId, costumeItemId); + g_session.m_hotkeyScript->Call("StylingShop_GetPayment_by_goods", "sd>ddd", this->m_display->GetStyleTable(type).c_str(), this->m_display->unknown_0098, zeny, itemId, costumeItemId); break; case 4: - g_luaScript->Call("StylingShop_GetPayment_by_goods", "sd>ddd", this->m_display->GetStyleTable(type).c_str(), this->m_display->unknown_00BC, zeny, itemId, costumeItemId); + g_session.m_hotkeyScript->Call("StylingShop_GetPayment_by_goods", "sd>ddd", this->m_display->GetStyleTable(type).c_str(), this->m_display->unknown_00BC, zeny, itemId, costumeItemId); break; case 5: - g_luaScript->Call("StylingShop_GetPayment_by_goods", "sd>ddd", this->m_display->GetStyleTable(type).c_str(), this->m_display->unknown_00C0, zeny, itemId, costumeItemId); + g_session.m_hotkeyScript->Call("StylingShop_GetPayment_by_goods", "sd>ddd", this->m_display->GetStyleTable(type).c_str(), this->m_display->unknown_00C0, zeny, itemId, costumeItemId); break; case 6: - g_luaScript->Call("StylingShop_GetPayment_by_goods", "sd>ddd", this->m_display->GetStyleTable(type).c_str(), this->m_display->unknown_00C4, zeny, itemId, costumeItemId); + g_session.m_hotkeyScript->Call("StylingShop_GetPayment_by_goods", "sd>ddd", this->m_display->GetStyleTable(type).c_str(), this->m_display->unknown_00C4, zeny, itemId, costumeItemId); break; case 7: - g_luaScript->Call("StylingShop_GetPaymentChangeCostume", "dd>ddd", g_session.m_job, this->m_display->job, zeny, itemId, costumeItemId); + g_session.m_hotkeyScript->Call("StylingShop_GetPaymentChangeCostume", "dd>ddd", g_session.m_job, this->m_display->job, zeny, itemId, costumeItemId); break; } } @@ -1051,7 +1051,7 @@ void UIShowInfoWnd::UpdateChangedStyles() { } int sequence = 0; - g_luaScript->Call("StylingShop_GetSeqnumber_by_goods", "sd>d", "TopAccessory", this->m_display->unknown_00BC, &sequence); + g_session.m_hotkeyScript->Call("StylingShop_GetSeqnumber_by_goods", "sd>d", "TopAccessory", this->m_display->unknown_00BC, &sequence); if (!this->unknown_00AD[3] && this->m_display->unknown_009C != *reinterpret_cast(&g_session.unknown_0EF4[4]) && this->m_display->unknown_009C != 0 && sequence != 0) { this->m_checks[this->m_list.size()]->SetChecked(1); @@ -1060,7 +1060,7 @@ void UIShowInfoWnd::UpdateChangedStyles() { } unsigned char* accessoryChanged = reinterpret_cast(&this->unknown_00B1); - g_luaScript->Call("StylingShop_GetSeqnumber_by_goods", "sd>d", "MidAccessory", this->m_display->unknown_00C0, &sequence); + g_session.m_hotkeyScript->Call("StylingShop_GetSeqnumber_by_goods", "sd>d", "MidAccessory", this->m_display->unknown_00C0, &sequence); if (!accessoryChanged[0] && this->m_display->unknown_00A0 != *reinterpret_cast(&g_session.unknown_0EF4[8]) && this->m_display->unknown_00A0 != 0 && sequence != 0) { this->m_checks[this->m_list.size()]->SetChecked(1); @@ -1068,7 +1068,7 @@ void UIShowInfoWnd::UpdateChangedStyles() { accessoryChanged[0] = 1; } - g_luaScript->Call("StylingShop_GetSeqnumber_by_goods", "sd>d", "BottomAccessory", this->m_display->unknown_00C4, &sequence); + g_session.m_hotkeyScript->Call("StylingShop_GetSeqnumber_by_goods", "sd>d", "BottomAccessory", this->m_display->unknown_00C4, &sequence); if (!accessoryChanged[1] && this->m_display->unknown_00A4 != *reinterpret_cast(&g_session.unknown_0EF4[0]) && this->m_display->unknown_00A4 != 0 && sequence != 0) { this->m_checks[this->m_list.size()]->SetChecked(1); @@ -1356,7 +1356,7 @@ int UIAccessoryShowCase::SendMsg(UIWindow* sender, int message, std::intptr_t ar bool apply = true; if (g_session.IsDoramJob(g_session.GetDisplayJob()) == true) { - g_luaScript->Call("StylingShop_GetIsDoram_by_goods", "sd>b", table, button->m_itemId, &apply); + g_session.m_hotkeyScript->Call("StylingShop_GetIsDoram_by_goods", "sd>b", table, button->m_itemId, &apply); } if (apply == true) { @@ -1857,41 +1857,41 @@ bool UIShowInfoWnd::SendStyleChange() { if (this->m_checks[index]->geometry.unknown_0030 != 0) { changed = true; int table = 1; - g_luaScript->Call("StylingShop_GetSeqnumber_by_goods", "sd>d", display->GetStyleTable(table).c_str(), display->unknown_0094, &item.value); + g_session.m_hotkeyScript->Call("StylingShop_GetSeqnumber_by_goods", "sd>d", display->GetStyleTable(table).c_str(), display->unknown_0094, &item.value); } } else if (type == 2) { if (this->m_checks[index]->geometry.unknown_0030 != 0) { changed = true; int table = 2; - g_luaScript->Call("StylingShop_GetSeqnumber_by_goods", "sd>d", display->GetStyleTable(table).c_str(), display->unknown_008C, &item.value); + g_session.m_hotkeyScript->Call("StylingShop_GetSeqnumber_by_goods", "sd>d", display->GetStyleTable(table).c_str(), display->unknown_008C, &item.value); item.kind = g_session.IsDoramJob(g_session.GetDisplayJob()) == true ? 6 : 1; } } else if (type == 3) { if (this->m_checks[index]->geometry.unknown_0030 != 0) { changed = true; int table = 3; - g_luaScript->Call("StylingShop_GetSeqnumber_by_goods", "sd>d", display->GetStyleTable(table).c_str(), display->unknown_0098, &item.value); + g_session.m_hotkeyScript->Call("StylingShop_GetSeqnumber_by_goods", "sd>d", display->GetStyleTable(table).c_str(), display->unknown_0098, &item.value); item.kind = g_session.IsDoramJob(g_session.GetDisplayJob()) == true ? 8 : 2; } } else if (type == 4) { if (this->m_checks[index]->geometry.unknown_0030 != 0) { changed = true; int table = 4; - g_luaScript->Call("StylingShop_GetSeqnumber_by_goods", "sd>d", display->GetStyleTable(table).c_str(), display->unknown_00BC, &item.value); + g_session.m_hotkeyScript->Call("StylingShop_GetSeqnumber_by_goods", "sd>d", display->GetStyleTable(table).c_str(), display->unknown_00BC, &item.value); item.kind = 3; } } else if (type == 5) { if (this->m_checks[index]->geometry.unknown_0030 != 0) { changed = true; int table = 5; - g_luaScript->Call("StylingShop_GetSeqnumber_by_goods", "sd>d", display->GetStyleTable(table).c_str(), display->unknown_00C0, &item.value); + g_session.m_hotkeyScript->Call("StylingShop_GetSeqnumber_by_goods", "sd>d", display->GetStyleTable(table).c_str(), display->unknown_00C0, &item.value); item.kind = 4; } } else if (type == 6) { if (this->m_checks[index]->geometry.unknown_0030 != 0) { changed = true; int table = 6; - g_luaScript->Call("StylingShop_GetSeqnumber_by_goods", "sd>d", display->GetStyleTable(table).c_str(), display->unknown_00C4, &item.value); + g_session.m_hotkeyScript->Call("StylingShop_GetSeqnumber_by_goods", "sd>d", display->GetStyleTable(table).c_str(), display->unknown_00C4, &item.value); item.kind = 5; } } else if (type == 7) { @@ -1924,15 +1924,15 @@ void UIAccessoryShowCase::Slot15(int, int) { int skipped = 0; int count = 0; - g_luaScript->Call("StylingShop_GetSizeInTable", "s>d", "TopAccessory", &count); + g_session.m_hotkeyScript->Call("StylingShop_GetSizeInTable", "s>d", "TopAccessory", &count); int slot = 0; this->AddAccessories(loaded, skipped, "TopAccessory", count, slot); - g_luaScript->Call("StylingShop_GetSizeInTable", "s>d", "MidAccessory", &count); + g_session.m_hotkeyScript->Call("StylingShop_GetSizeInTable", "s>d", "MidAccessory", &count); slot = 1; this->AddAccessories(loaded, skipped, "MidAccessory", count, slot); - g_luaScript->Call("StylingShop_GetSizeInTable", "s>d", "BottomAccessory", &count); + g_session.m_hotkeyScript->Call("StylingShop_GetSizeInTable", "s>d", "BottomAccessory", &count); slot = 2; this->AddAccessories(loaded, skipped, "BottomAccessory", count, slot); } @@ -1944,10 +1944,10 @@ void UIAccessoryShowCase::AddAccessories(int& loaded, int& skipped, const char* int order = 1; for (unsigned int index = first + 1; index < static_cast(count + first + 1); ++index, ++order) { int itemId = 0; - g_luaScript->Call("StylingShop_GetGoods", "sd>d", table, order, &itemId); + g_session.m_hotkeyScript->Call("StylingShop_GetGoods", "sd>d", table, order, &itemId); if (g_session.IsDoramJob(g_session.GetDisplayJob()) == true) { bool available = false; - g_luaScript->Call("StylingShop_GetIsDoram_by_goods", "sd>b", table, itemId, &available); + g_session.m_hotkeyScript->Call("StylingShop_GetIsDoram_by_goods", "sd>b", table, itemId, &available); if (!available) { ++skipped; continue; @@ -2039,9 +2039,9 @@ void UIMyStyleWnd::LoadLikeList() { int goods = 0; int count = 0; if (style.topAccNum != 0) { - g_luaScript->Call("StylingShop_GetSizeInTable", "s>d", "TopAccessory", &count); + g_session.m_hotkeyScript->Call("StylingShop_GetSizeInTable", "s>d", "TopAccessory", &count); for (int index = 1; index < count + 1; ++index) { - g_luaScript->Call("StylingShop_GetGoods", "sd>d", "TopAccessory", index, &goods); + g_session.m_hotkeyScript->Call("StylingShop_GetGoods", "sd>d", "TopAccessory", index, &goods); ITEM_DESC description = FindItemDescription(goods); if (style.topAccNum == description.unknown_0040) { display->unknown_00BC = goods; @@ -2050,9 +2050,9 @@ void UIMyStyleWnd::LoadLikeList() { } } if (style.midAccNum != 0) { - g_luaScript->Call("StylingShop_GetSizeInTable", "s>d", "MidAccessory", &count); + g_session.m_hotkeyScript->Call("StylingShop_GetSizeInTable", "s>d", "MidAccessory", &count); for (int index = 1; index < count + 1; ++index) { - g_luaScript->Call("StylingShop_GetGoods", "sd>d", "MidAccessory", index, &goods); + g_session.m_hotkeyScript->Call("StylingShop_GetGoods", "sd>d", "MidAccessory", index, &goods); ITEM_DESC description = FindItemDescription(goods); if (style.midAccNum == description.unknown_0040) { display->unknown_00C0 = goods; @@ -2061,9 +2061,9 @@ void UIMyStyleWnd::LoadLikeList() { } } if (style.bottomAccNum != 0) { - g_luaScript->Call("StylingShop_GetSizeInTable", "s>d", "BottomAccessory", &count); + g_session.m_hotkeyScript->Call("StylingShop_GetSizeInTable", "s>d", "BottomAccessory", &count); for (int index = 1; index < count + 1; ++index) { - g_luaScript->Call("StylingShop_GetGoods", "sd>d", "BottomAccessory", index, &goods); + g_session.m_hotkeyScript->Call("StylingShop_GetGoods", "sd>d", "BottomAccessory", index, &goods); ITEM_DESC description = FindItemDescription(goods); if (style.bottomAccNum == description.unknown_0040) { display->unknown_00C4 = goods; @@ -2387,7 +2387,7 @@ void UIBasicStylingWnd::Slot15(int, int) { int count = 0; const int type = 1; - g_luaScript->Call("StylingShop_GetSizeInTable", "s>d", this->m_display->GetStyleTable(type).c_str(), &count); + g_session.m_hotkeyScript->Call("StylingShop_GetSizeInTable", "s>d", this->m_display->GetStyleTable(type).c_str(), &count); for (int i = 0; i < count; ++i) { char normal[64]; char hover[64]; diff --git a/Source/UI/Text/UIAchWnd.cpp b/Source/UI/Text/UIAchWnd.cpp index 17cebed5..88a86dde 100644 --- a/Source/UI/Text/UIAchWnd.cpp +++ b/Source/UI/Text/UIAchWnd.cpp @@ -1453,7 +1453,7 @@ void UIAchViewWnd::UpdateInfo() { if (this->info->unknown_0054 > 0) { const std::string bitmap = "유저인터페이스\\achievement_re\\reward_buff.bmp"; const char* description = nullptr; - g_luaScript->Call("GetStateIconDescript", "dd>s", this->info->unknown_0054, 1, &description); + g_session.m_hotkeyScript->Call("GetStateIconDescript", "dd>s", this->info->unknown_0054, 1, &description); this->rewards[1]->Set(bitmap.c_str(), description, 0); this->rewards[1]->Show(1); } diff --git a/Source/UI/UICheckAttendanceWnd.cpp b/Source/UI/UICheckAttendanceWnd.cpp index 6bcf5e2f..0c808230 100644 --- a/Source/UI/UICheckAttendanceWnd.cpp +++ b/Source/UI/UICheckAttendanceWnd.cpp @@ -370,7 +370,7 @@ int UICheckAttendanceWnd::SendMsg(UIWindow* sender, int message, std::intptr_t a g_windowMgr.CloseWindow(328); } } else if (message == 34) { - if (g_luaScript->Call("set_checkAttendance_banner", "") == true) { + if (g_session.m_hotkeyScript->Call("set_checkAttendance_banner", "") == true) { this->m_banner->CreateButtons(); } if (this->m_banner->m_entries.size() == 0) { diff --git a/Source/UI/UIHotkeyGuideWnd.cpp b/Source/UI/UIHotkeyGuideWnd.cpp index e84ba6c7..0a9bbd2e 100644 --- a/Source/UI/UIHotkeyGuideWnd.cpp +++ b/Source/UI/UIHotkeyGuideWnd.cpp @@ -1,4 +1,5 @@ #include "Script/LuaScript.h" +#include "Client/Session.h" #include "UI/Window/UIWindowMgr.h" #include "UI/UIHotkeyGuideWnd.h" @@ -167,7 +168,7 @@ void UIHotkeyGuideWnd::Slot15(int, int) { int messages[18] = {105, 104, 283, 106, 103, 3134, 1317, 2859, 2353, 265, 3135, 2350, 3136, 2646, 3225, 3137, 574, 3138}; int hotkeys[18] = {47, 1, 2, 9, 5, 10, 3, 8, 42, -1, 46, 38, 51, 49, 6, 37, 17, 12}; for (int i = 0; i < 18; ++i) { - HotkeyInfo hotkey = GetHotkeyInfo(*g_luaScript, 1, hotkeys[i]); + HotkeyInfo hotkey = GetHotkeyInfo(*g_session.m_hotkeyScript, 1, hotkeys[i]); if (messages[i] == 265) { this->m_entries.push_back(HotkeyGuideEntry(messages[i], 27, 0)); } else { diff --git a/Source/UI/UILapineBoxWnd.cpp b/Source/UI/UILapineBoxWnd.cpp index 676c332a..b895f61d 100644 --- a/Source/UI/UILapineBoxWnd.cpp +++ b/Source/UI/UILapineBoxWnd.cpp @@ -533,22 +533,22 @@ void UILapineBoxWnd::SetIngredient(int id) { this->title.assign(name, std::strlen(name)); } - g_luaScript->CallTable("tblLapineDdukddakBox", "set_resource_item_list", "d", id); + g_session.m_hotkeyScript->CallTable("tblLapineDdukddakBox", "set_resource_item_list", "d", id); int minRefine = 0; - g_luaScript->CallTable("tblLapineDdukddakBox", "get_min_need_refine", "d>d", id, &minRefine); + g_session.m_hotkeyScript->CallTable("tblLapineDdukddakBox", "get_min_need_refine", "d>d", id, &minRefine); this->ingredientList->minRefine = minRefine; int maxRefine = 0; - g_luaScript->CallTable("tblLapineDdukddakBox", "get_max_need_refine", "d>d", id, &maxRefine); + g_session.m_hotkeyScript->CallTable("tblLapineDdukddakBox", "get_max_need_refine", "d>d", id, &maxRefine); this->ingredientList->maxRefine = maxRefine; this->ingredientList->SendMsg(this, 0x17, 0, 0, 0, 0); - g_luaScript->CallTable("tblLapineDdukddakBox", "get_need_item_count", "d>d", id, &this->maxItems); + g_session.m_hotkeyScript->CallTable("tblLapineDdukddakBox", "get_need_item_count", "d>d", id, &this->maxItems); const char* source = nullptr; - g_luaScript->CallTable("tblLapineDdukddakBox", "get_need_source_string", "d>s", id, &source); + g_session.m_hotkeyScript->CallTable("tblLapineDdukddakBox", "get_need_source_string", "d>s", id, &source); this->description.assign(source, std::strlen(source)); } diff --git a/Source/UI/UILapineUpgradeBoxWnd.cpp b/Source/UI/UILapineUpgradeBoxWnd.cpp index 99f7118d..e55f05f3 100644 --- a/Source/UI/UILapineUpgradeBoxWnd.cpp +++ b/Source/UI/UILapineUpgradeBoxWnd.cpp @@ -292,17 +292,17 @@ void UILapineUpgradeBoxWnd::SetIngredient(int id) { int minimumRefine = 0; int maximumRefine = 0; - g_luaScript->CallTable("tblLapineUpgradeBox", "get_min_need_refine", "d>d", id, &minimumRefine); + g_session.m_hotkeyScript->CallTable("tblLapineUpgradeBox", "get_min_need_refine", "d>d", id, &minimumRefine); this->ingredientList->minRefine = minimumRefine; - g_luaScript->CallTable("tblLapineUpgradeBox", "get_max_need_refine", "d>d", id, &maximumRefine); + g_session.m_hotkeyScript->CallTable("tblLapineUpgradeBox", "get_max_need_refine", "d>d", id, &maximumRefine); this->ingredientList->maxRefine = maximumRefine; - g_luaScript->CallTable("tblLapineUpgradeBox", "get_min_need_option", "d>d", id, &this->minOptionCount); + g_session.m_hotkeyScript->CallTable("tblLapineUpgradeBox", "get_min_need_option", "d>d", id, &this->minOptionCount); this->ingredientList->minOptionCount = this->minOptionCount; - g_luaScript->CallTable("tblLapineUpgradeBox", "set_resource_item_list", "d", id); + g_session.m_hotkeyScript->CallTable("tblLapineUpgradeBox", "set_resource_item_list", "d", id); this->ingredientList->SendMsg(this, 0x17, 0, 0, 0, 0); const char* source = nullptr; - g_luaScript->CallTable("tblLapineUpgradeBox", "get_need_source_string", "d>s", id, &source); + g_session.m_hotkeyScript->CallTable("tblLapineUpgradeBox", "get_need_source_string", "d>s", id, &source); this->description.assign(source, std::strlen(source)); } diff --git a/Source/UI/Window/FuncDrawWNDChar.cpp b/Source/UI/Window/FuncDrawWNDChar.cpp index 9ee1cf5e..3dd05035 100644 --- a/Source/UI/Window/FuncDrawWNDChar.cpp +++ b/Source/UI/Window/FuncDrawWNDChar.cpp @@ -28,7 +28,7 @@ FuncDrawWNDChar::FuncDrawWNDChar( m_topAccessory(topAccessory), m_midAccessory(midAccessory), m_robe(robe), m_flags(flags), m_shield(shield), m_bodyStyle(bodyStyle), m_headPalette(headPalette), m_action(action), m_motion(motion), m_time(time), m_helmRobe(false), m_drawOnTop(false), m_resources(), unknown_0050(), unknown_0068(), m_layers(), unknown_0088(0), unknown_008C(0), unknown_0090(0), unknown_0094(0) { - g_luaScript->CallTable(std::string("TB_Layer_Priority", 17), std::string("IsHelmRobe", 10), "d>b", this->m_robe, &this->m_helmRobe); + g_session.m_hotkeyScript->CallTable(std::string("TB_Layer_Priority", 17), std::string("IsHelmRobe", 10), "d>b", this->m_robe, &this->m_helmRobe); this->m_drawOnTop = this->DrawOnTop(); this->m_layers[5] = this->m_bottomAccessory; this->m_layers[4] = this->m_topAccessory; @@ -77,7 +77,7 @@ void FuncDrawWNDChar::Draw(bool option) { direction = 0; } - g_luaScript->Call("OffsetItemPos_GetOffsetForDoram", "ddd>dd", this->m_layers[key], direction, g_session.SyncUnknown0E98(), &x, &y); + g_session.m_hotkeyScript->Call("OffsetItemPos_GetOffsetForDoram", "ddd>dd", this->m_layers[key], direction, g_session.SyncUnknown0E98(), &x, &y); offset.x = x; offset.y = y; } diff --git a/Source/UI/Window/UIControl.cpp b/Source/UI/Window/UIControl.cpp index 25a2e788..8bbd09a9 100644 --- a/Source/UI/Window/UIControl.cpp +++ b/Source/UI/Window/UIControl.cpp @@ -1,4 +1,5 @@ #include "Client/Mode/CMode.h" +#include "Client/Session.h" #include "UI/Window/UIControl.h" #include "UI/Buttons/UIRadioButton.h" #include "UI/Buttons/UITextButton.h" @@ -1370,7 +1371,7 @@ void CUITitleBar::SetSecondButton(CUIButton* button) { this->AddChild(button); const char* behavior = nullptr; - if (g_luaScript->Call("GetBeHaviorOfWindow", "d>s", this->parent->geometry.id, &behavior) && behavior) { + if (g_session.m_hotkeyScript->Call("GetBeHaviorOfWindow", "d>s", this->parent->geometry.id, &behavior) && behavior) { const std::string text = behavior; static_cast(this->secondButton)->tooltip = text; } diff --git a/Source/UI/Window/UIHotKeyWnd.cpp b/Source/UI/Window/UIHotKeyWnd.cpp index 04daa628..575f8e88 100644 --- a/Source/UI/Window/UIHotKeyWnd.cpp +++ b/Source/UI/Window/UIHotKeyWnd.cpp @@ -200,7 +200,7 @@ void UIHotKeyWnd::SetHotkey(int tab, int index, HotkeyInfo info) { void UIHotKeyWnd::SaveHotkeys() { for (int tab = 0; tab < 4; ++tab) { for (const auto& entry : this->hotkeys[tab]) { - g_luaScript->Call("ChangeUserHotKey", "ddsdd", tab + 1, entry.first, entry.second.description.c_str(), entry.second.key1, entry.second.key2); + g_session.m_hotkeyScript->Call("ChangeUserHotKey", "ddsdd", tab + 1, entry.first, entry.second.description.c_str(), entry.second.key1, entry.second.key2); if (tab == 1) { g_windowMgr.sub_AAB0B0(); } @@ -210,7 +210,7 @@ void UIHotKeyWnd::SaveHotkeys() { std::string path = "SaveData\\UserKeys"; path = path + ".lua"; if (!path.empty()) { - g_luaScript->Call("SaveUserHotKeys2", "s", path.c_str()); + g_session.m_hotkeyScript->Call("SaveUserHotKeys2", "s", path.c_str()); char message[500]; std::memset(message, 0, sizeof(message)); StringFormat(message, sizeof(message), static_cast(-1), "%s", LookupMessage(3572)); @@ -340,14 +340,14 @@ void UIHotKeyWnd::Slot25(int x, int y) { // FUNCTION: fn_12617 UIHotKeyWnd::HotkeyEntry UIHotKeyWnd::GetHotkey(int tab, int index, bool resolve) { HotkeyEntry entry; - entry.index = resolve ? MapHotkeyIndex(*g_luaScript, tab, index) : index; + entry.index = resolve ? MapHotkeyIndex(*g_session.m_hotkeyScript, tab, index) : index; if (entry.index != -1) { const auto it = this->hotkeys[tab].find(entry.index); if (it != this->hotkeys[tab].end() && !it->second.description.empty()) { entry.info = it->second; } else { - entry.info = GetHotkeyInfo(*g_luaScript, tab, entry.index); + entry.info = GetHotkeyInfo(*g_session.m_hotkeyScript, tab, entry.index); } } @@ -429,7 +429,7 @@ void UIHotKeyWnd::Paint() { this->unknown_00C0 = this->DrawButtonBar(2, 0, 1); this->DrawPanelBackground(this->unknown_00BC, 0, ""); - const int count = CountHotkeys(*g_luaScript, this->m_tab); + const int count = CountHotkeys(*g_session.m_hotkeyScript, this->m_tab); int visibleRow = 0; for (int row = 0; row < count; ++row) { @@ -562,9 +562,9 @@ void UIHotKeyWnd::ReloadHotkeys() { for (int position = 0; position < 4; ++position) { const int tab = g_userHotkeyMgr->TabAt(position); - const int count = CountAllHotkeys(reinterpret_cast(g_session), tab); + const int count = CountAllHotkeys(*g_session.m_hotkeyScript, tab); for (int row = 0; row < count; ++row) { - const int index = ResolveHotkeyIndex(reinterpret_cast(g_session), tab, row); + const int index = ResolveHotkeyIndex(*g_session.m_hotkeyScript, tab, row); if (index == -1) { continue; } @@ -575,7 +575,7 @@ void UIHotKeyWnd::ReloadHotkeys() { int key2 = 0; const char* textValue = nullptr; const char* descriptionValue = nullptr; - if (!g_luaScript->Call("GetUserHotKeyInfo", "dd>ddss", tab + 1, index, &key1, &key2, &textValue, &descriptionValue)) { + if (!g_session.m_hotkeyScript->Call("GetUserHotKeyInfo", "dd>ddss", tab + 1, index, &key1, &key2, &textValue, &descriptionValue)) { continue; } @@ -584,7 +584,7 @@ void UIHotKeyWnd::ReloadHotkeys() { continue; } - if (!g_luaScript->Call("GetOriginalHotKeyInfo", "dd>ddss", tab + 1, index, &key1, &key2, &textValue, &descriptionValue)) { + if (!g_session.m_hotkeyScript->Call("GetOriginalHotKeyInfo", "dd>ddss", tab + 1, index, &key1, &key2, &textValue, &descriptionValue)) { continue; } @@ -626,7 +626,7 @@ bool UIHotKeyWnd::AssignSelectedHotkey(int mode) { int rejection = 0; bool checkConflict = false; - if (this->m_tab == 1 && ResolveHotkeyIndex(reinterpret_cast(g_session), 1, this->m_selectedRow) == 31) { + if (this->m_tab == 1 && ResolveHotkeyIndex(*g_session.m_hotkeyScript, 1, this->m_selectedRow) == 31) { const int key = g_windowMgr.keyCode; const int modifier = g_windowMgr.modifierKey; if (key == 0x12 || modifier == 0x12 || key == 0x11 || modifier == 0x11 || key == 0x10 || modifier == 0x10) { @@ -677,7 +677,7 @@ bool UIHotKeyWnd::AssignSelectedHotkey(int mode) { info.key1 = g_windowMgr.keyCode; info.key2 = g_windowMgr.modifierKey; const char* text = nullptr; - if (g_luaScript->Call("GetKeyDes", "dd>s", g_windowMgr.keyCode, g_windowMgr.modifierKey, &text) && text) { + if (g_session.m_hotkeyScript->Call("GetKeyDes", "dd>s", g_windowMgr.keyCode, g_windowMgr.modifierKey, &text) && text) { info.text = text; } } @@ -706,7 +706,7 @@ int UIHotKeyWnd::CheckHotkeyConflict() { continue; } - const int count = CountAllHotkeys(reinterpret_cast(g_session), tab); + const int count = CountAllHotkeys(*g_session.m_hotkeyScript, tab); for (int index = 0; index < count; ++index) { const HotkeyEntry entry = this->GetHotkey(tab, index, true); HotkeyInfo info = entry.info; @@ -729,7 +729,7 @@ int UIHotKeyWnd::CheckHotkeyConflict() { this->SetHotkey(tab, entry.index, info); if (tab == 0 && this->m_tab != 0) { - const int shortcutCount = CountAllHotkeys(reinterpret_cast(g_session), 3); + const int shortcutCount = CountAllHotkeys(*g_session.m_hotkeyScript, 3); for (int shortcut = 0; shortcut < shortcutCount; ++shortcut) { const HotkeyEntry other = this->GetHotkey(3, shortcut, true); HotkeyInfo otherInfo = other.info; @@ -827,7 +827,7 @@ int UIHotKeyWnd::SendMsg( this->unknown_0114 = 0; this->m_page = 1; - const int count = CountAllHotkeys(reinterpret_cast(g_session), tab); + const int count = CountAllHotkeys(*g_session.m_hotkeyScript, tab); if (count > 36) { this->unknown_0114 = 1; this->m_pageCount = count / 36; diff --git a/Source/UI/Window/UIMessageBox.cpp b/Source/UI/Window/UIMessageBox.cpp index 33649994..6fc1c0af 100644 --- a/Source/UI/Window/UIMessageBox.cpp +++ b/Source/UI/Window/UIMessageBox.cpp @@ -3951,12 +3951,12 @@ void UIReplayControlWnd::Slot15(int, int) { this->AddChild(this->m_pauseButton); HotkeyInfo hotkey; - hotkey = GetHotkeyInfo(reinterpret_cast(g_session), 1, 39); + hotkey = GetHotkeyInfo(*g_session.m_hotkeyScript, 1, 39); this->m_playButton->SetTooltip(hotkey.text.c_str()); this->m_pauseButton->SetTooltip(hotkey.text.c_str()); - hotkey = GetHotkeyInfo(reinterpret_cast(g_session), 1, 40); + hotkey = GetHotkeyInfo(*g_session.m_hotkeyScript, 1, 40); static_cast(this->m_buttons[2])->SetTooltip(hotkey.text.c_str()); - hotkey = GetHotkeyInfo(reinterpret_cast(g_session), 1, 41); + hotkey = GetHotkeyInfo(*g_session.m_hotkeyScript, 1, 41); static_cast(this->m_buttons[3])->SetTooltip(hotkey.text.c_str()); this->m_progress = new UIBarGraph4(); diff --git a/Source/UI/Window/UINewSkillListWnd.cpp b/Source/UI/Window/UINewSkillListWnd.cpp index 50ef2c88..3ef2932a 100644 --- a/Source/UI/Window/UINewSkillListWnd.cpp +++ b/Source/UI/Window/UINewSkillListWnd.cpp @@ -227,7 +227,7 @@ void UINewSkillListWnd::sub_9AE930() { } int x = 0; int y = 0; - g_luaScript->Call("OffsetItemPos_GetOffsetForDoram", "ddd>dd", view, 23, g_session.SyncUnknown0E98(), &x, &y); + g_session.m_hotkeyScript->Call("OffsetItemPos_GetOffsetForDoram", "ddd>dd", view, 23, g_session.SyncUnknown0E98(), &x, &y); offsetX = x; offsetY = y; } @@ -502,7 +502,7 @@ void UINewSkillListWnd::InitTabs() { const char* defaultTabs[4] = {}; const char* jobTabs[4] = {}; - g_luaScript->Call(func, "d>ssss", 0, &defaultTabs[0], &defaultTabs[1], &defaultTabs[2], &defaultTabs[3]); + g_session.m_hotkeyScript->Call(func, "d>ssss", 0, &defaultTabs[0], &defaultTabs[1], &defaultTabs[2], &defaultTabs[3]); const unsigned baseJob = JobNames::BaseJob(g_session.GetDisplayJob()); int jobKey = baseJob; @@ -717,7 +717,7 @@ void UINewSkillListWnd::InitTabs() { break; } - g_luaScript->Call(func, "d>ssss", jobKey, &jobTabs[0], &jobTabs[1], &jobTabs[2], &jobTabs[3]); + g_session.m_hotkeyScript->Call(func, "d>ssss", jobKey, &jobTabs[0], &jobTabs[1], &jobTabs[2], &jobTabs[3]); for (size_t i = this->m_tabs->labels.size(); i < 4; ++i) { if (g_session.m_skillBundle.GroupSize(i) > 0) { @@ -1040,7 +1040,7 @@ void UINewSkillListWnd::Slot28(int x, int y) { int tooltipX = -10; int tooltipY = -20; this->ToScreen(tooltipX, tooltipY); - const char* name = skill.first->DisplayName(*g_luaScript); + const char* name = skill.first->DisplayName(*g_session.m_hotkeyScript); g_modeMgr.gameMode->ShowTooltip(name, tooltipX + x, tooltipY + y, -1, 0, 1); } } @@ -1254,7 +1254,7 @@ void UINewSkillListWnd::LayoutButtons() { for (const CSkillInfo& skill : list) { const unsigned int slot = skill.unknown_0024 - this->m_columns * this->m_firstRow; if (slot < 42 && skill.available != 0 && skill.unknown_0024 != 0xFFFFFFFF && skill.level != 0 && - CSkillInfo::UsesLevel(*g_luaScript, skill.id)) { + CSkillInfo::UsesLevel(*g_session.m_hotkeyScript, skill.id)) { const int y = static_cast(slot) / this->m_columns * 56 + 70; const int x = static_cast(slot) % this->m_columns * 68; this->m_btnSkillUps[slot]->Move(x + 111, y); @@ -1274,7 +1274,7 @@ void UINewSkillListWnd::LayoutButtons() { this->m_btnLevelUp[row]->Move(78, y - 14); } if (!this->m_locked && row < this->m_visibleRows && static_cast(this->m_firstRow + row) < list.size() && - skill.available != 0 && skill.level != 0 && CSkillInfo::UsesLevel(*g_luaScript, skill.id)) { + skill.available != 0 && skill.level != 0 && CSkillInfo::UsesLevel(*g_session.m_hotkeyScript, skill.id)) { this->m_btnSkills[row]->Move(112, y); this->m_btnSkillUps[row]->Move(192, y); } @@ -1550,7 +1550,7 @@ bool UINewSkillListWnd::sub_9B3EB0(int skillId) { } if (static_cast(info->unknown_002C) <= 0) { - const char* name = info->DisplayName(*g_luaScript); + const char* name = info->DisplayName(*g_session.m_hotkeyScript); g_windowMgr.SendNotice(1, reinterpret_cast(FormatString(LookupMessage(0xDCB), name)), 0xFF, 0, 0, 0); return false; } diff --git a/Source/UI/Window/UIPartyBookingHelpWnd.cpp b/Source/UI/Window/UIPartyBookingHelpWnd.cpp index 0399c2df..6816e417 100644 --- a/Source/UI/Window/UIPartyBookingHelpWnd.cpp +++ b/Source/UI/Window/UIPartyBookingHelpWnd.cpp @@ -1,4 +1,5 @@ #include "UI/Window/UIPartyBookingHelpWnd.h" +#include "Client/Session.h" #include "Client/Input/InputCharset.h" #include "Contents/MessageTable.h" @@ -22,7 +23,7 @@ void UIPartyBookingHelpWnd::Slot15(int width, int height) { std::string help; const char* result = nullptr; - if (g_luaScript->Call("GetPartyBookingHelp", "d>s", -1, &result)) { + if (g_session.m_hotkeyScript->Call("GetPartyBookingHelp", "d>s", -1, &result)) { help = result; if (help.size()) { char* text = new char[help.size() + 4]; diff --git a/Source/UI/Window/UIRoMapWnd.cpp b/Source/UI/Window/UIRoMapWnd.cpp index 05c410f5..6a17761f 100644 --- a/Source/UI/Window/UIRoMapWnd.cpp +++ b/Source/UI/Window/UIRoMapWnd.cpp @@ -675,8 +675,8 @@ void UIRoMapWnd::DrawMapMarker(const RoMapMarker& marker, unsigned char skipSele // OFFSET: 0x009119B0 // FUNCTION: fn_12522 UIRoMapWnd::UIRoMapWnd() : UIFrameWnd(0), unknown_00D0(0) { - g_luaScript->Call("ReadKafraMoveMapServiceInfo", ""); - g_luaScript->Call("ReadKafraMiniMapPosInfo", ""); + g_session.m_hotkeyScript->Call("ReadKafraMoveMapServiceInfo", ""); + g_session.m_hotkeyScript->Call("ReadKafraMiniMapPosInfo", ""); this->unknown_01FC.clear(); this->ClearRecords(); this->m_showLabels = 0; diff --git a/Source/UI/Window/UISecondCostumeWnd.cpp b/Source/UI/Window/UISecondCostumeWnd.cpp index 062311e6..4a66570b 100644 --- a/Source/UI/Window/UISecondCostumeWnd.cpp +++ b/Source/UI/Window/UISecondCostumeWnd.cpp @@ -65,7 +65,7 @@ void UISecondCostumeWnd::LoadLists() { for (int index = 1;; ++index) { const char* name = nullptr; int value = 0; - g_luaScript->Call("_get_DressHeadPaletteList", "dd>sd", sex, index, &name, &value); + g_session.m_hotkeyScript->Call("_get_DressHeadPaletteList", "dd>sd", sex, index, &name, &value); if (name == nullptr) { break; } @@ -79,7 +79,7 @@ void UISecondCostumeWnd::LoadLists() { for (int index = 1;; ++index) { const char* name = nullptr; int value = 0; - g_luaScript->Call("_get_Headstylelist", "dd>sd", sex, index, &name, &value); + g_session.m_hotkeyScript->Call("_get_Headstylelist", "dd>sd", sex, index, &name, &value); if (name == nullptr) { break; } @@ -93,7 +93,7 @@ void UISecondCostumeWnd::LoadLists() { for (int index = 1;; ++index) { const char* name = nullptr; int value = 0; - g_luaScript->Call("_get_DressBodyPaletteList", "dd>sd", sex, index, &name, &value); + g_session.m_hotkeyScript->Call("_get_DressBodyPaletteList", "dd>sd", sex, index, &name, &value); if (name == nullptr) { break; } @@ -107,7 +107,7 @@ void UISecondCostumeWnd::LoadLists() { for (int index = 1;; ++index) { const char* name = nullptr; int value = 0; - g_luaScript->Call("_get_dresslist", "ddd>sd", sex, job, index, &name, &value); + g_session.m_hotkeyScript->Call("_get_dresslist", "ddd>sd", sex, job, index, &name, &value); if (name == nullptr) { break; } diff --git a/Source/UI/Window/UISeekPartyListWnd.cpp b/Source/UI/Window/UISeekPartyListWnd.cpp index 81b7ed0b..c5525590 100644 --- a/Source/UI/Window/UISeekPartyListWnd.cpp +++ b/Source/UI/Window/UISeekPartyListWnd.cpp @@ -586,14 +586,14 @@ void UISeekPartyListWnd::UpdateScrollBar() { // OFFSET: 0x00943F40 // FUNCTION: fn_12830 void UISeekPartyListWnd::InitRegionFilter() { - g_luaScript->HasTable("map_list"); + g_session.m_hotkeyScript->HasTable("map_list"); std::string regionName; int region = 1; for (;; ++region) { int id = 0; const char* name = nullptr; - if (g_luaScript->Call("queryRegionInfo", "d>ds", region, &id, &name)) { + if (g_session.m_hotkeyScript->Call("queryRegionInfo", "d>ds", region, &id, &name)) { if (!name) { break; } @@ -602,7 +602,7 @@ void UISeekPartyListWnd::InitRegionFilter() { } } - g_luaScript->HasTable("map_list"); + g_session.m_hotkeyScript->HasTable("map_list"); for (int current = 1; current < region; ++current) { std::vector maps; int x = 0; @@ -612,7 +612,7 @@ void UISeekPartyListWnd::InitRegionFilter() { int green = 0; int blue = 0; for (int index = 1;; ++index) { - if (g_luaScript->Call("queryMapInfo", "dd>ddsddd", current, index, &x, &y, &name, &red, &green, &blue)) { + if (g_session.m_hotkeyScript->Call("queryMapInfo", "dd>ddsddd", current, index, &x, &y, &name, &red, &green, &blue)) { if (!name) { break; } diff --git a/Source/UI/Window/UISeekPartyMBWnd.cpp b/Source/UI/Window/UISeekPartyMBWnd.cpp index b28372d8..498cec3c 100644 --- a/Source/UI/Window/UISeekPartyMBWnd.cpp +++ b/Source/UI/Window/UISeekPartyMBWnd.cpp @@ -1,4 +1,5 @@ #include "UI/Window/UISeekPartyMBWnd.h" +#include "Client/Session.h" #include "Contents/MessageTable.h" #include "Contents/UserData/NormalItemSlots.h" #include "Network/Connection/Connection.h" @@ -384,14 +385,14 @@ void UISeekPartyMBWnd::Slot15(int width, int height) { // OFFSET: 0x009458B0 // FUNCTION: fn_12835 void UISeekPartyMBWnd::LoadRegionMaps() { - g_luaScript->HasTable("map_list"); + g_session.m_hotkeyScript->HasTable("map_list"); std::string unused; int regionCount = 2; for (;; ++regionCount) { int regionId = 0; const char* regionName = nullptr; - if (g_luaScript->Call("queryRegionInfo", "d>ds", regionCount, ®ionId, ®ionName)) { + if (g_session.m_hotkeyScript->Call("queryRegionInfo", "d>ds", regionCount, ®ionId, ®ionName)) { if (!regionName) { break; } @@ -399,7 +400,7 @@ void UISeekPartyMBWnd::LoadRegionMaps() { } } - g_luaScript->HasTable("map_list"); + g_session.m_hotkeyScript->HasTable("map_list"); for (int region = 2; region < regionCount; ++region) { std::vector> maps; for (int index = 1;; ++index) { @@ -409,7 +410,7 @@ void UISeekPartyMBWnd::LoadRegionMaps() { int red = 0; int green = 0; int blue = 0; - if (g_luaScript->Call("queryMapInfo", "dd>ddsddd", region, index, &mapId, &level, &mapName, &red, &green, &blue)) { + if (g_session.m_hotkeyScript->Call("queryMapInfo", "dd>ddsddd", region, index, &mapId, &level, &mapName, &red, &green, &blue)) { if (!mapName) { break; } diff --git a/Source/UI/Window/UIWindowFactory.cpp b/Source/UI/Window/UIWindowFactory.cpp index 89e36835..7bdb80b9 100644 --- a/Source/UI/Window/UIWindowFactory.cpp +++ b/Source/UI/Window/UIWindowFactory.cpp @@ -22,7 +22,7 @@ UIWindow* UIWindowMgr::CreateLayoutWindow(int id) { int height = 0; int x = 0; int y = 0; - if (!g_luaScript->Call("GetWindowInfo", "d>dddd", id, &width, &height, &x, &y)) { + if (!g_session.m_hotkeyScript->Call("GetWindowInfo", "d>dddd", id, &width, &height, &x, &y)) { return nullptr; }