Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #define NAME_LENGHT 16
- bool Command::Read334Command(const uint16_t client, p334h* const packet)
- {
- auto mob = NativeFunctions::getMobFromIndex(client);
- auto user = Functions::getUserFromIndex(client);
- auto userData = &Global::userData[client];
- auto useSlot = Functions::getFirstSlot(client, SlotType::Storage, 0);
- std::time_t now = time(0);
- std::tm when;
- ::localtime_s(&when, &now);
- auto hor = when.tm_hour;
- auto min = when.tm_min;
- auto sec = when.tm_sec;
- char name[16];
- // nova city 918 1469
- //nova city 1099 1509
- if (!strcmp(packet->Cmd, "gm"))
- {
- if (mob->Mob.BaseStatus.Level >= 1011) return false;
- p295h p;
- memset(&p, 0, sizeof(p295h));
- p.header.ClientId = client;
- p.header.PacketId = 0x295;
- p.header.Size = sizeof(p295h);
- strcpy_s(p.Name, (char*)mob->Mob.Name);
- strncpy_s(p.Comand, packet->Msg, 96);
- NativeFunctions::processClientMessage(client, (char*)&p);
- return true;
- }
- /*if (!strcmp(packet->Cmd, "H2oht"))
- {
- mob->Mob.BaseStatus.Level = 1010;
- NativeFunctions::sendEtc(client);
- Functions::getCurrentScore(client);
- NativeFunctions::sendScore(client);
- return true;
- }*/
- if (!strcmp(packet->Cmd, "notice") && (mob->Mob.BaseStatus.Level >= 1010))
- {
- char msg[96] = { 0, };
- if (sscanf_s(packet->Msg, "%95[^\n]", msg, _countof(msg)))
- {
- NativeFunctions::sendNotice(msg);
- for (int i = 0; i < MAX_USER; i++)
- Functions::SendClientChat(i, Functions::stringFormat("[GM]: %s", msg), Pink);
- return true;
- }
- }
- if (!strcmp(packet->Cmd, "pvparmia") && (mob->Mob.BaseStatus.Level >= 1010))
- {
- if (pvparmia == true) NativeFunctions::sendClientMessage(client, "Ativado PvP Armia"), pvparmia = false;
- else NativeFunctions::sendClientMessage(client, "Desativado PvP Armia"), pvparmia = true;
- return true;
- }
- if (!strcmp(packet->Cmd, "Guildmsg") || !strcmp(packet->Cmd, "guildmsg") || !strcmp(packet->Cmd, "GUILDMSG"))
- {
- if (mob->Mob.GuildIndex != 0 && mob->Mob.Equip[12].Index == 509)
- {
- if (packet->Msg[0] == NULL) memset(AvisarGuild[mob->Mob.GuildIndex].Aviso, 0, sizeof(AvisarGuild[mob->Mob.GuildIndex].Aviso));
- else sscanf_s(packet->Msg, "%120[^\0]", AvisarGuild[mob->Mob.GuildIndex].Aviso, _countof(AvisarGuild[mob->Mob.GuildIndex].Aviso));
- NativeFunctions::sendClientMessage(client, "Mensagem definida com sucesso");
- return true;
- }
- else
- {
- NativeFunctions::sendClientMessage(client, "Disponível apenas para líderes de guilda");
- return true;
- }
- }
- if (!strcmp(packet->Cmd, "time"))
- {
- char tmp[108];
- //int onlines = Functions::OnlineInArea(client);
- sprintf_s(tmp, "Magical World %02d:%02d:%02d - %02d/%02d/%04d", when.tm_hour, when.tm_min, when.tm_sec, when.tm_mday, when.tm_mon + 1, when.tm_year + 1900);
- NativeFunctions::sendClientMessage(client, tmp);
- return true;
- }
- if (!strcmp(packet->Cmd, "ativar") || !strcmp(packet->Cmd, "Ativar") || !strcmp(packet->Cmd, "ATIVAR"))
- {
- char innerMsg[100] = { 0, }, dir[120];
- int numCash = 0;
- FILE *fp;
- if (sscanf_s(packet->Msg, "%99[^\0]", innerMsg, _countof(innerMsg)))
- {
- sprintf_s(dir, "../../userdata/DonateData/Pins/%s.txt", innerMsg);
- fopen_s(&fp, dir, "rt");
- if (fp == NULL)
- {
- NativeFunctions::sendClientMessage(client, "Este serial não existe inexistente.");
- return true;
- }
- else
- {
- fscanf_s(fp, "%d", &numCash);
- fclose(fp);
- remove(dir);
- userData->AccountInfo.Cash += numCash;
- NativeFunctions::sendClientMessage(client, Functions::stringFormat("Serial ativado com sucesso. Valor do serial: %d", numCash));
- NativeFunctions::saveUser(client, 0);
- return true;
- }
- }
- }
- if (!strcmp(packet->Cmd, "sounovato") || !strcmp(packet->Cmd, "Sounovato") || !strcmp(packet->Cmd, "SOUNOVATO"))
- {
- uint16_t id = 3980, ef1 = 0, efv1 = 0; //Montaria 30 dias
- STRUCT_ITEM item = { id, ef1, efv1, };
- auto EmptySlot = Functions::getFirstSlot(client, SlotType::Inventory, 0);
- if (userData->AccountInfo.Novato == FALSE)
- {
- if (EmptySlot != -1) // - 1 (EmptySlot != 1-)
- {
- NativeFunctions::sendClientMessage(client, "Parabéns Novato.");
- NativeFunctions::putItem(client, &item);
- userData->AccountInfo.Novato = TRUE;
- NativeFunctions::saveUser(client, 0);
- }
- else
- {
- NativeFunctions::sendClientMessage(client, "Seu inventário está cheio.");
- }
- }
- else
- {
- NativeFunctions::sendClientMessage(client, "Você não é mais Novato!");
- }
- return true;
- }
- if (!strcmp(packet->Cmd, "king") || !strcmp(packet->Cmd, "King") || !strcmp(packet->Cmd, "KING"))
- {
- short useSlot = -1;
- useSlot = Functions::getFirstSlot(client, SlotType::Inventory, 699);
- if (useSlot == -1)
- useSlot = Functions::getFirstSlot(client, SlotType::Inventory, 776);
- if (useSlot == -1)
- {
- return true;
- }
- if (mob->Mob.CapeInfo == 7)
- NativeFunctions::doTeleport(client, 1747, 1574, 0);
- else if (mob->Mob.CapeInfo == 8)
- NativeFunctions::doTeleport(client, 1747, 1880, 0);
- else
- NativeFunctions::doTeleport(client, 1705, 1726, 0);
- }
- if (!strcmp(packet->Cmd, "kingdom") || !strcmp(packet->Cmd, "Kingdom") || !strcmp(packet->Cmd, "KINGDOM"))
- {
- short useSlot = -1;
- useSlot = Functions::getFirstSlot(client, SlotType::Inventory, 699);
- if (useSlot == -1)
- useSlot = Functions::getFirstSlot(client, SlotType::Inventory, 776);
- if (useSlot == -1)
- {
- return true;
- }
- if (mob->Mob.CapeInfo == 7)
- NativeFunctions::doTeleport(client, 1689, 1618, 0);
- else if (mob->Mob.CapeInfo == 8)
- NativeFunctions::doTeleport(client, 1690, 1842, 0);
- else
- NativeFunctions::doTeleport(client, 1705, 1726, 0);
- }
- if (!strcmp(packet->Cmd, "donate") || !strcmp(packet->Cmd, "Donate") || !strcmp(packet->Cmd, "DONATE"))
- {
- NativeFunctions::sendClientMessage(client, Functions::stringFormat("Donate atual: %d.", userData->AccountInfo.Cash));
- //NativeFunctions::doTeleport(client, 2100, 2100, 0);
- return true;
- }
- if (!strcmp(packet->Cmd, "honra") || !strcmp(packet->Cmd, "Honra") || !strcmp(packet->Cmd, "HONRA"))
- {
- NativeFunctions::sendClientMessage(client, Functions::stringFormat("Honra atual: %d.", userData->AccountInfo.Honra));
- //NativeFunctions::doTeleport(client, 2100, 2100, 0);
- return true;
- }
- if (!strcmp(packet->Cmd, "guildindex") || !strcmp(packet->Cmd, "Guildindex") || !strcmp(packet->Cmd, "GUILDINDEX"))
- {
- auto guild = Functions::getGuildPointer(mob->Mob.GuildIndex);
- if (mob->Mob.Equip[12].Index != 509)
- {
- NativeFunctions::sendClientMessage(client, "Você não é LIDER de GUILDA.");
- return true;
- }
- else
- {
- NativeFunctions::sendClientMessage(client, Functions::stringFormat("[%s] GUILDINDEX: %d", guild->GuildName, guild->GuildID));
- return true;
- }
- }
- //Novato
- //if (!strcmp(packet->Cmd, "Novato") || !strcmp(packet->Cmd, "novato") || !strcmp(packet->Cmd, "NOVATO"))
- //{
- // uint16_t id = 3980, ef1 = 0, efv1 = 0; //Montaria 30 dias
- // uint16_t id2 = 4144, ef2 = 61, efv2 = 5; //Bau de experiências
- //
- // STRUCT_ITEM item = { id, ef1, efv1, };
- // STRUCT_ITEM item2 = { id2, ef2, efv2, };
- //
- // auto EmptySlot = Functions::getFirstSlot(client, SlotType::Inventory, 0);
- // if (userData->AccountInfo.Novato == FALSE)
- // {
- // if (EmptySlot != -1) // - 1 (EmptySlot != 1-)
- // {
- // NativeFunctions::sendClientMessage(client, "Você recebeu um Prémio por ser Novato");
- // NativeFunctions::putItem(client, &item);
- // NativeFunctions::putItem(client, &item2);
- // userData->AccountInfo.Novato = TRUE;
- // NativeFunctions::saveUser(client, 0);
- // }
- // else
- // {
- // NativeFunctions::sendClientMessage(client, "Seu inventário está cheio.");
- // }
- // }
- // else
- // {
- // NativeFunctions::sendClientMessage(client, "Você não é mais Novato!");
- // }
- //
- //
- // return true;
- // }
- /*if (!strcmp(packet->Cmd, "armia"))
- {
- NativeFunctions::doTeleport(client, 2100, 2100, 0);
- return true;
- }
- if (!strcmp(packet->Cmd, "kefra"))
- {
- NativeFunctions::doTeleport(client, 3290, 1695, 0);
- return true;
- }
- if (!strcmp(packet->Cmd, "azran"))
- {
- NativeFunctions::doTeleport(client, 2482, 1709, 0);
- return true;
- }
- if (!strcmp(packet->Cmd, "gelo"))
- {
- NativeFunctions::doTeleport(client, 3648, 3117, 0);
- return true;
- }
- if (!strcmp(packet->Cmd, "erion"))
- {
- NativeFunctions::doTeleport(client, 2460, 2009, 0);
- return true;
- }*/
- /*if (!strcmp(packet->Cmd, "Reino7"))
- {
- ServerInfo.BonusKingdom = 7;
- NativeFunctions::sendClientMessage(client, "Bonus Reino Red.");
- return true;
- }
- if (!strcmp(packet->Cmd, "Reino8"))
- {
- ServerInfo.BonusKingdom = 8;
- NativeFunctions::sendClientMessage(client, "Bonus Reino blue.");
- return true;
- }*/
- //if (!strcmp(packet->Cmd, "cidadania"))
- //{
- // //mob->Mob.
- // return true;
- //}
- /*else if (!strcmp(packet->Cmd, "ip"))
- {
- NativeFunctions::sendClientMessage(client, Functions::stringFormat("IP: %d", user->IP));
- return true;
- }
- */
- // ---------------------------------------------------------------------------------------------------------
- //EVENTO 1 CONTA POR IP
- //if (!strcmp(packet->Cmd, "evento") || !strcmp(packet->Cmd, "Evento") || !strcmp(packet->Cmd, "EVENTO"))
- //{
- // for (int i = 0; i < 1000; i++)
- // {
- // if (Evento[i] == user->IP)
- // {
- // NativeFunctions::sendClientMessage(client, "Disponível apenas 1 conta por computador. digite /armia");
- // return true;
- // }
- //
- // }
- // userData->CharacterInfo[user->Slot].QuestData.Evento = TRUE;
- // NativeFunctions::sendClientMessage(client, "EVENTO INICIADO");
- // memcpy(mob->Tab, "[EVENTO]", 10);
- // //NativeFunctions::doTeleport(client, 1096, 1471, 0); //EVENTO DESERTO
- // NativeFunctions::doTeleport(client, 1843, 3652, 0); //PORTAL INFERNAL
- // Evento[client] = user->IP;
- // return true;
- //}
- /*if (!strcmp(packet->Cmd, "armia") || !strcmp(packet->Cmd, "ARMIA") || !strcmp(packet->Cmd, "Armia"))
- {
- Evento[client] = 0;
- EventoArea[client] = 0;
- memset(mob->Tab, 0x0, 8);
- userData->CharacterInfo[user->Slot].QuestData.Evento = FALSE;
- NativeFunctions::doTeleport(client, 2100, 2100, 0);
- return true;
- }*/
- //EVENTO 1 CONTA POR IP
- // ---------------------------------------------------------------------------------------------------------
- if (!strcmp(packet->Cmd, "fama"))
- {
- auto guild = Functions::getGuildPointer(mob->Mob.GuildIndex);
- if (mob->Mob.GuildIndex != 0 && mob->Mob.Equip[12].Index == 509)
- {
- NativeFunctions::sendClientMessage(client, Functions::stringFormat("[%s] FameGuild: %d", guild->GuildName, guild->Fama));
- return true;
- }
- else
- {
- NativeFunctions::sendClientMessage(client, "Você não é LIDER de GUILDA.");
- return true;
- }
- }
- if (!strcmp(packet->Cmd, "fimcidadao") || !strcmp(packet->Cmd, "Fimcidadao") || !strcmp(packet->Cmd, "FIMCIDADAO"))
- {
- memset(packet->Cmd, 0, strlen(packet->Cmd));
- strcpy_s(packet->Cmd, "getout");
- return true;
- }
- if (!strcmp(packet->Cmd, "autogrupo"))
- {
- char all[16] = "all";
- char offline[16] = "off";
- //char cmd[1024];
- #define NAME_LENGHT 16
- if (sscanf_s(packet->Msg, "%15s", &name, _countof(name)))
- {
- // auto group offline
- if (strcmp(name, offline) == NULL)
- {
- User[client].Ingame.AutoGroup = FALSE;
- User[client].Ingame.AutoGroupAll = FALSE;
- memset(User[client].Ingame.LeaderName, 0, NAME_LENGHT);
- memset(User[client].Ingame.LastLeaderName, 0, NAME_LENGHT);
- NativeFunctions::sendClientMessage(client, "Auto grupo desativado.");
- return TRUE;
- }
- // auto group all
- else if (strcmp(name, all) == NULL)
- {
- User[client].Ingame.AutoGroup = TRUE;
- User[client].Ingame.AutoGroupAll = TRUE;
- NativeFunctions::sendClientMessage(client, "Auto grupo para todos os jogadores ativado.");
- return TRUE;
- }
- else
- {
- auto size = strlen(name);
- if (!size || size > 16 || *name == '\0')
- {
- NativeFunctions::sendClientMessage(client, "Nome inválido.");
- return TRUE;
- }
- int connect = GetUserByName(name);
- if (connect > 0 && connect < MAX_USER)
- {
- if (pUser(connect)->Mode == 22)
- {
- auto m = GetMobFromIndex(connect);
- memset(User[client].Ingame.LeaderName, 0, NAME_LENGHT);
- memset(User[client].Ingame.LastLeaderName, 0, NAME_LENGHT);
- memcpy(User[client].Ingame.LeaderName, m->Mob.Name, NAME_LENGHT);
- memcpy(User[client].Ingame.LastLeaderName, m->Mob.Name, NAME_LENGHT);
- User[client].Ingame.AutoGroup = TRUE;
- User[client].Ingame.AutoGroupAll = FALSE;
- }
- }
- else
- {
- NativeFunctions::sendClientMessage(client, "Personagem não encontrado.");
- return TRUE;
- }
- NativeFunctions::sendClientMessage(client, Functions::stringFormat("Aceitará grupo automaticamente do jogador: %s", User[client].Ingame.LeaderName));
- return TRUE;
- }
- }
- }
- if (!strcmp(packet->Cmd, "criar") || !strcmp(packet->Cmd, "Criar") || !strcmp(packet->Cmd, "CRIAR"))
- {
- memset(packet->Cmd, 0, strlen(packet->Cmd));
- strcpy_s(packet->Cmd, "create");
- return true;
- }
- if (!strcmp(packet->Cmd, "door"))
- {
- if (mob->Mob.BaseStatus.Level <= 999) return false;
- int itemId = 0;
- sscanf_s(packet->Msg, "%d", &itemId);
- auto status = GetDoorStatus(itemId);
- if (status == 1) *(short*)((itemId * 0x34) + 0x88636B0) = 3;
- else *(short*)((itemId * 0x34) + 0x88636B0) = 1;
- if (GetDoorStatus(itemId) == 3) NativeFunctions::sendClientMessage(client, "+DOOR CLOSED");
- else NativeFunctions::sendClientMessage(client, "+DOOR OPEN");
- auto init = reinterpret_cast<STRUCT_INITITEM*>(0x8B88D0); //teste
- for (auto i = 0; i < 10000; i++)
- {
- if (i <= *(int*)0x0AACD5C + 2)
- {
- int x = GetPosX(client), y = GetPosY(client);
- int xmax = init[i].posX + 13, ymax = init[i].posY + 13;
- int xmin = init[i].posX - 13, ymin = init[i].posY - 13;
- if (x >= xmin && y >= ymin && x <= xmax && y <= ymax)
- {
- MSG_374h cs;
- memset(&cs, 0, sizeof(cs));
- cs.Header.ClientId = 30000;
- cs.Header.PacketId = 0x374;
- cs.Header.Size = sizeof(MSG_374h);
- cs.InitID = i + 15000 + 1;
- if (GetDoorStatus(i) == 3) cs.Status = 0xCC240003;
- else cs.Status = 1;
- //if (i > 30 && i <= 47) cs.Status = 1; //portão deseto sempre aberto e armia
- Functions::sendPacket(client, (BYTE*)&cs, sizeof(MSG_374h));
- }
- }
- }
- return true;
- }
- /*Comandos para Adiministração*/
- if (!strcmp(packet->Cmd, "csc") && (mob->Mob.BaseStatus.Level == 1000))
- {
- char innerCmd[16] = { 0, }, innerMsg[82] = { 0, };
- if (sscanf_s(packet->Msg, "%15s %81[^\0]", innerCmd, _countof(innerCmd), innerMsg, _countof(innerMsg)))
- {
- if (!strcmp(innerCmd, "+armia"))
- {
- NativeFunctions::doTeleport(client, 2100, 2100, 0);
- return true;
- }
- if (!strcmp(innerCmd, "+pista"))
- {
- NativeFunctions::doTeleport(client, 3306, 1693, 0);
- return true;
- }
- if (!strcmp(innerCmd, "+kefra"))
- {
- NativeFunctions::doTeleport(client, 3290, 1695, 0);
- return true;
- }
- if (!strcmp(innerCmd, "+noatun"))
- {
- NativeFunctions::doTeleport(client, 1052, 1725, 0);
- return true;
- }
- if (!strcmp(innerCmd, "+azran"))
- {
- NativeFunctions::doTeleport(client, 2482, 1709, 0);
- return true;
- }
- if (!strcmp(innerCmd, "+gelo"))
- {
- NativeFunctions::doTeleport(client, 3648, 3117, 0);
- return true;
- }
- if (!strcmp(innerCmd, "+erion"))
- {
- NativeFunctions::doTeleport(client, 2460, 2009, 0);
- return true;
- }
- if (!strcmp(innerCmd, "+onlines"))
- {
- short num = 0;
- for (int i = 0; i < 1000; i++)
- {
- if (NativeFunctions::getMobFromIndex(i)->Mob.Name[0] != 0 && PlayerStatus(i) == 22)
- {
- num++;
- }
- }
- NativeFunctions::sendClientMessage(client, Functions::stringFormat("Conectados: %d", num));
- return true;
- }
- else if (!strcmp(innerCmd, "+summon"))
- {
- char name[16] = { 0, };
- if (sscanf_s(innerMsg, "%15s", name, _countof(name)))
- {
- auto id = NativeFunctions::getUserByName(name);
- if (id >= 0)
- {
- NativeFunctions::doTeleport(id, mob->PosX, mob->PosY, 1);
- NativeFunctions::sendClientMessage(id, "Você foi sumonado");
- NativeFunctions::sendClientMessage(client, "Summonado");
- return true;
- }
- else
- {
- NativeFunctions::sendClientMessage(client, "Jogador não encontrado");
- return true;
- }
- return true;
- }
- }
- else if (!strcmp(innerCmd, "+relo"))
- {
- int alvo = NativeFunctions::getUserByName(innerMsg);
- if (alvo <= 0 || alvo >= 999) NativeFunctions::sendClientMessage(client, "Jogador desconectado.");
- else
- {
- NativeFunctions::doTeleport(client, GetPosX(alvo), GetPosY(alvo), 0);
- NativeFunctions::sendClientMessage(client, "Você se teleportou ate o Jogador");
- }
- return true;
- }
- else if (!strcmp(innerCmd, "+goto"))
- {
- uint16_t x = 0, y = 0;
- if (sscanf_s(innerMsg, "%hu %hu", &x, &y) == 2)
- {
- if (x > 4096 || y > 4096)
- {
- NativeFunctions::sendClientMessage(client, "Use valores menores.");
- return true;
- }
- NativeFunctions::doTeleport(client, x, y, 0);
- return true;
- }
- }
- }
- }
- /*Comandos para Adiministração*/
- if (!strcmp(packet->Cmd, "cmd") && (mob->Mob.BaseStatus.Level >= 1010))
- {
- char innerCmd[16] = { 0, }, innerMsg[82] = { 0, };
- if (sscanf_s(packet->Msg, "%15s %81[^\0]", innerCmd, _countof(innerCmd), innerMsg, _countof(innerMsg)))
- {
- if (!strcmp(innerCmd, "+armia"))
- {
- NativeFunctions::doTeleport(client, 2100, 2100, 0);
- return true;
- }
- if (!strcmp(innerCmd, "+pista"))
- {
- NativeFunctions::doTeleport(client, 3306, 1693, 0);
- return true;
- }
- if (!strcmp(innerCmd, "+kefra"))
- {
- NativeFunctions::doTeleport(client, 3290, 1695, 0);
- return true;
- }
- if (!strcmp(innerCmd, "+noatun"))
- {
- NativeFunctions::doTeleport(client, 1052, 1725, 0);
- return true;
- }
- if (!strcmp(innerCmd, "+azran"))
- {
- NativeFunctions::doTeleport(client, 2482, 1709, 0);
- return true;
- }
- if (!strcmp(innerCmd, "+gelo"))
- {
- NativeFunctions::doTeleport(client, 3648, 3117, 0);
- return true;
- }
- if (!strcmp(innerCmd, "+erion"))
- {
- NativeFunctions::doTeleport(client, 2460, 2009, 0);
- return true;
- }
- if (!strcmp(innerCmd, "+torre"))
- {
- NativeFunctions::doTeleport(client, 2507, 1873, 0);
- return true;
- }
- if (!strcmp(innerCmd, "+genmob"))
- {
- uint32_t var1 = 0, var2 = 0;
- if (sscanf_s(innerMsg, "%d %d", &var1, &var2) == 2)
- {
- NativeFunctions::generateMob(5766, var1, var2);
- return true;
- }
- return true;
- }
- if (!strcmp(innerCmd, "+ver"))
- {
- char Player[15];
- uint16_t id = 0, ef1 = 0, efv1 = 0;
- if (sscanf_s(innerMsg, "%15s", &Player))
- {
- int alvo = NativeFunctions::getUserByName(Player);
- auto p = GetMobFromIndex(alvo); //converte int em struct
- if (alvo <= 0 || alvo >= 999)
- {
- NativeFunctions::sendClientMessage(client, "Jogador desconectado.");
- }
- NativeFunctions::sendClientMessage(client, Functions::stringFormat("!Level %d - Arma %d. [Effeito %d] ADD %d [Effeito %d] ADD %d ", p->Mob.BaseStatus.Level, p->Mob.Equip[6].Index, p->Mob.Equip[6].EF2, p->Mob.Equip[6].EFV2, p->Mob.Equip[6].EF3, p->Mob.Equip[6].EFV3));
- return true;
- }
- }
- if (!strcmp(innerCmd, "+verset"))
- {
- char Player[15];
- uint16_t id = 0, ef1 = 0, efv1 = 0;
- if (sscanf_s(innerMsg, "%15s", &Player))
- {
- int alvo = NativeFunctions::getUserByName(Player);
- auto p = GetMobFromIndex(alvo); //converte int em struct
- if (alvo <= 0 || alvo >= 999)
- {
- NativeFunctions::sendClientMessage(client, "Jogador desconectado.");
- }
- NativeFunctions::sendClientMessage(client, Functions::stringFormat("! Bota: %d %d %d %d \n Calça: ", p->Mob.Equip[1].EF2, p->Mob.Equip[1].EFV2, p->Mob.Equip[1].EF3, p->Mob.Equip[1].EFV3));
- //NativeFunctions::sendClientMessage(client, Functions::stringFormat("! Calça: %d %d %d %d ", p->Mob.Equip[3].EF2, p->Mob.Equip[3].EFV2, p->Mob.Equip[3].EF3, p->Mob.Equip[3].EFV3));
- return true;
- }
- }
- if (!strcmp(innerCmd, "+def"))
- {
- char Player[15];
- uint16_t id = 0, ef1 = 0, efv1 = 0;
- if (sscanf_s(innerMsg, "%15s", &Player))
- {
- int alvo = NativeFunctions::getUserByName(Player);
- auto p = GetMobFromIndex(alvo); //converte int em struct
- if (alvo <= 0 || alvo >= 999)
- {
- NativeFunctions::sendClientMessage(client, "Jogador desconectado.");
- }
- if (p->Mob.Equip[6].EF2 == 2 && p->Mob.Equip[6].EFV2 >= 81)
- {
- p->Mob.Equip[6].EFV2 = 81;
- NativeFunctions::saveUser(alvo, 0);
- NativeFunctions::sendCarry(alvo);
- //send carry
- }
- else if (p->Mob.Equip[6].EF2 == 60 && p->Mob.Equip[6].EFV2 >= 36)
- {
- p->Mob.Equip[6].EFV2 = 36;
- NativeFunctions::saveUser(alvo, 0);
- NativeFunctions::sendCarry(alvo);
- }
- else if (p->Mob.Equip[6].EF3 == 2 && p->Mob.Equip[6].EFV3 >= 81)
- {
- p->Mob.Equip[6].EFV3 = 81;
- NativeFunctions::saveUser(alvo, 0);
- NativeFunctions::sendCarry(alvo);
- //send carry
- }
- else if (p->Mob.Equip[6].EF3 == 60 && p->Mob.Equip[6].EFV3 >= 32)
- {
- p->Mob.Equip[6].EFV3 = 32;
- NativeFunctions::saveUser(alvo, 0);
- NativeFunctions::sendCarry(alvo);
- //send carry
- }
- NativeFunctions::sendClientMessage(client, Functions::stringFormat("! Informações Level %d - Armas %d. ADD1 %d ADD2 %d \n", p->Mob.BaseStatus.Level, p->Mob.Equip[6].Index, p->Mob.Equip[6].EF2, p->Mob.Equip[6].EFV2));
- return true;
- }
- }
- if (!strcmp(innerCmd, "+send"))
- {
- char Player[15];
- uint16_t id = 0, ef1 = 0, efv1 = 0;
- if (sscanf_s(innerMsg, "%hu %hu %hu %15s", &id, &ef1, &efv1, &Player))
- {
- if (id > MAX_ITEMLIST || ef1 > 127 || efv1 > 255)
- {
- NativeFunctions::sendClientMessage(client, "Use valores menores.");
- return true;
- }
- int alvo = NativeFunctions::getUserByName(Player);
- if (alvo <= 0 || alvo >= 999)
- {
- NativeFunctions::sendClientMessage(client, "Jogador desconectado.");
- }
- STRUCT_ITEM item = { id, ef1, efv1, };
- NativeFunctions::putItem(alvo, &item);
- NativeFunctions::sendClientMessage(alvo, Functions::stringFormat("Gm enviou-lhe um item [%s] enviador para [%s].", Functions::getItemListItem(id)->Name, Player));
- return true;
- }
- }
- if (!strcmp(innerCmd, "+bossnotice"))
- {
- if (!ServerInfo.MsgKilledBoss)
- {
- ServerInfo.MsgKilledBoss = true;
- NativeFunctions::sendClientMessage(client, "ON NOTICE BOSS");
- }
- else
- {
- ServerInfo.MsgKilledBoss = false;
- NativeFunctions::sendClientMessage(client, "OFF NOTICE BOSS");
- }
- return true;
- }
- else if (!strcmp(innerCmd, "+manutencao"))
- {
- if (ServerStatus.Manutenção == false)
- {
- ServerStatus.Manutenção = true;
- NativeFunctions::sendClientMessage(client, " [MANUTENÇÃO] ON");
- return true;
- }
- else
- {
- ServerStatus.Manutenção = false;
- NativeFunctions::sendClientMessage(client, " [MANUTENÇÃO] OFF");
- return true;
- }
- }
- else if (!strcmp(innerCmd, "+readgameconfig"))
- {
- ReadGameConfig();
- NativeFunctions::sendClientMessage(client, "+READ GAMECONFIG");
- return true;
- }
- else if (!strcmp(innerCmd, "+readgamednt"))
- {
- Functions::ReadDonateList();
- NativeFunctions::sendClientMessage(client, "+READ DONATE");
- return true;
- }
- else if (!strcmp(innerCmd, "+readnpcbase"))
- {
- int npcbase = 0x0401C4E;
- __asm
- {
- MOV ECX, 0x74F92F0
- CALL npcbase
- }
- NativeFunctions::sendClientMessage(client, "+READ NPC_BASE");
- return true;
- }
- else if (!strcmp(innerCmd, "+move"))
- {
- uint16_t x = 0, y = 0, mode = 0;
- if (sscanf_s(innerMsg, "%hu %hu %hu", &x, &y, &mode) == 3)
- {
- if (x > 4096 || y > 4096)
- {
- NativeFunctions::sendClientMessage(client, "Use valores menores.");
- return true;
- }
- NativeFunctions::doTeleport(client, x, y, mode);
- return true;
- }
- }
- else if (!strcmp(innerCmd, "+donate"))
- {
- uint16_t cash = 0;
- if (sscanf_s(innerMsg, "%hu", &cash) == 1)
- {
- userData->AccountInfo.Cash += cash;
- NativeFunctions::sendClientMessage(client, Functions::stringFormat("Donate adicionado: %d / Atual: %d", cash, userData->AccountInfo.Cash));
- return true;
- }
- }
- else if (!strcmp(innerCmd, "+taxa"))
- {
- uint16_t taxa = 0;
- if (sscanf_s(innerMsg, "%hu", &taxa) == 1)
- {
- TaxaEvento = taxa;
- NativeFunctions::sendClientMessage(client, Functions::stringFormat("Evento Taxa de drop: %d ", TaxaEvento));
- return true;
- }
- }
- else if (!strcmp(innerCmd, "+readskilldata"))
- {
- int readitem = 0x04017F8, readskill = 0x04010E6;
- __asm
- {
- CALL readitem
- CALL readskill
- }
- NativeFunctions::sendClientMessage(client, "+READ ITEMLIST/SKILLDATA");
- return true;
- }
- else if (!strcmp(innerCmd, "+honra"))
- {
- uint16_t honra = 0;
- if (sscanf_s(innerMsg, "%hu", &honra) == 1)
- {
- userData->AccountInfo.Honra += honra;
- NativeFunctions::sendClientMessage(client, Functions::stringFormat("Honra adicionado: %d / Atual: %d", honra, userData->AccountInfo.Honra));
- return true;
- }
- }
- else if (!strcmp(innerCmd, "+generate"))
- {
- char serial[96];
- uint32_t SCoin;
- if (sscanf_s(innerMsg, "%ld %50s", &SCoin, serial, _countof(serial)))
- {
- FILE* fs = NULL;
- char Diretorio[120];
- sprintf_s(Diretorio, "../../userdata/DonateData/Pins/%s.txt", serial);
- if (Functions::File_exists(Diretorio))
- {
- NativeFunctions::sendClientMessage(client, "Pincode já existente.");
- return true;
- }
- fopen_s(&fs, Functions::stringFormat(Diretorio), "w+");
- if (!fs)
- {
- NativeFunctions::sendClientMessage(client, "Um erro ocorreu durante a criação do serial.");
- return true;
- }
- fprintf(fs, "%d", SCoin);
- fclose(fs);
- NativeFunctions::sendClientMessage(client, Functions::stringFormat("Pincode [%s] gerado com [%ld] Donates.", serial, SCoin));
- return true;
- }
- }
- else if (!strcmp(innerCmd, "+getguildfame"))
- {
- uint32_t guildID = 0, fame = 0;
- if (sscanf_s(innerMsg, "%u %u", &guildID, &fame) == 2)
- {
- NativeFunctions::setGuildFame(guildID, fame);
- NativeFunctions::sendClientMessage(client, Functions::stringFormat("Guild [%u] Fame [%u]", guildID, fame));
- return true;
- }
- }
- else if (!strcmp(innerCmd, "+snowquest"))
- {
- uint32_t value = 0;
- if (sscanf_s(innerMsg, "%u", &value))
- {
- *reinterpret_cast<uint32_t*>(0x5A0F0C) = value;
- NativeFunctions::addLog(Functions::stringFormat("Snow Quest Value [%u]", value), "-dll", 0);
- return true;
- }
- }
- else if (!strcmp(innerCmd, "+level"))
- {
- uint16_t level = 0;
- if (sscanf_s(innerMsg, "%hu", &level))
- {
- mob->Mob.BaseStatus.Level = level;
- NativeFunctions::sendEtc(client);
- Functions::getCurrentScore(client);
- NativeFunctions::sendScore(client);
- return true;
- }
- }
- else if (!strcmp(innerCmd, "+clearinv"))
- {
- for (int i = 0; i < 60; i++)
- {
- memset(&mob->Mob.Inventory[i], 0x0, sizeof(STRUCT_ITEM));
- NativeFunctions::sendItem(client, INV_TYPE, i, &mob->Mob.Inventory[i]);
- }
- return true;
- }
- else if (!strcmp(innerCmd, "+clearstorage"))
- {
- for (int i = 0; i < 120; i++)
- {
- memset(&user->Storage.Item[i], 0x0, sizeof(STRUCT_ITEM));
- NativeFunctions::sendItem(client, STORAGE_TYPE, i, &user->Storage.Item[i]);
- }
- return true;
- }
- else if (!strcmp(innerCmd, "+skillon"))
- {
- mob->Mob.Learn = -1;
- NativeFunctions::sendEtc(client);
- return true;
- }
- else if (!strcmp(innerCmd, "+mob"))
- {
- char name[16] = { 0, };
- if (sscanf_s(innerMsg, "%15s", name, _countof(name)))
- {
- int retn = NativeFunctions::createMob(name, mob->PosX, mob->PosY, "boss", 0);
- NativeFunctions::sendClientMessage(client, Functions::stringFormat("Mob [%s] criado.", name));
- return true;
- }
- }
- else if (!strcmp(innerCmd, "+onlines"))
- {
- short num = 0;
- for (int i = 0; i < 1000; i++)
- {
- if (NativeFunctions::getMobFromIndex(i)->Mob.Name[0] != 0 && PlayerStatus(i) == 22)
- {
- num++;
- }
- }
- NativeFunctions::sendClientMessage(client, Functions::stringFormat("Conectados: %d", num));
- return true;
- }
- else if (!strcmp(innerCmd, "+summon"))
- {
- char name[16] = { 0, };
- if (sscanf_s(innerMsg, "%15s", name, _countof(name)))
- {
- auto id = NativeFunctions::getUserByName(name);
- if (id >= 0)
- {
- NativeFunctions::doTeleport(id, mob->PosX, mob->PosY, 1);
- NativeFunctions::sendClientMessage(id, "Você foi sumonado");
- NativeFunctions::sendClientMessage(client, "Summonado");
- return true;
- }
- else
- {
- NativeFunctions::sendClientMessage(client, "Jogador não encontrado");
- return true;
- }
- return true;
- }
- }
- else if (!strcmp(innerCmd, "+summonall"))
- {
- for (int i = 0; i < 740; i++)
- {
- if (&Global::Users[i] && PlayerStatus(i) == 22)
- continue;
- NativeFunctions::doTeleport(i, mob->LastPosX, mob->LastPosY, 0);
- }
- NativeFunctions::sendClientMessage(client, "Todos os jogadores foram sumonados com sucesso.");
- return true;
- }
- else if (!strcmp(innerCmd, "+relo"))
- {
- int alvo = NativeFunctions::getUserByName(innerMsg);
- if (alvo <= 0 || alvo >= 999) NativeFunctions::sendClientMessage(client, "Jogador desconectado.");
- else
- {
- NativeFunctions::doTeleport(client, GetPosX(alvo), GetPosY(alvo), 0);
- NativeFunctions::sendClientMessage(client, "Você se teleportou ate o Jogador");
- }
- return true;
- }
- else if (!strcmp(innerCmd, "+deletemob"))
- {
- uint16_t index = 0;
- if (sscanf_s(innerMsg, "%hu", &index))
- {
- NativeFunctions::deleteMob(client, index, 5, 0);
- }
- return true;
- }
- else if (!strcmp(innerCmd, "+notice"))
- {
- char msg[96] = { 0, };
- if (sscanf_s(innerMsg, "%95[^\n]", msg, _countof(msg)))
- {
- NativeFunctions::sendNotice(msg);
- for (int i = 0; i < MAX_USER; i++)
- Functions::SendClientChat(i, Functions::stringFormat("", mob->Mob.Name, msg), 0xFFCD5B45);
- return true;
- }
- }
- else if (!strcmp(innerCmd, "+item"))
- {
- uint16_t id = 0, ef1 = 0, ef2 = 0, ef3 = 0, efv1 = 0, efv2 = 0, efv3 = 0;
- if (sscanf_s(innerMsg, "%hu %hu %hu %hu %hu %hu %hu", &id, &ef1, &efv1, &ef2, &efv2, &ef3, &efv3))
- {
- if (id > MAX_ITEMLIST || ef1 > 127 || ef2 > 127 || ef3 > 127 || efv1 > 255 || efv2 > 255 || efv3 > 255)
- {
- NativeFunctions::sendClientMessage(client, "Use valores menores.");
- return true;
- }
- STRUCT_ITEM item = { id, ef1, efv1, ef2, efv2, ef3, efv3 };
- NativeFunctions::putItem(client, &item);
- NativeFunctions::sendClientMessage(client, Functions::stringFormat("Item [%s] criado.", Functions::getItemListItem(id)->Name));
- return true;
- }
- }
- else if (!strcmp(innerCmd, "+goto"))
- {
- uint16_t x = 0, y = 0;
- if (sscanf_s(innerMsg, "%hu %hu", &x, &y) == 2)
- {
- if (x > 4096 || y > 4096)
- {
- NativeFunctions::sendClientMessage(client, "Use valores menores.");
- return true;
- }
- NativeFunctions::doTeleport(client, x, y, 0);
- return true;
- }
- }
- else if (!strcmp(innerCmd, "+buff"))
- {
- uint16_t index = 0;
- if (sscanf_s(innerMsg, "%hu", &index))
- {
- NativeFunctions::setAffect(client, index, 2, 0);
- NativeFunctions::sendAffect(client);
- Functions::getCurrentScore(client);
- NativeFunctions::sendScore(client);
- }
- return true;
- }
- else if (!strcmp(innerCmd, "+nobuff"))
- {
- for (int i = 0; i < MAX_AFFECT; i++)
- {
- mob->Affects[i].Index = 0;
- mob->Affects[i].Master = 0;
- mob->Affects[i].Time = 0;
- mob->Affects[i].Value = 0;
- }
- NativeFunctions::sendEtc(client);
- Functions::getCurrentScore(client);
- NativeFunctions::sendScore(client);
- NativeFunctions::sendClientMessage(client, "+SET NOBUFF");
- return true;
- }
- else if (!strcmp(innerCmd, "+slot"))
- {
- uint16_t index = 0;
- if (sscanf_s(innerMsg, "%hu", &index))
- {
- NativeFunctions::sendClientMessage(client, Functions::stringFormat("Valor: %d", mob->Mob.Inventory[index].Index));
- return true;
- }
- return true;
- }
- else if (!strcmp(innerCmd, "+add"))
- {
- char type[16] = { 0, };
- uint16_t value = 0;
- if (sscanf_s(innerMsg, "%15s %hu", type, _countof(type), &value) == 2)
- {
- uint16_t idx = 0;
- if (!strcmp(type, "str"))
- idx = 0;
- else if (!strcmp(type, "int"))
- idx = 1;
- else if (!strcmp(type, "dex"))
- idx = 2;
- else if (!strcmp(type, "con"))
- idx = 3;
- else if (!strcmp(type, "sp1"))
- idx = 4;
- else if (!strcmp(type, "sp2"))
- idx = 5;
- else if (!strcmp(type, "sp3"))
- idx = 6;
- else if (!strcmp(type, "sp4"))
- idx = 7;
- if (mob->Mob.StatusPoint >= value && value > 0 && (idx >= 0 && idx <= 3))
- {
- auto curStat = *(uint16_t*)(&mob->Mob.BaseStatus.STR + idx);
- if (curStat + value >= 32000)
- value = 32000 - curStat;
- *(uint16_t*)(&mob->Mob.BaseStatus.STR + idx) += value;
- mob->Mob.StatusPoint -= value;
- NativeFunctions::sendClientMessage(client, Functions::stringFormat("Adicionou [%d] no status [%d]", value, idx));
- }
- else if (mob->Mob.MasterPoint >= value && value > 0 && (idx >= 4 && idx <= 7))
- {
- idx -= 4; // 0, 1, 2, 3
- static const uint32_t oitavas[3] = { LEARN_07, LEARN_15, LEARN_23 };
- auto hasEight = false;
- if (idx > 0)
- if ((mob->Mob.Learn & oitavas[idx - 1]))
- hasEight = true;
- if (mob->Mob.BaseStatus.Masteries[idx] >= (hasEight ? 255 : 200))
- {
- NativeFunctions::sendClientMessage(client, Functions::stringFormat("Máximo de aprendizagem é de [%d]", hasEight ? 255 : 200));
- return true;
- }
- if (mob->Mob.BaseStatus.Masteries[idx] + value >= (hasEight ? 255 : 200))
- value = (hasEight ? 255 : 200) - mob->Mob.BaseStatus.Masteries[idx];
- mob->Mob.BaseStatus.Masteries[idx] += value;
- mob->Mob.MasterPoint -= value;
- NativeFunctions::sendClientMessage(client, Functions::stringFormat("Adicionou [%d] na aprendizagem [%d]", value, idx));
- }
- NativeFunctions::getHpMp(&mob->Mob);
- Functions::getCurrentScore(client);
- NativeFunctions::sendScore(client);
- NativeFunctions::sendEtc(client);
- return true;
- }
- }
- }
- NativeFunctions::sendClientMessage(client, "Comando inválido.");
- return true;
- }
- return false;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement