Wheredidigo
Community Developer
- Joined
- Dec 15, 2013
- Messages
- 417
I am currently working on my own methods for loading settings for plugins I want to use.
Here is my LoadSettings Method:
Notice how I'm calling BuildTeleportLocations in 2 different ways and setting it to 2 different types.
This is my BuildTeleportLocations method:
Everything compiles just fine in Visual Studio, but when I load RB, I am getting the following error in my log:
Is this something you can add to the compiler or do I need to create 2 different methods and then make note that RB can't handle doing dynamic methods?
Here is my attached log:
Here is my LoadSettings Method:
Code:
private static void LoadSettings()
{
var fileLocation = PluginManager.PluginDirectory + "\\FateBotManager\\FateBotManagerSettings.xml";
XElement xmlSettings;
if (File.Exists(fileLocation))
{
xmlSettings = XElement.Load(fileLocation);
}
else
{
xmlSettings = new XElement("Settings",
new XElement("DoBossFates", false),
new XElement("MinPercentCompleteForBoss", 0f),
new XElement("DoEscortFates", false),
new XElement("MaxLevelsAbove", 3),
new XElement("MaxLevelsBelow", 10),
new XElement("DoOnlyThisFate", string.Empty),
[B]BuildTeleportLocations()[/B]);
xmlSettings.Save(fileLocation);
}
var settings = new FateBotManagerSettings
{
DoBossFates = (bool) xmlSettings.Element("DoBossFates"),
MinPercentCompleteForBoss = (float) xmlSettings.Element("MinPercentCompleteForBoss"),
DoEscortFates = (bool) xmlSettings.Element("DoEscortFates"),
MaxLevelsAbove = (int) xmlSettings.Element("MaxLevelsAbove"),
MaxLevelsBelow = (int) xmlSettings.Element("MaxLevelsBelow"),
DoOnlyThisFate = (string) xmlSettings.Element("DoOnlyThisFate"),
TeleportLocations = [B]BuildTeleportLocations(xmlSettings.Element("TeleportLocations"))[/B]
};
Settings = settings;
}
Notice how I'm calling BuildTeleportLocations in 2 different ways and setting it to 2 different types.
This is my BuildTeleportLocations method:
Code:
private static dynamic BuildTeleportLocations(XElement locations = null)
{
if (locations == null)
{
var xmlRetval = new XElement("TeleportLocations");
var textInfo = CultureInfo.CurrentCulture.TextInfo;
foreach (var location in WorldManager.AvailableLocations)
{
xmlRetval.Add(new XElement("TeleportLocation",
new XElement("Name", textInfo.ToTitleCase(location.Name)),
new XElement("AetheryteId", location.AetheryteId),
new XElement("ZoneId", location.ZoneId),
new XElement("JSTAtmaHour", 0),
new XElement("AtmaCount", 0),
new XElement("AtmaName", string.Empty)));
}
return xmlRetval;
}
return locations.Descendants("TeleportLocations").Select(location => new TeleportLocation
{
AetheryteId = (uint) location.Element("AetheryteId"),
AtmaCount = (int) location.Element("AtmaCount"),
AtmaName = (string) location.Element("AtmaName"),
JstAtmaHour = (int) location.Element("JSTAtmaHour"),
Name = (string) location.Element("Name"),
ZoneId = (int) location.Element("ZoneId")
}).ToList();
}
Everything compiles just fine in Visual Studio, but when I load RB, I am getting the following error in my log:
[23:12:01.307 N] Compiler Error: error CS0518: Predefined type 'Microsoft.CSharp.RuntimeBinder.Binder' is not defined or imported
[23:12:01.307 N] Compiler Error: c:\RebornBuddy\Plugins\FateBotManager\FateBotManager.cs(142,31) : error CS1969: One or more types required to compile a dynamic expression cannot be found. Are you missing a reference?
[23:12:01.307 N] Compiler Error: c:\RebornBuddy\Plugins\FateBotManager\FateBotManager.cs(160,37) : error CS1969: One or more types required to compile a dynamic expression cannot be found. Are you missing a reference?
Is this something you can add to the compiler or do I need to create 2 different methods and then make note that RB can't handle doing dynamic methods?
Here is my attached log: