Here is a mod to make Vendors calculate the rarity of the items to sell for better pricing Tristian came to me and asked
GenericSell.cs
Code:
using System;
using System.Collections.Generic;
using Server.Items;
using ItemNameHue;

namespace Server.Mobiles
{
    public class GenericSellInfo : IShopSellInfo
    {
        private readonly Dictionary<Type, int> m_Table = new Dictionary<Type, int>();
        private Type[] m_Types;
        public GenericSellInfo()
        {
        }

        public Type[] Types
        {
            get
            {
                if (this.m_Types == null)
                {
                    this.m_Types = new Type[this.m_Table.Keys.Count];
                    this.m_Table.Keys.CopyTo(this.m_Types, 0);
                }

                return this.m_Types;
            }
        }
        public void Add(Type type, int price)
        {
            this.m_Table[type] = price;
            this.m_Types = null;
        }

        public int GetSellPriceFor(Item item)
        {
            int price = 0;
            this.m_Table.TryGetValue(item.GetType(), out price);

            if (item is BaseArmor)
            {
                BaseArmor armor = (BaseArmor)item;

                if (armor.Quality == ArmorQuality.Low)
                    price = (int)(price * 0.60);
                else if (armor.Quality == ArmorQuality.Exceptional)
                    price = (int)(price * 1.25);
				//Chance the Price multiplier here//
				price += 7 * ArmorItemProps.CheckArmor(armor);
				
                price += 100 * (int)armor.Durability;

                price += 100 * (int)armor.ProtectionLevel;

                if (price < 1)
                    price = 1;
            }
            else if (item is BaseWeapon)
            {
                BaseWeapon weapon = (BaseWeapon)item;

                if (weapon.Quality == WeaponQuality.Low)
                    price = (int)(price * 0.60);
                else if (weapon.Quality == WeaponQuality.Exceptional)
                    price = (int)(price * 1.25);

				//Chance the Price multiplier here//
				price += 7 * WeaponItemProps.CheckWeapon(weapon);
				
                price += 100 * (int)weapon.DurabilityLevel;

                price += 100 * (int)weapon.DamageLevel;

                if (price < 1)
                    price = 1;
            }
			//Jewelry and Clothing Mod//
			else if (item is BaseJewel)
			{
			  BaseJewel jewel = (BaseJewel)item;
			 
				//Chance the Price multiplier here//
				price += 7 * JewelItemProps.CheckJewel(jewel);
				
				 if (price < 1)
                    price = 1;
			
			}
			else if (item is BaseClothing)
			{
				BaseClothing clothing = (BaseClothing)item;
				
				//Chance the Price multiplier here//
				price += 7 * ClothingItemProps.CheckClothing(clothing);
				
				 if (price < 1)
                    price = 1;
			}
            else if (item is BaseBeverage)
            {
                int price1 = price, price2 = price;

                if (item is Pitcher)
                {
                    price1 = 3;
                    price2 = 5;
                }
                else if (item is BeverageBottle)
                {
                    price1 = 3;
                    price2 = 3;
                }
                else if (item is Jug)
                {
                    price1 = 6;
                    price2 = 6;
                }

                BaseBeverage bev = (BaseBeverage)item;

                if (bev.IsEmpty || bev.Content == BeverageType.Milk)
                    price = price1;
                else
                    price = price2;
            }

            return price;
        }

        public int GetBuyPriceFor(Item item)
        {
            return (int)(1.90 * this.GetSellPriceFor(item));
        }

        public string GetNameFor(Item item)
        {
            if (item.Name != null)
                return item.Name;
            else
                return item.LabelNumber.ToString();
        }

        public bool IsSellable(Item item)
        {
            if (item.QuestItem)
                return false;

            //if ( item.Hue != 0 )
            //return false;

            return this.IsInList(item.GetType());
        }

        public bool IsResellable(Item item)
        {
            if (item.QuestItem)
                return false;

            //if ( item.Hue != 0 )
            //return false;

            return this.IsInList(item.GetType());
        }

        public bool IsInList(Type type)
        {
            return this.m_Table.ContainsKey(type);
        }
    }
}
 
Here is a mod to make Vendors calculate the rarity of the items to sell for better pricing Tristian came to me and asked
GenericSell.cs
Code:
using System;
using System.Collections.Generic;
using Server.Items;
using ItemNameHue;

namespace Server.Mobiles
{
    public class GenericSellInfo : IShopSellInfo
    {
        private readonly Dictionary<Type, int> m_Table = new Dictionary<Type, int>();
        private Type[] m_Types;
        public GenericSellInfo()
        {
        }

        public Type[] Types
        {
            get
            {
                if (this.m_Types == null)
                {
                    this.m_Types = new Type[this.m_Table.Keys.Count];
                    this.m_Table.Keys.CopyTo(this.m_Types, 0);
                }

                return this.m_Types;
            }
        }
        public void Add(Type type, int price)
        {
            this.m_Table[type] = price;
            this.m_Types = null;
        }

        public int GetSellPriceFor(Item item)
        {
            int price = 0;
            this.m_Table.TryGetValue(item.GetType(), out price);

            if (item is BaseArmor)
            {
                BaseArmor armor = (BaseArmor)item;

                if (armor.Quality == ArmorQuality.Low)
                    price = (int)(price * 0.60);
                else if (armor.Quality == ArmorQuality.Exceptional)
                    price = (int)(price * 1.25);
				//Chance the Price multiplier here//
				price += 7 * ArmorItemProps.CheckArmor(armor);
				
                price += 100 * (int)armor.Durability;

                price += 100 * (int)armor.ProtectionLevel;

                if (price < 1)
                    price = 1;
            }
            else if (item is BaseWeapon)
            {
                BaseWeapon weapon = (BaseWeapon)item;

                if (weapon.Quality == WeaponQuality.Low)
                    price = (int)(price * 0.60);
                else if (weapon.Quality == WeaponQuality.Exceptional)
                    price = (int)(price * 1.25);

				//Chance the Price multiplier here//
				price += 7 * WeaponItemProps.CheckWeapon(weapon);
				
                price += 100 * (int)weapon.DurabilityLevel;

                price += 100 * (int)weapon.DamageLevel;

                if (price < 1)
                    price = 1;
            }
			//Jewelry and Clothing Mod//
			else if (item is BaseJewel)
			{
			  BaseJewel jewel = (BaseJewel)item;
			
				//Chance the Price multiplier here//
				price += 7 * JewelItemProps.CheckJewel(jewel);
				
				 if (price < 1)
                    price = 1;
			
			}
			else if (item is BaseClothing)
			{
				BaseClothing clothing = (BaseClothing)item;
				
				//Chance the Price multiplier here//
				price += 7 * ClothingItemProps.CheckClothing(clothing);
				
				 if (price < 1)
                    price = 1;
			}
            else if (item is BaseBeverage)
            {
                int price1 = price, price2 = price;

                if (item is Pitcher)
                {
                    price1 = 3;
                    price2 = 5;
                }
                else if (item is BeverageBottle)
                {
                    price1 = 3;
                    price2 = 3;
                }
                else if (item is Jug)
                {
                    price1 = 6;
                    price2 = 6;
                }

                BaseBeverage bev = (BaseBeverage)item;

                if (bev.IsEmpty || bev.Content == BeverageType.Milk)
                    price = price1;
                else
                    price = price2;
            }

            return price;
        }

        public int GetBuyPriceFor(Item item)
        {
            return (int)(1.90 * this.GetSellPriceFor(item));
        }

        public string GetNameFor(Item item)
        {
            if (item.Name != null)
                return item.Name;
            else
                return item.LabelNumber.ToString();
        }

        public bool IsSellable(Item item)
        {
            if (item.QuestItem)
                return false;

            //if ( item.Hue != 0 )
            //return false;

            return this.IsInList(item.GetType());
        }

        public bool IsResellable(Item item)
        {
            if (item.QuestItem)
                return false;

            //if ( item.Hue != 0 )
            //return false;

            return this.IsInList(item.GetType());
        }

        public bool IsInList(Type type)
        {
            return this.m_Table.ContainsKey(type);
        }
    }
}

Thank you i never thought about this!
 
Has anyone ever figured out how to also display the total calculation derived from the piece of armor? I want to display the value of ' CheckArmor ' in the hover over list.add for all base weapons.
 
are you using my mod or no josh?
[doublepost=1480974606][/doublepost]upload_2016-12-5_16-40-18.png
upload_2016-12-5_16-40-31.pngupload_2016-12-5_16-47-49.pngupload_2016-12-5_16-49-20.png
Code:
	if (values >= 250)
					return String.Format("<BASEFONT COLOR=#FF8000>[Legendary {0}]",values)	;
				else if (values >= 175)
					return String.Format("<BASEFONT COLOR=#A335EE>[Epic {0}]",values);
				else if (values >= 75)
					return String.Format("<BASEFONT COLOR=#0070FF>[Rare {0}]", values);
				else if (values >= 25)
					return String.Format("<BASEFONT COLOR=#1EFF00>[Uncommon {0}]", values);

					return String.Format("<BASEFONT COLOR=#D6D6D6>[Common {0}]", values);

it replaces

Code:
if (values >= 300)
					return "<BASEFONT COLOR=#FF944D>";
				else if (values >= 200)
					return "<BASEFONT COLOR=#B48FFF>";
				else if (values >= 100)
					return "<BASEFONT COLOR=#8DBAE8>";
				else if (values >= 50)
					return "<BASEFONT COLOR=#A1E68A>";

					return "<BASEFONT COLOR=#D6D6D6>";
 
I'm not using your mod, but I can if that's the only wayway. Also I want to be able to get the total check armor on the mobile and display out on mouse over, that's just pm edit
 
hmmmm. i would have to sit down and think how i could get all the values to spit out. it shouldnt be to hard considering the way i did, you would have to use my mod for it to work the way i have it set up, but i will try to figure out how to calculate all the values and add them up.
[doublepost=1481133781][/doublepost]the way you would call it in player mobile would to be in the base.getproperties, i havent completely figured it out yet and really havent had time to yet, but i know the line of code would be like this but you would have to figure out how to call Item item then call BaseArmor BaseWeapon BaseJewelry and BaseClothing,
Code:
list.Add(1060658, "Totel Item Level : {0}",ArmorItemProps.CheckArmor(armor)+WeaponItemProps.CheckWeapon(weapon)+JewelItemProps.CheckJewel(jewel)+ClothingItemProps.CheckClothing(clothing));
 
Last edited:
Btw with your Mod I did notice something, it's not tacking on the resource Type in the name Also it doesn't tack in Exceptional. I used your base scripts as comparisons and i can't see anything i may have done wrong, is that working as intended?
 
need help.
JustUO Version 1.0, Build 2.0
Operating System: Microsoft Windows NT 6.1.7601 Service Pack 1
.NET Framework: 4.0.30319.1
Time: 2018/6/26 19:25:19
Mobiles: 12141
Items: 97010
Exception:
System.InvalidCastException: specifiedcastis not valid.
在 ItemNameHue.WeaponItemProps.CheckWeapon(BaseWeapon item)
在 Server.Items.BaseWeapon.GetProperties(ObjectPropertyList list)
在 Server.Item.get_PropertyList() c:\Users\Administrator\Desktop\JustUO-2\Server\Item.cs:linenumber 2081
在 Server.Item.InvalidateProperties() c:\Users\Administrator\Desktop\JustUO-2\Server\Item.cs:linenumber 2132
在 Server.Item.set_Map(Map value) c:\Users\Administrator\Desktop\JustUO-2\Server\Item.cs:linenumber 2359
在 Server.Item.AddItem(Item item) c:\Users\Administrator\Desktop\JustUO-2\Server\Item.cs:linenumber 3740
在 Server.Items.Container.DropItem(Item dropped) c:\Users\Administrator\Desktop\JustUO-2\Server\Items\Container.cs:linenumber 1721
在 Server.Commands.DonationSystem.AutoOrganizer.OnTick()
在 Server.Timer.Slice() c:\Users\Administrator\Desktop\JustUO-2\Server\Timer.cs:linenumber 401
在 Server.Core.Main(String[] args) c:\Users\Administrator\Desktop\JustUO-2\Server\Main.cs:linenumber 639
 

Attachments

  • WeaponItemProps.cs
    13.6 KB · Views: 15
  • BaseWeapon.cs
    135.9 KB · Views: 20
A sloppy update for anyone trying to use this now...

In WeaponItemsProps.cs, line 82, the enum has been changed from int to long. Update like so:

WeaponItemProps.cs:
foreach (long i in Enum.GetValues(typeof(AosWeaponAttribute)))

It should compile, but I had issues with the actual name being displayed. As of some time ago, items (weapons, armor, etc) are no longer named when created. The "name" property will be null, and the game renders a name based on the cliloc file. For some reason that process fails with the code, presented as-is. In each of the 4 files (BaseArmor, BaseWeapon, BaseJewelry, BaseClothing), I replaced this line...

Code:
list.Add(1053099, ItemNameHue.WeaponItemProps.RarityNameMod(this, ((m_Quality == WeaponQuality.Exceptional) ? "Exceptional " : "") + "{0}\t{1}"), resourceName, GetNameString());

with this bit:

Code:
            string itemnamehue = ItemNameHue.WeaponItemProps.GetWeaponItemValue(this);

            string name = Name;  // items no longer have names by default, they render the name defined in cliloc.<language>

            if (name == null)   // if item does have a name, it was specially named, so display only the name + color
                list.Add(1053099, "{0}\t{1}", itemnamehue + resourceName, GetNameString());
            else
                list.Add(1053099, "{0}\t{1}", itemnamehue, GetNameString());

You'll have to update this for each different type, and replace "WeaponItemProps" and "GetWeaponItemValue" with their corresponding functions.

Also note: I removed "Exceptional" from the name because I didn't like it.
 
here are my bases and my mods to the script for it.
This works perfectly for everything Except Armor. it does not work at all for BaseArmor.
I obviosuly compared the old version to the current version and its just commenting out the same info in all 4 Base files and adding the same line to all 4 Base files. Weapons, Jewelry, and Clothing all work 100% fine. Armor displays 0% of the information added and doesnt even attempt to display it.



Clothing Working 100% Fine (Weapons and Jewelry do As Well)
11ce32b152e5e28d84bb46ecbea398d8.png

Armor absolutely refuses to work.
299c67289c78e5bb5d9be00248df5d49.png



Edits are:
On Line 2709: Comment out everything except Resource Type.
On Line 2832: add new label.
 

Attachments

  • BaseArmor.cs
    123.2 KB · Views: 6
Last edited:
I encountered several different problems in the wild. Prefix and suffix's were missing with the previous implementation. In addition, keyguard would eat away at the item name. Attached are my fixes for these symptoms. I hope this helps the next GM =)

This Is The End Reaction GIF
 

Attachments

  • BaseArmor.cs
    122 KB · Views: 4
  • KeyGuardCommand.cs
    3.8 KB · Views: 5
Has anybody tried to mix this script with the storage keys? If so this will catch you off guard.
1691398090608.png

I found away to call the items basic name which is 75% of the way there =\. The list view is at least readable now =).

As I continued debugging and trying to find a solution, I can see the clico number for the bear mask is accurate on the right. But its the clico number and is not readable by the humans. I can't seem to isolate where in the code 1061599 is being called for.
1691398121459.png

Using visual studios, I can see the label number but I can't seem to figure out the syntax for calling it.
1691398220133.png

Apologies for all the rambling its 2 am here X_X. Thank you for any leads in advance ^^
 
Back