From bbedfd67468dc5105169fc114a54d30ae1a36f23 Mon Sep 17 00:00:00 2001 From: skotlex Date: Fri, 7 Sep 2007 07:31:58 +0000 Subject: - Added support for the new party invite/reply packets from the latest client version. - Cleared up some TODO's - Added auto-rejecting party/guild invites when the target is disconnected from the server. - Added a correction in the walking code to abort it when map_moveblock cancels the player's walking (by warping/knocking back),the default code would fail because unit_stopwalking would do nothing since the walk timer was already -1 in that moment. - Corrected mob_randomwalk to use unsigned int for the tick variable. - Changed the default @Main format to prevent crashes in the newer clients. git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11134 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/map/clif.c | 34 ++++++++++++++++++++++++++++++++++ src/map/guild.c | 6 ++++++ src/map/mob.c | 2 +- src/map/mob.h | 2 +- src/map/party.c | 5 +++++ src/map/script.c | 6 +++--- src/map/unit.c | 3 +++ 7 files changed, 53 insertions(+), 5 deletions(-) (limited to 'src/map') diff --git a/src/map/clif.c b/src/map/clif.c index 8af8de5d8..16b6f19f0 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -10105,6 +10105,28 @@ void clif_parse_PartyInvite(int fd, struct map_session_data *sd) party_invite(sd, t_sd); } +void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) +{ + struct map_session_data *t_sd; + char *name = RFIFOP(fd,2); + name[NAME_LENGTH]='\0'; + + if(map[sd->bl.m].flag.partylock) + { //Guild locked. + clif_displaymessage(fd, msg_txt(227)); + return; + } + + t_sd = map_nick2sd(name); + + // @noask [LuzZza] + if(t_sd && t_sd->state.noask) { + clif_noask_sub(sd, t_sd, 1); + return; + } + + party_invite(sd, t_sd); +} /*========================================== * パーティ勧誘返答 *------------------------------------------*/ @@ -10118,6 +10140,16 @@ void clif_parse_ReplyPartyInvite(int fd,struct map_session_data *sd) } } +void clif_parse_ReplyPartyInvite2(int fd,struct map_session_data *sd) +{ + if(battle_config.basic_skill_check == 0 || pc_checkskill(sd,NV_BASIC) >= 5){ + party_reply_invite(sd,RFIFOL(fd,2),RFIFOB(fd,6)); + } else { + party_reply_invite(sd,RFIFOL(fd,2),-1); + clif_skill_fail(sd,1,0,4); + } +} + /*========================================== * パーティ脱退要求 *------------------------------------------*/ @@ -11820,7 +11852,9 @@ static int packetdb_readdb(void) {clif_parse_CreateParty,"createparty"}, {clif_parse_CreateParty2,"createparty2"}, {clif_parse_PartyInvite,"partyinvite"}, + {clif_parse_PartyInvite2,"partyinvite2"}, {clif_parse_ReplyPartyInvite,"replypartyinvite"}, + {clif_parse_ReplyPartyInvite2,"replypartyinvite2"}, {clif_parse_LeaveParty,"leaveparty"}, {clif_parse_RemovePartyMember,"removepartymember"}, {clif_parse_PartyChangeOption,"partychangeoption"}, diff --git a/src/map/guild.c b/src/map/guild.c index 462f2cd76..a0f894f18 100644 --- a/src/map/guild.c +++ b/src/map/guild.c @@ -648,6 +648,12 @@ int guild_invite(struct map_session_data *sd,struct map_session_data *tsd) return 0; } } + + if (!tsd->fd) { //You can't invite someone who has already disconnected. + clif_guild_inviteack(sd,1); + return 0; + } + if(tsd->status.guild_id>0 || tsd->guild_invite>0 || (agit_flag && map[tsd->bl.m].flag.gvg_castle)) diff --git a/src/map/mob.c b/src/map/mob.c index cd1fe1cc7..c6ab7418e 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1023,7 +1023,7 @@ int mob_unlocktarget(struct mob_data *md,int tick) /*========================================== * Random walk *------------------------------------------*/ -int mob_randomwalk(struct mob_data *md,int tick) +int mob_randomwalk(struct mob_data *md,unsigned int tick) { const int retrycount=20; int i,x,y,c,d; diff --git a/src/map/mob.h b/src/map/mob.h index e75de3912..93fe8225e 100644 --- a/src/map/mob.h +++ b/src/map/mob.h @@ -162,7 +162,7 @@ int mob_once_spawn_area(struct map_session_data *sd,const char *mapname, int mob_spawn_guardian(const char* mapname, short x, short y, const char* mobname, int class_, const char* event, int guardian); // Spawning Guardians [Valaris] int mob_guardian_guildchange(struct block_list *bl,va_list ap); //Change Guardian's ownership. [Skotlex] -int mob_randomwalk(struct mob_data *md,int tick); +int mob_randomwalk(struct mob_data *md,unsigned int tick); int mob_target(struct mob_data *md,struct block_list *bl,int dist); int mob_unlocktarget(struct mob_data *md,int tick); diff --git a/src/map/party.c b/src/map/party.c index eeb3d5b9a..6ae42a9f1 100644 --- a/src/map/party.c +++ b/src/map/party.c @@ -268,6 +268,11 @@ int party_invite(struct map_session_data *sd,struct map_session_data *tsd) return 0; } } + if (!tsd->fd) { //You can't invite someone who has already disconnected. + clif_party_inviteack(sd,tsd->status.name,1); + return 0; + } + if( tsd->status.party_id>0 || tsd->party_invite>0 ){ clif_party_inviteack(sd,tsd->status.name,0); return 0; diff --git a/src/map/script.c b/src/map/script.c index a98dffe5c..7e36818e9 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -8563,7 +8563,7 @@ BUILDIN_FUNC(sc_start) } if( potion_flag == 1 && potion_target ) - {//##TODO how does this work [FlavioJS] + { //skill.c set the flags before running the script, this must be a potion-pitched effect. bl = map_id2bl(potion_target); tick /= 2;// Thrown potions only last half. val4 = 1;// Mark that this was a thrown sc_effect @@ -8601,7 +8601,7 @@ BUILDIN_FUNC(sc_start2) } if( potion_flag == 1 && potion_target ) - {//##TODO how does this work [FlavioJS] + { //skill.c set the flags before running the script, this must be a potion-pitched effect. bl = map_id2bl(potion_target); tick /= 2;// Thrown potions only last half. val4 = 1;// Mark that this was a thrown sc_effect @@ -8643,7 +8643,7 @@ BUILDIN_FUNC(sc_start4) } if( potion_flag == 1 && potion_target ) - {//##TODO how does this work [FlavioJS] + { //skill.c set the flags before running the script, this must be a potion-pitched effect. bl = map_id2bl(potion_target); tick /= 2;// Thrown potions only last half. } diff --git a/src/map/unit.c b/src/map/unit.c index 05175a991..dc57dfd38 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -156,6 +156,9 @@ static int unit_walktoxy_timer(int tid,unsigned int tick,int id,int data) map_moveblock(bl, x, y, tick); ud->walk_count++; //walked cell counter, to be used for walk-triggered skills. [Skotlex] + if (bl->x != x || bl->y != y || ud->walktimer != -1) + return 0; //map_moveblock has altered the object beyond what we expected (moved/warped it) + ud->walktimer = 1; map_foreachinmovearea(clif_insight, bl, AREA_SIZE, -dx, -dy, sd?BL_ALL:BL_PC, bl); -- cgit v1.2.3-60-g2f50