미러서버 파일 코드 수정
GPT에게 물어보고 적용하면서 수정함
신루 서버 파일은 Language_M.txt의 순서?에 따라서 아이템 코드가 바뀌는걸로 알고 있음
그러니 미러서버 파일에서 정상작동하던 룬스톤들을 다른 서버 파일에서 작동시키면 작동이 안됨
되는 룬스톤도 있지만 안되는 룬스톤도 있고 아예 안될수도 있음
이게 미러서버 파일에 맞게 해당 아이템 코드들을 하드코딩으로 아예 박아둬서 그런거라
다른 서버파일에서도 동일하게 작동하게 하려면 해당 코드들을 Item(Code).txt에서 읽어서 적용하면
해당 아이템 코드가 존재할때 작동을 하게 만들 수 있음
#define RuneStone 318771247 //룬스톤
#define ReinforceRuneStone 318771263 //강화 룬스톤
#define ProtectReinforceRuneStone 318771262 //보호 강화 룬스톤
#define ProtectRuneStone 318771261 //보호 룬스톤
#define BlackRuneStone 318771275 //블랙 룬스톤
#define SuperRuneStone 318771277 //슈퍼 룬스톤
#define RecyclingItem 318771278 //도깨비 방망이
이 부분의 코드를 define에서 int로 변경하고 = 0; 을 붙여서 int형 변수로 바꿔주고
도깨비 방망이는 내가 사용하지 않아서 뺐음.... 그래도 작동 원리는 동일하니
int RuneStone = 0;
int ReinforceRuneStone = 0;
int ProtectReinforceRuneStone = 0;
int ProtectRuneStone = 0;
int BlackRuneStone = 0;
int SuperRuneStone = 0;
int Miracle = 0; //기존 코드에서 define으로 선언하지 않고 아이템 코드를 그대로 넣은 부분이라서 이건 코드에서 그 부분 찾아서 변수를 넣어줘야됨
int ProtectScroll = 0; //기존 코드에서 define으로 선언하지 않고 아이템 코드를 그대로 넣은 부분이라서 이건 코드에서 그 부분 찾아서 변수를 넣어줘야됨
이렇게 변경을 해준뒤에
아래 코드들을 추가해주고
void LoadItemCodesFromFile()
{
char exePath[MAX_PATH] = {};
GetModuleFileNameA(NULL, exePath, MAX_PATH);
for (int i = strlen(exePath) - 1; i >= 0; --i) {
if (exePath[i] == '\\') {
exePath[i] = '\0';
break;
}
}
strcat_s(exePath, "\\Config\\Item(Code).txt");
std::ifstream file(exePath);
if (!file.is_open()) {
printf("파일 열기 실패: %s\n", exePath);
return;
}
std::string line;
while (std::getline(file, line)) {
if (line.empty()) continue;
size_t colonPos = line.find(':');
if (colonPos == std::string::npos) continue;
std::string name = line.substr(0, colonPos);
std::string codeStr = line.substr(colonPos + 1);
name.erase(0, name.find_first_not_of(" \t"));
name.erase(name.find_last_not_of(" \t") + 1);
codeStr.erase(0, codeStr.find_first_not_of(" \t"));
codeStr.erase(codeStr.find_last_not_of(" \t") + 1);
int code = atoi(codeStr.c_str());
if (code != 0 || codeStr.find("0") != std::string::npos) {
itemCodeMap[name] = code;
}
else {
printf("파싱 실패: [%s] = [%s]\n", name.c_str(), codeStr.c_str());
}
}
file.close();
}
해당 코드로 Item(Code).txt를 읽어온 뒤
int GetItemCode(const std::string& name)
{
auto it = itemCodeMap.find(name);
return (it != itemCodeMap.end()) ? it->second : -1;
}
void InitItemCodes()
{
RuneStone = GetItemCode("룬스톤");
ReinforceRuneStone = GetItemCode("강화 룬스톤");
ProtectReinforceRuneStone = GetItemCode("보호 강화 룬스톤");
ProtectRuneStone = GetItemCode("보호 룬스톤");
BlackRuneStone = GetItemCode("블랙 룬스톤");
SuperRuneStone = GetItemCode("슈퍼 룬스톤");
ProtectScroll = GetItemCode("보호주문서");
Miracle = GetItemCode("미라클 통행증");
if (ProtectScroll == -1) {
ProtectScroll = GetItemCode("보호 주문서");
}
if (SuperRuneStone == -1) {
SuperRuneStone = GetItemCode("슈퍼룬스톤");
}
if (ProtectRuneStone == -1) {
ProtectRuneStone = GetItemCode("보호룬스톤");
}
if (ReinforceRuneStone == -1) {
ReinforceRuneStone = GetItemCode("강화룬스톤");
}
if (ProtectReinforceRuneStone == -1) {
ProtectReinforceRuneStone = GetItemCode("보호 강화룬스톤");
if (ProtectReinforceRuneStone == -1) {
ProtectReinforceRuneStone = GetItemCode("보호강화 룬스톤");
if (ProtectReinforceRuneStone == -1) {
ProtectReinforceRuneStone = GetItemCode("보호강화룬스톤");
}
}
}
}
해당 코드로 가장 먼저 선언한 변수에 코드 값을 넣어주면
기존에 define로 선언해서 사용하던 부분들에 item(Code).txt에서 읽어온 값으로 들어가게 됨
만약 해당 아이템 값이 없다면 -1 로 들어가면서 작동이 안됨
어떤 아이템이 적용되는지는
void PrintLoadedItemCodes()
{
printf(" [아이템 코드 확인] \n");
printf("-1로 나오는거는 코드가 없는 것 \n");
printf("코드가 있는데 안나온다면 띄어쓰기 확인 \n");
printf("룬스톤: %d\n", RuneStone);
printf("강화 룬스톤: %d\n", ReinforceRuneStone);
printf("보호 룬스톤: %d\n", ProtectRuneStone);
printf("보호 강화 룬스톤: %d\n", ProtectReinforceRuneStone);
printf("슈퍼 룬스톤: %d\n", SuperRuneStone);
printf("다크 룬스톤: %d\n", BlackRuneStone);
printf("보호주문서: %d\n", ProtectScroll);
printf("미라클 통행증 : %d\n", Miracle);
printf("------------------------- \n");
}
해당 코드를 넣고 확인하면됨
위 코드들이 작동하기 위해서는
맨 아래쪽에
void HookClass::HookFunctions()
{
if (MH_Initialize() != MH_OK)
{
LeaveCriticalSection(&cs);
return;
}
InitializeCriticalSection(&cs);
InitializeCriticalSectionAndSpinCount(&cs, 0);
LoadItemCodesFromFile(); //아이템 코드 읽기
InitItemCodes(); //아이템 코드 읽기
PrintLoadedItemCodes(); //적용된 코드 확인
..........
}
LoadItemCodesFromFile(); //아이템 코드 읽기
InitItemCodes(); //아이템 코드 읽기
PrintLoadedItemCodes(); //적용된 코드 확인
이 3줄을 포함시켜서 작동시킬때 확인하면 됨
이러면 미러서버파일뿐만 아니라 다른 기존 통파일에서도 해당 아이템 코드가 존재한다면 사용이 가능해짐
이걸로해서 가장 흔하게 퍼진 지피지기 통파일에서 룬스톤, 보호룬스톤, 강화룬스톤, 보호강화룬스톤, 슈퍼룬스톤 5개의 작동을 확인했음
슈퍼룬스톤의 경우 해당 코드가 존재하지만 아이템이 룬스톤 아이템이 아니라서 강화 시도시 경고창이 뜨지 않고 바로 작동하는 문제가 있긴함
어떤식으로 넣어야 될지는 GPT에게 물어보면 친절하게 알려줌

자택경비 님의 최근 댓글
아.. 아님 찾았음 2025 09.01 윈도우 xp말고 7이상에서 구동할때 MainSvrT가 정상적으로 실행이 안되는데 왜그럴까요.... 2025 09.01 전에 이팩 구해서 뜯어봤는데 진짜 머리아픔.... 버그없이 쓰려면 룬스톤 기능만 남기고 싹 지우는게 가장 좋음 2025 07.25 ㄳㄳ 2024 04.26 ㄳㄳ 2024 04.12