Advertisement
Guest User

Untitled

a guest
Jan 21st, 2015
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.82 KB | None | 0 0
  1. local bosses = {
  2. ['rat'] = {bestLoot = {
  3. [1] = {"ferumbras hat", "hat of the mad", "magic plate armor", "golden armor", "golden helmet"},
  4. [2] = {"dragon shield", "war hammer", "plate armor", "golden shied", "blue robe"},
  5. [3] = {"gold coin", "crystal coin", "small emerald", "golden legs", "golden boots"}
  6. }},
  7. {goodLoot = {
  8. oneTimeItem = {"ferumbras hat", "hat of the mad"},
  9. singleItem = {"dragon shield", "war hammer"},
  10. multiItem = {"gold coin", "crystal coin", "small emerald"}
  11. }},
  12. {worseLoot = {
  13. oneTimeItem = {"ferumbras hat", "hat of the mad"},
  14. singleItem = {"dragon shield", "war hammer"},
  15. multiItem = {"gold coin", "crystal coin", "small emerald"}
  16. }},
  17. {worstLoot = {
  18. oneTimeItem = {"ferumbras hat", "hat of the mad"},
  19. singleItem = {"dragon shield", "war hammer"},
  20. multiItem = {"gold coin", "crystal coin", "small emerald"}
  21. }},
  22.  
  23. ['another monster'] = {bestLoot = {
  24. [1] = {"ferumbras hat", "hat of the mad", "magic plate armor", "golden armor", "golden helmet"},
  25. [2] = {"dragon shield", "war hammer", "plate armor", "golden shied", "blue robe"},
  26. [3] = {"gold coin", "crystal coin", "small emerald", "golden legs", "golden boots"}
  27. }},
  28. {goodLoot = {
  29. oneTimeItem = {"ferumbras hat", "hat of the mad"},
  30. singleItem = {"dragon shield", "war hammer"},
  31. multiItem = {"gold coin", "crystal coin", "small emerald"}
  32. }},
  33. {worseLoot = {
  34. oneTimeItem = {"ferumbras hat", "hat of the mad"},
  35. singleItem = {"dragon shield", "war hammer"},
  36. multiItem = {"gold coin", "crystal coin", "small emerald"}
  37. }},
  38. {worstLoot = {
  39. oneTimeItem = {"ferumbras hat", "hat of the mad"},
  40. singleItem = {"dragon shield", "war hammer"},
  41. multiItem = {"gold coin", "crystal coin", "small emerald"}
  42. }},
  43. }
  44.  
  45. function onKill(creature, target)
  46. local targetMonster = target:getMonster()
  47. if not targetMonster then
  48. return true
  49. end
  50.  
  51. local bossConfig = bosses[targetMonster:getName():lower()]
  52. if not bossConfig then
  53. return true
  54. end
  55.  
  56. local player = creature:getPlayer()
  57. local monsterMaxHealth = targetMonster:getMaxHealth()
  58. local lootLoop = math.random(3)
  59. local loopAgain = bossConfig.bestLoot[1]
  60. local whatItem = math.random(#bossConfig.bestLoot)
  61.  
  62. for i = 1, lootLoop do
  63. lootmsg = bossConfig.bestLoot[lootLoop][math.random(5)]
  64. local x = 1
  65. while x < whatItem do
  66. x = x + 1
  67. item2 = bossConfig.bestLoot[whatItem][#loopAgain]
  68. if whatItem == 3 then
  69. itemCount = math.random(30)
  70. lootmsg = "".. lootmsg ..", ".. itemCount .." ".. item2
  71. else
  72. lootmsg = "".. lootmsg ..", ".. item2
  73. end
  74. end
  75. end
  76.  
  77. print(lootmsg)
  78. print(lootLoop)
  79. print(whatItem)
  80.  
  81. player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your deeds have been noticed and the following items are available in your reward chest: ".. lootmsg ..".")
  82.  
  83. local corpsePos = targetMonster:getPosition()
  84. local container = Game.createItem(21584, 1, corpsePos)
  85. container:addItem(item2, 5)
  86.  
  87. -- for pid, damage in pairs(targetMonster:getDamageMap()) do
  88. -- local player = Player(pid)
  89. -- if player then
  90. -- if damage.total >= ((monsterMaxHealth / 100) * 30) and damage.total < ((monsterMaxHealth / 100) * 50) then
  91. -- elseif damage.total >= ((monsterMaxHealth / 100) * 50) and damage.total < ((monsterMaxHealth / 100) * 70) then
  92. -- player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your deeds have been noticed2.")
  93. -- elseif damage.total >= ((monsterMaxHealth / 100) * 70) and damage.total < ((monsterMaxHealth / 100) * 90) then
  94. -- player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your deeds have been noticed3.")
  95. -- elseif damage.total >= ((monsterMaxHealth / 100) * 90) then
  96. -- player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your deeds have been noticed4.")
  97. -- else
  98. -- player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your deeds have been noticed.")
  99. -- end
  100. -- end
  101. -- end
  102. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement