diff --git a/Source/Client/Session.h b/Source/Client/Session.h index 6f2e668..7838803 100644 --- a/Source/Client/Session.h +++ b/Source/Client/Session.h @@ -19,6 +19,7 @@ class CActRes; class LuaScript; struct ActionFrame; +struct WindowDialogs; struct SessionRecord6144 { /* 0000 */ std::uint16_t unknown_0000 = 0; @@ -34,6 +35,16 @@ struct RobeAlpha { /* 0008 */ int period; }; +struct ProhibitionLogEntry { + /* 0000 */ std::uint32_t aid; + /* 0004 */ std::uint32_t accountId; + /* 0008 */ std::uint32_t minutes; + /* 000C */ std::uint32_t date; + /* 0010 */ std::uint32_t time; + /* 0014 */ char name[32]; + /* 0034 */ char ownerName[32]; +}; + struct SessionShop { /* 0000 */ unsigned char unknown_0000; /* 0004 */ std::vector>> unknown_0004; @@ -59,7 +70,9 @@ public: /* 06F9 */ unsigned char unknown_06F9[0x23]; /* 071C */ std::vector m_homunSkillLevels; /* 0728 */ std::vector m_mercSkillLevels; - /* 0734 */ unsigned char unknown_0734[0x44]; + /* 0734 */ unsigned char unknown_0734[0x20]; + /* 0754 */ std::vector m_prohibitionLog; + /* 0760 */ unsigned char unknown_0760[0x18]; /* 0778 */ std::vector> unknown_0778; /* 0784 */ std::map unknown_0784; /* 078C */ std::map unknown_078C; @@ -239,6 +252,8 @@ public: int FindUnknown0778(int key) const; CSkillInfo AdditionalSkillAt(int index) const; CSkillInfo HomunSkillAt(int index) const; + void DeleteProhibitionLog(std::uint32_t aid, std::uint32_t minutes, WindowDialogs& dialogs); + const char* DecodePlayerName() const; void NotifyHomunSkillWindows(); void NotifyMercSkillWindows(); int GetPetActionNumber(int hungerLevel, int friendlyLevel, int action); @@ -283,6 +298,8 @@ extern CSession g_session; #if defined(_WIN32) && !defined(_WIN64) static_assert(sizeof(SessionRecord6144) == 0x38); +static_assert(sizeof(ProhibitionLogEntry) == 0x54); +static_assert(offsetof(CSession, m_prohibitionLog) == 0x754); static_assert(offsetof(SessionRecord6144, unknown_002C) == 0x2C); static_assert(offsetof(SessionRecord6144, unknown_0030) == 0x30); static_assert(offsetof(CSession, m_additionalSkills) == 0x4); diff --git a/Source/Contents/Skills/ClientSkills.cpp b/Source/Contents/Skills/ClientSkills.cpp index 9636d87..9459ab1 100644 --- a/Source/Contents/Skills/ClientSkills.cpp +++ b/Source/Contents/Skills/ClientSkills.cpp @@ -2,14 +2,19 @@ #include "Client/Session.h" #include "Contents/ClientState.h" #include "Contents/Jobs/JobId.h" +#include "Contents/Jobs/JobInheritance.h" #include "Script/LuaScript.h" #include "UI/Window/UIWindow.h" #include "UI/Window/UIWindowMgr.h" +#include "UI/Window/WindowDialogs.h" #include "UI/Window/WindowManagerWindows.h" #include #include +// GLOBAL: gl_24650 +char g_decodedPlayerName[64]; + namespace { // INLINED CSkillInfo Find(const std::list& values, std::uint32_t id) { @@ -429,6 +434,29 @@ void CSession::EraseUnknownKey(std::int64_t key) { } } +// OFFSET: 0x00E085A0 +// FUNCTION: fn_23763 +void CSession::DeleteProhibitionLog(std::uint32_t aid, std::uint32_t minutes, WindowDialogs& dialogs) { + const char* message; + auto found = this->m_prohibitionLog.end(); + for (auto entry = this->m_prohibitionLog.begin(); entry != this->m_prohibitionLog.end(); ++entry) { + if (entry->aid == aid) { + found = entry; + } + } + + if (found == this->m_prohibitionLog.end()) { + message = "채팅 로그 삭제 실패 : 채팅 금지를 준 기록이 없습니다."; + } else if (found->minutes > minutes) { + message = "채팅 로그 삭제 안함 : 마이너스 된 시간이 기존의 채팅 금지 시간보다 짧습니다."; + } else { + this->m_prohibitionLog.erase(found); + message = "채팅 로그 삭제 성공"; + } + + dialogs.Confirm(message, 0, true, false, 0, "Message", 280, 120, 0); +} + // OFFSET: 0x00E08690 // FUNCTION: fn_23764 std::int64_t CSession::FindUnknown0784(std::int64_t key) const { @@ -474,6 +502,17 @@ int CSession::GetBeginEffectId(int skillId) const { return effectId; } +// OFFSET: 0x00E08C70 +// FUNCTION: fn_23771 +const char* CSession::DecodePlayerName() const { + std::memcpy(g_decodedPlayerName, this->m_playerNameKey, sizeof(g_decodedPlayerName)); + for (unsigned int index = 0; index < sizeof(g_decodedPlayerName); ++index) { + g_decodedPlayerName[index] ^= g_playerNameKey[index]; + } + + return g_decodedPlayerName; +} + // OFFSET: 0x00E08EE0 // FUNCTION: fn_23773 ItemInfo CSession::GetItem2B50(int index) const {