예제 #1
0
 public byte GetSkillLevel(SkillID skill)
 {
     byte skillValue;
     if (m_skillMap.TryGetValue(skill, out skillValue))
         return skillValue;
     return 0;
 }
예제 #2
0
        public SkillDb(IServiceProvider services)
        {
            var db = services.ThrowOrGet <IInterfaceIdDatabase>();

            Attack       = new SkillID("Attack", 0, db.AttackLevelUpDialog);
            Defense      = new SkillID("Defense", 1, db.DefenceLevelUpDialog);
            Strength     = new SkillID("Strength", 2, db.StrengthLevelUpDialog);
            Hitpoints    = new SkillID("Hitpoints", 3, db.HitpointsLevelUpDialog);
            Ranged       = new SkillID("Ranged", 4, db.RangedLevelUpDialog);
            Prayer       = new SkillID("Prayer", 5, db.PrayerLevelUpDialog);
            Magic        = new SkillID("Magic", 6, db.MagicLevelUpDialog);
            Cooking      = new SkillID("Cooking", 7, db.CookingLevelUpDialog);
            Woodcutting  = new SkillID("Woodcutting", 8, db.WoodcuttingLevelUpDialog);
            Fletching    = new SkillID("Fletching", 9, db.FletchingLevelUpDialog);
            Fishing      = new SkillID("Fishing", 10, db.FishingLevelUpDialog);
            Firemaking   = new SkillID("Firemaking", 11, db.FiremakingLevelUpDialog);
            Crafting     = new SkillID("Crafting", 12, db.CraftingLevelUpDialog);
            Smithing     = new SkillID("Smithing", 13, db.SmithingLevelUpDialog);
            Mining       = new SkillID("Mining", 14, db.MiningLevelUpDialog);
            Herblore     = new SkillID("Herblore", 15, db.HerbloreLevelUpDialog);
            Agility      = new SkillID("Agility", 16, db.AgilityLevelUpDialog);
            Thieving     = new SkillID("Thieving", 17, db.ThievingLevelUpDialog);
            Slayer       = new SkillID("Slayer", 18, db.SlayerLevelUpDialog);
            Farming      = new SkillID("Farming", 19, db.FarmingLevelUpDialog);
            Runecrafting = new SkillID("Runecrafting", 20, db.RunecraftingLevelUpDialog);
        }
예제 #3
0
    public Skill GetSkill(SkillID id)
    {
        if (id.elementID != 0)
        {
            Debug.Log("Invalid element Id (must be 0 for skills, >0 for perks)");
        }

        if (id.treeID >= skillTrees.Count)
        {
            Debug.Log("Invalid tree ID");
            return(null);
        }
        SkillTree tree        = skillTrees[id.treeID];
        int       branchCount = -1;

        foreach (SkillTree.Level level in tree.levels)
        {
            foreach (SkillBranch branch in level.branches)
            {
                branchCount++;
                if (branchCount == id.branchID)
                {
                    return(branch.rootSkill_);
                }
            }
        }
        Debug.Log("Invalid branch ID");
        return(null);
    }
예제 #4
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Id != 0)
            {
                hash ^= Id.GetHashCode();
            }
            if (SkillID != 0)
            {
                hash ^= SkillID.GetHashCode();
            }
            if (SkillIcon != 0)
            {
                hash ^= SkillIcon.GetHashCode();
            }
            if (SkillName.Length != 0)
            {
                hash ^= SkillName.GetHashCode();
            }
            if (SkillLevel != 0)
            {
                hash ^= SkillLevel.GetHashCode();
            }
            if (SkillType != 0)
            {
                hash ^= SkillType.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
예제 #5
0
        public SkillResultID method_29()
        {
            SkillID skillID_ = this.method_26();
            int     int_     = this.method_42();

            return(new SkillResultID(skillID_, int_));
        }
예제 #6
0
 public byte Test1(SkillID skillID)
 {
     byte skillLevel;
     skillLevel = GetSkillLevel(skillID);
     SetSkillLevel(skillID, 50);
     skillLevel = GetSkillLevel(skillID);
     return skillLevel;
 }
예제 #7
0
 public O_USE_SKILL_2()
 {
     Skill     = new SkillID();
     SkillType = 0;
     Level     = 0;
     LevelType = 0;
     Target    = new TargetParam();
 }
    private void Awake()
    {
        skillID = GetComponent <SkillID>();

        hotkeyController = GameObject.FindGameObjectWithTag("HotkeyWrapper").GetComponent <HotkeyController>();

        parent = GameObject.FindGameObjectWithTag("HotkeyWrapper").transform;
    }
예제 #9
0
 public ISkillModel GetModel(SkillID skill)
 {
     if (All.ContainsKey(skill))
     {
         return(All[skill]);
     }
     return(null);
 }
예제 #10
0
            public int Test2(SkillID skillID)
            {
                int skillLevel;

                skillLevel = GetSkillLevel(skillID);
                SetSkillLevel(skillID, 0);
                skillLevel = GetSkillLevel(skillID);
                return(skillLevel);
            }
예제 #11
0
            public byte Test2(SkillID skillID)
            {
                byte skillLevel;

                skillLevel = GetSkillLevel(skillID);
                SetSkillLevel(skillID, 0);
                skillLevel = GetSkillLevel(skillID);
                return(skillLevel);
            }
예제 #12
0
        /// <summary>
        /// If skill was interrupted under casting this will inform the client to reset the cooldown of that skill.
        /// </summary>
        /// <param name="caster">The caster of the interrupted skill.</param>
        /// <param name="skillID">The ID of the skill that got interrupted.</param>
        public void SendSkillInterrupt(Entity caster, SkillID skillID)
        {
            NetOutgoingMessage msgOut = Server.CreateMessage();

            msgOut.Write((byte)MessageType.SkillInterrupt);
            msgOut.Write((byte)skillID);

            caster.GetConnection()?.SendMessage(msgOut, NetDeliveryMethod.Unreliable, 0);
        }
예제 #13
0
 public void Read(BinaryReader br)
 {
     Skill = new SkillID()
     {
         Value = br.ReadUInt32()
     };
     Level  = br.ReadUInt32();
     Target = TargetStream.Read(br);
 }
예제 #14
0
            public void SetSkillLevel(SkillID skill, byte level)
            {
                byte oldLevel = GetSkillLevel(skill);

                if (level == 0)
                    m_skillMap.Remove(skill);
                else
                    m_skillMap[skill] = level;
            }
예제 #15
0
        public byte GetSkillLevel(SkillID skill)
        {
            byte skillValue;

            if (m_skillMap.TryGetValue(skill, out skillValue))
            {
                return(skillValue);
            }
            return(0);
        }
예제 #16
0
        public byte GetSkillLevel(SkillID skill)
        {
            var tuple = m_skills.FirstOrDefault(t => t.Item1 == skill);

            if (tuple == null)
            {
                return(0);
            }

            return(tuple.Item2);
        }
예제 #17
0
 public void Init()
 {
     for (int i = 0; i < 3; i++)
     {
         {
             GoSkill[i]  = GameObject.Find("Box" + (i + 1).ToString());
             Skill[i]    = new SkillID();
             Skill[i].ID = 0;
         }
     }
 }
예제 #18
0
 public void Initialize()
 {
     unitName      = DataDefaults.unitName;
     raceName      = DataDefaults.raceName;
     level         = 1;
     attributes    = new UnitAttributesData();
     mainAttack    = new SkillID();
     perks         = new List <PerkID>();
     skills        = new List <SkillID>();
     inventory     = new InventoryData();
     isInitialized = true;
 }
예제 #19
0
    public Skill getSkill(SkillID skillID)
    {
        if (weapon.skills.skillTable.ContainsKey(skillID))
        {
            return(weapon.skills.skillTable[skillID]);
        }

        else
        {
            return(null);
        }
    }
예제 #20
0
            public void SetSkillLevel(SkillID skill, byte level)
            {
                byte oldLevel = GetSkillLevel(skill);

                if (level == 0)
                {
                    m_skillMap.Remove(skill);
                }
                else
                {
                    m_skillMap[skill] = level;
                }
            }
        public Skill(SkillData data)
        {
            this.data = data;

            skillName = data._skillName;
            id        = data._id;

            skillType = data._skillType;

            mpCost = data._mpCost;

            description = data._description;
        }
예제 #22
0
 public UnitData(UnitData other)
 {
     unitName       = other.unitName;
     raceName       = other.raceName;
     level          = other.level;
     attributes     = new UnitAttributesData(other.attributes);
     mainAttack     = new SkillID(other.mainAttack);
     perks          = new List <PerkID>(other.perks);
     skills         = new List <SkillID>(other.skills);
     inventory      = new InventoryData(other.inventory);
     usesRootMotion = other.usesRootMotion;
     isInitialized  = other.isInitialized;
 }
        public Skill GetSkill(SkillID id)
        {
            if (database.ContainsKey(id))
            {
                return(database[id].GetSkill());
            }
            else
            {
                Debug.LogError("Database does not contain a skill with the ID: " + id.ToString());
            }

            return(null);
        }
예제 #24
0
 /// <summary>
 /// 准备id对应的技能,检查能否释放
 /// </summary>
 /// <param name="skillId">技能id</param>
 /// <returns>id对应的技能数据</returns>
 public SkillData PrepareSkill(SkillID skillId)
 {
     for (int i = skills.Length - 1; i >= 0; i--)
     {
         if (skills[i] != null && skills[i].id == skillId)
         {
             if (skills[i].coolRemain <= 0 &&
                 skills[i].costMana <= characterStatus.curBaseMana)
             {
                 return(skills[i]);
             }
         }
     }
     return(null);
 }
예제 #25
0
        public void GainExperience(SkillID skill, float exp)
        {
            var model = GetModel(skill);

            if (model == null)
            {
                Parent.SystemMessage($"Tried to gain experience in skill {skill} but no model for it was found.", CoreSystemMessageFlags.Debug | CoreSystemMessageFlags.Skill);
                return;
            }

            Parent.SendMessage(new ExperienceGainMessage(exp, model));

            if (model.GainExperience(Parent, exp))
            {
                Parent.SendMessage(new LevelUpMessage(model));
            }
        }
예제 #26
0
        private TauntStartPosition GetStartPosition(SkillID skillID)
        {
            if (skillID < 0)
            {
                return(TauntStartPosition.FaceDown);
            }
            var anmData = SkillDataMan.inst.GetSkillData(skillID)[0].anmData[0];

            if (anmData.formDispList[0].formIdx == 101)
            {
                return(TauntStartPosition.FaceDown);
            }
            else
            {
                return(TauntStartPosition.FaceUp);
            }
        }
예제 #27
0
        private TauntEndPosition GetEndPosition(SkillID skillID)
        {
            if (skillID < 0)
            {
                return(TauntEndPosition.Grounded);
            }
            var anmData = SkillDataMan.inst.GetSkillData(skillID)[0].anmData[0];

            if (anmData.formDispList[anmData.formNum - 1].formIdx != 101 && anmData.formDispList[anmData.formNum - 1].formIdx != 100)
            {
                return(TauntEndPosition.Standing);
            }
            else
            {
                return(TauntEndPosition.Grounded);
            }
        }
예제 #28
0
 public HeroData(HeroData other)
 {
     isEmpty              = other.isEmpty;
     characterName        = other.characterName;
     raceId               = other.raceId;
     xp                   = other.xp;
     level                = other.level;
     rankPoints           = other.rankPoints;
     totalAttributePoints = other.totalAttributePoints;
     spentAttributePoints = other.spentAttributePoints;
     skillTreeSlots       = other.skillTreeSlots.DeepCopy();
     skills               = other.skills.DeepCopy();
     primarySkill         = new SkillID(other.primarySkill);
     secondarySkills      = other.secondarySkills.DeepCopy();
     unitData             = new UnitData(other.unitData);
     teleportData         = new TeleportData(other.teleportData);
 }
예제 #29
0
        public void SetSkillLevel(SkillID skill, byte level)
        {
            byte oldLevel = GetSkillLevel(skill);

            if (level == 0)
            {
                m_skillMap.Remove(skill);
            }
            else
            {
                m_skillMap[skill] = level;
            }

            if (level != oldLevel)
            {
                this.World.AddChange(new SkillChange(this, skill, level));
            }
        }
예제 #30
0
        public void SetSkillLevel(SkillID skill, byte level)
        {
            for (int i = 0; i < m_skills.Count; ++i)
            {
                if (m_skills[i].Item1 == skill)
                {
                    if (level == 0)
                    {
                        m_skills.RemoveAt(i);
                    }
                    else
                    {
                        m_skills[i] = new Tuple <SkillID, byte>(skill, level);
                    }
                    return;
                }
            }

            m_skills.Add(new Tuple <SkillID, byte>(skill, level));
        }
예제 #31
0
 public WeaponData(WeaponData other)
 {
     damage         = new Attribute(other.damage);
     damageSpread   = new Attribute(other.damageSpread);
     reach          = new Attribute(other.reach);
     speedModifier  = new Attribute(other.speedModifier);
     strRequired    = new Attribute(other.strRequired);
     strDamageBonus = new Attribute(other.strDamageBonus);
     strSpeedBonus  = new Attribute(other.strSpeedBonus);
     strReachBonus  = new Attribute(other.strReachBonus);
     dexRequired    = new Attribute(other.dexRequired);
     dexDamageBonus = new Attribute(other.dexDamageBonus);
     dexSpeedBonus  = new Attribute(other.dexSpeedBonus);
     dexReachBonus  = new Attribute(other.dexReachBonus);
     intRequired    = new Attribute(other.intRequired);
     intDamageBonus = new Attribute(other.intDamageBonus);
     intSpeedBonus  = new Attribute(other.intSpeedBonus);
     intReachBonus  = new Attribute(other.intReachBonus);
     basicSkillId   = new SkillID(other.basicSkillId);
 }
예제 #32
0
    public void CorrectInvalidData()
    {
        if (string.IsNullOrEmpty(unitName))
        {
            Debug.LogWarning("Unit name not found, changing to " + DataDefaults.unitName);
            unitName = DataDefaults.unitName;
        }
        if (raceName == null || !Main.StaticData.Game.Races.ContainsName(raceName))
        {
            Debug.LogWarning("Invalid race name, changing to " + DataDefaults.raceName);
            raceName = DataDefaults.raceName;
        }
        if (mainAttack == null || !Main.StaticData.Game.Skills.ContainsName(mainAttack.Name))
        {
            Debug.LogWarning("Invalid main attack, changing to " + DataDefaults.skillName);
            mainAttack = new SkillID();
        }
        Inventory.CorrectInvalidData();

        Attributes.CorrectInvalidData();
    }
예제 #33
0
        /// <summary>
        /// 使用指定id的技能
        /// </summary>
        /// <param name="skillId">技能id</param>
        /// <param name="isBatter">是否为连击</param>
        public void UseSkill(SkillID skillId, bool isBatter = false)
        {
            if (isBatter && curSkill != null)
            {
                skillId = curSkill.nextBatterId;
            }
            curSkill = skillManager.PrepareSkill(skillId);
            if (curSkill == null)
            {
                Debug.Log("Can't use: " + skillId.ToString());
                return;
            }

            if (curSkill.attackType == SkillAttackType.Single)
            {
                var target = SelectClosestTarget();
                if (target == null)
                {
                    Debug.Log("Can't find target for: " + skillId.ToString());
                }
                else
                {
                    ShowSelectedFx(false);
                    curTarget = target;
                    curAttackTargetSelected = curTarget.GetComponent <CharacterSelected>();
                    ShowSelectedFx(true);
                    transform.LookAt(curTarget);
                }
            }
            else
            {
                // TODO
            }

            characterAnimation.SetTrigger(curSkill.hashAnimationName);
        }
예제 #34
0
 public int Test2(SkillID skillID)
 {
     int skillLevel;
     skillLevel = GetSkillLevel(skillID);
     SetSkillLevel(skillID, 0);
     skillLevel = GetSkillLevel(skillID);
     return skillLevel;
 }
예제 #35
0
 public SkillChange(LivingObject ob, SkillID skillID, byte level)
     : base(ob)
 {
     this.SkillID = skillID;
     this.Level = level;
 }
예제 #36
0
 public void SetSkillLevel(SkillID skill, byte level)
 {
     this.SkillMap[skill] = level;
 }
예제 #37
0
        public void SetSkillLevel(SkillID skill, byte level)
        {
            byte oldLevel = GetSkillLevel(skill);

            if (level == 0)
                m_skillMap.Remove(skill);
            else
                m_skillMap[skill] = level;

            if (level != oldLevel)
                this.World.AddChange(new SkillChange(this, skill, level));
        }
예제 #38
0
        public void SetSkillLevel(SkillID skill, byte level)
        {
            for (int i = 0; i < m_skills.Count; ++i)
            {
                if (m_skills[i].Item1 == skill)
                {
                    if (level == 0)
                        m_skills.RemoveAt(i);
                    else
                        m_skills[i] = new Tuple<SkillID, byte>(skill, level);
                    return;
                }
            }

            m_skills.Add(new Tuple<SkillID, byte>(skill, level));
        }
예제 #39
0
        public byte GetSkillLevel(SkillID skill)
        {
            var tuple = m_skills.FirstOrDefault(t => t.Item1 == skill);

            if (tuple == null)
                return 0;

            return tuple.Item2;
        }
예제 #40
0
 int GetTicks(SkillID skillID)
 {
     var lvl = GetSkillLevel(skillID);
     return 20 / (lvl / 26 + 1);
 }