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

@ -125,13 +125,13 @@ namespace Server.Items
{
int mana = BaseMana;
double skillTotal = GetSkill(from, SkillName.Swords) + GetSkill(from, SkillName.Macing)
+ GetSkill(from, SkillName.Fencing) +
double skillTotal = GetSkill(from, SkillName.Swords) + GetSkill(from, SkillName.Macing) +
GetSkill(from, SkillName.Fencing) +
GetSkill(from, SkillName.Archery) +
GetSkill(from, SkillName.Parry)
+ GetSkill(from, SkillName.Lumberjacking) +
GetSkill(from, SkillName.Stealth)
+ GetSkill(from, SkillName.Poisoning) +
GetSkill(from, SkillName.Parry) +
GetSkill(from, SkillName.Lumberjacking) +
GetSkill(from, SkillName.Stealth) +
GetSkill(from, SkillName.Poisoning) +
GetSkill(from, SkillName.Bushido) +
GetSkill(from, SkillName.Ninjitsu);
@ -256,55 +256,33 @@ namespace Server.Items
#region Dueling
string option = null;
if (this is ArmorIgnore)
option = "Armor Ignore";
else if (this is BleedAttack)
option = "Bleed Attack";
else if (this is ConcussionBlow)
option = "Concussion Blow";
else if (this is CrushingBlow)
option = "Crushing Blow";
else if (this is Disarm)
option = "Disarm";
else if (this is Dismount)
option = "Dismount";
else if (this is DoubleStrike)
option = "Double Strike";
else if (this is InfectiousStrike)
option = "Infectious Strike";
else if (this is MortalStrike)
option = "Mortal Strike";
else if (this is MovingShot)
option = "Moving Shot";
else if (this is ParalyzingBlow)
option = "Paralyzing Blow";
else if (this is ShadowStrike)
option = "Shadow Strike";
else if (this is WhirlwindAttack)
option = "Whirlwind Attack";
else if (this is RidingSwipe)
option = "Riding Swipe";
else if (this is FrenziedWhirlwind)
option = "Frenzied Whirlwind";
else if (this is Block)
option = "Block";
else if (this is DefenseMastery)
option = "Defense Mastery";
else if (this is NerveStrike)
option = "Nerve Strike";
else if (this is TalonStrike)
option = "Talon Strike";
else if (this is Feint)
option = "Feint";
else if (this is DualWield)
option = "Dual Wield";
else if (this is DoubleShot)
option = "Double Shot";
else if (this is ArmorPierce)
option = "Armor Pierce";
string option = this switch
{
ArmorIgnore _ => "Armor Ignore",
BleedAttack _ => "Bleed Attack",
ConcussionBlow _ => "Concussion Blow",
CrushingBlow _ => "Crushing Blow",
Disarm _ => "Disarm",
Dismount _ => "Dismount",
DoubleStrike _ => "Double Strike",
InfectiousStrike _ => "Infectious Strike",
MortalStrike _ => "Mortal Strike",
MovingShot _ => "Moving Shot",
ParalyzingBlow _ => "Paralyzing Blow",
ShadowStrike _ => "Shadow Strike",
WhirlwindAttack _ => "Whirlwind Attack",
RidingSwipe _ => "Riding Swipe",
FrenziedWhirlwind _ => "Frenzied Whirlwind",
Block _ => "Block",
DefenseMastery _ => "Defense Mastery",
NerveStrike _ => "Nerve Strike",
TalonStrike _ => "Talon Strike",
Feint _ => "Feint",
DualWield _ => "Dual Wield",
DoubleShot _ => "Double Shot",
ArmorPierce _ => "Armor Pierce",
_ => null
};
if (option != null && !DuelContext.AllowSpecialAbility(from, option, true))
return false;
@ -381,7 +359,7 @@ namespace Server.Items
Table.Remove(m);
if (Core.AOS && m.NetState != null)
m.Send(ClearWeaponAbility.Instance);
Packets.SendClearWeaponAbility(m.NetState);
}
public static void Initialize()

View file

@ -291,24 +291,16 @@ namespace Server.Items
if (m_Quality == WeaponQuality.Exceptional)
bonus += 20;
switch (m_DurabilityLevel)
bonus += m_DurabilityLevel switch
{
case WeaponDurabilityLevel.Durable:
bonus += 20;
break;
case WeaponDurabilityLevel.Substantial:
bonus += 50;
break;
case WeaponDurabilityLevel.Massive:
bonus += 70;
break;
case WeaponDurabilityLevel.Fortified:
bonus += 100;
break;
case WeaponDurabilityLevel.Indestructible:
bonus += 120;
break;
}
WeaponDurabilityLevel.Durable => 20,
WeaponDurabilityLevel.Substantial => 50,
WeaponDurabilityLevel.Massive => 70,
WeaponDurabilityLevel.Fortified => 100,
WeaponDurabilityLevel.Indestructible => 120,
_ => 0
};
if (Core.AOS)
{
@ -516,10 +508,9 @@ namespace Server.Items
double swrd = m.Skills.Swords.Value;
double fenc = m.Skills.Fencing.Value;
double mcng = m.Skills.Macing.Value;
double val;
sk = SkillName.Swords;
val = swrd;
double val = swrd;
if (fenc > val)
{
@ -530,12 +521,7 @@ namespace Server.Items
if (mcng > val) sk = SkillName.Macing;
}
else if (WeaponAttributes.MageWeapon != 0)
{
if (m.Skills.Magery.Value > m.Skills[Skill].Value)
sk = SkillName.Magery;
else
sk = Skill;
}
sk = m.Skills.Magery.Value > m.Skills[Skill].Value ? SkillName.Magery : Skill;
else
{
sk = Skill;
@ -792,9 +778,7 @@ namespace Server.Items
if (canSwing && attacker.HarmfulCheck(defender))
{
attacker.DisruptiveAction();
if (attacker.NetState != null)
attacker.Send(new Swing(0, attacker, defender));
Packets.SendSwing(attacker.NetState, attacker.Serial, defender.Serial);
if (attacker is BaseCreature bc)
{
@ -1449,7 +1433,7 @@ namespace Server.Items
damage = AOS.Scale(damage, 100 + damageBonus);
return damage / 100;
return damage / 100.0;
}
public virtual CheckSlayerResult CheckSlayers(Mobile attacker, Mobile defender)
@ -1641,65 +1625,32 @@ namespace Server.Items
if (!Core.AOS)
return 0;
int bonus = 0;
switch (m_AccuracyLevel)
return m_AccuracyLevel switch
{
case WeaponAccuracyLevel.Accurate:
bonus += 02;
break;
case WeaponAccuracyLevel.Surpassingly:
bonus += 04;
break;
case WeaponAccuracyLevel.Eminently:
bonus += 06;
break;
case WeaponAccuracyLevel.Exceedingly:
bonus += 08;
break;
case WeaponAccuracyLevel.Supremely:
bonus += 10;
break;
}
return bonus;
WeaponAccuracyLevel.Accurate => 2,
WeaponAccuracyLevel.Surpassingly => 4,
WeaponAccuracyLevel.Eminently => 6,
WeaponAccuracyLevel.Exceedingly => 8,
WeaponAccuracyLevel.Supremely => 10,
_ => 0
};
}
public virtual int GetDamageBonus()
{
int bonus = VirtualDamageBonus;
switch (m_Quality)
public virtual int GetDamageBonus() =>
VirtualDamageBonus + m_Quality switch
{
case WeaponQuality.Low:
bonus -= 20;
break;
case WeaponQuality.Exceptional:
bonus += 20;
break;
}
switch (m_DamageLevel)
WeaponQuality.Low => -20,
WeaponQuality.Exceptional => 20,
_ => 0,
} + m_DamageLevel switch
{
case WeaponDamageLevel.Ruin:
bonus += 15;
break;
case WeaponDamageLevel.Might:
bonus += 20;
break;
case WeaponDamageLevel.Force:
bonus += 25;
break;
case WeaponDamageLevel.Power:
bonus += 30;
break;
case WeaponDamageLevel.Vanq:
bonus += 35;
break;
}
return bonus;
}
WeaponDamageLevel.Ruin => 15,
WeaponDamageLevel.Might => 20,
WeaponDamageLevel.Force => 25,
WeaponDamageLevel.Power => 30,
WeaponDamageLevel.Vanq => 35,
_ => 0,
};
public virtual double ScaleDamageAOS(Mobile attacker, double damage, bool checkSkills)
{
@ -2353,10 +2304,7 @@ namespace Server.Items
}
else if (m_Slayer != SlayerName.None || m_Slayer2 != SlayerName.None ||
m_DurabilityLevel != WeaponDurabilityLevel.Regular || m_DamageLevel != WeaponDamageLevel.Regular ||
m_AccuracyLevel != WeaponAccuracyLevel.Regular)
{
attrs.Add(new EquipInfoAttribute(1038000)); // Unidentified
}
m_AccuracyLevel != WeaponAccuracyLevel.Regular) attrs.Add(new EquipInfoAttribute(1038000)); // Unidentified
if (m_Poison != null && m_PoisonCharges > 0)
attrs.Add(new EquipInfoAttribute(1017383, m_PoisonCharges));
@ -2364,21 +2312,15 @@ namespace Server.Items
int number;
if (Name == null)
{
number = LabelNumber;
}
else
{
LabelTo(from, Name);
number = 1041000;
}
if (attrs.Count == 0 && Crafter == null && Name != null)
return;
EquipmentInfo eqInfo = new EquipmentInfo(number, m_Crafter, false, attrs.ToArray());
from.Send(new DisplayEquipmentInfo(this, eqInfo));
if (attrs.Count > 0 || Crafter != null || Name == null)
EquipmentPackets.SendDisplayEquipmentInfo(from.NetState, this, number, m_Crafter, false, attrs);
}
private class ResetEquipTimer : Timer
@ -2918,7 +2860,7 @@ namespace Server.Items
double damage = GetAosDamage(attacker, 23, 1, 4);
defender.BoltEffect(0);
defender.BoltEffect();
SpellHelper.Damage(TimeSpan.Zero, defender, attacker, damage, 0, 0, 0, 0, 100);
}
@ -3355,8 +3297,7 @@ namespace Server.Items
parentMobile.AddSkillMod(m_MageMod);
}
if (GetSaveFlag(flags, SaveFlag.PlayerConstructed))
PlayerConstructed = true;
PlayerConstructed |= GetSaveFlag(flags, SaveFlag.PlayerConstructed);
if (GetSaveFlag(flags, SaveFlag.SkillBonuses))
SkillBonuses = new AosSkillBonuses(this, reader);
@ -3508,8 +3449,7 @@ namespace Server.Items
if (m_Hits <= 0 && m_MaxHits <= 0) m_Hits = m_MaxHits = Utility.RandomMinMax(InitMinHits, InitMaxHits);
if (version < 6)
PlayerConstructed = true; // we don't know, so, assume it's crafted
PlayerConstructed |= version < 6; // we don't know, so, assume it's crafted
}
#endregion

View file

@ -71,7 +71,7 @@ namespace Server.Items
startLoc.Z + 32);
Effects.SendMovingEffect(new Entity(Serial.Zero, startLoc, map), new Entity(Serial.Zero, endLoc, map),
0x36E4, 5, 0, false, false);
0x36E4, 5, 0);
Timer.DelayCall(TimeSpan.FromSeconds(1.0), () => FinishLaunch(endLoc, map));
}

View file

@ -81,7 +81,7 @@ namespace Server.Items
if (canSwing && attacker.HarmfulCheck(defender))
{
attacker.DisruptiveAction();
attacker.Send(new Swing(0, attacker, defender));
Packets.SendSwing(attacker.NetState, attacker.Serial, defender.Serial);
if (OnFired(attacker, defender))
{

View file

@ -1,4 +1,5 @@
using System;
using System.Linq;
using Server.Engines.CannedEvil;
using Server.Mobiles;
using Server.Network;
@ -117,9 +118,7 @@ namespace Server.Items
{
Type t = bc.GetType();
foreach (Type type in m_ChampTamables)
if (type == t)
return true;
return m_ChampTamables.Any(type => type == t);
}
}
@ -145,7 +144,7 @@ namespace Server.Items
if (from.CheckTargetSkill(SkillName.Herding, m_Creature, min, max))
{
if (p != from)
if (!ReferenceEquals(p, from))
p = new Point2D(p.X, p.Y);
m_Creature.TargetLocation = p;