Nuor

lootmoney.script

Dec 19th, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.54 KB | None | 0 0
  1. --Modified by Surs for A.R.E.A.
  2. local feature_is_active = axr_main.config:r_value("mm_options","enable_loot_money",1,false)
  3. local function opt_menu_on_init(menu)
  4. menu.gameplay_options["loot_money"] = {default=false, debug_only=false, typ="check",
  5. on_accept=function(handler,optMgr,ctrl)
  6. feature_is_active = ctrl:GetCheck()
  7. end
  8. }
  9. end
  10.  
  11. function on_game_start()
  12. RegisterScriptCallback("opt_menu_on_init",opt_menu_on_init)
  13. end
  14.  
  15. function lootmoney(npc)
  16. if not (feature_is_active) then return end
  17. if not (npc) then return end
  18. local money = npc:money()
  19. local actor = db.actor
  20. if money and (money > 0) and (money < 10000) then
  21. local deadmoney = money
  22. local npc_rank = ranks.get_obj_rank_name(npc)
  23. if npc_rank then
  24. if npc_rank == "legend" and deadmoney >=800
  25. then deadmoney=math.random(600,2000)
  26. elseif npc_rank == "master" and deadmoney >=750
  27. then deadmoney=math.random(500,1500)
  28. elseif npc_rank == "expert" and deadmoney >=700
  29. then deadmoney=math.random(500,1000)
  30. elseif npc_rank == "veteran" and deadmoney >=650
  31. then deadmoney=math.random(400,800)
  32. elseif npc_rank == "professional" and deadmoney >=600
  33. then deadmoney=math.random(400,600)
  34. elseif npc_rank == "experienced" and deadmoney >=550
  35. then deadmoney=math.random(200,400)
  36. elseif npc_rank == "trainee" and deadmoney >=500
  37. then deadmoney=math.random(50,300)
  38. elseif npc_rank == "trainee" and deadmoney >=500
  39. then deadmoney=math.random(50,300)
  40. elseif npc_rank == "novice" and deadmoney >=300
  41. then deadmoney=math.random(25,200)
  42. end
  43. end
  44.  
  45. if actor:has_info("hacking_soft_installed") then
  46. local news_caption = strformat(game.translate_string("st_dead_stalker"),npc:character_name())
  47. local news_text = strformat(game.translate_string("st_intercept_funds"),"%c[255,255,0,0]"..deadmoney.."%c[default]")
  48. actor:give_game_news(news_caption, news_text, "ui_iconsTotal_found_money", 0, 10000)
  49. actor:give_money(deadmoney)
  50. -- game_stats.money_quest_update(deadmoney)
  51. npc:give_money(-money)
  52. -- game_stats.money_quest_update(-money)
  53. if (math.random(1,100) >= 90) then
  54. coc_treasure_manager.create_random_stash(nil,strformat(game.translate_string("st_coc_cache"),npc:character_name()))
  55. end
  56. end
  57. if area_skills then area_skills.raise_skill("marauder_skill", 0.5) end
  58. end
  59. end
  60.  
  61. function lootmoney_effect(npc,corpse)
  62. if not (feature_is_active) then return end
  63. if not (npc and corpse) then return end
  64. local money=corpse:money()
  65. if money and (money > 0) and (money < 10000) then
  66. local deadmoney = money
  67. local gi_rank = ranks.get_obj_rank_name(corpse)
  68. if gi_rank then
  69. if gi_rank == "legend" and deadmoney >=500
  70. then deadmoney=math.random(600,1000)
  71. elseif gi_rank == "master" and deadmoney >=450
  72. then deadmoney=math.random(500,900)
  73. elseif gi_rank == "expert" and deadmoney >=400
  74. then deadmoney=math.random(500,800)
  75. elseif gi_rank == "veteran" and deadmoney >=350
  76. then deadmoney=math.random(400,700)
  77. elseif gi_rank == "professional" and deadmoney >=300
  78. then deadmoney=math.random(400,600)
  79. elseif gi_rank == "experienced" and deadmoney >=250
  80. then deadmoney=math.random(200,500)
  81. elseif gi_rank == "trainee" and deadmoney >=200
  82. then deadmoney=math.random(50,400)
  83. elseif gi_rank == "novice" and deadmoney >=100
  84. then deadmoney=math.random(25,400)
  85. end
  86. end
  87. npc:give_money(deadmoney)
  88. -- game_stats.money_quest_update(deadmoney)
  89. corpse:give_money(-money)
  90. -- game_stats.money_quest_update(-money)
  91.  
  92. end
  93. end
Add Comment
Please, Sign In to add comment