|
@@ -15407,38 +15407,41 @@ BUILDIN_FUNC(isday)
|
|
BUILDIN_FUNC(isequippedcnt)
|
|
BUILDIN_FUNC(isequippedcnt)
|
|
{
|
|
{
|
|
TBL_PC *sd;
|
|
TBL_PC *sd;
|
|
- int i, id = 1;
|
|
|
|
- int ret = 0;
|
|
|
|
|
|
|
|
- if (!script_rid2sd(sd)) { //If the player is not attached it is a script error anyway... but better prevent the map server from crashing...
|
|
|
|
|
|
+ if (!script_rid2sd(sd)) {
|
|
script_pushint(st,0);
|
|
script_pushint(st,0);
|
|
return SCRIPT_CMD_SUCCESS;
|
|
return SCRIPT_CMD_SUCCESS;
|
|
}
|
|
}
|
|
|
|
|
|
- for (i=0; id!=0; i++) {
|
|
|
|
- short j;
|
|
|
|
- FETCH (i+2, id) else id = 0;
|
|
|
|
|
|
+ int ret = 0;
|
|
|
|
+ int total = script_lastdata(st);
|
|
|
|
+ std::vector<int32> list(total);
|
|
|
|
+
|
|
|
|
+ for (int i = 2; i <= total; ++i) {
|
|
|
|
+ int id = script_getnum(st,i);
|
|
if (id <= 0)
|
|
if (id <= 0)
|
|
continue;
|
|
continue;
|
|
|
|
+ if (std::find(list.begin(), list.end(), id) != list.end())
|
|
|
|
+ continue;
|
|
|
|
+ list.push_back(id);
|
|
|
|
|
|
- for (j=0; j<EQI_MAX; j++) {
|
|
|
|
|
|
+ for (short j = 0; j < EQI_MAX; j++) {
|
|
short index = sd->equip_index[j];
|
|
short index = sd->equip_index[j];
|
|
- if(index < 0)
|
|
|
|
|
|
+ if (index < 0)
|
|
continue;
|
|
continue;
|
|
if (pc_is_same_equip_index((enum equip_index)j, sd->equip_index, index))
|
|
if (pc_is_same_equip_index((enum equip_index)j, sd->equip_index, index))
|
|
continue;
|
|
continue;
|
|
|
|
|
|
- if(!sd->inventory_data[index])
|
|
|
|
|
|
+ if (!sd->inventory_data[index])
|
|
continue;
|
|
continue;
|
|
|
|
|
|
if (itemdb_type(id) != IT_CARD) { //No card. Count amount in inventory.
|
|
if (itemdb_type(id) != IT_CARD) { //No card. Count amount in inventory.
|
|
if (sd->inventory_data[index]->nameid == id)
|
|
if (sd->inventory_data[index]->nameid == id)
|
|
- ret+= sd->inventory.u.items_inventory[index].amount;
|
|
|
|
|
|
+ ret += sd->inventory.u.items_inventory[index].amount;
|
|
} else { //Count cards.
|
|
} else { //Count cards.
|
|
- short k;
|
|
|
|
if (itemdb_isspecial(sd->inventory.u.items_inventory[index].card[0]))
|
|
if (itemdb_isspecial(sd->inventory.u.items_inventory[index].card[0]))
|
|
continue; //No cards
|
|
continue; //No cards
|
|
- for(k=0; k<sd->inventory_data[index]->slot; k++) {
|
|
|
|
|
|
+ for (short k = 0; k < sd->inventory_data[index]->slot; k++) {
|
|
if (sd->inventory.u.items_inventory[index].card[k] == id)
|
|
if (sd->inventory.u.items_inventory[index].card[k] == id)
|
|
ret++; //[Lupus]
|
|
ret++; //[Lupus]
|
|
}
|
|
}
|