Overrrding Item Ranks.

as12.postimg.org_b8wo5y65p_Item_Ranks.jpg

By using the code below (Nockar Colored Name) edited to make it list under the name rather than change the name to a string colored version of the name.

Code:
public override void AddNameProperty(ObjectPropertyList list)

        {//Colored Item Name Mod Start
            BaseArmor arm = this;

            //AddNamePropertiey Code
            string oreType = CraftResources.GetName(m_Resource);

            if (oreType.ToLower() == "none" || oreType.ToLower() == "normal" || oreType != "0") oreType = "";
                oreType = null;

            if (this.m_Quality == ArmorQuality.Exceptional)
            {
                if (oreType != null)
                    list.Add(1053100, "#{0}\t{1}", oreType, this.GetNameString()); // exceptional ~1_oretype~ ~2_armortype~
                else
                    list.Add(1050040, this.GetNameString()); // exceptional ~1_ITEMNAME~
            }
            else
            {
                if (oreType != null)
                    list.Add(1053099, "#{0}\t{1}", oreType, this.GetNameString()); // ~1_oretype~ ~2_armortype~
                else if (this.Name == null)
                    list.Add(this.LabelNumber);
                else
                    list.Add(this.Name);
            }

                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)
                {
                    ItemValue = ItemValue.Common;
                }
                if (props >= 1 && props <= 2)     // Green (Uncommon)
                {
                    ItemValue = ItemValue.Uncommon;
                }
                if (props >= 3 && props <= 4)     // Blue (Rare)
                {
                    ItemValue = ItemValue.Rare;
                }
                if (props >= 5 && props <= 6)     // Purple (Epic)
                {
                    ItemValue = ItemValue.Epic;
                }
                if (props >= 7 && props <= 8)     // Orange (Legendary)
                {
                    ItemValue = ItemValue.Legendary;
                }

This works quite well it will change the rank listed under the name depending on the props of a item.
I am trying to override it tho for example Hat Of Magi should always be [Artifact].

Ive tried to use the same method as LableNumber but i get the following error.

Ovveride Code??
Code:
public override int ItemValue
        {
            get
            {
                return ItemValue.Artifact;
            }
        }

Error?
Code:
Errors:
+ Items/Armor/Artifacts/ArmorOfFortune.cs:
    CS1715: Line 37: 'Server.Items.ArmorOfFortune.ItemValue': type must be 'Serv
er.ItemValue' to match overridden member 'Server.Item.ItemValue'
Scripts: One or more scripts failed to compile or no script files were found.
- Press return to exit, or R to try again.

Inside the core they are both using

Code:
public virtual void AddItemValueProperty(ObjectPropertyList list) //ItemValue
public virtual void AddNameProperty(ObjectPropertyList list)//LabelNumber
..

If anyone has some insight on where i am going wrong please help me out...

Thanks
Crymi

P.S I am using a modified Item.cs core file in order to display the "rank" below the name..
 
is there a public virtual int ItemValue(); in the core?

also just a tip about all those if statements,
you could do:
Code:
if (props == 0)
common
else if (props <= 2)
uncommon
else if (props <= 4)
rare
else if (props <= 6)
epic
else if (props <= 8)
legendary

in the state where it is now, lets say you have an ucommon object.
it passes in the first if, it's not equal to 0, so it stops that there. Then it goes to the next if, and it's valid.
BUT it will continue to check rare, epic and legendary each time, which is not optimised.
 
the core uses
Code:
public virtual bool OverrideItemValue { get { return false; } }
        private ItemValue m_ItemValue;

        [CommandProperty(AccessLevel.GameMaster)]
        public ItemValue ItemValue
        {
            get
            {
                return m_ItemValue;
            }
            set
            {
                if (m_ItemValue != value)
                {
                    m_ItemValue = value;
                    InvalidateProperties();
                }
            }
        }

This allows to me edit the ItemValue ingame and also add it to all items not just weapons..

I'm trying to make it so i can have certain items always flagged as say donation items no matter how many props it has listed...
 
This is the AddNameProperties from the core..

Code:
public virtual void AddNameProperties(ObjectPropertyList list)
		{
			AddNameProperty(list);

            #region Item Value
            if (ItemValue != ItemValue.None)
                AddItemValueProperty(list);
            #endregion

			if (IsSecure)
			{
				AddSecureProperty(list);
			}
			else if (IsLockedDown)
			{
				AddLockedDownProperty(list);
			}

			Mobile blessedFor = BlessedFor;

			if (blessedFor != null && !blessedFor.Deleted)
			{
				AddBlessedForProperty(list, blessedFor);
			}

			if (DisplayLootType)
			{
				AddLootTypeProperty(list);
			}

			if (DisplayWeight)
			{
				AddWeightProperty(list);
			}

			if (QuestItem)
			{
				AddQuestItemProperty(list);
			}

			AppendChildNameProperties(list);
		}
 
Sorry, I meant the entire method from the first post, your custom one. Was the one up in the first post the whole thing? I wasn't sure because it was missing the last brace.
 
Most of this is based off the system Nockar released and it does work i just added a different section for it to color.. I think i am missing something in the core to be able to override it them item script tho..

Code:
public override void AddNameProperty(ObjectPropertyList list)
        {
  //Colored Item Name Mod Start
            BaseArmor arm = this;

            //AddNamePropertiey Code
            string oreType = CraftResources.GetName(m_Resource);

            if (oreType.ToLower() == "none" || oreType.ToLower() == "normal" || oreType != "0") oreType = "";
            oreType = null;

            if (this.m_Quality == ArmorQuality.Exceptional)
            {
                if (oreType != null)
                    list.Add(1053100, "#{0}\t{1}", oreType, this.GetNameString()); // exceptional ~1_oretype~ ~2_armortype~
                else
                    list.Add(1050040, this.GetNameString()); // exceptional ~1_ITEMNAME~
            }
            else
            {
                if (oreType != null)
                    list.Add(1053099, "#{0}\t{1}", oreType, this.GetNameString()); // ~1_oretype~ ~2_armortype~
                else if (this.Name == null)
                    list.Add(this.LabelNumber);
                else
                    list.Add(this.Name);
            }

            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)
            {
                ItemValue = ItemValue.None;
            }
            if (props >= 1 && props <= 2) 	// Green (Uncommon)
            {
                ItemValue = ItemValue.Uncommon;
            }
            if (props >= 3 && props <= 4) 	// Blue (Rare)
            {
                ItemValue = ItemValue.Rare;
            }
            if (props >= 5 && props <= 6) 	// Purple (Epic)
            {
                ItemValue = ItemValue.Epic;
            }
            if (props >= 7 && props <= 8) 	// Orange (Legendary)
            {
                ItemValue = ItemValue.Legendary;
            }
            if (props >= 9) 		// Golden (Artifact)
            {
                ItemValue = ItemValue.Artifact;
            }
        }
         

       
     

        public override bool AllowEquipedCast(Mobile from)
 
Just a wild guess here:

Code:
public override void AddNameProperty(ObjectPropertyList list)
  {
  //Colored Item Name Mod Start
  BaseArmor arm = this;
  //AddNamePropertiey Code
  string oreType = CraftResources.GetName(m_Resource);
  if (oreType.ToLower() == "none" || oreType.ToLower() == "normal" || oreType != "0") oreType = "";
  oreType = null;
  if (this.m_Quality == ArmorQuality.Exceptional)
  {
  if (oreType != null)
  list.Add(1053100, "#{0}\t{1}", oreType, this.GetNameString()); // exceptional ~1_oretype~ ~2_armortype~
  else
  list.Add(1050040, this.GetNameString()); // exceptional ~1_ITEMNAME~
  }
  else
  {
  if (oreType != null)
  list.Add(1053099, "#{0}\t{1}", oreType, this.GetNameString()); // ~1_oretype~ ~2_armortype~
  else if (this.Name == null)
  list.Add(this.LabelNumber);
  else
  list.Add(this.Name);
  }
  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;
       // In here add a line checking if the item is an Artifact
       if (this.IsArtifact) // This is pseudo-code, I am not looking at the actual code here...
       {
         // Here either "return;" or label it as [Artifact] if you need to.
       }
  // Props code display
  if (props == 0)  //  No color (Common)
  {
  ItemValue = ItemValue.None;
  }
  if (props >= 1 && props <= 2)  // Green (Uncommon)
  {
  ItemValue = ItemValue.Uncommon;
  }
  if (props >= 3 && props <= 4)  // Blue (Rare)
  {
  ItemValue = ItemValue.Rare;
  }
  if (props >= 5 && props <= 6)  // Purple (Epic)
  {
  ItemValue = ItemValue.Epic;
  }
  if (props >= 7 && props <= 8)  // Orange (Legendary)
  {
  ItemValue = ItemValue.Legendary;
  }
  if (props >= 9)  // Golden (Artifact)
  {
  ItemValue = ItemValue.Artifact;
  }
  }
 
I'm not at my computer atm so not able to look..

However if this was to work it would only limit me to artifacts.

I hope to use this system for all quest items to have tag all donations items etc.

However using the ranks based on props as well will override the items rank if it's a quest or donation etc.
 
What I am saying is use If/Then/Else logic to decide if the item is Artifact/Quest/Donation, then if it's none of those, you can use the props method for rarity. The important thing is that if it finds one of the A/Q/ or D to not continue to add the props part.
 
I've tried putting in a few checks around where it starts to count the props of the item and it either doesn't make a difference or it stops the count on all items.. I can't seem to figure it out.. I guess it another script ill have to put to the back and work on again when i learn how to code better :(
 
No, I'm sorry. I guess I am just not understanding what you are trying to see. If you have more pictures or descriptions of what you would like to see or how you want it to look, let me know.
 
Ok let me try to explain better..

The aim of this is to introduce ranks to items. Depending on the amount of props a item has depends on the rank it is given. For example

as8.postimg.org_c6knbwtpd_Gloves.jpg_e51a9d96d73ead8cd02bbec017d12380.jpg
As you can see the gloves have changed from Uncommon to Rare when more attributes have been added.
Code:
public override void AddNameProperty(ObjectPropertyList list)
        {
  //Colored Item Name Mod Start
            BaseArmor arm = this;

            //AddNamePropertiey Code
            string oreType = CraftResources.GetName(m_Resource);

            if (oreType.ToLower() == "none" || oreType.ToLower() == "normal" || oreType != "0") oreType = "";
            oreType = null;

            if (this.m_Quality == ArmorQuality.Exceptional)
            {
                if (oreType != null)
                    list.Add(1053100, "#{0}\t{1}", oreType, this.GetNameString()); // exceptional ~1_oretype~ ~2_armortype~
                else
                    list.Add(1050040, this.GetNameString()); // exceptional ~1_ITEMNAME~
            }
            else
            {
                if (oreType != null)
                    list.Add(1053099, "#{0}\t{1}", oreType, this.GetNameString()); // ~1_oretype~ ~2_armortype~
                else if (this.Name == null)
                    list.Add(this.LabelNumber);
                else
                    list.Add(this.Name);
            }

            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)
            {
                ItemValue = ItemValue.None;
            }
            if (props >= 1 && props <= 2) 	// Green (Uncommon)
            {
                ItemValue = ItemValue.Uncommon;
            }
            if (props >= 3 && props <= 4) 	// Blue (Rare)
            {
                ItemValue = ItemValue.Rare;
            }
            if (props >= 5 && props <= 7) 	// Purple (Epic)
            {
                ItemValue = ItemValue.Epic;
            }
            if (props >= 8) 	// Orange (Legendary)
            {
                ItemValue = ItemValue.Legendary;
            }
        }
So using this above code any item will take on the name depending on how many props it has..

However certain items that come from say donations / quests / events should have there own tag

for example

as12.postimg.org_b8wo5y65p_Item_Ranks.jpg

So Even if the Hat of Magi had 1, 5, or 10 attributes it will always stay Donation in this case..

Hope this makes better sense..
 
Check your if statements as i suggested in my previous post.
if you put 100 if statements, 100 will be made, even if the first is valid,
if you use 1 if and 99 else if, it will stop when it gets valid somewhere. (aka not ending with the last one.)

Don't forget to put something like

if (item.isDonation)
ItemValue = ItemValue.Donation;
else if (item.ArtifactRarity > 0)
ItemValue = ItemValue.Legendary;
else if (.....) //add here ALL the things with itemvalue.something under else if statements
 
PoOka i understand whats your saying however. In Hat of Magi there will be this line of code.

Code:
ItemValue = ItemValue.Artifact;
This allows me to add a item Value To Anything not just armors weapons etc.

However in BaseArmor/BaseWeapon etc that has the ranking part depending on props.

Im looking for a way to override the ranking part in basearmor with a section of code in HatofMagi.cs

I hope this makes sense i have trouble explaining things
 
private ItemValue m_ItemValue;

[CommandProperty( AccessLevel.GameMaster )]
public virtual ItemValue ItemValue{ get{ return m_ItemValue; } set{m_ItemValue = value}}
 
Code:
if (!(this.ItemValue == ItemValue.Artifact || this.ItemValue == ItemValue.Quest || this.ItemValue == ItemValue.Donation))
{
	// here do the props stuff...
}
 
Back