Decompile fn_23789 (CSession::GetMonsterSkillInfo)
Batch #1927 by ragnarok-clanker: 0 byte-identical, 1 confirmed by peer review. - fn_23789 CSession::GetMonsterSkillInfo: logic confirmed by peer review Reviewed-by: ragnarok-clanker Adds to the build: Source/Contents/MonsterXmlActions.cpp
This commit is contained in:
parent
60f8e2a655
commit
bcf4062a45
3 changed files with 91 additions and 0 deletions
|
|
@ -269,6 +269,8 @@ public:
|
|||
CSkillInfo AdditionalSkillAt(int index) const;
|
||||
CSkillInfo HomunSkillAt(int index) const;
|
||||
void DeleteProhibitionLog(std::uint32_t aid, std::uint32_t minutes, WindowDialogs& dialogs);
|
||||
int IsAdminSubMode(int subMode);
|
||||
void GetMonsterSkillInfo(const char* monster, int skill, int* action, int* loopType, WindowDialogs& dialogs);
|
||||
const char* DecodePlayerName() const;
|
||||
void NotifyHomunSkillWindows();
|
||||
void NotifyMercSkillWindows();
|
||||
|
|
@ -336,6 +338,9 @@ public:
|
|||
};
|
||||
|
||||
extern CSession g_session;
|
||||
extern std::vector<int> g_adminAccountIds;
|
||||
|
||||
bool IsAdminAccount(int aid);
|
||||
|
||||
#if defined(_WIN32) && !defined(_WIN64)
|
||||
static_assert(sizeof(SessionRecord6144) == 0x38);
|
||||
|
|
|
|||
85
Source/Contents/MonsterXmlActions.cpp
Normal file
85
Source/Contents/MonsterXmlActions.cpp
Normal file
|
|
@ -0,0 +1,85 @@
|
|||
#include "Client/Session.h"
|
||||
#include "Contents/MessageTable.h"
|
||||
#include "UI/Window/WindowDialogs.h"
|
||||
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
|
||||
// GLOBAL: gl_24750
|
||||
std::vector<int> g_adminAccountIds;
|
||||
|
||||
// OFFSET: 0x00AD1BE0
|
||||
// FUNCTION: fn_17812
|
||||
bool IsAdminAccount(int aid) {
|
||||
for (int value : g_adminAccountIds) {
|
||||
if (value == aid) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00DFA390
|
||||
// FUNCTION: fn_23572
|
||||
int CSession::IsAdminSubMode(int subMode) {
|
||||
if (IsAdminAccount(this->m_aid) && subMode == 7) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
// OFFSET: 0x00E09B50
|
||||
// FUNCTION: fn_23789
|
||||
void CSession::GetMonsterSkillInfo(const char* monster, int skill, int* action, int* loopType, WindowDialogs& dialogs) {
|
||||
*action = -1;
|
||||
|
||||
char tableName[21];
|
||||
std::memcpy(tableName, "Monster_Action_Table", sizeof(tableName));
|
||||
XmlNode* table = this->m_monsterSkillInfo.FindChild(DecodeMessageRot(tableName));
|
||||
if (!table) {
|
||||
return;
|
||||
}
|
||||
|
||||
char number[8];
|
||||
char skillName[8];
|
||||
_itoa(skill, number, 10);
|
||||
std::sprintf(skillName, "_%s", number);
|
||||
|
||||
char monsterName[256];
|
||||
std::strcpy(monsterName, monster);
|
||||
_strlwr(monsterName);
|
||||
XmlNode* entry = table->FindChild(DecodeMessageRot(monsterName));
|
||||
if (!entry) {
|
||||
return;
|
||||
}
|
||||
|
||||
XmlNode* skillNode = entry->FindChild(DecodeMessageRot(skillName));
|
||||
if (!skillNode) {
|
||||
return;
|
||||
}
|
||||
|
||||
char fieldName[9];
|
||||
std::memcpy(fieldName, "action", 7);
|
||||
XmlNode* actionNode = skillNode->FindChild(DecodeMessageRot(fieldName));
|
||||
std::memcpy(fieldName, "loopType", 9);
|
||||
XmlNode* loopNode = skillNode->FindChild(DecodeMessageRot(fieldName));
|
||||
|
||||
if (this->IsAdminSubMode(1) && (!actionNode || !loopNode)) {
|
||||
*action = 0;
|
||||
*loopType = 0;
|
||||
dialogs.Confirm("에러발생. 클라이언트 담당자 에게 에러 사실을 통보 하세요. 위치 - CPlayer :: GetMonsterSkillInfo", 0, true, false, 0, "Message", 280, 120, 0);
|
||||
dialogs.Confirm("action 또는 loopType 이 존재하지 않음.", 0, true, false, 0, "Message", 280, 120, 0);
|
||||
return;
|
||||
}
|
||||
|
||||
char actionText[8];
|
||||
char loopText[8];
|
||||
std::sprintf(actionText, DecodeMessageRot(const_cast<char*>(actionNode->Text().c_str())));
|
||||
std::sprintf(loopText, DecodeMessageRot(const_cast<char*>(loopNode->Text().c_str())));
|
||||
*action = std::atoi(actionText);
|
||||
*loopType = std::atoi(loopText);
|
||||
}
|
||||
|
|
@ -380,6 +380,7 @@
|
|||
"Source/Contents/Models/ModelTextureAnimation.cpp": 3,
|
||||
"Source/Contents/MonsterResources.cpp": 4,
|
||||
"Source/Contents/MonsterSpeech.cpp": 4,
|
||||
"Source/Contents/MonsterXmlActions.cpp": 4,
|
||||
"Source/Contents/MovementRoute.cpp": 4,
|
||||
"Source/Contents/MovementRouteInterpolation.cpp": 4,
|
||||
"Source/Contents/Movies/BinkMovie.cpp": 3,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue