Full Version : 2.0 Conversion dump?
xmlspawner >>Troubleshooting >>2.0 Conversion dump?


<< Prev | Next >>

gizmo- 06-16-2006
Im gonna be spending the next few days going over conversion stuff with xml 3.1 system and RunUO 2.0. Im gonna post all fixes that I can find here. To do my part on helping bringing this system to 2.0 standards.

gizmo- 06-16-2006
getting lots of errors in these files.

XMLSetPoint2DGump.cs and XMLSetPoint3DGump.cs and XmlCategorizedAddGump.cs
at this point im sure there are more files. it only displays so many errors =(


All the errors are CS0133

C# Definition

CODE


Visual C# Language Concepts

Compiler Error CS0133The expression being assigned to 'variable' must be constant
A const variable cannot take as its value an expression that is not constant.
The following sample generates CS0133:
// CS0133.cs
public class A
{
  public const int i = c;   // CS0133, c is not constant
  public static int c = i;
  // try the following line instead
  // public const int i = 6;

  public static void Main()
  {
  }
}


Example Errors are as follows.

The expression being assigned to 'Server.Gumps.XmlSetPoint2DGump.GumpOffsetX' must be a constant. In fact all the errors say this.


Old PropsConfig.cs file

CODE

using System;
using Server;

namespace Server.Gumps
{
public class PropsConfig
{
 public const bool OldStyle = false;

 public const int GumpOffsetX = 30;
 public const int GumpOffsetY = 30;

 public const int TextHue = 0;
 public const int TextOffsetX = 2;

 public const int OffsetGumpID = 0x0A40; // Pure black
 public const int HeaderGumpID = OldStyle ? 0x0BBC : 0x0E14; // Light offwhite, textured : Dark navy blue, textured
 public const int  EntryGumpID = 0x0BBC; // Light offwhite, textured
 public const int   BackGumpID = 0x13BE; // Gray slate/stoney
 public const int    SetGumpID = OldStyle ? 0x0000 : 0x0E14; // Empty : Dark navy blue, textured

 public const int SetWidth = 20;
 public const int SetOffsetX = OldStyle ? 4 : 2, SetOffsetY = 2;
 public const int SetButtonID1 = 0x15E1; // Arrow pointing right
 public const int SetButtonID2 = 0x15E5; // " pressed

 public const int PrevWidth = 20;
 public const int PrevOffsetX = 2, PrevOffsetY = 2;
 public const int PrevButtonID1 = 0x15E3; // Arrow pointing left
 public const int PrevButtonID2 = 0x15E7; // " pressed

 public const int NextWidth = 20;
 public const int NextOffsetX = 2, NextOffsetY = 2;
 public const int NextButtonID1 = 0x15E1; // Arrow pointing right
 public const int NextButtonID2 = 0x15E5; // " pressed

 public const int OffsetSize = 1;

 public const int EntryHeight = 20;
 public const int BorderSize = 10;
}
}



new PropsConfig.cs File

CODE

using System;
using Server;

namespace Server.Gumps
{
public class PropsConfig
{
 public static readonly bool OldStyle = false;

 public static readonly int GumpOffsetX = 30;
 public static readonly int GumpOffsetY = 30;

 public static readonly int TextHue = 0;
 public static readonly int TextOffsetX = 2;

 public static readonly int OffsetGumpID = 0x0A40; // Pure black
 public static readonly int HeaderGumpID = OldStyle ? 0x0BBC : 0x0E14; // Light offwhite, textured : Dark navy blue, textured
 public static readonly int  EntryGumpID = 0x0BBC; // Light offwhite, textured
 public static readonly int   BackGumpID = 0x13BE; // Gray slate/stoney
 public static readonly int    SetGumpID = OldStyle ? 0x0000 : 0x0E14; // Empty : Dark navy blue, textured

 public static readonly int SetWidth = 20;
 public static readonly int SetOffsetX = OldStyle ? 4 : 2, SetOffsetY = 2;
 public static readonly int SetButtonID1 = 0x15E1; // Arrow pointing right
 public static readonly int SetButtonID2 = 0x15E5; // " pressed

 public static readonly int PrevWidth = 20;
 public static readonly int PrevOffsetX = 2, PrevOffsetY = 2;
 public static readonly int PrevButtonID1 = 0x15E3; // Arrow pointing left
 public static readonly int PrevButtonID2 = 0x15E7; // " pressed

 public static readonly int NextWidth = 20;
 public static readonly int NextOffsetX = 2, NextOffsetY = 2;
 public static readonly int NextButtonID1 = 0x15E1; // Arrow pointing right
 public static readonly int NextButtonID2 = 0x15E5; // " pressed

 public static readonly int OffsetSize = 1;

 public static readonly int EntryHeight = 20;
 public static readonly int BorderSize = 10;
}
}


Okay I got these all to compile through now. The proble was the fact atha ll the XmlProp files in the XmlProps Folder of XML spawner had to have all the

const

keywords removed. Seemed to compile just fine. Now onto the other erros.

ArteGordon- 06-16-2006
Just got back and pulled down RC1. I'll start going through it as well. Your gump initialization fixes are helpful. The original was from the distribution props gump initialization, so the new stuff can also be copied from the new distro gumps.
thanks.

gizmo- 06-16-2006
Joy Joy Joy..

ArrayList dont use System.Collections its now...

List from System.Collectiongs.Generic ?

Hashtable has been moved (yet to find where) or how it was changed.

Ive got all the Command stuff fixxed.

All the

using Server.Scripts.Commands

need to be changed to

Server.Commands;


What a mess. Well this is where I left off on conversion to 2.0. Gonna get some sleep here and try again tomorrow. Hehe just wait man, once you get diggin in youll be like OMFG, what the hell happened to RunUO. Oh well only takes time I guess. Ill just guess from my few hours of debuggin and fixing files. I probably had to modify about 200-250 lines of code in your system. And its still all out of wack =(. Good luck man.

gizmo- 06-16-2006
BASE REGION from 2.0 =(

CODE

Back to Server.Regions
BaseRegion : Region, IComparable
Derived Types: CancelQuestRegion, ChampionSpawnRegion, DungeonRegion, GauntletRegion, GreenAcres, GuardedRegion, HouseRegion, Jail, NoHousingRegion, QuestCompleteObjectiveRegion, QuestNoEntryRegion, QuestOfferRegion, StrongholdRegion, TreasureRegion
(static) bool CanSpawn( Region region, Type[] types )
(static) void Configure()
(static) string GetRuneNameFor( Region region )
(ctor) BaseRegion( XmlElement xml, Map map, Region parent )
(ctor) BaseRegion( string name, Map map, Region parent, Rectangle3D[] area )
(ctor) BaseRegion( string name, Map map, Region parent, Rectangle2D[] area )
(ctor) BaseRegion( string name, Map map, int priority, Rectangle3D[] area )
(ctor) BaseRegion( string name, Map map, int priority, Rectangle2D[] area )
bool ExcludeFromParentSpawns( get; set; )
bool NoLogoutDelay( get; set; )
string RuneName( get; set; )
SpawnEntry[] Spawns( get; set; )
SpawnZLevel SpawnZLevel( get; set; )
virtual bool AcceptsSpawnsFrom( Region region )
virtual TimeSpan GetLogoutDelay( Mobile m )
void InitRectangles()
virtual void OnUnregister()
Point3D RandomSpawnLocation( int spawnHeight, bool land, bool water, Point3D home, int range )
virtual string ToString()



REGION from 2.0

CODE

Back to Server
Region : IComparable
Derived Types: BaseRegion
(static) TimeSpan DefaultLogoutDelay( get; set; )
(static) Type DefaultRegionType( get; set; )
(static) List`1 Regions( get; )
(static) TimeSpan StaffLogoutDelay( get; set; )
(static) bool CanMove( Mobile m, Direction d, Point3D newLocation, Point3D oldLocation, Map map )
(static) Rectangle3D ConvertTo3D( Rectangle2D rect )
(static) Rectangle3D[] ConvertTo3D( Rectangle2D[] rects )
(static) Region Find( Point3D p, Map map )
(static) string GetAttribute( XmlElement xml, string attribute, bool mandatory )
(static) void Load()
(static) void LoadRegions( XmlElement xml, Map map, Region parent )
(static) void OnRegionChange( Mobile m, Region oldRegion, Region newRegion )
(static) bool ReadBoolean( XmlElement xml, string attribute, ref bool value )
(static) bool ReadBoolean( XmlElement xml, string attribute, ref bool value, bool mandatory )
(static) bool ReadDateTime( XmlElement xml, string attribute, ref DateTime value )
(static) bool ReadDateTime( XmlElement xml, string attribute, ref DateTime value, bool mandatory )
(static) bool ReadEnum( XmlElement xml, string attribute, Type type, ref object value )
(static) bool ReadEnum( XmlElement xml, string attribute, Type type, ref object value, bool mandatory )
(static) bool ReadInt32( XmlElement xml, string attribute, ref int value )
(static) bool ReadInt32( XmlElement xml, string attribute, ref int value, bool mandatory )
(static) bool ReadMap( XmlElement xml, string attribute, ref Map value )
(static) bool ReadMap( XmlElement xml, string attribute, ref Map value, bool mandatory )
(static) bool ReadPoint3D( XmlElement xml, Map map, ref Point3D value )
(static) bool ReadPoint3D( XmlElement xml, Map map, ref Point3D value, bool mandatory )
(static) bool ReadRectangle3D( XmlElement xml, int defaultMinZ, int defaultMaxZ, ref Rectangle3D value )
(static) bool ReadRectangle3D( XmlElement xml, int defaultMinZ, int defaultMaxZ, ref Rectangle3D value, bool mandatory )
(static) bool ReadString( XmlElement xml, string attribute, ref string value )
(static) bool ReadString( XmlElement xml, string attribute, ref string value, bool mandatory )
(static) bool ReadTimeSpan( XmlElement xml, string attribute, ref TimeSpan value )
(static) bool ReadTimeSpan( XmlElement xml, string attribute, ref TimeSpan value, bool mandatory )
(static) bool ReadType( XmlElement xml, string attribute, ref Type value )
(static) bool ReadType( XmlElement xml, string attribute, ref Type value, bool mandatory )
(ctor) Region( XmlElement xml, Map map, Region parent )
(ctor) Region( string name, Map map, int priority, Rectangle3D[] area )
(ctor) Region( string name, Map map, int priority, Rectangle2D[] area )
(ctor) Region( string name, Map map, Region parent, Rectangle3D[] area )
(ctor) Region( string name, Map map, Region parent, Rectangle2D[] area )
Rectangle3D[] Area( get; )
int ChildLevel( get; )
List`1 Children( get; )
MusicName DefaultMusic( get; )
bool Dynamic( get; )
Point3D GoLocation( get; set; )
bool IsDefault( get; )
Map Map( get; )
MusicName Music( get; set; )
string Name( get; )
Region Parent( get; )
int Priority( get; )
bool Registered( get; )
Sector[] Sectors( get; )
virtual bool AcceptsSpawnsFrom( Region region )
virtual bool AllowBeneficial( Mobile from, Mobile target )
virtual bool AllowHarmful( Mobile from, Mobile target )
virtual bool AllowHousing( Mobile from, Point3D p )
virtual bool AllowSpawn()
virtual void AlterLightLevel( Mobile m, ref int global, ref int personal )
virtual bool CanUseStuckMenu( Mobile m )
virtual bool CheckAccessibility( Item item, Mobile from )
bool Contains( Point3D p )
virtual TimeSpan GetLogoutDelay( Mobile m )
int GetMobileCount()
List`1 GetMobiles()
int GetPlayerCount()
List`1 GetPlayers()
Region GetRegion( string regionName )
Region GetRegion( Type regionType )
virtual Type GetResource( Type type )
bool IsChildOf( Region region )
bool IsPartOf( string regionName )
bool IsPartOf( Type regionType )
bool IsPartOf( Region region )
virtual void MakeGuard( Mobile focus )
virtual void OnAggressed( Mobile aggressor, Mobile aggressed, bool criminal )
virtual bool OnBeginSpellCast( Mobile m, ISpell s )
virtual void OnBeneficialAction( Mobile helper, Mobile target )
virtual void OnChildAdded( Region child )
virtual void OnChildRemoved( Region child )
virtual bool OnCombatantChange( Mobile m, Mobile Old, Mobile New )
virtual void OnCriminalAction( Mobile m, bool message )
virtual bool OnDamage( Mobile m, ref int Damage )
virtual bool OnDeath( Mobile m )
virtual bool OnDecay( Item item )
virtual void OnDidHarmful( Mobile harmer, Mobile harmed )
virtual bool OnDoubleClick( Mobile m, object o )
virtual void OnEnter( Mobile m )
virtual void OnExit( Mobile m )
virtual void OnGotBeneficialAction( Mobile helper, Mobile target )
virtual void OnGotHarmful( Mobile harmer, Mobile harmed )
virtual bool OnHeal( Mobile m, ref int Heal )
virtual void OnLocationChanged( Mobile m, Point3D oldLocation )
virtual bool OnMoveInto( Mobile m, Direction d, Point3D newLocation, Point3D oldLocation )
virtual void OnRegister()
virtual bool OnResurrect( Mobile m )
virtual bool OnSingleClick( Mobile m, object o )
virtual bool OnSkillUse( Mobile m, int Skill )
virtual void OnSpeech( SpeechEventArgs args )
virtual void OnSpellCast( Mobile m, ISpell s )
virtual bool OnTarget( Mobile m, Target t, object o )
virtual void OnUnregister()
void Register()
virtual bool SendInaccessibleMessage( Item item, Mobile from )
virtual void SpellDamageScalar( Mobile caster, Mobile target, ref double damage )
virtual int System.IComparable.CompareTo( object obj )
virtual string ToString()
void Unregister()


I noticed that Coords isnt there anymore, so thats gonna need fixxed too. =( probably some other crap. Didnt get a chance because once i got the commands cleaned up, It started in on the HashTable/ArrayList crap with a few errors in region.coords ect..