/* Action Factory Copyright (C) 2019 AleaJactaEst This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ #include "core/reference.h" #include "core/array.h" #include "core/dictionary.h" #include "core/list.h" #include "modules/debug/debug.h" #include "modules/networkconnection/network_data.h" #include "modules/networkconnection/state_connexion.h" #include "modules/referentialmessage/referentialmessage.h" #include "modules/referentialmessage/referentialmessagecore.h" #include "modules/impulse/impulsebase.h" #include "action_factory.h" #include "action_genericmultipart.h" #include "action.h" struct SPropVisualA { struct SPropSubData // 64 bits used { uint64_t Sex : 1; // max: 2 current: 2 uint64_t JacketModel : 8; // max: 256 current: 93 uint64_t JacketColor : 3; // max: 8 current: 8 uint64_t TrouserModel : 8; // max: 256 current: 104 uint64_t TrouserColor : 3; // max: 8 current: 8 uint64_t WeaponRightHand : 10; // max: 1024 current: 457 uint64_t WeaponLeftHand : 8; // max: 256 current: 63 uint64_t ArmModel : 8; // max: 256 current: 94 uint64_t ArmColor : 3; // max: 8 current: 8 uint64_t HatModel : 9; // max: 512 current: 192 uint64_t HatColor : 3; // max: 8 current: 8 }; union { uint64_t PropertyA; SPropSubData PropertySubData; }; }; struct SPropVisualB { struct SPropSubData // 47 bits used { uint64_t Name : 16; uint64_t HandsModel : 9; // max: 512 current: 90 uint64_t HandsColor : 3; // max: 8 current: 8 uint64_t FeetModel : 9; // max: 512 current: 94 uint64_t FeetColor : 3; // max: 8 current: 8 uint64_t RTrail : 4; uint64_t LTrail : 3; }; union { uint64_t PropertyB; SPropSubData PropertySubData; }; }; struct SPropVisualC { struct SPropSubData // 54 bits used { uint64_t MorphTarget1 : 3; // max: 8 current: 8 uint64_t MorphTarget2 : 3; // max: 8 current: 8 uint64_t MorphTarget3 : 3; // max: 8 current: 8 uint64_t MorphTarget4 : 3; // max: 8 current: 8 uint64_t MorphTarget5 : 3; // max: 8 current: 8 uint64_t MorphTarget6 : 3; // max: 8 current: 8 uint64_t MorphTarget7 : 3; // max: 8 current: 8 uint64_t MorphTarget8 : 3; // max: 8 current: 8 uint64_t EyesColor : 3; // max: 8 current: 8 uint64_t Tattoo : 7; // max: 128 current: 64 uint64_t CharacterHeight : 4; // max: 16 current: 16 uint64_t TorsoWidth : 4; // max: 16 current: 16 uint64_t ArmsWidth : 4; // max: 16 current: 16 uint64_t LegsWidth : 4; // max: 16 current: 16 uint64_t BreastSize : 4; // max: 16 current: 16 }; union { uint64_t PropertyC; SPropSubData PropertySubData; }; }; void ActionFactory::decode_message(NetworkData * data, Ref msgin) { Dictionary value; ReferentialMessage ref_msg; uint32_t id = ref_msg.read_command(msgin); DBG_PRINT("Decode message:" + ImpulseBase::get_command_name(id)); value["action"] = Action::CODE::ACTION_GENERIC_CODE; value["impulse"] = id; #ifdef DEBUG_ENABLED value["action_debug"] = "ACTION_GENERIC_CODE"; value["impulse_debug"] = ImpulseBase::get_command_name(id); #endif switch(id) { case ImpulseBase::Impulse::TARGET_PARTY: { break; } case ImpulseBase::Impulse::TARGET_INVENTORY: { break; } case ImpulseBase::Impulse::TARGET_FOLLOW: { break; } case ImpulseBase::Impulse::TARGET_NO_FOLLOW: { break; } case ImpulseBase::Impulse::CONNECTION_USER_CHAR: { break; } case ImpulseBase::Impulse::CONNECTION_NO_USER_CHAR: { break; } case ImpulseBase::Impulse::CONNECTION_USER_CHARS: { // khanat-opennel-code/code/ryzom/client/src/net_manager.cpp void impulseUserChars(NLMISC::CBitMemStream &impulse) // khanat-opennel-code/code/ryzom/server/src/entities_game_service/entity_manager/entity_callbacks.cpp void sendCharactersSummary( CPlayer *player, bool AllAutorized, uint32 bitfieldOwnerOfActiveAnimSession, uint32 bitfieldOwnerOfEditSession ) uint32_t i; value["server_people_active"] = msgin->get_uint8(); value["server_career_active"] = msgin->get_uint8(); uint32_t character_summaries_Len = msgin->get_uint32(); value["character_summaries_len"] = character_summaries_Len; Array character_summaries; for(i=0;iget_version(); character["mainland"] = msgin->get_uint32(); character["name"] = msgin->get_string_utf16(); character["people"] = msgin->get_uint32(); character["location"] = msgin->get_uint32(); // khanat-opennel-code/code/ryzom/common/src/game_share/player_visual_properties.h # struct SPropVisualA visual_prop_a.PropertyA = msgin->get_uint64(); visual_prop_b.PropertyB = msgin->get_uint64(); visual_prop_c.PropertyC = msgin->get_uint64(); character["sheet_id"] = msgin->get_uint32(); character["title"] = msgin->get_sint32(); character["character_slot"] = msgin->get_uint8(); character["in_ring_session"] = msgin->get_bool(); character["has_edit_session"] = msgin->get_bool(); character["in_newbieland"] = msgin->get_bool(); character["visual_prop_a"] = visual_prop_a.PropertyA; character["visual_prop_b"] = visual_prop_b.PropertyB; character["visual_prop_c"] = visual_prop_c.PropertyC; character["sex"] = visual_prop_a.PropertySubData.Sex; character["jacket_model"] = visual_prop_a.PropertySubData.JacketModel; character["jacket_color"] = visual_prop_a.PropertySubData.JacketColor; character["trouser_model"] = visual_prop_a.PropertySubData.TrouserModel; character["trouser_color"] = visual_prop_a.PropertySubData.TrouserColor; character["weapon_right_hand"] = visual_prop_a.PropertySubData.WeaponRightHand; character["weapon_left_hand"] = visual_prop_a.PropertySubData.WeaponLeftHand; character["arm_model"] = visual_prop_a.PropertySubData.ArmModel; character["arm_color"] = visual_prop_a.PropertySubData.ArmColor; character["hat_model"] = visual_prop_a.PropertySubData.HatModel; character["hat_color"] = visual_prop_a.PropertySubData.HatColor; character["name_extra"] = visual_prop_b.PropertySubData.Name; character["hands_model"] = visual_prop_b.PropertySubData.HandsModel; character["hands_color"] = visual_prop_b.PropertySubData.HandsColor; character["feet_model"] = visual_prop_b.PropertySubData.FeetModel; character["feet_color"] = visual_prop_b.PropertySubData.FeetColor; character["right_trail"] = visual_prop_b.PropertySubData.RTrail; character["left_trail"] = visual_prop_b.PropertySubData.LTrail; character["morph_target_1"] = visual_prop_c.PropertySubData.MorphTarget1; character["morph_target_2"] = visual_prop_c.PropertySubData.MorphTarget2; character["morph_target_3"] = visual_prop_c.PropertySubData.MorphTarget3; character["morph_target_4"] = visual_prop_c.PropertySubData.MorphTarget4; character["morph_target_5"] = visual_prop_c.PropertySubData.MorphTarget5; character["morph_target_6"] = visual_prop_c.PropertySubData.MorphTarget6; character["morph_target_7"] = visual_prop_c.PropertySubData.MorphTarget7; character["morph_target_8"] = visual_prop_c.PropertySubData.MorphTarget8; character["eyes_color"] = visual_prop_c.PropertySubData.EyesColor; character["tattoo"] = visual_prop_c.PropertySubData.Tattoo; character["character_height"] = visual_prop_c.PropertySubData.CharacterHeight; character["torso_width"] = visual_prop_c.PropertySubData.TorsoWidth; character["arms_width"] = visual_prop_c.PropertySubData.ArmsWidth; character["legs_width"] = visual_prop_c.PropertySubData.LegsWidth; character["breast_size"] = visual_prop_c.PropertySubData.BreastSize; character_summaries.append(character); } value["character_summaries"] = character_summaries; uint32_t shard_names_Len = msgin->get_uint32(); value["shard_names_Len"] = shard_names_Len; Array shard_names; for(i=0;iget_string(); ++i; shard_name["display_name"] = msgin->get_string(); ++i; shard_name["short_name"] = msgin->get_string(); ++i; shard_names.append(shard_name); } value["shard_names"] = shard_names; value["privileges"] = msgin->get_string(); value["free_trial"] = msgin->get_bool(); uint32_t mainlands_len = msgin->get_uint32(); value["mainlands_len"] = mainlands_len; Array mainlands; for(i=0;iget_uint32(); mainland["name"] = msgin->get_string_utf16(); // msgin->get_ustring(); mainland["description"] = msgin->get_string_utf16(); // msgin->get_ustring(); mainland["language_code"] = msgin->get_string(); mainland["online"] = msgin->get_bool(); mainlands.append(mainland); } value["mainlands"] = mainlands; break; } case ImpulseBase::Impulse::CONNECTION_CREATE_CHAR: { break; } case ImpulseBase::Impulse::CONNECTION_SELECT_CHAR: { break; } case ImpulseBase::Impulse::CONNECTION_DELETE_CHAR: { break; } case ImpulseBase::Impulse::CONNECTION_RENAME_CHAR: { break; } case ImpulseBase::Impulse::CONNECTION_ENTER: { break; } case ImpulseBase::Impulse::CONNECTION_READY: { break; } case ImpulseBase::Impulse::CONNECTION_TIME_DATE_SYNCHRO: { break; } case ImpulseBase::Impulse::CONNECTION_ASK_NAME: { break; } case ImpulseBase::Impulse::CONNECTION_VALID_NAME: { break; } case ImpulseBase::Impulse::CONNECTION_CREATE_CHAR_ERROR: { break; } case ImpulseBase::Impulse::CONNECTION_RECONNECT: { break; } case ImpulseBase::Impulse::CONNECTION_SERVER_RECONNECT_OK: { break; } case ImpulseBase::Impulse::CONNECTION_SHARD_ID: { break; } case ImpulseBase::Impulse::CONNECTION_SERVER_QUIT_OK: { break; } case ImpulseBase::Impulse::CONNECTION_SERVER_QUIT_ABORT: { break; } case ImpulseBase::Impulse::CONNECTION_CLIENT_QUIT_REQUEST: { break; } case ImpulseBase::Impulse::CONNECTION_MAIL_AVAILABLE: { break; } case ImpulseBase::Impulse::CONNECTION_GUILD_MESSAGE_AVAILABLE: { break; } case ImpulseBase::Impulse::CONNECTION_PERMANENT_BAN: { break; } case ImpulseBase::Impulse::CONNECTION_UNBAN: { break; } case ImpulseBase::Impulse::CONNECTION_FAR_TP: { break; } case ImpulseBase::Impulse::CONNECTION_RET_MAINLAND: { break; } case ImpulseBase::Impulse::DB_UPD_PLR: { break; } case ImpulseBase::Impulse::DB_UPD_INV: { break; } case ImpulseBase::Impulse::DB_INIT_PLR: { break; } case ImpulseBase::Impulse::DB_INIT_INV: { break; } case ImpulseBase::Impulse::DB_GROUP_UPDATE_BANK: { break; } case ImpulseBase::Impulse::DB_GROUP_INIT_BANK: { break; } case ImpulseBase::Impulse::DB_GROUP_RESET_BANK: { break; } case ImpulseBase::Impulse::POSITION: { break; } case ImpulseBase::Impulse::HARVEST_DEPOSIT: { break; } case ImpulseBase::Impulse::HARVEST_CORPSE: { break; } case ImpulseBase::Impulse::HARVEST_INTERRUPT: { break; } case ImpulseBase::Impulse::HARVEST_CLOSE_TEMP_INVENTORY: { break; } case ImpulseBase::Impulse::TRAINING: { break; } case ImpulseBase::Impulse::JOB_SET_JOB_STATUS: { break; } case ImpulseBase::Impulse::JOB_SWAP_JOB_STATUS: { break; } case ImpulseBase::Impulse::CASTING_BEGIN: { break; } case ImpulseBase::Impulse::CASTING_INTERRUPT: { break; } case ImpulseBase::Impulse::FABER_OPEN: { break; } case ImpulseBase::Impulse::FABER_CLOSE: { break; } case ImpulseBase::Impulse::FABER_EXECUTE: { break; } case ImpulseBase::Impulse::FABER_SET_NUM_ITEM: { break; } case ImpulseBase::Impulse::FABER_START_CREATE: { break; } case ImpulseBase::Impulse::FABER_START_REPAIR: { break; } case ImpulseBase::Impulse::FABER_START_REFINE: { break; } case ImpulseBase::Impulse::FABER_SET_MP_QUALITY: { break; } case ImpulseBase::Impulse::FABER_SET_MP_REFINE: { break; } case ImpulseBase::Impulse::FABER_SET_TOOL: { break; } case ImpulseBase::Impulse::FABER_RESET_TOOL: { break; } case ImpulseBase::Impulse::FABER_INTERRUPT: { break; } case ImpulseBase::Impulse::COMBAT_ENGAGE: { break; } case ImpulseBase::Impulse::COMBAT_DISENGAGE: { break; } case ImpulseBase::Impulse::COMBAT_DEFAULT_ATTACK: { break; } case ImpulseBase::Impulse::COMBAT_ENGAGE_FAILED: { break; } case ImpulseBase::Impulse::COMBAT_VALIDATE_MELEE: { break; } case ImpulseBase::Impulse::COMBAT_PARRY: { break; } case ImpulseBase::Impulse::COMBAT_DODGE: { break; } case ImpulseBase::Impulse::COMBAT_PROTECTED_SLOT: { break; } case ImpulseBase::Impulse::COMBAT_FLYING_ChaScore1_DELTA: { break; } case ImpulseBase::Impulse::COMBAT_FLYING_TEXT_ISE: { break; } case ImpulseBase::Impulse::COMBAT_FLYING_TEXT: { break; } case ImpulseBase::Impulse::STRING_TELL: { break; } case ImpulseBase::Impulse::STRING_FAR_TELL: { break; } case ImpulseBase::Impulse::STRING_CHAT: { break; } case ImpulseBase::Impulse::STRING_CHAT_TEAM: { break; } case ImpulseBase::Impulse::STRING_ADD_DYN_STR: { break; } case ImpulseBase::Impulse::STRING_FILTER: { break; } case ImpulseBase::Impulse::STRING_CHAT_MODE: { break; } case ImpulseBase::Impulse::STRING_CHAT2: { break; } case ImpulseBase::Impulse::STRING_TELL2: { break; } case ImpulseBase::Impulse::STRING_DYN_STRING: { break; } case ImpulseBase::Impulse::STRING_DYN_STRING_GROUP: { break; } case ImpulseBase::Impulse::STRING_AFK_TXT: { break; } case ImpulseBase::Impulse::STUN_STUN: { break; } case ImpulseBase::Impulse::STUN_WAKE_UP: { break; } case ImpulseBase::Impulse::SENTENCE_EXECUTE: { break; } case ImpulseBase::Impulse::SENTENCE_CANCEL: { break; } case ImpulseBase::Impulse::SENTENCE_CANCEL_CURRENT: { break; } case ImpulseBase::Impulse::SENTENCE_CANCEL_ALL: { break; } case ImpulseBase::Impulse::SENTENCE_CLEAR: { break; } case ImpulseBase::Impulse::SENTENCE_MEMORIZE: { break; } case ImpulseBase::Impulse::SENTENCE_FORGET: { break; } case ImpulseBase::Impulse::SENTENCE_EVALUATE: { break; } case ImpulseBase::Impulse::SENTENCE_ADD_BRICK: { break; } case ImpulseBase::Impulse::SENTENCE_REMOVE_BRICK: { break; } case ImpulseBase::Impulse::SENTENCE_START: { break; } case ImpulseBase::Impulse::SENTENCE_STOP: { break; } case ImpulseBase::Impulse::TEAM_JOIN: { break; } case ImpulseBase::Impulse::TEAM_LEAVE: { break; } case ImpulseBase::Impulse::TEAM_INVITATION: { break; } case ImpulseBase::Impulse::TEAM_JOIN_PROPOSAL: { break; } case ImpulseBase::Impulse::TEAM_JOIN_PROPOSAL_DECLINE: { break; } case ImpulseBase::Impulse::TEAM_KICK: { break; } case ImpulseBase::Impulse::TEAM_SET_SUCCESSOR: { break; } case ImpulseBase::Impulse::TEAM_SHARE_OPEN: { break; } case ImpulseBase::Impulse::TEAM_SHARE_VALID_ITEM: { break; } case ImpulseBase::Impulse::TEAM_SHARE_INVALID_ITEM: { break; } case ImpulseBase::Impulse::TEAM_SHARE_VALID: { break; } case ImpulseBase::Impulse::TEAM_SHARE_INVALID: { break; } case ImpulseBase::Impulse::TEAM_SHARE_CLOSE: { break; } case ImpulseBase::Impulse::TEAM_CONTACT_INIT: { break; } case ImpulseBase::Impulse::TEAM_CONTACT_ADD: { break; } case ImpulseBase::Impulse::TEAM_CONTACT_DEL: { break; } case ImpulseBase::Impulse::TEAM_CONTACT_MOVE: { break; } case ImpulseBase::Impulse::TEAM_CONTACT_CREATE: { break; } case ImpulseBase::Impulse::TEAM_CONTACT_STATUS: { break; } case ImpulseBase::Impulse::TEAM_CONTACT_REMOVE: { break; } case ImpulseBase::Impulse::ITEM_DROP: { break; } case ImpulseBase::Impulse::ITEM_PICK_UP: { break; } case ImpulseBase::Impulse::ITEM_PICK_UP_CLOSE: { break; } case ImpulseBase::Impulse::ITEM_SWAP: { break; } case ImpulseBase::Impulse::ITEM_ACTIVATE_SHEATH: { break; } case ImpulseBase::Impulse::ITEM_HARVEST: { break; } case ImpulseBase::Impulse::ITEM_HARVEST_CLOSE: { break; } case ImpulseBase::Impulse::ITEM_GIVE: { break; } case ImpulseBase::Impulse::ITEM_DESTROY: { break; } case ImpulseBase::Impulse::ITEM_EQUIP: { break; } case ImpulseBase::Impulse::ITEM_UNEQUIP: { break; } case ImpulseBase::Impulse::ITEM_TEMP_TO_BAG: { break; } case ImpulseBase::Impulse::ITEM_ALL_TEMP: { break; } case ImpulseBase::Impulse::ITEM_NO_TEMP: { break; } case ImpulseBase::Impulse::ITEM_ENCHANT: { break; } case ImpulseBase::Impulse::ITEM_OPEN_ROOM_INVENTORY: { break; } case ImpulseBase::Impulse::ITEM_CLOSE_ROOM_INVENTORY: { break; } case ImpulseBase::Impulse::ITEM_USE_ITEM: { break; } case ImpulseBase::Impulse::ITEM_STOP_USE_XP_CAT: { break; } case ImpulseBase::Impulse::TP_RESPAWN: { break; } case ImpulseBase::Impulse::TP_BOT: { break; } case ImpulseBase::Impulse::TP_WANTED: { break; } case ImpulseBase::Impulse::TP_DEST: { break; } case ImpulseBase::Impulse::TP_DEST_WITH_SEASON: { break; } case ImpulseBase::Impulse::TP_ACK: { break; } case ImpulseBase::Impulse::TP_CORRECT: { break; } case ImpulseBase::Impulse::DEATH_RESPAWN_POINT: { break; } case ImpulseBase::Impulse::DEATH_ASK_RESPAWN: { break; } case ImpulseBase::Impulse::DEATH_RESPAWN: { break; } case ImpulseBase::Impulse::ANIMALS_BEAST: { break; } case ImpulseBase::Impulse::ANIMALS_MOUNT_ABORT: { break; } case ImpulseBase::Impulse::EXCHANGE_INVITATION: { break; } case ImpulseBase::Impulse::EXCHANGE_CLOSE_INVITATION: { break; } case ImpulseBase::Impulse::EXCHANGE_PROPOSAL: { break; } case ImpulseBase::Impulse::EXCHANGE_ACCEPT_INVITATION: { break; } case ImpulseBase::Impulse::EXCHANGE_DECLINE_INVITATION: { break; } case ImpulseBase::Impulse::EXCHANGE_VALIDATE: { break; } case ImpulseBase::Impulse::EXCHANGE_INVALIDATE: { break; } case ImpulseBase::Impulse::EXCHANGE_END: { break; } case ImpulseBase::Impulse::EXCHANGE_SEEDS: { break; } case ImpulseBase::Impulse::EXCHANGE_ADD: { break; } case ImpulseBase::Impulse::EXCHANGE_REMOVE: { break; } case ImpulseBase::Impulse::DEBUG_WHERE: { break; } case ImpulseBase::Impulse::DEBUG_WHO: { break; } case ImpulseBase::Impulse::DEBUG_REPLY_WHERE: { break; } case ImpulseBase::Impulse::DEBUG_SERVICES: { break; } case ImpulseBase::Impulse::DEBUG_CMD: { break; } case ImpulseBase::Impulse::DEBUG_PING: { break; } case ImpulseBase::Impulse::DEBUG_COUNTER: { break; } case ImpulseBase::Impulse::COMMAND_EMOTE: { break; } case ImpulseBase::Impulse::COMMAND_CUSTOM_EMOTE: { break; } case ImpulseBase::Impulse::COMMAND_WHERE: { break; } case ImpulseBase::Impulse::COMMAND_ADMIN: { break; } case ImpulseBase::Impulse::COMMAND_ADMIN_OFFLINE: { break; } case ImpulseBase::Impulse::COMMAND_REMOTE_ADMIN: { break; } case ImpulseBase::Impulse::COMMAND_REMOTE_ADMIN_ANSWER: { break; } case ImpulseBase::Impulse::COMMAND_SIT: { break; } case ImpulseBase::Impulse::COMMAND_AFK: { break; } case ImpulseBase::Impulse::COMMAND_RANDOM: { break; } case ImpulseBase::Impulse::COMMAND_GUILDMOTD: { break; } case ImpulseBase::Impulse::MP_EVAL_SET_MP: { break; } case ImpulseBase::Impulse::MP_EVAL_SET_MP_LEVEL: { break; } case ImpulseBase::Impulse::MP_EVAL_SET_MARKET: { break; } case ImpulseBase::Impulse::MP_EVAL_EXECUTE: { break; } case ImpulseBase::Impulse::BOTCHAT_NEXT_PAGE_ITEM: { break; } case ImpulseBase::Impulse::BOTCHAT_NEXT_PAGE_MISSION: { break; } case ImpulseBase::Impulse::BOTCHAT_START_TRADE_ITEM: { break; } case ImpulseBase::Impulse::BOTCHAT_START_TRADE_TELEPORT: { break; } case ImpulseBase::Impulse::BOTCHAT_START_TRADE_FACTION: { break; } case ImpulseBase::Impulse::BOTCHAT_START_TRADE_SKILL: { break; } case ImpulseBase::Impulse::BOTCHAT_START_TRADE_PACT: { break; } case ImpulseBase::Impulse::BOTCHAT_START_TRADE_ACTION: { break; } case ImpulseBase::Impulse::BOTCHAT_BUY: { break; } case ImpulseBase::Impulse::BOTCHAT_SELL: { break; } case ImpulseBase::Impulse::BOTCHAT_DESTROY_ITEM: { break; } case ImpulseBase::Impulse::BOTCHAT_REFRESH_TRADE_LIST: { break; } case ImpulseBase::Impulse::BOTCHAT_SET_FILTERS: { break; } case ImpulseBase::Impulse::BOTCHAT_START_CHOOSE_MISSION: { break; } case ImpulseBase::Impulse::BOTCHAT_START_DYNAMIC_MISSION: { break; } case ImpulseBase::Impulse::BOTCHAT_CONTINUE_MISSION: { break; } case ImpulseBase::Impulse::BOTCHAT_VALIDATE_PLAYER_GIFT: { break; } case ImpulseBase::Impulse::BOTCHAT_PICK_MISSION: { break; } case ImpulseBase::Impulse::BOTCHAT_DM_CHOICE: { break; } case ImpulseBase::Impulse::BOTCHAT_DM_ACCEPT: { break; } case ImpulseBase::Impulse::BOTCHAT_START_NEWS: { break; } case ImpulseBase::Impulse::BOTCHAT_START_CREATE_GUILD: { break; } case ImpulseBase::Impulse::BOTCHAT_END: { break; } case ImpulseBase::Impulse::BOTCHAT_FORCE_END: { break; } case ImpulseBase::Impulse::BOTCHAT_START_CHOOSE_DUTY: { break; } case ImpulseBase::Impulse::BOTCHAT_NEXT_PAGE_DUTY: { break; } case ImpulseBase::Impulse::BOTCHAT_DUTY_APPLY: { break; } case ImpulseBase::Impulse::BOTCHAT_DUTY_CANCEL_APPLY: { break; } case ImpulseBase::Impulse::BOTCHAT_START_TRADE_GUILD_OPTIONS: { break; } case ImpulseBase::Impulse::BOTCHAT_BUY_GUILD_OPTION: { break; } case ImpulseBase::Impulse::BOTCHAT_START_GUILD_RESEARCH: { break; } case ImpulseBase::Impulse::BOTCHAT_DESTROY_BUILDING: { break; } case ImpulseBase::Impulse::BOTCHAT_DYNCHAT_OPEN: { break; } case ImpulseBase::Impulse::BOTCHAT_DYNCHAT_CLOSE: { break; } case ImpulseBase::Impulse::BOTCHAT_DYNCHAT_SEND: { break; } case ImpulseBase::Impulse::JOURNAL_INIT_COMPLETED_MISSIONS: { break; } case ImpulseBase::Impulse::JOURNAL_UPDATE_COMPLETED_MISSIONS: { break; } case ImpulseBase::Impulse::JOURNAL_MISSION_ABANDON: { break; } case ImpulseBase::Impulse::JOURNAL_GROUP_MISSION_ABANDON: { break; } case ImpulseBase::Impulse::JOURNAL_ADD_COMPASS: { break; } case ImpulseBase::Impulse::JOURNAL_ADD_COMPASS_BOT: { break; } case ImpulseBase::Impulse::JOURNAL_REMOVE_COMPASS: { break; } case ImpulseBase::Impulse::JOURNAL_REMOVE_COMPASS_BOT: { break; } case ImpulseBase::Impulse::STRING_MANAGER_SET_LANGUAGE: { break; } case ImpulseBase::Impulse::STRING_MANAGER_PHRASE_SEND: { uint32_t dyn_id = msgin->get_uint32(); value["dyn_id"] = dyn_id; Array string_id; while(msgin->number_bit_not_read() > 32) string_id.append(msgin->get_uint32()); value["string_id"] = string_id; break; } case ImpulseBase::Impulse::STRING_MANAGER_STRING_RQ: { break; } case ImpulseBase::Impulse::STRING_MANAGER_STRING_RESP: { uint32_t string_id = msgin->get_uint32(); String str_utf8 = msgin->get_string_utf8(); DBG_PRINT("Decode message:" + ImpulseBase::get_command_name(id) + " string_id:" + itos(string_id) + " str_utf8:" + str_utf8); //param.push_back(timestamp); value["string_id"] = string_id; value["str_utf8"] = str_utf8; break; } case ImpulseBase::Impulse::STRING_MANAGER_RELOAD_CACHE: { uint32_t timestamp = msgin->get_uint32(); DBG_PRINT("Decode message:" + ImpulseBase::get_command_name(id) + " timestamp:" + itos(timestamp)); //param.push_back(timestamp); value["timestamp"] = timestamp; //data->_server_messages.push_back(value); break; } case ImpulseBase::Impulse::GUILD_CREATE: { break; } case ImpulseBase::Impulse::GUILD_ABORT_CREATION: { break; } case ImpulseBase::Impulse::GUILD_OPEN_GUILD_WINDOW: { break; } case ImpulseBase::Impulse::GUILD_INVITATION: { break; } case ImpulseBase::Impulse::GUILD_ACCEPT_INVITATION: { break; } case ImpulseBase::Impulse::GUILD_REFUSE_INVITATION: { break; } case ImpulseBase::Impulse::GUILD_JOIN_PROPOSAL: { break; } case ImpulseBase::Impulse::GUILD_SET_GRADE: { break; } case ImpulseBase::Impulse::GUILD_SET_LEADER: { break; } case ImpulseBase::Impulse::GUILD_KICK_MEMBER: { break; } case ImpulseBase::Impulse::GUILD_TELEPORT: { break; } case ImpulseBase::Impulse::GUILD_ASCENSOR: { break; } case ImpulseBase::Impulse::GUILD_FIRST_ASCENSOR_PAGE: { break; } case ImpulseBase::Impulse::GUILD_NEXT_ASCENSOR_PAGE: { break; } case ImpulseBase::Impulse::GUILD_LEAVE_ASCENSOR: { break; } case ImpulseBase::Impulse::GUILD_QUIT: { break; } case ImpulseBase::Impulse::GUILD_SET_PLAYER_TITLE: { break; } case ImpulseBase::Impulse::GUILD_UPDATE_PLAYER_TITLE: { break; } case ImpulseBase::Impulse::GUILD_USE_FEMALE_TITLES: { break; } case ImpulseBase::Impulse::GUILD_PUT_MONEY: { break; } case ImpulseBase::Impulse::GUILD_TAKE_MONEY: { break; } case ImpulseBase::Impulse::GUILD_OPEN_INVENTORY: { break; } case ImpulseBase::Impulse::GUILD_CLOSE_INVENTORY: { break; } case ImpulseBase::Impulse::OUTPOST_GIVEUP_OUTPOST: { break; } case ImpulseBase::Impulse::OUTPOST_SELECT: { break; } case ImpulseBase::Impulse::OUTPOST_UNSELECT: { break; } case ImpulseBase::Impulse::OUTPOST_DECLARE_WAR_START: { break; } case ImpulseBase::Impulse::OUTPOST_DECLARE_WAR_ACK: { break; } case ImpulseBase::Impulse::OUTPOST_DECLARE_WAR_VALIDATE: { break; } case ImpulseBase::Impulse::OUTPOST_SET_DEF_PERIOD: { break; } case ImpulseBase::Impulse::OUTPOST_SET_SQUAD: { break; } case ImpulseBase::Impulse::OUTPOST_SET_SQUAD_SPAWN: { break; } case ImpulseBase::Impulse::OUTPOST_INSERT_SQUAD: { break; } case ImpulseBase::Impulse::OUTPOST_REMOVE_SQUAD: { break; } case ImpulseBase::Impulse::OUTPOST_SET_SQUAD_CAPITAL: { break; } case ImpulseBase::Impulse::OUTPOST_CHOOSE_SIDE: { break; } case ImpulseBase::Impulse::OUTPOST_SIDE_CHOSEN: { break; } case ImpulseBase::Impulse::OUTPOST_BANISH_PLAYER: { break; } case ImpulseBase::Impulse::OUTPOST_BANISH_GUILD: { break; } case ImpulseBase::Impulse::OUTPOST_BUY_BUILDING: { break; } case ImpulseBase::Impulse::OUTPOST_DESTROY_BUILDING: { break; } case ImpulseBase::Impulse::PHRASE_DELETE: { break; } case ImpulseBase::Impulse::PHRASE_LEARN: { break; } case ImpulseBase::Impulse::PHRASE_MEMORIZE: { break; } case ImpulseBase::Impulse::PHRASE_FORGET: { break; } case ImpulseBase::Impulse::PHRASE_EXECUTE: { break; } case ImpulseBase::Impulse::PHRASE_EXECUTE_CYCLIC: { break; } case ImpulseBase::Impulse::PHRASE_EXECUTE_FABER: { break; } case ImpulseBase::Impulse::PHRASE_DOWNLOAD: { break; } case ImpulseBase::Impulse::PHRASE_BUY: { break; } case ImpulseBase::Impulse::PHRASE_CONFIRM_BUY: { break; } case ImpulseBase::Impulse::PHRASE_BUY_SHEET: { break; } case ImpulseBase::Impulse::PHRASE_CANCEL_LINK: { break; } case ImpulseBase::Impulse::PHRASE_CANCEL_TOP: { break; } case ImpulseBase::Impulse::PHRASE_CANCEL_ALL: { break; } case ImpulseBase::Impulse::PHRASE_CRISTALIZE: { break; } case ImpulseBase::Impulse::PHRASE_EXEC_CYCLIC_ACK: { break; } case ImpulseBase::Impulse::PHRASE_EXEC_NEXT_ACK: { break; } case ImpulseBase::Impulse::ITEM_INFO_GET: { break; } case ImpulseBase::Impulse::ITEM_INFO_SET: { break; } case ImpulseBase::Impulse::ITEM_INFO_REFRESH_VERSION: { break; } case ImpulseBase::Impulse::MISSION_PREREQ_GET: { break; } case ImpulseBase::Impulse::MISSION_PREREQ_SET: { break; } case ImpulseBase::Impulse::MISSION_ENTER_CRITICAL: { break; } case ImpulseBase::Impulse::MISSION_ASK_ENTER_CRITICAL: { break; } case ImpulseBase::Impulse::MISSION_CLOSE_ENTER_CRITICAL: { break; } case ImpulseBase::Impulse::MISSION_WAKE: { break; } case ImpulseBase::Impulse::MISSION_GROUP_WAKE: { break; } case ImpulseBase::Impulse::DUEL_ASK: { break; } case ImpulseBase::Impulse::DUEL_ACCEPT: { break; } case ImpulseBase::Impulse::DUEL_REFUSE: { break; } case ImpulseBase::Impulse::DUEL_ABANDON: { break; } case ImpulseBase::Impulse::DUEL_INVITATION: { break; } case ImpulseBase::Impulse::DUEL_CANCEL_INVITATION: { break; } case ImpulseBase::Impulse::PVP_CHALLENGE_ASK: { break; } case ImpulseBase::Impulse::PVP_CHALLENGE_ACCEPT: { break; } case ImpulseBase::Impulse::PVP_CHALLENGE_REFUSE: { break; } case ImpulseBase::Impulse::PVP_CHALLENGE_ABANDON: { break; } case ImpulseBase::Impulse::PVP_CHALLENGE_INVITATION: { break; } case ImpulseBase::Impulse::PVP_CHALLENGE_CANCEL_INVITATION: { break; } case ImpulseBase::Impulse::PVP_PVP_TAG: { break; } case ImpulseBase::Impulse::PVP_SET_NEUTRAL_ALLEGIANCE: { break; } case ImpulseBase::Impulse::PVP_SET_NEUTRAL_ALLEGIANCE_GUILD: { break; } case ImpulseBase::Impulse::PVP_FACTION_PUSH_FACTION_WAR: { break; } case ImpulseBase::Impulse::PVP_FACTION_POP_FACTION_WAR: { break; } case ImpulseBase::Impulse::PVP_FACTION_FACTION_WARS: { break; } case ImpulseBase::Impulse::ENCYCLOPEDIA_UPDATE: { break; } case ImpulseBase::Impulse::ENCYCLOPEDIA_INIT: { break; } case ImpulseBase::Impulse::USER_BARS: { break; } case ImpulseBase::Impulse::USER_POPUP: { break; } case ImpulseBase::Impulse::EVENT_SET_ITEM_CUSTOM_TEXT: { break; } case ImpulseBase::Impulse::EVENT_DUMMY: { break; } case ImpulseBase::Impulse::TOTEM_BUILD: { break; } case ImpulseBase::Impulse::TOTEM_DUMMY: { break; } case ImpulseBase::Impulse::MODULE_GATEWAY_FEOPEN: { break; } case ImpulseBase::Impulse::MODULE_GATEWAY_GATEWAY_MSG: { break; } case ImpulseBase::Impulse::MODULE_GATEWAY_FECLOSE: { break; } case ImpulseBase::Impulse::SEASON_SET: { break; } case ImpulseBase::Impulse::SEASON_DUMMY: { break; } case ImpulseBase::Impulse::DM_GIFT_BEGIN: { break; } case ImpulseBase::Impulse::DM_GIFT_VALIDATE: { break; } case ImpulseBase::Impulse::RING_MISSION_MISSION_RING_SELECT: { break; } case ImpulseBase::Impulse::RING_MISSION_DSS_DOWN: { break; } case ImpulseBase::Impulse::NPC_ICON_GET_DESC: { break; } case ImpulseBase::Impulse::NPC_ICON_SET_DESC: { break; } case ImpulseBase::Impulse::NPC_ICON_SVR_EVENT_MIS_AVL: { break; } case ImpulseBase::Impulse::NPC_ICON_SET_TIMER: { break; } default: { break; } } data->_server_messages.push_back(value); #ifdef DEBUG_ENABLED // Check if we have read all data - only on debug mode { uint32_t last_data; while ( msgin->number_bit_not_read() > 0 ) { DBG_PRINT("Read : " + itos(msgin->number_bit_not_read())); if ( msgin->number_bit_not_read() >= 8 ) //last_data = msgin->get_uint8(); last_data = 1; else last_data = msgin->get_serial(msgin->number_bit_not_read()); if ( last_data != 0 ) { ERR_PRINT("Missing some data - we dont' have translate all data : " + msgin->show()); break; } } } #endif } void ActionFactory::encode_message(Dictionary value, Ref msgout) { ReferentialMessage ref_msg; int id = value["impulse"]; ref_msg.write_command((ImpulseBase::Impulse)id, msgout); DBG_PRINT("[ActionFactory::pack] ACTION_GENERIC_CODE encode_message A:" + itos(id) + " / " + msgout->show_detail()); switch(id) { case ImpulseBase::Impulse::TARGET_PARTY: { break; } case ImpulseBase::Impulse::STRING_MANAGER_STRING_RQ: { uint32_t string_id = value["string_id"]; msgout->put_uint32(string_id); DBG_PRINT("[ActionFactory::pack] ACTION_GENERIC_CODE encode_message B:" + itos(id) + " / " + msgout->show_detail()); break; } case ImpulseBase::Impulse::CONNECTION_DELETE_CHAR: { uint8_t slot = value["slot"]; msgout->put_uint8(slot); break; } case ImpulseBase::Impulse::CONNECTION_CREATE_CHAR: { // khanat-opennel-code/code/ryzom/server/src/entities_game_service/player_manager/character.cpp:7977 bool CCharacter::checkCreateParams( const CCreateCharMsg& createCharMsg, CCreateCharErrorMsg& createCharErrorMsg, uint32 userId ) uint8_t slot = value["slot"]; uint8_t people = value["people"]; uint8_t sex = value["sex"]; uint8_t nb_point_fighter = value["nb_point_fighter"]; uint8_t nb_point_caster = value["nb_point_caster"]; uint8_t nb_point_crafter = value["nb_point_crafter"]; uint8_t nb_point_harvester = value["nb_point_harvester"]; uint8_t start_point = value["start_point"]; uint8_t hair_type = value["hair_type"]; uint8_t hair_color = value["hair_color"]; uint8_t gabarit_height = value["gabarit_height"]; uint8_t gabarit_torso_width = value["gabarit_torso_width"]; uint8_t gabarit_arms_width = value["gabarit_arms_width"]; uint8_t gabarit_legs_width = value["gabarit_legs_width"]; uint8_t gabarit_breast_size = value["gabarit_breast_size"]; uint8_t morph_target_1 = value["morph_target_1"]; uint8_t morph_target_2 = value["morph_target_2"]; uint8_t morph_target_3 = value["morph_target_3"]; uint8_t morph_target_4 = value["morph_target_4"]; uint8_t morph_target_5 = value["morph_target_5"]; uint8_t morph_target_6 = value["morph_target_6"]; uint8_t morph_target_7 = value["morph_target_7"]; uint8_t morph_target_8 = value["morph_target_8"]; uint8_t eyes_color = value["eyes_color"]; uint8_t tattoo = value["tattoo"]; uint8_t jacket_color = value["jacket_color"]; uint8_t trousers_color = value["trousers_color"]; uint8_t hat_color = value["hat_color"]; uint8_t arms_color = value["arms_color"]; uint8_t hands_color = value["hands_color"]; uint8_t feet_color = value["feet_color"]; uint32_t sheet_id = value["sheet_id"]; uint32_t session_id = value["session_id"]; String name = value["name"]; msgout->put_uint8(slot); msgout->put_uint32(sheet_id); msgout->put_uint32(session_id); msgout->put_string_utf16(name); msgout->put_uint8(people); msgout->put_uint8(sex); msgout->put_uint8(nb_point_fighter); msgout->put_uint8(nb_point_caster); msgout->put_uint8(nb_point_crafter); msgout->put_uint8(nb_point_harvester); msgout->put_uint32(start_point); msgout->put_uint8(hair_type); msgout->put_uint8(hair_color); msgout->put_uint8(gabarit_height); msgout->put_uint8(gabarit_torso_width); msgout->put_uint8(gabarit_arms_width); msgout->put_uint8(gabarit_legs_width); msgout->put_uint8(gabarit_breast_size); msgout->put_uint8(morph_target_1); msgout->put_uint8(morph_target_2); msgout->put_uint8(morph_target_3); msgout->put_uint8(morph_target_4); msgout->put_uint8(morph_target_5); msgout->put_uint8(morph_target_6); msgout->put_uint8(morph_target_7); msgout->put_uint8(morph_target_8); msgout->put_uint8(eyes_color); msgout->put_uint8(tattoo); msgout->put_uint8(jacket_color); msgout->put_uint8(trousers_color); msgout->put_uint8(hat_color); msgout->put_uint8(arms_color); msgout->put_uint8(hands_color); msgout->put_uint8(feet_color); DBG_PRINT("[ActionFactory::pack] ACTION_GENERIC_CODE encode_message B:" + itos(id) + " / " + msgout->show_detail()); break; } default: { break; } } } void ActionFactory::code(int code, Ref msgout) { if(code < 4) { msgout->put_bool(true); msgout->put_serial(code, 2); } else { msgout->put_bool(false); msgout->put_uint8(code); } } void ActionFactory::pack(NetworkData * data) { while(data->_command_to_send.size()) { DBG_PRINT("[ActionFactory::pack]"); Dictionary value = data->_command_to_send.pop_front(); int id = value["action"]; switch(id) { case Action::CODE::ACTION_POSITION_CODE: { break; } case Action::CODE::ACTION_GENERIC_CODE: case Action::CODE::ACTION_GENERIC_MULTI_PART_CODE: { Ref msg; msg.instance(); encode_message(value, msg); DBG_PRINT("[ActionFactory::pack] ACTION_GENERIC_CODE encode_message :" + msg->show_detail()); if( msg->size_data() < MAX_IMPULSE_BIT_SIZE ) // 1840 bits= 230*8 { // ACTION_GENERIC_CODE Ref msgout; msgout.instance(); code(Action::CODE::ACTION_GENERIC_CODE, msgout); msg->complet_byte(); DBG_PRINT("[ActionFactory::pack] ACTION_GENERIC_CODE encode_message (Bis):" + msg->show_detail()); DBG_PRINT("[ActionFactory::pack] ACTION_GENERIC_CODE prepared A :" + msgout->show_detail()); msgout->put_uint32(msg->size()); DBG_PRINT("[ActionFactory::pack] ACTION_GENERIC_CODE prepared B :" + msgout->show_detail()); msgout->put_bitstream(msg.ptr()); DBG_PRINT("[ActionFactory::pack] ACTION_GENERIC_CODE prepared C :" + msgout->show_detail()); data->_client_messages.append(msgout); //data->_client_messages.append(msgout->get_data()); DBG_PRINT("[ActionFactory::pack] ACTION_GENERIC_CODE prepared D :" + msgout->show_detail()); msgout.unref(); } else { // ACTION_GENERIC_MULTI_PART_CODE uint32_t size; uint32_t last = 0; uint32_t minimumBitSizeForMP = 1 + 2 + 2 + 4; // header uint32_t availableSize = (MAX_IMPULSE_BIT_SIZE - minimumBitSizeForMP); // 8 uint32_t bytelen = msg->size(); uint16_t part; uint16_t nbBlock = (bytelen + availableSize - 1); // availableSize uint8_t num = data->_impulse_multi_part_number; PoolByteArray msgTemp; data->_impulse_multi_part_number += 1; msg->complet_byte(); for(part = 0 ; part < nbBlock ; ++part) { Ref msgout; msgout.instance(); code(Action::CODE::ACTION_GENERIC_MULTI_PART_CODE, msgout); msgout->put_uint8(num); msgout->put_uint16(part); msgout->put_uint16(nbBlock); size = availableSize; if ( size + last > bytelen) size = bytelen - last; last = size; msgout->put_uint32(size); msgout->get_array_uint8(size); data->_client_messages.append(msgout); DBG_PRINT("[ActionFactory::pack] ACTION_GENERIC_MULTI_PART_CODE prepared :" + msgout->show_detail()); msgout.unref(); } } msg.unref(); break; } case Action::CODE::ACTION_SINT64: { break; } case Action::CODE::ACTION_SYNC_CODE: { // not used, here break; } case Action::CODE::ACTION_DISCONNECTION_CODE: { break; } case Action::CODE::ACTION_ASSOCIATION_CODE: { break; } case Action::CODE::ACTION_LOGIN_CODE: { // not used, here break; } case Action::CODE::ACTION_TARGET_SLOT_CODE: { break; } case Action::CODE::ACTION_DUMMY_CODE: { break; } } } } void ActionFactory::unpack(NetworkData * data, Ref msgin) { bool shortcode = msgin->get_bool(); uint8_t code; DBG_PRINT("shortcode:" + itos(shortcode)); if ( shortcode == true ) code = msgin->get_serial(2); else code = msgin->get_uint8(); DBG_PRINT("code:" + itos(code)); switch (code) { case Action::CODE::ACTION_POSITION_CODE: { // khanat-opennel-code/code/ryzom/common/src/game_share/action_position.cpp:34 void CActionPosition::unpack (NLMISC::CBitMemStream &message) // px ( 16 bit unsigned ) // py ( 16 bit unsigned ) // pz ( 16 bit unsigned ) : low bit have other signification // 0x01 : IsRelative // 0x02 : Interior DBG_PRINT("ACTION_POSITION_CODE"); uint16_t px = msgin->get_uint16(); uint16_t py = msgin->get_uint16(); uint16_t pz = msgin->get_uint16(); bool IsRelative = (pz & 0x1) != 0; bool Interior = (pz & 0x2) != 0; Dictionary msg; msg["action"] = code; #ifdef DEBUG_ENABLED msg["action_debug"] = "ACTION_POSITION_CODE"; #endif msg["px"] = px; msg["py"] = px; msg["pz"] = px; msg["IsRelative"] = IsRelative; msg["Interior"] = Interior; data->_server_messages.push_back(msg); DBG_PRINT("ACTION_POSITION_CODE px:" + uitos(px) + " py:" + uitos(py) + " pz:" + uitos(pz) + " IsRelative:" + uitos(IsRelative) + " Interior:" + uitos(Interior)); break; } case Action::CODE::ACTION_GENERIC_CODE: { // khanat-opennel-code/code/ryzom/common/src/game_share/action_generic.cpp void CActionGeneric::unpack (NLMISC::CBitMemStream &message) // size ( 32 bits unsigned ) : if size > 512 we have an error (normally reject by server) // StreamByte ( Array : size * 8 bits unsigned ) DBG_PRINT("ACTION_GENERIC_CODE"); uint32_t size = msgin->get_uint32(); DBG_PRINT("ACTION_GENERIC_CODE size:" + uitos(size)); PoolByteArray StreamByte = msgin->get_array_uint8(size); //BitStream StreamByte = msgin->get_bitstream(size); DBG_PRINT("ACTION_GENERIC_CODE size:" + uitos(size)); Ref tmp; tmp.instance(); tmp->put_array_uint8(StreamByte); decode_message(data, tmp); tmp.unref(); break; } case Action::CODE::ACTION_GENERIC_MULTI_PART_CODE: { // khanat-opennel-code/code/ryzom/common/src/game_share/action_generic_multi_part.h:46 virtual void unpack (NLMISC::CBitMemStream &message) // Number ( 8 bits unsigned ) // Part ( 16 bits unsigned ) // NbBlock ( 16 bits unsigned ) // size ( 32 bits unsigned ) // PartCont ( Array : size * 8 bits unsigned ) DBG_PRINT("ACTION_GENERIC_MULTI_PART_CODE"); uint8_t Number = msgin->get_uint8(); uint16_t Part = msgin->get_uint16(); uint16_t NbBlock = msgin->get_uint16(); uint32_t size = msgin->get_uint32(); PoolByteArray StreamByte = msgin->get_array_uint8(size); DBG_PRINT("ACTION_GENERIC_MULTI_PART_CODE Number:" + uitos(Number) + " Part:" + uitos(Part) + " NbBlock:" + uitos(NbBlock) + " size:" + uitos(size)); if ( ! data->_block.has(Number) ) { Dictionary newelement; data->_block[Number] = newelement; data->_block_used[Number] = 0; //data->_block[Number] = new GenericMultiPart(Number, NbBlock); } Dictionary ele = data->_block[Number]; //[Part] = StreamByte; ele[Part] = StreamByte; { Ref tmp; tmp.instance(); tmp->put_array_uint8(StreamByte); tmp.unref(); } if( ele.size() == NbBlock) { int used = data->_block_used[Number]; if ( used != 0 ) break; int i; PoolByteArray full; for(i = 0;i < NbBlock; ++i) { PoolByteArray tmp = ele[i]; full.append_array(ele[i]); } Ref tmp; tmp.instance(); tmp->put_array_uint8(full); decode_message(data, tmp); tmp.unref(); data->_block_used[Number] = 20; } break; } case Action::CODE::ACTION_SINT64: { // khanat-opennel-code/code/ryzom/common/src/game_share/action_sint64.cpp:86 void CActionSint64::unpack (NLMISC::CBitMemStream &message) // value ( 64 bits unsigned ) DBG_PRINT("ACTION_SINT64"); uint64_t value = msgin->get_uint64(); Dictionary msg; msg["action"] = code; #ifdef DEBUG_ENABLED msg["action_debug"] = "ACTION_SINT64"; #endif msg["value"] = value; data->_server_messages.push_back(msg); DBG_PRINT("ACTION_SINT64 value:" + uitos(value)); break; } case Action::CODE::ACTION_SYNC_CODE: { // khanat-opennel-code/code/ryzom/common/src/game_share/action_sync.h:44 virtual void unpack (NLMISC::CBitMemStream &message) // Sync ( 32 bits unsigned ) // BKEntityId ( 64 bits unsigned ) [see definition : khanat-opennel-code/code/nel/include/nel/misc/entity_id.h:64] DBG_PRINT("ACTION_SYNC_CODE"); uint32_t Sync = msgin->get_uint32(); uint64_t BKEntityId = msgin->get_uint64(); Dictionary msg; msg["action"] = code; #ifdef DEBUG_ENABLED msg["action_debug"] = "ACTION_SYNC_CODE"; #endif msg["Sync"] = Sync; msg["BKEntityId"] = BKEntityId; data->_server_messages.push_back(msg); DBG_PRINT("ACTION_SYNC_CODE Sync:" + uitos(Sync) + " BKEntityId:" + uitos(BKEntityId)); break; } case Action::CODE::ACTION_DISCONNECTION_CODE: { // khanat-opennel-code/code/ryzom/common/src/game_share/action_disconnection.h // No data DBG_PRINT("ACTION_DISCONNECTION_CODE"); Dictionary msg; msg["action"] = code; #ifdef DEBUG_ENABLED msg["action_debug"] = "ACTION_DISCONNECTION_CODE"; #endif data->_server_messages.push_back(msg); break; } case Action::CODE::ACTION_ASSOCIATION_CODE: { // khanat-opennel-code/code/ryzom/common/src/game_share/action_association.h virtual void unpack (NLMISC::CBitMemStream &message) // IsNewAssociation ( bool / 1 bit ) // if IsNewAssociation is true: // SheetId ( 32 bits unsigned ) // Replace ( bool / 1 bit ) DBG_PRINT("ACTION_ASSOCIATION_CODE"); uint32_t SheetId = msgin->get_uint32(); bool Replace = msgin->get_bool(); Dictionary msg; msg["action"] = code; #ifdef DEBUG_ENABLED msg["action_debug"] = "ACTION_ASSOCIATION_CODE"; #endif msg["SheetId"] = SheetId; msg["Replace"] = Replace; data->_server_messages.push_back(msg); DBG_PRINT("ACTION_ASSOCIATION_CODE SheetId:" + uitos(SheetId) + " Replace:" + uitos(Replace)); break; } case Action::CODE::ACTION_LOGIN_CODE: { // khanat-opennel-code/code/ryzom/common/src/game_share/action_login.h virtual void unpack (NLMISC::CBitMemStream &message) // ua ( 32 bits unsigned ) // uk ( 32 bits unsigned ) // ui ( 32 bits unsigned ) DBG_PRINT("ACTION_LOGIN_CODE"); uint32_t ua = msgin->get_uint32(); uint32_t uk = msgin->get_uint32(); uint32_t ui = msgin->get_uint32(); Dictionary msg; msg["action"] = code; #ifdef DEBUG_ENABLED msg["action_debug"] = "ACTION_LOGIN_CODE"; #endif msg["ua"] = ua; msg["uk"] = uk; msg["ui"] = ui; data->_server_messages.push_back(msg); DBG_PRINT("ACTION_LOGIN_CODE ua:" + uitos(ua) + " uk:" + uitos(uk)+ " ui:" + uitos(ui)); break; } case Action::CODE::ACTION_TARGET_SLOT_CODE: { // khanat-opennel-code/code/ryzom/common/src/game_share/action_target_slot.h virtual void unpack (NLMISC::CBitMemStream &message) // Slot ( 8 bits unsigned ) // TargetOrPickup (2 bits unsigned) DBG_PRINT("ACTION_TARGET_SLOT_CODE"); uint8_t Slot = msgin->get_uint8(); uint32_t TargetOrPickup = msgin->get_serial(2); Dictionary msg; msg["action"] = code; #ifdef DEBUG_ENABLED msg["action_debug"] = "ACTION_TARGET_SLOT_CODE"; #endif msg["Slot"] = Slot; msg["TargetOrPickup"] = TargetOrPickup; data->_server_messages.push_back(msg); DBG_PRINT("ACTION_TARGET_SLOT_CODE Slot:" + uitos(Slot) + " TargetOrPickup:" + uitos(TargetOrPickup)); break; } case Action::CODE::ACTION_DUMMY_CODE: { // khanat-opennel-code/code/ryzom/common/src/game_share/action_dummy.h virtual void unpack (NLMISC::CBitMemStream &message) // Dummy1 ( 32 bits unsigned ) // Dummy2 ( 32 bits unsigned ) DBG_PRINT("ACTION_DUMMY_CODE"); uint32_t Dummy1 = msgin->get_uint32(); uint32_t Dummy2 = msgin->get_uint32(); Dictionary msg; msg["action"] = code; #ifdef DEBUG_ENABLED msg["action_debug"] = "ACTION_DUMMY_CODE"; #endif msg["Dummy1"] = Dummy1; msg["Dummy2"] = Dummy2; data->_server_messages.push_back(msg); DBG_PRINT("ACTION_DUMMY_CODE Dummy1:" + uitos(Dummy1) + " Dummy2:" + uitos(Dummy2)); break; } default: { ERR_PRINT("Impossible to decode message received from server (code:" + uitos(code) + ")"); break; } } } void ActionFactory::decode(NetworkData * data, Ref msgin) { // khanat-opennel-code/code/ryzom/client/src/impulse_decoder.cpp:38 void CImpulseDecoder::decode(CBitMemStream &inbox, TPacketNumber receivedPacket, TPacketNumber receivedAck, TPacketNumber nextSentPacket, vector &actions) int keep; bool check_once; bool next; uint32_t * last_ack; int level; int channel; int num; data->_last_received_ack = msgin->get_uint32(); DBG_PRINT("last_received_ack:" + itos(data->_last_received_ack)); for( level=0 ; level < 3 ; ++level ) { DBG_PRINT("level:" + itos(level)); switch(level) { case 0: last_ack = data->_last_ack_0; channel = 0; break; case 1: last_ack = data->_last_ack_1; channel = data->_current_received_number & 1; break; default: // 2 last_ack = data->_last_ack_2; channel = data->_current_received_number & 3; break; } DBG_PRINT("channel:" + itos(channel)); keep = -1; check_once = false; num = 0; next = msgin->get_bool(); DBG_PRINT("next:" + itos(next)); while(next == true) { if( check_once == false ) { check_once = true; //keep = diff_uint32_circulate(received_ack, last_ack[channel]) >= 0; keep = data->_last_received_ack >= last_ack[channel]; if(keep) last_ack[channel] = data->_current_send_number; } num ++; unpack(data, msgin); // read next packet next = msgin->get_bool(); DBG_PRINT("next:" + itos(next)); } } clear_old_block(data); } void ActionFactory::clear_old_block(NetworkData * data) { int i; i = data->_block.size(); while(i>0) { i--; Variant value = data->_block_used.get_value_at_index(i); Variant key = data->_block_used.get_key_at_index(i); int used = data->_block_used[key]; if ( used >= 2 ) { used --; data->_block_used[key] = used; } else if ( used > 0 ) { data->_block_used.erase(key); data->_block.erase(key); DBG_PRINT("Remove block - key:" + String(key)); } } } void ActionFactory::clear_all_block(NetworkData * data) { int i; DBG_PRINT("Remove all block"); i = data->_block.size(); while(i>0) { i--; Variant key = data->_block_used.get_key_at_index(i); data->_block_used.erase(key); data->_block.erase(key); DBG_PRINT("Remove block: key:" + String(key)); } }