summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWushin <pasekei@gmail.com>2015-04-29 22:42:04 -0500
committerWushin <pasekei@gmail.com>2015-04-29 22:42:04 -0500
commitf3c12939d5ba0dcbc4dcca4bb0384a55d776b2c8 (patch)
treeaff755e961e1a0fbcc9d7f1d0bde2d93b4800dc0
parentc7f0a0dbb9fe0cb42b0516ae1d4d60f72bd4ebb5 (diff)
parentf6bc49ce199bf3c60f2c319698f84d9064dd8616 (diff)
downloadtmwa-f3c12939d5ba0dcbc4dcca4bb0384a55d776b2c8.tar.gz
tmwa-f3c12939d5ba0dcbc4dcca4bb0384a55d776b2c8.tar.bz2
tmwa-f3c12939d5ba0dcbc4dcca4bb0384a55d776b2c8.tar.xz
tmwa-f3c12939d5ba0dcbc4dcca4bb0384a55d776b2c8.zip
Merge pull request #58 from mekolat/changesex
change sex without disconnecting
-rw-r--r--src/map/chrif.cpp7
-rw-r--r--src/map/pc.cpp3
-rw-r--r--src/map/script-fun.cpp15
3 files changed, 4 insertions, 21 deletions
diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp
index 24369ed..3ffeaf2 100644
--- a/src/map/chrif.cpp
+++ b/src/map/chrif.cpp
@@ -568,15 +568,14 @@ void chrif_changedsex(Session *, const Packet_Fixed<0x2b0d>& fixed)
{
if (sd->status.inventory[i].nameid
&& bool(sd->status.inventory[i].equip))
- pc_unequipitem(sd, i, CalcStatus::NOW);
+ pc_unequipitem(sd, i, CalcStatus::LATER);
}
+ pc_calcstatus(sd, 0);
// save character
chrif_save(sd);
sd->login_id1++; // change identify, because if player come back in char within the 5 seconds, he can change its characters
// do same modify in login-server for the account, but no in char-server (it ask again login_id1 to login, and don't remember it)
- clif_displaymessage(sd->sess,
- "Your sex has been changed (need disconexion by the server)..."_s);
- clif_setwaitclose(sd->sess); // forced to disconnect for the change
+ clif_fixpcpos(sd); // use clif_set0078_main_1d8 to send new sex to the client
}
}
else
diff --git a/src/map/pc.cpp b/src/map/pc.cpp
index 0a5df8a..751b6e1 100644
--- a/src/map/pc.cpp
+++ b/src/map/pc.cpp
@@ -3522,8 +3522,7 @@ int pc_setparam(dumb_ptr<map_session_data> sd, SP type, int val)
}
break;
case SP::SEX:
- // this is a really bad idea
- sd->sex = static_cast<SEX>(val);
+ chrif_char_ask_name(AccountId(), sd->status_key.name, 5, HumanTimeDiff());
break;
case SP::WEIGHT:
sd->weight = val;
diff --git a/src/map/script-fun.cpp b/src/map/script-fun.cpp
index 17fe943..af6a9f2 100644
--- a/src/map/script-fun.cpp
+++ b/src/map/script-fun.cpp
@@ -1987,20 +1987,6 @@ void builtin_resetstatus(ScriptState *st)
}
/*==========================================
- * 性別変換
- *------------------------------------------
- */
-static
-void builtin_changesex(ScriptState *st)
-{
- dumb_ptr<map_session_data> sd = nullptr;
- sd = script_rid2sd(st);
-
- chrif_char_ask_name(AccountId(), sd->status_key.name, 5, HumanTimeDiff()); // type: 5 - changesex
- chrif_save(sd);
-}
-
-/*==========================================
* RIDのアタッチ
*------------------------------------------
*/
@@ -3178,7 +3164,6 @@ BuiltinFunction builtin_functions[] =
BUILTIN(sc_check, "i"_s, 'i'),
BUILTIN(debugmes, "s"_s, '\0'),
BUILTIN(resetstatus, ""_s, '\0'),
- BUILTIN(changesex, ""_s, '\0'),
BUILTIN(attachrid, "i"_s, 'i'),
BUILTIN(detachrid, ""_s, '\0'),
BUILTIN(isloggedin, "i"_s, 'i'),