Example #1
0
 //public WayPointControl(UnitObjectStats.Stat.Values values) : this()
 public WayPointControl(UnitObjectStats.Stat.StatValue values)
     : this()
 {
     wayPointValues = values;
 }
Example #2
0
 //// todo: rewrite public CharacterWaypoint(Unit heroUnit, TableDataSet dataSet)
 //    : base(heroUnit, dataSet)
 //{
 //    _waypoints = UnitHelpFunctions.GetComplexValue(BaseUnit, ItemValueNames.waypoint_flags);
 //    //if (_waypoints == null)
 //    {
 //        Unit.StatBlock.Stat _waypoint = new Unit.StatBlock.Stat();
 //        _waypoint.repeatFlag = 1;
 //        _waypoint.skipResource = 1;
 //        _waypoint.bitCount = 32;
 //        _waypoint.id = 20532;
 //        _waypoint.Name = "waypoint_flags";
 //        Unit.StatBlock.Stat.Attribute att1 = new Unit.StatBlock.Stat.Attribute();
 //        att1.BitCount = 8;
 //        att1.exists = 1;
 //        att1.skipTableId = 1;
 //        Unit.StatBlock.Stat.Attribute att2 = new Unit.StatBlock.Stat.Attribute();
 //        att2.BitCount = 16;
 //        att2.exists = 1;
 //        att2.TableId = 17715;
 //        _waypoint.attributes.Add(att1);
 //        _waypoint.attributes.Add(att2);
 //        _waypoint.values = new List<Unit.StatBlock.Stat.Values>();
 //        _waypoint.values.Add(GenerateNormal());
 //        _waypoint.values.Add(GenerateNightmare());
 //        _waypoints.values[0].Stat = 1535;
 //        //_waypoints.values.Add(GenerateNightmare());// = _waypoint;
 //    }
 //    //UnitHelpFunctions.SetComplexValue(_hero, ItemValueNames.waypoint_flags.ToString(), _waypoints);
 //}
 private UnitObjectStats.Stat.StatValue GenerateNormal()
 {
     UnitObjectStats.Stat.StatValue normal = new UnitObjectStats.Stat.StatValue();
     normal.Param2 = 16705;
     normal.Value = 1535;
     return normal;
 }
Example #3
0
 private UnitObjectStats.Stat.StatValue GenerateNightmare()
 {
     UnitObjectStats.Stat.StatValue nightmare = new UnitObjectStats.Stat.StatValue();
     nightmare.Param2 = 16961;
     nightmare.Value = 1535;
     return nightmare;
 }
Example #4
0
        private SkillTab CreateSkillsFromRow(List<UnitObjectStats.Stat.StatValue> availableSkills, DataTable skillTable, DataRow[] skillRows)
        {
            List<UnitObjectStats.Stat.StatValue> values = new List<UnitObjectStats.Stat.StatValue>();
            SkillTab skillInSkillTab = new SkillTab();

            //iterate through all available skills
            foreach (DataRow row in skillRows)
            {
                //get the skill id
                int skillId = (int)row["code"];
                //if the skill is already present, use that one
                UnitObjectStats.Stat.StatValue tmpSkill = availableSkills.Find(tmp => tmp.Param1 == skillId);
                if (tmpSkill != null)
                {
                    values.Add(tmpSkill);
                }
                //if not, add a new one
                else
                {
                    UnitObjectStats.Stat.StatValue skillEntry = new UnitObjectStats.Stat.StatValue();
                    skillEntry.Param1 = skillId;

                    values.Add(skillEntry);
                }
            }
            //_hero.Stats.statCount

            //and finally... initialize all skills :)
            foreach (UnitObjectStats.Stat.StatValue skillBlock in values)
            {
                Skill skill = InitializeSkill(skillTable, skillBlock);
                skillInSkillTab.Skills.Add(skill);
            }
            return skillInSkillTab;
        }
Example #5
0
 public Skill(string name, string description, string iconName, int maxLevel, Point position, int[] requiredSkills, int[] levelsOfRequiredSkills, UnitObjectStats.Stat.StatValue skillBlock)
 {
     _name = name;
     _description = description;
     _iconName = iconName;
     _maxLevel = maxLevel;
     _position = position;
     _requiredSkills = requiredSkills;
     _levelsOfRequiredSkills = levelsOfRequiredSkills;
     _skillBlock = skillBlock;
 }
Example #6
0
        /// <summary>
        /// Adds a new simple value (entry that holds only one value) to the stats table
        /// </summary>
        /// <param name="unit">The unit to add this stat to</param>
        /// <param name="valueName">The name/id of the value to add</param>
        /// <param name="value">The actual value to add</param>
        /// <param name="bitCount">The bitCount of this value (possibly defines the maximum value of the "value" entry)</param>
        public static void AddSimpleValue(UnitObject unit, ItemValueNames valueName, int value, int bitCount)
        {
            List<UnitObjectStats.Stat> newStats = new List<UnitObjectStats.Stat>();
            //copies the existing values to a new array
            newStats.AddRange(unit.Stats.Stats.Values);

            //check if the value already exists
            if (newStats.Find(tmp => tmp.Code == (int)valueName) != null)
            {
                return;
            }

            //generates a new stat
            UnitObjectStats.Stat newStat = new UnitObjectStats.Stat();
            //generates the entry that holds the stat value
            UnitObjectStats.Stat.StatValue newValue = new UnitObjectStats.Stat.StatValue();
            //newStat.Values = new List<UnitObjectStats.Stat.StatValue>();
            //adds the entry to the new stat
            newStat.Values.Add(newValue);
            //sets the bitCOunt value (maximum stat value defined by the number of bits?)
            //newStat.BitCount = bitCount;
            //sets the length of the stat array (may be unnecessary)
            //newStat.Length = 1;
            //sets the Id of the new stat
            //newStat.Code = (short)valueName;
            //newStat.SkipResource = 1;
            //newStat.repeatCount = 1;

            //adds the new value to the array
            newStats.Add(newStat);

            //assigns the new array to the unit
            unit.Stats.Stats.TryAdd(newStat.Code, newStat);// = newStats.ToArray();
            //unit.Stats.statCount = newStats.Count;
        }