private void OnStreamEntryAdded(StreamEntry entry) { AllianceStreamEntryMessage allianceStreamEntryMessage = new AllianceStreamEntryMessage(); allianceStreamEntryMessage.SetStreamEntry(entry); this.SendPiranhaMessage(allianceStreamEntryMessage, 1); }
public override void Process(Level level) { var avatar = level.GetPlayerAvatar(); var alliance = ObjectManager.GetAlliance(Id); var streamEntry = new InvitationStreamEntry(); streamEntry.SetId(alliance.GetChatMessages().Count + 1); streamEntry.SetSenderId(avatar.GetId()); streamEntry.SetHomeId(avatar.GetId()); streamEntry.SetSenderLeagueId(avatar.GetLeagueId()); streamEntry.SetSenderName(avatar.GetAvatarName()); streamEntry.SetSenderRole(avatar.GetAllianceRole()); streamEntry.SetMessage(Message); streamEntry.SetState(1); alliance.AddChatMessage(streamEntry); var members = alliance.GetAllianceMembers(); foreach (var member in members) { var memberLevel = ResourcesManager.GetPlayer(member.GetAvatarId(), false); var memberClient = memberLevel.GetClient(); if (memberClient != null) { var message = new AllianceStreamEntryMessage(memberClient); message.SetStreamEntry(streamEntry); message.Send(); } } }
public override void Execute(Level level) { var cm = new ShareStreamEntry(); cm.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds); cm.SetSenderId(0); cm.SetHomeId(0); cm.SetSenderLeagueId(22); cm.SetSenderName("Mimi"); cm.SetSenderRole(4); cm.SetMessage("Look this ! I killed it ahahah"); cm.SetEnemyName("Mimi"); cm.SetReplayjson("{'lol': 'mdr'}"); var all = ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); all.AddChatMessage(cm); foreach (var onlinePlayer in ResourcesManager.GetOnlinePlayers()) { if (onlinePlayer.GetPlayerAvatar().GetAllianceId() == level.GetPlayerAvatar().GetAllianceId()) { var p = new AllianceStreamEntryMessage(onlinePlayer.GetClient()); p.SetStreamEntry(cm); PacketManager.ProcessOutgoingPacket(p); } } }
public override void Process(Level level) { ClientAvatar player = level.GetPlayerAvatar(); Alliance all = ObjectManager.GetAlliance(ID); InvitationStreamEntry cm = new InvitationStreamEntry(); cm.SetId(all.GetChatMessages().Count + 1); cm.SetSenderId(player.GetId()); cm.SetHomeId(player.GetId()); cm.SetSenderLeagueId(player.GetLeagueId()); cm.SetSenderName(player.GetAvatarName()); cm.SetSenderRole(player.GetAllianceRole()); cm.SetMessage(Message); cm.SetState(1); all.AddChatMessage(cm); // New function for send a message foreach (AllianceMemberEntry op in all.GetAllianceMembers()) { Level playera = ResourcesManager.GetPlayer(op.GetAvatarId()); if (playera.GetClient() != null) { var p = new AllianceStreamEntryMessage(playera.GetClient()); p.SetStreamEntry(cm); p.Send(); } } }
public override async void Process(Level level) { try { ClientAvatar player = level.GetPlayerAvatar(); Alliance all = await ObjectManager.GetAlliance(ID); InvitationStreamEntry cm = new InvitationStreamEntry(); cm.SetId(all.GetChatMessages().Count + 1); cm.SetSenderId(player.GetId()); cm.SetHomeId(player.GetId()); cm.SetSenderLeagueId(player.GetLeagueId()); cm.SetSenderName(player.GetAvatarName()); cm.SetSenderRole(await player.GetAllianceRole()); cm.SetMessage(Message); cm.SetState(1); all.AddChatMessage(cm); foreach (AllianceMemberEntry op in all.GetAllianceMembers()) { Level playera = await ResourcesManager.GetPlayer(op.GetAvatarId()); if (playera.GetClient() != null) { AllianceStreamEntryMessage p = new AllianceStreamEntryMessage(playera.GetClient()); p.SetStreamEntry(cm); PacketProcessor.Send(p); } } } catch (Exception) { } }
public override void Process(Level level) { var a = ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); var defender = ResourcesManager.GetPlayer(a.GetChatMessages().Find(c => c.GetId() == ID).GetSenderId()); if (defender != null) { defender.Tick(); new ChallangeAttackDataMessage(Client, defender).Send(); } else { new OwnHomeDataMessage(Client, level); } var alliance = ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); var s = alliance.GetChatMessages().Find(c => c.GetStreamEntryType() == 12); if (s != null) { alliance.GetChatMessages().RemoveAll(t => t == s); foreach (AllianceMemberEntry op in alliance.GetAllianceMembers()) { Level playera = ResourcesManager.GetPlayer(op.GetAvatarId()); if (playera.GetClient() != null) { var p = new AllianceStreamEntryMessage(playera.GetClient()); p.SetStreamEntry(s); p.Send(); } } } }
public override async void Process(Level level) { try { if (m_vChatMessage.Length > 0) { if (m_vChatMessage.Length < 101) { if (m_vChatMessage[0] == '/') { Object obj = GameOpCommandFactory.Parse(m_vChatMessage); if (obj != null) { string player = ""; if (level != null) { player += " (" + level.GetPlayerAvatar().GetId() + ", " + level.GetPlayerAvatar().GetAvatarName() + ")"; } ((GameOpCommand)obj).Execute(level); } } else { ClientAvatar avatar = level.GetPlayerAvatar(); long allianceId = avatar.GetAllianceId(); if (allianceId > 0) { ChatStreamEntry cm = new ChatStreamEntry(); cm.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds); cm.SetSender(avatar); cm.SetMessage(m_vChatMessage); Alliance alliance = await ObjectManager.GetAlliance(allianceId); if (alliance != null) { alliance.AddChatMessage(cm); foreach (var op in alliance.GetAllianceMembers()) { Level player = await ResourcesManager.GetPlayer(op.GetAvatarId()); if (player.GetClient() != null) { AllianceStreamEntryMessage p = new AllianceStreamEntryMessage(player.GetClient()); p.SetStreamEntry(cm); PacketProcessor.Send(p); } } } } } } } } catch (Exception) { } }
public override void Execute(Level level) { ChallangeCommand challangeCommand = this; try { ClientAvatar player = level.GetPlayerAvatar(); Alliance alliance = ObjectManager.GetAlliance(player.GetAllianceId()); ChallengeStreamEntry cm = new ChallengeStreamEntry(); cm.SetMessage(challangeCommand.Message); cm.SetSenderId(player.GetId()); cm.SetSenderName(player.GetAvatarName()); cm.SetSenderLevel(player.GetAvatarLevel()); ChallengeStreamEntry challengeStreamEntry = cm; int allianceRole = player.GetAllianceRole(); challengeStreamEntry.SetSenderRole(allianceRole); challengeStreamEntry = (ChallengeStreamEntry)null; cm.SetId(alliance.GetChatMessages().Count + 1); cm.SetSenderLeagueId(player.GetLeagueId()); alliance.AddChatMessage((UCS.Logic.StreamEntry.StreamEntry)cm); UCS.Logic.StreamEntry.StreamEntry s = alliance.GetChatMessages().Find((Predicate <UCS.Logic.StreamEntry.StreamEntry>)(c => c.GetStreamEntryType() == 12)); List <AllianceMemberEntry> .Enumerator enumerator; if (s != null) { alliance.GetChatMessages().RemoveAll((Predicate <UCS.Logic.StreamEntry.StreamEntry>)(t => t == s)); foreach (AllianceMemberEntry allianceMember in alliance.GetAllianceMembers()) { Level player1 = ResourcesManager.GetPlayer(allianceMember.GetAvatarId(), false); if (player1.GetClient() != null) { new AllianceStreamEntryRemovedMessage(player1.GetClient(), s.GetId()).Send(); } } enumerator = new List <AllianceMemberEntry> .Enumerator(); } foreach (AllianceMemberEntry allianceMember in alliance.GetAllianceMembers()) { Level player1 = ResourcesManager.GetPlayer(allianceMember.GetAvatarId(), false); if (player1.GetClient() != null) { AllianceStreamEntryMessage Message = new AllianceStreamEntryMessage(player1.GetClient()); ChallengeStreamEntry challengeStreamEntry1 = cm; Message.SetStreamEntry((UCS.Logic.StreamEntry.StreamEntry)challengeStreamEntry1); Message.Send(); } } enumerator = new List <AllianceMemberEntry> .Enumerator(); player = (ClientAvatar)null; alliance = (Alliance)null; cm = (ChallengeStreamEntry)null; } catch (Exception ex) { } }
public override void Process(Level level) { var alliance = ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); if (alliance != null) { alliance.SetAllianceDescription(m_vAllianceDescription); alliance.SetAllianceBadgeData(m_vAllianceBadgeData); alliance.SetAllianceType(m_vAllianceType); alliance.SetRequiredScore(m_vRequiredScore); alliance.SetWarFrequency(m_vWarFrequency); alliance.SetAllianceOrigin(m_vAllianceOrigin); alliance.SetWarAndFriendlytStatus(m_vWarAndFriendlyStatus); var avatar = level.GetPlayerAvatar(); var allianceId = avatar.GetAllianceId(); var eventStreamEntry = new AllianceEventStreamEntry(); eventStreamEntry.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds); eventStreamEntry.SetSender(avatar); eventStreamEntry.SetEventType(10); eventStreamEntry.SetAvatarId(avatar.GetId()); eventStreamEntry.SetAvatarName(avatar.GetAvatarName()); eventStreamEntry.SetSenderId(avatar.GetId()); eventStreamEntry.SetSenderName(avatar.GetAvatarName()); alliance.AddChatMessage(eventStreamEntry); var edit = new AllianceSettingChangedCommand(); edit.SetAlliance(alliance); edit.SetPlayer(level); var availableServerCommandMessage = new AvailableServerCommandMessage(level.GetClient()); availableServerCommandMessage.SetCommandId(6); availableServerCommandMessage.SetCommand(edit); availableServerCommandMessage.Send(); Parallel.ForEach(alliance.GetAllianceMembers(), op => { var user = ResourcesManager.GetPlayer(op.GetAvatarId()); if (ResourcesManager.IsPlayerOnline(user)) { var p = new AllianceStreamEntryMessage(user.GetClient()); p.SetStreamEntry(eventStreamEntry); p.Send(); } }); var clan = DatabaseManager.Single().Save(alliance); clan.Wait(); } }
public override void Process(Level level) { if (m_vChatMessage.Length > 0) { if (m_vChatMessage[0] == '/') { var obj = GameOpCommandFactory.Parse(m_vChatMessage); if (obj != null) { var player = ""; if (level != null) { player += " (" + level.GetPlayerAvatar().GetId() + ", " + level.GetPlayerAvatar().GetAvatarName() + ")"; } ((GameOpCommand)obj).Execute(level); } } else { var avatar = level.GetPlayerAvatar(); var allianceId = avatar.GetAllianceId(); if (allianceId > 0) { var cm = new ChatStreamEntry(); cm.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds); cm.SetSender(avatar); cm.SetMessage(m_vChatMessage); var alliance = ObjectManager.GetAlliance(allianceId); if (alliance != null) { alliance.AddChatMessage(cm); Parallel.ForEach((alliance.GetAllianceMembers()), op => { Level player = ResourcesManager.GetPlayer(op.GetAvatarId()); if (player.GetClient() != null) { var p = new AllianceStreamEntryMessage(player.GetClient()); p.SetStreamEntry(cm); p.Send(); } }); } } } } }
public override void Process(Level level) { if (m_vChatMessage.Length > 0) { if (m_vChatMessage[0] == '/') { var obj = GameOpCommandFactory.Parse(m_vChatMessage); if (obj != null) { var player = ""; if (level != null) { player += " (" + level.GetPlayerAvatar().GetId() + ", " + level.GetPlayerAvatar().GetAvatarName() + ")"; } //Debugger.WriteLine("\t" + obj.GetType().Name + player); ((GameOpCommand)obj).Execute(level); } } else { var avatar = level.GetPlayerAvatar(); var allianceId = avatar.GetAllianceId(); if (allianceId > 0) { var cm = new ChatStreamEntry(); cm.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds); cm.SetAvatar(avatar); cm.SetMessage(m_vChatMessage); var alliance = ObjectManager.GetAlliance(allianceId); if (alliance != null) { alliance.AddChatMessage(cm); foreach (var onlinePlayer in ResourcesManager.GetOnlinePlayers()) { if (onlinePlayer.GetPlayerAvatar().GetAllianceId() == allianceId) { var p = new AllianceStreamEntryMessage(onlinePlayer.GetClient()); p.SetStreamEntry(cm); PacketManager.ProcessOutgoingPacket(p); } } } } } } }
public override async void Execute(Level level) { try { ClientAvatar player = level.GetPlayerAvatar(); long allianceID = player.GetAllianceId(); Alliance alliance = await ObjectManager.GetAlliance(allianceID); ChallangeStreamEntry cm = new ChallangeStreamEntry(); cm.SetMessage(Message); cm.SetSenderId(player.GetId()); cm.SetSenderName(player.GetAvatarName()); cm.SetSenderLevel(player.GetAvatarLevel()); cm.SetSenderRole(await player.GetAllianceRole()); cm.SetId(alliance.GetChatMessages().Count + 1); cm.SetSenderLeagueId(player.GetLeagueId()); StreamEntry s = alliance.GetChatMessages().Find(c => c.GetStreamEntryType() == 12); if (s != null) { alliance.GetChatMessages().RemoveAll(t => t == s); foreach (AllianceMemberEntry op in alliance.GetAllianceMembers()) { Level alliancemembers = await ResourcesManager.GetPlayer(op.GetAvatarId()); if (alliancemembers.GetClient() != null) { PacketProcessor.Send(new AllianceStreamEntryRemovedMessage(alliancemembers.GetClient(), s.GetId())); } } } alliance.AddChatMessage(cm); foreach (AllianceMemberEntry op in alliance.GetAllianceMembers()) { Level alliancemembers = await ResourcesManager.GetPlayer(op.GetAvatarId()); if (alliancemembers.GetClient() != null) { AllianceStreamEntryMessage p = new AllianceStreamEntryMessage(alliancemembers.GetClient()); p.SetStreamEntry(cm); PacketProcessor.Send(p); } } } catch (Exception) { } }
public override async void Execute(Level level) { try { ClientAvatar player = level.GetPlayerAvatar(); TroopRequestStreamEntry cm = new TroopRequestStreamEntry(); Alliance all = await ObjectManager.GetAlliance(player.GetAllianceId()); cm.SetId(all.GetChatMessages().Count + 1); cm.SetSenderId(player.GetId()); cm.SetHomeId(player.GetId()); cm.SetSenderLeagueId(player.GetLeagueId()); cm.SetSenderName(player.GetAvatarName()); cm.SetSenderRole(await player.GetAllianceRole()); cm.SetMessage(Message); cm.SetMaxTroop(player.GetAllianceCastleTotalCapacity()); all.AddChatMessage(cm); StreamEntry s = all.GetChatMessages().Find(c => c.GetSenderId() == level.GetPlayerAvatar().GetId() && c.GetStreamEntryType() == 1); if (s == null) { all.GetChatMessages().RemoveAll(t => t == s); } all.AddChatMessage(cm); foreach (AllianceMemberEntry op in all.GetAllianceMembers()) { Level aplayer = await ResourcesManager.GetPlayer(op.GetAvatarId()); if (aplayer.GetClient() != null) { if (s != null) { PacketProcessor.Send(new AllianceStreamEntryRemovedMessage(aplayer.GetClient(), s.GetId())); } AllianceStreamEntryMessage p = new AllianceStreamEntryMessage(aplayer.GetClient()); p.SetStreamEntry(cm); PacketProcessor.Send(p); } } } catch (Exception) { ResourcesManager.DropClient(level.GetClient().GetSocketHandle()); } }
public override async void Process(Level level) { try { if (level.GetPlayerAvatar().State == ClientAvatar.UserState.CHA) { ResourcesManager.DisconnectClient(Client); } else { level.GetPlayerAvatar().State = ClientAvatar.UserState.CHA; Alliance a = await ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); Level defender = await ResourcesManager.GetPlayer(a.GetChatMessages().Find(c => c.GetId() == ID).GetSenderId()); if (defender != null) { defender.Tick(); PacketProcessor.Send(new ChallangeAttackDataMessage(Client, defender)); } else { new OwnHomeDataMessage(Client, level); } Alliance alliance = await ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); StreamEntry s = alliance.GetChatMessages().Find(c => c.GetStreamEntryType() == 12); if (s != null) { alliance.GetChatMessages().RemoveAll(t => t == s); foreach (AllianceMemberEntry op in alliance.GetAllianceMembers()) { Level playera = await ResourcesManager.GetPlayer(op.GetAvatarId()); if (playera.GetClient() != null) { AllianceStreamEntryMessage p = new AllianceStreamEntryMessage(playera.GetClient()); p.SetStreamEntry(s); PacketProcessor.Send(p); } } } } } catch (Exception) { } }
public override void Execute(Level level) { var player = level.GetPlayerAvatar(); var allianceID = player.GetAllianceId(); var alliance = ObjectManager.GetAlliance(allianceID); var cm = new ChallangeStreamEntry(); cm.SetMessage(Message); cm.SetSenderId(player.GetId()); cm.SetSenderName(player.GetAvatarName()); cm.SetSenderLevel(player.GetAvatarLevel()); cm.SetSenderRole(player.GetAllianceRole()); cm.SetId(alliance.GetChatMessages().Count + 1); cm.SetSenderLeagueId(player.GetLeagueId()); var s = alliance.GetChatMessages().Find(c => c.GetStreamEntryType() == 12); if (s != null) { alliance.GetChatMessages().RemoveAll(t => t == s); Parallel.ForEach((alliance.GetAllianceMembers()), op => { var alliancemembers = ResourcesManager.GetPlayer(op.GetAvatarId()); if (alliancemembers.GetClient() != null) { new AllianceStreamEntryRemovedMessage(alliancemembers.GetClient(), s.GetId()).Send(); } }); } alliance.AddChatMessage(cm); Parallel.ForEach((alliance.GetAllianceMembers()), op => { var alliancemembers = ResourcesManager.GetPlayer(op.GetAvatarId()); if (alliancemembers.GetClient() != null) { var p = new AllianceStreamEntryMessage(alliancemembers.GetClient()); p.SetStreamEntry(cm); p.Send(); } }); }
public override void Process(Level level) { //Clans Edit Manager var alliance = ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); if (alliance != null) { alliance.SetAllianceDescription(m_vAllianceDescription); alliance.SetAllianceBadgeData(m_vAllianceBadgeData); alliance.SetAllianceType(m_vAllianceType); alliance.SetRequiredScore(m_vRequiredScore); alliance.SetWarFrequency(m_vWarFrequency); alliance.SetAllianceOrigin(m_vAllianceOrigin); var avatar = level.GetPlayerAvatar(); var allianceId = avatar.GetAllianceId(); var eventStreamEntry = new AllianceEventStreamEntry(); eventStreamEntry.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds); eventStreamEntry.SetAvatar(avatar); eventStreamEntry.SetEventType(10); eventStreamEntry.SetAvatarId(avatar.GetId()); eventStreamEntry.SetAvatarName(avatar.GetAvatarName()); eventStreamEntry.SetSenderId(avatar.GetId()); eventStreamEntry.SetSenderName(avatar.GetAvatarName()); alliance.AddChatMessage(eventStreamEntry); foreach (var onlinePlayer in ResourcesManager.GetOnlinePlayers()) { if (onlinePlayer.GetPlayerAvatar().GetAllianceId() == allianceId) { var p = new AllianceStreamEntryMessage(onlinePlayer.GetClient()); p.SetStreamEntry(eventStreamEntry); PacketManager.ProcessOutgoingPacket(p); PacketManager.ProcessOutgoingPacket(new OwnHomeDataMessage(Client, level)); PacketManager.ProcessOutgoingPacket(new AllianceDataMessage(Client, alliance)); } } DatabaseManager.Singelton.Save(alliance); } }
public override void Process(Level level) { var target = ResourcesManager.GetPlayer(m_vId); var player = level.GetPlayerAvatar(); var alliance = ObjectManager.GetAlliance(player.GetAllianceId()); if (player.GetAllianceRole() == 2 || player.GetAllianceRole() == 4) { if (player.GetAllianceId() == target.GetPlayerAvatar().GetAllianceId()) { target.GetPlayerAvatar().SetAllianceRole(m_vRole); if (m_vRole == 2) { player.SetAllianceRole(4); var eventStreamEntry = new AllianceEventStreamEntry(); eventStreamEntry.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds); eventStreamEntry.SetAvatar(player); eventStreamEntry.SetEventType(6); eventStreamEntry.SetAvatarId(target.GetPlayerAvatar().GetId()); eventStreamEntry.SetAvatarName(target.GetPlayerAvatar().GetAvatarName()); alliance.AddChatMessage(eventStreamEntry); foreach (var onlinePlayer in ResourcesManager.GetOnlinePlayers()) { if (onlinePlayer.GetPlayerAvatar().GetAllianceId() == target.GetPlayerAvatar().GetAllianceId()) { var p = new AllianceStreamEntryMessage(onlinePlayer.GetClient()); p.SetStreamEntry(eventStreamEntry); PacketManager.ProcessOutgoingPacket(p); } } } } } // PacketManager.ProcessOutgoingPacket(new AllianceDataMessage(Client, alliance)); PacketManager.ProcessOutgoingPacket(new PromoteAllianceMemberOkMessage(Client, target, this)); }
public override async void Process(Level level) { try { ClientAvatar avatar = level.GetPlayerAvatar(); Alliance alliance = await ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); if (await avatar.GetAllianceRole() == 2 && alliance.GetAllianceMembers().Count > 1) { List<AllianceMemberEntry> members = alliance.GetAllianceMembers(); foreach (AllianceMemberEntry player in members.Where(player => player.GetRole() >= 3)) { player.SetRole(2); if (ResourcesManager.IsPlayerOnline(await ResourcesManager.GetPlayer(player.GetAvatarId()))) { AllianceRoleUpdateCommand c = new AllianceRoleUpdateCommand(); c.SetAlliance(alliance); c.SetRole(2); c.Tick(level); Level l = await ResourcesManager.GetPlayer(player.GetAvatarId()); AvailableServerCommandMessage d = new AvailableServerCommandMessage(l.GetClient()); d.SetCommandId(8); d.SetCommand(c); PacketProcessor.Send(d); } done = true; break; } if (!done) { int count = alliance.GetAllianceMembers().Count; Random rnd = new Random(); int id = rnd.Next(1, count); while (id != level.GetPlayerAvatar().GetId()) id = rnd.Next(1, count); int loop = 0; foreach (AllianceMemberEntry player in members) { loop++; if (loop == id) { player.SetRole(2); if (ResourcesManager.IsPlayerOnline(await ResourcesManager.GetPlayer(player.GetAvatarId()))) { AllianceRoleUpdateCommand e = new AllianceRoleUpdateCommand(); e.SetAlliance(alliance); e.SetRole(2); e.Tick(level); Level l2 = await ResourcesManager.GetPlayer(player.GetAvatarId()); AvailableServerCommandMessage f = new AvailableServerCommandMessage(l2.GetClient()); f.SetCommandId(8); f.SetCommand(e); PacketProcessor.Send(f); } break; } } } } LeavedAllianceCommand a = new LeavedAllianceCommand(); a.SetAlliance(alliance); a.SetReason(1); AvailableServerCommandMessage b = new AvailableServerCommandMessage(Client); b.SetCommandId(2); b.SetCommand(a); PacketProcessor.Send(b); alliance.RemoveMember(avatar.GetId()); avatar.SetAllianceId(0); if (alliance.GetAllianceMembers().Count > 0) { AllianceEventStreamEntry eventStreamEntry = new AllianceEventStreamEntry(); eventStreamEntry.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds); eventStreamEntry.SetSender(avatar); eventStreamEntry.SetEventType(4); eventStreamEntry.SetAvatarId(avatar.GetId()); eventStreamEntry.SetAvatarName(avatar.GetAvatarName()); alliance.AddChatMessage(eventStreamEntry); foreach (Level onlinePlayer in ResourcesManager.GetOnlinePlayers()) if (onlinePlayer.GetPlayerAvatar().GetAllianceId() == alliance.GetAllianceId()) { AllianceStreamEntryMessage p = new AllianceStreamEntryMessage(onlinePlayer.GetClient()); p.SetStreamEntry(eventStreamEntry); PacketProcessor.Send(p); } } else { DatabaseManager.Single().RemoveAlliance(alliance); } PacketProcessor.Send(new LeaveAllianceOkMessage(Client, alliance)); } catch (Exception) { } }
public override async void Process(Level level) { try { Alliance a = await ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); StreamEntry message = a.GetChatMessages().Find(c => c.GetId() == MessageID); Level requester = await ResourcesManager.GetPlayer(message.GetSenderId()); if (Choice == 1) { if (!a.IsAllianceFull()) { requester.GetPlayerAvatar().SetAllianceId(a.GetAllianceId()); AllianceMemberEntry member = new AllianceMemberEntry(requester.GetPlayerAvatar().GetId()); member.SetRole(1); a.AddAllianceMember(member); StreamEntry e = a.GetChatMessages().Find(c => c.GetId() == MessageID); e.SetJudgeName(level.GetPlayerAvatar().GetAvatarName()); e.SetState(2); AllianceEventStreamEntry eventStreamEntry = new AllianceEventStreamEntry(); eventStreamEntry.SetId(a.GetChatMessages().Count + 1); eventStreamEntry.SetSender(requester.GetPlayerAvatar()); eventStreamEntry.SetAvatarName(level.GetPlayerAvatar().GetAvatarName()); eventStreamEntry.SetAvatarId(level.GetPlayerAvatar().GetId()); eventStreamEntry.SetEventType(2); a.AddChatMessage(eventStreamEntry); foreach (AllianceMemberEntry op in a.GetAllianceMembers()) { Level player = await ResourcesManager.GetPlayer(op.GetAvatarId()); if (player.GetClient() != null) { AllianceStreamEntryMessage c = new AllianceStreamEntryMessage(player.GetClient()); AllianceStreamEntryMessage p = new AllianceStreamEntryMessage(player.GetClient()); p.SetStreamEntry(eventStreamEntry); c.SetStreamEntry(e); PacketProcessor.Send(p); PacketProcessor.Send(c); } } if (ResourcesManager.IsPlayerOnline(requester)) { JoinedAllianceCommand joinAllianceCommand = new JoinedAllianceCommand(); joinAllianceCommand.SetAlliance(a); AvailableServerCommandMessage availableServerCommandMessage = new AvailableServerCommandMessage(requester.GetClient()); availableServerCommandMessage.SetCommandId(1); availableServerCommandMessage.SetCommand(joinAllianceCommand); AllianceRoleUpdateCommand d = new AllianceRoleUpdateCommand(); d.SetAlliance(a); d.SetRole(4); d.Tick(level); AvailableServerCommandMessage c = new AvailableServerCommandMessage(Client); c.SetCommandId(8); c.SetCommand(d); PacketProcessor.Send(new AnswerJoinRequestAllianceMessage(Client)); PacketProcessor.Send(availableServerCommandMessage); PacketProcessor.Send(c); PacketProcessor.Send(new AllianceStreamMessage(requester.GetClient(), a)); } } } else { StreamEntry e = a.GetChatMessages().Find(c => c.GetId() == MessageID); e.SetJudgeName(level.GetPlayerAvatar().GetAvatarName()); e.SetState(3); foreach (AllianceMemberEntry op in a.GetAllianceMembers()) { Level player = await ResourcesManager.GetPlayer(op.GetAvatarId()); if (player.GetClient() != null) { AllianceStreamEntryMessage c = new AllianceStreamEntryMessage(player.GetClient()); c.SetStreamEntry(e); PacketProcessor.Send(c); } } } } catch (Exception) { } }
public override void Execute(Level level) { var targetAccount = ResourcesManager.GetPlayer(m_vAvatarId, true); if (targetAccount != null) { var targetAvatar = targetAccount.GetPlayerAvatar(); var targetAllianceId = targetAvatar.GetAllianceId(); var requesterAvatar = level.GetPlayerAvatar(); var requesterAllianceId = requesterAvatar.GetAllianceId(); if (requesterAllianceId > 0 && targetAllianceId == requesterAllianceId) { var alliance = ObjectManager.GetAlliance(requesterAllianceId); var requesterMember = alliance.GetAllianceMember(requesterAvatar.GetId()); var targetMember = alliance.GetAllianceMember(m_vAvatarId); if (targetMember.HasLowerRoleThan(requesterMember.GetRole())) { targetAvatar.SetAllianceId(0); alliance.RemoveMember(m_vAvatarId); if (ResourcesManager.IsPlayerOnline(targetAccount)) { var leaveAllianceCommand = new LeaveAllianceCommand(); leaveAllianceCommand.SetAlliance(alliance); leaveAllianceCommand.SetReason(2); //Kick var availableServerCommandMessage = new AvailableServerCommandMessage(targetAccount.GetClient()); availableServerCommandMessage.SetCommandId(2); availableServerCommandMessage.SetCommand(leaveAllianceCommand); PacketManager.ProcessOutgoingPacket(availableServerCommandMessage); var kickOutStreamEntry = new AllianceKickOutStreamEntry(); kickOutStreamEntry.SetId( (int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds); kickOutStreamEntry.SetAvatar(requesterAvatar); kickOutStreamEntry.SetIsNew(0); kickOutStreamEntry.SetAllianceId(alliance.GetAllianceId()); kickOutStreamEntry.SetAllianceBadgeData(alliance.GetAllianceBadgeData()); kickOutStreamEntry.SetAllianceName(alliance.GetAllianceName()); kickOutStreamEntry.SetMessage(m_vMessage); var p = new AvatarStreamEntryMessage(targetAccount.GetClient()); p.SetAvatarStreamEntry(kickOutStreamEntry); PacketManager.ProcessOutgoingPacket(p); } var eventStreamEntry = new AllianceEventStreamEntry(); eventStreamEntry.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds); eventStreamEntry.SetAvatar(targetAvatar); eventStreamEntry.SetEventType(1); eventStreamEntry.SetAvatarId(requesterAvatar.GetId()); eventStreamEntry.SetAvatarName(requesterAvatar.GetAvatarName()); alliance.AddChatMessage(eventStreamEntry); foreach (var onlinePlayer in ResourcesManager.GetOnlinePlayers()) { if (onlinePlayer.GetPlayerAvatar().GetAllianceId() == requesterAllianceId) { var p = new AllianceStreamEntryMessage(onlinePlayer.GetClient()); p.SetStreamEntry(eventStreamEntry); PacketManager.ProcessOutgoingPacket(p); } } } } } }
public override async void Process(Level level) { try { Alliance alliance = await ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); if (alliance != null) { if (m_vAllianceDescription.Length < 259 || m_vAllianceDescription.Length < 0) { if (m_vAllianceBadgeData < 1 || m_vAllianceBadgeData < 10000000000) { if (m_vAllianceType < 0 || m_vAllianceType < 10) { if (m_vRequiredScore < 0 || m_vRequiredScore < 4201) { if (m_vWarFrequency < 0 || m_vWarFrequency < 10) { if (m_vAllianceOrigin < 0 || m_vAllianceOrigin < 42000000) { if (m_vWarAndFriendlyStatus < 0 || m_vWarAndFriendlyStatus < 5) { alliance.SetAllianceDescription(m_vAllianceDescription); alliance.SetAllianceBadgeData(m_vAllianceBadgeData); alliance.SetAllianceType(m_vAllianceType); alliance.SetRequiredScore(m_vRequiredScore); alliance.SetWarFrequency(m_vWarFrequency); alliance.SetAllianceOrigin(m_vAllianceOrigin); alliance.SetWarAndFriendlytStatus(m_vWarAndFriendlyStatus); ClientAvatar avatar = level.GetPlayerAvatar(); long allianceId = avatar.GetAllianceId(); AllianceEventStreamEntry eventStreamEntry = new AllianceEventStreamEntry(); eventStreamEntry.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds); eventStreamEntry.SetSender(avatar); eventStreamEntry.SetEventType(10); eventStreamEntry.SetAvatarId(avatar.GetId()); eventStreamEntry.SetAvatarName(avatar.GetAvatarName()); eventStreamEntry.SetSenderId(avatar.GetId()); eventStreamEntry.SetSenderName(avatar.GetAvatarName()); alliance.AddChatMessage(eventStreamEntry); AllianceSettingChangedCommand edit = new AllianceSettingChangedCommand(); edit.SetAlliance(alliance); edit.SetPlayer(level); AvailableServerCommandMessage availableServerCommandMessage = new AvailableServerCommandMessage(level.GetClient()); availableServerCommandMessage.SetCommandId(6); availableServerCommandMessage.SetCommand(edit); PacketProcessor.Send(availableServerCommandMessage); foreach (AllianceMemberEntry op in alliance.GetAllianceMembers()) { Level user = await ResourcesManager.GetPlayer(op.GetAvatarId()); if (ResourcesManager.IsPlayerOnline(user)) { AllianceStreamEntryMessage p = new AllianceStreamEntryMessage(user.GetClient()); p.SetStreamEntry(eventStreamEntry); PacketProcessor.Send(p); } } DatabaseManager.Single().Save(alliance); } else { ResourcesManager.DisconnectClient(Client); } } else { ResourcesManager.DisconnectClient(Client); } } else { ResourcesManager.DisconnectClient(Client); } } else { ResourcesManager.DisconnectClient(Client); } } else { ResourcesManager.DisconnectClient(Client); } } else { ResourcesManager.DisconnectClient(Client); } } else { ResourcesManager.DisconnectClient(Client); } } } catch (Exception) { } }
public override void Process(Level level) { var avatar = level.GetPlayerAvatar(); var alliance = ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); if (avatar.GetAllianceRole() == 2 && alliance.GetAllianceMembers().Count > 1) { var members = alliance.GetAllianceMembers(); foreach (AllianceMemberEntry player in members.Where(player => player.GetRole() >= 3)) { player.SetRole(2); if (ResourcesManager.IsPlayerOnline(ResourcesManager.GetPlayer(player.GetAvatarId()))) { var c = new AllianceRoleUpdateCommand(); c.SetAlliance(alliance); c.SetRole(2); c.Tick(level); var d = new AvailableServerCommandMessage(ResourcesManager.GetPlayer(player.GetAvatarId()).GetClient()); d.SetCommandId(8); d.SetCommand(c); d.Send(); } done = true; break; } if (!done) { var count = alliance.GetAllianceMembers().Count; var rnd = new Random(); var id = rnd.Next(1, count); while (id != level.GetPlayerAvatar().GetId()) { id = rnd.Next(1, count); } var loop = 0; foreach (AllianceMemberEntry player in members) { loop++; if (loop == id) { player.SetRole(2); if (ResourcesManager.IsPlayerOnline(ResourcesManager.GetPlayer(player.GetAvatarId()))) { var e = new AllianceRoleUpdateCommand(); e.SetAlliance(alliance); e.SetRole(2); e.Tick(level); var f = new AvailableServerCommandMessage(ResourcesManager.GetPlayer(player.GetAvatarId()).GetClient()); f.SetCommandId(8); f.SetCommand(e); f.Send(); } break; } } } } var a = new LeavedAllianceCommand(); a.SetAlliance(alliance); a.SetReason(1); var b = new AvailableServerCommandMessage(Client); b.SetCommandId(2); b.SetCommand(a); b.Send(); alliance.RemoveMember(avatar.GetId()); avatar.SetAllianceId(0); if (alliance.GetAllianceMembers().Count > 0) { var eventStreamEntry = new AllianceEventStreamEntry(); eventStreamEntry.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds); eventStreamEntry.SetSender(avatar); eventStreamEntry.SetEventType(4); eventStreamEntry.SetAvatarId(avatar.GetId()); eventStreamEntry.SetAvatarName(avatar.GetAvatarName()); alliance.AddChatMessage(eventStreamEntry); foreach (Level onlinePlayer in ResourcesManager.GetOnlinePlayers()) { if (onlinePlayer.GetPlayerAvatar().GetAllianceId() == alliance.GetAllianceId()) { AllianceStreamEntryMessage p = new AllianceStreamEntryMessage(onlinePlayer.GetClient()); p.SetStreamEntry(eventStreamEntry); p.Send(); } } } else { DatabaseManager.Single().RemoveAlliance(alliance); } new LeaveAllianceOkMessage(Client, alliance).Send(); }
public override void Process(Level level) { EditClanSettingsMessage clanSettingsMessage = this; try { Alliance alliance = ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); if (alliance != null) { if (clanSettingsMessage.m_vAllianceDescription.Length < 259 || clanSettingsMessage.m_vAllianceDescription.Length < 0) { if (clanSettingsMessage.m_vAllianceBadgeData < 1 || (long)clanSettingsMessage.m_vAllianceBadgeData < 10000000000L) { if (clanSettingsMessage.m_vAllianceType < 0 || clanSettingsMessage.m_vAllianceType < 10) { if (clanSettingsMessage.m_vRequiredScore < 0 || clanSettingsMessage.m_vRequiredScore < 4201) { if (clanSettingsMessage.m_vWarFrequency < 0 || clanSettingsMessage.m_vWarFrequency < 10) { if (clanSettingsMessage.m_vAllianceOrigin < 0 || clanSettingsMessage.m_vAllianceOrigin < 42000000) { if ((int)clanSettingsMessage.m_vWarAndFriendlyStatus < 0 || (int)clanSettingsMessage.m_vWarAndFriendlyStatus < 5) { alliance.SetAllianceDescription(m_vAllianceDescription); alliance.SetAllianceBadgeData(m_vAllianceBadgeData); alliance.SetAllianceType(m_vAllianceType); alliance.SetRequiredScore(m_vRequiredScore); alliance.SetWarFrequency(m_vWarFrequency); alliance.SetAllianceOrigin(m_vAllianceOrigin); alliance.SetWarAndFriendlytStatus(m_vWarAndFriendlyStatus); ClientAvatar avatar = level.GetPlayerAvatar(); avatar.GetAllianceId(); AllianceEventStreamEntry eventStreamEntry = new AllianceEventStreamEntry(); eventStreamEntry.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds); eventStreamEntry.SetSender(avatar); eventStreamEntry.SetEventType(10); eventStreamEntry.SetAvatarId(avatar.GetId()); eventStreamEntry.SetAvatarName(avatar.GetAvatarName()); eventStreamEntry.SetSenderId(avatar.GetId()); eventStreamEntry.SetSenderName(avatar.GetAvatarName()); alliance.AddChatMessage(eventStreamEntry); AllianceSettingChangedCommand Command = new AllianceSettingChangedCommand(); Command.SetAlliance(alliance); Command.SetPlayer(level); var availableServerCommandMessage = new AvailableServerCommandMessage(level.GetClient()); availableServerCommandMessage.SetCommandId(6); availableServerCommandMessage.SetCommand(Command); availableServerCommandMessage.Send(); foreach (AllianceMemberEntry allianceMember in alliance.GetAllianceMembers()) { Level player = ResourcesManager.GetPlayer(allianceMember.GetAvatarId(), false); if (ResourcesManager.IsPlayerOnline(player)) { var p = new AllianceStreamEntryMessage(player.GetClient()); AllianceEventStreamEntry eventStreamEntry1 = eventStreamEntry; p.SetStreamEntry(eventStreamEntry1); p.Send(); } } List <AllianceMemberEntry> .Enumerator enumerator = new List <AllianceMemberEntry> .Enumerator(); DatabaseManager.Instance.Save(alliance); eventStreamEntry = (AllianceEventStreamEntry)null; } else { ResourcesManager.DisconnectClient(clanSettingsMessage.Client); } } else { ResourcesManager.DisconnectClient(clanSettingsMessage.Client); } } else { ResourcesManager.DisconnectClient(clanSettingsMessage.Client); } } else { ResourcesManager.DisconnectClient(clanSettingsMessage.Client); } } else { ResourcesManager.DisconnectClient(clanSettingsMessage.Client); } } else { ResourcesManager.DisconnectClient(clanSettingsMessage.Client); } } else { ResourcesManager.DisconnectClient(clanSettingsMessage.Client); } } alliance = (Alliance)null; } catch (Exception ex) { } }
public override async void Process(Level level) { try { Alliance a = await ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); StreamEntry stream = a.GetChatMessages().Find(c => c.GetId() == MessageID); Level _Sender = await ResourcesManager.GetPlayer(stream.GetSenderId()); int upcomingspace = stream.m_vDonatedTroop + Troop.GetHousingSpace(); if (upcomingspace <= stream.m_vMaxTroop) { DonateAllianceUnitCommand _Donate = new DonateAllianceUnitCommand(); _Donate.SetMessageID(MessageID); _Donate.Tick(level); _Donate.SetUnit(Troop); DonatedAllianceUnitCommand _Donated = new DonatedAllianceUnitCommand(); _Donated.Tick(_Sender); _Donated.SetDonator(level.GetPlayerAvatar().GetAvatarName()); _Donated.SetUnitID(Troop.GetGlobalID()); _Donated.SetUnitLevel(level.GetPlayerAvatar().GetUnitUpgradeLevel(Troop)); AvailableServerCommandMessage availableServerCommandMessage = new AvailableServerCommandMessage(level.GetClient()); availableServerCommandMessage.SetCommandId(4); availableServerCommandMessage.SetCommand(_Donate); AvailableServerCommandMessage ravailableServerCommandMessage = new AvailableServerCommandMessage(_Sender.GetClient()); ravailableServerCommandMessage.SetCommandId(5); ravailableServerCommandMessage.SetCommand(_Donated); StreamEntry _Stream = a.GetChatMessages().Find(c => c.GetId() == MessageID); Level _PreviousPlayer = await ResourcesManager.GetPlayer(_Stream.GetSenderId()); ClientAvatar _PreviousPlayerAvatar = _PreviousPlayer.GetPlayerAvatar(); _Stream.AddDonatedTroop(level.GetPlayerAvatar().GetId(), Troop.GetGlobalID(), 1, level.GetPlayerAvatar().GetUnitUpgradeLevel(Troop)); int _Capicity = Troop.GetHousingSpace(); _Stream.AddUsedCapicity(_Capicity); _PreviousPlayerAvatar.SetAllianceCastleUsedCapacity(_PreviousPlayerAvatar.GetAllianceCastleUsedCapacity() + _Capicity); _PreviousPlayerAvatar.AddAllianceTroop(level.GetPlayerAvatar().GetId(), Troop.GetGlobalID(), 1, level.GetPlayerAvatar().GetUnitUpgradeLevel(Troop)); //PacketProcessor.Send(availableServerCommandMessage); if (ResourcesManager.IsPlayerOnline(_Sender)) { PacketProcessor.Send(ravailableServerCommandMessage); } foreach (AllianceMemberEntry op in a.GetAllianceMembers()) { Level player = await ResourcesManager.GetPlayer(op.GetAvatarId()); if (player.GetClient() != null) { AllianceStreamEntryMessage c = new AllianceStreamEntryMessage(player.GetClient()); c.SetStreamEntry(_Stream); PacketProcessor.Send(c); } } } } catch (Exception) { } }
public override void Process(Level level) { var avatar = level.GetPlayerAvatar(); var alliance = ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); if (avatar.GetAllianceRole() == 2 && alliance.GetAllianceMembers().Count > 1) { var members = alliance.GetAllianceMembers(); foreach (AllianceMemberEntry player in members.Where(player => player.GetRole() >= 3)) { player.SetRole(2); done = true; break; } if (!done) { var count = alliance.GetAllianceMembers().Count; var rnd = new Random(); var id = rnd.Next(1, count); while (id != level.GetPlayerAvatar().GetId()) { id = rnd.Next(1, count); } var loop = 0; foreach (AllianceMemberEntry player in members) { loop++; if (loop == id) { player.SetRole(2); break; } } } } alliance.RemoveMember(avatar.GetId()); avatar.SetAllianceId(0); if (alliance.GetAllianceMembers().Count > 0) { var eventStreamEntry = new AllianceEventStreamEntry(); eventStreamEntry.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds); eventStreamEntry.SetAvatar(avatar); eventStreamEntry.SetEventType(4); eventStreamEntry.SetAvatarId(avatar.GetId()); eventStreamEntry.SetAvatarName(avatar.GetAvatarName()); alliance.AddChatMessage(eventStreamEntry); foreach (Level onlinePlayer in ResourcesManager.GetOnlinePlayers()) { if (onlinePlayer.GetPlayerAvatar().GetAllianceId() == alliance.GetAllianceId()) { AllianceStreamEntryMessage p = new AllianceStreamEntryMessage(onlinePlayer.GetClient()); p.SetStreamEntry(eventStreamEntry); PacketManager.ProcessOutgoingPacket(p); } } } else { DatabaseManager.Singelton.RemoveAlliance(alliance); } PacketManager.ProcessOutgoingPacket(new LeaveAllianceOkMessage(Client, alliance)); }
public override void Process(Level level) { var target = ResourcesManager.GetPlayer(m_vId); var player = level.GetPlayerAvatar(); var alliance = ObjectManager.GetAlliance(player.GetAllianceId()); if (player.GetAllianceRole() == 2 || player.GetAllianceRole() == 4) { if (player.GetAllianceId() == target.GetPlayerAvatar().GetAllianceId()) { int oldrole = target.GetPlayerAvatar().GetAllianceRole(); target.GetPlayerAvatar().SetAllianceRole(m_vRole); if (m_vRole == 2) { player.SetAllianceRole(4); AllianceEventStreamEntry demote = new AllianceEventStreamEntry(); demote.SetId(alliance.GetChatMessages().Count + 1); demote.SetSender(player); demote.SetEventType(6); demote.SetAvatarId(player.GetId()); demote.SetAvatarName(player.GetAvatarName()); alliance.AddChatMessage(demote); AllianceEventStreamEntry promote = new AllianceEventStreamEntry(); promote.SetId(alliance.GetChatMessages().Count + 1); promote.SetSender(target.GetPlayerAvatar()); promote.SetEventType(5); promote.SetAvatarId(player.GetId()); promote.SetAvatarName(player.GetAvatarName()); alliance.AddChatMessage(promote); PromoteAllianceMemberOkMessage rup = new PromoteAllianceMemberOkMessage(Client); PromoteAllianceMemberOkMessage rub = new PromoteAllianceMemberOkMessage(target.GetClient()); AllianceRoleUpdateCommand p = new AllianceRoleUpdateCommand(); AvailableServerCommandMessage pa = new AvailableServerCommandMessage(Client); AllianceRoleUpdateCommand t = new AllianceRoleUpdateCommand(); AvailableServerCommandMessage ta = new AvailableServerCommandMessage(target.GetClient()); rup.SetID(level.GetPlayerAvatar().GetId()); rup.SetRole(4); rub.SetID(target.GetPlayerAvatar().GetId()); rub.SetRole(2); t.SetAlliance(alliance); p.SetAlliance(alliance); t.SetRole(2); p.SetRole(4); t.Tick(target); p.Tick(level); ta.SetCommandId(8); pa.SetCommandId(8); ta.SetCommand(t); pa.SetCommand(p); if (ResourcesManager.IsPlayerOnline(target)) { ta.Send(); rub.Send(); } rup.Send(); pa.Send(); // New function for send a message foreach (AllianceMemberEntry op in alliance.GetAllianceMembers()) { Level aplayer = ResourcesManager.GetPlayer(op.GetAvatarId()); if (aplayer.GetClient() != null) { AllianceStreamEntryMessage a = new AllianceStreamEntryMessage(aplayer.GetClient()); AllianceStreamEntryMessage b = new AllianceStreamEntryMessage(aplayer.GetClient()); a.SetStreamEntry(demote); b.SetStreamEntry(promote); a.Send(); b.Send(); } } } else { AllianceRoleUpdateCommand t = new AllianceRoleUpdateCommand(); AvailableServerCommandMessage ta = new AvailableServerCommandMessage(target.GetClient()); PromoteAllianceMemberOkMessage ru = new PromoteAllianceMemberOkMessage(target.GetClient()); AllianceEventStreamEntry stream = new AllianceEventStreamEntry(); stream.SetId(alliance.GetChatMessages().Count + 1); stream.SetSender(target.GetPlayerAvatar()); stream.SetAvatarId(player.GetId()); stream.SetAvatarName(player.GetAvatarName()); if (m_vRole > oldrole) { stream.SetEventType(5); } else { stream.SetEventType(6); } t.SetAlliance(alliance); t.SetRole(m_vRole); t.Tick(target); ta.SetCommandId(8); ta.SetCommand(t); ru.SetID(target.GetPlayerAvatar().GetId()); ru.SetRole(m_vRole); alliance.AddChatMessage(stream); if (ResourcesManager.IsPlayerOnline(target)) { ta.Send(); ru.Send(); } // New function for send a message foreach (AllianceMemberEntry op in alliance.GetAllianceMembers()) { Level aplayer = ResourcesManager.GetPlayer(op.GetAvatarId()); if (aplayer.GetClient() != null) { AllianceStreamEntryMessage b = new AllianceStreamEntryMessage(aplayer.GetClient()); b.SetStreamEntry(stream); PacketManager.Send(b); } } } } } }