diff options
-rw-r--r-- | Changelog-Trunk.txt | 15 | ||||
-rw-r--r-- | conf-tmpl/inter_athena.conf | 7 | ||||
-rw-r--r-- | sql-files/upgrade_svn5902.sql | 14 | ||||
-rw-r--r-- | src/char/char.c | 34 | ||||
-rw-r--r-- | src/char_sql/char.c | 15 | ||||
-rw-r--r-- | src/char_sql/char.h | 3 | ||||
-rw-r--r-- | src/char_sql/inter.c | 45 | ||||
-rw-r--r-- | src/login_sql/login.c | 20 | ||||
-rw-r--r-- | src/map/clif.c | 16 | ||||
-rw-r--r-- | src/map/map.c | 58 | ||||
-rw-r--r-- | src/map/npc.c | 4 | ||||
-rw-r--r-- | src/map/pc.c | 46 | ||||
-rw-r--r-- | src/map/status.c | 45 |
13 files changed, 216 insertions, 106 deletions
diff --git a/Changelog-Trunk.txt b/Changelog-Trunk.txt index 137304880..c3b8d09d4 100644 --- a/Changelog-Trunk.txt +++ b/Changelog-Trunk.txt @@ -3,6 +3,21 @@ Date Added 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.
+2006/04/04
+ * Added inter config connection_ping_interval which specifies interval in
+ hours at which mysql_ping's must be done on all connection handles to keep
+ the mysql connection alive. Defaults to 0 (disabled) [Skotlex]
+ * Made the login sql handle on the char-sql server be used only when
+ gm_read_method 1 is enabled. [Skotlex]
+ * Small fixes to npc_enable, added BL_NPC handling on status_get_sc.
+ [Skotlex]
+ - Some changes to close-confine, status start will fail when the source is
+ not found or it doesn't has sc-data. [Skotlex]
+ - pc_setoption no longer changes the character's class when
+ mounting/dismounting, it only changes the view-class. [Skotlex]
+ * Modified the char-txt server to modify the class of mounted characters to
+ their non-mounted version. Added an upgrade_svn5902 file to handle the
+ class update on the sql tables. [Skotlex]
2006/04/03
* Fixed pc_setpos using unit_remove_map with type 0 instead of 3, which
confuses clients and makes them think the character in question is still
diff --git a/conf-tmpl/inter_athena.conf b/conf-tmpl/inter_athena.conf index b8ee9f976..fd6459d09 100644 --- a/conf-tmpl/inter_athena.conf +++ b/conf-tmpl/inter_athena.conf @@ -69,6 +69,13 @@ read_gm_interval: 10 // (Note that this feature requires MySQL 4.1+)
//default_codepage:
+// Interval (in hours) at which servers do a ping on all sql-connections
+// to keep them alive (the default mysql settings makes a connection time-out
+// after 8 hours of inactivity).
+// 0 disables (default). Enable it only if you are getting
+// "MySQL server has gone Away" errors due to lack of activity on your server
+//connection_ping_interval: 3
+
// MySQL Login SQL Server
login_server_ip: 127.0.0.1
login_server_port: 3306
diff --git a/sql-files/upgrade_svn5902.sql b/sql-files/upgrade_svn5902.sql new file mode 100644 index 000000000..f9783ef00 --- /dev/null +++ b/sql-files/upgrade_svn5902.sql @@ -0,0 +1,14 @@ +update `char` set `class`='7' where `class`='13';
+update `char` set `class`='21' where `class`='14';
+update `char` set `class`='4008' where `class`='4014';
+update `char` set `class`='4015' where `class`='4022';
+update `char` set `class`='4030' where `class`='4036';
+update `char` set `class`='4037' where `class`='4044';
+update `char` set `class`='4047' where `class`='4048';
+update `guild_member` set `class`='7' where `class`='13';
+update `guild_member` set `class`='21' where `class`='14';
+update `guild_member` set `class`='4008' where `class`='4014';
+update `guild_member` set `class`='4015' where `class`='4022';
+update `guild_member` set `class`='4030' where `class`='4036';
+update `guild_member` set `class`='4037' where `class`='4044';
+update `guild_member` set `class`='4047' where `class`='4048';
diff --git a/src/char/char.c b/src/char/char.c index c50dbe126..8afd7c5af 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -565,6 +565,31 @@ int mmo_char_fromstr(char *str, struct mmo_charstatus *p, struct global_reg *reg p->account_id = tmp_int[1];
p->char_num = tmp_int[2];
p->class_ = tmp_int[3];
+ //Temporal fix until all chars are reverted from peco-flying-class to
+ //normal classes. [Skotlex]
+ switch (p->class_) {
+ case 13: //Job_Knight2
+ p->class_ = 7;
+ break;
+ case 21: //Job_Crusader2
+ p->class_ = 14;
+ break;
+ case 4014: //Job_Lord_Knight2
+ p->class_ = 4008;
+ break;
+ case 4022: //Job_Paladin2
+ p->class_ = 4015;
+ break;
+ case 4036: //Job_Baby_Knight2
+ p->class_ = 4030;
+ break;
+ case 4044: //Job_Baby_Crusader2
+ p->class_ = 4037;
+ break;
+ case 4048: //Job_Star_Gladiator2
+ p->class_ = 4047;
+ break;
+ }
p->base_level = tmp_int[4];
p->job_level = tmp_int[5];
p->base_exp = tmp_uint[0];
@@ -1645,14 +1670,7 @@ int mmo_char_send006b(int fd, struct char_session_data *sd) { WFIFOW(fd,j+50) = DEFAULT_WALK_SPEED; // p->speed;
WFIFOW(fd,j+52) = p->class_;
WFIFOW(fd,j+54) = p->hair;
-
- // pecopeco knights/crusaders crash fix
- if (p->class_ == 13 || p->class_ == 21 ||
- p->class_ == 4014 || p->class_ == 4022 ||
- p->class_ == 4036 || p->class_ == 4044)
- WFIFOW(fd,j+56) = 0;
- else WFIFOW(fd,j+56) = p->weapon;
-
+ WFIFOW(fd,j+56) = p->option&0x20?0:p->weapon; //When the weapon is sent and your option is riding, the client crashes on login!?
WFIFOW(fd,j+58) = p->base_level;
WFIFOW(fd,j+60) = (p->skill_point>SHRT_MAX)? SHRT_MAX : p->skill_point;
WFIFOW(fd,j+62) = p->head_bottom;
diff --git a/src/char_sql/char.c b/src/char_sql/char.c index dbd7e2dc9..4a17a3679 100644 --- a/src/char_sql/char.c +++ b/src/char_sql/char.c @@ -64,6 +64,7 @@ char pet_db[256] = "pet"; char gm_db[256] = "gm_accounts";
char friend_db[256] = "friends";
int db_use_sqldbs;
+int connection_ping_interval = 0;
char login_db_account_id[32] = "account_id";
char login_db_level[32] = "level";
@@ -1735,14 +1736,7 @@ int mmo_char_send006b(int fd, struct char_session_data *sd) { WFIFOW(fd,j+50) = DEFAULT_WALK_SPEED; // p->speed;
WFIFOW(fd,j+52) = p->class_;
WFIFOW(fd,j+54) = p->hair;
-
- // pecopeco knights/crusaders crash fix
- if (p->class_ == 13 || p->class_ == 21 ||
- p->class_ == 4014 || p->class_ == 4022 ||
- p->class_ == 4036 || p->class_ == 4044)
- WFIFOW(fd,j+56) = 0;
- else WFIFOW(fd,j+56) = p->weapon;
-
+ WFIFOW(fd,j+56) = p->option&0x20?0:p->weapon; //When the weapon is sent and your option is riding, the client crashes on login!?
WFIFOW(fd,j+58) = p->base_level;
WFIFOW(fd,j+60) = (p->skill_point > SHRT_MAX) ? SHRT_MAX : p->skill_point;
WFIFOW(fd,j+62) = p->head_bottom;
@@ -3813,7 +3807,8 @@ void do_final(void) { online_char_db->destroy(online_char_db, NULL);
mysql_close(&mysql_handle);
- mysql_close(&lmysql_handle);
+ if(char_gm_read)
+ mysql_close(&lmysql_handle);
ShowInfo("ok! all done...\n");
}
@@ -3891,6 +3886,8 @@ void sql_config_read(const char *cfgName){ /* Kalaspuff, to get login_db */ }else if(strcmpi(w1,"use_sql_db")==0){ // added for sql item_db read for char server [Valaris]
db_use_sqldbs = config_switch(w2);
ShowStatus("Using SQL dbs: %s\n",w2);
+ } else if(strcmpi(w1,"connection_ping_interval")==0) {
+ connection_ping_interval = config_switch(w2);
//custom columns for login database
}else if(strcmpi(w1,"login_db_level")==0){
strcpy(login_db_level,w2);
diff --git a/src/char_sql/char.h b/src/char_sql/char.h index 53550dcd3..51c4426db 100644 --- a/src/char_sql/char.h +++ b/src/char_sql/char.h @@ -59,6 +59,7 @@ int char_child(int parent_id, int child_id); int request_accreg2(int account_id, int char_id);
int save_accreg2(unsigned char* buf, int len);
+extern bool char_gm_read;
extern int autosave_interval;
extern int save_log;
extern int charsave_method;
@@ -85,6 +86,8 @@ extern char party_db[256]; extern char pet_db[256];
extern int db_use_sqldbs; // added for sql item_db read for char server [Valaris]
+extern int connection_ping_interval;
+
extern char login_db_level[32];
extern char login_db_account_id[32];
diff --git a/src/char_sql/inter.c b/src/char_sql/inter.c index 5a220ef7f..38fd1f289 100644 --- a/src/char_sql/inter.c +++ b/src/char_sql/inter.c @@ -303,6 +303,17 @@ int inter_log(char *fmt,...) return 0;
}
+/*======================================================
+ * Does a mysql_ping to all connection handles. [Skotlex]
+ *------------------------------------------------------
+ */
+int inter_sql_ping(int tid, unsigned int tick, int id, int data)
+{
+ mysql_ping(&mysql_handle);
+ if(char_gm_read)
+ mysql_ping(&lmysql_handle);
+ return 0;
+}
// initialize
int inter_init(const char *file)
@@ -325,15 +336,17 @@ int inter_init(const char *file) ShowStatus("Connect Success! (Character Server)\n");
}
- mysql_init(&lmysql_handle);
- ShowInfo("Connect Character DB server.... (login server)\n");
- if(!mysql_real_connect(&lmysql_handle, login_server_ip, login_server_id, login_server_pw,
- login_server_db ,login_server_port, (char *)NULL, 0)) {
- //pointer check
- ShowFatalError("%s\n",mysql_error(&lmysql_handle));
- exit(1);
- }else {
- ShowStatus ("Connect Success! (Login Server)\n");
+ if(char_gm_read) {
+ mysql_init(&lmysql_handle);
+ ShowInfo("Connect Character DB server.... (login server)\n");
+ if(!mysql_real_connect(&lmysql_handle, login_server_ip, login_server_id, login_server_pw,
+ login_server_db ,login_server_port, (char *)NULL, 0)) {
+ //pointer check
+ ShowFatalError("%s\n",mysql_error(&lmysql_handle));
+ exit(1);
+ }else {
+ ShowStatus ("Connect Success! (Login Server)\n");
+ }
}
if(strlen(default_codepage) > 0 ) {
sprintf( tmp_sql, "SET NAMES %s", default_codepage );
@@ -341,10 +354,11 @@ int inter_init(const char *file) ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
}
- if (mysql_query(&lmysql_handle, tmp_sql)) {
- ShowSQL("DB error - %s\n",mysql_error(&lmysql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
+ if(char_gm_read)
+ if (mysql_query(&lmysql_handle, tmp_sql)) {
+ ShowSQL("DB error - %s\n",mysql_error(&lmysql_handle));
+ ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
+ }
}
wis_db = db_alloc(__FILE__,__LINE__,DB_INT,DB_OPT_RELEASE_DATA,sizeof(int));
inter_guild_sql_init();
@@ -357,6 +371,11 @@ int inter_init(const char *file) //printf ("interserver timer initializing : %d sec...\n",autosave_interval);
//i=add_timer_interval(gettick()+autosave_interval,inter_save_timer,0,0,autosave_interval);
+ if (connection_ping_interval) {
+ add_timer_func_list(inter_sql_ping, "inter_sql_ping");
+ add_timer_interval(gettick()+connection_ping_interval*60*1000,
+ inter_sql_ping, 0, 0, connection_ping_interval*60*1000);
+ }
return 0;
}
diff --git a/src/login_sql/login.c b/src/login_sql/login.c index ef5cbb7ec..d464cf2b0 100644 --- a/src/login_sql/login.c +++ b/src/login_sql/login.c @@ -121,6 +121,7 @@ char login_db[256] = "login"; int log_login=1; //Whether to log the logins or not. [Skotlex]
char loginlog_db[256] = "loginlog";
bool login_gm_read = true;
+int connection_ping_interval = 0;
// added to help out custom login tables, without having to recompile
// source so options are kept in the login_athena.conf or the inter_athena.conf
@@ -352,6 +353,16 @@ int e_mail_check(char *email) { return 1;
}
+/*======================================================
+ * Does a mysql_ping to all connection handles. [Skotlex]
+ *------------------------------------------------------
+ */
+int login_sql_ping(int tid, unsigned int tick, int id, int data)
+{
+ mysql_ping(&mysql_handle);
+ return 0;
+}
+
//-----------------------------------------------------
// Read Account database - mysql db
//-----------------------------------------------------
@@ -392,6 +403,12 @@ int mmo_auth_sqldb_init(void) { ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
}
}
+
+ if (connection_ping_interval) {
+ add_timer_func_list(login_sql_ping, "login_sql_ping");
+ add_timer_interval(gettick()+connection_ping_interval*60*1000,
+ login_sql_ping, 0, 0, connection_ping_interval*60*1000);
+ }
return 0;
}
@@ -2172,6 +2189,9 @@ void sql_config_read(const char *cfgName){ /* Kalaspuff, to get login_db */ else if(strcmpi(w1,"login_server_db")==0){
strcpy(login_server_db, w2);
ShowStatus ("set login_server_db : %s\n",w2);
+ }
+ else if(strcmpi(w1,"connection_ping_interval")==0) {
+ connection_ping_interval = atoi(w2);
}
else if(strcmpi(w1,"default_codepage")==0){
strcpy(default_codepage, w2);
diff --git a/src/map/clif.c b/src/map/clif.c index 7aa584d9c..417fd448b 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -7970,7 +7970,13 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd) add_timer(gettick()+1000,clif_nighttimer,sd->bl.id,0);
// if(sd->status.class_ != sd->vd.class_)
-// clif_changelook(&sd->bl,LOOK_BASE,sd->vd.class_);
+// clif_refreshlook(&sd->bl,sd->bl.id,LOOK_BASE,sd->vd.class_,SELF);
+
+ if (sd->sc.option&OPTION_FALCON)
+ clif_status_load(&sd->bl, SI_FALCON, 1);
+ if (sd->sc.option&OPTION_RIDING)
+ clif_status_load(&sd->bl, SI_RIDING, 1);
+
if(sd->status.pet_id > 0 && sd->pd && sd->pet.intimate > 900)
clif_pet_emotion(sd->pd,(sd->pd->class_ - 100)*100 + 50 + pet_hungry_val(sd));
@@ -10592,9 +10598,11 @@ void clif_friendslist_send(struct map_session_data *sd) { memcpy(WFIFOP(sd->fd, 4 + 32 * i + 8), &sd->status.friends[i].name, NAME_LENGTH);
}
- WFIFOW(sd->fd,2) = 4 + 32 * i;
- WFIFOSET(sd->fd, WFIFOW(sd->fd,2));
-
+ if (i) {
+ WFIFOW(sd->fd,2) = 4 + 32 * i;
+ WFIFOSET(sd->fd, WFIFOW(sd->fd,2));
+ }
+
for (n = 0; n < i; n++)
{ //Sending the online players
if (map_charid2sd(sd->status.friends[n].char_id))
diff --git a/src/map/map.c b/src/map/map.c index e77433181..87cc16577 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -62,10 +62,6 @@ MYSQL_RES* sql_res ; MYSQL_ROW sql_row ;
char tmp_sql[65535]="";
-MYSQL lmysql_handle;
-MYSQL_RES* lsql_res ;
-MYSQL_ROW lsql_row ;
-
MYSQL logmysql_handle; //For the log database - fix by [Maeki]
MYSQL_RES* logsql_res ;
MYSQL_ROW logsql_row ;
@@ -81,6 +77,7 @@ char map_server_pw[32] = "ragnarok"; char map_server_db[32] = "ragnarok";
char default_codepage[32] = ""; //Feature by irmin.
int db_use_sqldbs = 0;
+int connection_ping_interval = 0;
int login_server_port = 3306;
char login_server_ip[16] = "127.0.0.1";
@@ -2054,6 +2051,7 @@ int map_calc_dir( struct block_list *src,int x,int y) { *------------------------------------------
*/
int map_random_dir(struct block_list *bl, short *x, short *y) {
+ struct walkpath_data wpd; short xi = *x-bl->x;
short yi = *y-bl->y;
short i=0, j;
@@ -2069,7 +2067,11 @@ int map_random_dir(struct block_list *bl, short *x, short *y) { xi = bl->x + segment*dirx[j];
segment = (short)sqrt(dist2 - segment*segment); //The complement of the previously picked segment
yi = bl->y + segment*diry[j];
- } while (map_getcell(bl->m,xi,yi,CELL_CHKNOPASS) && (++i)<100);
+ } while (( + map_getcell(bl->m,xi,yi,CELL_CHKNOPASS) || + path_search_real(&wpd,bl->m,bl->x,bl->y,xi,yi,1,CELL_CHKNOREACH) == -1) + && (++i)<100);
+ if (i < 100) {
*x = xi;
*y = yi;
@@ -3414,6 +3416,8 @@ int inter_config_read(char *cfgName) } else if(strcmpi(w1,"use_sql_db")==0){
db_use_sqldbs = battle_config_switch(w2);
ShowStatus ("Using SQL dbs: %s\n",w2);
+ } else if(strcmpi(w1,"connection_ping_interval")==0) {
+ connection_ping_interval = battle_config_switch(w2);
//Login Server SQL DB
} else if(strcmpi(w1,"login_server_ip")==0){
strcpy(login_server_ip, w2);
@@ -3498,20 +3502,6 @@ int map_sql_init(void){ ShowStatus("connect success! (Map Server Connection)\n");
}
- mysql_init(&lmysql_handle);
-
- //DB connection start
- ShowInfo("Connecting to the Login DB Server....\n");
- if(!mysql_real_connect(&lmysql_handle, login_server_ip, login_server_id, login_server_pw,
- login_server_db ,login_server_port, (char *)NULL, 0)) {
- //pointer check
- ShowSQL("DB error - %s\n",mysql_error(&lmysql_handle));
- exit(1);
- }
- else {
- ShowStatus ("connect success! (Login Server Connection)\n");
- }
-
if(mail_server_enable) { // mail system [Valaris]
mysql_init(&mail_handle);
ShowInfo("Connecting to the Mail DB Server....\n");
@@ -3534,10 +3524,6 @@ int map_sql_init(void){ ShowSQL("DB error - %s\n",mysql_error(&mmysql_handle));
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
}
- if (mysql_query(&lmysql_handle, tmp_sql)) {
- ShowSQL("DB error - %s\n",mysql_error(&lmysql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- }
}
return 0;
}
@@ -3546,9 +3532,6 @@ int map_sql_close(void){ mysql_close(&mmysql_handle);
ShowStatus("Close Map DB Connection....\n");
- mysql_close(&lmysql_handle);
- ShowStatus("Close Login DB Connection....\n");
-
if (log_config.sql_logs)
//Updating this if each time there's a log_config addition is too much of a hassle. [Skotlex]
/*&& (log_config.branch || log_config.drop || log_config.mvpdrop ||
@@ -3753,6 +3736,23 @@ void map_versionscreen(int flag) { if (flag) exit(1);
}
+ +#ifndef TXT_ONLY +/*======================================================
+ * Does a mysql_ping to all connection handles. [Skotlex] + *------------------------------------------------------
+ */
+int map_sql_ping(int tid, unsigned int tick, int id, int data) +{ + mysql_ping(&mmysql_handle); + if (log_config.sql_logs) + mysql_ping(&logmysql_handle); + if(mail_server_enable) + mysql_ping(&mail_handle); + return 0; +} +#endif + /*======================================================
* Map-Server Init and Command-line Arguments [Valaris]
*------------------------------------------------------
@@ -3895,6 +3895,12 @@ int do_init(int argc, char *argv[]) { {
log_sql_init();
}
+ + if (connection_ping_interval) { + add_timer_func_list(map_sql_ping, "map_sql_ping");
+ add_timer_interval(gettick()+connection_ping_interval*60*1000, + map_sql_ping, 0, 0, connection_ping_interval*60*1000); + } #endif /* not TXT_ONLY */
npc_event_do_oninit(); // npcのOnInitイベント?行
diff --git a/src/map/npc.c b/src/map/npc.c index 936c04226..3c20b5691 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -116,10 +116,10 @@ int npc_enable(const char *name,int flag) nd->sc.option&=~OPTION_HIDE;
clif_changeoption(&nd->bl);
}else if (flag&4){
- nd->sc.option = OPTION_HIDE;
+ nd->sc.option|= OPTION_HIDE;
clif_changeoption(&nd->bl);
}else{ //Can't change the view_data to invisible class because the view_data for all npcs is shared! [Skotlex]
- nd->sc.option = OPTION_INVISIBLE;
+ nd->sc.option|= OPTION_INVISIBLE;
clif_changeoption(&nd->bl);
}
if(flag&3 && (nd->u.scr.xs > 0 || nd->u.scr.ys >0))
diff --git a/src/map/pc.c b/src/map/pc.c index 3854fe267..752917f61 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -5613,49 +5613,33 @@ int pc_setoption(struct map_session_data *sd,int type) switch (sd->status.class_)
{
case JOB_KNIGHT:
- sd->status.class_ = sd->vd.class_ = JOB_KNIGHT2;
+ clif_changelook(&sd->bl,LOOK_BASE,JOB_KNIGHT2);
break;
case JOB_CRUSADER:
- sd->status.class_ = sd->vd.class_ = JOB_CRUSADER2;
+ clif_changelook(&sd->bl,LOOK_BASE,JOB_CRUSADER2);
break;
case JOB_LORD_KNIGHT:
- sd->status.class_ = sd->vd.class_ = JOB_LORD_KNIGHT2;
+ clif_changelook(&sd->bl,LOOK_BASE,JOB_LORD_KNIGHT2);
break;
case JOB_PALADIN:
- sd->status.class_ = sd->vd.class_ = JOB_PALADIN2;
+ clif_changelook(&sd->bl,LOOK_BASE,JOB_PALADIN2);
break;
case JOB_BABY_KNIGHT:
- sd->status.class_ = sd->vd.class_ = JOB_BABY_KNIGHT2;
+ clif_changelook(&sd->bl,LOOK_BASE,JOB_BABY_KNIGHT2);
break;
case JOB_BABY_CRUSADER:
- sd->status.class_ = sd->vd.class_ = JOB_BABY_CRUSADER2;
+ clif_changelook(&sd->bl,LOOK_BASE,JOB_BABY_CRUSADER2);
break;
}
+ clif_changelook(&sd->bl,LOOK_CLOTHES_COLOR,sd->vd.cloth_color);
clif_status_load(&sd->bl,SI_RIDING,1);
status_calc_pc(sd,0); //Mounting/Umounting affects walk and attack speeds.
}
else if (!(type&OPTION_RIDING) && sd->sc.option&OPTION_RIDING && (sd->class_&MAPID_BASEMASK) == MAPID_SWORDMAN)
{ //We are going to dismount.
- switch (sd->status.class_)
- {
- case JOB_KNIGHT2:
- sd->status.class_ = sd->vd.class_ = JOB_KNIGHT;
- break;
- case JOB_CRUSADER2:
- sd->status.class_ = sd->vd.class_ = JOB_CRUSADER;
- break;
- case JOB_LORD_KNIGHT2:
- sd->status.class_ = sd->vd.class_ = JOB_LORD_KNIGHT;
- break;
- case JOB_PALADIN2:
- sd->status.class_ = sd->vd.class_ = JOB_PALADIN;
- break;
- case JOB_BABY_KNIGHT2:
- sd->status.class_ = sd->vd.class_ = JOB_BABY_KNIGHT;
- break;
- case JOB_BABY_CRUSADER2:
- sd->status.class_ = sd->vd.class_ = JOB_BABY_CRUSADER;
- break;
+ if (sd->vd.class_ != sd->status.class_) {
+ clif_changelook(&sd->bl,LOOK_BASE,sd->status.class_);
+ clif_changelook(&sd->bl,LOOK_CLOTHES_COLOR,sd->vd.cloth_color);
}
clif_status_load(&sd->bl,SI_RIDING,0);
status_calc_pc(sd,0); //Mounting/Umounting affects walk and attack speeds.
@@ -5669,13 +5653,11 @@ int pc_setoption(struct map_session_data *sd,int type) if (type&OPTION_FLYING && !(sd->sc.option&OPTION_FLYING)) //Flying ON
{
if (sd->status.class_==JOB_STAR_GLADIATOR)
- sd->status.class_ = sd->vd.class_ = JOB_STAR_GLADIATOR2;
+ clif_changelook(&sd->bl,LOOK_BASE,JOB_STAR_GLADIATOR2);
}
else if (!(type&OPTION_FLYING) && sd->sc.option&OPTION_FLYING) //Flying OFF
- {
- if (sd->status.class_==JOB_STAR_GLADIATOR2)
- sd->status.class_ = sd->vd.class_ = JOB_STAR_GLADIATOR;
- }
+ if (sd->vd.class_ != sd->status.class_)
+ clif_changelook(&sd->bl,LOOK_BASE,sd->status.class_);
sd->sc.option=type;
clif_changeoption(&sd->bl);
@@ -5727,7 +5709,7 @@ int pc_setcart(struct map_session_data *sd,int type) int pc_setfalcon(struct map_session_data *sd)
{
if(pc_checkskill(sd,HT_FALCON)>0){ // ファルコンマスタリ?スキル所持
- pc_setoption(sd,sd->sc.option|0x0010);
+ pc_setoption(sd,sd->sc.option|OPTION_FALCON);
}
return 0;
diff --git a/src/map/status.c b/src/map/status.c index 7df40765c..398360605 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -1572,12 +1572,6 @@ int status_calc_pc(struct map_session_data* sd,int first) }
// ----- CLIENT-SIDE REFRESH -----
- if(first&1) { //Since this is the initial loading, the Falcon and Peco icons must be loaded. [Skotlex]
- if (sd->sc.option&OPTION_FALCON)
- clif_status_load(&sd->bl, SI_FALCON, 1);
- if (sd->sc.option&OPTION_RIDING)
- clif_status_load(&sd->bl, SI_RIDING, 1);
- }
if(first&4) {
calculating = 0;
return 0;
@@ -3313,6 +3307,28 @@ void status_set_viewdata(struct block_list *bl, int class_) {
TBL_PC* sd = (TBL_PC*)bl;
if (pcdb_checkid(class_)) {
+ if (sd->sc.option&OPTION_RIDING)
+ switch (class_)
+ { //Adapt class to a Mounted one.
+ case JOB_KNIGHT:
+ class_ = JOB_KNIGHT2;
+ break;
+ case JOB_CRUSADER:
+ class_ = JOB_CRUSADER2;
+ break;
+ case JOB_LORD_KNIGHT:
+ class_ = JOB_LORD_KNIGHT2;
+ break;
+ case JOB_PALADIN:
+ class_ = JOB_PALADIN2;
+ break;
+ case JOB_BABY_KNIGHT:
+ class_ = JOB_BABY_KNIGHT2;
+ break;
+ case JOB_BABY_CRUSADER:
+ class_ = JOB_BABY_CRUSADER2;
+ break;
+ }
sd->vd.class_ = class_;
clif_get_weapon_view(sd, &sd->vd.weapon, &sd->vd.shield);
sd->vd.head_top = sd->status.head_top;
@@ -3375,10 +3391,14 @@ void status_set_viewdata(struct block_list *bl, int class_) struct status_change *status_get_sc(struct block_list *bl)
{
nullpo_retr(NULL, bl);
- if(bl->type==BL_MOB)
- return &((struct mob_data*)bl)->sc;
- if(bl->type==BL_PC)
- return &((struct map_session_data*)bl)->sc;
+ switch (bl->type) {
+ case BL_MOB:
+ return &((TBL_MOB*)bl)->sc;
+ case BL_PC:
+ return &((TBL_PC*)bl)->sc;
+ case BL_NPC:
+ return &((TBL_NPC*)bl)->sc;
+ }
return NULL;
}
@@ -4344,7 +4364,7 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val {
struct block_list *src = val2?map_id2bl(val2):NULL;
struct status_change *sc2 = src?status_get_sc(src):NULL;
- if (src && sc2 && sc2->count) {
+ if (src && sc2) {
if (sc2->data[SC_CLOSECONFINE].timer == -1) //Start lock on caster.
sc_start4(src,SC_CLOSECONFINE,100,sc->data[type].val1,1,0,0,tick+1000);
else { //Increase count of locked enemies and refresh time.
@@ -4352,7 +4372,8 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val delete_timer(sc2->data[SC_CLOSECONFINE].timer, status_change_timer);
sc2->data[SC_CLOSECONFINE].timer = add_timer(gettick()+tick+1000, status_change_timer, src->id, SC_CLOSECONFINE);
}
- }
+ } else //Status failed.
+ return 0;
}
break;
case SC_KAITE:
|