diff options
author | Jesusaves <cpntb1@ymail.com> | 2024-05-22 09:20:57 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2024-05-22 09:20:57 -0300 |
commit | b18780f0dbb580fca8627f7f09c0df8b6c238d53 (patch) | |
tree | 7f73d3ed92b869cde0da6fa908b383f30d000cde /npc/craft | |
parent | bdb1ece743520c63e7dc5c47b081e43e98488a20 (diff) | |
download | serverdata-b18780f0dbb580fca8627f7f09c0df8b6c238d53.tar.gz serverdata-b18780f0dbb580fca8627f7f09c0df8b6c238d53.tar.bz2 serverdata-b18780f0dbb580fca8627f7f09c0df8b6c238d53.tar.xz serverdata-b18780f0dbb580fca8627f7f09c0df8b6c238d53.zip |
Fix possible overflow in npc/craft/options, and inutilize it
Diffstat (limited to 'npc/craft')
-rw-r--r-- | npc/craft/options.txt | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/npc/craft/options.txt b/npc/craft/options.txt index 689b677b4..75a7fa758 100644 --- a/npc/craft/options.txt +++ b/npc/craft/options.txt @@ -43,7 +43,7 @@ function script csys_Generate { ///////////////////////////////////////////////////////////// // Basic tier if (.@gid & CRGROUP_BASE) { - .@lvl=(.@OVR ? 100 : CRAFTSYS[CRGROUP_BASE]); + .@lvl=min(CRAFT_MAXLV4, .@OVR ? 100 : CRAFTSYS[CRGROUP_BASE]); if (.@lvl >= 1) { array_push(@csys_attr, VAR_STRAMOUNT); array_push(@csys_attr, VAR_INTAMOUNT); @@ -72,7 +72,7 @@ function script csys_Generate { ///////////////////////////////////////////////////////////// // First tier if (.@gid & CRGROUP_ATK) { - .@lvl=(.@OVR ? 100 : CRAFTSYS[CRGROUP_ATK]); + .@lvl=min(CRAFT_MAXLV4, .@OVR ? 100 : CRAFTSYS[CRGROUP_ATK]); if (.@lvl >= 1) { array_push(@csys_attr, VAR_ATTPOWER); array_push(@csys_attr, VAR_ATTMPOWER); @@ -89,7 +89,7 @@ function script csys_Generate { .@stk+=1; } if (.@gid & CRGROUP_DEF) { - .@lvl=(.@OVR ? 100 : CRAFTSYS[CRGROUP_DEF]); + .@lvl=min(CRAFT_MAXLV4, .@OVR ? 100 : CRAFTSYS[CRGROUP_DEF]); if (.@lvl >= 1) { array_push(@csys_attr, VAR_ITEMDEFPOWER); array_push(@csys_attr, VAR_MDEFPOWER); @@ -106,7 +106,7 @@ function script csys_Generate { .@stk+=1; } if (.@gid & CRGROUP_ACC) { - .@lvl=(.@OVR ? 100 : CRAFTSYS[CRGROUP_ACC]); + .@lvl=min(CRAFT_MAXLV4, .@OVR ? 100 : CRAFTSYS[CRGROUP_ACC]); if (.@lvl >= 1) { array_push(@csys_attr, VAR_HITSUCCESSVALUE); } @@ -125,7 +125,7 @@ function script csys_Generate { .@stk+=1; } if (.@gid & CRGROUP_EVD) { - .@lvl=(.@OVR ? 100 : CRAFTSYS[CRGROUP_EVD]); + .@lvl=min(CRAFT_MAXLV4, .@OVR ? 100 : CRAFTSYS[CRGROUP_EVD]); if (.@lvl >= 1) { array_push(@csys_attr, VAR_AVOIDSUCCESSVALUE); } @@ -144,7 +144,7 @@ function script csys_Generate { ///////////////////////////////////////////////////////////// // Second tier if (.@gid & CRGROUP_REGEN) { - .@lvl=(.@OVR ? 100 : CRAFTSYS[CRGROUP_REGEN]); + .@lvl=min(CRAFT_MAXLV4, .@OVR ? 100 : CRAFTSYS[CRGROUP_REGEN]); if (.@lvl >= 1) { array_push(@csys_attr, VAR_HPACCELERATION); } @@ -158,7 +158,7 @@ function script csys_Generate { .@stk+=1; } if (.@gid & CRGROUP_SPEED) { - .@lvl=(.@OVR ? 100 : CRAFTSYS[CRGROUP_SPEED]); + .@lvl=min(CRAFT_MAXLV4, .@OVR ? 100 : CRAFTSYS[CRGROUP_SPEED]); if (.@lvl >= 1) { array_push(@csys_attr, VAR_PLUSASPD); } @@ -175,7 +175,7 @@ function script csys_Generate { .@stk+=1; } if (.@gid & CRGROUP_DOUBLE) { - .@lvl=(.@OVR ? 100 : CRAFTSYS[CRGROUP_DOUBLE]); + .@lvl=min(CRAFT_MAXLV4, .@OVR ? 100 : CRAFTSYS[CRGROUP_DOUBLE]); if (.@lvl >= 1) { array_push(@csys_attr, IOPT_CRITDMG); } @@ -189,7 +189,7 @@ function script csys_Generate { .@stk+=1; } if (.@gid & CRGROUP_MAXPC) { - .@lvl=(.@OVR ? 100 : CRAFTSYS[CRGROUP_MAXPC]); + .@lvl=min(CRAFT_MAXLV4, .@OVR ? 100 : CRAFTSYS[CRGROUP_MAXPC]); if (.@lvl >= 1) { array_push(@csys_attr, VAR_MAXHPPERCENT); array_push(@csys_attr, VAR_MAXSPPERCENT); @@ -207,7 +207,7 @@ function script csys_Generate { ///////////////////////////////////////////////////////////// // Third tier if (.@gid & CRGROUP_SCRESIST) { - .@lvl=(.@OVR ? 100 : CRAFTSYS[CRGROUP_SCRESIST]); + .@lvl=min(CRAFT_MAXLV4, .@OVR ? 100 : CRAFTSYS[CRGROUP_SCRESIST]); if (.@lvl >= 1) { array_push(@csys_attr, IOPT_SCRESIST_POISON); } @@ -228,7 +228,7 @@ function script csys_Generate { .@stk+=1; } if (.@gid & CRGROUP_SCINFLICT) { - .@lvl=(.@OVR ? 100 : CRAFTSYS[CRGROUP_SCINFLICT]); + .@lvl=min(CRAFT_MAXLV4, .@OVR ? 100 : CRAFTSYS[CRGROUP_SCINFLICT]); if (.@lvl >= 1) { array_push(@csys_attr, IOPT_SCPROVOKE_POISON); } @@ -252,7 +252,7 @@ function script csys_Generate { .@stk+=1; } if (.@gid & CRGROUP_MANAUSE) { - .@lvl=(.@OVR ? 100 : CRAFTSYS[CRGROUP_MANAUSE]); + .@lvl=min(CRAFT_MAXLV4, .@OVR ? 100 : CRAFTSYS[CRGROUP_MANAUSE]); if (.@lvl >= 1) { array_push(@csys_attr, SP_DRAIN); } @@ -267,7 +267,7 @@ function script csys_Generate { .@stk+=1; } if (.@gid & CRGROUP_BOSSATK) { - .@lvl=(.@OVR ? 100 : CRAFTSYS[CRGROUP_BOSSATK]); + .@lvl=min(CRAFT_MAXLV4, .@OVR ? 100 : CRAFTSYS[CRGROUP_BOSSATK]); if (.@lvl >= 1) { array_push(@csys_attr, HP_DRAIN); } @@ -285,7 +285,7 @@ function script csys_Generate { ///////////////////////////////////////////////////////////// // Final tier (needs minimum lv 3) if (.@gid & CRGROUP_FINAL) { - .@lvl=(.@OVR ? 100 : CRAFTSYS[CRGROUP_FINAL]); + .@lvl=min(CRAFT_MAXLV4, .@OVR ? 100 : CRAFTSYS[CRGROUP_FINAL]); if (.@lvl >= 1) { array_push(@csys_attr, IOPT_EXPGAIN); } @@ -1128,7 +1128,7 @@ function script csysGUI_RaiseOpt { .@mx = CRAFT_MAXLV4; // Check if you can upgrade the skill if (csysGUI_OptReq(.@sk)) { - if (.@lv > .@mx) { + if (.@lv >= .@mx) { mesc l("You cannot raise crafting skills beyond level @@!", .@mx), 1; return false; } |