Advertisement
Nuor

coc_treasure_manager.script

Dec 27th, 2017
608
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 21.05 KB | None | 0 0
  1. --[[
  2. ------------------------------------------------------------------------------------------------------------------
  3. -- Treasure randomizer
  4. -- by Alundaio
  5. ------------------------------------------------------------------------------------------------------------------
  6. This script spawns loot, randomly, inside all INVBOX class objects. Loot is determined on new game start and stored
  7. within the .scoc as a string. When the cache is opened, the loot is spawned.
  8.  
  9. A list of all valid item sections is generated automatically by parsing all of system_ini(). From this list, loot can be obtained. If you do not
  10. want a certain section from being spawned, put it in 'plugins\treasure_blacklist' 'ignore_sections'.
  11.  
  12. A valid item section is determined by several factors:
  13. 1. It must have can_trade = true
  14. 2. It must have quest_item = false
  15. 3. It must not have '_mp' in it's section name
  16. 4. It must have a valid 'inv_name' value
  17. 5. 'cost' must be greater than 0
  18.  
  19. To debug or to obtain a list of valid item sections, simply enable DEV_DEBUG (-dbg in command line).
  20. You shall find a 'valid_item_sections.ltx' in your main game directory after you start a new game.
  21.  
  22. To debug the actual results, start a new game. Then while in the loadscreen menu ctrl+left-click on the new 'autosave'. You
  23. will find the <filename>.lua in your savegame folder. Search the file for 'caches'
  24. --]]
  25.  
  26. caches = {}
  27. local caches_count = 0
  28.  
  29. local valid_item_list = nil
  30. local valid_item_list_array = nil
  31. local valid_map_spots = {
  32. ["treasure"] = true,
  33. ["treasure_player"] = true,
  34. ["treasure_searched"] = true,
  35. ["treasure_unique"] = true
  36. }
  37.  
  38. -- Table to put things that you wish only the specific count can ever only spawn
  39. local always_in_existence = {
  40. ["af_compass"] = 1,
  41. ["detector_advanced"] = 4,
  42. ["detector_elite"] = 2,
  43. ["detector_scientific"] = 1,
  44. ["detector_simple"] = 8,
  45. ["equ_military_pack"] = 3,
  46. ["equ_tourist_pack"] = 2,
  47. ["itm_repairkit_tier_1"] = 4,
  48. ["itm_repairkit_tier_2"] = 4,
  49. ["itm_repairkit_tier_3"] = 4,
  50. ["wpn_gauss"] = 1,
  51. ["wpn_addon_sight_ir"] = 2,
  52. ["wpn_addon_sight_irvar"] = 1
  53. }
  54. ------------------------------------------------------------------------------------------------------------------
  55. -- PRIVATE
  56. ------------------------------------------------------------------------------------------------------------------
  57. local function on_game_load()
  58. if (caches_count > 0) then
  59. return
  60. end
  61.  
  62. local ignore_list = {
  63. ["bar_inv_box"] = true,
  64. ["bar_inventory_box_2"] = true,
  65. ["val_recover_item_2_spawn"] = true
  66. }
  67.  
  68. local sim = alife()
  69. for id, se_obj in alife():objects() do
  70. if (IsInvbox(nil,se_obj:clsid()) and not ignore_list[se_obj:name()]) then
  71. caches[id] = false
  72. caches_count = caches_count + 1
  73. --elseif (se_obj:spawn_ini() and se_obj:spawn_ini():section_exist("drop_box")) then
  74. -- box_caches[id] = false
  75. -- box_caches_count = caches_count + 1
  76. end
  77. end
  78.  
  79. for i=1, math.floor(caches_count/2) do
  80. create_random_stash(true,"stash")
  81. end
  82.  
  83. local temp = {}
  84. for section,count in pairs(always_in_existence) do
  85. for i=1,count do
  86. iempty_table(temp)
  87. temp[1] = section
  88. create_random_stash(true,"stash",temp)
  89. end
  90. end
  91. end
  92.  
  93. local function actor_on_item_take_from_box(box,itm)
  94. if (caches[box:id()] == true) then
  95. -- Remove all existing map spots from the cache.
  96. -- Remember that this will only apply to randomly generated stashes.
  97. for k, v in pairs(valid_map_spots) do
  98. if level.map_has_object_spot(box:id(), k) then
  99. level.map_remove_object_spot(box:id(), k)
  100. end
  101. end
  102.  
  103. -- Mark the stash as "partially looted".
  104. local id = alife_object(box:id()).id
  105. level.map_add_object_spot_ser(id, "treasure_searched", game.translate_string("st_ui_pda_secret_searched"))
  106.  
  107. -- Remove the cache from the treasure manager.
  108. caches[box:id()] = false
  109. dxr_statistics.increment_statistic("stashes_found")
  110. news_manager.send_treasure(1)
  111. end
  112.  
  113. -- If no items remain; remove the "partially looted" marker.
  114. if box:is_inv_box_empty() then
  115. if level.map_has_object_spot(box:id(), "treasure_searched") then
  116. level.map_remove_object_spot(box:id(), "treasure_searched")
  117. end
  118. end
  119.  
  120. end
  121.  
  122. local function save_state(data)
  123. --alun_utils.debug_write("coc_treasure_manager.save_state")
  124. if (caches_count <= 0) then
  125. return
  126. end
  127.  
  128. if not (data.coc_treasure_manager) then
  129. data.coc_treasure_manager = {}
  130. end
  131.  
  132. data.coc_treasure_manager.caches_count = caches_count
  133. data.coc_treasure_manager.caches = caches
  134. end
  135.  
  136. local function load_state(data)
  137. if not (data.coc_treasure_manager) then
  138. return
  139. end
  140.  
  141. caches_count = data.coc_treasure_manager.caches_count or caches_count
  142. caches = data.coc_treasure_manager.caches or caches
  143.  
  144. data.coc_treasure_manager.caches_count = nil
  145. data.coc_treasure_manager.caches = nil
  146. end
  147.  
  148. local function physic_object_on_use_callback(box,who)
  149. if (IsInvbox(box)) then
  150. try_spawn_treasure(box)
  151. end
  152. end
  153. ------------------------------------------------------------------------------------------------------------------
  154. -- ON GAME START
  155. ------------------------------------------------------------------------------------------------------------------
  156. function on_game_start()
  157. RegisterScriptCallback("on_game_load",on_game_load)
  158. RegisterScriptCallback("actor_on_item_take_from_box",actor_on_item_take_from_box)
  159. RegisterScriptCallback("save_state",save_state)
  160. RegisterScriptCallback("load_state",load_state)
  161. RegisterScriptCallback("physic_object_on_use_callback",physic_object_on_use_callback)
  162. end
  163.  
  164. -------------------------------------------------------------------------------------------------------------------
  165.  
  166. last_secret = nil
  167. function create_random_stash(no_spot,hint,bonus_items, map_spot, delivery_id)
  168. map_spot = valid_map_spots[map_spot] and map_spot or "treasure"
  169.  
  170. last_secret = nil
  171.  
  172. if (caches_count <= 0) and (delivery_id == nil) then
  173. return
  174. end
  175.  
  176. last_secret = true
  177.  
  178. local sim = alife()
  179.  
  180. -- create a temporary table to use math.random
  181. local t = {}
  182. local size_t = 0
  183. for id,v in pairs(caches) do
  184. -- false means box is available
  185. if (v == false) then
  186. size_t = size_t + 1
  187. t[size_t] = id
  188. end
  189. end
  190.  
  191. local index = size_t > 0 and math.random(size_t)
  192.  
  193. if not (index) and (delivery_id == nil) then
  194. return
  195. end
  196.  
  197. local id = t[index]
  198. local se_box = id and sim:object(id)
  199. if not (se_box) and (delivery_id == nil) then
  200. caches[id] = nil
  201. caches_count = caches_count - 1
  202. return
  203. end
  204.  
  205. if not (valid_item_list) then
  206. valid_item_list,valid_item_list_array = get_valid_item_sections()
  207. end
  208.  
  209. local spawned_item = bonus_items or {}
  210. local max_weight = math.random(80,130)
  211.  
  212. if (dxr_achievements.has_achievement("rag_and_bone")) then
  213. max_weight = max_weight + 30
  214. end
  215.  
  216. if delivery_id then max_weight = math.random(200,300) end
  217.  
  218. local ini = system_ini()
  219. local function is_consumable(section)
  220. local v = ini:r_string_ex(section,"class","")
  221. return v == "S_FOOD" or v == "II_FOOD"
  222. end
  223.  
  224. local function is_outfit(section)
  225. local v = ini:r_string_ex(section,"class","")
  226. return v == "EQU_STLK" or v == "E_STLK" or v == "EQU_HLMET" or v == "E_HLMET"
  227. end
  228.  
  229. local function is_weapon(section)
  230. local v = ini:r_string_ex(section,"class","")
  231. return string.find(v,"WP_") ~= nil
  232. end
  233.  
  234. local function is_ammo(section)
  235. local v = ini:r_string_ex(section,"class","")
  236. return v == "AMMO" or v == "AMMO_S"
  237. end
  238.  
  239. local function is_backpack(section)
  240. local v = ini:r_string_ex(section,"class","")
  241. return v == "EQ_BAKPK"
  242. end
  243.  
  244. local function is_toolkit(section)
  245. return section == "itm_repairkit_tier_1" or section == "itm_repairkit_tier_2" or section == "itm_repairkit_tier_3"
  246. end
  247.  
  248. local function is_artefact(section)
  249. local v = ini:r_string_ex(section,"class","")
  250. return v == "SCRPTART"
  251. end
  252.  
  253. local function is_detector(section)
  254. local v = ini:r_string_ex(section,"class","")
  255. return v == "DET_ADVA" or v == "DET_ELIT" or v == "DET_SCIE" or v == "DET_SIMP"
  256. end
  257.  
  258. --\\ FOR DEBUG
  259. local cost_lvls = {500,1000,3000,5000,9000,15000,25000}
  260. if (DEV_DEBUG_DEV) and not sorted then
  261. -- iterate most expensive to least expensive by group.
  262. local tsortc,tsorto,tsortw,tsorta,tsorts,tsort = {},{},{},{},{},{}
  263. for section,cost in spairs(valid_item_list,function(t,a,b) return t[a] > t[b] end) do
  264. if is_consumable(section) then table.insert(tsortc, section.." = "..cost)
  265. elseif is_outfit(section) then table.insert(tsorto, section.." = "..cost)
  266. elseif is_weapon(section) then table.insert(tsortw, section.." = "..cost)
  267. elseif is_artefact(section) then table.insert(tsorta, section.." = "..cost)
  268. elseif is_ammo(section) then table.insert(tsorts, section.." = "..cost)
  269. else table.insert(tsort, section.." = "..cost)
  270. end
  271. end
  272. local cfg = io.open("valid_item_sort.ltx","w+")
  273. local function addgap(header, tname)
  274. local cost
  275. local lvl = 7
  276. cfg:write(header.."\n\n")
  277. for i=1,#tname do
  278. cost = tonumber(tname[i]:match("=%s(%d+)"))
  279. local once = nil
  280. while ((lvl >= 1) and cost < cost_lvls[lvl]) do
  281. lvl = lvl - 1
  282. once = true
  283. end
  284. if once then cfg:write("// "..cost_lvls[lvl+1].." //\n") end
  285. cfg:write(tname[i].."\n")
  286. end
  287. end
  288.  
  289. addgap("### Outfits ###", tsorto)
  290. addgap("\n### Weapons ###", tsortw)
  291. addgap("\n### Consumables ###", tsortc)
  292. addgap("\n### Artifacts ###", tsorta)
  293. addgap("\n### Ammo ###", tsorts)
  294. addgap("\n### Other ###", tsort)
  295. cfg:close()
  296. sorted = true
  297. end
  298. --//
  299.  
  300. local has_spawned = false
  301. local function try_spawn_item(sec,min,max,chance,weight)
  302. if (max_weight >= weight) then
  303. local new_max = math.random(min,max)
  304. for i=1,new_max do
  305. if ((math.random(1,1000)/1000) <= chance) then
  306. spawned_item[#spawned_item+1] = sec
  307. max_weight = max_weight - weight
  308. has_spawned = true
  309. end
  310. end
  311. end
  312. end
  313.  
  314. local allow_item = true
  315. utils.shuffle(valid_item_list_array)
  316. for i,section in ipairs(valid_item_list_array) do
  317. local cost = valid_item_list[section]
  318. if not (always_in_existence[section]) then
  319. has_spawned = false
  320. local skip = false
  321.  
  322. local bDetector = is_detector(section)
  323. local bToolkit = not bDetector and is_toolkit(section)
  324. local bArtefact = not bToolkit and is_artefact(section)
  325. local bWeapon = not bArtefact and is_weapon(section)
  326. local bOutfit = not bWeapon and is_outfit(section)
  327. local bBackpack = not bWeapon and not bOutfit and is_backpack(section)
  328. if (bWeapon or bOutfit or bBackpack or bArtefact) then
  329. if not (allow_item) then
  330. skip = true
  331. end
  332. end
  333.  
  334. if not (skip) then
  335. if (bBackpack) then
  336. if (section == "equ_tourist_pack") then
  337. try_spawn_item(section,1,1,0.03,80)
  338. elseif (section == "equ_military_pack") then
  339. try_spawn_item(section,1,1,0.05,80)
  340. else
  341. try_spawn_item(section,1,1,0.10,50)
  342. end
  343. elseif (bDetector) then
  344. local v = ini:r_string_ex(section,"class","")
  345. if (v == "DET_SCIE") then
  346. try_spawn_item(section,1,1,0.005,80)
  347. elseif (v == "DET_ELIT") then
  348. try_spawn_item(section,1,1,0.05,60)
  349. elseif (v == "DET_ADVA") then
  350. try_spawn_item(section,1,1,0.10,50)
  351. else
  352. try_spawn_item(section,1,1,0.15,40)
  353. end
  354. elseif (bToolkit) then
  355. if (section == "itm_repairkit_tier_3") then
  356. try_spawn_item(section,1,1,0.04,80)
  357. elseif (section == "itm_repairkit_tier_2") then
  358. try_spawn_item(section,1,1,0.08,80)
  359. else
  360. try_spawn_item(section,1,1,0.12,50)
  361. end
  362. else
  363. -- decide for each section based on chance, weight and item classification
  364. if (cost <= cost_lvls[1]) then
  365. if (is_consumable(section)) then
  366. try_spawn_item(section,1,3,0.50,40)
  367. elseif (is_ammo(section)) then
  368. try_spawn_item(section,1,1,0.20,40)
  369. elseif (bOutfit) then
  370. try_spawn_item(section,1,1,0.05,40)
  371. elseif (bWeapon) then
  372. try_spawn_item(section,1,1,0.05,50)
  373. else
  374. try_spawn_item(section,1,1,0.40,40)
  375. end
  376. elseif (cost <= cost_lvls[2]) then
  377. if (is_consumable(section)) then
  378. try_spawn_item(section,1,2,0.20,40)
  379. elseif (is_ammo(section)) then
  380. try_spawn_item(section,1,1,0.10,40)
  381. elseif (bOutfit) then
  382. try_spawn_item(section,1,1,0.04,40)
  383. elseif (bWeapon) then
  384. try_spawn_item(section,1,1,0.05,60)
  385. elseif (bArtefact) then
  386. try_spawn_item(section,1,1,0.01,50)
  387. else
  388. try_spawn_item(section,1,1,0.30,40)
  389. end
  390. elseif (cost <= cost_lvls[3]) then
  391. if (is_consumable(section)) then
  392. try_spawn_item(section,1,1,0.10,40)
  393. elseif (is_ammo(section)) then
  394. try_spawn_item(section,1,1,0.05,40)
  395. elseif (bOutfit) then
  396. try_spawn_item(section,1,1,0.03,40)
  397. elseif (bWeapon) then
  398. try_spawn_item(section,1,1,0.02,60)
  399. elseif (bArtefact) then
  400. try_spawn_item(section,1,1,0.01,50)
  401. else
  402. try_spawn_item(section,1,1,0.15,40)
  403. end
  404. elseif (cost <= cost_lvls[4]) then
  405. if (is_consumable(section)) then
  406. try_spawn_item(section,1,1,0.10,40)
  407. elseif (is_ammo(section)) then
  408. try_spawn_item(section,1,1,0.03,40)
  409. elseif (bOutfit) then
  410. try_spawn_item(section,1,1,0.01,60)
  411. elseif (bWeapon) then
  412. try_spawn_item(section,1,1,0.01,60)
  413. elseif (bArtefact) then
  414. try_spawn_item(section,1,1,0.01,50)
  415. else
  416. try_spawn_item(section,1,1,0.10,40)
  417. end
  418. elseif (cost <= cost_lvls[5]) then
  419. if (is_consumable(section)) then
  420. try_spawn_item(section,1,1,0.05,40)
  421. elseif (is_ammo(section)) then
  422. try_spawn_item(section,1,1,0.01,40)
  423. elseif (bOutfit) then
  424. try_spawn_item(section,1,1,0.005,80)
  425. elseif (bWeapon) then
  426. try_spawn_item(section,1,1,0.005,60)
  427. elseif (bArtefact) then
  428. try_spawn_item(section,1,1,0.005,50)
  429. else
  430. try_spawn_item(section,1,1,0.05,40)
  431. end
  432. elseif (cost <= cost_lvls[6]) then
  433. if (is_consumable(section)) then
  434. try_spawn_item(section,1,1,0.03,40)
  435. elseif (is_ammo(section)) then
  436. try_spawn_item(section,1,1,0.01,40)
  437. elseif (bOutfit) then
  438. try_spawn_item(section,1,1,0.005,80)
  439. elseif (bWeapon) then
  440. try_spawn_item(section,1,1,0.004,60)
  441. elseif (bArtefact) then
  442. try_spawn_item(section,1,1,0.003,50)
  443. else
  444. try_spawn_item(section,1,1,0.03,40)
  445. end
  446. elseif (cost <= cost_lvls[7]) then
  447. if (is_consumable(section)) then
  448. try_spawn_item(section,1,1,0.01,40)
  449. elseif (is_ammo(section)) then
  450. try_spawn_item(section,1,1,0.005,40)
  451. elseif (bOutfit) then
  452. try_spawn_item(section,1,1,0.003,80)
  453. elseif (bWeapon) then
  454. try_spawn_item(section,1,1,0.003,60)
  455. elseif (bArtefact) then
  456. try_spawn_item(section,1,1,0.001,50)
  457. else
  458. try_spawn_item(section,1,1,0.01,40)
  459. end
  460. else
  461. if (is_consumable(section)) then
  462. try_spawn_item(section,1,1,0.005,40)
  463. elseif (is_ammo(section)) then
  464. try_spawn_item(section,1,1,0.003,40)
  465. elseif (bOutfit) then
  466. try_spawn_item(section,1,1,0.001,80)
  467. elseif (bWeapon) then
  468. try_spawn_item(section,1,1,0.001,60)
  469. elseif (bArtefact) then
  470. try_spawn_item(section,1,1,0.001,50)
  471. else
  472. try_spawn_item(section,1,1,0.005,40)
  473. end
  474. end
  475. end
  476. end
  477.  
  478. if (has_spawned) and (bWeapon or bOutfit or bBackpack or bArtefact) then
  479. if (allow_item) then
  480. allow_item = false
  481. end
  482. end
  483.  
  484. if (max_weight <= 0) then
  485. break
  486. end
  487. end
  488. end
  489.  
  490. if delivery_id then
  491. caches[delivery_id] = table.concat(spawned_item,",")
  492. --printf("cache %s",caches[delivery_id])
  493. return
  494. end
  495.  
  496. if (#spawned_item > 0) then
  497. -- create map spot
  498. local ignore = nil
  499. for k, v in pairs(valid_map_spots) do
  500. if (level.map_has_object_spot(id,k) ~= 0) then
  501. ignore = true
  502. end
  503. end
  504. if (no_spot ~= true and not ignore) then
  505. level.map_add_object_spot_ser(id, map_spot or "treasure", hint or game.translate_string("st_ui_pda_secret"))
  506. news_manager.send_treasure(0)
  507. end
  508. caches[id] = table.concat(spawned_item,",")
  509. else
  510. caches[id] = false
  511. end
  512. end
  513.  
  514. function try_spawn_treasure(box, delivery_id)
  515. local id = box:id()
  516. --printf("try_spawn_treasure [%s]",caches[id])
  517.  
  518. if not (caches[id]) and delivery_id and not (caches[delivery_id]) then
  519. return
  520. end
  521.  
  522. if not (type(caches[id]) == "string") and (delivery_id == nil) then
  523. return
  524. end
  525.  
  526. local spawned_item
  527. caches[id] = true
  528. if delivery_id then
  529. spawned_item = alun_utils.str_explode(caches[delivery_id],",")
  530. caches[id] = nil
  531. caches[delivery_id] = nil
  532. else
  533. spawned_item = alun_utils.str_explode(caches[id],",")
  534. caches[id] = true
  535. end
  536.  
  537. if not (valid_item_list) then
  538. valid_item_list,valid_item_list_array = get_valid_item_sections()
  539. end
  540.  
  541. local sec,ammos,ct,ammo_type
  542. local ini = system_ini()
  543. local sim = alife()
  544. for i=1,#spawned_item do
  545. sec = spawned_item[i]
  546. if (valid_item_list[sec] and sec ~= "" and ini:section_exist(sec)) then
  547. if (utils.is_ammo(sec)) then
  548. create_ammo(sec,box:position(),box:level_vertex_id(),box:game_vertex_id(),id,math.random(10,20))
  549. else
  550.  
  551. -- Chernobyl Weapon Pack / Arsenal Overhaul 3
  552. -- Switches the weapon to a sighted variant if available.
  553. if (math.random() <= 0.3) then
  554. local sights = alun_utils.parse_list(ini, sec, "sights")
  555. if (#sights > 0) then
  556. sight = sights[math.random(#sights)]
  557. local variant_section = sec .. "_" .. sight
  558. if (ini:section_exist(variant_section)) then
  559. sec = variant_section
  560. end
  561. end
  562. end
  563.  
  564. -- since we spawning on parent, we don't want to register object or packetdata will be inaccurate
  565. local se_obj = sim:create(sec,box:position(),0,0,id)
  566. if (se_obj) then
  567. local cls = se_obj:clsid()
  568. if (IsWeapon(nil,cls) and cls ~= clsid.wpn_knife_s) then
  569. se_obj.condition = (math.random(70)+30)/100
  570.  
  571. local flags = se_obj:get_addon_flags()
  572. if (math.random() <= 0.3 and se_obj.scope_status == cse_alife_item_weapon.eAddonAttachable) then
  573. flags:set(cse_alife_item_weapon.eWeaponAddonScope,true)
  574. end
  575.  
  576. if (math.random() <= 0.3 and se_obj.grenade_launcher_status == cse_alife_item_weapon.eAddonAttachable) then
  577. flags:set(cse_alife_item_weapon.eWeaponAddonGrenadeLauncher,true)
  578. end
  579.  
  580. if (math.random() <= 0.3 and se_obj.silencer_status == cse_alife_item_weapon.eAddonAttachable) then
  581. flags:set(cse_alife_item_weapon.eWeaponAddonSilencer,true)
  582. end
  583.  
  584. -- Create random ammo type
  585. ammos = alun_utils.parse_list(ini,sec,"ammo_class")
  586. ct = ammos and #ammos
  587. ammo_type = ammos and ct and math.random(0,ct-1) or 0
  588.  
  589. se_obj.ammo_type = ammo_type
  590. end
  591. end
  592. end
  593. else
  594. printf("coc_treasure_manager.script: invalid section %s",sec)
  595. end
  596. end
  597. end
  598.  
  599. function save(pk)
  600. if (USE_MARSHAL) then
  601. return
  602. end
  603. pk:w_u16(caches_count)
  604. for id,v in pairs(caches) do
  605. pk:w_u16(id)
  606. pk:w_bool(v)
  607. end
  608. end
  609.  
  610. function load(pk)
  611. if (USE_MARSHAL) then
  612. return
  613. end
  614. caches_count = pk:r_u16()
  615. for i=1,caches_count do
  616. caches[pk:r_u16()] = pk:r_bool()
  617. end
  618. end
  619.  
  620. function get_valid_item_sections()
  621. local ltx = ini_file("plugins\\coc_treasure_manager.ltx")
  622. local t,tt = {},{}
  623. local ini = system_ini()
  624. ini:section_for_each(function(section)
  625. if not (ltx:line_exist("ignore_sections",section)) then
  626. if (ini:line_exist(section,"cform")) then
  627. if (ini:r_bool_ex(section,"can_trade",true) == true) then
  628. if (ini:r_bool_ex(section,"quest_item",false) == false) then
  629. if not (string.find(section,"mp_")) then
  630. local name = ini:r_string_ex(section,"inv_name")
  631. if (name and name ~= "" and name ~= "default") then
  632. local class = ini:r_string_ex(section,"class")
  633. if (class == "G_FAKE") then
  634. else
  635. -- Chernobyl Weapon Pack / Arsenal Overhaul 3
  636. -- blacklist everything but base weapon, try_spawn_treasure will handle the randomization of sights
  637. local parent_section = ini:r_string_ex(section,"parent_section")
  638. if (parent_section == nil or parent_section == "" or parent_section == section) then
  639. local cost = ini:r_float_ex(section,"cost") or 0
  640. if (cost > 0) then
  641. t[section] = cost
  642. tt[#tt+1] = section
  643. end
  644. end
  645. end
  646. end
  647. end
  648. end
  649. end
  650. end
  651. end
  652. end
  653. )
  654.  
  655. -- List of all items in game that are not quest items
  656. if (DEV_DEBUG_DEV) then
  657. local cfg = io.open("valid_item_sections.ltx","w+")
  658. for k,v in pairs(t) do
  659. cfg:write(k.."\n")
  660. end
  661. cfg:close()
  662. end
  663. return t,tt
  664. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement