/// <summary>
        /// Retrieve the guild object for the given guild group.
        /// </summary>
        /// <param name="guildGroup"></param>
        /// <param name="buildingFactionId">Specify this to ensure only the temple of matching Divine is returned</param>
        /// <returns>IGuild object</returns>
        public IGuild GetGuild(FactionFile.GuildGroups guildGroup, int buildingFactionId = 0)
        {
            IGuild guild;

            memberships.TryGetValue(guildGroup, out guild);

            if (guildGroup == FactionFile.GuildGroups.HolyOrder && buildingFactionId > 0)
            {
                if (guild != null)
                {
                    Temple.Divines deity  = Temple.GetDivine(buildingFactionId);
                    Temple         temple = (Temple)guild;
                    if (temple.Deity == deity)
                    {
                        return(guild);
                    }
                }
                return(templeNotMember);
            }
            else if (guildGroup == FactionFile.GuildGroups.KnightlyOrder && buildingFactionId > 0)
            {
                if (guild != null)
                {
                    KnightlyOrder.Orders order         = KnightlyOrder.GetOrder(buildingFactionId);
                    KnightlyOrder        knightlyOrder = (KnightlyOrder)guild;
                    if (knightlyOrder.Order == order)
                    {
                        return(guild);
                    }
                }
                return(guildNotMember);
            }
            return((guild != null) ? guild : guildNotMember);
        }
        private IGuild CreateGuildObj(FactionFile.GuildGroups guildGroup, int variant = 0)
        {
            Type guildType;

            if (customGuilds.TryGetValue(guildGroup, out guildType))
            {
                return((IGuild)Activator.CreateInstance(guildType));
            }
            else
            {
                switch (guildGroup)
                {
                case FactionFile.GuildGroups.FightersGuild:
                    return(new FightersGuild());

                case FactionFile.GuildGroups.MagesGuild:
                    return(new MagesGuild());

                case FactionFile.GuildGroups.HolyOrder:
                    return(new Temple(Temple.GetDivine(variant)));

                case FactionFile.GuildGroups.KnightlyOrder:
                    return(new KnightlyOrder(KnightlyOrder.GetOrder(variant)));

                case FactionFile.GuildGroups.GeneralPopulace:
                    return(new ThievesGuild());

                case FactionFile.GuildGroups.DarkBrotherHood:
                    return(new DarkBrotherhood());

                default:
                    return(null);
                }
            }
        }
Exemple #3
0
 public OrderMacroDataSource(KnightlyOrder guild) : base(guild)
 {
     parent = guild;
 }