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


C++ InPacket类代码示例

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


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

示例1: 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

示例2: 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

示例3:

	Ladder::Ladder(InPacket& recv)
	{
		x = recv.readshort();
		y1 = recv.readshort();
		y2 = recv.readshort();
		ladder = recv.readbool();
	}
开发者ID:aadarshasubedi,项目名称:JourneyClient,代码行数:7,代码来源:Mapinfo.cpp

示例4: handle

	void DeleteCharResponseHandler::handle(InPacket& recv) const
	{
		// Read the character id and if deletion was successfull (pic was correct).
		int32_t cid = recv.read_int();
		uint8_t state = recv.read_byte();

		// Extract information from the state byte.
		if (state)
		{
			UILoginNotice::Message message;
			switch (state)
			{
			case 10:
				message = UILoginNotice::BIRTHDAY_INCORRECT;
				break;
			case 20:
				message = UILoginNotice::SECOND_PASSWORD_INCORRECT;
				break;
			default:
				message = UILoginNotice::UNKNOWN_ERROR;
			}

			UI::get().emplace<UILoginNotice>(message);
		}
		else
		{
			if (auto charselect = UI::get().get_element<UICharSelect>())
				charselect->remove_char(cid);
		}

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

示例5: handle

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

示例6: handle

	void KillMobHandler::handle(InPacket& recv) const
	{
		int32_t oid = recv.readint();
		int8_t animation = recv.readbyte();

		Stage::get().getmobs().killmob(oid, animation);
	}
开发者ID:thisIsTooHard,项目名称:JourneyClient,代码行数:7,代码来源:MapObjectHandlers.cpp

示例7: Packet

InPacket::InPacket(const InPacket &rhs)
	: Packet(rhs)
{
	bodyLength = rhs.getLength();
	decryptedBuf = (unsigned char*)malloc(bodyLength * sizeof(unsigned char));
	memcpy(decryptedBuf, rhs.getBody(), bodyLength);
}
开发者ID:evareborn,项目名称:eva-nirvana,代码行数:7,代码来源:evapacket.cpp

示例8: 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

示例9: 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

示例10: if

	Footholdtree::Footholdtree(InPacket& recv)
	{
		int16_t leftw = 30000;
		int16_t rightw = -30000;
		int16_t botb = -30000;
		int16_t topb = 30000;

		uint16_t numbase = recv.readshort();
		for (uint16_t i = 0; i < numbase; i++)
		{
			uint8_t layer = recv.readbyte();
			uint16_t nummid = recv.readshort();
			for (uint16_t j = 0; j < nummid; j++)
			{
				uint16_t numlast = recv.readshort();
				for (uint16_t k = 0; k < numlast; k++)
				{
					Foothold foothold = Foothold(recv, layer);

					if (foothold.getl() < leftw)
					{
						leftw = foothold.getl();
					}
					else if (foothold.getr() > rightw)
					{
						rightw = foothold.getr();
					}

					if (foothold.getb() > botb)
					{
						botb = foothold.getb();
					}
					else if (foothold.gett() < topb)
					{
						topb = foothold.gett();
					}

					uint16_t id = foothold.getid();
					footholds[id] = foothold;

					if (abs(foothold.getslope()) < 0.5)
					{
						int16_t start = foothold.getl();
						int16_t end = foothold.getr();
						for (int16_t i = start; i <= end; i++)
						{
							footholdsbyx.insert(std::make_pair(i, id));
						}
					}
				}
			}
		}

		walls = Range<int16_t>(leftw + 25, rightw - 25);
		borders = Range<int16_t>(topb - 400, botb + 400);
	}
开发者ID:eaxvac,项目名称:JourneyClient,代码行数:56,代码来源:Footholdtree.cpp

示例11: parseareainfo

	void SetfieldHandler::parseareainfo(InPacket& recv) const
	{
		std::map<int16_t, std::string> areainfo;
		int16_t arsize = recv.read_short();
		for (int16_t i = 0; i < arsize; i++)
		{
			int16_t area = recv.read_short();
			areainfo[area] = recv.read_string();
		}
	}
开发者ID:snopboy,项目名称:JourneyClient,代码行数:10,代码来源:SetfieldHandlers.cpp

示例12: parsecharlist

	void Login::parsecharlist(InPacket& recv)
	{
		size_t numchars = recv.readbyte();
		for (size_t i = 0; i < numchars; i++)
		{
			addcharentry(recv);
		}

		account.pic = recv.readbyte();
		account.slots = static_cast<int8_t>(recv.readint());
	}
开发者ID:eaxvac,项目名称:JourneyClient,代码行数:11,代码来源:Login.cpp

示例13: handlebuff

	void ApplyBuffHandler::handlebuff(InPacket& recv, Buffstat::Value bs) const
	{
		int16_t value = recv.readshort();
		int32_t skillid = recv.readint();
		int32_t duration = recv.readint();

		Buff buff = Buff(bs, value, skillid, duration);
		Stage::get().getplayer().givebuff(buff);

		UI::get().withelement(UIElement::BUFFLIST, &UIBuffList::addbuff, skillid, duration);
	}
开发者ID:eaxvac,项目名称:JourneyClient,代码行数:11,代码来源:PlayerHandlers.cpp

示例14: 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

示例15: handlebuff

	void ApplyBuffHandler::handlebuff(InPacket& recv, Buff::Stat bs) const
	{
		int16_t value = recv.read_short();
		int32_t skillid = recv.read_int();
		int32_t duration = recv.read_int();

		Stage::get().getplayer().givebuff({ bs, value, skillid, duration });

		UI::get().with_element<UIBuffList>([&skillid, &duration](auto& bl) {
			bl.add_buff(skillid, duration);
		});
	}
开发者ID:snopboy,项目名称:JourneyClient,代码行数:12,代码来源:PlayerHandlers.cpp


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