Browse Source

Merge pull request #1589 from rathena/hotfix/issue1587

Fixed random options being removed on card removal
Jittapan Pluemsumran 8 years ago
parent
commit
01b1052570
1 changed files with 13 additions and 2 deletions
  1. 13 2
      src/map/script.c

+ 13 - 2
src/map/script.c

@@ -12645,6 +12645,12 @@ BUILDIN_FUNC(successremovecards) {
 
 
 		for (j = sd->inventory_data[i]->slot; j < MAX_SLOTS; j++)
 		for (j = sd->inventory_data[i]->slot; j < MAX_SLOTS; j++)
 			item_tmp.card[j]=sd->status.inventory[i].card[j];
 			item_tmp.card[j]=sd->status.inventory[i].card[j];
+		
+		for (j = 0; j < MAX_ITEM_RDM_OPT; j++){
+			item_tmp.option[j].id=sd->status.inventory[i].option[j].id;
+			item_tmp.option[j].value=sd->status.inventory[i].option[j].value;
+			item_tmp.option[j].param=sd->status.inventory[i].option[j].param;
+		}
 
 
 		pc_delitem(sd,i,1,0,3,LOG_TYPE_SCRIPT);
 		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
 		if((flag=pc_additem(sd,&item_tmp,1,LOG_TYPE_SCRIPT))){	//chk if can be spawn in inventory otherwise put on floor
@@ -12703,8 +12709,7 @@ BUILDIN_FUNC(failedremovecards) {
 	if(cardflag == 1) {
 	if(cardflag == 1) {
 		if(typefail == 0 || typefail == 2){	// destroy the item
 		if(typefail == 0 || typefail == 2){	// destroy the item
 			pc_delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
 			pc_delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
-		}
-		if(typefail == 1){	// destroy the card
+		}else if(typefail == 1){ // destroy the card
 			unsigned char flag = 0, j;
 			unsigned char flag = 0, j;
 			struct item item_tmp;
 			struct item item_tmp;
 
 
@@ -12719,6 +12724,12 @@ BUILDIN_FUNC(failedremovecards) {
 
 
 			for (j = sd->inventory_data[i]->slot; j < MAX_SLOTS; j++)
 			for (j = sd->inventory_data[i]->slot; j < MAX_SLOTS; j++)
 				item_tmp.card[j]=sd->status.inventory[i].card[j];
 				item_tmp.card[j]=sd->status.inventory[i].card[j];
+			
+			for (j = 0; j < MAX_ITEM_RDM_OPT; j++){
+				item_tmp.option[j].id=sd->status.inventory[i].option[j].id;
+				item_tmp.option[j].value=sd->status.inventory[i].option[j].value;
+				item_tmp.option[j].param=sd->status.inventory[i].option[j].param;
+			}
 
 
 			pc_delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);
 			pc_delitem(sd,i,1,0,2,LOG_TYPE_SCRIPT);