Inheritance: System.Web.UI.Page
Ejemplo n.º 1
0
        //add new if statement for new skill
        public Skill(Skills skill)
        {
            isDamage = false;
              isHealing = false;

              if (skill.HasFlag(Skills.Fire))
              {
            skillRatio = 2.0f;
            Name = "Fire";
            isDamage = true;
            isHealing = false;
              }
              if (skill.HasFlag(Skills.Ice))
              {
            skillRatio = 1.5f;
            Name = "Ice";
            isDamage = true;
            isHealing = false;
              }
              if (skill.HasFlag(Skills.Heal))
              {
            skillRatio = 1.0f;
            Name = "Heal";
            isDamage = false;
            isHealing = true;
              }
        }
Ejemplo n.º 2
0
 protected void Initialize(Character character, StatsHunter stats, CombatFactors cf, CalculationOptionsHunter co,
     Skills.Ability ability, bool useSpellHit, bool alwaysHit)
 {
     Char = character;
     StatS = stats;
     calcOpts = co;
     combatFactors = cf;
     Abil = ability;
     if (Abil == null)
     {
         isWhite = true;
     }
     else
     {
         Abil.combatFactors = combatFactors;
     }
     PetAbil = PetAttacks.None;
     this.useSpellHit = useSpellHit;
     /*// Defaults
     Miss 
     Dodge
     Parry
     Block
     Glance
     Critical
     Hit*/
     // Start a calc            
     if (alwaysHit) CalculateAlwaysHit();
     else Calculate();            
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Get Player Skills list
        /// </summary>
        /// <param name="playerId"></param>
        /// <returns></returns>
        public static Skills GetPlayerSkill(int playerId, SkillType skillType)
        {
            using (MySqlConnection connection = new MySqlConnection(connectionString))
            {
                connection.Open();
                Skills skills = new Skills();

                using (MySqlCommand command = connection.CreateCommand())
                {
                    command.CommandText = "GAME_PLAYER_SKILL_GET";
                    command.CommandType = System.Data.CommandType.StoredProcedure;
                    command.Parameters.AddWithValue("@in_PlayerId", playerId);
                    command.Parameters.AddWithValue("@in_SkillType", skillType);

                    var reader = command.ExecuteReader();

                    if (reader.HasRows)
                    {
                        while (reader.Read())
                        {
                            int skillId = reader.GetInt32(1);
                            int skillLevel = reader.GetInt32(2);

                            skills.AddSkill(skillId, skillLevel);
                        }
                    }
                }
                connection.Close();
                return skills;
            }
        }
 // Use this for initialization
 public ActiveSkills(string name, string description, int price, Skills father, float timeIncantation, int manaCost, Transform particule)
     : base(name, description, price, father)
 {
     m_manaCost = manaCost;
     m_timeIncantation = timeIncantation;
     m_particule = particule;
 }
        public uint CreateSkillAoE(Skills skill, Vector2 direction, Position position)
        {
            SkillAoE skillAoE;
            Movement movement;
            Sprite sprite;
            Collideable collideable;
            uint eid = Entity.NextEntity();

            position.EntityID = eid;
            position.Center += direction * 70;

            switch (skill)
            {
                default:
                    throw new Exception("Not a AoE skill");
            }

            collideable = new Collideable()
            {
                EntityID = eid,
                Bounds = new CircleBounds(position.Center, position.Radius),
            };

            game.SkillAoEComponent.Add(eid, skillAoE);
            game.MovementComponent.Add(eid, movement);
            game.PositionComponent.Add(eid, position);
            game.SpriteComponent.Add(eid, sprite);
            game.CollisionComponent.Add(eid, collideable);
            return eid;
        }
Ejemplo n.º 6
0
 protected Skill(int attackModifier, int defenseModifier, int healthModifier, int manaModifier, Skills type)
 {
     this.AttackModifier = attackModifier;
     this.DefenseModifier = defenseModifier;
     this.HealthModifier = healthModifier;
     this.ManaModifier = manaModifier;
     this.Type = type;
 }
Ejemplo n.º 7
0
	public static Skills getInstance(string id){
		Skills skills = new Skills ();
		XmlElement note = ResourceManager.getInstance().getXmlAttribute ("skills", "skillID", id);
		skills.skillID = int.Parse (note.GetAttribute ("skillID"));
		skills.skillType = int.Parse (note.GetAttribute ("skillType"));
		skills.skillName = note.GetAttribute ("skillName");
		skills.equipCondition = int.Parse (note.GetAttribute ("equipCondition"));
		return skills;
	}
Ejemplo n.º 8
0
 protected internal Item(Position position, string name, int attackModifier, int defenseModifier, int healthModifier, int manaModifier, Skills type)
     : base(position, MapMarkers.T, name)
 {
     this.ItemState = ItemState.Available;
     this.AttackModifier = attackModifier;
     this.DefenseModifier = defenseModifier;
     this.HealthModifier = healthModifier;
     this.ManaModifier = manaModifier;
     this.Type = type;
 }
Ejemplo n.º 9
0
    // Use this for initialization
    public Skills(string name, string description, int price, Skills father)
    {
        m_name = name;
        m_description = description;
        m_price = price;
        m_father = father;

        if(father == null)
            setIsUnlock(true);
    }
Ejemplo n.º 10
0
 public IServiceResults<int> Add(Skills model)
 {
     _skills.Add(model);
     var saveResult = _uow.SaveChanges();
     return new ServiceResults<int>
     {
         IsSuccessfull = saveResult.ToBool(),
         Message = saveResult.ToMessage(BusinessMessage.Error),
         Result = model.SkillsId
     };
 }
 // Use this for initialization
 public PassiveSkills(string name, string description, int price, Skills father, int costIncFirstAd, int costIncSecAd, float firstAd, float secAd, string nameFirstAd, string nameSecAd, string descriptionFirstAd, string descriptionSecAd)
     : base(name, description, price, father)
 {
     m_costIncFirstAd = costIncFirstAd;
     m_costIncSecAd = costIncSecAd;
     m_firstAd = firstAd;
     m_secAd = secAd;
     m_nameFirstAd = nameFirstAd;
     m_nameSecAd = nameSecAd;
     m_descriptionFirstAd = descriptionFirstAd;
     m_descriptionSecAd = descriptionSecAd;
 }
 void Start()
 {
     player = GameObject.FindGameObjectWithTag("Player").GetComponent<Controller2D>();
     sprite = GetComponent<SpriteRenderer>();
     animationController = GetComponent<Animator>();
     projectileCollider = GetComponent<Collider2D>();
     initalXOffset = projectileCollider.offset.x;
     initalYOffset = projectileCollider.offset.y;
     hit = false;
     decaying = false;
     currentSkill = SkillsController.skillsController.selectedSkill;
     UpdateDirection();
 }
    // Use this for initialization
    public BaseSkills(string name, string description, int price, Skills father, float timeIncantation, int manaCost, Transform particule, float damage, int costIncDamage, int costIncAd, string nameDamage, string nameAd, string descriptionDamage, string descriptionAd, float baseAd)
        : base(name, description, price, father, timeIncantation, manaCost, particule, damage)
    {
        m_costIncDamage = costIncDamage;

        m_baseAd = baseAd;
        m_ad = m_baseAd;
        m_costIncAd = costIncAd;
        m_nameAd = nameAd;
        m_nameDamage = nameDamage;
        m_descriptionAd = descriptionAd;
        m_descriptionDamage = descriptionDamage;
    }
Ejemplo n.º 14
0
 public bool SkillRequirementsMet (Skills skill)
 {
     if (skill.requiredStatName == Skills.RequiredStat.Agility)
     {
         if (GameControl.gameControl.currentSpeed >= skill.requiredStatValue)
         {
             return true;
         }
         else
         {
             return false;
         }
     }
     else if (skill.requiredStatName == Skills.RequiredStat.Defense)
     {
         if (GameControl.gameControl.currentDefense >= skill.requiredStatValue)
         {
             return true;
         }
         else
         {
             return false;
         }
     }
     else if (skill.requiredStatName == Skills.RequiredStat.Intelligence)
     {
         if (GameControl.gameControl.currentIntelligence >= skill.requiredStatValue)
         {
             return true;
         }
         else
         {
             return false;
         }
     }
     else if (skill.requiredStatName == Skills.RequiredStat.Strength)
     {
         if (GameControl.gameControl.currentStrength >= skill.requiredStatValue)
         {
             return true;
         }
         else
         {
             return false;
         }
     }
     else
     {
         return true;
     }
 }
		/// <summary>
		/// Writes the log.
		/// </summary>
		/// <param name="context">The context.</param>
		/// <param name="stream">The stream.</param>
		/// <param name="callback">The callback for UI updates.</param>
		public void WriteLog(IExecutionContext context, Stream stream, ProgressCallback callback)
		{
			int playerOid = -1;
			byte playerLevel = 0;
			string playerClassName = "";
			Skills playerSkills = new Skills();
			
			using (StreamWriter s = new StreamWriter(stream))
			{
				foreach (PacketLog log in context.LogManager.Logs)
				{
					for (int i = 0; i < log.Count; i++)
					{
						if (callback != null && (i & 0xFFF) == 0) // update progress every 4096th packet
							callback(i, log.Count - 1);

						Packet pak = log[i];
						if (pak is StoC_0x20_PlayerPositionAndObjectID)
						{
							StoC_0x20_PlayerPositionAndObjectID plr = (StoC_0x20_PlayerPositionAndObjectID) pak;
							playerOid = plr.PlayerOid;
#if SHOW_PACKETS
							s.WriteLine("playerOid:0x{0:X4}", playerOid);
#endif
						}
						else if (pak is StoC_0x16_VariousUpdate)
						{
							// Name, level, class
							StoC_0x16_VariousUpdate stat = (StoC_0x16_VariousUpdate) pak;
							if (stat.SubCode == 3)
							{
								StoC_0x16_VariousUpdate.PlayerUpdate subData = (StoC_0x16_VariousUpdate.PlayerUpdate) stat.SubData;
								playerLevel = subData.playerLevel;
								playerClassName = subData.className;
#if SHOW_PACKETS
								s.WriteLine("{0, -16} 0x16:3 class:{1} level:{2}", pak.Time.ToString(), playerClassName, playerLevel);
#endif
							}
						}
						else if (pak is StoC_0xAF_Message)
						{
							StoC_0xAF_Message msg = (StoC_0xAF_Message) pak;
#if SHOW_PACKETS
//							s.WriteLine("{0, -16} 0xAF 0x{1:X2} {2}", pak.Time.ToString(), msg.Type, msg.Text);
#endif
						}
					}
				}
			}
		}
Ejemplo n.º 16
0
 /// <summary>
 /// This function save the qualification
 /// </summary>
 private void SaveSkill()
 {
     var skill = new Skill
     {
         SkillText = txtSkill.Text,
         Active = rbtnActiveYes.Checked
     };
     var skillId = new Skills().AddUpdateSkill(skill);
     //clear text box and load skills
     txtSkill.Text = "";
     rbtnActiveYes.Checked = true;
     rbtnActiveNo.Checked = false;
     //load skills
     LoadSkills();
 }
Ejemplo n.º 17
0
 protected void Initialize(Character character, Base.StatsWarrior stats, CombatFactors cf, BossOptions bo,
     Skills.Ability ability, bool ismh, bool usespellhit, bool userangedhit, bool alwaysHit)
 {
     Char = character;
     StatS = stats;
     bossOpts = bo;
     combatFactors = cf;
     Abil = ability;
     isWhite = (Abil == null);
     isMH = ismh;
     useSpellHit = usespellhit;
     useRangedHit = userangedhit;
     // Start a calc
     Reset(alwaysHit);
 }
Ejemplo n.º 18
0
        /// <summary>
        /// Update player skills 
        /// </summary>
        /// <param name="player"></param>
        public static void SavePlayerSkill(Player player, SkillType skillType)
        {
            using (MySqlConnection connection = new MySqlConnection(connectionString))
            {
                connection.Open();
                Skills Skills = new Skills();
                switch (skillType)
                {
                    case SkillType.Ascension:
                        Skills = player.AscensionSkills;
                        break;
                    case SkillType.Basic:
                        Skills = player.Skills;
                        break;
                    case SkillType.Passive:
                        Skills = player.PassiveSkills;
                        break;
                }

                foreach (var skill in Skills.Values)
                {
                    using (MySqlCommand command = connection.CreateCommand())
                    {
                        try
                        {
                            command.CommandText = "GAME_PLAYER_SKILL_UPDATE";
                            command.CommandType = System.Data.CommandType.StoredProcedure;
                            command.Parameters.AddWithValue("@in_PlayerId", player.PlayerId);
                            command.Parameters.AddWithValue("@in_SkillId", skill.Key);
                            command.Parameters.AddWithValue("@in_SkillLevel", skill.Value);
                            command.Parameters.AddWithValue("@in_SkillType", skillType);
                            command.ExecuteNonQuery();
                        }
                        catch(Exception e)
                        {

                        }
                        finally
                        {

                        }
                    }
                }

                connection.Close();
            }
        }
Ejemplo n.º 19
0
	// Use this for initialization
	void Start () {
        if (pSkills != null)
        {
            Destroy(this.gameObject);
            return;
        }
        else
        {
            pSkills = this;
            DontDestroyOnLoad(transform.root.gameObject);
            skillPoints = 0;
            UIDropdownCool = gameObject.AddComponent<Timer>();
            UIDropdownCool.initialize(.2f, false);
            UIPanel.SetActive(false);
            up = true;
        }
	}
Ejemplo n.º 20
0
    void LoadSkills()
    {
        //bind repeater
        var list = new Skills().GetSkills(false).ToList();
        rptSkills.DataSource = list;
        rptSkills.DataBind();

        //show and hide items/actions and no items
        if (list.Count > 0)
        {
            items.Visible = true;
        }
        else
        {
            items.Visible = false;
        }
    }
        public uint CreateSkillAoE(Skills skill, Position position)
        {
            SkillAoE skillAoE;
            Sprite sprite;
            Collideable collideable;
            uint eid = Entity.NextEntity();

            position.EntityID = eid;

            switch (skill)
            {
                case Skills.detonate:
                    skillAoE = new SkillAoE()
                    {
                        EntityID = eid,
                        radius = 1,
                    };
                    sprite = new Sprite()
                    {
                        EntityID = eid,
                        SpriteSheet = game.Content.Load<Texture2D>("Spritesheets/BlueBullet"),
                        SpriteBounds = new Rectangle(0, 0, 10, 10),
                    };
                    position.Radius = 5;
                    break;
                default:
                    throw new Exception("Not a AoE skill");
            }

            collideable = new Collideable()
            {
                EntityID = eid,
                RoomID = position.RoomID,
                Bounds = new CircleBounds(position.Center, position.Radius),
            };

            game.SkillAoEComponent.Add(eid, skillAoE);
            game.PositionComponent.Add(eid, position);
            game.SpriteComponent.Add(eid, sprite);
            game.CollisionComponent.Add(eid, collideable);
            return eid;
        }
Ejemplo n.º 22
0
        //add new if statement for new skill
        public Skill(Skills skill)
        {
            isDamage = false;
              isHealing = false;

              if (skill.HasFlag(Skills.Fire))
              {
            skillRatio = 2.0f;
            Name = "Fire";
            isDamage = true;
            isHealing = false;
            target_type = Target_Type.Enemy;
              }
              if (skill.HasFlag(Skills.Ice))
              {
            skillRatio = 1.5f;
            Name = "Ice";
            isDamage = true;
            isHealing = false;
            target_type = Target_Type.Enemy;
              }
              if (skill.HasFlag(Skills.Heal)) //rename HealSelf?
              {
            skillRatio = 1.0f;
            Name = "Heal";
            isDamage = false;
            isHealing = true;
            target_type = Target_Type.Self;
              }
              if (skill.HasFlag(Skills.HealOther))
              {
              skillRatio = 1.0f;
              Name = "Heal Other";
              isDamage = false;
              isHealing = true;
              target_type = Target_Type.Ally;
              }
        }
Ejemplo n.º 23
0
        public void Read(BinaryReader _br, uint _version)
        {
            ecd = new EntityCreationData();
            ecd.read(_br, false);
            food = new LiveStats(Constants.cMaxPlayerFood, Constants.cFoodOversaturate);
            food.Read(_br);
            drink = new LiveStats(Constants.cMaxPlayerDrink, Constants.cDrinkOversaturate);
            drink.Read(_br);
            inventory             = GameUtils.ReadItemStack(_br);
            selectedInventorySlot = _br.ReadByte();
            bag = GameUtils.ReadItemStack(_br);
            if (bag.Length > 32)
            {
                ItemStack[] destinationArray = ItemStack.CreateArray(32);
                Array.Copy(bag, destinationArray, 32);
                bag = destinationArray;
            }
            alreadyCraftedList = new HashSet <string>();
            int num = _br.ReadUInt16();

            for (int i = 0; i < num; i++)
            {
                alreadyCraftedList.Add(_br.ReadString());
            }
            byte b = _br.ReadByte();

            for (int j = 0; j < b; j++)
            {
                spawnPoints.Add(new Vector3i(_br.ReadInt32(), _br.ReadInt32(), _br.ReadInt32()));
            }
            selectedSpawnPointKey = _br.ReadInt64();
            _br.ReadBoolean();
            _br.ReadInt16();
            if (_version > 1u)
            {
                bLoaded = _br.ReadBoolean();
            }
            if (_version > 2u)
            {
                lastSpawnPosition = new SpawnPosition(new Vector3i(_br.ReadInt32(), _br.ReadInt32(), _br.ReadInt32()), _br.ReadSingle());
            }
            else if (_version > 1u)
            {
                lastSpawnPosition = new SpawnPosition(new Vector3i(_br.ReadInt32(), _br.ReadInt32(), _br.ReadInt32()), 0f);
            }
            if (_version > 3u)
            {
                id = _br.ReadInt32();
            }
            if (_version > 4u)
            {
                droppedBackpackPosition = new Vector3i(_br.ReadInt32(), _br.ReadInt32(), _br.ReadInt32());
            }
            if (_version > 5u)
            {
                playerKills = _br.ReadInt32();
                zombieKills = _br.ReadInt32();
                deaths      = _br.ReadInt32();
                score       = _br.ReadInt32();
                equipment   = Equipment.Read(_br);
            }
            if (_version > 6u)
            {
                unlockedRecipeList = new List <string>();
                num = _br.ReadUInt16();
                for (int k = 0; k < num; k++)
                {
                    unlockedRecipeList.Add(_br.ReadString());
                }
            }
            if (_version > 7u)
            {
                _br.ReadUInt16();
                markerPosition = NetworkUtils.ReadVector3i(_br);
            }
            if (_version > 8u)
            {
                favoriteEquipment = Equipment.Read(_br);
            }
            if (_version > 10u)
            {
                experience = _br.ReadUInt32();
            }
            if (_version > 22u)
            {
                level = _br.ReadInt32();
            }
            if (_version > 11u)
            {
                bCrouchedLocked = _br.ReadBoolean();
            }
            craftingData.Read(_br, _version);

            if (_version > 14u)
            {
                if (_version < 18u)
                {
                    Skills pdfskills = new Skills();
                    pdfskills.Read(_br, _version);
                }
            }
            if (_version > 16u)
            {
                favoriteRecipeList = new List <string>();
                num = _br.ReadUInt16();
                for (int l = 0; l < num; l++)
                {
                    favoriteRecipeList.Add(_br.ReadString());
                }
            }
            if (_version > 17u)
            {
                int num2 = (int)_br.ReadUInt32();
                if (num2 > 0)
                {
                    //custom skill loader
                    MemoryStream pdfskills = new MemoryStream(0);
                    pdfskills = new MemoryStream(_br.ReadBytes(num2));
                    EntityPlayer EP = new EntityPlayer();
                    EP.Skills = new Skills();
                    if (pdfskills.Length > 0L)
                    {
                        EP.Skills.Read(new BinaryReader(pdfskills), 34u);
                    }
                    skills = EP.Skills.GetAllSkills();
                    //end custom skill loader
                }
            }
            if (_version > 18u)
            {
                totalItemsCrafted = _br.ReadUInt32();
                distanceWalked    = _br.ReadSingle();
                longestLife       = _br.ReadSingle();
            }
            if (_version > 19u)
            {
                waypoints = new WaypointCollection();
                waypoints.Read(_br);
            }
            if (_version > 23u)
            {
                skillPoints = _br.ReadInt32();
            }
            if (_version > 24u)
            {
                questJournal = new QuestJournal();
                questJournal.Read(_br);
            }
            if (_version > 25u)
            {
                deathUpdateTime = _br.ReadInt32();
            }
            if (_version > 26u)
            {
                currentLife = _br.ReadSingle();
            }
            if (_version > 29u)
            {
                bDead = _br.ReadBoolean();
            }
            if (_version > 30u)
            {
                _br.ReadByte();
                IsModdedSave = _br.ReadBoolean();
            }
            if (_version > 31u)
            {
                playerJournal = new PlayerJournal();
                playerJournal.Read(_br);
            }
            if (_version > 32u)
            {
                rentedVMPosition = NetworkUtils.ReadVector3i(_br);
                rentalEndTime    = _br.ReadUInt64();
            }
            if (_version > 33u)
            {
                trackedFriendEntityIds.Clear();
                int num3 = _br.ReadUInt16();
                for (int m = 0; m < num3; m++)
                {
                    trackedFriendEntityIds.Add(_br.ReadInt32());
                }
            }
        }
Ejemplo n.º 24
0
 public bool HasSkill(string name) => Skills.Any(x => x.SkillName == name);
Ejemplo n.º 25
0
    public LocalObject(string _uniqueName, Race _race, CharacterClass _cclass, Background _background, Origin _origin, int experience)
    {
        uniqueName = _uniqueName;
        race = _race;
        cclass = _cclass;
        background = _background;
        origin = _origin;

        xp = new Experience(experience, this);

        skills = new Skills(this);
        inventory = new Inventory(6, 1, "", true, null, this);

        hp = new HPComponent(this);
        movement = new Movement(this);
        defence = new Defence(this);
        attack = new Attack(this);
        abilities = new Abilities(this);
        fatigue = new Fatigue(this);
        eating = new Eating(this);
    }
Ejemplo n.º 26
0
 public Contest(Skills skill, Creature initiator, Creature defender) : base(initiator.encounter)
 {
 }
Ejemplo n.º 27
0
        /// <summary>
        /// Handle any kind of Monster interaction
        /// </summary>
        private void MonsterLife()
        {
            if (Monster == null)
            {
                return;
            }
            if ((DateTime.Now - LastEffect).TotalSeconds >= 5)
            {
                LastEffect = DateTime.Now;
                if (IsTarget)
                {
                    MapInstance.Broadcast(GenerateEff(824));
                }
                if (IsBonus)
                {
                    MapInstance.Broadcast(GenerateEff(826));
                }
            }

            // handle hit queue
            while (HitQueue.TryDequeue(out HitRequest hitRequest))
            {
                if (IsAlive && hitRequest.Session.Character.Hp > 0)
                {
                    int hitmode = 0;

                    // calculate damage
                    int damage = hitRequest.Session.Character.GenerateDamage(this, hitRequest.Skill, ref hitmode);

                    switch (hitRequest.TargetHitType)
                    {
                    case TargetHitType.SingleTargetHit:
                        MapInstance?.Broadcast($"su 1 {hitRequest.Session.Character.CharacterId} 3 {MapMonsterId} {hitRequest.Skill.SkillVNum} {hitRequest.Skill.Cooldown} {hitRequest.Skill.AttackAnimation} {hitRequest.SkillEffect} {hitRequest.Session.Character.PositionX} {hitRequest.Session.Character.PositionY} {(IsAlive ? 1 : 0)} {(int)((float)CurrentHp / (float)Monster.MaxHP * 100)} {damage} {hitmode} {hitRequest.Skill.SkillType - 1}");
                        break;

                    case TargetHitType.SingleTargetHitCombo:
                        MapInstance?.Broadcast($"su 1 {hitRequest.Session.Character.CharacterId} 3 {MapMonsterId} {hitRequest.Skill.SkillVNum} {hitRequest.Skill.Cooldown} {hitRequest.SkillCombo.Animation} {hitRequest.SkillCombo.Effect} {hitRequest.Session.Character.PositionX} {hitRequest.Session.Character.PositionY} {(IsAlive ? 1 : 0)} {(int)((float)CurrentHp / (float)Monster.MaxHP * 100)} {damage} {hitmode} {hitRequest.Skill.SkillType - 1}");
                        break;

                    case TargetHitType.SingleAOETargetHit:
                        switch (hitmode)
                        {
                        case 1:
                            hitmode = 4;
                            break;

                        case 3:
                            hitmode = 6;
                            break;

                        default:
                            hitmode = 5;
                            break;
                        }
                        if (hitRequest.ShowTargetHitAnimation)
                        {
                            MapInstance?.Broadcast($"su 1 {hitRequest.Session.Character.CharacterId} 3 {MapMonsterId} {hitRequest.Skill.SkillVNum} {hitRequest.Skill.Cooldown} {hitRequest.Skill.AttackAnimation} {hitRequest.SkillEffect} 0 0 {(IsAlive ? 1 : 0)} {(int)((float)CurrentHp / (float)Monster.MaxHP * 100)} 0 0 {hitRequest.Skill.SkillType - 1}");
                        }
                        MapInstance?.Broadcast($"su 1 {hitRequest.Session.Character.CharacterId} 3 {MapMonsterId} {hitRequest.Skill.SkillVNum} {hitRequest.Skill.Cooldown} {hitRequest.Skill.AttackAnimation} {hitRequest.SkillEffect} {hitRequest.Session.Character.PositionX} {hitRequest.Session.Character.PositionY} {(IsAlive ? 1 : 0)} {(int)((float)CurrentHp / (float)Monster.MaxHP * 100)} {damage} {hitmode} {hitRequest.Skill.SkillType - 1}");
                        break;

                    case TargetHitType.AOETargetHit:
                        switch (hitmode)
                        {
                        case 1:
                            hitmode = 4;
                            break;

                        case 3:
                            hitmode = 6;
                            break;

                        default:
                            hitmode = 5;
                            break;
                        }
                        MapInstance?.Broadcast($"su 1 {hitRequest.Session.Character.CharacterId} 3 {MapMonsterId} {hitRequest.Skill.SkillVNum} {hitRequest.Skill.Cooldown} {hitRequest.Skill.AttackAnimation} {hitRequest.SkillEffect} {hitRequest.Session.Character.PositionX} {hitRequest.Session.Character.PositionY} {(IsAlive ? 1 : 0)} {(int)((float)CurrentHp / (float)Monster.MaxHP * 100)} {damage} {hitmode} {hitRequest.Skill.SkillType - 1}");
                        break;

                    case TargetHitType.ZoneHit:
                        MapInstance?.Broadcast($"su 1 {hitRequest.Session.Character.CharacterId} 3 {MapMonsterId} {hitRequest.Skill.SkillVNum} {hitRequest.Skill.Cooldown} {hitRequest.Skill.AttackAnimation} {hitRequest.SkillEffect} {hitRequest.MapX} {hitRequest.MapY} {(IsAlive ? 1 : 0)} {(int)((float)CurrentHp / (float)Monster.MaxHP * 100)} {damage} 5 {hitRequest.Skill.SkillType - 1}");
                        break;

                    case TargetHitType.SpecialZoneHit:
                        MapInstance?.Broadcast($"su 1 {hitRequest.Session.Character.CharacterId} 3 {MapMonsterId} {hitRequest.Skill.SkillVNum} {hitRequest.Skill.Cooldown} {hitRequest.Skill.AttackAnimation} {hitRequest.SkillEffect} {hitRequest.Session.Character.PositionX} {hitRequest.Session.Character.PositionY} {(IsAlive ? 1 : 0)} {(int)((float)CurrentHp / (float)Monster.MaxHP * 100)} {damage} 0 {hitRequest.Skill.SkillType - 1}");
                        break;
                    }

                    // generate the kill bonus
                    hitRequest.Session.Character.GenerateKillBonus(this);
                }
                else
                {
                    // monster already has been killed, send cancel
                    hitRequest.Session.SendPacket($"cancel 2 {MapMonsterId}");
                }
                if (IsBoss)
                {
                    MapInstance.Broadcast(GenerateBoss());
                }
            }

            // Respawn
            if (!IsAlive && ShouldRespawn != null && ShouldRespawn.Value)
            {
                double timeDeath = (DateTime.Now - Death).TotalSeconds;
                if (timeDeath >= Monster.RespawnTime / 10d)
                {
                    Respawn();
                }
            }

            // normal movement
            else if (Target == -1)
            {
                Move();
            }

            // target following
            else
            {
                if (MapInstance != null)
                {
                    GetNearestOponent();
                    HostilityTarget();

                    ClientSession targetSession = MapInstance.GetSessionByCharacterId(Target);

                    // remove target in some situations
                    if (targetSession == null || targetSession.Character.Invisible || targetSession.Character.Hp <= 0 || CurrentHp <= 0)
                    {
                        RemoveTarget();
                        return;
                    }

                    NpcMonsterSkill npcMonsterSkill = null;
                    if (ServerManager.Instance.RandomNumber(0, 10) > 8 && Skills != null)
                    {
                        npcMonsterSkill = Skills.Where(s => (DateTime.Now - s.LastSkillUse).TotalMilliseconds >= 100 * s.Skill.Cooldown).OrderBy(rnd => _random.Next()).FirstOrDefault();
                    }

                    if (npcMonsterSkill?.Skill.TargetType == 1 && npcMonsterSkill?.Skill.HitType == 0)
                    {
                        TargetHit(targetSession, npcMonsterSkill);
                    }

                    // check if target is in range
                    if (!targetSession.Character.InvisibleGm && !targetSession.Character.Invisible && targetSession.Character.Hp > 0)
                    {
                        if (npcMonsterSkill != null && CurrentMp >= npcMonsterSkill.Skill.MpCost &&
                            Map.GetDistance(new MapCell
                        {
                            X = MapX,
                            Y = MapY
                        },
                                            new MapCell
                        {
                            X = targetSession.Character.PositionX,
                            Y = targetSession.Character.PositionY
                        }) < npcMonsterSkill.Skill.Range)
                        {
                            TargetHit(targetSession, npcMonsterSkill);
                        }
                        else if (Map.GetDistance(new MapCell
                        {
                            X = MapX,
                            Y = MapY
                        },
                                                 new MapCell
                        {
                            X = targetSession.Character.PositionX,
                            Y = targetSession.Character.PositionY
                        }) <= Monster.BasicRange)
                        {
                            TargetHit(targetSession, npcMonsterSkill);
                        }
                        else
                        {
                            FollowTarget(targetSession);
                        }
                    }
                    else
                    {
                        FollowTarget(targetSession);
                    }
                }
            }
        }
Ejemplo n.º 28
0
 public string GetName(Skills skill)
 {
     return(SkillList[skill].Name);
 }
Ejemplo n.º 29
0
        public static string GetSkillDesc(int id)
        {
            var data = Skills.Where(x => x.ID == id).ToList();

            return(data.Count > 0 ? data.First().Desc : "No description");
        }
Ejemplo n.º 30
0
 public T[] GetSkills <T>() where T : Skill
 {
     return(ElementAcquisitor.GetElements <T>(Skills.ToArray()));
 }
Ejemplo n.º 31
0
        public static void Gain(Mobile from, Skill skill)
        {
            if (from.Region is Regions.Jail)
            {
                return;
            }

            if (from is BaseCreature && ((BaseCreature)from).IsDeadPet)
            {
                return;
            }

            if (skill.SkillName == SkillName.Focus && from is BaseCreature)
            {
                return;
            }

            if (skill.Base < skill.Cap && skill.Lock == SkillLock.Up)
            {
                int toGain = 1;

                if (skill.Base <= 80.0)
                {
                    toGain = Utility.Random(4) + 1;
                }

                Skills skills = from.Skills;

                if ((skills.Total / skills.Cap) >= Utility.RandomDouble())    //( skills.Total >= skills.Cap )
                {
                    for (int i = 0; i < skills.Length; ++i)
                    {
                        Skill toLower = skills[i];

                        if (toLower != skill && toLower.Lock == SkillLock.Down && toLower.BaseFixedPoint >= toGain)
                        {
                            toLower.BaseFixedPoint -= toGain;
                            break;
                        }
                    }
                }

                if ((skills.Total + toGain) <= skills.Cap)
                {
                    skill.BaseFixedPoint += toGain;
                }
            }

            if (skill.Lock == SkillLock.Up)
            {
                SkillInfo info = skill.Info;

                if (from.StrLock == StatLockType.Up && (info.StrGain / 0.01) > Utility.RandomDouble())
                {
                    GainStat(from, Stat.Str);
                }
                else if (from.DexLock == StatLockType.Up && (info.DexGain / 0.01) > Utility.RandomDouble())
                {
                    GainStat(from, Stat.Dex);
                }
                else if (from.IntLock == StatLockType.Up && (info.IntGain / 0.01) > Utility.RandomDouble())
                {
                    GainStat(from, Stat.Int);
                }
            }
        }
Ejemplo n.º 32
0
        public void SetSkillsInSlot(IReadOnlyList <Skill> value, ItemSlot slot)
        {
            var oldValue = Skills.FirstOrDefault(ss => ss.Any(s => s.ItemSlot == slot));

            Skills.RemoveAndAdd(oldValue, value);
        }
Ejemplo n.º 33
0
    private void CheckForAction(string action)
    {
        if (Input.GetKeyDown(KeyCode.X))
        {
            options.show();
            attack.hide();
            skills.hide();
            items.hide();
            player.switchState(Transitions.Command.back);
        }

        Text   text;
        string name;
        Action move = new Attacks();

        (int, int, int)stats = (0, 0, 0);

        switch (action)
        {
        case "attack":
            break;

        case "skill":
            move = new Skills();
            break;

        case "item":
            //move = new Items();
            break;

        default:
            break;
        }

        if (Input.GetKeyDown(KeyCode.Z))
        {
            //gonna need a way to scroll down for when there are more than 4 options
            switch (index)
            {
            case 0:
                text        = button0.GetComponentInChildren <Text>();
                name        = text.ToString();
                displayStat = button0.GetComponent <SMDialogueTrigger>();
                stats       = move.Use(name);
                break;

            case 1:
                text        = button1.GetComponentInChildren <Text>();
                name        = text.ToString();
                displayStat = button1.GetComponent <SMDialogueTrigger>();
                stats       = move.Use(name);
                break;

            case 2:
                text        = button2.GetComponentInChildren <Text>();
                name        = text.ToString();
                displayStat = button2.GetComponent <SMDialogueTrigger>();
                stats       = move.Use(name);
                break;

            case 3:
                text        = button3.GetComponentInChildren <Text>();
                name        = text.ToString();
                displayStat = button3.GetComponent <SMDialogueTrigger>();
                stats       = move.Use(name);
                break;

            default:
                break;
            }

            playerNav.gameObject.SetActive(false);
            string[] msg = new string[] { "Your anixety changed by " + stats.Item1 +
                                          "!\nYour will changed by " + stats.Item2 + "!\nYou dealt " + stats.Item3 +
                                          " damage to the enemy!" };
            displayStat.TriggerDialogue(new Dialogue("", msg));
            SMDialogueTrigger.turn = 0;
            player.switchState(Transitions.Command.playerChoice);
        }
    }
Ejemplo n.º 34
0
 public IReadOnlyList <Skill> GetSkillsInSlot(ItemSlot slot)
 => Skills.Where(ss => ss.Any(s => s.ItemSlot == slot)).DefaultIfEmpty(new Skill[0]).First();
Ejemplo n.º 35
0
    public override bool ActivateByObject(ObjectInteraction ObjectUsed)
    {    //Code for handling otherobjects used on this object
         //Doors can be used by keys, picks and spikes.
        //ObjectInteraction objIntUsed = ObjectUsed.GetComponent<ObjectInteraction>();
        if (ObjectUsed != null)
        {
            switch (ObjectUsed.GetItemType())
            {
            case ObjectInteraction.KEY:                     //Key
                DoorKey dk = ObjectUsed.GetComponent <DoorKey>();
                if (dk != null)
                {
                    if (state() == true)
                    {
                        //Door is already open
                        UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 6));
                        return(true);
                    }
                    ObjectInteraction doorlock = getLockObjInt();
                    if (doorlock == null)
                    {
                        UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 3));
                        return(false);
                    }
                    if ((doorlock.link & 0x3F) == dk.owner)                         //This is a valid key for the door.
                    {
                        ToggleLock(true);
                        if (locked() == true)
                        {                                        //Locked message
                            UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 4));
                        }
                        else
                        {                                        //Unlockedmessage
                            UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 5));
                        }
                        return(true);
                    }
                    else
                    {
                        if (link == 53)
                        {                                //There is no lock
                            UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 3));
                        }
                        else
                        {                                //That is the wrong key.
                            UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 2));
                        }
                        return(true);
                    }
                }
                break;

            case ObjectInteraction.LOCKPICK:                            //lockpick
            {
                //lock pick skill check is based on the zpos of the "lock" object * 3 vs the players (lockpick skill + 1)
                //Locks cannot be picked if the zpos is 0xE or greater. In either case the skillcheck is attempted.
                ObjectInteraction LockObject = getLockObjInt();
                if (LockObject != null)
                {
                    int skillvalue  = UWCharacter.Instance.PlayerSkills.PickLock + 1;
                    int targetvalue = LockObject.zpos * 3;
                    Skills.SkillRollResult skillroll = Skills.SkillRoll(skillvalue, targetvalue);

                    if (LockObject.zpos >= 0xE)
                    {        //unpickable
                        if (skillroll == Skills.SkillRollResult.CriticalFailure)
                        {
                            BreakLockPick(ObjectUsed);
                        }
                        else
                        {
                            UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, StringController.str_your_lockpicking_attempt_failed_));
                        }
                    }
                    else
                    {
                        switch (skillroll)
                        {
                        case Skills.SkillRollResult.CriticalFailure:
                        {
                            BreakLockPick(ObjectUsed);
                            break;
                        }

                        case Skills.SkillRollResult.Failure:
                        {
                            UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, StringController.str_your_lockpicking_attempt_failed_));
                            break;
                        }

                        case Skills.SkillRollResult.Success:
                        case Skills.SkillRollResult.CriticalSuccess:
                        {
                            UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, StringController.str_you_succeed_in_picking_the_lock_));
                            UnlockDoor(true);
                            break;
                        }
                        }
                    }
                }
                else
                {
                    UWHUD.instance.MessageScroll.Add(StringController.instance.GetString(1, 3));        //There is no lock on that.
                }
            }
            break;

            //{
            //if (Pickable==true)
            //	{
            //		if (UWCharacter.Instance.PlayerSkills.TrySkill(Skills.SkillPicklock, Skills.DiceRoll(1,25)))
            //		{
            //		UWHUD.instance.MessageScroll.Add (StringController.instance.GetString (1,StringController.str_you_succeed_in_picking_the_lock_));
            //		UnlockDoor(true);
            //		}
            //	else
            //		{
            //		//Debug.Log ("Picklock failed!");
            //		UWHUD.instance.MessageScroll.Add (StringController.instance.GetString (1,StringController.str_your_lockpicking_attempt_failed_));
            //		//objIntUsed.consumeObject();
            //		}
            //	}
            //else
            //	{
            //		UWHUD.instance.MessageScroll.Add (StringController.instance.GetString (1,StringController.str_your_lockpicking_attempt_failed_));
            //	}
            //break;
            //}
            case ObjectInteraction.SPIKE:
            {
                if (Spike())
                {
                    ObjectUsed.consumeObject();
                }
                break;
            }

            default:
                return(false);
            }
        }
        else
        {
            return(false);
        }
        return(true);
    }
Ejemplo n.º 36
0
 public Character WithResetSkills() => WithSkills(Skills.Select(x => x.WithAvailable(true)));
Ejemplo n.º 37
0
 public int GetManaCost(Skills skill)
 {
     return(SkillList[skill].ManaCost);
 }
Ejemplo n.º 38
0
 public IReadOnlyList <Skill> GetSkillsInSlot(ItemSlot slot) =>
 Skills.FirstOrDefault(ss => ss.First().ItemSlot == slot) ?? Array.Empty <Skill>();
Ejemplo n.º 39
0
        public static void Gain(Mobile from, Skill skill)
        {
            if (from.Region.IsPartOf(typeof(Regions.Jail)))
            {
                return;
            }

            if (from is BaseCreature && ((BaseCreature)from).IsDeadPet)
            {
                return;
            }

            if (skill.SkillName == SkillName.Focus && from is BaseCreature)
            {
                return;
            }

            if (skill.Base < skill.Cap && skill.Lock == SkillLock.Up)
            {
                int toGain = 1;

                if (skill.Base <= 10.0)
                {
                    toGain = Utility.Random(4) + 1;
                }

                Skills skills = from.Skills;

                if (from.Player && (skills.Total / skills.Cap) >= Utility.RandomDouble())                    //( skills.Total >= skills.Cap )
                {
                    for (int i = 0; i < skills.Length; ++i)
                    {
                        Skill toLower = skills[i];

                        if (toLower != skill && toLower.Lock == SkillLock.Down && toLower.BaseFixedPoint >= toGain)
                        {
                            toLower.BaseFixedPoint -= toGain;
                            break;
                        }
                    }
                }

                #region Scroll of Alacrity
                PlayerMobile pm = from as PlayerMobile;

                if (from is PlayerMobile)
                {
                    if (pm != null && skill.SkillName == pm.AcceleratedSkill && pm.AcceleratedStart > DateTime.Now)
                    {
                        toGain *= Utility.RandomMinMax(2, 5);
                    }
                }
                #endregion

                if (!from.Player || (skills.Total + toGain) <= skills.Cap)
                {
                    skill.BaseFixedPoint += toGain;
                }
            }

            if (skill.Lock == SkillLock.Up)
            {
                SkillInfo info = skill.Info;

                if (from.StrLock == StatLockType.Up && (info.StrGain / 33.3) > Utility.RandomDouble())                  //changed from 33.3
                {
                    GainStat(from, Stat.Str);
                }
                else if (from.DexLock == StatLockType.Up && (info.DexGain / 33.3) > Utility.RandomDouble())
                {
                    GainStat(from, Stat.Dex);
                }
                else if (from.IntLock == StatLockType.Up && (info.IntGain / 33.3) > Utility.RandomDouble())
                {
                    GainStat(from, Stat.Int);
                }
            }
        }
Ejemplo n.º 40
0
 public Character WithUpdatedSkill(Skill s)
 {
     return(WithSkills(Skills.ReplaceWithID(s)));
 }
Ejemplo n.º 41
0
 public int GetLevel(Skills skill)
 {
     return(SkillList[skill].GetLevel());
 }
Ejemplo n.º 42
0
        public static void Gain(Mobile from, Skill skill)
        {
            if (from.Region.IsPartOf <Regions.Jail>())
            {
                return;
            }

            if (from is BaseCreature && ((BaseCreature)from).IsDeadPet)
            {
                return;
            }

            if (skill.SkillName == SkillName.Focus && from is BaseCreature && (!PetTrainingHelper.Enabled || !((BaseCreature)from).Controlled))
            {
                return;
            }

            if (skill.Base < skill.Cap && skill.Lock == SkillLock.Up)
            {
                int    toGain = 1;
                Skills skills = from.Skills;

                if (from is PlayerMobile && Siege.SiegeShard)
                {
                    int minsPerGain = Siege.MinutesPerGain(from, skill);

                    if (minsPerGain > 0)
                    {
                        if (Siege.CheckSkillGain((PlayerMobile)from, minsPerGain, skill))
                        {
                            if (from is PlayerMobile)
                            {
                                CheckReduceSkill((PlayerMobile)from, skills, toGain, skill);
                            }

                            if (skills.Total + toGain <= skills.Cap)
                            {
                                skill.BaseFixedPoint += toGain;
                            }
                        }

                        return;
                    }
                }

                if (skill.Base <= 10.0)
                {
                    toGain = Utility.Random(4) + 1;
                }

                #region Mondain's Legacy
                if (from is PlayerMobile && Server.Engines.Quests.QuestHelper.EnhancedSkill((PlayerMobile)from, skill))
                {
                    toGain *= Utility.RandomMinMax(2, 4);
                }
                #endregion

                #region Scroll of Alacrity
                if (from is PlayerMobile && skill.SkillName == ((PlayerMobile)from).AcceleratedSkill && ((PlayerMobile)from).AcceleratedStart > DateTime.UtcNow)
                {
                    ((PlayerMobile)from).SendLocalizedMessage(1077956); // You are infused with intense energy. You are under the effects of an accelerated skillgain scroll.
                    toGain = Utility.RandomMinMax(2, 5);
                }
                #endregion

                #region Skill Masteries
                else if (from is BaseCreature && (((BaseCreature)from).Controlled || ((BaseCreature)from).Summoned))
                {
                    Mobile master = ((BaseCreature)from).GetMaster();

                    if (master != null)
                    {
                        WhisperingSpell spell = SkillMasterySpell.GetSpell(master, typeof(WhisperingSpell)) as WhisperingSpell;

                        if (spell != null && master.InRange(from.Location, spell.PartyRange) && master.Map == from.Map && spell.EnhancedGainChance >= Utility.Random(100))
                        {
                            toGain = Utility.RandomMinMax(2, 5);
                        }
                    }
                }
                #endregion

                if (from is PlayerMobile)
                {
                    CheckReduceSkill((PlayerMobile)from, skills, toGain, skill);
                }

                if (!from.Player || (skills.Total + toGain <= skills.Cap))
                {
                    skill.BaseFixedPoint = Math.Min(skill.CapFixedPoint, skill.BaseFixedPoint + toGain);

                    if (from is PlayerMobile)
                    {
                        UpdateGGS(from, skill);
                    }
                }
            }

            #region Mondain's Legacy
            if (from is PlayerMobile)
            {
                Server.Engines.Quests.QuestHelper.CheckSkill((PlayerMobile)from, skill);
            }
            #endregion

            if (skill.Lock == SkillLock.Up && (!Siege.SiegeShard || !(from is PlayerMobile) || Siege.CanGainStat((PlayerMobile)from)))
            {
                SkillInfo info = skill.Info;

                // Old gain mechanic
                if (!Core.ML)
                {
                    if (from.StrLock == StatLockType.Up && (info.StrGain / 33.3) > Utility.RandomDouble())
                    {
                        GainStat(from, Stat.Str);
                    }
                    else if (from.DexLock == StatLockType.Up && (info.DexGain / 33.3) > Utility.RandomDouble())
                    {
                        GainStat(from, Stat.Dex);
                    }
                    else if (from.IntLock == StatLockType.Up && (info.IntGain / 33.3) > Utility.RandomDouble())
                    {
                        GainStat(from, Stat.Int);
                    }
                }
                else
                {
                    TryStatGain(info, from);
                }
            }
        }
Ejemplo n.º 43
0
        public static string GetSkillName(int id)
        {
            var data = Skills.Where(x => x.ID == id).ToList();

            return(data.Count > 0 ? data.First().Name : "Unknown");
        }
Ejemplo n.º 44
0
 public static void SetPlayerSkill(Skills skill, SkillAttribute attr, uint value)
 {
     if(skill < Skills.Last && attr < SkillAttribute.Last)
     {
         playerSkills[(int)skill, (int)attr] = value;
     }
 }
Ejemplo n.º 45
0
        public static Entity createPlayer(int skillLevel)
        {
            Entity e = ecs_instance.create();

            GameMap gameMap = ComponentMapper.get <GameMap> (ecs_instance.tag_manager.get_entity_by_tag("MAP"));
            Vector2 pos     = MapFactory.findSafeLocation(gameMap);

            //ECSInstance.entity_manager.add_component(e, new Position(new Vector2(576f, 360f),new Vector2(12.5f)));
            ecs_instance.add_component(e, new Position(pos, new Vector2(16)));
            //ECSInstance.entity_manager.add_component(e, new Position(new Vector2(0, 0), new Vector2(12.5f)));
            ecs_instance.add_component(e, new Velocity(4f));
            ecs_instance.add_component(e, new Controllable());
            //ECSInstance.entity_manager.add_component(e, new Sprite("characters\\lor_lar_sheet", "characters\\normals\\lor_lar_sheet_normals",32,32,0,0));;

            ecs_instance.add_component(e, AnimationFactory.createPlayerAnimation());
            ecs_instance.add_component(e, new CameraFocus(75));
            ecs_instance.add_component(e, new MapCollidable());
            ecs_instance.add_component(e, new Heading());
            ecs_instance.add_component(e, createLight(true, 8, new Vector3(new Vector2(576f, 360f), 10), 0.5f, new Vector4(1, 1, .6f, 1)));
            ecs_instance.add_component(e, new Transform());

            Information info = new Information();

            info.GeneralGroup   = "HUMAN";
            info.VariationGroup = "NONE";
            info.UniqueGroup    = "NONE";
            info.Name           = "PLAYER";
            ecs_instance.add_component(e, info);

            //create life
            Life life = new Life();

            life.IsAlive        = true;
            life.DeathLongevity = 1000;
            ecs_instance.add_component(e, life);

            //create interactions
            Interactable interact = new Interactable();

            interact.SupportedInteractions.PROJECTILE_COLLIDABLE = true;
            interact.SupportedInteractions.ATTACKABLE            = true;
            interact.SupportedInteractions.MAY_RECEIVE_VICTORY   = true;
            interact.SupportedInteractions.MAY_ADVANCE           = true;
            interact.SupportedInteractions.CAUSES_ADVANCEMENT    = false;
            interact.SupportedInteractions.AWARDS_VICTORY        = false;
            ecs_instance.add_component(e, interact);

            //create test equipment
            ItemFactory iFactory = new ItemFactory(ecs_instance);

            ecs_instance.add_component(e, iFactory.createTestEquipment());

            //setup experiences
            Knowledges knowledges = new Knowledges();

            knowledges.GeneralKnowledge.Add("HUMAN", new Knowledge {
                Name = "", Value = skillLevel, KnowledgeType = KnowledgeType.General
            });
            knowledges.GeneralKnowledge.Add("BAT", new Knowledge {
                Name = "", Value = skillLevel, KnowledgeType = KnowledgeType.General
            });
            knowledges.VariationKnowledge.Add("NONE", new Knowledge {
                Name = "", Value = 0f, KnowledgeType = KnowledgeType.General
            });
            knowledges.UniqueKnowledge.Add("NONE", new Knowledge {
                Name = "", Value = 0f, KnowledgeType = KnowledgeType.General
            });
            ecs_instance.add_component(e, knowledges);

            //setup attributes
            Statistics statistics = new Statistics();

            statistics.Focus = new Statistic {
                Name = "FOCUS", Value = skillLevel, StatType = StatType.FOCUS
            };
            statistics.Endurance = new Statistic {
                Name = "ENDURANCE", Value = skillLevel, StatType = StatType.ENDURANCE
            };
            statistics.Mind = new Statistic {
                Name = "MIND", Value = skillLevel, StatType = StatType.MIND
            };
            statistics.Muscle = new Statistic {
                Name = "MUSCLE", Value = skillLevel, StatType = StatType.MUSCLE
            };
            statistics.Perception = new Statistic {
                Name = "PERCEPTION", Value = skillLevel, StatType = StatType.PERCEPTION
            };
            statistics.Personality = new Statistic {
                Name = "PERSONALITY", Value = skillLevel, StatType = StatType.PERSONALITY
            };
            statistics.Quickness = new Statistic {
                Name = "QUICKNESS", Value = skillLevel, StatType = StatType.QUICKNESS
            };
            ecs_instance.add_component(e, statistics);

            //create health
            Health health = new Health(statistics.Endurance.Value * 5);            // new Health(5000);//

            health.RecoveryAmmount = statistics.Endurance.Value / 5;
            health.RecoveryRate    = 1000;
            ecs_instance.add_component(e, health);

            //setup skills
            Skills skills = new Skills();

            skills.Ranged = new Skill {
                Name = "RANGED", Value = skillLevel, SkillType = SkillType.Offensive
            };
            skills.Avoidance = new Skill {
                Name = "AVOIDANCE", Value = skillLevel, SkillType = SkillType.Defensive
            };
            skills.Melee = new Skill {
                Name = "MELEE", Value = skillLevel, SkillType = SkillType.Offensive
            };
            ecs_instance.add_component(e, skills);

            Factions factions = new Factions();

            factions.OwnerFaction = new Faction {
                Name = "PLAYER", Value = 100, FactionType = FactionType.Player
            };
            factions.KnownFactions.Add("WILDERNESS", new Faction {
                Name = "WILDERNESS", Value = -10, FactionType = FactionType.Wilderness
            });
            factions.KnownFactions.Add("ALLY", new Faction {
                Name = "ALLY", Value = 100, FactionType = FactionType.Ally
            });
            ecs_instance.add_component(e, factions);

            GameSession.PlayerState              = new PlayerState();
            GameSession.PlayerState.Statistics   = statistics;
            GameSession.PlayerState.Factions     = factions;
            GameSession.PlayerState.Health       = health;
            GameSession.PlayerState.Information  = info;
            GameSession.PlayerState.Interactable = interact;
            GameSession.PlayerState.Knowledges   = knowledges;
            GameSession.PlayerState.Life         = life;
            GameSession.PlayerState.Skills       = skills;

            ecs_instance.tag_manager.tag_entity("PLAYER", e);

            ecs_instance.resolve(e);

            return(e);
        }
Ejemplo n.º 46
0
        public Skills GetSkills(long beginTime, long endTime)
        {
            var sql =
                "SELECT amount, type, target, source, pet_zone, pet_id, skill_id, hotdot, critic, time, direction FROM skills WHERE time BETWEEN $begin AND $end ;";

            var command = new SQLiteCommand(sql, Connexion);

            command.Parameters.AddWithValue("$begin", beginTime);
            command.Parameters.AddWithValue("$end", endTime);

            var targetSourceSkills  = new Dictionary <EntityId, Dictionary <EntityId, List <Skill> > >();
            var sourceTargetSkills  = new Dictionary <EntityId, Dictionary <EntityId, List <Skill> > >();
            var sourceTargetIdSkill = new Dictionary <EntityId, Dictionary <EntityId, Dictionary <int, List <Skill> > > >();
            var sourceIdSkill       = new Dictionary <EntityId, Dictionary <int, List <Skill> > >();
            var rdr = command.ExecuteReader();

            while (rdr.Read())
            {
                var amount    = rdr.GetFieldValue <long>(rdr.GetOrdinal("amount"));
                var type      = (Type)rdr.GetFieldValue <long>(rdr.GetOrdinal("type"));
                var target    = new EntityId((ulong)rdr.GetFieldValue <long>(rdr.GetOrdinal("target")));
                var source    = new EntityId((ulong)rdr.GetFieldValue <long>(rdr.GetOrdinal("source")));
                var skillid   = rdr.GetFieldValue <long>(rdr.GetOrdinal("skill_id"));
                var direction = (HitDirection)rdr.GetFieldValue <long>(rdr.GetOrdinal("direction"));
                var critic    = rdr.GetFieldValue <long>(rdr.GetOrdinal("critic")) == 1;
                var hotdot    = rdr.GetFieldValue <long>(rdr.GetOrdinal("hotdot")) == 1;
                var time      = rdr.GetFieldValue <long>(rdr.GetOrdinal("time"));
                var petZone   = rdr.IsDBNull(rdr.GetOrdinal("pet_zone"))
                    ? 0
                    : rdr.GetFieldValue <long>(rdr.GetOrdinal("pet_zone"));
                var petId = rdr.IsDBNull(rdr.GetOrdinal("pet_id"))
                ? 0
                : rdr.GetFieldValue <long>(rdr.GetOrdinal("pet_id"));
                var pet   = BasicTeraData.Instance.MonsterDatabase.GetOrNull((ushort)petZone, (uint)petId);
                var skill = new Skill(amount, type, target, source, (int)skillid, hotdot, critic, time, pet, direction);

                if (!targetSourceSkills.ContainsKey(skill.Target))
                {
                    targetSourceSkills.Add(skill.Target, new Dictionary <EntityId, List <Skill> >());
                }

                if (!targetSourceSkills[skill.Target].ContainsKey(skill.Source))
                {
                    targetSourceSkills[skill.Target].Add(skill.Source, new List <Skill>());
                }

                if (!sourceTargetSkills.ContainsKey(skill.Source))
                {
                    sourceTargetIdSkill.Add(skill.Source, new Dictionary <EntityId, Dictionary <int, List <Skill> > >());
                    sourceIdSkill.Add(skill.Source, new Dictionary <int, List <Skill> >());
                    sourceTargetSkills.Add(skill.Source, new Dictionary <EntityId, List <Skill> >());
                }

                if (!sourceTargetSkills[skill.Source].ContainsKey(skill.Target))
                {
                    sourceTargetSkills[skill.Source].Add(skill.Target, new List <Skill>());
                    sourceTargetIdSkill[skill.Source].Add(skill.Target, new Dictionary <int, List <Skill> >());
                }

                if (!sourceTargetIdSkill[skill.Source][skill.Target].ContainsKey(skill.SkillId))
                {
                    sourceTargetIdSkill[skill.Source][skill.Target].Add(skill.SkillId, new List <Skill>());
                }

                if (!sourceIdSkill[skill.Source].ContainsKey(skill.SkillId))
                {
                    sourceIdSkill[skill.Source].Add(skill.SkillId, new List <Skill>());
                }

                targetSourceSkills[skill.Target][skill.Source].Add(skill);
                sourceTargetSkills[skill.Source][skill.Target].Add(skill);
                sourceTargetIdSkill[skill.Source][skill.Target][skill.SkillId].Add(skill);
                sourceIdSkill[skill.Source][skill.SkillId].Add(skill);
            }

            var skills = new Skills(sourceTargetSkills, targetSourceSkills, sourceTargetIdSkill, sourceIdSkill);

            return(skills);
        }
Ejemplo n.º 47
0
 public void Execute(Skills skill)
 {
     SkillList[skill].Execute();
 }
Ejemplo n.º 48
0
 public Skill SkillWithName(string name) => Skills.FirstOrDefault(x => x.SkillName == name);
Ejemplo n.º 49
0
 public UInt32 GetSkillLevel(Skills.Type skill)
 {
     return BotGameData.SkillLevels[skill] + BotGameData.ItemSkillLevels[skill];
 }
Ejemplo n.º 50
0
        public bool OnCast(Character caster, string args)
        {
            Character target = ReferenceSpell.FindAndConfirmSpellTarget(caster, args);

            if (target == null)
            {
                return(false);
            }

            ReferenceSpell.SendGenericCastMessage(caster, target, true);

            ReferenceSpell.SendGenericEnchantMessage(caster, target);

            int amount = Skills.GetSkillLevel(caster.magic) * 5;

            if (amount > 25)
            {
                amount = 25;
            }

            Effect.CreateCharacterEffect(Effect.EffectTypes.Protection_from_Poison, amount, target, Skills.GetSkillLevel(caster.magic) * 20, caster);

            return(true);
        }
        /// <summary>
        /// Reads RawData into structured data.
        /// </summary>
        public void StructureData(CFGData cfg)
        {
            this.Name = cfg.Name;

            this.Strength = cfg.Attributes[0];
            this.Intelligence = cfg.Attributes[1];
            this.Willpower = cfg.Attributes[2];
            this.Agility = cfg.Attributes[3];
            this.Endurance = cfg.Attributes[4];
            this.Personality = cfg.Attributes[5];
            this.Speed = cfg.Attributes[6];
            this.Luck = cfg.Attributes[7];

            this.PrimarySkill1 = (Skills)cfg.PrimarySkill1;
            this.PrimarySkill2 = (Skills)cfg.PrimarySkill2;
            this.PrimarySkill3 = (Skills)cfg.PrimarySkill3;
            this.MajorSkill1 = (Skills)cfg.MajorSkill1;
            this.MajorSkill2 = (Skills)cfg.MajorSkill2;
            this.MajorSkill3 = (Skills)cfg.MajorSkill3;
            this.MinorSkill1 = (Skills)cfg.MinorSkill1;
            this.MinorSkill2 = (Skills)cfg.MinorSkill2;
            this.MinorSkill3 = (Skills)cfg.MinorSkill3;
            this.MinorSkill4 = (Skills)cfg.MinorSkill4;
            this.MinorSkill5 = (Skills)cfg.MinorSkill5;
            this.MinorSkill6 = (Skills)cfg.MinorSkill6;

            this.HitPointsPerLevelOrMonsterLevel = cfg.HitPointsPerLevelOrMonsterLevel;

            float value = (cfg.AdvancementMultiplier >> 16) + ((cfg.AdvancementMultiplier & 0xffff)) / 65536f;
            try
            {
                this.AdvancementMultiplier = float.Parse(string.Format("{0:0.00}", value), NumberStyles.Float, CultureInfo.InvariantCulture);
            }
            catch
            {
                this.AdvancementMultiplier = value;
            }

            this.Paralysis = GetTolerance(cfg, EffectFlags.Paralysis);
            this.Magic = GetTolerance(cfg, EffectFlags.Magic);
            this.Poison = GetTolerance(cfg, EffectFlags.Poison);
            this.Fire = GetTolerance(cfg, EffectFlags.Fire);
            this.Frost = GetTolerance(cfg, EffectFlags.Frost);
            this.Shock = GetTolerance(cfg, EffectFlags.Shock);
            this.Disease = GetTolerance(cfg, EffectFlags.Disease);

            this.ForbiddenMaterials = (MaterialFlags)cfg.ForbiddenMaterialsFlags;
            this.ForbiddenShields = (ShieldFlags)((cfg.WeaponArmorShieldsBitfield >> 9) & 0x0f);
            this.ForbiddenArmors = (ArmorFlags)((cfg.WeaponArmorShieldsBitfield >> 6) & 0x07);
            this.ForbiddenProficiencies = (ProficiencyFlags)(cfg.WeaponArmorShieldsBitfield & 0x3f);
            this.ExpertProficiencies = (ProficiencyFlags)((cfg.WeaponArmorShieldsBitfield >> 16) & 0x3f);

            this.ShortBlades = GetProficiency(ProficiencyFlags.ShortBlades);
            this.LongBlades = GetProficiency(ProficiencyFlags.LongBlades);
            this.HandToHand = GetProficiency(ProficiencyFlags.HandToHand);
            this.Axes = GetProficiency(ProficiencyFlags.Axes);
            this.BluntWeapons = GetProficiency(ProficiencyFlags.BluntWeapons);
            this.MissileWeapons = GetProficiency(ProficiencyFlags.MissileWeapons);

            this.SpellPointMultiplier = GetSpellPointMultiplier(cfg);
            this.SpellPointMultiplierValue = GetSpellPointMultiplierValue(this.SpellPointMultiplier);

            this.DarknessPoweredMagery = (DarknessMageryFlags)((cfg.AbilityFlagsAndSpellPointsBitfield & 0x300) >> 8);
            this.LightPoweredMagery = (LightMageryFlags)((cfg.AbilityFlagsAndSpellPointsBitfield & 0x00C0) >> 6);

            this.SpellAbsorption = (SpellAbsorptionFlags)cfg.SpellAbsorptionFlags;

            this.NoRegenSpellPoints = HasSpecialAbility(cfg, SpecialAbilityFlags.NoRegenSpellPoints);

            this.AcuteHearing = HasSpecialAbility(cfg, SpecialAbilityFlags.AcuteHearing);
            this.Athleticism = HasSpecialAbility(cfg, SpecialAbilityFlags.Athleticism);
            this.AdrenalineRush = HasSpecialAbility(cfg, SpecialAbilityFlags.AdrenalineRush);

            this.Regeneration = (RegenerationFlags)cfg.Regeneration;
            this.RapidHealing = (RapidHealingFlags)cfg.RapidHealing;

            this.DamageFromSunlight = HasSpecialAbility(cfg, SpecialAbilityFlags.SunDamage);
            this.DamageFromHolyPlaces = HasSpecialAbility(cfg, SpecialAbilityFlags.HolyDamage);

            this.UndeadAttackModifier = GetAttackModifier(cfg, EnemyGroups.Undead);
            this.DaedraAttackModifier = GetAttackModifier(cfg, EnemyGroups.Daedra);
            this.HumanoidAttackModifier = GetAttackModifier(cfg, EnemyGroups.Humanoid);
            this.AnimalsAttackModifier = GetAttackModifier(cfg, EnemyGroups.Animals);
        }
Ejemplo n.º 52
0
 public int GetRemainingCooldown(Skills skill)
 {
     return(SkillList[skill].GetRemainingCooldown());
 }
Ejemplo n.º 53
0
        public static uint GetPlayerSkill(Skills skill, SkillAttribute attr)
        {
            if(skill < Skills.Last && attr < SkillAttribute.Last)
            {
                return playerSkills[(int)skill, (int)attr];
            }

            return 0;
        }
Ejemplo n.º 54
0
        public SkillUpdate( Skills skills )
            : base(0x3A)
        {
            this.EnsureCapacity( 6 + (skills.Length * 9) );

            m_Stream.Write( (byte) 0x02 ); // type: absolute, capped

            for ( int i = 0; i < skills.Length; ++i )
            {
                Skill s = skills[i];

                double v = s.Value;
                int uv = (int)(v * 10);

                if ( uv < 0 )
                    uv = 0;
                else if ( uv >= 0x10000 )
                    uv = 0xFFFF;

                m_Stream.Write( (ushort) (s.Info.SkillID + 1) );
                m_Stream.Write( (ushort) uv );
                m_Stream.Write( (ushort) s.BaseFixedPoint );
                m_Stream.Write( (byte) s.Lock );
                m_Stream.Write( (ushort) s.CapFixedPoint );
            }

            m_Stream.Write( (short) 0 ); // terminate
        }
Ejemplo n.º 55
0
        /// <summary>
        /// Called by Phoenix.Initialize().
        /// </summary>
        /// <param name="param">Client directory.</param>
        internal static void Load(object param)
        {
            string dir = param.ToString();

            try {
                Trace.WriteLine("Loading ultima data files started..", "MulLib");

                tiledata = TileData.Load(Path.Combine(dir, "tiledata.mul"));
                hues = Hues.Load(Path.Combine(dir, "hues.mul"));
                radarCol = RadarCol.Load(Path.Combine(dir, "radarcol.mul"));
                skills = Skills.Load(Path.Combine(dir, "skills.idx"), Path.Combine(dir, "skills.mul"));
                art = Art.Load(Path.Combine(dir, "artidx.mul"), Path.Combine(dir, "art.mul"), MulFileAccessMode.ReadOnly);
                multi = Multi.Load(Path.Combine(dir, "multi.idx"), Path.Combine(dir, "multi.mul"), MulFileAccessMode.ReadOnly);

                Trace.WriteLine("Loading ultima data files finished.", "MulLib");
            }
            catch (Exception e) {
                string msg = String.Format("Unable to load ultima data files. Program will be terminated. Exception:\r\n{0}", e);
                Trace.WriteLine(msg, "MulLib");
                MessageBox.Show(msg, "Fatal Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                Core.Terminate();
            }

            try {
                SyncEvent.Invoke(Loaded, null, EventArgs.Empty);
            }
            catch (Exception e) {
                Trace.WriteLine("Unhandled exception in DataFiles.Loaded event. Exception:\r\n" + e.ToString(), "MulLib");
            }
        }
Ejemplo n.º 56
0
        private void AddSkillMethod(string skillName)
        {
            string errors = null;

            if (IsValid(ValidatesProperties, out errors))
            {
                Errors = errors;
                using (var _database = new ITManagerEntities())
                {
                    if (!_database.ProfessionalSkills.Any(s => s.Name == SkillName) && !Skills.Any(s => s.Name == SkillName))
                    {
                        Skills.Add(new Models.UserPageModel.ProfessionalSkill
                        {
                            Name = skillName
                        });
                    }
                    else
                    {
                        Errors = "This skill is already exists.";
                    }
                }
            }
            else
            {
                Errors = errors;
            }

            Errors = Errors?.Trim();
        }
Ejemplo n.º 57
0
 public AbilityWrapper(Skills.Ability ability)
 {
     Ability = ability;
     _isDamaging = Ability.DamageOverride + Ability.DamageOnUseOverride > 0f;
 }
Ejemplo n.º 58
0
        public static void Gain(Mobile from, Skill skill, int toGain)
        {
            if (from.Region.IsPartOf <Jail>())
            {
                return;
            }

            if (from is BaseCreature && ((BaseCreature)from).IsDeadPet)
            {
                return;
            }

            if (skill.SkillName == SkillName.Focus && from is BaseCreature && !((BaseCreature)from).Controlled)
            {
                return;
            }

            if (skill.Base < skill.Cap && skill.Lock == SkillLock.Up)
            {
                Skills skills = from.Skills;

                if (from is PlayerMobile && Siege.SiegeShard)
                {
                    int minsPerGain = Siege.MinutesPerGain(from, skill);

                    if (minsPerGain > 0)
                    {
                        if (Siege.CheckSkillGain((PlayerMobile)from, minsPerGain, skill))
                        {
                            CheckReduceSkill(skills, toGain, skill);

                            if (skills.Total + toGain <= skills.Cap)
                            {
                                skill.BaseFixedPoint += toGain;
                            }
                        }

                        return;
                    }
                }

                if (toGain == 1 && skill.Base <= 80.0)
                {
                    toGain = Utility.Random(4) + 1;
                }

                #region Mondain's Legacy
                if (from is PlayerMobile && QuestHelper.EnhancedSkill((PlayerMobile)from, skill))
                {
                    toGain *= Utility.RandomMinMax(2, 4);
                }
                #endregion

                #region Scroll of Alacrity
                if (from is PlayerMobile && skill.SkillName == ((PlayerMobile)from).AcceleratedSkill &&
                    ((PlayerMobile)from).AcceleratedStart > DateTime.UtcNow)
                {
                    // You are infused with intense energy. You are under the effects of an accelerated skillgain scroll.
                    ((PlayerMobile)from).SendLocalizedMessage(1077956);

                    toGain = Utility.RandomMinMax(2, 5);
                }
                #endregion

                #region Skill Masteries
                else if (from is BaseCreature && !(from is Server.Engines.Despise.DespiseCreature) && (((BaseCreature)from).Controlled || ((BaseCreature)from).Summoned))
                {
                    Mobile master = ((BaseCreature)from).GetMaster();

                    if (master != null)
                    {
                        WhisperingSpell spell = SkillMasterySpell.GetSpell(master, typeof(WhisperingSpell)) as WhisperingSpell;

                        if (spell != null && master.InRange(from.Location, spell.PartyRange) && master.Map == from.Map &&
                            spell.EnhancedGainChance >= Utility.Random(100))
                        {
                            toGain = Utility.RandomMinMax(2, 5);
                        }
                    }
                }
                #endregion

                if (from is PlayerMobile)
                {
                    CheckReduceSkill(skills, toGain, skill);
                }

                if (!from.Player || (skills.Total + toGain <= skills.Cap))
                {
                    skill.BaseFixedPoint = Math.Min(skill.CapFixedPoint, skill.BaseFixedPoint + toGain);

                    EventSink.InvokeSkillGain(new SkillGainEventArgs(from, skill, toGain));

                    if (from is PlayerMobile)
                    {
                        UpdateGGS(from, skill);
                    }
                }
            }

            if (from is PlayerMobile)
            {
                QuestHelper.CheckSkill((PlayerMobile)from, skill);
            }

            if (skill.Lock == SkillLock.Up && (!Siege.SiegeShard || !(from is PlayerMobile) || Siege.CanGainStat((PlayerMobile)from)))
            {
                TryStatGain(skill.Info, from);
            }
        }
Ejemplo n.º 59
0
 public void Handle(SkillChosen domainEvent)
 {
     Skills          = Skills.Append(domainEvent.NewSkill.SkillId);
     FreeSkillPoints = domainEvent.NewFreeSkillPoints;
 }
Ejemplo n.º 60
0
 private void RemoveSkillMethod(Models.UserPageModel.ProfessionalSkill skill)
 {
     Skills.Remove(skill);
 }