ModernUO/Projects/Scripts/Items/Maps/PresetMap.cs
Kamron Batman 179cb50557 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
2019-11-11 12:40:16 +01:00

145 lines
4.8 KiB
C#

namespace Server.Items
{
public class PresetMap : MapItem
{
private int m_LabelNumber;
[Constructible]
public PresetMap(PresetMapType type)
{
int v = (int)type;
if (v >= 0 && v < PresetMapEntry.Table.Length)
InitEntry(PresetMapEntry.Table[v]);
}
public PresetMap(PresetMapEntry entry)
{
InitEntry(entry);
}
public PresetMap(Serial serial) : base(serial)
{
}
public override int LabelNumber => m_LabelNumber == 0 ? base.LabelNumber : m_LabelNumber;
public void InitEntry(PresetMapEntry entry)
{
m_LabelNumber = entry.Name;
Width = entry.Width;
Height = entry.Height;
Bounds = entry.Bounds;
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
writer.Write(m_LabelNumber);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
switch (version)
{
case 0:
{
m_LabelNumber = reader.ReadInt();
break;
}
}
}
}
public class PresetMapEntry
{
public PresetMapEntry(int name, int width, int height, int xLeft, int yTop, int xRight, int yBottom)
{
Name = name;
Width = width;
Height = height;
Bounds = new Rectangle2D(xLeft, yTop, xRight - xLeft, yBottom - yTop);
}
public int Name{ get; }
public int Width{ get; }
public int Height{ get; }
public Rectangle2D Bounds{ get; }
public static readonly PresetMapEntry[] Table =
{
new PresetMapEntry(1041189, 200, 200, 1092, 1396, 1736, 1924), // map of Britain
new PresetMapEntry(1041203, 200, 200, 0256, 1792, 1736, 2560), // map of Britain to Skara Brae
new PresetMapEntry(1041192, 200, 200, 1024, 1280, 2304, 3072), // map of Britain to Trinsic
new PresetMapEntry(1041183, 200, 200, 2500, 1900, 3000, 2400), // map of Buccaneer's Den
new PresetMapEntry(1041198, 200, 200, 2560, 1792, 3840, 2560), // map of Buccaneer's Den to Magincia
new PresetMapEntry(1041194, 200, 200, 2560, 1792, 3840, 3072), // map of Buccaneer's Den to Ocllo
new PresetMapEntry(1041181, 200, 200, 1088, 3572, 1528, 4056), // map of Jhelom
new PresetMapEntry(1041186, 200, 200, 3530, 2022, 3818, 2298), // map of Magincia
new PresetMapEntry(1041199, 200, 200, 3328, 1792, 3840, 2304), // map of Magincia to Ocllo
new PresetMapEntry(1041182, 200, 200, 2360, 0356, 2706, 0702), // map of Minoc
new PresetMapEntry(1041190, 200, 200, 0000, 0256, 2304, 3072), // map of Minoc to Yew
new PresetMapEntry(1041191, 200, 200, 2467, 0572, 2878, 0746), // map of Minoc to Vesper
new PresetMapEntry(1041188, 200, 200, 4156, 0808, 4732, 1528), // map of Moonglow
new PresetMapEntry(1041201, 200, 200, 3328, 0768, 4864, 1536), // map of Moonglow to Nujelm
new PresetMapEntry(1041185, 200, 200, 3446, 1030, 3832, 1424), // map of Nujelm
new PresetMapEntry(1041197, 200, 200, 3328, 1024, 3840, 2304), // map of Nujelm to Magincia
new PresetMapEntry(1041187, 200, 200, 3582, 2456, 3770, 2742), // map of Ocllo
new PresetMapEntry(1041184, 200, 200, 2714, 3329, 3100, 3639), // map of Serpent's Hold
new PresetMapEntry(1041200, 200, 200, 2560, 2560, 3840, 3840), // map of Serpent's Hold to Ocllo
new PresetMapEntry(1041180, 200, 200, 0524, 2064, 0960, 2452), // map of Skara Brae
new PresetMapEntry(1041204, 200, 200, 0000, 0000, 5199, 4095), // map of The World
new PresetMapEntry(1041177, 200, 200, 1792, 2630, 2118, 2952), // map of Trinsic
new PresetMapEntry(1041193, 200, 200, 1792, 1792, 3072, 3072), // map of Trinsic to Buccaneer's Den
new PresetMapEntry(1041195, 200, 200, 0256, 1792, 2304, 4095), // map of Trinsic to Jhelom
new PresetMapEntry(1041178, 200, 200, 2636, 0592, 3064, 1012), // map of Vesper
new PresetMapEntry(1041196, 200, 200, 2636, 0592, 3840, 1536), // map of Vesper to Nujelm
new PresetMapEntry(1041179, 200, 200, 0236, 0741, 0766, 1269), // map of Yew
new PresetMapEntry(1041202, 200, 200, 0000, 0512, 1792, 2048) // map of Yew to Britain
};
}
public enum PresetMapType
{
Britain,
BritainToSkaraBrae,
BritainToTrinsic,
BucsDen,
BucsDenToMagincia,
BucsDenToOcllo,
Jhelom,
Magincia,
MaginciaToOcllo,
Minoc,
MinocToYew,
MinocToVesper,
Moonglow,
MoonglowToNujelm,
Nujelm,
NujelmToMagincia,
Ocllo,
SerpentsHold,
SerpentsHoldToOcllo,
SkaraBrae,
TheWorld,
Trinsic,
TrinsicToBucsDen,
TrinsicToJhelom,
Vesper,
VesperToNujelm,
Yew,
YewToBritain
}
}