RunUO Community

This is a sample guest message. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

[RunUO 2.0] Colored Item Name Properties

espcevan

Sorceror
Okay, I have this down to one error at the moment.

Code:
Errors:
+ Customs/Extended Localizer - PropertyList-2-StringList/OPLWrapper.cs:
    CS1501: Line 42: No overload for method 'Compile' takes '1' arguments

byte[] data = list.Compile(false);

Code:
        public string[] GetString(string language)
        {
            byte[] data = list.Compile(false);
            ArrayList msgs = new ArrayList();
 
            GoodPacketReader reader = new GoodPacketReader(data, false);
            reader.Seek(15, System.IO.SeekOrigin.Begin);
 
            int msgNum = -1;
            for (int i = 15; i < data.Length - 4; )
            {
                msgNum = reader.ReadInt32();
                int paramLength = reader.ReadInt16() / 2;
 
                string param = "";
                if (paramLength > 0)
                {
                    param = reader.ReadUnicodeStringLE(paramLength);
                }
 
                string msg = Localizer.GetFormat(language, msgNum, param);
                msgs.Add(msg);
 
                i += 6 + paramLength;
            }
 

Vorspire

Knight
Rich (BB code):
        public string[] GetString(string language)
        {
            int length;
            byte[] data = list.Compile(false, out length);
            List<string> msgs = new List<string>();
 
            GoodPacketReader reader = new GoodPacketReader(data, false);
            reader.Seek(15, System.IO.SeekOrigin.Begin);
 
            int msgNum = -1;
            for (int i = 15; i < data.Length - 4; )
            {
                msgNum = reader.ReadInt32();
                int paramLength = reader.ReadInt16() / 2;
 
                string param = "";
                if (paramLength > 0)
                {
                    param = reader.ReadUnicodeStringLE(paramLength);
                }
 
                string msg = Localizer.GetFormat(language, msgNum, param);
                msgs.Add(msg);
 
                i += 6 + paramLength;
            }
 

espcevan

Sorceror
Code:
Scripts: Compiling C# scripts...Error:
System.Runtime.InteropServices.ExternalException: Timed out waiting for a progra
m to execute. The command being executed was "C:\WINDOWS\Microsoft.NET\Framework
\v2.0.50727\csc.exe" /noconfig /fullpaths @"C:\Documents and Settings\Owner\Loca
l Settings\Temp\hr5jpcgk.cmdline".
  at System.CodeDom.Compiler.Executor.ExecWaitWithCaptureUnimpersonated(SafeUse
rTokenHandle userToken, String cmd, String currentDir, TempFileCollection tempFi
les, String& outputName, String& errorName, String trueCmdLine)
  at System.CodeDom.Compiler.Executor.ExecWaitWithCapture(SafeUserTokenHandle u
serToken, String cmd, String currentDir, TempFileCollection tempFiles, String& o
utputName, String& errorName, String trueCmdLine)
  at Microsoft.CSharp.CSharpCodeGenerator.Compile(CompilerParameters options, S
tring compilerDirectory, String compilerExe, String arguments, String& outputFil
e, Int32& nativeReturnValue, String trueArgs)
  at Microsoft.CSharp.CSharpCodeGenerator.FromFileBatch(CompilerParameters opti
ons, String[] fileNames)
  at Microsoft.CSharp.CSharpCodeGenerator.System.CodeDom.Compiler.ICodeCompiler
.CompileAssemblyFromFileBatch(CompilerParameters options, String[] fileNames)
  at System.CodeDom.Compiler.CodeDomProvider.CompileAssemblyFromFile(CompilerPa
rameters options, String[] fileNames)
  at Server.ScriptCompiler.CompileCSScripts(Boolean debug, Boolean cache, Assem
bly& assembly)
  at Server.ScriptCompiler.Compile(Boolean debug, Boolean cache)
  at Server.Core.Main(String[] args)
This exception is fatal, press return to exit
 

espcevan

Sorceror
After trying to restart i end up with errors.

Code:
Errors:
+ Customs/Extended Localizer - PropertyList-2-StringList/OPLWrapper.cs:
    CS0246: Line 44: The type or namespace name 'List' could not be found (are y
ou missing a using directive or an assembly reference?)
    CS0246: Line 44: The type or namespace name 'List' could not be found (are y
ou missing a using directive or an assembly reference?)
 

espcevan

Sorceror
Errors:
+ Customs/Extended Localizer - PropertyList-2-StringList/OPLWrapper.cs:
CS1501: Line 67: No overload for method 'ToArray' takes '1' arguments
 

HellDriven

Wanderer
Can I see an example of someone's complete BaseJewel.cs?
I'm getting the errors:
+ Items/Jewels/BaseJewel.cs:
CS1519: Line 283: Invalid token '{' in class, struct, or interface member de
claration
CS1520: Line 284: Class, struct, or interface method must have a return type

CS1001: Line 284: Identifier expected
CS1519: Line 285: Invalid token '{' in class, struct, or interface member de
claration
CS1519: Line 286: Invalid token '(' in class, struct, or interface member de
claration
CS1519: Line 286: Invalid token ')' in class, struct, or interface member de
claration
CS1519: Line 288: Invalid token '=' in class, struct, or interface member de
claration
CS1519: Line 288: Invalid token ')' in class, struct, or interface member de
claration
CS1519: Line 289: Invalid token '(' in class, struct, or interface member de
claration
CS1519: Line 289: Invalid token ')' in class, struct, or interface member de
claration
CS0116: Line 291: A namespace does not directly contain members such as fiel
ds or methods
CS0116: Line 301: A namespace does not directly contain members such as fiel
ds or methods
CS1022: Line 308: Type or namespace definition, or end-of-file expected

Figured it's easier if I just look for anything wrong and fix :) (Better off I learn right)
If anyone could assist me I'd be very grateful.
 

Zagros

Sorceror
In BaseWeapon.cs

Look at your AddNameProperty Method and *DO not copy and paste over it, Comment out the entire method you have *if you havent changed it.* It should have a bunch of mumbo jumbo about getting ore types and such. From end to end the method should look like this. *NEW edited method from this post


Code:
HTML:
public override void AddNameProperty(ObjectPropertyList list)
    {
//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, "<BASEFONT COLOR=#1EFF00>{0}\t{1}<BASEFONT COLOR=#FFFFFF>", oreType, GetNameString());
        }
        if( props >= 3 && props <= 4 )    // Blue (Rare)
        {
            list.Add(1053099, "<BASEFONT COLOR=#0070FF>{0}\t{1}<BASEFONT COLOR=#FFFFFF>", oreType, GetNameString());
        }
        if( props >= 5 && props <= 6 )    // Purple (Epic)
        {
            list.Add(1053099, "<BASEFONT COLOR=#A335EE>{0}\t{1}<BASEFONT COLOR=#FFFFFF>", oreType, GetNameString());
        }
        if( props >= 7 && props <= 8 )    // Orange (Legendary)
        {
            list.Add(1053099, "<BASEFONT COLOR=#FF8000>{0}\t{1}<BASEFONT COLOR=#FFFFFF>", oreType, GetNameString());
        }
        if( props >= 9 )        // Golden (Artifact)
        {
            list.Add(1053099, "<BASEFONT COLOR=#E6CC80>{0}\t{1}<BASEFONT COLOR=#FFFFFF>", oreType, GetNameString());
        }
//Colored Item Name Mod End[/B]
        if (!String.IsNullOrEmpty(m_EngravedText))
                list.Add( 1062613, m_EngravedText );
 
                /* list.Add( 1062613, Utility.FixHtml( m_EngravedText ) ); */
        }

It works like a charm, Side effects are that you will see Iron next to anything thats not specifly an Iron product.. Ie. A Shadow Iron Sword. would indeed say Shadow Iron.
On this post there is another work around for it.

I would think that perhaps afew members could get together to make this prettier, and insted of all that being in distro scripts insted put it into the xml system as, XmlRarityItem with a simple call back into the AddNameProperty method so we can do this on the fly to any baseweapon and not all of them at the same time.


Even on the heavly edited shard I have here.. this mod to baseweapon didn't seem to effect much in the 15 minutes ive added random items.


Hehe to fix the affixing the resource type to everything.

Code:
Code:
if ( oreType.ToLower() == "none" || oreType.ToLower() == "normal" || oreType != "0" ) oreType = "";
notice the addition of the oreType != "0" works like a charm.


P.s. I know this looks like a bad copy and paste job.
 

HellDriven

Wanderer
Okay.. fixed almost every problem except one.. but I can't find what it refers to..

Errors:
+ Items/Jewels/BaseJewel.cs:
CS0246: Line 297: The type or namespace name 'B' could not be found (are you
missing a using directive or an assembly reference?)

Line 297 is:
{

I don't get what could be the problem.
 
this will only work for runuo 2.0 or can it work on say orbsa 2.2? cause i get the same issue with the serverall pucutaion errors and also the wont read correctly
 

espcevan

Sorceror
Got it working with a help from a buddy. Here are all the files that had to be modded so others can compare. works for 2.2
 

Attachments

  • BaseArmor.cs
    48.6 KB · Views: 56
  • BaseClothing.cs
    29.6 KB · Views: 41
  • BaseJewel.cs
    13.8 KB · Views: 54
  • BaseRanged.cs
    5.8 KB · Views: 41
  • BaseWeapon.cs
    104.8 KB · Views: 49
  • Extended Localizer - PropertyList-2-StringList.rar
    7.5 KB · Views: 48
  • LootPack.cs
    38.3 KB · Views: 48

DevXLX

Sorceror
Any chance for a fix to item names?

When you hold ctrl+shift, the names go "<BASEFONT COLOR..." etc :/
Checked my code to verify basearmor and baseweapon have the little # infront at the lines you described and the old label commented out, yet doesn't do anything to fix the issue above.

Also it would be really nice, if there was an option to include artifact rarity in the system, so artifacts are not only blue and some green, cuz some have only few but very powerful properties.
Just a suggestion, thanks for an awesome script :)

PS.
Is it on porpuse it doesn't color player-crafted items that are exceptional? (it does color regular and low quality crafts) could that be fixed, so it also colors exceptional items? :)
 
there is a } at the end of what your copying that might se setting off your problems i just deleted that and the errors with
= ; " stuff went away might try the thrity day microsoft visual studio it pulls up those errors when you aree adding the system in should give ya a bit of insite.
 

DevXLX

Sorceror
I would really love if someone could maybe show, how this same system could be used for BaseCreature.cs ?

The whole Diablo-feel is great and it would be even better if you could Color-Code monster names, based on difficulty aswell.

Like an AncientWyrm would have it's name in Orange color .... a Zombie would have Green color... a sewer rat would remain plain white / default color...

etc etc...

Same as colored properties serves a way for new players to much quicker learn to recognize valueable item drops, this would help new players to judge monsters from a distance, before actually
attacking them. :)

I tried doing <BASEFONT COLOR=#ff884c> in titles on monsters, to give them a colored title, based on difficulty - it works when you hover your mouse, it shows the color and title, but when you press all names, it looks terrible cus you see the BASEFONT COLOR stuff, as part of the title.
 
Top