From 6f6529a4bbc4dceaaed7e9c56b482e83fb809de9 Mon Sep 17 00:00:00 2001 From: Ben Longbons Date: Sat, 3 Jan 2015 12:11:33 -0800 Subject: Document every network packet's pre, post, and desc With pretty pictures (not a submodule because large images). Part of this commit was originally made by Rawng. --- src/admin/ladmin.cpp | 370 --------------------------------------------------- src/char/char.cpp | 86 ------------ src/login/login.cpp | 219 +----------------------------- src/map/battle.cpp | 11 -- src/map/battle.hpp | 1 - src/map/chrif.cpp | 133 +----------------- src/map/chrif.hpp | 1 - src/map/clif.cpp | 108 +-------------- src/map/clif.hpp | 5 - src/map/npc.cpp | 21 --- src/map/npc.hpp | 1 - src/map/pc.cpp | 180 +------------------------ src/map/pc.hpp | 5 +- src/mmo/skill.t.hpp | 3 + 14 files changed, 14 insertions(+), 1130 deletions(-) (limited to 'src') diff --git a/src/admin/ladmin.cpp b/src/admin/ladmin.cpp index e3557dd..97b570e 100644 --- a/src/admin/ladmin.cpp +++ b/src/admin/ladmin.cpp @@ -224,29 +224,6 @@ AString ladmin_log_filename = "log/ladmin.log"_s; // all other values are 'No MSG', then use state 9 please. // 'error_message_#7': message of the code error 6 = Your are Prohibited to log in until %s (packet 0x006a) // -// timeadd -// Adds or substracts time from the validity limit of an account. -// Modifier is done as follows: -// Adjustment value (-1, 1, +1, etc...) -// Modified element: -// a or y: year -// m: month -// j or d: day -// h: hour -// mn: minute -// s: second -// timeadd testname +1m-2mn1s-6y -// this example adds 1 month and 1 second, and substracts 2 minutes and 6 years at the same time. -// NOTE: You can not modify a unlimited validity limit. -// If you want modify it, you want probably create a limited validity limit. -// So, at first, you must set the validity limit to a date/time. -// -// timeset yyyy/mm/dd [hh:mm:ss] -// Changes the validity limit of an account. -// Default time [hh:mm:ss]: 23:59:59. -// timeset 0 -// Gives an unlimited validity limit (0 = unlimited). -// // unban/unbanish // Unban an account. // Like banset 0. @@ -491,13 +468,6 @@ void display_help(ZString param) PRINTF(" Research by name is not possible with this command.\n"_fmt); PRINTF(" list 10 9999999\n"_fmt); } - else if (command == "itemfrob"_s) - { - PRINTF("itemfrob \n"_fmt); - PRINTF(" Translates item IDs for all accounts.\n"_fmt); - PRINTF(" Any items matching the source item ID will be mapped to the dest-id.\n"_fmt); - PRINTF(" itemfrob 500 700\n"_fmt); - } else if (command == "listban"_s) { PRINTF("listban [start_id [end_id]]\n"_fmt); @@ -569,34 +539,6 @@ void display_help(ZString param) PRINTF(" 'error_message_#7': message of the code error 6\n"_fmt); PRINTF(" = Your are Prohibited to log in until... (packet 0x006a)\n"_fmt); } - else if (command == "timeadd"_s) - { - PRINTF("timeadd \n"_fmt); - PRINTF(" Adds or substracts time from the validity limit of an account.\n"_fmt); - PRINTF(" Modifier is done as follows:\n"_fmt); - PRINTF(" Adjustment value (-1, 1, +1, etc...)\n"_fmt); - PRINTF(" Modified element:\n"_fmt); - PRINTF(" a or y: year\n"_fmt); - PRINTF(" m: month\n"_fmt); - PRINTF(" j or d: day\n"_fmt); - PRINTF(" h: hour\n"_fmt); - PRINTF(" mn: minute\n"_fmt); - PRINTF(" s: second\n"_fmt); - PRINTF(" timeadd testname +1m-2mn1s-6y\n"_fmt); - PRINTF(" this example adds 1 month and 1 second, and substracts 2 minutes\n"_fmt); - PRINTF(" and 6 years at the same time.\n"_fmt); - PRINTF("NOTE: You can not modify a unlimited validity limit.\n"_fmt); - PRINTF(" If you want modify it, you want probably create a limited validity limit.\n"_fmt); - PRINTF(" So, at first, you must set the validity limit to a date/time.\n"_fmt); - } - else if (command == "timeadd"_s) - { - PRINTF("timeset yyyy/mm/dd [hh:mm:ss]\n"_fmt); - PRINTF(" Changes the validity limit of an account.\n"_fmt); - PRINTF(" Default time [hh:mm:ss]: 23:59:59.\n"_fmt); - PRINTF("timeset 0\n"_fmt); - PRINTF(" Gives an unlimited validity limit (0 = unlimited).\n"_fmt); - } else if (command == "unban"_s) { PRINTF("unban/unbanish \n"_fmt); @@ -648,7 +590,6 @@ void display_help(ZString param) PRINTF(" gm [GM_level] -- Modify the GM level of an account\n"_fmt); PRINTF(" id -- Give the id of an account\n"_fmt); PRINTF(" info -- Display all information of an account\n"_fmt); - PRINTF(" itemfrob -- Map all items from one item ID to another\n"_fmt); PRINTF(" kami -- Sends a broadcast message (in yellow)\n"_fmt); PRINTF(" kamib -- Sends a broadcast message (in blue)\n"_fmt); PRINTF(" list [First_id [Last_id]] -- Display a list of accounts\n"_fmt); @@ -665,10 +606,6 @@ void display_help(ZString param) PRINTF(" search -- Seek accounts\n"_fmt); PRINTF(" sex -- Modify the sex of an account\n"_fmt); PRINTF(" state -- Change the state\n"_fmt); - PRINTF(" timeadd -- Add or substract time from the\n"_fmt); - PRINTF(" example: ta apple +1m-2mn1s-2y validity limit of an account\n"_fmt); - PRINTF(" timeset yyyy/mm/dd [hh:mm:ss] -- Change the validify limit\n"_fmt); - PRINTF(" timeset 0 -- Give a unlimited validity limit\n"_fmt); PRINTF(" unban -- Remove the banishment of an account\n"_fmt); PRINTF(" unblock -- Set state 0 (Account ok) to an account\n"_fmt); PRINTF(" version -- Gives the version of the login-server\n"_fmt); @@ -1264,29 +1201,6 @@ void listaccount(ZString param, int type) list_count = 0; } -//-------------------------------------------------------- -// Sub-function: Frobnicate items -//-------------------------------------------------------- -static -int itemfrob(ZString param) -{ - ItemNameId source_id, dest_id; - - if (!extract(param, record<' '>(&source_id, &dest_id))) - { - PRINTF("You must provide the source and destination item IDs.\n"_fmt); - return 1; - } - - Packet_Fixed<0x7924> fixed_24; - fixed_24.source_item_id = source_id; - fixed_24.dest_item_id = dest_id; - send_fpacket<0x7924, 10>(login_session, fixed_24); - bytes_to_read = 1; // all logging is done to the three main servers - - return 0; -} - //-------------------------------------------- // Sub-function: Asking to modify a memo field //-------------------------------------------- @@ -1556,179 +1470,6 @@ void blockaccount(ZString param) changestatesub(name, 5, "-"_s); // state 5, no error message } -//--------------------------------------------------------------------- -// Sub-function: Add/substract time to the validity limit of an account -//--------------------------------------------------------------------- -static -void timeaddaccount(ZString param) -{ - AccountName name; - HumanTimeDiff modif {}; - - if (!qsplit(param, &name, &modif)) - { - PRINTF("Please input an account name and a modifier.\n"_fmt); - PRINTF(" : timeadd testname +1m-2mn1s-6y\n"_fmt); - PRINTF(" this example adds 1 month and 1 second, and substracts 2 minutes\n"_fmt); - PRINTF(" and 6 years at the same time.\n"_fmt); - LADMIN_LOG("Incomplete parameters to modify a limit time ('timeadd' command).\n"_fmt); - return; - } - if (name.is_print()) - { - return; - } - - if (!modif) - { - PRINTF("Please give an adjustment with this command:\n"_fmt); - PRINTF(" Adjustment value (-1, 1, +1, etc...)\n"_fmt); - PRINTF(" Modified element:\n"_fmt); - PRINTF(" a or y: year\n"_fmt); - PRINTF(" m: month\n"_fmt); - PRINTF(" j or d: day\n"_fmt); - PRINTF(" h: hour\n"_fmt); - PRINTF(" mn: minute\n"_fmt); - PRINTF(" s: second\n"_fmt); - PRINTF(" timeadd testname +1m-2mn1s-6y\n"_fmt); - PRINTF(" this example adds 1 month and 1 second, and substracts 2 minutes\n"_fmt); - PRINTF(" and 6 years at the same time.\n"_fmt); - LADMIN_LOG("No adjustment isn't an adjustment ('timeadd' command).\n"_fmt); - return; - } - - LADMIN_LOG("Request to login-server to modify a time limit.\n"_fmt); - - Packet_Fixed<0x7950> fixed_50; - fixed_50.account_name = name; - fixed_50.valid_add = modif; - send_fpacket<0x7950, 38>(login_session, fixed_50); - bytes_to_read = 1; -} - -//------------------------------------------------- -// Sub-function: Set a validity limit of an account -//------------------------------------------------- -static -void timesetaccount(ZString param) -{ - AccountName name; - XString date; - XString time_; - int year, month, day, hour, minute, second; - - year = month = day = hour = minute = second = 0; - - // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited) - TimeT connect_until_time = TimeT(); - struct tm tmtime = connect_until_time; // initialize - - if (!qsplit(param, &name, &date, &time_) - && !qsplit(param, &name, &date)) - { - PRINTF("Please input an account name, a date and a hour.\n"_fmt); - PRINTF(": timeset yyyy/mm/dd [hh:mm:ss]\n"_fmt); - PRINTF(" timeset 0 (0 = unlimited)\n"_fmt); - PRINTF(" Default time [hh:mm:ss]: 23:59:59.\n"_fmt); - LADMIN_LOG("Incomplete parameters to set a limit time ('timeset' command).\n"_fmt); - return; - } - if (!name.is_print()) - return; - - if (!time_) - time_ = "23:59:59"_s; - - if (date != "0"_s - && ((!extract(date, record<'/'>(&year, &month, &day)) - && !extract(date, record<'-'>(&year, &month, &day)) - && !extract(date, record<'.'>(&year, &month, &day))) - || !extract(time_, record<':'>(&hour, &minute, &second)))) - { - PRINTF("Please input 0 or a date and a time (format: 0 or yyyy/mm/dd hh:mm:ss).\n"_fmt); - LADMIN_LOG("Invalid format for the date/time ('timeset' command).\n"_fmt); - return; - } - - if (date == "0"_s) - { - connect_until_time = TimeT(); - } - else - { - if (year < 70) - { - year = year + 100; - } - if (year >= 1900) - { - year = year - 1900; - } - if (month < 1 || month > 12) - { - PRINTF("Please give a correct value for the month (from 1 to 12).\n"_fmt); - LADMIN_LOG("Invalid month for the date ('timeset' command).\n"_fmt); - return; - } - month = month - 1; - if (day < 1 || day > 31) - { - PRINTF("Please give a correct value for the day (from 1 to 31).\n"_fmt); - LADMIN_LOG("Invalid day for the date ('timeset' command).\n"_fmt); - return; - } - if (((month == 3 || month == 5 || month == 8 || month == 10) - && day > 30) ||(month == 1 && day > 29)) - { - PRINTF("Please give a correct value for a day of this month (%d).\n"_fmt, - month); - LADMIN_LOG("Invalid day for this month ('timeset' command).\n"_fmt); - return; - } - if (hour < 0 || hour > 23) - { - PRINTF("Please give a correct value for the hour (from 0 to 23).\n"_fmt); - LADMIN_LOG("Invalid hour for the time ('timeset' command).\n"_fmt); - return; - } - if (minute < 0 || minute > 59) - { - PRINTF("Please give a correct value for the minutes (from 0 to 59).\n"_fmt); - LADMIN_LOG("Invalid minute for the time ('timeset' command).\n"_fmt); - return; - } - if (second < 0 || second > 59) - { - PRINTF("Please give a correct value for the seconds (from 0 to 59).\n"_fmt); - LADMIN_LOG("Invalid second for the time ('timeset' command).\n"_fmt); - return; - } - tmtime.tm_year = year; - tmtime.tm_mon = month; - tmtime.tm_mday = day; - tmtime.tm_hour = hour; - tmtime.tm_min = minute; - tmtime.tm_sec = second; - tmtime.tm_isdst = -1; // -1: no winter/summer time modification - connect_until_time = tmtime; - if (connect_until_time.error()) - { - PRINTF("Invalid date.\n"_fmt); - PRINTF("Please add 0 or a date and a time (format: 0 or yyyy/mm/dd hh:mm:ss).\n"_fmt); - LADMIN_LOG("Invalid date. ('timeset' command).\n"_fmt); - return; - } - } - - LADMIN_LOG("Request to login-server to set a time limit.\n"_fmt); - - Packet_Fixed<0x7948> fixed_48; - fixed_48.account_name = name; - fixed_48.valid_until = connect_until_time; - send_fpacket<0x7948, 30>(login_session, fixed_48); - bytes_to_read = 1; -} - //------------------------------------------------------------------------------ // Sub-function: Asking to displaying information about an account (by its name) //------------------------------------------------------------------------------ @@ -1878,8 +1619,6 @@ void prompt(void) infoaccount(wrap(static_cast(atoi(parameters.c_str())))); else if (command == "kami"_s) sendbroadcast(parameters); // flag for normal - else if (command == "itemfrob"_s) - itemfrob(parameters); // 0: to list all else if (command == "list"_s) listaccount(parameters, 0); // 0: to list all else if (command == "listban"_s) @@ -1902,10 +1641,6 @@ void prompt(void) changesex(parameters); else if (command == "state"_s) changestate(parameters); - else if (command == "timeadd"_s) - timeaddaccount(parameters); - else if (command == "timeset"_s) - timesetaccount(parameters); else if (command == "unban"_s) unbanaccount(parameters); else if (command == "unblock"_s) @@ -1990,17 +1725,6 @@ void parse_fromlogin(Session *s) break; } - case 0x7925: // Itemfrob-OK - { - Packet_Fixed<0x7925> fixed; - rv = recv_fpacket<0x7925, 2>(s, fixed); - if (rv != RecvResult::Complete) - break; - - bytes_to_read = 0; - break; - } - case 0x7921: // Displaying of the list of accounts { std::vector> repeat; @@ -2491,47 +2215,6 @@ void parse_fromlogin(Session *s) break; } - case 0x7949: // answer of an account validity limit set - { - Packet_Fixed<0x7949> fixed; - rv = recv_fpacket<0x7949, 34>(s, fixed); - if (rv != RecvResult::Complete) - break; - - AccountId account_id = fixed.account_id; - AccountName name = fixed.account_name; - if (!account_id) - { - PRINTF("Account [%s] validity limit changing failed. Account doesn't exist.\n"_fmt, - name); - LADMIN_LOG("Account [%s] validity limit changing failed. Account doesn't exist.\n"_fmt, - name); - } - else - { - TimeT timestamp = fixed.valid_until; - if (!timestamp) - { - PRINTF("Validity Limit of the account [%s][id: %d] successfully changed to [unlimited].\n"_fmt, - name, account_id); - LADMIN_LOG("Validity Limit of the account [%s][id: %d] successfully changed to [unlimited].\n"_fmt, - name, account_id); - } - else - { - timestamp_seconds_buffer tmpstr; - stamp_time(tmpstr, ×tamp); - PRINTF("Validity Limit of the account [%s][id: %d] successfully changed to be until %s.\n"_fmt, - name, account_id, tmpstr); - LADMIN_LOG("Validity Limit of the account [%s][id: %d] successfully changed to be until %s.\n"_fmt, - name, account_id, - tmpstr); - } - } - bytes_to_read = 0; - break; - } - case 0x794b: // answer of an account ban set { Packet_Fixed<0x794b> fixed; @@ -2636,50 +2319,6 @@ void parse_fromlogin(Session *s) break; } - case 0x7951: // answer of an account validity limit changing - { - Packet_Fixed<0x7951> fixed; - rv = recv_fpacket<0x7951, 34>(s, fixed); - if (rv != RecvResult::Complete) - break; - - AccountId account_id = fixed.account_id; - AccountName name = fixed.account_name; - if (!account_id) - { - PRINTF("Account [%s] validity limit changing failed. Account doesn't exist.\n"_fmt, - name); - LADMIN_LOG("Account [%s] validity limit changing failed. Account doesn't exist.\n"_fmt, - name); - } - else - { - TimeT timestamp = fixed.valid_until; - if (!timestamp) - { - PRINTF("Validity limit of the account [%s][id: %d] unchanged.\n"_fmt, - name, account_id); - PRINTF("The account have an unlimited validity limit or\n"_fmt); - PRINTF("the changing is impossible with the proposed adjustments.\n"_fmt); - LADMIN_LOG("Validity limit of the account [%s][id: %d] unchanged. The account have an unlimited validity limit or the changing is impossible with the proposed adjustments.\n"_fmt, - name, account_id); - } - else - { - timestamp_seconds_buffer tmpstr; - stamp_time(tmpstr, ×tamp); - PRINTF("Validity limit of the account [%s][id: %d] successfully changed to be until %s.\n"_fmt, - name, account_id, - tmpstr); - LADMIN_LOG("Validity limit of the account [%s][id: %d] successfully changed to be until %s.\n"_fmt, - name, account_id, - tmpstr); - } - } - bytes_to_read = 0; - break; - } - case 0x7953: // answer of a request about informations of an account (by account name/id) { Packet_Head<0x7953> head; @@ -2700,7 +2339,6 @@ void parse_fromlogin(Session *s) timestamp_milliseconds_buffer lastlogin = head.last_login_string; VString<15> last_ip_ = head.ip_string; AccountEmail email = head.email; - TimeT connect_until_time = head.connect_until; TimeT ban_until_time = head.ban_until; AString& memo = repeat; if (!account_id) @@ -2794,17 +2432,9 @@ void parse_fromlogin(Session *s) connections); PRINTF(" Last connection at: %s (ip: %s)\n"_fmt, lastlogin, last_ip_); - if (!connect_until_time) { PRINTF(" Validity limit: unlimited.\n"_fmt); } - else - { - timestamp_seconds_buffer tmpstr; - stamp_time(tmpstr, &connect_until_time); - PRINTF(" Validity limit: until %s.\n"_fmt, - tmpstr); - } PRINTF(" Memo: '%s'\n"_fmt, memo); } } diff --git a/src/char/char.cpp b/src/char/char.cpp index 0b166c2..8ce2165 100644 --- a/src/char/char.cpp +++ b/src/char/char.cpp @@ -145,7 +145,6 @@ struct char_session_data : SessionData SEX sex; unsigned short packet_tmw_version; AccountEmail email; - TimeT connect_until_time; }; void SessionDeleter::operator()(SessionData *sd) @@ -162,7 +161,6 @@ struct AuthFifoEntry int delflag; SEX sex; unsigned short packet_tmw_version; - TimeT connect_until_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited) }; static std::array auth_fifo; @@ -1287,7 +1285,6 @@ void parse_tologin(Session *ls) sd->email = stringish(fixed.email); if (!e_mail_check(sd->email)) sd->email = DEFAULT_EMAIL; - sd->connect_until_time = fixed.connect_until; // send characters to player mmo_char_send006b(s2, sd); } @@ -1326,7 +1323,6 @@ void parse_tologin(Session *ls) sd->email = fixed.email; if (!e_mail_check(sd->email)) sd->email = DEFAULT_EMAIL; - sd->connect_until_time = fixed.connect_until; break; } } @@ -1484,64 +1480,6 @@ void parse_tologin(Session *ls) break; } - case 0x7924: - { // [Fate] Itemfrob package: forwarded from login-server - Packet_Fixed<0x7924> fixed; - rv = recv_fpacket<0x7924, 10>(ls, fixed); - if (rv != RecvResult::Complete) - break; - - ItemNameId source_id = fixed.source_item_id; - ItemNameId dest_id = fixed.dest_item_id; - - Packet_Fixed<0x2afa> fixed_fa; - fixed_fa.source_item_id = source_id; - fixed_fa.dest_item_id = dest_id; - - // forward package to map servers - for (Session *ss : iter_map_sessions()) - { - send_fpacket<0x2afa, 10>(ss, fixed_fa); - } - - for (CharPair& cp : char_keys) - { - CharKey *k = &cp.key; - CharData& cd = *cp.data.get(); - CharData *c = &cd; - Borrowed s = account2storage(k->account_id); - int changes = 0; -#define FIX(v) if (v == source_id) {v = dest_id; ++changes; } - for (IOff0 j : IOff0::iter()) - { - FIX(c->inventory[j].nameid); - } - // used to FIX cart, but it's no longer supported - // FIX(c->weapon); - FIX(c->shield); - FIX(c->head_top); - FIX(c->head_mid); - FIX(c->head_bottom); - - { - for (SOff0 j : SOff0::iter()) - { - FIX(s->storage_[j].nameid); - } - } -#undef FIX - if (changes) - CHAR_LOG("itemfrob(%d -> %d): `%s'(%d, account %d): changed %d times\n"_fmt, - source_id, dest_id, k->name, k->char_id, - k->account_id, changes); - - } - - mmo_char_sync(); - inter_storage_save(); - break; - } - // Account deletion notification (from login-server) case 0x2730: { @@ -1739,22 +1677,6 @@ void parse_frommap(Session *ms) { switch (packet_id) { - // request from map-server to reload GM accounts. Transmission to login-server (by Yor) - case 0x2af7: - { - Packet_Fixed<0x2af7> fixed; - rv = recv_fpacket<0x2af7, 2>(ms, fixed); - if (rv != RecvResult::Complete) - break; - - if (login_session) - { // don't send request if no login-server - Packet_Fixed<0x2709> fixed_09; - send_fpacket<0x2709, 2>(login_session, fixed_09); - } - break; - } - // Receiving map names list from the map-server case 0x2afa: { @@ -1880,7 +1802,6 @@ void parse_frommap(Session *ms) Packet_Payload<0x2afd> payload_fd; // not file descriptor payload_fd.account_id = account_id; payload_fd.login_id2 = afi.login_id2; - payload_fd.connect_until = afi.connect_until_time; cd->sex = afi.sex; payload_fd.packet_tmw_version = afi.packet_tmw_version; FPRINTF(stderr, @@ -1986,7 +1907,6 @@ void parse_frommap(Session *ms) auth_fifo_iter->login_id1 = fixed.login_id1; auth_fifo_iter->login_id2 = fixed.login_id2; auth_fifo_iter->delflag = 2; - auth_fifo_iter->connect_until_time = TimeT(); // unlimited/unknown time by default (not display in map-server) auth_fifo_iter->ip = fixed.ip; auth_fifo_iter++; @@ -2025,7 +1945,6 @@ void parse_frommap(Session *ms) auth_fifo_iter->char_id = fixed.char_id; auth_fifo_iter->delflag = 0; auth_fifo_iter->sex = fixed.sex; - auth_fifo_iter->connect_until_time = TimeT(); // unlimited/unknown time by default (not display in map-server) auth_fifo_iter->ip = fixed.client_ip; // default, if not found in the loop @@ -2417,7 +2336,6 @@ void handle_x0066(Session *s, struct char_session_data *sd, uint8_t rfifob_2, IP auth_fifo_iter->login_id2 = sd->login_id2; auth_fifo_iter->delflag = 0; auth_fifo_iter->sex = sd->sex; - auth_fifo_iter->connect_until_time = sd->connect_until_time; auth_fifo_iter->ip = s->client_ip; auth_fifo_iter->packet_tmw_version = sd->packet_tmw_version; auth_fifo_iter++; @@ -2486,7 +2404,6 @@ void parse_char(Session *s) s->session_data = make_unique(); sd = static_cast(s->session_data.get()); sd->email = stringish("no mail"_s); // put here a mail without '@' to refuse deletion if we don't receive the e-mail - sd->connect_until_time = TimeT(); // unknow or illimited (not displaying on map-server) } sd->account_id = account_id; sd->login_id1 = fixed.login_id1; @@ -2665,9 +2582,6 @@ void parse_char(Session *s) s->set_eof(); return; } - AccountEmail email = fixed.email; - if (!e_mail_check(email)) - email = DEFAULT_EMAIL; { { diff --git a/src/login/login.cpp b/src/login/login.cpp index fa528ba..526eb5d 100644 --- a/src/login/login.cpp +++ b/src/login/login.cpp @@ -177,8 +177,6 @@ GmLevel min_level_to_connect = GmLevel::from(0_u32); // minimum level of player static int add_to_unlimited_account = 0; // Give possibility or not to adjust (ladmin command: timeadd) the time of an unlimited account. static -int start_limited_time = -1; // Starting additional sec from now for the limited time at creation of accounts (-1: unlimited time, 0 or more: additional sec from now) -static int check_ip_flag = 1; // It's to check IP of a player between login-server and char-server (part of anti-hacking system) DIAG_PUSH(); @@ -216,7 +214,6 @@ struct AuthData AccountEmail email; // e-mail (by default: a@a.com) timestamp_seconds_buffer error_message; // Message of error code #6 = Your are Prohibited to log in until %s (packet 0x006a) TimeT ban_until_time; // # of seconds 1/1/1970 (timestamp): ban time limit of the account (0 = no ban) - TimeT connect_until_time; // # of seconds 1/1/1970 (timestamp): Validity limit of the account (0 = unlimited) IP4Address last_ip; // save of last IP of connection VString<254> memo; // a memo field int account_reg2_num; @@ -482,7 +479,7 @@ AString mmo_auth_tostr(const AuthData *p) p->state, p->email, p->error_message, - p->connect_until_time, + TimeT(), p->last_ip, p->memo, p->ban_until_time); @@ -499,6 +496,7 @@ AString mmo_auth_tostr(const AuthData *p) static bool extract(XString line, AuthData *ad) { + TimeT unused_connect_until_time; std::vector vars; VString<1> sex; VString<15> ip; @@ -513,7 +511,7 @@ bool extract(XString line, AuthData *ad) &ad->state, &ad->email, &ad->error_message, - &ad->connect_until_time, + &unused_connect_until_time, &ip, &ad->memo, &ad->ban_until_time, @@ -797,17 +795,6 @@ AccountId mmo_auth_new(struct mmo_account *account, SEX sex, AccountEmail email) ad.error_message = stringish("-"_s); ad.ban_until_time = TimeT(); - if (start_limited_time < 0) - ad.connect_until_time = TimeT(); // unlimited - else - { - // limited time - TimeT timestamp = static_cast(TimeT::now()) + start_limited_time; - // there used to be a silly overflow check here, but it wasn't - // correct, and we don't support time-limited accounts. - ad.connect_until_time = timestamp; - } - ad.last_ip = IP4Address(); ad.memo = "!"_s; ad.account_reg2_num = 0; @@ -901,14 +888,6 @@ int mmo_auth(struct mmo_account *account, Session *s) } } - if (ad->connect_until_time - && ad->connect_until_time < TimeT::now()) - { - LOGIN_LOG("Connection refused (account: %s, expired ID, ip: %s)\n"_fmt, - account->userid, ip); - return 2; // 2 = This ID is expired - } - LOGIN_LOG("Authentification accepted (account: %s (id: %d), ip: %s)\n"_fmt, account->userid, ad->account_id, ip); } @@ -997,22 +976,6 @@ void parse_fromchar(Session *s) switch (packet_id) { - // request from map-server via char-server to reload GM accounts (by Yor). - case 0x2709: - { - Packet_Fixed<0x2709> fixed; - rv = recv_fpacket<0x2709, 2>(s, fixed); - if (rv != RecvResult::Complete) - break; - - LOGIN_LOG("Char-server '%s': Request to re-load GM configuration file (ip: %s).\n"_fmt, - server[id].name, ip); - read_gm_account(); - // send GM accounts to all char-servers - send_GM_accounts(); - break; - } - case 0x2712: // request from char-server to authentify an account { Packet_Fixed<0x2712> fixed; @@ -1059,7 +1022,6 @@ void parse_fromchar(Session *s) fixed_13.account_id = acc; fixed_13.invalid = 0; fixed_13.email = ad.email; - fixed_13.connect_until = ad.connect_until_time; send_fpacket<0x2713, 51>(s, fixed_13); break; @@ -1118,7 +1080,6 @@ void parse_fromchar(Session *s) Packet_Fixed<0x2717> fixed_17; fixed_17.account_id = account_id; fixed_17.email = ad.email; - fixed_17.connect_until = ad.connect_until_time; send_fpacket<0x2717, 50>(s, fixed_17); if (rv != RecvResult::Complete) @@ -1720,23 +1681,6 @@ void parse_admin(Session *s) break; } - case 0x7924: - { // [Fate] Itemfrob package: change item IDs - Packet_Fixed<0x7924> fixed; - rv = recv_fpacket<0x7924, 10>(s, fixed); - if (rv != RecvResult::Complete) - break; - - for (Session *ss : iter_char_sessions()) - { - send_fpacket<0x7924, 10>(ss, fixed); - } - - Packet_Fixed<0x7925> fixed_25; - send_fpacket<0x7925, 2>(s, fixed_25); - break; - } - case 0x7930: // Request for an account creation { Packet_Fixed<0x7930> fixed; @@ -2332,48 +2276,6 @@ void parse_admin(Session *s) break; } - case 0x7948: // Request to change the validity limit (timestamp) (absolute value) - { - Packet_Fixed<0x7948> fixed; - rv = recv_fpacket<0x7948, 30>(s, fixed); - if (rv != RecvResult::Complete) - break; - - Packet_Fixed<0x7949> fixed_49; - { - fixed_49.account_id = AccountId(); - AccountName account_name = stringish(fixed.account_name.to_print()); - TimeT timestamp = fixed.valid_until; - timestamp_seconds_buffer tmpstr = stringish("unlimited"_s); - if (timestamp) - stamp_time(tmpstr, ×tamp); - AuthData *ad = search_account(account_name); - if (ad) - { - fixed_49.account_name = ad->userid; - LOGIN_LOG("'ladmin': Change of a validity limit (account: %s, new validity: %lld (%s), ip: %s)\n"_fmt, - ad->userid, - timestamp, - tmpstr, - ip); - ad->connect_until_time = timestamp; - fixed_49.account_id = ad->account_id; - } - else - { - fixed_49.account_name = account_name; - LOGIN_LOG("'ladmin': Attempt to change the validity limit of an unknown account (account: %s, received validity: %lld (%s), ip: %s)\n"_fmt, - account_name, - timestamp, - tmpstr, - ip); - } - fixed_49.valid_until = timestamp; - } - send_fpacket<0x7949, 34>(s, fixed_49); - break; - } - case 0x794a: // Request to change the final date of a banishment (timestamp) (absolute value) { Packet_Fixed<0x794a> fixed; @@ -2585,99 +2487,6 @@ void parse_admin(Session *s) break; } - case 0x7950: // Request to change the validity limite (timestamp) (relative change) - { - Packet_Fixed<0x7950> fixed; - rv = recv_fpacket<0x7950, 38>(s, fixed); - if (rv != RecvResult::Complete) - break; - - Packet_Fixed<0x7951> fixed_51; - { - fixed_51.account_id = AccountId(); - AccountName account_name = stringish(fixed.account_name.to_print()); - AuthData *ad = search_account(account_name); - if (ad) - { - fixed_51.account_id = ad->account_id; - fixed_51.account_name = ad->userid; - if (add_to_unlimited_account == 0 && !ad->connect_until_time) - { - LOGIN_LOG("'ladmin': Attempt to adjust the validity limit of an unlimited account (account: %s, ip: %s)\n"_fmt, - ad->userid, ip); - fixed_51.valid_until = TimeT(); - } - else - { - TimeT now = TimeT::now(); - TimeT timestamp = ad->connect_until_time; - if (!timestamp || timestamp < now) - timestamp = now; - struct tm tmtime = timestamp; - HumanTimeDiff v_diff = fixed.valid_add; - tmtime.tm_year += v_diff.year; - tmtime.tm_mon += v_diff.month; - tmtime.tm_mday += v_diff.day; - tmtime.tm_hour += v_diff.hour; - tmtime.tm_min += v_diff.minute; - tmtime.tm_sec += v_diff.second; - timestamp = tmtime; - if (timestamp.okay()) - { - timestamp_seconds_buffer tmpstr = stringish("unlimited"_s); - timestamp_seconds_buffer tmpstr2 = stringish("unlimited"_s); - if (ad->connect_until_time) - stamp_time(tmpstr, &ad->connect_until_time); - if (timestamp) - stamp_time(tmpstr2, ×tamp); - LOGIN_LOG("'ladmin': Adjustment of a validity limit (account: %s, %lld (%s) + (%+d y %+d m %+d d %+d h %+d mn %+d s) -> new validity: %lld (%s), ip: %s)\n"_fmt, - ad->userid, - ad->connect_until_time, - tmpstr, - v_diff.year, - v_diff.month, - v_diff.day, - v_diff.hour, - v_diff.minute, - v_diff.second, - timestamp, - tmpstr2, - ip); - ad->connect_until_time = timestamp; - fixed_51.valid_until = timestamp; - } - else - { - timestamp_seconds_buffer tmpstr = stringish("unlimited"_s); - if (ad->connect_until_time) - stamp_time(tmpstr, &ad->connect_until_time); - LOGIN_LOG("'ladmin': Impossible to adjust a validity limit (account: %s, %lld (%s) + (%+d y %+d m %+d d %+d h %+d mn %+d s) -> ???, ip: %s)\n"_fmt, - ad->userid, - ad->connect_until_time, - tmpstr, - v_diff.year, - v_diff.month, - v_diff.day, - v_diff.hour, - v_diff.minute, - v_diff.second, - ip); - fixed_51.valid_until = TimeT(); - } - } - } - else - { - fixed_51.account_name = account_name; - LOGIN_LOG("'ladmin': Attempt to adjust the validity limit of an unknown account (account: %s, ip: %s)\n"_fmt, - account_name, ip); - fixed_51.valid_until = TimeT(); - } - } - send_fpacket<0x7951, 34>(s, fixed_51); - break; - } - case 0x7952: // Request about informations of an account (by account name) { Packet_Fixed<0x7952> fixed; @@ -2701,7 +2510,6 @@ void parse_admin(Session *s) head_53.last_login_string = ad->lastlogin; head_53.ip_string = convert_for_printf(ad->last_ip); head_53.email = ad->email; - head_53.connect_until = ad->connect_until_time; head_53.ban_until = ad->ban_until_time; XString repeat_53 = ad->memo; @@ -2747,7 +2555,6 @@ void parse_admin(Session *s) head_53.last_login_string = ad.lastlogin; head_53.ip_string = convert_for_printf(ad.last_ip); head_53.email = ad.email; - head_53.connect_until = ad.connect_until_time; head_53.ban_until = ad.ban_until_time; XString repeat_53 = ad.memo; send_vpacket<0x7953, 150, 1>(s, head_53, repeat_53); @@ -3401,10 +3208,6 @@ bool login_config(XString w1, ZString w2) { add_to_unlimited_account = config_switch(w2); } - else if (w1 == "start_limited_time"_s) - { - start_limited_time = atoi(w2.c_str()); - } else if (w1 == "check_ip_flag"_s) { check_ip_flag = config_switch(w2); @@ -3626,14 +3429,6 @@ bool display_conf_warnings(void) rv = false; } - if (start_limited_time < -1) - { // -1: create unlimited account, 0 or more: additionnal sec from now to create limited time - PRINTF("***WARNING: Invalid value for start_limited_time parameter\n"_fmt); - PRINTF(" -> set to -1 (new accounts are created with unlimited time).\n"_fmt); - start_limited_time = -1; - rv = false; - } - if (check_ip_flag != 0 && check_ip_flag != 1) { // 0: no, 1: yes PRINTF("***WARNING: Invalid value for check_ip_flag parameter\n"_fmt); @@ -3775,13 +3570,9 @@ void save_config_in_log(void) else LOGIN_LOG("- to refuse adjustment (with timeadd ladmin) on an unlimited account. You must use timeset (ladmin command) before.\n"_fmt); - if (start_limited_time < 0) + { LOGIN_LOG("- to create new accounts with an unlimited time.\n"_fmt); - else if (start_limited_time == 0) - LOGIN_LOG("- to create new accounts with a limited time: time of creation.\n"_fmt); - else - LOGIN_LOG("- to create new accounts with a limited time: time of creation + %d second(s).\n"_fmt, - start_limited_time); + } if (check_ip_flag) LOGIN_LOG("- with control of players IP between login-server and char-server.\n"_fmt); diff --git a/src/map/battle.cpp b/src/map/battle.cpp index f852265..88fcc07 100644 --- a/src/map/battle.cpp +++ b/src/map/battle.cpp @@ -985,17 +985,6 @@ int battle_stopattack(dumb_ptr bl) return 0; } -// 移動停止 -int battle_stopwalking(dumb_ptr bl, int type) -{ - nullpo_retz(bl); - if (bl->bl_type == BL::MOB) - return mob_stop_walking(bl->is_mob(), type); - else if (bl->bl_type == BL::PC) - return pc_stop_walking(bl->is_player(), type); - return 0; -} - /*========================================== * ダメージ最終計算 *------------------------------------------ diff --git a/src/map/battle.hpp b/src/map/battle.hpp index aa96a72..7733391 100644 --- a/src/map/battle.hpp +++ b/src/map/battle.hpp @@ -58,7 +58,6 @@ int battle_heal(dumb_ptr bl, dumb_ptr target, int hp, // 攻撃や移動を止める int battle_stopattack(dumb_ptr bl); -int battle_stopwalking(dumb_ptr bl, int type); // 通常攻撃処理まとめ ATK battle_weapon_attack(dumb_ptr bl, dumb_ptr target, diff --git a/src/map/chrif.cpp b/src/map/chrif.cpp index dbdd401..9a36a60 100644 --- a/src/map/chrif.cpp +++ b/src/map/chrif.cpp @@ -912,126 +912,6 @@ int chrif_recvgmaccounts(Session *s, const std::vector>& r return 0; } -/*========================================== - * Request to reload GM accounts and their levels: send to char-server by [Yor] - *------------------------------------------ - */ -int chrif_reloadGMdb(void) -{ - if (!char_session) - return -1; - - Packet_Fixed<0x2af7> fixed_f7; - send_fpacket<0x2af7, 2>(char_session, fixed_f7); - - return 0; -} - -/*======================================== - * Map item IDs - *---------------------------------------- - */ - -static -void ladmin_itemfrob_fix_item(ItemNameId source, ItemNameId dest, Item *item) -{ - if (item && item->nameid == source) - { - item->nameid = dest; - item->equip = EPOS::ZERO; - } -} - -static -void ladmin_itemfrob_c2(dumb_ptr bl, ItemNameId source_id, ItemNameId dest_id) -{ -#define IFIX(v) if (v == source_id) {v = dest_id; } -#define FIX(item) ladmin_itemfrob_fix_item(source_id, dest_id, &item) - - if (!bl) - return; - - switch (bl->bl_type) - { - case BL::PC: - { - dumb_ptr pc = bl->is_player(); - - for (IOff0 j : IOff0::iter()) - IFIX(pc->status.inventory[j].nameid); - // cart is no longer supported - // IFIX(pc->status.weapon); - IFIX(pc->status.shield); - IFIX(pc->status.head_top); - IFIX(pc->status.head_mid); - IFIX(pc->status.head_bottom); - - Option> stor_ = account2storage2(pc->status_key.account_id); - if OPTION_IS_SOME(stor, stor_) - { - for (SOff0 j : SOff0::iter()) - FIX(stor->storage_[j]); - } - - for (IOff0 j : IOff0::iter()) - { - P item = TRY_UNWRAP(pc->inventory_data[j], continue); - if (item->nameid == source_id) - { - item->nameid = dest_id; - if (bool(item->equip)) - pc_unequipitem(pc, j, CalcStatus::NOW); - item->nameid = dest_id; - } - } - - break; - } - - case BL::MOB: - { - dumb_ptr mob = bl->is_mob(); - for (Item& itm : mob->lootitemv) - FIX(itm); - break; - } - - case BL::ITEM: - { - dumb_ptr item = bl->is_item(); - FIX(item->item_data); - break; - } - } -#undef FIX -#undef IFIX -} - -static -void ladmin_itemfrob_c(dumb_ptr bl, ItemNameId source_id, ItemNameId dest_id) -{ - ladmin_itemfrob_c2(bl, source_id, dest_id); -} - -static -void ladmin_itemfrob(Session *, const Packet_Fixed<0x2afa>& fixed) -{ - ItemNameId source_id = fixed.source_item_id; - ItemNameId dest_id = fixed.dest_item_id; - dumb_ptr bl = map_get_first_session(); - - // flooritems - map_foreachobject(std::bind(ladmin_itemfrob_c, ph::_1, source_id, dest_id), - BL::NUL /* any object */); - - // player characters (and, hopefully, mobs) - while (bl->bl_next) - { - ladmin_itemfrob_c2(bl, source_id, dest_id); - bl = bl->bl_next; - } -} - static void chrif_delete(Session *s) { @@ -1066,16 +946,6 @@ void chrif_parse(Session *s) chrif_connectack(s, fixed); break; } - case 0x2afa: - { - Packet_Fixed<0x2afa> fixed; - rv = recv_fpacket<0x2afa, 10>(s, fixed); - if (rv != RecvResult::Complete) - break; - - ladmin_itemfrob(s, fixed); - break; - } case 0x2afb: { Packet_Fixed<0x2afb> fixed; @@ -1095,12 +965,11 @@ void chrif_parse(Session *s) AccountId id = payload.account_id; int login_id2 = payload.login_id2; - TimeT connect_until_time = payload.connect_until; short tmw_version = payload.packet_tmw_version; CharKey st_key = payload.char_key; CharData st_data = payload.char_data; pc_authok(id, login_id2, - connect_until_time, tmw_version, + tmw_version, &st_key, &st_data); break; } diff --git a/src/map/chrif.hpp b/src/map/chrif.hpp index 4bd00aa..59fb541 100644 --- a/src/map/chrif.hpp +++ b/src/map/chrif.hpp @@ -47,7 +47,6 @@ void chrif_changeemail(AccountId id, AccountEmail actual_email, AccountEmail new void chrif_char_ask_name(AccountId id, CharName character_name, short operation_type, HumanTimeDiff modif); int chrif_saveaccountreg2(dumb_ptr sd); -int chrif_reloadGMdb(void); int chrif_send_divorce(CharId char_id); void do_init_chrif(void); diff --git a/src/map/clif.cpp b/src/map/clif.cpp index 430d928..edca352 100644 --- a/src/map/clif.cpp +++ b/src/map/clif.cpp @@ -622,37 +622,6 @@ int clif_clearchar(dumb_ptr bl, BeingRemoveWhy type) return 0; } -static -void clif_clearchar_delay_sub(TimerData *, tick_t, - dumb_ptr bl, BeingRemoveWhy type) -{ - clif_clearchar(bl, type); - MapBlockLock::freeblock(bl); -} - -int clif_clearchar_delay(tick_t tick, - dumb_ptr bl, BeingRemoveWhy type) -{ - dumb_ptr tmpbl; - tmpbl.new_(); - - // yikes! - tmpbl->bl_next = bl->bl_next; - tmpbl->bl_prev = bl->bl_prev; - tmpbl->bl_id = bl->bl_id; - tmpbl->bl_m = bl->bl_m; - tmpbl->bl_x = bl->bl_x; - tmpbl->bl_y = bl->bl_y; - tmpbl->bl_type = bl->bl_type; - - Timer(tick, - std::bind(clif_clearchar_delay_sub, ph::_1, ph::_2, - tmpbl, type) - ).detach(); - - return 0; -} - /*========================================== * *------------------------------------------ @@ -2683,43 +2652,6 @@ void clif_mobinsight(dumb_ptr bl, dumb_ptr md) } } -/*========================================== - * - *------------------------------------------ - */ -int clif_skillinfo(dumb_ptr sd, SkillID skillid, int type, - int range) -{ - nullpo_retz(sd); - - Session *s = sd->sess; - if (!sd->status.skill[skillid].lv) - return 0; - Packet_Fixed<0x0147> fixed_147; - fixed_147.info.skill_id = skillid; - if (type < 0) - fixed_147.info.type_or_inf = skill_get_inf(skillid); - else - fixed_147.info.type_or_inf = type; - fixed_147.info.flags = SkillFlags::ZERO; - fixed_147.info.level = sd->status.skill[skillid].lv; - fixed_147.info.sp = skill_get_sp(skillid, sd->status.skill[skillid].lv); - if (range < 0) - { - range = skill_get_range(skillid, sd->status.skill[skillid].lv); - if (range < 0) - range = battle_get_range(sd) - (range + 1); - fixed_147.info.range = range; - } - else - fixed_147.info.range = range; - fixed_147.info.unused = ""_s; - fixed_147.info.can_raise = sd->status.skill[skillid].lv < skill_get_max_raise(skillid); - send_fpacket<0x0147, 39>(s, fixed_147); - - return 0; -} - /*========================================== * スキルリストを送信する *------------------------------------------ @@ -3200,21 +3132,6 @@ int clif_movetoattack(dumb_ptr sd, dumb_ptr bl) return 0; } -/*========================================== - * MVPエフェクト - *------------------------------------------ - */ -int clif_mvp_effect(dumb_ptr sd) -{ - nullpo_retz(sd); - - Packet_Fixed<0x010c> fixed_10c; - fixed_10c.block_id = sd->bl_id; - Buffer buf = create_fpacket<0x010c, 6>(fixed_10c); - clif_send(buf, sd, SendWho::AREA); - return 0; -} - /*========================================== * エモーション *------------------------------------------ @@ -3837,25 +3754,6 @@ RecvResult clif_parse_Emotion(Session *s, dumb_ptr sd) return rv; } -/*========================================== - * - *------------------------------------------ - */ -static -RecvResult clif_parse_HowManyConnections(Session *s, dumb_ptr) -{ - Packet_Fixed<0x00c1> fixed; - RecvResult rv = recv_fpacket<0x00c1, 2>(s, fixed); - if (rv != RecvResult::Complete) - return rv; - - Packet_Fixed<0x00c2> fixed_c2; - fixed_c2.users = map_getusers(); - send_fpacket<0x00c2, 6>(s, fixed_c2); - - return rv; -} - /*========================================== * *------------------------------------------ @@ -4755,7 +4653,7 @@ RecvResult clif_parse_RemovePartyMember(Session *s, dumb_ptr s *------------------------------------------ */ static -RecvResult clif_parse_PartyChangeOpt0(Session *s, dumb_ptr sd) +RecvResult clif_parse_PartyChangeOption(Session *s, dumb_ptr sd) { Packet_Fixed<0x0102> fixed; RecvResult rv = recv_fpacket<0x0102, 6>(s, fixed); @@ -5000,7 +4898,7 @@ func_table clif_parse_func_table[0x0220] = {0, 5, nullptr, }, // 0x00be {1000, 3, clif_parse_Emotion, }, // 0x00bf {0, 7, nullptr, }, // 0x00c0 - {0, 2, clif_parse_HowManyConnections, }, // 0x00c1 + {0, 2, nullptr, }, // 0x00c1 {0, 6, nullptr, }, // 0x00c2 {0, 8, nullptr, }, // 0x00c3 {0, 6, nullptr, }, // 0x00c4 @@ -5065,7 +4963,7 @@ func_table clif_parse_func_table[0x0220] = {0, 10, clif_parse_ReplyPartyInvite, }, // 0x00ff {0, 2, clif_parse_LeaveParty, }, // 0x0100 {0, 6, nullptr, }, // 0x0101 - {0, 6, clif_parse_PartyChangeOpt0, }, // 0x0102 + {0, 6, clif_parse_PartyChangeOption, }, // 0x0102 {0, 30, clif_parse_RemovePartyMember, }, // 0x0103 {0, 79, nullptr, }, // 0x0104 {0, 31, nullptr, }, // 0x0105 diff --git a/src/map/clif.hpp b/src/map/clif.hpp index 24f4b80..2242949 100644 --- a/src/map/clif.hpp +++ b/src/map/clif.hpp @@ -52,7 +52,6 @@ int clif_charselectok(BlockId); int clif_dropflooritem(dumb_ptr); int clif_clearflooritem(dumb_ptr, Session *); int clif_clearchar(dumb_ptr, BeingRemoveWhy); // area or fd -int clif_clearchar_delay(tick_t, dumb_ptr, BeingRemoveWhy); void clif_clearchar_id(BlockId, BeingRemoveWhy, Session *); int clif_spawnpc(dumb_ptr); //area int clif_spawnnpc(dumb_ptr); // area @@ -131,8 +130,6 @@ void clif_pcoutsight(dumb_ptr, dumb_ptr); void clif_mobinsight(dumb_ptr, dumb_ptr); void clif_moboutsight(dumb_ptr, dumb_ptr); -int clif_skillinfo(dumb_ptr sd, SkillID skillid, int type, - int range); void clif_skillinfoblock(dumb_ptr sd); int clif_skillup(dumb_ptr sd, SkillID skill_num); @@ -152,8 +149,6 @@ void clif_wis_end(Session *s, int flag); void clif_itemlist(dumb_ptr sd); void clif_equiplist(dumb_ptr sd); -int clif_mvp_effect(dumb_ptr sd); - int clif_movetoattack(dumb_ptr sd, dumb_ptr bl); // party diff --git a/src/map/npc.cpp b/src/map/npc.cpp index 90ac917..cd80cdf 100644 --- a/src/map/npc.cpp +++ b/src/map/npc.cpp @@ -199,27 +199,6 @@ int npc_delete(dumb_ptr nd) return 0; } -void npc_timer_event(NpcEvent eventname) -{ - P ev = TRY_UNWRAP(ev_db.search(eventname), - { - PRINTF("npc_event: event not found [%s]\n"_fmt, - eventname); - return; - }); - - dumb_ptr nd; - - if ((nd = ev->nd) == nullptr) - { - PRINTF("npc_event: event not found [%s]\n"_fmt, - eventname); - return; - } - - run_script(ScriptPointer(borrow(*nd->scr.script), ev->pos), nd->bl_id, nd->bl_id); -} - /*========================================== * 全てのNPCのOn*イベント実行 *------------------------------------------ diff --git a/src/map/npc.hpp b/src/map/npc.hpp index cb42dbd..e62faf2 100644 --- a/src/map/npc.hpp +++ b/src/map/npc.hpp @@ -44,7 +44,6 @@ constexpr Species INVISIBLE_CLASS = wrap(32767); int npc_event_dequeue(dumb_ptr sd); int npc_event(dumb_ptr sd, NpcEvent npcname, int); -void npc_timer_event(NpcEvent eventname); // Added by RoVeRT int npc_command(dumb_ptr sd, NpcName npcname, XString command); int npc_touch_areanpc(dumb_ptr, Borrowed, int, int); int npc_click(dumb_ptr, BlockId); diff --git a/src/map/pc.cpp b/src/map/pc.cpp index 95bdb8d..468bc2d 100644 --- a/src/map/pc.cpp +++ b/src/map/pc.cpp @@ -606,7 +606,7 @@ int pc_isequip(dumb_ptr sd, IOff0 n) * char鯖から送られてきたステータスを設定 *------------------------------------------ */ -int pc_authok(AccountId id, int login_id2, TimeT connect_until_time, +int pc_authok(AccountId id, int login_id2, short tmw_version, const CharKey *st_key, const CharData *st_data) { dumb_ptr sd = nullptr; @@ -760,15 +760,6 @@ int pc_authok(AccountId id, int login_id2, TimeT connect_until_time, sd->packet_flood_reset_due = TimeT(); sd->packet_flood_in = 0; - // message of the limited time of the account - if (connect_until_time) - { - timestamp_seconds_buffer buffer; - stamp_time(buffer, &connect_until_time); - AString tmpstr = STRPRINTF("Your account time limit is: %s"_fmt, buffer); - - clif_wis_message(sd->sess, wisp_server_name, tmpstr); - } pc_calcstatus(sd, 1); return 0; @@ -2530,72 +2521,6 @@ void pc_touch_all_relevant_npcs(dumb_ptr sd) sd->areanpc_id = BlockId(); } -/*========================================== - * - *------------------------------------------ - */ -int pc_movepos(dumb_ptr sd, int dst_x, int dst_y) -{ - int moveblock; - int dx, dy; - - struct walkpath_data wpd; - - nullpo_retz(sd); - - if (path_search(&wpd, sd->bl_m, sd->bl_x, sd->bl_y, dst_x, dst_y, 0)) - return 1; - - sd->dir = sd->head_dir = map_calc_dir(sd, dst_x, dst_y); - - dx = dst_x - sd->bl_x; - dy = dst_y - sd->bl_y; - - moveblock = (sd->bl_x / BLOCK_SIZE != dst_x / BLOCK_SIZE - || sd->bl_y / BLOCK_SIZE != dst_y / BLOCK_SIZE); - - map_foreachinmovearea(std::bind(clif_pcoutsight, ph::_1, sd), - sd->bl_m, - sd->bl_x - AREA_SIZE, sd->bl_y - AREA_SIZE, - sd->bl_x + AREA_SIZE, sd->bl_y + AREA_SIZE, - dx, dy, - BL::NUL); - - if (moveblock) - map_delblock(sd); - sd->bl_x = dst_x; - sd->bl_y = dst_y; - if (moveblock) - map_addblock(sd); - - map_foreachinmovearea(std::bind(clif_pcinsight, ph::_1, sd), - sd->bl_m, - sd->bl_x - AREA_SIZE, sd->bl_y - AREA_SIZE, - sd->bl_x + AREA_SIZE, sd->bl_y + AREA_SIZE, - -dx, -dy, - BL::NUL); - - if (sd->status.party_id) - { // パーティのHP情報通知検査 - Option p = party_search(sd->status.party_id); - if (p.is_some()) - { - int flag = 0; - map_foreachinmovearea(std::bind(party_send_hp_check, ph::_1, sd->status.party_id, &flag), - sd->bl_m, - sd->bl_x - AREA_SIZE, sd->bl_y - AREA_SIZE, - sd->bl_x + AREA_SIZE, sd->bl_y + AREA_SIZE, - -dx, -dy, - BL::PC); - if (flag) - sd->party_hp = -1; - } - } - - pc_touch_all_relevant_npcs(sd); - return 0; -} - // // 武器戦闘 // @@ -3145,94 +3070,6 @@ int pc_skillup(dumb_ptr sd, SkillID skill_num) return 0; } -/*========================================== - * /resetlvl - *------------------------------------------ - */ -int pc_resetlvl(dumb_ptr sd, int type) -{ - nullpo_retz(sd); - - for (SkillID i : erange(SkillID(1), MAX_SKILL)) - { - sd->status.skill[i].lv = 0; - } - - if (type == 1) - { - sd->status.skill_point = 0; - sd->status.base_level = 1; - sd->status.job_level = 1; - sd->status.base_exp = 0; - sd->status.job_exp = 0; - sd->status.option = Opt0::ZERO; - - for (ATTR attr : ATTRs) - sd->status.attrs[attr] = 1; - } - - if (type == 2) - { - sd->status.skill_point = 0; - sd->status.base_level = 1; - sd->status.job_level = 1; - sd->status.base_exp = 0; - sd->status.job_exp = 0; - } - if (type == 3) - { - sd->status.base_level = 1; - sd->status.base_exp = 0; - } - if (type == 4) - { - sd->status.job_level = 1; - sd->status.job_exp = 0; - } - - clif_updatestatus(sd, SP::STATUSPOINT); - clif_updatestatus(sd, SP::STR); - clif_updatestatus(sd, SP::AGI); - clif_updatestatus(sd, SP::VIT); - clif_updatestatus(sd, SP::INT); - clif_updatestatus(sd, SP::DEX); - clif_updatestatus(sd, SP::LUK); - clif_updatestatus(sd, SP::BASELEVEL); - clif_updatestatus(sd, SP::JOBLEVEL); - clif_updatestatus(sd, SP::STATUSPOINT); - clif_updatestatus(sd, SP::NEXTBASEEXP); - clif_updatestatus(sd, SP::NEXTJOBEXP); - clif_updatestatus(sd, SP::SKILLPOINT); - - clif_updatestatus(sd, SP::USTR); // Updates needed stat points - Valaris - clif_updatestatus(sd, SP::UAGI); - clif_updatestatus(sd, SP::UVIT); - clif_updatestatus(sd, SP::UINT); - clif_updatestatus(sd, SP::UDEX); - clif_updatestatus(sd, SP::ULUK); // End Addition - - for (EQUIP i : EQUIPs) - { - // unequip items that can't be equipped by base 1 [Valaris] - IOff0 *idx = &sd->equip_index_maybe[i]; - if ((*idx).ok()) - { - if (!pc_isequip(sd, *idx)) - { - pc_unequipitem(sd, *idx, CalcStatus::LATER); - *idx = IOff0::from(-1); - } - } - } - - clif_skillinfoblock(sd); - pc_calcstatus(sd, 0); - - MAP_LOG_STATS(sd, "STATRESET"_fmt); - - return 0; -} - /*========================================== * /resetstate *------------------------------------------ @@ -3942,21 +3779,6 @@ int pc_changelook(dumb_ptr sd, LOOK type, int val) return 0; } -/*========================================== - * 付属品(鷹,ペコ,カート)設定 - *------------------------------------------ - */ -int pc_setoption(dumb_ptr sd, Opt0 type) -{ - nullpo_retz(sd); - - sd->status.option = type; - clif_changeoption(sd); - pc_calcstatus(sd, 0); - - return 0; -} - /*========================================== * script用変数の値を読む *------------------------------------------ diff --git a/src/map/pc.hpp b/src/map/pc.hpp index 9795443..c889e44 100644 --- a/src/map/pc.hpp +++ b/src/map/pc.hpp @@ -77,7 +77,7 @@ int pc_counttargeted(dumb_ptr sd, dumb_ptr src, int pc_setrestartvalue(dumb_ptr sd, int type); void pc_makesavestatus(dumb_ptr); int pc_setnewpc(dumb_ptr, AccountId, CharId, int, uint32_t /*tick_t*/, SEX); -int pc_authok(AccountId, int, TimeT, short tmw_version, const CharKey *, const CharData *); +int pc_authok(AccountId, int, short tmw_version, const CharKey *, const CharData *); int pc_authfail(AccountId accid); EPOS pc_equippoint(dumb_ptr sd, IOff0 n); @@ -87,7 +87,6 @@ IOff0 pc_checkequip(dumb_ptr sd, EPOS pos); int pc_walktoxy(dumb_ptr, int, int); int pc_stop_walking(dumb_ptr, int); -int pc_movepos(dumb_ptr, int, int); int pc_setpos(dumb_ptr, MapName, int, int, BeingRemoveWhy); void pc_setsavepoint(dumb_ptr, MapName, int, int); int pc_randomwarp(dumb_ptr sd, BeingRemoveWhy type); @@ -127,7 +126,6 @@ int pc_need_status_point(dumb_ptr, SP); int pc_statusup(dumb_ptr, SP); int pc_statusup2(dumb_ptr, SP, int); int pc_skillup(dumb_ptr, SkillID); -int pc_resetlvl(dumb_ptr, int type); int pc_resetstate(dumb_ptr); int pc_resetskill(dumb_ptr); int pc_equipitem(dumb_ptr, IOff0, EPOS); @@ -139,7 +137,6 @@ int pc_damage(dumb_ptr, dumb_ptr, int); int pc_heal(dumb_ptr, int, int); int pc_itemheal(dumb_ptr sd, int hp, int sp); int pc_percentheal(dumb_ptr sd, int, int); -int pc_setoption(dumb_ptr, Opt0); int pc_changelook(dumb_ptr, LOOK, int); int pc_readparam(dumb_ptr, SP); diff --git a/src/mmo/skill.t.hpp b/src/mmo/skill.t.hpp index d0e3926..21e4059 100644 --- a/src/mmo/skill.t.hpp +++ b/src/mmo/skill.t.hpp @@ -77,6 +77,9 @@ enum class SkillID : uint16_t // TODO: Remove these! NEGATIVE = 0xffff, ZERO = 0x0000, + // this is probably the remains of the 'basic' skill, + // which has since been partially split into emote, trade, and party, + // but the confusion is caused by the fact that it also covered attacks. ONE = 0x0001, // Basic skills. -- cgit v1.2.3-70-g09d2