[RunUO 2.0] Colored Item Name Properties Credits: Lord Graywolf & Vorspire were instrumental in helping me get this working. With out there extremely generous help I would never have been able to make this. So THANKS!!! You guys are awesome!!!! Cervontose’s http://www.runuo.com/forums/custom-script-releases/101383-runuo-2-0-random-loot-resources.html - Thanks for your hard work! These scripts are awesome! I used his code for the lootpack.cs part of the code to give random resource types. Lord_Greywofl’s http://www.runuo.com/forums/custom-script-releases/102756-spell-crafting.html – Thanks for this! I used a code out of here to do the props part. Vorspire’s http://www.runuo.com/forums/custom-...nded-localizer-propertylist-2-stringlist.html – Thanks for the help!!! Description: This is something I have wanted on my server for a long time!! And here it is! This system adds color names to items. So when magic items drop they will get color (green, blue, purple, orange) based upon their value. The value is determined by the number of magic props they have on them. In addition, the items will say what they are made of. It has to be like this in order to take care of the ~null name problem. Additionaly with Cervontoses system the items will also have a chance of having a random resrouce type. So instead of just getting Iron Longswords. You could get a Dull Copper Longsword or a Valorite Longsword. Example: Iron Longsword Dull Copper Breastplate Ash Wood Blackstaff Screenshot at very bottom. Note: anything that uses normal wood will not get the wood name displayed. Bows, clubs, and stuff like that will be called just “bow” or just “club” unless they get one of the rare resource wood types. Then their name will change to say, Ask Wood Club. Or what ever. Install: You will need to manually install this because everyone has a different base files. BaseWeapon.cs - in public override void AddNameProperty(ObjectPropertyList list) Make it look like this. Code: public override void AddNameProperty(ObjectPropertyList list) { [B]//Colored Item Name Mod Start //Getting Props code BaseWeapon wea = this as BaseWeapon; int props = 0; foreach( int i in Enum.GetValues(typeof( AosAttribute ) ) ) { if ( wea != null && wea.Attributes[ (AosAttribute)i ] > 0 ) ++props; } if ( wea != null ){ foreach( int i in Enum.GetValues(typeof( AosWeaponAttribute)) ) if ( wea.WeaponAttributes[ (AosWeaponAttribute)i ] > 0 ) ++props;} if ( wea != null ){ if(wea.Slayer != SlayerName.None) ++props; if (wea.Slayer2 != SlayerName.None) ++props; } if(this.SkillBonuses.Skill_1_Value > 0) ++props; if(this.SkillBonuses.Skill_2_Value > 0) ++props; if(this.SkillBonuses.Skill_3_Value > 0) ++props; if(this.SkillBonuses.Skill_4_Value > 0) ++props; if(this.SkillBonuses.Skill_5_Value > 0) ++props; //AddNamePropertiey Code string oreType = CraftResources.GetName( m_Resource ); if ( oreType.ToLower() == "none" || oreType.ToLower() == "normal" ) oreType = ""; // Props code display if( props == 0 ) // No color (Common) { list.Add(1053099, "{0}\t{1}", oreType, GetNameString()); } if( props >= 1 && props <= 2 ) // Green (Uncommon) { list.Add(1053099, "{0}\t{1}", oreType, GetNameString()); } if( props >= 3 && props <= 4 ) // Blue (Rare) { list.Add(1053099, "{0}\t{1}", oreType, GetNameString()); } if( props >= 5 && props <= 6 ) // Purple (Epic) { list.Add(1053099, "{0}\t{1}", oreType, GetNameString()); } if( props >= 7 && props <= 8 ) // Orange (Legendary) { list.Add(1053099, "{0}\t{1}", oreType, GetNameString()); } if( props >= 9 ) // Golden (Artifact) { list.Add(1053099, "{0}\t{1}", oreType, GetNameString()); } //Colored Item Name Mod End[/B] if (!String.IsNullOrEmpty(m_EngravedText)) list.Add(1062613, m_EngravedText); } BaseArmor.cs - in public override void AddNameProperty( ObjectPropertyList list ) make it look like this. Code: public override void AddNameProperty( ObjectPropertyList list ) { [B]//Colored Item Name Mod Start BaseArmor arm = this; //AddNamePropertiey Code string oreType = CraftResources.GetName( m_Resource ); if ( oreType.ToLower() == "none" || oreType.ToLower() == "normal" ) oreType = null; if ( m_Quality == ArmorQuality.Exceptional ) { if ( oreType != null ) list.Add( 1053100, "{0}\t{1}", oreType, GetNameString() ); // exceptional ~1_oretype~ ~2_armortype~ else list.Add( 1050040, GetNameString() ); // exceptional ~1_ITEMNAME~ } else { int props = 0; foreach( int i in Enum.GetValues(typeof( AosAttribute ) ) ) { if ( arm != null && arm.Attributes[ (AosAttribute)i ] > 0 ) ++props; } if ( arm != null ) foreach( int i in Enum.GetValues(typeof( AosArmorAttribute ) ) ) {if ( arm.ArmorAttributes[ (AosArmorAttribute)i ] > 0 ) ++props;} if(this.SkillBonuses.Skill_1_Value > 0) ++props; if(this.SkillBonuses.Skill_2_Value > 0) ++props; if(this.SkillBonuses.Skill_3_Value > 0) ++props; if(this.SkillBonuses.Skill_4_Value > 0) ++props; if(this.SkillBonuses.Skill_5_Value > 0) ++props; // Props code display if( props == 0 ) // No color (Common) { list.Add(1053099, "{0}\t{1}", oreType, GetNameString()); } if( props >= 1 && props <= 2 ) // Green (Uncommon) { list.Add(1053099, "{0}\t{1}", oreType, GetNameString()); } if( props >= 3 && props <= 4 ) // Blue (Rare) { list.Add(1053099, "{0}\t{1}", oreType, GetNameString()); } if( props >= 5 && props <= 6 ) // Purple (Epic) { list.Add(1053099, "{0}\t{1}", oreType, GetNameString()); } if( props >= 7 && props <= 8 ) // Orange (Legendary) { list.Add(1053099, "{0}\t{1}", oreType, GetNameString()); } if( props >= 9 ) // Golden (Artifact) { list.Add(1053099, "{0}\t{1}", oreType, GetNameString()); } } //Colored Item Name Mod End[/B] } BaseClothing.cs - in public override void AddNameProperty( ObjectPropertyList list ) make it look like this Code: public override void AddNameProperty( ObjectPropertyList list ) { [B]//Colored Item Name Mod Start //Getting Props code BaseClothing clo = this; int props = 0; foreach( int i in Enum.GetValues(typeof( AosAttribute ) ) ) { if ( clo != null && clo.Attributes[ (AosAttribute)i ] > 0 ) ++props; } if ( clo != null ){ foreach( int i in Enum.GetValues(typeof( AosArmorAttribute ) ) ) if ( clo.ClothingAttributes[ (AosArmorAttribute)i ] > 0 ) ++props;} if(this.SkillBonuses.Skill_1_Value > 0) ++props; if(this.SkillBonuses.Skill_2_Value > 0) ++props; if(this.SkillBonuses.Skill_3_Value > 0) ++props; if(this.SkillBonuses.Skill_4_Value > 0) ++props; if(this.SkillBonuses.Skill_5_Value > 0) ++props; //AddNamePropertiey Code string oreType = CraftResources.GetName( m_Resource ); if ( oreType.ToLower() == "none" || oreType.ToLower() == "normal" ) oreType = ""; // Props code display if( props == 0 ) // No color (Common) { list.Add(1053099, "{0}\t{1}", oreType, GetNameString()); } if( props >= 1 && props <= 2 ) // Green (Uncommon) { list.Add(1053099, "{0}\t{1}", oreType, GetNameString()); } if( props >= 3 && props <= 4 ) // Blue (Rare) { list.Add(1053099, "{0}\t{1}", oreType, GetNameString()); } if( props >= 5 && props <= 6 ) // Purple (Epic) { list.Add(1053099, "{0}\t{1}", oreType, GetNameString()); } if( props >= 7 && props <= 8 ) // Orange (Legendary) { list.Add(1053099, "{0}\t{1}", oreType, GetNameString()); } if( props >= 9 ) // Golden (Artifact) { list.Add(1053099, "{0}\t{1}", oreType, GetNameString()); } //Colored Item Name Mod End[/B] } BaseJewel.cs - Add this WHOLE thing in there. BaseJewel.cs does not have a GetNameString or a AddNameProperty in it. So you have to add it. Put it in between public override void GetProperties( ObjectPropertyList list ) & public override void Serialize( GenericWriter writer ) Code: list.Add( 1113694, prop.ToString() ); // Energy Resonance ~1_val~% if ( (prop = m_SAAbsorptionAttributes.ResonanceKinetic) != 0 ) list.Add( 1113695, prop.ToString() ); // Kinetic Resonance ~1_val~% #endregion base.AddResistanceProperties( list ); // mod to display attachment properties Server.Engines.XmlSpawner2.XmlAttach.AddAttachmentProperties(this, list); if ( m_HitPoints >= 0 && m_MaxHitPoints > 0 ) list.Add( 1060639, "{0}\t{1}", m_HitPoints, m_MaxHitPoints ); // durability ~1_val~ / ~2_val~ #region Sets if ( IsSetItem && !m_SetEquipped ) { list.Add( 1072378 ); //
Only when full set is present: SetHelper.GetSetProperties( list, this ); } #endregion } [B]//Colored Item Name Mod Start private string GetNameString( ) { string name = this.Name; if (name == null) name = String.Format("#{0}", LabelNumber); return name; } public override void AddNameProperty(ObjectPropertyList list) { //Getting Props code BaseJewel jew = this; int props = 0; foreach( int i in Enum.GetValues(typeof( AosAttribute ) ) ) { if ( jew != null && jew.Attributes[ (AosAttribute)i ] > 0 ) ++props; } if ( jew != null ){ foreach( int i in Enum.GetValues(typeof( AosElementAttribute)) ) if ( jew.Resistances[ (AosElementAttribute)i ] > 0 ) ++props;} if(this.SkillBonuses.Skill_1_Value > 0) ++props; if(this.SkillBonuses.Skill_2_Value > 0) ++props; if(this.SkillBonuses.Skill_3_Value > 0) ++props; if(this.SkillBonuses.Skill_4_Value > 0) ++props; if(this.SkillBonuses.Skill_5_Value > 0) ++props; //AddNamePropertiey Code string oreType = CraftResources.GetName( m_Resource ); if ( oreType.ToLower() == "none" || oreType.ToLower() == "normal" ) oreType = ""; // Props code display if( props == 0 ) // No color (Common) { list.Add(1053099, "{0}\t{1}", oreType, GetNameString()); } if( props >= 1 && props <= 2 ) // Green (Uncommon) { list.Add(1053099, "{0}\t{1}", oreType, GetNameString()); } if( props >= 3 && props <= 4 ) // Blue (Rare) { list.Add(1053099, "{0}\t{1}", oreType, GetNameString()); } if( props >= 5 && props <= 6 ) // Purple (Epic) { list.Add(1053099, "{0}\t{1}", oreType, GetNameString()); } if( props >= 7 && props <= 8 ) // Orange (Legendary) { list.Add(1053099, "{0}\t{1}", oreType, GetNameString()); } if( props >= 9 ) // Golden (Artifact) { list.Add(1053099, "{0}\t{1}", oreType, GetNameString()); } } //Colored Item Name Mod End[/B] public override void Serialize( GenericWriter writer ) { base.Serialize( writer ); #region SA // Bumped to 7 writer.Write( (int) 7 ); // version m_SAAbsorptionAttributes.Serialize( writer ); #endregion writer.WriteEncodedInt( (int) m_MaxHitPoints ); writer.WriteEncodedInt( (int) m_HitPoints ); writer.Write( (Mobile)m_BlessedBy ); // Personal Bless Deed #region Mondain's Legacy Sets version 4 writer.Write( (bool) m_LastEquipped ); writer.Write( (bool) m_SetEquipped ); BaseRanged.cs - add the following code that is bolded. Code: public BaseRanged( int itemID ) : base( itemID ) { [B] //Colored Item Name Mod Start Resource = CraftResource.RegularWood; //Colored Item Name Mod Start[/B] } In LootPack.cs - Add the following code that is BOLDED to - public Item Mutate( Mobile from, int luckChance, Item item ) You will need to check and make sure that the resources listed are the resources you have on your server. I think you can easily find what resources you have by looking in Log.cs, Ore.cs, Leathers.cs Code: int props = 1 + bonusProps; // Make sure we're not spawning items with 6 properties. if ( props > m_MaxProps ) props = m_MaxProps; if ( item is BaseWeapon ) BaseRunicTool.ApplyAttributesTo( (BaseWeapon)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity ); else if ( item is BaseArmor ) BaseRunicTool.ApplyAttributesTo( (BaseArmor)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity ); else if ( item is BaseJewel ) BaseRunicTool.ApplyAttributesTo( (BaseJewel)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity ); else if ( item is BaseHat ) BaseRunicTool.ApplyAttributesTo( (BaseHat)item, false, luckChance, props, m_MinIntensity, m_MaxIntensity ); [B] //material change Mod Start #region Items Resource/Exceptional Mutate if ( item is BaseStaff || item is BaseRanged || item is Club ) // Check to see if item is made of wood - Staffs, Bows, and Club. { BaseWeapon woodweapon = (BaseWeapon)item; // Taking the created item, setting it as woodweapon itemtype to add modifiers. int ww_chancewheel = Utility.Random( 1000 ); // Random number for chance of woods to be mutated if ( ww_chancewheel < 10 ) //If the ww_chance number is generated as less then 12, continue with code in brackets. { woodweapon.Resource = CraftResource.Frostwood; // Taking created item that was type woodweapon and setting the resource to Woodtype }else if ( ww_chancewheel < 30 ) { woodweapon.Resource = CraftResource.Bloodwood; }else if ( ww_chancewheel < 70 ) { woodweapon.Resource = CraftResource.Heartwood; }else if ( ww_chancewheel < 80 ) { woodweapon.Resource = CraftResource.YewWood; }else if ( ww_chancewheel < 100 ) { woodweapon.Resource = CraftResource.AshWood; }else if ( ww_chancewheel < 140 ) { woodweapon.Resource = CraftResource.OakWood; }else // If the random number does not meet any of the above, it does this. { woodweapon.Resource = CraftResource.RegularWood; } } else if ( item is BaseWeapon ) { BaseWeapon metalweapon = (BaseWeapon)item; int mw_chancewheel = Utility.Random( 6000 ); //if ( mw_chancewheel < 10 ) //{ metalweapon.Resource = CraftResource.Moonstone; //}else if ( mw_chancewheel < 30 ) //{ metalweapon.Resource = CraftResource.Jade; //}else if ( mw_chancewheel < 70 ) //{ metalweapon.Resource = CraftResource.Obsidian; //}else if ( mw_chancewheel < 120 ) //{ metalweapon.Resource = CraftResource.Mythril; //}else if ( mw_chancewheel < 180 ) //{ metalweapon.Resource = CraftResource.Platinum; //}else if ( mw_chancewheel < 250 ) //{ metalweapon.Resource = CraftResource.Silver; //}else if ( mw_chancewheel < 330 ) if ( mw_chancewheel < 100 ) // deleat this line (330 for valorite) { metalweapon.Resource = CraftResource.Valorite; }else if ( mw_chancewheel < 200 ) { metalweapon.Resource = CraftResource.Verite; }else if ( mw_chancewheel < 300 ) { metalweapon.Resource = CraftResource.Agapite; }else if ( mw_chancewheel < 400 ) { metalweapon.Resource = CraftResource.Gold; }else if ( mw_chancewheel < 500 ) { metalweapon.Resource = CraftResource.Bronze; }else if ( mw_chancewheel < 600 ) { metalweapon.Resource = CraftResource.Copper; }else if ( mw_chancewheel < 700 ) { metalweapon.Resource = CraftResource.ShadowIron; }else if ( mw_chancewheel < 800 ) { metalweapon.Resource = CraftResource.DullCopper; }else { metalweapon.Resource = CraftResource.Iron; } } if ( item is BaseJewel ) { BaseJewel jeweltype = (BaseJewel)item; if ( jeweltype.Resource == CraftResource.Iron ) { int mb_chancewheel = Utility.Random( 5000 ); if ( mb_chancewheel < 100 ) // deleat this line (330 for valorite) { jeweltype.Resource = CraftResource.Valorite; }else if ( mb_chancewheel < 200 ) { jeweltype.Resource = CraftResource.Verite; }else if ( mb_chancewheel < 300 ) { jeweltype.Resource = CraftResource.Agapite; }else if ( mb_chancewheel < 400 ) { jeweltype.Resource = CraftResource.Gold; }else if ( mb_chancewheel < 500 ) { jeweltype.Resource = CraftResource.Bronze; }else if ( mb_chancewheel < 600 ) { jeweltype.Resource = CraftResource.Copper; }else if ( mb_chancewheel < 700 ) { jeweltype.Resource = CraftResource.ShadowIron; }else if ( mb_chancewheel < 800 ) { jeweltype.Resource = CraftResource.DullCopper; }else { jeweltype.Resource = CraftResource.Iron; } } } if ( item is BaseArmor ) { BaseArmor armortype = (BaseArmor)item; if ( armortype.Resource == CraftResource.Iron ) { int ma_chancewheel = Utility.Random( 5000 ); //if ( ma_chancewheel < 10 ) //{ armortype.Resource = CraftResource.Moonstone; //}else if ( ma_chancewheel < 30 ) //{ armortype.Resource = CraftResource.Jade; //}else if ( ma_chancewheel < 70 ) //{ armortype.Resource = CraftResource.Obsidian; //}else if ( ma_chancewheel < 120 ) //{ armortype.Resource = CraftResource.Mythril; //}else if ( ma_chancewheel < 180 ) //{ armortype.Resource = CraftResource.Platinum; //}else if ( ma_chancewheel < 250 ) //{ armortype.Resource = CraftResource.Silver; //}else if ( ma_chancewheel < 330 ) if ( ma_chancewheel < 100 ) // deleat this line (330 for valorite) { armortype.Resource = CraftResource.Valorite; }else if ( ma_chancewheel < 200 ) { armortype.Resource = CraftResource.Verite; }else if ( ma_chancewheel < 300 ) { armortype.Resource = CraftResource.Agapite; }else if ( ma_chancewheel < 400 ) { armortype.Resource = CraftResource.Gold; }else if ( ma_chancewheel < 500 ) { armortype.Resource = CraftResource.Bronze; }else if ( ma_chancewheel < 600 ) { armortype.Resource = CraftResource.Copper; }else if ( ma_chancewheel < 700 ) { armortype.Resource = CraftResource.ShadowIron; }else if ( ma_chancewheel < 800 ) { armortype.Resource = CraftResource.DullCopper; }else { armortype.Resource = CraftResource.Iron; } } if ( armortype.Resource == CraftResource.RegularLeather ) { int la_chancewheel = Utility.Random( 1000 ); if ( la_chancewheel < 10 ) { armortype.Resource = CraftResource.BarbedLeather; }else if ( la_chancewheel < 30 ) { armortype.Resource = CraftResource.HornedLeather; }else if ( la_chancewheel < 70 ) { armortype.Resource = CraftResource.SpinedLeather; }else { armortype.Resource = CraftResource.RegularLeather; } } if ( armortype.Resource == CraftResource.RegularWood ) { int wa_chancewheel = Utility.Random( 1000 ); //Cherry,Cedar,Pine,Heartwood,Yew,Ash,Log if ( wa_chancewheel < 10 ) { armortype.Resource = CraftResource.Frostwood; }else if ( wa_chancewheel < 30) { armortype.Resource = CraftResource.Bloodwood; }else if ( wa_chancewheel < 70 ) { armortype.Resource = CraftResource.Heartwood; }else if ( wa_chancewheel < 80 ) { armortype.Resource = CraftResource.YewWood; }else if ( wa_chancewheel < 100 ) { armortype.Resource = CraftResource.AshWood; }else if ( wa_chancewheel < 140 ) { armortype.Resource = CraftResource.OakWood; }else { armortype.Resource = CraftResource.RegularWood; } } } #endregion //material change Mod end[/B] } else // not aos { if ( item is BaseWeapon ) { BaseWeapon weapon = (BaseWeapon)item; if ( 80 > Utility.Random( 100 ) ) weapon.AccuracyLevel = (WeaponAccuracyLevel)GetRandomOldBonus(); if ( 60 > Utility.Random( 100 ) ) weapon.DamageLevel = (WeaponDamageLevel)GetRandomOldBonus(); if ( 40 > Utility.Random( 100 ) ) weapon.DurabilityLevel = (WeaponDurabilityLevel)GetRandomOldBonus(); Any Wooden Shields, clubs, or other items that are made of wood scripts (NOT bows or cross bows, that is done is baseRanged.cs). Add the code that is bolded to your [Constructable] Code: [Constructable] public WoodenShield() : base( 0x1B7A ) { Weight = 5.0; [B] //Colored Item Name Mod Start Resource = CraftResource.RegularWood; //Colored Item Name Mod Start[/B] } Extended Localizer - PropertyList-2-StringList : I am not totally sure you need this. But it seem to work better when I have it. 1) Donwload these scripts from [RUO 2.0] Extended Localizer - PropertyList-2-StringList - RunUO - Ultima Online Emulation 2) Setup - Add thoes scrips to your customs folder. 3) Put the Ultima.dll from UltimaSDK in your RunUO root. Then add it to Data\Assemblies.cfg This is what mine looks like Code: System.dll System.Web.dll System.Xml.dll System.Data.dll System.Drawing.dll System.Windows.Forms.dll [B]Ultima.dll[/B] 4) Then you will probably need to open this UOSDK Path Fix.cs and change the path so it points to your UO Client directory. Extended Localizer - PropertyList-2-StringList\UOSDK Path Fix.cs I think that’s it! --------------------------------------------------------------------------------- 04/28/2011 - Update for ML Weapon & Armor Sets -In order to get the ML weapon & armor set properties to be added you will need to add the following code to each base. Code: NOTE: you will need to change arm to what ever it need to be based upon the Base file. This is the armor change. foreach( int i in Enum.GetValues(typeof( AosAttribute ) ) ) { if ( arm != null && arm.Attributes[ (AosAttribute)i ] > 0 ) ++props; } to foreach( int i in Enum.GetValues(typeof( AosAttribute ) ) ) { if ( arm != null && arm.Attributes[ (AosAttribute)i ] > 0 ) ++props; if ( arm != null && arm.SetAttributes[ (AosAttribute)i ] > 0 ) ++props; } NOTE: Not all base files might have thes. Look at your item to see if it needs these. if(this.SetSelfRepair > 0) ++props; if(this.SetSkillBonuses.Skill_1_Value > 0) ++props; if(this.SetSkillBonuses.Skill_2_Value > 0) ++props; if(this.SetSkillBonuses.Skill_3_Value > 0) ++props; if(this.SetSkillBonuses.Skill_4_Value > 0) ++props; if(this.SetSkillBonuses.Skill_5_Value > 0) ++props;06/19/2010 - Changes - Bug fix: Removed a # from BaseArmor.cs that made most crafted armor & shields get a messed up name. 06/09/2010 - Changes - Did a little code cleaning up - Changed colors to be WOW colors. - Added "Golden" color