当前位置: 首页>>代码示例>>C++>>正文


C++ InPacket::skip方法代码示例

本文整理汇总了C++中InPacket::skip方法的典型用法代码示例。如果您正苦于以下问题:C++ InPacket::skip方法的具体用法?C++ InPacket::skip怎么用?C++ InPacket::skip使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在InPacket的用法示例。


在下文中一共展示了InPacket::skip方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: handle

	void SpawnPetHandler::handle(InPacket& recv) const
	{
		using Character::Char;
		Optional<Char> character = Stage::get().getcharacter(recv.readint());
		if (!character)
			return;

		uint8_t petindex = recv.readbyte();
		int8_t mode = recv.readbyte();

		if (mode == 1)
		{
			recv.skip(1);

			int32_t itemid = recv.readint();
			string name = recv.readascii();
			int32_t uniqueid = recv.readint();

			recv.skip(4);

			Point<int16_t> pos = recv.readpoint();
			uint8_t stance = recv.readbyte();
			int32_t fhid = recv.readint();

			character->addpet(petindex, itemid, name, uniqueid, pos, stance, fhid);
		}
		else if (mode == 0)
		{
			bool hunger = recv.readbool();

			character->removepet(petindex, hunger);
		}
	}
开发者ID:thisIsTooHard,项目名称:JourneyClient,代码行数:33,代码来源:MapObjectHandlers.cpp

示例2: parse_world

	World LoginParser::parse_world(InPacket& recv)
	{
		int8_t wid = recv.read_byte();
		if (wid == -1)
			return{ {}, {}, {}, 0, 0, wid };

		std::string name = recv.read_string();
		uint8_t flag = recv.read_byte();
		std::string message = recv.read_string();

		recv.skip(5);

		std::vector<int32_t> chloads;
		uint8_t channelcount = recv.read_byte();
		for (uint8_t i = 0; i < channelcount; ++i)
		{
			recv.read_string(); // channel name
			chloads.push_back(recv.read_int());
			recv.skip(1);
			recv.skip(2);
		}

		recv.skip(2);

		return{ name, message, chloads, channelcount, flag, wid };
	}
开发者ID:Ordywee,项目名称:JourneyClient,代码行数:26,代码来源:LoginParser.cpp

示例3: parseworlds

	void Login::parseworlds(InPacket& recv)
	{
		int8_t worldid = recv.readbyte();
		if (worldid != -1)
		{
			World world;
			world.wid = worldid;
			world.name = recv.readascii();
			world.flag = recv.readbyte();
			world.message = recv.readascii();

			recv.skip(5);

			world.channelcount = recv.readbyte();
			for (uint8_t i = 0; i < world.channelcount; i++)
			{
				recv.readascii();
				recv.skip(4);
				world.chloads.push_back(recv.readbyte());
				recv.skip(2);
			}

			worlds.push_back(world);
		}
	}
开发者ID:eaxvac,项目名称:JourneyClient,代码行数:25,代码来源:Login.cpp

示例4: handle

	void ServerIPHandler::handle(InPacket& recv) const
	{
		recv.skip(2);

		// Read the ipv4 adress in a string.
		std::string addrstr;
		for (int i = 0; i < 4; i++)
		{
			uint8_t num = static_cast<uint8_t>(recv.read_byte());
			addrstr.append(std::to_string(num));
			if (i < 3)
			{
				addrstr.push_back('.');
			}
		}

		// Read the port adress in a string.
		std::string portstr = std::to_string(recv.read_short());

		int32_t cid = recv.read_int();

		// Attempt to reconnect to the server and if successfull, login to the game.
		Session::get().reconnect(addrstr.c_str(), portstr.c_str());
		PlayerLoginPacket(cid).dispatch();
	}
开发者ID:snopboy,项目名称:JourneyClient,代码行数:25,代码来源:LoginHandlers.cpp

示例5: set_field

	void SetfieldHandler::set_field(InPacket& recv) const
	{
		recv.skip(23);

		int32_t cid = recv.read_int();

		const CharEntry& playerentry = Session::get().getlogin().getcharbyid(cid);
		if (playerentry.cid != cid)
		{
			Console::get().print("Nonexisting cid: " + std::to_string(cid));
		}

		Stage::get().loadplayer(playerentry);

		Session::get().getlogin().parsestats(recv);

		Player& player = Stage::get().getplayer();

		recv.read_byte(); // 'buddycap'
		if (recv.read_bool())
		{
			recv.read_string(); // 'linkedname'
		}

		parse_inventory(recv, player.getinvent());
		parse_skillbook(recv, player.getskills());
		parse_questlog(recv, player.getquests());
		parseminigame(recv);
		parsering1(recv);
		parsering2(recv);
		parsering3(recv);
		parsetelerock(recv, player.gettrock());
		parsemonsterbook(recv, player.getmonsterbook());
		parsenewyear(recv);
		parseareainfo(recv);

		recv.skip(10);

		player.recalcstats(true);

		stagetransition(player.getstats().getportal(), player.getstats().getmapid());

		Sound(Sound::GAMESTART).play();

		UI::get().changestate(UI::GAME);
	}
开发者ID:snopboy,项目名称:JourneyClient,代码行数:46,代码来源:SetfieldHandlers.cpp

示例6: handle

	void AttackHandler::handle(InPacket& recv) const
	{
		int32_t cid = recv.readint();
		uint8_t count = recv.readbyte();

		recv.skip(1);

		using Gameplay::AttackResult;
		AttackResult attack;
		attack.type = type;

		attack.level = recv.readbyte();
		attack.skill = (attack.level > 0) ? recv.readint() : 0;

		attack.display = recv.readbyte();
		attack.toleft = recv.readbool();
		attack.stance = recv.readbyte();
		attack.speed = recv.readbyte();

		recv.skip(1);

		attack.bullet = recv.readint();

		attack.mobcount = (count >> 4) & 0xF;
		attack.hitcount = count & 0xF;
		for (uint8_t i = 0; i < attack.mobcount; i++)
		{
			int32_t oid = recv.readint();

			recv.skip(1);

			using Gameplay::Skill;
			uint8_t length = (attack.skill == Skill::MESO_EXPLOSION) ? recv.readbyte() : attack.hitcount;
			for (uint8_t j = 0; j < length; j++)
			{
				int32_t damage = recv.readint();
				bool critical = false; // todo
				auto singledamage = std::make_pair(damage, critical);
				attack.damagelines[oid].push_back(singledamage);
			}
		}

		using Gameplay::Stage;
		Stage::get().showattack(cid, attack);
	}
开发者ID:am910021,项目名称:JourneyClient,代码行数:45,代码来源:AttackHandlers.cpp

示例7: change_map

	void SetfieldHandler::change_map(InPacket& recv, int32_t) const
	{
		recv.skip(3);

		int32_t mapid = recv.read_int();
		int8_t portalid = recv.read_byte();

		stagetransition(portalid, mapid);
	}
开发者ID:snopboy,项目名称:JourneyClient,代码行数:9,代码来源:SetfieldHandlers.cpp

示例8: parse_account

	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;
	}
开发者ID:Ordywee,项目名称:JourneyClient,代码行数:20,代码来源:LoginParser.cpp

示例9: handle

	void UpdateskillsHandler::handle(InPacket& recv) const
	{
		recv.skip(3);

		int32_t skillid = recv.readint();
		int32_t level = recv.readint();
		int32_t masterlevel = recv.readint();
		int64_t expire = recv.readlong();

		Stage::get().getplayer().getskills().setskill(skillid, level, masterlevel, expire);
	}
开发者ID:eaxvac,项目名称:JourneyClient,代码行数:11,代码来源:PlayerHandlers.cpp

示例10: parse_inventory

	void SetfieldHandler::parse_inventory(InPacket& recv, Inventory& invent) const
	{
		invent.setmeso(recv.read_int());
		invent.setslots(Inventory::EQUIP, recv.read_byte());
		invent.setslots(Inventory::USE, recv.read_byte());
		invent.setslots(Inventory::SETUP, recv.read_byte());
		invent.setslots(Inventory::ETC, recv.read_byte());
		invent.setslots(Inventory::CASH, recv.read_byte());

		recv.skip(8);

		for (size_t i = 0; i < 3; i++)
		{
			Inventory::Type inv = (i == 0) ? Inventory::EQUIPPED : Inventory::EQUIP;
			int16_t pos = recv.read_short();
			while (pos != 0)
			{
				int16_t slot = (i == 1) ? -pos : pos;
				ItemParser::parseitem(recv, inv, slot, invent);
				pos = recv.read_short();
			}
		}

		recv.skip(2);

		Inventory::Type toparse[4] =
		{
			Inventory::USE, Inventory::SETUP, Inventory::ETC, Inventory::CASH
		};

		for (size_t i = 0; i < 4; i++)
		{
			Inventory::Type inv = toparse[i];
			int8_t pos = recv.read_byte();
			while (pos != 0)
			{
				ItemParser::parseitem(recv, inv, pos, invent);
				pos = recv.read_byte();
			}
		}
	}
开发者ID:snopboy,项目名称:JourneyClient,代码行数:41,代码来源:SetfieldHandlers.cpp

示例11: parsestats

	StatsEntry Login::parsestats(InPacket& recv) const
	{
		StatsEntry statsentry;

		statsentry.name = recv.readpadascii(13);

		recv.readbool(); //gender
		recv.readbyte(); //skin
		recv.readint(); //face
		recv.readint(); //hair

		for (size_t i = 0; i < 3; i++)
		{
			statsentry.petids.push_back(recv.readlong());
		}

		statsentry.stats[Maplestat::LEVEL] = recv.readbyte();
		statsentry.stats[Maplestat::JOB] = recv.readshort();
		statsentry.stats[Maplestat::STR] = recv.readshort();
		statsentry.stats[Maplestat::DEX] = recv.readshort();
		statsentry.stats[Maplestat::INT] = recv.readshort();
		statsentry.stats[Maplestat::LUK] = recv.readshort();
		statsentry.stats[Maplestat::HP] = recv.readshort();
		statsentry.stats[Maplestat::MAXHP] = recv.readshort();
		statsentry.stats[Maplestat::MP] = recv.readshort();
		statsentry.stats[Maplestat::MAXMP] = recv.readshort();
		statsentry.stats[Maplestat::AP] = recv.readshort();
		statsentry.stats[Maplestat::SP] = recv.readshort();
		statsentry.exp = recv.readint();
		statsentry.stats[Maplestat::FAME] = recv.readshort();

		recv.skip(4); //gachaexp
		statsentry.mapid = recv.readint();
		statsentry.portal = recv.readbyte();
		recv.skip(4); //timestamp

		statsentry.job = CharJob(statsentry.stats[Maplestat::JOB]);

		return statsentry;
	}
开发者ID:eaxvac,项目名称:JourneyClient,代码行数:40,代码来源:Login.cpp

示例12: parse_stats

	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;
	}
开发者ID:Ordywee,项目名称:JourneyClient,代码行数:38,代码来源:LoginParser.cpp

示例13: parsemonsterbook

	void SetfieldHandler::parsemonsterbook(InPacket& recv, Monsterbook& monsterbook) const
	{
		monsterbook.setcover(recv.read_int());

		recv.skip(1);

		int16_t size = recv.read_short();
		for (int16_t i = 0; i < size; i++)
		{
			int16_t cid = recv.read_short();
			int8_t mblv = recv.read_byte();

			monsterbook.addcard(cid, mblv);
		}
	}
开发者ID:snopboy,项目名称:JourneyClient,代码行数:15,代码来源:SetfieldHandlers.cpp

示例14: handle

	void CharlistHandler::handle(InPacket& recv) const
	{
		recv.skip(1);

		// Parse all characters.
		Session::get().getlogin().parsecharlist(recv);

		// Remove the world selection screen.
		UI::get().remove(UIElement::WORLDSELECT);

		// Add the character selection screen.
		UI::get().add(ElementCharSelect());

		UI::get().enable();
	}
开发者ID:am910021,项目名称:JourneyClient,代码行数:15,代码来源:LoginHandlers.cpp

示例15: handle

	void AddNewCharEntryHandler::handle(InPacket& recv) const
	{
		recv.skip(1);

		// Parse info on the new character.
		CharEntry character = LoginParser::parse_charentry(recv);

		// Remove the character creation ui.
		UI::get().remove(UIElement::CHARCREATION);

		// Readd the updated character selection.
		if (auto charselect = UI::get().get_element<UICharSelect>())
		{
			charselect->add_character(std::move(character));
			charselect->makeactive();
		}

		UI::get().enable();
	}
开发者ID:Ordywee,项目名称:JourneyClient,代码行数:19,代码来源:LoginHandlers.cpp


注:本文中的InPacket::skip方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。