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); } }
public static Asda2GuildWave GetGuildWaveForId(int guildId) { Asda2GuildWave guildWave = null; guildWaves.TryGetValue(guildId, out guildWave); return(guildWave); }
public static Asda2GuildWave CreateGuildWave(int guildId, int difficulty, Character chr) { Asda2GuildWave guildWave = new Asda2GuildWave(guildId, difficulty, chr.Guild); guildWave.AddRegisteringPlayer(chr); guildWaves.TryAdd(guildId, guildWave); Asda2GuildWaveHandler.GuildWaveEnterStatusToGuild(chr.Guild, GuildWaveEnterStatus.Register); return(guildWave); }
[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 GuildWaveUpdate(Asda2GuildWave guildWave, GuildWaveUpdateStatus status, int wave, int time) { using (var packet = new RealmPacketOut(RealmServerOpCode.GuildWaveUpdate)) //4409 { packet.WriteInt16(guildWave.GuildId); //{GuildId} packet.WriteByte((byte)status); // {type} 0 - подготовка(время - подготовка к 1 волне). 1 старт волны (время волны) .2 конец волны (время - подготовка к след волне) packet.WriteInt16(wave); // {wave} packet.WriteInt32(time); //{time} 5мин = 300000, 300*1000 guildWave.SendPacketToRegisteredOnGuildWavePlayers(packet); } }
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); } } }
public static void GuildWaveResult(Asda2GuildWave guildWave, Character chr, int waveCoin, int itemId1, int itemId2, int itemId3) { using (var packet = new RealmPacketOut(RealmServerOpCode.GuildWaveResult)) //4411 { packet.WriteInt16(guildWave.GuildId); // {guildId} packet.WriteByte(guildWave.Difficulty); // {Difficulty} packet.WriteInt16(guildWave.PlayersRegisteredCount); // {Count players} packet.WriteByte(guildWave.getAverageLevel()); // {Average Lvl} packet.WriteInt16(guildWave.LastWinnedWave + 1); // {Wave} packet.WriteInt32(0); packet.WriteInt16(waveCoin); // wave coin packet.WriteInt32(itemId1); // prize 1 packet.WriteInt32(itemId2); // prize 1 hard packet.WriteInt32(itemId3); // prize 1 hell chr.Send(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); } }
public void Update(int dt) { if (DateTime.Now.Hour == 6) { if (!isUpdated) { RestoreGuildWaveCounter(); isUpdated = true; } } else { if (isUpdated) { isUpdated = false; } } foreach (int guildId in guildWaves.Keys) { Asda2GuildWave guildWave = null; guildWaves.TryGetValue(guildId, out guildWave); if (guildWave != null) { if (guildWave.IsFailed || guildWave.PlayersRegisteredCount == 0 || guildWave.IsFinished) { guildWave.StopMap(); guildWaves.TryRemove(guildId, out guildWave); if (guildWave.PlayersRegisteredCount == 0 && !guildWave.IsFinished) { //Asda2GuildWaveHandler.GuildWaveEnterStatusToGuild(guildWave.Guild, GuildWaveEnterStatus.NotPlayers); } } else { guildWave.UpdateGuildWave(dt); } } } }
public Asda2GuildWaveMgr() { Asda2GuildWave.InitGuildWaveNpcList(); }
[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); } } }