Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- bool Compor::Comerciante(const int32_t client, MSG_STANDARD* header)
- {
- p379h *packet = (p379h*)header;
- auto mob = NativeFunctions::getMobFromIndex(header->ClientId);
- auto npc = NativeFunctions::getMobFromIndex(packet->mobID);
- auto user = Functions::getUserFromIndex(header->ClientId);
- auto userData = &Global::userData[header->ClientId];
- 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
- {
- if (npc->Mob.Inventory[packet->sellSlot].Index == 4038) // Vela do Coveiro
- {
- auto useSlot = Functions::getFirstSlot(packet->Header.ClientId, SlotType::Inventory, 412);
- if (useSlot == -1) {
- NativeFunctions::sendClientMessage(client, "Onde esta a P.O?");
- return false;
- }
- auto useSlot1 = Functions::getFirstSlot(packet->Header.ClientId, SlotType::Inventory, 413);
- if (useSlot1 == -1) {
- NativeFunctions::sendClientMessage(client, "Onde esta a P.L?");
- return false;
- }
- auto useSlot2 = Functions::getFirstSlot(packet->Header.ClientId, SlotType::Inventory, 419);
- if (useSlot2 == -1) {
- NativeFunctions::sendClientMessage(client, "Onde esta a Poeira?");
- return false;
- }
- auto useSlot3 = Functions::getFirstSlot(packet->Header.ClientId, SlotType::Inventory, 420);
- if (useSlot3 == -1) {
- NativeFunctions::sendClientMessage(client, "Onde esta a Poeira?");
- return false;
- }
- else
- {
- memset(&mob->Mob.Inventory[useSlot], 0, 8);
- Functions::amountMinus(&mob->Mob.Inventory[useSlot]);
- Functions::amountMinus(&mob->Mob.Inventory[useSlot1]);
- Functions::amountMinus(&mob->Mob.Inventory[useSlot2]);
- Functions::amountMinus(&mob->Mob.Inventory[useSlot3]);
- mob->Mob.Inventory[useSlot].Index = 4011;
- NativeFunctions::sendClientMessage(client, "Composição concluida");
- NativeFunctions::sendItem(packet->Header.ClientId, (int32_t)SlotType::Inventory, useSlot, &mob->Mob.Inventory[useSlot]);
- NativeFunctions::sendItem(packet->Header.ClientId, (int32_t)SlotType::Inventory, useSlot1, &mob->Mob.Inventory[useSlot1]);
- NativeFunctions::sendItem(packet->Header.ClientId, (int32_t)SlotType::Inventory, useSlot2, &mob->Mob.Inventory[useSlot2]);
- NativeFunctions::sendItem(packet->Header.ClientId, (int32_t)SlotType::Inventory, useSlot3, &mob->Mob.Inventory[useSlot3]);
- NativeFunctions::sendEtc(client);
- return false;
- }
- }
- return true;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement