summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-21 03:22:41 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-04-21 03:22:41 +0000
commit683e4c655690b314d535777d976fb767687e3981 (patch)
tree40e6871f66309034d5280a316c049f25191561d6
parent5920ad3c5e0517cdb0c46845a431ca791f0d2832 (diff)
downloadhercules-683e4c655690b314d535777d976fb767687e3981.tar.gz
hercules-683e4c655690b314d535777d976fb767687e3981.tar.bz2
hercules-683e4c655690b314d535777d976fb767687e3981.tar.xz
hercules-683e4c655690b314d535777d976fb767687e3981.zip
- Fixed the equip/unequip scripts not triggering for compounded cards.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6207 54d463be-8e91-2dee-dedb-b68131a5f0ec
-rw-r--r--Changelog-Trunk.txt2
-rw-r--r--src/map/pc.c45
2 files changed, 42 insertions, 5 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt
index 5a56255dc..56712d3f5 100644
--- a/Changelog-Trunk.txt
+++ b/Changelog-Trunk.txt
@@ -4,6 +4,8 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
2006/04/20
+ * Fixed the equip/unequip scripts not triggering for compounded cards.
+ [Skotlex]
* Char server will now ignore packet 0x65 for already authentified
accounts. [Skotlex]
* Added two columns to item_db: equip_script and unequip_script are scripts
diff --git a/src/map/pc.c b/src/map/pc.c
index c7cf8b24f..9602a9b2c 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -6207,9 +6207,26 @@ int pc_equipitem(struct map_session_data *sd,int n,int pos)
}
status_calc_pc(sd,0);
//OnEquip script [Skotlex]
- if (sd->inventory_data[n] && sd->inventory_data[n]->equip_script)
- run_script(sd->inventory_data[n]->equip_script,0,sd->bl.id,0);
-
+ if (sd->inventory_data[n]) {
+ int i;
+ struct item_data *data;
+ if (sd->inventory_data[n]->equip_script)
+ run_script(sd->inventory_data[n]->equip_script,0,sd->bl.id,0);
+ if(sd->status.inventory[n].card[0]==0x00ff ||
+ sd->status.inventory[n].card[0]==0x00fe ||
+ sd->status.inventory[n].card[0]==(short)0xff00)
+ ; //No cards
+ else
+ for(i=0;i<sd->inventory_data[n]->slot; i++)
+ {
+ if (!sd->status.inventory[n].card[i])
+ continue;
+ data = itemdb_exists(sd->status.inventory[n].card[i]);
+ if (data && data->equip_script)
+ run_script(data->equip_script,0,sd->bl.id,0);
+ }
+ }
+
if(sd->sc.count) {
if (sd->sc.data[SC_SIGNUMCRUCIS].timer != -1 && !battle_check_undead(7,sd->def_ele))
status_change_end(&sd->bl,SC_SIGNUMCRUCIS,-1);
@@ -6239,6 +6256,7 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag)
if(battle_config.battle_log)
ShowInfo("unequip %d %x:%x\n",n,pc_equippoint(sd,n),sd->status.inventory[n].equip);
+
if(!sd->status.inventory[n].equip){ //Nothing to unequip
clif_unequipitemack(sd,n,0,0);
return 0;
@@ -6284,8 +6302,25 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag)
status_change_end(&sd->bl,SC_SIGNUMCRUCIS,-1);
}
//OnUnEquip script [Skotlex]
- if (sd->inventory_data[n] && sd->inventory_data[n]->unequip_script)
- run_script(sd->inventory_data[n]->unequip_script,0,sd->bl.id,0);
+ if (sd->inventory_data[n]) {
+ int i;
+ struct item_data *data;
+ if (sd->inventory_data[n]->unequip_script)
+ run_script(sd->inventory_data[n]->unequip_script,0,sd->bl.id,0);
+ if(sd->status.inventory[n].card[0]==0x00ff ||
+ sd->status.inventory[n].card[0]==0x00fe ||
+ sd->status.inventory[n].card[0]==(short)0xff00)
+ ; //No cards
+ else
+ for(i=0;i<sd->inventory_data[n]->slot; i++)
+ {
+ if (!sd->status.inventory[n].card[i])
+ continue;
+ data = itemdb_exists(sd->status.inventory[n].card[i]);
+ if (data && data->unequip_script)
+ run_script(data->unequip_script,0,sd->bl.id,0);
+ }
+ }
return 0;
}