コード例 #1
0
ファイル: CombatPet.cs プロジェクト: zhouzu/PcapPlayer
        public void Init(Player player, DamageType damageType, PetDevice petDevice)
        {
            SuppressGenerateEffect = true;
            NoCorpse             = true;
            TreasureCorpse       = false;
            ExpirationTime       = DateTime.UtcNow + TimeSpan.FromSeconds(45);
            Location             = player.Location.InFrontOf(5f);
            Location.LandblockId = new LandblockId(Location.GetCell());
            Name       = player.Name + "'s " + Name;
            P_PetOwner = player;
            PetOwner   = player.Guid.Full;
            SetCombatMode(CombatMode.Melee);
            EnterWorld();
            DamageType   = damageType;
            Attackable   = true;
            MonsterState = State.Awake;
            IsAwake      = true;
            player.CurrentActiveCombatPet = this;

            // copy ratings from pet device
            DamageRating           = petDevice.GearDamage;
            DamageResistRating     = petDevice.GearDamageResist;
            CritDamageRating       = petDevice.GearCritDamage;
            CritDamageResistRating = petDevice.GearCritDamageResist;
            CritRating             = petDevice.GearCrit;
            CritResistRating       = petDevice.GearCritResist;
        }
コード例 #2
0
        public override bool Init(Player player, PetDevice petDevice)
        {
            var success = base.Init(player, petDevice);

            if (!success)
            {
                return(false);
            }

            SetCombatMode(CombatMode.Melee);
            MonsterState = State.Awake;
            IsAwake      = true;

            // copy ratings from pet device
            DamageRating           = petDevice.GearDamage;
            DamageResistRating     = petDevice.GearDamageResist;
            CritDamageRating       = petDevice.GearCritDamage;
            CritDamageResistRating = petDevice.GearCritDamageResist;
            CritRating             = petDevice.GearCrit;
            CritResistRating       = petDevice.GearCritResist;

            // are CombatPets supposed to attack monsters that are in the same faction as the pet owner?
            // if not, there are a couple of different approaches to this
            // the easiest way for the code would be to simply set Faction1Bits for the CombatPet to match the pet owner's
            // however, retail pcaps did not contain Faction1Bits for CombatPets

            // doing this the easiest way for the code here, and just removing during appraisal
            Faction1Bits = player.Faction1Bits;

            return(true);
        }
コード例 #3
0
        public virtual bool Init(Player player, PetDevice petDevice)
        {
            if (player.CurrentActivePet != null)
            {
                if (player.CurrentActivePet is CombatPet)
                {
                    player.SendTransientError($"{player.CurrentActivePet.Name} is already active");
                    return(false);
                }

                var stowPet = WeenieClassId == player.CurrentActivePet.WeenieClassId;

                // despawn passive pet
                player.CurrentActivePet.Destroy();

                if (stowPet)
                {
                    return(false);
                }
            }

            if (IsPassivePet)
            {
                // get physics radius of player and pet
                var playerRadius = player.PhysicsObj.GetPhysicsRadius();
                var petRadius    = GetPetRadius();

                var spawnDist = playerRadius + petRadius + MinDistance;

                Location = player.Location.InFrontOf(spawnDist, true);
            }
            else
            {
                Location = player.Location.InFrontOf(5.0f);
            }

            Location.ObjCellID = Location.GetCell();

            Name = player.Name + "'s " + Name;

            PetOwner   = player.Guid.Full;
            P_PetOwner = player;

            var success = EnterWorld();

            if (!success)
            {
                player.SendTransientError($"Couldn't spawn {Name}");
                return(false);
            }

            player.CurrentActivePet = this;

            if (IsPassivePet)
            {
                nextSlowTickTime = Time.GetUnixTime();
            }

            return(true);
        }
コード例 #4
0
        public override void HandleActionUseOnTarget(Player player, WorldObject target)
        {
            if (PetDevice.IsEncapsulatedSpirit(this) && target is PetDevice petDevice)
            {
                petDevice.Refill(player, this);
                return;
            }

            // fallback on recipe manager
            base.HandleActionUseOnTarget(player, target);
        }
コード例 #5
0
ファイル: Pet.cs プロジェクト: wmatuszak/ACE
        public virtual bool?Init(Player player, PetDevice petDevice)
        {
            var result = HandleCurrentActivePet(player);

            if (result == null || !result.Value)
            {
                return(result);
            }

            if (IsPassivePet)
            {
                // get physics radius of player and pet
                var playerRadius = player.PhysicsObj.GetPhysicsRadius();
                var petRadius    = GetPetRadius();

                var spawnDist = playerRadius + petRadius + MinDistance;

                Location = player.Location.InFrontOf(spawnDist, true);

                TimeToRot = -1;
            }
            else
            {
                Location = player.Location.InFrontOf(5.0f);
            }

            Location.LandblockId = new LandblockId(Location.GetCell());

            Name = player.Name + "'s " + Name;

            PetOwner   = player.Guid.Full;
            P_PetOwner = player;

            // All pets don't leave corpses, this maybe should have been in data, but isn't so lets make sure its true.
            NoCorpse = true;

            var success = EnterWorld();

            if (!success)
            {
                player.SendTransientError($"Couldn't spawn {Name}");
                return(false);
            }

            player.CurrentActivePet = this;

            if (IsPassivePet)
            {
                nextSlowTickTime = Time.GetUnixTime();
            }

            return(true);
        }
コード例 #6
0
        public override void HandleActionUseOnTarget(Player player, WorldObject target)
        {
            if (PetDevice.IsEncapsulatedSpirit(this) && target is PetDevice petDevice)
            {
                petDevice.Refill(player, this);
                return;
            }

            if (Aetheria.IsAetheriaManaStone(this) && Aetheria.IsAetheria(target.WeenieClassId))
            {
                Aetheria.UseObjectOnTarget(player, this, target);
                return;
            }

            // fallback on recipe manager
            base.HandleActionUseOnTarget(player, target);
        }
コード例 #7
0
        public void Init(Player player, DamageType damageType, PetDevice petDevice)
        {
            SuppressGenerateEffect = true;
            NoCorpse       = true;
            ExpirationTime = DateTime.UtcNow + TimeSpan.FromSeconds(45);
            Location       = player.Location.InFrontOf(5f); // FIXME: get correct cell
            Name           = player.Name + "'s " + Name;
            P_PetOwner     = player;
            PetOwner       = player.Guid.Full;
            SetCombatMode(CombatMode.Melee);
            EnterWorld();
            DamageType   = damageType;
            Attackable   = true;
            MonsterState = State.Awake;
            IsAwake      = true;
            player.CurrentActiveCombatPet = this;

            // copy ratings from pet device
            DamageRating           = petDevice.GearDamage;
            DamageResistRating     = petDevice.GearDamageResist;
            CritDamageRating       = petDevice.GearCritDamage;
            CritDamageResistRating = petDevice.GearCritDamageResist;
            CritRating             = petDevice.GearCrit;
            CritResistRating       = petDevice.GearCritResist;

            /*var spellBase = DatManager.PortalDat.SpellTable.Spells[32981];
             * var spell = DatabaseManager.World.GetCachedSpell(32981);
             *
             * if (spell != null && spellBase != null)
             * {
             *  var enchantment = new Enchantment(this, player.Guid, spellBase, spellBase.Duration, 1, (uint)EnchantmentMask.Cooldown, spell.StatModType);
             *  player.Session.Network.EnqueueSend(new GameEventMagicUpdateEnchantment(player.Session, enchantment));
             * }
             * else
             * {
             *  Console.WriteLine("Cooldown spell or spellBase were null");
             * }
             */
        }
コード例 #8
0
        public override bool Init(Player player, PetDevice petDevice)
        {
            var success = base.Init(player, petDevice);

            if (!success)
            {
                return(false);
            }

            SetCombatMode(CombatMode.Melee);
            MonsterState = State.Awake;
            IsAwake      = true;

            // copy ratings from pet device
            DamageRating           = petDevice.GearDamage;
            DamageResistRating     = petDevice.GearDamageResist;
            CritDamageRating       = petDevice.GearCritDamage;
            CritDamageResistRating = petDevice.GearCritDamageResist;
            CritRating             = petDevice.GearCrit;
            CritResistRating       = petDevice.GearCritResist;

            return(true);
        }