Guest User

lootmoney.script AUTISM MOD

a guest
Aug 6th, 2017
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.83 KB | None | 0 0
  1. --Wafel start
  2. function Wafel_func_lootmoney()
  3. local lootmoney_config={
  4. ['zero']={0,0},
  5. ['novice']={1,20},
  6. ['trainee']={5,25},
  7. ['experienced']={10,30},
  8. ['professional']={15,35},
  9. ['veteran']={17,40},
  10. ['expert']={25,45},
  11. ['master']={35,55},
  12. ['legend']={40,60},
  13. }
  14. local aliases={'zero','novice','trainee','experienced','professional','veteran','expert','master','legend'}
  15.  
  16.  
  17. return function (rank)
  18. --printf('Wafel checks: ')
  19. --printf('rank is: '..rank)
  20. math.randomseed(os.time())
  21. local result1,result2
  22.  
  23. local function find_pos(where,what)
  24. local pos=1
  25. for k,v in pairs(where) do
  26. if (string.find(v,''..what)~=nil) then
  27. pos=k
  28. break
  29. end
  30. end
  31. return pos
  32. end
  33. local temp_pos=find_pos(aliases,''..rank)
  34. --printf('temp pos is: '..temp_pos)
  35. if(temp_pos>1 and math.random(1,100)<math.floor(64/temp_pos))then
  36. --printf('in shuffle')
  37. temp_pos=math.random(temp_pos-2,temp_pos+2)
  38. if (temp_pos<2) then temp_pos=2
  39. elseif (temp_pos>9) then temp_pos=9 end
  40. --printf('temp pos after shuffle: '..temp_pos)
  41. end
  42. local temp_rank=aliases[temp_pos]
  43. --printf('temp rank is: '..temp_rank)
  44. local temp_min=lootmoney_config[temp_rank][1]
  45. local temp_max=lootmoney_config[temp_rank][2]
  46. --printf('min and max is '..temp_min..' and '..temp_max)
  47. result1=math.random(temp_min,temp_max)
  48. --printf('random is: '..result1)
  49.  
  50. result2=(math.floor(result1) > math.random(1,100) and 1 or 0)*math.floor(result1/2)
  51. return result1/100, result2/100
  52. -- if(rank==nil) then
  53. -- result1=math.random(lootmoney_config["novice"][1],lootmoney_config["novice"][2])
  54. -- else
  55. -- result1 = math.random(lootmoney_config[rank][1],lootmoney_config[rank][2])
  56. -- end
  57. -- result2=(math.floor(result1) > math.random(1,100) and 1 or 0)*math.floor(result1/2)
  58. -- return result1/100, result2/100
  59. end
  60. end
  61. --Wafel end
  62. function lootmoney(npc)
  63. --if npc:money() < 10000 then --commented by Wafel
  64. if npc:money() < 100000 then --Wafel
  65. local actor = db.actor
  66. local money = npc:money()
  67. if money ~= nil and money > 0 then
  68. local deadmoney = money
  69. local npc_rank
  70. npc_rank = ranks.get_obj_rank_name(npc)
  71. --printf('npc_rank is: '..npc_rank)
  72. --Wafel start
  73. local actor_rank = ranks.get_obj_rank_name(actor)--db.actor:character_rank()
  74. --math.randomseed(os.time())
  75. local rank_dep_lootmoney_W=Wafel_func_lootmoney()
  76.  
  77. local W_searching_skill, W_stash = rank_dep_lootmoney_W(actor_rank)
  78. --printf('money is: '..money)
  79. --printf('W_searching_skill is: '..W_searching_skill)
  80. --printf("Wafel check: " .. W_searching_skill .." and " .. W_stash)
  81. if (deadmoney==0) then deadmoney = 70 end
  82.  
  83. --if (npc_rank ~= nil) then
  84. if npc_rank == "novice" and deadmoney <150 then deadmoney=deadmoney+150
  85. elseif npc_rank == "trainee" and deadmoney <250 then deadmoney=deadmoney+250
  86. elseif npc_rank == "experienced" and deadmoney <350 then deadmoney=deadmoney+350
  87. elseif npc_rank == "professional" and deadmoney<450 then deadmoney=deadmoney+450
  88. elseif npc_rank == "veteran" and deadmoney <550 then deadmoney=deadmoney+550
  89. elseif npc_rank == "expert" and deadmoney <650 then deadmoney=deadmoney+650
  90. elseif npc_rank == "master" and deadmoney <750 then deadmoney=deadmoney+750
  91. elseif npc_rank == "legend" and deadmoney <850 then deadmoney=deadmoney+850
  92.  
  93. --end Wafel
  94.  
  95.  
  96. --[[commented by Wafel
  97. if npc_rank ~= nil then
  98. if npc_rank == "novice" and deadmoney >=400 then deadmoney=math.random(25,400)
  99. elseif npc_rank == "trainee" and deadmoney >=500 then deadmoney=math.random(50,400)
  100. elseif npc_rank == "experienced" and deadmoney >=550 then deadmoney=math.random(200,500)
  101. elseif npc_rank == "professional" and deadmoney >=600 then deadmoney=math.random(400,600)
  102. elseif npc_rank == "veteran" and deadmoney >=650 then deadmoney=math.random(400,700)
  103. elseif npc_rank == "expert" and deadmoney >=700 then deadmoney=math.random(500,800)
  104. elseif npc_rank == "master" and deadmoney >=750 then deadmoney=math.random(500,900)
  105. elseif npc_rank == "legend" and deadmoney >=800 then deadmoney=math.random(600,1000)
  106. --]]
  107. end
  108. --end
  109. --start Wafel
  110.  
  111. deadmoney=math.floor(deadmoney*W_searching_skill)
  112. --printf('deadmoney is: '..deadmoney)
  113. --end Wafel
  114. local news_caption = "Dead stalker: "..npc:character_name()
  115. local news_text = "Found Money: %c[255,255,0,0]"..game.translate_string(deadmoney).."%c[default] rub."
  116. --start Wafel
  117. if(W_stash>0) then
  118. --printf("w_stach check: "..W_stash)
  119. local bonus_money=math.floor(deadmoney*W_stash)
  120. if(bonus_money>0) then
  121. local W_stash_text_string={' Hidden, but found. '}
  122. news_caption=news_caption ..' hid it! '..W_stash_text_string[math.random(#W_stash_text_string)]
  123. news_text=news_text.." +also: ".."%c[255,255,0,0]"..game.translate_string(bonus_money).."%c[default] rub."
  124. deadmoney=deadmoney+bonus_money
  125. end
  126. end
  127. --end Wafel
  128. --xr_sound.set_sound_play(actor:id(), "pda_news")
  129. actor:give_game_news(news_caption, news_text, "ui_iconsTotal_found_money", 0, 10000)
  130. actor:give_money(deadmoney)
  131. -- game_stats.money_quest_update(deadmoney)
  132. npc:give_money(-money)
  133. -- game_stats.money_quest_update(-money)
  134. if (math.random(1,100) >= 90) then
  135. coc_treasure_manager.create_random_stash(nil,npc:character_name()..".Ĺăî ňŕéíčę.")
  136. end
  137. end
  138. end
  139. end
  140.  
  141. function lootmoney_effect(npc,corpse_npc)
  142. --if corpse_npc:money() < 10000 then --commented by Wafel
  143. if corpse_npc:money() < 100000 then --Wafel
  144. local num=corpse_npc:money()
  145. if num and num >0 then
  146. local deadmoney = num
  147. local gi_rank
  148. gi_rank = ranks.get_obj_rank_name(corpse_npc)
  149. --Wafel start
  150. local npc_rank = ranks.get_obj_rank_name(npc)
  151. math.randomseed( os.time() )
  152. local rank_dep_lootmoney_W=Wafel_func_lootmoney()
  153. local W_searching_skill, W_stash = rank_dep_lootmoney_W(npc_rank)
  154.  
  155. if gi_rank ~= nil then
  156. if gi_rank == "novice" and deadmoney <150 then deadmoney=deadmoney+150
  157. elseif gi_rank == "trainee" and deadmoney <250 then deadmoney=deadmoney+250
  158. elseif gi_rank == "experienced" and deadmoney <350 then deadmoney=deadmoney+350
  159. elseif gi_rank == "professional" and deadmoney<450 then deadmoney=deadmoney+450
  160. elseif gi_rank == "veteran" and deadmoney <550 then deadmoney=deadmoney+550
  161. elseif gi_rank == "expert" and deadmoney <650 then deadmoney=deadmoney+650
  162. elseif gi_rank == "master" and deadmoney <750 then deadmoney=deadmoney+750
  163. elseif gi_rank == "legend" and deadmoney <850 then deadmoney=deadmoney+850
  164. deadmoney=deadmoney*W_searching_skill
  165.  
  166. --end Wafel
  167.  
  168. --[[commented by Wafel
  169. if gi_rank ~= nil then
  170. if gi_rank == "novice" and deadmoney >=100 then deadmoney=math.random(25,400)
  171. elseif gi_rank == "trainee" and deadmoney >=200 then deadmoney=math.random(50,400)
  172. elseif gi_rank == "experienced" and deadmoney >=250 then deadmoney=math.random(200,500)
  173. elseif gi_rank == "professional" and deadmoney >=300 then deadmoney=math.random(400,600)
  174. elseif gi_rank == "veteran" and deadmoney >=350 then deadmoney=math.random(400,700)
  175. elseif gi_rank == "expert" and deadmoney >=400 then deadmoney=math.random(500,800)
  176. elseif gi_rank == "master" and deadmoney >=450 then deadmoney=math.random(500,900)
  177. elseif gi_rank == "legend" and deadmoney >=500 then deadmoney=math.random(600,1000)
  178. --]]
  179. end
  180. end
  181. --start Wafel
  182. if(W_stash>0) then
  183. deadmoney=deadmoney+math.floor(deadmoney*W_stash)
  184. end
  185. --end Wafel
  186. npc:give_money(deadmoney)
  187. -- game_stats.money_quest_update(deadmoney)
  188. corpse_npc:give_money(-num)
  189. -- game_stats.money_quest_update(-num)
  190. end
  191. end
  192. end
Add Comment
Please, Sign In to add comment