Olá. Eu tenho um servidor War, como base o OT de war do Soldoran, e nele há este problema de clonar itens pelo NPC. Vi algumas pessoas reclamando aqui pelo forúm sobre o dupe e eu sofri com isso, achei esta solução para resolver o problema. Por falha humana, em todos npcs esquecerem de definir um valor minimo para os itens agrupáveis ser vendido, com isso se você coloca-se no elfbot auto buyitems IDdoITEM 0 ele iria comprar e não pagar nada. Para os que não corrigiram pelos NPCS tambem há como corrigir pelas sources.
npc.cpp
if(NpcState* npcState = getState(player, true)) { npcState->amount = amount; npcState->subType = count; npcState->itemId = itemId; npcState->buyPrice = getListItemPrice(itemId, SHOPEVENT_BUY); npcState->ignoreCap = ignoreCap; npcState->inBackpacks = inBackpacks; const NpcResponse* response = getResponse(player, npcState, EVENT_PLAYER_SHOPBUY); executeResponse(player, npcState, response); }
substitua por
if(NpcState* npcState = getState(player, true)) { if(amount <= 0){ amount = 1; } npcState->amount = amount; npcState->subType = count; npcState->itemId = itemId; npcState->buyPrice = getListItemPrice(itemId, SHOPEVENT_BUY); npcState->ignoreCap = ignoreCap; npcState->inBackpacks = inBackpacks; const NpcResponse* response = getResponse(player, npcState, EVENT_PLAYER_SHOPBUY); executeResponse(player, npcState, response); }
Créditos: gpedro
Outro método é retirar os itens agrupáveis do NPC e colocar para compra em alavancas ou baus.
Segue o SCRIPT abaixo.
local coin = 2160 -- sua moeda vip local lever = { [6001] = {5,2342}, [6002] = {5,2342} } function onUse(cid,item,fromPosition,itemEx,toPosition) if doPlayerRemoveItem(cid,coin,lever[item.actionid][1]) == FALSE then return doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "você precisa de "..lever[item.actionid][1].." " ..getItemNameById(coin)) end doPlayerAddItem(cid,lever[item.actionid][2], isItemStackable(lever[item.actionid][2]) and 1 or 1) doPlayerSendTextMessage(cid,22,"você comprou um " .. getItemNameById(lever[item.actionid][2])) doSendMagicEffect(getCreaturePosition(cid), math.random(28,30)) return true end
<action actionid="6001-6002" script="alavanca.lua"/>
Eu configurei para vender apenas 1 itens agrupaveis por vez.
Créditos : Vodkart