예제 #1
0
	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);
		}
	}
	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);
		}
	}
예제 #3
0
	World::World(uint8_t id, InPacket& recv)
	{
		wid = id;
		name = recv.readascii();
		flag = recv.readbyte();
		message = recv.readascii();
		recv.readbyte();
		recv.readbyte();
		recv.readbyte();
		recv.readbyte();
		recv.readbyte();
		channelcount = recv.readbyte();
		for (uint8_t i = 0; i < channelcount; i++)
		{
			recv.readascii();
			recv.readint();
			chloads.push_back(recv.readbyte());
			recv.readshort();
		}
	}
예제 #4
0
	void SkillMacrosHandler::handle(InPacket& recv) const
	{
		uint8_t size = recv.readbyte();
		for (uint8_t i = 0; i < size; i++)
		{
			recv.readascii(); // name
			recv.readbyte(); // 'shout' byte
			recv.readint(); // skill 1
			recv.readint(); // skill 2
			recv.readint(); // skill 3
		}
	}
예제 #5
0
	Account::Account(InPacket& recv)
	{
		recv.readshort();
		accid = recv.readint();
		female = recv.readbool();
		recv.readbool(); //is admin
		gmlevel = recv.readbyte();
		recv.readbyte();
		name = recv.readascii();
		recv.readbyte();
		muted = recv.readbool();
		recv.readlong(); //muted until
		recv.readlong(); //creation date
		recv.readint();
		pin = recv.readshort();
		selected = 0;
	}
예제 #6
0
	void Login::parseaccount(InPacket& recv)
	{
		recv.readshort();
		account.accid = recv.readint();
		account.female = recv.readbool();
		recv.readbool(); //is admin
		account.gmlevel = recv.readbyte();
		recv.readbyte();
		account.name = recv.readascii();
		recv.readbyte();
		account.muted = recv.readbool();
		recv.readlong(); //muted until
		recv.readlong(); //creation date
		recv.readint();
		account.pin = recv.readshort();
		account.selected = 0;
	}
	void SpawnCharHandler::handle(InPacket& recv) const
	{
		int32_t cid = recv.readint();
		uint8_t level = recv.readbyte();
		string name = recv.readascii();

		recv.readascii(); // guildname
		recv.readshort(); // guildlogobg
		recv.readbyte(); // guildlogobgcolor
		recv.readshort(); // guildlogo
		recv.readbyte(); // guildlogocolor

		recv.skip(8);

		bool morphed = recv.readint() == 2;
		int32_t buffmask1 = recv.readint();
		int16_t buffvalue = 0;
		if (buffmask1 != 0)
		{
			buffvalue = morphed ? recv.readshort() : recv.readbyte();
		}
		recv.readint(); // buffmask 2

		recv.skip(43);

		recv.readint(); // 'mount'

		recv.skip(61);

		int16_t job = recv.readshort();
		LookEntry look = Session::get().getlogin().parselook(recv);

		recv.readint(); //count of 5110000 
		recv.readint(); // 'itemeffect'
		recv.readint(); // 'chair'

		Point<int16_t> position = recv.readpoint();
		int8_t stance = recv.readbyte();

		recv.skip(3);

		for (size_t i = 0; i < 3; i++)
		{
			int8_t available = recv.readbyte();
			if (available == 1)
			{
				recv.readbyte(); // 'byte2'
				recv.readint(); // petid
				recv.readascii(); // name
				recv.readint(); // unique id
				recv.readint();
				recv.readpoint(); // pos
				recv.readbyte(); // stance
				recv.readint(); // fhid
			}
			else
			{
				break;
			}
		}

		recv.readint(); // mountlevel
		recv.readint(); // mountexp
		recv.readint(); // mounttiredness

		//shop stuff, TO DO
		recv.readbyte();
		//shop stuff end

		bool chalkboard = recv.readbool();
		string chalktext = chalkboard ? recv.readascii() : "";

		recv.skip(3);
		recv.readbyte(); // team

		Stage::get().getchars().addchar(cid, look, level, job, name, stance, position);
	}