diff --git a/Info/NeedsFinished.txt b/Info/NeedsFinished.txt index 06f1fa8f0..6d4d1bed7 100644 --- a/Info/NeedsFinished.txt +++ b/Info/NeedsFinished.txt @@ -20,3 +20,5 @@ Citizens CentrED Stuff - Add unspawnable tiles around dungeons + +Skills diff --git a/Projects/UOContent/Engines/Craft/Core/CraftGump.cs b/Projects/UOContent/Engines/Craft/Core/CraftGump.cs index 19825711f..1dd0f4bd2 100644 --- a/Projects/UOContent/Engines/Craft/Core/CraftGump.cs +++ b/Projects/UOContent/Engines/Craft/Core/CraftGump.cs @@ -136,19 +136,9 @@ public class CraftGump : DynamicGump resourceType = subResource.ItemType; } - var resourceCount = 0; - - if (_from.Backpack != null) - { - foreach (var item in _from.Backpack.FindItems()) - { - if (resourceType.IsInstanceOfType(item)) - { - resourceCount += item.Amount; - } - } - } - + // Calls the new static method to combine identical resources (Logs + Boards) + //var resourceCount = CraftItem.GetAvailableResourceAmount(_from, resourceType); + var resourceCount = Server.Engines.Craft.CraftItem.GetAvailableResourceAmount(_from, resourceType); builder.AddButton(15, 362, 4005, 4007, GetButtonID(6, 0)); if (nameNumber > 0) @@ -181,19 +171,9 @@ public class CraftGump : DynamicGump resourceType = subResource.ItemType; } - var resourceCount = 0; - - if (_from.Backpack != null) - { - foreach (var item in _from.Backpack.FindItems()) - { - if (resourceType.IsInstanceOfType(item)) - { - resourceCount += item.Amount; - } - } - } - + // Calls the new static method to combine identical resources + //var resourceCount = CraftItem.GetAvailableResourceAmount(_from, resourceType); + var resourceCount = Server.Engines.Craft.CraftItem.GetAvailableResourceAmount(_from, resourceType); builder.AddButton(15, 382, 4005, 4007, GetButtonID(6, 7)); if (nameNumber > 0) @@ -260,20 +240,9 @@ public class CraftGump : DynamicGump ); } - var resourceCount = 0; - - if (from.Backpack != null) - { - var type = subResource.ItemType; - foreach (var item in from.Backpack.FindItems()) - { - if (type.IsInstanceOfType(item)) - { - resourceCount += item.Amount; - } - } - } - + // Calls the new static method to combine identical resources in the sub-menu selection + //var resourceCount = CraftItem.GetAvailableResourceAmount(from, subResource.ItemType); + var resourceCount = Server.Engines.Craft.CraftItem.GetAvailableResourceAmount(from, subResource.ItemType); builder.AddButton(220, 60 + index * 20, 4005, 4007, GetButtonID(5, i)); if (subResource.Name.Number > 0) diff --git a/Projects/UOContent/Engines/Craft/Core/CraftItem.cs b/Projects/UOContent/Engines/Craft/Core/CraftItem.cs index e99760bbc..5efb22784 100644 --- a/Projects/UOContent/Engines/Craft/Core/CraftItem.cs +++ b/Projects/UOContent/Engines/Craft/Core/CraftItem.cs @@ -571,7 +571,35 @@ namespace Server.Engines.Craft return amount; } + public static int GetAvailableResourceAmount(Mobile from, Type resType) + { + var pack = from.Backpack; + if (pack == null) + { + return 0; + } + // Find if this resource has interchangeable types (like Logs -> Boards) + Type[] linkedTypes = null; + for (var j = 0; j < m_TypesTable.Length; ++j) + { + if (m_TypesTable[j][0] == resType) + { + linkedTypes = m_TypesTable[j]; + break; + } + } + + linkedTypes ??= [resType]; + + int totalAmount = 0; + for (int i = 0; i < linkedTypes.Length; i++) + { + totalAmount += pack.GetAmount(linkedTypes[i]); + } + + return totalAmount; + } public bool ConsumeRes( Mobile from, Type typeRes, CraftSystem craftSystem, ref int resHue, ref int maxAmount, ConsumeType consumeType, ref TextDefinition message @@ -890,6 +918,7 @@ namespace Server.Engines.Craft if (gainSkills) // This is a passive check. Success chance is entirely dependant on the main skill { + from.CheckSkill(craftSkill.SkillToMake, minSkill, maxSkill); } } diff --git a/Projects/UOContent/Items/Armor/BaseArmor.cs b/Projects/UOContent/Items/Armor/BaseArmor.cs index abfba0e53..545f07225 100644 --- a/Projects/UOContent/Items/Armor/BaseArmor.cs +++ b/Projects/UOContent/Items/Armor/BaseArmor.cs @@ -608,7 +608,41 @@ namespace Server.Items if (Core.AOS) { + var bonus = (int)(from.Skills.ArmsLore.Value / 20); + + for (var i = 0; i < bonus; i++) + { + switch (Utility.Random(5)) + { + case 0: + { + PhysicalBonus++; + break; + } + case 1: + { + FireBonus++; + break; + } + case 2: + { + ColdBonus++; + break; + } + case 3: + { + EnergyBonus++; + break; + } + case 4: + { + PoisonBonus++; + break; + } + } + } (tool as BaseRunicTool)?.ApplyAttributesTo(this); + from.CheckSkill(SkillName.ArmsLore, 0, 100); } return quality; diff --git a/Projects/UOContent/Items/Weapons/BaseWeapon.cs b/Projects/UOContent/Items/Weapons/BaseWeapon.cs index c296b461e..450594260 100644 --- a/Projects/UOContent/Items/Weapons/BaseWeapon.cs +++ b/Projects/UOContent/Items/Weapons/BaseWeapon.cs @@ -670,7 +670,8 @@ public abstract partial class BaseWeapon if (Quality == WeaponQuality.Exceptional) { - Attributes.WeaponDamage = 35; + Attributes.WeaponDamage = 25 + (int)(from.Skills.ArmsLore.Value / 10); + from.CheckSkill(SkillName.ArmsLore, 0, 100); if (Core.ML) {