krycha1998
Advanced User
- Joined
- May 22, 2009
- Messages
- 199
- Reaction score
- 6
Witam,problem z silnikiem ,mianowicie :
1.NPC sprzedaje za du?o ,mp,gmp etc.
*polega to na tym ,je?eli kupimy np.50 mp dostajemy ok.3k;<,tak samo z runami.Wandy/rody dzia?aj? bez problem?w :
o to m?j skrypt
Posiadam silnik TFS 0.4 trunk r.3884
Prosz? o szybk? pomoc !
P.S.w razie problem?w b?d? edytowa? ten dzia? ,wi?c w wolnej chwili zajrzyj tu xDD
1.NPC sprzedaje za du?o ,mp,gmp etc.
*polega to na tym ,je?eli kupimy np.50 mp dostajemy ok.3k;<,tak samo z runami.Wandy/rody dzia?aj? bez problem?w :
o to m?j skrypt
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local trade = {
{id=2187, buy=15000, sell=3000, name="wand of inferno"},
{id=2175, buy=150, sell=10, name="spellbook"},
{id=8704, buy=20, sell=10, name="small healht potion"},
{id=2163, buy=450, sell=10, name="magic lightwand"},
{id=7618, buy=10, sell=10, name="health potion"},
{id=7620, buy=50, sell=10, name="mana potion"},
{id=7588, buy=100, sell=10, name="strong health potion"},
{id=7589, buy=80, sell=10, name="strong mana potion"},
{id=7591, buy=190, sell=10, name="great health potion"},
{id=7590, buy=120, sell=10, name="great mana potion"},
{id=8472, buy=190, sell=10, name="great spirit potion"},
{id=8473, buy=310, sell=10, name="ultimate health potion"},
{id=8474, buy=50, sell=10, name="antidote potion"},
{id=2265, buy=95, sell=10, name="intensive healing rune"},
{id=2273, buy=175, sell=10, name="ultimate healing rune"},
{id=2293, buy=350, sell=10, name="magic wall rune"},
{id=2261, buy=45, sell=10, name="destroy field rune"},
{id=2287, buy=45, sell=10, name="light magic missile rune"},
{id=7635, buy=15, sell=10, name="heavy magic missile rune"},
{id=2304, buy=180, sell=10, name="great fireball rune"},
{id=2313, buy=350, sell=10, name="explosion rune"},
{id=2268, buy=30, sell=10, name="sudden death rune"},
{id=2263, buy=300, sell=10, name="death arrow rune"},
{id=2278, buy=700, sell=10, name="paralyze rune"},
{id=2316, buy=375, sell=10, name="animate dead rune"},
{id=2290, buy=80, sell=10, name="convince creature rune"},
{id=2291, buy=210, sell=10, name="chameleon rune"},
{id=2310, buy=80, sell=10, name="desintegreat rune"},
{id=2190, buy=500, sell=10, name="wand of vortex"},
{id=2191, buy=1000, sell=10, name="wand of dragonbreath"},
{id=2188, buy=5000, sell=10, name="wand of decay"},
{id=9821, buy=7500, sell=10, name="wand of draconia"},
{id=8920, buy=18000, sell=10, name="wand of starstorm"},
{id=8922, buy=22000, sell=10, name="wand of voodoo"},
{id=2182, buy=500, sell=10, name="snakebite rod"},
{id=2186, buy=1000, sell=10, name="moonlight rod"},
{id=2185, buy=5000, sell=10, name="necrotic rod"},
{id=8911, buy=7500, sell=10, name="northwind rod"},
{id=2181, buy=10000, sell=10, name="terra rod"},
{id=2183, buy=15000, sell=10, name="hailstorm rod"},
{id=8912, buy=18000, sell=10, name="springsprout rod"},
{id=8910, buy=22000, sell=10, name="underworld rod"},
{id=2189, buy=10000, sell=2500, name="wand of cosmic energy"}
}
local items = {}
for _, item in ipairs(trade) do
items[item.id] = {storage = item.storage, item_id = item.id, buyPrice = item.buy, sellPrice = item.sell, subType = 0, realName = item.name}
end
local onBuy = function(cid, item, subType, amount, ignoreCap, inBackpacks)
if items[item].buyPrice ~= 0 then
doPlayerRemoveMoney(cid, amount * items[item].buyPrice)
for i = 1, amount do
doPlayerAddItem(cid, items[item].item_id, amount)
end
doNPCTalkALot(cid, 200, {"You bought "..amount.." "..items[item].realName.." for "..items[item].buyPrice * amount.." gold coins."})
end
end
local onSell = function(cid, item, subType, amount, ignoreCap, inBackpacks)
if items[item].sellPrice ~= 0 then
doPlayerAddMoney(cid, items[item].sellPrice * amount)
doPlayerRemoveItem(cid, items[item].item_id, amount)
doNPCTalkALot(cid, 200, {"You sell "..amount.." "..items[item].realName.." for "..items[item].sellPrice * amount.." gold coins."})
end
end
if msgcontains(msg, 'trade') or msgcontains(msg, 'offer') then
openShopWindow(cid, trade, onBuy, onSell)
selfSay("It's my offer.", cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Posiadam silnik TFS 0.4 trunk r.3884
Prosz? o szybk? pomoc !
P.S.w razie problem?w b?d? edytowa? ten dzia? ,wi?c w wolnej chwili zajrzyj tu xDD