Hello.. i have source mod by epoque this project no longer support by epoque so i decide update everything my problem is addslot doesnt work with the getitemslots script command
/*==========================================
// Epoque's Expansion Pack
* addslot <position>;
*------------------------------------------*/
BUILDIN_FUNC(addslot)
{
int i, j;
int slot, flag;
struct item equip_;
struct map_session_data* sd = script_rid2sd(st);
const int pos[] = { EQI_HEAD_TOP, EQI_ARMOR, EQI_HAND_L, EQI_HAND_R, EQI_GARMENT, EQI_SHOES, EQI_ACC_L, EQI_ACC_R, EQI_HEAD_MID, EQI_HEAD_LOW };
if (sd == NULL)
{
ShowError("addslot: Failed to add slot, no player attached!\n");
return 0;
}
slot = script_getnum(st, 2);
if (slot < EQI_ACC_L || slot > EQI_HAND_R )
{
ShowError("addslot: Invalid equipment given (%d), can only slot equipment.\n", slot);
return 0;
}
slot = sd->equip_index[pos[slot - 1]];
if (slot < 0)
{
ShowError("addslot: No equipment slotted at the given position\n");
return 0;
}
if (itemdb_isspecial(sd->status.inventory[slot].card[0]) ||
sd->inventory_data[slot]->slot == MAX_SLOTS ||
sd->status.inventory[slot].card[3] > CARD_NOSLOT_ID)
{
ShowError("addslot: This equipment already has full slots/all available slots.");
return 0;
}
/* Search for a previously removed slot */
ARR_FIND(0, sd->inventory_data[slot]->slot, i, sd->status.inventory[slot].card[i] == CARD_NOSLOT_ID);
if (i == sd->inventory_data[slot]->slot)
{
/* Search for a free card block */
ARR_FIND(0, MAX_SLOTS, i, sd->status.inventory[slot].card[i] == 0 && i >= sd->inventory_data[slot]->slot);
}
if (i == MAX_SLOTS)
{
ShowError("addslot: This equipment has no available slots.\n");
return 0;
}
equip_.id = 0;
equip_.nameid = sd->inventory_data[slot]->nameid;
equip_.amount = 1;
equip_.equip = 0;
equip_.identify = 1;
equip_.refine = sd->status.inventory[slot].refine;
equip_.attribute = sd->status.inventory[slot].attribute;
equip_.expire_time = sd->status.inventory[slot].expire_time;
for (j = 0; MAX_SLOTS > j; j++)
equip_.card[j] = sd->status.inventory[slot].card[j];
if (i < sd->inventory_data[slot]->slot)
equip_.card[i] = 0;
else
equip_.card[i] = CARD_SLOT_ID;
pc_delitem(sd,slot,1,0,0,LOG_TYPE_SCRIPT);
if((flag = pc_additem(sd, &equip_, 1,LOG_TYPE_SCRIPT)))
{
clif_additem(sd, 0, 0, flag);
map_addflooritem(&equip_,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0,0);
}
return 0;
}
Question
Jayz
Hello.. i have source mod by epoque this project no longer support by epoque so i decide update everything my problem is addslot doesnt work with the getitemslots script command
bump
Edited by Zack-Link to comment
Share on other sites
12 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.