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

@ -1,6 +1,5 @@
using System;
using System.IO;
using System.Linq;
using Server.Factions;
using Server.Mobiles;
using Server.Network;
@ -42,7 +41,9 @@ namespace Server
if (chance > Utility.Random(100))
{
int weight = _items.Sum(item => item.Weight);
int weight = 0;
foreach (WeightedItem item in _items) weight += item.Weight;
weight = Utility.Random(weight);
@ -176,4 +177,4 @@ namespace Server
public Item Construct() => Activator.CreateInstance(Type) as Item;
}
}
}
}

View file

@ -25,9 +25,7 @@ namespace Server
bool used = false;
IPooledEnumerable eable = from.GetMobilesInRange(8);
foreach (Mobile mob in eable)
foreach (Mobile mob in from.GetMobilesInRange(8))
if (mob.Player && !mob.Alive && from.InLOS(mob))
{
if (Faction.Find(mob) != ourFaction) continue;
@ -43,8 +41,6 @@ namespace Server
}
}
eable.Free();
if (used)
{
from.LocalOverheadMessage(MessageType.Regular, 2219, false, "The urn shatters as you invoke its power.");

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;
}
}
}

View file

@ -23,7 +23,7 @@ namespace Server.Factions
public override void DoVisibleEffect()
{
Effects.SendLocationEffect(GetWorldLocation(), Map, 0x36BD, 15);
Effects.SendLocationEffect(GetWorldLocation(), Map, 0x36BD, 15, 10);
}
public override void DoAttackEffect(Mobile m)

View file

@ -8,10 +8,6 @@ namespace Server.Factions
{
}
public FactionSawTrap(Serial serial) : base(serial)
{
}
public override int LabelNumber => 1041047; // faction saw trap
public override int AttackMessage => 1010544; // The blade cuts deep into your skin!
@ -23,7 +19,7 @@ namespace Server.Factions
public override void DoVisibleEffect()
{
Effects.SendLocationEffect(Location, Map, 0x11AD, 25);
Effects.SendLocationEffect(Location, Map, 0x11AD, 25, 10);
}
public override void DoAttackEffect(Mobile m)