Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- RL Rashid Script by Zbizu, for OTLand.net --
- -- This script is 100% free and will be. You are not allowed to sell it! --
- -- special thanks to Dantez and Dubler for support with custom trade system --
- -- Yeah, yeah I suck in LUA, I know it could be shorter and shit, post better if you think this one is bad. --
- -- config begins here
- local MSG_MISSION_WRONG_DAY = "I'm not in the mood to talk about that right now. Come find me on another day."
- local MSG_MISSION_DONE = "You helped enough for today. Come back tomorrow."
- local MSG_MISSION_NEXT = "So, my friend, are you willing to proceed to the next mission to become a recognised trader?"
- local MSG_QUEST_DONE = "You don't need to prove anything anymore, old friend. If you want to {trade}, just ask."
- local DAY_GLOBALSTORAGE = 25358 -- must be same as in RashidHandler
- local TRADE_PLAYERSTORAGE = 25358
- local ENDSTORAGE = 13 -- last mission done storage
- -- put there storages npcs check before they give player questitem
- local Willard_storage = {85, 3}
- local Miraia_storage = {85, 9}
- local Briasol_storage = {85, 11}
- local Uzgod_storage = {85, 14}
- -- config ends here
- local keywordHandler = KeywordHandler:new()
- local npcHandler = NpcHandler:new(keywordHandler)
- NpcSystem.parseParameters(npcHandler)
- local talkState = {}
- local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
- local items = {}
- function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
- function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
- function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
- function onThink() npcHandler:onThink() end
- function onPlayerEndTrade(cid) npcHandler:onPlayerEndTrade(cid) end
- function onPlayerCloseChannel(cid) npcHandler:onPlayerCloseChannel(cid) 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 RashidList = {
- [1] = { -- armors
- {id=20109, sell=7000, name="Buckle"}, -- 981
- {id=8878, sell=16000, name="Crystalline Armor"},
- {id=8885, sell=55000, name="Divine Plate"},
- {id=2492, sell=40000, name="Dragon Scale Mail"},
- {id=2503, sell=30000, name="Dwarven Armor"},
- {id=9929, sell=1000, name="Flower Dress"},
- {id=7897, sell=11000, name="Glacier Robe"},
- {id=2466, sell=20000, name="Golden Armor"},
- {id=8873, sell=3000, name="Hibiscus Dress"},
- {id=8877, sell=16000, name="Lavos Armor"},
- {id=3968, sell=1000, name="Leopard Armor"},
- {id=7898, sell=11000, name="Lightning Robe"},
- {id=2472, sell=90000, name="Magic Plate Armor"},
- {id=7899, sell=11000, name="Magma Coat"},
- {id=7463, sell=6000, name="Mammoth Fur Cape"},
- {id=8891, sell=15000, name="Paladin Armor"},
- {id=6095, sell=500, name="Pirate Shirt"},
- {id=8889, sell=18000, name="Skullcracker Armor"},
- {id=8880, sell=16000, name="Swamplair Armor"},
- {id=7884, sell=11000, name="Terra Mantle"},
- },
- [2] = { -- legs
- {id=7896, sell=11000, name="Glacier Kilt"},
- {id=2470, sell=30000, name="Golden Legs"},
- {id=9928, sell=500, name="Leaf Legs"},
- {id=7895, sell=11000, name="Lightning Legs"},
- {id=7894, sell=11000, name="Magma Legs"},
- {id=7464, sell=850, name="Mammoth Fur Shorts"},
- {id=5918, sell=200, name="Pirate Knee Breeches"},
- {id=7885, sell=11000, name="Terra Legs"},
- },
- [3] = { -- shields
- {id=2541, sell=80, name="Bone Shield"},
- {id=2535, sell=5000, name="Castle Shield"},
- {id=2521, sell=400, name="Dark Shield"},
- {id=2520, sell=30000, name="Demon Shield"},
- {id=2514, sell=50000, name="Mastermind Shield"},
- {id=2536, sell=9000, name="Medusa Shield"},
- {id=7460, sell=1500, name="Norse Shield"},
- {id=2540, sell=2000, name="Scarab Shield"},
- {id=2542, sell=35000, name="Tempest Shield"},
- {id=6131, sell=150, name="Tortoise Shield"},
- },
- [4] = { -- helmets
- {id=5917, sell=150, name="Bandana"},
- {id=3972, sell=7500, name="Bonelord Helmet"},
- {id=12630, sell=40000, name="Cobra Crown"},
- {id=2462, sell=1000, name="Devil Helmet"},
- {id=9927, sell=500, name="Flower Wreath"},
- {id=7902, sell=2500, name="Glacier Mask"},
- {id=20132, sell=2000, name="Helmet of the Lost"}, -- 981
- {id=7461, sell=200, name="Krimhorn Helmet"},
- {id=7901, sell=2500, name="Lightning Headband"},
- {id=7900, sell=2500, name="Magma Monocle"},
- {id=6096, sell=1000, name="Pirate Hat"},
- {id=7462, sell=400, name="Ragnir Helmet"},
- {id=5741, sell=40000, name="Skull Helmet"},
- {id=7903, sell=2500, name="Terra Hood"},
- {id=10570, sell=5000, name="Witch Hat"},
- },
- [5] = { -- boots
- {id=9931, sell=500, name="Coconut Shoes"},
- {id=3982, sell=1000, name="Crocodile Boots"},
- {id=7457, sell=2000, name="Fur Boots"},
- {id=7892, sell=2500, name="Glacier Shoes"},
- {id=7893, sell=2500, name="Lightning Boots"},
- {id=7891, sell=2500, name="Magma Boots"},
- {id=2641, sell=2000, name="Patched Boots"},
- {id=5462, sell=3000, name="Pirate Boots"},
- {id=2645, sell=30000, name="Steel Boots"},
- {id=7886, sell=2500, name="Terra Boots"},
- },
- [6] = { -- weapons
- {id=7414, sell=20000, name="Abyss Hammer"},
- {id=7426, sell=8000, name="Amber Staff"},
- {id=7404, sell=20000, name="Assassin Dagger"},
- {id=3962, sell=1500, name="Beastslayer Axe"},
- {id=7403, sell=40000, name="Berserker"},
- {id=7406, sell=6000, name="Blacksteel Sword"},
- {id=7429, sell=40000, name="Blessed Sceptre"},
- {id=7379, sell=1500, name="Brutetamer's Staff"},
- {id=8850, sell=40000, name="Chain Bolter"},
- {id=7427, sell=9000, name="Chaos Mace"},
- {id=8855, sell=25000, name="Composite Hornbow"},
- {id=7415, sell=30000, name="Cranial Basher"},
- {id=18453, sell=35000, name="Crystal Crossbow"}, -- 96
- {id=2445, sell=12000, name="Crystal Mace"},
- {id=7449, sell=600, name="Crystal Sword"},
- {id=2439, sell=110, name="Daramanian Mace"},
- {id=2440, sell=1000, name="Daramanian Waraxe"},
- {id=7382, sell=36000, name="Demonrage Sword"},
- {id=7387, sell=3000, name="Diamond Sceptre"},
- {id=2451, sell=15000, name="Djinn Blade"},
- {id=7402, sell=15000, name="Dragon Slayer"},
- {id=7430, sell=3000, name="Dragonbone Staff"},
- {id=7419, sell=10000, name="Dreaded Cleaver"}, -- green djinn 15k
- {id=7438, sell=2000, name="Elvish Bow"},
- {id=2438, sell=8000, name="Epee"},
- {id=7432, sell=1000, name="Furry Club"},
- {id=2427, sell=11000, name="Guardian Halberd"},
- {id=2444, sell=30000, name="Hammer of Wrath"},
- {id=7380, sell=6000, name="Headchopper"},
- {id=2452, sell=50000, name="Heavy Mace"},
- {id=2442, sell=90, name="Heavy Machete"},
- {id=13838, sell=2000, name="Heavy Trident"}, -- 92
- {id=7389, sell=30000, name="Heroic Axe"},
- {id=7422, sell=25000, name="Jade Hammer"},
- {id=7390, sell=40000, name="Justice Seeker"},
- {id=7424, sell=5000, name="Lunar Staff"},
- {id=7381, sell=300, name="Mammoth Whopper"},
- {id=7386, sell=12000, name="Mercenary Sword"},
- {id=18454, sell=35000, name="Mycological Bow"}, -- 96
- {id=7384, sell=30000, name="Mystic Blade"},
- {id=2426, sell=2000, name="Naginata"},
- {id=7418, sell=35000, name="Nightmare Blade"},
- {id=7456, sell=10000, name="Noble Axe"},
- {id=7392, sell=6000, name="Orcish Maul"},
- {id=20108, sell=4000, name="Pair of Iron Fists"}, -- 981
- {id=2446, sell=23000, name="Pharaoh Sword"},
- {id=7383, sell=25000, name="Relic Sword"},
- {id=7434, sell=40000, name="Royal Axe"},
- {id=6553, sell=45000, name="Ruthless Axe"},
- {id=7437, sell=7000, name="Sapphire Hammer"},
- {id=2402, sell=500, name="Silver Dagger"},
- {id=7452, sell=5000, name="Spiked Squelcher"},
- {id=7425, sell=500, name="Taurus Mace"},
- {id=7388, sell=30000, name="Vile Axe"},
- {id=2454, sell=12000, name="War Axe"},
- {id=7408, sell=1500, name="Wyvern Fang"},
- },
- [7] = { -- ench wp
- {id=7866, sell=30000, name="Earth Cranial Basher"},
- {id=7858, sell=15000, name="Earth Dragon Slayer"},
- {id=7862, sell=6000, name="Earth Headchopper"},
- {id=7861, sell=30000, name="Earth Heroic Axe"},
- {id=7856, sell=30000, name="Earth Mystic Blade"},
- {id=7867, sell=6000, name="Earth Orcish Maul"},
- {id=7855, sell=25000, name="Earth Relic Sword"},
- {id=7863, sell=12000, name="Earth War Axe"},
- {id=7881, sell=30000, name="Energy Cranial Basher"},
- {id=7873, sell=15000, name="Energy Dragon Slayer"},
- {id=7877, sell=6000, name="Energy Headchopper"},
- {id=7876, sell=30000, name="Energy Heroic Axe"},
- {id=7871, sell=30000, name="Energy Mystic Blade"},
- {id=7882, sell=6000, name="Energy Orcish Maul"},
- {id=7870, sell=25000, name="Energy Relic Sword"},
- {id=7878, sell=12000, name="Energy War Axe"},
- {id=7756, sell=30000, name="Fiery Cranial Basher"},
- {id=7748, sell=15000, name="Fiery Dragon Slayer"},
- {id=7752, sell=6000, name="Fiery Headchopper"},
- {id=7751, sell=30000, name="Fiery Heroic Axe"},
- {id=7746, sell=30000, name="Fiery Mystic Blade"},
- {id=7757, sell=6000, name="Fiery Orcish Maul"},
- {id=7745, sell=25000, name="Fiery Relic Sword"},
- {id=7753, sell=12000, name="Fiery War Axe"},
- {id=7775, sell=30000, name="Icy Cranial Basher"},
- {id=7767, sell=15000, name="Icy Dragon Slayer"},
- {id=7771, sell=6000, name="Icy Headchopper"},
- {id=7770, sell=30000, name="Icy Heroic Axe"},
- {id=7765, sell=30000, name="Icy Mystic Blade"},
- {id=7776, sell=6000, name="Icy Orcish Maul"},
- {id=7764, sell=25000, name="Icy Relic Sword"},
- {id=7772, sell=12000, name="Icy War Axe"},
- },
- [8] = { -- jewelry
- {id=2142, sell=200, name="Ancient Amulet"},
- {id=11374, sell=1500, name="Beetle Necklace"},
- {id=2125, sell=500, name="Crystal Necklace"},
- {id=2124, sell=250, name="Crystal Ring"},
- {id=6300, sell=1000, name="Death Ring"},
- {id=2136, sell=32000, name="Demonbone Amulet"},
- {id=2127, sell=800, name="Emerald Bangle"},
- {id=7888, sell=1500, name="Glacier Amulet"},
- {id=2179, sell=8000, name="Gold Ring"},
- {id=10220, sell=3000, name="Leviathan's Amulet"},
- {id=7889, sell=1500, name="Lightning Pendant"},
- {id=7890, sell=1500, name="Magma Amulet"},
- {id=2171, sell=2500, name="Platinum Amulet"},
- {id=2123, sell=30000, name="Ring of the Sky"},
- {id=2133, sell=2000, name="Ruby Necklace"},
- {id=10219, sell=3000, name="Sacred Tree Amulet"},
- {id=2135, sell=200, name="Scarab Amulet"},
- {id=10221, sell=3000, name="Shockwave Amulet"},
- {id=2134, sell=150, name="Silver Brooch"},
- {id=7887, sell=1500, name="Terra Amulet"},
- },
- [9] = { -- misc
- {id=2110, sell=200, name="Doll"},
- {id=5710, sell=300, name="Light Shovel"},
- {id=5810, sell=500, name="Pirate Voodoo Doll"},
- {id=3955, sell=400, name="Voodoo Doll"},
- {id=2079, sell=8000, name="War Horn"},
- }
- }
- local RashidTypes = {
- ["armors"] = 1,
- ["legs"] = 2,
- ["shields"] = 3,
- ["helmets"] = 4,
- ["boots"] = 5,
- ["weapons"] = 6,
- ["enchanted weapons"] = 7,
- ["jewelry"] = 8,
- ["miscellaneous"] = 9
- }
- local onSell = function(cid, item, subType, amount, ignoreCap, inBackpacks)
- for _, item in ipairs(items) do
- items[item.id] = {item_id = item.id, sellPrice = item.sell, subType = 0}
- end
- if(subType < 1 or getItemInfo(items[item].item_id).stackable) then
- subType = -1
- end
- if(doPlayerRemoveItem(cid, items[item].item_id, amount, subType, ignoreEquipped)) then
- if amount > 1 then nm = getItemPluralNameById(items[item].item_id) else nm = getItemNameById(items[item].item_id) end
- if amount > 1 then nn = amount else nn = getItemArticleById(items[item].item_id) end
- doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Sold ' .. nn .. ' ' .. nm .. ' for ' .. amount * items[item].sellPrice .. ' gold.')
- doPlayerAddMoney(cid, amount * items[item].sellPrice)
- return true
- end
- end
- local function TypeWindow()
- openShopWindow(cid, RashidList[RashidTypes[msg]], onBuy, onSell)
- end
- local function AllWindow()
- openShopWindow(cid, items, onBuy, onSell)
- end
- if talkState[talkUser] == 19 and RashidTypes[msg] ~= null then
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) == ENDSTORAGE then
- closeShopWindow(cid)
- addEvent(TypeWindow, 10, cid)
- selfSay("Here.", cid)
- else
- selfSay("Sorry, but you do not belong to my exclusive customers. I have to make sure that I can trust in the quality of your wares.", cid)
- talkState[talkUser] = 0
- end
- end
- if msgcontains(msg, 'trade') or msgcontains(msg, 'offer') then
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) == ENDSTORAGE then
- items = {}
- for i=1, #RashidList do
- for k,v in pairs(RashidList[i]) do
- table.insert(items,v)
- end
- end
- closeShopWindow(cid)
- addEvent(AllWindow, 10, cid)
- selfSay("Of course, old friend. You can also browse only {armors}, {legs}, {shields}, {helmets}, {boots}, {weapons}, {enchanted weapons}, {jewelry} or {miscellaneous} stuff.", cid)
- talkState[talkUser] = 19
- else
- selfSay("Sorry, but you do not belong to my exclusive customers. I have to make sure that I can trust in the quality of your wares.", cid)
- talkState[talkUser] = 0
- end
- end
- -- mission handler begins here
- if msgcontains(msg, "no")then
- selfSay("Then stop wasting my time!", cid)
- talkState[talkUser] = 0
- npcHandler:releaseFocus(cid)
- end
- if msgcontains(msg, "yes") then
- if talkState[talkUser] == 18 then
- if doPlayerRemoveItem(cid,5929,1) then
- selfSay("Thank you!! Ah, this makes my day! I'll take the rest of the day off to get to know this little guy. Come see me tomorrow, if you like.", cid)
- doCreatureSetStorage(cid, TRADE_PLAYERSTORAGE, 12)
- else
- selfSay("This is not funny. Fulfill your promise or get out of my eyes!", cid)
- end
- talkState[talkUser] = 0
- npcHandler:releaseFocus(cid)
- elseif talkState[talkUser] == 17 then
- doCreatureSetStorage(cid, TRADE_PLAYERSTORAGE, 11)
- selfSay("Thanks so much! I'll be waiting eagerly for your return then.", cid)
- talkState[talkUser] = 0
- npcHandler:releaseFocus(cid)
- elseif talkState[talkUser] == 16 then
- talkState[talkUser] = 17
- npcHandler:say("My friend, it seems you have already learnt a lot about the art of trading. I think you are more than worthy to become a recognised trader. ...", cid)
- npcHandler:say("There is just one little favour that I would ask from you... something personal, actually, forgive my boldness. ...", cid, 8000)
- npcHandler:say("I have always dreamed to have a small pet, one that I could take with me and which wouldn't cause problems. ...", cid, 13000)
- npcHandler:say("Could you - just maybe - bring me a small goldfish in a bowl? I know that you would be able to get one, wouldn't you?", cid, 17000)
- elseif talkState[talkUser] == 15 then
- if doPlayerRemoveItem(cid,8209,1) then
- selfSay("Ha! You are clever indeed, well done! I'll take this from you. Come see me tomorrow, I think we two might get into business after all.", cid)
- doCreatureSetStorage(cid, TRADE_PLAYERSTORAGE, 10)
- else
- if getPlayerItemCount(cid, 11395) > 0 then
- selfSay("I don't even want to know what happend there. This quality is awful. Go to Uzgod and try again.", cid)
- else
- if getPlayerItemCount(cid, 7385) > 0 then
- selfSay("You paid too much for this one! Try again and remember that you may spend only 400 gold on it.", cid)
- else
- selfSay("It seems you lost it. Go and get another one!", cid)
- end
- end
- end
- talkState[talkUser] = 0
- npcHandler:releaseFocus(cid)
- elseif talkState[talkUser] == 14 then
- doCreatureSetStorage(cid, TRADE_PLAYERSTORAGE, 9)
- doCreatureSetStorage(cid, Uzgod_storage[1], Uzgod_storage[2])
- selfSay("Okay, I'm curious how you will do with Uzgod. Good luck!", cid)
- talkState[talkUser] = 0
- npcHandler:releaseFocus(cid)
- elseif talkState[talkUser] == 13 then
- talkState[talkUser] = 14
- npcHandler:say("Fine! There's one more skill that I need to test and which is cruicial for a successful trader. ...", cid)
- npcHandler:say("Of course you must be able to haggle, else you won't survive long in this business. To make things as hard as possible for you, I have the perfect trade partner for you. ...", cid, 8000)
- npcHandler:say("Dwarves are said to be the most stubborn of all traders. Travel to {Kazordoon} and try to get the smith Uzgod to sell a crimson sword to you. ...", cid, 13000)
- npcHandler:say("Of course, it has to be cheap. Don't come back with anything more expensive than 400 gold. ...", cid, 17000)
- npcHandler:say("And the quality must not suffer, of course! Everything clear and understood?", cid, 21000)
- elseif talkState[talkUser] == 12 then
- if doPlayerRemoveItem(cid,7582,1) then
- selfSay("I'm surprised that you managed to bring this vase without a single crack. That was what I needed to know, thank you.", cid)
- doCreatureSetStorage(cid, TRADE_PLAYERSTORAGE, 8)
- else
- selfSay("It seems you lost it. Go and get another one!", cid)
- end
- talkState[talkUser] = 0
- npcHandler:releaseFocus(cid)
- elseif talkState[talkUser] == 11 then
- doCreatureSetStorage(cid, TRADE_PLAYERSTORAGE, 7)
- doCreatureSetStorage(cid, Briasol_storage[1], Briasol_storage[2])
- selfSay("Okay, then please find Briasol in {Ab'Dendriel} and ask for a 'fine vase'.", cid)
- talkState[talkUser] = 0
- npcHandler:releaseFocus(cid)
- elseif talkState[talkUser] == 10 then
- talkState[talkUser] = 11
- npcHandler:say("Well, that's good to hear. From you as my trader and deliveryman, I expect more than bringing stinky cheese. ...", cid)
- npcHandler:say("I wonder if you are able to deliver goods so fragile they almost break when looked at. ...", cid, 6000)
- npcHandler:say("I have ordered a special elven vase from Briasol in Ab'Dendriel. Get it from him and don't even touch it, just bring it to me while I'm in Ankrahmun. Everything clear and understood?", cid, 12000)
- elseif talkState[talkUser] == 9 then
- if doPlayerRemoveItem(cid,8112,1) then
- selfSay("Mmmhh, the lovely odeur of scarab cheese! I really can't understand why most people can't stand it. Thanks, well done!", cid)
- doCreatureSetStorage(cid, TRADE_PLAYERSTORAGE, 6)
- else
- selfSay("This is NOT a scarab cheese! You can't fake its odour.", cid)
- end
- talkState[talkUser] = 0
- npcHandler:releaseFocus(cid)
- elseif talkState[talkUser] == 8 then
- doCreatureSetStorage(cid, TRADE_PLAYERSTORAGE, 5)
- doCreatureSetStorage(cid, Miraia_storage[1], Miraia_storage[2])
- selfSay("Okay, then please find Miraia in {Darashia} and ask her about the 'scarab cheese'.", cid)
- talkState[talkUser] = 0
- npcHandler:releaseFocus(cid)
- elseif talkState[talkUser] == 7 then
- talkState[talkUser] = 8
- npcHandler:say("Well, that's good to hear. From you as my trader and deliveryman, I expect more than carrying heavy packages. ...", cid)
- npcHandler:say("You also need to be fast and deliver wares in time. I have ordered a very special cheese wheel made from Darashian milk. ...", cid, 8000)
- npcHandler:say("Unfortunately, the high temperature in the desert makes it rot really fast, so it must not stay in the sun for too long. ...", cid, 15000)
- npcHandler:say("I'm also afraid that you might not be able to use ships because of the smell of the cheese. ...", cid, 19000)
- npcHandler:say("Please get the cheese from {Miraia} and bring it to me while I'm in {Port Hope}. Everything clear and understood?", cid, 25000)
- elseif talkState[talkUser] == 6 then
- if doPlayerRemoveItem(cid,7503,1) then
- selfSay("Great. Just place it over there - yes, thanks, that's it. Come see me another day, I'll be busy for a while now.", cid)
- doCreatureSetStorage(cid, TRADE_PLAYERSTORAGE, 4)
- else
- selfSay("Then find Willard and ask him for 'package for Rashid'. I'll be busy for a while now.", cid)
- end
- talkState[talkUser] = 0
- npcHandler:releaseFocus(cid)
- elseif talkState[talkUser] == 5 then
- doCreatureSetStorage(cid, TRADE_PLAYERSTORAGE, 3)
- doCreatureSetStorage(cid, Willard_storage[1], Willard_storage[2])
- selfSay("Fine. Then off you go, just ask {Willard} about the 'package for Rashid'.", cid)
- talkState[talkUser] = 0
- npcHandler:releaseFocus(cid)
- elseif talkState[talkUser] == 4 then
- talkState[talkUser] = 5
- npcHandler:say("Alright, that's good to hear. From you as my trader and deliveryman, I expect more than finding rare items. ...", cid)
- npcHandler:say("You also need to be able to transport heavy wares, weaklings won't get far here. I have ordered a special package from {Edron}. ...", cid, 8000)
- npcHandler:say("Pick it up from Willard and bring it back to me while I'm in Liberty Bay. Everything clear and understood?", cid, 15000)
- elseif talkState[talkUser] == 3 then
- if doPlayerRemoveItem(cid,7397,1) then
- selfSay("Well done! I'll take that from you. <snags it> Come see me another day, I'll be busy for a while now.", cid)
- doCreatureSetStorage(cid, TRADE_PLAYERSTORAGE, 2)
- else
- selfSay("Stop wasting my time, I am busy person.", cid)
- end
- talkState[talkUser] = 0
- npcHandler:releaseFocus(cid)
- elseif talkState[talkUser] == 2 then
- selfSay("Fine. Then get a hold of that {deer trophy} and bring it to me while I'm in {Svargrond}. Just ask me about your {mission}.", cid)
- doCreatureSetStorage(cid, TRADE_PLAYERSTORAGE, 1)
- talkState[talkUser] = 0
- npcHandler:releaseFocus(cid)
- elseif talkState[talkUser] == 1 then
- talkState[talkUser] = 2
- npcHandler:say("Very good! I need talented people who are able to handle my wares with care, find good offers and the like, so I'm going to test you. ...", cid)
- npcHandler:say("First, I'd like to see if you can dig up rare wares. Something like a ...", cid, 8000)
- npcHandler:say("mastermind shield! ...", cid, 15000)
- npcHandler:say("Haha, just kidding, fooled you there, didn't I? Always control your nerves, that's quite important during bargaining. ...", cid, 19000)
- npcHandler:say("Okay, all I want from you is one of these rare {deer trophies}. I have a customer here in {Svargrond} who ordered one, so I'd like you to deliver it to me while I'm in Svargrond. ...", cid, 25000)
- npcHandler:say("Everything clear and understood?", cid, 32000)
- end
- end
- if msgcontains(msg, "deer") or msgcontains(msg, "trophy") then
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) == 1 then
- if getPlayerItemCount(cid, 7397) > 0 then
- selfSay("Have you managed to obtain a rare deer trophy for my customer?", cid)
- talkState[talkUser] = 3
- else
- selfSay("Your mission is to find a deer trophy. I will accept this trophy only on mondays, so hurry up.", cid)
- talkState[talkUser] = 0
- end
- else
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) < 1 then
- selfSay("Currently I'm out of them, but if I get any I'll let you know.", cid)
- else
- selfSay("I don't need any at the moment, old friend. If you want to {trade} other items, just ask me.", cid)
- end
- talkState[talkUser] = 0
- end
- end
- if msgcontains(msg, "package") then
- if getGlobalStorageValue(DAY_GLOBALSTORAGE) == 2 then
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) == 3 then
- selfSay("Did you bring me the package?", cid)
- talkState[talkUser] = 6
- else
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) > 2 then
- selfSay(MSG_MISSION_DONE, cid)
- talkState[talkUser] = 0
- else
- selfSay(MSG_MISSION_WRONG_DAY, cid)
- talkState[talkUser] = 0
- end
- end
- end
- end
- if msgcontains(msg, "scarab") or msgcontains(msg, "cheese") then
- if getGlobalStorageValue(DAY_GLOBALSTORAGE) == 3 then
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) == 5 then
- selfSay("Have you brought the cheese?", cid)
- talkState[talkUser] = 9
- else
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) > 4 then
- selfSay(MSG_MISSION_DONE, cid)
- talkState[talkUser] = 0
- else
- selfSay(MSG_MISSION_WRONG_DAY, cid)
- talkState[talkUser] = 0
- end
- end
- end
- end
- if msgcontains(msg, "vase") then
- if getGlobalStorageValue(DAY_GLOBALSTORAGE) == 4 then
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) == 7 then
- selfSay("Have you brought the vase?", cid)
- talkState[talkUser] = 12
- else
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) > 6 then
- selfSay(MSG_MISSION_DONE, cid)
- talkState[talkUser] = 0
- else
- selfSay(MSG_MISSION_WRONG_DAY, cid)
- talkState[talkUser] = 0
- end
- end
- end
- end
- if msgcontains(msg, "crimson") or msgcontains(msg, "sword") then
- if getGlobalStorageValue(DAY_GLOBALSTORAGE) == 5 then
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) == 9 then
- selfSay("Have you brought a cheap but good crimson sword?", cid)
- talkState[talkUser] = 15
- else
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) > 8 then
- selfSay(MSG_MISSION_DONE, cid)
- talkState[talkUser] = 0
- else
- selfSay(MSG_MISSION_WRONG_DAY, cid)
- talkState[talkUser] = 0
- end
- end
- end
- end
- if msgcontains(msg, "fish") or msgcontains(msg, "bowl") then
- if getGlobalStorageValue(DAY_GLOBALSTORAGE) == 6 then
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) == 11 then
- selfSay("Have you brought me a gold fish??", cid)
- talkState[talkUser] = 18
- else
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) > 10 then
- selfSay(MSG_MISSION_DONE, cid)
- talkState[talkUser] = 0
- else
- selfSay(MSG_MISSION_WRONG_DAY, cid)
- talkState[talkUser] = 0
- end
- end
- end
- end
- if msgcontains(msg, "mission") then
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) > ENDSTORAGE then
- selfSay(MSG_QUEST_DONE, cid)
- talkState[talkUser] = 0
- else
- -- MONDAY --
- if getGlobalStorageValue(DAY_GLOBALSTORAGE) == 1 then
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) > 1 then
- selfSay(MSG_MISSION_DONE, cid)
- talkState[talkUser] = 0
- else
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) == 1 then
- selfSay("Have you managed to obtain a rare deer trophy for my customer?", cid)
- talkState[talkUser] = 3
- else
- selfSay("Well, you could attempt the mission to become a recognised trader, but it requires a lot of travelling. Are you willing to try?", cid)
- talkState[talkUser] = 1
- end
- end
- -- TUESDAY --
- elseif getGlobalStorageValue(DAY_GLOBALSTORAGE) == 2 then
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) == 3 then
- selfSay("Did you bring me the package?", cid)
- talkState[talkUser] = 6
- else
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) == 2 then
- selfSay(MSG_MISSION_NEXT, cid)
- talkState[talkUser] = 4
- else
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) > 2 then
- selfSay(MSG_MISSION_DONE, cid)
- talkState[talkUser] = 0
- else
- selfSay(MSG_MISSION_WRONG_DAY, cid)
- talkState[talkUser] = 0
- end
- end
- end
- -- WEDNESDAY --
- elseif getGlobalStorageValue(DAY_GLOBALSTORAGE) == 3 then
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) == 5 then
- selfSay("Have you brought the cheese?", cid)
- talkState[talkUser] = 9
- else
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) == 4 then
- selfSay(MSG_MISSION_NEXT, cid)
- talkState[talkUser] = 7
- else
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) > 4 then
- selfSay(MSG_MISSION_DONE, cid)
- talkState[talkUser] = 0
- else
- selfSay(MSG_MISSION_WRONG_DAY, cid)
- talkState[talkUser] = 0
- end
- end
- end
- -- THURSDAY --
- elseif getGlobalStorageValue(DAY_GLOBALSTORAGE) == 4 then
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) == 7 then
- selfSay("Have you brought the vase?", cid)
- talkState[talkUser] = 12
- else
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) == 6 then
- selfSay(MSG_MISSION_NEXT, cid)
- talkState[talkUser] = 10
- else
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) > 6 then
- selfSay(MSG_MISSION_DONE, cid)
- talkState[talkUser] = 0
- else
- selfSay(MSG_MISSION_WRONG_DAY, cid)
- talkState[talkUser] = 0
- end
- end
- end
- -- FRIDAY --
- elseif getGlobalStorageValue(DAY_GLOBALSTORAGE) == 5 then
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) == 9 then
- selfSay("Have you brought a cheap but good crimson sword?", cid)
- talkState[talkUser] = 15
- else
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) == 8 then
- selfSay(MSG_MISSION_NEXT, cid)
- talkState[talkUser] = 13
- else
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) > 8 then
- selfSay(MSG_MISSION_DONE, cid)
- talkState[talkUser] = 0
- else
- selfSay(MSG_MISSION_WRONG_DAY, cid)
- talkState[talkUser] = 0
- end
- end
- end
- -- SATURDAY --
- elseif getGlobalStorageValue(DAY_GLOBALSTORAGE) == 6 then
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) == 11 then
- selfSay("Have you brought me a gold fish??", cid)
- talkState[talkUser] = 18
- else
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) == 10 then
- selfSay(MSG_MISSION_NEXT, cid)
- talkState[talkUser] = 16
- else
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) > 10 then
- selfSay(MSG_MISSION_DONE, cid)
- talkState[talkUser] = 0
- else
- selfSay(MSG_MISSION_WRONG_DAY, cid)
- talkState[talkUser] = 0
- end
- end
- end
- -- SUNDAY --
- elseif getGlobalStorageValue(DAY_GLOBALSTORAGE) == 7 then
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) == 12 then
- selfSay("Ah, right. <ahem> I hereby declare you - one of my recognised traders! Feel free to offer me your wares!", cid)
- doCreatureSetStorage(cid, TRADE_PLAYERSTORAGE, 13)
- -- if your server uses achievement system place recognised trader achievement here
- else
- if getCreatureStorage(cid, TRADE_PLAYERSTORAGE) > 12 then
- selfSay(MSG_MISSION_DONE, cid)
- else
- selfSay(MSG_MISSION_WRONG_DAY, cid)
- end
- end
- talkState[talkUser] = 0
- else
- selfSay(MSG_MISSION_WRONG_DAY .. " I don't even know what day is it. Please report that issue to server administrator.", cid)
- print("\n[Warning - " .. getCreatureName(getNpcId()) .. "] RashidHandler: Wrong global storage! \nRashidHandler wasn't installed or is disabled! \nIt's impossible to do The Travelling Trader Quest now!")
- end
- end
- end
- -- mission handler ends here
- return true
- end
- npcHandler:setCallback(CALLBACK_GREET, greetCallback)
- npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
- npcHandler:addModule(FocusModule:new())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement