### Navigating and Interacting with Objects in Ultima Online Source: https://github.com/uoaccess/scripts/blob/master/Quests/Beginner Equipment Quest/Beginner Quest Set-Up.txt Commands for character movement and object property manipulation in Ultima Online. 'go' moves the character, while 'props' allows editing of target object properties like teleporter destinations. ```command [go 3600 2576 20 ``` ```command [go 3604 2570 20 ``` ```command [props ``` ```command [go 6048 362 44 ``` -------------------------------- ### Modifying Character Creation Script (C#) Source: https://github.com/uoaccess/scripts/blob/master/Quests/Beginner Equipment Quest/Beginner Quest Set-Up.txt Adding a 'Letter of Apprenticeship' item to new characters upon creation by modifying the 'CharacterCreation.cs' script. This ensures players receive the necessary item to begin the quest. ```csharp PackItem( new RedBook( "a book", m.Name, 20, true ) ); PackItem( new Gold( 1000 ) ); // Starting gold can be customized here PackItem( new Dagger() ); PackItem( new Candle() ); PackItem( new LetterofApprenticeship() ); ``` -------------------------------- ### Adding NPCs and Objects in Ultima Online Source: https://github.com/uoaccess/scripts/blob/master/Quests/Beginner Equipment Quest/Beginner Quest Set-Up.txt Commands used to add game entities such as NPCs and interactive objects within the Ultima Online environment. These commands require administrative privileges and precise location targeting. ```command [add Lothar ``` ```command [add pentagramaddon ``` ```command [add teleporter ``` ```command [add Brianna ``` ```command [add LetterofApprenticeship ``` -------------------------------- ### Configuring Teleporter Destinations in Ultima Online Source: https://github.com/uoaccess/scripts/blob/master/Quests/Beginner Equipment Quest/Beginner Quest Set-Up.txt Modifying teleporter properties using the 'props' command interface. This involves setting the destination map ('Trammel') and precise coordinates (X, Y, Z) for the teleportation point. ```plaintext MapDest: Trammel PointDest: X:6062, Y:273, Z:-22 ``` ```plaintext MapDest: Trammel PointDest: X:3601, Y:2570, Z:20 ``` -------------------------------- ### C# BaseAddon: Create Placeable Decorative Objects Source: https://context7.com/uoaccess/scripts/llms.txt This C# script demonstrates how to create a placeable decorative object (Addon) using the BaseAddon class in ServUO/RunUO. It defines the visual components of the addon and handles serialization for persistence. The script requires the Server and Server.Items namespaces. ```csharp using System; using Server; using Server.Items; namespace Server.Items { public class AncientOakBonsaiEastAddon : BaseAddon { // Define the visual components (item IDs and positions) private static int[,] m_AddOnSimpleComponents = new int[,] { {18137, 0, 0, 0} // ItemID, X, Y, Z offset }; public override BaseAddonDeed Deed { get { return new AncientOakBonsaiEastAddonDeed(); } } [Constructable] public AncientOakBonsaiEastAddon() { // Add all components to the addon for (int i = 0; i < m_AddOnSimpleComponents.Length / 4; i++) AddComponent(new AddonComponent(m_AddOnSimpleComponents[i,0]), m_AddOnSimpleComponents[i,1], m_AddOnSimpleComponents[i,2], m_AddOnSimpleComponents[i,3]); } public AncientOakBonsaiEastAddon(Serial serial) : base(serial) { } public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write(0); // Version } public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); } } public class AncientOakBonsaiEastAddonDeed : BaseAddonDeed { public override BaseAddon Addon { get { return new AncientOakBonsaiEastAddon(); } } [Constructable] public AncientOakBonsaiEastAddonDeed() { Name = "AncientOakBonsaiEast"; } public AncientOakBonsaiEastAddonDeed(Serial serial) : base(serial) { } public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write(0); // Version } public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); } } } ``` -------------------------------- ### Conditional Script Download Logic (C) Source: https://github.com/uoaccess/scripts/blob/master/README.md This C# snippet demonstrates a conditional logic for downloading scripts if they are needed and wanted. If the condition is not met, it opens a web browser to ServUO.com. This logic is a conceptual representation and not directly executable without a defined script environment. ```csharp if (Scripts != Have && Want == True) { Download(ScriptsYouWant); } else OpenBrowser(www.ServUO.com); ``` -------------------------------- ### Create Custom Armor with Set Bonuses (C#) Source: https://context7.com/uoaccess/scripts/llms.txt This C# code defines a custom armor piece, 'AcolyteArms', inheriting from 'BaseArmor'. It sets physical and elemental resistances, durability, and requirements. The 'OnEquip' method checks for other set pieces and applies bonuses, while 'OnRemoved' reverts these changes. This allows for unique armor sets with synergistic effects. ```csharp using System; using Server.Items; namespace Server.Items { [FlipableAttribute(0x13CD, 0x13C5)] public class AcolyteArms : BaseArmor { public override int LabelNumber { get { return 1074307; } } public override int BasePhysicalResistance { get { return 7; } } public override int BaseFireResistance { get { return 7; } } public override int BaseColdResistance { get { return 3; } } public override int BasePoisonResistance { get { return 4; } } public override int BaseEnergyResistance { get { return 4; } } public override int InitMinHits { get { return 30; } } public override int InitMaxHits { get { return 40; } } public override int AosStrReq { get { return 20; } } public override int ArmorBase { get { return 13; } } public override ArmorMaterialType MaterialType { get { return ArmorMaterialType.Leather; } } public override ArmorMeditationAllowance DefMedAllowance { get { return ArmorMeditationAllowance.All; } } [Constructable] public AcolyteArms() : base(0x13CD) { Weight = 5.0; Attributes.BonusMana = 2; Attributes.SpellDamage = 2; } // Set bonus activation when full set is equipped public override bool OnEquip(Mobile from) { Item shirt = from.FindItemOnLayer(Layer.InnerTorso); Item glove = from.FindItemOnLayer(Layer.Gloves); Item pants = from.FindItemOnLayer(Layer.Pants); if (shirt != null && shirt.GetType() == typeof(AcolyteChest) && glove != null && glove.GetType() == typeof(AcolyteGloves) && pants != null && pants.GetType() == typeof(AcolyteLegs)) { // Visual effect when set activates Effects.PlaySound(from.Location, from.Map, 503); from.FixedParticles(0x376A, 9, 32, 5030, EffectLayer.Waist); // Apply set bonuses Hue = 0x2; ArmorAttributes.SelfRepair = 3; PhysicalBonus = 3; FireBonus = 3; ColdBonus = 3; PoisonBonus = 3; EnergyBonus = 3; // Update all other set pieces AcolyteChest chest = from.FindItemOnLayer(Layer.InnerTorso) as AcolyteChest; chest.Hue = 0x2; chest.Attributes.NightSight = 1; chest.Attributes.Luck = 100; chest.ArmorAttributes.SelfRepair = 3; // ... additional bonuses applied to other pieces from.SendLocalizedMessage(1072391); } this.InvalidateProperties(); return base.OnEquip(from); } // Remove bonuses when piece is unequipped public override void OnRemoved(object parent) { if (parent is Mobile) { Mobile m = (Mobile)parent; Hue = 0x0; ArmorAttributes.SelfRepair = 0; PhysicalBonus = 0; FireBonus = 0; ColdBonus = 0; PoisonBonus = 0; EnergyBonus = 0; // ... reset bonuses on other pieces this.InvalidateProperties(); } base.OnRemoved(parent); } public AcolyteArms(Serial serial) : base(serial) { } public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write((int)0); } public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); if (Weight == 1.0) Weight = 5.0; } } } ``` -------------------------------- ### Chess Game Logic and State Management in C# Source: https://context7.com/uoaccess/scripts/llms.txt Implements the core logic for a chess game, managing game state, player turns, and move validation. It includes enums for game status and classes for representing the game board and pieces. Dependencies include System and Server namespaces. ```csharp using System; using Server; namespace Arya.Chess { public enum GameStatus { Setup, WhiteToMove, BlackToMove, WhiteMoving, BlackMoving, WhitePromotion, BlackPromotion, Over } public class ChessGame { // Player management private Mobile m_Black; private Mobile m_White; private bool m_BlackOwner; // Time tracking private DateTime m_GameStart; private TimeSpan m_WhiteTime = TimeSpan.Zero; private TimeSpan m_BlackTime = TimeSpan.Zero; private DateTime m_MoveTime; // Game state private BChessboard m_Board; private BaseChessPiece m_MovingPiece; private GameStatus m_Status = GameStatus.Setup; private Rectangle2D m_Bounds; private int m_Z; // Properties for accessing game state public Mobile Black { get { return m_Black; } } public Mobile White { get { return m_White; } } public GameStatus Status { get { return m_Status; } } public BChessboard Board { get { return m_Board; } } // Initialize new game public ChessGame(Mobile white, Mobile black, Rectangle2D bounds, int z) { m_White = white; m_Black = black; m_Bounds = bounds; m_Z = z; m_Board = new BChessboard(); m_GameStart = DateTime.Now; m_Status = GameStatus.WhiteToMove; } // Start the game public void StartGame() { m_GameStart = DateTime.Now; m_MoveTime = DateTime.Now; m_Status = GameStatus.WhiteToMove; if (m_White != null) m_White.SendMessage("The game has started. White moves first."); if (m_Black != null) m_Black.SendMessage("The game has started. White moves first."); } // Handle piece movement public bool MakeMove(Mobile player, Point2D from, Point2D to) { if (!IsPlayerTurn(player)) return false; if (m_Board.IsValidMove(from, to)) { m_Board.MovePiece(from, to); UpdateMoveTime(player); SwitchTurns(); return true; } return false; } // Update time tracking private void UpdateMoveTime(Mobile player) { TimeSpan elapsed = DateTime.Now - m_MoveTime; if (player == m_White) m_WhiteTime += elapsed; else m_BlackTime += elapsed; m_MoveTime = DateTime.Now; } // Check if it's the player's turn private bool IsPlayerTurn(Mobile player) { if (player == m_White && m_Status == GameStatus.WhiteToMove) return true; if (player == m_Black && m_Status == GameStatus.BlackToMove) return true; return false; } // Switch turns between players private void SwitchTurns() { if (m_Status == GameStatus.WhiteToMove) m_Status = GameStatus.BlackToMove; else if (m_Status == GameStatus.BlackToMove) m_Status = GameStatus.WhiteToMove; } // End the game public void EndGame(Mobile winner) { m_Status = GameStatus.Over; if (winner != null) { winner.SendMessage("You have won the game!"); Mobile loser = (winner == m_White) ? m_Black : m_White; if (loser != null) loser.SendMessage("You have lost the game."); } } } } ``` -------------------------------- ### Register Administrator Command with Access Level - C# Source: https://context7.com/uoaccess/scripts/llms.txt Registers a new administrator command named 'AddToBank' that requires 'Administrator' access level. When executed, it opens a Gump interface for the player. This command is part of the Server.Commands namespace and utilizes various Server and Gumps related classes. ```csharp using System; using Server; using Server.Commands; using Server.Targeting; using Server.Items; using Server.Mobiles; using Server.Gumps; using Server.Accounting; namespace Server.Commands { public class AddToBank { public static void Initialize() { // Register command with access level requirement CommandSystem.Register("AddToBank", AccessLevel.Administrator, new CommandEventHandler(AddToBank_OnCommand)); } private static void AddToBank_OnCommand(CommandEventArgs e) { e.Mobile.SendGump(new AddToBankGump()); } // Target system for item selection public class DupeTarget : Target { private bool m_InBag; private int m_Amount; private int m_GiveRule; private int m_Access; public DupeTarget(bool inbag, int amount, int give, int access) : base(15, false, TargetFlags.None) { m_InBag = inbag; m_Amount = amount; m_GiveRule = give; m_Access = access; } protected override void OnTarget(Mobile from, object targ) { if (!(targ is Item)) { from.SendMessage("You can only dupe items."); return; } from.SendMessage("Placing {0} into bank boxes...", ((Item)targ).Name ?? "an item"); CommandLogging.WriteLine(from, "{0} {1} adding {2} to bank boxes", from.AccessLevel, CommandLogging.Format(from), CommandLogging.Format(targ)); GiveItem(from, (Item)targ, m_Amount, m_GiveRule, m_Access); } } // Distribute items to all accounts private static bool GiveItemToAccounts(Item item, int amount) { bool success = true; foreach (Account acct in Accounts.GetAccounts()) { if (acct[0] != null) { if (!CopyItem(item, amount, acct[0].BankBox)) { Console.WriteLine("Could not give item to {0}", acct[0].Name); success = false; } } } return success; } // Copy item using reflection private static bool CopyItem(Item item, int count, Container container) { Type t = item.GetType(); ConstructorInfo[] info = t.GetConstructors(); foreach (ConstructorInfo c in info) { ParameterInfo[] paramInfo = c.GetParameters(); if (paramInfo.Length == 0) { try { for (int i = 0; i < count; i++) { object o = c.Invoke(new object[0]); if (o != null && o is Item) { Item newItem = (Item)o; CopyProperties(newItem, item); newItem.Parent = null; if (container != null) container.AddItem(newItem); } } return true; } catch { return false; } } } return false; } } } ``` -------------------------------- ### C# Spartan NPC - BaseCreature Implementation Source: https://context7.com/uoaccess/scripts/llms.txt Defines a 'Spartan' NPC using the BaseCreature class. This NPC has specific combat stats, skills, resistances, equipment, and loot generation defined. It inherits from BaseCreature and includes serialization/deserialization logic. ```csharp using System; using System.Collections; using Server.Items; using Server.ContextMenus; using Server.Misc; using Server.Network; namespace Server.Mobiles { [CorpseName("a spartan corpse")] public class Spartan : BaseCreature { public override bool ShowFameTitle { get { return false; } } [Constructable] public Spartan() : base(AIType.AI_Melee, FightMode.Aggressor, 10, 1, 0.2, 0.2) { SpeechHue = Utility.RandomDyedHue(); Name = "a spartan"; Hue = Utility.RandomSkinHue(); Body = 0x190; // Human body type // Set base stats SetStr(86, 100); SetDex(81, 100); SetInt(72, 85); SetDamage(18, 26); SetHits(100, 152); // Configure skills SetSkill(SkillName.Fencing, 95.0, 100.0); SetSkill(SkillName.Swords, 92.0, 100.0); SetSkill(SkillName.Tactics, 90.0, 100.0); SetSkill(SkillName.Wrestling, 94.3, 100.0); // Set resistances SetResistance(ResistanceType.Physical, 70, 80); SetResistance(ResistanceType.Fire, 40, 50); SetResistance(ResistanceType.Cold, 80, 90); SetResistance(ResistanceType.Poison, 50, 60); SetResistance(ResistanceType.Energy, 25, 35); Fame = 22500; Karma = -22500; // Equip the mobile with items AddItem(new Cloak(33)); AddItem(new BoneArms()); AddItem(new BoneLegs()); AddItem(new PhalanxSpear()); AddItem(new BronzeShield()); AddItem(new NorseHelm()); AddItem(new Sandals()); Utility.AssignRandomHair(this); } public override void GenerateLoot() { AddLoot(LootPack.Average); } public override bool AlwaysMurderer { get { return true; } } public Spartan(Serial serial) : base(serial) { } public override void Serialize(GenericWriter writer) { base.Serialize(writer); writer.Write((int)0); // version } public override void Deserialize(GenericReader reader) { base.Deserialize(reader); int version = reader.ReadInt(); } } } ``` -------------------------------- ### C# Gump for Interactive Dialog Source: https://context7.com/uoaccess/scripts/llms.txt This C# code defines a Gump class named ArrianasGump, which creates an interactive dialog interface for a game. It registers a command to open the gump and includes HTML content for quest dialogs, along with decorative images and a reply button. The OnResponse method handles button clicks, providing feedback to the player. ```csharp using System; using Server; using Server.Gumps; using Server.Network; using Server.Commands; namespace Server.Gumps { public class ArrianasGump : Gump { public static void Initialize() { CommandSystem.Register("ArrianasGump", AccessLevel.GameMaster, new CommandEventHandler(ArrianasGump_OnCommand)); } private static void ArrianasGump_OnCommand(CommandEventArgs e) { e.Mobile.SendGump(new ArrianasGump(e.Mobile)); } public ArrianasGump(Mobile owner) : base(50, 50) { AddPage(0); AddImageTiled(54, 33, 369, 400, 2624); AddAlphaRegion(54, 33, 369, 400); AddImageTiled(416, 39, 44, 389, 203); AddImageTiled(58, 39, 29, 390, 10460); AddImageTiled(412, 37, 31, 389, 10460); AddLabel(140, 60, 0x34, "Arriana's Lost Heirloom"); // HTML content for quest dialog AddHtml(107, 140, 300, 230, "
" + "