public static void GuildWaveoOnResponse(IRealmClient client, int guildid) { using (var packet = new RealmPacketOut(RealmServerOpCode.GuildWaveoOnResponse)) //4401 { Asda2GuildWave guildWave = Asda2GuildWaveMgr.GetGuildWaveForId(guildid); packet.WriteInt16(guildid); //{GuildId}default value : 3 Len : 2 if (guildWave != null) { packet.WriteByte((byte)GuildWaveOnSRS.Show); //{GuildWaveOnSRS} packet.WriteByte(guildWave.Difficulty); //{GuildWaveOnDifficulty} packet.WriteInt16(guildWave.PlayersRegisteredCount); //{Count Player} } else { packet.WriteByte((byte)GuildWaveOnSRS.Select); //{GuildWaveOnSRS} packet.WriteByte(0); //{GuildWaveOnDifficulty} packet.WriteInt16(0); //{Count Player} } //Asda2GuildWave.GetDiffeclity(guildWave.Difficulty); client.ActiveCharacter.Send(packet, addEnd: true); } }
[PacketHandler(RealmServerOpCode.GuildWaveEnterRequest)] //4406 public static void GuildWaveEnterRequest(IRealmClient client, RealmPacketIn packet) { Asda2GuildWave guildWave = Asda2GuildWaveMgr.GetGuildWaveForId((int)client.ActiveCharacter.GuildId); if (guildWave != null) { if (guildWave.RegistrationFinished) { if (!guildWave.IsInProgress) { if (guildWave.isPlayerRegistered(client.ActiveCharacter)) { client.ActiveCharacter.IsAsda2GuildWave = true; guildWave.AddEnteredPlayer(client.ActiveCharacter); } else { GlobalHandler.SendTeleportedByCristalResponse(client, MapId.Alpia, 0, 0, TeleportByCristalStaus.NotRegisterWave); } } else { GlobalHandler.SendTeleportedByCristalResponse(client, MapId.Alpia, 0, 0, TeleportByCristalStaus.RejoinNot); } } } else { GlobalHandler.SendTeleportedByCristalResponse(client, MapId.Alpia, 0, 0, TeleportByCristalStaus.NoWaveInfo); } }
[PacketHandler(RealmServerOpCode.GuildWaveExit)] //4407 public static void GuildWaveExit(IRealmClient client, RealmPacketIn packet) { Asda2GuildWave guildWave = Asda2GuildWaveMgr.GetGuildWaveForId((int)client.ActiveCharacter.GuildId); if (guildWave != null) { client.ActiveCharacter.IsAsda2GuildWave = false; guildWave.ExitGuildWave(client.ActiveCharacter); } }
public static void DiconnectGuildWave(Character chr) { if (chr.IsAsda2GuildWave) { Asda2GuildWave guildWave = Asda2GuildWaveMgr.GetGuildWaveForId((int)chr.GuildId); if (guildWave != null) { guildWave.RemoveRegisteringPlayer(chr); } chr.IsAsda2GuildWave = false; } }
public static void GuildWaveoOnResponseToRegisteredPlayers(int guildid) { using (var packet = new RealmPacketOut(RealmServerOpCode.GuildWaveoOnResponse)) //4401 { Asda2GuildWave guildWave = Asda2GuildWaveMgr.GetGuildWaveForId(guildid); if (guildWave != null) { packet.WriteInt16(guildid); //{GuildId}default value : 3 Len : 2 packet.WriteByte((byte)GuildWaveOnSRS.Show); //{GuildWaveOnSRS} packet.WriteByte(guildWave.Difficulty); //{GuildWaveOnDifficulty} packet.WriteInt16(guildWave.PlayersRegisteredCount); //{Count Player} guildWave.SendPacketToRegisteredPlayers(packet); } } }
[PacketHandler(RealmServerOpCode.GuildWaveUnregisterRequest)] //4404 public static void GuildWaveUnregisterRequest(IRealmClient client, RealmPacketIn packet) { packet.Position += 2; packet.ReadByte(); //{Type act} Asda2GuildWave guildWave = Asda2GuildWaveMgr.GetGuildWaveForId((int)client.ActiveCharacter.GuildId); if (guildWave != null) { guildWave.RemoveRegisteringPlayer(client.ActiveCharacter); GuildWaveUnregisterResponse(client, GuildWaveUnregisterStatus.Ok); GuildWaveoOnResponseToRegisteredPlayers((int)client.ActiveCharacter.GuildId); } else { GuildWaveUnregisterResponse(client, GuildWaveUnregisterStatus.Fail); } }
[PacketHandler(RealmServerOpCode.GuildWaveRegisterRequest)] //4402 public static void GuildWaveRegisterRequest(IRealmClient client, RealmPacketIn packet) { packet.Position += 2; packet.ReadByte(); //{Type act} var difficulty = packet.ReadByte(); //{Difficulty} Asda2GuildWave guildWave = Asda2GuildWaveMgr.GetGuildWaveForId((int)client.ActiveCharacter.GuildId); /* if (guildWave.IsInProgress) * { * GuildWaveRegisterResponse(client, GuildWaveRegisterStatus.Fail); * return; * }*/ if (guildWave == null) { if (client.ActiveCharacter.Guild.WaveLimit >= CharacterFormulas.GetWaveLimit(client.ActiveCharacter.Guild.Level)) { if (CharacterFormulas.GetWaveLimit(client.ActiveCharacter.Guild.Level) > 1) { GuildWaveRegisterResponse(client, GuildWaveRegisterStatus.LimitDay); } else { GuildWaveRegisterResponse(client, GuildWaveRegisterStatus.LimitOneDay); } return; } if (client.ActiveCharacter.Guild.Level < 2) { GuildWaveRegisterResponse(client, GuildWaveRegisterStatus.GuildLevel); } else { guildWave = Asda2GuildWaveMgr.CreateGuildWave((int)client.ActiveCharacter.GuildId, difficulty, client.ActiveCharacter); GuildWaveRegisterResponse(client, GuildWaveRegisterStatus.Ok); GuildWaveoOnResponseToRegisteredPlayers(guildWave.GuildId); } } else { if (guildWave.PlayersRegisteredCount < 20) { if (guildWave.isPlayerRegistered(client.ActiveCharacter)) { GuildWaveRegisterResponse(client, GuildWaveRegisterStatus.AlreadyRegistered); } else { if (guildWave.IsInProgress) { GuildWaveRegisterResponse(client, GuildWaveRegisterStatus.WaveInProgress); } else { guildWave.AddRegisteringPlayer(client.ActiveCharacter); GuildWaveRegisterResponse(client, GuildWaveRegisterStatus.Ok); GuildWaveoOnResponseToRegisteredPlayers((int)client.ActiveCharacter.GuildId); } } } else { GuildWaveRegisterResponse(client, GuildWaveRegisterStatus.Full); } } }