summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/common/socket.c2
-rw-r--r--src/login_sql/login.c2
-rw-r--r--src/map/clif.c11
-rw-r--r--src/map/mercenary.c4
-rw-r--r--src/map/pc.c5
-rw-r--r--src/map/script.c52
-rw-r--r--src/map/skill.c29
-rw-r--r--src/map/status.c7
8 files changed, 61 insertions, 51 deletions
diff --git a/src/common/socket.c b/src/common/socket.c
index 65c85a48b..2e52b079f 100644
--- a/src/common/socket.c
+++ b/src/common/socket.c
@@ -1290,7 +1290,7 @@ void socket_init (void)
if(a->sin_family == AF_INET) {
u_long ad = ntohl(a->sin_addr.s_addr);
- if(ad != INADDR_LOOPBACK) {
+ if(ad != INADDR_LOOPBACK && ad != INADDR_ANY) {
addr_[naddr_ ++] = ad;
if(naddr_ == 16)
break;
diff --git a/src/login_sql/login.c b/src/login_sql/login.c
index 5527b82f4..8dd0bcc48 100644
--- a/src/login_sql/login.c
+++ b/src/login_sql/login.c
@@ -932,7 +932,7 @@ int parse_fromchar(int fd){
case 0x2709:
if (log_login)
{
- sprintf(tmpsql,"INSERT DELAYED INTO `%s`(`time`,`ip`,`user`,`rcode`,`log`) VALUES (NOW(), '%u', '%s','%s', 'GM reload request')", loginlog_db, (unsigned int)ntohl(ipl),server[id].name, RETCODE);
+ sprintf(tmpsql,"INSERT DELAYED INTO `%s`(`time`,`ip`,`user`,`log`) VALUES (NOW(), '%u', '%s', 'GM reload request')", loginlog_db, (unsigned int)ntohl(ipl),server[id].name);
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);
diff --git a/src/map/clif.c b/src/map/clif.c
index 10f423cba..f5ba4101f 100644
--- a/src/map/clif.c
+++ b/src/map/clif.c
@@ -8218,8 +8218,6 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
if(sd->npc_id) npc_event_dequeue(sd);
if(sd->state.connect_new) {
- // Temperory moved to pc_reg_received until Skot is back.
- //status_calc_pc(sd,1);
if (sd->sc.option&OPTION_FALCON)
clif_status_load(&sd->bl, SI_FALCON, 1);
@@ -8318,8 +8316,7 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
clif_send_petdata(sd,0,0);
clif_send_petdata(sd,5,battle_config.pet_hair_style);
clif_send_petstatus(sd);
-
- if(sd->state.connect_new && sd->pd->pet.intimate > 900)
+ if(sd->state.connect_new && sd->pd->pet.intimate > 900)
clif_pet_emotion(sd->pd,(sd->pd->pet.class_ - 100)*100 + 50 + pet_hungry_val(sd->pd));
}
@@ -8349,8 +8346,8 @@ void clif_parse_LoadEndAck(int fd,struct map_session_data *sd)
sc_start(&sd->bl,SC_NOCHAT,100,0,0);
if(sd->state.connect_new) {
- //Delayed night effect on log-on fix for the glow-issue. Thanks to Larry.
sd->state.connect_new = 0;
+ //Delayed night effect on log-on fix for the glow-issue. Thanks to Larry.
if (night_flag) {
char tmpstr[1024];
strcpy(tmpstr, msg_txt(500)); // Actually, it's the night...
@@ -11731,6 +11728,10 @@ int clif_parse(int fd) {
if (sd && sd->state.auth == 1 && sd->state.waitingdisconnect == 1) { // 切断待ちの場合パケットを処理しない
} else if (packet_db[packet_ver][cmd].func) {
+ if (sd && sd->bl.prev == NULL &&
+ packet_db[packet_ver][cmd].func != clif_parse_LoadEndAck)
+ ; //Only valid packet when player is not on a map is the finish-loading packet.
+ else
if (sd
|| packet_db[packet_ver][cmd].func == clif_parse_WantToConnection
|| packet_db[packet_ver][cmd].func == clif_parse_debug
diff --git a/src/map/mercenary.c b/src/map/mercenary.c
index 32a2e9f97..1d417be98 100644
--- a/src/map/mercenary.c
+++ b/src/map/mercenary.c
@@ -720,8 +720,8 @@ int merc_resurrect_homunculus(struct map_session_data *sd, unsigned char per, sh
hd->bl.m = sd->bl.m;
hd->bl.x = x;
hd->bl.y = y;
- map_addblock(&sd->hd->bl);
- clif_spawn(&sd->hd->bl);
+ map_addblock(&hd->bl);
+ clif_spawn(&hd->bl);
}
status_revive(&hd->bl, per, 0);
return 1;
diff --git a/src/map/pc.c b/src/map/pc.c
index 7aeaf2232..f9415e9cd 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -706,7 +706,6 @@ int pc_authok(struct map_session_data *sd, int login_id2, time_t connect_until_t
sd->state.event_disconnect = 1;
sd->state.event_kill_mob = 1;
- // Reverted, since it causes tons of problems putting elsewhere.
status_calc_pc(sd,1);
sd->state.auth = 1; //Do not auth him until the initial stats have been placed.
@@ -813,9 +812,6 @@ int pc_reg_received(struct map_session_data *sd)
sd->mission_count = pc_readglobalreg(sd,"TK_MISSION_COUNT");
}
- if(sd->battle_status.hp == 0)
- pc_setrestartvalue(sd, 1);
-
//SG map and mob read [Komurka]
for(i=0;i<3;i++) //for now - someone need to make reading from txt/sql
{
@@ -860,6 +856,7 @@ int pc_reg_received(struct map_session_data *sd)
sd->state.event_joblvup = 1;
sd->state.event_loadmap = 1;
}
+
return 0;
}
diff --git a/src/map/script.c b/src/map/script.c
index 2df67fcb1..9c9a5fc21 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -8650,30 +8650,31 @@ int buildin_emotion(struct script_state *st)
return 0;
}
-int buildin_maprespawnguildid_sub(struct block_list *bl,va_list ap)
+static int buildin_maprespawnguildid_sub_pc(DBKey key, void *data, va_list ap)
{
- int g_id=va_arg(ap,int);
- int flag=va_arg(ap,int);
- struct map_session_data *sd=NULL;
- struct mob_data *md=NULL;
+ va_list ap2 = va_arg(ap, va_list); // double decode -_-
+ int m=va_arg(ap2,int);
+ int g_id=va_arg(ap2,int);
+ int flag=va_arg(ap2,int);
+ struct map_session_data *sd = (TBL_PC*)data;
- if(bl->type == BL_PC)
- sd=(struct map_session_data*)bl;
- if(bl->type == BL_MOB)
- md=(struct mob_data *)bl;
+ if(!sd || sd->bl.m != m)
+ return 0;
+ if(
+ ((sd->status.guild_id == g_id) && flag&1) || //Warp out owners
+ ((sd->status.guild_id != g_id) && flag&2) || //Warp out outsiders
+ (sd->status.guild_id == 0) // Warp out players not in guild [Valaris]
+ )
+ pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,3);
+ return 1;
+}
- if(sd){
- if((sd->status.guild_id == g_id) && (flag&1))
- pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,3);
- else if((sd->status.guild_id != g_id) && (flag&2))
- pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,3);
- else if (sd->status.guild_id == 0) // Warp out players not in guild [Valaris]
- pc_setpos(sd,sd->status.save_point.map,sd->status.save_point.x,sd->status.save_point.y,3); // end addition [Valaris]
- }
- if(md && flag&4){
- if(!md->guardian_data && md->class_ != MOBID_EMPERIUM)
- unit_remove_map(bl,1);
- }
+static int buildin_maprespawnguildid_sub_mob(struct block_list *bl,va_list ap)
+{
+ struct mob_data *md=(struct mob_data *)bl;
+
+ if(!md->guardian_data && md->class_ != MOBID_EMPERIUM)
+ status_kill(bl);
return 0;
}
@@ -8685,8 +8686,13 @@ int buildin_maprespawnguildid(struct script_state *st)
int m=map_mapname2mapid(mapname);
- if(m != -1)
- map_foreachinmap(buildin_maprespawnguildid_sub,m,BL_CHAR,g_id,flag);
+ if(m == -1)
+ return 0;
+
+ //Catch ALL players (in case some are 'between maps' on execution time)
+ map_foreachpc(buildin_maprespawnguildid_sub_pc,m,g_id,flag);
+ if (flag&4) //Remove script mobs.
+ map_foreachinmap(buildin_maprespawnguildid_sub_mob,m,BL_MOB);
return 0;
}
diff --git a/src/map/skill.c b/src/map/skill.c
index b11ae6dde..f49744679 100644
--- a/src/map/skill.c
+++ b/src/map/skill.c
@@ -1310,17 +1310,19 @@ int skill_additional_effect (struct block_list* src, struct block_list *bl, int
case TK_JUMPKICK:
//Cancel out Soul Linker status of the target. [Skotlex]
if (tsc->count) {
- if (tsc->data[SC_PRESERVE].timer != -1) //preserve blocks the cleaning
- break;
- //Remove pitched potions effect.
- if (tsc->data[SC_ASPDPOTION0].timer != -1 && tsc->data[SC_ASPDPOTION0].val4)
+ //Remove NORMAL potions effect.
+ if (tsc->data[SC_ASPDPOTION0].timer != -1 && !tsc->data[SC_ASPDPOTION0].val4)
status_change_end(bl, SC_ASPDPOTION0, -1);
- if (tsc->data[SC_ASPDPOTION1].timer != -1 && tsc->data[SC_ASPDPOTION1].val4)
+ if (tsc->data[SC_ASPDPOTION1].timer != -1 && !tsc->data[SC_ASPDPOTION1].val4)
status_change_end(bl, SC_ASPDPOTION1, -1);
- if (tsc->data[SC_ASPDPOTION2].timer != -1 && tsc->data[SC_ASPDPOTION2].val4)
+ if (tsc->data[SC_ASPDPOTION2].timer != -1 && !tsc->data[SC_ASPDPOTION2].val4)
status_change_end(bl, SC_ASPDPOTION2, -1);
- if (tsc->data[SC_ASPDPOTION3].timer != -1 && tsc->data[SC_ASPDPOTION3].val4)
+ if (tsc->data[SC_ASPDPOTION3].timer != -1 && !tsc->data[SC_ASPDPOTION3].val4)
status_change_end(bl, SC_ASPDPOTION3, -1);
+ if (tsc->data[SC_SPEEDUP0].timer != -1 && !tsc->data[SC_SPEEDUP0].val4)
+ status_change_end(bl, SC_SPEEDUP0, -1);
+ if (tsc->data[SC_SPEEDUP1].timer != -1 && !tsc->data[SC_SPEEDUP1].val4)
+ status_change_end(bl, SC_SPEEDUP1, -1);
if (tsc->data[SC_SPIRIT].timer != -1)
status_change_end(bl, SC_SPIRIT, -1);
if (tsc->data[SC_ONEHAND].timer != -1)
@@ -4621,6 +4623,7 @@ int skill_castend_nodamage_id (struct block_list *src, struct block_list *bl, in
clif_skill_nodamage(src,bl,skillid,skilllv,1);
i = status_get_sc_def_mdef(bl);
if (i >= 10000 ||
+ (dstsd && (dstsd->class_&MAPID_UPPERMASK) == MAPID_SOUL_LINKER) ||
tsc == NULL || (tsc->data[SC_SPIRIT].timer != -1 && tsc->data[SC_SPIRIT].val2 == SL_ROGUE) || //Rogue's spirit defends againt dispel.
//Fixed & changed to use a proportionnal reduction (no info, but seems far more logical) [DracoRPG]
rand()%10000 >= (10000-i)*(50+10*skilllv)/100)
@@ -9333,8 +9336,9 @@ int skill_landprotector (struct block_list *bl, va_list ap)
break;
}
if (unit->group->skill_id == SA_LANDPROTECTOR &&
- !(skill_get_unit_flag(skillid)&(UF_DANCE|UF_SONG|UF_ENSEMBLE)))
- { //It deletes everything except songs/dances/encores.
+ skill_get_type(skillid) == BF_MAGIC)
+// !(skill_get_unit_flag(skillid)&(UF_DANCE|UF_SONG|UF_ENSEMBLE)))
+ { //When LP is already placed, all it does it prevent magic spells from being placed.
(*alive) = 0;
return 1;
}
@@ -9355,10 +9359,9 @@ int skill_ganbatein (struct block_list *bl, va_list ap)
if ((unit = (struct skill_unit *)bl) == NULL || unit->group == NULL)
return 0;
-// Apparently, it REMOVES traps.
-// if (skill_get_inf2(unit->group->skill_id)&INF2_TRAP)
-// return 0; //Do not remove traps.
-
+ if (unit->group->state.song_dance)
+ return 0; //Don't touch song/dance/ensemble.
+
if (unit->group->skill_id == SA_LANDPROTECTOR)
skill_delunit(unit, 1);
else skill_delunitgroup(NULL, unit->group, 1);
diff --git a/src/map/status.c b/src/map/status.c
index 8c26ad3d7..2c5a5c7e5 100644
--- a/src/map/status.c
+++ b/src/map/status.c
@@ -1520,6 +1520,9 @@ int status_calc_pc(struct map_session_data* sd,int first)
int i,index;
int skill,refinedef=0;
+ if(sd->state.connect_new && !first&1) //Shouldn't invoke yet until player is done loading.
+ return -1;
+
if (++calculating > 10) //Too many recursive calls!
return -1;
@@ -4166,11 +4169,11 @@ int status_isdead(struct block_list *bl)
int status_isimmune(struct block_list *bl)
{
struct status_change *sc =status_get_sc(bl);
+ if (sc && sc->count && sc->data[SC_HERMODE].timer != -1)
+ return 1;
if (bl->type == BL_PC &&
((TBL_PC*)bl)->special_state.no_magic_damage)
return ((TBL_PC*)bl)->special_state.no_magic_damage > battle_config.gtb_sc_immunity;
- if (sc && sc->count && sc->data[SC_HERMODE].timer != -1)
- return 1;
return 0;
}