662 lines
34 KiB
Plaintext
662 lines
34 KiB
Plaintext
|
local coc_ranking_array_size = 100 -- Top100
|
||
|
local coc_ranking_list = {}
|
||
|
local actor_rank_place
|
||
|
dialog_closed = true
|
||
|
|
||
|
----------------------------------------------------------------------------
|
||
|
-- Engine->lua function calls
|
||
|
----------------------------------------------------------------------------
|
||
|
|
||
|
-- PDA Tabs
|
||
|
-- It's now possible to add new button tabs to pda*.xml.
|
||
|
-- You can use ActorMenu.get_pda_menu():GetActiveSection() to find out active pda tab
|
||
|
-- UI returned must be CUIScriptWnd
|
||
|
function set_active_subdialog(section)
|
||
|
--printf("set_active_subdialog | section=%s",section)
|
||
|
|
||
|
-- SMR
|
||
|
if smr_amain_mcm.get_config("smr_enabled") and smr_amain_mcm.get_config("glitched_pda") then
|
||
|
return ui_pda_glitched_tab.get_ui()
|
||
|
end
|
||
|
|
||
|
-- For NPCs PDA
|
||
|
local obj = db.actor:item_in_slot(8)
|
||
|
local sec = obj and obj:section()
|
||
|
if item_device.device_npc_pda[sec] then
|
||
|
return ui_pda_npc_tab.get_ui( se_load_var(obj:id(), obj:name(), "info") )
|
||
|
end
|
||
|
|
||
|
-- For Actor PDA
|
||
|
if (section == "eptTasks") then
|
||
|
|
||
|
elseif (section == "eptRanking") then
|
||
|
|
||
|
elseif (section == "eptLogs") then
|
||
|
|
||
|
elseif (section == "eptRelations") then
|
||
|
return ui_pda_relations_tab.get_ui()
|
||
|
|
||
|
elseif (section == "eptContacts") then
|
||
|
if _G.WARFARE then
|
||
|
return ui_pda_warfare_tab.get_ui()
|
||
|
else
|
||
|
return ui_pda_contacts_tab.get_ui()
|
||
|
end
|
||
|
|
||
|
elseif (section == "eptEncyclopedia") then
|
||
|
return ui_pda_encyclopedia_tab.get_ui()
|
||
|
|
||
|
elseif (section == "eptRadio") then
|
||
|
return ui_pda_radio_tab.get_ui()
|
||
|
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function pda_use() -- from engine?
|
||
|
return item_device.is_pda_charged()
|
||
|
end
|
||
|
|
||
|
function on_low_battery() -- from engine
|
||
|
|
||
|
end
|
||
|
|
||
|
local map_spot_property = {}
|
||
|
function property_box_clicked(property_ui)
|
||
|
local list_item = property_ui:GetSelectedItem()
|
||
|
if not (list_item) then
|
||
|
return
|
||
|
end
|
||
|
local textControl = list_item:GetTextItem()
|
||
|
local prop = textControl:GetText()
|
||
|
--printf("prop=%s",prop)
|
||
|
SendScriptCallback("map_spot_menu_property_clicked",property_ui,map_spot_property.id,map_spot_property.level_name,prop)
|
||
|
end
|
||
|
|
||
|
function property_box_add_properties(property_ui,id,level_name,hint)
|
||
|
map_spot_property.id = id
|
||
|
map_spot_property.level_name = level_name
|
||
|
-- if (hint and hint ~= "") then
|
||
|
-- property_ui:AddItem(hint)
|
||
|
-- end
|
||
|
SendScriptCallback("map_spot_menu_add_property",property_ui,id,level_name,hint)
|
||
|
end
|
||
|
|
||
|
-- use actor_menu for other modes
|
||
|
-- 10 = Talk dialog show
|
||
|
-- 11 = Talk dialog hide
|
||
|
function actor_menu_mode(mode)
|
||
|
if(mode==10) then
|
||
|
dialog_closed = false
|
||
|
for k,st in pairs(db.storage) do
|
||
|
if (st.object and st.object:is_talking() and st.object:id() ~= AC_ID) then
|
||
|
local id = st.object:id()
|
||
|
SetEvent("used_npc_id", id) -- stupid hack since sidorovich and forester don't have use_callback
|
||
|
local sound_theme = xr_sound.sound_table[id]
|
||
|
if sound_theme and sound_theme.reset then
|
||
|
sound_theme:reset(id)
|
||
|
end
|
||
|
local m_data = alife_storage_manager.get_state()
|
||
|
if not (m_data.actor_contacts) then
|
||
|
m_data.actor_contacts = {}
|
||
|
end
|
||
|
m_data.actor_contacts[id] = true
|
||
|
break
|
||
|
end
|
||
|
end
|
||
|
Register_UI("Dialog")
|
||
|
--printf("---:>Talk Dialog show")
|
||
|
elseif(mode==11) then
|
||
|
--printf("---:>Talk Dialog hide")
|
||
|
SendScriptCallback("actor_on_leave_dialog",GetEvent("used_npc_id"))
|
||
|
SetEvent("used_npc_id", nil)
|
||
|
dialog_closed = true
|
||
|
Unregister_UI("Dialog")
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function get_time_elapsed()
|
||
|
local s_time = level.get_start_time()
|
||
|
local seconds = tonumber(game.get_game_time():diffSec(s_time))
|
||
|
|
||
|
if (seconds < 60) then
|
||
|
return string.format("%d %s",seconds,game.translate_string("ui_st_secs"))
|
||
|
elseif (seconds < 3600) then
|
||
|
return string.format("%d %s",seconds/60,game.translate_string("ui_st_mins"))
|
||
|
elseif (seconds < 86400) then
|
||
|
return string.format("%d %s",seconds/60/60,game.translate_string("ui_st_hours"))
|
||
|
end
|
||
|
|
||
|
return string.format("%d %s",seconds/60/60/24,game.translate_string("ui_st_days"))
|
||
|
end
|
||
|
|
||
|
function get_stat(index) -- index= int return string
|
||
|
if(index==0) then
|
||
|
return get_time_elapsed()
|
||
|
elseif(index==1) then
|
||
|
return tostring(game_statistics.get_statistic_count("emissions"))
|
||
|
elseif(index==2) then
|
||
|
return tostring(game_statistics.get_statistic_count("tasks_completed"))
|
||
|
elseif(index==3) then
|
||
|
return tostring(game_statistics.get_statistic_count("killed_monsters"))
|
||
|
elseif(index==4) then
|
||
|
return tostring(game_statistics.get_statistic_count("killed_stalkers"))
|
||
|
elseif(index==5) then
|
||
|
return tostring(game_statistics.get_statistic_count("boxes_smashed"))
|
||
|
elseif(index==6) then
|
||
|
return tostring(game_statistics.get_statistic_count("stashes_found"))
|
||
|
elseif(index==7) then
|
||
|
return tostring(game_statistics.get_statistic_count("psi_storms"))
|
||
|
elseif(index==8) then
|
||
|
return tostring(game_statistics.get_statistic_count("pdas_delivered"))
|
||
|
elseif(index==9) then
|
||
|
return tostring(game_statistics.get_statistic_count("helicopters_downed"))
|
||
|
elseif(index==10) then
|
||
|
return tostring(game_statistics.get_statistic_count("artefacts_detected"))
|
||
|
elseif(index==11) then
|
||
|
return tostring(game_statistics.get_statistic_count("wounded_helped"))
|
||
|
elseif(index==12) then
|
||
|
return tostring(game_statistics.get_statistic_count("level_changes"))
|
||
|
elseif(index==13) then
|
||
|
return tostring(game_statistics.get_statistic_count("enemies_surrendered"))
|
||
|
elseif(index==14) then
|
||
|
return tostring(game_statistics.get_statistic_count("field_dressings"))
|
||
|
elseif(index==15) then
|
||
|
return (ui_pda_encyclopedia_tab.get_articles_unlocked_count() .. "/" .. ui_pda_encyclopedia_tab.get_articles_count())
|
||
|
elseif(index==16) then
|
||
|
return (game_achievements.get_achievements_unlocked_count() .. "/" .. game_achievements.get_achievements_count())
|
||
|
elseif(index==17) then
|
||
|
return (game_statistics.get_actor_visited_levels_count() .. "/33")
|
||
|
elseif(index==18) then
|
||
|
return (db.actor:money() .. " RU")
|
||
|
end
|
||
|
return ""
|
||
|
end
|
||
|
|
||
|
----------------------------------------------------------------------------
|
||
|
-- Engine->lua function calls
|
||
|
----------------------------------------------------------------------------
|
||
|
local primary_objects_tbl = {
|
||
|
{target="mar_2c_01_anomaly_spot", hint="st_mar_2c_01_anomaly_spot_name"},
|
||
|
{target="mar_2c_02_anomaly_spot", hint="st_mar_2c_02_anomaly_spot_name"},
|
||
|
{target="ds_2c_01_anomaly_spot", hint="st_ds_2c_01_anomaly_spot_name"},
|
||
|
{target="ds_2c_02_anomaly_spot", hint="st_ds_2c_02_anomaly_spot_name"},
|
||
|
{target="ds_2c_03_anomaly_spot", hint="st_ds_2c_03_anomaly_spot_name"},
|
||
|
{target="ds_2c_04_anomaly_spot", hint="st_ds_2c_04_anomaly_spot_name"},
|
||
|
{target="trc_2c_01_rift_anom_spot", hint="st_trc_2c_01_rift_anom_spot_name"},
|
||
|
{target="trc_2c_02_chem_anom_spot", hint="st_trc_2c_02_chem_anom_spot_name"},
|
||
|
{target="trc_2c_03_desolation_anom_spot", hint="st_trc_2c_03_desolation_anom_spot_name"},
|
||
|
{target="esc_2c_01_high_hopes_anomaly_spot", hint="st_esc_2c_01_high_hopes_anomaly_spot_name"},
|
||
|
{target="gar_2c_01_nwi_anomaly_spot", hint="st_gar_2c_01_nwi_anomaly_spot_name"},
|
||
|
{target="gar_2c_02_toaster_anomaly_spot", hint="st_gar_2c_02_toaster_anomaly_spot_name"},
|
||
|
{target="agr_2c_01_hg_anomaly_spot", hint="st_agr_2c_01_hg_anomaly_spot_name"},
|
||
|
-- Undergound anomalies are commented out until we can have underground minimaps.
|
||
|
--{target="labx18_2c_01_deep_burn_anomaly_spot", hint="st_labx18_2c_01_deep_burn_anomaly_spot_name"},
|
||
|
--{target="labx18_2c_02_ff_anomaly_spot", hint="st_labx18_2c_02_ff_anomaly_spot_name"},
|
||
|
--{target="labx18_2c_03_elders_anomaly_spot", hint="st_labx18_2c_03_elders_anomaly_spot_name"},
|
||
|
--{target="labx18_2c_04_bioh_anomaly_spot", hint="st_labx18_2c_04_bioh_anomaly_spot_name"},
|
||
|
{target="bar_2c_01_grant_anomaly_spot", hint="st_bar_2c_01_grant_anomaly_spot_name"},
|
||
|
{target="ros_2c_01_tunnel_anomaly_spot", hint="st_ros_2c_01_tunnel_anomaly_spot_name"},
|
||
|
{target="ros_2c_02_crispy_train_anomaly_spot", hint="st_ros_2c_02_crispy_train_anomaly_spot_name"},
|
||
|
{target="ros_2c_03_yc_anomaly_spot", hint="st_ros_2c_03_yc_anomaly_spot_name"},
|
||
|
{target="mil_2c_01_hw_anomaly_spot", hint="st_mil_2c_01_hw_anomaly_spot_name"},
|
||
|
{target="yan_2c_01_cd_anomaly_spot", hint="st_yan_2c_01_cd_anomaly_spot_name"},
|
||
|
--{target="x16_lab_2c_01_fb_anomy_spot", hint="st_x16_lab_2c_01_fb_anomy_spot_name"},
|
||
|
{target="cit_2c_01_ch_anomaly_spot", hint="st_cit_2c_01_ch_anomaly_spot_name"},
|
||
|
{target="cit_2c_02_pg_anomaly_spot", hint="st_cit_2c_02_pg_anomaly_spot_name"},
|
||
|
{target="lim_2c_01_ls_anomaly_spot", hint="st_lim_2c_01_ls_anomaly_spot_name"},
|
||
|
{target="lim_2c_02_ib_anomaly_spot", hint="st_lim_2c_02_ib_anomaly_spot_name"},
|
||
|
{target="rad_2c_01_bl_anomaly_spot", hint="st_rad_2c_01_bl_anomaly_spot_name"},
|
||
|
{target="rad_2c_02_pp_anomaly_spot", hint="st_rad_2c_02_pp_anomaly_spot_name"},
|
||
|
--{target="bun_2c_01_f_anomaly_spot", hint="st_bun_2c_01_f_anomaly_spot_name"},
|
||
|
--{target="bun_2c_02_gp_anomaly_spot", hint="st_bun_2c_02_gp_anomaly_spot_name"},
|
||
|
{target="pri_2c_01_pp_anomaly_spot", hint="st_pri_2c_01_pp_anomaly_spot_name"},
|
||
|
{target="pri_2c_02_gt_anomaly_spot", hint="st_pri_2c_02_gt_anomaly_spot_name"},
|
||
|
{target="pri_2c_03_wr_anomaly_spot", hint="st_pri_2c_03_wr_anomaly_spot_name"},
|
||
|
{target="pri_2c_04_o_anomaly_spot", hint="st_pri_2c_04_o_anomaly_spot_name"},
|
||
|
{target="aes_2c_01_ce_anomaly_spot", hint="st_aes_2c_01_ce_anomaly_spot_name"},
|
||
|
{target="aes_2c_02_p_anomaly_spot", hint="st_aes_2c_02_p_anomaly_spot_name"},
|
||
|
{target="aes2_2c_01_bo_anomaly_spot", hint="st_aes2_2c_01_bo_anomaly_spot_name"},
|
||
|
{target="aes2_2c_02_at_anomaly_spot", hint="st_aes2_2c_02_at_anomaly_spot_name"},
|
||
|
--{target="sar_2c_01_r_anomaly_spot", hint="st_sar_2c_01_r_anomaly_spot_name"},
|
||
|
{target="gen_2c_01_ss_anomaly_spot", hint="st_gen_2c_01_ss_anomaly_spot_name"},
|
||
|
{target="mar_smart_terrain_11_3_anomaly_spot", hint="st_mar_smart_terrain_11_3_anomaly_spot_name"},
|
||
|
{target="mar_smart_terrain_10_10_anomaly_spot", hint="st_mar_smart_terrain_10_10_anomaly_spot_name"},
|
||
|
{target="mar_smart_terrain_base_anomaly_spot", hint="st_mar_smart_terrain_base_anomaly_spot_name"},
|
||
|
{target="mar_smart_terrain_8_8_anomaly_spot", hint="st_mar_smart_terrain_8_8_anomaly_spot_name"},
|
||
|
{target="mar_smart_terrain_12_2_anomaly_spot", hint="st_mar_smart_terrain_12_2_anomaly_spot_name"},
|
||
|
{target="mar_smart_terrain_3_7_anomaly_spot", hint="st_mar_smart_terrain_3_7_anomaly_spot_name"},
|
||
|
{target="mar_smart_terrain_3_3_anomaly_spot", hint="st_mar_smart_terrain_3_3_anomaly_spot_name"},
|
||
|
{target="esc_smart_terrain_1_11_anomaly_spot", hint="st_esc_smart_terrain_1_11_anomaly_spot_name"},
|
||
|
{target="esc_smart_terrain_8_9_anomaly_spot", hint="st_esc_smart_terrain_8_9_anomaly_spot_name"},
|
||
|
{target="esc_smart_terrain_5_4_anomaly_spot", hint="st_esc_smart_terrain_5_4_anomaly_spot_name"},
|
||
|
{target="gar_smart_terrain_3_7_anomaly_spot", hint="st_gar_smart_terrain_3_7_anomaly_spot_name"},
|
||
|
{target="gar_smart_terrain_3_7_anomaly_spot_2", hint="st_gar_smart_terrain_3_7_anomaly_spot_2_name"},
|
||
|
{target="gar_smart_terrain_2_4_anomaly_spot", hint="st_gar_smart_terrain_2_4_anomaly_spot_name"},
|
||
|
{target="gar_smart_terrain_6_7_anomaly_spot", hint="st_gar_smart_terrain_6_7_anomaly_spot_name"},
|
||
|
{target="gar_smart_terrain_5_6_anomaly_spot", hint="st_gar_smart_terrain_5_6_anomaly_spot_name"},
|
||
|
{target="gar_smart_terrain_1_7_anomaly_spot", hint="st_gar_smart_terrain_1_7_anomaly_spot_name"},
|
||
|
{target="agr_smart_terrain_1_3_anomaly_spot", hint="st_agr_smart_terrain_1_3_anomaly_spot_name"},
|
||
|
{target="agr_smart_terrain_4_4_near_3_anomaly_spot", hint="st_agr_smart_terrain_4_4_near_3_anomaly_spot_name"},
|
||
|
{target="agr_smart_terrain_5_7_anomaly_spot", hint="st_agr_smart_terrain_5_7_anomaly_spot_name"},
|
||
|
{target="agr_smart_terrain_5_2_anomaly_spot", hint="st_agr_smart_terrain_5_2_anomaly_spot_name"},
|
||
|
{target="agr_smart_terrain_1_2_anomaly_spot", hint="st_agr_smart_terrain_1_2_anomaly_spot_name"},
|
||
|
{target="val_smart_terrain_9_10_anomaly_spot", hint="st_val_smart_terrain_9_10_anomaly_spot_name"},
|
||
|
{target="val_smart_terrain_6_4_anomaly_spot", hint="st_val_smart_terrain_6_4_anomaly_spot_name"},
|
||
|
{target="val_smart_terrain_8_6_anomaly_spot", hint="st_val_smart_terrain_8_6_anomaly_spot_name"},
|
||
|
{target="val_smart_terrain_9_4_anomaly_spot", hint="st_val_smart_terrain_9_4_anomaly_spot_name"},
|
||
|
{target="val_smart_terrain_8_9_anomaly_spot", hint="st_val_smart_terrain_8_9_anomaly_spot_name"},
|
||
|
{target="mil_smart_terrain_4_7_anomaly_spot", hint="st_mil_smart_terrain_4_7_anomaly_spot_name"},
|
||
|
{target="mil_smart_terrain_2_1_anomaly_spot", hint="st_mil_smart_terrain_2_1_anomaly_spot_name"},
|
||
|
{target="mil_smart_terrain_2_6_anomaly_spot", hint="st_mil_smart_terrain_2_6_anomaly_spot_name"},
|
||
|
{target="mil_smart_terrain_7_4_anomaly_spot", hint="st_mil_smart_terrain_7_4_anomaly_spot_name"},
|
||
|
{target="mil_smart_terrain_8_3_anomaly_spot", hint="st_mil_smart_terrain_8_3_anomaly_spot_name"},
|
||
|
{target="yan_smart_terrain_2_5_anomaly_spot", hint="st_yan_smart_terrain_2_5_anomaly_spot_name"},
|
||
|
{target="yan_smart_terrain_zombi_spawn_anomaly_spot", hint="st_yan_smart_terrain_zombi_spawn_anomaly_spot_name"},
|
||
|
{target="yan_smart_terrain_5_3_anomaly_spot", hint="st_yan_smart_terrain_5_3_anomaly_spot_name"},
|
||
|
{target="yan_smart_terrain_4_2_anomaly_spot", hint="st_yan_smart_terrain_4_2_anomaly_spot_name"},
|
||
|
{target="red_smart_terrain_6_3_anomaly_spot", hint="st_red_smart_terrain_6_3_anomaly_spot_name"},
|
||
|
{target="red_smart_terrain_4_5_anomaly_spot", hint="st_red_smart_terrain_4_5_anomaly_spot_name"},
|
||
|
{target="red_smart_terrain_monsters_anomaly_spot", hint="st_red_smart_terrain_monsters_anomaly_spot_name"},
|
||
|
{target="red_smart_terrain_3_2_anomaly_spot", hint="st_red_smart_terrain_3_2_anomaly_spot_name"},
|
||
|
{target="red_smart_terrain_6_6_anomaly_spot", hint="st_red_smart_terrain_6_6_anomaly_spot_name"},
|
||
|
{target="red_smart_terrain_3_1_anomaly_spot", hint="st_red_smart_terrain_3_1_anomaly_spot_name"},
|
||
|
{target="gen_smart_terrain_urod_anomaly_spot", hint="st_gen_smart_terrain_urod_anomaly_spot_name"},
|
||
|
{target="trc_sim_13_anomal_zone_spot", hint="st_trc_sim_13_anomal_zone_spot_name"},
|
||
|
|
||
|
-- POLE
|
||
|
{target="pol_smart_terrain_1_2_anomaly_spot", hint="st_pol_smart_terrain_1_2_anomaly_spot_name"},
|
||
|
|
||
|
-- MLR
|
||
|
{target="dasc_treesucker_state_spot", hint="st_dasc_treesucker_state_name"},
|
||
|
{target="tc_smart_terrain_bandit_base_spot", hint="st_tc_bandit_base_name"},
|
||
|
{target="rad_smart_terrain_kpp_spot", hint="st_tc_kpp_name"},
|
||
|
{target="rad_smart_terrain_vert_spot", hint="st_tc_vert_name"},
|
||
|
{target="radar_smart_terrain_first_zastava_spot", hint="st_radar_first_zastava_name"},
|
||
|
{target="rad_smart_terrain_bunker_spot", hint="st_rad_bunker_name"},
|
||
|
{target="red_smart_terrain_dark_yar_spot", hint="st_red_dark_yar_name"},
|
||
|
{target="red_smart_terrain_central_mine_spot", hint="st_red_central_mine_name"},
|
||
|
{target="red_smart_terrain_crap_spot", hint="st_red_crap_name"},
|
||
|
{target="agr_smart_terrai_SRI_spot", hint="st_agr_SRI_name"},
|
||
|
{target="mar_smart_terrain_post_spot", hint="st_lim_post_vishka_name"},
|
||
|
{target="mar_smart_terrain_old_church_spot", hint="st_lim_old_church_name"},
|
||
|
{target="mar_smart_terrain_village_csky_spot", hint="st_lim_village_csky_name"},
|
||
|
{target="mar_smart_terrain_water_pump_station_spot", hint="st_lim_water_pump_station_name"},
|
||
|
{target="mar_smart_terrain_mechanic_yard_spot", hint="st_lim_mechanic_yard_name"},
|
||
|
{target="red_smart_terrain_bridge_spot", hint="st_lim_bridge_name"},
|
||
|
{target="red_smart_terrain_house_lesnik_spot", hint="st_lim_house_lesnik_name"},
|
||
|
{target="lim_smart_first_zastava_spot", hint="st_lim_zastava_name"},
|
||
|
{target="lim_smart_bubbles_spot", hint="st_lim_bubbles_name"},
|
||
|
{target="lim_smart_nonbuild_spot", hint="st_lim_nonbuild_name"},
|
||
|
{target="lim_smart_dyga_spot", hint="st_lim_dyga_name"},
|
||
|
{target="ds_smart_administration_spot", hint="st_ds_administration_name"},
|
||
|
{target="ds_smart_market_spot", hint="st_ds_market_name"},
|
||
|
{target="ds_smart_house_of_culture_spot", hint="st_ds_HoC_name"},
|
||
|
{target="esc_smart_terrain_novice_village_spot", hint="st_novice_village_name"},
|
||
|
{target="esc_smart_terrain_south_blokpost_spot", hint="st_south_blokpost_name"},
|
||
|
{target="esc_smart_terrain_ATP_spot", hint="st_ATP_name"},
|
||
|
{target="esc_smart_terrain_elevator_spot", hint="st_elevator_name"},
|
||
|
{target="esc_smart_terrain_tunnel_electr_spot", hint="st_tunnel_electr_name"},
|
||
|
{target="esc_smart_terrain_neut_base_spot", hint="st_neut_base_name"},
|
||
|
{target="esc_smart_terrain_north_blockpost_spot", hint="st_north_blockpost_name"},
|
||
|
{target="dar_smart_terrain_farm_spot", hint="st_dar_farm_name"},
|
||
|
{target="dar_smart_terrain_complex_proizv_spot", hint="st_dar_complex_name"},
|
||
|
{target="mil_smart_terrain_bs_village_spot", hint="st_bs_village_name"},
|
||
|
{target="mil_smart_terrain_base_freedom_spot", hint="st_base_freedom_name"},
|
||
|
{target="mil_smart_terrain_border_spot", hint="st_border_name"},
|
||
|
{target="pri_smart_terrain_mon_base_spot", hint="st_mon_base_name"},
|
||
|
{target="pri_smart_terrain_hotel_poless_spot", hint="st_hotel_poless_name"},
|
||
|
{target="pri_smart_terrain_big_bus_station_spot", hint="st_big_bus_station_name"},
|
||
|
{target="gar_smart_terrain_6_3_baraholka_spot", hint="st_gar_baraholka_name"},
|
||
|
{target="gar_smart_terrain_dolg_outpost_spot", hint="st_gar_outpost_name"},
|
||
|
{target="gar_smart_terrain_3_5_angar_spot", hint="st_gar_angar_name"},
|
||
|
{target="bar_smart_terrain_bar100rent_spot", hint="st_bar100rent_name"},
|
||
|
{target="yan_smart_terrain_6_4_bunker_spot", hint="st_yanbunker_name"},
|
||
|
{target="yan_smart_terrain_proizvcomplex_spot", hint="st_yancomplex_name"},
|
||
|
|
||
|
{target="zat_b55_spot", hint="st_zat_b55_name_land"},
|
||
|
{target="zat_b100_spot", hint="st_zat_b100_name_land"},
|
||
|
{target="zat_b104_spot", hint="st_zat_b104_name_land"},
|
||
|
{target="zat_b38_spot", hint="st_zat_b38_name_land"},
|
||
|
{target="zat_b40_spot", hint="st_zat_b40_name_land"},
|
||
|
{target="zat_b56_spot", hint="st_zat_b56_name_land"},
|
||
|
{target="zat_b5_spot", hint="st_zat_b5_name_land"},
|
||
|
{target="zat_a2_spot", hint="st_zat_a2_name_land"},
|
||
|
{target="zat_b20_spot", hint="st_zat_b20_name_land"},
|
||
|
{target="zat_b20_spot", hint="st_zat_fire_name_land"},
|
||
|
{target="zat_b53_spot", hint="st_zat_b53_name_land"},
|
||
|
{target="zat_b101_spot", hint="st_zat_b101_name_land"},
|
||
|
{target="zat_b101_spot", hint="st_zat_waste_name_land"},
|
||
|
{target="zat_b106_spot", hint="st_zat_b106_name_land"},
|
||
|
{target="zat_b7_spot", hint="st_zat_b7_name_land"},
|
||
|
{target="zat_b14_spot", hint="st_zat_b14_name_land"},
|
||
|
{target="zat_b14_spot", hint="st_zat_tide_name_land"},
|
||
|
{target="zat_b52_spot", hint="st_zat_b52_name_land"},
|
||
|
{target="zat_b39_spot", hint="st_zat_b39_name_land"},
|
||
|
{target="zat_b33_spot", hint="st_zat_b33_name_land"},
|
||
|
{target="zat_b18_spot", hint="st_zat_b18_name_land"},
|
||
|
{target="zat_b54_spot", hint="st_zat_b54_name_land"},
|
||
|
{target="zat_b12_spot", hint="st_zat_b12_name_land"},
|
||
|
{target="zat_b28_spot", hint="st_zat_b28_name_land"},
|
||
|
{target="zat_b103_spot", hint="st_zat_b103_name_land"},
|
||
|
{target="jup_b1_spot", hint="st_jup_b1_name_land"},
|
||
|
{target="jup_b46_spot", hint="st_jup_b46_name_land"},
|
||
|
{target="jup_b202_spot", hint="st_jup_b202_name_land"},
|
||
|
{target="jup_b211_spot", hint="st_jup_b211_name_land"},
|
||
|
{target="jup_b200_spot", hint="st_jup_b200_name_land"},
|
||
|
{target="jup_b19_spot", hint="st_jup_b19_name_land"},
|
||
|
{target="jup_a6_spot", hint="st_jup_a6_name_land"},
|
||
|
{target="jup_b25_spot", hint="st_jup_b25_name_land"},
|
||
|
{target="jup_b25_spot", hint="st_jup_earth_name_land"},
|
||
|
{target="jup_b6_spot", hint="st_jup_b6_name_land"},
|
||
|
{target="jup_b205_spot", hint="st_jup_b205_name_land"},
|
||
|
{target="jup_b206_spot", hint="st_jup_b206_name_land"},
|
||
|
{target="jup_b206_spot", hint="st_jup_grove_name_land"},
|
||
|
{target="jup_b32_spot", hint="st_jup_b32_name_land"},
|
||
|
{target="jup_a10_spot", hint="st_jup_a10_name_land"},
|
||
|
{target="jup_b209_spot", hint="st_jup_b209_name_land"},
|
||
|
{target="jup_b208_spot", hint="st_jup_b208_name_land"},
|
||
|
{target="jup_a12_spot", hint="st_jup_a12_name_land"},
|
||
|
{target="jup_b212_spot", hint="st_jup_b212_name_land"},
|
||
|
{target="jup_b9_spot", hint="st_jup_b9_name_land"},
|
||
|
{target="jup_b201_spot", hint="st_jup_b201_name_land"},
|
||
|
{target="jup_a9_spot", hint="st_jup_a9_name_land"},
|
||
|
|
||
|
{target="pri_a28_spot", hint="st_pri_a28_name_land"},
|
||
|
{target="pri_b36_spot", hint="st_pri_b36_name_land"},
|
||
|
{target="pri_b303_spot", hint="st_pri_b303_name_land"},
|
||
|
{target="pri_b301_spot", hint="st_pri_b301_name_land"},
|
||
|
{target="pri_a17_spot", hint="st_pri_a17_name_land"},
|
||
|
{target="pri_b306_spot", hint="st_pri_b306_name_land"},
|
||
|
{target="pri_b306_spot", hint="st_pri_plug_name_land"},
|
||
|
{target="pri_a16_spot", hint="st_pri_a16_name_land"},
|
||
|
{target="pri_a25_spot", hint="st_pri_a25_name_land"},
|
||
|
{target="pri_b35_spot", hint="st_pri_b35_name_land"},
|
||
|
{target="pri_a21_spot", hint="st_pri_a21_name_land"},
|
||
|
{target="pri_b304_spot", hint="st_pri_b304_name_land"},
|
||
|
{target="pri_b304_spot", hint="st_pri_bath_name_land"},
|
||
|
{target="pri_a18_spot", hint="st_pri_a18_name_land"},
|
||
|
{target="pri_anomal_vulkan_spot", hint="st_pri_b307_name_land"},
|
||
|
{target="pri_anomal_loza_spot", hint="st_pri_b302_name_land"}
|
||
|
}
|
||
|
|
||
|
function fill_primary_objects()
|
||
|
for k,v in pairs(primary_objects_tbl) do
|
||
|
local obj_id = get_story_object_id(v.target)
|
||
|
--/ SGM in
|
||
|
if obj_id and (level.map_has_object_spot(obj_id,"primary_object") == 0) and has_alife_info(v.target) then
|
||
|
level.map_add_object_spot(obj_id, "primary_object", v.hint)
|
||
|
end
|
||
|
--/ SGM out
|
||
|
end
|
||
|
|
||
|
local sleep_zones_tbl =
|
||
|
{ "mar_a3_sr_sleep_id",
|
||
|
"agr_sr_sleep_wagon_id",
|
||
|
"agr_sr_sleep_tunnel_id",
|
||
|
"agr_army_sleep_id",
|
||
|
"esc_basement_sleep_area_id",
|
||
|
"esc_secret_sleep_id",
|
||
|
"ds_farmhouse_sleep_id",
|
||
|
"val_abandoned_house_sleep_id",
|
||
|
"val_vagon_sleep_id",
|
||
|
"gar_dolg_sleep_id",
|
||
|
"gar_angar_sleep_id",
|
||
|
"bar_actor_sleep_zone_id",
|
||
|
"yan_bunker_sleep_restrictor_id",
|
||
|
"ros_vagon_sleep_id",
|
||
|
"mil_freedom_sleep_id",
|
||
|
"mil_smart_terran_2_4_sleep_id",
|
||
|
"rad_sleep_room_id",
|
||
|
"cit_merc_sleep_id",
|
||
|
"pri_monolith_sleep_id",
|
||
|
"pri_room27_sleep_id",
|
||
|
"zat_a2_sr_sleep_id",
|
||
|
"jup_a6_sr_sleep_id",
|
||
|
"pri_a16_sr_sleep_id",
|
||
|
"pol_secret_sleep_id"
|
||
|
}
|
||
|
for i=1,#sleep_zones_tbl do
|
||
|
local obj_id = get_story_object_id(sleep_zones_tbl[i])
|
||
|
if (level.map_has_object_spot(obj_id, "ui_pda2_actor_sleep_location")==0) then
|
||
|
level.map_add_object_spot_ser(obj_id, "ui_pda2_actor_sleep_location", "st_ui_pda_sleep_place")
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
function add_quick_slot_items_on_game_start()
|
||
|
for i=0,3 do
|
||
|
exec_console_cmd( strformat("slot_%s %s",i, ini_sys:r_string_ex("actor","quick_item_"..tostring(i+1)) or "") )
|
||
|
end
|
||
|
end
|
||
|
|
||
|
----------------------------------------------------------------------------
|
||
|
-- Scripted Callback Register
|
||
|
----------------------------------------------------------------------------
|
||
|
local function npc_on_net_spawn(npc,se_obj)
|
||
|
se_save_var(se_obj.id,se_obj:name(),"last_seen_level",level.name())
|
||
|
se_save_var(se_obj.id,se_obj:name(),"last_seen_time",game.get_game_time())
|
||
|
end
|
||
|
|
||
|
function on_game_start()
|
||
|
local function on_game_load()
|
||
|
if (not alife_storage_manager.get_state().enable_warfare_mode) then
|
||
|
CreateTimeEvent(0, "ScanForSpots", 2, discover_spots)
|
||
|
end
|
||
|
end
|
||
|
|
||
|
RegisterScriptCallback("npc_on_net_spawn",npc_on_net_spawn)
|
||
|
RegisterScriptCallback("on_game_load",on_game_load)
|
||
|
end
|
||
|
|
||
|
-- mlr
|
||
|
----------------------------------------------------------------------------
|
||
|
-- Character Ranking
|
||
|
----------------------------------------------------------------------------
|
||
|
function get_coc_ranking_list()
|
||
|
for i=1,10 do
|
||
|
printf("- get_coc_ranking_list | id [%s] = %s", i , coc_ranking_list[i])
|
||
|
end
|
||
|
return coc_ranking_list
|
||
|
end
|
||
|
|
||
|
-- called from info_portions.script
|
||
|
function calculate_rankings()
|
||
|
local t = {}
|
||
|
local sim = alife()
|
||
|
-- add actor to list
|
||
|
t[0] = sim:actor():rank()
|
||
|
|
||
|
-- check all stalker server objects
|
||
|
for i=1,65534 do
|
||
|
local se_obj = sim:object(i)
|
||
|
if (se_obj and IsStalker(nil,se_obj:clsid()) and se_obj:alive() and se_obj:community() ~= "zombied" and se_obj:community() ~= "trader") then
|
||
|
-- Check if object has a story id, if it does they are probably unique
|
||
|
local sid = story_objects.story_id_by_object_id[se_obj.id]
|
||
|
if not (sid) then
|
||
|
t[se_obj.id] = se_obj:rank()
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
|
||
|
coc_ranking_list = iempty_table(coc_ranking_list)
|
||
|
local size_t = 0
|
||
|
-- sort by highest rank first
|
||
|
for id,rank in spairs(t, function(t,a,b) return t[a] > t[b] end) do
|
||
|
size_t = size_t + 1
|
||
|
coc_ranking_list[size_t] = id
|
||
|
if (id == AC_ID) then
|
||
|
actor_rank_place = size_t
|
||
|
end
|
||
|
end
|
||
|
|
||
|
-- force actor into last visible slot + 1 on ranking list
|
||
|
coc_ranking_list[coc_ranking_array_size+1] = 0
|
||
|
end
|
||
|
|
||
|
-- called from engine! It's how many character rankings to display! u8 (max 255)
|
||
|
function get_rankings_array_size()
|
||
|
return coc_ranking_array_size
|
||
|
end
|
||
|
|
||
|
-- called from engine! must return bool!
|
||
|
function coc_rankings_can_show(index)
|
||
|
if (has_alife_info("ui_pda_hide")) then
|
||
|
return false
|
||
|
end
|
||
|
local se_obj = coc_ranking_list[index] ~= nil and alife_object(coc_ranking_list[index])
|
||
|
if (se_obj) then
|
||
|
return true
|
||
|
end
|
||
|
return false
|
||
|
end
|
||
|
|
||
|
-- called from engine! must return string!
|
||
|
function coc_rankings_set_name(index)
|
||
|
local se_obj = coc_ranking_list[index] ~= nil and alife_object(coc_ranking_list[index])
|
||
|
if (se_obj) then
|
||
|
return strformat("%s. %s",se_obj.id == AC_ID and actor_rank_place or index,se_obj:character_name())
|
||
|
end
|
||
|
return ""
|
||
|
end
|
||
|
|
||
|
-- called from engine! must return string!
|
||
|
function coc_rankings_set_hint(index)
|
||
|
local se_obj = coc_ranking_list[index] ~= nil and alife_object(coc_ranking_list[index])
|
||
|
if (se_obj) then
|
||
|
if (se_obj.id == AC_ID) then
|
||
|
--TODO: Maybe some stats for player, like rank points per minute; if such a thing is possible.
|
||
|
return ""
|
||
|
else
|
||
|
local return_str = ""
|
||
|
|
||
|
-- DEBUG REMOVE ME LATER
|
||
|
if(DEV_DEBUG and ui_options.get("other/debug_hud") == true) then
|
||
|
return_str = se_obj:profile_name() .. [[ \n]] .. se_obj:character_icon() .. [[ \n]]
|
||
|
end
|
||
|
|
||
|
-- stalker stats
|
||
|
local m_data = alife_storage_manager.get_se_obj_state(se_obj)
|
||
|
if (m_data) then
|
||
|
local last_seen_level = m_data.last_seen_level
|
||
|
local last_seen_time = m_data.last_seen_time and m_data.last_seen_time.dateToString and m_data.last_seen_time:dateToString(game.CTime.DateToDay)
|
||
|
|
||
|
if (last_seen_level and last_seen_time) then
|
||
|
return_str = return_str .. game.translate_string("st_last_seen") .. ": " .. game.translate_string(last_seen_level) .. " (" .. last_seen_time .. ")"
|
||
|
|
||
|
if (m_data["killed_stalkers"]) then
|
||
|
return_str = return_str .. [[ \n]] .. game.translate_string("st_stalkers_killed") .. ": " .. tostring(m_data["killed_stalkers"])
|
||
|
end
|
||
|
if (m_data["killed_monsters"]) then
|
||
|
return_str = return_str .. [[ \n]] .. game.translate_string("st_mutants_killed") .. ": " .. tostring(m_data["killed_monsters"])
|
||
|
end
|
||
|
if (m_data["artefacts_found"]) then
|
||
|
return_str = return_str .. [[ \n]] .. game.translate_string("st_artefacts_found") .. ": " .. tostring(m_data["artefacts_found"])
|
||
|
end
|
||
|
if (m_data["wounded_helped"]) then
|
||
|
return_str = return_str .. [[ \n]] .. game.translate_string("st_wounded_helped") .. ": " .. tostring(m_data["wounded_helped"])
|
||
|
end
|
||
|
if (m_data["corpse_looted"]) then
|
||
|
return_str = return_str .. [[ \n]] .. game.translate_string("st_corpse_looted") .. ": " .. tostring(m_data["corpse_looted"])
|
||
|
end
|
||
|
if (m_data["items_sold"]) then
|
||
|
return_str = return_str .. [[ \n]] .. game.translate_string("st_items_sold") .. ": " .. tostring(m_data["items_sold"])
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
return return_str
|
||
|
end
|
||
|
end
|
||
|
return ""
|
||
|
end
|
||
|
|
||
|
-- called from engine! must return string!
|
||
|
function coc_rankings_set_description(index)
|
||
|
local se_obj = coc_ranking_list[index] ~= nil and alife_object(coc_ranking_list[index])
|
||
|
if (se_obj) then
|
||
|
local faction_color = "%c[255,255,255,1]"
|
||
|
if (game_relations.is_factions_enemies(db.actor:character_community(),se_obj:community())) then
|
||
|
faction_color = "%c[255,255,1,1]"
|
||
|
elseif (game_relations.is_factions_friends(db.actor:character_community(),se_obj:community())) then
|
||
|
faction_color = "%c[255,1,255,1]"
|
||
|
end
|
||
|
|
||
|
local reputation = se_obj:reputation()
|
||
|
|
||
|
local repu_color = "%c[255,255,255,1]"
|
||
|
if (reputation <= -500) then
|
||
|
repu_color = "%c[255,255,1,1]"
|
||
|
elseif (reputation >= 500) then
|
||
|
repu_color = "%c[255,1,255,1]"
|
||
|
end
|
||
|
|
||
|
local faction_str = game.translate_string("ui_st_community") .. ": " .. faction_color .. game.translate_string(se_obj:community()) .. "%c[default]"
|
||
|
local rank_str = game.translate_string("ui_st_rank") .. ": " .. "%c[255,215,215,215]" .. game.translate_string("st_rank_"..ranks.get_se_obj_rank_name(se_obj)) .. " %c[255,110,110,255]" .. se_obj:rank() .. "%c[default]"
|
||
|
local repu_str = game.translate_string("ui_st_reputation") .. ": " .. repu_color .. game.translate_string(utils_obj.get_reputation_name(reputation)) .. "%c[default]"
|
||
|
|
||
|
return strformat([[ %s \n %s \n %s]],faction_str,rank_str,repu_str)
|
||
|
end
|
||
|
return ""
|
||
|
end
|
||
|
|
||
|
-- called from engine! must return string!
|
||
|
function coc_rankings_set_icon(index)
|
||
|
local se_obj = coc_ranking_list[index] ~= nil and alife_object(coc_ranking_list[index])
|
||
|
if (se_obj) then
|
||
|
local icon_name
|
||
|
if (se_obj.id == AC_ID) then
|
||
|
if (ui_options.get("gameplay/general/outfit_portrait") == true) then
|
||
|
local outfit = db.actor:item_in_slot(7)
|
||
|
if (outfit) then
|
||
|
local icon = ini_sys:r_string_ex(outfit:section(),"character_portrait")
|
||
|
if (icon and icon ~= "") then
|
||
|
return icon
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
icon_name = db.actor:character_icon()
|
||
|
else
|
||
|
local npc = db.storage[se_obj.id] and db.storage[se_obj.id].object
|
||
|
if (npc) then
|
||
|
icon_name = npc:character_icon()
|
||
|
else
|
||
|
icon_name = se_obj:character_icon()
|
||
|
end
|
||
|
end
|
||
|
return icon_name and icon_name ~= "" and icon_name or "ui\\ui_noise"
|
||
|
end
|
||
|
return ""
|
||
|
end
|
||
|
|
||
|
function coc_rankings_show_border(index)
|
||
|
local se_obj = coc_ranking_list[index] ~= nil and alife_object(coc_ranking_list[index])
|
||
|
return se_obj and se_obj.id == AC_ID or false
|
||
|
end
|
||
|
|
||
|
local distance_tbl = {
|
||
|
["l12_stancia"] = 45,
|
||
|
["l12_stancia_2"] = 45,
|
||
|
["l11_hospital"] = 30,
|
||
|
["l10_limansk"] = 35,
|
||
|
["l06_rostok"] = 30,
|
||
|
["k02_trucks_cemetery"] = 45,
|
||
|
}
|
||
|
function discover_spots()
|
||
|
ResetTimeEvent(0,"ScanForSpots",3)
|
||
|
|
||
|
local actor = db.actor
|
||
|
for k,v in pairs(primary_objects_tbl) do
|
||
|
if actor:dont_has_info(v.target) then
|
||
|
local obj_id = get_story_object_id(v.target)
|
||
|
if obj_id and db.storage[obj_id] and db.storage[obj_id].object then
|
||
|
local n_dist = distance_tbl[level.name()] or 40
|
||
|
if (db.storage[obj_id].object:position():distance_to(actor:position()) <= n_dist) then
|
||
|
give_info(v.target)
|
||
|
game_statistics.increment_rank(10)
|
||
|
actor_menu.set_fade_msg( game.translate_string(v.hint), 5, nil, "device\\pda\\spot_discovered" )
|
||
|
--news_manager.send_tip(actor,game.translate_string(v.hint),0,"tourist",5000,nil,game.translate_string("st_revealled_area"))
|
||
|
fill_primary_objects()
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|