gcr_fc
Bronze MemberTipo de Conteúdo
Perfis
Fóruns
Atualizações
Quizzes
Store
Tudo que gcr_fc postou
-
Descompilação Exec_MSG_ReqRanking 0x39F - TMsrv 7.56 / TMsrv 7.57
gcr_fc respondeu ao tópico de Sc2ALLin em Descompilação
Show de bola, tá evoluindo bem nas descompilacoes, parabéns. -
TMSecurity.h #pragma once #include <cstdint> // Para tipos de dados padrão #include <cassert> // Para assert class TMSecurity { public: TMSecurity(); virtual ~TMSecurity(); char GetKeyword(int pos); char GetPasswordKey(); void InitializeKeys(); public: char GameKeyWords[512]; char PasswordKey; }; void MSHDecrypt(unsigned int* v, unsigned int* k); void MSHEncrypt(unsigned int* v, unsigned int* k); char* MSHEncDec(int Mode, const char* filename, char* ptr, int size); unsigned int* getkey(const char* file); TMSecurity.cpp #include "pch.h" #include "TMGlobal.h" const unsigned int DELTA = 0x9E3779B9; //0090AA50 TMSecurity::TMSecurity() //Função Ok { memset(GameKeyWords, 0, 512); PasswordKey = 180; //-76 } //0090AAF0 TMSecurity::~TMSecurity() //Função Ok { memset(GameKeyWords, 0, 512); } //0090AB90 char TMSecurity::GetKeyword(int pos) //Função Ok { char result = 0; if (GameKeyWords[pos]) result = GameKeyWords[pos]; return result; } //0090AC10 char TMSecurity::GetPasswordKey() //Função Ok { return PasswordKey; } //0090AC70 void TMSecurity::InitializeKeys() //Função Ok { std::string fileName = "Conf/VibrantGames.bin"; FILE* fp = NULL; if(!fopen_s(&fp, fileName.c_str(), "rb")) { fseek(fp, 0, 2); int file_size = ftell(fp); rewind(fp); char* buffer = (char*)malloc(file_size); if (buffer) { fread(buffer, 1, file_size, fp); fclose(fp); for (int i = 0; i < file_size; i++) buffer[i] ^= PasswordKey; char* p2 = MSHEncDec(1, (char*)fileName.c_str(), buffer, file_size); if (p2) { if (file_size > 512) file_size = 512; memcpy(&GameKeyWords, p2, file_size); free(p2); free(buffer); } } } else MessageBoxA(0, "Please, reinstall the game, data corrupted!", "Vibrant Games", 0); } //00950210 char* MSHEncDec(int Mode, const char* filename, char* ptr, int size) //Função Ok { if (!filename || !ptr || !size) return NULL; const char* file = filename; for (int i = strlen(filename) - 1; i > 0; i--) { if (filename[i] == '/' || filename[i] == '\\') { file = &filename[i + 1]; break; } } int blocks = size / 8; char* out = (char*)malloc(size); if (!out) return NULL; unsigned int* key = getkey(file); if (!key) { free(out); return NULL; } unsigned char* pout = reinterpret_cast<unsigned char*>(out); unsigned int v[2]; for (int i = 0; i < blocks; i++, ptr += 8, pout += 8) { memcpy(v, ptr, sizeof(v)); if (!Mode) MSHEncrypt(v, key); else MSHDecrypt(v, key); memcpy(pout, v, sizeof(v)); } SecureZeroMemory(key, 4 * sizeof(unsigned int)); free(key); return out; } //00950080 void MSHDecrypt(unsigned int* v, unsigned int* k) //Função Ok { unsigned int v0 = v[0]; unsigned int v1 = v[1]; unsigned int sum = DELTA * 32; for (int i = 0; i < 32; i++) { v1 -= ((v0 << 4) + k[2]) ^ (v0 + sum) ^ ((v0 >> 5) + k[3]); v0 -= ((v1 << 4) + k[0]) ^ (v1 + sum) ^ ((v1 >> 5) + k[1]); sum -= DELTA; } v[0] = v0; v[1] = v1; } //00950440 void MSHEncrypt(unsigned int* v, unsigned int* k) //Função Ok { unsigned int v1 = v[0]; unsigned int v0 = v[1]; unsigned int sum = 0; for (int i = 0; i < 32; i++) { sum += DELTA; v0 += ((v1 << 4) + k[0]) ^ (v1 + sum) ^ ((v1 >> 5) + k[1]); v1 += ((v0 << 4) + k[2]) ^ (v0 + sum) ^ ((v0 >> 5) + k[3]); } v[0] = v0; v[1] = v1; } //00950920 unsigned int* getkey(const char* file) //Função Ok { unsigned int* key = (unsigned int*)malloc(4 * sizeof(unsigned int)); if (!key) return NULL; int len = strlen(file); char* newFile = (char*)malloc(len); if (!newFile) { free(key); return NULL; } for (int i = 0; file[i] && i < len; i++) newFile[i] = tolower(file[i]); memset(key, (13 * len) + 73, 4 * sizeof(unsigned int)); for (int j = 0; j < len; j++) key[j % 4] ^= newFile[j]; free(newFile); return key; } BaseDef.cpp //0067F240 bool BASE_IsEncrypted(const char* file) //Função Ok { FILE* fp = fopen(file, "rb"); if (!fp) return false; bool encrypted = false; int code[3]{}; if (fread(code, 1, 4, fp) == 4) { if(strstr(file, ".msa") || strstr(file, ".vgo")) { if (code[0] && code[0] != 322 && code[0] != 274) encrypted = true; } else if (strstr(file, ".msh") || strstr(file, ".vgm")) { if (code[0]) encrypted = true; } else if (strstr(file, ".wys") || strstr(file, ".vgt")) { if (code[0] && code[0] != 0x30315357 && code[0] != 0x30315457) encrypted = true; } else if (strstr(file, ".wyt") || strstr(file, ".vgi")) { if (code[0] && code[0] != 0x30315457 && code[0] != 0x30315357) encrypted = true; } } fclose(fp); return encrypted; } Criem uma variaval global para a classe TMSecurity, nome original g_pSecurityManager A g_pSecurityManager->InitializeKeys() dever ser chamada dentro da NewApp A função de decode é chamada nesses locais //00690380 int CMesh::LoadMesh(char* file) //Função Ok //0075E550 int TextureManager::LoadUITexture(int nIndex, int nSrcIndex) //Função Ok //0075C110 int TextureManager::LoadEffectTexture(int nIndex) //Função Ok //0075D940 int TextureManager::LoadModelTexture(int nIndex) //Função Ok //0075CCA0 int TextureManager::LoadEnvTexture(int nIndex) //Função Ok //008E3B10 int TMMesh::LoadMsa(const char* szFileName) //Função Ok //00697C90 char* CPSock::ReadMessage(int* ErrorCode, int* ErrorType) //Função Ok //00697340 int CPSock::AddMessage(char* pMsg, int Size, int FixedKeyWord) //Função Ok A implementacao delas é com vcs
-
void CloseUser(int conn, int numError) //Função Ok { if (!IsPlayer(conn)) { sprintf_s(temp, "err, mob:%s conn:%d pos:%d,%d", pMob[conn].MOB.MobName, conn, pMob[conn].TargetX, pMob[conn].TargetY); Log(temp, "-system", 0); return; } if (pUser[conn].Mode == USER_PLAY && pMob[conn].TargetX >= 0 && pMob[conn].TargetX < MAX_GRIDX && pMob[conn].TargetY >= 0 && pMob[conn].TargetY < MAX_GRIDY) pMobGrid[pMob[conn].TargetY][pMob[conn].TargetX] = MOB_EMPTY; pUser[conn].Admin = FALSE; if (pUser[conn].cSock.Sock) { sprintf_s(temp, "clo,fd %d-%d conn:%d num:%d", pUser[conn].Mode, pMob[conn].Mode, conn, numError); Log(temp, pUser[conn].AccountName, pUser[conn].IP); if (pUser[conn].GameRoomState) sprintf_s(temp, "pcr,Logout fd %d", pUser[conn].Mode); } pUser[conn].cSock.CloseSocket(); pMob[conn].MOB.Equip[FACE].Index = pMob[conn].MobFace; int userMode = pUser[conn].Mode; if (userMode == USER_EMPTY || userMode == USER_ACCEPT) { pUser[conn].CloseUser(); return; } if (userMode == USER_PLAY || userMode == USER_SAVING4QUIT) { RemoveParty(conn, 0); int otherTrade = pUser[conn].Trade.OpponentID; if (IsPlayer(otherTrade) && pUser[otherTrade].Mode == USER_PLAY && pUser[otherTrade].Trade.OpponentID == conn) RemoveTrade(otherTrade); pUser[conn].Trade.OpponentID = MOB_EMPTY; MSG_SavingQuit pSavingQuit{}; pSavingQuit.Header.Type = _MSG_SavingQuit; pSavingQuit.Header.Size = sizeof MSG_SavingQuit; if (pUser[conn].Slot < 0 || pUser[conn].Slot >= 4) return; pMob[conn].MOB.Equip[FACE].Index = pMob[conn].MobFace; memcpy(&pSavingQuit.MOB, &pMob[conn].MOB, sizeof STRUCT_MOB); memcpy(pMob[conn].Ext1.Affect, pMob[conn].Affect, sizeof STRUCT_AFFECT * MAX_AFFECT); memcpy(&pSavingQuit.Ext1, &pMob[conn].Ext1, sizeof STRUCT_EXT1); memcpy(&pSavingQuit.Ext2, &pMob[conn].Ext2, sizeof STRUCT_EXT2); memcpy(pSavingQuit.Cargo, pUser[conn].Cargo, sizeof STRUCT_ITEM * MAX_CARGO); memcpy(pSavingQuit.ShortSkill, pUser[conn].SkillBar2, 16); memcpy(pSavingQuit.AccountName, pUser[conn].AccountName, NAME_LENGTH); pSavingQuit.Coin = pUser[conn].Gold; pSavingQuit.Header.ID = conn; if(DBServerSocket.AddMessage((char*)&pSavingQuit, pSavingQuit.Header.Size)) DBServerSocket.SendMessageA(); else { int attemptsCount = 0; for (int i = 0; i < 5; i++) { int* ip = (int*)LocalIP; if(DBServerSocket.SingleConnect(DBServerAddress, DBServerPort, *ip, WSA_READDB)) break; Sleep(100); attemptsCount++; } if (attemptsCount == 5) Log("err, critical!!! - close user fail", pUser[conn].AccountName, pUser[conn].IP); else { DBServerSocket.SendMessageA(); DBServerSocket.AddMessage((char*)&pSavingQuit, pSavingQuit.Header.Size); } } pUser[conn].Mode = USER_SAVING4QUIT; DeleteMob(conn, DELETE_DISCONNECT); pUser[conn].CrackErrorCount = 0; return; } MSG_STANDARD pNoNeedSave{}; pNoNeedSave.Header.Type = _MSG_DBNoNeedSave; pNoNeedSave.Header.ID = conn; pNoNeedSave.Header.Size = sizeof MSG_STANDARD; DBServerSocket.SendOneMessage((char*)&pNoNeedSave, pNoNeedSave.Header.Size); pMob[conn].Mode = MOB_EMPTY; pUser[conn].CloseUser(); } #define _MSG_SavingQuit (6 | FLAG_GAME2DB) //0x806 struct MSG_SavingQuit //size 2752 { PACKET_HEADER Header; int Slot; STRUCT_MOB MOB; STRUCT_ITEM Cargo[MAX_CARGO]; int Coin; char ShortSkill[16]; char AccountName[NAME_LENGTH]; STRUCT_EXT1 Ext1; STRUCT_EXT2 Ext2; }; #define IsPlayer(conn) ((((conn) > MOB_EMPTY && (conn) < MAX_USER) ? TRUE : FALSE))
-
void ProcessTrainingCamp(int conn, int npcId, int confirm, int merchant) { int questFlag = -1; if (merchant == 36) questFlag == 8; else if (merchant == 40) questFlag == 9; else if (merchant == 41) questFlag == 10; else if (merchant == 43) questFlag == 11; int questBit = 1 << questFlag; int questLvl = questFlag - 8; if (pMob[conn].MOB.CurrentScore.Level > 35 && pMob[conn].MOB.CurrentScore.Level < MAX_USER) return; int keyId = 451 + questLvl; if (questLvl != 3 && pMob[conn].MOB.Quest & questBit) { SendClientMessage(npcId, TRUE, _NN_NewbieQuest_Already1 + questLvl); return; } if (keyId == 454) keyId == 524; //Emblema_Orc int i; for (i = 0; i < MAX_VISIBLE_INVENTORY; i++) { if (pMob[conn].MOB.Inventory[i].Index == keyId) break; } if (i == MAX_VISIBLE_INVENTORY) { SendClientMessage(npcId, TRUE, _NN_NewbieQuest_Cheerup1 + questLvl); return; } SendClientMessage(npcId, TRUE, _NN_NewbieQuest_Complete1 + questLvl); SendClientMessage(conn, FALSE, _NN_NewbieQuest_Reward1 + questLvl); pMob[conn].MOB.Quest |= questBit; if (!questLvl) { STRUCT_ITEM reward{}; reward.Index = 682; //Kit_de_Cura_(20_M.) reward.EF1 = EF_AMOUNT; reward.EFV1 = 20; PutItem(conn, &reward); } else if (questLvl == 1) { int weaponId = pMob[conn].MOB.Equip[WEAPON].Index; if (weaponId >= 3000 && weaponId <= 3007) return; if (weaponId > 0 && weaponId < MAX_ITEMLIST) { char str1[128]{}; char str2[128]{}; int reqLvl = g_pItemList[weaponId].ReqLvl; if (reqLvl > 36 && reqLvl < 1000) return; int baseLvl = 50; BASE_GetItemCode(&pMob[conn].MOB.Equip[WEAPON], str1); int ef1 = pMob[conn].MOB.Equip[WEAPON].EF1; int efv1 = pMob[conn].MOB.Equip[WEAPON].EFV1; pMob[conn].MOB.Equip[WEAPON].EF1 = 0; pMob[conn].MOB.Equip[WEAPON].EFV1 = 0; pMob[conn].MOB.Equip[WEAPON].EF2 = 0; pMob[conn].MOB.Equip[WEAPON].EFV2 = 0; pMob[conn].MOB.Equip[WEAPON].EF3 = 0; pMob[conn].MOB.Equip[WEAPON].EFV3 = 0; SetItemBonus(&pMob[conn].MOB.Equip[WEAPON], reqLvl + baseLvl, TRUE, 0, FALSE); pMob[conn].MOB.Equip[WEAPON].EF1 = ef1; pMob[conn].MOB.Equip[WEAPON].EFV1 = efv1; SendItem(conn, EQUIP_TYPE, WEAPON, &pMob[conn].MOB.Equip[WEAPON]); BASE_GetItemCode(&pMob[conn].MOB.Equip[WEAPON], str2); sprintf(temp, "que, chobo_quest2 befor:%s after:%s", str1, str2); Log(temp, pUser[conn].AccountName, pUser[conn].IP); SetTick(conn, 44, 200, 200); SendScore(conn); } } else if (questLvl == 2) { for (int j = 0; j < 8; j++) { int itemId = pMob[conn].MOB.Equip[j].Index; if (itemId < 500 || itemId >= MAX_ITEMLIST) return; int reqLvl = g_pItemList[itemId].ReqLvl; if (reqLvl > 36 && reqLvl < 1000) return; int itemSanc = BASE_GetItemSanc(&pMob[conn].MOB.Equip[j]); if (itemSanc < 7) itemSanc += (rand() % 3) + 1; if (itemSanc > 9) itemSanc = 9; BASE_SetItemSanc(&pMob[conn].MOB.Equip[j], itemSanc, 0); SendItem(conn, EQUIP_TYPE, j, &pMob[conn].MOB.Equip[j]); } SetTick(conn, 44, 200, 200); SendScore(conn); SendEquip(conn, conn); } else if (questLvl == 3) { int sort = rand() % 3; if (sort == 0) { STRUCT_ITEM reward{}; reward.Index = 682; //Kit_de_Cura_(20_M.) reward.EF1 = EF_AMOUNT; reward.EFV1 = 20; PutItem(conn, &reward); } else if (sort == 1) { STRUCT_ITEM reward{}; reward.Index = 481; //Olho_Crescente PutItem(conn, &reward); } else { STRUCT_ITEM reward{}; reward.Index = 651 + (rand() % 3); //Rubi_do_Carbunkle PutItem(conn, &reward); } SetTick(conn, 44, 200, 200); SendScore(conn); BASE_ClearItem(&pMob[conn].MOB.Inventory[i]); SendItem(conn, INVEN_TYPE, i, &pMob[conn].MOB.Inventory[i]); } }
-
Descompilação SendSummonParty TMSrv 7.57+ Packet 0x3EA
gcr_fc respondeu ao tópico de gcr_fc em Descompilação
Basicamente tá tudo aí, tem que dar uma revisada nos códigos e tal, mas basicamente tem todos... -
void ProcessKings(int conn, int npcId, int confirm) { if (pMob[conn].MOB.Equip[ORB].Index == 1742 && pMob[conn].MOB.Equip[STONE].Index >= 1760 && pMob[conn].MOB.Equip[STONE].Index <= 1763) { if (!BASE_GetCheckFace(pMob[conn].MobFace)) //Criar o Arch { if (!confirm) { SendClientMessage(npcId, TRUE, _NN_NewCharacter); return; } if (pMob[conn].MOB.BaseScore.Level < TransLevel - 1) { SendClientMessage(npcId, TRUE, _NN_NeedMoreExp); return; } int archSlot = -1; int archClass = (((pMob[conn].MobFace / 10) * 4) + (pMob[conn].MOB.Equip[STONE].Index - 1760)) + 4; char archName[NAME_LENGTH]{}; sprintf_s(archName, "%s", pMob[conn].MOB.MobName); strupr(archName); int sameNameCount = 0; for (int i = 0; i < MOB_PER_ACCOUNT; i++) { if (!pUser[conn].SelChar.Name[i]) continue; char tmpName[NAME_LENGTH]{}; strcpy(tmpName, pUser[conn].SelChar.Name[i]); strupr(tmpName); if (!strcmp(tmpName, archName)) { sameNameCount++; if (sameNameCount >= 2) { SendClientMessage(conn, FALSE, _NN_SameCharAlready); return; } } } for (int i = 0; i < MOB_PER_ACCOUNT; i++) { if (pUser[conn].SelChar.Name[i]) continue; archSlot = i; break; } if (archSlot == -1) { SendClientMessage(conn, FALSE, _NN_NoEmptySlot); return; } sprintf_s(temp, "que,transchar: %s, class: %d, slot: %d", pMob[conn].MOB.MobName, archClass, archSlot); Log(temp, pUser[conn].AccountName, pUser[conn].IP); pMob[conn].MOB.Equip[ORB].Index = 0; pMob[conn].MOB.Equip[STONE].Index = 0; CharLogOut(conn); MSG_NewCharacter pNewChar{}; pNewChar.Header.Type = _MSG_DBNewCharacter; pNewChar.Header.Size = sizeof MSG_NewCharacter; pNewChar.Header.ID = conn; strncpy(pNewChar.MobName, pMob[conn].MOB.MobName, NAME_LENGTH); pNewChar.Slot = archSlot; pNewChar.Class = archClass; pUser[conn].Mode = USER_WAITDB; DBServerSocket.SendOneMessage((char*)&pNewChar, pNewChar.Header.Size); SendClientMessage(conn, FALSE, _NN_Congratulations_Trans); SendClientSignalParm2(conn, 0, _MSG_SendArchEffect, archSlot, 0); return; } //Criar a Ideal int secretStoneSlot[4]{ -1, -1, -1, -1 }; for (int i = 0; i < MAX_VISIBLE_INVENTORY; i++) { if (pMob[conn].MOB.Inventory[i].Index == 5334) secretStoneSlot[0] = i; else if (pMob[conn].MOB.Inventory[i].Index == 5335) secretStoneSlot[1] = i; else if (pMob[conn].MOB.Inventory[i].Index == 5336) secretStoneSlot[2] = i; else if (pMob[conn].MOB.Inventory[i].Index == 5337) secretStoneSlot[3] = i; } if (secretStoneSlot[0] == -1 || secretStoneSlot[1] == -1 || secretStoneSlot[2] == -1 || secretStoneSlot[3] == -1) return; if (SendPutItemInvCarry(conn, 5338, 0)) { for (int i = 0; i < 4; i++) { memset(&pMob[conn].MOB.Inventory[secretStoneSlot[i]], 0, sizeof STRUCT_ITEM); //ebp-0bc8 SendItem(conn, INVEN_TYPE, secretStoneSlot[i], &pMob[conn].MOB.Inventory[secretStoneSlot[i]]); } memset(&pMob[conn].MOB.Equip[ORB], 0, sizeof STRUCT_ITEM); SendItem(conn, EQUIP_TYPE, ORB, &pMob[conn].MOB.Equip[ORB]); memset(&pMob[conn].MOB.Equip[STONE], 0, sizeof STRUCT_ITEM); SendItem(conn, EQUIP_TYPE, STONE, &pMob[conn].MOB.Equip[STONE]); pMob[conn].GetCurrentScore(conn); SendScore(conn); } sprintf_s(temp, "que,transchar 2 make 5338: %s", pMob[conn].MOB.MobName); Log(temp, pUser[conn].AccountName, pUser[conn].IP); return; } //Capas int npcKingdom = pMob[npcId].MOB.Clan; int curLvl = pMob[conn].MOB.CurrentScore.Level; int capeLvl = 0; if (pMob[conn].CheckEvolution() == CELESTIAL) curLvl += MAX_LEVEL; int capeId = pMob[conn].MOB.Equip[CAPE].Index; int kingdomEmblem = FALSE; if (pMob[conn].MOB.Equip[PET].Index == 4081) kingdomEmblem = TRUE; int curKingdom = BASE_GetKingdom(capeId); if (capeId == 3197 || capeId == 3198 || capeId == 3199) //Mestre_de_Hekalotia - Mestre_de_Akelonia - Mestre_dos_Aventureiros capeLvl = 4; if (capeId == 3194 || capeId == 3195 || capeId == 3196) //Herói_de_Hekalotia - Herói_de_Akelonia - Herói_dos_Aventureiros capeLvl = 4; if (capeId == 3191 || capeId == 3192 || capeId == 3193) //Elite_de_Hekalotia - Elite_de_Akelonia - Elite_dos_Aventureiros capeLvl = 3; if (capeId == 543 //Manto_do_Guerreiro || capeId == 544 //Manto_de_Shiner || capeId == 1766 //Capa_dos_Campeões || capeId == 1767 //Capa_dos_Campeões || capeId == 1768 //Capa_dos_Campeões || capeId == 1769 //Capa_dos_Campeões || capeId == 1770 //Capa_dos_Campeões || capeId == 1771) //Capa_dos_Campeões { capeLvl = 2; } if (capeId == 545 || capeId == 546 || capeId == 549) //Manto_Hekalotia - Manto_Akelonia - Manto_do_Aventureiro capeLvl = 1; if (curKingdom == 6) curKingdom = 0; if (curKingdom && curKingdom != npcKingdom) return; if (Sapphire < 1) Sapphire = 1; int calcSapphireBlue = Sapphire / 100; int calcSapphireRed = 64 - calcSapphireBlue; if (calcSapphireBlue < 4) calcSapphireBlue = 4; if (calcSapphireRed < 4) calcSapphireRed = 4; int reqSapphire = 0; if (npcKingdom == KINGDOM_BLUE) reqSapphire = calcSapphireBlue; if (npcKingdom == KINGDOM_RED) reqSapphire = calcSapphireRed; if (confirm) { if (capeLvl >= 2 && curKingdom) { if (npcKingdom == KINGDOM_BLUE) { SendClientMessage(conn, FALSE, _NN_My_King_Bless1); return; } if (npcKingdom == KINGDOM_RED) { SendClientMessage(conn, FALSE, _NN_My_King_Bless2); return; } } if (curLvl < 219 || (capeLvl == 1 && curLvl < 255)) { SendClientMessage(conn, FALSE, _NN_Need_Level); return; } int unitSapphire = 0; int packSapphire = 0; if (!kingdomEmblem) { for (int i = 0; i < MAX_VISIBLE_INVENTORY; i++) { if (pMob[conn].MOB.Inventory[i].Index == 697 || pMob[conn].MOB.Inventory[i].Index == 4131) { int amount = BASE_GetItemAmount(&pMob[conn].MOB.Inventory[i]); if (amount == 0) unitSapphire++; if (amount > 0) { if (amount == 10) packSapphire = 1; unitSapphire += amount; } } } if (unitSapphire < reqSapphire) { sprintf(temp, "%d", reqSapphire); SendClientMessage(conn, FALSE, _DN_Need_D_Sapphire, temp); return; } if (unitSapphire > reqSapphire && packSapphire > 0) { SendClientMessage(conn, FALSE, _NN_NeedOverSapp); return; } } else { if (capeLvl == 1) return; if(curLvl < 220) { SendClientMessage(conn, FALSE, _NN_Level_Limit2); return; } if (BASE_CheckQuestBit(pMob[conn].Ext2.Quest[1], 7)) { SendClientMessage(conn, FALSE, _NN_Youve_Done_It_Already); return; } } int saveSapphire = reqSapphire; if (!kingdomEmblem) { for (int i = 0; i < MAX_VISIBLE_INVENTORY; i++) { if (pMob[conn].MOB.Inventory[i].Index == 697 || pMob[conn].MOB.Inventory[i].Index == 4131) { int amount = BASE_GetItemAmount(&pMob[conn].MOB.Inventory[i]); if (amount == 0) reqSapphire--; if (amount > 0) { if (amount == 10) packSapphire = 1; reqSapphire -= amount; } memset(&pMob[conn].MOB.Inventory[i], 0, sizeof STRUCT_ITEM); SendItem(conn, INVEN_TYPE, i, &pMob[conn].MOB.Inventory[i]); if (reqSapphire <= 0) break; } } } else { memset(&pMob[conn].MOB.Equip[PET], 0, sizeof STRUCT_ITEM); SendItem(conn, EQUIP_TYPE, PET, &pMob[conn].MOB.Equip[PET]); BASE_SetQuestBit(&pMob[conn].Ext2.Quest[1], 7); } if (capeId >= 3197 && capeId <= 3199 && npcKingdom == KINGDOM_BLUE) pMob[conn].MOB.Equip[CAPE].Index = 3197; else if (capeId >= 3197 && capeId <= 3199 && npcKingdom == KINGDOM_RED) pMob[conn].MOB.Equip[CAPE].Index = 3198; else if (capeId == 572 && npcKingdom == KINGDOM_BLUE) pMob[conn].MOB.Equip[CAPE].Index = 1766; else if (capeId == 572 && npcKingdom == KINGDOM_RED) pMob[conn].MOB.Equip[CAPE].Index = 1769; else if (capeId == 573 && npcKingdom == KINGDOM_BLUE) pMob[conn].MOB.Equip[CAPE].Index = 1767; else if (capeId == 573 && npcKingdom == KINGDOM_RED) pMob[conn].MOB.Equip[CAPE].Index = 1770; else if (capeId == 574 && npcKingdom == KINGDOM_BLUE) pMob[conn].MOB.Equip[CAPE].Index = 1768; else if (capeId == 574 && npcKingdom == KINGDOM_RED) pMob[conn].MOB.Equip[CAPE].Index = 1771; else if (capeId >= 3191 && capeId <= 3193 && npcKingdom == KINGDOM_BLUE) pMob[conn].MOB.Equip[CAPE].Index = 3191; else if (capeId >= 3191 && capeId <= 3193 && npcKingdom == KINGDOM_RED) pMob[conn].MOB.Equip[CAPE].Index = 3192; else if (capeId >= 3194 && capeId <= 3196 && npcKingdom == KINGDOM_BLUE) pMob[conn].MOB.Equip[CAPE].Index = 3194; else if (capeId >= 3194 && capeId <= 3196 && npcKingdom == KINGDOM_RED) pMob[conn].MOB.Equip[CAPE].Index = 3195; else { if (capeLvl == 1) { if (capeId != 549) memset(&pMob[conn].MOB.Equip[CAPE], 0, sizeof STRUCT_ITEM); if (npcKingdom == KINGDOM_BLUE) pMob[conn].MOB.Equip[CAPE].Index = 543; else pMob[conn].MOB.Equip[CAPE].Index = 544; } else { if (capeId != 548) memset(&pMob[conn].MOB.Equip[CAPE], 0, sizeof STRUCT_ITEM); if (npcKingdom == KINGDOM_BLUE) pMob[conn].MOB.Equip[CAPE].Index = 545; else pMob[conn].MOB.Equip[CAPE].Index = 546; } } SendItem(conn, EQUIP_TYPE, CAPE, &pMob[conn].MOB.Equip[CAPE]); if (npcKingdom == KINGDOM_BLUE) SendClientMessage(conn, FALSE, _NN_My_King_Bless1); else SendClientMessage(conn, FALSE, _NN_My_King_Bless2); sprintf(temp, "que,get mantle %d - sapphire:%d - newbie:%d", pMob[conn].MOB.Equip[CAPE].Index, saveSapphire, kingdomEmblem); Log(temp, pUser[conn].AccountName, pUser[conn].IP); SendEquip(conn, FALSE); pMob[conn].GetCurrentScore(conn); SendScore(conn); return; } if (!kingdomEmblem) { sprintf(temp, "%d", reqSapphire); SendClientMessage(conn, FALSE, _DN_Need_D_Sapphire, temp); } }
-
class CMob // TMSrv 7.57 Size da CMob 2344 { public: // O size original da STRUCT_MOB na TMSrv 7.57 é 1024 bytes STRUCT_MOB MOB; // - CORRETO - TMSrv 7.57 7D84AC0 - 0 - 1023 STRUCT_EXT1 Ext1; // - CORRETO - TMSrv 7.57 7D84EC0 - 1024 - 1027 - 0x400 STRUCT_EXT2 Ext2; // - CORRETO - TMSrv 7.57 7D84FE0 - 1312 - 0x520 STRUCT_AFFECT Affect[MAX_AFFECT]; // - CORRETO - TMSrv 7.57 7D85148 - 1672 - 1927 - 0x688 char Tab[MAX_TAB_LENGTH]; // - CORRETO - TMSrv 7.57 7D85248 - 1928 - 1953 - 0x788 int SegmentExp; // - CORRETO - TMSrv 7.57 7D85268 - 1960 - 1963 - 0x7A8 int SegmentCreate; // - CORRETO - TMSrv 7.57 7D8526C - 1964 - 1967 - 0x7AC int SegmentX; // - CORRETO - TMSrv 7.57 7D85270 - 1968 - 1971 - 0x7B0 int SegmentY; // - CORRETO - TMSrv 7.57 7D85274 - 1972 - 1975 - 0x7B4 int SegmentListX[MAX_SEGMENT]; // - CORRETO - TMSrv 7.57 7D85278 - 1976 - 1995 - 0x7B8 int SegmentListY[MAX_SEGMENT]; // - CORRETO - TMSrv 7.57 7D8528C - 1996 - 2015 - 0x7CC int SegmentWait[MAX_SEGMENT]; // - CORRETO - TMSrv 7.57 7D852A0 - 2016 - 2035 - 0x7E0 int SegmentDirection; // - CORRETO - TMSrv 7.57 7D852B4 - 2036 - 2039 - 0x7F4 int SegmentProgress; // - CORRETO - TMSrv 7.57 7D852B8 - 2040 - 2043 - 0x7F8 int GenerateIndex; // - CORRETO - TMSrv 7.57 7D852BC - 2044 - 2047 - 0x7FC unsigned short CurrentTarget; // - CORRETO - TMSrv 7.57 7D852C0 - 2048 - 2049 - 0x800 unsigned short EnemyList[MAX_ENEMY]; // - CORRETO - TMSrv 7.57 7D852C2 - 2050 - 2057 - 0x802 unsigned short PartyList[MAX_PARTY]; // - CORRETO - TMSrv 7.57 7D852CA - 2058 - 2081 - 0x80A int Mode; // - CORRETO - TMSrv 7.57 7D852E4 - 2084 - 2087 - 0x824 int Leader; // - CORRETO - TMSrv 7.57 7D852E8 - 2088 - 2091 - 0x828 int Formation; // - CORRETO - TMSrv 7.57 7D852EC - 2092 - 2095 - 0x82C int RouteType; // - CORRETO - TMSrv 7.57 7D852F0 - 2096 - 2099 - 0x830 int LastX; // - CORRETO - TMSrv 7.57 7D852F4 - 2100 - 2103 - 0x834 int LastY; // - CORRETO - TMSrv 7.57 7D852F8 - 2104 - 2107 - 0x838 int LastTime; // - CORRETO - TMSrv 7.57 7D852FC - 2108 - 2111 - 0x83C int LastSpeed; // - CORRETO - TMSrv 7.57 7D85300 - 2112 - 2115 - 0x840 int TargetX; // - CORRETO - TMSrv 7.57 7D85304 - 2116 - 2119 - 0x844 int TargetY; // - CORRETO - TMSrv 7.57 7D85308 - 2120 - 2123 - 0x848 int NextX; // - CORRETO - TMSrv 7.57 7D8530C - 2124 - 2127 - 0x84C int NextY; // - CORRETO - TMSrv 7.57 7D85310 - 2128 - 2131 - 0x850 int NextAction; // - CORRETO - TMSrv 7.57 7D85314 - 2132 - 2135 - 0x854 char Route[MAX_ROUTE]; // - CORRETO - TMSrv 7.57 7D85318 - 2136 - 2159 - 0x858 int WaitSec; // - CORRETO - TMSrv 7.57 7D85330 - 2160 - 2163 - 0x870 int WeaponDamage; // - CORRETO - TMSrv 7.57 7D85334 - 2164 - 2167 - 0x874 int Summoner; // - CORRETO - TMSrv 7.57 7D85338 - 2168 - 2171 - 0x878 int PotionCount; // - CONFIRMAR - TMSrv 7.57 7D8533C - 2172 - 2175 - 0x87C int GuildDisable; // - CORRETO - TMSrv 7.57 7D85340 - 2176 - 2179 - 0x880 int DropBonus; // - CORRETO - TMSrv 7.57 7D85344 - 2180 - 2183 - 0x884 int ExpBonus; // - CORRETO - TMSrv 7.57 7D85348 - 2184 - 2187 - 0x888 int Range; // - CORRETO - TMSrv 7.57 7D8534C - 2188 - 2191 - 0x88C int AgmoState; // - CORRETO - TMSrv 7.57 7D85350 - 2192 - 2195 - 0x890 0:mob comum 1:mob agmo int unk_7D85354; // - CONFIRMAR - TMSrv 7.57 7D85354 - 2196 - 2199 - 0x894 Só é inicializada no construtor da CMob e nao é mais usada! int MobFace; // - CORRETO - TMSrv 7.57 7D85358 - 2200 - 2203 - 0x898 // Calculo é feito com MobFace % 10 < 5 Mortal ou Transformações do BM retorna 0 // > 5 verifica no Learn se tem soul se nao tiver retorna 1 // se tiver soul retorna 2 int QuestIndex; // - CORRETO - TMSrv 7.57 7D8535C - 2204 - 2207 - 0x89C int KhepraState; // - CORRETO - TMSrv 7.57 7D85360 - 2208 - 2211 - 0x8A0 int SpecialMobControl; // - CORRETO - TMSrv 7.57 7D85364 - 2212 - 2215 - 0x8A4 int LegendVeridState; // - CORRETO - TMSrv 7.57 7D85368 - 2216 - 2219 - 0x8A8 int BossEmotion; // - CORRETO - TMSrv 7.57 7D8536C - 2220 - 2223 - 0x8AC int ForceDamage; // - CORRETO - TMSrv 7.57 7D85370 - 2224 - 2227 - 0x8B0 int TmpSpeed; // - CORRETO - TMSrv 7.57 7D85374 - 2228 - 2231 - 0x8B4 int CurTime; // - CORRETO - TMSrv 7.57 7D85378 - 2232 - 2235 - 0x8B8 int QuestRegisterPos; // - CORRETO - TMSrv 7.57 7D8537C - 2236 - 2239 - 0x8BC Salva em qual posição vc registrou a pista - Usada tbm na guerra de torres!! int ServerKingdom; // - CORRETO - TMSrv 7.57 7D85380 - 2240 - 2243 - 0x8C0 int SpecialMobUnspawnTime; // - CORRETO - TMSrv 7.57 7D85384 - 2244 - 2247 - 0x8C4 Nome Provisório ate analizar melhor int mobAttackControl; // - CORRETO - TMSrv 7.57 7D85388 - 2248 - 2251 - 0x8C8 Controla quantas vezes o mob usara uma skill de area int enemyPosX; // - CORRETO - TMSrv 7.57 7D8538C - 2252 - 2255 - 0x8CC TargetX do alvo que sera atacado com skill int enemyPosY; // - CORRETO - TMSrv 7.57 7D85390 - 2256 - 2259 - 0x8D0 TargetY do alvo que sera atacado com skill int unk_7D85394; // - CONFIRMAR - TMSrv 7.57 7D85394 - 2260 - 2263 - 0x8D4 Inicializada no Construtor da CMob e checada na GetEnemyFromView! int CountHpDamage; // - CORRETO - TMSrv 7.57 7D85398 - 2264 - 2267 - 0x8D8 int countHP; // - CORRETO - TMSrv 7.57 7D8539C - 2268 - 2271 - 0x8DC int countMP; // - CORRETO - TMSrv 7.57 7D853A0 - 2272 - 2275 - 0x8E0 int PerfBonus; // - CORRETO - TMSrv 7.57 7D853A4 - 2276 - 2279 - 0x8E4 int AbsBonus; // - CORRETO - TMSrv 7.57 7D853A8 - 2280 - 2283 - 0x8E8 int unk_7D853AC; // - CONFIRMAR - TMSrv 7.57 7D853AC - 2284 - 2287 - 0x8EC Relacionado a itens premium com data int SummonType; // - CORRETO - TMSrv 7.57 7D853B0 - 2288 - 2291 - 0x8F0 int ItemUser; // - CORRETO - TMSrv 7.57 7D853B4 - 2292 - 2295 - 0x8F4 int ItemSummoner; // - CORRETO - TMSrv 7.57 7D853B8 - 2296 - 2299 - 0x8F8 short DamagePvP; // - CORRETO - TMSrv 7.57 7D853BC - 2300 - 2301 - 0x8FC short DefensePvP; // - CORRETO - TMSrv 7.57 7D853BE - 2302 - 2303 - 0x8FE unsigned short MobList[MAX_PARTY]; // - CORRETO - TMSrv 7.57 7D853C0 - 2304 - 2327 - 0x900 PartyList para as Evocações!! int nAffectInfo; // - CORRETO - TMSrv 7.57 7D853D8 - 2328 - 2331 - 0x918 /* //0 off - 1 on Bit 0 : Controle de Mana (1 << 0) Bit 1 : Imunidade (1 << 1) Bit 2 : Encantar Gelo (1 << 2) Bit 3 : Possuido (1 << 3) Bit 4 : Toxina da Serpente (1 << 4) Bit 5 : Evasão Aprimorada (1 << 5) Bit 6 : Invisibilidade (1 << 6) Bit 7 : Velocidade (1 << 7) Bit 8 : Immunity (1 << 8) Bit 9 : Cancel (1 << 9) Bit 10 : Frozen (1 << 10) Bit 11 : Invulnerable (1 << 11) Bit 12 : Flash (1 << 12) */ int nSkillDalay; // - CORRETO - TMSrv 7.57 7D853DC - 2332 - 2335 - 0x91C int Accuracy; // - CORRETO - TMSrv 7.57 7D853E0 - 2336 - 2339 - 0x920 int Evasion; // - CORRETO - TMSrv 7.57 7D853E4 - 2340 - 2343 - 0x924 public: //TMSrv 7.57 004CC7B0 CMob(); //TMSrv 7.57 004CCA00 ~CMob(); //TMSrv 7.57 004CCA30 void InitMob(); //TMSrv 7.57 004CCC00 void ProcessorSecTimer(); //TMSrv 7.57 004CCC30 int StandingByProcessor(); //TMSrv 7.57 004CD190 int BattleProcessor(); //TMSrv 7.57 004CD7D0 void AddEnemyList(short TargetId); //TMSrv 7.57 004CD8E0 void RemoveEnemyList(short TargetId); //TMSrv 7.57 004CD960 void SelectTargetFromEnemyList(); //TMSrv 7.57 004CDDF0 // 1:ShipMove 0:DeleteObject int SetSegment(); //TMSrv 7.57 004CE1C0 void GetCurrentScore(int conn); //TMSrv 7.57 004CFA60 void GetTargetPosDistance(int TargetId); //TMSrv 7.57 004CFDE0 void GetRandomPos(); //TMSrv 7.57 004D0080 void GetTargetPos(int TargetId); //TMSrv 7.57 004D0300 int CheckGetLevel(); //TMSrv 7.57 004D07E0 void GetNextPos(); //TMSrv 7.57 004D0AB0 int GetEnemyFromView(); //TMSrv 7.57 004D0DB0 int CheckLevelBlock(); //TMSrv 7.57 004D1020 int CheckPvPZone(); //TMSrv 7.57 004D1170 int CheckEvolution(); //TMSrv 7.57 004D2460 int CheckKhepra(); }; struct STRUCT_SUBCLASS { unsigned int LearnedSkill; // - CORRETO - TMSrv 7.57 7D84FF0 - 7D85050 - - - salva o Learn do celestial/subcelestial unsigned int nLearnedSkill; // - CORRETO - TMSrv 7.57 7D84FF4 - 7D85054 - - - salva o Learn2 do celestial/subcelestial STRUCT_ITEM Equip; // - CORRETO - TMSrv 7.57 7D84FF8 - 7D85058 - - - salva Face do personagem STRUCT_SCORE CurrentScore; // - CORRETO - TMSrv 7.57 7D85000 - 7D85060 - - - salva os Score long long Exp; // - CORRETO - TMSrv 7.57 7D85030 - 7D85090 - salva a Exp char ShortSkill[20]; // - CORRETO - TMSrv 7.57 7D85038 - 7D85098 - salva a SkilBar1[4] e a SkillBar2[16] unsigned short ScoreBonus; // - CORRETO - TMSrv 7.57 7D8504C - 7D850AC - salva os pontos de Score que ainda nao foram distribuidos unsigned short SkillBonus; // - CORRETO - TMSrv 7.57 7D8504E - 7D850AE - salva os pontos para compra de skills }; struct STRUCT_EXT1 { int Data[8]; STRUCT_AFFECT Affect[MAX_AFFECT]; }; struct STRUCT_EXT2 { char Quest[12]; unsigned int LastConnectTime; STRUCT_SUBCLASS SubClass[2]; char ItemPassWord[16]; unsigned int ItemPos; int SendLevItem; short AdminGuildItem; char Dummy[126]; }; struct STRUCT_MOB { char MobName[NAME_LENGTH]; //Nome do MOB/NPC/Player TMSrv 7.57 7D84AC0 char Clan; //Reino ou Grupo do MOB/NPC/Player TMSrv 7.57 7D84AD0 unsigned char Merchant; //Identificador da merchant TMSrv 7.57 7D84AD1 unsigned short Guild; //Identificador da Guild do MOB/NPC/Player TMSrv 7.57 7D84AD2 char Class; //Identificador da classe do MOB/NPC/Player TMSrv 7.57 7D84AD4 unsigned char Rsv; //AffectInfo TMSrv 7.57 7D84AD5 unsigned short Quest; //QuestInfo TMSrv 7.57 7D84AD6 int Coin; //Gold atual do MOB/NPC/Player TMSrv 7.57 7D84AD8 long long Exp; //Experiencia atual do MOB/NPC/Player TMSrv 7.57 7D84AE0 0x20 32 short HomeTownX; //Ultima posição X salva com a Gema Estelar TMSrv 7.57 7D84AE8 short HomeTownY; //Ultima posição Y salva com a Gema Estelar TMSrv 7.57 7D84AEA STRUCT_SCORE BaseScore; //Status base TMSrv 7.57 7D84AEC 0x2C 44 STRUCT_SCORE CurrentScore; //Status atual TMSrv 7.57 7D84B1C 0x5C 92 STRUCT_ITEM Equip[MAX_EQUIP]; //Itens equipados no personagem TMSrv 7.57 7D84B4C 0x8C 140 STRUCT_ITEM Inventory[MAX_INVENTORY]; //Itens do inventario TMSrv 7.57 7D84BCC unsigned int LearnedSkill; //Skills Aprendidas - Dividido em 4 categorias TMSrv 7.57 7D84DCC 0x30C 780 unsigned int nLearnedSkill; //Novas Skills - Dividido em 4 categorias TMSrv 7.57 7D84DD0 0x310 784 unsigned short ScoreBonus; //Pontos de Status (Str, Int, Dex, Con) TMSrv 7.57 7D84DD4 0x314 788 unsigned short SpecialBonus; //Pontos de Apreendizagem TMSrv 7.57 7D84DD6 0x316 790 unsigned short SkillBonus; //Pontos de Skill TMSrv 7.57 7D84DD8 0x318 792 unsigned char Critical; //Chance de Hits Criticos TMSrv 7.57 7D84DDA 0x31A 794 unsigned char SaveMana; // TMSrv 7.57 7D84DDB 0x31B 795 char SkillBar1[4]; //Salva o id de 4 skills da barra 1 //char SkillBar1[0]; TMSrv 7.57 7D84DDC //char SkillBar1[1]; TMSrv 7.57 7D84DDD //char SkillBar1[2]; TMSrv 7.57 7D84DDE //char SkillBar1[3]; TMSrv 7.57 7D84DDF char GuildLevel; //Identifica se o Player é membrou ou lider do clan TMSrv 7.57 7D84DE0 unsigned char RegenHP; //Regeneração de HP TMSrv 7.57 7D84DE2 0x322 802 unsigned char RegenMP; //Regeneração de MP TMSrv 7.57 7D84DE3 0x323 803 unsigned char dummy[206]; //Bytes reservados short Resist[4]; //Resistencias Sagrado - Trovão - Fogo - Gelo //short Resist[0]; TMSrv 7.57 7D84EB2 0x3F2 1010 //short Resist[1]; TMSrv 7.57 7D84EB4 0x3F4 1012 //short Resist[2]; TMSrv 7.57 7D84EB6 0x3F6 1014 //short Resist[3]; TMSrv 7.57 7D84EB8 0x3F8 1016 unsigned short Magic; //Multiplicador de dano magico TMSrv 7.57 7D84EBA 0x3FA 1018 short CurrentKill; //max 1200 TMSrv 7.57 7D84EBC 0x3FC 1020 short TotalKill; //max 20000 TMSrv 7.57 7D84EBE 0x3FE 1022 };
-
void ProcessShaman(int conn, int npcId) { int circleId = pMob[conn].MOB.Equip[PET].Index; int circleType = 0; int circleMode = 0; if (circleId == 448 || circleId == 449 || circleId == 450) { if (pMob[conn].MOB.Quest & 0x10) { SendClientMessage(npcId, TRUE, _NN_Youve_Done_It_Already); return; } circleType = circleId - 448; circleMode = 1; } else if (circleId == 693 || circleId == 694 || circleId == 695) { circleType = circleId - 693; circleMode = 2; } else { SendClientMessage(npcId, TRUE, _NN_Need_Pure_Divine); return; } int maxResetPoint = 50; if (circleMode == 2) maxResetPoint = 100; int specialPoints = pMob[conn].MOB.SpecialBonus; for (int i = 0; i < 4; i++) { if (pMob[conn].MOB.BaseScore.Special[i] > maxResetPoint) { specialPoints += maxResetPoint; pMob[conn].MOB.BaseScore.Special[i] -= maxResetPoint; } else { specialPoints += pMob[conn].MOB.BaseScore.Special[i]; pMob[conn].MOB.BaseScore.Special[i] = 0; } if (pMob[conn].MOB.BaseScore.Special[i] > 200) { int moreThan200 = pMob[conn].MOB.BaseScore.Special[i]; pMob[conn].MOB.BaseScore.Special[i] = 200; specialPoints = (moreThan200 + specialPoints) - 200; } } pMob[conn].MOB.SpecialBonus = specialPoints; if (circleType == 0) { pMob[conn].MOB.LearnedSkill &= 0xFFFFFF00; pMob[conn].MOB.nLearnedSkill &= 0xFF0; } if (circleType == 1) { pMob[conn].MOB.LearnedSkill &= 0xFFFF00FF; pMob[conn].MOB.nLearnedSkill &= 0xF0F; } if (circleType == 2) { pMob[conn].MOB.LearnedSkill &= 0xFF00FFFF; pMob[conn].MOB.nLearnedSkill &= 0x0FF; } BASE_GetBonusSkillPoint(&pMob[conn].MOB, pMob[conn].MobFace); memset(&pMob[conn].MOB.Equip[PET], 0, sizeof STRUCT_ITEM); SendItem(conn, EQUIP_TYPE, PET, &pMob[conn].MOB.Equip[PET]); SendEtc(conn); SetTick(conn, 44, 20, 20); //pode ser setaffect em algumas sources SendScore(conn); SendClientMessage(npcId, TRUE, _NN_Initialize_Skill); if (circleMode == 1) pMob[conn].MOB.Quest |= 0x10; else if(circleMode == 2) pMob[conn].MOB.Quest |= 0x20; SendClientMessage(conn, FALSE, _NN_Qest06Complete); sprintf_s(temp, "que,divice circle quest item:%d mode:%d type:%d", circleId, circleMode, circleType); Log(temp, pUser[conn].AccountName, pUser[conn].IP); MSG_SetSkillBar pSkillBar{}; pSkillBar.Header.Type = _MSG_SetSkillBar; pSkillBar.Header.ID = ESCENE_FIELD; pSkillBar.Header.Size = sizeof MSG_SetSkillBar; memcpy(pSkillBar.SkillBar1, pMob[conn].MOB.SkillBar1, 4); memcpy(pSkillBar.SkillBar2, pUser[conn].SkillBar2, 16); pUser[conn].cSock.AddMessage((char*)&pSkillBar, pSkillBar.Header.Size); } att
-
void ProcessGoldenDragon(int conn, int npcId, int future) { int ret = FALSE; if (pMob[conn].MOB.Equip[PET].Index == 4060) //Immaturity_Angel { int itemSanc = BASE_GetItemSanc(&pMob[conn].MOB.Equip[PET]); int sanc9plus = TRUE; if (itemSanc < 9) sanc9plus = FALSE; if (pMob[conn].Affect[MAX_AFFECT - 1].Type) sanc9plus = FALSE; if (pMob[conn].CheckEvolution() != ARCH) { sanc9plus = FALSE; SendClientMessage(conn, FALSE, _NN_Need_Trans); } if (sanc9plus) { STRUCT_ITEM item{}; item.Index = 5338; //Ideal item.EF1 = EF_NOTRADE; item.EFV1 = EF_NOTRADE; ret = SendPutItemInvCarry(conn, 0, &item); } //004F893D if (ret) { memset(&pMob[conn].MOB.Equip[PET], 0, sizeof STRUCT_ITEM); SendItem(conn, EQUIP_TYPE, PET, &pMob[conn].MOB.Equip[PET]); pMob[conn].Affect[MAX_AFFECT - 1].Type = 49; pMob[conn].Affect[MAX_AFFECT - 1].Level = 0; pMob[conn].Affect[MAX_AFFECT - 1].Time += 75600; pMob[conn].GetCurrentScore(conn); SendAffect(conn); SendClientMessage(conn, FALSE, _NN_Congratulations); } return; } //004F8A06 if(CombineTreasureMap(conn)) return; for (int i = 0; i < MAX_VISIBLE_INVENTORY; i++) { if (pMob[conn].MOB.Inventory[i].Index <= 0) continue; for (int j = 0; j < MAX_TREASURE; j++) { if (g_pTreasure[j].Source <= 0) continue; if (pMob[conn].MOB.Inventory[i].Index != g_pTreasure[j].Source) continue; //004F8ACF char tmpBuffer[128]{}; sprintf_s(temp, "tra,_gold_ 0"); BASE_GetItemCode(&pMob[conn].MOB.Inventory[i], tmpBuffer); strcat(temp, tmpBuffer); Log(temp, pUser[conn].AccountName, pUser[conn].IP); memset(&pMob[conn].MOB.Inventory[i], 0, sizeof STRUCT_ITEM); SendItem(conn, INVEN_TYPE, i, &pMob[conn].MOB.Inventory[i]); int sortItem = rand() % 1000; STRUCT_ITEM item{}; if (sortItem < g_pTreasure[j].Rate[0]) memcpy(&item, &g_pTreasure[j].Target[0], sizeof STRUCT_ITEM); else if (sortItem < g_pTreasure[j].Rate[1]) memcpy(&item, &g_pTreasure[j].Target[1], sizeof STRUCT_ITEM); else if (sortItem < g_pTreasure[j].Rate[2]) memcpy(&item, &g_pTreasure[j].Target[2], sizeof STRUCT_ITEM); else if (sortItem < g_pTreasure[j].Rate[3]) memcpy(&item, &g_pTreasure[j].Target[3], sizeof STRUCT_ITEM); else if (sortItem < g_pTreasure[j].Rate[4]) memcpy(&item, &g_pTreasure[j].Target[4], sizeof STRUCT_ITEM); if (!item.Index) { SendClientMessage(npcId, TRUE, _NN_Next_Chance); return; } sprintf_s(temp, "tra,%s 0", pUser[conn].AccountName); BASE_GetItemCode(&item, tmpBuffer); strcat(temp, tmpBuffer); Log(temp, "_gold_", pUser[conn].IP); if (PutItem(conn, &item)) { SendClientMessage(npcId, TRUE, _NN_Congratulations); return; } } } //004F8DCF int crystal[7]{}; int crystalCount = 0; for (int i = 0; i < MAX_VISIBLE_INVENTORY; i++) { if (pMob[conn].MOB.Inventory[i].Index < 421 || pMob[conn].MOB.Inventory[i].Index > 427) continue; crystal[pMob[conn].MOB.Inventory[i].Index - 421] = 1; crystalCount++; } //004F8E78 if (!crystal[0] || !crystal[1] || !crystal[2] || !crystal[3] || !crystal[4] || !crystal[5] || !crystal[6]) { SendClientMessage(npcId, TRUE, _NN_Gather_7_Clistals); return; } if(!pMob[conn].MOB.Inventory[WEAPON].Index) { SendClientMessage(npcId, TRUE, _NN_Equip_Weapon_To_Enchant); return; } if (pMob[conn].MOB.Inventory[WEAPON].Index >= 3000 && pMob[conn].MOB.Inventory[WEAPON].Index < 3200) { SendClientMessage(npcId, TRUE, _NN_Equip_Weapon_To_Enchant); return; } int weaponMobType = BASE_GetItemAbility(&pMob[conn].MOB.Inventory[WEAPON], EF_MOBTYPE); if (weaponMobType == ARCH || weaponMobType == CELESTIAL) { SendClientMessage(npcId, TRUE, _NN_NOT_TRANS3ITEM); return; } SendEmotion(conn, 23, 0); STRUCT_ITEM weapon = pMob[conn].MOB.Inventory[WEAPON]; STRUCT_ITEM tmpWeapon = weapon; int calcItemLvl = (crystalCount / 10) * 25; int itemReqLvl = g_pItemList[weapon.Index].ReqLvl; weapon.EF1 = 0; weapon.EFV1 = 0; weapon.EF2 = 0; weapon.EFV2 = 0; weapon.EF3 = 0; weapon.EFV3 = 0; SetItemBonus(&weapon, calcItemLvl + itemReqLvl, TRUE, 1104, FALSE); for (int i = 0; i < MAX_VISIBLE_INVENTORY; i++) { if (pMob[conn].MOB.Inventory[i].Index < 421 || pMob[conn].MOB.Inventory[i].Index > 427) continue; pMob[conn].MOB.Inventory[i].Index = 0; memset(&pMob[conn].MOB.Inventory[i], 0, sizeof STRUCT_ITEM); } SendCarry(conn); SendItem(conn, EQUIP_TYPE, WEAPON, &weapon); SendClientMessage(npcId, TRUE, _SN_Now_I_Will_Enchant_Your, pMob[conn].MOB.MobName); SetTick(conn, 44, 200, 200); SendScore(conn); sprintf_s(temp, "etc,crystal %d-%d from %d:%d %d:%d %d:%d to %d:%d %d:%d %d:%d", crystalCount, tmpWeapon.Index, tmpWeapon.EF1, tmpWeapon.EFV1, tmpWeapon.EF2, tmpWeapon.EFV2, tmpWeapon.EF3, tmpWeapon.EFV3, weapon.EF1, weapon.EFV1, weapon.EF2, weapon.EFV2, weapon.EF3, weapon.EFV3); Log(temp, pUser[conn].AccountName, pUser[conn].IP); }
-
Quando sobra um tempinho, nois aparece.
-
struct STRUCT_ICEQUEEN { int Timer; //TMSrv 7.57 61AA018 int CastleWaitingTime; //TMSrv 7.57 61AA01C int WaitingTime; //TMSrv 7.57 61AA020 int KillerLeader; //TMSrv 7.57 61AA024 }; //TMSrv 7.57 6471C8 CC int g_IceQueenRandSpawn[6][2] = { {3640, 2806}, {3615, 2789}, {3500, 2848}, {3513, 3008}, {3641, 3008}, {3745, 2978} }; //5A0F0C - 6471F8 int IceQueenState = 1; //Variavel Global de Controle //TMSrv 7.57 61AA018 STRUCT_ICEQUEEN g_pIceQueenQuest; //TMSrv 7.57 00588BD0 void ProcessIceQueenMobKilled(int killer, int target) //Função Ok { int targetGenIndex = pMob[target].GenerateIndex; if (IceQueenState == 1 && targetGenIndex == 155) //IceQueenMirror { int ptLeaderId = CheckIceQueenParty(killer); g_pIceQueenQuest.KillerLeader = ptLeaderId; if (!IsPlayer(g_pIceQueenQuest.KillerLeader)) return; for (int i = 0; i < 29; i++) GenerateMob(5454 + i, 0, 0); g_pIceQueenQuest.CastleWaitingTime = 1800; IceQueenState = 2; } //00588C89 else if (IceQueenState == 2 && targetGenIndex >= 5454 && targetGenIndex <= 5482) { int haveMob = CheckIceQueenCurNumMob(); if (!haveMob) return; GenerateMob(149, 0, 0); //DarkShadow SendClientMessage(g_pIceQueenQuest.KillerLeader, FALSE, _ND_GenDarkShadow); for (int i = 0; i < MAX_PARTY; i++) { int ptMember = pMob[g_pIceQueenQuest.KillerLeader].PartyList[i]; if (ptMember <= MOB_EMPTY || ptMember >= MAX_USER) continue; SendClientMessage(ptMember, FALSE, _ND_GenDarkShadow); } IceQueenState = 3; } //00588D4E else if (IceQueenState == 3 && targetGenIndex == 149) //DarkShadow { int ptLeaderId = CheckIceQueenParty(killer); if (ptLeaderId != g_pIceQueenQuest.KillerLeader) { IceQueenState = 1; ResetIceQueenQuest(); return; } QuestInitTeleportGroup(g_pIceQueenQuest.KillerLeader, 3859, 2882); GenerateMob(154, 0, 0); IceQueenState = 4; } //00588DC6 else if (IceQueenState == 4 && targetGenIndex == 154) //IceQueenVerid { if (rand() % 2) g_pIceQueenQuest.WaitingTime = 28800; //a quest ocorre a cada 8 horas else g_pIceQueenQuest.WaitingTime = 43200; //ou a cada 12 horas IceQueenState = 5; sprintf(temp, "etc, IceQueen killer %s", pMob[killer].MOB.MobName); Log(temp, "system", 0); ResetIceQueenQuest(); } } //TMSrv 7.57 00588EA0 int CheckIceQueenCurNumMob() //Função Ok { for (int i = 0; i < 29; i++) { int curMob = mNPCGen.pList[5454 + i].CurrentNumMob; if (curMob > MOB_EMPTY) return FALSE; } return TRUE; } //TMSrv 7.57 00588F10 void InitIceQueenQuest() //Função Ok { g_pIceQueenQuest.Timer = 1200; int spawnPosition = rand() % 6; int curIceQueenGen = mNPCGen.pList[155].CurrentNumMob; if (curIceQueenGen <= 0) { GenerateMob(155, g_IceQueenRandSpawn[spawnPosition][0], g_IceQueenRandSpawn[spawnPosition][1]); return; } int specialMobId = SummonedSpecialMobList[9]; //IceQueenMirror if (specialMobId <= 0) return; if (!pMob[specialMobId].Mode || pMob[specialMobId].Mode == MOB_COMBAT) return; DoTeleport(specialMobId, g_IceQueenRandSpawn[spawnPosition][0], g_IceQueenRandSpawn[spawnPosition][1], FALSE); pMob[specialMobId].LastX = g_IceQueenRandSpawn[spawnPosition][0]; pMob[specialMobId].TargetX = pMob[specialMobId].LastX; pMob[specialMobId].SegmentX = pMob[specialMobId].TargetX; pMob[specialMobId].SegmentListY[0] = pMob[specialMobId].SegmentX; pMob[specialMobId].LastY = g_IceQueenRandSpawn[spawnPosition][1]; pMob[specialMobId].TargetY = pMob[specialMobId].LastY; pMob[specialMobId].SegmentY = pMob[specialMobId].TargetY; pMob[specialMobId].SegmentListX[0] = pMob[specialMobId].SegmentY; for (int i = 1; i < MAX_SEGMENT; i++) { pMob[specialMobId].SegmentListX[i] = (rand() % 5) + g_IceQueenRandSpawn[spawnPosition][0] - 2; pMob[specialMobId].SegmentListY[i] = (rand() % 5) + g_IceQueenRandSpawn[spawnPosition][1] - 2; } } //TMSrv 7.57 00589160 void ResetIceQueenQuest() //Função Ok { if (g_pIceQueenQuest.KillerLeader) { int posX = (rand() % 5) + 3657; int posY = (rand() % 5) + 3128; QuestInitTeleportGroup(g_pIceQueenQuest.KillerLeader, posX, posY); } if (mNPCGen.pList[154].Mode) //IceQueenVerid DeleteMobGenerateId(154, DELETE_UNSPAWN); if (mNPCGen.pList[155].Mode) //IceQueenMirror DeleteMobGenerateId(155, DELETE_UNSPAWN); if (mNPCGen.pList[149].Mode) //DarkShadow DeleteMobGenerateId(149, DELETE_UNSPAWN); for (int i = 0; i < 29; i++) { int curMob = mNPCGen.pList[5454 + i].CurrentNumMob; if (curMob > MOB_EMPTY) DeleteMobGenerateId(5454 + i, DELETE_UNSPAWN); } g_pIceQueenQuest.Timer = 0; g_pIceQueenQuest.CastleWaitingTime = 0; } //TMSrv 7.57 00589280 int CheckIceQueenParty(int conn) //Função Ok { int leader = pMob[conn].Leader; if (leader <= MOB_EMPTY) leader = conn; for (int i = 0; i < MAX_PARTY; i++) { int ptMember = pMob[leader].PartyList[i]; if (IsPlayer(ptMember)) break; } return leader; } //ProcessSecTimer //00563A20 if (IceQueenState == 1) //IceQueen Quest { if (g_pIceQueenQuest.Timer > 0) g_pIceQueenQuest.Timer--; else InitIceQueenQuest(); } else if (IceQueenState == 2 || IceQueenState == 3 || IceQueenState == 4) { if (g_pIceQueenQuest.CastleWaitingTime > 0) g_pIceQueenQuest.CastleWaitingTime--; else { ResetIceQueenQuest(); IceQueenState = 1; } } else if (IceQueenState == 5) { if (g_pIceQueenQuest.WaitingTime > 0) g_pIceQueenQuest.WaitingTime--; else { InitIceQueenQuest(); IceQueenState = 1; } } //MobKilled //004BDA26 - 0056FD17 if (ptMemberCount <= 0 || ptMemberCount > MAX_PARTY + 1 || ptLevelCount <= 0) { GridMulticast(pMob[target].TargetX, pMob[target].TargetY, (MSG_STANDARD*)&pMobKill, FALSE); DeleteMob(target, DELETE_DEAD); if (IceQueenState) ProcessIceQueenMobKilled(killer, target); return; } //Final da MobKilled if (IceQueenState) ProcessIceQueenMobKilled(killer, target);
- 3 respostas
-
- 46