summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-24 13:42:12 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-05-24 13:42:12 +0000
commite52640627fce60823f1d5f82ebe4e611b3e38ec0 (patch)
tree9f6a7861e165f6a26a84d70f3ef433c917eb6934 /src
parentd6f9e7355aea40c50b1346b0e1f2b3ae489cf0b5 (diff)
downloadhercules-e52640627fce60823f1d5f82ebe4e611b3e38ec0.tar.gz
hercules-e52640627fce60823f1d5f82ebe4e611b3e38ec0.tar.bz2
hercules-e52640627fce60823f1d5f82ebe4e611b3e38ec0.tar.xz
hercules-e52640627fce60823f1d5f82ebe4e611b3e38ec0.zip
- Corrected mob angry mode, now it only "restores" itself after being hit when the mob has no target within their range of sight rather than on picking a new target.
- Corrected a pair of incorrect sql query parsing logic in the login-sql ban request packet. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@6724 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src')
-rw-r--r--src/login_sql/login.c12
-rw-r--r--src/map/mob.c7
-rw-r--r--src/map/script.c2
3 files changed, 9 insertions, 12 deletions
diff --git a/src/login_sql/login.c b/src/login_sql/login.c
index 2d94aba2f..07fed4836 100644
--- a/src/login_sql/login.c
+++ b/src/login_sql/login.c
@@ -1733,16 +1733,16 @@ int parse_login(int fd) {
}
//check query result
sql_res = mysql_store_result(&mysql_handle) ;
- sql_row = mysql_fetch_row(sql_res); //row fetching
+ sql_row = sql_res?mysql_fetch_row(sql_res):NULL; //row fetching
- if (atoi(sql_row[0]) >= dynamic_pass_failure_ban_how_many ) {
+ if (sql_row && atoi(sql_row[0]) >= dynamic_pass_failure_ban_how_many ) {
sprintf(tmpsql,"INSERT INTO `ipbanlist`(`list`,`btime`,`rtime`,`reason`) VALUES ('%d.%d.%d.*', NOW() , NOW() + INTERVAL %d MINUTE ,'Password error ban: %s')", p[0], p[1], p[2], dynamic_pass_failure_ban_how_long, t_uid);
if(mysql_query(&mysql_handle, tmpsql)) {
ShowSQL("DB error - %s\n",mysql_error(&mysql_handle));
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
}
}
- mysql_free_result(sql_res);
+ if(sql_res) mysql_free_result(sql_res);
}
else if (result == -2){ //dynamic banned - add ip to ban list.
sprintf(tmpsql,"INSERT INTO `ipbanlist`(`list`,`btime`,`rtime`,`reason`) VALUES ('%d.%d.%d.*', NOW() , NOW() + INTERVAL 1 MONTH ,'Dynamic banned user id : %s')", p[0], p[1], p[2], t_uid);
@@ -1761,15 +1761,13 @@ int parse_login(int fd) {
ShowDebug("at %s:%d - %s\n", __FILE__,__LINE__,tmp_sql);
}
sql_res = mysql_store_result(&mysql_handle) ;
- if (sql_res) {
- sql_row = mysql_fetch_row(sql_res); //row fetching
- }
+ sql_row = sql_res?mysql_fetch_row(sql_res):NULL; //row fetching
//cannot connect login failed
memset(WFIFOP(fd,0),'\0',23);
WFIFOW(fd,0)=0x6a;
WFIFOB(fd,2)=result;
if (result == 6) { // 6 = Your are Prohibited to log in until %s
- if (atol(sql_row[0]) != 0) { // if account is banned, we send ban timestamp
+ if (sql_row && atol(sql_row[0]) != 0) { // if account is banned, we send ban timestamp
char tmpstr[256];
time_t ban_until_time;
ban_until_time = atol(sql_row[0]);
diff --git a/src/map/mob.c b/src/map/mob.c
index f45c6f104..3d22baa80 100644
--- a/src/map/mob.c
+++ b/src/map/mob.c
@@ -569,7 +569,6 @@ int mob_linksearch(struct block_list *bl,va_list ap)
md->last_linktime = tick;
if( mob_can_reach(md,target,md->db->range2, MSS_FOLLOW) ){ // Reachability judging
md->target_id = target->id;
- md->state.aggressive = (status_get_mode(&md->bl)&MD_ANGRY)?1:0;
md->min_chase=md->db->range3;
return 1;
}
@@ -685,6 +684,7 @@ int mob_spawn (struct mob_data *md)
md->master_id = 0;
md->master_dist = 0;
+ md->state.aggressive = md->db->mode&MD_ANGRY?1:0;
md->state.skillstate = MSS_IDLE;
md->next_walktime = tick+rand()%5000+1000;
md->last_linktime = tick;
@@ -817,7 +817,6 @@ static int mob_ai_sub_hard_activesearch(struct block_list *bl,va_list ap)
) {
(*target) = bl;
md->target_id=bl->id;
- md->state.aggressive = (status_get_mode(&md->bl)&MD_ANGRY)?1:0;
md->min_chase= dist + md->db->range3;
if(md->min_chase>MAX_MINCHASE)
md->min_chase=MAX_MINCHASE;
@@ -855,7 +854,6 @@ static int mob_ai_sub_hard_changechase(struct block_list *bl,va_list ap)
) {
(*target) = bl;
md->target_id=bl->id;
- md->state.aggressive = (status_get_mode(&md->bl)&MD_ANGRY)?1:0;
md->min_chase= md->db->range3;
return 1;
}
@@ -965,7 +963,6 @@ static int mob_ai_sub_hard_slavemob(struct mob_data *md,unsigned int tick)
}
if (tbl && status_check_skilluse(&md->bl, tbl, 0, 0)) {
md->target_id=tbl->id;
- md->state.aggressive = (status_get_mode(&md->bl)&MD_ANGRY)?1:0;
md->min_chase=md->db->range3+distance_bl(&md->bl, tbl);
if(md->min_chase>MAX_MINCHASE)
md->min_chase=MAX_MINCHASE;
@@ -1167,6 +1164,8 @@ static int mob_ai_sub_hard(struct block_list *bl,va_list ap)
) {
map_foreachinrange (mob_ai_sub_hard_activesearch, &md->bl,
view_range, md->special_state.ai?BL_CHAR:BL_PC, md, &tbl);
+ if(!tbl && mode&MD_ANGRY && !md->state.aggressive)
+ md->state.aggressive = 1; //Restore angry state when no targets are visible.
} else if (mode&MD_CHANGECHASE && (md->state.skillstate == MSS_RUSH || md->state.skillstate == MSS_FOLLOW)) {
search_size = view_range<md->db->range ? view_range:md->db->range;
map_foreachinrange (mob_ai_sub_hard_changechase, &md->bl,
diff --git a/src/map/script.c b/src/map/script.c
index cde146b1a..26da3ee8f 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -654,7 +654,7 @@ struct {
{buildin_classchange,"classchange","ii"},
{buildin_misceffect,"misceffect","i"},
{buildin_soundeffect,"soundeffect","si"},
- {buildin_soundeffectall,"soundeffectall","*"}, // SoundEffectAll [Codemaster]
+ {buildin_soundeffectall,"soundeffectall","si*"}, // SoundEffectAll [Codemaster]
{buildin_strmobinfo,"strmobinfo","ii"}, // display mob data [Valaris]
{buildin_guardian,"guardian","siisii*i"}, // summon guardians
{buildin_guardianinfo,"guardianinfo","i"}, // display guardian data [Valaris]