-- StatsDisplay - Nitpicker's Modpack -- Last modified: 2021.10.21 -- https://github.com/Ishmaeel/NitpickerModpack -- LuaFormatter off function override_stats_table() utils_ui.stats_table["weapon"] = { ["accuracy"] = { index= 1, typ= "float", name= "ui_inv_accuracy", icon_p= "ui_wp_prop_tochnost", icon_n= "", track= false, magnitude= 1, unit= "st_perc", proper_unit="InverseDispersion", compare= false, sign= false, show_always= true, value_functor= {"ish_item_stats","scale_100","utils_ui","prop_accuracry"} }, ["handling"] = { index= 2, typ= "float", name= "ui_inv_handling", icon_p= "ui_wp_prop_ergonomics", icon_n= "", track= false, magnitude= 1, unit= "st_perc", proper_unit="CameraInertia", compare= false, sign= false, show_always= true, value_functor= {"ish_item_stats","scale_100","utils_ui","prop_handling"} }, ["damage"] = { index= 3, typ= "float", name= "ui_inv_damage", icon_p= "ui_wp_prop_damage", icon_n= "", track= false, magnitude= 1, unit= "st_stat_dmg", proper_unit="Ouchies", compare= false, sign= false, show_always= true, value_functor= {"ish_item_stats","scale_100_for_pellets","utils_ui","prop_damage"} }, ["fire_rate"] = { index= 4, typ= "float", name= "ui_inv_rate_of_fire", icon_p= "ui_wp_prop_skorostrelnost", icon_n= "", track= false, magnitude= 1000, unit= "st_stat_rpm", proper_unit="PewsPerMinute", compare= false, sign= false, show_always= true, value_functor= {"utils_ui","prop_rpm"} }, ["ammo_mag_size"] = { index= 5, typ= "float", name= "ui_ammo_count", icon_p= "ui_wp_propery_07", icon_n= "", track= false, magnitude= 1, unit= "", proper_unit="DoYouFeelLuckyPunk", compare= false, sign= false ,show_always= true }, } utils_ui.stats_table["outfit"] = { ["fire_wound_protection"] = { index= 10, typ= "float", name= "ui_inv_outfit_fire_wound_protection", icon_p= "ui_am_propery_01", icon_n= "", track= false, magnitude= (100/SYS_GetParam(2,"actor_condition","max_fire_wound_protection")), unit= "st_perc", condition= true, compare= false, sign= true, show_always= true , value_functor= {"utils_item","get_outfit_protection", "FireWound"}}, ["burn_protection"] = { index= 20, typ= "float", name= "ui_inv_outfit_burn_protection", icon_p= "ui_am_prop_thermo", icon_n= "", track= false, magnitude= (100/SYS_GetParam(2,"actor_condition","fire_zone_max_power")), unit= "st_perc", condition= true, compare= false, sign= true, show_always= true , value_functor= {"utils_item","get_outfit_protection", "Burn"} }, ["shock_protection"] = { index= 30, typ= "float", name= "ui_inv_outfit_shock_protection", icon_p= "ui_am_prop_electro", icon_n= "", track= false, magnitude= (100/SYS_GetParam(2,"actor_condition","electra_zone_max_power")), unit= "st_perc", condition= true, compare= false, sign= true, show_always= true , value_functor= {"utils_item","get_outfit_protection", "Shock"}}, ["chemical_burn_protection"] = { index= 40, typ= "float", name= "ui_inv_outfit_chemical_burn_protection", icon_p= "ui_am_prop_chem", icon_n= "", track= false, magnitude= (100/SYS_GetParam(2,"actor_condition","acid_zone_max_power")), unit= "st_perc", condition= true, compare= false, sign= true, show_always= true , value_functor= {"utils_item","get_outfit_protection", "ChemicalBurn"}}, ["radiation_protection"] = { index= 50, typ= "float", name= "ui_inv_outfit_radiation_protection", icon_p= "ui_am_propery_09", icon_n= "", track= false, magnitude= (100/SYS_GetParam(2,"actor_condition","radio_zone_max_power")), unit= "st_perc", condition= true, compare= false, sign= true, show_always= true , value_functor= {"utils_item","get_outfit_protection", "Radiation"}}, ["telepatic_protection"] = { index= 60, typ= "float", name= "ui_inv_outfit_telepatic_protection", icon_p= "ui_am_propery_11", icon_n= "", track= false, magnitude= (100/SYS_GetParam(2,"actor_condition","psi_zone_max_power")), unit= "st_perc", condition= true, compare= false, sign= true, show_always= true , value_functor= {"utils_item","get_outfit_protection", "Telepatic"}}, ["wound_protection"] = { index= 70, typ= "float", name= "ui_inv_outfit_wound_protection", icon_p= "ui_am_prop_wound", icon_n= "", track= false, magnitude= (100/SYS_GetParam(2,"actor_condition","max_wound_protection")), unit= "st_perc", condition= true, compare= false, sign= true, show_always= true , value_functor= {"utils_item","get_outfit_protection", "Wound"}}, ["strike_protection"] = { index= 80, typ= "float", name= "ui_inv_outfit_strike_protection", icon_p= "ui_am_prop_strike", icon_n= "", track= false, magnitude= 100, unit= "st_perc", condition= true, compare= false, sign= true, show_always= true , value_functor= {"utils_item","get_outfit_protection", "Strike"}}, ["explosion_protection"] = { index= 90, typ= "float", name= "ui_inv_outfit_explosion_protection", icon_p= "ui_am_prop_explo", icon_n= "", track= false, magnitude= 100, unit= "st_perc", condition= true, compare= false, sign= true, show_always= true , value_functor= {"utils_item","get_outfit_protection", "Explosion"}}, ["artefact_count"] = { index= 100, typ= "float", name= "ui_inv_outfit_artefact_count", icon_p= "ui_am_prop_artefact",icon_n= "", track= false, magnitude= 1, unit= "", compare= false, sign= false,show_always= true , value_functor= {"utils_item","get_outfit_belt_size"}}, ["additional_inventory_weight"]= { index= 110, typ= "float", name= "ui_inv_outfit_additional_weight", icon_p= "ui_am_propery_08", icon_n= "ui_am_prop_carry_weight_negative", track= false, magnitude= 1, unit= "st_kg", compare= false, sign= true, show_always= true , value_functor= {"utils_item","get_outfit_property", "additional_inventory_weight"}}, } utils_ui.stats_table["backpack"] = { ["additional_inventory_weight"]= { index= 1, typ= "float", name= "ui_inv_outfit_additional_weight", icon_p= "ui_am_propery_08", icon_n= "ui_am_prop_carry_weight_negative", track= false, magnitude= 1, unit= "st_kg", compare= false, sign= true, show_always= true}, } utils_ui.stats_table["artefact"] = { ["condition"] = { index= 1, typ= "float", name= "ui_inv_af_condition", icon_p= "ui_am_condition", icon_n= "", track= false, magnitude= 100, unit= "st_perc", compare= false, sign= true, show_always= true, value_functor= {"utils_ui","prop_condition"} }, ["health_restore_speed"] = { index= 2, typ= "float", name= "ui_inv_health", icon_p= "ui_am_propery_05", icon_n= "ui_am_prop_health_negative", track= false, magnitude= 6600, unit= "", condition= true, compare= false, sign= true, show_always= false }, ["radiation_restore_speed"] = { index= 3, typ= "float", name= "ui_inv_radiation", icon_p= "ui_am_propery_09", icon_n= "ui_am_prop_radio_restore", track= false, magnitude= 47000, unit= "st_msv_sec", condition= true, compare= false, sign= true, show_always= false, sign_inverse= true }, ["satiety_restore_speed"] = { index= 4, typ= "float", name= "ui_inv_satiety", icon_p= "ui_am_prop_satiety_restore_speed", icon_n= "ui_am_prop_satiety", track= false, magnitude= 100, unit= "", condition= true, compare= false, sign= true, show_always= false }, ["power_restore_speed"] = { index= 5, typ= "float", name= "ui_inv_power", icon_p= "ui_am_propery_07", icon_n= "ui_am_prop_power_restore", track= false, magnitude= 30000, unit= "st_perc", condition= true, compare= false, sign= true, show_always= false }, ["bleeding_restore_speed"] = { index= 6, typ= "float", name= "ui_inv_bleeding", icon_p= "ui_am_prop_restore_bleeding", icon_n= "ui_am_prop_bleeding_restore", track= false, magnitude= 15000, unit= "st_ml_min", condition= true, compare= false, sign= true, show_always= false }, ["burn_immunity"] = { index= 7, typ= "float", name= "ui_inv_outfit_burn_protection", icon_p= "ui_am_prop_thermo", icon_n= "ui_am_prop_burn_immunity", track= false, magnitude= 0.75 * get_game_diff_hit_type("burn_immunity"), unit= "st_perc", condition= true, compare= false, sign= true, show_always= false ,section= "hit_absorbation_sect" }, ["shock_immunity"] = { index= 8, typ= "float", name= "ui_inv_outfit_shock_protection", icon_p= "ui_am_prop_electro", icon_n= "ui_am_prop_shock_immunity", track= false, magnitude= get_game_diff_hit_type("shock_immunity"), unit= "st_perc", condition= true, compare= false, sign= true, show_always= false ,section= "hit_absorbation_sect" }, ["radiation_immunity"] = { index= 9, typ= "float", name= "ui_inv_outfit_radiation_protection", icon_p= "ui_am_propery_09", icon_n= "ui_am_prop_radiation_immunity", track= false, magnitude= get_game_diff_hit_type("radiation_immunity"), unit= "st_perc", condition= true, compare= false, sign= true, show_always= false ,section= "hit_absorbation_sect" }, ["telepatic_immunity"] = { index= 10, typ= "float", name= "ui_inv_outfit_telepatic_protection", icon_p= "ui_am_propery_11", icon_n= "ui_am_prop_telepat_immunity", track= false, magnitude= get_game_diff_hit_type("telepatic_immunity"), unit= "st_perc", condition= true, compare= false, sign= true, show_always= false ,section= "hit_absorbation_sect" }, ["chemical_burn_immunity"] = { index= 11, typ= "float", name= "ui_inv_outfit_chemical_burn_protection", icon_p= "ui_am_prop_chem", icon_n= "ui_am_prop_chemburn_immunity", track= false, magnitude= get_game_diff_hit_type("chemical_burn_immunity"), unit= "st_perc", condition= true, compare= false, sign= true, show_always= false ,section= "hit_absorbation_sect" }, ["wound_immunity"] = { index= 12, typ= "float", name= "ui_inv_outfit_wound_protection", icon_p= "ui_am_prop_wound", icon_n= "ui_am_prop_wound_minus", track= false, magnitude= 0.75 * get_game_diff_hit_type("wound_immunity"), unit= "st_perc", condition= true, compare= false, sign= true, show_always= false ,section= "hit_absorbation_sect" }, ["fire_wound_immunity"] = { index= 13, typ= "float", name= "ui_inv_outfit_fire_wound_protection", icon_p= "ui_am_propery_01", icon_n= "ui_am_prop_fire_wound_negative", track= false, magnitude= 0.75 * get_game_diff_hit_type("fire_wound_immunity"), unit= "st_perc", condition= true, compare= false, sign= true, show_always= false ,section= "hit_absorbation_sect" }, ["explosion_immunity"] = { index= 14, typ= "float", name= "ui_inv_outfit_explosion_protection", icon_p= "ui_am_prop_explo", icon_n= "ui_am_prop_explo_minus", track= false, magnitude= get_game_diff_hit_type("explosion_immunity"), unit= "st_perc", condition= true, compare= false, sign= true, show_always= false ,section= "hit_absorbation_sect" }, ["strike_immunity"] = { index= 15, typ= "float", name= "ui_inv_outfit_strike_protection", icon_p= "ui_am_prop_strike", icon_n= "ui_am_prop_strike_minus", track= false, magnitude= get_game_diff_hit_type("strike_immunity"), unit= "st_perc", condition= true, compare= false, sign= true, show_always= false ,section= "hit_absorbation_sect" }, ["additional_inventory_weight"]= { index= 16, typ= "float", name= "ui_inv_outfit_additional_weight", icon_p= "ui_am_propery_08", icon_n= "ui_am_prop_carry_weight_negative", track= false, magnitude= 1000, unit= "st_g", compare= false, sign= true, show_always= false }, } utils_ui.stats_table["booster"] = { ["boost_time"] = { index= 1, typ= "float", name= "ui_inv_effect_time", icon_p= "ui_am_prop_time_period", icon_n= "", track= false, magnitude= 1, unit= "ui_inv_seconds", compare= false, sign= true, show_always= false }, ["boost_health_restore"] = { index= 2, typ= "float", name= "ui_inv_health", icon_p= "ui_am_propery_05", icon_n= "", track= false, magnitude= 1000, unit= "st_perc", compare= false, sign= true, show_always= false }, ["boost_radiation_restore"] = { index= 3, typ= "float", name= "ui_inv_radiation", icon_p= "ui_am_propery_09", icon_n= "", track= false, magnitude= 30000, unit= "st_msv_sec", compare= false, sign= true, show_always= false, sign_inverse_txt= true }, ["eat_satiety"] = { index= 4, typ= "float", name= "ui_inv_satiety", icon_p= "ui_am_prop_satiety_restore_speed", icon_n= "ui_am_prop_satiety", track= false, magnitude= 1000, unit= "st_kcal", compare= false, sign= true, show_always= false }, ["boost_anabiotic"] = { index= 5, typ= "float", name= "", icon_p= "ui_am_prop_Vibros", icon_n= "ui_am_prop_anabiotic", track= false, magnitude= 1000, unit= "", compare= false, sign= true, show_always= false }, ["boost_power_restore"] = { index= 6, typ= "float", name= "ui_inv_power", icon_p= "ui_am_propery_07", icon_n= "ui_am_prop_power_restore", track= false, magnitude= 100000, unit= "st_microg", compare= false, sign= true, show_always= false }, ["boost_bleeding_restore"] = { index= 7, typ= "float", name= "ui_inv_bleeding", icon_p= "ui_am_prop_restore_bleeding", icon_n= "ui_am_prop_bleeding_restore", track= false, magnitude= 150000, unit= "st_ml_min", compare= false, sign= true, show_always= false }, ["boost_radiation_protection"] = { index= 8, typ= "float", name= "ui_inv_outfit_radiation_protection", icon_p= "ui_am_propery_09", icon_n= "ui_am_prop_radiation_protection", track= false, magnitude= 3300, unit= "st_perc", compare= false, sign= true, show_always= false }, ["boost_telepat_protection"] = { index= 9, typ= "float", name= "ui_inv_outfit_telepatic_protection", icon_p= "ui_am_propery_11", icon_n= "ui_am_prop_telepat_protection", track= false, magnitude= 1000, unit= "st_perc", compare= false, sign= true, show_always= false }, ["boost_chemburn_protection"] = { index= 10, typ= "float", name= "ui_inv_outfit_chemical_burn_protection", icon_p= "ui_am_prop_chem", icon_n= "ui_am_prop_chemburn_protection", track= false, magnitude= 500, unit= "st_perc", compare= false, sign= true, show_always= false }, ["boost_burn_immunity"] = { index= 11, typ= "float", name= "ui_inv_outfit_burn_protection", icon_p= "ui_am_prop_thermo", icon_n= "ui_am_prop_burn_immunity", track= false, magnitude= 1000, unit= "st_perc", compare= false, sign= true, show_always= false }, ["boost_shock_immunity"] = { index= 12, typ= "float", name= "ui_inv_outfit_shock_protection", icon_p= "ui_am_prop_electro", icon_n= "ui_am_prop_shock_immunity", track= false, magnitude= 100, unit= "st_perc", compare= false, sign= true, show_always= false }, ["boost_radiation_immunity"] = { index= 13, typ= "float", name= "ui_inv_outfit_radiation_protection", icon_p= "ui_am_propery_09", icon_n= "ui_am_prop_radiation_immunity", track= false, magnitude= 3300, unit= "st_perc", compare= false, sign= true, show_always= false }, ["boost_telepat_immunity"] = { index= 14, typ= "float", name= "ui_inv_outfit_telepatic_protection", icon_p= "ui_am_propery_11", icon_n= "ui_am_prop_telepat_immunity", track= false, magnitude= 1000, unit= "st_perc", compare= false, sign= true, show_always= false }, ["boost_chemburn_immunity"] = { index= 15, typ= "float", name= "ui_inv_outfit_chemical_burn_protection", icon_p= "ui_am_prop_chem", icon_n= "ui_am_prop_chemburn_immunity", track= false, magnitude= 500, unit= "st_perc", compare= false, sign= true, show_always= false }, ["boost_max_weight"] = { index= 16, typ= "float", name= "ui_inv_outfit_additional_weight", icon_p= "ui_am_propery_08", icon_n= "ui_am_prop_max_weight", track= false, magnitude= 1000, unit= "st_g", compare= false, sign= true, show_always= false }, } apply_compatibility_patches() end function apply_compatibility_patches() if outfit_speed and outfit_speed.get_outfit_speed then -- "Outfits Affect Movespeed (OLD)" utils_ui.stats_table["outfit"]["speed_modifier"] = { index=120, typ="float", name="ui_inv_outfit_speed", icon_p="ui_am_prop_sprint", icon_n="", track=false, magnitude=100, unit="%", compare=false, sign=false, show_always=false, value_functor={"outfit_speed","get_outfit_speed"}} end if outfit_speed_mcm and outfit_speed_mcm.get_outfit_speed then -- "Outfits Affect Movespeed (MCM)" utils_ui.stats_table["outfit"]["speed_modifier"] = { index=120, typ="float", name="ui_inv_outfit_speed", icon_p="ui_am_prop_sprint", icon_n="", track=false, magnitude=100, unit="%", compare=false, sign=false, show_always=false, value_functor={"outfit_speed_mcm","get_outfit_speed"}} end if arti_outfits and arti_outfits.get_max_condition then -- "Outfit Parts and Repair Overhaul (OLD)" utils_ui.stats_table["outfit"]["max_condition"] = { index=5, typ="float", name="ui_inv_max_condition", icon_p="ui_am_propery_01", icon_n="", track=false, magnitude=1, unit="%", compare=false, sign=false, show_always=false, value_functor={"arti_outfits","get_max_condition"}} end if arti_outfits and arti_outfits.ui_max_condition then -- "Outfit Parts and Repair Overhaul (NEW)" utils_ui.stats_table["outfit"]["max_condition"] = { index=5, typ="float", name="ui_inv_max_condition", icon_p="ui_am_propery_01", icon_n="", track=false, magnitude=1, unit="%", compare=false, sign=false, show_always=false, value_functor={"arti_outfits","ui_max_condition"}} end if monke_patch_ui and monke_patch_ui.old_prep_table then utils_ui.prepare_stats_table = function() end end end -- LuaFormatter on -- custom functor to call the original function in utils_ui and scale the return value up to a percent. function scale_100(obj, sec, base_file, base_func, param) local base_value = _G[base_file][base_func](obj, sec, param) return math.floor(base_value * 100) end -- custom functor to retrieve the highest pellet count from compatible ammunition and multiply with the base damage value. -- this is to display a better damage value for shotguns that can fire buck shot. function scale_100_for_pellets(obj, sec, base_file, base_func, param) local base_damage = scale_100(obj, sec, base_file, base_func, param) local max_pellet_count = 0 local id = obj and obj:id() local ammo_list = utils_item.get_ammo(sec, id) for _, ammo_name in pairs(ammo_list) do if ammo_name ~= "ammo_12x70_buck_self" then local pellet_count = ini_sys:r_float_ex(ammo_name, "buck_shot") or 1 if pellet_count > max_pellet_count then max_pellet_count = pellet_count end end end return base_damage * max_pellet_count end Base_UIInfoItem_Update = nil local w8_caption = game.translate_string("ui_inv_outfit_additional_weight") -- update the item tooltip to prevent display of green +1 delta indicators in all attributes when an equipped item is compared to itself function Ish_UIInfoItem_Update(sender, obj, sec, flags) Base_UIInfoItem_Update(sender, obj, sec, flags) if obj and sender.can_compare then local slot = SYS_GetParam(2, sec, "slot", -1) + 1 local obj_b = slot > 0 and db.actor:item_in_slot(slot) if obj_b and obj:id() == obj_b:id() then -- same thing! for _, ele in pairs(sender.stats) do local newtext = ele.txt:GetText() if ele.cap:GetText() ~= w8_caption then newtext = string.gsub(newtext, "+", "") -- strip plus sign from all stats but wait. w8. weight. end ele.txt:SetText(newtext) ele.txt:SetTextColor(utils_xml.get_color("white", true)) ele.comp:Show(false) end end end end -- smol addition for game diff ;] -- (courtesy of xcvb 2021.10.10) function get_game_diff_hit_type(imm) local get_game_diff = get_console():get_string("g_game_difficulty") local game_difficulty_resist = SYS_GetParam(2, "actor_immunities_" .. get_game_diff, imm, 0) if imm == "telepatic_immunity" then -- psi adding resists twice game_difficulty_resist = game_difficulty_resist * 2 end game_difficulty_resist = game_difficulty_resist * 100 -- st_perc return game_difficulty_resist end function on_console_execute(cmd) if cmd == "g_game_difficulty" then override_stats_table() end end function on_game_start() Base_UIInfoItem_Update = utils_ui.UIInfoItem.Update utils_ui.UIInfoItem.Update = Ish_UIInfoItem_Update RegisterScriptCallback("on_console_execute", on_console_execute) override_stats_table() end