Overwrite

Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
Unstable Kitsune
2023-11-28 23:20:26 -05:00
parent 3cd54811de
commit b918192e4e
11608 changed files with 2644205 additions and 47 deletions

View File

@@ -0,0 +1,96 @@
#region Header
// _,-'/-'/
// . __,-; ,'( '/
// \. `-.__`-._`:_,-._ _ , . ``
// `:-._,------' ` _,`--` -: `_ , ` ,' :
// `---..__,,--' (C) 2023 ` -'. -'
// # Vita-Nex [http://core.vita-nex.com] #
// {o)xxx|===============- # -===============|xxx(o}
// # #
#endregion
#region References
using System;
using System.Collections.Generic;
using System.Linq;
using Server;
using Server.Engines.Craft;
using Server.Items;
#endregion
namespace VitaNex.SuperCrafts
{
public sealed class CraftInfo
{
public static ResourceInfo[] DefResources = { new ResourceInfo(typeof(Gold), "Gold Coin", 60000) };
public CraftItem CraftItem { get; private set; }
public Type TypeOf { get; private set; }
public TextDefinition Group { get; private set; }
public TextDefinition Name { get; private set; }
public SkillName Skill { get; private set; }
public double MinSkill { get; private set; }
public double MaxSkill { get; private set; }
public ResourceInfo[] Resources { get; private set; }
private readonly Action<CraftItem> _OnAdded;
public CraftInfo(
Type t,
TextDefinition group,
TextDefinition name,
SkillName skill,
double skillReq,
IEnumerable<ResourceInfo> resources,
Action<CraftItem> onAdded = null)
: this(t, group, name, skill, skillReq, skillReq, resources, onAdded)
{ }
public CraftInfo(
Type t,
TextDefinition group,
TextDefinition name,
SkillName skill,
double minSkill,
double maxSkill,
IEnumerable<ResourceInfo> resources,
Action<CraftItem> onAdded = null)
{
TypeOf = t;
Group = group.IsNullOrWhiteSpace() ? new TextDefinition("Misc") : group;
Name = name.IsNullOrWhiteSpace() ? new TextDefinition("Unknown") : name;
Skill = skill;
MinSkill = Math.Max(0.0, Math.Min(minSkill, maxSkill));
MaxSkill = Math.Max(MinSkill, Math.Max(minSkill, maxSkill));
if (resources != null)
{
Resources = resources.Where(r => r.TypeOf != null && r.TypeOf.IsEqualOrChildOf<Item>()).ToArray();
}
if (Resources.Length == 0)
{
Resources = DefResources.Dupe(r => new ResourceInfo(r.TypeOf, r.Name, r.Amount));
}
_OnAdded = onAdded;
}
public void OnAdded(CraftItem item)
{
if (item == null)
{
return;
}
CraftItem = item;
if (_OnAdded != null)
{
_OnAdded(CraftItem);
}
}
}
}

View File

@@ -0,0 +1,33 @@
#region Header
// _,-'/-'/
// . __,-; ,'( '/
// \. `-.__`-._`:_,-._ _ , . ``
// `:-._,------' ` _,`--` -: `_ , ` ,' :
// `---..__,,--' (C) 2023 ` -'. -'
// # Vita-Nex [http://core.vita-nex.com] #
// {o)xxx|===============- # -===============|xxx(o}
// # #
#endregion
#region References
using System;
using Server;
#endregion
namespace VitaNex.SuperCrafts
{
public class ResourceInfo
{
public Type TypeOf { get; private set; }
public TextDefinition Name { get; private set; }
public int Amount { get; private set; }
public ResourceInfo(Type t, TextDefinition name, int amount)
{
TypeOf = t;
Name = name.IsNullOrWhiteSpace() ? new TextDefinition("Unknown") : name;
Amount = Math.Max(1, amount);
}
}
}

View File

@@ -0,0 +1,212 @@
#region Header
// _,-'/-'/
// . __,-; ,'( '/
// \. `-.__`-._`:_,-._ _ , . ``
// `:-._,------' ` _,`--` -: `_ , ` ,' :
// `---..__,,--' (C) 2023 ` -'. -'
// # Vita-Nex [http://core.vita-nex.com] #
// {o)xxx|===============- # -===============|xxx(o}
// # #
#endregion
#region References
using System;
using System.Collections.Generic;
using System.Linq;
using Server;
using Server.Engines.Craft;
using Server.Items;
#endregion
namespace VitaNex.SuperCrafts
{
public abstract class SuperCraftSystem : CraftSystem
{
public static List<SuperCraftSystem> Instances { get; private set; }
static SuperCraftSystem()
{
var types = typeof(SuperCraftSystem).GetConstructableChildren();
Instances = types.Select(t => t.CreateInstanceSafe<SuperCraftSystem>()).Where(cs => cs != null).ToList();
var sys = new ObjectProperty("Systems");
var list = sys.GetValue(typeof(CraftSystem)) as List<CraftSystem>;
if (list != null)
{
list.AddRange(Instances);
list.Prune();
}
}
// If there are issues with initialization, uncomment the next line:
//[CallPriority(Int32.MaxValue - (Int16.MaxValue * 2))]
public static void Initialize()
{
Instances.Prune();
}
public static SuperCraftSystem Resolve(Type tSys)
{
return Instances.FirstOrDefault(cs => cs.TypeEquals(tSys));
}
public static TSys Resolve<TSys>()
where TSys : SuperCraftSystem
{
return Instances.OfType<TSys>().FirstOrDefault();
}
public abstract TextDefinition GumpTitle { get; }
public override sealed int GumpTitleNumber => GumpTitle.Number;
public override sealed string GumpTitleString => GumpTitle.String;
public SuperCraftSystem(int minCraftEffect, int maxCraftEffect, double delay)
: base(minCraftEffect, maxCraftEffect, delay)
{ }
public override abstract void InitCraftList();
#if ServUO
public override int CanCraft(Mobile m, ITool tool, Type itemType)
#else
public override int CanCraft(Mobile m, BaseTool tool, Type itemType)
#endif
{
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
{
return 1044038; // You have worn out your tool!
}
if (tool is Item o && !BaseTool.CheckAccessible(o, m))
{
return 1044263; // The tool must be on your person to use.
}
return 0;
}
public virtual int AddCraft<TItem>(
TextDefinition group,
TextDefinition name,
double skillReq,
ResourceInfo[] resources,
Action<CraftItem> onAdded = null)
where TItem : Item
{
return AddCraft<TItem>(group, name, MainSkill, skillReq, resources, onAdded);
}
public virtual int AddCraft<TItem>(
TextDefinition group,
TextDefinition name,
SkillName skill,
double skillReq,
ResourceInfo[] resources,
Action<CraftItem> onAdded = null)
where TItem : Item
{
return AddCraft(new CraftInfo(typeof(TItem), group, name, skill, skillReq, resources, onAdded));
}
public virtual int AddCraft<TItem>(
TextDefinition group,
TextDefinition name,
double minSkill,
double maxSkill,
ResourceInfo[] resources,
Action<CraftItem> onAdded = null)
where TItem : Item
{
return AddCraft<TItem>(group, name, MainSkill, minSkill, maxSkill, resources, onAdded);
}
public virtual int AddCraft<TItem>(
TextDefinition group,
TextDefinition name,
SkillName skill,
double minSkill,
double maxSkill,
ResourceInfo[] resources,
Action<CraftItem> onAdded = null)
where TItem : Item
{
return AddCraft(new CraftInfo(typeof(TItem), group, name, skill, minSkill, maxSkill, resources, onAdded));
}
public virtual int AddCraft(CraftInfo info)
{
if (info == null || info.TypeOf == null || info.Resources == null || info.Resources.Length == 0)
{
return -1;
}
if (!info.TypeOf.IsConstructableFrom<Item>())
{
return -1;
}
var res = info.Resources[0];
var msg = String.Format("You do not have the required {0} to craft that item.", res.Name.GetString());
var index = AddCraft(
info.TypeOf,
info.Group,
info.Name,
info.Skill,
info.MinSkill,
info.MaxSkill,
res.TypeOf,
res.Name,
res.Amount,
msg);
if (info.Resources.Length > 1)
{
foreach (var r in info.Resources.Skip(1))
{
AddRes(
index,
r.TypeOf,
r.Name,
r.Amount,
String.Format("You do not have the required {0} to craft that item.", r.Name.GetString()));
}
}
info.OnAdded(CraftItems.GetAt(index));
return index;
}
public CraftItem FindCraft<T>()
{
return FindCraft(typeof(T));
}
public virtual CraftItem FindCraft(Type type)
{
return FindCraft(type, true);
}
public CraftItem FindCraft<T>(bool subClasses)
{
return FindCraft(typeof(T), subClasses);
}
public virtual CraftItem FindCraft(Type type, bool subClasses)
{
if (CraftItems != null)
{
return subClasses ? CraftItems.SearchForSubclass(type) : CraftItems.SearchFor(type);
}
return null;
}
}
}

View File

@@ -0,0 +1,261 @@
#region Header
// _,-'/-'/
// . __,-; ,'( '/
// \. `-.__`-._`:_,-._ _ , . ``
// `:-._,------' ` _,`--` -: `_ , ` ,' :
// `---..__,,--' (C) 2023 ` -'. -'
// # Vita-Nex [http://core.vita-nex.com] #
// {o)xxx|===============- # -===============|xxx(o}
// # #
#endregion
#region References
using System;
using Server;
using Server.Engines.Craft;
using Server.Items;
using VitaNex.Items;
#endregion
namespace VitaNex.SuperCrafts
{
public sealed class Pyrotechnics : SuperCraftSystem
{
public static Type PowderType = ScriptCompiler.FindTypeByName("BlackPowder") ?? typeof(SulfurousAsh);
public override SkillName MainSkill => SkillName.Alchemy;
public override TextDefinition GumpTitle => "<BASEFONT COLOR=#FFFFFF><CENTER>PYROTECHNICS MENU</CENTER>";
public Pyrotechnics()
: base(0, 0, 3)
{
MarkOption = true;
}
#if ServUO
public override int CanCraft(Mobile m, ITool tool, Type itemType)
#else
public override int CanCraft(Mobile m, BaseTool tool, Type itemType)
#endif
{
if (tool == null || tool.Deleted || tool.UsesRemaining < 0)
{
return 1044038; // You have worn out your tool!
}
if (tool is Item o && !BaseTool.CheckAccessible(o, m))
{
return 1044263; // The tool must be on your person to use.
}
return base.CanCraft(m, tool, itemType);
}
public override bool RetainsColorFrom(CraftItem item, Type type)
{
if (item != null && type != null)
{
if (item.ItemType.IsEqualOrChildOf<BaseFirework>() && type.IsEqualOrChildOf<BaseFireworkStar>())
{
return true;
}
if (item.ItemType.IsEqualOrChildOf<BaseFireworkStar>() && type.IsEqualOrChildOf<BaseIngot>())
{
return true;
}
}
return false;
}
public override void InitCraftList()
{
InitComponents();
InitRockets();
SetSubRes(typeof(IronIngot), 1044022);
AddSubRes(typeof(IronIngot), 1044022, 00.0, 1044036, 1044267);
AddSubRes(typeof(DullCopperIngot), 1044023, 65.0, 1044036, 1044268);
AddSubRes(typeof(ShadowIronIngot), 1044024, 70.0, 1044036, 1044268);
AddSubRes(typeof(CopperIngot), 1044025, 75.0, 1044036, 1044268);
AddSubRes(typeof(BronzeIngot), 1044026, 80.0, 1044036, 1044268);
AddSubRes(typeof(GoldIngot), 1044027, 85.0, 1044036, 1044268);
AddSubRes(typeof(AgapiteIngot), 1044028, 90.0, 1044036, 1044268);
AddSubRes(typeof(VeriteIngot), 1044029, 95.0, 1044036, 1044268);
AddSubRes(typeof(ValoriteIngot), 1044030, 97.0, 1044036, 1044268);
var type = ScriptCompiler.FindTypeByName("MithrilIngot");
if (type != null && type.IsChildOf<BaseIngot>())
{
AddSubRes(type, "MITHRIL", 99.0, 1044268);
}
SetSubRes2(typeof(FireworkStarIron), "IRON STARS");
AddSubRes2(typeof(FireworkStarIron), "IRON STARS", 00.0, "You cannot work with this unusual star.");
AddSubRes2(typeof(FireworkStarDullCopper), "DULL COPPER STARS", 65.0, "You cannot work with this unusual star.");
AddSubRes2(typeof(FireworkStarShadowIron), "SHADOW IRON STARS", 70.0, "You cannot work with this unusual star.");
AddSubRes2(typeof(FireworkStarCopper), "COPPER STARS", 75.0, "You cannot work with this unusual star.");
AddSubRes2(typeof(FireworkStarBronze), "BRONZE STARS", 80.0, "You cannot work with this unusual star.");
AddSubRes2(typeof(FireworkStarGold), "GOLD STARS", 85.0, "You cannot work with this unusual star.");
AddSubRes2(typeof(FireworkStarAgapite), "AGAPITE STARS", 90.0, "You cannot work with this unusual star.");
AddSubRes2(typeof(FireworkStarVerite), "VERITE STARS", 95.0, "You cannot work with this unusual star.");
AddSubRes2(typeof(FireworkStarValorite), "VALORITE STARS", 99.0, "You cannot work with this unusual star.");
}
private void InitComponents()
{
AddCraft<FireworkStarCustom>(
"Components",
"Firework Star",
0.0,
100.0,
new[]
{
new ResourceInfo(typeof(IronIngot), 1044036, 2), new ResourceInfo(PowderType, PowderType.Name.SpaceWords(), 1),
new ResourceInfo(typeof(BlackPearl), "Black Pearl", 1)
},
c => c.NeedHeat = true);
AddCraft<FireworkFuse>(
"Components",
"Firework Fuse",
0.0,
100.0,
new[] { new ResourceInfo(typeof(Wool), "Wool", 2), new ResourceInfo(PowderType, PowderType.Name.SpaceWords(), 1) });
}
private void InitRockets()
{
AddCraft<BottleRocket>(
"Rockets",
"Bottle Rocket",
0.0,
20.0,
new[]
{
new ResourceInfo(typeof(FireworkStarIron), "Firework Star", 1),
new ResourceInfo(typeof(FireworkFuse), "Firework Fuse", 1)
},
c => c.UseSubRes2 = true);
AddCraft<SkyShieldRocket>(
"Rockets",
"Sky Shield",
10.0,
30.0,
new[]
{
new ResourceInfo(typeof(FireworkStarIron), "Firework Star", 2),
new ResourceInfo(typeof(FireworkFuse), "Firework Fuse", 1)
},
c => c.UseSubRes2 = true);
AddCraft<LittleBoyRocket>(
"Rockets",
"Little Boy",
20.0,
40.0,
new[]
{
new ResourceInfo(typeof(FireworkStarIron), "Firework Star", 3),
new ResourceInfo(typeof(FireworkFuse), "Firework Fuse", 2)
},
c => c.UseSubRes2 = true);
AddCraft<MoonShineRocket>(
"Rockets",
"Moon Shine",
40.0,
60.0,
new[]
{
new ResourceInfo(typeof(FireworkStarIron), "Firework Star", 5),
new ResourceInfo(typeof(FireworkFuse), "Firework Fuse", 2)
},
c => c.UseSubRes2 = true);
AddCraft<PenetratorRocket>(
"Rockets",
"The Penetrator",
60.0,
80.0,
new[]
{
new ResourceInfo(typeof(FireworkStarIron), "Firework Star", 7),
new ResourceInfo(typeof(FireworkFuse), "Firework Fuse", 3)
},
c => c.UseSubRes2 = true);
AddCraft<BigBettyRocket>(
"Rockets",
"Big Betty",
80.0,
100.0,
new[]
{
new ResourceInfo(typeof(FireworkStarIron), "Firework Star", 9),
new ResourceInfo(typeof(FireworkFuse), "Firework Fuse", 3)
},
c => c.UseSubRes2 = true);
AddCraft<BlockBusterRocket>(
"Rockets",
"Block Buster",
100.0,
120.0,
new[]
{
new ResourceInfo(typeof(FireworkStarIron), "Firework Star", 11),
new ResourceInfo(typeof(FireworkFuse), "Firework Fuse", 4)
},
c => c.UseSubRes2 = true);
}
public override double GetChanceAtMin(CraftItem item)
{
return 0.10;
}
public override void PlayCraftEffect(Mobile m)
{
if (m != null)
{
m.PlaySound(85);
}
}
public override int PlayEndingEffect(
Mobile m,
bool failed,
bool lostMaterial,
bool toolBroken,
int quality,
bool makersMark,
CraftItem item)
{
if (toolBroken)
{
m.SendLocalizedMessage(1044038); // You have worn out your tool
}
if (failed)
{
if (lostMaterial)
{
return 1044043; // You failed to create the item, and some of your materials are lost.
}
return 1044157; // You failed to create the item, but no materials were lost.
}
return 1044154; // You create the item.
}
}
}