Decompile 10 functions in Source/Client/Application/Launcher.cpp, Source/Contents/Actors/MercenaryAI.cpp, ...

Batch #16897 by KWDev: 10 byte-identical, 0 confirmed by peer review.

- fn_24361 StartClientProcess: byte-identical
- fn_22336 AiMercenaryAttack: byte-identical
- fn_22345 AiMoveToOwner: byte-identical
- fn_22346 AiSkillGround: byte-identical
- fn_22347 AiSkillObject: byte-identical
- fn_07093 CPowderingEffect::IsAlive: byte-identical
- fn_18033 GuildInfo::RemoveAgitId: byte-identical
- fn_06537 NEO_PACKAGEITEM::CPaidPackageItemMgr::LoadScript: byte-identical
- fn_04447 CSelectPackageItemMgr::LoadScript: byte-identical
- fn_09082 CSimpleStringMgr::AddString: byte-identical

Merged automatically: every function is byte-identical to the original.
This commit is contained in:
ragnarok-clanker 2026-11-11 11:00:36 +00:00
commit 651bb29657
7 changed files with 47 additions and 38 deletions

View file

@ -833,9 +833,9 @@ HANDLE StartClientProcess(char* program) {
STARTUPINFOA startup = {};
startup.cb = sizeof(startup);
PROCESS_INFORMATION process = {};
startup.dwFlags = STARTF_USESHOWWINDOW;
startup.wShowWindow = SW_SHOWNORMAL;
PROCESS_INFORMATION process = {};
CreateProcessA(nullptr, commandLine, nullptr, nullptr, FALSE, 0, nullptr, nullptr, &startup, &process);
return process.hProcess;

View file

@ -305,8 +305,8 @@ int AiHomunAttack(lua_State* state) {
// OFFSET: 0x00D9ECA0
// FUNCTION: fn_22336
int AiMercenaryAttack(lua_State* state) {
std::uint32_t aid = static_cast<std::uint32_t>(lua_tonumber(state, 1));
std::uint32_t target = static_cast<std::uint32_t>(lua_tonumber(state, 2));
std::uint32_t aid = static_cast<std::uint32_t>(luaL_checknumber(state, 1));
std::uint32_t target = static_cast<std::uint32_t>(luaL_checknumber(state, 2));
if (!g_session.IsMercenaryAid(aid)) {
return 0;
}
@ -1067,13 +1067,13 @@ int AiMove(lua_State* state) {
// OFFSET: 0x00DA0260
// FUNCTION: fn_22345
int AiMoveToOwner(lua_State* state) {
std::uint32_t aid = static_cast<std::uint32_t>(lua_tonumber(state, 1));
std::uint32_t aid = static_cast<std::uint32_t>(luaL_checknumber(state, 1));
if (!g_session.IsHomunAid(aid) && !g_session.IsMercenaryAid(aid)) {
return 0;
}
MoveToOwnerPacket packet;
if (static_cast<CGameMode*>(g_modeMgr.GetGameMode())->scene->GetGameActorByAID(aid)) {
MoveToOwnerPacket packet;
packet.opcode = ID_CZ_REQUEST_MOVETOOWNER;
packet.aid = aid;
GetRagConnection().Send(reinterpret_cast<PacketLengths&>(GetRagConnection()).FixedLength(packet.opcode), &packet);
@ -1085,12 +1085,12 @@ int AiMoveToOwner(lua_State* state) {
// OFFSET: 0x00DA0300
// FUNCTION: fn_22346
int AiSkillGround(lua_State* state) {
std::uint32_t aid = static_cast<std::uint32_t>(lua_tonumber(state, 1));
std::uint32_t aid = static_cast<std::uint32_t>(luaL_checknumber(state, 1));
int skillArgs[4];
skillArgs[0] = static_cast<int>(lua_tonumber(state, 3));
skillArgs[1] = static_cast<int>(lua_tonumber(state, 4));
skillArgs[2] = static_cast<int>(lua_tonumber(state, 5));
skillArgs[3] = static_cast<int>(lua_tonumber(state, 2));
skillArgs[0] = static_cast<int>(luaL_checknumber(state, 3));
skillArgs[1] = static_cast<int>(luaL_checknumber(state, 4));
skillArgs[2] = static_cast<int>(luaL_checknumber(state, 5));
skillArgs[3] = static_cast<int>(luaL_checknumber(state, 2));
if (!g_session.IsHomunAid(aid) && !g_session.IsMercenaryAid(aid)) {
return 0;
@ -1111,10 +1111,10 @@ int AiSkillGround(lua_State* state) {
// OFFSET: 0x00DA0420
// FUNCTION: fn_22347
int AiSkillObject(lua_State* state) {
std::uint32_t aid = static_cast<std::uint32_t>(lua_tonumber(state, 1));
unsigned int level = static_cast<unsigned int>(lua_tonumber(state, 2));
std::uint32_t skillId = static_cast<std::uint32_t>(lua_tonumber(state, 3));
std::uint32_t target = static_cast<std::uint32_t>(lua_tonumber(state, 4));
std::uint32_t aid = static_cast<std::uint32_t>(luaL_checknumber(state, 1));
unsigned int level = static_cast<unsigned int>(luaL_checknumber(state, 2));
std::uint32_t skillId = static_cast<std::uint32_t>(luaL_checknumber(state, 3));
std::uint32_t target = static_cast<std::uint32_t>(luaL_checknumber(state, 4));
CSkillInfo skill = g_session.LookupSkill(skillId);
if (!skill.available) {

View file

@ -171,14 +171,14 @@ void CPowderingEffect::InitSmokeParticle(CParticle* particle) {
// OFFSET: 0x007097B0
// FUNCTION: fn_07093
bool CPowderingEffect::IsAlive() {
for (CParticle* particle : this->smokeParticles) {
if (particle->animationState != 2) {
for (auto it = this->smokeParticles.begin(); it != this->smokeParticles.end(); ++it) {
if ((*it)->animationState != 2) {
return true;
}
}
for (CParticle* particle : this->spriteParticles) {
if (particle->animationState != 2) {
for (auto it = this->spriteParticles.begin(); it != this->spriteParticles.end(); ++it) {
if ((*it)->animationState != 2) {
return true;
}
}

View file

@ -53,7 +53,12 @@ void GuildInfo::ClearMembers() {
// OFFSET: 0x00AE4270
// FUNCTION: fn_18033
void GuildInfo::RemoveAgitId(int value) {
auto it = std::find(this->agitIds.begin(), this->agitIds.end(), value);
auto it = this->agitIds.begin();
for (; it != this->agitIds.end(); ++it) {
if (value == *it) {
break;
}
}
if (it != this->agitIds.end()) {
this->agitIds.erase(it);
}

View file

@ -223,15 +223,17 @@ void CPaidPackageItemMgr::AddItem(int itemId) {
bool CPaidPackageItemMgr::LoadScript() {
CLuaInstance script;
script.SetGlobal("C_AddItemSold", CPaidPackageItemMgr::LuaAddItemSold);
if (script.LoadFile("LuaFiles514\\Lua Files\\ProbabilityInfo\\SimpleCashShopScript.lub") == true) {
lua_State* state = script.GetState();
if (state) {
lua_getfield(state, LUA_GLOBALSINDEX, "LoadItemSoldTbl");
if (lua_pcall(state, 0, 0, 0) != 0) {
MessageBoxA(nullptr, lua_tolstring(state, -1, nullptr), "CPaidItemMgr", 0);
} else {
return true;
}
if (script.LoadFile("LuaFiles514\\Lua Files\\ProbabilityInfo\\SimpleCashShopScript.lub") == false) {
return false;
}
lua_State* state = script.GetState();
if (state) {
lua_getfield(state, LUA_GLOBALSINDEX, "LoadItemSoldTbl");
if (lua_pcall(state, 0, 0, 0) != 0) {
MessageBoxA(nullptr, lua_tolstring(state, -1, nullptr), "CPaidItemMgr", 0);
} else {
return true;
}
}

View file

@ -56,15 +56,17 @@ bool CSelectPackageItemMgr::LoadScript() {
CLuaInstance script;
script.SetGlobal("AddTab", CSelectPackageItemMgr::LuaAddTab);
script.SetGlobal("AddItem", CSelectPackageItemMgr::LuaAddItem);
if (script.LoadFile("LuaFiles514\\Lua Files\\SelectPackage\\SelectPackageItem_Cln.lub") == true) {
lua_State* state = script.GetState();
if (state) {
lua_getfield(state, LUA_GLOBALSINDEX, "LoadTable");
if (lua_pcall(state, 0, 0, 0) != 0) {
MessageBoxA(nullptr, lua_tolstring(state, -1, nullptr), "CSelectPackageItemMgr", 0);
} else {
lua_settop(state, -2);
}
if (script.LoadFile("LuaFiles514\\Lua Files\\SelectPackage\\SelectPackageItem_Cln.lub") == false) {
return false;
}
lua_State* state = script.GetState();
if (state) {
lua_getfield(state, LUA_GLOBALSINDEX, "LoadTable");
if (lua_pcall(state, 0, 0, 0) != 0) {
MessageBoxA(nullptr, lua_tolstring(state, -1, nullptr), "CSelectPackageItemMgr", 0);
} else {
lua_settop(state, -2);
}
}

View file

@ -112,7 +112,7 @@ void CSimpleStringMgr::AddString(STR_TYPE type, const char* key, const char* val
}
auto table = this->m_tables.find(type);
if (table == this->m_tables.end()) {
if (this->m_tables.end() == table) {
std::unordered_map<std::string, std::string> entries;
entries.emplace(key, value);
this->m_tables.emplace(type, std::move(entries));