Revert "Updates Packets & Randomizer (#43)" (#61)

This reverts commit 179cb50557.
This commit is contained in:
Kamron Batman 2019-11-11 08:46:11 -08:00 • committed by GitHub
parent 179cb50557
commit c2ecc76457
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
588 changed files with 16260 additions and 10926 deletions

View file

@ -113,15 +113,10 @@ namespace Server.Factions
return 502956; // You cannot place a trap on that.
if (Core.ML)
{
IPooledEnumerable eable = m.GetItemsInRange(p, 0);
foreach (Item item in eable)
foreach (Item item in m.GetItemsInRange(p, 0))
if (item is BaseFactionTrap trap && trap.Faction == Faction)
return 1075263; // There is already a trap belonging to your faction at this location.;
eable.Free();
}
switch (AllowedPlacing)
{
case AllowedPlacing.FactionStronghold:
@ -134,12 +129,22 @@ namespace Server.Factions
return 1010355; // This trap can only be placed in your stronghold
}
case AllowedPlacing.AnyFactionTown:
return Town.FromRegion(Region.Find(p, m)) != null ? 0 : 1010356;
{
Town town = Town.FromRegion(Region.Find(p, m));
if (town != null)
return 0;
return 1010356; // This trap can only be placed in a faction town
}
case AllowedPlacing.ControlledFactionTown:
{
Town town = Town.FromRegion(Region.Find(p, m));
return town != null && town.Owner == Faction ? 0 : 1010357;
if (town != null && town.Owner == Faction)
return 0;
return 1010357; // This trap can only be placed in a town your faction controls
}
}
@ -150,16 +155,17 @@ namespace Server.Factions
{
base.OnMovement(m, oldLocation);
if (!CheckDecay() && CheckRange(m.Location, oldLocation, 6) &&
Faction.Find(m) != null && (m.Skills.DetectHidden.Value - 80.0) / 20.0 > Utility.RandomDouble())
PrivateOverheadLocalizedMessage(m, 1010154, MessageHue, "", ""); // [Faction Trap]
if (!CheckDecay() && CheckRange(m.Location, oldLocation, 6))
if (Faction.Find(m) != null &&
(m.Skills.DetectHidden.Value - 80.0) / 20.0 > Utility.RandomDouble())
PrivateOverheadLocalizedMessage(m, 1010154, MessageHue, "", ""); // [Faction Trap]
}
public void PrivateOverheadLocalizedMessage(Mobile to, int number, int hue, string name, string args)
{
NetState ns = to?.NetState;
Packets.SendMessageLocalized(ns, Serial, ItemID, MessageType.Regular, hue, 3, number, name, args);
ns?.Send(new MessageLocalized(Serial, ItemID, MessageType.Regular, hue, 3, number, name, args));
}
public virtual bool CheckDecay()
@ -246,7 +252,10 @@ namespace Server.Factions
if (faction == null && mob is BaseFactionGuard guard)
faction = guard.Faction;
return faction != null && faction != Faction;
if (faction == null)
return false;
return faction != Faction;
}
}
}