Skip to content

Commit

Permalink
exploit fix
Browse files Browse the repository at this point in the history
  • Loading branch information
SapphicOverload committed Nov 24, 2024
1 parent 9768a62 commit ba17312
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion code/_onclick/hud/hud.dm
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ GLOBAL_LIST_INIT(available_ui_styles, list(
var/atom/movable/screen/rest_icon
var/atom/movable/screen/throw_icon
var/atom/movable/screen/module_store_icon
var/atom/movable/screen/skill_menu
var/atom/movable/screen/skill_menu/skill_menu

var/list/static_inventory = list() //the screen objects which are static
var/list/toggleable_inventory = list() //the screen objects which can be hidden
Expand Down
12 changes: 9 additions & 3 deletions code/datums/mind.dm
Original file line number Diff line number Diff line change
Expand Up @@ -808,9 +808,15 @@
/mob/proc/add_exp(skill, amount)
if(!mind)
return FALSE
if(mind.exp_progress[skill] + amount >= EXPERIENCE_PER_LEVEL * (2**mind.skills[skill])) // exp required scales exponentially
mind.exp_progress[skill] = 0
adjust_skill(skill, 1)
var/exp_required = EXPERIENCE_PER_LEVEL * (2**mind.skills[skill]) // exp required scales exponentially
if(mind.exp_progress[skill] + amount >= exp_required)
var/levels_gained = round(log(2, 1 + (mind.exp_progress[skill] + amount) / exp_required)) // in case you gained so much you go up more than one level
var/levels_allocated = hud_used?.skill_menu ? hud_used.skill_menu.allocated_skills[skill] : 0
if(levels_allocated > 0) // adjust any already allocated skills to prevent shenanigans (you know who you are)
hud_used.skill_menu.allocated_points -= min(levels_gained, levels_allocated)
hud_used.skill_menu.allocated_skills[skill] -= min(levels_gained, levels_allocated)
mind.exp_progress[skill] += amount - exp_required * (2**(levels_gained - 1))
adjust_skill(skill, levels_gained)
to_chat(src, span_boldnotice("Your [skill] skill is now level [get_skill(skill)]!"))
return TRUE
mind.exp_progress[skill] += amount
Expand Down

0 comments on commit ba17312

Please sign in to comment.