### C# Example: Creating and Configuring a Magical Weapon Source: https://context7.com/zuluhotelaustralia/zuluhotel/llms.txt Demonstrates how to create a weapon, access its base properties like damage and speed, set skill requirements, and configure magical enchantments and slayer properties. It also shows how to manage durability, crafting information, and fortification. ```csharp using Server.Items; using Server.Mobiles; using Server.Engines.Craft; using ZuluContent.Zulu.Engines.Magic; using ZuluContent.Zulu.Engines.Magic.Enums; public class WeaponExample { public void CreateMagicalWeapon() { // Create a weapon Longsword sword = new Longsword(); // Base weapon properties int minDamage = sword.MinDamage; int maxDamage = sword.MaxDamage; int speed = sword.Speed; int maxRange = sword.MaxRange; // 1 for melee // Skill requirements int strReq = sword.StrRequirement; int dexReq = sword.DexRequirement; int intReq = sword.IntRequirement; // Weapon classification WeaponType weaponType = sword.Type; // Slashing, Bashing, Piercing, Ranged WeaponAnimation animation = sword.Animation; // Slash1H, Slash2H, etc SkillName skill = sword.Skill; // Swords, Macing, Fencing, Archery SkillName accuracySkill = sword.AccuracySkill; // Tactics for hit chance // Durability system int currentHits = sword.Hits; int maxHits = sword.MaxHits; bool isDamaged = sword.Hits < sword.MaxHits; // Crafting and quality MarkQuality quality = sword.Quality; // Regular, Exceptional, Low Mobile crafter = sword.Crafter; CraftResource material = sword.Resource; // Iron, DullCopper, Gold, etc // Set material sword.Resource = CraftResource.Valorite; // Strongest material // Magical properties via enchantments if (sword is IEnchanted enchantedWeapon) { // Get enchantment dictionary EnchantmentDictionary enchants = enchantedWeapon.Enchantments; // Magical weapon type MagicalWeaponType magicType = sword.MagicalWeaponType; // Types: None, Fire, Cold, Poison, Energy, Life, Death, Earth, Air, Water // Harvest bonus (for tools/weapons) int harvestBonus = sword.HarvestBonus; // Apply custom enchantments // See Enchantment system examples above } // Slayer properties (bonus damage vs creature types) SlayerName slayer1 = sword.OldSlayer; SlayerName slayer2 = sword.OldSlayer2; // Repairable interface if (sword is IRepairable repairable) { bool canRepair = repairable.CanRepair; // Repair at blacksmith or with repair deed } // Fortification (increase max durability) if (sword.CanFortify) { sword.MaxHits += 10; // Fortify by 10 points sword.Hits = sword.MaxHits; } // Combat sounds int hitSound = sword.HitSound; int missSound = sword.MissSound; } // Example: Create enchanted weapon with specific properties public BaseWeapon CreateEnchantedSword(Mobile owner) { var sword = new Katana { Resource = CraftResource.Verite, Quality = MarkQuality.Exceptional, Crafter = owner }; // Apply enchantments if (sword is IEnchanted enchanted) { // Set magical type sword.MagicalWeaponType = MagicalWeaponType.Fire; // Additional enchantments can be added via Enchantment system } return sword; } } ``` -------------------------------- ### CraftSystem: Item Crafting Framework Example Source: https://context7.com/zuluhotelaustralia/zuluhotel/llms.txt Demonstrates how to use the CraftSystem for item crafting, including accessing system properties, craft items, resource management, skill checks, and enhancement options. It shows how to retrieve configuration details like main skill, sounds, delay, and checks for features like resmelting, repairing, and fortifying. ```csharp using Server.Engines.Craft; using Server.Items; using Server.Mobiles; using ZuluContent.Configuration.Types.Crafting; public class CraftingExample { public void UseCraftSystem(Mobile crafter, CraftSystem craftSystem) { // Get crafting context for the mobile CraftContext context = craftSystem.GetContext(crafter); // Access craft system properties from configuration SkillName mainSkill = craftSystem.MainSkill; // e.g., SkillName.Blacksmith int gumpTitleId = craftSystem.GumpTitleNumber; int craftSound = craftSystem.CraftWorkSound; int endSound = craftSystem.CraftEndSound; double craftDelay = craftSystem.Delay; // Access craft items and groups CraftItemCol craftItems = craftSystem.CraftItems; CraftGroupCol craftGroups = craftSystem.CraftGroups; CraftSubResCol primaryResources = craftSystem.CraftSubRes; CraftSubResCol secondaryResources = craftSystem.CraftSubRes2; // Check system features bool canResmelt = craftSystem.Resmelt; bool canRepair = craftSystem.Repair; bool canFortify = craftSystem.Fortify; bool canMark = craftSystem.MarkOption; bool canEnhance = craftSystem.CanEnhance; // Example: Blacksmithing // DefBlacksmithy system includes: // - Weapons (swords, maces, axes) // - Armor (platemail, chainmail, ringmail) // - Uses Iron, DullCopper, ShadowIron, Copper, Bronze, Gold, Agapite, Verite, Valorite // Craft item with specific resource CraftResource resource = CraftResource.Gold; // Golden ingots // Get required skill for item with resource int baseSkillRequired = 75; // Base skill requirement int actualSkillRequired = craftSystem.GetCraftSkillRequired( baseSkillRequired, typeof(GoldIngot) ); // Get craft points for success calculation int craftPoints = craftSystem.GetCraftPoints(actualSkillRequired, 10); // Check if resources consumed on failure bool consumeOnFail = craftSystem.ConsumeOnFailure( crafter, typeof(IronIngot), null ); } } ``` -------------------------------- ### HarvestSystem: Resource Gathering Framework Example Source: https://context7.com/zuluhotelaustralia/zuluhotel/llms.txt Illustrates the usage of the HarvestSystem for resource gathering activities like mining, lumberjacking, and fishing. It covers checking tool validity, harvest conditions, resource availability, calculating resource consumption based on skill, and determining the chance for rare resources. The example also touches upon resource banks and bonus enchantments. ```csharp using Server.Engines.Harvest; using Server.Items; using Server.Mobiles; using ZuluContent.Zulu.Engines.Magic.Enchantments; public class HarvestExample { public void PerformHarvest(Mobile harvester, Item tool, Point3D location) { HarvestSystem system = Mining.System; // Or Lumberjacking.System // Get harvest definitions (different resource types) List definitions = system.Definitions; HarvestDefinition def = definitions[0]; // Check tool and requirements bool toolValid = system.CheckTool(harvester, tool); bool canHarvest = system.CheckHarvest(harvester, tool, def, location); bool inRange = system.CheckRange(harvester, tool, def, harvester.Map, location, false); // Check resource availability bool resourcesAvailable = system.CheckResources( harvester, tool, def, harvester.Map, location, false ); // Get consume amount based on skill int consumeAmount = system.GetConsumeAmount(harvester, def); // Calculate chance for colored/rare resources // Base: (skill / 5) + 35 // Max: 75% // Bonus: +10% if tool has HarvestBonus enchantment int coloredChance = system.GetChanceForColored(harvester, tool, def); // Example with enchanted pickaxe if (tool is IEnchanted enchantedTool) { int harvestBonus = enchantedTool.Enchantments.Get((HarvestBonus e) => e.Value); if (harvestBonus > 0) { // +10% chance for colored resources Console.WriteLine($"Harvest bonus active: +{harvestBonus}"); } } // Resource bank system // Map divided into regions, each with regenerating resource bank HarvestBank bank = def.GetBank(harvester.Map, location.X, location.Y); if (bank != null && bank.Current >= consumeAmount) { // Harvest successful, deduct from bank bank.Current -= consumeAmount; Console.WriteLine($"Harvested! Bank remaining: {bank.Current}/{bank.Maximum}"); } } } ``` -------------------------------- ### C# Loot Table Creation and Rolling Example Source: https://context7.com/zuluhotelaustralia/zuluhotel/llms.txt Demonstrates how to create a loot table, add individual items with drop chances and quantities, and incorporate nested loot groups for more complex drops. It also shows how to roll the loot table to generate items based on defined parameters and then process the generated loot. ```csharp using Server.Scripts.Engines.Loot; using System.Collections.Generic; using System; public class LootExample { public LootTable CreateCreatureLoot() { var lootTable = new LootTable(); // Add individual item entries // LootEntry(Type itemType, int minQty, int maxQty, double chance) lootTable.Add(new LootEntry(typeof(Gold), 50, 150, 1.0)); // Always drops 50-150 gold lootTable.Add(new LootEntry(typeof(Bandage), 5, 10, 0.5)); // 50% chance for 5-10 bandages lootTable.Add(new LootEntry(typeof(BlackPearl), 1, 5, 0.25)); // 25% chance for reagents // Add nested loot groups var weaponGroup = new LootGroup(); weaponGroup.Add(new LootEntry(typeof(Longsword), 1, 1, 0.3)); weaponGroup.Add(new LootEntry(typeof(Katana), 1, 1, 0.2)); weaponGroup.Add(new LootEntry(typeof(Broadsword), 1, 1, 0.5)); // Add group with chance lootTable.Add(weaponGroup, 1, 1, 0.4); // 40% chance for one weapon // Create armor group var armorGroup = new LootGroup(); armorGroup.Add(new LootEntry(typeof(PlateChest), 1, 1, 0.1)); armorGroup.Add(new LootEntry(typeof(ChainCoif), 1, 1, 0.3)); armorGroup.Add(new LootEntry(typeof(LeatherGloves), 1, 1, 0.6)); lootTable.Add(armorGroup, 1, 1, 0.3); // 30% chance for one armor piece // Roll the loot table int itemLevel = 5; // Affects enchantment chances double itemChance = 0.85; // Base quality modifier List generatedLoot = lootTable.Roll(itemLevel, itemChance); foreach (var lootItem in generatedLoot) { Type itemType = lootItem.Value; int quantity = lootItem.Quantity; int level = lootItem.ItemLevel; double chance = lootItem.ItemChance; Console.WriteLine($"Generated: {quantity}x {itemType.Name} (Level: {level})"); // Create actual item instance and apply enchantments based on level Item item = Activator.CreateInstance(itemType) as Item; if (item != null) { item.Amount = quantity; // Apply magical properties based on itemLevel and itemChance } } return lootTable; } // Example: Boss creature with multiple loot groups public LootTable CreateBossLoot() { var bossLoot = new LootTable(); // Guaranteed gold bossLoot.Add(new LootEntry(typeof(Gold), 500, 1000, 1.0)); // Multiple weapon chances var magicWeapons = new LootGroup(); magicWeapons.Add(new LootEntry(typeof(VikingSword), 1, 1, 0.3)); magicWeapons.Add(new LootEntry(typeof(Halberd), 1, 1, 0.3)); bossLoot.Add(magicWeapons, 1, 2, 0.8); // 80% chance for 1-2 magic weapons // Rare resources bossLoot.Add(new LootEntry(typeof(DullCopperIngot), 10, 25, 0.5)); bossLoot.Add(new LootEntry(typeof(OakLog), 10, 25, 0.5)); return bossLoot; } } ``` -------------------------------- ### Manage Player Party Members and Stats in C# Source: https://context7.com/zuluhotelaustralia/zuluhotel/llms.txt Demonstrates how to manage a player party system using the Server.Engines.PartySystem library. This includes creating parties, adding/removing members, accessing member information, and handling automatic stat updates (stamina and mana) for nearby party members. It also shows how to query stats between party members and an example of healing a party member. ```csharp using Server.Engines.PartySystem; using Server.Mobiles; using Server.Network; using System.Collections.Generic; public class PartyExample { public void ManageParty(Mobile leader) { // Create a new party Party party = new Party(leader); // Party properties int maxCapacity = Party.Capacity; // 10 members Mobile partyLeader = party.Leader; int memberCount = party.Count; bool isActive = party.Active; // true if more than 1 member // Add members (up to 10) Mobile newMember = new PlayerMobile(); party.Candidates.Add(newMember); // Invite candidate // Accept invitation party.Members.Add(new PartyMemberInfo(newMember)); // Access members List members = party.Members; PartyMemberInfo leaderInfo = party[0]; // First member is always leader PartyMemberInfo memberInfo = party[newMember]; // Get by mobile // Party stat updates - automatically shared // When member stamina changes party.OnStamChanged(newMember); // Sends stam update to all nearby party members // When member mana changes party.OnManaChanged(newMember); // Sends mana update to all nearby party members // Stats query between party members party.OnStatsQuery(leader, newMember); // Leader checks newMember's stats // Example: Heal party member foreach (var memberInfo in party.Members) { Mobile member = memberInfo.Mobile; if (member != null && member.Alive && member.Hits < member.HitsMax) { // Party members can see each other's health if (member.Map == leader.Map && Utility.InUpdateRange(leader.Location, member.Location)) { // Heal the member member.Hits = member.HitsMax; party.OnStamChanged(member); // Update party } } } // Remove member party.Members.RemoveAt(1); // Disband party party.Members.Clear(); } } ``` -------------------------------- ### ZuluClass - Character Class System Implementation Source: https://context7.com/zuluhotelaustralia/zuluhotel/llms.txt This C# code illustrates the ZuluClass system, which defines six character classes for Modern Zuluhotel. It shows how to access a player's class type and level, lists the defining skills for each class, and outlines the skill point requirements for level progression (0-6). The example also touches upon class skill bonuses. ```csharp using Scripts.Zulu.Engines.Classes; using Server.Mobiles; public class ClassExample { public void DemonstrateClassSystem(Mobile player) { // Check if player has a class (IZuluClassed interface) if (player is IZuluClassed zuluPlayer) { ZuluClass playerClass = zuluPlayer.ZuluClass; // Get current class and level ZuluClassType classType = playerClass.Type; int level = playerClass.Level; // 0-6 // Available classes with their defining skills // Warrior: Wrestling, Tactics, Healing, Anatomy, Swords, Macing, Fencing, Parry // Ranger: Tracking, Archery, AnimalLore, Veterinary, AnimalTaming, Fishing, Camping, Cooking // Mage: Alchemy, ItemID, EvalInt, Inscribe, MagicResist, Meditation, Magery, SpiritSpeak // Crafter: Tinkering, ArmsLore, Fletching, Tailoring, Mining, Lumberjacking, Carpentry, Blacksmith // Thief: Hiding, Stealth, Stealing, DetectHidden, RemoveTrap, Poisoning, Lockpicking, Snooping // Bard: Musicianship, Peacemaking, Provocation, Discordance (and related skills) // Level requirements (skill points needed) // Level 0: 480 points // Level 1: 600 points (480 + 120) // Level 2: 720 points // Level 3: 840 points // Level 4: 960 points // Level 5: 1080 points // Level 6: 1200 points Console.WriteLine($"{player.Name} is a level {level} {classType}"); // Get class bonus multiplier (1.5x for class skills) // Skills in the player's class category receive 50% bonus double bonus = 1.5; // ClasseBonus constant // Check minimum skill requirement for a level double minSkillsForLevel3 = ZuluClass.MinSkills[3]; // 840.0 } } } ``` -------------------------------- ### Configuration Management with ZhConfig Source: https://context7.com/zuluhotelaustralia/zuluhotel/llms.txt This C# snippet demonstrates how to use ZhConfig, the central configuration manager for Modern Zuluhotel. It loads and provides type-safe access to server settings from CUE configuration files, covering core game, crafting, magic, creature, loot, and resource configurations. It also includes a method for deserializing custom JSON configurations. ```csharp using Server; using ZuluContent.Configuration.Types; // Access configuration at runtime public class MyFeature { public void ConfigureFeature() { // Access core game settings Expansion expansion = ZhConfig.Core.Expansion; bool insuranceEnabled = ZhConfig.Core.InsuranceEnabled; int actionDelay = ZhConfig.Core.ActionDelay; // Access crafting configuration var craftSettings = ZhConfig.Crafting; // Access magic system settings var magicConfig = ZhConfig.Magic; // Access creature configuration var creatureConfig = ZhConfig.Creatures; // Access loot table settings var lootConfig = ZhConfig.Loot; // Access resource definitions (ores, logs, etc) var resourceConfig = ZhConfig.Resources; Console.WriteLine($"Server expansion: {expansion}"); } // Load custom JSON config with proper serialization public T LoadCustomConfig(string configPath) { return ZhConfig.DeserializeJsonConfig( configPath, ZhConfig.DefaultSerializerOptions ); } } ``` -------------------------------- ### Manage Player Account Authentication and Security in C# Source: https://context7.com/zuluhotelaustralia/zuluhotel/llms.txt Illustrates the management of player accounts using the Server.Accounting library. This code covers account creation, password setting and validation (with support for multiple hashing algorithms like Argon2), access level management, and tracking in-game currency (Gold and Platinum). It also details character slot management, account timestamps, IP tracking and restrictions, and GM-specific features like comments and tags. ```csharp using Server.Accounting; using Server.Mobiles; using System; using System.Net; public class AccountExample { public void ManageAccount() { // Create new account var account = new Account("username"); // Authentication and security account.SetPassword("securepassword"); // Hashed with Argon2 by default PasswordProtectionAlgorithm algorithm = account.PasswordAlgorithm; // Access level and permissions account.AccessLevel = AccessLevel.Player; // Currency system (Gold and Platinum) int goldAmount = account.TotalGold; // 0-999,999,999 int platinumAmount = account.TotalPlat; // 1 platinum = CurrencyThreshold gold // Character management (up to 7 characters per account) Mobile[] characters = account.Mobiles; int characterCount = account.Count; int characterLimit = account.Limit; // 7 slots // Add character to slot PlayerMobile newChar = new PlayerMobile(); account[0] = newChar; // Assign to first slot // Account timestamps DateTime created = account.Created; DateTime lastLogin = account.LastLogin; TimeSpan totalGameTime = account.TotalGameTime; // IP tracking and restrictions IPAddress[] loginIPs = account.LoginIPs; string[] ipRestrictions = account.IPRestrictions; // Whitelist with wildcard support // Young player status (40 hours protection) TimeSpan youngDuration = Account.YoungDuration; // 40 hours // Comments and tags (GM tools) account.Comments.Add(new AccountComment("John_GM", "Clean account")); account.Tags.Add(new AccountTag("VIP", "true")); // Account flags bool isBanned = account.Banned; // Login validation bool canLogin = account.CheckPassword("password"); if (canLogin) { account.LastLogin = DateTime.UtcNow; } // Security features // - Argon2 password hashing (default) // - PBKDF2, SHA2, SHA1, MD5 (legacy support) // - IP restrictions with wildcard support // - Account attack limiter // - Max 10 accounts per IP (configurable) // - Auto account creation (configurable) } } ``` -------------------------------- ### Base Spell Casting Framework in C# Source: https://context7.com/zuluhotelaustralia/zuluhotel/llms.txt Implements a base spell casting system with mechanics for mana costs, cast times, targeting, and interruptions. It integrates with the class system and handles spell lifecycle events. ```csharp using Server.Spells; using Server.Mobiles; using Server.Targeting; public class CustomSpell : Spell { public CustomSpell(Mobile caster, Item scrollItem = null) : base(caster, scrollItem) { } public override SkillName CastSkill => SkillName.Magery; public override SkillName DamageSkill => SkillName.EvalInt; // Mana cost based on spell circle public override int Mana => Circle.Mana; public void CastSpellExample() { Mobile caster = Caster; // Check if currently casting if (IsCasting) { Console.WriteLine("Spell is being cast"); } // Check if targeting if (IsTargeting) { Console.WriteLine("Waiting for target selection"); } // Cast sequence // 1. Start cast // 2. Check requirements (mana, reagents, etc) // 3. Begin animation and cast timer // 4. If targeting required, set AsyncSpellTarget // 5. Complete cast and apply effects // Spell can be interrupted by: // - Taking damage (OnCasterHurt - DisturbType.Hurt) // - Movement (if BlocksMovement is true) // - Equipping items (OnCasterEquipping) // - Death (OnCasterKilled) FinishSequence(); // Complete the spell sequence } // Movement blocking example public override bool OnCasterMoving(Direction d) { if (IsCasting && Info.BlocksMovement) { Caster.SendLocalizedMessage(500111); // You are frozen and can not move. return false; } return true; } } ``` -------------------------------- ### Magical Item Enchantment System in C# Source: https://context7.com/zuluhotelaustralia/zuluhotel/llms.txt A flexible enchantment system for weapons, armor, and items, featuring curse mechanics, buffs, and hook-based event handling. It allows for custom enchantment types and application to items. ```csharp using ZuluContent.Zulu.Engines.Magic; using ZuluContent.Zulu.Engines.Magic.Enums; using Server; using Server.Mobiles; using Server.Spells; // Create a custom enchantment type public class FireDamageEnchantment : Enchantment { public override string AffixName => "of Flames"; [Key(1)] public int BonusDamage { get; set; } public FireDamageEnchantment(int bonusDamage, bool cursed = false) : base(cursed) { BonusDamage = bonusDamage; Cursed = cursed ? CurseType.Unrevealed : CurseType.None; } // Hook into spell damage calculation public override void OnSpellDamage( Mobile attacker, Mobile defender, Spell spell, ElementalType damageType, ref int damage) { if (damageType == ElementalType.Fire) { damage += BonusDamage; } } // Hook into healing calculation public override void OnHeal(Mobile healer, Mobile patient, object source, ref double healAmount) { // Modify heal amount healAmount *= 1.1; // 10% bonus } // Hook into paralysis public override void OnParalysis(Mobile mobile, ref TimeSpan duration, ref bool paralyze) { // Reduce paralysis duration duration = TimeSpan.FromSeconds(duration.TotalSeconds * 0.5); } } // Apply enchantments to items public class EnchantmentExample { public void ApplyEnchantments(IEnchanted item, Mobile owner) { // Get enchantment dictionary EnchantmentDictionary enchantments = item.Enchantments; // Add an enchantment var fireEnchant = new FireDamageEnchantment(10); enchantments.Add(fireEnchant); // Query enchantments using Get with predicate int fireDamage = enchantments.Get((FireDamageEnchantment e) => e.BonusDamage); // Set enchantment value enchantments.Set((FireDamageEnchantment e) => e.BonusDamage = 15); // Check curse status CurseType curseStatus = fireEnchant.Cursed; bool isCursed = curseStatus != CurseType.None; // Enchantment lifecycle events fireEnchant.OnAdded(item, owner); fireEnchant.OnIdentified(item); fireEnchant.OnRemoved(item, owner); } } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.