summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authormc_cameri <mc_cameri@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-11-06 18:25:09 +0000
committermc_cameri <mc_cameri@54d463be-8e91-2dee-dedb-b68131a5f0ec>2004-11-06 18:25:09 +0000
commit8d3ea0cd76e3cce2e8a95db9acacf2d344126d1e (patch)
tree8df34f69aceeaf77535d8bd1669e7caa328c9b67 /src/map
parent2bfb5e33a095ac718884f7319cc22ca366780abf (diff)
downloadhercules-8d3ea0cd76e3cce2e8a95db9acacf2d344126d1e.tar.gz
hercules-8d3ea0cd76e3cce2e8a95db9acacf2d344126d1e.tar.bz2
hercules-8d3ea0cd76e3cce2e8a95db9acacf2d344126d1e.tar.xz
hercules-8d3ea0cd76e3cce2e8a95db9acacf2d344126d1e.zip
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/athena@27 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map')
-rw-r--r--src/map/atcommand.c45
-rw-r--r--src/map/atcommand.h3
-rw-r--r--src/map/chrif.c19
-rw-r--r--src/map/chrif.h1
4 files changed, 61 insertions, 7 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c
index a4c6fc745..e243680dd 100644
--- a/src/map/atcommand.c
+++ b/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 */
/*==========================================
diff --git a/src/map/atcommand.h b/src/map/atcommand.h
index 72d57af6a..c5ba3df58 100644
--- a/src/map/atcommand.h
+++ b/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]
diff --git a/src/map/chrif.c b/src/map/chrif.c
index 0423d792b..66f496d71 100644
--- a/src/map/chrif.c
+++ b/src/map/chrif.c
@@ -415,6 +415,20 @@ int chrif_char_ask_name(int id, char * character_name, short operation_type, int
}
/*==========================================
+ * 性別変化要求
+ *------------------------------------------
+ */
+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.
* type of operation:
@@ -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;
}
diff --git a/src/map/chrif.h b/src/map/chrif.h
index 3408c89ef..c01afedba 100644
--- a/src/map/chrif.h
+++ b/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);