Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  1. bool Compor::Comerciante(const int32_t client, MSG_STANDARD* header)
  2. {
  3. p379h *packet = (p379h*)header;
  4. auto mob = NativeFunctions::getMobFromIndex(header->ClientId);
  5. auto npc = NativeFunctions::getMobFromIndex(packet->mobID);
  6. auto user = Functions::getUserFromIndex(header->ClientId);
  7. auto userData = &Global::userData[header->ClientId];
  8.  
  9.  
  10. if (strcmp(npc->Mob.Name, "Forjador") == 0)//Aqui vc coloca o nome do mob que vc quer(precisa criar com os mesmos itens q estão aqui abaixo e com mesmo nome) Basta replicar para outras funções
  11. {
  12. if (npc->Mob.Inventory[packet->sellSlot].Index == 4038) // Vela do Coveiro
  13. {
  14. auto useSlot = Functions::getFirstSlot(packet->Header.ClientId, SlotType::Inventory, 412);
  15. if (useSlot == -1) {
  16. NativeFunctions::sendClientMessage(client, "Onde esta a P.O?");
  17. return false;
  18.  
  19. }
  20. auto useSlot1 = Functions::getFirstSlot(packet->Header.ClientId, SlotType::Inventory, 413);
  21. if (useSlot1 == -1) {
  22. NativeFunctions::sendClientMessage(client, "Onde esta a P.L?");
  23. return false;
  24.  
  25. }
  26. auto useSlot2 = Functions::getFirstSlot(packet->Header.ClientId, SlotType::Inventory, 419);
  27. if (useSlot2 == -1) {
  28. NativeFunctions::sendClientMessage(client, "Onde esta a Poeira?");
  29. return false;
  30.  
  31. }
  32. auto useSlot3 = Functions::getFirstSlot(packet->Header.ClientId, SlotType::Inventory, 420);
  33. if (useSlot3 == -1) {
  34. NativeFunctions::sendClientMessage(client, "Onde esta a Poeira?");
  35. return false;
  36.  
  37. }
  38. else
  39. {
  40. memset(&mob->Mob.Inventory[useSlot], 0, 8);
  41. Functions::amountMinus(&mob->Mob.Inventory[useSlot]);
  42. Functions::amountMinus(&mob->Mob.Inventory[useSlot1]);
  43. Functions::amountMinus(&mob->Mob.Inventory[useSlot2]);
  44. Functions::amountMinus(&mob->Mob.Inventory[useSlot3]);
  45. mob->Mob.Inventory[useSlot].Index = 4011;
  46. NativeFunctions::sendClientMessage(client, "Composição concluida");
  47.  
  48. NativeFunctions::sendItem(packet->Header.ClientId, (int32_t)SlotType::Inventory, useSlot, &mob->Mob.Inventory[useSlot]);
  49. NativeFunctions::sendItem(packet->Header.ClientId, (int32_t)SlotType::Inventory, useSlot1, &mob->Mob.Inventory[useSlot1]);
  50. NativeFunctions::sendItem(packet->Header.ClientId, (int32_t)SlotType::Inventory, useSlot2, &mob->Mob.Inventory[useSlot2]);
  51. NativeFunctions::sendItem(packet->Header.ClientId, (int32_t)SlotType::Inventory, useSlot3, &mob->Mob.Inventory[useSlot3]);
  52. NativeFunctions::sendEtc(client);
  53. return false;
  54. }
  55.  
  56. }
  57.  
  58.  
  59. return true;
  60. }
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. return true;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement