コード例 #1
0
        public Alliance(AllianceRecord record)
        {
            this.Record = record;
            this.Emblem = new AllianceEmblem(this.Record);

            foreach (var item in Singleton <GuildManager> .Instance.GetGuildsByAlliance(this.Record))
            {
                item.SetAlliance(this);

                this.m_guilds.Add(item.Id, item);

                if (this.Record.Owner == item.Id)
                {
                    this.SetBoss(item);
                }
            }

            if (this.Boss == null)
            {
                if (this.m_guilds.Count == 0)
                {
                }
                else
                {
                    this.SetBoss(this.m_guilds.First().Value);
                }
            }
        }
コード例 #2
0
        private static void BuildDB()
        {
            UserRecord u = new UserRecord();

            u.Drop(); u.Create();
            AllianceRecord a = new AllianceRecord();

            a.Drop(); a.Create();
            PlanetRecord p = new PlanetRecord();

            p.Drop(); p.Create();
            ReportRecord r = new ReportRecord();

            r.Drop(); r.Create();
            ResourceRecord res = new ResourceRecord();

            res.Drop(); res.Create();
            BuildingRecord b = new BuildingRecord();

            b.Drop(); b.Create();
            ResearchRecord re = new ResearchRecord();

            re.Drop(); re.Create();
            FleetRecord f = new FleetRecord();

            f.Drop(); f.Create();
            DefenceRecord d = new DefenceRecord();

            d.Drop(); d.Create();
        }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
        public static void HandleGetAllianceInformations(AllianceInsiderInfoRequestMessage message, WorldClient client)
        {
            AllianceRecord             Alliance = client.Character.GetAlliance();
            AllianceInsiderInfoMessage msg      = AllianceProvider.GetAllianceInsiderInfoMessage(Alliance);

            client.Send(msg);
        }
コード例 #5
0
        public static bool CanCreateAlliance(WorldClient client, AllianceCreationValidMessage message)
        {
            if (!client.Character.HasGuild)
            {
                client.Send(new AllianceCreationResultMessage((sbyte)GuildCreationResultEnum.GUILD_CREATE_ERROR_LEAVE));
                return(false);
            }
            if (client.Character.HasAlliance)
            {
                client.Send(new AllianceCreationResultMessage((sbyte)GuildCreationResultEnum.GUILD_CREATE_ERROR_ALREADY_IN_GUILD));
                return(false);
            }
            if (message.allianceTag.Length < 3 || message.allianceTag.Length > 5)
            {
                client.Send(new AllianceCreationResultMessage((sbyte)GuildCreationResultEnum.GUILD_CREATE_ERROR_REQUIREMENT_UNMET));
                return(false);
            }

            if (AllianceRecord.NameTaked(message.allianceName) || AllianceRecord.TagTaked(message.allianceTag))
            {
                client.Send(new AllianceCreationResultMessage((sbyte)GuildCreationResultEnum.GUILD_CREATE_ERROR_NAME_ALREADY_EXISTS));
                return(false);
            }

            if (GuildRecord.GetGuild(client.Character.GuildId).GetLeader().CharacterId != client.Character.Id)
            {
                client.Send(new AllianceCreationResultMessage((sbyte)GuildCreationResultEnum.GUILD_CREATE_ERROR_REQUIREMENT_UNMET));
                return(false);
            }
            return(true);
        }
コード例 #6
0
 // CONSTRUCTORS
 public AllianceEmblem(AllianceRecord record)
 {
     this.Record = record;
     if (this.SymbolShape != 0)
     {
         this.Template = Singleton <AllianceManager> .Instance.TryGetEmblem((int)this.SymbolShape);
     }
 }
コード例 #7
0
 public IEnumerable <Guild> GetGuildsByAlliance(AllianceRecord alliance)
 {
     lock (this.m_lock)
     {
         return(this.m_guilds.Values
                .Where(entry => entry.Record.AllianceId == alliance.Id));
     }
 }
コード例 #8
0
        public static AllianceRecord CreateAlliance(GuildRecord creator, string tag, string name, GuildEmblem emblem)
        {
            AllianceRecord Alliance = new AllianceRecord(AllianceRecord.PopNextId(), name, tag, emblem.symbolColor, emblem.symbolShape, emblem.backgroundShape, emblem.backgroundColor, creator.Id);

            Alliance.AddElement();
            JoinAlliance(creator, Alliance, null);
            return(Alliance);
        }
コード例 #9
0
 public void LeaveGuild(Character character)
 {
     CharacterGuildRecord.GetCharacterGuild(character.Id).RemoveElement();
     character.HumanOptions.RemoveAll(x => x is HumanOptionGuild);
     character.Client.Send(new GuildLeftMessage());
     AllianceRecord.OnCharacterLeftAlliance(character);
     character.RefreshOnMapInstance();
     character.ForgetEmote(GuildProvider.EMOTE_ID);
 }
コード例 #10
0
        public static void LeaveAlliance(int guildId)
        {
            GuildAllianceRecord         AllianceMember = GuildAllianceRecord.GuildsAlliances.Find(x => x.GuildId == guildId);
            List <CharacterGuildRecord> guildMembers   = CharacterGuildRecord.CharactersGuilds.FindAll(x => x.GuildId == guildId);

            foreach (CharacterGuildRecord guildMember in guildMembers)
            {
                Character record = WorldServer.Instance.GetOnlineClient(guildMember.CharacterId).Character;
                AllianceRecord.OnCharacterLeftAlliance(record);
            }
            AllianceMember.RemoveElement();
        }
コード例 #11
0
        public static void DeleteAlliance(int id)
        {
            AllianceRecord             Alliance        = AllianceProvider.GetAlliance(id);
            List <GuildAllianceRecord> AllianceMembers = GuildAllianceRecord.GuildsAlliances.FindAll(x => x.AllianceId == id);

            foreach (GuildAllianceRecord member in AllianceMembers)
            {
                LeaveAlliance(member.GuildId);
                member.RemoveElement();
            }
            Alliance.RemoveElement();
        }
コード例 #12
0
        public static void JoinAlliance(GuildRecord Guild, AllianceRecord Alliance, WorldClient Inviter = null)
        {
            GuildAllianceRecord Gmember = new GuildAllianceRecord(Guild.Id, Alliance.Id);

            Gmember.AddElement();
            if (Inviter != null)
            {
                Inviter.Send(new AllianceInvitationAnswerMessage(true));
            }
            foreach (CharacterGuildRecord member in CharacterGuildRecord.CharactersGuilds.FindAll(x => x.GuildId == Guild.Id))
            {
                AllianceRecord.OnCharacterJoinAlliance(CharacterRecord.GetCharacterRecordById(member.CharacterId), Alliance);
            }
        }
コード例 #13
0
        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)));
            }
        }
コード例 #14
0
ファイル: Character.cs プロジェクト: leonardo-spy/Symbioz
 public AllianceRecord GetAlliance()
 {
     return(HasAlliance ? AllianceRecord.GetAlliance(AllianceId) : null);
 }
コード例 #15
0
 public static AllianceInsiderInfoMessage GetAllianceInsiderInfoMessage(AllianceRecord alliance)
 {
     return(new AllianceInsiderInfoMessage(new DofusProtocol.Types.AllianceFactSheetInformations((uint)alliance.Id, alliance.Tag, alliance.Name, new DofusProtocol.Types.GuildEmblem(alliance.SymbolShape, alliance.SymbolColor, alliance.BackgroundShape, alliance.BackgroundColor), DateTime.Now.Second), AllianceProvider.GetGuildsInsiderFactSheetInformations(alliance.Id), (IEnumerable <PrismSubareaEmptyInfo>) new List <PrismSubareaEmptyInfo>()));
 }
コード例 #16
0
        public static GuildRecord GetLeader(int allianceId)
        {
            AllianceRecord alliance = GetAlliance(allianceId);

            return(GuildRecord.GetGuild(alliance.LeaderGuildId));
        }