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,213 @@
using System;
using Server;
using Server.Mobiles;
using Server.ContextMenus;
using Server.Items;
using Server.Misc;
using Server.Prompts;
using Server.Network;
using System.Collections.Generic;
namespace Server.Engines.CityLoyalty
{
public class CityHerald : BaseCreature
{
public City City { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public CityLoyaltySystem CitySystem { get { return CityLoyaltySystem.GetCityInstance(City); } set { } }
public override bool IsInvulnerable { get { return true; } }
private string _Announcement;
[CommandProperty(AccessLevel.GameMaster)]
public string Announcement
{
get
{
return _Announcement;
}
set
{
if (String.IsNullOrEmpty(value))
{
AnnouncementExpires = DateTime.MinValue;
if (Timer != null)
{
Timer.Stop();
Timer = null;
}
}
if (value != _Announcement)
{
AnnouncementExpires = DateTime.UtcNow + TimeSpan.FromHours(CityLoyaltySystem.AnnouncementPeriod);
if (Timer != null)
Timer.Stop();
Timer = Timer.DelayCall(TimeSpan.FromMinutes(3), TimeSpan.FromMinutes(3), DoAnnouncement);
Timer.Start();
}
_Announcement = value;
if (_Announcement != null)
DoAnnouncement();
}
}
[CommandProperty(AccessLevel.GameMaster)]
public DateTime AnnouncementExpires { get; set; }
public Timer Timer { get; set; }
[Constructable]
public CityHerald(City city) : base(AIType.AI_Vendor, FightMode.None, 10, 1, .4, .2)
{
City = city;
SpeechHue = 0x3B2;
Female = Utility.RandomDouble() > 0.75;
Blessed = true;
Name = Female ? NameList.RandomName("female") : NameList.RandomName("male");
Title = "the city herald";
Body = Female ? 0x191 : 0x190;
HairItemID = Race.RandomHair(Female);
FacialHairItemID = Race.RandomFacialHair(Female);
HairHue = Race.RandomHairHue();
Hue = Race.RandomSkinHue();
SetStr(150);
SetInt(50);
SetDex(150);
EquipItem(new Doublet(1157));
EquipItem(new FancyShirt(1908));
EquipItem(new FeatheredHat(1157));
EquipItem(new LongPants(1908));
var boots = new Boots();
boots.Hue = 2012;
EquipItem(boots);
EquipItem(new GoldRing());
CantWalk = true;
}
public override void GetContextMenuEntries( Mobile from, List<ContextMenuEntry> list )
{
base.GetContextMenuEntries( from, list );
list.Add(new DonateGoldEntry(from, this));
}
private class DonateGoldEntry : ContextMenuEntry
{
public CityHerald Herald { get; private set; }
public Mobile Player { get; private set; }
public DonateGoldEntry(Mobile player, CityHerald herald) : base(1156237, 3) // Donate Gold
{
Player = player;
Herald = herald;
Enabled = player.InRange(herald.Location, 5);
}
public override void OnClick()
{
if (Player.Prompt != null)
{
Player.SendLocalizedMessage(1079166); // You already have a text entry request pending.
}
else
{
Player.SendLocalizedMessage(1155865); // Enter amount to deposit:
Player.BeginPrompt(
(from, text) =>
{
int amount = Utility.ToInt32(text);
if (amount > 0)
{
if (Banker.Withdraw(from, amount, true))
{
CityLoyaltySystem.GetCityInstance(Herald.City).AddToTreasury(from, amount, true);
Herald.SayTo(from, 1152926); // The City thanks you for your generosity!
}
else
from.SendLocalizedMessage(1155867); // The amount entered is invalid. Verify that there are sufficient funds to complete this transaction.
}
else
from.SendLocalizedMessage(1155867); // The amount entered is invalid. Verify that there are sufficient funds to complete this transaction.
},
(from, text) =>
{
from.SendLocalizedMessage(1155867); // The amount entered is invalid. Verify that there are sufficient funds to complete this transaction.
});
}
}
}
public void DoAnnouncement()
{
if (!String.IsNullOrEmpty(_Announcement))
{
PublicOverheadMessage(MessageType.Regular, 0x3B2, 502976); // Hear ye! Hear ye!
Timer.DelayCall(TimeSpan.FromSeconds(3), () =>
{
PublicOverheadMessage(MessageType.Regular, 0x3B2, false, _Announcement);
});
}
if (DateTime.UtcNow > AnnouncementExpires)
{
AnnouncementExpires = DateTime.MinValue;
if (Timer != null)
{
Timer.Stop();
Timer = null;
}
}
}
public CityHerald(Serial serial) : base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
writer.Write((int)City);
writer.Write(_Announcement);
writer.Write(AnnouncementExpires);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int v = reader.ReadInt();
City = (City)reader.ReadInt();
_Announcement = reader.ReadString();
AnnouncementExpires = reader.ReadDateTime();
if (CitySystem != null)
CitySystem.Herald = this;
if (DateTime.UtcNow < AnnouncementExpires)
{
Timer = Timer.DelayCall(TimeSpan.FromMinutes(3), TimeSpan.FromMinutes(3), DoAnnouncement);
Timer.Start();
}
}
}
}

View File

@@ -0,0 +1,221 @@
using Server.Items;
using Server.Mobiles;
using System;
using System.Collections.Generic;
using Server.ContextMenus;
using System.Globalization;
using Server.Gumps;
using System.Linq;
namespace Server.Engines.CityLoyalty
{
public class GuardCaptain : BaseCreature
{
[CommandProperty(AccessLevel.GameMaster)]
public City City { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public BoxOfRopes Box { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public DateTime NextShout { get; set; }
[CommandProperty(AccessLevel.GameMaster)]
public CityLoyaltySystem CitySystem { get { return CityLoyaltySystem.GetCityInstance(City); } set { } }
public override bool IsInvulnerable { get { return true; } }
private Dictionary<PlayerMobile, DateTime> _BannerCooldown;
[Constructable]
public GuardCaptain(City city) : base(AIType.AI_Vendor, FightMode.None, 10, 1, 0.2, 0.4)
{
City = city;
Female = Utility.RandomDouble() > 0.75;
Blessed = true;
Name = Female ? NameList.RandomName("female") : NameList.RandomName("male");
Title = "the guard captain";
Body = Female ? 0x191 : 0x190;
HairItemID = Race.RandomHair(Female);
FacialHairItemID = Race.RandomFacialHair(Female);
HairHue = Race.RandomHairHue();
Hue = Race.RandomSkinHue();
SetStr(150);
SetInt(50);
SetDex(150);
SetWearable(new ShortPants(1508));
if (Female)
SetWearable(new FemaleStuddedChest());
else
SetWearable(new PlateChest());
SetWearable(new BodySash(1326));
SetWearable(new Halberd());
CantWalk = true;
}
public override void OnMovement(Mobile m, Point3D oldLocation)
{
if (CitySystem != null && m is PlayerMobile && InRange(m.Location, 2))
{
Raider raider = ((PlayerMobile)m).AllFollowers.FirstOrDefault(mob => mob is Raider && mob.InRange(this.Location, 2)) as Raider;
if (raider != null)
{
CitySystem.AwardLove(m, 1000);
SayTo(m, 1152250, m.Name); // Thank you, ~1_name~, for your assistance during these difficult times.
raider.Delete();
}
}
base.OnMovement(m, oldLocation);
}
public override void GetContextMenuEntries(Mobile from, List<ContextMenuEntry> entries)
{
base.GetContextMenuEntries(from, entries);
if(from is PlayerMobile)
entries.Add(new InternalEntry(from as PlayerMobile, this));
}
public class InternalEntry : ContextMenuEntry
{
public PlayerMobile Player { get; set; }
public GuardCaptain Guard { get; set; }
public InternalEntry(PlayerMobile from, GuardCaptain guard)
: base(1152366, 3) // City Banner
{
Player = from;
Guard = guard;
Enabled = CityLoyaltySystem.HasCitizenship(from, Guard.City);
}
public override void OnClick()
{
CityLoyaltySystem thisSystem = CityLoyaltySystem.GetCityInstance(Guard.City);
CityLoyaltySystem theirSystem = CityLoyaltySystem.GetCitizenship(Player);
Guard.CheckBannerCooldown();
if (theirSystem != null && thisSystem != null && CityLoyaltySystem.HasCitizenship(Player, Guard.City))
{
if(Guard.IsInBannerCooldown(Player))
Guard.SayTo(Player, 1152364, String.Format("#{0}", CityLoyaltySystem.BannerLocalization(thisSystem.City))); // I have quite a backlog of orders and I cannot satisfy your request for a ~1_ITEM~ right now.
if (theirSystem.GetLoyaltyRating(Player) < LoyaltyRating.Adored)
Guard.SayTo(Player, 1152363, String.Format("#{0}", CityLoyaltySystem.GetCityLocalization(thisSystem.City))); // I apologize, but you are not well-enough renowned in the city of ~1_CITY~ to make this purchase.
else
{
string args = String.Format("#{0}\t{1}", CityLoyaltySystem.BannerLocalization(thisSystem.City), CityLoyaltySystem.BannerCost.ToString("N0", CultureInfo.GetCultureInfo("en-US")));
Player.SendGump(new ConfirmCallbackGump(Player, 1049004, 1152365, Player, args, Guard.OnConfirm));
}
}
}
}
private void OnConfirm(Mobile m, object o)
{
PlayerMobile pm = m as PlayerMobile;
if(pm != null)
{
if (Banker.Withdraw(pm, CityLoyaltySystem.BannerCost))
{
CityBannerDeed deed = new CityBannerDeed(City);
CitySystem.AddToTreasury(m, CityLoyaltySystem.BannerCost);
if(pm.Backpack == null || !pm.Backpack.TryDropItem(pm, deed, false))
{
pm.BankBox.DropItem(deed);
pm.SendMessage("The deed has been placed in your bank box.");
}
else
pm.SendMessage("The deed has been placed in your backpack.");
AddToCooldown(pm);
}
else
SayTo(pm, 1152302); // I am afraid your bank box does not contain the funds needed to complete this transaction.
}
}
public void AddToCooldown(PlayerMobile pm)
{
if (_BannerCooldown == null)
_BannerCooldown = new Dictionary<PlayerMobile, DateTime>();
_BannerCooldown[pm] = DateTime.UtcNow + TimeSpan.FromHours(CityLoyaltySystem.BannerCooldownDuration);
}
public bool IsInBannerCooldown(PlayerMobile m)
{
if (_BannerCooldown != null && m is PlayerMobile)
{
if (_BannerCooldown.ContainsKey((PlayerMobile)m))
return _BannerCooldown[m] > DateTime.UtcNow;
}
return false;
}
public void CheckBannerCooldown()
{
if (_BannerCooldown == null || _BannerCooldown.Count == 0)
return;
List<PlayerMobile> list = new List<PlayerMobile>(_BannerCooldown.Keys);
foreach (PlayerMobile pm in list)
{
if (_BannerCooldown[pm] < DateTime.UtcNow)
_BannerCooldown.Remove(pm);
}
list.Clear();
list.TrimExcess();
}
public override void OnThink()
{
base.OnThink();
if (NextShout < DateTime.UtcNow)
{
Say(Utility.Random(1152252, 6));
NextShout = DateTime.UtcNow + TimeSpan.FromSeconds(Utility.RandomMinMax(45, 65));
}
}
public GuardCaptain(Serial serial) : base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write(0);
writer.Write((int)City);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
City = (City)reader.ReadInt();
if (CitySystem != null)
CitySystem.Captain = this;
}
}
}

View File

@@ -0,0 +1,166 @@
using System;
using Server;
using Server.Items;
using System.Linq;
using Server.Network;
using Server.Engines.CityLoyalty;
namespace Server.Mobiles
{
public class Raider : BaseCreature
{
public DateTime DeleteTime { get; set; }
public override bool Commandable { get { return false; } }
public override bool ReduceSpeedWithDamage { get { return false; } }
public override bool AlwaysMurderer { get { return true; } }
[Constructable]
public Raider()
: base(AIType.AI_Melee, FightMode.Closest, 10, 1, 0.2, 0.4)
{
Title = "the raider";
Hue = Utility.RandomSkinHue();
Utility.AssignRandomHair(this);
SetStr(150, 200);
SetDex(125, 150);
SetInt(95, 110);
SetHits(400, 650);
SetDamage(21, 28);
if (this.Female = Utility.RandomBool())
{
Body = 0x191;
Name = NameList.RandomName("female");
EquipItem(new Skirt(Utility.RandomNeutralHue()));
}
else
{
Body = 0x190;
Name = NameList.RandomName("male");
EquipItem(new ShortPants(Utility.RandomNeutralHue()));
}
SetDamageType(ResistanceType.Physical, 100);
SetResistance(ResistanceType.Physical, 45, 55);
SetResistance(ResistanceType.Fire, 45, 55);
SetResistance(ResistanceType.Cold, 45, 55);
SetResistance(ResistanceType.Poison, 45, 55);
SetResistance(ResistanceType.Energy, 45, 55);
SetSkill(SkillName.MagicResist, 50.0, 75.5);
SetSkill(SkillName.Archery, 90.0, 105.5);
SetSkill(SkillName.Tactics, 90.0, 105.5);
SetSkill(SkillName.Anatomy, 90.0, 105.5);
Fame = 7500;
Karma = -7500;
SetWearable(new TricorneHat());
SetWearable(new LeatherArms());
SetWearable(new FancyShirt());
SetWearable(new Cutlass());
SetWearable(new Boots(Utility.RandomNeutralHue()));
SetWearable(new GoldEarrings());
Item bow;
switch (Utility.Random(4))
{
default:
case 0: bow = new CompositeBow(); PackItem(new Arrow(25)); break;
case 1: bow = new Crossbow(); PackItem(new Bolt(25)); break;
case 2: bow = new Bow(); PackItem(new Arrow(25)); break;
case 3: bow = new HeavyCrossbow(); PackItem(new Bolt(25)); break;
}
SetWearable(bow);
ControlSlots = 0;
}
public bool TryArrest(Mobile m)
{
if (ControlMaster != null)
{
m.SendLocalizedMessage(1152247); // That person is already under arrest.
}
else if (m is PlayerMobile && ((PlayerMobile)m).AllFollowers.FirstOrDefault(mob => mob is Raider) != null)
{
m.SendLocalizedMessage(1152249); // You already have a prisoner.
}
else if (Hits > ((double)HitsMax / 10))
{
m.SendLocalizedMessage(1152229); // That person won't sit still for it! A more aggressive approach is in order.
m.NonlocalOverheadMessage(MessageType.Regular, 0x3B2, 1152237, String.Format("{0}\t{1}", m.Name, this.Name, "raider"));
}
else
{
DeleteTime = DateTime.UtcNow + TimeSpan.FromHours(1);
SetControlMaster(m);
IsBonded = false;
ControlTarget = m;
ControlOrder = OrderType.Follow;
m.SendLocalizedMessage(1152236, this.Name); // You arrest the ~1_name~. Take the criminal to the guard captain.
m.NonlocalOverheadMessage(MessageType.Regular, 0x3B2, 1152238, String.Format("{0}\t{1}", m.Name, this.Name));
return true;
}
return false;
}
public override void OnThink()
{
base.OnThink();
CheckDelete();
}
public void CheckDelete()
{
if (DeleteTime != DateTime.MinValue && DateTime.UtcNow > DeleteTime)
{
if (ControlMaster != null && ControlMaster.NetState != null)
{
ControlMaster.SendLocalizedMessage(1152248); // You did not take your prisoner to the Guard Captain in time.
}
Delete();
}
}
public override void GenerateLoot()
{
AddLoot(LootPack.FilthyRich, 2);
}
public Raider(Serial serial)
: base(serial)
{
}
public override void Serialize(GenericWriter writer)
{
base.Serialize(writer);
writer.Write((int)0);
Timer.DelayCall(TimeSpan.FromSeconds(10), CheckDelete);
writer.Write(DeleteTime);
}
public override void Deserialize(GenericReader reader)
{
base.Deserialize(reader);
int version = reader.ReadInt();
DeleteTime = reader.ReadDateTime();
}
}
}