예제 #1
0
        string GetNamePart(RaceId race, int index)
        {
            var path      = $"country_{race}_{index}";
            var nameParts = Content.ResourceManager.GetString(path).Split(";");

            return(RandUtils.GetItem(nameParts));
        }
예제 #2
0
        public void Load(BinaryReader f)
        {
            id   = f.ReadInt32();
            name = f.ReadString();
            RaceId race_id = (RaceId)f.ReadInt32();

            race = Race.Get(race_id);
            ClassId class_id = (ClassId)f.ReadInt32();

            clas             = Class.Get(class_id);
            level            = f.ReadInt32();
            exp              = f.ReadInt32();
            exp_need         = 100 * level;
            str              = f.ReadInt32();
            dex              = f.ReadInt32();
            end              = f.ReadInt32();
            hp               = f.ReadInt32();
            hpmax            = CalculateMaxHp();
            weapon           = f.ReadInt32();
            armor            = f.ReadInt32();
            bow              = f.ReadInt32();
            gold             = f.ReadInt32();
            potions          = f.ReadInt32();
            age              = f.ReadInt32();
            kills            = f.ReadInt32();
            dungeon_level    = f.ReadInt32();
            lowest_level     = f.ReadInt32();
            target_level     = f.ReadInt32();
            know_down_stairs = f.ReadBoolean();
            immortal         = f.ReadBoolean();
        }
예제 #3
0
파일: Run.cs 프로젝트: at-besa/hurace
        public int CompareTo(Run other)
        {
            if (ReferenceEquals(this, other))
            {
                return(0);
            }
            if (ReferenceEquals(null, other))
            {
                return(1);
            }
            var raceIdComparison = RaceId.CompareTo(other.RaceId);

            if (raceIdComparison != 0)
            {
                return(raceIdComparison);
            }
            var runNoComparison = RunNo.CompareTo(other.RunNo);

            if (runNoComparison != 0)
            {
                return(runNoComparison);
            }
            var runningComparison = Running.CompareTo(other.Running);

            if (runningComparison != 0)
            {
                return(runningComparison);
            }
            return(Finished.CompareTo(other.Finished));
        }
예제 #4
0
        internal override string ToTimelineString()
        {
            var timelinestring = base.ToTimelineString();
            var racetext       = Race?.ToString().ToLower() ?? RaceId?.ToString() ?? "";

            return($"{timelinestring} {PopNumberMoved} {racetext} joined with {Entity}.");
        }
예제 #5
0
        /// <summary>
        /// Creates a new Corpse for the given owner
        /// </summary>
        /// <param name="owner">The owner of this Corpse</param>
        /// <param name="pos">The position where the Corpse should appear</param>
        /// <param name="orientation">Orientation of the corpse</param>
        /// <param name="displayId">The displayid of the corpse</param>
        /// <param name="face">Face value</param>
        /// <param name="skin">Skin value</param>
        /// <param name="hairStyle">Hairstyle</param>
        /// <param name="hairColor">Haircolor</param>
        /// <param name="facialHair">Facial hair (beard)</param>
        /// <param name="guildId">The guild to which the owner of the corpse belongs</param>
        /// <param name="gender">Gender of the owner</param>
        /// <param name="race">Race of the owner</param>
        /// <param name="flags">Flags (only skeleton or full corpse)</param>
        /// <param name="dynFlags">Dynamic flags (is it lootable?)</param>
        public Corpse(Character owner, Vector3 pos, float orientation, uint displayId,
                      byte face,
                      byte skin,
                      byte hairStyle,
                      byte hairColor,
                      byte facialHair,
                      uint guildId,
                      GenderType gender,
                      RaceId race,
                      CorpseFlags flags,
                      CorpseDynamicFlags dynFlags)
        {
            EntityId  = EntityId.GetCorpseId((uint)Interlocked.Increment(ref lastUID));
            DisplayId = displayId;
            Owner     = owner;
            Type     |= ObjectTypes.Corpse;
            ScaleX    = 1;

            m_position    = pos;
            m_orientation = orientation;

            Face         = face;
            Skin         = skin;
            HairStyle    = hairStyle;
            HairColor    = hairColor;
            FacialHair   = facialHair;
            GuildId      = guildId;
            Gender       = gender;
            Race         = race;
            Flags        = flags;
            DynamicFlags = dynFlags;
        }
예제 #6
0
        public override void Convert(byte[] rawData)
        {
            uint       uint32    = DBCRecordConverter.GetUInt32(rawData, 1);
            RaceId     race      = (RaceId)((int)uint32 & (int)byte.MaxValue);
            ClassId    clssId    = (ClassId)((uint32 & 65280U) >> 8);
            GenderType gender    = (GenderType)((uint32 & 16711680U) >> 16);
            Archetype  archetype = ArchetypeMgr.GetArchetype(race, clssId);

            if (archetype == null)
            {
                return;
            }
            List <ItemStack> initialItems = archetype.GetInitialItems(gender);

            for (int field = 2; field <= 25; ++field)
            {
                int itemId = DBCRecordConverter.GetInt32(rawData, field);
                if (itemId > 0)
                {
                    ItemTemplate template = ItemMgr.GetTemplate((Asda2ItemId)itemId);
                    if (template == null)
                    {
                        LogManager.GetCurrentClassLogger()
                        .Warn("Missing initial Item in DB: " + (object)itemId + " (" + (object)(uint)itemId +
                              ")");
                    }
                    else if (template.IsStackable)
                    {
                        int index = initialItems.FindIndex((Predicate <ItemStack>)(stack =>
                                                                                   (long)stack.Template.Id == (long)itemId));
                        if (index > -1)
                        {
                            initialItems[index] = new ItemStack()
                            {
                                Template = template,
                                Amount   = initialItems[index].Amount + 1
                            }
                        }
                        ;
                        else
                        {
                            initialItems.Add(new ItemStack()
                            {
                                Template = template,
                                Amount   = template.IsAmmo ? template.MaxAmount : 1
                            });
                        }
                    }
                    else
                    {
                        initialItems.Add(new ItemStack()
                        {
                            Template = template,
                            Amount   = 1
                        });
                    }
                }
            }
        }
예제 #7
0
 public static Faction Get(RaceId race)
 {
     if ((uint)race >= ByRace.Length)
     {
         return(null);
     }
     return(ByRace[(uint)race]);
 }
예제 #8
0
 /// <summary>Returns the Race with the given type</summary>
 public static BaseRace GetRace(RaceId id)
 {
     if ((uint)id < BaseRaces.Length)
     {
         return(BaseRaces[(uint)id]);
     }
     return(null);
 }
예제 #9
0
 public static Archetype GetArchetype(RaceId race, ClassId clssId)
 {
     if (clssId >= (ClassId)WCellConstants.ClassTypeLength || (uint)race >= WCellConstants.RaceTypeLength)
     {
         return((Archetype)null);
     }
     return(ArchetypeMgr.Archetypes[(uint)clssId]?[(uint)race]);
 }
예제 #10
0
 /// <summary>Returns the Race with the given type</summary>
 public static BaseRace GetRace(RaceId id)
 {
     if ((long)(uint)id < (long)ArchetypeMgr.BaseRaces.Length)
     {
         return(ArchetypeMgr.BaseRaces[(uint)id]);
     }
     return((BaseRace)null);
 }
예제 #11
0
    public string GetRaceEnumName(RaceId race)
    {
        if (statEnum.TryGetValue(2000 + (int)race, out var line))
        {
            return(line);
        }

        return(null);
    }
예제 #12
0
 public static Archetype GetArchetype(RaceId race, ClassId clssId)
 {
     if ((uint)clssId >= WCellConstants.ClassTypeLength || (uint)race >= WCellConstants.RaceTypeLength)
     {
         return null;
     }
     var clss = Archetypes[(uint)clssId];
     return clss != null ? clss[(uint)race] : null;
 }
예제 #13
0
        public static Archetype GetArchetype(RaceId race, ClassId clssId)
        {
            if ((uint)clssId >= WCellConstants.ClassTypeLength || (uint)race >= WCellConstants.RaceTypeLength)
            {
                return(null);
            }
            var clss = Archetypes[(uint)clssId];

            return(clss != null ? clss[(uint)race] : null);
        }
예제 #14
0
 /// <summary>
 /// Returns the corresponding <see cref="Archetype"/>.
 /// </summary>
 /// <exception cref="NullReferenceException">If Archetype does not exist</exception>
 public static Archetype GetArchetypeNotNull(RaceId race, ClassId clss)
 {
     Archetype type;
     if ((uint)clss >= WCellConstants.ClassTypeLength || (uint)race >= WCellConstants.RaceTypeLength ||
         ((type = Archetypes[(uint)clss][(uint)race]) == null))
     {
         throw new ArgumentException(string.Format("Archetype \"{0} {1}\" does not exist.", race, clss));
     }
     return type;
 }
예제 #15
0
 string GenerateUniqueName(RaceId race)
 {
     do
     {
         var name = GetNamePart(race, 0) + GetNamePart(race, 1) + GetNamePart(race, 2);
         if (Countries.Find(c => c.Name == name) == null)
         {
             return(name);
         }
     } while (true);
 }
예제 #16
0
        /// <summary>
        /// Returns the corresponding <see cref="Archetype"/>.
        /// </summary>
        /// <exception cref="NullReferenceException">If Archetype does not exist</exception>
        public static Archetype GetArchetypeNotNull(RaceId race, ClassId clss)
        {
            Archetype type;

            if ((uint)clss >= WCellConstants.ClassTypeLength || (uint)race >= WCellConstants.RaceTypeLength ||
                ((type = Archetypes[(uint)clss][(uint)race]) == null))
            {
                throw new ArgumentException(string.Format("Archetype \"{0} {1}\" does not exist.", race, clss));
            }
            return(type);
        }
예제 #17
0
 public string GetRaceShortDesc(RaceId race)
 {
     if ((int)race <= VANILLA_NUM_RACES)
     {
         return(statMes[12000 + (int)race]);
     }
     else
     {
         return(statMesExt[12000 + (int)race]);
     }
 }
예제 #18
0
        /// <summary>
        /// Returns all archetypes with the given race/class combination.
        /// 0 for race or class means all.
        /// </summary>
        /// <returns></returns>
        public static List <Archetype> GetArchetypes(RaceId race, ClassId clss)
        {
            if (clss >= (ClassId)WCellConstants.ClassTypeLength || (uint)race >= WCellConstants.RaceTypeLength)
            {
                return((List <Archetype>)null);
            }
            List <Archetype> archetypeList = new List <Archetype>();

            if (clss == ClassId.NoClass)
            {
                foreach (Archetype[] archetype1 in ArchetypeMgr.Archetypes)
                {
                    if (archetype1 != null)
                    {
                        if (race == RaceId.None)
                        {
                            foreach (Archetype archetype2 in archetype1)
                            {
                                if (archetype2 != null)
                                {
                                    archetypeList.Add(archetype2);
                                }
                            }
                        }
                        else if (archetype1[(uint)race] != null)
                        {
                            archetypeList.Add(archetype1[(uint)race]);
                        }
                    }
                }
            }
            else if (race == RaceId.None)
            {
                foreach (Archetype archetype in ArchetypeMgr.Archetypes[(uint)clss])
                {
                    if (archetype != null)
                    {
                        archetypeList.Add(archetype);
                    }
                }
            }
            else if (ArchetypeMgr.Archetypes[(uint)clss][(uint)race] != null)
            {
                archetypeList.Add(ArchetypeMgr.Archetypes[(uint)clss][(uint)race]);
            }

            if (archetypeList.Count == 0)
            {
                return((List <Archetype>)null);
            }
            return(archetypeList);
        }
예제 #19
0
    public string GetRaceName(RaceId race)
    {
        if (statMesExt.TryGetValue(2000 + (int)race, out var line))
        {
            return(line);
        }

        if (statMes.TryGetValue(2000 + (int)race, out line))
        {
            return(line);
        }

        return(null);
    }
예제 #20
0
 /// <summary>
 /// Adds all skills of that race/class combination with max value
 /// </summary>
 /// <param name="learnAbilities">Whether to also learn all abilities, related to the given skills.</param>
 public void LearnAll(RaceId race, ClassId clss, bool learnAbilities)
 {
     foreach (var info in SkillHandler.RaceClassInfos[(int)race][(int)clss].Values)
     {
         var skill = GetOrCreate(info.SkillLine.Id, true);
         if (skill != null)
         {
             skill.LearnMax();
             if (learnAbilities)
             {
                 skill.LearnAllAbilities();
             }
         }
     }
 }
예제 #21
0
파일: RaceData.cs 프로젝트: at-besa/hurace
        public int CompareTo(RaceData other)
        {
            if (ReferenceEquals(this, other))
            {
                return(0);
            }
            if (ReferenceEquals(null, other))
            {
                return(1);
            }
            var idComparison = Id.CompareTo(other.Id);

            if (idComparison != 0)
            {
                return(idComparison);
            }
            var raceIdComparison = RaceId.CompareTo(other.RaceId);

            if (raceIdComparison != 0)
            {
                return(raceIdComparison);
            }
            var skierIdComparison = SkierId.CompareTo(other.SkierId);

            if (skierIdComparison != 0)
            {
                return(skierIdComparison);
            }
            var disqualifiedComparison = Disqualified.CompareTo(other.Disqualified);

            if (disqualifiedComparison != 0)
            {
                return(disqualifiedComparison);
            }
            var runningComparison = Running.CompareTo(other.Running);

            if (runningComparison != 0)
            {
                return(runningComparison);
            }
            var blockedComparison = Blocked.CompareTo(other.Blocked);

            if (blockedComparison != 0)
            {
                return(blockedComparison);
            }
            return(Finished.CompareTo(other.Finished));
        }
예제 #22
0
        /// <summary>
        /// Gets an enumerator of characters based on their race.
        /// </summary>
        /// <param name="entRace">the race to search for</param>
        /// <returns>a list of <see cref="Character" /> objects belonging to the given race</returns>
        public static ICollection <Character> GetCharactersOfRace(RaceId entRace)
        {
            var list = new List <Character>(s_namedEntities.Count);

            using (worldLock.EnterReadLock())
            {
                foreach (INamedEntity chr in s_namedEntities.Values)
                {
                    if (chr is Character && ((Character)chr).Race == entRace)
                    {
                        list.Add((Character)chr);
                    }
                }
            }
            return(list);
        }
예제 #23
0
        protected override string LegendsDescription()
        {
            var timestring = base.LegendsDescription();

            var count = PopNumberMoved.ToString();

            if (PopNumberMoved >= 24)
            {
                count = "dozens";
            }


            var racetext = Race?.ToString().ToLower() ?? RaceId?.ToString() ?? "";


            return($"{timestring} {count} of {racetext} from {Region} joined with the {Entity} at {Site.AltName}.");
        }
예제 #24
0
        internal override void Export(string table)
        {
            base.Export(table);

            table = GetType().Name;

            var vals = new List <object>
            {
                Id,
                EntityId.DBExport(),
                SiteId.DBExport(),
                RaceId.DBExport(),
                PopNumberMoved.DBExport(),
                RegionId.DBExport(),
                PopFlid.DBExport()
            };

            Database.ExportWorldItem(table, vals);
        }
예제 #25
0
    public bool GetRaceByEnumName(string name, out RaceId race)
    {
        // TODO: TP extensions
        // foreach (var it in mRaceSpecs){
        //     if (it.second.conditionName == raceName){
        //         return it.first;
        //   }
        // }

        // Try the primary races
        for (int i = 0; i < VANILLA_NUM_RACES; i++)
        {
            var raceName = GetRaceEnumName((RaceId)i);
            if (raceName.Equals(name, StringComparison.InvariantCultureIgnoreCase))
            {
                race = (RaceId)i;
                return(true);
            }
        }

        // Try the subraces
        int[] subraceEnumIds =
        {
            33, 65, 97, 129,
            34, 66, 98, 130, 162,
            35, 67, 38, 70
        };
        // TODO: I do not believe this is actually correct. Test if it's actually used
        foreach (var subraceId in subraceEnumIds)
        {
            var raceName = GetRaceEnumName((RaceId)subraceId);
            if (raceName.Equals(name, StringComparison.InvariantCultureIgnoreCase))
            {
                throw new NotImplementedException();
                race = (RaceId)subraceId;
                return(true);
            }
        }

        race = default;
        return(false);
    }
예제 #26
0
파일: Race.cs 프로젝트: KonH/TheKing
 public Race(
     RaceId name,
     int population,
     double growthRate,
     double power,
     double speed,
     double taxRate,
     int soldierPrice,
     LocationType startLoc
     )
 {
     Id           = name;
     Population   = population;
     GrowthRate   = growthRate;
     Power        = power;
     Speed        = speed;
     TaxRate      = taxRate;
     SoldierPrice = soldierPrice;
     StartLoc     = startLoc;
 }
예제 #27
0
        /// <summary>
        /// Returns all archetypes with the given race/class combination.
        /// 0 for race or class means all.
        /// </summary>
        /// <returns></returns>
        public static List <Archetype> GetArchetypes(RaceId race, ClassId clss)
        {
            if ((uint)clss >= WCellConstants.ClassTypeLength || (uint)race >= WCellConstants.RaceTypeLength)
            {
                return(null);
            }

            var list = new List <Archetype>();

            if (clss == 0)
            {
                // applies to all classes
                foreach (var raceArchetypes in Archetypes)
                {
                    if (raceArchetypes != null)
                    {
                        if (race == 0)
                        {
                            // applies to all classes and races
                            foreach (var archetype in raceArchetypes)
                            {
                                if (archetype != null)
                                {
                                    list.Add(archetype);
                                }
                            }
                        }
                        else
                        {
                            if (raceArchetypes[(uint)race] != null)
                            {
                                list.Add(raceArchetypes[(uint)race]);
                            }
                        }
                    }
                }
            }
            else
            {
                if (race == 0)
                {
                    // applies to all races
                    foreach (var archetype in Archetypes[(uint)clss])
                    {
                        if (archetype != null)
                        {
                            list.Add(archetype);
                        }
                    }
                }
                else
                {
                    // just one
                    if (Archetypes[(uint)clss][(uint)race] != null)
                    {
                        list.Add(Archetypes[(uint)clss][(uint)race]);
                    }
                }
            }

            if (list.Count == 0)
            {
                return(null);
            }
            return(list);
        }
예제 #28
0
		public static Faction Get(RaceId race)
		{
			if ((uint)race >= ByRace.Length)
			{
				return null;
			}
			return ByRace[(uint)race];
		}
예제 #29
0
 /// <summary>
 /// Returns the Race with the given type
 /// </summary>
 public static BaseRace GetRace(RaceId id)
 {
     return((uint)id >= BaseRaces.Length ? null : BaseRaces[(uint)id]);
 }
예제 #30
0
 public static Race FromRaceId(this Race race, RaceId raceId)
 {
     return(raceIdMap[raceId]);
 }
예제 #31
0
            public override SkillRaceClassInfo ConvertTo(byte[] rawData, ref int id)
            {
                id = GetInt32(rawData, 0);
                int num1 = 0;
                SkillRaceClassInfo skillRaceClassInfo1 = new SkillRaceClassInfo();
                SkillRaceClassInfo skillRaceClassInfo2 = skillRaceClassInfo1;

                byte[] data1    = rawData;
                int    field1   = num1;
                int    num2     = field1 + 1;
                int    uint32_1 = (int)GetUInt32(data1, field1);

                skillRaceClassInfo2.Id = (uint)uint32_1;
                byte[]             data2               = rawData;
                int                field2              = num2;
                int                num3                = field2 + 1;
                SkillId            uint32_2            = (SkillId)GetUInt32(data2, field2);
                SkillRaceClassInfo skillRaceClassInfo3 = skillRaceClassInfo1;

                byte[] data3    = rawData;
                int    field3   = num3;
                int    num4     = field3 + 1;
                int    uint32_3 = (int)GetUInt32(data3, field3);

                skillRaceClassInfo3.RaceMask = (RaceMask)uint32_3;
                SkillRaceClassInfo skillRaceClassInfo4 = skillRaceClassInfo1;

                byte[] data4    = rawData;
                int    field4   = num4;
                int    num5     = field4 + 1;
                int    uint32_4 = (int)GetUInt32(data4, field4);

                skillRaceClassInfo4.ClassMask = (ClassMask)uint32_4;
                SkillRaceClassInfo skillRaceClassInfo5 = skillRaceClassInfo1;

                byte[] data5    = rawData;
                int    field5   = num5;
                int    num6     = field5 + 1;
                int    uint32_5 = (int)GetUInt32(data5, field5);

                skillRaceClassInfo5.Flags = (SkillRaceClassFlags)uint32_5;
                SkillRaceClassInfo skillRaceClassInfo6 = skillRaceClassInfo1;

                byte[] data6    = rawData;
                int    field6   = num6;
                int    num7     = field6 + 1;
                int    uint32_6 = (int)GetUInt32(data6, field6);

                skillRaceClassInfo6.MinimumLevel = (uint)uint32_6;
                byte[] data7  = rawData;
                int    field7 = num7;
                int    field8 = field7 + 1;
                int    int32  = GetInt32(data7, field7);

                if (int32 > 0)
                {
                    TierReader.Entries.TryGetValue(int32, out skillRaceClassInfo1.Tiers);
                }
                skillRaceClassInfo1.SkillCostIndex = GetUInt32(rawData, field8);
                skillRaceClassInfo1.SkillLine      = ById.Get((uint)uint32_2);
                if (skillRaceClassInfo1.SkillLine != null)
                {
                    foreach (ClassId allClassId in WCellConstants.AllClassIds)
                    {
                        if (allClassId < ClassId.End)
                        {
                            ClassMask mask = allClassId.ToMask();
                            foreach (RaceMask key in WCellConstants.RaceTypesByMask.Keys)
                            {
                                RaceId raceType = WCellConstants.GetRaceType(key);
                                if (skillRaceClassInfo1.RaceMask.HasAnyFlag(key) &&
                                    skillRaceClassInfo1.ClassMask.HasAnyFlag(mask))
                                {
                                    Dictionary <SkillId, SkillRaceClassInfo>[] dictionaryArray =
                                        RaceClassInfos[(int)raceType];
                                    if (dictionaryArray == null)
                                    {
                                        RaceClassInfos[(int)raceType] = dictionaryArray =
                                            new Dictionary <SkillId, SkillRaceClassInfo> [WCellConstants.ClassTypeLength];
                                    }
                                    Dictionary <SkillId, SkillRaceClassInfo> dictionary =
                                        dictionaryArray[(int)allClassId];
                                    if (dictionary == null)
                                    {
                                        dictionaryArray[(int)allClassId] =
                                            dictionary = new Dictionary <SkillId, SkillRaceClassInfo>();
                                    }
                                    SkillRaceClassInfo skillRaceClassInfo7;
                                    if (dictionary.TryGetValue(uint32_2, out skillRaceClassInfo7))
                                    {
                                        skillRaceClassInfo1.RaceMask  |= skillRaceClassInfo7.RaceMask;
                                        skillRaceClassInfo1.ClassMask |= skillRaceClassInfo7.ClassMask;
                                    }
                                    else if (skillRaceClassInfo1.SkillLine.Tiers.Id == 0U &&
                                             skillRaceClassInfo1.Tiers.Id != 0U)
                                    {
                                        skillRaceClassInfo1.SkillLine.Tiers = skillRaceClassInfo1.Tiers;
                                    }

                                    dictionary[uint32_2] = skillRaceClassInfo1;
                                }
                            }
                        }
                    }
                }

                return(skillRaceClassInfo1);
            }
예제 #32
0
		internal BaseRace(RaceId id)
		{
			Id = id;
		}
예제 #33
0
 internal BaseRace(RaceId id)
 {
     Id = id;
 }
예제 #34
0
 /// <summary>
 /// Returns the Race with the given type
 /// </summary>
 public static BaseRace GetRace(RaceId id)
 {
     return (uint)id >= BaseRaces.Length ? null : BaseRaces[(uint)id];
 }
예제 #35
0
        /// <summary>
        /// Returns all archetypes with the given race/class combination.
        /// 0 for race or class means all.
        /// </summary>
        /// <returns></returns>
        public static List<Archetype> GetArchetypes(RaceId race, ClassId clss)
        {
            if ((uint)clss >= WCellConstants.ClassTypeLength || (uint)race >= WCellConstants.RaceTypeLength)
            {
                return null;
            }

            var list = new List<Archetype>();
            if (clss == 0)
            {
                // applies to all classes
                foreach (var raceArchetypes in Archetypes)
                {
                    if (raceArchetypes != null)
                    {
                        if (race == 0)
                        {
                            // applies to all classes and races
                            foreach (var archetype in raceArchetypes)
                            {
                                if (archetype != null)
                                {
                                    list.Add(archetype);
                                }
                            }
                        }
                        else
                        {
                            if (raceArchetypes[(uint)race] != null)
                            {
                                list.Add(raceArchetypes[(uint)race]);
                            }
                        }
                    }
                }
            }
            else
            {
                if (race == 0)
                {
                    // applies to all races
                    foreach (var archetype in Archetypes[(uint)clss])
                    {
                        if (archetype != null)
                        {
                            list.Add(archetype);
                        }
                    }
                }
                else
                {
                    // just one
                    if (Archetypes[(uint)clss][(uint)race] != null)
                    {
                        list.Add(Archetypes[(uint)clss][(uint)race]);
                    }
                }
            }

            if (list.Count == 0)
            {
                return null;
            }
            return list;
        }
예제 #36
0
		/// <summary>
		/// Adds all skills of that race/class combination with max value
		/// </summary>
		/// <param name="learnAbilities">Whether to also learn all abilities, related to the given skills.</param>
		public void LearnAll(RaceId race, ClassId clss, bool learnAbilities)
		{
			foreach (var info in SkillHandler.RaceClassInfos[(int)race][(int)clss].Values)
			{
				var skill = GetOrCreate(info.SkillLine.Id, true);
				if (skill != null)
				{
					skill.LearnMax();
					if (learnAbilities)
					{
						skill.LearnAllAbilities();
					}
				}
			}
		}
예제 #37
0
파일: Corpse.cs 프로젝트: WCellFR/WCellFR
		/// <summary>
		/// Creates a new Corpse for the given owner
		/// </summary>
		/// <param name="owner">The owner of this Corpse</param>
		/// <param name="pos">The position where the Corpse should appear</param>
		/// <param name="orientation">Orientation of the corpse</param>
		/// <param name="displayId">The displayid of the corpse</param>
		/// <param name="face">Face value</param>
		/// <param name="skin">Skin value</param>
		/// <param name="hairStyle">Hairstyle</param>
		/// <param name="hairColor">Haircolor</param>
		/// <param name="facialHair">Facial hair (beard)</param>
		/// <param name="guildId">The guild to which the owner of the corpse belongs</param>
		/// <param name="gender">Gender of the owner</param>
		/// <param name="race">Race of the owner</param>
		/// <param name="flags">Flags (only skeleton or full corpse)</param>
		/// <param name="dynFlags">Dynamic flags (is it lootable?)</param>
		public Corpse(Character owner, Vector3 pos, float orientation, uint displayId,
			byte face,
			byte skin,
			byte hairStyle,
			byte hairColor,
			byte facialHair,
			uint guildId,
			GenderType gender,
			RaceId race,
			CorpseFlags flags,
			CorpseDynamicFlags dynFlags)
		{
			EntityId = EntityId.GetCorpseId((uint)Interlocked.Increment(ref lastUID));
			DisplayId = displayId;
			Owner = owner;
			Type |= ObjectTypes.Corpse;
			ScaleX = 1;

		    m_position = pos;
            m_orientation = orientation;

			Face = face;
			Skin = skin;
			HairStyle = hairStyle;
			HairColor = hairColor;
			FacialHair = facialHair;
			GuildId = guildId;
			Gender = gender;
			Race = race;
			Flags = flags;
			DynamicFlags = dynFlags;
		}
예제 #38
0
 public static Race Get(RaceId id)
 {
     return(races.Single(x => x.id == id));
 }
예제 #39
0
		/// <summary>
		/// Returns the FactionGroup of the given race.
		/// Throws KeyNotFoundException if race is not a valid player-race.
		/// </summary>
		/// <param name="race">the race</param>
		/// <returns>The FactionGroup of the race.</returns>
		public static FactionGroup GetFactionGroup(RaceId race)
		{
			return ByRace[(uint)race].Group;
		}
예제 #40
0
파일: World.cs 프로젝트: ebakkedahl/WCell
        /// <summary>
        /// Gets an enumerator of characters based on their race.
        /// </summary>
        /// <param name="entRace">the race to search for</param>
        /// <returns>a list of <see cref="Character" /> objects belonging to the given race</returns>
        public static ICollection<Character> GetCharactersOfRace(RaceId entRace)
        {
            var list = new List<Character>(s_namedEntities.Count);

            using (worldLock.EnterReadLock())
            {
                foreach (INamedEntity chr in s_namedEntities.Values)
                {
                    if (chr is Character && ((Character)chr).Race == entRace)
                    {
                        list.Add((Character)chr);
                    }
                }
            }
            return list;
        }
예제 #41
0
 /// <summary>
 /// Get language description by Spell Id
 /// </summary>
 /// <returns></returns>
 public static LanguageDescription GetLanguageDescByRace(RaceId race)
 {
     return ByRace.Get((uint)race);
 }