Ejemplo n.º 1
0
        /// <summary>
        /// Gets the weapon of a projectile.
        /// For certain projectiles, it will pull from a list of
        /// projectile-to-weapon Dictionaries and returns
        /// the weapon based off the dictionary mapping.
        /// </summary>
        /// <param name="owner">Index of the owner of projectile.</param>
        /// <param name="type">Type of projectile.</param>
        /// <returns>Returns the item the projectile came from.</returns>
        public static PvPItem GetProjectileWeapon(PvPPlayer owner, int type)
        {
            PvPItem weapon;

            if (PresetData.PresetProjDamage.ContainsKey(type))
            {
                weapon = new PvPItem();
            }
            else if (PresetData.ProjHooks.ContainsKey(type))
            {
                weapon = owner.FindPlayerItem(PresetData.ProjHooks[type]);
            }
            else if (PresetData.FromWhatItem.ContainsKey(type))
            {
                weapon = owner.FindPlayerItem(PresetData.FromWhatItem[type]);
            }
            else if (PresetData.MinionItem.ContainsKey(type))
            {
                weapon = owner.FindPlayerItem(PresetData.MinionItem[type]);
            }
            else
            {
                weapon = owner.HeldItem;
            }
            return(weapon);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the weapon of a projectile.
        /// For certain projectiles, it will pull from a list of
        /// projectile-to-weapon-mapping Dictionaries and returns
        /// the weapon based off the dictionary mapping.
        /// </summary>
        /// <param Name="owner">Owner of projectile.</param>
        /// <param Name="type">Type of projectile.</param>
        /// <returns>Returns the item the projectile came from.</returns>
        public static PvPItem GetProjectileWeapon(PvPPlayer owner, int type)
        {
            PvPItem weapon;

            if (PresetData.PresetProjDamage.ContainsKey(type))
            {
                weapon = new PvPItem {
                    Damage      = PresetData.PresetProjDamage[type],
                    SpecialName = Lang.GetProjectileName(type).ToString()
                };
            }
            else if (PresetData.ProjHooks.ContainsKey(type))
            {
                weapon = new PvPItem(type);
            }
            else if (PresetData.FromWhatItem.ContainsKey(type))
            {
                weapon = owner.FindPlayerItem(PresetData.FromWhatItem[type]);
            }
            else if (PresetData.MinionItem.ContainsKey(type))
            {
                weapon = owner.FindPlayerItem(PresetData.MinionItem[type]);
            }
            else
            {
                weapon = owner.GetPlayerItem;
            }
            return(weapon);
        }