Beispiel #1
0
		public GenericWeapon(bool isRanged, float minDmg, float maxDmg, int attackTime, DamageSchoolMask dmgType)
		{
			IsRanged = isRanged;
			IsMelee = !isRanged;
			AttackTime = attackTime;
			Damages = new[] { new DamageInfo(dmgType, minDmg, maxDmg) };
		}
Beispiel #2
0
		public GenericWeapon(InventorySlotTypeMask slot, float minDmg, float maxDmg, int attackTime, DamageSchoolMask dmgType)
		{
			InventorySlotMask = slot;
			AttackTime = attackTime;
			MaxRange = Unit.DefaultMeleeAttackRange;
			Damages = new[] { new DamageInfo(dmgType, minDmg, maxDmg) };
		}
Beispiel #3
0
 public static void SendMagicDamage(WorldObject victim, IEntity attacker, SpellId spell, uint damage,
                                    uint overkill, DamageSchoolMask schools, uint absorbed, uint resisted, uint blocked, bool unkBool,
                                    SpellLogFlags flags)
 {
     using (RealmPacketOut packet =
                new RealmPacketOut((PacketId)RealmServerOpCode.SMSG_SPELLNONMELEEDAMAGELOG, 40))
     {
         victim.EntityId.WritePacked((BinaryWriter)packet);
         if (attacker != null)
         {
             attacker.EntityId.WritePacked((BinaryWriter)packet);
         }
         else
         {
             packet.Write((byte)0);
         }
         packet.Write((uint)spell);
         packet.Write(damage);
         packet.Write(overkill);
         packet.Write((byte)schools);
         packet.Write(absorbed);
         packet.Write(resisted);
         packet.Write(0);
         packet.Write(unkBool);
         packet.Write(blocked);
         packet.Write((uint)flags);
         packet.Write((byte)0);
         victim.SendPacketToArea(packet, true, false, Locale.Any, new float?());
     }
 }
Beispiel #4
0
 public GenericWeapon(InventorySlotTypeMask slot, float minDmg, float maxDmg, int attackTime,
                      DamageSchoolMask dmgType)
 {
     this.InventorySlotMask = slot;
     this.AttackTime        = attackTime;
     this.MaxRange          = Unit.DefaultMeleeAttackRange;
     this.Damages           = new DamageInfo[1]
     {
         new DamageInfo(dmgType, minDmg, maxDmg)
     };
     this.IsWeapon = true;
 }
Beispiel #5
0
        public int Absorb(int absorbAmount, DamageSchoolMask schools)
        {
            if (absorbAmount <= 0 || this.SpellEffect != null &&
                this.Spell.AttributesExD.HasFlag((Enum)SpellAttributesExD.CannotBeAbsorbed))
            {
                return(0);
            }
            if (schools.HasAnyFlag(this.UsedSchool))
            {
                int num = Math.Min(this.Damage, absorbAmount);
                absorbAmount  -= num;
                this.Absorbed += num;
            }

            return(absorbAmount);
        }
Beispiel #6
0
        public int Absorb(int absorbAmount, DamageSchoolMask schools)
        {
            if (absorbAmount <= 0)
            {
                return(0);
            }

            if (SpellEffect != null && Spell.AttributesExD.HasFlag(SpellAttributesExD.CannotBeAbsorbed))
            {
                return(0);
            }

            if (schools.HasAnyFlag(UsedSchool))
            {
                var value = Math.Min(Damage, absorbAmount);
                absorbAmount -= value;
                Absorbed     += value;
            }
            return(absorbAmount);
        }
Beispiel #7
0
 public GenericWeapon(InventorySlotTypeMask slot, float minDmg, float maxDmg, DamageSchoolMask dmgType)
     : this(slot, minDmg, maxDmg, GenericWeapon.Fists.AttackTime, dmgType)
 {
     this.IsWeapon = true;
 }
Beispiel #8
0
		public GenericWeapon(InventorySlotTypeMask slot, float minDmg, float maxDmg, DamageSchoolMask dmgType)
			: this(slot, minDmg, maxDmg, Fists.AttackTime, dmgType)
		{
		}
Beispiel #9
0
 public DamageInfo(DamageSchoolMask school, float min, float max)
 {
     School  = school;
     Minimum = min;
     Maximum = max;
 }
Beispiel #10
0
		public static void SendMagicDamage(WorldObject victim, IEntity attacker,
			SpellId spell, uint damage, uint overkill, DamageSchoolMask schools,
			uint absorbed, uint resisted, uint blocked, 
			bool unkBool, SpellLogFlags  flags)
		{
			using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SPELLNONMELEEDAMAGELOG, 40))
			{
				victim.EntityId.WritePacked(packet);
				if (attacker != null)
				{
					attacker.EntityId.WritePacked(packet);
				}
				else
				{
					packet.Write((byte)0);
				}
				packet.Write((uint)spell);

				packet.Write(damage);
				packet.Write(overkill);
				packet.Write((byte)schools);
				packet.Write(absorbed);
				packet.Write(resisted);
				packet.Write(0);				// apparently always 0
				packet.Write(unkBool);			// 0 or 1
				packet.Write(blocked);
				// also flags 0x8, 0x10, 
				packet.Write((uint)flags);
				packet.Write((byte)0);// unused by client

				victim.SendPacketToArea(packet, true);
			}
		}
Beispiel #11
0
 public static bool HasAnyFlag(this DamageSchoolMask flags, DamageSchool school)
 {
     return((flags & (DamageSchoolMask)(1 << (int)(school & (DamageSchool)31))) != DamageSchoolMask.None);
 }
Beispiel #12
0
 public static bool HasAnyFlag(this DamageSchoolMask flags, DamageSchoolMask otherFlags)
 {
     return((flags & otherFlags) != DamageSchoolMask.None);
 }
Beispiel #13
0
 public static bool HasAnyFlag(this DamageSchoolMask flags, DamageSchool school)
 {
     return((flags & (DamageSchoolMask)(1 << (int)school)) != 0);
 }
Beispiel #14
0
		public GenericWeapon(bool isRanged, float minDmg, float maxDmg, DamageSchoolMask dmgType)
			: this(isRanged, minDmg, maxDmg, Fists.AttackTime, dmgType)
		{
		}
Beispiel #15
0
 public DamageInfo(DamageSchoolMask school, float min, float max)
 {
     School = school;
     Minimum = min;
     Maximum = max;
 }
Beispiel #16
0
 public DamageInfo(DamageSchoolMask school, float min, float max)
 {
     this.School  = school;
     this.Minimum = min;
     this.Maximum = max;
 }
Beispiel #17
0
		public int Absorb(int absorbAmount, DamageSchoolMask schools)
		{
			if (absorbAmount <= 0)
			{
				return 0;
			}

			if (SpellEffect != null && Spell.AttributesExD.HasFlag(SpellAttributesExD.CannotBeAbsorbed))
			{
				return 0;
			}

			if (schools.HasAnyFlag(UsedSchool))
			{
				var value = Math.Min(Damage, absorbAmount);
				absorbAmount -= value;
				Absorbed += value;
			}
			return absorbAmount;
		}
		public static bool HasAnyFlag(this DamageSchoolMask flags, DamageSchoolMask otherFlags)
		{
			return (flags & otherFlags) != 0;
		}
Beispiel #19
0
        public static void SendMagicDamage(WorldObject victim, IEntity attacker,
                                           SpellId spell, uint damage, uint overkill, DamageSchoolMask schools,
                                           uint absorbed, uint resisted, uint blocked,
                                           bool unkBool, SpellLogFlags flags)
        {
            using (var packet = new RealmPacketOut(RealmServerOpCode.SMSG_SPELLNONMELEEDAMAGELOG, 40))
            {
                victim.EntityId.WritePacked(packet);
                if (attacker != null)
                {
                    attacker.EntityId.WritePacked(packet);
                }
                else
                {
                    packet.Write((byte)0);
                }
                packet.Write((uint)spell);

                packet.Write(damage);
                packet.Write(overkill);
                packet.Write((byte)schools);
                packet.Write(absorbed);
                packet.Write(resisted);
                packet.Write(0);                                        // apparently always 0
                packet.Write(unkBool);                                  // 0 or 1
                packet.Write(blocked);
                // also flags 0x8, 0x10,
                packet.Write((uint)flags);
                packet.Write((byte)0);                // unused by client

                victim.SendPacketToArea(packet, true, false);
            }
        }
Beispiel #20
0
 public GenericWeapon(InventorySlotTypeMask slot, float minDmg, float maxDmg, int attackTime, DamageSchoolMask dmgType)
 {
     InventorySlotMask = slot;
     AttackTime        = attackTime;
     MaxRange          = Unit.DefaultMeleeAttackRange;
     Damages           = new[] { new DamageInfo(dmgType, minDmg, maxDmg) };
 }