void SytProgress::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (leftsize == 0) throw EncodeError(); *p = level; ++buffersize; ++p; --leftsize; if (leftsize == 0) throw EncodeError(); *p = pve_index; ++buffersize; ++p; --leftsize; if (leftsize == 0) throw EncodeError(); *p = ev_index; ++buffersize; ++p; --leftsize; }
void SytJAL_SKILL::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (4 > leftsize) throw EncodeError(); CProto::h2n_32(p, skill_id); buffersize += 4; p += 4; leftsize -= 4; if (4 > leftsize) throw EncodeError(); CProto::h2n_32(p, con_idx); buffersize += 4; p += 4; leftsize -= 4; if (4 > leftsize) throw EncodeError(); CProto::h2n_32(p, count); buffersize += 4; p += 4; leftsize -= 4; }
void SytJAL_GENERAL_AWARD::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (2 > leftsize) throw EncodeError(); CProto::h2n_16(p, index); buffersize += 2; p += 2; leftsize -= 2; arraysize = leftsize; levelup_info.Encode(p, arraysize); buffersize += arraysize; p += arraysize; leftsize -= arraysize; if (2 > leftsize) throw EncodeError(); CProto::h2n_16(p, assist_index); buffersize += 2; p += 2; leftsize -= 2; arraysize = leftsize; assist_levelup_info.Encode(p, arraysize); buffersize += arraysize; p += arraysize; leftsize -= arraysize; }
void stArtifice::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (2 > leftsize) throw EncodeError(); CProto::h2n_16(p, general_id); buffersize += 2; p += 2; leftsize -= 2; if (leftsize == 0) throw EncodeError(); *p = is_soul; ++buffersize; ++p; --leftsize; if (is_soul == 1) { if (2 > leftsize) throw EncodeError(); CProto::h2n_16(p, soul_num); buffersize += 2; p += 2; leftsize -= 2; } }
/* body */ void XJCMD_CSC_USERINFO_SYNCS::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (leftsize == 0) throw EncodeError(); *p = user_version; ++buffersize; ++p; --leftsize; if (4 > leftsize) throw EncodeError(); CProto::h2n_32(p, user_db_res_version); buffersize += 4; p += 4; leftsize -= 4; if (4 > leftsize) throw EncodeError(); CProto::h2n_32(p, user_res_version); buffersize += 4; p += 4; leftsize -= 4; }
void ProtoBattleFightInfo::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (1 > leftsize) throw EncodeError(); *p = battle_array_id.size(); ++buffersize; ++p; --leftsize; if (4 * battle_array_id.size() > leftsize) throw EncodeError(); for (unsigned int i=0; i< battle_array_id.size(); ++i) { CProto::h2n_32(p, battle_array_id[i]); buffersize += 4; p += 4; leftsize -= 4; } if (leftsize == 0) throw EncodeError(); *p = super_element; ++buffersize; ++p; --leftsize; }
void XJCMD_LEVEL_NEXTSC::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (2 > leftsize) throw EncodeError(); CProto::h2n_16(p, retcode); buffersize += 2; p += 2; leftsize -= 2; if (retcode == SYT_GOOD) { arraysize = leftsize; ev_seq.Encode(p, arraysize); buffersize += arraysize; p += arraysize; leftsize -= arraysize; } if (retcode == SYT_GOOD) { if (leftsize == 0) throw EncodeError(); *p = firsttime; ++buffersize; ++p; --leftsize; } }
void SytEvSeq::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (leftsize == 0) throw EncodeError(); *p = level; ++buffersize; ++p; --leftsize; if (1 > leftsize) throw EncodeError(); *p = seq_arraylen; ++buffersize; ++p; --leftsize; for (unsigned int i=0; i<seq_arraylen; ++i) { arraysize = leftsize; seq[i].Encode(p, arraysize); buffersize += arraysize; p += arraysize; leftsize -= arraysize; } }
void XJCMD_QUERY_PROGRESSSC::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (leftsize == 0) throw EncodeError(); *p = firsttime; ++buffersize; ++p; --leftsize; if (leftsize == 0) throw EncodeError(); *p = levels_can_jump; ++buffersize; ++p; --leftsize; if (leftsize == 0) throw EncodeError(); *p = play_times; ++buffersize; ++p; --leftsize; if (leftsize == 0) throw EncodeError(); *p = max_play_times; ++buffersize; ++p; --leftsize; if (leftsize == 0) throw EncodeError(); *p = have_progress; ++buffersize; ++p; --leftsize; if (have_progress == 1) { arraysize = leftsize; progress.Encode(p, arraysize); buffersize += arraysize; p += arraysize; leftsize -= arraysize; } }
void XJCMD_LEVEL_STARTSC::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (2 > leftsize) throw EncodeError(); CProto::h2n_16(p, retcode); buffersize += 2; p += 2; leftsize -= 2; if (leftsize == 0) throw EncodeError(); *p = jump_levels; ++buffersize; ++p; --leftsize; if (retcode == SYT_GOOD) { arraysize = leftsize; ev_seq.Encode(p, arraysize); buffersize += arraysize; p += arraysize; leftsize -= arraysize; } if (jump_levels > 0 && (retcode == SYT_GOOD || retcode == SYT_ALL_LEVEL_FINISHED)) { arraysize = leftsize; jump_award_list.Encode(p, arraysize); buffersize += arraysize; p += arraysize; leftsize -= arraysize; } if (retcode == SYT_GOOD) { if (leftsize == 0) throw EncodeError(); *p = firsttime; ++buffersize; ++p; --leftsize; } }
void ProtoBattleImpacter::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (leftsize == 0) throw EncodeError(); *p = op_type; ++buffersize; ++p; --leftsize; if (1 > leftsize) throw EncodeError(); *p = impact_id.size(); ++buffersize; ++p; --leftsize; if (4 * impact_id.size() > leftsize) throw EncodeError(); for (unsigned int i=0; i< impact_id.size(); ++i) { CProto::h2n_32(p, impact_id[i]); buffersize += 4; p += 4; leftsize -= 4; } if (leftsize == 0) throw EncodeError(); *p = pos; ++buffersize; ++p; --leftsize; arraysize = leftsize; obj_data.Encode(p, arraysize); buffersize += arraysize; p += arraysize; leftsize -= arraysize; }
void ProtoBattleImpactObj::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (4 > leftsize) throw EncodeError(); CProto::h2n_32(p, max_hp); buffersize += 4; p += 4; leftsize -= 4; if (4 > leftsize) throw EncodeError(); CProto::h2n_32(p, diff_hp); buffersize += 4; p += 4; leftsize -= 4; if (1 > leftsize) throw EncodeError(); *p = fight_state.size(); ++buffersize; ++p; --leftsize; if (leftsize < fight_state.size()) throw EncodeError(); memcpy(p,&fight_state[0], fight_state.size()); buffersize += fight_state.size(); p += fight_state.size(); leftsize-= fight_state.size(); if (leftsize == 0) throw EncodeError(); *p = assist_value; ++buffersize; ++p; --leftsize; }
void SytEvent::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (2 > leftsize) throw EncodeError(); CProto::h2n_16(p, tag); buffersize += 2; p += 2; leftsize -= 2; if (tag == SytEvPveBoss || tag == SytEvPve) { arraysize = leftsize; pve.Encode(p, arraysize); buffersize += arraysize; p += arraysize; leftsize -= arraysize; } if (tag == SytEvPvp) { arraysize = leftsize; pvp.Encode(p, arraysize); buffersize += arraysize; p += arraysize; leftsize -= arraysize; } if (tag == SytEvTreasureChest) { arraysize = leftsize; treasure_chest.Encode(p, arraysize); buffersize += arraysize; p += arraysize; leftsize -= arraysize; } if (tag == SytEvAdvanture) { arraysize = leftsize; adv_data.Encode(p, arraysize); buffersize += arraysize; p += arraysize; leftsize -= arraysize; } if (tag == SytEvRandAward) { arraysize = leftsize; rand_award_data.Encode(p, arraysize); buffersize += arraysize; p += arraysize; leftsize -= arraysize; } }
void ProtoBattleJointAttackData::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (1 > leftsize) throw EncodeError(); *p = joint_pos.size(); ++buffersize; ++p; --leftsize; if (leftsize < joint_pos.size()) throw EncodeError(); memcpy(p,&joint_pos[0], joint_pos.size()); buffersize += joint_pos.size(); p += joint_pos.size(); leftsize-= joint_pos.size(); if (1 > leftsize) throw EncodeError(); *p = fly_pos.size(); ++buffersize; ++p; --leftsize; if (leftsize < fly_pos.size()) throw EncodeError(); memcpy(p,&fly_pos[0], fly_pos.size()); buffersize += fly_pos.size(); p += fly_pos.size(); leftsize-= fly_pos.size(); if (1 > leftsize) throw EncodeError(); *p = joint_rate.size(); ++buffersize; ++p; --leftsize; if (leftsize < joint_rate.size()) throw EncodeError(); memcpy(p,&joint_rate[0], joint_rate.size()); buffersize += joint_rate.size(); p += joint_rate.size(); leftsize-= joint_rate.size(); if (4 > leftsize) throw EncodeError(); CProto::h2n_32(p, score); buffersize += 4; p += 4; leftsize -= 4; }
void ProtoBattleFightNode::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (leftsize == 0) throw EncodeError(); *p = type; ++buffersize; ++p; --leftsize; if (2 > leftsize) throw EncodeError(); CProto::h2n_16(p, index); buffersize += 2; p += 2; leftsize -= 2; }
void ProtoBattleAttackOrderInfo::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (1 > leftsize) throw EncodeError(); *p = attack_order.size(); ++buffersize; ++p; --leftsize; if (leftsize < attack_order.size()) throw EncodeError(); memcpy(p,&attack_order[0], attack_order.size()); buffersize += attack_order.size(); p += attack_order.size(); leftsize-= attack_order.size(); }
void SytEvPveData::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (4 > leftsize) throw EncodeError(); CProto::h2n_32(p, stage_id); buffersize += 4; p += 4; leftsize -= 4; if (4 > leftsize) throw EncodeError(); CProto::h2n_32(p, dialog_id); buffersize += 4; p += 4; leftsize -= 4; }
void SytEvRandAwardData::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (4 > leftsize) throw EncodeError(); CProto::h2n_32(p, money); buffersize += 4; p += 4; leftsize -= 4; if (4 > leftsize) throw EncodeError(); CProto::h2n_32(p, exp); buffersize += 4; p += 4; leftsize -= 4; }
void SytEvTCAwardItem::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (4 > leftsize) throw EncodeError(); CProto::h2n_32(p, item_id); buffersize += 4; p += 4; leftsize -= 4; if (leftsize == 0) throw EncodeError(); *p = count; ++buffersize; ++p; --leftsize; }
void ProtoBattleCampInfo::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (1 > leftsize) throw EncodeError(); *p = user_guid.size(); ++buffersize; ++p; --leftsize; if (8 * user_guid.size() > leftsize) throw EncodeError(); for (unsigned int i=0; i< user_guid.size(); ++i) { CProto::h2n_64(p, user_guid[i]); buffersize += 8; p += 8; leftsize -= 8; } }
inline Bytes encode(const Unicode& object) const { int state; size_t offset = 0; size_t enclen = 0; bytechar* encptr = NULL; size_t declen = object.length(); const unicode* decptr = static_cast<const unicode*>(object); state = u8_encode(decptr, declen, encptr, enclen, offset); if (state != UNICODE_STATE_SUCCESS) throw EncodeError(state, offset, "UTF-8"); return Bytes(encptr, enclen); }
void ProtoBattleGeneralInfo::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (4 > leftsize) throw EncodeError(); CProto::h2n_32(p, id); buffersize += 4; p += 4; leftsize -= 4; if (4 > leftsize) throw EncodeError(); CProto::h2n_32(p, assist_id); buffersize += 4; p += 4; leftsize -= 4; if (leftsize == 0) throw EncodeError(); *p = pos; ++buffersize; ++p; --leftsize; if (4 > leftsize) throw EncodeError(); CProto::h2n_32(p, max_hp); buffersize += 4; p += 4; leftsize -= 4; }
void XJCMD_CSC_ENCHANTMENT_LEVELUPCS::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (leftsize == 0) throw EncodeError(); *p = enchantment_index; ++buffersize; ++p; --leftsize; }
void XJCMD_PROCESS_EVENTSC::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (2 > leftsize) throw EncodeError(); CProto::h2n_16(p, retcode); buffersize += 2; p += 2; leftsize -= 2; }
void XJCMD_PROCESS_EVENTCS::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (1 > leftsize) throw EncodeError(); *p = parameters_arraylen; ++buffersize; ++p; --leftsize; if (4 * MAX_NUM_EV_INT_PARAM > leftsize) throw EncodeError(); for (unsigned int i=0; i<parameters_arraylen; ++i) { CProto::h2n_32(p, parameters[i]); buffersize += 4; p += 4; leftsize -= 4; } }
void XJCMD_CSC_ENCHANTMENT_LEVELUPSC::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (2 > leftsize) throw EncodeError(); CProto::h2n_16(p, retcode); buffersize += 2; p += 2; leftsize -= 2; }
void XJCMD_CSC_CHANGEFACESC::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (2 > leftsize) throw EncodeError(); CProto::h2n_16(p, newfaceid); buffersize += 2; p += 2; leftsize -= 2; }
void XJCMD_LEVEL_STARTCS::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (2 > leftsize) throw EncodeError(); CProto::h2n_16(p, opt); buffersize += 2; p += 2; leftsize -= 2; if (opt == SytStartNew) { if (leftsize == 0) throw EncodeError(); *p = jump_levels; ++buffersize; ++p; --leftsize; } }
void SytEvPvpData::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (leftsize == 0) throw EncodeError(); *p = reserved; ++buffersize; ++p; --leftsize; }
void ProtoBattleTurnInfo::Encode(unsigned char *buffer, unsigned int& buffersize) throw (EncodeError) { unsigned int leftsize; leftsize = buffersize; unsigned char *p; p = buffer; buffersize = 0; if (leftsize == 0) throw EncodeError(); *p = curr_turn; ++buffersize; ++p; --leftsize; }