From 00be4ee9caf8e176a77e3dd1cce5111a8a344a2c Mon Sep 17 00:00:00 2001 From: HAO YAN Date: Fri, 18 Mar 2022 01:20:17 +0800 Subject: [PATCH] Update Item Card slot count (#6301) Should cover all card slots since these slots doesn't only store card anymore. --- doc/script_commands.txt | 6 +++--- src/map/pc.cpp | 2 +- src/map/script.cpp | 11 +++++------ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/doc/script_commands.txt b/doc/script_commands.txt index 5fd549facf..c62f652ac4 100644 --- a/doc/script_commands.txt +++ b/doc/script_commands.txt @@ -4059,7 +4059,7 @@ The renewal feature to check is determined by the number . *isequipped({,{,..}}) This function will return 1 if the invoking character has all of the item -IDs given equipped (if card IDs are passed, then it checks if the cards are +IDs given equipped (if item/card IDs are passed, then it checks if the items/cards are inserted into slots in the equipment they are currently wearing). Theoretically there is no limit to the number of items that may be tested for at the same time. If even one of the items given is not equipped, 0 will be returned. @@ -4085,9 +4085,9 @@ Example: --------------------------------------- -*checkequipedcard() +*checkequipedcard() -This function will return 1 if the card specified by its item ID number is +This function will return 1 if the item/card specified by its item ID number is inserted into any equipment they have in their inventory, currently equipped or not. diff --git a/src/map/pc.cpp b/src/map/pc.cpp index b195369367..435d68625f 100755 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -1295,7 +1295,7 @@ bool pc_isequipped(struct map_session_data *sd, t_itemid nameid) continue; if( sd->inventory_data[index]->nameid == nameid ) return true; - for( j = 0; j < sd->inventory_data[index]->slots; j++ ){ + for( j = 0; j < MAX_SLOTS; j++ ){ if( sd->inventory.u.items_inventory[index].card[j] == nameid ) return true; } diff --git a/src/map/script.cpp b/src/map/script.cpp index 4bb1a6f5d3..12c4a5e06b 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -15516,7 +15516,7 @@ BUILDIN_FUNC(checkequipedcard) if(sd->inventory.u.items_inventory[i].nameid > 0 && sd->inventory.u.items_inventory[i].amount && sd->inventory_data[i]){ if (itemdb_isspecial(sd->inventory.u.items_inventory[i].card[0])) continue; - for(n=0;ninventory_data[i]->slots;n++){ + for (n=0; n < MAX_SLOTS; n++) { if(sd->inventory.u.items_inventory[i].card[n] == c) { script_pushint(st,1); return SCRIPT_CMD_SUCCESS; @@ -16068,7 +16068,7 @@ BUILDIN_FUNC(isequippedcnt) } else { //Count cards. if (itemdb_isspecial(sd->inventory.u.items_inventory[index].card[0])) continue; //No cards - for (short k = 0; k < sd->inventory_data[index]->slots; k++) { + for (short k = 0; k < MAX_SLOTS; k++) { if (sd->inventory.u.items_inventory[index].card[k] == id) ret++; //[Lupus] } @@ -16124,11 +16124,10 @@ BUILDIN_FUNC(isequipped) break; } else { //Cards short k; - if (sd->inventory_data[index]->slots == 0 || - itemdb_isspecial(sd->inventory.u.items_inventory[index].card[0])) + if (itemdb_isspecial(sd->inventory.u.items_inventory[index].card[0])) continue; - for (k = 0; k < sd->inventory_data[index]->slots; k++) + for (k = 0; k < MAX_SLOTS; k++) { //New hash system which should support up to 4 slots on any equipment. [Skotlex] unsigned int hash = 0; if (sd->inventory.u.items_inventory[index].card[k] != id) @@ -16198,7 +16197,7 @@ BUILDIN_FUNC(cardscnt) } else { if (itemdb_isspecial(sd->inventory.u.items_inventory[index].card[0])) continue; - for(k=0; kinventory_data[index]->slots; k++) { + for (k=0; k < MAX_SLOTS; k++) { if (sd->inventory.u.items_inventory[index].card[k] == id) ret++; }