Update Item Card slot count (#6301)

Should cover all card slots since these slots doesn't only store card anymore.
This commit is contained in:
HAO YAN 2022-03-18 01:20:17 +08:00 committed by GitHub
parent 5193fd6c92
commit 00be4ee9ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 10 deletions

View File

@ -4059,7 +4059,7 @@ The renewal feature to check is determined by the number <type>.
*isequipped(<id>{,<id>{,..}})
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(<card id>)
*checkequipedcard(<item id>)
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.

View File

@ -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;
}

View File

@ -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;n<sd->inventory_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; k<sd->inventory_data[index]->slots; k++) {
for (k=0; k < MAX_SLOTS; k++) {
if (sd->inventory.u.items_inventory[index].card[k] == id)
ret++;
}