parent
096d39609e
commit
8e9221bb5a
400 changed files with 3688 additions and 5969 deletions
|
|
@ -136,7 +136,7 @@ namespace Server
|
|||
|
||||
#region Dragon Barding
|
||||
|
||||
if ((from?.Player != true) && m.Player && m.Mount is SwampDragon pet)
|
||||
if (from?.Player != true && m.Player && m.Mount is SwampDragon pet)
|
||||
if (pet.HasBarding)
|
||||
{
|
||||
int percent = pet.BardingExceptional ? 20 : 10;
|
||||
|
|
@ -194,26 +194,26 @@ namespace Server
|
|||
|
||||
public static int GetStatus(Mobile from, int index)
|
||||
{
|
||||
switch (index)
|
||||
return index switch
|
||||
{
|
||||
// TODO: Account for buffs/debuffs
|
||||
case 0: return from.GetMaxResistance(ResistanceType.Physical);
|
||||
case 1: return from.GetMaxResistance(ResistanceType.Fire);
|
||||
case 2: return from.GetMaxResistance(ResistanceType.Cold);
|
||||
case 3: return from.GetMaxResistance(ResistanceType.Poison);
|
||||
case 4: return from.GetMaxResistance(ResistanceType.Energy);
|
||||
case 5: return AosAttributes.GetValue(from, AosAttribute.DefendChance);
|
||||
case 6: return 45;
|
||||
case 7: return AosAttributes.GetValue(from, AosAttribute.AttackChance);
|
||||
case 8: return AosAttributes.GetValue(from, AosAttribute.WeaponSpeed);
|
||||
case 9: return AosAttributes.GetValue(from, AosAttribute.WeaponDamage);
|
||||
case 10: return AosAttributes.GetValue(from, AosAttribute.LowerRegCost);
|
||||
case 11: return AosAttributes.GetValue(from, AosAttribute.SpellDamage);
|
||||
case 12: return AosAttributes.GetValue(from, AosAttribute.CastRecovery);
|
||||
case 13: return AosAttributes.GetValue(from, AosAttribute.CastSpeed);
|
||||
case 14: return AosAttributes.GetValue(from, AosAttribute.LowerManaCost);
|
||||
default: return 0;
|
||||
}
|
||||
0 => from.GetMaxResistance(ResistanceType.Physical),
|
||||
1 => from.GetMaxResistance(ResistanceType.Fire),
|
||||
2 => from.GetMaxResistance(ResistanceType.Cold),
|
||||
3 => from.GetMaxResistance(ResistanceType.Poison),
|
||||
4 => from.GetMaxResistance(ResistanceType.Energy),
|
||||
5 => AosAttributes.GetValue(from, AosAttribute.DefendChance),
|
||||
6 => 45,
|
||||
7 => AosAttributes.GetValue(from, AosAttribute.AttackChance),
|
||||
8 => AosAttributes.GetValue(from, AosAttribute.WeaponSpeed),
|
||||
9 => AosAttributes.GetValue(from, AosAttribute.WeaponDamage),
|
||||
10 => AosAttributes.GetValue(from, AosAttribute.LowerRegCost),
|
||||
11 => AosAttributes.GetValue(from, AosAttribute.SpellDamage),
|
||||
12 => AosAttributes.GetValue(from, AosAttribute.CastRecovery),
|
||||
13 => AosAttributes.GetValue(from, AosAttribute.CastSpeed),
|
||||
14 => AosAttributes.GetValue(from, AosAttribute.LowerManaCost),
|
||||
_ => 0
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -522,13 +522,13 @@ namespace Server
|
|||
string modName = Owner.Serial.ToString();
|
||||
|
||||
if (strBonus != 0)
|
||||
to.AddStatMod(new StatMod(StatType.Str, modName + "Str", strBonus, TimeSpan.Zero));
|
||||
to.AddStatMod(new StatMod(StatType.Str, $"{modName}Str", strBonus, TimeSpan.Zero));
|
||||
|
||||
if (dexBonus != 0)
|
||||
to.AddStatMod(new StatMod(StatType.Dex, modName + "Dex", dexBonus, TimeSpan.Zero));
|
||||
to.AddStatMod(new StatMod(StatType.Dex, $"{modName}Dex", dexBonus, TimeSpan.Zero));
|
||||
|
||||
if (intBonus != 0)
|
||||
to.AddStatMod(new StatMod(StatType.Int, modName + "Int", intBonus, TimeSpan.Zero));
|
||||
to.AddStatMod(new StatMod(StatType.Int, $"{modName}Int", intBonus, TimeSpan.Zero));
|
||||
}
|
||||
|
||||
to.CheckStatTimers();
|
||||
|
|
@ -538,9 +538,9 @@ namespace Server
|
|||
{
|
||||
string modName = Owner.Serial.ToString();
|
||||
|
||||
from.RemoveStatMod(modName + "Str");
|
||||
from.RemoveStatMod(modName + "Dex");
|
||||
from.RemoveStatMod(modName + "Int");
|
||||
from.RemoveStatMod($"{modName}Str");
|
||||
from.RemoveStatMod($"{modName}Dex");
|
||||
from.RemoveStatMod($"{modName}Int");
|
||||
|
||||
from.CheckStatTimers();
|
||||
}
|
||||
|
|
@ -995,21 +995,19 @@ namespace Server
|
|||
public void GetProperties(ObjectPropertyList list)
|
||||
{
|
||||
for (int i = 0; i < 5; ++i)
|
||||
{
|
||||
if (GetValues(i, out SkillName skill, out double bonus))
|
||||
list.Add(1060451 + i, "#{0}\t{1}", GetLabel(skill), bonus);
|
||||
}
|
||||
}
|
||||
|
||||
public static int GetLabel(SkillName skill)
|
||||
{
|
||||
switch (skill)
|
||||
return skill switch
|
||||
{
|
||||
case SkillName.EvalInt: return 1002070; // Evaluate Intelligence
|
||||
case SkillName.Forensics: return 1002078; // Forensic Evaluation
|
||||
case SkillName.Lockpicking: return 1002097; // Lockpicking
|
||||
default: return 1044060 + (int)skill;
|
||||
}
|
||||
SkillName.EvalInt => 1002070, // Evaluate Intelligence
|
||||
SkillName.Forensics => 1002078, // Forensic Evaluation
|
||||
SkillName.Lockpicking => 1002097, // Lockpicking
|
||||
_ => (1044060 + (int)skill)
|
||||
};
|
||||
}
|
||||
|
||||
public void AddTo(Mobile m)
|
||||
|
|
|
|||
|
|
@ -1,182 +0,0 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Gumps;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server.Misc
|
||||
{
|
||||
public static class Assistants
|
||||
{
|
||||
private static class Settings
|
||||
{
|
||||
[Flags]
|
||||
public enum Features : ulong
|
||||
{
|
||||
None = 0,
|
||||
|
||||
FilterWeather = 1 << 0, // Weather Filter
|
||||
FilterLight = 1 << 1, // Light Filter
|
||||
SmartTarget = 1 << 2, // Smart Last Target
|
||||
RangedTarget = 1 << 3, // Range Check Last Target
|
||||
AutoOpenDoors = 1 << 4, // Automatically Open Doors
|
||||
DequipOnCast = 1 << 5, // Unequip Weapon on spell cast
|
||||
AutoPotionEquip = 1 << 6, // Un/re-equip weapon on potion use
|
||||
PoisonedChecks = 1 << 7, // Block heal If poisoned/Macro If Poisoned condition/Heal or Cure self
|
||||
LoopedMacros = 1 << 8, // Disallow looping or recursive macros
|
||||
UseOnceAgent = 1 << 9, // The use once agent
|
||||
RestockAgent = 1 << 10, // The restock agent
|
||||
SellAgent = 1 << 11, // The sell agent
|
||||
BuyAgent = 1 << 12, // The buy agent
|
||||
PotionHotkeys = 1 << 13, // All potion hotkeys
|
||||
RandomTargets = 1 << 14, // All random target hotkeys (not target next, last target, target self)
|
||||
ClosestTargets = 1 << 15, // All closest target hotkeys
|
||||
OverheadHealth = 1 << 16, // Health and Mana/Stam messages shown over player's heads
|
||||
AutolootAgent = 1 << 17, // The autoloot agent
|
||||
BoneCutterAgent = 1 << 18, // The bone cutter agent
|
||||
AdvancedMacros = 1 << 19, // Advanced macro engine
|
||||
AutoRemount = 1 << 20, // Auto remount after dismount
|
||||
AutoBandage = 1 << 21, // Auto bandage friends, self, last and mount option
|
||||
EnemyTargetShare = 1 << 22, // Enemy target share on guild, party or alliance chat
|
||||
FilterSeason = 1 << 23, // Season Filter
|
||||
SpellTargetShare = 1 << 24, // Spell target share on guild, party or alliance chat
|
||||
|
||||
All = ulong.MaxValue
|
||||
}
|
||||
|
||||
public const bool Enabled = false;
|
||||
public const bool KickOnFailure = true; // It will also kick clients running without assistants
|
||||
|
||||
public const string WarningMessage = "The server was unable to negotiate features with your assistant. "
|
||||
+ "You must download and run an updated version of <A HREF=\"http://uosteam.com\">UOSteam</A>"
|
||||
+ " or <A HREF=\"https://bitbucket.org/msturgill/razor-releases/downloads\">Razor</A>."
|
||||
+ "<BR><BR>Make sure you've checked the option <B>Negotiate features with server</B>, "
|
||||
+ "once you have this box checked you may log in and play normally."
|
||||
+ "<BR><BR>You will be disconnected shortly.";
|
||||
|
||||
public static readonly TimeSpan HandshakeTimeout = TimeSpan.FromSeconds(30.0);
|
||||
public static readonly TimeSpan DisconnectDelay = TimeSpan.FromSeconds(15.0);
|
||||
|
||||
public static Features DisallowedFeatures{ get; private set; } = Features.None;
|
||||
|
||||
public static void Configure()
|
||||
{
|
||||
//DisallowFeature( Features.FilterWeather );
|
||||
}
|
||||
|
||||
public static void DisallowFeature(Features feature)
|
||||
{
|
||||
SetDisallowed(feature, true);
|
||||
}
|
||||
|
||||
public static void AllowFeature(Features feature)
|
||||
{
|
||||
SetDisallowed(feature, false);
|
||||
}
|
||||
|
||||
public static void SetDisallowed(Features feature, bool value)
|
||||
{
|
||||
if (value)
|
||||
DisallowedFeatures |= feature;
|
||||
else
|
||||
DisallowedFeatures &= ~feature;
|
||||
}
|
||||
}
|
||||
|
||||
private static class Negotiator
|
||||
{
|
||||
private static Dictionary<Mobile, Timer> m_Dictionary = new Dictionary<Mobile, Timer>();
|
||||
|
||||
public static void Initialize()
|
||||
{
|
||||
/* if (Settings.Enabled)
|
||||
{
|
||||
EventSink.Login += EventSink_Login;
|
||||
ProtocolExtensions.Register(0xFF, true, OnHandshakeResponse);
|
||||
}*/
|
||||
}
|
||||
|
||||
private static void EventSink_Login(LoginEventArgs e)
|
||||
{
|
||||
Mobile m = e.Mobile;
|
||||
|
||||
if (m?.NetState != null && m.NetState.Running)
|
||||
{
|
||||
m.Send(new BeginHandshake());
|
||||
|
||||
if (Settings.KickOnFailure)
|
||||
m.Send(new BeginHandshake());
|
||||
|
||||
if (m_Dictionary.TryGetValue(m, out Timer t))
|
||||
t.Stop();
|
||||
|
||||
m_Dictionary[m] = t = Timer.DelayCall(Settings.HandshakeTimeout, OnHandshakeTimeout, m);
|
||||
t.Start();
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnHandshakeResponse(NetState state, PacketReader pvSrc)
|
||||
{
|
||||
pvSrc.Trace(state);
|
||||
|
||||
if (state?.Mobile == null || !state.Running)
|
||||
return;
|
||||
|
||||
Mobile m = state.Mobile;
|
||||
if (m_Dictionary.TryGetValue(m, out Timer t))
|
||||
{
|
||||
t.Stop();
|
||||
|
||||
m_Dictionary.Remove(m);
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnHandshakeTimeout(Mobile m)
|
||||
{
|
||||
if (m == null)
|
||||
return;
|
||||
|
||||
m_Dictionary.Remove(m);
|
||||
|
||||
// if (!Settings.KickOnFailure)
|
||||
// {
|
||||
// Console.WriteLine("Player '{0}' failed to negotiate features.", m);
|
||||
// }
|
||||
|
||||
if (m.NetState?.Running == true)
|
||||
{
|
||||
m.SendGump(new WarningGump(1060635, 30720, Settings.WarningMessage, 0xFFC000, 420, 250));
|
||||
|
||||
if (m.AccessLevel <= AccessLevel.Player)
|
||||
{
|
||||
Timer t;
|
||||
m_Dictionary[m] = t = Timer.DelayCall(Settings.DisconnectDelay, OnForceDisconnect, m);
|
||||
t.Start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void OnForceDisconnect(Mobile m)
|
||||
{
|
||||
if (m == null)
|
||||
return;
|
||||
|
||||
if (m.NetState != null && m.NetState.Running)
|
||||
m.NetState.Dispose();
|
||||
|
||||
m_Dictionary.Remove(m);
|
||||
|
||||
Console.WriteLine("Player {0} kicked (Failed assistant handshake)", m);
|
||||
}
|
||||
|
||||
private sealed class BeginHandshake : ProtocolExtension
|
||||
{
|
||||
public BeginHandshake()
|
||||
: base(0xFE, 8)
|
||||
{
|
||||
m_Stream.Write((uint)((ulong)Settings.DisallowedFeatures >> 32));
|
||||
m_Stream.Write((uint)((ulong)Settings.DisallowedFeatures & 0xFFFFFFFF));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using Server.Commands;
|
||||
|
||||
namespace Server.Misc
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using Server.Commands;
|
||||
|
||||
namespace Server.Misc
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using Server.Commands;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ namespace Server.Items
|
|||
|
||||
BaseHouse house = BaseHouse.FindHouseAt(loc, from.Map, 16);
|
||||
|
||||
if (house == null || !house.IsCoOwner(from))
|
||||
if (house?.IsCoOwner(from) != true)
|
||||
{
|
||||
from.SendLocalizedMessage(1042036); // That location is not in your house.
|
||||
return;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using Server.Commands;
|
||||
using Server.Commands.Generic;
|
||||
using Server.Gumps;
|
||||
using Server.Items;
|
||||
|
|
@ -146,7 +145,7 @@ namespace Server.Guilds
|
|||
|
||||
public void CheckLeader()
|
||||
{
|
||||
if (m_Leader == null || m_Leader.Disbanded)
|
||||
if (m_Leader?.Disbanded != false)
|
||||
{
|
||||
CalculateAllianceLeader();
|
||||
|
||||
|
|
|
|||
|
|
@ -401,10 +401,8 @@ namespace Server.Misc
|
|||
List<string> keywordsFound = new List<string>();
|
||||
|
||||
for ( int i = 0; i < split.Length; ++i )
|
||||
{
|
||||
if (m_KeywordHash.TryGetValue( split[i], out string keyword ))
|
||||
keywordsFound.Add( keyword );
|
||||
}
|
||||
|
||||
if ( keywordsFound.Count > 0 )
|
||||
{
|
||||
|
|
@ -461,7 +459,7 @@ namespace Server.Misc
|
|||
}
|
||||
}
|
||||
|
||||
int maxWords = (split.Length / 2) + 1;
|
||||
int maxWords = split.Length / 2 + 1;
|
||||
|
||||
if ( maxWords < 2 )
|
||||
maxWords = 2;
|
||||
|
|
@ -501,7 +499,7 @@ namespace Server.Misc
|
|||
if ( (Flags & IHSFlags.OnMovement) == 0 )
|
||||
return; // not enabled
|
||||
|
||||
if ( !mover.Player || (mover.Hidden && mover.AccessLevel > AccessLevel.Player) )
|
||||
if ( !mover.Player || mover.Hidden && mover.AccessLevel > AccessLevel.Player )
|
||||
return;
|
||||
|
||||
if ( !mob.InRange( mover, 5 ) || mob.InRange( oldLocation, 5 ) )
|
||||
|
|
@ -522,16 +520,13 @@ namespace Server.Misc
|
|||
return; // 90% chance to do nothing; 10% chance to talk
|
||||
|
||||
if ( amount < 5 )
|
||||
{
|
||||
SayRandomTranslate( mob,
|
||||
"Ouch!",
|
||||
"Me not hurt bad!",
|
||||
"Thou fight bad.",
|
||||
"Thy blows soft!",
|
||||
"You bad with weapon!" );
|
||||
}
|
||||
else
|
||||
{
|
||||
SayRandomTranslate( mob,
|
||||
"Ouch! Me hurt!",
|
||||
"No, kill me not!",
|
||||
|
|
@ -540,7 +535,6 @@ namespace Server.Misc
|
|||
"Oof! That hurt!",
|
||||
"Aaah! That hurt...",
|
||||
"Good blow!" );
|
||||
}
|
||||
}
|
||||
|
||||
public void OnConstruct( Mobile mob )
|
||||
|
|
@ -553,9 +547,5 @@ namespace Server.Misc
|
|||
mob.Say( ConstructSentance( wordCount ) );
|
||||
mob.PlaySound( Sound );
|
||||
}
|
||||
|
||||
public InhumanSpeech()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Server.Accounting;
|
||||
using Server.Commands;
|
||||
|
||||
namespace Server.Misc
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
using System;
|
||||
using Server.Commands;
|
||||
using Server.Items;
|
||||
using Server.Network;
|
||||
|
||||
|
|
|
|||
|
|
@ -623,24 +623,14 @@ namespace Server
|
|||
|
||||
public static SpellScroll RandomScroll(int minIndex, int maxIndex, SpellbookType type)
|
||||
{
|
||||
Type[] types;
|
||||
|
||||
switch (type)
|
||||
var types = type switch
|
||||
{
|
||||
default:
|
||||
case SpellbookType.Regular:
|
||||
types = RegularScrollTypes;
|
||||
break;
|
||||
case SpellbookType.Necromancer:
|
||||
types = Core.SE ? SENecromancyScrollTypes : NecromancyScrollTypes;
|
||||
break;
|
||||
case SpellbookType.Paladin:
|
||||
types = PaladinScrollTypes;
|
||||
break;
|
||||
case SpellbookType.Arcanist:
|
||||
types = ArcanistScrollTypes;
|
||||
break;
|
||||
}
|
||||
SpellbookType.Regular => RegularScrollTypes,
|
||||
SpellbookType.Necromancer => (Core.SE ? SENecromancyScrollTypes : NecromancyScrollTypes),
|
||||
SpellbookType.Paladin => PaladinScrollTypes,
|
||||
SpellbookType.Arcanist => ArcanistScrollTypes,
|
||||
_ => RegularScrollTypes
|
||||
};
|
||||
|
||||
return Construct(types, Utility.RandomMinMax(minIndex, maxIndex)) as SpellScroll;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
using Server.Commands;
|
||||
|
||||
namespace Server.Misc
|
||||
{
|
||||
public class NameVerification
|
||||
|
|
|
|||
|
|
@ -320,8 +320,7 @@ namespace Server.Misc
|
|||
#region Dueling
|
||||
|
||||
if (pmFrom != null && pmTarg != null)
|
||||
if (pmFrom.DuelContext != null && pmFrom.DuelContext.StartedBeginCountdown && !pmFrom.DuelContext.Finished &&
|
||||
pmFrom.DuelContext == pmTarg.DuelContext)
|
||||
if (pmFrom.DuelContext?.StartedBeginCountdown == true && !pmFrom.DuelContext.Finished && pmFrom.DuelContext == pmTarg.DuelContext)
|
||||
return pmFrom.DuelContext.IsAlly(pmFrom, pmTarg) ? Notoriety.Ally : Notoriety.Enemy;
|
||||
|
||||
#endregion
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
using Server.Network;
|
||||
|
||||
namespace Server.Misc
|
||||
{
|
||||
public enum ProfanityAction
|
||||
|
|
|
|||
|
|
@ -49,18 +49,18 @@ namespace Server.Misc
|
|||
|
||||
public override int RandomHair(bool female) //Random hair doesn't include baldness
|
||||
{
|
||||
switch (Utility.Random(9))
|
||||
return Utility.Random(9) switch
|
||||
{
|
||||
case 0: return 0x203B; //Short
|
||||
case 1: return 0x203C; //Long
|
||||
case 2: return 0x203D; //Pony Tail
|
||||
case 3: return 0x2044; //Mohawk
|
||||
case 4: return 0x2045; //Pageboy
|
||||
case 5: return 0x2047; //Afro
|
||||
case 6: return 0x2049; //Pig tails
|
||||
case 7: return 0x204A; //Krisna
|
||||
default: return female ? 0x2046 : 0x2048; //Buns or Receding Hair
|
||||
}
|
||||
0 => 0x203B, //Short
|
||||
1 => 0x203C, //Long
|
||||
2 => 0x203D, //Pony Tail
|
||||
3 => 0x2044, //Mohawk
|
||||
4 => 0x2045, //Pageboy
|
||||
5 => 0x2047, //Afro
|
||||
6 => 0x2049, //Pig tails
|
||||
7 => 0x204A, //Krisna
|
||||
_ => (female ? 0x2046 : 0x2048)
|
||||
};
|
||||
}
|
||||
|
||||
public override bool ValidateFacialHair(bool female, int itemID)
|
||||
|
|
@ -158,17 +158,17 @@ namespace Server.Misc
|
|||
|
||||
public override int RandomHair(bool female) //Random hair doesn't include baldness
|
||||
{
|
||||
switch (Utility.Random(8))
|
||||
return Utility.Random(8) switch
|
||||
{
|
||||
case 0: return 0x2FC0; //Long Feather
|
||||
case 1: return 0x2FC1; //Short
|
||||
case 2: return 0x2FC2; //Mullet
|
||||
case 3: return 0x2FCE; //Knob
|
||||
case 4: return 0x2FCF; //Braided
|
||||
case 5: return 0x2FD1; //Spiked
|
||||
case 6: return female ? 0x2FCC : 0x2FBF; //Flower or Mid-long
|
||||
default: return female ? 0x2FD0 : 0x2FCD; //Bun or Long
|
||||
}
|
||||
0 => 0x2FC0, //Long Feather
|
||||
1 => 0x2FC1, //Short
|
||||
2 => 0x2FC2, //Mullet
|
||||
3 => 0x2FCE, //Knob
|
||||
4 => 0x2FCF, //Braided
|
||||
5 => 0x2FD1, //Spiked
|
||||
6 => (female ? 0x2FCC : 0x2FBF), //Flower or Mid-long
|
||||
_ => (female ? 0x2FD0 : 0x2FCD)
|
||||
};
|
||||
}
|
||||
|
||||
public override bool ValidateFacialHair(bool female, int itemID) => itemID == 0;
|
||||
|
|
@ -239,29 +239,19 @@ namespace Server.Misc
|
|||
return 0;
|
||||
if (!female)
|
||||
return 0x4258 + Utility.Random(8);
|
||||
switch (Utility.Random(9))
|
||||
return Utility.Random(9) switch
|
||||
{
|
||||
case 0:
|
||||
return 0x4261;
|
||||
case 1:
|
||||
return 0x4262;
|
||||
case 2:
|
||||
return 0x4273;
|
||||
case 3:
|
||||
return 0x4274;
|
||||
case 4:
|
||||
return 0x4275;
|
||||
case 5:
|
||||
return 0x42B0;
|
||||
case 6:
|
||||
return 0x42B1;
|
||||
case 7:
|
||||
return 0x42AA;
|
||||
case 8:
|
||||
return 0x42AB;
|
||||
}
|
||||
|
||||
return 0;
|
||||
0 => 0x4261,
|
||||
1 => 0x4262,
|
||||
2 => 0x4273,
|
||||
3 => 0x4274,
|
||||
4 => 0x4275,
|
||||
5 => 0x42B0,
|
||||
6 => 0x42B1,
|
||||
7 => 0x42AA,
|
||||
8 => 0x42AB,
|
||||
_ => 0
|
||||
};
|
||||
}
|
||||
|
||||
public override bool ValidateFacialHair(bool female, int itemID) => !female && itemID >= 0x42AD && itemID <= 0x42B0;
|
||||
|
|
@ -286,4 +276,4 @@ namespace Server.Misc
|
|||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -202,13 +202,13 @@ namespace Server.Misc
|
|||
if (ar == null || ar.ArmorAttributes.MageArmor != 0 || ar.Attributes.SpellChanneling != 0)
|
||||
return 0.0;
|
||||
|
||||
switch (ar.MeditationAllowance)
|
||||
return ar.MeditationAllowance switch
|
||||
{
|
||||
default:
|
||||
case ArmorMeditationAllowance.None: return ar.BaseArmorRatingScaled;
|
||||
case ArmorMeditationAllowance.Half: return ar.BaseArmorRatingScaled / 2.0;
|
||||
case ArmorMeditationAllowance.All: return 0.0;
|
||||
}
|
||||
ArmorMeditationAllowance.None => ar.BaseArmorRatingScaled,
|
||||
ArmorMeditationAllowance.Half => (ar.BaseArmorRatingScaled / 2.0),
|
||||
ArmorMeditationAllowance.All => 0.0,
|
||||
_ => ar.BaseArmorRatingScaled
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -94,10 +94,6 @@ namespace Server.Items
|
|||
|
||||
public int RunicMaxIntensity { get; set; }
|
||||
|
||||
public CraftAttributeInfo()
|
||||
{
|
||||
}
|
||||
|
||||
public static readonly CraftAttributeInfo Blank;
|
||||
public static readonly CraftAttributeInfo DullCopper, ShadowIron, Copper, Bronze, Golden, Agapite, Verite, Valorite;
|
||||
public static readonly CraftAttributeInfo Spined, Horned, Barbed;
|
||||
|
|
@ -462,7 +458,7 @@ namespace Server.Items
|
|||
/// <summary>
|
||||
/// Returns true if '<paramref name="resource"/>' is None, Iron, RegularLeather or RegularWood. False if otherwise.
|
||||
/// </summary>
|
||||
public static bool IsStandard( CraftResource resource ) => ( resource == CraftResource.None || resource == CraftResource.Iron || resource == CraftResource.RegularLeather || resource == CraftResource.RegularWood );
|
||||
public static bool IsStandard( CraftResource resource ) => resource == CraftResource.None || resource == CraftResource.Iron || resource == CraftResource.RegularLeather || resource == CraftResource.RegularWood;
|
||||
|
||||
private static Dictionary<Type, CraftResource> m_TypeTable;
|
||||
|
||||
|
|
@ -493,15 +489,14 @@ namespace Server.Items
|
|||
/// </summary>
|
||||
public static CraftResourceInfo GetInfo( CraftResource resource )
|
||||
{
|
||||
CraftResourceInfo[] list = null;
|
||||
|
||||
switch ( GetType( resource ) )
|
||||
var list = GetType(resource) switch
|
||||
{
|
||||
case CraftResourceType.Metal: list = m_MetalInfo; break;
|
||||
case CraftResourceType.Leather: list = Core.AOS ? m_AOSLeatherInfo : m_LeatherInfo; break;
|
||||
case CraftResourceType.Scales: list = m_ScaleInfo; break;
|
||||
case CraftResourceType.Wood: list = m_WoodInfo; break;
|
||||
}
|
||||
CraftResourceType.Metal => m_MetalInfo,
|
||||
CraftResourceType.Leather => (Core.AOS ? m_AOSLeatherInfo : m_LeatherInfo),
|
||||
CraftResourceType.Scales => m_ScaleInfo,
|
||||
CraftResourceType.Wood => m_WoodInfo,
|
||||
_ => null
|
||||
};
|
||||
|
||||
if ( list != null )
|
||||
{
|
||||
|
|
@ -539,15 +534,14 @@ namespace Server.Items
|
|||
/// </summary>
|
||||
public static CraftResource GetStart( CraftResource resource )
|
||||
{
|
||||
switch ( GetType( resource ) )
|
||||
return GetType(resource) switch
|
||||
{
|
||||
case CraftResourceType.Metal: return CraftResource.Iron;
|
||||
case CraftResourceType.Leather: return CraftResource.RegularLeather;
|
||||
case CraftResourceType.Scales: return CraftResource.RedScales;
|
||||
case CraftResourceType.Wood: return CraftResource.RegularWood;
|
||||
}
|
||||
|
||||
return CraftResource.None;
|
||||
CraftResourceType.Metal => CraftResource.Iron,
|
||||
CraftResourceType.Leather => CraftResource.RegularLeather,
|
||||
CraftResourceType.Scales => CraftResource.RedScales,
|
||||
CraftResourceType.Wood => CraftResource.RegularWood,
|
||||
_ => CraftResource.None
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
@ -590,7 +584,7 @@ namespace Server.Items
|
|||
{
|
||||
CraftResourceInfo info = GetInfo( resource );
|
||||
|
||||
return ( info == null ? string.Empty : info.Name );
|
||||
return info == null ? string.Empty : info.Name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
|||
|
|
@ -262,14 +262,13 @@ namespace Server.Misc
|
|||
|
||||
public static bool CanLower(Mobile from, Stat stat)
|
||||
{
|
||||
switch (stat)
|
||||
return stat switch
|
||||
{
|
||||
case Stat.Str: return from.StrLock == StatLockType.Down && from.RawStr > 10;
|
||||
case Stat.Dex: return from.DexLock == StatLockType.Down && from.RawDex > 10;
|
||||
case Stat.Int: return from.IntLock == StatLockType.Down && from.RawInt > 10;
|
||||
}
|
||||
|
||||
return false;
|
||||
Stat.Str => (from.StrLock == StatLockType.Down && from.RawStr > 10),
|
||||
Stat.Dex => (from.DexLock == StatLockType.Down && from.RawDex > 10),
|
||||
Stat.Int => (from.IntLock == StatLockType.Down && from.RawInt > 10),
|
||||
_ => false
|
||||
};
|
||||
}
|
||||
|
||||
public static bool CanRaise(Mobile from, Stat stat)
|
||||
|
|
@ -278,14 +277,13 @@ namespace Server.Misc
|
|||
if (from.RawStatTotal >= from.StatCap)
|
||||
return false;
|
||||
|
||||
switch (stat)
|
||||
return stat switch
|
||||
{
|
||||
case Stat.Str: return from.StrLock == StatLockType.Up && from.RawStr < 125;
|
||||
case Stat.Dex: return from.DexLock == StatLockType.Up && from.RawDex < 125;
|
||||
case Stat.Int: return from.IntLock == StatLockType.Up && from.RawInt < 125;
|
||||
}
|
||||
|
||||
return false;
|
||||
Stat.Str => (from.StrLock == StatLockType.Up && from.RawStr < 125),
|
||||
Stat.Dex => (from.DexLock == StatLockType.Up && from.RawDex < 125),
|
||||
Stat.Int => (from.IntLock == StatLockType.Up && from.RawInt < 125),
|
||||
_ => false
|
||||
};
|
||||
}
|
||||
|
||||
public static void IncreaseStat(Mobile from, Stat stat, bool atrophy)
|
||||
|
|
@ -399,4 +397,4 @@ namespace Server.Misc
|
|||
IncreaseStat(from, stat, atrophy);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using Server.Network;
|
||||
|
||||
namespace Server
|
||||
{
|
||||
|
|
|
|||
|
|
@ -57,14 +57,13 @@ namespace Server
|
|||
{
|
||||
int type = reader.ReadEncodedInt();
|
||||
|
||||
switch (type)
|
||||
return type switch
|
||||
{
|
||||
case 0: return new TextDefinition();
|
||||
case 1: return new TextDefinition(reader.ReadEncodedInt());
|
||||
case 2: return new TextDefinition(reader.ReadString());
|
||||
}
|
||||
|
||||
return null;
|
||||
0 => new TextDefinition(),
|
||||
1 => new TextDefinition(reader.ReadEncodedInt()),
|
||||
2 => new TextDefinition(reader.ReadString()),
|
||||
_ => null
|
||||
};
|
||||
}
|
||||
|
||||
public static void AddTo(ObjectPropertyList list, TextDefinition def)
|
||||
|
|
@ -163,6 +162,6 @@ namespace Server
|
|||
return isInteger ? new TextDefinition(i) : new TextDefinition(value);
|
||||
}
|
||||
|
||||
public static bool IsNullOrEmpty(TextDefinition def) => def == null || def.IsEmpty;
|
||||
public static bool IsNullOrEmpty(TextDefinition def) => def?.IsEmpty != false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ namespace Server.Misc
|
|||
m.SendLocalizedMessage(1019063); // You have lost a little karma.
|
||||
}
|
||||
|
||||
if (!Core.AOS && wasPositiveKarma && m.Karma < 0 && pm != null && !pm.KarmaLocked)
|
||||
if (!Core.AOS && wasPositiveKarma && m.Karma < 0 && pm?.KarmaLocked == false)
|
||||
{
|
||||
pm.KarmaLocked = true;
|
||||
m.SendLocalizedMessage(1042511, "",
|
||||
|
|
@ -326,9 +326,9 @@ namespace Server.Misc
|
|||
string skillTitle = highest.Info.Title;
|
||||
|
||||
if (mob.Female && skillTitle.EndsWith("man"))
|
||||
skillTitle = skillTitle.Substring(0, skillTitle.Length - 3) + "woman";
|
||||
skillTitle = $"{skillTitle.Substring(0, skillTitle.Length - 3)}woman";
|
||||
|
||||
return string.Concat(skillLevel, " ", skillTitle);
|
||||
return $"{skillLevel} {skillTitle}";
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
@ -361,12 +361,12 @@ namespace Server.Misc
|
|||
|
||||
private static int GetTableType(Skill skill)
|
||||
{
|
||||
switch (skill.SkillName)
|
||||
return skill.SkillName switch
|
||||
{
|
||||
default: return 0;
|
||||
case SkillName.Bushido: return 1;
|
||||
case SkillName.Ninjitsu: return 2;
|
||||
}
|
||||
SkillName.Bushido => 1,
|
||||
SkillName.Ninjitsu => 2,
|
||||
_ => 0
|
||||
};
|
||||
}
|
||||
|
||||
private static int GetTableIndex(Skill skill)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
using Server.Commands;
|
||||
using Server.Commands.Generic;
|
||||
|
||||
namespace Server.Items
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Server.Commands;
|
||||
using Server.Mobiles;
|
||||
|
||||
namespace Server
|
||||
|
|
@ -123,9 +122,9 @@ namespace Server
|
|||
World.Broadcast(0x35, true, "Generating vendor spawns for {0}, please wait.", map);
|
||||
|
||||
for (int i = 0; i < regions.Length; ++i)
|
||||
for (int x = 0; x < map.Width; ++x)
|
||||
for (int y = 0; y < map.Height; ++y)
|
||||
CheckPoint(map, regions[i].X + x, regions[i].Y + y);
|
||||
for (int x = 0; x < map.Width; ++x)
|
||||
for (int y = 0; y < map.Height; ++y)
|
||||
CheckPoint(map, regions[i].X + x, regions[i].Y + y);
|
||||
|
||||
for (int i = 0; i < m_ShopList.Count; ++i)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -130,10 +130,8 @@ namespace Server.Misc
|
|||
public virtual bool IntersectsWith( Rectangle2D area )
|
||||
{
|
||||
for ( int i = 0; i < Area.Length; ++i )
|
||||
{
|
||||
if ( CheckIntersection( area, Area[i] ) )
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -101,7 +101,7 @@ namespace Server.Misc
|
|||
op.WriteLine("<!DOCTYPE html>");
|
||||
op.WriteLine("<html>");
|
||||
op.WriteLine(" <head>");
|
||||
op.WriteLine(" <title>" + ServerList.ServerName + " Server Status</title>");
|
||||
op.WriteLine($" <title>{ServerList.ServerName} Server Status</title>");
|
||||
op.WriteLine(" </head>");
|
||||
op.WriteLine(" <style type=\"text/css\">");
|
||||
op.WriteLine(" body { background: #999; }");
|
||||
|
|
@ -125,7 +125,7 @@ namespace Server.Misc
|
|||
|
||||
Guild g = m.Guild as Guild;
|
||||
|
||||
op.Write(" <tr class=\"ruo-result " + (index % 2 == 0 ? "even" : "odd") + "\"><td>");
|
||||
op.Write($" <tr class=\"ruo-result {(index % 2 == 0 ? "even" : "odd")}\"><td>");
|
||||
|
||||
if (g != null)
|
||||
{
|
||||
|
|
@ -134,7 +134,7 @@ namespace Server.Misc
|
|||
|
||||
string title = m.GuildTitle;
|
||||
|
||||
title = title != null ? title.Trim() : string.Empty;
|
||||
title = title?.Trim() ?? string.Empty;
|
||||
|
||||
if (title.Length > 0)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Server.Commands;
|
||||
using Server.Mobiles;
|
||||
|
||||
// Version 0.8
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue