diff --git a/quant.ew/files/core/perk_fns.lua b/quant.ew/files/core/perk_fns.lua index 59054770..3e2fa723 100644 --- a/quant.ew/files/core/perk_fns.lua +++ b/quant.ew/files/core/perk_fns.lua @@ -20,6 +20,14 @@ local perks_to_ignore = { TELEKINESIS = true, } +local global_perks = { + NO_MORE_SHUFFLE = true, + UNLIMITED_SPELLS = true, + TRICK_BLOOD_MONEY = true, + GOLD_IS_FOREVER = true, + PEACE_WITH_GODS = true +} + function perk_fns.get_my_perks() lazyload() local perks = {} @@ -33,6 +41,19 @@ function perk_fns.get_my_perks() return perks end +local function spawn_perk(perk_info, auto_pickup_entity) + local x, y = EntityGetTransform(ctx.my_player.entity) + local perk_entity = perk_spawn(x, y - 8, perk_info.id) + if auto_pickup_entity then + perk_pickup(perk_entity, auto_pickup_entity, nil, true, false) + end + local icon = EntityCreateNew() + EntityAddTag(icon, "perk_entity") + EntityAddComponent2(icon, "UIIconComponent", {icon_sprite_file = perk_info.ui_icon, name = perk_info.ui_name, description = perk_info.ui_description}) + EntityAddChild(ctx.my_player.entity, icon) +end + + local function give_one_perk(entity_who_picked, perk_info, count) lazyload() @@ -78,6 +99,12 @@ local function give_one_perk(entity_who_picked, perk_info, count) EntityAddChild( entity_who_picked, particle_id ) end end + + if global_perks[perk_info.id] + and perk_fns.get_my_perks()[perk_info.id] == nil then + spawn_perk(perk_info, true) + global_perks[perk_info.id] = false + end end function perk_fns.update_perks(perk_data, player_data) diff --git a/quant.ew/files/system/perk_patches/append/perks_client.lua b/quant.ew/files/system/perk_patches/append/perks_client.lua index 25bc2997..bb0d06ec 100644 --- a/quant.ew/files/system/perk_patches/append/perks_client.lua +++ b/quant.ew/files/system/perk_patches/append/perks_client.lua @@ -1,4 +1,4 @@ -if not ctx.proxy_opts.randomize_perks then +if CrossCall ~= nil and not CrossCall("ew_randomize_perks") then return end diff --git a/quant.ew/files/system/perk_patches/perk_patches.lua b/quant.ew/files/system/perk_patches/perk_patches.lua index e0ca64e9..75ec8a5d 100644 --- a/quant.ew/files/system/perk_patches/perk_patches.lua +++ b/quant.ew/files/system/perk_patches/perk_patches.lua @@ -49,6 +49,10 @@ np.CrossCallAdd("ew_perk_ban_list", function() return ctx.proxy_opt.perk_ban_list end) +np.CrossCallAdd("ew_randomize_perks", function() + return ctx.proxy_opt.randomize_perks +end) + rpc.opts_everywhere() function rpc.sync_perk_amount(items, genome) GlobalsSetValue("TEMPLE_SHOP_ITEM_COUNT", tostring(items))