Skip to content

Commit

Permalink
Changes/Fixes (ServUO#4773)
Browse files Browse the repository at this point in the history
Replaced standard create world teleporter items with regions.
Fixed an exploit with the Huntmaster.
MessageInABottle uses the new ItemID.
Various boat clean up and command fixes.
Fixed a crash that could result when t-hunting and a guardian is blocked from spawning.

Co-authored-by: TrueUO <[email protected]>
TrueUO and DocKnight86 authored May 4, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent d695fda commit af14d35
Showing 39 changed files with 5,303 additions and 3,726 deletions.
3,254 changes: 3,254 additions & 0 deletions Data/TeleporterRegions.xml

Large diffs are not rendered by default.

1,375 changes: 0 additions & 1,375 deletions Data/teleporters.csv

This file was deleted.

3 changes: 0 additions & 3 deletions Scripts/Commands/CreateWorld.cs
Original file line number Diff line number Diff line change
@@ -58,7 +58,6 @@ public CommandEntry(string n, string c, string d, Category cat, Expansion expans
new CommandEntry("Moongates", "Moongen", "MoonGenDelete", Category.Decoration, Expansion.None, 101),
new CommandEntry("Doors", "DoorGen", "DoorGenDelete", Category.Decoration, Expansion.None, 102),
new CommandEntry("Signs", "SignGen", "SignGenDelete", Category.Decoration, Expansion.None, 103),
new CommandEntry("Teleporters", "TelGen", "TelGenDelete", Category.Decoration, Expansion.None, 104),
new CommandEntry("Doom Lamp", "GenLeverPuzzle", "LampPuzzleDelete", Category.System, Expansion.AOS, 105),
new CommandEntry("Doom Gauntlet", "GenGauntlet", "DeleteGauntlet", Category.Dungeon, Expansion.AOS, 106),
new CommandEntry("Khaldun", "GenKhaldun", "DeleteKhaldun", Category.Dungeon, Expansion.None, 107),
@@ -499,8 +498,6 @@ public static bool HasGenerated(int index)
return WeakEntityCollection.HasCollection("door");
case 103:
return WeakEntityCollection.HasCollection("sign");
case 104:
return WeakEntityCollection.HasCollection("tel");
case 105:
return WeakEntityCollection.HasCollection("LeverPuzzleController");
case 106:
10 changes: 0 additions & 10 deletions Scripts/Items/Consumables/BankCheck.cs
Original file line number Diff line number Diff line change
@@ -162,16 +162,6 @@ public override void OnAdded(object parent)

if (tradeInfo != null)
{
if (owner.NetState != null && !owner.NetState.NewSecureTrading)
{
double total = Worth / Math.Max(1.0, Account.CurrencyThreshold);
int plat = (int)Math.Truncate(total);
int gold = (int)((total - plat) * Account.CurrencyThreshold);

tradeInfo.Plat += plat;
tradeInfo.Gold += gold;
}

if (tradeInfo.VirtualCheck != null)
{
tradeInfo.VirtualCheck.UpdateTrade(tradeInfo.Mobile);
12 changes: 1 addition & 11 deletions Scripts/Items/Consumables/Gold.cs
Original file line number Diff line number Diff line change
@@ -94,16 +94,6 @@ public override void OnAdded(object parent)

if (tradeInfo != null)
{
if (owner.NetState != null && !owner.NetState.NewSecureTrading)
{
double total = Amount / Math.Max(1.0, Account.CurrencyThreshold);
int plat = (int)Math.Truncate(total);
int gold = (int)((total - plat) * Account.CurrencyThreshold);

tradeInfo.Plat += plat;
tradeInfo.Gold += gold;
}

if (tradeInfo.VirtualCheck != null)
{
tradeInfo.VirtualCheck.UpdateTrade(tradeInfo.Mobile);
@@ -146,4 +136,4 @@ protected override void OnAmountChange(int oldValue)
UpdateTotal(this, TotalType.Gold, newValue - oldValue);
}
}
}
}
11 changes: 2 additions & 9 deletions Scripts/Items/Consumables/MessageInABottle.cs
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@ public MessageInABottle(Map map)

[Constructable]
public MessageInABottle(Map map, int level)
: base(0x099F)
: base(0xA30C)
{
Weight = 1.0;
m_TargetMap = map;
@@ -67,18 +67,15 @@ public static int GetRandomLevel()
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);

writer.Write(3); // version

writer.Write(m_Level);

writer.Write(m_TargetMap);
}

public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);

int version = reader.ReadInt();

switch (version)
@@ -101,11 +98,7 @@ public override void Deserialize(GenericReader reader)
}
}

if (version < 2)
m_Level = GetRandomLevel();

if (version < 3 && m_TargetMap == Map.Tokuno)
m_TargetMap = Map.Trammel;
ItemID = 0xA30C;
}

public override void OnDoubleClick(Mobile from)
9 changes: 1 addition & 8 deletions Scripts/Items/Corpses/Corpse.cs
Original file line number Diff line number Diff line change
@@ -956,14 +956,7 @@ public override void SendInfoTo(NetState state, bool sendOplPacket)

if (((Body)Amount).IsHuman && ItemID == 0x2006)
{
if (state.ContainerGridLines)
{
state.Send(new CorpseContent6017(state.Mobile, this));
}
else
{
state.Send(new CorpseContent(state.Mobile, this));
}
state.Send(new CorpseContent(state.Mobile, this));

state.Send(new CorpseEquip(state.Mobile, this));
}
79 changes: 1 addition & 78 deletions Scripts/Items/Corpses/Packets.cs
Original file line number Diff line number Diff line change
@@ -70,83 +70,6 @@ public CorpseContent(Mobile beholder, Corpse beheld)
count++;
}

EnsureCapacity(5 + (count * 19));

long pos = m_Stream.Position;

int written = 0;

m_Stream.Write((ushort)0);

for (int i = 0; i < items.Count; ++i)
{
Item child = items[i];

if (!child.Deleted && child.Parent == beheld && beholder.CanSee(child))
{
m_Stream.Write(child.Serial);
m_Stream.Write((ushort)child.ItemID);
m_Stream.Write((byte)0); // signed, itemID offset
m_Stream.Write((ushort)child.Amount);
m_Stream.Write((short)child.X);
m_Stream.Write((short)child.Y);
m_Stream.Write(beheld.Serial);
m_Stream.Write((ushort)child.Hue);

++written;
}
}

if (beheld.Hair != null && beheld.Hair.ItemID > 0)
{
m_Stream.Write(HairInfo.FakeSerial(beheld.Owner) - 2);
m_Stream.Write((ushort)beheld.Hair.ItemID);
m_Stream.Write((byte)0); // signed, itemID offset
m_Stream.Write((ushort)1);
m_Stream.Write((short)0);
m_Stream.Write((short)0);
m_Stream.Write(beheld.Serial);
m_Stream.Write((ushort)beheld.Hair.Hue);

++written;
}

if (beheld.FacialHair != null && beheld.FacialHair.ItemID > 0)
{
m_Stream.Write(FacialHairInfo.FakeSerial(beheld.Owner) - 2);
m_Stream.Write((ushort)beheld.FacialHair.ItemID);
m_Stream.Write((byte)0); // signed, itemID offset
m_Stream.Write((ushort)1);
m_Stream.Write((short)0);
m_Stream.Write((short)0);
m_Stream.Write(beheld.Serial);
m_Stream.Write((ushort)beheld.FacialHair.Hue);

++written;
}

m_Stream.Seek(pos, SeekOrigin.Begin);
m_Stream.Write((ushort)written);
}
}

public sealed class CorpseContent6017 : Packet
{
public CorpseContent6017(Mobile beholder, Corpse beheld)
: base(0x3C)
{
System.Collections.Generic.List<Item> items = beheld.EquipItems;
int count = items.Count;

if (beheld.Hair != null && beheld.Hair.ItemID > 0)
{
count++;
}
if (beheld.FacialHair != null && beheld.FacialHair.ItemID > 0)
{
count++;
}

EnsureCapacity(5 + (count * 20));

long pos = m_Stream.Position;
@@ -209,4 +132,4 @@ public CorpseContent6017(Mobile beholder, Corpse beheld)
m_Stream.Write((ushort)written);
}
}
}
}
25 changes: 14 additions & 11 deletions Scripts/Items/Internal/PvPWarnTeleporter.cs
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ public override bool OnMoveOver(Mobile m)
if (pm.DisabledPvpWarning)
return base.OnMoveOver(m);
else if (!pm.HasGump(typeof(PvpWarningGump)))
pm.SendGump(new PvpWarningGump(this));
pm.SendGump(new PvpWarningGump(m, this));
}

return true;
@@ -48,12 +48,14 @@ public override void Deserialize(GenericReader reader)

public class PvpWarningGump : Gump
{
private readonly Teleporter m_Owner;
public ITeleporter Teleporter { get; set; }
public Point3D Location { get; set; }

public PvpWarningGump(Teleporter teleporter)
public PvpWarningGump(Mobile from, ITeleporter teleporter)
: base(150, 50)
{
m_Owner = teleporter;
Teleporter = teleporter;
Location = from.Location;

AddPage(0);

@@ -93,10 +95,7 @@ public override void OnResponse(NetState sender, RelayInfo info)
{
PlayerMobile pm = sender.Mobile as PlayerMobile;

if (pm == null)
return;

if (!pm.InRange(m_Owner.Location, 5))
if (pm == null || !pm.InRange(Location, 5))
return;

switch (info.ButtonID)
@@ -110,8 +109,12 @@ public override void OnResponse(NetState sender, RelayInfo info)
}
case 1: // Yes, I wish to proceed
{
BaseCreature.TeleportPets(pm, m_Owner.PointDest, m_Owner.MapDest);
pm.MoveToWorld(m_Owner.PointDest, m_Owner.MapDest);
//BaseCreature.TeleportPets(pm, m_Owner.PointDest, m_Owner.MapDest);
//pm.MoveToWorld(m_Owner.PointDest, m_Owner.MapDest);
if (Teleporter != null)
{
Teleporter.DoTeleport(pm);
}

break;
}
@@ -122,4 +125,4 @@ public override void OnResponse(NetState sender, RelayInfo info)
}
}
}
}
}
30 changes: 10 additions & 20 deletions Scripts/Items/Internal/Teleporter.cs
Original file line number Diff line number Diff line change
@@ -2,14 +2,20 @@
using Server.Mobiles;
using Server.Network;
using Server.Spells;
using Server.Regions;
using System;
using System.Collections.Generic;
using System.Text;
#endregion

namespace Server.Items
{
public class Teleporter : Item
public interface ITeleporter
{
void DoTeleport(Mobile m);
}

public class Teleporter : Item, ITeleporter
{
private bool m_Active, m_Creatures, m_CombatCheck, m_CriminalCheck;
private Point3D m_PointDest;
@@ -248,7 +254,6 @@ public virtual void StartTeleport(Mobile m)
{
if (!m.CanBeginAction(typeof(Teleporter)))
{
m.SendMessage("Teleport in progress...");
return;
}

@@ -257,15 +262,7 @@ public virtual void StartTeleport(Mobile m)
return;
}

if (m_Delay > TimeSpan.Zero)
{
DelayedTeleport(m);
}
else
{
// Allow OnMoveOver to return before processing the map/location changes
Timer.DelayCall(DoTeleport, m);
}
DelayedTeleport(m);
}

private void DelayedTeleport(Mobile m)
@@ -274,20 +271,14 @@ private void DelayedTeleport(Mobile m)

m.Frozen = true;

m.SendMessage(
"Teleporting in {0:#,0.##} second{1}",
m_Delay.TotalSeconds,
m_Delay.TotalSeconds != 1 ? "s" : String.Empty);

Timer.DelayCall(m_Delay, DelayedTeleportCallback, m);
Timer.DelayCall(m_Delay > TeleportRegion.Delay ? m_Delay : TeleportRegion.Delay, DelayedTeleportCallback, m);
}

private void DelayedTeleportCallback(Mobile m)
{
m.EndAction(typeof(Teleporter));
Timer.DelayCall(TimeSpan.FromMilliseconds(250), () => m.EndAction(typeof(Teleporter)));

m.Frozen = false;

DoTeleport(m);
}

@@ -315,7 +306,6 @@ public virtual void DoTeleport(Mobile m)
}

BaseCreature.TeleportPets(m, p, map);

m.MoveToWorld(p, map);

if (m_DestEffect && sendEffect)
2 changes: 1 addition & 1 deletion Scripts/Misc/CharacterCreation.cs
Original file line number Diff line number Diff line change
@@ -327,7 +327,7 @@ private static void FixStat(ref int stat, int diff, int max)

private static void SetStats(Mobile m, NetState state, int str, int dex, int intel)
{
int max = state.NewCharacterCreation ? 90 : 80;
int max = 90;

FixStats(ref str, ref dex, ref intel, max);

Loading

0 comments on commit af14d35

Please sign in to comment.