Exemplo n.º 1
0
 public static void CreateAllianceCommand(string value, WorldClient client)
 {
     if (!client.Character.HasGuild)
     {
         client.Send(new AllianceCreationResultMessage((sbyte)GuildCreationResultEnum.GUILD_CREATE_ERROR_REQUIREMENT_UNMET));
     }
     if (!client.Character.HasAlliance)
     {
         client.Send(new AllianceCreationStartedMessage());
     }
     else if (GuildProvider.GetLeader(client.Character.GuildId).CharacterId != client.Character.Id)
     {
         client.Send(new AllianceCreationResultMessage((sbyte)GuildCreationResultEnum.GUILD_CREATE_ERROR_REQUIREMENT_UNMET));
     }
     else if (client.Character.HasAlliance)
     {
         client.Send(new AllianceCreationResultMessage((sbyte)GuildCreationResultEnum.GUILD_CREATE_ERROR_ALREADY_IN_GUILD));
     }
 }
 public static void HandleAllianceKickRequest(AllianceKickRequestMessage message, WorldClient client)
 {
     if (client.Character.HasAlliance && AllianceProvider.GetLeader(client.Character.AllianceId).Id == client.Character.GuildId && GuildProvider.GetLeader(client.Character.GuildId).CharacterId == client.Character.Id)
     {
         AllianceRecord.GetAlliance(client.Character.AllianceId).KickFromAlliance((int)message.kickedId, client);
     }
 }
        public static void HandleGetGuildInFactRequest(GuildFactsRequestMessage message, WorldClient client)
        {
            GuildRecord guild = GuildRecord.GetGuild((int)message.guildId);

            if (guild == null)
            {
                return;
            }
            AllianceRecord alliance = AllianceProvider.GetAllianceFromGuild(guild.Id);
            List <CharacterMinimalInformations> membersMinimalInfos = new List <CharacterMinimalInformations>();

            foreach (GuildMember member in CharacterGuildRecord.GetMembers(guild.Id))
            {
                membersMinimalInfos.Add(new CharacterMinimalInformations(member.id, member.level, member.name));
            }
            if (alliance == null)
            {
                client.Send(new GuildFactsMessage(new GuildFactSheetInformations((uint)guild.Id, guild.Name, guild.GetEmblemObject(), (uint)GuildProvider.GetLeader(guild.Id).CharacterId, (byte)guild.Level, (ushort)CharacterGuildRecord.GetMembers(guild.Id).Count()), 0, 0, true, (IEnumerable <CharacterMinimalInformations>)membersMinimalInfos));
            }
            else
            {
                client.Send(new GuildInAllianceFactsMessage(new GuildFactSheetInformations((uint)guild.Id, guild.Name, guild.GetEmblemObject(), (uint)GuildProvider.GetLeader(guild.Id).CharacterId, (byte)guild.Level, (ushort)CharacterGuildRecord.GetMembers(guild.Id).Count()), 0, 0, true, (IEnumerable <CharacterMinimalInformations>)membersMinimalInfos, new BasicNamedAllianceInformations((uint)alliance.Id, alliance.Tag, alliance.Name)));
            }
        }