OP

jonldavis

Member
ServUO Version
Publish Unknown
Ultima Expansion
None
Can anyone help with fixing these errors.
I guess I'll post them as I go.

SBGardener.cs
Errors are with the four that I underlined
Two of them - InternalBuyInfo()
Error: CS0121 - The call is ambiguous between the following methods or properties: 'method1' and 'method2'
Two of them - m_BuyInfo
Error: CS0229 - Ambiguity between 'member1' and 'member2'
""
private readonly List<GenericBuyInfo> m_BuyInfo = new InternalBuyInfo();
private readonly IShopSellInfo m_SellInfo = new InternalSellInfo();


public override IShopSellInfo SellInfo => m_SellInfo;
public override List<GenericBuyInfo> BuyInfo => m_BuyInfo;

public class InternalBuyInfo : List<GenericBuyInfo>
{
public InternalBuyInfo()
{
Add(new GenericBuyInfo(typeof(Hoe), 17, 20, 0xE86, 2524));
Add(new GenericBuyInfo(typeof(GardeningContract), 10156, 500, 0x14F0, 0));
Add(new GenericBuyInfo("1060834", typeof(Engines.Plants.PlantBowl), 2, 20, 0x15FD, 0));
Add(new BeverageBuyInfo(typeof(Pitcher), BeverageType.Water, 11, 20, 0x1F9D, 0));
}
}


Besides explaining how to fix them if you could also explain this coding in C#?
I'm trying to learn C# but I'm confused on why you would do this.
When I created a List it usually goes something like this...
List<string> list = new List<string>();
Meaning my List used the string class to start with and to end with.
But in the coding below they start with one class and end with another method.
List<GenericBuyInfo> m_BuyInfo = new InternalBuyInfo();
Maybe someone can point me to a video or website that explains this kind of a List.

The next thing I'm confused on:
What does this mean: =>
public override IShopSellInfo SellInfo => m_SellInfo;
 
Last edited:
Regarding the first error, "CS0121 - The call is ambiguous between the following methods or properties", it occurs when the compiler can't determine which method or property to call because multiple methods or properties match the method call with the same name, parameters, and return type. In this case, the error is happening because there are two methods with the same name "InternalBuyInfo()" in the class.

To fix the error, you need to rename one of the methods so that they have unique names.

Regarding the second error, "CS0229 - Ambiguity between 'member1' and 'member2'", it happens when there is ambiguity between two members in the class, such as fields or properties, that have the same name and type. In this case, the error is happening because there are two fields in the class, "m_BuyInfo" and "m_SellInfo", that have the same type "InternalBuyInfo".

To fix the error, you need to change the type of either "m_BuyInfo" or "m_SellInfo" to a different type that is not the same as the type of the other field.

Regarding the list initialization syntax used in the code, it is initializing the "m_BuyInfo" field with an instance of the "InternalBuyInfo" class, which is a custom implementation of the "List<GenericBuyInfo>" class. The "InternalBuyInfo" class is defining a list of buyable items with their prices and properties that are used by the "SBGardener" class.

The syntax "=>" is used for an expression-bodied member. In this case, it is defining the "SellInfo" property of the "SBGardener" class as an expression-bodied member that returns the value of the "m_SellInfo" field. This is a shorthand syntax that can be used for simple property getter methods.

I hope this helps! As for resources to learn more about C#, I recommend the official Microsoft C# documentation (C# docs - get started, tutorials, reference.), which has tutorials, guides, and examples for C# programming.
 
Yea, I found two of these...
1. ServUO-master\Scripts\VendorInfo\SBGardener.cs
2. ServUO-master\Scripts\Custom\Cooking Expansion Set\Mobiles\SBinfo\SBGardener.cs
both have - public InternalBuyInfo()
Is it safe to move 1. which is a short list onto the end of 2. which has a very long list of items?
Or does the index matter for 1 and I shouldn't move it?
 
Well I commented out - ServUO-master\Scripts\VendorInfo\SBGardener.cs
Took their list of items and added it over here
ServUO-master\Scripts\Custom\Cooking Expansion Set\Mobiles\SBinfo\SBGardener.cs
That got rid of the ambiguous or ambiguity errors.

Next up I'm getting naming errors with
XmlAttach, XmlData, XmlInt, XmlSkill, XmlDex, XmlStr

Oh great I'm missing a namespace
using Server.Engines.XmlSpawner2;

Is this the one I want?
Went from like 20 something errors to almost 700 after putting that XMLSpawner in my Custom folder.
Appears that I already have it
C:\Users\jonld\Downloads\UO2\good\ServUO-master\ServUO-master\Scripts\Services\XmlSpawner\XmlSpawner2.cs
Under namespace Server.Mobiles
Got rid of the XmlSpawner2 in the custom folder and back to my 20 something errors.
Still that leaves me with these naming errors.
XmlAttach, XmlData, XmlInt, XmlSkill, XmlDex, XmlStr
Well got rid of XmlAttach using - [Updated Custom Release] XmlAttach & XmlLevelItem for newest repo
Down to 13 errors.
 
Last edited:

Active Shards

Donations

Total amount
$0.00
Goal
$1,000.00
Back