1local keywordHandler = KeywordHandler:new()
2local npcHandler = NpcHandler:new(keywordHandler)
3NpcSystem.parseParameters(npcHandler)
4
5-- OTServ event handling functions start
6function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
7function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
8function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
9function onThink() npcHandler:onThink() end
10-- OTServ event handling functions end
11
12function creatureSayCallback(cid, type, msg)
13 -- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, 14so you do not have to take care of that yourself.
15 if(npcHandler.focus ~= cid) then
16 return false
17 end
18
19 addon_need_premium = 'Sorry, you need a premium account to get addons.'
20 addon_have_already = 'Sorry, you already have this addon.'
21 addon_have_not_items = 'Sorry, you don\'t have these items.'
22 addon_give = 'Here you are.'
23 player_gold = getPlayerItemCount(cid,2148)
24 player_plat = getPlayerItemCount(cid,2152)*100
25 player_crys = getPlayerItemCount(cid,2160)*10000
26 player_money = player_gold + player_plat + player_crys
27
28 if msgcontains(msg, 'addons') then
29 selfSay('I can give you Citizen, Hunter, Knight, Mage, Nobleman, Summoner, Warrior, Barbarian, Druid, 30Wizard, Oriental, Pirate, Assassin, Beggar and Shaman addons.')
31 elseif msgcontains(msg, 'help') then
32 selfSay('To buy the first addon say \'first NAME addon\', for the second addon say \'second NAME 33addon\'.')
34------------------------------------------------ addon ------------------------------------------------
35 elseif msgcontains(msg, 'first citizen addon') then
36 if isPremium(cid) then
37 if getPlayerItemCount(cid,2160) >= 6 then
38>> selfSay('Do you want to buy the first citizen addon for 60k?')
talk_state = 1
else
selfSay('I need 60k for the first citizen addon. Come back when you have them.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 1 then
talk_state = 0
if getPlayerItemCount(cid,2160) >= 6 then
addon = getPlayerStorageValue(cid,10001)
if addon == -1 then
if doPlayerTakeItem(cid,2160,6) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 128, 1)
doPlayerAddAddon(cid, 136, 1)
setPlayerStorageValue(cid,10001,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'second citizen addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,2361) >= 1 then
selfSay('Did you bring me 1 frozen starlight?')
talk_state = 2
else
selfSay('I need 1 frozen starlight to give you the second citizen addon. Come back when you have this one.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 2 then
talk_state = 0
if getPlayerItemCount(cid,2361) >= 1 then
addon = getPlayerStorageValue(cid,10002)
if addon == -1 then
if doPlayerTakeItem(cid,2361,1) == 0
selfSay(addon_give)
doPlayerAddAddon(cid, 128, 2)
doPlayerAddAddon(cid, 136, 2)
setPlayerStorageValue(cid,10002,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'first hunter addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,5803) >= 1 then
selfSay('Did you bring me an arbalest?')
talk_state = 3
else
selfSay('I need an arbalest, to give you the first hunter addon. Come back when you have this.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 3 then
talk_state = 0
if getPlayerItemCount(cid,5803) >= 1 then
addon = getPlayerStorageValue(cid,20002)
if addon == -1 then
if doPlayerTakeItem(cid,5803,1) == 0
selfSay(addon_give)
doPlayerAddAddon(cid, 129, 1)
doPlayerAddAddon(cid, 137, 1)
setPlayerStorageValue(cid,20002,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'second hunter addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,2160) >= 6 then
selfSay('Did you bring me 60k?')
talk_state = 4
else
selfSay('I need 60k to give you the second hunter addon. Come back when you have them.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 4 then
talk_state = 0
if getPlayerItemCount(cid,2160) >= 6 then
addon = getPlayerStorageValue(cid,20001)
if addon == -1 then
if doPlayerTakeItem(cid,2160,6) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 129, 2)
doPlayerAddAddon(cid, 137, 2)
setPlayerStorageValue(cid,20001,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'first knight addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,2396) >= 1 and getPlayerItemCount(cid,2160) >= 6 then
selfSay('Did you bring me an ice rapier and 100k?')
talk_state = 5
else
selfSay('I need an ice rapier and 100k, to give you the first knight addon. Come back when you have them.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 5 then
talk_state = 0
if getPlayerItemCount(cid,2396) >= 1 and getPlayerItemCount(cid,2160) >= 6 then
addon = getPlayerStorageValue(cid,30001)
if addon == -1 then
if doPlayerTakeItem(cid,2396,1) == 0 and doPlayerTakeItem(cid,2160,6) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 131, 1)
doPlayerAddAddon(cid, 139, 1)
setPlayerStorageValue(cid,30001,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'second knight addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,6500) >= 35 and getPlayerItemCount(cid,2498) >= 1 then
selfSay('Did you bring me 35 demonic essence and a royal helmet?')
talk_state = 6
else
selfSay('I need 35 demonic essence and a royal helmet, to give you the second knight addon. Come back when you have them.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 6 then
talk_state = 0
if getPlayerItemCount(cid,6500) >= 35 and getPlayerItemCount(cid,2498) >= 1 then
addon = getPlayerStorageValue(cid,30002)
if addon == -1 then
if doPlayerTakeItem(cid,6500,35) == 0 and doPlayerTakeItem(cid,2498,1) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 131, 2)
doPlayerAddAddon(cid, 139, 2)
setPlayerStorageValue(cid,30002,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'first mage addon') then
if isPremium(cid) then
if getPlayerSex(cid) == 0 then
if getPlayerItemCount(cid,2160) >= 6 then
selfSay('Did you bring me 60k?')
talk_state = 7
else
selfSay('I need 60k, to give you the first mage addon. Come back when you have it.')
talk_state = 0
end
elseif getPlayerSex(cid) == 1 then
if getPlayerItemCount(cid,8892) >= 1 then
selfSay('Did you bring me an ethno coat?')
talk_state = 7
else
selfSay('I need an ethno coat to give you the first mage addon.')
talk_state = 0
end
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 7 then
talk_state = 0
if getPlayerSex(cid) == 0 then
if getPlayerItemCount(cid,2160) >= 6 then
addon = getPlayerStorageValue(cid,40001)
if addon == -1 then
if doPlayerTakeItem(cid,2160,6) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 141, 1)
setPlayerStorageValue(cid,40001,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
elseif getPlayerSex(cid) == 1 then
if getPlayerItemCount(cid,8892) >= 1 then
addon = getPlayerStorageValue(cid,40001)
if addon == -1 then
if doPlayerTakeItem(cid,8892,1) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 130, 1)
setPlayerStorageValue(cid,40001,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'second mage addon') then
if isPremium(cid) then
if getPlayerSex(cid) == 0 then
if getPlayerItemCount(cid,8918) >= 1 then
selfSay('Did you bring me a spellbook of dark mysteries?')
talk_state = 8
else
selfSay('I need a spellbook of dark mysteries, to give you the second mage addon. Come back when you have it.')
talk_state = 0
end
elseif getPlayerSex(cid) == 1 then
if getPlayerItemCount(cid,2195) >= 1 then
selfSay('Did you bring me a pair of boots of haste')
talk_state = 8
else
selfSay('I need a pair of boots of haste to give ya this addon HUEHUEHUE!')
talk_state = 0
end
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 8 then
talk_state = 0
if getPlayerSex(cid) == 0 then
if getPlayerItemCount(cid,8918) >= 1 then
addon = getPlayerStorageValue(cid,40002)
if addon == -1 then
if doPlayerTakeItem(cid,8918,1) then
selfSay(addon_give)
doPlayerAddAddon(cid, 141, 2)
setPlayerStorageValue(cid,40002,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
elseif getPlayerSex(cid) == 1 then
if getPlayerItemCount(cid,2195) >= 1 then
addon = getPlayerStorageValue(cid,40002)
if addon == -1 then
if doPlayerTakeItem(cid,2195,1) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 130, 2)
setPlayerStorageValue(cid,40002,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'first summoner addon') then
if isPremium(cid) then
if getPlayerSex(cid) == 1 then
if getPlayerItemCount(cid,2160) >= 6 then
selfSay('Did you bring me 60k?')
talk_state = 9
else
selfSay('I need 60k, to give you the first summoner addon. Come back when you have it.')
talk_state = 0
end
elseif getPlayerSex(cid) == 0 then
if getPlayerItemCount(cid,2160) >= 6 then
selfSay('Did you bring me 30k for reputation ;)?')
talk_state = 9
else
selfSay('I need 30k for your reputation, to give you the first summoner addon. Come back when you have it.')
talk_state = 0
end
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 9 then
talk_state = 0
if getPlayerSex(cid) == 1 then
if getPlayerItemCount(cid,2160) >= 6 then
addon = getPlayerStorageValue(cid,50001)
if addon == -1 then
if doPlayerTakeItem(cid,2160,6) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 133, 1)
setPlayerStorageValue(cid,50001,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
elseif getPlayerSex(cid) == 0 then
if getPlayerItemCount(cid,2160) >= 3 then
addon = getPlayerStorageValue(cid,50001)
if addon == -1 then
if doPlayerTakeItem(cid,2160,3) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 138, 1)
setPlayerStorageValue(cid,50001,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'second summoner addon') then
if isPremium(cid) then
if getPlayerSex(cid) == 1 then
if getPlayerItemCount(cid,2640) >= 1 then
selfSay('Did you bring me one pair of soft boots?')
talk_state = 10
else
selfSay('I need one pair of soft boots, to give you the second summoner addon. Come back when you have it.')
talk_state = 0
end
elseif getPlayerSex(cid) == 0 then
if getPlayerItemCount(cid,2160) >= 2 then
selfSay('Did you bring me 20k?')
talk_state = 10
else
selfSay('I need 20k, to give you the second summoner addon. Come back when you have it.')
talk_state = 0
end
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 10 then
talk_state = 0
if getPlayerSex(cid) == 1 then
if getPlayerItemCount(cid,2640) >= 1 then
addon = getPlayerStorageValue(cid,50002)
if addon == -1 then
if doPlayerTakeItem(cid,2640,1) then
selfSay(addon_give)
doPlayerAddAddon(cid, 133, 2)
setPlayerStorageValue(cid,50002,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
elseif getPlayerSex(cid) == 0 then
if getPlayerItemCount(cid,2160) >= 2 then
addon = getPlayerStorageValue(cid,50002)
if addon == -1 then
if doPlayerTakeItem(cid,2160,2) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 138, 2)
setPlayerStorageValue(cid,50002,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'first barbarian addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,6500) >= 100 then
selfSay('Did you bring me 100 demonic essence?')
talk_state = 11
else
selfSay('I need 100 demonic essence, to give you the first barbarian addon. Come back when you have them.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 11 then
talk_state = 0
if getPlayerItemCount(cid,6500) >= 100 then
addon = getPlayerStorageValue(cid,60001)
if addon == -1 then
if doPlayerTakeItem(cid,6500,100) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 143, 2)
doPlayerAddAddon(cid, 147, 2)
setPlayerStorageValue(cid,60001,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'second barbarian addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,2160) >= 10 then
selfSay('Did you bring me 100k?')
talk_state = 12
else
selfSay('I need 100k, to give you the second barbarian addon. Come back when you have them.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 12 then
talk_state = 0
if getPlayerItemCount(cid,2160) >= 10 then
addon = getPlayerStorageValue(cid,60002)
if addon == -1 then
if doPlayerTakeItem(cid,2160,10) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 143, 1)
doPlayerAddAddon(cid, 147, 1)
setPlayerStorageValue(cid,60002,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'first druid addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,2470) >= 1 and getPlayerItemCount(cid,2160) >= 8 then
selfSay('Did you bring me one golden legs and 80k?')
talk_state = 13
else
selfSay('I need one golden legs and 80k, to give you the first druid addon. Come back when you have them.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 13 then
talk_state = 0
if getPlayerItemCount(cid,2470) >= 1 and getPlayerItemCount(cid,2160) >= 8 then
addon = getPlayerStorageValue(cid,70001)
if addon == -1 then
if doPlayerTakeItem(cid,2470,1) == 0 and doPlayerTakeItem(cid,2160,8) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 144, 1)
doPlayerAddAddon(cid, 148, 1)
setPlayerStorageValue(cid,70001,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'second druid addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,2472) >= 1 then
selfSay('Did you bring me a magic plate armor?')
talk_state = 14
else
selfSay('I need a magic plate armor to give you this addon.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 14 then
talk_state = 0
if getPlayerItemCount(cid,2472) >= 1 then
addon = getPlayerStorageValue(cid,70002)
if addon == -1 then
if doPlayerTakeItem(cid,2472,1) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 144, 2)
doPlayerAddAddon(cid, 148, 2)
setPlayerStorageValue(cid,70002,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'first nobleman addon') then
if isPremium(cid) then
if player_money >= 150000 then
selfSay('Did you bring me 150000 gold coins?')
talk_state = 15
else
selfSay('I need 150000 gold coins, to give you the first nobleman addon. Come back when you have them.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 15 then
talk_state = 0
if player_money >= 150000 then
addon = getPlayerStorageValue(cid,80001)
if addon == -1 then
if pay(cid,150000) then
selfSay(addon_give)
doPlayerAddAddon(cid, 132, 1)
doPlayerAddAddon(cid, 140, 1)
setPlayerStorageValue(cid,80001,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'second nobleman addon') then
if isPremium(cid) then
if player_money >= 150000 then
selfSay('Did you bring me 150000 gold coins?')
talk_state = 16
else
selfSay('I need 150000 gold coins, to give you the second nobleman addon. Come back when you have them.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 16 then
talk_state = 0
if player_money >= 150000 then
addon = getPlayerStorageValue(cid,80002)
if addon == -1 then
if pay(cid,150000) then
selfSay(addon_give)
doPlayerAddAddon(cid, 132, 2)
doPlayerAddAddon(cid, 140, 2)
setPlayerStorageValue(cid,80002,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'first oriental addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,6528) >= 1 then
selfSay('Did you bring me an avenger?')
talk_state = 17
else
selfSay('I need an avenger, to give you the first oriental addon. Come back when you have it.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 17 then
talk_state = 0
if getPlayerItemCount(cid,6528) >= 1 then
addon = getPlayerStorageValue(cid,90001)
if addon == -1 then
if doPlayerTakeItem(cid,6528,1) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 146, 1)
doPlayerAddAddon(cid, 150, 1)
setPlayerStorageValue(cid,90001,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'second oriental addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,2160) >= 25 then
selfSay('Did you bring me 250k?')
talk_state = 18
else
selfSay('I need 250k, to give you the second oriental addon. Come back when you have them.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 18 then
talk_state = 0
if getPlayerItemCount(cid,2160) >= 25 then
addon = getPlayerStorageValue(cid,90002)
if addon == -1 then
if doPlayerTakeItem(cid,2160,25) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 146, 2)
doPlayerAddAddon(cid, 150, 2)
setPlayerStorageValue(cid,90002,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'first warrior addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,5919) >= 1 then
selfSay('Did you bring me a dragon claw?')
talk_state = 19
else
selfSay('I a dragon claw, to give you the first warrior addon. Come back when you have it.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 19 then
talk_state = 0
if getPlayerItemCount(cid,5919) >= 1 then
addon = getPlayerStorageValue(cid,100001)
if addon == -1 then
if doPlayerTakeItem(cid,5919,1) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 134, 1)
doPlayerAddAddon(cid, 142, 1)
setPlayerStorageValue(cid,100001,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'second warrior addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,2160) >= 8
selfSay('Did you bring me 80k?')
talk_state = 20
else
selfSay('I need 80k, to give you the second warrior addon. Come back when you have them.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 20 then
talk_state = 0
if getPlayerItemCount(cid,2160) >= 8 then
addon = getPlayerStorageValue(cid,100002)
if addon == -1 then
if doPlayerTakeItem(cid,2160,8) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 134, 2)
doPlayerAddAddon(cid, 142, 2)
setPlayerStorageValue(cid,100002,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'first wizard addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,2160) >= 10 then
selfSay('Did you bring me 100k?')
talk_state = 21
else
selfSay('I need 100k, to give you the first wizard addon. Come back when you have it.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 21 then
talk_state = 0
if getPlayerItemCount(cid,2160) >= 10 then
addon = getPlayerStorageValue(cid,110001)
if addon == -1 then
if doPlayerTakeItem(cid,2160,10) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 145, 2)
doPlayerAddAddon(cid, 149, 2)
setPlayerStorageValue(cid,110001,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'second wizard addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,2492) >= 1 then
selfSay('Did you bring me one dragon scale mail?')
talk_state = 22
else
selfSay('I need a dragon scale mail for this addon. Come back when you have them.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 22 then
talk_state = 0
if getPlayerItemCount(cid,2492) >= 1 then
addon = getPlayerStorageValue(cid,110001)
if addon == -1 then
if doPlayerTakeItem(cid,2492,1) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 145, 1)
doPlayerAddAddon(cid, 149, 1)
setPlayerStorageValue(cid,110002,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'first assassin addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,2160) >= 100 then
selfSay('Did you bring me 1kk?')
talk_state = 23
else
selfSay('I need 1kk, to give you the first assassin addon. Come back when you have it.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 23 then
talk_state = 0
if getPlayerItemCount(cid,2160) >= 100 then
addon = getPlayerStorageValue(cid,120001)
if addon == -1 then
if doPlayerTakeItem(cid,2160,100) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 152, 1)
doPlayerAddAddon(cid, 156, 1)
setPlayerStorageValue(cid,120001,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'second assassin addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,2160) >= 25 then
selfSay('Did you bring me 250k?')
talk_state = 24
else
selfSay('I need 250k, to give you the second assassin addon. Come back when you have them.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 24 then
talk_state = 0
if getPlayerItemCount(cid,2160) >= 25 then
addon = getPlayerStorageValue(cid,120002)
if addon == -1 then
if doPlayerTakeItem(cid,2160,25) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 152, 2)
doPlayerAddAddon(cid, 156, 2)
setPlayerStorageValue(cid,120002,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'first beggar addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,2160) >= 2
selfSay('Did you bring me 20k?')
talk_state = 25
else
selfSay('I need 20k, to give you the first beggar addon. Come back when you have it.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 25 then
talk_state = 0
if getPlayerItemCount(cid,2160) >= 2 then
addon = getPlayerStorageValue(cid,130001)
if addon == -1 then
if doPlayerTakeItem(cid,2160,2) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 153, 1)
doPlayerAddAddon(cid, 157, 1)
setPlayerStorageValue(cid,130001,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'second beggar addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,2160) >= 10 then
selfSay('Did you bring me 100k?')
talk_state = 26
else
selfSay('I need 100k, to give you the second beggar addon. Come back when you have them.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 26 then
talk_state = 0
if getPlayerItemCount(cid,2160) >= 10 then
addon = getPlayerStorageValue(cid,130002)
if addon == -1 then
if doPlayerTakeItem(cid,2160,10) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 153, 2)
doPlayerAddAddon(cid, 157, 2)
setPlayerStorageValue(cid,130002,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'first pirate addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,2393) >= 1 and getPlayerItemCount(cid,2432) >= 1 then
selfSay('Did you bring me 1 giant sword and 1 fire axe?')
talk_state = 27
else
selfSay('I need 1 giant sword and 1 fire axe, to give you the first pirate addon. Come back when you have it.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 27 then
talk_state = 0
if getPlayerItemCount(cid,2393) >= 1 and getPlayerItemCount(cid,2432) >= 1 then
addon = getPlayerStorageValue(cid,140001)
if addon == -1 then
if doPlayerTakeItem(cid,2393,1) == 0 and doPlayerTakeItem(cid,2432,1) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 151, 1)
doPlayerAddAddon(cid, 155, 1)
setPlayerStorageValue(cid,140001,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'second pirate addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,2160) >= 6 then
selfSay('Did you bring me 60k?')
talk_state = 28
else
selfSay('I need 60k, to give you the second pirate addon. Come back when you have them.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 28 then
talk_state = 0
if getPlayerItemCount(cid,2160) >= 6 then
addon = getPlayerStorageValue(cid,140002)
if addon == -1 then
if doPlayerTakeItem(cid,2160,6) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 151, 2)
doPlayerAddAddon(cid, 155, 2)
setPlayerStorageValue(cid,140002,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'first shaman addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,2160) >= 5 then
selfSay('Did you bring me 50k?')
talk_state = 29
else
selfSay('I need 50k, to give you the first shaman addon. Come back when you have it.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 29 then
talk_state = 0
if getPlayerItemCount(cid,2160) >= 5 then
addon = getPlayerStorageValue(cid,150001)
if addon == -1 then
if doPlayerTakeItem(cid,2160,5) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 154, 1)
doPlayerAddAddon(cid, 158, 1)
setPlayerStorageValue(cid,150001,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ addon ------------------------------------------------
elseif msgcontains(msg, 'second shaman addon') then
if isPremium(cid) then
if getPlayerItemCount(cid,2160) >= 5 then
selfSay('Did you bring me 50k?')
talk_state = 30
else
selfSay('I need 50k, to give you the second shaman addon. Come back when you have them.')
talk_state = 0
end
else
selfSay(addon_need_premium)
talk_state = 0
end
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 30 then
talk_state = 0
if getPlayerItemCount(cid,2160) >= 5 then
addon = getPlayerStorageValue(cid,150002)
if addon == -1 then
if doPlayerTakeItem(cid,2160,5) == 0 then
selfSay(addon_give)
doPlayerAddAddon(cid, 154, 2)
doPlayerAddAddon(cid, 158, 2)
setPlayerStorageValue(cid,150002,1)
end
else
selfSay(addon_have_already)
end
else
selfSay(addon_have_not_items)
end
------------------------------------------------ confirm no ------------------------------------------------
elseif msgcontains(msg, 'no') and (talk_state >= 1 and talk_state <= 34) then
selfSay('Ok than.')
talk_state = 0
end
-- Place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())