Skip to content

Commit

Permalink
Fixed foods and cash foods being applied simultaneously
Browse files Browse the repository at this point in the history
  • Loading branch information
csnv committed Nov 10, 2023
1 parent 3faa147 commit 211602f
Showing 1 changed file with 37 additions and 6 deletions.
43 changes: 37 additions & 6 deletions src/map/status.c
Original file line number Diff line number Diff line change
Expand Up @@ -7203,28 +7203,59 @@ static int status_change_start_sub(struct block_list *src, struct block_list *bl
if( bl->type != BL_MER )
return 0; // Stats only for Mercenaries
break;
// Normal foods can't overwrite cash foods, and cash foods only overwrite those of equal or lower level
case SC_FOOD_STR:
if (sc->data[SC_FOOD_STR_CASH] && sc->data[SC_FOOD_STR_CASH]->val1 > val1)
if (sc->data[SC_FOOD_STR_CASH] != NULL)
return 0;
FALLTHROUGH
case SC_FOOD_STR_CASH:
if ((sc->data[SC_FOOD_STR_CASH] && sc->data[SC_FOOD_STR_CASH]->val1 > val1)
|| (sc->data[SC_FOOD_STR] && sc->data[SC_FOOD_STR]->val1 > val1))
return 0;
break;
case SC_FOOD_AGI:
if (sc->data[SC_FOOD_AGI_CASH] && sc->data[SC_FOOD_AGI_CASH]->val1 > val1)
if (sc->data[SC_FOOD_AGI_CASH] != NULL)
return 0;
FALLTHROUGH
case SC_FOOD_AGI_CASH:
if ((sc->data[SC_FOOD_AGI_CASH] && sc->data[SC_FOOD_AGI_CASH]->val1 > val1)
|| (sc->data[SC_FOOD_AGI] && sc->data[SC_FOOD_AGI]->val1 > val1))
return 0;
break;
case SC_FOOD_VIT:
if (sc->data[SC_FOOD_VIT_CASH] && sc->data[SC_FOOD_VIT_CASH]->val1 > val1)
if (sc->data[SC_FOOD_VIT_CASH] != NULL)
return 0;
FALLTHROUGH
case SC_FOOD_VIT_CASH:
if ((sc->data[SC_FOOD_VIT_CASH] && sc->data[SC_FOOD_VIT_CASH]->val1 > val1)
|| (sc->data[SC_FOOD_VIT] && sc->data[SC_FOOD_VIT]->val1 > val1))
return 0;
break;
case SC_FOOD_INT:
if (sc->data[SC_FOOD_INT_CASH] && sc->data[SC_FOOD_INT_CASH]->val1 > val1)
if (sc->data[SC_FOOD_INT_CASH] != NULL)
return 0;
FALLTHROUGH
case SC_FOOD_INT_CASH:
if ((sc->data[SC_FOOD_INT_CASH] && sc->data[SC_FOOD_INT_CASH]->val1 > val1)
|| (sc->data[SC_FOOD_INT] && sc->data[SC_FOOD_INT]->val1 > val1))
return 0;
break;
case SC_FOOD_DEX:
if (sc->data[SC_FOOD_DEX_CASH] && sc->data[SC_FOOD_DEX_CASH]->val1 > val1)
if (sc->data[SC_FOOD_DEX_CASH] != NULL)
return 0;
FALLTHROUGH
case SC_FOOD_DEX_CASH:
if ((sc->data[SC_FOOD_DEX_CASH] && sc->data[SC_FOOD_DEX_CASH]->val1 > val1)
|| (sc->data[SC_FOOD_DEX] && sc->data[SC_FOOD_DEX]->val1 > val1))
return 0;
break;
case SC_FOOD_LUK:
if (sc->data[SC_FOOD_LUK_CASH] && sc->data[SC_FOOD_LUK_CASH]->val1 > val1)
if (sc->data[SC_FOOD_LUK_CASH] != NULL)
return 0;
FALLTHROUGH
case SC_FOOD_LUK_CASH:
if ((sc->data[SC_FOOD_LUK_CASH] && sc->data[SC_FOOD_LUK_CASH]->val1 > val1)
|| (sc->data[SC_FOOD_LUK] && sc->data[SC_FOOD_LUK]->val1 > val1))
return 0;
break;
case SC_CAMOUFLAGE:
Expand Down

0 comments on commit 211602f

Please sign in to comment.