mirror of
https://github.com/ACEmulator/ACE
synced 2026-08-17 12:26:06 -04:00
* HandleActionStackableSplitTo3D cleanup * Container: Remove duplicate TryRemoveFromInventoryWithoutClear() * Always fix placement positions in Container SortWorldObjectsIntoInventory * HandleActionStackableSplitToContainer cleanup * Inventory cleanup * Cleanup child object management (items held in hands) * More player inventory progress * Remove ActionChain.AddDelayTicks() (not used, we use time based) * Fix opcode log warning in InboundMessageManager * HandleActionDropItem looking good on the new system * HandleActionDropItem comments * Fix PlayerEnterWorld exception when player has null Location * More inventory progress * minor cleanups * Remove IComparable from WorldObject Only one WorldObject per ObjectGuid can exist at a time. The normal reference comparison is fine. IComparable gives the wrong impression that a WorldObject with the same ObjectGuid can be defined/instantiated by two different objects at the same time. * Inventory Progress * Fix stack size bug in Developer commands that use AddWeeniesToInventory * more inventory progress * More split progress * more stack progress * Use virtual MotionPickup * Inventory improvements * more inventory progress * player/npc give refactored * Convert some obsolete inventory functions over to TryConsumeFromInventoryWithNetworking * All inventory functions converted * Fix item decaying explosions * Fix player trade * More fixes * Fix giving partial stacks * Fix burden limitations when picking up items * Fix selling items * Inventory move to fixes * Cleanup TrySetChild * Don't decay IsStuck objects * Don't allow pickup of IsStuck items * Fix moving equipped items around * Weapons now work * Fix player location null restore * Add back HeritageBonuses to Player_Skills * Fix equipment spell/dispell on equip/dequip * Fix non-selectable wielded items from showing on the player model * Fix wield/unwield sound for equipped items that aren't childeren * TrySetChild should ClearChild if it's not a valid child. * Fix missile ammo as child * Send DeleteObject instead of PickupEvent on Dequip. This fixes disappearing weapon on relog * Couple notes where item recovieres should go * Hopefully this fixes the ammo being displayed incorrectly * Couple inventory fixes Fix death items dropping properly Fix giving equipped items appearing in targets inventory * Allow close container that has no viewer * Couple more log warnings for potential lost items * Attuned check removed for GiveObjecttoNPC * Don't consume unlimited use gems * Fix HandleDestroyBonded * Fix destroying equipped items when consumed
65 lines
2.1 KiB
C#
65 lines
2.1 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
|
|
using ACE.Server.WorldObjects;
|
|
|
|
namespace ACE.Server.Entity
|
|
{
|
|
/// <summary>
|
|
/// An attackable objects keeps track of its damage sources
|
|
/// </summary>
|
|
public class AttackDamage
|
|
{
|
|
public WorldObject Source;
|
|
public uint Amount;
|
|
public DateTime Time;
|
|
public bool IsCritical;
|
|
|
|
/// <summary>
|
|
/// Constructs a new attack damage
|
|
/// </summary>
|
|
/// <param name="source">The attacker or source of damage</param>
|
|
/// <param name="amount">The amount of hit damage</param>
|
|
/// <param name="criticalHit">Flag indicates critical hit</param>
|
|
public AttackDamage(WorldObject source, uint amount, bool criticalHit)
|
|
{
|
|
Source = source;
|
|
Amount = amount;
|
|
Time = DateTime.UtcNow;
|
|
IsCritical = criticalHit;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns the total damage from the source attacker
|
|
/// </summary>
|
|
/// <param name="attacks">The list of attacks performed on a target</param>
|
|
/// <param name="source">The attacker to add up the damage for</param>
|
|
public static ulong GetTotalDamage(List<AttackDamage> attacks, WorldObject source)
|
|
{
|
|
return (ulong)attacks.Where(a => a.Source == source).Sum(a => a.Amount);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns TRUE if last attack was critical hit
|
|
/// </summary>
|
|
/// <param name="attacks">The list of attacks performed on a target</param>
|
|
public static bool LastHitCritical(List<AttackDamage> attacks)
|
|
{
|
|
var lastHit = attacks.LastOrDefault();
|
|
if (lastHit != null)
|
|
return lastHit.IsCritical;
|
|
else
|
|
return false;
|
|
}
|
|
|
|
/// <summary>
|
|
/// Returns the top damager on creature death
|
|
/// </summary>
|
|
public static WorldObject GetTopDamager(List<AttackDamage> attacks)
|
|
{
|
|
// build the attack list
|
|
return new AttackList(attacks).TopDamager;
|
|
}
|
|
}
|
|
}
|