Formatting #2 (#59)

This commit is contained in:
Kamron Batman 2019-10-05 00:37:03 -07:00 committed by GitHub
parent 096d39609e
commit 8e9221bb5a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
400 changed files with 3688 additions and 5969 deletions

View file

@ -34,13 +34,13 @@ namespace Server.Engines.Quests.Collector
public override void AddNameProperty(ObjectPropertyList list)
{
ImageTypeInfo info = ImageTypeInfo.Get(m_Image);
list.Add(1060847, "#1055126\t#" + info.Name); // a painted image of:
list.Add(1060847, $"#1055126\t#{info.Name}"); // a painted image of:
}
public override void OnSingleClick(Mobile from)
{
ImageTypeInfo info = ImageTypeInfo.Get(m_Image);
LabelTo(from, 1060847, "#1055126\t#" + info.Name); // a painted image of:
LabelTo(from, 1060847, $"#1055126\t#{info.Name}"); // a painted image of:
}
public override void OnDoubleClick(Mobile from)

View file

@ -132,18 +132,12 @@ namespace Server.Engines.Quests.Collector
public void InitTheater()
{
switch (Utility.Random(3))
m_Theater = Utility.Random(3) switch
{
case 1:
m_Theater = Theater.Britain;
break;
case 2:
m_Theater = Theater.Nujelm;
break;
default:
m_Theater = Theater.Jhelom;
break;
}
1 => Theater.Britain,
2 => Theater.Nujelm,
_ => Theater.Jhelom
};
}
public bool IsInRightTheater()
@ -155,14 +149,13 @@ namespace Server.Engines.Quests.Collector
if (region == null)
return false;
switch (m_Theater)
return m_Theater switch
{
case Theater.Britain: return region.IsPartOf("Britain");
case Theater.Nujelm: return region.IsPartOf("Nujel'm");
case Theater.Jhelom: return region.IsPartOf("Jhelom");
default: return false;
}
Theater.Britain => region.IsPartOf("Britain"),
Theater.Nujelm => region.IsPartOf("Nujel'm"),
Theater.Jhelom => region.IsPartOf("Jhelom"),
_ => false
};
}
public override void OnComplete()

View file

@ -625,11 +625,11 @@ namespace Server.Engines.Quests
{
c16 &= 0x7FFF;
int r = ((c16 >> 10) & 0x1F) << 3;
int g = ((c16 >> 05) & 0x1F) << 3;
int b = ((c16 >> 00) & 0x1F) << 3;
int r = (c16 >> 10 & 0x1F) << 3;
int g = (c16 >> 05 & 0x1F) << 3;
int b = (c16 & 0x1F) << 3;
return (r << 16) | (g << 8) | (b << 0);
return r << 16 | g << 8 | b;
}
public static int C16216(int c16) => c16 & 0x7FFF;
@ -638,11 +638,11 @@ namespace Server.Engines.Quests
{
c32 &= 0xFFFFFF;
int r = ((c32 >> 16) & 0xFF) >> 3;
int g = ((c32 >> 08) & 0xFF) >> 3;
int b = ((c32 >> 00) & 0xFF) >> 3;
int r = (c32 >> 16 & 0xFF) >> 3;
int g = (c32 >> 08 & 0xFF) >> 3;
int b = (c32 & 0xFF) >> 3;
return (r << 10) | (g << 5) | (b << 0);
return r << 10 | g << 5 | b;
}
public static string Color(string text, int color) => $"<BASEFONT COLOR=#{color:X6}>{text}</BASEFONT>";

View file

@ -182,7 +182,7 @@ namespace Server.Engines.Quests.Necro
if (m is PlayerMobile && !m.Frozen && !m.Alive && InRange(m, 4) && !InRange(oldLocation, 4) && InLOS(m))
{
if (m.Map == null || !m.Map.CanFit(m.Location, 16, false, false))
if (m.Map?.CanFit(m.Location, 16, false, false) != true)
{
m.SendLocalizedMessage(502391); // Thou can not be resurrected there!
}

View file

@ -194,7 +194,7 @@ namespace Server.Engines.Quests.Ninja
if (!m.Frozen && !m.Alive && InRange(m, 4) && !InRange(oldLocation, 4) && InLOS(m))
{
if (m.Map == null || !m.Map.CanFit(m.Location, 16, false, false))
if (m.Map?.CanFit(m.Location, 16, false, false) != true)
{
m.SendLocalizedMessage(502391); // Thou can not be resurrected there!
}

View file

@ -92,7 +92,7 @@ namespace Server.Engines.Quests.Ninja
if (!m.Frozen && !m.Alive && InRange(m, 4) && !InRange(oldLocation, 4) && InLOS(m))
{
if (m.Map == null || !m.Map.CanFit(m.Location, 16, false, false))
if (m.Map?.CanFit(m.Location, 16, false, false) != true)
{
m.SendLocalizedMessage(502391); // Thou can not be resurrected there!
}

View file

@ -122,7 +122,7 @@ namespace Server.Engines.Quests.Samurai
obj.Complete();
obj = qs.FindObjective<FifthTrialIntroObjective>();
if (obj != null && ((FifthTrialIntroObjective)obj).StolenTreasure)
if (((FifthTrialIntroObjective)obj)?.StolenTreasure == true)
qs.AddConversation(new SixthTrialIntroConversation(true));
else
qs.AddConversation(new SixthTrialIntroConversation(false));

View file

@ -64,19 +64,12 @@ namespace Server.Engines.Quests.Samurai
break;
}
Item weapon;
switch (Utility.Random(3))
var weapon = Utility.Random(3) switch
{
case 0:
weapon = new NoDachi();
break;
case 1:
weapon = new Lajatang();
break;
default:
weapon = new Wakizashi();
break;
}
0 => (Item)new NoDachi(),
1 => new Lajatang(),
_ => new Wakizashi()
};
weapon.Movable = false;
AddItem(weapon);

View file

@ -58,61 +58,26 @@ namespace Server.Engines.Quests.Naturalist
{
Seed reward;
PlantType type;
switch (Utility.Random(17))
var type = Utility.Random(17) switch
{
case 0:
type = PlantType.CampionFlowers;
break;
case 1:
type = PlantType.Poppies;
break;
case 2:
type = PlantType.Snowdrops;
break;
case 3:
type = PlantType.Bulrushes;
break;
case 4:
type = PlantType.Lilies;
break;
case 5:
type = PlantType.PampasGrass;
break;
case 6:
type = PlantType.Rushes;
break;
case 7:
type = PlantType.ElephantEarPlant;
break;
case 8:
type = PlantType.Fern;
break;
case 9:
type = PlantType.PonytailPalm;
break;
case 10:
type = PlantType.SmallPalm;
break;
case 11:
type = PlantType.CenturyPlant;
break;
case 12:
type = PlantType.WaterPlant;
break;
case 13:
type = PlantType.SnakePlant;
break;
case 14:
type = PlantType.PricklyPearCactus;
break;
case 15:
type = PlantType.BarrelCactus;
break;
default:
type = PlantType.TribarrelCactus;
break;
}
0 => PlantType.CampionFlowers,
1 => PlantType.Poppies,
2 => PlantType.Snowdrops,
3 => PlantType.Bulrushes,
4 => PlantType.Lilies,
5 => PlantType.PampasGrass,
6 => PlantType.Rushes,
7 => PlantType.ElephantEarPlant,
8 => PlantType.Fern,
9 => PlantType.PonytailPalm,
10 => PlantType.SmallPalm,
11 => PlantType.CenturyPlant,
12 => PlantType.WaterPlant,
13 => PlantType.SnakePlant,
14 => PlantType.PricklyPearCactus,
15 => PlantType.BarrelCactus,
_ => PlantType.TribarrelCactus
};
if (study.StudiedSpecialNest)
{
@ -120,19 +85,12 @@ namespace Server.Engines.Quests.Naturalist
}
else
{
PlantHue hue;
switch (Utility.Random(3))
var hue = Utility.Random(3) switch
{
case 0:
hue = PlantHue.Pink;
break;
case 1:
hue = PlantHue.Magenta;
break;
default:
hue = PlantHue.Aqua;
break;
}
0 => PlantHue.Pink,
1 => PlantHue.Magenta,
_ => PlantHue.Aqua
};
reward = new Seed(type, hue);
}

View file

@ -34,7 +34,7 @@ namespace Server.Engines.Quests.Doom
System.From.SendMessage("Internal error: unable to find summoning altar. Quest unable to continue.");
System.Cancel();
}
else if (altar.Daemon == null || !altar.Daemon.Alive)
else if (altar.Daemon?.Alive != true)
{
BoneDemon daemon = new BoneDemon();

View file

@ -83,7 +83,7 @@ namespace Server.Engines.Quests.Doom
2023, 0);
Effects.PlaySound(loc, Map, 0x1FE);
Chyloth = new Chyloth { Direction = (Direction)(7 & (4 + (int)from.GetDirectionTo(loc))) };
Chyloth = new Chyloth { Direction = (Direction)(7 & 4 + (int)from.GetDirectionTo(loc)) };
Chyloth.MoveToWorld(loc, Map);

View file

@ -28,7 +28,7 @@ namespace Server.Engines.Quests.Doom
public void CheckDaemon()
{
if (m_Daemon == null || !m_Daemon.Alive)
if (m_Daemon?.Alive != true)
{
m_Daemon = null;
Hue = 0;

View file

@ -28,7 +28,7 @@ namespace Server.Engines.Quests.Doom
System.From.SendMessage("Internal error: unable to find summoning altar. Quest unable to continue.");
System.Cancel();
}
else if (altar.Daemon == null || !altar.Daemon.Alive)
else if (altar.Daemon?.Alive != true)
{
System.AddConversation(new VanquishDaemonConversation());
}
@ -85,7 +85,7 @@ namespace Server.Engines.Quests.Doom
public override void CheckProgress()
{
if (m_Daemon == null || !m_Daemon.Alive)
if (m_Daemon?.Alive != true)
Complete();
}

View file

@ -42,7 +42,7 @@ namespace Server.Engines.Quests.Doom
{
SummoningAltar altar = Victoria.Altar;
if (altar != null && (altar.Daemon == null || !altar.Daemon.Alive))
if (altar != null && altar.Daemon?.Alive != true)
if (From.Map == Victoria.Map && From.InRange(Victoria, 8))
{
WaitForSummon = false;
@ -56,7 +56,7 @@ namespace Server.Engines.Quests.Doom
public static int GetDaemonBonesFor(BaseCreature creature)
{
if (creature == null || creature.Controlled || creature.Summoned)
if (creature?.Controlled != false || creature.Summoned)
return 0;
int fame = creature.Fame;

View file

@ -68,22 +68,13 @@ namespace Server.Engines.Quests.Haven
public void DoFireEffect(IPoint3D target)
{
Point3D from;
switch (CannonDirection)
var from = CannonDirection switch
{
case CannonDirection.North:
from = new Point3D(X, Y - 1, Z);
break;
case CannonDirection.East:
from = new Point3D(X + 1, Y, Z);
break;
case CannonDirection.South:
from = new Point3D(X, Y + 1, Z);
break;
default:
from = new Point3D(X - 1, Y, Z);
break;
}
CannonDirection.North => new Point3D(X, Y - 1, Z),
CannonDirection.East => new Point3D(X + 1, Y, Z),
CannonDirection.South => new Point3D(X, Y + 1, Z),
_ => new Point3D(X - 1, Y, Z)
};
Effects.SendLocationEffect(from, Map, 0x36B0, 16, 1);
Effects.PlaySound(from, Map, 0x11D);
@ -104,22 +95,13 @@ namespace Server.Engines.Quests.Haven
if (!(Canoneer?.Deleted == false && Canoneer.Active))
return;
bool canFire;
switch (CannonDirection)
var canFire = CannonDirection switch
{
case CannonDirection.North:
canFire = m.X >= X - 7 && m.X <= X + 7 && m.Y == Y - 7 && oldLocation.Y < Y - 7;
break;
case CannonDirection.East:
canFire = m.Y >= Y - 7 && m.Y <= Y + 7 && m.X == X + 7 && oldLocation.X > X + 7;
break;
case CannonDirection.South:
canFire = m.X >= X - 7 && m.X <= X + 7 && m.Y == Y + 7 && oldLocation.Y > Y + 7;
break;
default:
canFire = m.Y >= Y - 7 && m.Y <= Y + 7 && m.X == X - 7 && oldLocation.X < X - 7;
break;
}
CannonDirection.North => (m.X >= X - 7 && m.X <= X + 7 && m.Y == Y - 7 && oldLocation.Y < Y - 7),
CannonDirection.East => (m.Y >= Y - 7 && m.Y <= Y + 7 && m.X == X + 7 && oldLocation.X > X + 7),
CannonDirection.South => (m.X >= X - 7 && m.X <= X + 7 && m.Y == Y + 7 && oldLocation.Y > Y + 7),
_ => (m.Y >= Y - 7 && m.Y <= Y + 7 && m.X == X - 7 && oldLocation.X < X - 7)
};
if (canFire && Canoneer.WillFire(this, m))
Fire(Canoneer, m);

View file

@ -33,28 +33,15 @@ namespace Server.Engines.Quests.Haven
AddItem(new LeatherGloves());
AddItem(new LeatherGorget());
Item weapon;
switch (Utility.Random(6))
var weapon = Utility.Random(6) switch
{
case 0:
weapon = new Broadsword();
break;
case 1:
weapon = new Cutlass();
break;
case 2:
weapon = new Katana();
break;
case 3:
weapon = new Longsword();
break;
case 4:
weapon = new Scimitar();
break;
default:
weapon = new VikingSword();
break;
}
0 => (Item)new Broadsword(),
1 => new Cutlass(),
2 => new Katana(),
3 => new Longsword(),
4 => new Scimitar(),
_ => new VikingSword()
};
weapon.Movable = false;
AddItem(weapon);

View file

@ -112,7 +112,7 @@ namespace Server.Engines.Quests.Haven
if (m is PlayerMobile && !m.Frozen && !m.Alive && InRange(m, 4) && !InRange(oldLocation, 4) && InLOS(m))
{
if (m.Map == null || !m.Map.CanFit(m.Location, 16, false, false))
if (m.Map?.CanFit(m.Location, 16, false, false) != true)
{
m.SendLocalizedMessage(502391); // Thou can not be resurrected there!
}

View file

@ -305,28 +305,15 @@ namespace Server.Engines.Quests.Haven
}
else
{
BaseWeapon weapon;
switch (Utility.Random(6))
var weapon = Utility.Random(6) switch
{
case 0:
weapon = new Broadsword();
break;
case 1:
weapon = new Cutlass();
break;
case 2:
weapon = new Katana();
break;
case 3:
weapon = new Longsword();
break;
case 4:
weapon = new Scimitar();
break;
default:
weapon = new VikingSword();
break;
}
0 => (BaseWeapon)new Broadsword(),
1 => new Cutlass(),
2 => new Katana(),
3 => new Longsword(),
4 => new Scimitar(),
_ => new VikingSword()
};
if (Core.AOS)
{
@ -392,7 +379,7 @@ namespace Server.Engines.Quests.Haven
if (m is PlayerMobile && !m.Frozen && !m.Alive && InRange(m, 4) && !InRange(oldLocation, 4) && InLOS(m))
{
if (m.Map == null || !m.Map.CanFit(m.Location, 16, false, false))
if (m.Map?.CanFit(m.Location, 16, false, false) != true)
{
m.SendLocalizedMessage(502391); // Thou can not be resurrected there!
}

View file

@ -76,27 +76,23 @@ namespace Server.Engines.Quests.Haven
{
get
{
switch (Step)
return Step switch
{
case KillHordeMinionsStep.First:
/* Find the mountain pass beyond the house which lies at the
KillHordeMinionsStep.First =>
/* Find the mountain pass beyond the house which lies at the
* end of the runic road.<BR><BR>
*
* Assist the city Militia by slaying <I>Horde Minions</I>
*/
return 1049089;
case KillHordeMinionsStep.LearnKarma:
/* You have just gained some <a href="?ForceTopic45">Karma</a>
1049089,
KillHordeMinionsStep.LearnKarma =>
/* You have just gained some <a href="?ForceTopic45">Karma</a>
* for killing the horde minion. <a href="?ForceTopic134">Learn</a>
* how this affects your Paladin abilities.
*/
return 1060389;
default:
// Continue driving back the Horde Minions, as Uzeraan instructed you to do.
return 1060507;
}
1060389,
_ => 1060507
};
}
}
@ -105,12 +101,12 @@ namespace Server.Engines.Quests.Haven
get
{
if (System.From.Profession == 5) // paladin
switch (Step)
return Step switch
{
case KillHordeMinionsStep.First: return 1;
case KillHordeMinionsStep.LearnKarma: return 2;
default: return 5;
}
KillHordeMinionsStep.First => 1,
KillHordeMinionsStep.LearnKarma => 2,
_ => 5
};
return 5;
}

View file

@ -66,12 +66,12 @@ namespace Server.Engines.Quests.Haven
{
get
{
switch (From.Profession)
return From.Profession switch
{
case 1: return 0x15C9; // warrior
case 2: return 0x15C1; // magician
default: return 0x15D3; // paladin
}
1 => 0x15C9, // warrior
2 => 0x15C1, // magician
_ => 0x15D3
};
}
}
@ -164,4 +164,4 @@ namespace Server.Engines.Quests.Haven
return false;
}
}
}
}

View file

@ -288,24 +288,20 @@ namespace Server.Engines.Quests.Hag
get
{
if (!BlackheartMet)
switch (Step)
return Step switch
{
case 1:
/* You must gather each ingredient on the Hag's list so that she can cook
1 =>
/* You must gather each ingredient on the Hag's list so that she can cook
* up her vile Magic Brew. The first ingredient is :
*/
return 1055019;
case 2:
/* You must gather each ingredient on the Hag's list so that she can cook
1055019,
2 =>
/* You must gather each ingredient on the Hag's list so that she can cook
* up her vile Magic Brew. The second ingredient is :
*/
return 1055044;
default:
/* You must gather each ingredient on the Hag's list so that she can cook
* up her vile Magic Brew. The final ingredient is :
*/
return 1055045;
}
1055044,
_ => 1055045
};
/* You are still attempting to obtain a jug of Captain Blackheart's
* Whiskey, but the drunkard Captain refuses to share his unique brew.
@ -375,7 +371,7 @@ namespace Server.Engines.Quests.Hag
if (creature.GetType() == type)
{
System.From.SendLocalizedMessage(1055043,
"#" + info.Name); // You gather a ~1_INGREDIENT_NAME~ from the corpse.
$"#{info.Name}"); // You gather a ~1_INGREDIENT_NAME~ from the corpse.
CurProgress++;