public override void Process(Level level) { var avatar = level.GetPlayerAvatar(); var allianceId = avatar.GetAllianceId(); if (allianceId > 0) { ChatStreamEntry cm = new ChatStreamEntry(); cm.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds); cm.SetAvatar(avatar); cm.SetMessage(m_vChatMessage); Alliance 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 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(); if (allianceId > 0) { var cm = new ChatStreamEntry(); cm.SetId((int)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds); cm.SetSenderId(0); cm.SetHomeId(0); cm.SetSenderLeagueId(22); cm.SetSenderName("System Manager"); cm.SetSenderRole(2); cm.SetMessage("Clan settings updated!"); var alliance1 = ObjectManager.GetAlliance(allianceId); if (alliance != null) { alliance1.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); PacketManager.ProcessOutgoingPacket(new OwnHomeDataMessage(Client, level)); PacketManager.ProcessOutgoingPacket(new AllianceDataMessage(Client, alliance)); } } } } } }
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()); 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 void Process(Level level) { var avatar = level.GetPlayerAvatar(); var alliance = ObjectManager.GetAlliance(level.GetPlayerAvatar().GetAllianceId()); if (avatar.GetAllianceRole() == 2 && alliance.GetAllianceMembers().Count != 0) { var members = alliance.GetAllianceMembers(); foreach (var 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 (var 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 (var onlinePlayer in ResourcesManager.GetOnlinePlayers()) { if (onlinePlayer.GetPlayerAvatar().GetAllianceId() == alliance.GetAllianceId()) { var p = new AllianceStreamEntryMessage(onlinePlayer.GetClient()); p.SetStreamEntry(eventStreamEntry); PacketManager.ProcessOutgoingPacket(p); } } } else { DatabaseManager.Singelton.RemoveAlliance(alliance); } PacketManager.ProcessOutgoingPacket(new LeaveAllianceOkMessage(Client, alliance)); DatabaseManager.Singelton.Save(level); }
//00 00 02 24 20 41 6A 6B 00 00 00 01 00 00 02 1F //00 00 00 17 00 9E 81 01 //01 //00 00 00 33 //44 C3 A9 73 6F 6C C3 A9 2C 20 6E 6F 75 73 20 61 76 6F 6E 73 20 64 C3 A9 63 69 64 C3 A9 20 64 65 20 74 27 65 78 63 6C 75 72 65 20 64 75 20 63 6C 61 6E 2E //00 00 01 E6 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); //Now sending messages 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); } } } } } }
//00 00 02 24 20 41 6A 6B 00 00 00 01 00 00 02 1F //00 00 00 17 00 9E 81 01 //01 //00 00 00 33 //44 C3 A9 73 6F 6C C3 A9 2C 20 6E 6F 75 73 20 61 76 6F 6E 73 20 64 C3 A9 63 69 64 C3 A9 20 64 65 20 74 27 65 78 63 6C 75 72 65 20 64 75 20 63 6C 61 6E 2E //00 00 01 E6 public override void Execute(Level level) { Level 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) { Alliance 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); //Now sending messages 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); AllianceKickOutStreamEntry 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); } AllianceEventStreamEntry 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); } } } } } }