void BuffHandler::handle(InPacket& recv) const { int64_t firstmask = recv.read_long(); int64_t secondmask = recv.read_long(); switch (secondmask) { case Buff::BATTLESHIP: handlebuff(recv, Buff::BATTLESHIP); return; } for (Buff::Stat stat : Buff::FIRST_BUFFS) { if (firstmask & stat) { handlebuff(recv, stat); } } for (Buff::Stat stat : Buff::SECOND_BUFFS) { if (secondmask & stat) { handlebuff(recv, stat); } } Stage::get().getplayer().recalcstats(false); }
void SetfieldHandler::parse_questlog(InPacket& recv, Questlog& quests) const { int16_t size = recv.read_short(); for (int16_t i = 0; i < size; i++) { int16_t qid = recv.read_short(); std::string qdata = recv.read_string(); if (quests.is_started(qid)) { int16_t qidl = quests.get_last_started(); quests.add_in_progress(qidl, qid, qdata); i--; } else { quests.add_started(qid, qdata); } } std::map<int16_t, int64_t> completed; size = recv.read_short(); for (int16_t i = 0; i < size; i++) { int16_t qid = recv.read_short(); int64_t time = recv.read_long(); quests.add_completed(qid, time); } }
void UpdateskillsHandler::handle(InPacket& recv) const { recv.skip(3); int32_t skillid = recv.read_int(); int32_t level = recv.read_int(); int32_t masterlevel = recv.read_int(); int64_t expire = recv.read_long(); Stage::get().getplayer().getskills().set_skill(skillid, level, masterlevel, expire); }
Account LoginParser::parse_account(InPacket & recv) { Account account; recv.skip(2); account.accid = recv.read_int(); account.female = recv.read_bool(); recv.read_bool(); //is admin account.gmlevel = recv.read_byte(); recv.skip(1); account.name = recv.read_string(); recv.skip(1); account.muted = recv.read_bool(); recv.read_long(); //muted until recv.read_long(); //creation date recv.skip(4); account.pin = recv.read_short(); return account; }
void SetfieldHandler::parse_skillbook(InPacket& recv, Skillbook& skills) const { int16_t size = recv.read_short(); for (int16_t i = 0; i < size; i++) { int32_t skillid = recv.read_int(); int32_t level = recv.read_int(); int64_t expiration = recv.read_long(); bool fourthtjob = ((skillid % 100000) / 10000 == 2); int32_t masterlevel = fourthtjob ? recv.read_int() : -1; skills.set_skill(skillid, level, masterlevel, expiration); } size = recv.read_short(); for (int16_t i = 0; i < size; i++) { int32_t skillid = recv.read_int(); int32_t cooldown = recv.read_short(); skills.set_cd(skillid, cooldown); } }
StatsEntry LoginParser::parse_stats(InPacket& recv) { StatsEntry statsentry; statsentry.name = recv.read_padded_string(13); recv.read_bool(); //gender recv.read_byte(); //skin recv.read_int(); //face recv.read_int(); //hair for (size_t i = 0; i < 3; i++) { statsentry.petids.push_back(recv.read_long()); } statsentry.stats[Maplestat::LEVEL] = recv.read_byte(); statsentry.stats[Maplestat::JOB] = recv.read_short(); statsentry.stats[Maplestat::STR] = recv.read_short(); statsentry.stats[Maplestat::DEX] = recv.read_short(); statsentry.stats[Maplestat::INT] = recv.read_short(); statsentry.stats[Maplestat::LUK] = recv.read_short(); statsentry.stats[Maplestat::HP] = recv.read_short(); statsentry.stats[Maplestat::MAXHP] = recv.read_short(); statsentry.stats[Maplestat::MP] = recv.read_short(); statsentry.stats[Maplestat::MAXMP] = recv.read_short(); statsentry.stats[Maplestat::AP] = recv.read_short(); statsentry.stats[Maplestat::SP] = recv.read_short(); statsentry.exp = recv.read_int(); statsentry.stats[Maplestat::FAME] = recv.read_short(); recv.skip(4); //gachaexp statsentry.mapid = recv.read_int(); statsentry.portal = recv.read_byte(); recv.skip(4); //timestamp return statsentry; }