local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
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 creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local storages = {
main_storage = 10001,
points_storage = 10002,
bosses_storage = 10003,
promote_storage = 10004,
demodras_storage = 10005,
tiquandas_revenge_storage = 10006,
demons_storage = 10007
}
for i = 19970, 19999 do
if getPlayerStorageValue(cid, i) == -1 then
doPlayerSetStorageValue(cid, i, 0)
end
end
local mainStorage = getPlayerStorageValue(cid, storages.main_storage)
local bossStorages = getPlayerStorageValue(cid, storages.bosses_storage)
local points = getPlayerStorageValue(cid, storages.points_storage)
local promote = getPlayerStorageValue(cid, storages.promote_storage)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if promote == -1 then
promote = 0
end
if points == -1 then
points = 0
end
local good_hunting = {"Happy hunting, old chap! Come back to me when you are through with your {task}.", "Good show, old chap! Speak to me again when you are done hunting."}
local good_job = {"That took some time, huh? Good hunting though. If you're up for another hunting mission just ask me for a {task}.", "If you're up for another hunting mission just ask me for a {task}."}
local huntsMan_rank = {
{id=11208, buy=0, sell=50, name="antlers"},
{id=10549, buy=0, sell=100, name="bloody pincers"},
{id=11183, buy=0, sell=35, name="crab pincers"},
{id=10573, buy=0, sell=55, name="cyclops toe"},
{id=10564, buy=0, sell=30, name="frosty ear of a troll"},
{id=11193, buy=0, sell=600, name="hydra head"},
{id=11366, buy=0, sell=80, name="lancer beetle shell"},
{id=10578, buy=0, sell=420, name="mutated bat ear"},
{id=11222, buy=0, sell=400, name="sabretooth"},
{id=11367, buy=0, sell=20, name="sandcrawler shell"},
{id=10547, buy=0, sell=280, name="scarab pincers"},
{id=11365, buy=0, sell=60, name="terramite legs"},
{id=11363, buy=0, sell=170, name="terramite shell"},
{id=11184, buy=0, sell=30000, name="terrorbird beak"},
{id=7398, buy=0, sell=500, name="cyclops trophy"},
{id=7401, buy=0, sell=500, name="minotaur trophy"}
}
local bigGameHunter_rank = {
{id=7397, buy=0, sell=3000, name="deer trophy"},
{id=7400, buy=0, sell=3000, name="lion trophy"},
{id=7394, buy=0, sell=3000, name="wolf trophy"}
}
for k,v in pairs(huntsMan_rank) do
table.insert(bigGameHunter_rank, k, v)
end
local trophyHunter_rank = {
{id=7396, buy=0, sell=20000, name="behemoth trophy"},
{id=7393, buy=0, sell=40000, name="demon trophy"},
{id=7399, buy=0, sell=10000, name="dragon lord trophy"},
{id=10518, buy=1000, sell=0, name="demon backpack"}
}
for k,v in pairs(bigGameHunter_rank) do
table.insert(trophyHunter_rank, k, v)
end
local items = {}
for _, item in ipairs(huntsMan_rank) do
items[item.id] = {storage = item.storage, item_id = item.id, buyPrice = item.buy, sellPrice = item.sell, subType = 0, realName = item.name}
end
local items = {}
for _, item in ipairs(bigGameHunter_rank) do
items[item.id] = {storage = item.storage, item_id = item.id, buyPrice = item.buy, sellPrice = item.sell, subType = 0, realName = item.name}
end
local items = {}
for _, item in ipairs(trophyHunter_rank) 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
local tasks = {
--level 5-49--
[1] = {name = "carniphilas", storage = 9999, expe = "yes", how_many = 1500,
begin_storage_value = 1, finish_storage_value = 2, talkstate = 1},
[2] = {name = "crocodiles", storage = 9998, expe = "yes", how_many = 800,
begin_storage_value = 3, finish_storage_value = 4, boss = "yes",
before_kill_boss = 1, after_kill_boss = 2, talkstate = 2},
[3] = {name = "tarantulas", storage = 9997, expe = "yes", how_many = 1500,
begin_storage_value = 5, finish_storage_value = 6, boss = "yes",
before_kill_boss = 3, after_kill_boss = 4, talkstate = 3},
[4] = {name = "stone golems", storage = 9996, expe = "yes", how_many = 2000,
begin_storage_value = 7, finish_storage_value = 8, talkstate = 4},
[5] = {name = "mammoths", storage = 9995, expe = "yes", how_many = 4000,
begin_storage_value = 9, finish_storage_value = 10, boss = "yes",
before_kill_boss = 5, after_kill_boss = 6, talkstate = 5},
--level 50-89--
[6] = {name = "ice golems", storage = 9994, expe = "yes", how_many = 15000,
begin_storage_value = 11, finish_storage_value = 12, boss = "yes",
before_kill_boss = 7, after_kill_boss = 8, talkstate = 6},
[7] = {name = "quaras", talkstate = 49},
[8] = {name = "elementals", talkstate = 48},
[9] = {name = "mutated rats", storage = 9987, expe = "yes", how_many = 10000,
begin_storage_value = 13, finish_storage_value = 14, boss = "yes",
before_kill_boss = 9, after_kill_boss = 10, talkstate = 7},
[10] = {name = "giant spiders", storage = 9986, expe = "yes", how_many = 5000,
begin_storage_value = 15, finish_storage_value = 16, boss = "yes",
before_kill_boss = 11, after_kill_boss = 12, talkstate = 8},
--level 90+ --
[11] = {name = "hydras", storage = 9985,
begin_storage_value = 17, finish_storage_value = 18, boss = "yes",
before_kill_boss = 13, after_kill_boss = 14, talkstate = 9},
[12] = {name = "sea serpents", storage = 9984,
begin_storage_value = 19, finish_storage_value = 20, boss = "yes",
before_kill_boss = 15, after_kill_boss = 16, talkstate = 10},
[13] = {name = "behemoths", storage = 9983,
begin_storage_value = 21, finish_storage_value = 22, boss = "yes",
before_kill_boss = 17, after_kill_boss = 18, talkstate = 11},
[14] = {name = "serpent spawns", storage = 9982,
begin_storage_value = 23, finish_storage_value = 24, boss = "yes",
before_kill_boss = 19, after_kill_boss = 20, talkstate = 12}
}
local others_tasks = {
--quaras--
[1] = {name = "quaras", storage = 9992, expe = "yes", how_many = 12000,
begin_storage_value = 24, finish_storage_value = 25, boss = "yes",
before_kill_boss = 21, after_kill_boss = 22, talkstate = 13},
[2] = {name = "quara scouts", storage = 9993, expe = "yes", how_many = 10000,
begin_storage_value = 26, finish_storage_value = 27, talkstate = 14},
--elementals--
[3] = {name = "fire", storage = 9991, expe = "yes", how_many = 7000,
begin_storage_value = 28, finish_storage_value = 29, talkstate = 15},
[4] = {name = "water", storage = 9990, expe = "yes", how_many = 7000,
begin_storage_value = 30, finish_storage_value = 31, talkstate = 16},
[5] = {name = "earth", storage = 9989, expe = "yes", how_many = 10000,
begin_storage_value = 32, finish_storage_value = 33, talkstate = 17},
[6] = {name = "energy", storage = 9988, expe = "yes", how_many = 10000,
begin_storage_value = 34, finish_storage_value = 35, talkstate = 18}
}
local rank = {
[1] = {need_points = 5, name = "Huntsman", storage_value = 0, talkstate = 50},
[2] = {need_points = 10, name = "Ranger", storage_value = 1, talkstate = 51},
[3] = {need_points = 20, name = "Big Game Hunter", storage_value = 2, talkstate = 52},
[4] = {need_points = 30, name = "Trophy Hunter", storage_value = 3, talkstate = 53},
[5] = {need_points = 50, name = "Elite Hunter", storage_value = 4, talkstate = 54}
}
local promotion = {
[1] = {talktype = 50, how_many_exp = 5000, finish_storage_values = 1},
[2] = {talktype = 51, how_many_exp = 8000, finish_storage_values = 2},
[3] = {talktype = 52, how_many_exp = 10000, finish_storage_values = 3},
[4] = {talktype = 53, how_many_exp = 15000, item = "yes", what = 10518, count = 1, finish_storage_values = 4},
[5] = {talktype = 54, how_many_exp = 30000, finish_storage_values = 5}
}
if msgcontains(msg, 'special task') then
if promote == 5 then
if getPlayerLevel(cid) >= 90 then
if getPlayerStorageValue(cid, storages.tiquandas_revenge_storage) == -1 then
doNPCTalkALot(cid, 200, {"Have you heared about Tiquandas Revenge? It is said that the jungle itself is alive and takes revenge for all the bad things people have done to it. ..."})
doNPCTalkALot(cid, 10000, {"I myself believe that there is some truth in this clap trap. Something 'real' which therefore must have a hideout somewhere. Go find it and take revenge yourself! Ask me about the special task when you're done."})
doPlayerSetStorageValue(cid, storages.tiquandas_revenge_storage, 0)
return true
elseif getPlayerStorageValue(cid, storages.tiquandas_revenge_storage) == 1 then
doNPCTalkALot(cid, 200, {"Great accievement, old chap! You are an outstanding hunter, no doubt about it!"})
doPlayerSetStorageValue(cid, storages.tiquandas_revenge_storage, 2)
return true
end
else
doNPCTalkALot(cid, 200, {"You are an eager one. Your rank within our hunting elite is great buuuut I believe you're a little inexperienced for the special tasks. Gain more experience and then you will be equal to the special task! I don't want to send you to your death!"})
end
if getPlayerLevel(cid) >= 100 then
if getPlayerStorageValue(cid, storages.tiquandas_revenge_storage) == 2 then
if getPlayerStorageValue(cid, storages.demodras_storage) == -1 then
doNPCTalkALot(cid, 200, {"Go kill Demodras."})
doPlayerSetStorageValue(cid, storages.demodras_storage, 0)
elseif getPlayerStorageValue(cid, storages.demodras_storage) == 1 then
doNPCTalkALot(cid, 200, {"Good job."})
doPlayerSetStorageValue(cid, storages.demodras_storage, 2)
end
end
if getPlayerStorageValue(cid, storages.demodras_storage) == 2 then
if getPlayerStorageValue(cid, storages.demons_storage) == -1 then
doNPCTalkALot(cid, 200, {"Go kill 6666 Demons."})
doPlayerSetStorageValue(cid, storages.demons_storage, 0)
doPlayerSetStorageValue(cid, 9981, 0)
doPlayerSetStorageValue(cid, storages.main_storage, 36)
elseif getPlayerStorageValue(cid, storages.demons_storage) == 1 and getPlayerStorageValue(cid, storages.main_storage) == 37 then
doNPCTalkALot(cid, 200, {"Amazing! You kill all 6666 dmeons!"})
doPlayerSetStorageValue(cid, storages.demons_storage, 2)
doPlayerSetStorageValue(cid, storages.main_storage, 0)
end
end
else
doNPCTalkALot(cid, 200, {"You are an eager one. Your rank within our hunting elite is great buuuut I believe you're a little inexperienced for the special tasks. Gain more experience and then you will be equal to the special task! I don't want to send you to your death!"})
end
end
elseif msgcontains(msg, 'trade') or msgcontains(msg, 'offer') then
if isInArray({1,2,3,4,5}, promote) then
if isInArray({1,2}, promote) then
openShopWindow(cid, huntsMan_rank, onBuy, onSell)
elseif isInArray({3}, promote) then
openShopWindow(cid, bigGameHunter_rank, onBuy, onSell)
elseif isInArray({4,5}, promote) then
openShopWindow(cid, trophyHunter_rank, onBuy, onSell)
end
doNPCTalkALot(cid, 200, {"It's my offer."})
else
doNPCTalkALot(cid, 200, {"You don't have any rank."})
end
elseif msgcontains(msg, 'cancel') then
if (mainStorage > 0 or bossStorages > 0) then
if isInArray({36,37}, mainStorage) == false then
doNPCTalkALot(cid, 200, {"Do you want cancel actual mission?"})
talkState[talkUser] = 103
else
doNPCTalkALot(cid, 200, {"You killed "..getPlayerStorageValue(cid, 9981).." of 6666 Demons."})
return true
end
else
doNPCTalkALot(cid, 200, {"You do not started any {task}."})
return true
end
elseif msgcontains(msg, 'yes') and talkState[talkUser] == 103 then
doNPCTalkALot(cid, 200, {"Speak to me again when you are done hunting."})
doPlayerSetStorageValue(cid, storages.main_storage, 0)
doPlayerSetStorageValue(cid, storages.bosses_storage, -1)
for i = 19970, 19999 do
if getPlayerStorageValue(cid, i) ~= -1 then
doPlayerSetStorageValue(cid, i, 0)
end
end
for k,v in pairs(tasks) do
if isInArray({0,1}, getPlayerStorageValue(cid, v.storage)) then
doPlayerSetStorageValue(cid, v.storage, -1)
end
end
elseif msgcontains(msg, 'task') then
if isInArray({-1,0}, mainStorage) and bossStorages == -1 then
if mainStorage == -1 then
mainStorage = 0
end
if (getPlayerLevel(cid) > 5 and getPlayerLevel(cid) < 50) then
doNPCTalkALot(cid, 200, {"All right, what would you like to hunt? {Crocodiles}, {tarantulas}, {carniphilas}, {stone golems} or {mammoths}?"})
talkState[talkUser] = 100
elseif (getPlayerLevel(cid) > 49 and getPlayerLevel(cid) < 90) then
doNPCTalkALot(cid, 200, {"All right, what would you like to hunt? {Ice golems}, {quara}, {elementals}, {mutated rats} or {giant spiders}?"})
talkState[talkUser] = 101
elseif (getPlayerLevel(cid) > 89) then
doNPCTalkALot(cid, 200, {"All right, what would you like to hunt? {Hydras}, {sea serpents}, {behemoths} or {serpent spawns}?"})
talkState[talkUser] = 102
end
end
end
for i = 1, #tasks do
if msgcontains(msg, tasks[i].name) then
if talkState[talkUser] == 100 then
if tasks[i].name == "carniphilas" then
doNPCTalkALot(cid, 200, {"Damn walking weed-thingies! You'll find them deeper in the jungle. Weed out {150 "..tasks[i].name.."} for our society. Alright?"})
elseif tasks[i].name == "crocodiles" then
doNPCTalkALot(cid, 200, {"They are a nuisance! You'll find them here in the jungle near the river. Hunt {300 "..tasks[i].name.."} and you'll get a nice reward. Interested?"})
elseif tasks[i].name == "tarantulas" then
doNPCTalkALot(cid, 200, {"Do you want kill {300 tarantulas?}"})
elseif tasks[i].name == "stone golems" then
doNPCTalkALot(cid, 200, {"They can be found all over Tibia. You'll find them in mountain caves or rocky dungeons. Hunt {200} of them and come back to me. Understood?"})
elseif tasks[i].name == "mammoths" then
doNPCTalkALot(cid, 200, {"This particular species are found in Svargrond. Impressive beasts, but you wouldn't want one in your back garden. Hunt {300} of them. Alright?"})
end
elseif talkState[talkUser] == 101 then
if tasks[i].name == "ice golems" then
doNPCTalkALot(cid, 200, {"The ice golems on the glacier of Hrodmir are becoming a threat to the civilians in Svargrond. Travel to the Ice Islands and hunt {300 "..tasks[i].name.."}. Do you accept this task?"})
elseif tasks[i].name == "quara" then
doNPCTalkALot(cid, 200, {"What do you want, {quaras} or {quara scouts?}"})
elseif tasks[i].name == "elementals" then
doNPCTalkALot(cid, 200, {"What do you want, {fire}, {water}, {earth} or {energy?}"})
elseif tasks[i].name == "mutated rats" then
doNPCTalkALot(cid, 200, {"Recently, I heard of a disturbing development in Yalahar - a plague of monstrous Mutated rats! If they were to spread to the rest of Tibia.. <shudders> My task for you is to contain their numbers in Yalahar. Hunt {200} of them. What do you say?"})
elseif tasks[i].name == "giant spiders" then
doNPCTalkALot(cid, 200, {"Never liked spiders. Entirely too many legs. And I always find them in my bath! Those nasty creepy crawlies are a threat to the hygiene of every living being in Tibia. Hunt {500} of them. Okay?"})
end
elseif talkState[talkUser] == 102 then
if tasks[i].name == "hydras" then
doNPCTalkALot(cid, 200, {"Do you want kill {2000 "..tasks[i].name.."?}"})
elseif tasks[i].name == "sea serpents" then
doNPCTalkALot(cid, 200, {"Do you want kill {2000 "..tasks[i].name.."?}"})
elseif tasks[i].name == "behemoths" then
doNPCTalkALot(cid, 200, {"Do you want kill {2000 "..tasks[i].name.."?}"})
elseif tasks[i].name == "serpent spawns" then
doNPCTalkALot(cid, 200, {"Do you want kill {1500 "..tasks[i].name.."?}"})
end
end
talkState[talkUser] = tasks[i].talkstate
elseif msgcontains(msg, 'yes') and talkState[talkUser] == tasks[i].talkstate and isInArray({-1,0}, mainStorage) then
doPlayerSetStorageValue(cid, storages.main_storage, tasks[i].begin_storage_value)
doNPCTalkALot(cid, 200, {good_hunting[math.random(1, #good_hunting)]})
doPlayerSetStorageValue(cid, tasks[i].storage, 0)
return true
elseif msgcontains(msg, 'task') then
if mainStorage == tasks[i].finish_storage_value and bossStorages == -1 then
if tasks[i].boss == "yes" then
doNPCTalkALot(cid, 200, {"Good job, go kill boss."})
doPlayerSetStorageValue(cid, storages.bosses_storage, tasks[i].before_kill_boss)
doPlayerSetStorageValue(cid, tasks[i].storage, 2)
return true
else
doPlayerSetStorageValue(cid, storages.main_storage, 0)
doPlayerSetStorageValue(cid, tasks[i].storage, -1)
doNPCTalkALot(cid, 200, {good_job[math.random(1, #good_job)]})
if tasks[i].expe == "yes" then
doPlayerAddExp(cid, tasks[i].how_many)
doSendAnimatedText(getPlayerPosition(cid), tasks[i].how_many, TEXTCOLOR_WHITE)
end
return true
end
elseif bossStorages == tasks[i].after_kill_boss then
doPlayerSetStorageValue(cid, storages.main_storage, 0)
doPlayerSetStorageValue(cid, storages.bosses_storage, -1)
doNPCTalkALot(cid, 200, {good_job[math.random(1, #good_job)]})
return true
elseif mainStorage == 36 then
doNPCTalkALot(cid, 200, {"You killed "..getPlayerStorageValue(cid, 9981).." of 6666 Demons."})
return true
elseif isInArray(tasks[i].before_kill_boss, bossStorages) then
doNPCTalkALot(cid, 200, {"You do not kill boss yet."})
end
elseif msgcontains(msg, 'no') and isInArray({i,15,16,17,18,48,49,50,51,52,53,54,100,101,102,103}, talkState[talkUser]) then
doNPCTalkALot(cid, 200, {"Ok then."})
end
end
for i = 1, #others_tasks do
if msgcontains(msg, others_tasks[i].name) then
if talkState[talkUser] == 49 then
if others_tasks[i].name == "quaras" then
doNPCTalkALot(cid, 200, {"Do you want kill {300 quaras?}"})
elseif others_tasks[i].name == "quara scouts" then
doNPCTalkALot(cid, 200, {"Do you want kill {300 quara scouts?}"})
end
elseif talkState[talkUser] == 48 then
if others_tasks[i].name == "fire" then
doNPCTalkALot(cid, 200, {"Don't get burnt! Your challenge, should you choose to accept it, is to kill {70 fire elementals or massive fire elementals}. Are you ready?"})
elseif others_tasks[i].name == "water" then
doNPCTalkALot(cid, 200, {"Alright, go hunt {70 water elementals or massive water elementals}. Don't forget your umbrella! Alright?"})
elseif others_tasks[i].name == "earth" then
doNPCTalkALot(cid, 200, {"Good choice! I need you to slay {70 earth elementals or massive earth elementals}. There are some in the so called Taboo-area in the eastern jungle of Tiquanda and I heard about a cave in Edron where you'll find them. Are you game?"})
elseif others_tasks[i].name == "energy" then
doNPCTalkALot(cid, 200, {"A brave hunter! Kill {70 energy elementals or massive energy elementals}. You'll find them in the mountains between Darama and Tiquanda. Are you sure you want to do this?"})
end
end
talkState[talkUser] = others_tasks[i].talkstate
elseif msgcontains(msg, 'yes') and talkState[talkUser] == others_tasks[i].talkstate and isInArray({-1,0}, mainStorage) then
doPlayerSetStorageValue(cid, storages.main_storage, others_tasks[i].begin_storage_value)
doNPCTalkALot(cid, 200, {good_hunting[math.random(1, #good_hunting)]})
if getPlayerStorageValue(cid, others_tasks[i].storage) < 0 then
doPlayerSetStorageValue(cid, others_tasks[i].storage, 0)
end
elseif msgcontains(msg, 'task') then
if mainStorage == others_tasks[i].finish_storage_value and bossStorages == -1 then
if others_tasks[i].boss == "yes" then
doPlayerSetStorageValue(cid, storages.main_storage, others_tasks[i].before_kill_boss)
else
doPlayerSetStorageValue(cid, storages.main_storage, 0)
doPlayerSetStorageValue(cid, others_tasks[i].storage, -1)
doNPCTalkALot(cid, 200, {good_job[math.random(1, #good_job)]})
if others_tasks[i].expe == "yes" then
doPlayerAddExp(cid, others_tasks[i].how_many)
doSendAnimatedText(getPlayerPosition(cid), others_tasks[i].how_many, TEXTCOLOR_WHITE)
end
end
elseif getStorage == others_tasks[i].after_kill_boss then
doPlayerSetStorageValue(cid, storages.main_storage, 0)
doPlayerSetStorageValue(cid, others_tasks[i].storage, -1)
doNPCTalkALot(cid, 200, {good_job[math.random(1, #good_job)]})
elseif isInArray(tasks[i].begin_storage_value, mainStorage) then
s = "You killed "
for k,v in pairs(other_tasks) do
if getPlayerStorageValue(cid, v.storage) >= 0 then
count = getPlayerStorageValue(cid, v.storage)
s = s ..count.." "..v.name.."."
end
end
doNPCTalkALot(cid, 200, {s})
elseif isInArray(others_tasks[i].before_kill_boss, bossStorages) then
doNPCTalkALot(cid, 200, {"You do not kill boss yet."})
end
end
end
for i = 1, #rank do
if msgcontains(msg, 'rank') then
if points >= rank[i].need_points then
if promote == rank[i].storage_value then
if rank[i].need_points >= 5 and promote == 0 then
doNPCTalkALot(cid, 200, {"Welcome back "..getCreatureName(cid)..". You have completed 5 tasks for our society. Ask me for a {promotion} to advance your rank!"})
elseif rank[i].need_points >= 10 and promote == 1 then
doNPCTalkALot(cid, 200, {"Welcome back "..getCreatureName(cid)..". You have completed 10 tasks for our society. Ask me for a {promotion} to advance your rank!"})
elseif rank[i].need_points >= 20 and promote == 2 then
doNPCTalkALot(cid, 200, {"Salutations "..getCreatureName(cid)..". You have completed 20 tasks for our society. Ask me for a {promotion} to advance your rank!"})
elseif rank[i].need_points >= 30 and promote == 3 then
doNPCTalkALot(cid, 200, {"Welcome back "..getCreatureName(cid)..". You have completed 30 tasks for our society. Ask me for a {promotion} to advance your rank!"})
elseif rank[i].need_points == 50 and promote == 4 then
doNPCTalkALot(cid, 200, {"By the gods....50 hunting tasks....this is austoding! Ask me for a {promotion} to advance your rank! And while you are here, I also have another special task for you."})
end
talkState[talkUser] = rank[i].talkstate
return true
end
elseif points <= rank[i].need_points then
if isInArray({-1,0}, promote) then
doNPCTalkALot(cid, 200, {"You don't have any rank. You have "..points.." points. On next level you need "..rank[i].need_points - points.." points."})
else
doNPCTalkALot(cid, 200, {"Your actualy rank is "..rank[i-1].name..". You have "..points.." points. On next level you need "..rank[i].need_points - points.." points."})
end
return true
end
end
end
for i = 1, #promotion do
if msgcontains(msg, 'promotion') then
if talkState[talkUser] == promotion[i].talktype then
if promote == promotion[i].finish_storage_values - 1 then
doPlayerAddExp(cid, promotion[i].how_many_exp)
doSendAnimatedText(getPlayerPosition(cid), promotion[i].how_many_exp, TEXTCOLOR_WHITE)
doPlayerSetStorageValue(cid, storages.promote_storage, promotion[i].finish_storage_values)
if talkState[talkUser] == 50 then
doNPCTalkALot(cid, 200, {"You have completed 5 tasks! Let me promote you to the first rank: {Huntsman}. Congratulations! ..."})
doNPCTalkALot(cid, 10000, {"If you find any trophies that you don't need, feel free to ask me for a {trade}."})
elseif talkState[talkUser] == 51 then
doNPCTalkALot(cid, 200, {"You have completed 10 hunting tasks. It's time for a promotion. You advance to the rank of {Ranger}. Congratulations! ..."})
doNPCTalkALot(cid, 10000, {"Oh, I made a deal with Lorek. He ships Rangers from our society - and higher ranks of course - to Banuta, Chor or near the mountain pass to Darama. Just ask him for a passage."})
elseif talkState[talkUser] == 52 then
doNPCTalkALot(cid, 200, {"Good show! You have completed 20 hunting tasks for the 'Paw and Fur - Hunting Elite. You have earned the right to join the ranks of those known as {Big game} {hunter}. Congratulations! ..."})
doNPCTalkALot(cid, 10000, {"From now on I'll buy more trophies from you!"})
elseif talkState[talkUser] == 53 then
doNPCTalkALot(cid, 200, {"Spiffing! You have done 30 hunting tasks! From now on you can call yourself a {Trophy hunter}. As a reward I have this special backpack for you and in addition you can sell some more rare trophies to me."})
elseif talkState[talkUser] == 54 then
doNPCTalkALot(cid, 200, {"Congratulations! You have made the highest rank: {Elite hunter}. If haven't yet done so ask me for the {special task}."})
if promotion[i].item == "yes" then
doPlayerAddItem(cid, promotion[i].what, promotion[i].count)
end
end
end
end
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())