Index: src/map/script.c
===================================================================
--- src/map/script.c (revision 409)
+++ src/map/script.c (working copy)
@@ -7864,6 +7864,7 @@
int val4 = 0;
int val5 = 0;
TBL_PC* sd;
+ int nb_args=0;
sd = script_rid2sd(st);
if( sd == NULL )
@@ -7895,7 +7896,8 @@
break;
}
- switch( script_lastdata(st)-2 ) {
+ nb_args = script_lastdata(st)-2;
+ switch( nb_args ) {
case 1:
pc_bonus(sd, type, val1);
break;
@@ -7933,6 +7935,8 @@
ShowDebug("buildin_bonus: unexpected number of arguments (%d)\n", (script_lastdata(st) - 1));
break;
}
+ if(nb_args <= 5)
+ clif_sp_refresh(sd,type);
return 0;
}
Index: src/map/clif.c
===================================================================
--- src/map/clif.c (revision 408)
+++ src/map/clif.c (working copy)
@@ -54,6 +54,7 @@
/* for clif_clearunit_delayed */
static struct eri *delay_clearunit_ers;
+static DBMap* clif_sprefresh_db; //refreshable SP hash
//#define DUMP_UNKNOWN_PACKET
//#define DUMP_INVALID_PACKET
@@ -2730,6 +2731,30 @@
return 0;
}
+/*
+ * Helper fonction to refresh status after a bonus
+ * Derivated from Hulk pc_updatestatus
+ * if type == -1 refresh all
+ */
+void clif_sp_refresh(struct map_session_data *sd,int type){
+ int i=0, dtype=0;
+ ShowInfo("Entering clif_sp_refresh\n");
+ if(type != -1 && idb_exists(clif_sprefresh_db,type)){
+ dtype=idb_iget(clif_sprefresh_db,type);
+ if(dtype){
+ ShowInfo("Refreshing type(key)=%d => dtype(associate type)=%d, sp_atk1=%d, sp_atk2=%d\n",type,dtype,SP_ATK1,SP_ATK2);
+ clif_updatestatus(sd,dtype);
+ }
+ }
+ else { //refresh all
+ int size = db_size(clif_sprefresh_db);
+ for(i=0; i<size; i++){
+ dtype=idb_iget(clif_sprefresh_db,i);
+ clif_updatestatus(sd,dtype);
+ }
+ }
+}
+
/// Notifies client of a character parameter change.
/// 00b0 <var id>.W <value>.L (ZC_PAR_CHANGE)
/// 00b1 <var id>.W <value>.L (ZC_LONGPAR_CHANGE)
@@ -15353,7 +15378,7 @@
nullpo_retv(sd);
WBUFW(buf,0) = 0x2cb;
- safestrncpy( WBUFP(buf,2), name, 62 );
+ safestrncpy((char *) WBUFP(buf,2), name, 62 );
WBUFW(buf,63) = num;
if(flag) // A timer has changed or been added
clif_send(buf,packet_len(0x2cb),&sd->bl,PARTY);
@@ -15390,7 +15415,7 @@
nullpo_retv(sd);
WBUFW(buf,0) = 0x2cd;
- safestrncpy( WBUFP(buf,2), name, 62 );
+ safestrncpy((char *) WBUFP(buf,2), name, 62 );
WBUFL(buf,63) = limit1;
WBUFL(buf,67) = limit2;
if(flag) // A timer has changed or been added
@@ -17396,6 +17421,64 @@
ShowStatus("Using default packet version: "CL_WHITE"%d"CL_RESET".\n", clif_config.packet_db_ver);
}
+void clif_create_sprefresh_db(void){
+ clif_sprefresh_db = idb_alloc(DB_OPT_BASE);
+ idb_iput(clif_sprefresh_db, SP_WEIGHT, SP_WEIGHT);
+ idb_iput(clif_sprefresh_db, SP_MAXWEIGHT, SP_MAXWEIGHT);
+ idb_iput(clif_sprefresh_db, SP_SPEED, SP_SPEED);
+ idb_iput(clif_sprefresh_db, SP_BASELEVEL, SP_BASELEVEL);
+ idb_iput(clif_sprefresh_db, SP_JOBLEVEL, SP_JOBLEVEL);
+ idb_iput(clif_sprefresh_db, SP_KARMA, SP_KARMA);
+ idb_iput(clif_sprefresh_db, SP_STATUSPOINT, SP_STATUSPOINT);
+ idb_iput(clif_sprefresh_db, SP_SKILLPOINT, SP_SKILLPOINT);
+ idb_iput(clif_sprefresh_db, SP_HIT, SP_HIT);
+ idb_iput(clif_sprefresh_db, SP_FLEE1, SP_FLEE1);
+ idb_iput(clif_sprefresh_db, SP_FLEE2, SP_FLEE2);
+ idb_iput(clif_sprefresh_db, SP_MAXHP, SP_MAXHP);
+ idb_iput(clif_sprefresh_db, SP_MAXSP, SP_MAXSP);
+ idb_iput(clif_sprefresh_db, SP_HP, SP_HP);
+ idb_iput(clif_sprefresh_db, SP_SP, SP_SP);
+ idb_iput(clif_sprefresh_db, SP_ASPD, SP_ASPD);
+ idb_iput(clif_sprefresh_db, SP_ATK1, SP_ATK1);
+ idb_iput(clif_sprefresh_db, SP_BASE_ATK, SP_ATK1);
+ idb_iput(clif_sprefresh_db, SP_DEF1, SP_DEF1);
+ idb_iput(clif_sprefresh_db, SP_MDEF1, SP_MDEF1);
+ idb_iput(clif_sprefresh_db, SP_ATK2, SP_ATK2);
+ idb_iput(clif_sprefresh_db, SP_DEF2, SP_DEF2);
+ idb_iput(clif_sprefresh_db, SP_MDEF2, SP_MDEF2);
+ idb_iput(clif_sprefresh_db, SP_CRITICAL, SP_CRITICAL);
+ idb_iput(clif_sprefresh_db, SP_MATK1, SP_MATK1);
+ idb_iput(clif_sprefresh_db, SP_MATK2, SP_MATK2);
+ idb_iput(clif_sprefresh_db, SP_ZENY, SP_ZENY);
+ idb_iput(clif_sprefresh_db, SP_BASEEXP, SP_BASEEXP);
+ idb_iput(clif_sprefresh_db, SP_JOBEXP, SP_JOBEXP);
+ idb_iput(clif_sprefresh_db, SP_NEXTBASEEXP, SP_NEXTBASEEXP);
+ idb_iput(clif_sprefresh_db, SP_NEXTJOBEXP, SP_NEXTJOBEXP);
+ idb_iput(clif_sprefresh_db, SP_USTR, SP_USTR);
+ idb_iput(clif_sprefresh_db, SP_UAGI, SP_UAGI);
+ idb_iput(clif_sprefresh_db, SP_UVIT, SP_UVIT);
+ idb_iput(clif_sprefresh_db, SP_UINT, SP_UINT);
+ idb_iput(clif_sprefresh_db, SP_UDEX, SP_UDEX);
+ idb_iput(clif_sprefresh_db, SP_ULUK, SP_ULUK);
+ idb_iput(clif_sprefresh_db, SP_ATTACKRANGE, SP_ATTACKRANGE);
+ idb_iput(clif_sprefresh_db, SP_STR, SP_STR);
+ idb_iput(clif_sprefresh_db, SP_AGI, SP_AGI);
+ idb_iput(clif_sprefresh_db, SP_VIT, SP_VIT);
+ idb_iput(clif_sprefresh_db, SP_INT, SP_INT);
+ idb_iput(clif_sprefresh_db, SP_DEX, SP_DEX);
+ idb_iput(clif_sprefresh_db, SP_LUK, SP_LUK);
+ idb_iput(clif_sprefresh_db, SP_CARTINFO, SP_CARTINFO);
+
+ /*
+ int clif_sprefresh[] = {
+ SP_WEIGHT,SP_MAXWEIGHT,SP_SPEED,SP_BASELEVEL,SP_JOBLEVEL,SP_KARMA,
+ SP_MANNER,SP_STATUSPOINT,SP_SKILLPOINT,SP_HIT,SP_FLEE1,SP_FLEE2,SP_MAXHP,
+ SP_MAXSP,SP_HP,SP_SP,SP_ASPD,SP_ATK1,SP_DEF1,SP_MDEF1,SP_ATK2,SP_DEF2,SP_MDEF2,
+ SP_CRITICAL,SP_MATK1,SP_MATK2,SP_ZENY,SP_BASEEXP,SP_JOBEXP,SP_NEXTBASEEXP,SP_NEXTJOBEXP,
+ SP_USTR,SP_UAGI,SP_UVIT,SP_UINT,SP_UDEX,SP_ULUK,SP_ATTACKRANGE,SP_STR,SP_AGI,SP_VIT,SP_INT,SP_DEX,SP_LUK,SP_CARTINFO};
+ */
+}
+
/*==========================================
*
*------------------------------------------*/
@@ -17415,6 +17498,7 @@
//Using the packet_db file is the only way to set up packets now [Skotlex]
packetdb_readdb();
+ clif_create_sprefresh_db();
set_defaultparse(clif_parse);
if( make_listen_bind(bind_ip,map_port) == -1 ) {
@@ -17431,4 +17515,5 @@
void do_final_clif(void) {
ers_destroy(delay_clearunit_ers);
+ db_destroy(clif_sprefresh_db);
}
Index: src/map/clif.h
===================================================================
--- src/map/clif.h (revision 408)
+++ src/map/clif.h (working copy)
@@ -784,6 +784,6 @@
void clif_channel_msg(struct Channel *channel, struct map_session_data *sd, char *msg, short color);
#define clif_menuskill_clear(sd) (sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0;
+void clif_sp_refresh(struct map_session_data *sd,int type);
-
#endif /* _CLIF_H_ */
Index: src/map/pc.c
===================================================================
--- src/map/pc.c (revision 409)
+++ src/map/pc.c (working copy)
@@ -8597,42 +8597,6 @@
}
/*==========================================
- * Temporary force update status like status_calc_bl_ but skip checkings to refresh [Aelys|sphkz] bugreport #66 [Fix 2 merde]
- *------------------------------------------*/
-void pc_updatestatus(struct map_session_data *sd)
-{
- clif_updatestatus(sd,SP_STR);
- clif_updatestatus(sd,SP_AGI);
- clif_updatestatus(sd,SP_VIT);
- clif_updatestatus(sd,SP_INT);
- clif_updatestatus(sd,SP_DEX);
- clif_updatestatus(sd,SP_LUK);
- clif_updatestatus(sd,SP_HIT);
- clif_updatestatus(sd,SP_FLEE1);
- clif_updatestatus(sd,SP_ASPD);
- clif_updatestatus(sd,SP_SPEED);
- clif_updatestatus(sd,SP_ATK1);
- clif_updatestatus(sd,SP_DEF1);
- clif_updatestatus(sd,SP_DEF2);
- clif_updatestatus(sd,SP_ATK2);
- clif_updatestatus(sd,SP_DEF2);
- clif_updatestatus(sd,SP_DEF1);
- clif_updatestatus(sd,SP_FLEE2);
- clif_updatestatus(sd,SP_CRITICAL);
- clif_updatestatus(sd,SP_MATK2);
- clif_updatestatus(sd,SP_MATK1);
- clif_updatestatus(sd,SP_MDEF1);
- clif_updatestatus(sd,SP_MDEF2);
- clif_updatestatus(sd,SP_MDEF2);
- clif_updatestatus(sd,SP_MDEF1);
- clif_updatestatus(sd,SP_ATTACKRANGE);
- clif_updatestatus(sd,SP_MAXHP);
- clif_updatestatus(sd,SP_MAXSP);
- clif_updatestatus(sd,SP_HP);
- clif_updatestatus(sd,SP_SP);
-}
-
-/*==========================================
* Equip item on player sd at req_pos from inventory index n
*------------------------------------------*/
int pc_equipitem(struct map_session_data *sd,int n,int req_pos)
@@ -8839,9 +8803,6 @@
}
}
- //Force to refresh all status calculation on status windows [Aelys|sphkz] Temporary fix for bugreport#66
- pc_updatestatus(sd);
-
sd->npc_item_flag = iflag;
return 0;
@@ -9011,9 +8972,6 @@
}
}
- //Force to refresh all status calculation on status windows [Aelys|sphkz] Temporary fix for bugreport#66
- pc_updatestatus(sd);
-
sd->npc_item_flag = iflag;
return 0;
Index: src/common/conf.h
===================================================================
--- src/common/conf.h (revision 408)
+++ src/common/conf.h (working copy)
@@ -5,7 +5,7 @@
#define _CONF_H_
#include "../common/cbasetypes.h"
-#include "libconfig.h"
+#include "../../3rdparty/libconfig/libconfig.h"
int conf_read_file(config_t *config, const char *config_filename);
int config_setting_copy(config_setting_t *parent, const config_setting_t *src);