diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/char/char.c | 4 | ||||
-rw-r--r-- | src/char_sql/char.c | 57 | ||||
-rw-r--r-- | src/char_sql/inter.c | 8 | ||||
-rw-r--r-- | src/common/mmo.h | 3 | ||||
-rw-r--r-- | src/login_sql/login.c | 103 | ||||
-rw-r--r-- | src/map/clif.c | 8 | ||||
-rw-r--r-- | src/map/map.h | 13 | ||||
-rw-r--r-- | src/map/pc.c | 108 | ||||
-rw-r--r-- | src/map/pc.h | 8 | ||||
-rw-r--r-- | src/map/status.c | 11 |
10 files changed, 110 insertions, 213 deletions
diff --git a/src/char/char.c b/src/char/char.c index b0a261f56..28ae5dea1 100644 --- a/src/char/char.c +++ b/src/char/char.c @@ -3322,8 +3322,8 @@ int parse_char(int fd) { WFIFOL(fd,2) = cd->char_id;
memcpy(WFIFOP(fd,6), mapindex_id2name(cd->last_point.map), MAP_NAME_LENGTH);
ShowInfo("Character selection '%s' (account: %d, slot: %d).\n", cd->name, sd->account_id, ch);
-
- // Andvanced subnet check [LuzZza]
+
+ // Advanced subnet check [LuzZza]
if((subnet_map_ip = lan_subnetcheck((long *)p)))
WFIFOL(fd,22) = subnet_map_ip;
else
diff --git a/src/char_sql/char.c b/src/char_sql/char.c index ad51a2825..3690ae43a 100644 --- a/src/char_sql/char.c +++ b/src/char_sql/char.c @@ -339,30 +339,30 @@ int isGM(int account_id) { }
void read_gm_account(void) {
- if(char_gm_read)
- {
- if (gm_account != NULL)
- aFree(gm_account);
- GM_num = 0;
+ if(!char_gm_read)
+ return;
+
+ if (gm_account != NULL)
+ aFree(gm_account);
+ GM_num = 0;
- sprintf(tmp_sql, "SELECT `%s`,`%s` FROM `%s` WHERE `%s`>='%d'",login_db_account_id,login_db_level,gm_db,login_db_level,lowest_gm_level);
- 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);
- }
- lsql_res = mysql_store_result(&lmysql_handle);
- if (lsql_res) {
- gm_account = (struct gm_account*)aCalloc(sizeof(struct gm_account) * (size_t)mysql_num_rows(lsql_res), 1);
- while ((lsql_row = mysql_fetch_row(lsql_res))) {
- gm_account[GM_num].account_id = atoi(lsql_row[0]);
- gm_account[GM_num].level = atoi(lsql_row[1]);
- GM_num++;
- }
+ sprintf(tmp_sql, "SELECT `%s`,`%s` FROM `%s` WHERE `%s`>='%d'",login_db_account_id,login_db_level,gm_db,login_db_level,lowest_gm_level);
+ 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);
+ }
+ lsql_res = mysql_store_result(&lmysql_handle);
+ if (lsql_res) {
+ gm_account = (struct gm_account*)aCalloc(sizeof(struct gm_account) * (size_t)mysql_num_rows(lsql_res), 1);
+ while ((lsql_row = mysql_fetch_row(lsql_res))) {
+ gm_account[GM_num].account_id = atoi(lsql_row[0]);
+ gm_account[GM_num].level = atoi(lsql_row[1]);
+ GM_num++;
}
-
- mysql_free_result(lsql_res);
- mapif_send_gmaccounts();
}
+
+ mysql_free_result(lsql_res);
+ mapif_send_gmaccounts();
}
int compare_item(struct item *a, struct item *b) {
@@ -2054,11 +2054,9 @@ int parse_tologin(int fd) { break;
case 0x2732:
- if(!char_gm_read)
- {
- if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
- return 0;
- {
+ if (RFIFOREST(fd) < 4 || RFIFOREST(fd) < RFIFOW(fd,2))
+ return 0;
+ if(!char_gm_read) {
unsigned char buf[32000];
if (gm_account != NULL)
aFree(gm_account);
@@ -2075,9 +2073,8 @@ int parse_tologin(int fd) { memcpy(buf, RFIFOP(fd,0), RFIFOW(fd,2));
WBUFW(buf,0) = 0x2b15;
mapif_sendall(buf, RFIFOW(fd,2));
- }
- RFIFOSKIP(fd,RFIFOW(fd,2));
}
+ RFIFOSKIP(fd,RFIFOW(fd,2));
break;
// Receive GM accounts [Freya login server packet by Yor]
@@ -3895,8 +3892,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);
+ } 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/inter.c b/src/char_sql/inter.c index 74da7f303..137e25d47 100644 --- a/src/char_sql/inter.c +++ b/src/char_sql/inter.c @@ -303,10 +303,10 @@ 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)
{
ShowInfo("Pinging SQL server to keep connection alive...\n");
@@ -373,7 +373,7 @@ int inter_init(const char *file) //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_func_list(inter_sql_ping, "inter_sql_ping");
add_timer_interval(gettick()+connection_ping_interval*60*60*1000,
inter_sql_ping, 0, 0, connection_ping_interval*60*60*1000);
}
diff --git a/src/common/mmo.h b/src/common/mmo.h index 99fb76c40..2b940de6b 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -183,7 +183,8 @@ struct mmo_charstatus { short class_;
unsigned short status_point,skill_point;
int hp,max_hp,sp,max_sp;
- short option,manner;
+ unsigned short option;
+ short manner;
unsigned char karma;
short hair,hair_color,clothes_color;
int party_id,guild_id,pet_id;
diff --git a/src/login_sql/login.c b/src/login_sql/login.c index 7c1faf0aa..ce4afa3e3 100644 --- a/src/login_sql/login.c +++ b/src/login_sql/login.c @@ -214,32 +214,31 @@ void read_gm_account(void) { MYSQL_RES* sql_res ;
MYSQL_ROW sql_row;
- if(login_gm_read)
+ if(!login_gm_read)
+ return;
+ sprintf(tmp_sql, "SELECT `%s`,`%s` FROM `%s` WHERE `%s`> '0'",login_db_account_id,login_db_level,login_db,login_db_level);
+ if (mysql_query(&mysql_handle, tmp_sql)) {
+ ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
+ ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
+ return; //Failed to read GM list!
+ }
+
+ if (gm_account_db != NULL)
{
- sprintf(tmp_sql, "SELECT `%s`,`%s` FROM `%s` WHERE `%s`> '0'",login_db_account_id,login_db_level,login_db,login_db_level);
- if (mysql_query(&mysql_handle, tmp_sql)) {
- ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
- ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
- return; //Failed to read GM list!
- }
+ aFree(gm_account_db);
+ gm_account_db = NULL;
+ }
+ GM_num = 0;
- if (gm_account_db != NULL)
- {
- aFree(gm_account_db);
- gm_account_db = NULL;
- }
- GM_num = 0;
-
- sql_res = mysql_store_result(&mysql_handle);
- if (sql_res) {
- gm_account_db = (struct gm_account*)aCalloc((size_t)mysql_num_rows(sql_res), sizeof(struct gm_account));
- while ((sql_row = mysql_fetch_row(sql_res))) {
- gm_account_db[GM_num].account_id = atoi(sql_row[0]);
- gm_account_db[GM_num].level = atoi(sql_row[1]);
- GM_num++;
- }
- mysql_free_result(sql_res);
+ sql_res = mysql_store_result(&mysql_handle);
+ if (sql_res) {
+ gm_account_db = (struct gm_account*)aCalloc((size_t)mysql_num_rows(sql_res), sizeof(struct gm_account));
+ while ((sql_row = mysql_fetch_row(sql_res))) {
+ gm_account_db[GM_num].account_id = atoi(sql_row[0]);
+ gm_account_db[GM_num].level = atoi(sql_row[1]);
+ GM_num++;
}
+ mysql_free_result(sql_res);
}
}
@@ -253,30 +252,29 @@ void send_GM_accounts(int fd) { unsigned char buf[32767];
int len;
- if(login_gm_read)
- {
- len = 4;
- WBUFW(buf,0) = 0x2732;
- for(i = 0; i < GM_num; i++)
- // send only existing accounts. We can not create a GM account when server is online.
- if (gm_account_db[i].level > 0) {
- WBUFL(buf,len) = gm_account_db[i].account_id;
- WBUFB(buf,len+4) = (unsigned char)gm_account_db[i].level;
- len += 5;
- if (len >= 32000) {
- ShowWarning("send_GM_accounts: Too many accounts! Only %d out of %d were sent.\n", i, GM_num);
- break;
- }
- }
- WBUFW(buf,2) = len;
- if (fd == -1)
- charif_sendallwos(-1, buf, len);
- else
- {
- memcpy(WFIFOP(fd,0), buf, len);
- WFIFOSET(fd,len);
+ if(!login_gm_read)
+ return;
+ len = 4;
+ WBUFW(buf,0) = 0x2732;
+ for(i = 0; i < GM_num; i++)
+ // send only existing accounts. We can not create a GM account when server is online.
+ if (gm_account_db[i].level > 0) {
+ WBUFL(buf,len) = gm_account_db[i].account_id;
+ WBUFB(buf,len+4) = (unsigned char)gm_account_db[i].level;
+ len += 5;
+ if (len >= 32000) {
+ ShowWarning("send_GM_accounts: Too many accounts! Only %d out of %d were sent.\n", i, GM_num);
+ break;
}
}
+ WBUFW(buf,2) = len;
+ if (fd == -1)
+ charif_sendallwos(-1, buf, len);
+ else
+ {
+ memcpy(WFIFOP(fd,0), buf, len);
+ WFIFOSET(fd,len);
+ }
return;
}
@@ -406,7 +404,7 @@ int mmo_auth_sqldb_init(void) { }
if (connection_ping_interval) {
- add_timer_func_list(login_sql_ping, "login_sql_ping");
+ add_timer_func_list(login_sql_ping, "login_sql_ping");
add_timer_interval(gettick()+connection_ping_interval*60*60*1000,
login_sql_ping, 0, 0, connection_ping_interval*60*60*1000);
}
@@ -1831,11 +1829,8 @@ int parse_login(int fd) { WFIFOSET(fd,3);
session[fd]->func_parse=parse_fromchar;
realloc_fifo(fd,FIFOSIZE_SERVERLINK,FIFOSIZE_SERVERLINK);
- if(login_gm_read)
- {
- // send GM account to char-server
- send_GM_accounts(fd);
- }
+ // send GM account to char-server
+ send_GM_accounts(fd);
} else {
WFIFOW(fd, 0) =0x2711;
WFIFOB(fd, 2)=3;
@@ -2194,8 +2189,8 @@ void sql_config_read(const char *cfgName){ /* Kalaspuff, to get login_db */ 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,"connection_ping_interval")==0) {
+ connection_ping_interval = atoi(w2);
}
else if(strcmpi(w1,"default_codepage")==0){
strcpy(default_codepage, w2);
@@ -2289,10 +2284,8 @@ int do_init(int argc,char **argv){ ShowInfo("finished mmo_auth_sqldb_init()\n");
if(login_gm_read)
- {
//Read account information.
read_gm_account();
- }
//set default parser as parse_login function
set_defaultparse(parse_login);
diff --git a/src/map/clif.c b/src/map/clif.c index 6e01d7fed..27fff5618 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -8591,7 +8591,7 @@ void clif_parse_ActionRequest(int fd, struct map_session_data *sd) { switch(action_type) {
case 0x00: // once attack
case 0x07: // continuous attack
- if(sd->vd.class_ ==JOB_WEDDING || sd->vd.class_==JOB_XMAS)
+ if(sd->sc.option&(OPTION_WEDDING|OPTION_XMAS))
return;
if (!battle_config.sdelay_attack_enable && pc_checkskill(sd, SA_FREECAST) <= 0) {
if (DIFF_TICK(tick, sd->ud.canact_tick) < 0) {
@@ -9363,7 +9363,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) { return;
}
- if (sd->vd.class_ == JOB_WEDDING || sd->vd.class_ == JOB_XMAS)
+ if(sd->sc.option&(OPTION_WEDDING|OPTION_XMAS))
return;
if (sd->invincible_timer != -1)
@@ -9453,7 +9453,7 @@ void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, int skilll return;
}
- if (sd->vd.class_ == JOB_WEDDING || sd->vd.class_ == JOB_XMAS)
+ if(sd->sc.option&(OPTION_WEDDING|OPTION_XMAS))
return;
if (sd->invincible_timer != -1)
@@ -9517,7 +9517,7 @@ void clif_parse_UseSkillMap(int fd,struct map_session_data *sd) if (clif_cant_act(sd))
return;
- if (sd->vd.class_==JOB_WEDDING || sd->vd.class_ == JOB_XMAS)
+ if(sd->sc.option&(OPTION_WEDDING|OPTION_XMAS))
return;
if(sd->invincible_timer != -1)
diff --git a/src/map/map.h b/src/map/map.h index 7e133a516..525b7dc5e 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -241,18 +241,21 @@ enum { #define OPTION_SIGHT 0x0001
#define OPTION_HIDE 0x0002
#define OPTION_CLOAK 0x0004
-
+#define OPTION_CART1 0x0008
#define OPTION_FALCON 0x0010
#define OPTION_RIDING 0x0020
#define OPTION_INVISIBLE 0x0040
+#define OPTION_CART2 0x0080
+#define OPTION_CART3 0x0100
+#define OPTION_CART4 0x0200
+#define OPTION_CART5 0x0400
#define OPTION_ORCISH 0x0800
-
#define OPTION_WEDDING 0x1000
#define OPTION_RUWACH 0x2000
#define OPTION_CHASEWALK 0x4000
+#define OPTION_XMAS 0x8000
-#define OPTION_FLYING 0x8000
-
+#define OPTION_FLYING 0x10000
//TODO: Get these Missing options...
#define OPTION_SIGHTTRASHER 0x0001
@@ -409,7 +412,7 @@ struct status_change { struct status_change_entry data[MAX_STATUSCHANGE];
short count;
short opt1,opt2,opt3;
- short option;
+ unsigned short option;
};
struct vending {
diff --git a/src/map/pc.c b/src/map/pc.c index 371816c8b..0c40d1de4 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -3306,98 +3306,6 @@ int pc_checkequip(struct map_session_data *sd,int pos) }
/*==========================================
- * ?生職や養子職の元の職業を返す
- *------------------------------------------
- */
-struct pc_base_job pc_calc_base_job(int b_class)
-{
- struct pc_base_job bj;
- if(b_class < JOB_NOVICE_HIGH){
- if (b_class == JOB_KNIGHT2)
- bj.job = JOB_KNIGHT;
- else if (b_class == JOB_CRUSADER2)
- bj.job = JOB_CRUSADER;
- else
- bj.job = b_class;
- bj.upper = 0;
- }else if(b_class >= JOB_NOVICE_HIGH && b_class <= JOB_PALADIN2){ //High Jobs
- if (b_class == JOB_LORD_KNIGHT2)
- bj.job = JOB_KNIGHT;
- else if (b_class == JOB_PALADIN2)
- bj.job = JOB_CRUSADER;
- else
- bj.job = b_class - JOB_NOVICE_HIGH;
- bj.upper = 1;
- }else if(b_class >= JOB_TAEKWON && b_class <= JOB_SOUL_LINKER){
- if (b_class == JOB_STAR_GLADIATOR2)
- bj.job = 24 + JOB_STAR_GLADIATOR - JOB_TAEKWON;
- else
- bj.job = 24 + b_class - JOB_TAEKWON;
- bj.upper = 0;
- }else{ //Baby Classes
- if (b_class == JOB_SUPER_BABY)
- bj.job = JOB_SUPER_NOVICE;
- else if (b_class == JOB_BABY_KNIGHT2)
- bj.job = JOB_KNIGHT;
- else if (b_class == JOB_BABY_CRUSADER2)
- bj.job = JOB_CRUSADER;
- else
- bj.job = b_class - JOB_BABY;
- bj.upper = 2;
- }
-
- if(bj.job == JOB_NOVICE){
- bj.type = 0;
- }else if(bj.job <= JOB_THIEF || bj.job == JOB_TAEKWON){
- bj.type = 1;
- }else{
- bj.type = 2;
- }
-
- return bj;
-}
-
-/*==========================================
- * For quick calculating [Celest]
- *------------------------------------------
- */
-int pc_calc_base_job2 (int b_class)
-{
- if(b_class < JOB_NOVICE_HIGH)
- {
- if (b_class == JOB_KNIGHT2)
- return JOB_KNIGHT;
- if (b_class == JOB_CRUSADER2)
- return JOB_CRUSADER;
- return b_class;
- }
- if(b_class >= JOB_NOVICE_HIGH && b_class < JOB_BABY)
- {
- if (b_class == JOB_LORD_KNIGHT2)
- return JOB_KNIGHT;
- if (b_class == JOB_PALADIN2)
- return JOB_CRUSADER;
- return b_class - JOB_NOVICE_HIGH;
- }
- if(b_class >= JOB_TAEKWON && b_class <= JOB_SOUL_LINKER )
- {
- if (b_class == JOB_STAR_GLADIATOR2)
- return 24 + JOB_STAR_GLADIATOR - JOB_TAEKWON;
- return 24 + b_class - JOB_TAEKWON;
- }
- //Baby Classes
- {
- if (b_class == JOB_SUPER_BABY)
- return JOB_SUPER_NOVICE;
- if (b_class == JOB_BABY_KNIGHT2)
- return JOB_KNIGHT;
- if (b_class == JOB_BABY_CRUSADER2)
- return JOB_CRUSADER;
- return b_class - JOB_BABY;
- }
-}
-
-/*==========================================
* Convert's from the client's lame Job ID system
* to the map server's 'makes sense' system. [Skotlex]
*------------------------------------------
@@ -5622,22 +5530,18 @@ int pc_setoption(struct map_session_data *sd,int type) */
int pc_setcart(struct map_session_data *sd,int type)
{
- int cart[6]={0x0000,0x0008,0x0080,0x0100,0x0200,0x0400};
- int option, i;
+ int cart[6]={0x0000,OPTION_CART1,OPTION_CART2,OPTION_CART3,OPTION_CART4,OPTION_CART5};
+ int option;
nullpo_retr(0, sd);
if (type < 0 || type > 5)
return 0; //Never trust the values sent by the client! [Skotlex]
- option = sd->sc.option;
- for (i = 0; i < 6; i++)
- { //This should preserve the current option, only modifying the cart bit.
- if (i == type)
- option |= cart[i];
- else
- option &= ~cart[i];
- }
if(pc_checkskill(sd,MC_PUSHCART)>0){ // プッシュカ?トスキル所持
+ option = sd->sc.option;
+ //This should preserve the current option, only modifying the cart bit.
+ option&=~(OPTION_CART1|OPTION_CART2|OPTION_CART3|OPTION_CART4|OPTION_CART5);
+ option|=cart[type];
if(!pc_iscarton(sd)){ // カ?トを付けていない
pc_setoption(sd,option);
clif_cart_itemlist(sd);
diff --git a/src/map/pc.h b/src/map/pc.h index 4a96893a6..9513bd176 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -212,14 +212,6 @@ int pc_set_gm_level(int account_id, int level); void pc_setstand(struct map_session_data *sd);
int pc_candrop(struct map_session_data *sd,int item_id);
-struct pc_base_job{
- int job; //職業、ただし転生職や養子職の場合は元の職業を返す(廃プリ→プリ)
- int type; //ノビ 0, 一次職 1, 二次職 2, スパノビ 3
- int upper; //通常 0, 転生 1, 養子 2
-};
-
-struct pc_base_job pc_calc_base_job(int b_class);//転生や養子職の元の職業を返す
-int pc_calc_base_job2(int b_class); // Celest
int pc_jobid2mapid(unsigned short b_class); // Skotlex
int pc_mapid2jobid(unsigned short class_, int sex); // Skotlex
diff --git a/src/map/status.c b/src/map/status.c index a4e47a97f..bdb12deb9 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -4088,7 +4088,6 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val val2 = 5*(2+type-SC_ASPDPOTION0);
break;
- case SC_XMAS: // Xmas Suit [Valaris]
case SC_WEDDING: //結婚用(結婚衣裳になって?くのが?いとか)
{
struct view_data *vd = status_get_viewdata(bl);
@@ -4746,6 +4745,9 @@ int status_change_start(struct block_list *bl,int type,int rate,int val1,int val case SC_SIGHTTRASHER:
sc->option |= OPTION_SIGHTTRASHER;
break;
+ case SC_XMAS: // Xmas Suit [Valaris]
+ sc->option |= OPTION_XMAS;
+ break;
case SC_FUSION:
sc->option |= OPTION_FLYING;
break;
@@ -4957,10 +4959,11 @@ int status_change_end( struct block_list* bl , int type,int tid ) case SC_SWOO: // [marquis007]
case SC_SKA: // [marquis007]
case SC_KNOWLEDGE:
+ case SC_KEEPING:
+ case SC_BARRIER:
calc_flag = 1;
break;
- case SC_XMAS: // Xmas Suit [Valaris]
case SC_WEDDING: //結婚用(結婚衣裳になって?くのが?いとか)
{
struct view_data *vd = status_get_viewdata(bl);
@@ -5256,6 +5259,10 @@ int status_change_end( struct block_list* bl , int type,int tid ) sc->option &= ~OPTION_SIGHTTRASHER;
opt_flag = 1;
break;
+ case SC_XMAS: // Xmas Suit [Valaris]
+ sc->option &= ~OPTION_XMAS;
+ opt_flag = 1;
+ break;
case SC_FUSION:
sc->option &= ~OPTION_FLYING;
opt_flag = 1;
|