OpenFusion/src/core/Packets.cpp

200 lines
7.9 KiB
C++
Raw Normal View History

#include <string>
#include "Defines.hpp"
#include "Packets.hpp"
#include "CNStructs.hpp"
#define PACKET(id) {id, {id, sizeof(s##id), #id}}
#define VAR_PACKET(id, memb, tr) {id, {id, sizeof(s##id), #id, offsetof(s##id, memb), sizeof(tr)}}
std::map<uint32_t, PacketDesc> Packets::packets = {
// CL2LS
PACKET(P_CL2LS_REQ_LOGIN),
PACKET(P_CL2LS_REQ_CHECK_CHAR_NAME),
PACKET(P_CL2LS_REQ_SAVE_CHAR_NAME),
PACKET(P_CL2LS_REQ_CHAR_CREATE),
PACKET(P_CL2LS_REQ_CHAR_SELECT),
PACKET(P_CL2LS_REQ_CHAR_DELETE),
PACKET(P_CL2LS_REQ_SHARD_SELECT),
PACKET(P_CL2LS_REQ_SHARD_LIST_INFO),
PACKET(P_CL2LS_CHECK_NAME_LIST),
PACKET(P_CL2LS_REQ_SAVE_CHAR_TUTOR),
PACKET(P_CL2LS_REQ_PC_EXIT_DUPLICATE),
PACKET(P_CL2LS_REP_LIVE_CHECK),
PACKET(P_CL2LS_REQ_CHANGE_CHAR_NAME),
PACKET(P_CL2LS_REQ_SERVER_SELECT),
// CL2FE
PACKET(P_CL2FE_REQ_PC_ENTER),
PACKET(P_CL2FE_REQ_PC_EXIT),
PACKET(P_CL2FE_REQ_PC_MOVE),
PACKET(P_CL2FE_REQ_PC_STOP),
PACKET(P_CL2FE_REQ_PC_JUMP),
VAR_PACKET(P_CL2FE_REQ_PC_ATTACK_NPCs, iNPCCnt, int32_t),
PACKET(P_CL2FE_REQ_SEND_FREECHAT_MESSAGE),
PACKET(P_CL2FE_REQ_SEND_MENUCHAT_MESSAGE),
PACKET(P_CL2FE_REQ_PC_REGEN),
PACKET(P_CL2FE_REQ_ITEM_MOVE),
PACKET(P_CL2FE_REQ_PC_TASK_START),
PACKET(P_CL2FE_REQ_PC_TASK_END),
PACKET(P_CL2FE_REQ_NANO_EQUIP),
PACKET(P_CL2FE_REQ_NANO_UNEQUIP),
PACKET(P_CL2FE_REQ_NANO_ACTIVE),
PACKET(P_CL2FE_REQ_NANO_TUNE),
VAR_PACKET(P_CL2FE_REQ_NANO_SKILL_USE, iTargetCnt, int32_t),
PACKET(P_CL2FE_REQ_PC_TASK_STOP),
PACKET(P_CL2FE_REQ_PC_TASK_CONTINUE),
PACKET(P_CL2FE_REQ_PC_GOTO),
PACKET(P_CL2FE_REQ_CHARGE_NANO_STAMINA),
PACKET(P_CL2FE_REQ_PC_KILL_QUEST_NPCs),
PACKET(P_CL2FE_REQ_PC_VENDOR_ITEM_BUY),
PACKET(P_CL2FE_REQ_PC_VENDOR_ITEM_SELL),
PACKET(P_CL2FE_REQ_PC_ITEM_DELETE),
PACKET(P_CL2FE_REQ_PC_GIVE_ITEM),
PACKET(P_CL2FE_REQ_PC_ROCKET_STYLE_READY),
PACKET(P_CL2FE_REQ_PC_ROCKET_STYLE_FIRE),
VAR_PACKET(P_CL2FE_REQ_PC_ROCKET_STYLE_HIT, iTargetCnt, int64_t),
PACKET(P_CL2FE_REQ_PC_GRENADE_STYLE_READY),
PACKET(P_CL2FE_REQ_PC_GRENADE_STYLE_FIRE),
PACKET(P_CL2FE_REQ_PC_GRENADE_STYLE_HIT),
PACKET(P_CL2FE_REQ_PC_NANO_CREATE),
PACKET(P_CL2FE_REQ_PC_TRADE_OFFER),
PACKET(P_CL2FE_REQ_PC_TRADE_OFFER_CANCEL),
PACKET(P_CL2FE_REQ_PC_TRADE_OFFER_ACCEPT),
PACKET(P_CL2FE_REQ_PC_TRADE_OFFER_REFUSAL),
PACKET(P_CL2FE_REQ_PC_TRADE_OFFER_ABORT),
PACKET(P_CL2FE_REQ_PC_TRADE_CONFIRM),
PACKET(P_CL2FE_REQ_PC_TRADE_CONFIRM_CANCEL),
PACKET(P_CL2FE_REQ_PC_TRADE_CONFIRM_ABORT),
PACKET(P_CL2FE_REQ_PC_TRADE_ITEM_REGISTER),
PACKET(P_CL2FE_REQ_PC_TRADE_ITEM_UNREGISTER),
PACKET(P_CL2FE_REQ_PC_TRADE_CASH_REGISTER),
PACKET(P_CL2FE_REQ_PC_TRADE_EMOTES_CHAT),
PACKET(P_CL2FE_REQ_PC_BANK_OPEN),
PACKET(P_CL2FE_REQ_PC_BANK_CLOSE),
PACKET(P_CL2FE_REQ_PC_VENDOR_START),
PACKET(P_CL2FE_REQ_PC_VENDOR_TABLE_UPDATE),
PACKET(P_CL2FE_REQ_PC_VENDOR_ITEM_RESTORE_BUY),
PACKET(P_CL2FE_REQ_PC_COMBAT_BEGIN),
PACKET(P_CL2FE_REQ_PC_COMBAT_END),
PACKET(P_CL2FE_REQ_REQUEST_MAKE_BUDDY),
PACKET(P_CL2FE_REQ_ACCEPT_MAKE_BUDDY),
PACKET(P_CL2FE_REQ_SEND_BUDDY_FREECHAT_MESSAGE),
PACKET(P_CL2FE_REQ_SEND_BUDDY_MENUCHAT_MESSAGE),
PACKET(P_CL2FE_REQ_GET_BUDDY_STYLE),
PACKET(P_CL2FE_REQ_SET_BUDDY_BLOCK),
PACKET(P_CL2FE_REQ_REMOVE_BUDDY),
PACKET(P_CL2FE_REQ_GET_BUDDY_STATE),
PACKET(P_CL2FE_REQ_PC_JUMPPAD),
PACKET(P_CL2FE_REQ_PC_LAUNCHER),
PACKET(P_CL2FE_REQ_PC_ZIPLINE),
PACKET(P_CL2FE_REQ_PC_MOVEPLATFORM),
PACKET(P_CL2FE_REQ_PC_SLOPE),
PACKET(P_CL2FE_REQ_PC_STATE_CHANGE),
PACKET(P_CL2FE_REQ_PC_MAP_WARP),
PACKET(P_CL2FE_REQ_PC_GIVE_NANO),
PACKET(P_CL2FE_REQ_NPC_SUMMON),
PACKET(P_CL2FE_REQ_NPC_UNSUMMON),
PACKET(P_CL2FE_REQ_ITEM_CHEST_OPEN),
PACKET(P_CL2FE_REQ_PC_GIVE_NANO_SKILL),
PACKET(P_CL2FE_DOT_DAMAGE_ONOFF),
PACKET(P_CL2FE_REQ_PC_VENDOR_BATTERY_BUY),
PACKET(P_CL2FE_REQ_PC_WARP_USE_NPC),
PACKET(P_CL2FE_REQ_PC_GROUP_INVITE),
PACKET(P_CL2FE_REQ_PC_GROUP_INVITE_REFUSE),
PACKET(P_CL2FE_REQ_PC_GROUP_JOIN),
PACKET(P_CL2FE_REQ_PC_GROUP_LEAVE),
PACKET(P_CL2FE_REQ_PC_AVATAR_EMOTES_CHAT),
PACKET(P_CL2FE_REQ_PC_BUDDY_WARP),
PACKET(P_CL2FE_REQ_GET_MEMBER_STYLE),
PACKET(P_CL2FE_REQ_GET_GROUP_STYLE),
PACKET(P_CL2FE_REQ_PC_CHANGE_MENTOR),
PACKET(P_CL2FE_REQ_GET_BUDDY_LOCATION),
PACKET(P_CL2FE_REQ_NPC_GROUP_SUMMON),
PACKET(P_CL2FE_REQ_PC_WARP_TO_PC),
PACKET(P_CL2FE_REQ_EP_RANK_GET_LIST),
PACKET(P_CL2FE_REQ_EP_RANK_GET_DETAIL),
PACKET(P_CL2FE_REQ_EP_RANK_GET_PC_INFO),
PACKET(P_CL2FE_REQ_EP_RACE_START),
PACKET(P_CL2FE_REQ_EP_RACE_END),
PACKET(P_CL2FE_REQ_EP_RACE_CANCEL),
PACKET(P_CL2FE_REQ_EP_GET_RING),
PACKET(P_CL2FE_REQ_IM_CHANGE_SWITCH_STATUS),
PACKET(P_CL2FE_REQ_SHINY_PICKUP),
PACKET(P_CL2FE_REQ_SHINY_SUMMON),
PACKET(P_CL2FE_REQ_PC_MOVETRANSPORTATION),
PACKET(P_CL2FE_REQ_SEND_ALL_GROUP_FREECHAT_MESSAGE),
PACKET(P_CL2FE_REQ_SEND_ANY_GROUP_FREECHAT_MESSAGE),
PACKET(P_CL2FE_REQ_BARKER),
PACKET(P_CL2FE_REQ_SEND_ALL_GROUP_MENUCHAT_MESSAGE),
PACKET(P_CL2FE_REQ_SEND_ANY_GROUP_MENUCHAT_MESSAGE),
PACKET(P_CL2FE_REQ_REGIST_TRANSPORTATION_LOCATION),
PACKET(P_CL2FE_REQ_PC_WARP_USE_TRANSPORTATION),
PACKET(P_CL2FE_GM_REQ_PC_SPECIAL_STATE_SWITCH),
PACKET(P_CL2FE_GM_REQ_PC_SET_VALUE),
PACKET(P_CL2FE_GM_REQ_KICK_PLAYER),
PACKET(P_CL2FE_GM_REQ_TARGET_PC_TELEPORT),
PACKET(P_CL2FE_GM_REQ_PC_LOCATION),
PACKET(P_CL2FE_GM_REQ_PC_ANNOUNCE),
PACKET(P_CL2FE_REQ_SET_PC_BLOCK),
PACKET(P_CL2FE_REQ_REGIST_RXCOM),
PACKET(P_CL2FE_GM_REQ_PC_MOTD_REGISTER),
PACKET(P_CL2FE_REQ_ITEM_USE),
PACKET(P_CL2FE_REQ_WARP_USE_RECALL),
PACKET(P_CL2FE_REP_LIVE_CHECK),
PACKET(P_CL2FE_REQ_PC_MISSION_COMPLETE),
PACKET(P_CL2FE_REQ_PC_TASK_COMPLETE),
PACKET(P_CL2FE_REQ_NPC_INTERACTION),
PACKET(P_CL2FE_DOT_HEAL_ONOFF),
PACKET(P_CL2FE_REQ_PC_SPECIAL_STATE_SWITCH),
PACKET(P_CL2FE_REQ_PC_EMAIL_UPDATE_CHECK),
PACKET(P_CL2FE_REQ_PC_READ_EMAIL),
PACKET(P_CL2FE_REQ_PC_RECV_EMAIL_PAGE_LIST),
PACKET(P_CL2FE_REQ_PC_DELETE_EMAIL),
PACKET(P_CL2FE_REQ_PC_SEND_EMAIL),
PACKET(P_CL2FE_REQ_PC_RECV_EMAIL_ITEM),
PACKET(P_CL2FE_REQ_PC_RECV_EMAIL_CANDY),
PACKET(P_CL2FE_GM_REQ_TARGET_PC_SPECIAL_STATE_ONOFF),
PACKET(P_CL2FE_REQ_PC_SET_CURRENT_MISSION_ID),
PACKET(P_CL2FE_REQ_NPC_GROUP_INVITE),
PACKET(P_CL2FE_REQ_NPC_GROUP_KICK),
PACKET(P_CL2FE_REQ_PC_FIRST_USE_FLAG_SET),
PACKET(P_CL2FE_REQ_PC_TRANSPORT_WARP),
PACKET(P_CL2FE_REQ_PC_TIME_TO_GO_WARP),
PACKET(P_CL2FE_REQ_PC_RECV_EMAIL_ITEM_ALL),
PACKET(P_CL2FE_REQ_CHANNEL_INFO),
PACKET(P_CL2FE_REQ_PC_CHANNEL_NUM),
PACKET(P_CL2FE_REQ_PC_WARP_CHANNEL),
PACKET(P_CL2FE_REQ_PC_LOADING_COMPLETE),
PACKET(P_CL2FE_REQ_PC_FIND_NAME_MAKE_BUDDY),
PACKET(P_CL2FE_REQ_PC_FIND_NAME_ACCEPT_BUDDY),
VAR_PACKET(P_CL2FE_REQ_PC_ATTACK_CHARs, iTargetCnt, sGM_PVPTarget),
PACKET(P_CL2FE_PC_STREETSTALL_REQ_READY),
PACKET(P_CL2FE_PC_STREETSTALL_REQ_CANCEL),
PACKET(P_CL2FE_PC_STREETSTALL_REQ_REGIST_ITEM),
PACKET(P_CL2FE_PC_STREETSTALL_REQ_UNREGIST_ITEM),
PACKET(P_CL2FE_PC_STREETSTALL_REQ_SALE_START),
PACKET(P_CL2FE_PC_STREETSTALL_REQ_ITEM_LIST),
PACKET(P_CL2FE_PC_STREETSTALL_REQ_ITEM_BUY),
PACKET(P_CL2FE_REQ_PC_ITEM_COMBINATION),
PACKET(P_CL2FE_GM_REQ_SET_PC_SKILL),
PACKET(P_CL2FE_REQ_PC_SKILL_ADD),
PACKET(P_CL2FE_REQ_PC_SKILL_DEL),
PACKET(P_CL2FE_REQ_PC_SKILL_USE),
PACKET(P_CL2FE_REQ_PC_ROPE),
PACKET(P_CL2FE_REQ_PC_BELT),
PACKET(P_CL2FE_REQ_PC_VEHICLE_ON),
PACKET(P_CL2FE_REQ_PC_VEHICLE_OFF),
PACKET(P_CL2FE_REQ_PC_REGIST_QUICK_SLOT),
PACKET(P_CL2FE_REQ_PC_DISASSEMBLE_ITEM),
PACKET(P_CL2FE_GM_REQ_REWARD_RATE),
PACKET(P_CL2FE_REQ_PC_ITEM_ENCHANT),
};
std::string Packets::p2str(int val) {
if (packets.find(val) == packets.end())
return "UNKNOWN";
return packets[val].name;
}