* Fixes a bug with the main loop. Removes unnecessary optimizations for RDRand. * WIP - Rewriting packets. * Cleanup and updates README * Converts more packets * Fixes header * Converts Effects packets. * Forgot the send command * Adds the start of containers packets. * Adds message packets with caching * Extends the send methods * Starts to add Acquire methods * Converted the packets * Cleanup * Cleanup * Adds more packets * Adds more packets * Fixes clearing arrays from pool. Adds Mobile Incoming * Converts more packets. * Moves more packets * Moves more packets * Test compression * Merges * Migrating to an idiomatic syntax that also supports compression, and proxying. * Optimize the stack alloc. Changes attributes * Converted container packets * Visual Studio doesn't auto save files. I am still getting used to subpar IDEs. * Adds static packet caching. Will profile later. Converts more packets * Fixes packets and changes how compression is configured * WIP - Adds basics for Gumps. Not finished though. * Fix file * Fixes formatting * Changed SpanWriter to be more idiomatic. * Fixes Span vs RawSpan and missing stackallocs * Converts over some more gumps * WIP - Deletes 32bit support. * Drops RDRand32 support. * Fixes gump compilation * Converting gump components * Removes old huffman compression function * Revert signature for backwards compatibility * WIP - Converting more gump components * Creates ArraySet for the strings. Updates AppendTo to reference that. * Converts the maining gump components * Cleans up gump components * Cleans up directives * Cleans up ArraySet and moves it. Adds null-coalescing-assignment * Cleanup, Target Packets, and C# 8 changes. * Removed OPL Packet * World packets * Fixing packet uses * Cleans up code. Fixes packet uses in various places. * More cleanup for packets * Code cleanup * Converts more packet uses and cleans up more code * More code cleanup * Finishes fixing the packets in Item * Updates secure trade packets * Updates core and gets it to compile. * Moved packets to scripts. Fixed account handler use of packets * Code cleanup * Updates chat packets * Code cleanuo * Adds party packets, but need to implement them. * Party packets WIP * Finishes party packets * Rearrange movement namespaces and classes * Finishes plant packets * Code Formatting * Fixes moving effects * Code cleanup, eliminates equipinfo * Adds more packets. Fixes bugs with various packets. * Finishes mahjon packets * Fixes mahjong packet * Code cleanup * Finishes mahjong packets * Adds Map packets * Add multifacet maps and charts * Cleans up some packets with UTF8 * Optimizes packets * Cleans up more packets. Moves the MessageHelper * Removes assistant support. Removes extended protocol. Incorporates MapUO packets as normal packets. * Updates protocol extensions packet receiver * Fixes a few bugs. Fixes a few more packets. * Code cleanup and fixing more packets * Fixes packet effects * Cleaned up more code * Buff Icon cleanup * Removed unused constructors * Code Cleanup. Adds BoatHS Packets * Moves house files. Updates house foundation packets. * Deployment cleanup * Fixes: * Code cleanup * More code cleanup * More code cleanup * Cleaned up BaseHouse * Enforces styling * Converts foreach to linq where possible. * Dont need that * Goals/Readme updates * Removes 32bit support at the highest level. Turns on HRT by default. * Code cleanup. Fixes extended features packet. * Fixes various bugs * Code cleanup * Code cleanup * Code cleanup. Fixes gump X/Y assignment. * Code cleanup using |= operator * More code cleanup * Cleanup * Fixes spacing issues. Thanks Visual Studio. You suck. * Compiler error * Fixes NPE from RunUO 2.7 * Renames ScriptCompiler to AssemblyHandler. Fixes packets. Updates README * Fixes more packets. Stupid trailing nulls. * Fixes various bugs. * Fixes for gumps * Fixes more gump stuff. Going to split it out later since it is getting insane * Recoded the gump writing * WIP * *Added output path of scripts project to dev branch *Activated debugging in code
187 lines
6.7 KiB
C#
187 lines
6.7 KiB
C#
using System;
|
|
using Server.Items;
|
|
using Server.Network;
|
|
using Server.Targeting;
|
|
|
|
namespace Server.Engines.Harvest
|
|
{
|
|
public class Lumberjacking : HarvestSystem
|
|
{
|
|
private static Lumberjacking m_System;
|
|
|
|
#region Tile lists
|
|
|
|
private static int[] m_TreeTiles =
|
|
{
|
|
0x4CCA, 0x4CCB, 0x4CCC, 0x4CCD, 0x4CD0, 0x4CD3, 0x4CD6, 0x4CD8,
|
|
0x4CDA, 0x4CDD, 0x4CE0, 0x4CE3, 0x4CE6, 0x4CF8, 0x4CFB, 0x4CFE,
|
|
0x4D01, 0x4D41, 0x4D42, 0x4D43, 0x4D44, 0x4D57, 0x4D58, 0x4D59,
|
|
0x4D5A, 0x4D5B, 0x4D6E, 0x4D6F, 0x4D70, 0x4D71, 0x4D72, 0x4D84,
|
|
0x4D85, 0x4D86, 0x52B5, 0x52B6, 0x52B7, 0x52B8, 0x52B9, 0x52BA,
|
|
0x52BB, 0x52BC, 0x52BD,
|
|
|
|
0x4CCE, 0x4CCF, 0x4CD1, 0x4CD2, 0x4CD4, 0x4CD5, 0x4CD7, 0x4CD9,
|
|
0x4CDB, 0x4CDC, 0x4CDE, 0x4CDF, 0x4CE1, 0x4CE2, 0x4CE4, 0x4CE5,
|
|
0x4CE7, 0x4CE8, 0x4CF9, 0x4CFA, 0x4CFC, 0x4CFD, 0x4CFF, 0x4D00,
|
|
0x4D02, 0x4D03, 0x4D45, 0x4D46, 0x4D47, 0x4D48, 0x4D49, 0x4D4A,
|
|
0x4D4B, 0x4D4C, 0x4D4D, 0x4D4E, 0x4D4F, 0x4D50, 0x4D51, 0x4D52,
|
|
0x4D53, 0x4D5C, 0x4D5D, 0x4D5E, 0x4D5F, 0x4D60, 0x4D61, 0x4D62,
|
|
0x4D63, 0x4D64, 0x4D65, 0x4D66, 0x4D67, 0x4D68, 0x4D69, 0x4D73,
|
|
0x4D74, 0x4D75, 0x4D76, 0x4D77, 0x4D78, 0x4D79, 0x4D7A, 0x4D7B,
|
|
0x4D7C, 0x4D7D, 0x4D7E, 0x4D7F, 0x4D87, 0x4D88, 0x4D89, 0x4D8A,
|
|
0x4D8B, 0x4D8C, 0x4D8D, 0x4D8E, 0x4D8F, 0x4D90, 0x4D95, 0x4D96,
|
|
0x4D97, 0x4D99, 0x4D9A, 0x4D9B, 0x4D9D, 0x4D9E, 0x4D9F, 0x4DA1,
|
|
0x4DA2, 0x4DA3, 0x4DA5, 0x4DA6, 0x4DA7, 0x4DA9, 0x4DAA, 0x4DAB,
|
|
0x52BE, 0x52BF, 0x52C0, 0x52C1, 0x52C2, 0x52C3, 0x52C4, 0x52C5,
|
|
0x52C6, 0x52C7
|
|
};
|
|
|
|
#endregion
|
|
|
|
private Lumberjacking()
|
|
{
|
|
HarvestResource[] res;
|
|
HarvestVein[] veins;
|
|
|
|
HarvestDefinition lumber = new HarvestDefinition
|
|
{
|
|
BankWidth = 4,
|
|
BankHeight = 3,
|
|
MinTotal = 20,
|
|
MaxTotal = 45,
|
|
MinRespawn = TimeSpan.FromMinutes(20.0),
|
|
MaxRespawn = TimeSpan.FromMinutes(30.0),
|
|
Skill = SkillName.Lumberjacking,
|
|
Tiles = m_TreeTiles,
|
|
MaxRange = 2,
|
|
ConsumedPerHarvest = 10,
|
|
ConsumedPerFeluccaHarvest = 20,
|
|
EffectActions = new[] { 13 },
|
|
EffectSounds = new[] { 0x13E },
|
|
EffectCounts = Core.AOS ? new[] { 1 } : new[] { 1, 2, 2, 2, 3 },
|
|
EffectDelay = TimeSpan.FromSeconds(1.6),
|
|
EffectSoundDelay = TimeSpan.FromSeconds(0.9),
|
|
NoResourcesMessage = 500493, // There's not enough wood here to harvest.
|
|
FailMessage = 500495, // You hack at the tree for a while, but fail to produce any useable wood.
|
|
OutOfRangeMessage = 500446, // That is too far away.
|
|
PackFullMessage = 500497, // You can't place any wood into your backpack!
|
|
ToolBrokeMessage = 500499 // You broke your axe.
|
|
};
|
|
|
|
if (Core.ML)
|
|
{
|
|
res = new[]
|
|
{
|
|
new HarvestResource(00.0, 00.0, 100.0, 1072540, typeof(Log)),
|
|
new HarvestResource(65.0, 25.0, 105.0, 1072541, typeof(OakLog)),
|
|
new HarvestResource(80.0, 40.0, 120.0, 1072542, typeof(AshLog)),
|
|
new HarvestResource(95.0, 55.0, 135.0, 1072543, typeof(YewLog)),
|
|
new HarvestResource(100.0, 60.0, 140.0, 1072544, typeof(HeartwoodLog)),
|
|
new HarvestResource(100.0, 60.0, 140.0, 1072545, typeof(BloodwoodLog)),
|
|
new HarvestResource(100.0, 60.0, 140.0, 1072546, typeof(FrostwoodLog))
|
|
};
|
|
|
|
|
|
veins = new[]
|
|
{
|
|
new HarvestVein(49.0, 0.0, res[0], null), // Ordinary Logs
|
|
new HarvestVein(30.0, 0.5, res[1], res[0]), // Oak
|
|
new HarvestVein(10.0, 0.5, res[2], res[0]), // Ash
|
|
new HarvestVein(05.0, 0.5, res[3], res[0]), // Yew
|
|
new HarvestVein(03.0, 0.5, res[4], res[0]), // Heartwood
|
|
new HarvestVein(02.0, 0.5, res[5], res[0]), // Bloodwood
|
|
new HarvestVein(01.0, 0.5, res[6], res[0]) // Frostwood
|
|
};
|
|
|
|
lumber.BonusResources = new[]
|
|
{
|
|
new BonusHarvestResource(0, 83.9, null, null), //Nothing
|
|
new BonusHarvestResource(100, 10.0, 1072548, typeof(BarkFragment)),
|
|
new BonusHarvestResource(100, 03.0, 1072550, typeof(LuminescentFungi)),
|
|
new BonusHarvestResource(100, 02.0, 1072547, typeof(SwitchItem)),
|
|
new BonusHarvestResource(100, 01.0, 1072549, typeof(ParasiticPlant)),
|
|
new BonusHarvestResource(100, 00.1, 1072551, typeof(BrilliantAmber))
|
|
};
|
|
}
|
|
else
|
|
{
|
|
res = new[]
|
|
{
|
|
new HarvestResource(00.0, 00.0, 100.0, 500498, typeof(Log))
|
|
};
|
|
|
|
veins = new[]
|
|
{
|
|
new HarvestVein(100.0, 0.0, res[0], null)
|
|
};
|
|
}
|
|
|
|
lumber.Resources = res;
|
|
lumber.Veins = veins;
|
|
|
|
lumber.RaceBonus = Core.ML;
|
|
lumber.RandomizeVeins = Core.ML;
|
|
|
|
Definition = lumber;
|
|
Definitions.Add(lumber);
|
|
}
|
|
|
|
public static Lumberjacking System => m_System ??= new Lumberjacking();
|
|
|
|
public HarvestDefinition Definition{ get; }
|
|
|
|
public override bool CheckHarvest(Mobile from, Item tool)
|
|
{
|
|
if (!base.CheckHarvest(from, tool))
|
|
return false;
|
|
|
|
if (tool.Parent != from)
|
|
{
|
|
from.SendLocalizedMessage(500487); // The axe must be equipped for any serious wood chopping.
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public override bool CheckHarvest(Mobile from, Item tool, HarvestDefinition def, object toHarvest)
|
|
{
|
|
if (!base.CheckHarvest(from, tool, def, toHarvest))
|
|
return false;
|
|
|
|
if (tool.Parent != from)
|
|
{
|
|
from.SendLocalizedMessage(500487); // The axe must be equipped for any serious wood chopping.
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
public override void OnBadHarvestTarget(Mobile from, Item tool, object toHarvest)
|
|
{
|
|
if (toHarvest is Mobile mobile)
|
|
mobile.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 500450,
|
|
from.NetState); // You can only skin dead creatures.
|
|
else if (toHarvest is Item item)
|
|
item.LabelTo(from, 500464); // Use this on corpses to carve away meat and hide
|
|
else if (toHarvest is StaticTarget || toHarvest is LandTarget)
|
|
from.SendLocalizedMessage(500489); // You can't use an axe on that.
|
|
else
|
|
from.SendLocalizedMessage(1005213); // You can't do that
|
|
}
|
|
|
|
public override void OnHarvestStarted(Mobile from, Item tool, HarvestDefinition def, object toHarvest)
|
|
{
|
|
base.OnHarvestStarted(from, tool, def, toHarvest);
|
|
|
|
if (Core.ML)
|
|
from.RevealingAction();
|
|
}
|
|
|
|
public static void Initialize()
|
|
{
|
|
Array.Sort(m_TreeTiles);
|
|
}
|
|
}
|
|
}
|