Explorar o código

- 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://svn.code.sf.net/p/rathena/svn/trunk@11134 54d463be-8e91-2dee-dedb-b68131a5f0ec

skotlex %!s(int64=17) %!d(string=hai) anos
pai
achega
574c76e799
Modificáronse 10 ficheiros con 63 adicións e 6 borrados
  1. 7 0
      Changelog-Trunk.txt
  2. 1 1
      conf-tmpl/msg_athena.conf
  3. 2 0
      db/packet_db.txt
  4. 34 0
      src/map/clif.c
  5. 6 0
      src/map/guild.c
  6. 1 1
      src/map/mob.c
  7. 1 1
      src/map/mob.h
  8. 5 0
      src/map/party.c
  9. 3 3
      src/map/script.c
  10. 3 0
      src/map/unit.c

+ 7 - 0
Changelog-Trunk.txt

@@ -3,6 +3,13 @@ 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.
 
+2007/09/07
+	* Added support for the new party invite/reply packets from the latest
+	  client version.
+	* Added auto-rejecting party/guild invites when the target is disconnected
+	  from the server.
+	* Changed the default @Main format to prevent crashes in the newer
+	  clients.
 2007/09/04
 	* bonus3 autospell (and autospell when hit) will now select for spell
 	  target self when the skill is tagged a support skill.

+ 1 - 1
conf-tmpl/msg_athena.conf

@@ -390,7 +390,7 @@
 383: Main chat already disabled.
 384: Main chat is currently enabled. Usage: @main <on|off>, @main <message>.
 385: Main chat is currently disabled. Usage: @main <on|off>, @main <message>.
-386: Main@%s: %s
+386: Main@%s : %s
 387: You cannot use Main chat while muted.
 388: You should enable main chat with "@main on" command.
 //NoAsk

+ 2 - 0
db/packet_db.txt

@@ -1017,6 +1017,8 @@ packet_ver: 22
 0x02ba,11,hotkey,2:4:5:9
 0x02bb,8
 0x02bc,6
+0x02c4,26,partyinvite2,2
+0x02c7,7,replypartyinvite2,2,6
 
 //Add new packets here
 //packet_ver: 23

+ 34 - 0
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"},

+ 6 - 0
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))

+ 1 - 1
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;

+ 1 - 1
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);

+ 5 - 0
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;

+ 3 - 3
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.
 	}

+ 3 - 0
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);