From 056aef958fb762526ba119379d46d5c2f1dd200c Mon Sep 17 00:00:00 2001 From: mekolat Date: Thu, 16 Apr 2015 11:09:09 -0400 Subject: change sex without disconnecting --- src/map/chrif.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'src') diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp index bf4ae4e..ec008b3 100644 --- a/src/map/chrif.cpp +++ b/src/map/chrif.cpp @@ -615,9 +615,7 @@ void chrif_changedsex(Session *, const Packet_Fixed<0x2b0d>& fixed) 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 -- cgit v1.2.3-70-g09d2 From 920e18c1b959780bbcea5d289c1c766239449776 Mon Sep 17 00:00:00 2001 From: mekolat Date: Thu, 16 Apr 2015 18:50:36 -0400 Subject: deprecate builtin changesex --- src/map/pc.cpp | 3 +-- src/map/script-fun.cpp | 15 --------------- 2 files changed, 1 insertion(+), 17 deletions(-) (limited to 'src') diff --git a/src/map/pc.cpp b/src/map/pc.cpp index 1e840ea..60f8da7 100644 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -3520,8 +3520,7 @@ int pc_setparam(dumb_ptr sd, SP type, int val) } break; case SP::SEX: - // this is a really bad idea - sd->sex = static_cast(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 3b814aa..65f8d2b 100644 --- a/src/map/script-fun.cpp +++ b/src/map/script-fun.cpp @@ -1986,20 +1986,6 @@ void builtin_resetstatus(ScriptState *st) pc_resetstate(sd); } -/*========================================== - * 性別変換 - *------------------------------------------ - */ -static -void builtin_changesex(ScriptState *st) -{ - dumb_ptr sd = nullptr; - sd = script_rid2sd(st); - - chrif_char_ask_name(AccountId(), sd->status_key.name, 5, HumanTimeDiff()); // type: 5 - changesex - chrif_save(sd); -} - /*========================================== * RIDのアタッチ *------------------------------------------ @@ -3167,7 +3153,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'), -- cgit v1.2.3-70-g09d2 From f6bc49ce199bf3c60f2c319698f84d9064dd8616 Mon Sep 17 00:00:00 2001 From: mekolat Date: Fri, 17 Apr 2015 08:24:55 -0400 Subject: do not recalc all at once --- src/map/chrif.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp index ec008b3..fc60ca7 100644 --- a/src/map/chrif.cpp +++ b/src/map/chrif.cpp @@ -609,8 +609,9 @@ 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 -- cgit v1.2.3-70-g09d2