Browse Source

Made some cleanup in changesex

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@12626 54d463be-8e91-2dee-dedb-b68131a5f0ec
toms 17 năm trước cách đây
mục cha
commit
ccb23efe49
5 tập tin đã thay đổi với 9 bổ sung14 xóa
  1. 1 0
      Changelog-Trunk.txt
  2. 1 1
      src/char/char.c
  3. 1 1
      src/char_sql/char.c
  4. 5 1
      src/map/chrif.c
  5. 1 11
      src/map/script.c

+ 1 - 0
Changelog-Trunk.txt

@@ -4,6 +4,7 @@ AS OF SVN REV. 5091, WE ARE NOW USING TRUNK.  ALL UNTESTED BUGFIXES/FEATURES GO
 IF YOU HAVE A WORKING AND TESTED BUGFIX PUT IT INTO STABLE AS WELL AS TRUNK.
 
 2008/04/19
+	* Made some cleanup in changesex [Toms]
 	* Fixed a bug in (init/start/stop)npctimer [Toms]
 2008/04/18
 	* Fixed a bug when unloading a npc near a shop.

+ 1 - 1
src/char/char.c

@@ -3000,7 +3000,7 @@ int parse_frommap(int fd)
 			}
 
 			// send answer if a player ask, not if the server ask
-			if( acc != -1 ) {
+			if( acc != -1 && type != 5) { // Don't send answer for changesex
 				WFIFOHEAD(fd,34);
 				WFIFOW(fd, 0) = 0x2b0f;
 				WFIFOL(fd, 2) = acc;

+ 1 - 1
src/char_sql/char.c

@@ -2599,7 +2599,7 @@ int parse_frommap(int fd)
 			Sql_FreeResult(sql_handle);
 
 			// send answer if a player ask, not if the server ask
-			if( acc != -1 ) {
+			if( acc != -1 && type != 5) { // Don't send answer for changesex
 				WFIFOHEAD(fd,34);
 				WFIFOW(fd, 0) = 0x2b0f;
 				WFIFOL(fd, 2) = acc;

+ 5 - 1
src/map/chrif.c

@@ -786,7 +786,11 @@ int chrif_changesex(struct map_session_data *sd)
 	WFIFOSET(char_fd,44);
 
 	clif_displaymessage(sd->fd, "Need disconnection to perform change-sex request...");
-	map_quit(sd);
+
+	if (sd->fd)
+		clif_authfail_fd(sd->fd, 15);
+	else
+		map_quit(sd);
 	return 0;
 }
 

+ 1 - 11
src/map/script.c

@@ -8506,17 +8506,7 @@ BUILDIN_FUNC(changesex)
 	TBL_PC *sd = NULL;
 	sd = script_rid2sd(st);
 
-	if (sd->status.sex == 0) {
-		sd->status.sex = 1;
-		if ((sd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER)
-			sd->status.class_ -= 1;
-	} else if (sd->status.sex == 1) {
-		sd->status.sex = 0;
-		if ((sd->class_&MAPID_UPPERMASK) == MAPID_BARDDANCER)
-			sd->status.class_ += 1;
-	}
-	chrif_char_ask_name(-1, sd->status.name, 5, 0, 0, 0, 0, 0, 0); // type: 5 - changesex
-	chrif_save(sd,0);
+	chrif_changesex(sd);
 	return 0;
 }