/// <summary> /// Generates normal loot (usually for dead mob-corpses). /// Returns null, if the loot is empty. /// </summary> /// <param name="lootable">The Object or Unit that is being looted</param> public static Asda2Loot GetOrCreateLoot(IAsda2Lootable lootable, Character triggerChar, Asda2LootEntryType type) { Asda2Loot loot = lootable.Loot; if (loot != null) { if (loot.IsMoneyLooted && loot.RemainingCount == 0) { return((Asda2Loot)null); } loot.Looters.Clear(); } else { lootable.Loot = loot = (Asda2Loot)Asda2LootMgr.CreateLoot <Asda2NPCLoot>(lootable, triggerChar, type, MapId.Silaris); } return(loot); }
/// <summary>Generates loot for Items and GOs.</summary> /// <param name="lootable">The Object or Unit that is being looted</param> /// <returns>The object's loot or null if there is nothing to get or the given Character can't access the loot.</returns> public static Asda2ObjectLoot CreateAndSendObjectLoot(IAsda2Lootable lootable, Character initialLooter, Asda2LootEntryType type) { Asda2Loot loot1 = initialLooter.LooterEntry.Loot; if (loot1 != null) { loot1.ForceDispose(); } IList <Asda2LooterEntry> looters = Asda2LootMgr.FindLooters(lootable, initialLooter); Asda2ObjectLoot loot2 = Asda2LootMgr.CreateLoot <Asda2ObjectLoot>(lootable, initialLooter, type, MapId.Silaris); if (loot2 != null) { initialLooter.LooterEntry.Loot = (Asda2Loot)loot2; loot2.Initialize(initialLooter, looters, MapId.Silaris); } return(loot2); }