CODE |
public override bool OnAugment(Mobile from, object target) { if (target is YourStatuette) { // look for the other augments in the target sockets XmlSockets s = (XmlSockets)XmlAttach.FindAttachment(target, typeof(XmlSockets)); if(s != null && s.SocketOccupants != null) { bool hasaugment1 = false; bool hasaugment2 = false; bool hasaugment3 = false; bool hasaugment4 = false; foreach (SocketOccupant so in s.SocketOccupants) { if (so.OccupantType is YourSpecialAugment1) hasaugment1 = true; if (so.OccupantType is YourSpecialAugment2) hasaugment2 = true; if (so.OccupantType is YourSpecialAugment3) hasaugment3 = true; if (so.OccupantType is YourSpecialAugment4) hasaugment4 = true; } if (hasaugment1 && hasaugment2 && hasaugment3 && hasaugment4) { // spawn your creature } } } return false; } public override bool CanAugment(Mobile from, object target) { if (target is YourStatuette) { return true; } return false; } |
QUOTE |
public override DeathMoveResult GetParentMoveResultFor(Item item) { if (CheckInsuranceOnDeath(item)) return DeathMoveResult.MoveToBackpack; DeathMoveResult res = base.GetParentMoveResultFor(item); XmlData a = (XmlData)XmlAttach.FindAttachment(this, typeof(XmlData), "NoDrop"); if (res == (DeathMoveResult.MoveToCorpse && item.Movable && this.Young) || (a != null && !(item is YourSpecialStatuette))) res = DeathMoveResult.MoveToBackpack; return res; } |
QUOTE |
public override DeathMoveResult GetInventoryMoveResultFor(Item item) { if (CheckInsuranceOnDeath(item)) return DeathMoveResult.MoveToBackpack; DeathMoveResult res = base.GetInventoryMoveResultFor(item); XmlData a = (XmlData)XmlAttach.FindAttachment(this, typeof(XmlData), "NoDrop"); if (res == (DeathMoveResult.MoveToCorpse && item.Movable && this.Young) || (a != null && !(item is YourSpecialStatuette))) res = DeathMoveResult.MoveToBackpack; return res; } |
QUOTE |
if (res == (DeathMoveResult.MoveToCorpse && item.Movable && this.Young) || (a != null && !(item is YourSpecialStatuette))) res = DeathMoveResult.MoveToBackpack; |
QUOTE |
public override DeathMoveResult GetParentMoveResultFor(Item item) { if (CheckInsuranceOnDeath(item)) return DeathMoveResult.MoveToBackpack; DeathMoveResult res = base.GetParentMoveResultFor(item); XmlProtectItems a = (XmlProtectItems)XmlAttach.FindAttachment(this, typeof(XmlProtectItems)); if (res == DeathMoveResult.MoveToCorpse && ((item.Movable && this.Young) || (a != null && a.ProtectItem(item)))) res = DeathMoveResult.MoveToBackpack; return res; } public override DeathMoveResult GetInventoryMoveResultFor(Item item) { if (CheckInsuranceOnDeath(item)) return DeathMoveResult.MoveToBackpack; DeathMoveResult res = base.GetInventoryMoveResultFor(item); XmlProtectItems a = (XmlProtectItems)XmlAttach.FindAttachment(this, typeof(XmlProtectItems)); if (res == DeathMoveResult.MoveToCorpse && ((item.Movable && this.Young) || (a != null && a.ProtectItem(item)))) res = DeathMoveResult.MoveToBackpack; return res; } |
QUOTE |
public bool ProtectItem(Item item) { // check to see whether this item should be moved to the backpack on death // check the region Mobile from = AttachedTo as Mobile; if (from != null) { Region r = Region.Find(from.Location, from.Map); // if it is in the wrong region then dont protect the item if (from != null && RegionName != null && RegionName != String.Empty) return false; } // add whatever item exemptions that you want here if (item is BaseClothing || item is BaseArmor) { // dont protect them return false; } // by default protect all items return true; } |
CODE |
using System; using Server; using Server.Targeting; using Server.Mobiles; namespace Server.Items { public class ItemIdentification { public static void Initialize() { SkillInfo.Table[(int)SkillName.ItemID].Callback = new SkillUseCallback( OnUse ); } public static TimeSpan OnUse( Mobile from ) { from.SendLocalizedMessage( 500343 ); // What do you wish to appraise and identify? from.Target = new InternalTarget(); return TimeSpan.FromSeconds( 1.0 ); } [PlayerVendorTarget] private class InternalTarget : Target { public InternalTarget() : base ( 8, false, TargetFlags.None ) { AllowNonlocal = true; } protected override void OnTarget( Mobile from, object o ) { if ( o is Item ) { if ( from.CheckTargetSkill( SkillName.ItemID, o, 0, 100 ) ) { if ( o is BaseWeapon ) ((BaseWeapon)o).Identified = true; else if ( o is BaseArmor ) ((BaseArmor)o).Identified = true; if ( !Core.AOS ) ((Item)o).OnSingleClick( from ); } else { from.SendLocalizedMessage( 500353 ); // You are not certain... } } else if ( o is Mobile ) { ((Mobile)o).OnSingleClick( from ); } else { from.SendLocalizedMessage( 500353 ); // You are not certain... } } } } } |
QUOTE |
STEP 8: (recommended but not required) To allow the ItemIdentification skill to be used to reveal attachments on items/mobs, one line must be added to ItemIdentification.cs (Scripts/Skills/ItemIdentification.cs) as described below. (note, you dont have to make this mod if you dont want to, the spawner and other items will work just fine without it, players just wont be able to see what attachments are on an item/mob using this skill). around line 50 of ItemIdentification.cs change else if ( o is Mobile ) { ((Mobile)o).OnSingleClick( from ); } else { from.SendLocalizedMessage( 500353 ); // You are not certain... } to else if ( o is Mobile ) { ((Mobile)o).OnSingleClick( from ); } else { from.SendLocalizedMessage( 500353 ); // You are not certain... } //allows the identify skill to reveal attachments Server.Engines.XmlSpawner2.XmlAttach.RevealAttachments(from,o); |
QUOTE |
STEP 11: (recommended but not required) To allow attachment properties on weapons/armor to be automatically displayed in the properties list on mouseover/click, these changes must be made to BaseWeapon.cs (Scripts/Items/Weapons/BaseWeapon.cs), BaseArmor.cs (Scripts/Items/Armor/BaseArmor.cs) and BaseJewel.cs (Scripts/Items/Jewels/BaseJewel.cs) described below. (note, you dont have to make this mod if you dont want to, the spawner and other items will work just fine without it, players just wont automatically see attachment properties on items with attachments). at the end of the GetProperties method around line 2823 of BaseWeapon.cs change if ( m_Hits > 0 && m_MaxHits > 0 ) list.Add( 1060639, "{0}\t{1}", m_Hits, m_MaxHits ); // durability ~1_val~ / ~2_val~ to if ( m_Hits > 0 && m_MaxHits > 0 ) list.Add( 1060639, "{0}\t{1}", m_Hits, m_MaxHits ); // durability ~1_val~ / ~2_val~ // mod to display attachment properties Server.Engines.XmlSpawner2.XmlAttach.AddAttachmentProperties(this, list); at the end of the GetProperties method around line 1488 of BaseArmor.cs change if ( m_HitPoints > 0 && m_MaxHitPoints > 0 ) list.Add( 1060639, "{0}\t{1}", m_HitPoints, m_MaxHitPoints ); // durability ~1_val~ / ~2_val~ to if ( m_HitPoints > 0 && m_MaxHitPoints > 0 ) list.Add( 1060639, "{0}\t{1}", m_HitPoints, m_MaxHitPoints ); // durability ~1_val~ / ~2_val~ // mod to display attachment properties Server.Engines.XmlSpawner2.XmlAttach.AddAttachmentProperties(this, list); at the end of the GetProperties method around line 226 of BaseJewel.cs change base.AddResistanceProperties( list ); to base.AddResistanceProperties( list ); // mod to display attachment properties Server.Engines.XmlSpawner2.XmlAttach.AddAttachmentProperties(this, list); |
CODE |
using System; using Server; using Server.Mobiles; using Server.Engines.XmlSpawner2; namespace Server.Items { public class JimsRuby : BaseSocketAugmentation, IMythicAugment { [Constructable] public JimsRuby() : base(0xF13) { Name = "Mythic Ruby"; Hue = 32; } public JimsRuby( Serial serial ) : base( serial ) { } public override int SocketsRequired {get { return 4; } } public override int Icon {get { return 0x9a8; } } public override bool UseGumpArt {get { return true; } } public override int IconXOffset { get { return 15;} } public override int IconYOffset { get { return 15;} } public override string OnIdentify(Mobile from) { return "You can feel this jewels power."; } public override bool OnAugment(Mobile from, object target) { if (target is Artifact) { // look for the other augments in the target sockets XmlSockets s = (XmlSockets)XmlAttach.FindAttachment(target, typeof(XmlSockets)); if(s != null && s.SocketOccupants != null) { bool hasaugment1 = false; bool hasaugment2 = false; bool hasaugment3 = false; bool hasaugment4 = false; foreach (SocketOccupant so in s.SocketOccupants) { if (so.OccupantType is YourSpecialAugment1) hasaugment1 = true; if (so.OccupantType is YourSpecialAugment2) hasaugment2 = true; if (so.OccupantType is YourSpecialAugment3) hasaugment3 = true; if (so.OccupantType is YourSpecialAugment4) hasaugment4 = true; } if (hasaugment1 && hasaugment2 && hasaugment3 && hasaugment4) { // spawn your creature } } } return false; } public override bool CanAugment(Mobile from, object target) { if (target is Artifact) {return true; } return false; } 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(); } } } |
CODE |
if (so.OccupantType is JimsRuby) hasaugment1 = true; |
CODE |
if (so.OccupantType == typeof(JimsRuby)) hasaugment1 = true; |
CODE |
using System; using Server; using Server.Mobiles; using Server.Engines.XmlSpawner2; namespace Server.Items { public class JimsRuby : BaseSocketAugmentation, IMythicAugment { [Constructable] public JimsRuby() : base(0xF13) { Name = "Mythic Ruby"; Hue = 32; } public JimsRuby( Serial serial ) : base( serial ) { } public override int SocketsRequired {get { return 1; } } public override int Icon {get { return 0x9a8; } } public override bool UseGumpArt {get { return true; } } public override int IconXOffset { get { return 15;} } public override int IconYOffset { get { return 15;} } public override string OnIdentify(Mobile from) { return "You can feel this jewels power"; } public override bool OnAugment(Mobile from, object target) { if(((SimpleArtifact)target).Name == "DEMISE") { // look for the other augments in the target sockets XmlSockets s = (XmlSockets)XmlAttach.FindAttachment(target, typeof(XmlSockets)); if(s != null && s.SocketOccupants != null) { bool hasaugment1 = false; bool hasaugment2 = false; bool hasaugment3 = false; bool hasaugment4 = false; foreach (XmlSockets.SocketOccupant so in s.SocketOccupants) { if (so.OccupantType == typeof(JimsRuby)) hasaugment1 = true; if (so.OccupantType == typeof(JimsRuby)) hasaugment2 = true; if (so.OccupantType == typeof(JimsRuby)) hasaugment3 = true; if (so.OccupantType == typeof(JimsRuby)) hasaugment4 = true; } if (hasaugment1 && hasaugment2 && hasaugment3 && hasaugment4) { //spawn your creature } } } return false; } public override bool CanAugment(Mobile from, object target) { if(((SimpleArtifact)target).Name == "DEMISE") {return true; } return false; } 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(); } } } |
CODE |
Exception: System.NullReferenceException: Object reference not set to an instance of an object. at Server.Items.JimsRuby.OnAugment(Mobile from, Object target) at Server.Engines.XmlSpawner2.XmlSockets.Augment(Mobile from, Object parent, XmlSockets sock, Int32 socketnum, IXmlSocketAugmentation a) at Server.Engines.XmlSpawner2.AddAugmentationToSocket.OnTarget(Mobile from, Object targeted) at Server.Targeting.Target.Invoke(Mobile from, Object targeted) at Server.Network.PacketHandlers.TargetResponse(NetState state, PacketReader pvSrc) at Server.Network.MessagePump.HandleReceive(NetState ns) at Server.Network.MessagePump.Slice() at Server.Core.Main(String[] args) |