public override void Process(Level level) { //Clan creation var alliance = ObjectManager.CreateAlliance(0); alliance.SetAllianceName(m_vAllianceName); alliance.SetAllianceDescription(m_vAllianceDescription); alliance.SetAllianceType(m_vAllianceType); alliance.SetRequiredScore(m_vRequiredScore); alliance.SetAllianceBadgeData(m_vAllianceBadgeData); alliance.SetAllianceOrigin(m_vAllianceOrigin); alliance.SetWarFrequency(m_vWarFrequency); //Set player clan //ObjectManager.OnlinePlayers.TryGetValue(p.Client, out player); level.GetPlayerAvatar().SetAllianceId(alliance.GetAllianceId()); var member = new AllianceMemberEntry(level.GetPlayerAvatar().GetId()); member.SetRole(2); alliance.AddAllianceMember(member); var joinAllianceCommand = new JoinAllianceCommand(); joinAllianceCommand.SetAlliance(alliance); var availableServerCommandMessage = new AvailableServerCommandMessage(Client); availableServerCommandMessage.SetCommandId(1); availableServerCommandMessage.SetCommand(joinAllianceCommand); PacketManager.ProcessOutgoingPacket(availableServerCommandMessage); PacketManager.ProcessOutgoingPacket(new OwnHomeDataMessage(Client, level)); // Necessary to display the "Customize" Button. }
public override void Process(Level level) { var alliance = ObjectManager.CreateAlliance(0); alliance.SetAllianceName(m_vAllianceName); alliance.SetAllianceDescription(m_vAllianceDescription); alliance.SetAllianceType(m_vAllianceType); alliance.SetRequiredScore(m_vRequiredScore); alliance.SetAllianceBadgeData(m_vAllianceBadgeData); alliance.SetAllianceOrigin(m_vAllianceOrigin); alliance.SetWarFrequency(m_vWarFrequency); alliance.SetWarPublicStatus(m_vWarLogPublic); level.GetPlayerAvatar().SetAllianceId(alliance.GetAllianceId()); var member = new AllianceMemberEntry(level.GetPlayerAvatar().GetId()); member.SetRole(2); alliance.AddAllianceMember(member); var b = new JoinAllianceCommand(); b.SetAlliance(alliance); var a = new AvailableServerCommandMessage(Client); a.SetCommandId(1); a.SetCommand(b); PacketManager.ProcessOutgoingPacket(a); PacketManager.ProcessOutgoingPacket(new OwnHomeDataMessage(Client, level)); PacketManager.ProcessOutgoingPacket(new AllianceStreamMessage(Client, alliance)); PacketManager.ProcessOutgoingPacket(new AllianceFullEntryMessage(Client, alliance)); }
public override void Process(Level level) { var alliance = ObjectManager.GetAlliance(m_vAllianceId); if (alliance != null) { if (!alliance.IsAllianceFull()) { level.GetPlayerAvatar().SetAllianceId(alliance.GetAllianceId()); var member = new AllianceMemberEntry(level.GetPlayerAvatar().GetId()); member.SetRole(1); alliance.AddAllianceMember(member); var joinAllianceCommand = new JoinAllianceCommand(); joinAllianceCommand.SetAlliance(alliance); var availableServerCommandMessage = new AvailableServerCommandMessage(Client); availableServerCommandMessage.SetCommandId(8); availableServerCommandMessage.SetCommand(joinAllianceCommand); PacketManager.ProcessOutgoingPacket(availableServerCommandMessage); PacketManager.ProcessOutgoingPacket(new OwnHomeDataMessage(Client, level)); PacketManager.ProcessOutgoingPacket(new AllianceStreamMessage(Client, alliance)); PacketManager.ProcessOutgoingPacket(new AllianceFullEntryMessage(Client, alliance)); } } }
public override void Process(Level level) { if (m_vAllianceName == null) { m_vAllianceName = "Clan"; } var alliance = ObjectManager.CreateAlliance(0); alliance.SetAllianceName(m_vAllianceName); alliance.SetAllianceDescription(m_vAllianceDescription); alliance.SetAllianceType(m_vAllianceType); alliance.SetRequiredScore(m_vRequiredScore); alliance.SetAllianceBadgeData(m_vAllianceBadgeData); alliance.SetAllianceOrigin(m_vAllianceOrigin); alliance.SetWarFrequency(m_vWarFrequency); alliance.SetWarAndFriendlytStatus(m_vWarAndFriendlyStatus); level.GetPlayerAvatar().SetAllianceId(alliance.GetAllianceId()); var member = new AllianceMemberEntry(level.GetPlayerAvatar().GetId()); member.SetRole(2); alliance.AddAllianceMember(member); var b = new JoinedAllianceCommand(); b.SetAlliance(alliance); var d = new AllianceRoleUpdateCommand(); d.SetAlliance(alliance); d.SetRole(2); d.Tick(level); var a = new AvailableServerCommandMessage(Client); a.SetCommandId(1); a.SetCommand(b); var c = new AvailableServerCommandMessage(Client); c.SetCommandId(8); c.SetCommand(d); a.Send(); c.Send(); }
public override void Process(Level level) { var alliance = ObjectManager.GetAlliance(m_vAllianceId); if (alliance == null || alliance.IsAllianceFull()) { return; } level.GetPlayerAvatar().SetAllianceId(alliance.GetAllianceId()); var entry = new AllianceMemberEntry(level.GetPlayerAvatar().GetId()); entry.SetRole(1); alliance.AddAllianceMember(entry); var jaCommand = new JoinedAllianceCommand(); jaCommand.SetAlliance(alliance); var aruCommand = new AllianceRoleUpdateCommand(); aruCommand.SetAlliance(alliance); aruCommand.SetRole(1); aruCommand.Tick(level); var asCommand1 = new AvailableServerCommandMessage(Client); asCommand1.SetCommandId(1); asCommand1.SetCommand(jaCommand); var asCommand2 = new AvailableServerCommandMessage(Client); asCommand2.SetCommandId(8); asCommand2.SetCommand(aruCommand); asCommand1.Send(); asCommand2.Send(); new AllianceStreamMessage(Client, alliance).Send(); }
public override async void Process(Level level) { try { Alliance alliance = await ObjectManager.GetAlliance(m_vAllianceId); if (alliance != null) { if (!alliance.IsAllianceFull()) { level.GetPlayerAvatar().SetAllianceId(alliance.GetAllianceId()); AllianceMemberEntry member = new AllianceMemberEntry(level.GetPlayerAvatar().GetId()); member.SetRole(1); alliance.AddAllianceMember(member); JoinedAllianceCommand b = new JoinedAllianceCommand(); b.SetAlliance(alliance); AllianceRoleUpdateCommand c = new AllianceRoleUpdateCommand(); c.SetAlliance(alliance); c.SetRole(1); c.Tick(level); AvailableServerCommandMessage a = new AvailableServerCommandMessage(Client); a.SetCommandId(1); a.SetCommand(b); AvailableServerCommandMessage d = new AvailableServerCommandMessage(Client); d.SetCommandId(8); d.SetCommand(c); PacketProcessor.Send(a); PacketProcessor.Send(d); PacketProcessor.Send(new AllianceStreamMessage(Client, alliance)); } } } catch (Exception) { } }
public override void Process(Level level) { var alliance = ObjectManager.GetAlliance(m_vAllianceId); if (alliance != null) { if (!alliance.IsAllianceFull()) { level.GetPlayerAvatar().SetAllianceId(alliance.GetAllianceId()); var member = new AllianceMemberEntry(level.GetPlayerAvatar().GetId()); member.SetRole(1); alliance.AddAllianceMember(member); var b = new JoinedAllianceCommand(); b.SetAlliance(alliance); var c = new AllianceRoleUpdateCommand(); c.SetAlliance(alliance); c.SetRole(1); c.Tick(level); var a = new AvailableServerCommandMessage(Client); a.SetCommandId(1); a.SetCommand(b); var d = new AvailableServerCommandMessage(Client); d.SetCommandId(8); d.SetCommand(c); a.Send(); d.Send(); new AllianceStreamMessage(Client, alliance).Send(); } } }
public override void Process(Level level) { if (m_vAllianceName == null) { m_vAllianceName = "Clan"; } if (m_vAllianceName.Length < 16 || m_vAllianceName.Length < 1) { if (m_vAllianceDescription.Length < 259 || m_vAllianceDescription.Length < 0) { if (m_vAllianceBadgeData < 1 || (long)m_vAllianceBadgeData < 10000000000L) { 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 ((int)m_vWarAndFriendlyStatus < 0 || (int)m_vWarAndFriendlyStatus < 5) { Alliance alliance = ObjectManager.CreateAlliance(); alliance.SetAllianceName(m_vAllianceName); alliance.SetAllianceDescription(m_vAllianceDescription); alliance.SetAllianceType(m_vAllianceType); alliance.SetRequiredScore(m_vRequiredScore); alliance.SetAllianceBadgeData(m_vAllianceBadgeData); alliance.SetAllianceOrigin(m_vAllianceOrigin); alliance.SetWarFrequency(m_vWarFrequency); alliance.SetWarAndFriendlytStatus(m_vWarAndFriendlyStatus); level.GetPlayerAvatar().SetAllianceId(alliance.GetAllianceId()); AllianceMemberEntry entry = new AllianceMemberEntry(level.GetPlayerAvatar().GetId()); entry.SetRole(2); alliance.AddAllianceMember(entry); JoinedAllianceCommand Command1 = new JoinedAllianceCommand(); Command1.SetAlliance(alliance); AllianceRoleUpdateCommand Command2 = new AllianceRoleUpdateCommand(); Command2.SetAlliance(alliance); Command2.SetRole(2); Command2.Tick(level); var a = new AvailableServerCommandMessage(Client); a.SetCommandId(1); a.SetCommand(Command1); var c = new AvailableServerCommandMessage(Client); c.SetCommandId(8); c.SetCommand(Command2); a.Send(); c.Send(); } 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); } } else { ResourcesManager.DisconnectClient(Client); } }
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) { } }