Jump to content
  • 0

addslot - slotted card cannot be removed by card remover


Lord Ganja

Question


  • Group:  Members
  • Topic Count:  141
  • Topics Per Day:  0.03
  • Content Count:  444
  • Reputation:   22
  • Joined:  06/18/12
  • Last Seen:  

Help please. I added the addslot src to mine. and encountered DUPING of cards when using the card remover.

 

Example:

An asprika[0] got slotted with addslot script and become asprika[1]. Then asprika is compounded with sinx card.

after removing the card, I still have the asprika compounded with sinx card, and a new sinx card in my inventory.

You got Assassin Cross Card (1).
Asprika of Shadow is taken off.
You got Asprika of Shadow(1)

Here's the code for successremovecards:

BUILDIN_FUNC(successremovecards) {
int i=-1,c,cardflag=0;


TBL_PC* sd = script_rid2sd(st);
int num = script_getnum(st,2);


if (num > 0 && num <= ARRAYLENGTH(equip))
i=pc_checkequip(sd,equip[num-1]);


if (i < 0 || !sd->inventory_data[i]) {
return 0;
}


if(itemdb_isspecial(sd->status.inventory[i].card[0]))
return 0;


for( c = MAX_SLOTS - 1; c >= 0; --c ) //add-removeslots
{
if( sd->status.inventory[i].card[c] && itemdb_type(sd->status.inventory[i].card[c]) == IT_CARD && sd->status.inventory[i].card[c] != CARD_SLOT_ID ) //add-removeslots
{// extract this card from the item 
unsigned char flag = 0;
struct item item_tmp;
memset(&item_tmp,0,sizeof(item_tmp));
cardflag = 1;
item_tmp.nameid   = sd->status.inventory[i].card[c];
item_tmp.identify = 1;


if((flag=pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){ // get back the cart in inventory
clif_additem(sd,0,0,flag);
//map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
if (c > sd->inventory_data[i]->slot-1) //addslot
sd->status.inventory[i].card[c] = CARD_SLOT_ID; //addslot
}
}
}


if(cardflag == 1) {//if card was remove remplace item with no card
unsigned char flag = 0, j;
struct item item_tmp;
memset(&item_tmp,0,sizeof(item_tmp));


item_tmp.nameid      = sd->status.inventory[i].nameid;
item_tmp.identify    = 1;
item_tmp.refine      = sd->status.inventory[i].refine;
item_tmp.attribute   = sd->status.inventory[i].attribute;
item_tmp.expire_time = sd->status.inventory[i].expire_time;
item_tmp.bound       = sd->status.inventory[i].bound;


for (j = 0; j < MAX_SLOTS; j++) //addslot
item_tmp.card[j]=0; //addslot
for (j = sd->inventory_data[i]->slot; j < MAX_SLOTS; j++)
item_tmp.card[j]=sd->status.inventory[i].card[j];


pc_delitem(sd,i,1,0,3,LOG_TYPE_SCRIPT);
if((flag=pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){ //chk if can be spawn in inventory otherwise put on floor
clif_additem(sd,0,0,flag);
map_addflooritem(&item_tmp,1,sd->bl.m,sd->bl.x,sd->bl.y,0,0,0,0);
}


clif_misceffect(&sd->bl,3);
}
return SCRIPT_CMD_SUCCESS;
}

Thanks in advance!

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...