Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --Wafel start
- function Wafel_func_lootmoney()
- local lootmoney_config={
- ['zero']={0,0},
- ['novice']={1,20},
- ['trainee']={5,25},
- ['experienced']={10,30},
- ['professional']={15,35},
- ['veteran']={17,40},
- ['expert']={25,45},
- ['master']={35,55},
- ['legend']={40,60},
- }
- local aliases={'zero','novice','trainee','experienced','professional','veteran','expert','master','legend'}
- return function (rank)
- --printf('Wafel checks: ')
- --printf('rank is: '..rank)
- math.randomseed(os.time())
- local result1,result2
- local function find_pos(where,what)
- local pos=1
- for k,v in pairs(where) do
- if (string.find(v,''..what)~=nil) then
- pos=k
- break
- end
- end
- return pos
- end
- local temp_pos=find_pos(aliases,''..rank)
- --printf('temp pos is: '..temp_pos)
- if(temp_pos>1 and math.random(1,100)<math.floor(64/temp_pos))then
- --printf('in shuffle')
- temp_pos=math.random(temp_pos-2,temp_pos+2)
- if (temp_pos<2) then temp_pos=2
- elseif (temp_pos>9) then temp_pos=9 end
- --printf('temp pos after shuffle: '..temp_pos)
- end
- local temp_rank=aliases[temp_pos]
- --printf('temp rank is: '..temp_rank)
- local temp_min=lootmoney_config[temp_rank][1]
- local temp_max=lootmoney_config[temp_rank][2]
- --printf('min and max is '..temp_min..' and '..temp_max)
- result1=math.random(temp_min,temp_max)
- --printf('random is: '..result1)
- result2=(math.floor(result1) > math.random(1,100) and 1 or 0)*math.floor(result1/2)
- return result1/100, result2/100
- -- if(rank==nil) then
- -- result1=math.random(lootmoney_config["novice"][1],lootmoney_config["novice"][2])
- -- else
- -- result1 = math.random(lootmoney_config[rank][1],lootmoney_config[rank][2])
- -- end
- -- result2=(math.floor(result1) > math.random(1,100) and 1 or 0)*math.floor(result1/2)
- -- return result1/100, result2/100
- end
- end
- --Wafel end
- function lootmoney(npc)
- --if npc:money() < 10000 then --commented by Wafel
- if npc:money() < 100000 then --Wafel
- local actor = db.actor
- local money = npc:money()
- if money ~= nil and money > 0 then
- local deadmoney = money
- local npc_rank
- npc_rank = ranks.get_obj_rank_name(npc)
- --printf('npc_rank is: '..npc_rank)
- --Wafel start
- local actor_rank = ranks.get_obj_rank_name(actor)--db.actor:character_rank()
- --math.randomseed(os.time())
- local rank_dep_lootmoney_W=Wafel_func_lootmoney()
- local W_searching_skill, W_stash = rank_dep_lootmoney_W(actor_rank)
- --printf('money is: '..money)
- --printf('W_searching_skill is: '..W_searching_skill)
- --printf("Wafel check: " .. W_searching_skill .." and " .. W_stash)
- if (deadmoney==0) then deadmoney = 70 end
- --if (npc_rank ~= nil) then
- if npc_rank == "novice" and deadmoney <150 then deadmoney=deadmoney+150
- elseif npc_rank == "trainee" and deadmoney <250 then deadmoney=deadmoney+250
- elseif npc_rank == "experienced" and deadmoney <350 then deadmoney=deadmoney+350
- elseif npc_rank == "professional" and deadmoney<450 then deadmoney=deadmoney+450
- elseif npc_rank == "veteran" and deadmoney <550 then deadmoney=deadmoney+550
- elseif npc_rank == "expert" and deadmoney <650 then deadmoney=deadmoney+650
- elseif npc_rank == "master" and deadmoney <750 then deadmoney=deadmoney+750
- elseif npc_rank == "legend" and deadmoney <850 then deadmoney=deadmoney+850
- --end Wafel
- --[[commented by Wafel
- if npc_rank ~= nil then
- if npc_rank == "novice" and deadmoney >=400 then deadmoney=math.random(25,400)
- elseif npc_rank == "trainee" and deadmoney >=500 then deadmoney=math.random(50,400)
- elseif npc_rank == "experienced" and deadmoney >=550 then deadmoney=math.random(200,500)
- elseif npc_rank == "professional" and deadmoney >=600 then deadmoney=math.random(400,600)
- elseif npc_rank == "veteran" and deadmoney >=650 then deadmoney=math.random(400,700)
- elseif npc_rank == "expert" and deadmoney >=700 then deadmoney=math.random(500,800)
- elseif npc_rank == "master" and deadmoney >=750 then deadmoney=math.random(500,900)
- elseif npc_rank == "legend" and deadmoney >=800 then deadmoney=math.random(600,1000)
- --]]
- end
- --end
- --start Wafel
- deadmoney=math.floor(deadmoney*W_searching_skill)
- --printf('deadmoney is: '..deadmoney)
- --end Wafel
- local news_caption = "Dead stalker: "..npc:character_name()
- local news_text = "Found Money: %c[255,255,0,0]"..game.translate_string(deadmoney).."%c[default] rub."
- --start Wafel
- if(W_stash>0) then
- --printf("w_stach check: "..W_stash)
- local bonus_money=math.floor(deadmoney*W_stash)
- if(bonus_money>0) then
- local W_stash_text_string={' Hidden, but found. '}
- news_caption=news_caption ..' hid it! '..W_stash_text_string[math.random(#W_stash_text_string)]
- news_text=news_text.." +also: ".."%c[255,255,0,0]"..game.translate_string(bonus_money).."%c[default] rub."
- deadmoney=deadmoney+bonus_money
- end
- end
- --end Wafel
- --xr_sound.set_sound_play(actor:id(), "pda_news")
- actor:give_game_news(news_caption, news_text, "ui_iconsTotal_found_money", 0, 10000)
- actor:give_money(deadmoney)
- -- game_stats.money_quest_update(deadmoney)
- npc:give_money(-money)
- -- game_stats.money_quest_update(-money)
- if (math.random(1,100) >= 90) then
- coc_treasure_manager.create_random_stash(nil,npc:character_name()..".Ĺăî ňŕéíčę.")
- end
- end
- end
- end
- function lootmoney_effect(npc,corpse_npc)
- --if corpse_npc:money() < 10000 then --commented by Wafel
- if corpse_npc:money() < 100000 then --Wafel
- local num=corpse_npc:money()
- if num and num >0 then
- local deadmoney = num
- local gi_rank
- gi_rank = ranks.get_obj_rank_name(corpse_npc)
- --Wafel start
- local npc_rank = ranks.get_obj_rank_name(npc)
- math.randomseed( os.time() )
- local rank_dep_lootmoney_W=Wafel_func_lootmoney()
- local W_searching_skill, W_stash = rank_dep_lootmoney_W(npc_rank)
- if gi_rank ~= nil then
- if gi_rank == "novice" and deadmoney <150 then deadmoney=deadmoney+150
- elseif gi_rank == "trainee" and deadmoney <250 then deadmoney=deadmoney+250
- elseif gi_rank == "experienced" and deadmoney <350 then deadmoney=deadmoney+350
- elseif gi_rank == "professional" and deadmoney<450 then deadmoney=deadmoney+450
- elseif gi_rank == "veteran" and deadmoney <550 then deadmoney=deadmoney+550
- elseif gi_rank == "expert" and deadmoney <650 then deadmoney=deadmoney+650
- elseif gi_rank == "master" and deadmoney <750 then deadmoney=deadmoney+750
- elseif gi_rank == "legend" and deadmoney <850 then deadmoney=deadmoney+850
- deadmoney=deadmoney*W_searching_skill
- --end Wafel
- --[[commented by Wafel
- if gi_rank ~= nil then
- if gi_rank == "novice" and deadmoney >=100 then deadmoney=math.random(25,400)
- elseif gi_rank == "trainee" and deadmoney >=200 then deadmoney=math.random(50,400)
- elseif gi_rank == "experienced" and deadmoney >=250 then deadmoney=math.random(200,500)
- elseif gi_rank == "professional" and deadmoney >=300 then deadmoney=math.random(400,600)
- elseif gi_rank == "veteran" and deadmoney >=350 then deadmoney=math.random(400,700)
- elseif gi_rank == "expert" and deadmoney >=400 then deadmoney=math.random(500,800)
- elseif gi_rank == "master" and deadmoney >=450 then deadmoney=math.random(500,900)
- elseif gi_rank == "legend" and deadmoney >=500 then deadmoney=math.random(600,1000)
- --]]
- end
- end
- --start Wafel
- if(W_stash>0) then
- deadmoney=deadmoney+math.floor(deadmoney*W_stash)
- end
- --end Wafel
- npc:give_money(deadmoney)
- -- game_stats.money_quest_update(deadmoney)
- corpse_npc:give_money(-num)
- -- game_stats.money_quest_update(-num)
- end
- end
- end
Add Comment
Please, Sign In to add comment