void Prop_Setter::serialize(Block_Buffer & w) const { w.write_int32(prop_type); w.write_int32(addi_type); w.write_uint8(operate); w.write_double(basic); w.write_double(fixed); w.write_double(percent); }
void Msg_Struct::build_buffer_arg(const Field_Info &field_info, Block_Buffer &buffer, Isolate* isolate, v8::Local<v8::Value> value) { if(field_info.field_type == "int8") { int8_t val = 0; if (value->IsInt32()) { val = value->Int32Value(isolate->GetCurrentContext()).FromJust(); } buffer.write_int8(val); } else if(field_info.field_type == "int16") { int16_t val = 0; if (value->IsInt32()) { val = value->Int32Value(isolate->GetCurrentContext()).FromJust(); } buffer.write_int16(val); } else if(field_info.field_type == "int32") { int32_t val = 0; if (value->IsInt32()) { val = value->Int32Value(isolate->GetCurrentContext()).FromJust(); } buffer.write_int32(val); } else if(field_info.field_type == "int64") { int64_t val = 0; if (value->IsNumber()) { val = value->NumberValue(isolate->GetCurrentContext()).FromJust(); } buffer.write_int64(val); } else if(field_info.field_type == "double") { double val = 0; if (value->IsNumber()) { val = value->NumberValue(isolate->GetCurrentContext()).FromJust(); } buffer.write_double(val); } else if(field_info.field_type == "bool") { bool val = 0; if (value->IsBoolean()) { val = value->BooleanValue(isolate->GetCurrentContext()).FromJust(); } buffer.write_bool(val); } else if(field_info.field_type == "string") { std::string val = ""; if (value->IsString()) { String::Utf8Value str(value->ToString(isolate->GetCurrentContext()).ToLocalChecked()); std::stringstream stream; stream << ToCString(str); val = stream.str(); } buffer.write_string(val); } else { LOG_ERROR("Can not find the field_type:%s, struct_name:%s", field_info.field_type.c_str(), struct_name().c_str()); } }
// for db save -- void Expedition_Scene_Demage_Rank_Data::serialize(Block_Buffer &w) const { w.write_string(role_name); w.write_int64(role_id); w.write_int64(gang_id); w.write_string(gang_name); w.write_int64(uuid); w.write_string(server_name); w.write_int32(force); w.write_int32(level); w.write_double(demage); }
void Hero_Info_Detail::serialize(Block_Buffer &w) const { w.write_int32(hero_id); w.write_int32(hero_index); w.write_int32(hero_facade_id); w.write_string(hero_name); w.write_int8(is_outer); w.write_int8(is_fighter); w.write_int32(level); w.write_int32(formation); w.write_int32(awake_lvl); w.write_double(exp); uint16_t __prop_value_vec_size = prop_value.size(); w.write_uint16(__prop_value_vec_size); for(uint16_t i = 0; i < __prop_value_vec_size; ++i) { prop_value[i].serialize(w); } w.write_uint16(artifacts.size()); for (Artifact_Map::const_iterator it = artifacts.begin(); it != artifacts.end(); ++it) { it->second.serialize(w); } hero_fighter_detail.serialize(w); }
int Fighter_Detail::serialize(Block_Buffer &buffer) const { buffer.write_int64(role_id); power.serialize(buffer); agility.serialize(buffer); dexterity.serialize(buffer); armor.serialize(buffer); stamina.serialize(buffer); physical_attack.serialize(buffer); spell_attack.serialize(buffer); physical_defense.serialize(buffer); spell_defense.serialize(buffer); hit_rate.serialize(buffer); avoid.serialize(buffer); ignore_def.serialize(buffer); blood_max.serialize(buffer); cure.serialize(buffer); cure_rate.serialize(buffer); sing_rate.serialize(buffer); crit.serialize(buffer); crit_def.serialize(buffer); init_morale.serialize(buffer); morale_caps.serialize(buffer); crit_hurt.serialize(buffer); crit_hurt_sub.serialize(buffer); hit_rate_addition.serialize(buffer); avoid_rate_addition.serialize(buffer); crit_rate_addition.serialize(buffer); crit_def_rate_addition.serialize(buffer); speed.serialize(buffer); blood_current.serialize(buffer); morale_current.serialize(buffer); strength_current.serialize(buffer); strength_max.serialize(buffer); blood_pool_current.serialize(buffer); blood_pool_max.serialize(buffer); ignore_def_rate.serialize(buffer); status_hit_rate.serialize(buffer); status_def_rate.serialize(buffer); blood_steal.serialize(buffer); phy_hurt_fix.serialize(buffer); phy_hurt_rate.serialize(buffer); spell_hurt_fix.serialize(buffer); spell_hurt_rate.serialize(buffer); hurt_fix.serialize(buffer); hurt_rate.serialize(buffer); be_hurt_fix.serialize(buffer); be_hurt_rate.serialize(buffer); pk_hurt_add.serialize(buffer); pk_hurt_sub.serialize(buffer); phy_hurt_rate_sub.serialize(buffer); spell_hurt_rate_sub.serialize(buffer); skill_hurt_rate.serialize(buffer); human_add.serialize(buffer); elf_add.serialize(buffer); orc_add.serialize(buffer); dragon_add.serialize(buffer); undead_add.serialize(buffer); demon_add.serialize(buffer); human_sub.serialize(buffer); elf_sub.serialize(buffer); orc_sub.serialize(buffer); dragon_sub.serialize(buffer); undead_sub.serialize(buffer); demon_sub.serialize(buffer); summon_add.serialize(buffer); summon_sub.serialize(buffer); be_cure_rate.serialize(buffer); effect_rate.serialize(buffer); pve_hurt_add.serialize(buffer); pve_hurt_sub.serialize(buffer); dizz_strengthen.serialize(buffer); dizz_weaken.serialize(buffer); buffer.write_int32(phy_power_recover_time); buffer.write_int32(phy_power_buy_times); buffer.write_int32(level); buffer.write_double(experience); buffer.write_double(elite_btl_morale); buffer.write_int32(force); buffer.write_int32(highest_force); buffer.write_int32(ttl_force); buffer.write_int32(ttl_skill_points_); buffer.write_int32(default_skill); buffer.write_int32(cur_used_talent_); buffer.write_int32(reset_skill_times); buffer.write_uint16(talent_map.size()); for (Talent_Map::const_iterator it = talent_map.begin(); it != talent_map.end(); ++it) { it->second.serialize(buffer); } buffer.write_uint16(extra_skill_vec.size()); for (Skill_DB_Info_Vec::const_iterator it = extra_skill_vec.begin(); it != extra_skill_vec.end(); ++it) { it->serialize(buffer); } buffer.write_bool(is_clear_moral_); return 0; }
void Prop_Base::serialize(Block_Buffer & w) const { w.write_double(basic_value); w.write_double(fixed_value); w.write_double(percent_value); }