Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local bosses = {
- ['rat'] = {bestLoot = {
- [1] = {"ferumbras hat", "hat of the mad", "magic plate armor", "golden armor", "golden helmet"},
- [2] = {"dragon shield", "war hammer", "plate armor", "golden shied", "blue robe"},
- [3] = {"gold coin", "crystal coin", "small emerald", "golden legs", "golden boots"}
- }},
- {goodLoot = {
- oneTimeItem = {"ferumbras hat", "hat of the mad"},
- singleItem = {"dragon shield", "war hammer"},
- multiItem = {"gold coin", "crystal coin", "small emerald"}
- }},
- {worseLoot = {
- oneTimeItem = {"ferumbras hat", "hat of the mad"},
- singleItem = {"dragon shield", "war hammer"},
- multiItem = {"gold coin", "crystal coin", "small emerald"}
- }},
- {worstLoot = {
- oneTimeItem = {"ferumbras hat", "hat of the mad"},
- singleItem = {"dragon shield", "war hammer"},
- multiItem = {"gold coin", "crystal coin", "small emerald"}
- }},
- ['another monster'] = {bestLoot = {
- [1] = {"ferumbras hat", "hat of the mad", "magic plate armor", "golden armor", "golden helmet"},
- [2] = {"dragon shield", "war hammer", "plate armor", "golden shied", "blue robe"},
- [3] = {"gold coin", "crystal coin", "small emerald", "golden legs", "golden boots"}
- }},
- {goodLoot = {
- oneTimeItem = {"ferumbras hat", "hat of the mad"},
- singleItem = {"dragon shield", "war hammer"},
- multiItem = {"gold coin", "crystal coin", "small emerald"}
- }},
- {worseLoot = {
- oneTimeItem = {"ferumbras hat", "hat of the mad"},
- singleItem = {"dragon shield", "war hammer"},
- multiItem = {"gold coin", "crystal coin", "small emerald"}
- }},
- {worstLoot = {
- oneTimeItem = {"ferumbras hat", "hat of the mad"},
- singleItem = {"dragon shield", "war hammer"},
- multiItem = {"gold coin", "crystal coin", "small emerald"}
- }},
- }
- function onKill(creature, target)
- local targetMonster = target:getMonster()
- if not targetMonster then
- return true
- end
- local bossConfig = bosses[targetMonster:getName():lower()]
- if not bossConfig then
- return true
- end
- local player = creature:getPlayer()
- local monsterMaxHealth = targetMonster:getMaxHealth()
- local lootLoop = math.random(3)
- local loopAgain = bossConfig.bestLoot[1]
- local whatItem = math.random(#bossConfig.bestLoot)
- for i = 1, lootLoop do
- lootmsg = bossConfig.bestLoot[lootLoop][math.random(5)]
- local x = 1
- while x < whatItem do
- x = x + 1
- item2 = bossConfig.bestLoot[whatItem][#loopAgain]
- if whatItem == 3 then
- itemCount = math.random(30)
- lootmsg = "".. lootmsg ..", ".. itemCount .." ".. item2
- else
- lootmsg = "".. lootmsg ..", ".. item2
- end
- end
- end
- print(lootmsg)
- print(lootLoop)
- print(whatItem)
- player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your deeds have been noticed and the following items are available in your reward chest: ".. lootmsg ..".")
- local corpsePos = targetMonster:getPosition()
- local container = Game.createItem(21584, 1, corpsePos)
- container:addItem(item2, 5)
- -- for pid, damage in pairs(targetMonster:getDamageMap()) do
- -- local player = Player(pid)
- -- if player then
- -- if damage.total >= ((monsterMaxHealth / 100) * 30) and damage.total < ((monsterMaxHealth / 100) * 50) then
- -- elseif damage.total >= ((monsterMaxHealth / 100) * 50) and damage.total < ((monsterMaxHealth / 100) * 70) then
- -- player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your deeds have been noticed2.")
- -- elseif damage.total >= ((monsterMaxHealth / 100) * 70) and damage.total < ((monsterMaxHealth / 100) * 90) then
- -- player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your deeds have been noticed3.")
- -- elseif damage.total >= ((monsterMaxHealth / 100) * 90) then
- -- player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your deeds have been noticed4.")
- -- else
- -- player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your deeds have been noticed.")
- -- end
- -- end
- -- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement