Updates Packets & Randomizer (#43)

* 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
This commit is contained in:
Kamron Batman 2019-11-11 03:40:16 -08:00 committed by 3HMonkey
parent 7aa8fd3df1
commit 179cb50557
588 changed files with 10843 additions and 16177 deletions

View file

@ -75,7 +75,7 @@ namespace Server.Engines.Plants
}
case 2: // Help
{
from.Send(new DisplayHelpTopic(71, true)); // EMPTYING THE BOWL
ContentPackets.SendDisplayHelpTopic(from.NetState, 17, true); // EMPTYING THE BOWL
from.SendGump(new EmptyTheBowlGump(m_Plant));

View file

@ -264,9 +264,7 @@ namespace Server.Engines.Plants
case 1: // Reproduction menu
{
if (m_Plant.PlantStatus > PlantStatus.BowlOfDirt)
{
from.SendGump(new ReproductionGump(m_Plant));
}
else
{
from.SendLocalizedMessage(1061885); // You need to plant a seed in the bowl first.
@ -278,32 +276,28 @@ namespace Server.Engines.Plants
}
case 2: // Infestation
{
from.Send(new DisplayHelpTopic(54, true)); // INFESTATION LEVEL
ContentPackets.SendDisplayHelpTopic(from.NetState, 54, true); // INFESTATION LEVEL
from.SendGump(new MainPlantGump(m_Plant));
break;
}
case 3: // Fungus
{
from.Send(new DisplayHelpTopic(56, true)); // FUNGUS LEVEL
ContentPackets.SendDisplayHelpTopic(from.NetState, 56, true); // FUNGUS LEVEL
from.SendGump(new MainPlantGump(m_Plant));
break;
}
case 4: // Poison
{
from.Send(new DisplayHelpTopic(58, true)); // POISON LEVEL
ContentPackets.SendDisplayHelpTopic(from.NetState, 58, true); // POISON LEVEL
from.SendGump(new MainPlantGump(m_Plant));
break;
}
case 5: // Disease
{
from.Send(new DisplayHelpTopic(60, true)); // DISEASE LEVEL
ContentPackets.SendDisplayHelpTopic(from.NetState, 60, true); // DISEASE LEVEL
from.SendGump(new MainPlantGump(m_Plant));
break;
@ -320,9 +314,7 @@ namespace Server.Engines.Plants
$"#{m_Plant.GetLocalizedPlantStatus()}"); // Target the container you wish to use to water the ~1_val~.
}
else
{
m_Plant.Pour(from, bev);
}
from.SendGump(new MainPlantGump(m_Plant));
@ -354,7 +346,7 @@ namespace Server.Engines.Plants
}
case 11: // Help
{
from.Send(new DisplayHelpTopic(48, true)); // PLANT GROWING
ContentPackets.SendDisplayHelpTopic(from.NetState, 48, true); // PLANT GROWING
from.SendGump(new MainPlantGump(m_Plant));
@ -374,9 +366,7 @@ namespace Server.Engines.Plants
Item item = GetPotion(from, effects);
if (item != null)
{
m_Plant.Pour(from, item);
}
else
{
if (m_Plant.ApplyPotion(effects[0], true, out int message))

View file

@ -1,15 +0,0 @@
namespace Server.Network
{
public class DisplayHelpTopic : Packet
{
public DisplayHelpTopic(int topicID, bool display) : base(0xBF)
{
EnsureCapacity(11);
m_Stream.Write((short)0x17);
m_Stream.Write((byte)1);
m_Stream.Write(topicID);
m_Stream.Write(display);
}
}
}

View file

@ -84,8 +84,7 @@ namespace Server.Engines.Plants
}
else
{
if (PlantSystem == null)
PlantSystem = new PlantSystem(this, false);
PlantSystem ??= new PlantSystem(this, false);
int hits = (int)(PlantSystem.MaxHits * ratio);

View file

@ -1,4 +1,5 @@
using System;
using System.Linq;
using Server.Items;
namespace Server.Engines.Plants
@ -31,15 +32,9 @@ namespace Server.Engines.Plants
public Type ResourceType{ get; }
public static PlantResourceInfo GetInfo(PlantType plantType, PlantHue plantHue)
{
foreach (PlantResourceInfo info in m_ResourceList)
if (info.PlantType == plantType && info.PlantHue == plantHue)
return info;
return null;
}
public static PlantResourceInfo GetInfo(PlantType plantType, PlantHue plantHue) =>
m_ResourceList.FirstOrDefault(info => info.PlantType == plantType && info.PlantHue == plantHue);
public Item CreateResource() => (Item)Activator.CreateInstance(ResourceType);
}
}
}

View file

@ -383,6 +383,7 @@ namespace Server.Engines.Plants
return 1060827; // soft
if (Water <= 3)
return 1060828; // squishy
return 1060829; // sopping wet
}

View file

@ -261,21 +261,13 @@ namespace Server.Engines.Plants
double rand = Utility.RandomDouble();
if (rand < 0.5 / exp4)
return PlantType.CommonGreenBonsai;
if (rand < 1.0 / exp4)
return PlantType.CommonPinkBonsai;
if (rand < (k1 * 0.5 + 1.0) / exp4)
return PlantType.UncommonGreenBonsai;
if (rand < exp1 / exp4)
return PlantType.UncommonPinkBonsai;
if (rand < (k2 * 0.5 + exp1) / exp4)
return PlantType.RareGreenBonsai;
if (rand < exp2 / exp4)
return PlantType.RarePinkBonsai;
if (rand < exp3 / exp4)
return PlantType.ExceptionalBonsai;
return PlantType.ExoticBonsai;
return rand < 0.5 / exp4 ? PlantType.CommonGreenBonsai :
rand < 1.0 / exp4 ? PlantType.CommonPinkBonsai :
rand < (k1 * 0.5 + 1.0) / exp4 ? PlantType.UncommonGreenBonsai :
rand < exp1 / exp4 ? PlantType.UncommonPinkBonsai :
rand < (k2 * 0.5 + exp1) / exp4 ? PlantType.RareGreenBonsai :
rand < exp2 / exp4 ? PlantType.RarePinkBonsai :
rand < exp3 / exp4 ? PlantType.ExceptionalBonsai : PlantType.ExoticBonsai;
}
public static bool IsCrossable(PlantType plantType) => GetInfo(plantType).Crossable;
@ -356,4 +348,4 @@ namespace Server.Engines.Plants
return hueInfo.IsBright() ? 1113493 : 1113492; // ~1_amount~ [bright] ~2_color~ ~3_type~ seeds
}
}
}
}

View file

@ -14,50 +14,30 @@ namespace Server.Engines.Plants
from.InRange(m_Plant.GetWorldLocation(), 3))
{
if (!m_Plant.IsUsableBy(from))
{
m_Plant.LabelTo(from,
1061856); // You must have the item in your backpack or locked down in order to use it.
}
else if (!m_Plant.IsCrossable)
{
m_Plant.LabelTo(from, 1053050); // You cannot gather pollen from a mutated plant!
}
else if (!m_Plant.PlantSystem.PollenProducing)
{
m_Plant.LabelTo(from, 1053051); // You cannot gather pollen from a plant in this stage of development!
}
else if (m_Plant.PlantSystem.Health < PlantHealth.Healthy)
{
m_Plant.LabelTo(from, 1053052); // You cannot gather pollen from an unhealthy plant!
}
else
{
if (!(targeted is PlantItem targ) || targ.PlantStatus >= PlantStatus.DecorativePlant ||
targ.PlantStatus <= PlantStatus.BowlOfDirt)
{
m_Plant.LabelTo(from, 1053070); // You can only pollinate other specially grown plants!
}
else if (!targ.IsUsableBy(from))
{
targ.LabelTo(from,
1061856); // You must have the item in your backpack or locked down in order to use it.
}
else if (!targ.IsCrossable)
{
targ.LabelTo(from, 1053073); // You cannot cross-pollinate with a mutated plant!
}
else if (!targ.PlantSystem.PollenProducing)
{
targ.LabelTo(from, 1053074); // This plant is not in the flowering stage. You cannot pollinate it!
}
else if (targ.PlantSystem.Health < PlantHealth.Healthy)
{
targ.LabelTo(from, 1053075); // You cannot pollinate an unhealthy plant!
}
else if (targ.PlantSystem.Pollinated)
{
targ.LabelTo(from, 1053072); // This plant has already been pollinated!
}
else if (targ == m_Plant)
{
targ.PlantSystem.Pollinated = true;
@ -85,4 +65,4 @@ namespace Server.Engines.Plants
m_Plant.IsUsableBy(from)) from.SendGump(new ReproductionGump(m_Plant));
}
}
}
}

View file

@ -138,24 +138,21 @@ namespace Server.Engines.Plants
}
case 3: // Pollination
{
from.Send(new DisplayHelpTopic(67, true)); // POLLINATION STATE
ContentPackets.SendDisplayHelpTopic(from.NetState, 67, true); // POLLINATION STATE
from.SendGump(new ReproductionGump(m_Plant));
break;
}
case 4: // Resources
{
from.Send(new DisplayHelpTopic(69, true)); // RESOURCE PRODUCTION
ContentPackets.SendDisplayHelpTopic(from.NetState, 69, true); // RESOURCE PRODUCTION
from.SendGump(new ReproductionGump(m_Plant));
break;
}
case 5: // Seeds
{
from.Send(new DisplayHelpTopic(68, true)); // SEED PRODUCTION
ContentPackets.SendDisplayHelpTopic(from.NetState, 68, true); // SEED PRODUCTION
from.SendGump(new ReproductionGump(m_Plant));
break;
@ -200,9 +197,7 @@ namespace Server.Engines.Plants
m_Plant.LabelTo(from, 1053055); // Mutated plants do not produce resources!
}
else if (system.AvailableResources == 0)
{
m_Plant.LabelTo(from, 1053056); // This plant has no resources to gather!
}
else
{
Item resource = resInfo.CreateResource();
@ -229,13 +224,9 @@ namespace Server.Engines.Plants
PlantSystem system = m_Plant.PlantSystem;
if (!m_Plant.Reproduces)
{
m_Plant.LabelTo(from, 1053060); // Mutated plants do not produce seeds!
}
else if (system.AvailableSeeds == 0)
{
m_Plant.LabelTo(from, 1053061); // This plant has no seeds to gather!
}
else
{
Seed seed = new Seed(system.SeedType, system.SeedHue, true);

View file

@ -64,7 +64,7 @@ namespace Server.Engines.Plants
}
case 2: // Help
{
from.Send(new DisplayHelpTopic(70, true)); // DECORATIVE MODE
ContentPackets.SendDisplayHelpTopic(from.NetState, 70, true); // DECORATIVE MODE
from.SendGump(new SetToDecorativeGump(m_Plant));