public override void Handle(NecClient client, NecPacket packet) { /*int32, unknown. probably party mode. * int32, target client(character) id[i think this is the sends structure]*/ int unknown = packet.data.ReadInt32(); //party mode uint targetInstanceId = packet.data.ReadUInt32(); NecClient targetClient = server.clients.GetByCharacterInstanceId(targetInstanceId); Party party = server.instances.GetInstance(client.character.partyId) as Party; targetClient.character.partyRequest = client.character.instanceId; if (targetInstanceId == 0) { targetInstanceId = client.character.instanceId; } _Logger.Debug($"ID {client.character.instanceId} {client.character.name} sent a party: ${party.instanceId} invite to {targetClient.character.name} with instance ID {targetInstanceId}"); //acknowledge the send, tell it the recv logic is complete. IBuffer res = BufferProvider.Provide(); res.WriteInt32(0); //error check router.Send(client, (ushort)AreaPacketId.recv_party_invite_r, res, ServerType.Area); RecvPartyNotifyInvite recvPartyNotifyInvite = new RecvPartyNotifyInvite(client, party); router.Send(recvPartyNotifyInvite, targetClient); }
public override void Handle(NecClient client, NecPacket packet) { /*int32, party type: 1 = open, 0 = closed * int32, normal item distribution: 1 = random, 0 = do not distribute * int32, rare item distribution: 1 = draw, 0 = do not distribute * int32, target client(character) id*/ int partyType = packet.data.ReadInt32(); int normItemDist = packet.data.ReadInt32(); int rareItemDist = packet.data.ReadInt32(); uint targetInstanceId = packet.data.ReadUInt32(); Party myFirstParty = new Party(); server.instances.AssignInstance(myFirstParty); myFirstParty.partyType = partyType; myFirstParty.normalItemDist = normItemDist; myFirstParty.rareItemDist = rareItemDist; myFirstParty.targetClientId = targetInstanceId; myFirstParty.Join(client); myFirstParty.partyLeaderId = client.character.instanceId; client.character.partyId = myFirstParty.instanceId; RecvPartyNotifyEstablish recvPartyNotifyEstablish = new RecvPartyNotifyEstablish(client, myFirstParty); router.Send(recvPartyNotifyEstablish, client); // Only establish the party for the acceptee. everyone else is already established. RecvCharaBodyNotifyPartyJoin recvCharaBodyNotifyPartyJoin = new RecvCharaBodyNotifyPartyJoin(client.character.instanceId, myFirstParty.instanceId, myFirstParty.partyType); router.Send(client.map, recvCharaBodyNotifyPartyJoin); //Only send the Join Notify of the Accepting Client to the Map. Existing members already did that when they joined. RecvCharaNotifyPartyJoin recvCharaNotifyPartyJoin = new RecvCharaNotifyPartyJoin(client.character.instanceId, myFirstParty.instanceId, myFirstParty.partyType); router.Send(recvCharaNotifyPartyJoin, client); //Only send the Join of the Accepting Client to the Accepting Client. if (targetInstanceId != 0) { NecClient targetClient = server.clients.GetByCharacterInstanceId(targetInstanceId); RecvPartyNotifyInvite recvPartyNotifyInvite = new RecvPartyNotifyInvite(targetClient, myFirstParty); router.Send(recvPartyNotifyInvite, targetClient); } IBuffer res = BufferProvider.Provide(); res.WriteInt32(0); router.Send(client, (ushort)AreaPacketId.recv_party_establish_r, res, ServerType.Area); }