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

@ -7,7 +7,7 @@ using Server.Network;
namespace Server.Misc
{
public class CharacterCreation
public static class CharacterCreation
{
private static readonly CityInfo m_NewHavenInfo =
new CityInfo("New Haven", "The Bountiful Harvest Inn", 3503, 2574, 14, Map.Trammel);
@ -22,15 +22,8 @@ namespace Server.Misc
private static void AddBackpack(Mobile m)
{
Container pack = m.Backpack;
if (pack == null)
{
pack = new Backpack();
pack.Movable = false;
m.AddItem(pack);
}
if (m.Backpack == null)
m.AddItem(new Backpack {Movable = false});
PackItem(new RedBook("a book", m.Name, 20, true));
PackItem(new Gold(1000)); // Starting gold can be customized here
@ -52,16 +45,8 @@ namespace Server.Misc
item.Location = new Point3D(x, y, 0);
}
private static Item MakePotionKeg(PotionEffect type, int hue)
{
PotionKeg keg = new PotionKeg();
keg.Held = 100;
keg.Type = type;
keg.Hue = hue;
return MakeNewbie(keg);
}
private static Item MakePotionKeg(PotionEffect type, int hue) =>
MakeNewbie(new PotionKeg {Held = 100, Type = type, Hue = hue});
private static void FillBankAOS(Mobile m)
{
@ -75,11 +60,8 @@ namespace Server.Misc
m.StatCap = 250;
Container cont;
// Begin box of money
cont = new WoodenBox();
Container cont = new WoodenBox();
cont.ItemID = 0xE7D;
cont.Hue = 0x489;
@ -97,8 +79,7 @@ namespace Server.Misc
// Begin bag of potion kegs
cont = new Backpack();
cont.Name = "Various Potion Kegs";
cont = new Backpack {Name = "Various Potion Kegs"};
PlaceItemIn(cont, 45, 149, MakePotionKeg(PotionEffect.CureGreater, 0x2D));
PlaceItemIn(cont, 69, 149, MakePotionKeg(PotionEffect.HealGreater, 0x499));
@ -113,8 +94,7 @@ namespace Server.Misc
// Begin bag of tools
cont = new Bag();
cont.Name = "Tool Bag";
cont = new Bag {Name = "Tool Bag"};
PlaceItemIn(cont, 30, 35, new TinkerTools(1000));
PlaceItemIn(cont, 60, 35, new HousePlacementTool());
@ -145,8 +125,7 @@ namespace Server.Misc
// Begin bag of archery ammo
cont = new Bag();
cont.Name = "Bag Of Archery Ammo";
cont = new Bag {Name = "Bag Of Archery Ammo"};
PlaceItemIn(cont, 48, 76, new Arrow(5000));
PlaceItemIn(cont, 72, 76, new Bolt(5000));
@ -156,8 +135,7 @@ namespace Server.Misc
// Begin bag of treasure maps
cont = new Bag();
cont.Name = "Bag Of Treasure Maps";
cont = new Bag {Name = "Bag Of Treasure Maps"};
PlaceItemIn(cont, 30, 35, new TreasureMap(1, Map.Trammel));
PlaceItemIn(cont, 45, 35, new TreasureMap(2, Map.Trammel));
@ -181,9 +159,7 @@ namespace Server.Misc
// Begin bag of raw materials
cont = new Bag();
cont.Hue = 0x835;
cont.Name = "Raw Materials Bag";
cont = new Bag {Hue = 0x835, Name = "Raw Materials Bag"};
PlaceItemIn(cont, 92, 60, new BarbedLeather(5000));
PlaceItemIn(cont, 92, 68, new HornedLeather(5000));
@ -216,9 +192,7 @@ namespace Server.Misc
// Begin bag of spell casting stuff
cont = new Backpack();
cont.Hue = 0x480;
cont.Name = "Spell Casting Stuff";
cont = new Backpack {Hue = 0x480, Name = "Spell Casting Stuff"};
PlaceItemIn(cont, 45, 105, new Spellbook(ulong.MaxValue));
PlaceItemIn(cont, 65, 105, new NecromancerSpellbook((ulong)0xFFFF));
@ -234,8 +208,7 @@ namespace Server.Misc
toHue.Hue = 0x2D;
PlaceItemIn(cont, 45, 150, toHue);
toHue = new BagOfNecroReagents(150);
toHue.Hue = 0x488;
toHue = new BagOfNecroReagents(150) {Hue = 0x488};
PlaceItemIn(cont, 65, 150, toHue);
PlaceItemIn(cont, 140, 150, new BagOfAllReagents(500));
@ -250,9 +223,7 @@ namespace Server.Misc
// Begin bag of ethereals
cont = new Backpack();
cont.Hue = 0x490;
cont.Name = "Bag Of Ethy's!";
cont = new Backpack {Hue = 0x490, Name = "Bag Of Ethy's!"};
PlaceItemIn(cont, 45, 66, new EtherealHorse());
PlaceItemIn(cont, 69, 82, new EtherealOstard());
@ -268,9 +239,7 @@ namespace Server.Misc
// Begin first bag of artifacts
cont = new Backpack();
cont.Hue = 0x48F;
cont.Name = "Bag of Artifacts";
cont = new Backpack {Hue = 0x48F, Name = "Bag of Artifacts"};
PlaceItemIn(cont, 45, 66, new TitansHammer());
PlaceItemIn(cont, 69, 82, new InquisitorsResolution());
@ -282,9 +251,7 @@ namespace Server.Misc
// Begin second bag of artifacts
cont = new Backpack();
cont.Hue = 0x48F;
cont.Name = "Bag of Artifacts";
cont = new Backpack {Hue = 0x48F, Name = "Bag of Artifacts"};
PlaceItemIn(cont, 45, 66, new GauntletsOfNobility());
PlaceItemIn(cont, 69, 82, new MidnightBracers());
@ -324,10 +291,7 @@ namespace Server.Misc
// End second bag of artifacts
// Begin bag of minor artifacts
cont = new Backpack();
cont.Hue = 0x48F;
cont.Name = "Bag of Minor Artifacts";
cont = new Backpack {Hue = 0x48F, Name = "Bag of Minor Artifacts"};
PlaceItemIn(cont, 45, 66, new LunaLance());
PlaceItemIn(cont, 69, 82, new VioletCourage());
@ -368,9 +332,7 @@ namespace Server.Misc
if (Core.SE)
{
cont = new Bag();
cont.Hue = 0x501;
cont.Name = "Tokuno Minor Artifacts";
cont = new Bag {Hue = 0x501, Name = "Tokuno Minor Artifacts"};
PlaceItemIn(cont, 42, 70, new Exiler());
PlaceItemIn(cont, 38, 53, new HanzosBow());
@ -398,8 +360,7 @@ namespace Server.Misc
if (Core.SE) //This bag came only after SE.
{
cont = new Bag();
cont.Name = "Bag of Bows";
cont = new Bag {Name = "Bag of Bows"};
PlaceItemIn(cont, 31, 84, new Bow());
PlaceItemIn(cont, 78, 74, new CompositeBow());
@ -432,11 +393,7 @@ namespace Server.Misc
bank.DropItem(new BankCheck(1000000));
// Full spellbook
Spellbook book = new Spellbook();
book.Content = ulong.MaxValue;
bank.DropItem(book);
bank.DropItem(new Spellbook {Content = ulong.MaxValue});
Bag bag = new Bag();
@ -641,10 +598,7 @@ namespace Server.Misc
newChar.Female = args.Female;
//newChar.Body = newChar.Female ? 0x191 : 0x190;
if (Core.Expansion >= args.Race.RequiredExpansion)
newChar.Race = args.Race; //Sets body
else
newChar.Race = Race.DefaultRace;
newChar.Race = Core.Expansion >= args.Race.RequiredExpansion ? args.Race : Race.DefaultRace;
//newChar.Hue = Utility.ClipSkinHue( args.Hue & 0x3FFF ) | 0x8000;
newChar.Hue = newChar.Race.ClipSkinHue(args.Hue & 0x3FFF) | 0x8000;
@ -692,12 +646,7 @@ namespace Server.Misc
if (TestCenter.Enabled)
FillBankbox(newChar);
if (young)
{
NewPlayerTicket ticket = new NewPlayerTicket();
ticket.Owner = newChar;
newChar.BankBox.DropItem(ticket);
}
if (young) newChar.BankBox.DropItem(new NewPlayerTicket {Owner = newChar});
CityInfo city = GetStartLocation(args, young);
@ -710,19 +659,8 @@ namespace Server.Misc
new WelcomeTimer(newChar).Start();
}
public static bool VerifyProfession(int profession)
{
if (profession < 0)
return false;
if (profession < 4)
return true;
if (Core.AOS && profession < 6)
return true;
if (Core.SE && profession < 8)
return true;
return false;
}
public static bool VerifyProfession(int profession) =>
profession >= 0 && (profession < 4 || Core.AOS && profession < 6 || Core.SE && profession < 8);
private static CityInfo GetStartLocation(CharacterCreatedEventArgs args, bool isYoung)
{
@ -754,9 +692,7 @@ namespace Server.Misc
break;
}
case 5: //Paladin
{
return m_NewHavenInfo;
}
case 6: //Samurai
{
if ((flags & ClientFlags.Tokuno) != 0)
@ -795,10 +731,7 @@ namespace Server.Misc
}
}
if (useHaven)
return m_NewHavenInfo;
return args.City;
return useHaven ? m_NewHavenInfo : args.City;
}
private static void FixStats(ref int str, ref int dex, ref int intel, int max)
@ -1164,7 +1097,7 @@ namespace Server.Misc
if (m_Mobile?.EquipItem(item) == true)
return;
Container pack = m_Mobile.Backpack;
Container pack = m_Mobile?.Backpack;
if (!mustEquip && pack != null)
pack.DropItem(item);
@ -1177,7 +1110,7 @@ namespace Server.Misc
if (!Core.AOS)
item.LootType = LootType.Newbied;
Container pack = m_Mobile.Backpack;
Container pack = m_Mobile?.Backpack;
if (pack != null)
pack.DropItem(item);
@ -1733,18 +1666,18 @@ namespace Server.Misc
private class BadStartMessage : Timer
{
private int m_Message;
private Mobile m_Mobile;
private Mobile m_From;
public BadStartMessage(Mobile m, int message) : base(TimeSpan.FromSeconds(3.5))
{
m_Mobile = m;
m_From = m;
m_Message = message;
Start();
}
protected override void OnTick()
{
m_Mobile.SendLocalizedMessage(m_Message);
m_From.SendLocalizedMessage(m_Message);
}
}
}