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/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 +- 10 files changed, 6 insertions(+), 460 deletions(-) (limited to 'src/map') 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); -- cgit v1.2.3-70-g09d2