Added a flag to indicate if the script of an autobonus was parsed for the sake of resource saving.
git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@14129 54d463be-8e91-2dee-dedb-b68131a5f0ec
This commit is contained in:
parent
b0d3e8b0cf
commit
1d4c819268
@ -3,6 +3,8 @@ Date Added
|
|||||||
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
|
AS OF SVN REV. 5091, WE ARE NOW USING TRUNK. ALL UNTESTED BUGFIXES/FEATURES GO INTO TRUNK.
|
||||||
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
|
IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
|
||||||
|
|
||||||
|
09/11/08
|
||||||
|
* Added a flag to indicate if the script of an autobonus was parsed for the sake of resourse saving. [Inkfish]
|
||||||
09/11/04
|
09/11/04
|
||||||
* All Songs/Dances now create a 3 second delay before Adaption can be used. [Inkfish]
|
* All Songs/Dances now create a 3 second delay before Adaption can be used. [Inkfish]
|
||||||
* Fixed unit still not being able to move when fiberlock is removed by Magnetic Earth. [Inkfish]
|
* Fixed unit still not being able to move when fiberlock is removed by Magnetic Earth. [Inkfish]
|
||||||
|
15
src/map/pc.c
15
src/map/pc.c
@ -1665,7 +1665,7 @@ int pc_delautobonus(struct map_session_data* sd, struct s_autobonus *autobonus,c
|
|||||||
|
|
||||||
for( i = 0; i < max; i++ )
|
for( i = 0; i < max; i++ )
|
||||||
{
|
{
|
||||||
if( autobonus[i].active != INVALID_TIMER && ( !restore || (autobonus[i].pos && !(sd->state.autobonus&autobonus[i].pos)) ) )
|
if( autobonus[i].active != INVALID_TIMER && !(restore && sd->state.autobonus&autobonus[i].pos) )
|
||||||
{ // Logout / Unequipped an item with an activated bonus
|
{ // Logout / Unequipped an item with an activated bonus
|
||||||
delete_timer(autobonus[i].active,pc_endautobonus);
|
delete_timer(autobonus[i].active,pc_endautobonus);
|
||||||
autobonus[i].active = INVALID_TIMER;
|
autobonus[i].active = INVALID_TIMER;
|
||||||
@ -1681,6 +1681,9 @@ int pc_delautobonus(struct map_session_data* sd, struct s_autobonus *autobonus,c
|
|||||||
if( sd->state.autocast )
|
if( sd->state.autocast )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
if( autobonus[i].pos&sd->state.script_parsed && restore )
|
||||||
|
continue;
|
||||||
|
|
||||||
if( autobonus[i].bonus_script )
|
if( autobonus[i].bonus_script )
|
||||||
script_free_code(autobonus[i].bonus_script);
|
script_free_code(autobonus[i].bonus_script);
|
||||||
if( autobonus[i].other_script )
|
if( autobonus[i].other_script )
|
||||||
@ -6999,6 +7002,7 @@ int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
|
|||||||
* 0 - only unequip
|
* 0 - only unequip
|
||||||
* 1 - calculate status after unequipping
|
* 1 - calculate status after unequipping
|
||||||
* 2 - force unequip
|
* 2 - force unequip
|
||||||
|
* 4 - ignore autobonus flags
|
||||||
*------------------------------------------*/
|
*------------------------------------------*/
|
||||||
int pc_unequipitem(struct map_session_data *sd,int n,int flag)
|
int pc_unequipitem(struct map_session_data *sd,int n,int flag)
|
||||||
{
|
{
|
||||||
@ -7071,8 +7075,13 @@ int pc_unequipitem(struct map_session_data *sd,int n,int flag)
|
|||||||
status_change_end(&sd->bl, SC_ARMOR_RESIST, -1);
|
status_change_end(&sd->bl, SC_ARMOR_RESIST, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if( sd->state.autobonus&sd->status.inventory[n].equip )
|
if( !(flag&4) )
|
||||||
sd->state.autobonus &= ~sd->status.inventory[n].equip; //Check for activated autobonus [Inkfish]
|
{
|
||||||
|
if( sd->state.script_parsed&sd->status.inventory[n].equip )
|
||||||
|
sd->state.script_parsed &= ~sd->status.inventory[n].equip;
|
||||||
|
if( sd->state.autobonus&sd->status.inventory[n].equip )
|
||||||
|
sd->state.autobonus &= ~sd->status.inventory[n].equip; //Check for activated autobonus [Inkfish]
|
||||||
|
}
|
||||||
|
|
||||||
sd->status.inventory[n].equip=0;
|
sd->status.inventory[n].equip=0;
|
||||||
|
|
||||||
|
@ -130,7 +130,8 @@ struct map_session_data {
|
|||||||
unsigned int bg_id;
|
unsigned int bg_id;
|
||||||
unsigned skillonskill : 1;
|
unsigned skillonskill : 1;
|
||||||
unsigned short user_font;
|
unsigned short user_font;
|
||||||
unsigned short autobonus;
|
unsigned short script_parsed; //flag to indicate if the script of an autobonus is parsed. [Inkfish]
|
||||||
|
unsigned short autobonus; //flag to indicate if an autobonus is activated. [Inkfish]
|
||||||
} state;
|
} state;
|
||||||
struct {
|
struct {
|
||||||
unsigned char no_weapon_damage, no_magic_damage, no_misc_damage;
|
unsigned char no_weapon_damage, no_magic_damage, no_misc_damage;
|
||||||
|
@ -6436,7 +6436,7 @@ BUILDIN_FUNC(successrefitem)
|
|||||||
log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
|
log_pick_pc(sd, "N", sd->status.inventory[i].nameid, -1, &sd->status.inventory[i]);
|
||||||
|
|
||||||
sd->status.inventory[i].refine++;
|
sd->status.inventory[i].refine++;
|
||||||
pc_unequipitem(sd,i,2); // status calc will happen in pc_equipitem() below
|
pc_unequipitem(sd,i,2|4); // status calc will happen in pc_equipitem() below
|
||||||
|
|
||||||
clif_refine(sd->fd,0,i,sd->status.inventory[i].refine);
|
clif_refine(sd->fd,0,i,sd->status.inventory[i].refine);
|
||||||
clif_delitem(sd,i,1);
|
clif_delitem(sd,i,1);
|
||||||
@ -6638,6 +6638,8 @@ BUILDIN_FUNC(autobonus)
|
|||||||
return 0;
|
return 0;
|
||||||
if( sd->state.autobonus&sd->status.inventory[current_equip_item_index].equip )
|
if( sd->state.autobonus&sd->status.inventory[current_equip_item_index].equip )
|
||||||
return 0;
|
return 0;
|
||||||
|
if( sd->state.script_parsed&sd->status.inventory[current_equip_item_index].equip )
|
||||||
|
return 0;
|
||||||
|
|
||||||
bonus_script = parse_script(script_getstr(st,2), "autobonus bonus", 0, 0);
|
bonus_script = parse_script(script_getstr(st,2), "autobonus bonus", 0, 0);
|
||||||
rate = script_getnum(st,3);
|
rate = script_getnum(st,3);
|
||||||
@ -6678,6 +6680,8 @@ BUILDIN_FUNC(autobonus2)
|
|||||||
return 0;
|
return 0;
|
||||||
if( sd->state.autobonus&sd->status.inventory[current_equip_item_index].equip )
|
if( sd->state.autobonus&sd->status.inventory[current_equip_item_index].equip )
|
||||||
return 0;
|
return 0;
|
||||||
|
if( sd->state.script_parsed&sd->status.inventory[current_equip_item_index].equip )
|
||||||
|
return 0;
|
||||||
|
|
||||||
bonus_script = parse_script(script_getstr(st,2), "autobonus bonus", 0, 0);
|
bonus_script = parse_script(script_getstr(st,2), "autobonus bonus", 0, 0);
|
||||||
rate = script_getnum(st,3);
|
rate = script_getnum(st,3);
|
||||||
@ -6717,6 +6721,8 @@ BUILDIN_FUNC(autobonus3)
|
|||||||
return 0;
|
return 0;
|
||||||
if( sd->state.autobonus&sd->status.inventory[current_equip_item_index].equip )
|
if( sd->state.autobonus&sd->status.inventory[current_equip_item_index].equip )
|
||||||
return 0;
|
return 0;
|
||||||
|
if( sd->state.script_parsed&sd->status.inventory[current_equip_item_index].equip )
|
||||||
|
return 0;
|
||||||
|
|
||||||
bonus_script = parse_script(script_getstr(st,2), "autobonus bonus", 0, 0);
|
bonus_script = parse_script(script_getstr(st,2), "autobonus bonus", 0, 0);
|
||||||
rate = script_getnum(st,3);
|
rate = script_getnum(st,3);
|
||||||
|
@ -1856,6 +1856,7 @@ int status_calc_pc_(struct map_session_data* sd, bool first)
|
|||||||
if(first && sd->inventory_data[index]->equip_script)
|
if(first && sd->inventory_data[index]->equip_script)
|
||||||
{ //Execute equip-script on login
|
{ //Execute equip-script on login
|
||||||
run_script(sd->inventory_data[index]->equip_script,0,sd->bl.id,0);
|
run_script(sd->inventory_data[index]->equip_script,0,sd->bl.id,0);
|
||||||
|
sd->state.script_parsed |= sd->status.inventory[index].equip;
|
||||||
if (!calculating)
|
if (!calculating)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user