Пример #1
0
CAlliance::CAlliance(CBattleEntity* PEntity) 
{
	DSP_DEBUG_BREAK_IF(PEntity->PParty == NULL);

    m_AllianceID   = PEntity->PParty->GetPartyID();

	//will need to deal with these
	//m_PSyncTarget 	= NULL;
//	m_PQuaterMaster = NULL;


	addParty(PEntity->PParty);
	this->aLeader = PEntity->PParty;

}
Пример #2
0
void SyncPacket::PartyPacket::updateParty(uint16_t channel, int8_t type, int32_t playerid, int32_t target) {
	Player *partyplayer = PlayerDataProvider::Instance()->getPlayer(playerid);
	PacketCreator packet;
	packet.add<int16_t>(IMSG_FORWARD_TO);
	packet.add<int32_t>(playerid);
	packet.addHeader(SMSG_PARTY);
	switch (type) {
		case PartyActions::Join: 
			packet.add<int8_t>(0x0F);
			packet.add<int32_t>(partyplayer->getParty()->getId());
			packet.addString(PlayerDataProvider::Instance()->getPlayer(target)->getName());
			break;
		case PartyActions::Leave:
		case PartyActions::Expel:
			packet.add<int8_t>(0x0C);
			packet.add<int32_t>(partyplayer->getParty()->getId());
			packet.add<int32_t>(target);
			packet.add<int8_t>(0x01);
			packet.add<int8_t>(type == PartyActions::Leave ? 0x00 : 0x01);
			packet.addString(PlayerDataProvider::Instance()->getPlayer(target, true)->getName());
			break;
		case PartyActions::SilentUpdate:
		case PartyActions::LogInOrOut:
			packet.add<int8_t>(0x07);
			packet.add<int32_t>(partyplayer->getParty()->getId());
	}
	addParty(packet, partyplayer->getParty(), PlayerDataProvider::Instance()->getPlayer(playerid)->getChannel());
	Channels::Instance()->sendToChannel(channel, packet);

	if (type == PartyActions::SilentUpdate)
		return;

	target = target == 0 ? playerid : target;

	packet = PacketCreator();
	packet.add<int16_t>(IMSG_SYNC);
	packet.add<int8_t>(Sync::SyncTypes::Party);
	packet.add<int8_t>(type);
	packet.add<int32_t>(target);
	packet.add<int32_t>(PlayerDataProvider::Instance()->getPlayer(target, true)->getParty()->getId());
	Channels::Instance()->sendToChannel(channel, packet);
}