Overwrite

Complete Overwrite of the Folder with the free shard. ServUO 57.3 has been added.
This commit is contained in:
Unstable Kitsune
2023-11-28 23:20:26 -05:00
parent 3cd54811de
commit b918192e4e
11608 changed files with 2644205 additions and 47 deletions

View File

@@ -0,0 +1,196 @@
using System;
using System.Collections.Generic;
namespace Server.Mobiles
{
public class ProximitySpawner : Spawner
{
private int m_TriggerRange;
private TextDefinition m_SpawnMessage;
private bool m_InstantFlag;
[Constructable]
public ProximitySpawner()
{
}
[Constructable]
public ProximitySpawner(string spawnName)
: base(spawnName)
{
}
[Constructable]
public ProximitySpawner(int amount, int minDelay, int maxDelay, int team, int homeRange, string spawnName)
: base(amount, minDelay, maxDelay, team, homeRange, spawnName)
{
}
[Constructable]
public ProximitySpawner(int amount, int minDelay, int maxDelay, int team, int homeRange, string spawnName, int triggerRange, string spawnMessage, bool instantFlag)
: base(amount, minDelay, maxDelay, team, homeRange, spawnName)
{
m_TriggerRange = triggerRange;
m_SpawnMessage = TextDefinition.Parse(spawnMessage);
m_InstantFlag = instantFlag;
}
public ProximitySpawner(int amount, TimeSpan minDelay, TimeSpan maxDelay, int team, int homeRange, List<string> spawnNames)
: base(amount, minDelay, maxDelay, team, homeRange, spawnNames)
{
}
public ProximitySpawner(int amount, TimeSpan minDelay, TimeSpan maxDelay, int team, int homeRange, List<string> spawnNames, int triggerRange, TextDefinition spawnMessage, bool instantFlag)
: base(amount, minDelay, maxDelay, team, homeRange, spawnNames)
{
m_TriggerRange = triggerRange;
m_SpawnMessage = spawnMessage;
m_InstantFlag = instantFlag;
}
public ProximitySpawner(Serial serial)
: base(serial)
{
}
[CommandProperty(AccessLevel.Spawner)]
public int TriggerRange
{
get
{
return m_TriggerRange;
}
set
{
m_TriggerRange = value;
}
}
[CommandProperty(AccessLevel.Spawner)]
public TextDefinition SpawnMessage
{
get
{
return m_SpawnMessage;
}
set
{
m_SpawnMessage = value;
}
}
[CommandProperty(AccessLevel.Spawner)]
public bool InstantFlag
{
get
{
return m_InstantFlag;
}
set
{
m_InstantFlag = value;
}
}
public override string DefaultName
{
get
{
return "Proximity Spawner";
}
}
public override bool HandlesOnMovement
{
get
{
return true;
}
}
public override void DoTimer(TimeSpan delay)
{
if (!Running)
return;
End = DateTime.UtcNow + delay;
}
public override void Respawn()
{
RemoveSpawned();
End = DateTime.UtcNow;
}
public override void Spawn()
{
for (int i = 0; i < SpawnObjectCount; ++i)
{
for (int j = 0; j < MaxCount; ++j)
Spawn(SpawnObjects[i]);
}
}
public override bool CheckSpawnerFull()
{
return false;
}
public virtual bool ValidTrigger(Mobile m)
{
if (m is BaseCreature)
{
BaseCreature bc = (BaseCreature)m;
if (!bc.Controlled && !bc.Summoned)
return false;
}
else if (!m.Player)
{
return false;
}
return (m.Alive && !m.IsDeadBondedPet && m.CanBeDamaged() && !m.Hidden);
}
public override void OnMovement(Mobile m, Point3D oldLocation)
{
if (!Running)
return;
if (IsEmpty && End <= DateTime.UtcNow && m.InRange(GetWorldLocation(), m_TriggerRange) && m.Location != oldLocation && ValidTrigger(m))
{
TextDefinition.SendMessageTo(m, m_SpawnMessage);
DoTimer();
Spawn();
if (m_InstantFlag)
{
foreach (ISpawnable spawned in GetSpawn())
{
if (spawned is Mobile)
((Mobile)spawned).Combatant = m;
}
}
}
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0); // version
writer.Write(m_TriggerRange);
TextDefinition.Serialize(writer, m_SpawnMessage);
writer.Write(m_InstantFlag);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
m_TriggerRange = reader.ReadInt();
m_SpawnMessage = TextDefinition.Deserialize(reader);
m_InstantFlag = reader.ReadBool();
}
}
}

View File

@@ -0,0 +1,66 @@
using System;
using System.Collections.Generic;
namespace Server.Mobiles
{
public class SpawnObject
{
public string SpawnName { get; set; }
public int MaxCount { get; set; }
public int CurrentCount { get { return SpawnedObjects.Count; } }
public List<ISpawnable> SpawnedObjects { get; set; }
public SpawnObject(string name)
: this(name, 1)
{
}
public SpawnObject(string name, int count)
{
SpawnName = name;
MaxCount = count;
SpawnedObjects = new List<ISpawnable>();
}
public SpawnObject(GenericReader reader)
{
int version = reader.ReadInt();
SpawnedObjects = new List<ISpawnable>();
int count = reader.ReadInt();
for (int i = 0; i < count; i++)
{
ISpawnable e = World.FindEntity(reader.ReadInt()) as ISpawnable;
if (e != null)
SpawnedObjects.Add(e);
}
SpawnName = reader.ReadString();
MaxCount = reader.ReadInt();
}
public void Serialize(GenericWriter writer)
{
writer.Write(0);
writer.Write(SpawnedObjects.Count);
foreach (var sp in SpawnedObjects)
{
if (sp is Item)
writer.Write((Item)sp);
else if (sp is Mobile)
writer.Write((Mobile)sp);
else
writer.Write(Serial.MinusOne);
}
writer.Write(SpawnName);
writer.Write(MaxCount);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,232 @@
using System;
using System.Collections.Generic;
using Server.Gumps;
using Server.Network;
namespace Server.Mobiles
{
public class SpawnerGump : BaseGump
{
public static readonly int MaxEntries = 13;
public Spawner Spawner { get; set; }
public int LabelHue { get { return User != null && User.NetState != null && User.NetState.IsEnhancedClient ? 0x386 : 0x384; } }
public SpawnerGump(Mobile m, Spawner spawner)
: base(m as PlayerMobile, 50, 50)
{
Spawner = spawner;
}
public override void AddGumpLayout()
{
AddPage(0);
AddBackground(0, 0, 410, 381, 5054);
AddLabel(75, 1, 0, "Spawn List");
AddLabel(335, 1, 0, "Max");
AddLabel(378, 1, 0, "Total");
AddButton(5, 310, 0xFB7, 0xFB9, 1, GumpButtonType.Reply, 0);
AddLabel(38, 310, LabelHue, "Apply");
AddButton(5, 333, 0xFA8, 0xFAB, 1025, GumpButtonType.Reply, 0);
AddLabel(38, 333, LabelHue, "Props");
AddButton(5, 356, 0xFB1, 0xFB3, 0, GumpButtonType.Reply, 0);
AddLabel(38, 356, LabelHue, "Cancel");
AddButton(110, 310, 0xFA5, 0xFA7, 1500, GumpButtonType.Reply, 0);
AddLabel(143, 310, LabelHue, String.Format("Running: {0}", Spawner.Running ? "Yes" : "No"));
AddButton(110, 333, 0xFA5, 0xFA7, 1000, GumpButtonType.Reply, 0);
AddLabel(143, 333, LabelHue, String.Format("Group: {0}", Spawner.Group ? "Yes" : "No"));
AddButton(110, 356, 0xFB4, 0xFB6, 2, GumpButtonType.Reply, 0);
AddLabel(143, 356, LabelHue, "Bring to Home");
AddButton(270, 333, 0xFA8, 0xFAA, 3, GumpButtonType.Reply, 0);
AddLabel(303, 333, LabelHue, "Total Respawn");
AddButton(270, 356, 0xFA8, 0xFAA, 1750, GumpButtonType.Reply, 0);
AddLabel(303, 356, LabelHue, "Total Reset");
AddImageTiled(350, 306, 30, 23, 0xA40);
AddImageTiled(351, 307, 28, 21, 0xBBC);
AddLabel(270, 306, LabelHue, "Max Spawn:");
AddTextEntry(353, 307, 28, 21, 0, 500, Spawner.MaxCount.ToString());
AddLabel(382, 307, 0, Spawner.SpawnCount.ToString());
for (int i = 0; i < MaxEntries; i++)
{
AddButton(5, (22 * i) + 20, 0xFA5, 0xFA7, 4 + (i * 2), GumpButtonType.Reply, 0);
AddButton(38, (22 * i) + 20, 0xFA2, 0xFA4, 5 + (i * 2), GumpButtonType.Reply, 0);
AddImageTiled(71, (22 * i) + 20, 279, 23, 0xA40);
AddImageTiled(72, (22 * i) + 21, 277, 21, 0xBBC);
AddImageTiled(330, (22 * i) + 20, 50, 23, 0xA40);
AddImageTiled(331, (22 * i) + 21, 48, 21, 0xBBC);
string str = "";
int max = 0;
if (i < Spawner.SpawnObjects.Count)
{
var so = Spawner.SpawnObjects[i];
str = so.SpawnName;
max = so.MaxCount;
int count = Spawner.CountCreatures(so);
AddLabel(382, (22 * i) + 20, 0, count.ToString());
}
AddTextEntry(75, (22 * i) + 21, 304, 21, 0, i, str);
AddTextEntry(332, (22 * i) + 21, 28, 21, 0, i + 20, max.ToString());
}
}
public void UpdateSpawnObjects(RelayInfo info, Mobile from)
{
TextRelay tr = info.GetTextEntry(500);
if (tr != null && tr.Text.Length > 0)
{
Spawner.MaxCount = Math.Max(0, Utility.ToInt32(tr.Text));
}
for (int i = 0; i < MaxEntries; i++)
{
TextRelay te = info.GetTextEntry(i);
TextRelay te2 = info.GetTextEntry(i + 20);
SpawnObject so = i < Spawner.SpawnObjects.Count ? Spawner.SpawnObjects[i] : null;
if (te != null)
{
string name = te.Text;
string maxCount = te2 != null ? te2.Text : null;
int max = 0;
if (name.Length > 0)
{
name = name.Trim();
if (!String.IsNullOrEmpty(maxCount))
{
max = Utility.ToInt32(maxCount);
}
max = Math.Max(0, max);
string t = Spawner.ParseType(name);
Type type = ScriptCompiler.FindTypeByName(t);
if (type == null)
{
from.SendMessage("{0} is not a valid type name.", t);
continue;
}
if (so != null)
{
if (so.SpawnName != name)
so.SpawnName = name;
if (so.MaxCount != max)
so.MaxCount = max;
}
else
{
Spawner.AddSpawnObject(new SpawnObject(name, max));
}
}
}
}
}
public override void OnResponse(RelayInfo info)
{
if (Spawner.Deleted || User.AccessLevel < AccessLevel.GameMaster)
return;
switch ( info.ButtonID )
{
case 0: // Closed
{
return;
}
case 1: // Apply
{
UpdateSpawnObjects(info, User);
break;
}
case 2: // Bring to Home
{
Spawner.BringToHome();
break;
}
case 3: // Total Respawn
{
Spawner.Respawn();
break;
}
case 1000:
{
if (Spawner.Group)
Spawner.Group = false;
else
Spawner.Group = true;
break;
}
case 1025:
{
User.SendGump(new PropertiesGump(User, Spawner));
break;
}
case 1500:
{
if (Spawner.Running)
Spawner.Running = false;
else
Spawner.Running = true;
break;
}
case 1750:
{
Spawner.RemoveSpawned();
break;
}
default:
{
int buttonID = info.ButtonID - 4;
int index = buttonID / 2;
int type = buttonID % 2;
TextRelay entry = info.GetTextEntry(index);
if (entry != null && entry.Text.Length > 0)
{
UpdateSpawnObjects(info, User);
if (type == 0) // Spawn creature
Spawner.Spawn(index);
else // Remove creatures
Spawner.RemoveSpawned(index);
}
break;
}
}
Refresh();
}
}
}

View File

@@ -0,0 +1,12 @@
using System;
namespace Server.Mobiles
{
public class SpawnerType
{
public static Type GetType(string name)
{
return ScriptCompiler.FindTypeByName(name);
}
}
}