function on_xml_read() if beo_mcm then return end RegisterScriptCallback("on_xml_read", function(xml_file_name, xml_obj) if xml_file_name:find( [[\dialogs.xml]] ) then local query_res = xml_obj:query("dialog[id=dm_encrypted_pda] > phrase_list > phrase[id=1] > text") if not (type(query_res) == "table" and size_table(query_res) == 1) then return end local elem = query_res[1] local phrase_elem = elem.parent xml_obj:removeElement(elem) xml_obj:insertFromXMLString([[modxml_pdahacking_unlockcost.dialog_pda_unlock]], phrase_elem, #phrase_elem.kids) end end) end function on_game_start() if beo_mcm then return end if not ui_mcm.get("pda_hacking/enable_tech_unlock_cost") then return end base_have_encrypted_pda_money = ui_pda_npc_tab.have_encrypted_pda_money function ui_pda_npc_tab.have_encrypted_pda_money(first_speaker, second_speaker) local encrypted_pdas = ui_pda_npc_tab.get_encrypted_pdas() local num = #encrypted_pdas return mlr_utils.have_money(ui_mcm.get("pda_hacking/tech_unlock_cost") * num) end base_take_encrypted_pda_money = ui_pda_npc_tab.take_encrypted_pda_money function ui_pda_npc_tab.take_encrypted_pda_money(first_speaker, second_speaker) local encrypted_pdas = ui_pda_npc_tab.get_encrypted_pdas() local num = #encrypted_pdas dialogs.relocate_money_from_actor(first_speaker, second_speaker, num * ui_mcm.get("pda_hacking/tech_unlock_cost")) end end function dialog_pda_unlock() if ui_mcm.get("pda_hacking/enable_tech_unlock_cost") then return strformat(game.translate_string("st_pdahacking_unlock_cost"), ui_mcm.get("pda_hacking/tech_unlock_cost")) else return "st_encrypted_pda_text_1" end end