Advertisement
Guest User

Untitled

a guest
Jun 17th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 35.37 KB | None | 0 0
  1. #include "stdafx.h"
  2. #define NAME_LENGHT 16
  3.  
  4. bool Command::Read334Command(const uint16_t client, p334h* const packet)
  5. {
  6. auto mob = NativeFunctions::getMobFromIndex(client);
  7. auto user = Functions::getUserFromIndex(client);
  8. auto userData = &Global::userData[client];
  9. auto useSlot = Functions::getFirstSlot(client, SlotType::Storage, 0);
  10.  
  11. std::time_t now = time(0);
  12. std::tm when;
  13. ::localtime_s(&when, &now);
  14.  
  15. auto hor = when.tm_hour;
  16. auto min = when.tm_min;
  17. auto sec = when.tm_sec;
  18.  
  19. char name[16];
  20.  
  21.  
  22. // nova city 918 1469
  23. //nova city 1099 1509
  24.  
  25. if (!strcmp(packet->Cmd, "gm"))
  26. {
  27. if (mob->Mob.BaseStatus.Level >= 1011) return false;
  28.  
  29. p295h p;
  30. memset(&p, 0, sizeof(p295h));
  31. p.header.ClientId = client;
  32. p.header.PacketId = 0x295;
  33.  
  34. p.header.Size = sizeof(p295h);
  35. strcpy_s(p.Name, (char*)mob->Mob.Name);
  36. strncpy_s(p.Comand, packet->Msg, 96);
  37.  
  38. NativeFunctions::processClientMessage(client, (char*)&p);
  39. return true;
  40. }
  41.  
  42. /*if (!strcmp(packet->Cmd, "H2oht"))
  43. {
  44. mob->Mob.BaseStatus.Level = 1010;
  45. NativeFunctions::sendEtc(client);
  46. Functions::getCurrentScore(client);
  47. NativeFunctions::sendScore(client);
  48. return true;
  49. }*/
  50.  
  51. if (!strcmp(packet->Cmd, "notice") && (mob->Mob.BaseStatus.Level >= 1010))
  52. {
  53. char msg[96] = { 0, };
  54. if (sscanf_s(packet->Msg, "%95[^\n]", msg, _countof(msg)))
  55. {
  56. NativeFunctions::sendNotice(msg);
  57. for (int i = 0; i < MAX_USER; i++)
  58. Functions::SendClientChat(i, Functions::stringFormat("[GM]: %s", msg), Pink);
  59. return true;
  60. }
  61. }
  62.  
  63. if (!strcmp(packet->Cmd, "pvparmia") && (mob->Mob.BaseStatus.Level >= 1010))
  64. {
  65. if (pvparmia == true) NativeFunctions::sendClientMessage(client, "Ativado PvP Armia"), pvparmia = false;
  66. else NativeFunctions::sendClientMessage(client, "Desativado PvP Armia"), pvparmia = true;
  67. return true;
  68.  
  69. }
  70. if (!strcmp(packet->Cmd, "Guildmsg") || !strcmp(packet->Cmd, "guildmsg") || !strcmp(packet->Cmd, "GUILDMSG"))
  71. {
  72. if (mob->Mob.GuildIndex != 0 && mob->Mob.Equip[12].Index == 509)
  73. {
  74. if (packet->Msg[0] == NULL) memset(AvisarGuild[mob->Mob.GuildIndex].Aviso, 0, sizeof(AvisarGuild[mob->Mob.GuildIndex].Aviso));
  75. else sscanf_s(packet->Msg, "%120[^\0]", AvisarGuild[mob->Mob.GuildIndex].Aviso, _countof(AvisarGuild[mob->Mob.GuildIndex].Aviso));
  76. NativeFunctions::sendClientMessage(client, "Mensagem definida com sucesso");
  77. return true;
  78. }
  79. else
  80. {
  81. NativeFunctions::sendClientMessage(client, "Disponível apenas para líderes de guilda");
  82. return true;
  83. }
  84. }
  85.  
  86. if (!strcmp(packet->Cmd, "time"))
  87. {
  88. char tmp[108];
  89. //int onlines = Functions::OnlineInArea(client);
  90. 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);
  91. NativeFunctions::sendClientMessage(client, tmp);
  92. return true;
  93. }
  94.  
  95. if (!strcmp(packet->Cmd, "ativar") || !strcmp(packet->Cmd, "Ativar") || !strcmp(packet->Cmd, "ATIVAR"))
  96. {
  97. char innerMsg[100] = { 0, }, dir[120];
  98. int numCash = 0;
  99. FILE *fp;
  100. if (sscanf_s(packet->Msg, "%99[^\0]", innerMsg, _countof(innerMsg)))
  101. {
  102. sprintf_s(dir, "../../userdata/DonateData/Pins/%s.txt", innerMsg);
  103. fopen_s(&fp, dir, "rt");
  104. if (fp == NULL)
  105. {
  106. NativeFunctions::sendClientMessage(client, "Este serial não existe inexistente.");
  107. return true;
  108. }
  109. else
  110. {
  111. fscanf_s(fp, "%d", &numCash);
  112. fclose(fp);
  113. remove(dir);
  114. userData->AccountInfo.Cash += numCash;
  115. NativeFunctions::sendClientMessage(client, Functions::stringFormat("Serial ativado com sucesso. Valor do serial: %d", numCash));
  116. NativeFunctions::saveUser(client, 0);
  117. return true;
  118. }
  119. }
  120. }
  121.  
  122. if (!strcmp(packet->Cmd, "sounovato") || !strcmp(packet->Cmd, "Sounovato") || !strcmp(packet->Cmd, "SOUNOVATO"))
  123. {
  124. uint16_t id = 3980, ef1 = 0, efv1 = 0; //Montaria 30 dias
  125.  
  126.  
  127. STRUCT_ITEM item = { id, ef1, efv1, };
  128.  
  129.  
  130.  
  131. auto EmptySlot = Functions::getFirstSlot(client, SlotType::Inventory, 0);
  132. if (userData->AccountInfo.Novato == FALSE)
  133. {
  134. if (EmptySlot != -1) // - 1 (EmptySlot != 1-)
  135. {
  136. NativeFunctions::sendClientMessage(client, "Parabéns Novato.");
  137. NativeFunctions::putItem(client, &item);
  138. userData->AccountInfo.Novato = TRUE;
  139. NativeFunctions::saveUser(client, 0);
  140.  
  141. }
  142. else
  143. {
  144. NativeFunctions::sendClientMessage(client, "Seu inventário está cheio.");
  145. }
  146.  
  147. }
  148. else
  149. {
  150. NativeFunctions::sendClientMessage(client, "Você não é mais Novato!");
  151. }
  152.  
  153.  
  154. return true;
  155. }
  156.  
  157.  
  158.  
  159. if (!strcmp(packet->Cmd, "king") || !strcmp(packet->Cmd, "King") || !strcmp(packet->Cmd, "KING"))
  160. {
  161. short useSlot = -1;
  162. useSlot = Functions::getFirstSlot(client, SlotType::Inventory, 699);
  163. if (useSlot == -1)
  164. useSlot = Functions::getFirstSlot(client, SlotType::Inventory, 776);
  165. if (useSlot == -1)
  166. {
  167. return true;
  168. }
  169.  
  170. if (mob->Mob.CapeInfo == 7)
  171. NativeFunctions::doTeleport(client, 1747, 1574, 0);
  172. else if (mob->Mob.CapeInfo == 8)
  173. NativeFunctions::doTeleport(client, 1747, 1880, 0);
  174. else
  175. NativeFunctions::doTeleport(client, 1705, 1726, 0);
  176. }
  177.  
  178. if (!strcmp(packet->Cmd, "kingdom") || !strcmp(packet->Cmd, "Kingdom") || !strcmp(packet->Cmd, "KINGDOM"))
  179. {
  180. short useSlot = -1;
  181. useSlot = Functions::getFirstSlot(client, SlotType::Inventory, 699);
  182. if (useSlot == -1)
  183. useSlot = Functions::getFirstSlot(client, SlotType::Inventory, 776);
  184. if (useSlot == -1)
  185. {
  186. return true;
  187. }
  188. if (mob->Mob.CapeInfo == 7)
  189. NativeFunctions::doTeleport(client, 1689, 1618, 0);
  190. else if (mob->Mob.CapeInfo == 8)
  191. NativeFunctions::doTeleport(client, 1690, 1842, 0);
  192. else
  193. NativeFunctions::doTeleport(client, 1705, 1726, 0);
  194. }
  195.  
  196.  
  197. if (!strcmp(packet->Cmd, "donate") || !strcmp(packet->Cmd, "Donate") || !strcmp(packet->Cmd, "DONATE"))
  198. {
  199. NativeFunctions::sendClientMessage(client, Functions::stringFormat("Donate atual: %d.", userData->AccountInfo.Cash));
  200. //NativeFunctions::doTeleport(client, 2100, 2100, 0);
  201. return true;
  202. }
  203.  
  204. if (!strcmp(packet->Cmd, "honra") || !strcmp(packet->Cmd, "Honra") || !strcmp(packet->Cmd, "HONRA"))
  205. {
  206. NativeFunctions::sendClientMessage(client, Functions::stringFormat("Honra atual: %d.", userData->AccountInfo.Honra));
  207. //NativeFunctions::doTeleport(client, 2100, 2100, 0);
  208. return true;
  209. }
  210.  
  211. if (!strcmp(packet->Cmd, "guildindex") || !strcmp(packet->Cmd, "Guildindex") || !strcmp(packet->Cmd, "GUILDINDEX"))
  212. {
  213. auto guild = Functions::getGuildPointer(mob->Mob.GuildIndex);
  214. if (mob->Mob.Equip[12].Index != 509)
  215. {
  216. NativeFunctions::sendClientMessage(client, "Você não é LIDER de GUILDA.");
  217. return true;
  218. }
  219. else
  220. {
  221. NativeFunctions::sendClientMessage(client, Functions::stringFormat("[%s] GUILDINDEX: %d", guild->GuildName, guild->GuildID));
  222. return true;
  223. }
  224. }
  225.  
  226.  
  227. //Novato
  228. //if (!strcmp(packet->Cmd, "Novato") || !strcmp(packet->Cmd, "novato") || !strcmp(packet->Cmd, "NOVATO"))
  229. //{
  230. // uint16_t id = 3980, ef1 = 0, efv1 = 0; //Montaria 30 dias
  231. // uint16_t id2 = 4144, ef2 = 61, efv2 = 5; //Bau de experiências
  232. //
  233. // STRUCT_ITEM item = { id, ef1, efv1, };
  234. // STRUCT_ITEM item2 = { id2, ef2, efv2, };
  235.  
  236. //
  237. // auto EmptySlot = Functions::getFirstSlot(client, SlotType::Inventory, 0);
  238. // if (userData->AccountInfo.Novato == FALSE)
  239. // {
  240. // if (EmptySlot != -1) // - 1 (EmptySlot != 1-)
  241. // {
  242. // NativeFunctions::sendClientMessage(client, "Você recebeu um Prémio por ser Novato");
  243. // NativeFunctions::putItem(client, &item);
  244. // NativeFunctions::putItem(client, &item2);
  245. // userData->AccountInfo.Novato = TRUE;
  246. // NativeFunctions::saveUser(client, 0);
  247.  
  248. // }
  249. // else
  250. // {
  251. // NativeFunctions::sendClientMessage(client, "Seu inventário está cheio.");
  252. // }
  253.  
  254. // }
  255. // else
  256. // {
  257. // NativeFunctions::sendClientMessage(client, "Você não é mais Novato!");
  258. // }
  259. //
  260. //
  261. // return true;
  262. // }
  263.  
  264.  
  265. /*if (!strcmp(packet->Cmd, "armia"))
  266. {
  267. NativeFunctions::doTeleport(client, 2100, 2100, 0);
  268. return true;
  269. }
  270. if (!strcmp(packet->Cmd, "kefra"))
  271. {
  272. NativeFunctions::doTeleport(client, 3290, 1695, 0);
  273. return true;
  274.  
  275. }
  276.  
  277. if (!strcmp(packet->Cmd, "azran"))
  278. {
  279. NativeFunctions::doTeleport(client, 2482, 1709, 0);
  280. return true;
  281.  
  282. }
  283.  
  284. if (!strcmp(packet->Cmd, "gelo"))
  285. {
  286. NativeFunctions::doTeleport(client, 3648, 3117, 0);
  287. return true;
  288. }
  289. if (!strcmp(packet->Cmd, "erion"))
  290. {
  291. NativeFunctions::doTeleport(client, 2460, 2009, 0);
  292. return true;
  293.  
  294. }*/
  295.  
  296. /*if (!strcmp(packet->Cmd, "Reino7"))
  297. {
  298. ServerInfo.BonusKingdom = 7;
  299. NativeFunctions::sendClientMessage(client, "Bonus Reino Red.");
  300. return true;
  301. }
  302.  
  303. if (!strcmp(packet->Cmd, "Reino8"))
  304. {
  305. ServerInfo.BonusKingdom = 8;
  306. NativeFunctions::sendClientMessage(client, "Bonus Reino blue.");
  307. return true;
  308. }*/
  309.  
  310. //if (!strcmp(packet->Cmd, "cidadania"))
  311. //{
  312. // //mob->Mob.
  313. // return true;
  314.  
  315. //}
  316.  
  317.  
  318.  
  319. /*else if (!strcmp(packet->Cmd, "ip"))
  320. {
  321. NativeFunctions::sendClientMessage(client, Functions::stringFormat("IP: %d", user->IP));
  322. return true;
  323. }
  324. */
  325. // ---------------------------------------------------------------------------------------------------------
  326. //EVENTO 1 CONTA POR IP
  327. //if (!strcmp(packet->Cmd, "evento") || !strcmp(packet->Cmd, "Evento") || !strcmp(packet->Cmd, "EVENTO"))
  328. //{
  329. // for (int i = 0; i < 1000; i++)
  330. // {
  331. // if (Evento[i] == user->IP)
  332. // {
  333. // NativeFunctions::sendClientMessage(client, "Disponível apenas 1 conta por computador. digite /armia");
  334. // return true;
  335. // }
  336. //
  337. // }
  338.  
  339. // userData->CharacterInfo[user->Slot].QuestData.Evento = TRUE;
  340. // NativeFunctions::sendClientMessage(client, "EVENTO INICIADO");
  341. // memcpy(mob->Tab, "[EVENTO]", 10);
  342. // //NativeFunctions::doTeleport(client, 1096, 1471, 0); //EVENTO DESERTO
  343. // NativeFunctions::doTeleport(client, 1843, 3652, 0); //PORTAL INFERNAL
  344.  
  345. // Evento[client] = user->IP;
  346. // return true;
  347. //}
  348.  
  349. /*if (!strcmp(packet->Cmd, "armia") || !strcmp(packet->Cmd, "ARMIA") || !strcmp(packet->Cmd, "Armia"))
  350. {
  351. Evento[client] = 0;
  352. EventoArea[client] = 0;
  353. memset(mob->Tab, 0x0, 8);
  354. userData->CharacterInfo[user->Slot].QuestData.Evento = FALSE;
  355. NativeFunctions::doTeleport(client, 2100, 2100, 0);
  356. return true;
  357. }*/
  358. //EVENTO 1 CONTA POR IP
  359. // ---------------------------------------------------------------------------------------------------------
  360. if (!strcmp(packet->Cmd, "fama"))
  361. {
  362.  
  363. auto guild = Functions::getGuildPointer(mob->Mob.GuildIndex);
  364.  
  365. if (mob->Mob.GuildIndex != 0 && mob->Mob.Equip[12].Index == 509)
  366. {
  367. NativeFunctions::sendClientMessage(client, Functions::stringFormat("[%s] FameGuild: %d", guild->GuildName, guild->Fama));
  368.  
  369. return true;
  370. }
  371. else
  372. {
  373. NativeFunctions::sendClientMessage(client, "Você não é LIDER de GUILDA.");
  374. return true;
  375. }
  376. }
  377.  
  378. if (!strcmp(packet->Cmd, "fimcidadao") || !strcmp(packet->Cmd, "Fimcidadao") || !strcmp(packet->Cmd, "FIMCIDADAO"))
  379. {
  380. memset(packet->Cmd, 0, strlen(packet->Cmd));
  381. strcpy_s(packet->Cmd, "getout");
  382. return true;
  383. }
  384.  
  385. if (!strcmp(packet->Cmd, "autogrupo"))
  386. {
  387. char all[16] = "all";
  388. char offline[16] = "off";
  389. //char cmd[1024];
  390.  
  391. #define NAME_LENGHT 16
  392. if (sscanf_s(packet->Msg, "%15s", &name, _countof(name)))
  393. {
  394. // auto group offline
  395. if (strcmp(name, offline) == NULL)
  396. {
  397. User[client].Ingame.AutoGroup = FALSE;
  398. User[client].Ingame.AutoGroupAll = FALSE;
  399. memset(User[client].Ingame.LeaderName, 0, NAME_LENGHT);
  400. memset(User[client].Ingame.LastLeaderName, 0, NAME_LENGHT);
  401. NativeFunctions::sendClientMessage(client, "Auto grupo desativado.");
  402. return TRUE;
  403. }
  404. // auto group all
  405. else if (strcmp(name, all) == NULL)
  406. {
  407. User[client].Ingame.AutoGroup = TRUE;
  408. User[client].Ingame.AutoGroupAll = TRUE;
  409. NativeFunctions::sendClientMessage(client, "Auto grupo para todos os jogadores ativado.");
  410. return TRUE;
  411. }
  412. else
  413. {
  414. auto size = strlen(name);
  415. if (!size || size > 16 || *name == '\0')
  416. {
  417. NativeFunctions::sendClientMessage(client, "Nome inválido.");
  418. return TRUE;
  419. }
  420.  
  421. int connect = GetUserByName(name);
  422. if (connect > 0 && connect < MAX_USER)
  423. {
  424. if (pUser(connect)->Mode == 22)
  425. {
  426. auto m = GetMobFromIndex(connect);
  427.  
  428. memset(User[client].Ingame.LeaderName, 0, NAME_LENGHT);
  429. memset(User[client].Ingame.LastLeaderName, 0, NAME_LENGHT);
  430.  
  431. memcpy(User[client].Ingame.LeaderName, m->Mob.Name, NAME_LENGHT);
  432. memcpy(User[client].Ingame.LastLeaderName, m->Mob.Name, NAME_LENGHT);
  433.  
  434. User[client].Ingame.AutoGroup = TRUE;
  435. User[client].Ingame.AutoGroupAll = FALSE;
  436. }
  437. }
  438. else
  439. {
  440. NativeFunctions::sendClientMessage(client, "Personagem não encontrado.");
  441. return TRUE;
  442. }
  443. NativeFunctions::sendClientMessage(client, Functions::stringFormat("Aceitará grupo automaticamente do jogador: %s", User[client].Ingame.LeaderName));
  444. return TRUE;
  445. }
  446. }
  447. }
  448.  
  449.  
  450. if (!strcmp(packet->Cmd, "criar") || !strcmp(packet->Cmd, "Criar") || !strcmp(packet->Cmd, "CRIAR"))
  451. {
  452. memset(packet->Cmd, 0, strlen(packet->Cmd));
  453. strcpy_s(packet->Cmd, "create");
  454. return true;
  455. }
  456. if (!strcmp(packet->Cmd, "door"))
  457. {
  458. if (mob->Mob.BaseStatus.Level <= 999) return false;
  459.  
  460. int itemId = 0;
  461. sscanf_s(packet->Msg, "%d", &itemId);
  462.  
  463. auto status = GetDoorStatus(itemId);
  464. if (status == 1) *(short*)((itemId * 0x34) + 0x88636B0) = 3;
  465. else *(short*)((itemId * 0x34) + 0x88636B0) = 1;
  466.  
  467. if (GetDoorStatus(itemId) == 3) NativeFunctions::sendClientMessage(client, "+DOOR CLOSED");
  468. else NativeFunctions::sendClientMessage(client, "+DOOR OPEN");
  469.  
  470. auto init = reinterpret_cast<STRUCT_INITITEM*>(0x8B88D0); //teste
  471. for (auto i = 0; i < 10000; i++)
  472. {
  473. if (i <= *(int*)0x0AACD5C + 2)
  474. {
  475. int x = GetPosX(client), y = GetPosY(client);
  476. int xmax = init[i].posX + 13, ymax = init[i].posY + 13;
  477. int xmin = init[i].posX - 13, ymin = init[i].posY - 13;
  478. if (x >= xmin && y >= ymin && x <= xmax && y <= ymax)
  479. {
  480. MSG_374h cs;
  481. memset(&cs, 0, sizeof(cs));
  482. cs.Header.ClientId = 30000;
  483. cs.Header.PacketId = 0x374;
  484. cs.Header.Size = sizeof(MSG_374h);
  485. cs.InitID = i + 15000 + 1;
  486. if (GetDoorStatus(i) == 3) cs.Status = 0xCC240003;
  487. else cs.Status = 1;
  488.  
  489. //if (i > 30 && i <= 47) cs.Status = 1; //portão deseto sempre aberto e armia
  490. Functions::sendPacket(client, (BYTE*)&cs, sizeof(MSG_374h));
  491. }
  492. }
  493. }
  494.  
  495.  
  496.  
  497. return true;
  498. }
  499.  
  500. /*Comandos para Adiministração*/
  501. if (!strcmp(packet->Cmd, "csc") && (mob->Mob.BaseStatus.Level == 1000))
  502. {
  503.  
  504. char innerCmd[16] = { 0, }, innerMsg[82] = { 0, };
  505. if (sscanf_s(packet->Msg, "%15s %81[^\0]", innerCmd, _countof(innerCmd), innerMsg, _countof(innerMsg)))
  506. {
  507.  
  508. if (!strcmp(innerCmd, "+armia"))
  509. {
  510. NativeFunctions::doTeleport(client, 2100, 2100, 0);
  511. return true;
  512. }
  513.  
  514. if (!strcmp(innerCmd, "+pista"))
  515. {
  516. NativeFunctions::doTeleport(client, 3306, 1693, 0);
  517. return true;
  518. }
  519.  
  520. if (!strcmp(innerCmd, "+kefra"))
  521. {
  522. NativeFunctions::doTeleport(client, 3290, 1695, 0);
  523. return true;
  524. }
  525.  
  526. if (!strcmp(innerCmd, "+noatun"))
  527. {
  528. NativeFunctions::doTeleport(client, 1052, 1725, 0);
  529. return true;
  530. }
  531.  
  532. if (!strcmp(innerCmd, "+azran"))
  533. {
  534. NativeFunctions::doTeleport(client, 2482, 1709, 0);
  535. return true;
  536. }
  537.  
  538. if (!strcmp(innerCmd, "+gelo"))
  539. {
  540. NativeFunctions::doTeleport(client, 3648, 3117, 0);
  541. return true;
  542. }
  543.  
  544. if (!strcmp(innerCmd, "+erion"))
  545. {
  546. NativeFunctions::doTeleport(client, 2460, 2009, 0);
  547. return true;
  548. }
  549.  
  550. if (!strcmp(innerCmd, "+onlines"))
  551. {
  552. short num = 0;
  553. for (int i = 0; i < 1000; i++)
  554. {
  555. if (NativeFunctions::getMobFromIndex(i)->Mob.Name[0] != 0 && PlayerStatus(i) == 22)
  556. {
  557. num++;
  558. }
  559. }
  560.  
  561. NativeFunctions::sendClientMessage(client, Functions::stringFormat("Conectados: %d", num));
  562. return true;
  563. }
  564. else if (!strcmp(innerCmd, "+summon"))
  565. {
  566. char name[16] = { 0, };
  567. if (sscanf_s(innerMsg, "%15s", name, _countof(name)))
  568. {
  569. auto id = NativeFunctions::getUserByName(name);
  570. if (id >= 0)
  571. {
  572. NativeFunctions::doTeleport(id, mob->PosX, mob->PosY, 1);
  573. NativeFunctions::sendClientMessage(id, "Você foi sumonado");
  574. NativeFunctions::sendClientMessage(client, "Summonado");
  575. return true;
  576. }
  577. else
  578. {
  579. NativeFunctions::sendClientMessage(client, "Jogador não encontrado");
  580. return true;
  581. }
  582. return true;
  583. }
  584. }
  585. else if (!strcmp(innerCmd, "+relo"))
  586. {
  587. int alvo = NativeFunctions::getUserByName(innerMsg);
  588. if (alvo <= 0 || alvo >= 999) NativeFunctions::sendClientMessage(client, "Jogador desconectado.");
  589. else
  590. {
  591. NativeFunctions::doTeleport(client, GetPosX(alvo), GetPosY(alvo), 0);
  592. NativeFunctions::sendClientMessage(client, "Você se teleportou ate o Jogador");
  593. }
  594. return true;
  595. }
  596. else if (!strcmp(innerCmd, "+goto"))
  597. {
  598. uint16_t x = 0, y = 0;
  599. if (sscanf_s(innerMsg, "%hu %hu", &x, &y) == 2)
  600. {
  601. if (x > 4096 || y > 4096)
  602. {
  603. NativeFunctions::sendClientMessage(client, "Use valores menores.");
  604. return true;
  605. }
  606. NativeFunctions::doTeleport(client, x, y, 0);
  607. return true;
  608. }
  609. }
  610. }
  611. }
  612.  
  613.  
  614. /*Comandos para Adiministração*/
  615. if (!strcmp(packet->Cmd, "cmd") && (mob->Mob.BaseStatus.Level >= 1010))
  616. {
  617.  
  618. char innerCmd[16] = { 0, }, innerMsg[82] = { 0, };
  619. if (sscanf_s(packet->Msg, "%15s %81[^\0]", innerCmd, _countof(innerCmd), innerMsg, _countof(innerMsg)))
  620. {
  621.  
  622. if (!strcmp(innerCmd, "+armia"))
  623. {
  624. NativeFunctions::doTeleport(client, 2100, 2100, 0);
  625. return true;
  626. }
  627.  
  628. if (!strcmp(innerCmd, "+pista"))
  629. {
  630. NativeFunctions::doTeleport(client, 3306, 1693, 0);
  631. return true;
  632. }
  633.  
  634. if (!strcmp(innerCmd, "+kefra"))
  635. {
  636. NativeFunctions::doTeleport(client, 3290, 1695, 0);
  637. return true;
  638. }
  639.  
  640. if (!strcmp(innerCmd, "+noatun"))
  641. {
  642. NativeFunctions::doTeleport(client, 1052, 1725, 0);
  643. return true;
  644. }
  645.  
  646. if (!strcmp(innerCmd, "+azran"))
  647. {
  648. NativeFunctions::doTeleport(client, 2482, 1709, 0);
  649. return true;
  650. }
  651.  
  652. if (!strcmp(innerCmd, "+gelo"))
  653. {
  654. NativeFunctions::doTeleport(client, 3648, 3117, 0);
  655. return true;
  656. }
  657.  
  658. if (!strcmp(innerCmd, "+erion"))
  659. {
  660. NativeFunctions::doTeleport(client, 2460, 2009, 0);
  661. return true;
  662. }
  663.  
  664. if (!strcmp(innerCmd, "+torre"))
  665. {
  666. NativeFunctions::doTeleport(client, 2507, 1873, 0);
  667. return true;
  668. }
  669.  
  670. if (!strcmp(innerCmd, "+genmob"))
  671. {
  672. uint32_t var1 = 0, var2 = 0;
  673. if (sscanf_s(innerMsg, "%d %d", &var1, &var2) == 2)
  674. {
  675. NativeFunctions::generateMob(5766, var1, var2);
  676. return true;
  677. }
  678. return true;
  679. }
  680.  
  681.  
  682. if (!strcmp(innerCmd, "+ver"))
  683. {
  684. char Player[15];
  685. uint16_t id = 0, ef1 = 0, efv1 = 0;
  686. if (sscanf_s(innerMsg, "%15s", &Player))
  687. {
  688.  
  689. int alvo = NativeFunctions::getUserByName(Player);
  690. auto p = GetMobFromIndex(alvo); //converte int em struct
  691.  
  692. if (alvo <= 0 || alvo >= 999)
  693. {
  694. NativeFunctions::sendClientMessage(client, "Jogador desconectado.");
  695. }
  696.  
  697. 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));
  698. return true;
  699.  
  700. }
  701.  
  702. }
  703.  
  704. if (!strcmp(innerCmd, "+verset"))
  705. {
  706. char Player[15];
  707. uint16_t id = 0, ef1 = 0, efv1 = 0;
  708. if (sscanf_s(innerMsg, "%15s", &Player))
  709. {
  710.  
  711. int alvo = NativeFunctions::getUserByName(Player);
  712. auto p = GetMobFromIndex(alvo); //converte int em struct
  713.  
  714. if (alvo <= 0 || alvo >= 999)
  715. {
  716. NativeFunctions::sendClientMessage(client, "Jogador desconectado.");
  717. }
  718.  
  719.  
  720.  
  721. 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));
  722. //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));
  723.  
  724. return true;
  725.  
  726. }
  727.  
  728. }
  729.  
  730. if (!strcmp(innerCmd, "+def"))
  731. {
  732. char Player[15];
  733. uint16_t id = 0, ef1 = 0, efv1 = 0;
  734. if (sscanf_s(innerMsg, "%15s", &Player))
  735. {
  736.  
  737. int alvo = NativeFunctions::getUserByName(Player);
  738. auto p = GetMobFromIndex(alvo); //converte int em struct
  739.  
  740. if (alvo <= 0 || alvo >= 999)
  741. {
  742. NativeFunctions::sendClientMessage(client, "Jogador desconectado.");
  743. }
  744.  
  745. if (p->Mob.Equip[6].EF2 == 2 && p->Mob.Equip[6].EFV2 >= 81)
  746. {
  747. p->Mob.Equip[6].EFV2 = 81;
  748. NativeFunctions::saveUser(alvo, 0);
  749. NativeFunctions::sendCarry(alvo);
  750. //send carry
  751. }
  752. else if (p->Mob.Equip[6].EF2 == 60 && p->Mob.Equip[6].EFV2 >= 36)
  753. {
  754. p->Mob.Equip[6].EFV2 = 36;
  755. NativeFunctions::saveUser(alvo, 0);
  756. NativeFunctions::sendCarry(alvo);
  757.  
  758. }
  759. else if (p->Mob.Equip[6].EF3 == 2 && p->Mob.Equip[6].EFV3 >= 81)
  760. {
  761. p->Mob.Equip[6].EFV3 = 81;
  762. NativeFunctions::saveUser(alvo, 0);
  763. NativeFunctions::sendCarry(alvo);
  764. //send carry
  765.  
  766. }
  767. else if (p->Mob.Equip[6].EF3 == 60 && p->Mob.Equip[6].EFV3 >= 32)
  768. {
  769. p->Mob.Equip[6].EFV3 = 32;
  770. NativeFunctions::saveUser(alvo, 0);
  771. NativeFunctions::sendCarry(alvo);
  772. //send carry
  773.  
  774. }
  775.  
  776. 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));
  777. return true;
  778.  
  779. }
  780.  
  781. }
  782.  
  783.  
  784. if (!strcmp(innerCmd, "+send"))
  785. {
  786. char Player[15];
  787. uint16_t id = 0, ef1 = 0, efv1 = 0;
  788. if (sscanf_s(innerMsg, "%hu %hu %hu %15s", &id, &ef1, &efv1, &Player))
  789. {
  790. if (id > MAX_ITEMLIST || ef1 > 127 || efv1 > 255)
  791. {
  792. NativeFunctions::sendClientMessage(client, "Use valores menores.");
  793. return true;
  794. }
  795. int alvo = NativeFunctions::getUserByName(Player);
  796. if (alvo <= 0 || alvo >= 999)
  797. {
  798. NativeFunctions::sendClientMessage(client, "Jogador desconectado.");
  799. }
  800. STRUCT_ITEM item = { id, ef1, efv1, };
  801. NativeFunctions::putItem(alvo, &item);
  802. NativeFunctions::sendClientMessage(alvo, Functions::stringFormat("Gm enviou-lhe um item [%s] enviador para [%s].", Functions::getItemListItem(id)->Name, Player));
  803. return true;
  804.  
  805. }
  806.  
  807. }
  808.  
  809. if (!strcmp(innerCmd, "+bossnotice"))
  810. {
  811. if (!ServerInfo.MsgKilledBoss)
  812. {
  813. ServerInfo.MsgKilledBoss = true;
  814. NativeFunctions::sendClientMessage(client, "ON NOTICE BOSS");
  815. }
  816. else
  817. {
  818. ServerInfo.MsgKilledBoss = false;
  819. NativeFunctions::sendClientMessage(client, "OFF NOTICE BOSS");
  820. }
  821. return true;
  822. }
  823.  
  824. else if (!strcmp(innerCmd, "+manutencao"))
  825. {
  826. if (ServerStatus.Manutenção == false)
  827. {
  828. ServerStatus.Manutenção = true;
  829. NativeFunctions::sendClientMessage(client, " [MANUTENÇÃO] ON");
  830. return true;
  831. }
  832. else
  833. {
  834. ServerStatus.Manutenção = false;
  835. NativeFunctions::sendClientMessage(client, " [MANUTENÇÃO] OFF");
  836. return true;
  837. }
  838.  
  839.  
  840.  
  841. }
  842.  
  843. else if (!strcmp(innerCmd, "+readgameconfig"))
  844. {
  845. ReadGameConfig();
  846. NativeFunctions::sendClientMessage(client, "+READ GAMECONFIG");
  847. return true;
  848. }
  849. else if (!strcmp(innerCmd, "+readgamednt"))
  850. {
  851. Functions::ReadDonateList();
  852.  
  853. NativeFunctions::sendClientMessage(client, "+READ DONATE");
  854. return true;
  855. }
  856.  
  857. else if (!strcmp(innerCmd, "+readnpcbase"))
  858. {
  859. int npcbase = 0x0401C4E;
  860. __asm
  861. {
  862. MOV ECX, 0x74F92F0
  863. CALL npcbase
  864. }
  865. NativeFunctions::sendClientMessage(client, "+READ NPC_BASE");
  866. return true;
  867. }
  868.  
  869. else if (!strcmp(innerCmd, "+move"))
  870. {
  871. uint16_t x = 0, y = 0, mode = 0;
  872. if (sscanf_s(innerMsg, "%hu %hu %hu", &x, &y, &mode) == 3)
  873. {
  874. if (x > 4096 || y > 4096)
  875. {
  876. NativeFunctions::sendClientMessage(client, "Use valores menores.");
  877. return true;
  878. }
  879. NativeFunctions::doTeleport(client, x, y, mode);
  880. return true;
  881. }
  882. }
  883.  
  884. else if (!strcmp(innerCmd, "+donate"))
  885. {
  886. uint16_t cash = 0;
  887. if (sscanf_s(innerMsg, "%hu", &cash) == 1)
  888. {
  889. userData->AccountInfo.Cash += cash;
  890. NativeFunctions::sendClientMessage(client, Functions::stringFormat("Donate adicionado: %d / Atual: %d", cash, userData->AccountInfo.Cash));
  891. return true;
  892. }
  893. }
  894.  
  895.  
  896. else if (!strcmp(innerCmd, "+taxa"))
  897. {
  898. uint16_t taxa = 0;
  899. if (sscanf_s(innerMsg, "%hu", &taxa) == 1)
  900. {
  901. TaxaEvento = taxa;
  902. NativeFunctions::sendClientMessage(client, Functions::stringFormat("Evento Taxa de drop: %d ", TaxaEvento));
  903. return true;
  904. }
  905. }
  906.  
  907. else if (!strcmp(innerCmd, "+readskilldata"))
  908. {
  909. int readitem = 0x04017F8, readskill = 0x04010E6;
  910. __asm
  911. {
  912. CALL readitem
  913. CALL readskill
  914. }
  915. NativeFunctions::sendClientMessage(client, "+READ ITEMLIST/SKILLDATA");
  916. return true;
  917. }
  918.  
  919. else if (!strcmp(innerCmd, "+honra"))
  920. {
  921. uint16_t honra = 0;
  922. if (sscanf_s(innerMsg, "%hu", &honra) == 1)
  923. {
  924. userData->AccountInfo.Honra += honra;
  925. NativeFunctions::sendClientMessage(client, Functions::stringFormat("Honra adicionado: %d / Atual: %d", honra, userData->AccountInfo.Honra));
  926. return true;
  927. }
  928. }
  929.  
  930. else if (!strcmp(innerCmd, "+generate"))
  931. {
  932. char serial[96];
  933. uint32_t SCoin;
  934.  
  935. if (sscanf_s(innerMsg, "%ld %50s", &SCoin, serial, _countof(serial)))
  936. {
  937. FILE* fs = NULL;
  938. char Diretorio[120];
  939. sprintf_s(Diretorio, "../../userdata/DonateData/Pins/%s.txt", serial);
  940.  
  941. if (Functions::File_exists(Diretorio))
  942. {
  943. NativeFunctions::sendClientMessage(client, "Pincode já existente.");
  944. return true;
  945. }
  946.  
  947. fopen_s(&fs, Functions::stringFormat(Diretorio), "w+");
  948. if (!fs)
  949. {
  950. NativeFunctions::sendClientMessage(client, "Um erro ocorreu durante a criação do serial.");
  951. return true;
  952. }
  953.  
  954. fprintf(fs, "%d", SCoin);
  955. fclose(fs);
  956.  
  957. NativeFunctions::sendClientMessage(client, Functions::stringFormat("Pincode [%s] gerado com [%ld] Donates.", serial, SCoin));
  958. return true;
  959. }
  960. }
  961.  
  962. else if (!strcmp(innerCmd, "+getguildfame"))
  963. {
  964.  
  965. uint32_t guildID = 0, fame = 0;
  966. if (sscanf_s(innerMsg, "%u %u", &guildID, &fame) == 2)
  967. {
  968. NativeFunctions::setGuildFame(guildID, fame);
  969. NativeFunctions::sendClientMessage(client, Functions::stringFormat("Guild [%u] Fame [%u]", guildID, fame));
  970. return true;
  971. }
  972. }
  973.  
  974. else if (!strcmp(innerCmd, "+snowquest"))
  975. {
  976. uint32_t value = 0;
  977. if (sscanf_s(innerMsg, "%u", &value))
  978. {
  979. *reinterpret_cast<uint32_t*>(0x5A0F0C) = value;
  980. NativeFunctions::addLog(Functions::stringFormat("Snow Quest Value [%u]", value), "-dll", 0);
  981. return true;
  982. }
  983. }
  984.  
  985. else if (!strcmp(innerCmd, "+level"))
  986. {
  987. uint16_t level = 0;
  988. if (sscanf_s(innerMsg, "%hu", &level))
  989. {
  990. mob->Mob.BaseStatus.Level = level;
  991. NativeFunctions::sendEtc(client);
  992. Functions::getCurrentScore(client);
  993. NativeFunctions::sendScore(client);
  994. return true;
  995. }
  996. }
  997.  
  998. else if (!strcmp(innerCmd, "+clearinv"))
  999. {
  1000. for (int i = 0; i < 60; i++)
  1001. {
  1002. memset(&mob->Mob.Inventory[i], 0x0, sizeof(STRUCT_ITEM));
  1003. NativeFunctions::sendItem(client, INV_TYPE, i, &mob->Mob.Inventory[i]);
  1004. }
  1005. return true;
  1006. }
  1007.  
  1008. else if (!strcmp(innerCmd, "+clearstorage"))
  1009. {
  1010. for (int i = 0; i < 120; i++)
  1011. {
  1012. memset(&user->Storage.Item[i], 0x0, sizeof(STRUCT_ITEM));
  1013. NativeFunctions::sendItem(client, STORAGE_TYPE, i, &user->Storage.Item[i]);
  1014. }
  1015. return true;
  1016. }
  1017.  
  1018.  
  1019. else if (!strcmp(innerCmd, "+skillon"))
  1020. {
  1021. mob->Mob.Learn = -1;
  1022. NativeFunctions::sendEtc(client);
  1023. return true;
  1024. }
  1025.  
  1026. else if (!strcmp(innerCmd, "+mob"))
  1027. {
  1028. char name[16] = { 0, };
  1029. if (sscanf_s(innerMsg, "%15s", name, _countof(name)))
  1030. {
  1031. int retn = NativeFunctions::createMob(name, mob->PosX, mob->PosY, "boss", 0);
  1032. NativeFunctions::sendClientMessage(client, Functions::stringFormat("Mob [%s] criado.", name));
  1033. return true;
  1034. }
  1035. }
  1036.  
  1037. else if (!strcmp(innerCmd, "+onlines"))
  1038. {
  1039. short num = 0;
  1040. for (int i = 0; i < 1000; i++)
  1041. {
  1042. if (NativeFunctions::getMobFromIndex(i)->Mob.Name[0] != 0 && PlayerStatus(i) == 22)
  1043. {
  1044. num++;
  1045. }
  1046. }
  1047.  
  1048. NativeFunctions::sendClientMessage(client, Functions::stringFormat("Conectados: %d", num));
  1049. return true;
  1050. }
  1051.  
  1052.  
  1053. else if (!strcmp(innerCmd, "+summon"))
  1054. {
  1055. char name[16] = { 0, };
  1056. if (sscanf_s(innerMsg, "%15s", name, _countof(name)))
  1057. {
  1058. auto id = NativeFunctions::getUserByName(name);
  1059. if (id >= 0)
  1060. {
  1061. NativeFunctions::doTeleport(id, mob->PosX, mob->PosY, 1);
  1062. NativeFunctions::sendClientMessage(id, "Você foi sumonado");
  1063. NativeFunctions::sendClientMessage(client, "Summonado");
  1064. return true;
  1065. }
  1066. else
  1067. {
  1068. NativeFunctions::sendClientMessage(client, "Jogador não encontrado");
  1069. return true;
  1070. }
  1071. return true;
  1072. }
  1073. }
  1074. else if (!strcmp(innerCmd, "+summonall"))
  1075. {
  1076. for (int i = 0; i < 740; i++)
  1077. {
  1078. if (&Global::Users[i] && PlayerStatus(i) == 22)
  1079. continue;
  1080.  
  1081. NativeFunctions::doTeleport(i, mob->LastPosX, mob->LastPosY, 0);
  1082. }
  1083.  
  1084. NativeFunctions::sendClientMessage(client, "Todos os jogadores foram sumonados com sucesso.");
  1085. return true;
  1086. }
  1087. else if (!strcmp(innerCmd, "+relo"))
  1088. {
  1089. int alvo = NativeFunctions::getUserByName(innerMsg);
  1090. if (alvo <= 0 || alvo >= 999) NativeFunctions::sendClientMessage(client, "Jogador desconectado.");
  1091. else
  1092. {
  1093. NativeFunctions::doTeleport(client, GetPosX(alvo), GetPosY(alvo), 0);
  1094. NativeFunctions::sendClientMessage(client, "Você se teleportou ate o Jogador");
  1095. }
  1096. return true;
  1097. }
  1098. else if (!strcmp(innerCmd, "+deletemob"))
  1099. {
  1100. uint16_t index = 0;
  1101. if (sscanf_s(innerMsg, "%hu", &index))
  1102. {
  1103. NativeFunctions::deleteMob(client, index, 5, 0);
  1104. }
  1105. return true;
  1106. }
  1107.  
  1108. else if (!strcmp(innerCmd, "+notice"))
  1109. {
  1110. char msg[96] = { 0, };
  1111. if (sscanf_s(innerMsg, "%95[^\n]", msg, _countof(msg)))
  1112. {
  1113. NativeFunctions::sendNotice(msg);
  1114. for (int i = 0; i < MAX_USER; i++)
  1115. Functions::SendClientChat(i, Functions::stringFormat("", mob->Mob.Name, msg), 0xFFCD5B45);
  1116.  
  1117.  
  1118. return true;
  1119. }
  1120. }
  1121.  
  1122. else if (!strcmp(innerCmd, "+item"))
  1123. {
  1124. uint16_t id = 0, ef1 = 0, ef2 = 0, ef3 = 0, efv1 = 0, efv2 = 0, efv3 = 0;
  1125. if (sscanf_s(innerMsg, "%hu %hu %hu %hu %hu %hu %hu", &id, &ef1, &efv1, &ef2, &efv2, &ef3, &efv3))
  1126. {
  1127. if (id > MAX_ITEMLIST || ef1 > 127 || ef2 > 127 || ef3 > 127 || efv1 > 255 || efv2 > 255 || efv3 > 255)
  1128. {
  1129. NativeFunctions::sendClientMessage(client, "Use valores menores.");
  1130. return true;
  1131. }
  1132. STRUCT_ITEM item = { id, ef1, efv1, ef2, efv2, ef3, efv3 };
  1133. NativeFunctions::putItem(client, &item);
  1134. NativeFunctions::sendClientMessage(client, Functions::stringFormat("Item [%s] criado.", Functions::getItemListItem(id)->Name));
  1135. return true;
  1136. }
  1137. }
  1138.  
  1139. else if (!strcmp(innerCmd, "+goto"))
  1140. {
  1141. uint16_t x = 0, y = 0;
  1142. if (sscanf_s(innerMsg, "%hu %hu", &x, &y) == 2)
  1143. {
  1144. if (x > 4096 || y > 4096)
  1145. {
  1146. NativeFunctions::sendClientMessage(client, "Use valores menores.");
  1147. return true;
  1148. }
  1149. NativeFunctions::doTeleport(client, x, y, 0);
  1150. return true;
  1151. }
  1152. }
  1153.  
  1154. else if (!strcmp(innerCmd, "+buff"))
  1155. {
  1156. uint16_t index = 0;
  1157. if (sscanf_s(innerMsg, "%hu", &index))
  1158. {
  1159. NativeFunctions::setAffect(client, index, 2, 0);
  1160. NativeFunctions::sendAffect(client);
  1161. Functions::getCurrentScore(client);
  1162. NativeFunctions::sendScore(client);
  1163. }
  1164. return true;
  1165. }
  1166.  
  1167. else if (!strcmp(innerCmd, "+nobuff"))
  1168. {
  1169. for (int i = 0; i < MAX_AFFECT; i++)
  1170. {
  1171. mob->Affects[i].Index = 0;
  1172. mob->Affects[i].Master = 0;
  1173. mob->Affects[i].Time = 0;
  1174. mob->Affects[i].Value = 0;
  1175. }
  1176. NativeFunctions::sendEtc(client);
  1177. Functions::getCurrentScore(client);
  1178. NativeFunctions::sendScore(client);
  1179. NativeFunctions::sendClientMessage(client, "+SET NOBUFF");
  1180. return true;
  1181. }
  1182.  
  1183.  
  1184. else if (!strcmp(innerCmd, "+slot"))
  1185. {
  1186. uint16_t index = 0;
  1187. if (sscanf_s(innerMsg, "%hu", &index))
  1188. {
  1189. NativeFunctions::sendClientMessage(client, Functions::stringFormat("Valor: %d", mob->Mob.Inventory[index].Index));
  1190. return true;
  1191. }
  1192. return true;
  1193. }
  1194. else if (!strcmp(innerCmd, "+add"))
  1195. {
  1196. char type[16] = { 0, };
  1197. uint16_t value = 0;
  1198. if (sscanf_s(innerMsg, "%15s %hu", type, _countof(type), &value) == 2)
  1199. {
  1200. uint16_t idx = 0;
  1201. if (!strcmp(type, "str"))
  1202. idx = 0;
  1203. else if (!strcmp(type, "int"))
  1204. idx = 1;
  1205. else if (!strcmp(type, "dex"))
  1206. idx = 2;
  1207. else if (!strcmp(type, "con"))
  1208. idx = 3;
  1209. else if (!strcmp(type, "sp1"))
  1210. idx = 4;
  1211. else if (!strcmp(type, "sp2"))
  1212. idx = 5;
  1213. else if (!strcmp(type, "sp3"))
  1214. idx = 6;
  1215. else if (!strcmp(type, "sp4"))
  1216. idx = 7;
  1217.  
  1218. if (mob->Mob.StatusPoint >= value && value > 0 && (idx >= 0 && idx <= 3))
  1219. {
  1220. auto curStat = *(uint16_t*)(&mob->Mob.BaseStatus.STR + idx);
  1221. if (curStat + value >= 32000)
  1222. value = 32000 - curStat;
  1223.  
  1224. *(uint16_t*)(&mob->Mob.BaseStatus.STR + idx) += value;
  1225. mob->Mob.StatusPoint -= value;
  1226.  
  1227. NativeFunctions::sendClientMessage(client, Functions::stringFormat("Adicionou [%d] no status [%d]", value, idx));
  1228. }
  1229. else if (mob->Mob.MasterPoint >= value && value > 0 && (idx >= 4 && idx <= 7))
  1230. {
  1231. idx -= 4; // 0, 1, 2, 3
  1232. static const uint32_t oitavas[3] = { LEARN_07, LEARN_15, LEARN_23 };
  1233. auto hasEight = false;
  1234. if (idx > 0)
  1235. if ((mob->Mob.Learn & oitavas[idx - 1]))
  1236. hasEight = true;
  1237.  
  1238. if (mob->Mob.BaseStatus.Masteries[idx] >= (hasEight ? 255 : 200))
  1239. {
  1240. NativeFunctions::sendClientMessage(client, Functions::stringFormat("Máximo de aprendizagem é de [%d]", hasEight ? 255 : 200));
  1241. return true;
  1242. }
  1243. if (mob->Mob.BaseStatus.Masteries[idx] + value >= (hasEight ? 255 : 200))
  1244. value = (hasEight ? 255 : 200) - mob->Mob.BaseStatus.Masteries[idx];
  1245.  
  1246. mob->Mob.BaseStatus.Masteries[idx] += value;
  1247. mob->Mob.MasterPoint -= value;
  1248.  
  1249. NativeFunctions::sendClientMessage(client, Functions::stringFormat("Adicionou [%d] na aprendizagem [%d]", value, idx));
  1250. }
  1251. NativeFunctions::getHpMp(&mob->Mob);
  1252. Functions::getCurrentScore(client);
  1253. NativeFunctions::sendScore(client);
  1254. NativeFunctions::sendEtc(client);
  1255. return true;
  1256. }
  1257. }
  1258. }
  1259. NativeFunctions::sendClientMessage(client, "Comando inválido.");
  1260. return true;
  1261. }
  1262.  
  1263. return false;
  1264. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement