kmicic0 Opublikowano 26 Listopada 2011 Zgłoś Udostępnij Opublikowano 26 Listopada 2011 (edytowane) Znalazłem plik odpowiadający za schowki mam prośbę zróbmy burze mózgów może uda nam się go przerobić tak że będzie przy rzadkich schowkach prawdopodobieństwo znalezienia 100% wklejam plik. tytuł task_menager-- DMX 1.3.4 PL trurl3 & Yurek -- solid_list oparta na Linspiro Addon v1.1 local rare_list = { novice_section = { "wpn_toz34", "wpn_ak74", "wpn_aps_sk1", "wpn_m4super90", "wpn_mp5_m1", "wpn_colt_m1", "wpn_mp5_m2", "wpn_walther_m1", "scientific_outfit", "stalker_outfit_v3", "specops_outfit", "dolg_gaz_outfit_m1", "ammo_vog-25p", "ammo_m209", "ammo_12x70_buck", "ammo_5.45x39_fmj", "ammo_9x39_pab9", "ammo_9x39_ap", "ammo_9x39_sp5", "mutant_flesh_eye", "mutant_boar_leg", "mutant_dog_tail", "mutant_zombie_hand", "mutant_face_tushkano", "mutant_tail_cat", "mutant_spleen_rat", "af_medusa", "af_vyvert", "af_blood", "af_electra_sparkler", "af_rusty_thorn", "af_ameba_slime", "af_drops", "af_ameba_mica", "af_soul", "af_night_star", "af_electra_moonlight", "af_gravi", "af_cristall_flower", "af_mincer_meat", "af_electra_flash", "af_rusty_kristall", "af_ameba_slug", "af_fireball", "medkit_army" }, experienced_section = { "ammo_7.62x54_7h1", "ammo_7.62x54_ap", "ammo_7.62x54_7h14", "ammo_og-7b", "mutant_zombie_hand", "mutant_snork_leg", "mutant_poltergeist_glas", "mutant_fracture_hand", "mutant_boar_leg", "wpn_m16a2_sk1", "wpn_sg552_sk1", "wpn_wincheaster1300", "wpn_m4", "wpn_ppsh41_sk2", "wpn_abakan_m1", "wpn_fort_m1", "wpn_winchester_m1", "wpn_l85_m1", "wpn_l85_m2", "wpn_beretta_m1", "military_outfit", "svoboda_heavy_outfit", "dolg_scientific_outfit", "freedom_scientific_outfit", "merc_scientific_outfit", "monolit_scientific_outfit", "nebo_scientific_outfit", "outfit_dolg_m1", "outfit_killer_m1", "af_fuzz_kolobok", "af_rusty_sea-urchin", "af_ameba_mica", "af_soul", "af_night_star", "af_dummy_glassbeads", "af_dummy_pellicle", "af_dummy_battery", "af_dummy_dummy", "af_dummy_spring", "af_babka_1", "af_spirit_1", "medkit_army" }, veteran_section = { "af_dummy_dummy", "af_fuzz_kolobok", "af_spirit_1", "af_spirit_2", "af_cry_1", "af_babka_1", "af_pudd_1", "af_pudd_2", "af_dik_1", "af_kol_1", "af_armor_1", "af_armor_2", "af_dummy_dummy", "af_dummy_spring", "af_eye_voron", "ammo_og-7b", "ammo_vog-25p", "mutant_krovosos_jaw", "mutant_burer_hand", "mutant_zombie_hand", "mutant_hand_kontroler", "mutant_psevdogigant_hand", "mutant_chimera_kogot", "wpn_spas12_m1", "wpn_sig_m1", "wpn_spas12", "wpn_vintorez", "wpn_rpg7", "wpn_g36", "wpn_m1891_30_scope", "wpn_pkm", "wpn_groza", "medkit_army" }, master_section = { "wpn_vintorez", "wpn_svu", "wpn_svd", "wpn_rg6_m1", "wpn_val_m1", "wpn_rpg7", "wpn_fn2000", "wpn_protecta", "mutant_krovosos_jaw", "mutant_burer_hand", "mutant_hand_kontroler", "mutant_psevdogigant_hand", "mutant_chimera_kogot", "af_simbion", "svoboda_exoskeleton", "monolit_exoskeleton", "nebo_exo_outfit", "exo_bandit_outfit", "exo_outfit", "af_spirit_2", "af_cry_2", "af_babka_2", "af_pudd_2", "af_babka_3", "af_dik_2", "af_kol_2", "af_kol_3", "af_armor_2", "af_armor_3", "medkit_army", "medkit_scientic" } } local solid_list = { novice_section = { --Ŕđňĺôŕęňű-- "af_drops", "af_ameba_slime", "af_rusty_thorn", "af_electra_sparkler", "af_blood", "af_vyvert", "af_medusa", --Ŕěěóíčöč˙-- "grenade_rgd5", "ammo_12x70_buck", "ammo_9x19_fmj", "ammo_9x19_pbp", "ammo_9x18_pmm", "ammo_9x18_fmj", --Îđóćčĺ-- "wpn_addon_silencer", "wpn_mp5", "wpn_bm16", "wpn_fort", "wpn_pb", "wpn_pm", --ĎđÎ÷ĺĺ-- "bread", "bandage", "kolbasa", "medkit", "vodka", "sigaret", "conserva" }, experienced_section = { --Ŕđňĺôŕęňű-- "af_cristall_flower", "af_gravi", "af_mincer_meat", "af_electra_flash", "af_rusty_kristall", "af_ameba_slug", "af_fireball", --Ŕěěóíčöč˙-- "grenade_rgd5", "grenade_gd-05", "grenade_f1", "ammo_9x19_pbp", "ammo_9x18_pmm", "ammo_5.45x39_fmj", "ammo_11.43x23_fmj", "ammo_5.56x45_ss190", --Ďóřęč-- "wpn_addon_scope", "wpn_mp5", "wpn_ak74u", "wpn_ak74u_m1", "wpn_walther", --ĎđÎ÷ĺĺ-- "mutant_dog_tail", "mutant_boar_leg", "kolbasa", "medkit", "antirad", "energy_drink", "conserva" }, veteran_section = { --Ŕđňĺôŕęňű-- "af_night_star", "af_gold_fish", "af_soul", "af_electra_moonlight", "af_rusty_sea-urchin", "af_ameba_mica", "af_cristall", --Ŕěěóíčöč˙-- "grenade_f1", "ammo_vog-25", "ammo_m209", "ammo_5.45x39_ap", "ammo_11.43x23_hydro", "ammo_9x39_pab9", "ammo_5.56x45_ss190", "ammo_12x76_zhekan", --Ďóřęč-- "wpn_addon_scope_susat", "wpn_addon_grenade_launcher", "wpn_beretta", "wpn_sig550", "wpn_toz34", "wpn_abakan_m2", "wpn_desert_eagle", --ĎđÎ÷ĺĺ-- "mutant_psevdodog_tail", "mutant_snork_leg", "medkit_army", "antirad" }, master_section = { --Ŕđňĺôŕęňű-- "af_dummy_glassbeads", "af_dummy_pellicle", "af_dummy_battery", "af_dummy_dummy", "af_dummy_spring", "af_fuzz_kolobok", --Ŕěěóíčöč˙-- "ammo_m209", "ammo_vog-25p", "ammo_9x39_ap", "ammo_12x76_dart", "ammo_7.62x54_7h14", "ammo_9x39_sp5", "ammo_5.56x45_ap", "ammo_7.62x54_7h1", --Ďóřęč-- "wpn_addon_grenade_launcher_m203", "wpn_colt1911", "wpn_spas12", "wpn_l85", "wpn_lr300", "wpn_groza", "wpn_groza_m1", --ĎđÎ÷ĺĺ-- "mutant_krovosos_jaw", "mutant_burer_hand", "medkit_army", "medkit_scientic" } } local treasure_manager = nil local n_rank function parse_spawns(line) if line == nil then return {} end --' ĺńëč default-Îâ áÎëüřĺ, ÷ĺě çíŕ÷ĺíčé â ini, ňÎ çŕáčňü íĺäÎńňŕţůčĺ ďÎńëĺäíčě çíŕ÷ĺíčĺě čç ini local t = se_respawn.parse_names(line) local n = table.getn(t) local ret_table = {} local k = 1 while k <= n do local spawn = {} spawn.section = t[k] -- ĎđÎâĺđ˙ĺě ÷ňÎ ýňÎ íĺ ďÎńëĺäí˙˙ çŕďčńü if t[k+1] ~= nil then local p = tonumber(t[k+1]) -- ďđÎâĺđ˙ĺě ÷ňÎ âňÎđűě ÷čńëÎě çŕäŕíŕ âĺđÎ˙ňíÎńňü, ŕ íĺ äđóăŕ˙ ńĺęöč˙ ńďŕâíó if p then -- çŕáčâŕĺě ÷čńëÎ spawn.prob = p k = k + 2 else -- çŕáčâŕĺě äĺôÎëň 1 spawn.prob = 1 k = k + 1 end else spawn.prob = 1 k = k + 1 end table.insert(ret_table, spawn) end return ret_table end class "CTreasure" function CTreasure:__init() --' íŕ ęÎíńňđóęňÎđĺ âű÷čňűâŕĺě LTX č ńÎçäŕĺě çŕăÎňÎâęč ęâĺńňÎâ. local iniFileName = "misctreasure_manager.ltx" self.ini = ini_file(iniFileName) --' Čňĺđčđóĺěń˙ ďÎ âńĺě íŕńňđÎéęŕě ôđŕç if not iniLineSectionExist("list",iniFileName) then abort("There is no section in treasure_manager.ltx") end local n = iniLinesCount("list",iniFileName) local id, value = "","" --' íŕ÷ŕëüíŕ˙ óńňŕíÎâęŕ self.treasure_info = {} for i=0,n-1 do result, id, value = getIniLine("list",i,"","",iniFileName) self.treasure_info[id] = {} self.treasure_info[id].target = utils.cfg_get_number(self.ini, id, "target", nil, true) --self.treasure_info[id].target = getIniValueFloat(id, "target", nil, iniFileName) self.treasure_info[id].name = utils.cfg_get_string(self.ini, id, "name", nil, true, "") --self.treasure_info[id].name = getIniValueString(id, "name", "", iniFileName) self.treasure_info[id].description = utils.cfg_get_string(self.ini, id, "description", nil, true, "") --self.treasure_info[id].description = getIniValueString(id, "description", "", iniFileName) self.treasure_info[id].items = parse_spawns(utils.cfg_get_string(self.ini, id, "items", nil, true, "")) --self.treasure_info[id].items = parse_spawns(getIniValueString(id, "items", "", iniFileName)) local community = parse_names(getIniValueString(id, "community", "stalker, bandit, dolg, freedom", iniFileName)) self.treasure_info[id].community = {} for k,v in pairs(community) do self.treasure_info[id].community[v] = true end if self.treasure_info[id].items == nil then abort("cant find 'items' in %s", id) end self.treasure_info[id].condlist = xr_logic.parse_condlist(db.actor, "treasure_manager", "condlist", getIniValueString(id, "condlist", "", iniFileName)) --' Îňěĺňčě ňŕéíčę ęŕę íÎâűé self.treasure_info[id].active = false self.treasure_info[id].done = false --print_table(self.treasure_info) end --' âńďÎěÎăŕňĺëüíűĺ ňŕáëčöű äë˙ Îáëĺă÷ĺíč˙ ďÎčńęŕ self.treasure_by_target = {} for k,v in pairs(self.treasure_info) do self.treasure_by_target[v.target] = k end end --' Ţçŕíčĺ číčöčŕňÎđŕ (âÎçěÎćíÎńňü âűäŕňü ňŕéíčę) function CTreasure:use(npc) printf("TREASURE USE") --lootmoney start if (npc and db.actor) then lootmoney.lootmoney(npc) end --lootmoney end local rarets if npc ~= nil then n_rank = npc:character_rank() else n_rank = 0 end -- ĺńëč âűáđŕí đĺäęčé ňčď ňŕéíčęÎâ, ňÎ ńíčçčě ÎâĺđÎ˙ňíÎńňü ĺăÎ âűďŕäĺíč˙ if amk.load_variable("option_treasure", 0) == 2 then rarets = 97 else rarets = 90 end if amk.is_debug then rarets=0 end if math.random(100) < rarets then return end --' íóćíÎ đŕíäÎěíÎ âűáđŕňü Îäčí čç ňŕéíčęÎâ. local avail = {} local tr_sum = 0 for k,v in pairs(self.treasure_info) do if v.done == false and v.active == false and v.community[npc:character_community()] == true then local treasure_prob = xr_logic.pick_section_from_condlist(db.actor, npc, v.condlist) if treasure_prob == "" or treasure_prob == nil then treasure_prob = 0 end if tonumber(treasure_prob) >= 0 and v.community[npc:character_community()] == true and v.active == false then if tonumber(treasure_prob) == 100 then self:give_treasure(k) else table.insert(avail, {k = k, prob = treasure_prob}) tr_sum = tr_sum + treasure_prob end end end end if tr_sum == 0 or math.random(100) < 65 then return end local tr_w = math.random(tr_sum) for k,v in pairs(avail) do tr_w = tr_w - v.prob if tr_w <= 0 then --' âűäŕňü ňŕéíčę self:give_treasure(v.k) break end end end --' ŃÎőđŕíĺíčĺ function CTreasure:check() --' ĎđÎâĺđęŕ ňŕéíčęÎâ for k,v in pairs(self.treasure_info) do --' âűäŕňü ňŕéíčę self:give_treasure(k) end end --' âűäŕ÷ŕ ňŕéíčęŕ function CTreasure:give_treasure(k) local v = self.treasure_info[k] local obj = alife():story_object(v.target) if obj ~= nil then news_manager.send_treasure(v.name) --' ĎÎěĺňčňü íŕ ęŕđňĺ local text = "%c[255,238,155,23]"..game.translate_string(v.name).."n".."%c[default]"..game.translate_string(v.description) -- if not level.map_has_object_spot(obj.id,"treasure") then level.map_add_object_spot_ser(obj.id, "treasure", text) -- else -- amk.mylog("Blocking mapspot for "..obj:name()) -- end -- ďđÎâĺđęŕ, ęŕęÎé ňčď ňŕéíčęŕ âűáđŕí -- ĺńëč ňŕéíčę íĺ ęëŕńńč÷ĺńęčé č íĺ čěĺííÎé, ňÎ çŕěĺíčě ńÎäĺđćčěÎĺ if amk.load_variable("option_treasure", 0) ~= 0 and self:named_treasure(v) == false then v.items = self:give_item_list() end --' Ńăĺíĺđčňü âĺůč for kk,vv in pairs(v.items) do if ammo_section[vv.section] == true then se_respawn.create_ammo(vv.section, obj.position, obj.m_level_vertex_id, obj.m_game_vertex_id, obj.id, vv.prob) else for i=1,vv.prob do alife():create(vv.section, obj.position, obj.m_level_vertex_id, obj.m_game_vertex_id, obj.id) end end end --' ĎÎěĺňčě ňŕéíčę ęŕę âűäŕííűé self.treasure_info[k].active = true self.treasure_info[k].done = true -- Îňďđŕâčě ňŕéíčę â Îôôëŕéí local sim = alife () if sim ~= nil and obj.online then sim:set_switch_online (obj.id, false) sim:set_switch_offline (obj.id, true) -- sim:set_switch_online (obj.id, true) -- sim:set_switch_offline (obj.id, false) amk.convert_npc[obj.id]=1 -- ńňŕâčě â Î÷ĺđĺäü íŕ âűâÎä â Îíëŕéí end else printf("TREASURE %s, target doesnt exist", k) end end --' Ńíčěŕĺě Îňěĺňęó ń ňŕéíčęŕ function CTreasure:treasure_empty(box, box_story_id) printf("!!! treasure empty") local k = self.treasure_by_target[box_story_id] if k == nil or self.treasure_info[k] == nil then return end self.treasure_info[k].active = false -- ĺńëč ňŕéíčę íĺ čěĺííÎé, ňÎ ďĺđĺâĺäĺí ĺăÎ â Îíëŕéí äë˙ ńëĺäóţůĺé âűäŕ÷č if self:named_treasure(self.treasure_info[k]) == false then self.treasure_info[k].done = false end level.map_remove_object_spot(box:id(), "treasure") end --' ŃÎőđŕíĺíčĺ function CTreasure:save(p) --' ŃÎőđŕí˙ĺě đŕçěĺđ ňŕáëčöű local size = 0 for k,v in pairs(self.treasure_info) do size = size + 1 end p:w_u16(size) for k,v in pairs(self.treasure_info) do p:w_u16(v.target) p:w_bool(v.active) p:w_bool(v.done) end end --' çŕăđóçęŕ function CTreasure:load(p) local t = p:r_u16() for i = 1,t do local k = self.treasure_by_target[p:r_u16()] self.treasure_info[k].active = p:r_bool() self.treasure_info[k].done = p:r_bool() end end function CTreasure:give_item_list() local rank = 1 local tabla = {} -- ńęÎëüęÎ íŕčěĺíÎâŕíčé ďđĺäěĺňÎâ áóäĺň â ňŕéíčęĺ local i = math.random(1, 4) -- ń÷čňŕĺě íŕńňđÎéęó ďÎëüçÎâŕňĺë˙ local opt = amk.load_variable("option_treasure", 0) --~ -- Îďđĺäĺëčě đŕíă íĺďčń˙ --~ if nepis~= nil then -- rank = n_rank --nepis.character_rank () if n_rank == nil then n_rank = math.random(1, 9)*100 end if n_rank <= 300 then rank = 1 elseif n_rank <=600 then rank = 2 elseif n_rank <= 900 then rank = 3 else rank = 4 end --~ else --~ rank = 1 --~ end for j = 1, i, 1 do local cnt = 0 local spawn = {} -- Îďđĺäĺëčě, čç ęŕęÎé ńĺęöčč áđŕňü ďđĺäěĺňű, č ęŕęčĺ čěĺííÎ if opt == 1 then if rank == 1 then spawn.section = solid_list.novice_section[math.random(table.getn(solid_list.novice_section))] elseif rank == 2 then spawn.section = solid_list.experienced_section[math.random(table.getn(solid_list.experienced_section))] elseif rank == 3 then spawn.section = solid_list.veteran_section[math.random(table.getn(solid_list.veteran_section))] else spawn.section = solid_list.master_section[math.random(table.getn(solid_list.master_section))] end else if rank == 1 then spawn.section = rare_list.novice_section[math.random(table.getn(rare_list.novice_section))] elseif rank == 2 then spawn.section = rare_list.experienced_section[math.random(table.getn(rare_list.experienced_section))] elseif rank == 3 then spawn.section = rare_list.veteran_section[math.random(table.getn(rare_list.veteran_section))] else spawn.section = rare_list.master_section[math.random(table.getn(rare_list.master_section))] end end -- óńňŕíÎâęŕ ęÎë-âŕ ďđĺäěĺňÎâ â çŕâčńčěÎńňč Îň ńĺęöčč if ammo_section[spawn.section] == true then local ini = system_ini() local num_in_box = ini:r_u32(spawn.section, "box_size") local h = math.random(1, 5) -- ďŕňđÎíű âűäŕĺě íĺ řňóęŕěč, ŕ ďŕ÷ęŕěč cnt = math.random(1, h) * num_in_box else local s = tostring(spawn.section) if string.find(s, "outfit") ~= nil or string.find(s, "wpn") ~= nil then cnt = 1 elseif string.find(s, "addon") ~= nil or string.find(s, "af") ~= nil or string.find(s, "mutant") ~= nil then cnt = math.random(1,2) else cnt = math.random(1,5) end end -- ńÎőđŕí˙ĺě číôó Î ňĺęóůĺě ďđĺäěĺňĺ spawn.prob = cnt table.insert(tabla, spawn) end return tabla end function CTreasure:named_treasure(v) -- ďđÎâĺđęŕ, ˙âë˙ĺňń˙ ëč ňŕéíčę čěĺííűě. Ĺńëč äŕ, ňÎ ĺăÎ íŕďÎëíĺíčĺ íĺ ěĺí˙ĺňń˙ if v.name == "agr_secret_0000_name" --Ňŕéíčę ŃĺđÎăÎ or v.name == "bar_secret_0011_name" --Ňŕéíčę Ŕđíč or v.name == "esc_secret_0013_name" --Ňŕéíčę âÎđďŕëŕ or v.name == "gar_secret_0002_name" --âĺůč Ăđčçëč or v.name == "gar_secret_0011_name" --Ńęëŕä ăđóďďű Ńňđĺëęŕ or v.name == "gar_secret_0021_name" --Đţęçŕę äÎőë˙ęŕ or v.name == "pri_secret_0003_name" --Őŕáŕđ Ęëűęŕ or v.name == "pri_secret_0004_name" --çŕďŕńű ëčäĺđŕ ŃâÎáÎäű or v.name == "rad_secret_0000_name" --Ęëŕä óăđţěÎăÎ or v.name == "rad_secret_0004_name" --çŕďŕń ăđóďďű Îň÷ŕ˙ííűő or v.name == "ros_secret_0015_name" --Ňŕéíčę Ń÷ŕńňëčâ÷čęŕ or v.name == "ros_secret_0018_name" --ßůčę ń ěĺäčęŕěĺíňŕěč or v.name == "val_secret_0028_name" --Ňŕéíčę áÎđÎâŕ or v.name == "x18_secret_0000_name" --Ňŕéíčę ĘÎď÷ĺíÎăÎ or v.name == "yan_secret_0011_name" --Ňŕéíčę ó÷¸íÎăÎ or v.name == "agr_krysyk_secret_name" or v.name == "agr_krysyk_secret_name" or v.name == "mil_borov_secret_name" or v.name == "aver_arhara_secret_1" --Ňŕéíčę Ŕđőŕđű or v.name == "aver_arhara_secret_2" --Ňŕéíčę Ďčëčăđčěŕ or v.name == "aver_arhara_secret_3" --Ňŕéíčę Îňřĺëüíčęŕ or v.name == "aver_arhara_secret_4" --Ňŕéíčę çâĺçäÎ÷¸ňŕ or v.name == "aver_arhara_secret_5" --Ňŕéíčę Ńňŕđčęŕ or v.name == "warlab_arhara_secret_1" --Ňŕéíčę or v.name == "warlab_arhara_secret_2" --Ňŕéíčę or v.name == "warlab_arhara_secret_3" --Ňŕéíčę or v.name == "village_arhara_secret_1" --Ňŕéíčę Ěčőč or v.name == "village_arhara_secret_2" --Ňŕéíčę ěĺńňíÎăÎ or v.name == "village_arhara_secret_3" --đţęçŕę ęŕďčňŕíŕ or v.name == "village_arhara_secret_4" --Ňŕéíčę ëĺéňĺíŕíňŕ or v.name == "generators_arhara_secret_1" --Đţęçŕę ěÎíÎëčňÎâöŕ or v.name == "generators_arhara_secret_2" --Ňŕéíčę çĺěë˙ęŕ or v.name == "generators_arhara_secret_3" --Őŕáŕđ Îőđŕííčęŕ or v.name == "generators_arhara_secret_4" --Ňŕéíčę ôđčöŕ or v.name == "generators_arhara_secret_5" --íĺčçâĺńňíűé ňŕéíčę or v.name == "atp_arhara_secret_1" --Ňŕéíčę ěŕň¸đÎăÎ đŕçâĺä÷čęŕ or v.name == "atp_arhara_secret_2" --çŕíŕ÷ęŕ Říűđű or v.name == "atp_arhara_secret_3" --Őŕáŕđ Ęčňŕ or v.name == "dead_city_secret_1" --çŕíŕ÷ęŕ áĺăëĺöŕ or v.name == "dead_city_secret_2" --âĺůč çÎěáčđÎâŕííÎăÎ or v.name == "dead_city_secret_3" --íű÷ęŕ ÎáěÎđÎęŕ or v.name == "dead_city_secret_4" --ŃőđÎí ńňŕđÎćčëŕ or v.name == "dead_city_secret_5" --äĺäęčíű âĺůč or v.name == "esc_secret_0010_name" --Ňŕéíčę ń ďčâÎě or v.name == "marsh_secret_0014_name" --Schowek Huntera then return true else return false end end function get_treasure_manager() if treasure_manager == nil then treasure_manager = CTreasure() end return treasure_manager end function take_item_from_box(box, box_story_id) printf("!!! take item from box %s", tostring(box:is_inv_box_empty())) -- if box:is_inv_box_empty() == true then get_treasure_manager():treasure_empty(box, box_story_id) -- end end function save(p) get_treasure_manager():save(p) end function load(p) get_treasure_manager():load(p) end function clear_treasure_manager() treasure_manager = nil end function CTreasure:dialog(npc) if npc ~= nil then n_rank = npc:character_rank() else n_rank = 0 end local avail = {} local tr_sum = 0 for k,v in pairs(self.treasure_info) do if v.done == false and v.active == false and v.community[npc:character_community()] == true then local treasure_prob = xr_logic.pick_section_from_condlist(db.actor, npc, v.condlist) if treasure_prob == "" or treasure_prob == nil then treasure_prob = 0 end if tonumber(treasure_prob) >= 0 and v.community[npc:character_community()] == true and v.active == false then if tonumber(treasure_prob) == 100 then self:give_treasure(k) else table.insert(avail, {k = k, prob = treasure_prob}) tr_sum = tr_sum + treasure_prob end end end end if tr_sum == 0 then return end local tr_w = math.random(tr_sum) for k,v in pairs(avail) do tr_w = tr_w - v.prob if tr_w <= 0 then self:give_treasure(v.k) break end end end Znalazłem częściowe rozwiązanie po wypiciu flaszki ze stalkerem jeżeli posiada taką informację to wyświetla nam schowki oto dowód na focie Wysypisko http://imageshack.us...11185116l0.jpg/ a tutaj plik po otwarciu w swojej gamedacie usuńcie zawartość i wklejcie lub przekopiujcie moje dwa pliki terasure_manager -- DMX 1.3.4 PL trurl3 & Yurek -- solid_list oparta na Linspiro Addon v1.1 local rare_list = { novice_section = { "wpn_toz34", "wpn_ak74", "wpn_aps_sk1", "wpn_m4super90", "wpn_mp5_m1", "wpn_colt_m1", "wpn_mp5_m2", "wpn_walther_m1", "scientific_outfit", "stalker_outfit_v3", "specops_outfit", "dolg_gaz_outfit_m1", "ammo_vog-25p", "ammo_m209", "ammo_12x70_buck", "ammo_5.45x39_fmj", "ammo_9x39_pab9", "ammo_9x39_ap", "ammo_9x39_sp5", "mutant_flesh_eye", "mutant_boar_leg", "mutant_dog_tail", "mutant_zombie_hand", "mutant_face_tushkano", "mutant_tail_cat", "mutant_spleen_rat", "af_medusa", "af_vyvert", "af_blood", "af_electra_sparkler", "af_rusty_thorn", "af_ameba_slime", "af_drops", "af_ameba_mica", "af_soul", "af_night_star", "af_electra_moonlight", "af_gravi", "af_cristall_flower", "af_mincer_meat", "af_electra_flash", "af_rusty_kristall", "af_ameba_slug", "af_fireball", "medkit_army" }, experienced_section = { "ammo_7.62x54_7h1", "ammo_7.62x54_ap", "ammo_7.62x54_7h14", "ammo_og-7b", "mutant_zombie_hand", "mutant_snork_leg", "mutant_poltergeist_glas", "mutant_fracture_hand", "mutant_boar_leg", "wpn_m16a2_sk1", "wpn_sg552_sk1", "wpn_wincheaster1300", "wpn_m4", "wpn_ppsh41_sk2", "wpn_abakan_m1", "wpn_fort_m1", "wpn_winchester_m1", "wpn_l85_m1", "wpn_l85_m2", "wpn_beretta_m1", "military_outfit", "svoboda_heavy_outfit", "dolg_scientific_outfit", "freedom_scientific_outfit", "merc_scientific_outfit", "monolit_scientific_outfit", "nebo_scientific_outfit", "outfit_dolg_m1", "outfit_killer_m1", "af_fuzz_kolobok", "af_rusty_sea-urchin", "af_ameba_mica", "af_soul", "af_night_star", "af_dummy_glassbeads", "af_dummy_pellicle", "af_dummy_battery", "af_dummy_dummy", "af_dummy_spring", "af_babka_1", "af_spirit_1", "medkit_army" }, veteran_section = { "af_dummy_dummy", "af_fuzz_kolobok", "af_spirit_1", "af_spirit_2", "af_cry_1", "af_babka_1", "af_pudd_1", "af_pudd_2", "af_dik_1", "af_kol_1", "af_armor_1", "af_armor_2", "af_dummy_dummy", "af_dummy_spring", "af_eye_voron", "ammo_og-7b", "ammo_vog-25p", "mutant_krovosos_jaw", "mutant_burer_hand", "mutant_zombie_hand", "mutant_hand_kontroler", "mutant_psevdogigant_hand", "mutant_chimera_kogot", "wpn_spas12_m1", "wpn_sig_m1", "wpn_spas12", "wpn_vintorez", "wpn_rpg7", "wpn_g36", "wpn_m1891_30_scope", "wpn_pkm", "wpn_groza", "medkit_army" }, master_section = { "wpn_vintorez", "wpn_svu", "wpn_svd", "wpn_rg6_m1", "wpn_val_m1", "wpn_rpg7", "wpn_fn2000", "wpn_protecta", "mutant_krovosos_jaw", "mutant_burer_hand", "mutant_hand_kontroler", "mutant_psevdogigant_hand", "mutant_chimera_kogot", "af_simbion", "svoboda_exoskeleton", "monolit_exoskeleton", "nebo_exo_outfit", "exo_bandit_outfit", "exo_outfit", "af_spirit_2", "af_cry_2", "af_babka_2", "af_pudd_2", "af_babka_3", "af_dik_2", "af_kol_2", "af_kol_3", "af_armor_2", "af_armor_3", "medkit_army", "medkit_scientic" } } local solid_list = { novice_section = { --Ŕđňĺôŕęňű-- "af_drops", "af_ameba_slime", "af_rusty_thorn", "af_electra_sparkler", "af_blood", "af_vyvert", "af_medusa", --Ŕěěóíčöč˙-- "grenade_rgd5", "ammo_12x70_buck", "ammo_9x19_fmj", "ammo_9x19_pbp", "ammo_9x18_pmm", "ammo_9x18_fmj", --Îđóćčĺ-- "wpn_addon_silencer", "wpn_mp5", "wpn_bm16", "wpn_fort", "wpn_pb", "wpn_pm", --ĎđÎ÷ĺĺ-- "bread", "bandage", "kolbasa", "medkit", "vodka", "sigaret", "conserva" }, experienced_section = { --Ŕđňĺôŕęňű-- "af_cristall_flower", "af_gravi", "af_mincer_meat", "af_electra_flash", "af_rusty_kristall", "af_ameba_slug", "af_fireball", --Ŕěěóíčöč˙-- "grenade_rgd5", "grenade_gd-05", "grenade_f1", "ammo_9x19_pbp", "ammo_9x18_pmm", "ammo_5.45x39_fmj", "ammo_11.43x23_fmj", "ammo_5.56x45_ss190", --Ďóřęč-- "wpn_addon_scope", "wpn_mp5", "wpn_ak74u", "wpn_ak74u_m1", "wpn_walther", --ĎđÎ÷ĺĺ-- "mutant_dog_tail", "mutant_boar_leg", "kolbasa", "medkit", "antirad", "energy_drink", "conserva" }, veteran_section = { --Ŕđňĺôŕęňű-- "af_night_star", "af_gold_fish", "af_soul", "af_electra_moonlight", "af_rusty_sea-urchin", "af_ameba_mica", "af_cristall", --Ŕěěóíčöč˙-- "grenade_f1", "ammo_vog-25", "ammo_m209", "ammo_5.45x39_ap", "ammo_11.43x23_hydro", "ammo_9x39_pab9", "ammo_5.56x45_ss190", "ammo_12x76_zhekan", --Ďóřęč-- "wpn_addon_scope_susat", "wpn_addon_grenade_launcher", "wpn_beretta", "wpn_sig550", "wpn_toz34", "wpn_abakan_m2", "wpn_desert_eagle", --ĎđÎ÷ĺĺ-- "mutant_psevdodog_tail", "mutant_snork_leg", "medkit_army", "antirad" }, master_section = { --Ŕđňĺôŕęňű-- "af_dummy_glassbeads", "af_dummy_pellicle", "af_dummy_battery", "af_dummy_dummy", "af_dummy_spring", "af_fuzz_kolobok", --Ŕěěóíčöč˙-- "ammo_m209", "ammo_vog-25p", "ammo_9x39_ap", "ammo_12x76_dart", "ammo_7.62x54_7h14", "ammo_9x39_sp5", "ammo_5.56x45_ap", "ammo_7.62x54_7h1", --Ďóřęč-- "wpn_addon_grenade_launcher_m203", "wpn_colt1911", "wpn_spas12", "wpn_l85", "wpn_lr300", "wpn_groza", "wpn_groza_m1", --ĎđÎ÷ĺĺ-- "mutant_krovosos_jaw", "mutant_burer_hand", "medkit_army", "medkit_scientic" } } local treasure_manager = nil local n_rank function parse_spawns(line) if line == nil then return {} end --' ĺńëč default-Îâ áÎëüřĺ, ÷ĺě çíŕ÷ĺíčé â ini, ňÎ çŕáčňü íĺäÎńňŕţůčĺ ďÎńëĺäíčě çíŕ÷ĺíčĺě čç ini local t = se_respawn.parse_names(line) local n = table.getn(t) local ret_table = {} local k = 1 while k <= n do local spawn = {} spawn.section = t[k] -- ĎđÎâĺđ˙ĺě ÷ňÎ ýňÎ íĺ ďÎńëĺäí˙˙ çŕďčńü if t[k+1] ~= nil then local p = tonumber(t[k+1]) -- ďđÎâĺđ˙ĺě ÷ňÎ âňÎđűě ÷čńëÎě çŕäŕíŕ âĺđÎ˙ňíÎńňü, ŕ íĺ äđóăŕ˙ ńĺęöč˙ ńďŕâíó if p then -- çŕáčâŕĺě ÷čńëÎ spawn.prob = p k = k + 2 else -- çŕáčâŕĺě äĺôÎëň 1 spawn.prob = 1 k = k + 1 end else spawn.prob = 1 k = k + 1 end table.insert(ret_table, spawn) end return ret_table end class "CTreasure" function CTreasure:__init() --' íŕ ęÎíńňđóęňÎđĺ âű÷čňűâŕĺě LTX č ńÎçäŕĺě çŕăÎňÎâęč ęâĺńňÎâ. local iniFileName = "misctreasure_manager.ltx" self.ini = ini_file(iniFileName) --' Čňĺđčđóĺěń˙ ďÎ âńĺě íŕńňđÎéęŕě ôđŕç if not iniLineSectionExist("list",iniFileName) then abort("There is no section in treasure_manager.ltx") end local n = iniLinesCount("list",iniFileName) local id, value = "","" --' íŕ÷ŕëüíŕ˙ óńňŕíÎâęŕ self.treasure_info = {} for i=0,n-1 do result, id, value = getIniLine("list",i,"","",iniFileName) self.treasure_info[id] = {} self.treasure_info[id].target = utils.cfg_get_number(self.ini, id, "target", nil, true) --self.treasure_info[id].target = getIniValueFloat(id, "target", nil, iniFileName) self.treasure_info[id].name = utils.cfg_get_string(self.ini, id, "name", nil, true, "") --self.treasure_info[id].name = getIniValueString(id, "name", "", iniFileName) self.treasure_info[id].description = utils.cfg_get_string(self.ini, id, "description", nil, true, "") --self.treasure_info[id].description = getIniValueString(id, "description", "", iniFileName) self.treasure_info[id].items = parse_spawns(utils.cfg_get_string(self.ini, id, "items", nil, true, "")) --self.treasure_info[id].items = parse_spawns(getIniValueString(id, "items", "", iniFileName)) local community = parse_names(getIniValueString(id, "community", "stalker, bandit, dolg, freedom", iniFileName)) self.treasure_info[id].community = {} for k,v in pairs(community) do self.treasure_info[id].community[v] = true end if self.treasure_info[id].items == nil then abort("cant find 'items' in %s", id) end self.treasure_info[id].condlist = xr_logic.parse_condlist(db.actor, "treasure_manager", "condlist", getIniValueString(id, "condlist", "", iniFileName)) --' Îňěĺňčě ňŕéíčę ęŕę íÎâűé self.treasure_info[id].active = true self.treasure_info[id].done = true --print_table(self.treasure_info) end --' âńďÎěÎăŕňĺëüíűĺ ňŕáëčöű äë˙ Îáëĺă÷ĺíč˙ ďÎčńęŕ self.treasure_by_target = {} for k,v in pairs(self.treasure_info) do self.treasure_by_target[v.target] = k end end --' Ţçŕíčĺ číčöčŕňÎđŕ (âÎçěÎćíÎńňü âűäŕňü ňŕéíčę) function CTreasure:use(npc) printf("TREASURE USE") --lootmoney start if (npc and db.actor) then lootmoney.lootmoney(npc) end --lootmoney end local rarets if npc ~= nil then n_rank = npc:character_rank() else n_rank = 0 end -- ĺńëč âűáđŕí đĺäęčé ňčď ňŕéíčęÎâ, ňÎ ńíčçčě ÎâĺđÎ˙ňíÎńňü ĺăÎ âűďŕäĺíč˙ if amk.load_variable("option_treasure", 100) == 2 then rarets = 100 else rarets = 100 end if amk.is_debug then rarets=100 end if math.random(100) < rarets then return end --' íóćíÎ đŕíäÎěíÎ âűáđŕňü Îäčí čç ňŕéíčęÎâ. local avail = {} local tr_sum = 100 for k,v in pairs(self.treasure_info) do if v.done == true and v.active == true and v.community[npc:character_community()] == true then local treasure_prob = xr_logic.pick_section_from_condlist(db.actor, npc, v.condlist) if treasure_prob == "" or treasure_prob == nil then treasure_prob = 100 end if tonumber(treasure_prob) >= 100 and v.community[npc:character_community()] == true and v.active == true then if tonumber(treasure_prob) == 100 then self:give_treasure(k) else table.insert(avail, {k = k, prob = treasure_prob}) tr_sum = tr_sum + treasure_prob end end end end if tr_sum == 100 or math.random(100) < 0 then return end local tr_w = math.random(tr_sum) for k,v in pairs(avail) do tr_w = tr_w - v.prob if tr_w <= 0 then --' âűäŕňü ňŕéíčę self:give_treasure(v.k) break end end end --' ŃÎőđŕíĺíčĺ function CTreasure:check() --' ĎđÎâĺđęŕ ňŕéíčęÎâ for k,v in pairs(self.treasure_info) do --' âűäŕňü ňŕéíčę self:give_treasure(k) end end --' âűäŕ÷ŕ ňŕéíčęŕ function CTreasure:give_treasure(k) local v = self.treasure_info[k] local obj = alife():story_object(v.target) if obj ~= nil then news_manager.send_treasure(v.name) --' ĎÎěĺňčňü íŕ ęŕđňĺ local text = "%c[255,238,155,23]"..game.translate_string(v.name).."n".."%c[default]"..game.translate_string(v.description) -- if not level.map_has_object_spot(obj.id,"treasure") then level.map_add_object_spot_ser(obj.id, "treasure", text) -- else -- amk.mylog("Blocking mapspot for "..obj:name()) -- end -- ďđÎâĺđęŕ, ęŕęÎé ňčď ňŕéíčęŕ âűáđŕí -- ĺńëč ňŕéíčę íĺ ęëŕńńč÷ĺńęčé č íĺ čěĺííÎé, ňÎ çŕěĺíčě ńÎäĺđćčěÎĺ if amk.load_variable("option_treasure", 100) ~= 100 and self:named_treasure(v) == true then v.items = self:give_item_list() end --' Ńăĺíĺđčňü âĺůč for kk,vv in pairs(v.items) do if ammo_section[vv.section] == true then se_respawn.create_ammo(vv.section, obj.position, obj.m_level_vertex_id, obj.m_game_vertex_id, obj.id, vv.prob) else for i=1,vv.prob do alife():create(vv.section, obj.position, obj.m_level_vertex_id, obj.m_game_vertex_id, obj.id) end end end --' ĎÎěĺňčě ňŕéíčę ęŕę âűäŕííűé self.treasure_info[k].active = true self.treasure_info[k].done = true -- Îňďđŕâčě ňŕéíčę â Îôôëŕéí local sim = alife () if sim ~= nil and obj.online then sim:set_switch_online (obj.id, true) sim:set_switch_offline (obj.id, true) -- sim:set_switch_online (obj.id, true) -- sim:set_switch_offline (obj.id, true) amk.convert_npc[obj.id]=1 -- ńňŕâčě â Î÷ĺđĺäü íŕ âűâÎä â Îíëŕéí end else printf("TREASURE %s, target doesnt exist", k) end end --' Ńíčěŕĺě Îňěĺňęó ń ňŕéíčęŕ function CTreasure:treasure_empty(box, box_story_id) printf("!!! treasure empty") local k = self.treasure_by_target[box_story_id] if k == nil or self.treasure_info[k] == nil then return end self.treasure_info[k].active = true -- ĺńëč ňŕéíčę íĺ čěĺííÎé, ňÎ ďĺđĺâĺäĺí ĺăÎ â Îíëŕéí äë˙ ńëĺäóţůĺé âűäŕ÷č if self:named_treasure(self.treasure_info[k]) == true then self.treasure_info[k].done = true end level.map_remove_object_spot(box:id(), "treasure") end --' ŃÎőđŕíĺíčĺ function CTreasure:save(p) --' ŃÎőđŕí˙ĺě đŕçěĺđ ňŕáëčöű local size = 0 for k,v in pairs(self.treasure_info) do size = size + 1 end p:w_u16(size) for k,v in pairs(self.treasure_info) do p:w_u16(v.target) p:w_bool(v.active) p:w_bool(v.done) end end --' çŕăđóçęŕ function CTreasure:load(p) local t = p:r_u16() for i = 1,t do local k = self.treasure_by_target[p:r_u16()] self.treasure_info[k].active = p:r_bool() self.treasure_info[k].done = p:r_bool() end end function CTreasure:give_item_list() local rank = 1 local tabla = {} -- ńęÎëüęÎ íŕčěĺíÎâŕíčé ďđĺäěĺňÎâ áóäĺň â ňŕéíčęĺ local i = math.random(1, 4) -- ń÷čňŕĺě íŕńňđÎéęó ďÎëüçÎâŕňĺë˙ local opt = amk.load_variable("option_treasure", 0) --~ -- Îďđĺäĺëčě đŕíă íĺďčń˙ --~ if nepis~= nil then -- rank = n_rank --nepis.character_rank () if n_rank == nil then n_rank = math.random(1, 9)*100 end if n_rank <= 300 then rank = 1 elseif n_rank <=600 then rank = 2 elseif n_rank <= 900 then rank = 3 else rank = 4 end --~ else --~ rank = 1 --~ end for j = 1, i, 1 do local cnt = 0 local spawn = {} -- Îďđĺäĺëčě, čç ęŕęÎé ńĺęöčč áđŕňü ďđĺäěĺňű, č ęŕęčĺ čěĺííÎ if opt == 1 then if rank == 1 then spawn.section = solid_list.novice_section[math.random(table.getn(solid_list.novice_section))] elseif rank == 2 then spawn.section = solid_list.experienced_section[math.random(table.getn(solid_list.experienced_section))] elseif rank == 3 then spawn.section = solid_list.veteran_section[math.random(table.getn(solid_list.veteran_section))] else spawn.section = solid_list.master_section[math.random(table.getn(solid_list.master_section))] end else if rank == 1 then spawn.section = rare_list.novice_section[math.random(table.getn(rare_list.novice_section))] elseif rank == 2 then spawn.section = rare_list.experienced_section[math.random(table.getn(rare_list.experienced_section))] elseif rank == 3 then spawn.section = rare_list.veteran_section[math.random(table.getn(rare_list.veteran_section))] else spawn.section = rare_list.master_section[math.random(table.getn(rare_list.master_section))] end end -- óńňŕíÎâęŕ ęÎë-âŕ ďđĺäěĺňÎâ â çŕâčńčěÎńňč Îň ńĺęöčč if ammo_section[spawn.section] == true then local ini = system_ini() local num_in_box = ini:r_u32(spawn.section, "box_size") local h = math.random(1, 5) -- ďŕňđÎíű âűäŕĺě íĺ řňóęŕěč, ŕ ďŕ÷ęŕěč cnt = math.random(1, h) * num_in_box else local s = tostring(spawn.section) if string.find(s, "outfit") ~= nil or string.find(s, "wpn") ~= nil then cnt = 1 elseif string.find(s, "addon") ~= nil or string.find(s, "af") ~= nil or string.find(s, "mutant") ~= nil then cnt = math.random(1,2) else cnt = math.random(1,5) end end -- ńÎőđŕí˙ĺě číôó Î ňĺęóůĺě ďđĺäěĺňĺ spawn.prob = cnt table.insert(tabla, spawn) end return tabla end function CTreasure:named_treasure(v) -- ďđÎâĺđęŕ, ˙âë˙ĺňń˙ ëč ňŕéíčę čěĺííűě. Ĺńëč äŕ, ňÎ ĺăÎ íŕďÎëíĺíčĺ íĺ ěĺí˙ĺňń˙ if v.name == "agr_secret_0000_name" --Ňŕéíčę ŃĺđÎăÎ or v.name == "bar_secret_0011_name" --Ňŕéíčę Ŕđíč or v.name == "esc_secret_0013_name" --Ňŕéíčę âÎđďŕëŕ or v.name == "gar_secret_0002_name" --âĺůč Ăđčçëč or v.name == "gar_secret_0011_name" --Ńęëŕä ăđóďďű Ńňđĺëęŕ or v.name == "gar_secret_0021_name" --Đţęçŕę äÎőë˙ęŕ or v.name == "pri_secret_0003_name" --Őŕáŕđ Ęëűęŕ or v.name == "pri_secret_0004_name" --çŕďŕńű ëčäĺđŕ ŃâÎáÎäű or v.name == "rad_secret_0000_name" --Ęëŕä óăđţěÎăÎ or v.name == "rad_secret_0004_name" --çŕďŕń ăđóďďű Îň÷ŕ˙ííűő or v.name == "ros_secret_0015_name" --Ňŕéíčę Ń÷ŕńňëčâ÷čęŕ or v.name == "ros_secret_0018_name" --ßůčę ń ěĺäčęŕěĺíňŕěč or v.name == "val_secret_0028_name" --Ňŕéíčę áÎđÎâŕ or v.name == "x18_secret_0000_name" --Ňŕéíčę ĘÎď÷ĺíÎăÎ or v.name == "yan_secret_0011_name" --Ňŕéíčę ó÷¸íÎăÎ or v.name == "agr_krysyk_secret_name" or v.name == "agr_krysyk_secret_name" or v.name == "mil_borov_secret_name" or v.name == "aver_arhara_secret_1" --Ňŕéíčę Ŕđőŕđű or v.name == "aver_arhara_secret_2" --Ňŕéíčę Ďčëčăđčěŕ or v.name == "aver_arhara_secret_3" --Ňŕéíčę Îňřĺëüíčęŕ or v.name == "aver_arhara_secret_4" --Ňŕéíčę çâĺçäÎ÷¸ňŕ or v.name == "aver_arhara_secret_5" --Ňŕéíčę Ńňŕđčęŕ or v.name == "warlab_arhara_secret_1" --Ňŕéíčę or v.name == "warlab_arhara_secret_2" --Ňŕéíčę or v.name == "warlab_arhara_secret_3" --Ňŕéíčę or v.name == "village_arhara_secret_1" --Ňŕéíčę Ěčőč or v.name == "village_arhara_secret_2" --Ňŕéíčę ěĺńňíÎăÎ or v.name == "village_arhara_secret_3" --đţęçŕę ęŕďčňŕíŕ or v.name == "village_arhara_secret_4" --Ňŕéíčę ëĺéňĺíŕíňŕ or v.name == "generators_arhara_secret_1" --Đţęçŕę ěÎíÎëčňÎâöŕ or v.name == "generators_arhara_secret_2" --Ňŕéíčę çĺěë˙ęŕ or v.name == "generators_arhara_secret_3" --Őŕáŕđ Îőđŕííčęŕ or v.name == "generators_arhara_secret_4" --Ňŕéíčę ôđčöŕ or v.name == "generators_arhara_secret_5" --íĺčçâĺńňíűé ňŕéíčę or v.name == "atp_arhara_secret_1" --Ňŕéíčę ěŕň¸đÎăÎ đŕçâĺä÷čęŕ or v.name == "atp_arhara_secret_2" --çŕíŕ÷ęŕ Říűđű or v.name == "atp_arhara_secret_3" --Őŕáŕđ Ęčňŕ or v.name == "dead_city_secret_1" --çŕíŕ÷ęŕ áĺăëĺöŕ or v.name == "dead_city_secret_2" --âĺůč çÎěáčđÎâŕííÎăÎ or v.name == "dead_city_secret_3" --íű÷ęŕ ÎáěÎđÎęŕ or v.name == "dead_city_secret_4" --ŃőđÎí ńňŕđÎćčëŕ or v.name == "dead_city_secret_5" --äĺäęčíű âĺůč or v.name == "esc_secret_0010_name" --Ňŕéíčę ń ďčâÎě or v.name == "marsh_secret_0014_name" --Schowek Huntera then return true else return true end end function get_treasure_manager() if treasure_manager == nil then treasure_manager = CTreasure() end return treasure_manager end function take_item_from_box(box, box_story_id) printf("!!! take item from box %s", tostring(box:is_inv_box_empty())) -- if box:is_inv_box_empty() == true then get_treasure_manager():treasure_empty(box, box_story_id) -- end end function save(p) get_treasure_manager():save(p) end function load(p) get_treasure_manager():load(p) end function clear_treasure_manager() treasure_manager = nil end function CTreasure:dialog(npc) if npc ~= nil then n_rank = npc:character_rank() else n_rank = 0 end local avail = {} local tr_sum = 100 for k,v in pairs(self.treasure_info) do if v.done == true and v.active == true and v.community[npc:character_community()] == true then local treasure_prob = xr_logic.pick_section_from_condlist(db.actor, npc, v.condlist) if treasure_prob == "" or treasure_prob == nil then treasure_prob = 100 end if tonumber(treasure_prob) >= 100 and v.community[npc:character_community()] == true and v.active == true then if tonumber(treasure_prob) == 100 then self:give_treasure(k) else table.insert(avail, {k = k, prob = treasure_prob}) tr_sum = tr_sum + treasure_prob end end end end if tr_sum == 0 then return end local tr_w = math.random(tr_sum) for k,v in pairs(avail) do tr_w = tr_w - v.prob if tr_w <= 0 then self:give_treasure(v.k) break end end end terasure_manager.scripts -- solid_list ÎńíÎâŕí íŕ Linspiro Addon v1.1 local rare_list = { novice_section = { "wpn_toz34", "wpn_ak74", "wpn_aps_sk1", "wpn_m4super90", "wpn_mp5_m1", "wpn_colt_m1", "wpn_mp5_m2", "wpn_walther_m1", "scientific_outfit", "stalker_outfit_v3", "specops_outfit", "dolg_gaz_outfit_m1", "ammo_vog-25p", "ammo_m209", "ammo_12x70_buck", "ammo_5.45x39_fmj", "ammo_9x39_pab9", "ammo_9x39_ap", "ammo_9x39_sp5", "mutant_flesh_eye", "mutant_boar_leg", "mutant_dog_tail", "mutant_zombie_hand", "mutant_face_tushkano", "mutant_tail_cat", "mutant_spleen_rat", "af_medusa", "af_vyvert", "af_blood", "af_electra_sparkler", "af_rusty_thorn", "af_ameba_slime", "af_drops", "af_ameba_mica", "af_soul", "af_night_star", "af_electra_moonlight", "af_gravi", "af_cristall_flower", "af_mincer_meat", "af_electra_flash", "af_rusty_kristall", "af_ameba_slug", "af_fireball", "medkit_army" }, experienced_section = { "ammo_7.62x54_7h1", "ammo_7.62x54_ap", "ammo_7.62x54_7h14", "ammo_og-7b", "mutant_zombie_hand", "mutant_snork_leg", "mutant_poltergeist_glas", "mutant_fracture_hand", "mutant_boar_leg", "wpn_m16a2_sk1", "wpn_sg552_sk1", "wpn_wincheaster1300", "wpn_m4", "wpn_ppsh41_sk2", "wpn_abakan_m1", "wpn_fort_m1", "wpn_winchester_m1", "wpn_l85_m1", "wpn_l85_m2", "wpn_beretta_m1", "military_outfit", "svoboda_heavy_outfit", "dolg_scientific_outfit", "freedom_scientific_outfit", "merc_scientific_outfit", "monolit_scientific_outfit", "nebo_scientific_outfit", "outfit_dolg_m1", "outfit_killer_m1", "af_fuzz_kolobok", "af_rusty_sea-urchin", "af_ameba_mica", "af_soul", "af_night_star", "af_dummy_glassbeads", "af_dummy_pellicle", "af_dummy_battery", "af_dummy_dummy", "af_dummy_spring", "af_babka_1", "af_spirit_1", "medkit_army" }, veteran_section = { "af_dummy_dummy", "af_fuzz_kolobok", "af_spirit_1", "af_spirit_2", "af_cry_1", "af_babka_1", "af_pudd_1", "af_pudd_2", "af_dik_1", "af_kol_1", "af_armor_1", "af_armor_2", "af_dummy_dummy", "af_dummy_spring", "af_eye_voron", "ammo_og-7b", "ammo_vog-25p", "mutant_krovosos_jaw", "mutant_burer_hand", "mutant_zombie_hand", "mutant_hand_kontroler", "mutant_psevdogigant_hand", "mutant_chimera_kogot", "wpn_spas12_m1", "wpn_sig_m1", "wpn_spas12", "wpn_vintorez", "wpn_rpg7", "wpn_g36", "wpn_m1891_30_scope", "wpn_pkm", "wpn_groza", "medkit_army" }, master_section = { "wpn_vintorez", "wpn_svu", "wpn_svd", "wpn_rg6_m1", "wpn_val_m1", "wpn_rpg7", "wpn_fn2000", "wpn_protecta", "mutant_krovosos_jaw", "mutant_burer_hand", "mutant_hand_kontroler", "mutant_psevdogigant_hand", "mutant_chimera_kogot", "af_simbion", "svoboda_exoskeleton", "monolit_exoskeleton", "nebo_exo_outfit", "exo_bandit_outfit", "exo_outfit", "af_spirit_2", "af_cry_2", "af_babka_2", "af_pudd_2", "af_babka_3", "af_dik_2", "af_kol_2", "af_kol_3", "af_armor_2", "af_armor_3", "medkit_army", "medkit_scientic" } } local solid_list = { novice_section = { --Ŕđňĺôŕęňű-- "af_drops", "af_ameba_slime", "af_rusty_thorn", "af_electra_sparkler", "af_blood", "af_vyvert", "af_medusa", --Ŕěěóíčöč˙-- "grenade_rgd5", "ammo_12x70_buck", "ammo_9x19_fmj", "ammo_9x19_pbp", "ammo_9x18_pmm", "ammo_9x18_fmj", --Îđóćčĺ-- "wpn_addon_silencer", "wpn_mp5", "wpn_bm16", "wpn_fort", "wpn_pb", "wpn_pm", --ĎđÎ÷ĺĺ-- "bread", "bandage", "kolbasa", "medkit", "vodka", "sigaret", "conserva" }, experienced_section = { --Ŕđňĺôŕęňű-- "af_cristall_flower", "af_gravi", "af_mincer_meat", "af_electra_flash", "af_rusty_kristall", "af_ameba_slug", "af_fireball", --Ŕěěóíčöč˙-- "grenade_rgd5", "grenade_gd-05", "grenade_f1", "ammo_9x19_pbp", "ammo_9x18_pmm", "ammo_5.45x39_fmj", "ammo_11.43x23_fmj", "ammo_5.56x45_ss190", --Ďóřęč-- "wpn_addon_scope", "wpn_mp5", "wpn_ak74u", "wpn_ak74u_m1", "wpn_walther", --ĎđÎ÷ĺĺ-- "mutant_dog_tail", "mutant_boar_leg", "kolbasa", "medkit", "antirad", "energy_drink", "conserva" }, veteran_section = { --Ŕđňĺôŕęňű-- "af_night_star", "af_gold_fish", "af_soul", "af_electra_moonlight", "af_rusty_sea-urchin", "af_ameba_mica", "af_cristall", --Ŕěěóíčöč˙-- "grenade_f1", "ammo_vog-25", "ammo_m209", "ammo_5.45x39_ap", "ammo_11.43x23_hydro", "ammo_9x39_pab9", "ammo_5.56x45_ss190", "ammo_12x76_zhekan", --Ďóřęč-- "wpn_addon_scope_susat", "wpn_addon_grenade_launcher", "wpn_beretta", "wpn_sig550", "wpn_toz34", "wpn_abakan_m2", "wpn_desert_eagle", --ĎđÎ÷ĺĺ-- "mutant_psevdodog_tail", "mutant_snork_leg", "medkit_army", "antirad" }, master_section = { --Ŕđňĺôŕęňű-- "af_dummy_glassbeads", "af_dummy_pellicle", "af_dummy_battery", "af_dummy_dummy", "af_dummy_spring", "af_fuzz_kolobok", --Ŕěěóíčöč˙-- "ammo_m209", "ammo_vog-25p", "ammo_9x39_ap", "ammo_12x76_dart", "ammo_7.62x54_7h14", "ammo_9x39_sp5", "ammo_5.56x45_ap", "ammo_7.62x54_7h1", --Ďóřęč-- "wpn_addon_grenade_launcher_m203", "wpn_colt1911", "wpn_spas12", "wpn_l85", "wpn_lr300", "wpn_groza", "wpn_groza_m1", --ĎđÎ÷ĺĺ-- "mutant_krovosos_jaw", "mutant_burer_hand", "medkit_army", "medkit_scientic" } } local treasure_manager = nil local n_rank function parse_spawns(line) if line == nil then return {} end --' ĺńëč default-Îâ áÎëüřĺ, ÷ĺě çíŕ÷ĺíčé â ini, ňÎ çŕáčňü íĺäÎńňŕţůčĺ ďÎńëĺäíčě çíŕ÷ĺíčĺě čç ini local t = se_respawn.parse_names(line) local n = table.getn(t) local ret_table = {} local k = 1 while k <= n do local spawn = {} spawn.section = t[k] -- ĎđÎâĺđ˙ĺě ÷ňÎ ýňÎ íĺ ďÎńëĺäí˙˙ çŕďčńü if t[k+1] ~= nil then local p = tonumber(t[k+1]) -- ďđÎâĺđ˙ĺě ÷ňÎ âňÎđűě ÷čńëÎě çŕäŕíŕ âĺđÎ˙ňíÎńňü, ŕ íĺ äđóăŕ˙ ńĺęöč˙ ńďŕâíó if p then -- çŕáčâŕĺě ÷čńëÎ spawn.prob = p k = k + 2 else -- çŕáčâŕĺě äĺôÎëň 1 spawn.prob = 1 k = k + 1 end else spawn.prob = 1 k = k + 1 end table.insert(ret_table, spawn) end return ret_table end class "CTreasure" function CTreasure:__init() --' íŕ ęÎíńňđóęňÎđĺ âű÷čňűâŕĺě LTX č ńÎçäŕĺě çŕăÎňÎâęč ęâĺńňÎâ. local iniFileName = "misctreasure_manager.ltx" self.ini = ini_file(iniFileName) --' Čňĺđčđóĺěń˙ ďÎ âńĺě íŕńňđÎéęŕě ôđŕç if not iniLineSectionExist("list",iniFileName) then abort("There is no section in treasure_manager.ltx") end local n = iniLinesCount("list",iniFileName) local id, value = "","" --' íŕ÷ŕëüíŕ˙ óńňŕíÎâęŕ self.treasure_info = {} for i=0,n-1 do result, id, value = getIniLine("list",i,"","",iniFileName) self.treasure_info[id] = {} self.treasure_info[id].target = utils.cfg_get_number(self.ini, id, "target", nil, true) --self.treasure_info[id].target = getIniValueFloat(id, "target", nil, iniFileName) self.treasure_info[id].name = utils.cfg_get_string(self.ini, id, "name", nil, true, "") --self.treasure_info[id].name = getIniValueString(id, "name", "", iniFileName) self.treasure_info[id].description = utils.cfg_get_string(self.ini, id, "description", nil, true, "") --self.treasure_info[id].description = getIniValueString(id, "description", "", iniFileName) self.treasure_info[id].items = parse_spawns(utils.cfg_get_string(self.ini, id, "items", nil, true, "")) --self.treasure_info[id].items = parse_spawns(getIniValueString(id, "items", "", iniFileName)) local community = parse_names(getIniValueString(id, "community", "stalker, bandit, dolg, freedom", iniFileName)) self.treasure_info[id].community = {} for k,v in pairs(community) do self.treasure_info[id].community[v] = true end if self.treasure_info[id].items == nil then abort("cant find 'items' in %s", id) end self.treasure_info[id].condlist = xr_logic.parse_condlist(db.actor, "treasure_manager", "condlist", getIniValueString(id, "condlist", "", iniFileName)) --' Îňěĺňčě ňŕéíčę ęŕę íÎâűé self.treasure_info[id].active = true self.treasure_info[id].done = true --print_table(self.treasure_info) end --' âńďÎěÎăŕňĺëüíűĺ ňŕáëčöű äë˙ Îáëĺă÷ĺíč˙ ďÎčńęŕ self.treasure_by_target = {} for k,v in pairs(self.treasure_info) do self.treasure_by_target[v.target] = k end end --' Ţçŕíčĺ číčöčŕňÎđŕ (âÎçěÎćíÎńňü âűäŕňü ňŕéíčę) function CTreasure:use(npc) printf("TREASURE USE") --lootmoney start if (npc and db.actor) then lootmoney.lootmoney(npc) end --lootmoney end local rarets if npc ~= nil then n_rank = npc:character_rank() else n_rank = 0 end -- ĺńëč âűáđŕí đĺäęčé ňčď ňŕéíčęÎâ, ňÎ ńíčçčě ÎâĺđÎ˙ňíÎńňü ĺăÎ âűďŕäĺíč˙ if amk.load_variable("option_treasure", 100) == 2 then rarets = 100 else rarets = 100 end if amk.is_debug then rarets=100 end if math.random(100) < rarets then return end --' íóćíÎ đŕíäÎěíÎ âűáđŕňü Îäčí čç ňŕéíčęÎâ. local avail = {} local tr_sum = 0 for k,v in pairs(self.treasure_info) do if v.done == true and v.active == true and v.community[npc:character_community()] == true then local treasure_prob = xr_logic.pick_section_from_condlist(db.actor, npc, v.condlist) if treasure_prob == "" or treasure_prob == nil then treasure_prob = 100 end if tonumber(treasure_prob) >= 100 and v.community[npc:character_community()] == true and v.active == true then if tonumber(treasure_prob) == 100 then self:give_treasure(k) else table.insert(avail, {k = k, prob = treasure_prob}) tr_sum = tr_sum + treasure_prob end end end end if tr_sum == 100 or math.random(100) < 0 then return end local tr_w = math.random(tr_sum) for k,v in pairs(avail) do tr_w = tr_w - v.prob if tr_w <= 0 then --' âűäŕňü ňŕéíčę self:give_treasure(v.k) break end end end --' ŃÎőđŕíĺíčĺ function CTreasure:check() --' ĎđÎâĺđęŕ ňŕéíčęÎâ for k,v in pairs(self.treasure_info) do --' âűäŕňü ňŕéíčę self:give_treasure(k) end end --' âűäŕ÷ŕ ňŕéíčęŕ function CTreasure:give_treasure(k) local v = self.treasure_info[k] local obj = alife():story_object(v.target) if obj ~= nil then news_manager.send_treasure(v.name) --' ĎÎěĺňčňü íŕ ęŕđňĺ local text = "%c[255,238,155,23]"..game.translate_string(v.name).."n".."%c[default]"..game.translate_string(v.description) -- if not level.map_has_object_spot(obj.id,"treasure") then level.map_add_object_spot_ser(obj.id, "treasure", text) -- else -- amk.mylog("Blocking mapspot for "..obj:name()) -- end -- ďđÎâĺđęŕ, ęŕęÎé ňčď ňŕéíčęŕ âűáđŕí -- ĺńëč ňŕéíčę íĺ ęëŕńńč÷ĺńęčé č íĺ čěĺííÎé, ňÎ çŕěĺíčě ńÎäĺđćčěÎĺ if amk.load_variable("option_treasure", 100) ~= 100 and self:named_treasure(v) == true then v.items = self:give_item_list() end --' Ńăĺíĺđčňü âĺůč for kk,vv in pairs(v.items) do if ammo_section[vv.section] == true then se_respawn.create_ammo(vv.section, obj.position, obj.m_level_vertex_id, obj.m_game_vertex_id, obj.id, vv.prob) else for i=1,vv.prob do alife():create(vv.section, obj.position, obj.m_level_vertex_id, obj.m_game_vertex_id, obj.id) end end end --' ĎÎěĺňčě ňŕéíčę ęŕę âűäŕííűé self.treasure_info[k].active = true self.treasure_info[k].done = true -- Îňďđŕâčě ňŕéíčę â Îôôëŕéí local sim = alife () if sim ~= nil and obj.online then sim:set_switch_online (obj.id, true) sim:set_switch_offline (obj.id, true) -- sim:set_switch_online (obj.id, true) -- sim:set_switch_offline (obj.id, true) amk.convert_npc[obj.id]=1 -- ńňŕâčě â Î÷ĺđĺäü íŕ âűâÎä â Îíëŕéí end else printf("TREASURE %s, target doesnt exist", k) end end --' Ńíčěŕĺě Îňěĺňęó ń ňŕéíčęŕ function CTreasure:treasure_empty(box, box_story_id) printf("!!! treasure empty") local k = self.treasure_by_target[box_story_id] if k == nil or self.treasure_info[k] == nil then return end self.treasure_info[k].active = trur -- ĺńëč ňŕéíčę íĺ čěĺííÎé, ňÎ ďĺđĺâĺäĺí ĺăÎ â Îíëŕéí äë˙ ńëĺäóţůĺé âűäŕ÷č if self:named_treasure(self.treasure_info[k]) == true then self.treasure_info[k].done = true end level.map_remove_object_spot(box:id(), "treasure") end --' ŃÎőđŕíĺíčĺ function CTreasure:save(p) --' ŃÎőđŕí˙ĺě đŕçěĺđ ňŕáëčöű local size = 0 for k,v in pairs(self.treasure_info) do size = size + 1 end p:w_u16(size) for k,v in pairs(self.treasure_info) do p:w_u16(v.target) p:w_bool(v.active) p:w_bool(v.done) end end --' çŕăđóçęŕ function CTreasure:load(p) local t = p:r_u16() for i = 1,t do local k = self.treasure_by_target[p:r_u16()] self.treasure_info[k].active = p:r_bool() self.treasure_info[k].done = p:r_bool() end end function CTreasure:give_item_list() local rank = 1 local tabla = {} -- ńęÎëüęÎ íŕčěĺíÎâŕíčé ďđĺäěĺňÎâ áóäĺň â ňŕéíčęĺ local i = math.random(1, 4) -- ń÷čňŕĺě íŕńňđÎéęó ďÎëüçÎâŕňĺë˙ local opt = amk.load_variable("option_treasure", 0) --~ -- Îďđĺäĺëčě đŕíă íĺďčń˙ --~ if nepis~= nil then -- rank = n_rank --nepis.character_rank () if n_rank == nil then n_rank = math.random(1, 9)*100 end if n_rank <= 300 then rank = 1 elseif n_rank <=600 then rank = 2 elseif n_rank <= 900 then rank = 3 else rank = 4 end --~ else --~ rank = 1 --~ end for j = 1, i, 1 do local cnt = 0 local spawn = {} -- Îďđĺäĺëčě, čç ęŕęÎé ńĺęöčč áđŕňü ďđĺäěĺňű, č ęŕęčĺ čěĺííÎ if opt == 1 then if rank == 1 then spawn.section = solid_list.novice_section[math.random(table.getn(solid_list.novice_section))] elseif rank == 2 then spawn.section = solid_list.experienced_section[math.random(table.getn(solid_list.experienced_section))] elseif rank == 3 then spawn.section = solid_list.veteran_section[math.random(table.getn(solid_list.veteran_section))] else spawn.section = solid_list.master_section[math.random(table.getn(solid_list.master_section))] end else if rank == 1 then spawn.section = rare_list.novice_section[math.random(table.getn(rare_list.novice_section))] elseif rank == 2 then spawn.section = rare_list.experienced_section[math.random(table.getn(rare_list.experienced_section))] elseif rank == 3 then spawn.section = rare_list.veteran_section[math.random(table.getn(rare_list.veteran_section))] else spawn.section = rare_list.master_section[math.random(table.getn(rare_list.master_section))] end end -- óńňŕíÎâęŕ ęÎë-âŕ ďđĺäěĺňÎâ â çŕâčńčěÎńňč Îň ńĺęöčč if ammo_section[spawn.section] == true then local ini = system_ini() local num_in_box = ini:r_u32(spawn.section, "box_size") local h = math.random(1, 5) -- ďŕňđÎíű âűäŕĺě íĺ řňóęŕěč, ŕ ďŕ÷ęŕěč cnt = math.random(1, h) * num_in_box else local s = tostring(spawn.section) if string.find(s, "outfit") ~= nil or string.find(s, "wpn") ~= nil then cnt = 1 elseif string.find(s, "addon") ~= nil or string.find(s, "af") ~= nil or string.find(s, "mutant") ~= nil then cnt = math.random(1,2) else cnt = math.random(1,5) end end -- ńÎőđŕí˙ĺě číôó Î ňĺęóůĺě ďđĺäěĺňĺ spawn.prob = cnt table.insert(tabla, spawn) end return tabla end function CTreasure:named_treasure(v) -- ďđÎâĺđęŕ, ˙âë˙ĺňń˙ ëč ňŕéíčę čěĺííűě. Ĺńëč äŕ, ňÎ ĺăÎ íŕďÎëíĺíčĺ íĺ ěĺí˙ĺňń˙ if v.name == "agr_secret_0000_name" --Ňŕéíčę ŃĺđÎăÎ or v.name == "bar_secret_0011_name" --Ňŕéíčę Ŕđíč or v.name == "esc_secret_0013_name" --Ňŕéíčę âÎđďŕëŕ or v.name == "gar_secret_0002_name" --âĺůč Ăđčçëč or v.name == "gar_secret_0011_name" --Ńęëŕä ăđóďďű Ńňđĺëęŕ or v.name == "gar_secret_0021_name" --Đţęçŕę äÎőë˙ęŕ or v.name == "pri_secret_0003_name" --Őŕáŕđ Ęëűęŕ or v.name == "pri_secret_0004_name" --çŕďŕńű ëčäĺđŕ ŃâÎáÎäű or v.name == "rad_secret_0000_name" --Ęëŕä óăđţěÎăÎ or v.name == "rad_secret_0004_name" --çŕďŕń ăđóďďű Îň÷ŕ˙ííűő or v.name == "ros_secret_0015_name" --Ňŕéíčę Ń÷ŕńňëčâ÷čęŕ or v.name == "ros_secret_0018_name" --ßůčę ń ěĺäčęŕěĺíňŕěč or v.name == "val_secret_0028_name" --Ňŕéíčę áÎđÎâŕ or v.name == "x18_secret_0000_name" --Ňŕéíčę ĘÎď÷ĺíÎăÎ or v.name == "yan_secret_0011_name" --Ňŕéíčę ó÷¸íÎăÎ or v.name == "agr_krysyk_secret_name" or v.name == "agr_krysyk_secret_name" or v.name == "mil_borov_secret_name" or v.name == "aver_arhara_secret_1" --Ňŕéíčę Ŕđőŕđű or v.name == "aver_arhara_secret_2" --Ňŕéíčę Ďčëčăđčěŕ or v.name == "aver_arhara_secret_3" --Ňŕéíčę Îňřĺëüíčęŕ or v.name == "aver_arhara_secret_4" --Ňŕéíčę çâĺçäÎ÷¸ňŕ or v.name == "aver_arhara_secret_5" --Ňŕéíčę Ńňŕđčęŕ or v.name == "warlab_arhara_secret_1" --Ňŕéíčę or v.name == "warlab_arhara_secret_2" --Ňŕéíčę or v.name == "warlab_arhara_secret_3" --Ňŕéíčę or v.name == "village_arhara_secret_1" --Ňŕéíčę Ěčőč or v.name == "village_arhara_secret_2" --Ňŕéíčę ěĺńňíÎăÎ or v.name == "village_arhara_secret_3" --đţęçŕę ęŕďčňŕíŕ or v.name == "village_arhara_secret_4" --Ňŕéíčę ëĺéňĺíŕíňŕ or v.name == "generators_arhara_secret_1" --Đţęçŕę ěÎíÎëčňÎâöŕ or v.name == "generators_arhara_secret_2" --Ňŕéíčę çĺěë˙ęŕ or v.name == "generators_arhara_secret_3" --Őŕáŕđ Îőđŕííčęŕ or v.name == "generators_arhara_secret_4" --Ňŕéíčę ôđčöŕ or v.name == "generators_arhara_secret_5" --íĺčçâĺńňíűé ňŕéíčę or v.name == "atp_arhara_secret_1" --Ňŕéíčę ěŕň¸đÎăÎ đŕçâĺä÷čęŕ or v.name == "atp_arhara_secret_2" --çŕíŕ÷ęŕ Říűđű or v.name == "atp_arhara_secret_3" --Őŕáŕđ Ęčňŕ or v.name == "dead_city_secret_1" --çŕíŕ÷ęŕ áĺăëĺöŕ or v.name == "dead_city_secret_2" --âĺůč çÎěáčđÎâŕííÎăÎ or v.name == "dead_city_secret_3" --íű÷ęŕ ÎáěÎđÎęŕ or v.name == "dead_city_secret_4" --ŃőđÎí ńňŕđÎćčëŕ or v.name == "dead_city_secret_5" --äĺäęčíű âĺůč or v.name == "esc_secret_0010_name" --Ňŕéíčę ń ďčâÎě or v.name == "marsh_secret_0014_name" --Schowek Huntera then return true else return false end end function get_treasure_manager() if treasure_manager == nil then treasure_manager = CTreasure() end return treasure_manager end function take_item_from_box(box, box_story_id) printf("!!! take item from box %s", tostring(box:is_inv_box_empty())) -- if box:is_inv_box_empty() == true then get_treasure_manager():treasure_empty(box, box_story_id) -- end end function save(p) get_treasure_manager():save(p) end function load(p) get_treasure_manager():load(p) end function clear_treasure_manager() treasure_manager = nil end function CTreasure:dialog(npc) if npc ~= nil then n_rank = npc:character_rank() else n_rank = 0 end local avail = {} local tr_sum = 0 for k,v in pairs(self.treasure_info) do if v.done == true and v.active == true and v.community[npc:character_community()] == true then local treasure_prob = xr_logic.pick_section_from_condlist(db.actor, npc, v.condlist) if treasure_prob == "" or treasure_prob == nil then treasure_prob = 100 end if tonumber(treasure_prob) >= 100 and v.community[npc:character_community()] == true and v.active == true then if tonumber(treasure_prob) == 100 then self:give_treasure(k) else table.insert(avail, {k = k, prob = treasure_prob}) tr_sum = tr_sum + treasure_prob end end end end if tr_sum == 100 then return end local tr_w = math.random(tr_sum) for k,v in pairs(avail) do tr_w = tr_w - v.prob if tr_w <= 100 then self:give_treasure(v.k) break end end end uwaga: Nie testowany na soliance Nie dubluj postów LD Edytowane 27 Listopada 2011 przez LordDino Odnośnik do komentarza Udostępnij na innych stronach Więcej opcji udostępniania...
Rekomendowane odpowiedzi