瀏覽代碼

git-svn-id: https://svn.code.sf.net/p/rathena/svn/athena@27 54d463be-8e91-2dee-dedb-b68131a5f0ec

mc_cameri 20 年之前
父節點
當前提交
0b048d6c92
共有 5 個文件被更改,包括 62 次插入7 次删除
  1. 1 0
      Changelog.txt
  2. 43 2
      src/map/atcommand.c
  3. 2 1
      src/map/atcommand.h
  4. 15 4
      src/map/chrif.c
  5. 1 0
      src/map/chrif.h

+ 1 - 0
Changelog.txt

@@ -1,5 +1,6 @@
 Date	Added
 11/06
+	* atcommand.c/.h,chrif.c/.h, added @changesex. [MC Cameri]
 	* mob.c & clif.c: Added & Modified a few parts dealing with monsters and guilds [Codemaster]
 	* mob.c: Re-did a few parts according to jA's 1057 version. [Codemaster]
 11/05

+ 43 - 2
src/map/atcommand.c

@@ -209,6 +209,7 @@ ATCOMMAND_FUNC(send); // by davidsiaw
 ATCOMMAND_FUNC(setbattleflag); // by MouseJstr
 ATCOMMAND_FUNC(unmute); // [Valaris]
 ATCOMMAND_FUNC(uptime); // by MC Cameri
+ATCOMMAND_FUNC(changesex); // by MC Cameri
 
 #ifndef TXT_ONLY
 ATCOMMAND_FUNC(checkmail); // [Valaris]
@@ -456,6 +457,7 @@ static AtCommandInfo atcommand_info[] = {
 	{ AtCommand_SetBattleFlag,		"@setbattleflag",	60, atcommand_setbattleflag },
 	{ AtCommand_UnMute,				"@unmute",			60, atcommand_unmute }, // [Valaris]
 	{ AtCommand_UpTime,				"@uptime",			 0, atcommand_uptime }, // by MC Cameri
+	{ AtCommand_ChangeSex,			"@changesex",		 1, atcommand_changesex }, // by MC Cameri
 
 #ifndef TXT_ONLY // sql-only commands
 	{ AtCommand_CheckMail,			"@checkmail",		 1, atcommand_listmail }, // [Valaris]
@@ -5923,8 +5925,8 @@ int atcommand_repairall(
 
 	count = 0;
 	for (i = 0; i < MAX_INVENTORY; i++) {
-		if (sd->status.inventory[i].nameid && sd->status.inventory[i].attribute == 1) {
-			sd->status.inventory[i].attribute = 0;
+		if (sd->status.inventory[i].nameid && sd->status.inventory[i].broken == 1) {
+			sd->status.inventory[i].broken = 0;
 			clif_produceeffect(sd, 0, sd->status.inventory[i].nameid);
 			count++;
 		}
@@ -7564,6 +7566,45 @@ atcommand_uptime(
 	return 0;
 }
 
+/*==========================================
+ * @changesex <sex>
+ * => Changes one's sex. Argument sex can be
+ * 0 or 1, m or f, male or female.
+ *------------------------------------------
+ */
+int
+atcommand_changesex(
+	const int fd, struct map_session_data* sd,
+	const char* command, const char* message)
+{
+
+//	char sex[200], output[200];
+	int isex = (sd->status.sex+1)%2;
+/*
+	if (!message || !*message)
+		return -1;
+	memset(sex, '\0', sizeof(sex));
+	if(sscanf(message, "%99[^\n]", sex) < 1)
+		return -1;
+	str_lower(sex);
+	if (strcmp(sex,"0") == 0 || strcmp(sex,"f") == 0 || strcmp(sex,"female") == 0) {
+		isex = 0;
+	} else if (strcmp(sex,"1") == 0 || strcmp(sex,"m") == 0 || strcmp(sex,"male") == 0) {
+		isex = 1;
+	} else {
+		clif_displaymessage(fd,msg_table[456]);
+		return 0;
+	}
+*/
+//	if (isex != sd->sex) {
+		chrif_changesex(sd->status.account_id, isex);
+//	} else {
+//		sprintf(output,msg_table[460],(isex == 0)?"female":"male");
+//		clif_displaymessage(fd,output);
+//	}
+	return 0;
+}
+
 #ifndef TXT_ONLY  /* Begin SQL-Only commands */
 
 /*==========================================

+ 2 - 1
src/map/atcommand.h

@@ -191,7 +191,8 @@ enum AtCommandType {
 	AtCommand_Send,
 	AtCommand_SetBattleFlag,
 	AtCommand_UnMute,
-	AtCommand_UpTime,	
+	AtCommand_UpTime,
+	AtCommand_ChangeSex,	
 	// SQL-only commands start
 #ifndef TXT_ONLY 
 	AtCommand_CheckMail, // [Valaris]

+ 15 - 4
src/map/chrif.c

@@ -414,6 +414,20 @@ int chrif_char_ask_name(int id, char * character_name, short operation_type, int
 	return 0;
 }
 
+/*==========================================
+ * 性別変化要求
+ *------------------------------------------
+ */
+int chrif_changesex(int id, int sex) {
+	WFIFOW(char_fd,0) = 0x2b0c;
+	WFIFOW(char_fd,2) = 9;
+	WFIFOL(char_fd,4) = id;
+	WFIFOB(char_fd,8) = sex;
+	printf("chrif : sended 0x2b0c\n");
+	WFIFOSET(char_fd,9);
+	return 0;
+}
+
 /*==========================================
  * Answer after a request about a character name to do some operations (by Yor)
  * Used to answer of chrif_char_ask_name.
@@ -885,9 +899,7 @@ int chrif_parse(int fd)
 
 	// only char-server can have an access to here.
 	// so, if it isn't the char-server, we disconnect the session (fd != char_fd).
-	if(fd != char_fd)
-		session[fd]->eof = 1;
-	if(session[fd]->eof) {
+	if (fd != char_fd || session[fd]->eof) {
 		if (fd == char_fd) {
 			printf("Map-server can't connect to char-server (connection #%d).\n", fd);
 			char_fd = -1;
@@ -907,7 +919,6 @@ int chrif_parse(int fd)
 			if (r == 1) continue;	// intifで処理した
 			if (r == 2) return 0;	// intifで処理したが、データが足りない
 
-			close(fd);	// intifで処理できなかった
 			session[fd]->eof = 1;
 			return 0;
 		}

+ 1 - 0
src/map/chrif.h

@@ -23,6 +23,7 @@ int chrif_saveaccountreg2(struct map_session_data *sd);
 int chrif_reloadGMdb(void);
 int chrif_ragsrvinfo(int base_rate,int job_rate, int drop_rate);
 int chrif_char_offline(struct map_session_data *sd);
+int chrif_changesex(int id, int sex);
 
 int do_init_chrif(void);