Accessing EQ objects from C# code in .NET

Moderator: MacroQuest Developers

Blue
orc pawn
orc pawn
Posts: 11
Joined: Tue Aug 16, 2005 10:53 am

Accessing EQ objects from C# code in .NET

Post by Blue » Thu Jul 26, 2007 4:49 pm


<<Check the later posts. We are up to a partial but increasingly full (and working!) wrapper for ISXEQ that lets you find MOB's, target them, and attack from any .Net language.>>

I've been playing around with Everquest under InnerSpace and trying to understand Lax's copious documentation in the Wiki. Here's a working snippet of code that shows how to get a C# program to display your character's loc onto the InnerSpace console. I'm posting here because some MQ'ers who are slightly curious about InnerSpace don't frequent the other IS boards, e.g. ISMods.com or Lavishsoft.com. And a couple of days ago I would have been glad to get a tiny example that just compiled to a runnable console program.

Now my question to the knowledgeable developers out there is: 1) Now that I can, clumsily, access TLO's, how would I go about initiating in-game actions from within a .NET program? e.g. moving, attacking, casting, etc. Is this a matter of sending KeyPress commands etc.? <cringes> and 2) The following shows one way to read ISXEQ objects from C#, but it would seem a lot better to have the whole ISXEQ data exposed to .NET through a wrapper. Would this be a big deal? I notice that most of the other games that run under InnerSpace (EQ2, Vanguard, WoW etc.) have such a wrapper available, but, ironically, EQ1 does not.

OK, here's my example. If you set it up as a C# Console App under VS2005 it should compile cleanly and be runnable from the InnerSpace console. Feel free to point out flaws:

Code: Select all

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using InnerSpaceAPI;
using LavishVMAPI;

// This is an experiment to play around with how to access ISXEQ Top Level Objects from .NET.
// It's a console app that should display your character's name and location on the InnerSpace console.
// To run it, so far I am feeding the IS dotnet command the full line of text that gacutil creates.  For example,
// at the InnerSpace console I type:
// dotnet "ISXBasicAccess, Version=1.0.0.0, Culture=neutral, PublicKeyToken=48f786b573cdbb7f, processorArchitecture=MSIL"
// There has to be a better way to do this, but it works for now.
// 
// To set this up in VS2005, follow the instructions in 
// http://www.lavishsoft.com/wiki/index.php/NET:Tutorials:HelloWorld


namespace ISXBasicAccess
{
    class Program
    {
        static void Main(string[] args)
        {
            using (new FrameLock(true))   
            {
                EqMe myGuy = new EqMe();
                if (!myGuy.IsValid) InnerSpace.Echo("myGuy.IsValid=false"); 
                InnerSpaceAPI.InnerSpace.Echo("Name: " + myGuy.name);
                //InnerSpaceAPI.InnerSpace.Echo("ID: " + myGuy.id.ToString("D") );
                InnerSpaceAPI.InnerSpace.Echo("Loc:" + myGuy.y.ToString("F") + "," + myGuy.x.ToString("F") + "," + myGuy.z.ToString("F") );
            }
        }
    }


        public class EqMe : LavishScriptAPI.LavishScriptObject
        {

            public EqMe()
                : base(LavishScriptAPI.LavishScript.Objects.GetObject("Me"))
            {
            }

            public int id
            {
                get
                {
                    return GetMember<int>("ID");
                }
            }

            public string name
            {
                get
                {
                    return GetMember<string>("Name");
                }
            }

            public int level
            {
                get
                {
                    return GetMember<int>("Level");
                }
            }

            public float x
            {
                get
                {
                    return GetMember<float>("X");
                }
            }

            public float y
            {
                get
                {
                    return GetMember<float>("Y");
                }
            }

            public float z
            {
                get
                {
                    return GetMember<float>("Z");
                }
            }

        }

}
Last edited by Blue on Tue Aug 07, 2007 5:58 pm, edited 1 time in total.

selu989
orc pawn
orc pawn
Posts: 18
Joined: Wed Sep 15, 2004 1:55 pm

Post by selu989 » Thu Jul 26, 2007 5:12 pm

Thanks Blue :D

Blue
orc pawn
orc pawn
Posts: 11
Joined: Tue Aug 16, 2005 10:53 am

Post by Blue » Wed Aug 01, 2007 4:35 pm

I'd like to push this approach a bit farther. Can the experienced MQ2 Devs please chime in (even a little bit!) I can extend the little example I gave above to make any basic type of MQ2 data available under InnerSpace, e.g. I can see how I convert integers, floating point numbers, and strings. But what should I do about more complex types? For example, if you go to the MQ2 manual for a list of TLO's:
http://www.nashskills.com/mq2manual.html#mq2ini
and search for "Required ability (if any)" you'll be right at an example of what I mean. All the other members are ints and strings, but now I have to cope with a member of type "altability" ... can I do it this way?

Code: Select all

Public class TLOWrap_Altability: LavishScriptAPI.LavishScriptObject
{
	Public TLOWrap_Altability: LavishScriptAPI.LavishScriptObject()
		: base(LavishScriptAPI.LavishScript.Objects.GetObject("Altability"))
		{
		}
		...yada yada ...
		public altability RequiresAbility
		{
			get
			{
				return GetMember<altability>("RequiresAbility");
			}
		}
If so, yay! Onward and upward.
(My next and hopefully final question on this topic will be how to cope with arrays. Search for "Your skill in the selected language" on the same page of the manual to see the first of these I bump into.
Any help will be greatly appreciated. If I can just understand how to deal with these two questions, I can probably publish a kludgy wrapper for ISXEQ TLO's here for anyone else that wants to use .NET languages.

Red-One
a ghoul
a ghoul
Posts: 143
Joined: Tue Dec 28, 2004 9:14 pm

tid bit of info

Post by Red-One » Wed Aug 01, 2007 7:29 pm

Code: Select all

Public class TLOWrap_Altability: LavishScriptAPI.LavishScriptObject 
{ 
   Public TLOWrap_Altability() 
      : base(LavishScriptAPI.LavishScript.Objects.GetObject("Altability")) 
      { 
      } 
[b]Public TLOWrap_Altability(LavishScriptAPI.LavishScriptObject lavishObj) 
      : base(lavishObj) 
      { 
      } [/b]
      ...yada yada ... 
      public altability RequiresAbility 
      { 
         get 
         { 
            [b]return new TLOWrap_Altability(GetMember("RequiresAbility")); [/b]
         } 
      }
That should do it. Anytime you want to return one of your own wrapper objects from a member of a TLO you do so by passing a reference to its LavishScriptObject to the constructor of your own (which GetMember()returns).

If it is something in lavishscript that takes arguments, then use the proper GetMember overload to pass them in. So lets run off your example with abilities. Let's assume there is a Me.Ability:

In LavishScript if there is only ever 1 ability then you would do echo ${Me.Ability}, or ${Me.Ability.Name} but this is not really the case. Most likely you have lots of abilities and you need to tell LavishScript which one you want. This means you would do echo ${Me.Ability[taunt].Name}. It searches for an ability named taunt (duh!).

Now lets add this feature to your example. Let us assume you have a wrapped 'EqMe' class. You have an ability class already, so lets put it under EqMe. For brevity I'm going to rename your ability class to EqAbility and use that from now on.

Code: Select all

public EqAbility Ability
{
    get { return new EqAbility(GetMember("Ability")); }
}
That handles the first example...but remembe we have a load of abilities, so the above won't suffice. Let's make it better and allow the developer to pass in what ability he wants to retrieve. This requires us to make it a method instead of a property.

Code: Select all

public EqAbility GetAbility(string search)
{
   return new EqAbility(GetMember("Ability",search)); 
}
Simple, isn't it? This handles someone being able to do Me.GetAbility("taunt"). This would in turn (with your example) allow me to do Me.GetAbility("taunt").RequiresAbility and so on.


In the case where you want multiple search arguments you simple change the method signature and it accomplishes the same thing.

Code: Select all

public EqAbility GetAbility(params string[] search)
{
   return new EqAbility(GetMember("Ability",search)); 
}
by using the params keyword, the developer is not restricted to passing just 1 string, they can pass 0-N. I can now call the method using Me.GetAbility("taunt","param2","param3") and so on. Really the example makes more sense if you think of the Spawn TLO, since you may want to pass lots of stuff to it. Spawn.GetSpawn("cleric","range 20-30","male") or what have you. (note that it does require valid search params, the same ones you would use in LavishScript to do a spawn search).

Edit: only use the Generic ("GetMember<>()")implementation for value types. LavishScriptAPI has no clue about any of your reference types much less being able to convert return values to them. So if you are returning an int/string/bool/float, etc then use them. If not, then don't.
An example would be Me.Name. Your property would be:

Code: Select all

public string Name
{
   get { return GetMember<string>("Name");}
}

I hope that clears things up. If not, hit me up in IRC or post here and then paste me the link in #isxeq channel.

-Red
Last edited by Red-One on Thu Aug 02, 2007 2:21 am, edited 1 time in total.

Red-One
a ghoul
a ghoul
Posts: 143
Joined: Tue Dec 28, 2004 9:14 pm

Post by Red-One » Wed Aug 01, 2007 7:49 pm

Also, when you want to act upon the item, just use ExecuteMethod instead of GetMember. Add this to your EqMe class

Code: Select all

public void TargetSelf()
{
   ExecuteMethod("Target");
}
Lastly, for ease of implementation; Your classes could follow the same inheritence hirearchy as mq2/isxeq does to inherit members/methods, etc.

-Red

Blue
orc pawn
orc pawn
Posts: 11
Joined: Tue Aug 16, 2005 10:53 am

Post by Blue » Mon Aug 06, 2007 2:52 pm

Red-One,
Thanks much. Your few lines of fix sent me back to do some serious reading (C# mostly and some MQ2.) I tried to plug in your suggestion but I can't get it to work. Maybe you can see where I'm off the rails? Here's a pared down copy of the code. It compiles cleanly, but it's not targeting the nearest Mob. (There's no run time error.) Any observations?

Code: Select all

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using InnerSpaceAPI;
using LavishVMAPI;

namespace ISXEQWrapper
{
    class eqwrapper
    {
        static void toonSay(string aString)
        {
            InnerSpaceAPI.InnerSpace.Echo(aString);
        }

        static void toonDo(string aString)
        {
            LavishScriptAPI.LavishScript.ExecuteCommand(aString);
        }

        static void Main(string[] args)
        {
            using (new FrameLock(true))
            {
                EqMe myGuy = new EqMe();
                if (!myGuy.IsValid) toonSay("myGuy.IsValid=false");
                Eq_Spawn aMob = new Eq_Spawn();
                aMob = myGuy.NearestSpawn("NPC Range 100");
                toonSay("Nearest MOB="+aMob.Name);
                aMob.Target();
                toonDo("cast Immobility");
                toonDo("cast Rend");
            }
        }
    }

    public class EqMe : Eq_Character
    {
        public EqMe()
            :base(LavishScriptAPI.LavishScript.Objects.GetObject("Me"))
        { 
        }
    }

    public class Eq_Character : Eq_Spawn
    {
        public Eq_Character()
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Character"))
        {
        }
        public Eq_Character(LavishScriptAPI.LavishScriptObject lavishObj)
            : base(lavishObj)
        {
        }

    }

    public class Eq_Spawn : LavishScriptAPI.LavishScriptObject
    {
        public Eq_Spawn()
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Spawn"))
        {
        }
        public Eq_Spawn(LavishScriptAPI.LavishScriptObject lavishObj)
            : base(lavishObj)
        {
        }

        public void Target()
        {
            ExecuteMethod("Target");
        }

        public Eq_Spawn NearestSpawn(string search)
        {
            return new Eq_Spawn(GetMember("NearestSpawn", search));
        }

        public Eq_Spawn NearestSpawn(params string[] search)
        {
            return new Eq_Spawn(GetMember("NearestSpawn", search));
        }

        public string Name
        {
            get
            {
                return GetMember<string>("Name");
            }
        }

    }
}



Blue
orc pawn
orc pawn
Posts: 11
Joined: Tue Aug 16, 2005 10:53 am

getting close to useful

Post by Blue » Tue Aug 07, 2007 5:44 pm

Red-One ... thanks for helping out with my last question on IRC. As we discussed, I'm posting some code that summarizes our conversation.

The following C# code, compiled and run from the InnerSpace console, will echo some info about your character then will find, face, and nuke the nearest MOB. This is not intended to be practical by itself, but to show the wrapped ISXEQ objects working.
The line that shows finding the nearest MOB,
EqSpawn aMob = new EqSpawn("npc");
could have any MQ2 spawn search criteria as a series of strings instead of just "npc"

The code that follows includes a first cut at wrapping all the simple types that ISXEQ makes available. That is, it grabbed everything that was an integer, float, boolean, or string, and ignored the rest for now. The code was written mechanically (and without much understanding of MQ2) so parts of it may be wrong or may not make sense. Try it out and let me know what you run into. I will probably flesh out at least a few more types, e.g. buffs, that involve looking up parameters as EqSpawn does. Overall, this is NOT the right way to wrap ISXEQ ... Lax points to the right approach in the InnerSpace documentation ... but does work and it is better than nothing.

Code: Select all

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Threading;
using InnerSpaceAPI;
using LavishVMAPI;
using IS = InnerSpaceAPI.InnerSpace;
using LS = LavishScriptAPI.LavishScript;


// This is an experiment to understand how to access ISXEQ Top Level Objects from .NET.
// It's a console app that should display a few stats about your character and a nearby MOB on the InnerSpace console.
// If you happen to be a baby Wizard, it will also cast a baby nuke on said MOB, so don't test it in the wrong zone.
// To run it, so far I am feeding the IS dotnet command the full line of text that gacutil creates.  For example,
// at the InnerSpace console I type:
// dotnet "ISXBasicAccess, Version=1.0.0.0, Culture=neutral, PublicKeyToken=48f786b573cdbb7f, processorArchitecture=MSIL"
// There has to be a better way to do this, but it works for now.
// 
// To set this up in VS2005, follow the instructions in 
// http://www.lavishsoft.com/wiki/index.php/NET:Tutorials:HelloWorld


namespace ISXEQWrapper
{
    class EqWrapper
    {
        static void Main(string[] args)
        {
            using (new FrameLock(true))
            {
                EqMe myGuy = new EqMe();
                IS.Echo("Name: " + myGuy.Name);
                IS.Echo("Loc: " + myGuy.Y.ToString("F") + "," + myGuy.X.ToString("F") + "," + myGuy.Z.ToString("F"));
                IS.Echo("Level: " + myGuy.Level.ToString("D"));
                if (myGuy.Levitating) IS.Echo("Woah I seem to be flying!");
                EqSpawn aMob = new EqSpawn("npc");
                IS.Echo("aMob type: " + aMob.Type);
                IS.Echo("Nearest MOB: " + aMob.Name);
                aMob.Target();
                aMob.Face();
                LS.ExecuteCommand("cast Rend");
            }
        }
    }

    public class EqMe : EqCharacter
    {
        public EqMe()
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Me"))
        {
        }
    }

    public class EqAltability : LavishScriptAPI.LavishScriptObject
    {
        public EqAltability()
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Altability"))
        {
        }
        public int AARankRequired
        {
            get { return GetMember<int>("AARankRequired"); }
        }
        public int Cost
        {
            get { return GetMember<int>("Cost"); }
        }
        public string Description
        {
            get { return GetMember<string>("Description"); }
        }
        public int ID
        {
            get { return GetMember<int>("ID"); }
        }
        public int MaxRank
        {
            get { return GetMember<int>("MaxRank"); }
        }
        public int MinLevel
        {
            get { return GetMember<int>("MinLevel"); }
        }
        public string Name
        {
            get { return GetMember<string>("Name"); }
        }
        public int RequiresAbilityPoints
        {
            get { return GetMember<int>("RequiresAbilityPoints"); }
        }
        public int ReuseTime
        {
            get { return GetMember<int>("ReuseTime"); }
        }
        public string ShortName
        {
            get { return GetMember<string>("ShortName"); }
        }
        public int Type
        {
            get { return GetMember<int>("Type"); }
        }
    }

    public class EqBuff : LavishScriptAPI.LavishScriptObject
    {
        public EqBuff()
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Buff"))
        {
        }
        public int ID
        {
            get { return GetMember<int>("ID"); }
        }
        public int Level
        {
            get { return GetMember<int>("Level"); }
        }
        public float Mod
        {
            get { return GetMember<float>("Mod"); }
        }
    }

    public class EqCharacter : EqSpawn
    {
        public EqCharacter()
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Character"))
        {
        }
        public EqCharacter(LavishScriptAPI.LavishScriptObject lavishObj)
            : base(lavishObj)
        {
        }

        public int AvoidanceBonus
        {
            get { return GetMember<int>("AvoidanceBonus"); }
        }
        public int AccuracyBonus
        {
            get { return GetMember<int>("AccuracyBonus"); }
        }
        public int StunResistBonus
        {
            get { return GetMember<int>("StunResistBonus"); }
        }
        public int StrikeThroughBonus
        {
            get { return GetMember<int>("StrikeThroughBonus"); }
        }
        public int DoTShieldBonus
        {
            get { return GetMember<int>("DoTShieldBonus"); }
        }
        public int AttackBonus
        {
            get { return GetMember<int>("AttackBonus"); }
        }
        public int HPRegenBonus
        {
            get { return GetMember<int>("HPRegenBonus"); }
        }
        public int ManaRegenBonus
        {
            get { return GetMember<int>("ManaRegenBonus"); }
        }
        public int DamageShieldBonus
        {
            get { return GetMember<int>("DamageShieldBonus"); }
        }
        public int AttackSpeed
        {
            get { return GetMember<int>("AttackSpeed"); }
        }
        public int Exp
        {
            get { return GetMember<int>("Exp"); }
        }
        public float PctExp
        {
            get { return GetMember<float>("PctExp"); }
        }
        public int AAExp
        {
            get { return GetMember<int>("AAExp"); }
        }
        public float PctAAExp
        {
            get { return GetMember<float>("PctAAExp"); }
        }
        public int AAPoints
        {
            get { return GetMember<int>("AAPoints"); }
        }
        public int CombatEffectsBonus
        {
            get { return GetMember<int>("CombatEffectsBonus"); }
        }
        public int EnduranceBonus
        {
            get { return GetMember<int>("EnduranceBonus"); }
        }
        public int HPRegen
        {
            get { return GetMember<int>("HPRegen"); }
        }
        public int CurrentMana
        {
            get { return GetMember<int>("CurrentMana"); }
        }
        public int MaxMana
        {
            get { return GetMember<int>("MaxMana"); }
        }
        public int ManaRegen
        {
            get { return GetMember<int>("ManaRegen"); }
        }
        public int PctMana
        {
            get { return GetMember<int>("PctMana"); }
        }
        public int Endurance
        {
            get { return GetMember<int>("Endurance"); }
        }
        public int MaxEndurance
        {
            get { return GetMember<int>("MaxEndurance"); }
        }
        public int PctEndurance
        {
            get { return GetMember<int>("PctEndurance"); }
        }
        public int ShieldingBonus
        {
            get { return GetMember<int>("ShieldingBonus"); }
        }
        public int SpellShieldBonus
        {
            get { return GetMember<int>("SpellShieldBonus"); }
        }
        public bool Grouped
        {
            get { return GetMember<bool>("Grouped"); }
        }
        public int HPBonus
        {
            get { return GetMember<int>("HPBonus"); }
        }
        public int ManaBonus
        {
            get { return GetMember<int>("ManaBonus"); }
        }
        public int GukEarned
        {
            get { return GetMember<int>("GukEarned"); }
        }
        public int MMEarned
        {
            get { return GetMember<int>("MMEarned"); }
        }
        public int RujEarned
        {
            get { return GetMember<int>("RujEarned"); }
        }
        public int TakEarned
        {
            get { return GetMember<int>("TakEarned"); }
        }
        public int MirEarned
        {
            get { return GetMember<int>("MirEarned"); }
        }
        public int LDoNPoints
        {
            get { return GetMember<int>("LDoNPoints"); }
        }
        public int CurrentFavor
        {
            get { return GetMember<int>("CurrentFavor"); }
        }
        public int CareerFavor
        {
            get { return GetMember<int>("CareerFavor"); }
        }
        public bool Combat
        {
            get { return GetMember<bool>("Combat"); }
        }
        public int Dar
        {
            get { return GetMember<int>("Dar"); }
        }
        public bool Moving
        {
            get { return GetMember<bool>("Moving"); }
        }
        public int GroupLeaderExp
        {
            get { return GetMember<int>("GroupLeaderExp"); }
        }
        public float PctGroupLeader
        {
            get { return GetMember<float>("PctGroupLeader"); }
        }
        public int GroupLeaderPoints
        {
            get { return GetMember<int>("GroupLeaderPoints"); }
        }
        public int RaidLeaderExp
        {
            get { return GetMember<int>("RaidLeaderExp"); }
        }
        public float PctRaidLeaderExp
        {
            get { return GetMember<float>("PctRaidLeaderExp"); }
        }
        public int RaidLeaderPoints
        {
            get { return GetMember<int>("RaidLeaderPoints"); }
        }
        public int Platinum
        {
            get { return GetMember<int>("Platinum"); }
        }
        public int Gold
        {
            get { return GetMember<int>("Gold"); }
        }
        public int Silver
        {
            get { return GetMember<int>("Silver"); }
        }
        public int Copper
        {
            get { return GetMember<int>("Copper"); }
        }
        public int PlatinumBank
        {
            get { return GetMember<int>("PlatinumBank"); }
        }
        public int GoldBank
        {
            get { return GetMember<int>("GoldBank"); }
        }
        public int SilverBank
        {
            get { return GetMember<int>("SilverBank"); }
        }
        public int CopperBank
        {
            get { return GetMember<int>("CopperBank"); }
        }
        public int Cash
        {
            get { return GetMember<int>("Cash"); }
        }
        public int CashBank
        {
            get { return GetMember<int>("CashBank"); }
        }
        public int PlatinumShared
        {
            get { return GetMember<int>("PlatinumShared"); }
        }
        public bool Stunned
        {
            get { return GetMember<bool>("Stunned"); }
        }
        public bool RangedReady
        {
            get { return GetMember<bool>("RangedReady"); }
        }
        public bool AltTimerReady
        {
            get { return GetMember<bool>("AltTimerReady"); }
        }
        public int FreeInventory
        {
            get { return GetMember<int>("FreeInventory"); }
        }
        public int LargestFreeInventory
        {
            get { return GetMember<int>("LargestFreeInventory"); }
        }
        public string GroupList
        {
            get { return GetMember<string>("GroupList"); }
        }
        public bool AmIGroupLeader
        {
            get { return GetMember<bool>("AmIGroupLeader"); }
        }
    }

    public class EqGround : LavishScriptAPI.LavishScriptObject
    {
        public EqGround()
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Ground"))
        {
        }
        public int ID
        {
            get { return GetMember<int>("ID"); }
        }
        public float Distance
        {
            get { return GetMember<float>("Distance"); }
        }
        public float X
        {
            get { return GetMember<float>("X"); }
        }
        public float Y
        {
            get { return GetMember<float>("Y"); }
        }
        public float Z
        {
            get { return GetMember<float>("Z"); }
        }
        public float W
        {
            get { return GetMember<float>("W"); }
        }
        public float N
        {
            get { return GetMember<float>("N"); }
        }
        public float U
        {
            get { return GetMember<float>("U"); }
        }
        public bool LineOfSight
        {
            get { return GetMember<bool>("LineOfSight"); }
        }
        public string Name
        {
            get { return GetMember<string>("Name"); }
        }
    }

    public class EqItem : LavishScriptAPI.LavishScriptObject
    {
        public EqItem()
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Item"))
        {
        }
        public int ID
        {
            get { return GetMember<int>("ID"); }
        }
        public string Name
        {
            get { return GetMember<string>("Name"); }
        }
        public bool Lore
        {
            get { return GetMember<bool>("Lore"); }
        }
        public bool NoDrop
        {
            get { return GetMember<bool>("NoDrop"); }
        }
        public bool NoRent
        {
            get { return GetMember<bool>("NoRent"); }
        }
        public bool Magic
        {
            get { return GetMember<bool>("Magic"); }
        }
        public int Value
        {
            get { return GetMember<int>("Value"); }
        }
        public int Size
        {
            get { return GetMember<int>("Size"); }
        }
        public int Weight
        {
            get { return GetMember<int>("Weight"); }
        }
        public int Stack
        {
            get { return GetMember<int>("Stack"); }
        }
        public string Type
        {
            get { return GetMember<string>("Type"); }
        }
        public int Tribute
        {
            get { return GetMember<int>("Tribute"); }
        }
        public int Charges
        {
            get { return GetMember<int>("Charges"); }
        }
        public string LDoNTheme
        {
            get { return GetMember<string>("LDoNTheme"); }
        }
        public string DMGBonus
        {
            get { return GetMember<string>("DMGBonus"); }
        }
        public bool Stackable
        {
            get { return GetMember<bool>("Stackable"); }
        }
        public int Container
        {
            get { return GetMember<int>("Container"); }
        }
        public int Items
        {
            get { return GetMember<int>("Items"); }
        }
        public int BuyPrice
        {
            get { return GetMember<int>("BuyPrice"); }
        }
        public int SellPrice
        {
            get { return GetMember<int>("SellPrice"); }
        }
        public int WornSlots
        {
            get { return GetMember<int>("WornSlots"); }
        }
        public float CastTime
        {
            get { return GetMember<float>("CastTime"); }
        }
        public string EffectType
        {
            get { return GetMember<string>("EffectType"); }
        }
    }

    public class EqPlugin : LavishScriptAPI.LavishScriptObject
    {
        public EqPlugin()
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Plugin"))
        {
        }
        public string Name
        {
            get { return GetMember<string>("Name"); }
        }
    }

    public class EqSkill : LavishScriptAPI.LavishScriptObject
    {
        public EqSkill()
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Skill"))
        {
        }
        public string Name
        {
            get { return GetMember<string>("Name"); }
        }
        public int ID
        {
            get { return GetMember<int>("ID"); }
        }
        public float Accuracy
        {
            get { return GetMember<float>("Accuracy"); }
        }
        public int ReuseTime
        {
            get { return GetMember<int>("ReuseTime"); }
        }
        public bool AltTimer
        {
            get { return GetMember<bool>("AltTimer"); }
        }
        public int MinLevel
        {
            get { return GetMember<int>("MinLevel"); }
        }
        public int StartingSkill
        {
            get { return GetMember<int>("StartingSkill"); }
        }
        public int SkillCapPre50
        {
            get { return GetMember<int>("SkillCapPre50"); }
        }
        public int SkillCapPost50
        {
            get { return GetMember<int>("SkillCapPost50"); }
        }
    }

    public class EqSpawn : LavishScriptAPI.LavishScriptObject
    {
        public EqSpawn()
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Spawn"))
        {
        }
        public EqSpawn(params string[] search)
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Spawn", search))
        {
        }
        public EqSpawn(LavishScriptAPI.LavishScriptObject lavishObj)
            : base(lavishObj)
        {
        }

        public void Target()
        {
            ExecuteMethod("Target");
        }

        public void Face()
        {
            ExecuteMethod("Face");
        }

        public void LeftClick()
        {
            ExecuteMethod("LeftClick");
        }

        public void RightClick()
        {
            ExecuteMethod("RightClick");
        }

        public EqSpawn NearestSpawn(params string[] search)
        {
            return new EqSpawn(GetMember("NearestSpawn", search));
        }

        public int AARank
        {
            get { return GetMember<int>("AARank"); }
        }
        public string AATitle
        {
            get { return GetMember<string>("AATitle"); }
        }
        public bool AFK
        {
            get { return GetMember<bool>("AFK"); }
        }
        public int Animation
        {
            get { return GetMember<int>("Animation"); }
        }
        public bool Anonymous
        {
            get { return GetMember<bool>("Anonymous"); }
        }
        public bool Assist
        {
            get { return GetMember<bool>("Assist"); }
        }
        public bool Binding
        {
            get { return GetMember<bool>("Binding"); }
        }
        public string CleanName
        {
            get { return GetMember<string>("CleanName"); }
        }
        public string ConColor
        {
            get { return GetMember<string>("ConColor"); }
        }
        public int CurrentHPs
        {
            get { return GetMember<int>("CurrentHPs"); }
        }
        public float DistanceX
        {
            get { return GetMember<float>("DistanceX"); }
        }
        public float DistanceY
        {
            get { return GetMember<float>("DistanceY"); }
        }
        public float DistanceZ
        {
            get { return GetMember<float>("DistanceZ"); }
        }
        public float Distance
        {
            get { return GetMember<float>("Distance"); }
        }
        public float Distance3D
        {
            get { return GetMember<float>("Distance3D"); }
        }
        public float DistancePredict
        {
            get { return GetMember<float>("DistancePredict"); }
        }
        public float DistanceW
        {
            get { return GetMember<float>("DistanceW"); }
        }
        public float DistanceN
        {
            get { return GetMember<float>("DistanceN"); }
        }
        public float DistanceU
        {
            get { return GetMember<float>("DistanceU"); }
        }
        public bool Ducking
        {
            get { return GetMember<bool>("Ducking"); }
        }
        public bool FeetWet
        {
            get { return GetMember<bool>("FeetWet"); }
        }
        public bool Feigning
        {
            get { return GetMember<bool>("Feigning"); }
        }
        public string Gender
        {
            get { return GetMember<string>("Gender"); }
        }
        public bool GM
        {
            get { return GetMember<bool>("GM"); }
        }
        public bool GroupLeader
        {
            get { return GetMember<bool>("GroupLeader"); }
        }
        public string Guild
        {
            get { return GetMember<string>("Guild"); }
        }
        public string GuildStatus
        {
            get { return GetMember<string>("GuildStatus"); }
        }
        public float Height
        {
            get { return GetMember<float>("Height"); }
        }
        public int Holding
        {
            get { return GetMember<int>("Holding"); }
        }
        public int Hunger
        {
            get { return GetMember<int>("Hunger"); }
        }
        public int ID
        {
            get { return GetMember<int>("ID"); }
        }
        public string Name
        {
            get { return GetMember<string>("Name"); }
        }
        public int Level
        {
            get { return GetMember<int>("Level"); }
        }
        public float X
        {
            get { return GetMember<float>("X"); }
        }
        public float Y
        {
            get { return GetMember<float>("Y"); }
        }
        public float Z
        {
            get { return GetMember<float>("Z"); }
        }
        public float N
        {
            get { return GetMember<float>("N"); }
        }
        public float W
        {
            get { return GetMember<float>("W"); }
        }
        public float U
        {
            get { return GetMember<float>("U"); }
        }
        public float S
        {
            get { return GetMember<float>("S"); }
        }
        public float E
        {
            get { return GetMember<float>("E"); }
        }
        public float D
        {
            get { return GetMember<float>("D"); }
        }
        public bool LineOfSight
        {
            get { return GetMember<bool>("LineOfSight"); }
        }
        public float Speed
        {
            get { return GetMember<float>("Speed"); }
        }
        public bool Levitating
        {
            get { return GetMember<bool>("Levitating"); }
        }
        public bool Sneaking
        {
            get { return GetMember<bool>("Sneaking"); }
        }
        public string Light
        {
            get { return GetMember<string>("Light"); }
        }
        public string State
        {
            get { return GetMember<string>("State"); }
        }
        public int MaxHPs
        {
            get { return GetMember<int>("MaxHPs"); }
        }
        public int PctHPs
        {
            get { return GetMember<int>("PctHPs"); }
        }
        public string Type
        {
            get { return GetMember<string>("Type"); }
        }
        public string Surname
        {
            get { return GetMember<string>("Surname"); }
        }
        public float MaxRange
        {
            get { return GetMember<float>("MaxRange"); }
        }
        public float MaxRangeTo
        {
            get { return GetMember<float>("MaxRangeTo"); }
        }
        public bool Swimming
        {
            get { return GetMember<bool>("Swimming"); }
        }
        public bool Underwater
        {
            get { return GetMember<bool>("Underwater"); }
        }
        public bool Roleplaying
        {
            get { return GetMember<bool>("Roleplaying"); }
        }
        public float Look
        {
            get { return GetMember<float>("Look"); }
        }
        public bool Invis
        {
            get { return GetMember<bool>("Invis"); }
        }
        public bool LFG
        {
            get { return GetMember<bool>("LFG"); }
        }
        public bool Linkdead
        {
            get { return GetMember<bool>("Linkdead"); }
        }
        public bool Trader
        {
            get { return GetMember<bool>("Trader"); }
        }
        public bool Sitting
        {
            get { return GetMember<bool>("Sitting"); }
        }
        public bool Standing
        {
            get { return GetMember<bool>("Standing"); }
        }
        public bool Invited
        {
            get { return GetMember<bool>("Invited"); }
        }
        public int Mark
        {
            get { return GetMember<int>("Mark"); }
        }
        public int Thirst
        {
            get { return GetMember<int>("Thirst"); }
        }
    }

    public class EqSpell : LavishScriptAPI.LavishScriptObject
    {
        public EqSpell()
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Spell"))
        {
        }
        public int ID
        {
            get { return GetMember<int>("ID"); }
        }
        public string Name
        {
            get { return GetMember<string>("Name"); }
        }
        public int Level
        {
            get { return GetMember<int>("Level"); }
        }
        public string Skill
        {
            get { return GetMember<string>("Skill"); }
        }
        public int Mana
        {
            get { return GetMember<int>("Mana"); }
        }
        public int ResistAdj
        {
            get { return GetMember<int>("ResistAdj"); }
        }
        public float Range
        {
            get { return GetMember<float>("Range"); }
        }
        public float AERange
        {
            get { return GetMember<float>("AERange"); }
        }
        public float PushBack
        {
            get { return GetMember<float>("PushBack"); }
        }
        public float CastTime
        {
            get { return GetMember<float>("CastTime"); }
        }
        public float FizzleTime
        {
            get { return GetMember<float>("FizzleTime"); }
        }
        public float RecoveryTime
        {
            get { return GetMember<float>("RecoveryTime"); }
        }
        public float MyCastTime
        {
            get { return GetMember<float>("MyCastTime"); }
        }
        public float RecastTime
        {
            get { return GetMember<float>("RecastTime"); }
        }
        public string SpellType
        {
            get { return GetMember<string>("SpellType"); }
        }
        public string TargetType
        {
            get { return GetMember<string>("TargetType"); }
        }
        public string ResistType
        {
            get { return GetMember<string>("ResistType"); }
        }
        public string CastOnYou
        {
            get { return GetMember<string>("CastOnYou"); }
        }
        public string CastOnAnother
        {
            get { return GetMember<string>("CastOnAnother"); }
        }
    }

    public class EqSwitch : LavishScriptAPI.LavishScriptObject
    {
        public EqSwitch()
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Switch"))
        {
        }
        public int ID
        {
            get { return GetMember<int>("ID"); }
        }
        public float Distance
        {
            get { return GetMember<float>("Distance"); }
        }
        public float X
        {
            get { return GetMember<float>("X"); }
        }
        public float Y
        {
            get { return GetMember<float>("Y"); }
        }
        public float Z
        {
            get { return GetMember<float>("Z"); }
        }
        public float W
        {
            get { return GetMember<float>("W"); }
        }
        public float N
        {
            get { return GetMember<float>("N"); }
        }
        public float U
        {
            get { return GetMember<float>("U"); }
        }
        public bool LineOfSight
        {
            get { return GetMember<bool>("LineOfSight"); }
        }
        public float DefaultX
        {
            get { return GetMember<float>("DefaultX"); }
        }
        public float DefaultY
        {
            get { return GetMember<float>("DefaultY"); }
        }
        public float DefaultZ
        {
            get { return GetMember<float>("DefaultZ"); }
        }
        public float DefaultW
        {
            get { return GetMember<float>("DefaultW"); }
        }
        public float DefaultN
        {
            get { return GetMember<float>("DefaultN"); }
        }
        public float DefaultU
        {
            get { return GetMember<float>("DefaultU"); }
        }
        public bool Open
        {
            get { return GetMember<bool>("Open"); }
        }
        public string Name
        {
            get { return GetMember<string>("Name"); }
        }
    }

    public class EqZone : LavishScriptAPI.LavishScriptObject
    {
        public EqZone()
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Zone"))
        {
        }
        public int ID
        {
            get { return GetMember<int>("ID"); }
        }
        public string Name
        {
            get { return GetMember<string>("Name"); }
        }
        public string ShortName
        {
            get { return GetMember<string>("ShortName"); }
        }
    }

    public class EqClass : LavishScriptAPI.LavishScriptObject
    {
        public EqClass()
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Class"))
        {
        }
        public bool CanCast
        {
            get { return GetMember<bool>("CanCast"); }
        }
        public bool ClericType
        {
            get { return GetMember<bool>("ClericType"); }
        }
        public bool DruidType
        {
            get { return GetMember<bool>("DruidType"); }
        }
        public int ID
        {
            get { return GetMember<int>("ID"); }
        }
        public string Name
        {
            get { return GetMember<string>("Name"); }
        }
        public bool NecromancerType
        {
            get { return GetMember<bool>("NecromancerType"); }
        }
        public bool PetClass
        {
            get { return GetMember<bool>("PetClass"); }
        }
        public bool PureCaster
        {
            get { return GetMember<bool>("PureCaster"); }
        }
        public bool ShamanType
        {
            get { return GetMember<bool>("ShamanType"); }
        }
        public string ShortName
        {
            get { return GetMember<string>("ShortName"); }
        }
    }

    public class EqCorpse : LavishScriptAPI.LavishScriptObject
    {
        public EqCorpse()
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Corpse"))
        {
        }
        public int Items
        {
            get { return GetMember<int>("Items"); }
        }
        public bool Open
        {
            get { return GetMember<bool>("Open"); }
        }
    }

    public class EqDeity : LavishScriptAPI.LavishScriptObject
    {
        public EqDeity()
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Deity"))
        {
        }
        public int ID
        {
            get { return GetMember<int>("ID"); }
        }
        public string Name
        {
            get { return GetMember<string>("Name"); }
        }
        public string Team
        {
            get { return GetMember<string>("Team"); }
        }
    }

    public class EqHeading : LavishScriptAPI.LavishScriptObject
    {
        public EqHeading()
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Heading"))
        {
        }
        public int Clock
        {
            get { return GetMember<int>("Clock"); }
        }
        public float Degrees
        {
            get { return GetMember<float>("Degrees"); }
        }
        public float DegreesCCW
        {
            get { return GetMember<float>("DegreesCCW"); }
        }
        public string Name
        {
            get { return GetMember<string>("Name"); }
        }
        public string ShortName
        {
            get { return GetMember<string>("ShortName"); }
        }
    }

    public class EqInvslot : LavishScriptAPI.LavishScriptObject
    {
        public EqInvslot()
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Invslot"))
        {
        }
        public int ID
        {
            get { return GetMember<int>("ID"); }
        }
        public int Slot
        {
            get { return GetMember<int>("Slot"); }
        }
        public string Name
        {
            get { return GetMember<string>("Name"); }
        }
    }

    public class EqTicks : LavishScriptAPI.LavishScriptObject
    {
        public EqTicks()
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Ticks"))
        {
        }
        public int Hours
        {
            get { return GetMember<int>("Hours"); }
        }
        public int Minutes
        {
            get { return GetMember<int>("Minutes"); }
        }
        public int Seconds
        {
            get { return GetMember<int>("Seconds"); }
        }
        public string Time
        {
            get { return GetMember<string>("Time"); }
        }
        public int TotalMinutes
        {
            get { return GetMember<int>("TotalMinutes"); }
        }
        public int TotalSeconds
        {
            get { return GetMember<int>("TotalSeconds"); }
        }
        public int Ticks
        {
            get { return GetMember<int>("Ticks"); }
        }
        public string TimeHMS
        {
            get { return GetMember<string>("TimeHMS"); }
        }
    }

    public class EqRace : LavishScriptAPI.LavishScriptObject
    {
        public EqRace()
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Race"))
        {
        }
        public int ID
        {
            get { return GetMember<int>("ID"); }
        }
        public string Name
        {
            get { return GetMember<string>("Name"); }
        }
    }

    public class EqRaidmember : LavishScriptAPI.LavishScriptObject
    {
        public EqRaidmember()
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Raidmember"))
        {
        }
        public int Group
        {
            get { return GetMember<int>("Group"); }
        }
        public bool GroupLeader
        {
            get { return GetMember<bool>("GroupLeader"); }
        }
        public int Level
        {
            get { return GetMember<int>("Level"); }
        }
        public bool Looter
        {
            get { return GetMember<bool>("Looter"); }
        }
        public string Name
        {
            get { return GetMember<string>("Name"); }
        }
        public bool RaidLeader
        {
            get { return GetMember<bool>("RaidLeader"); }
        }
    }

    public class EqCurrentzone : LavishScriptAPI.LavishScriptObject
    {
        public EqCurrentzone()
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Currentzone"))
        {
        }
        public float Gravity
        {
            get { return GetMember<float>("Gravity"); }
        }
        public int ID
        {
            get { return GetMember<int>("ID"); }
        }
        public float MinClip
        {
            get { return GetMember<float>("MinClip"); }
        }
        public float MaxClip
        {
            get { return GetMember<float>("MaxClip"); }
        }
        public string Name
        {
            get { return GetMember<string>("Name"); }
        }
        public string ShortName
        {
            get { return GetMember<string>("ShortName"); }
        }
        public int SkyType
        {
            get { return GetMember<int>("SkyType"); }
        }
        public int Type
        {
            get { return GetMember<int>("Type"); }
        }
    }

    public class EqMacroquest : LavishScriptAPI.LavishScriptObject
    {
        public EqMacroquest()
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Macroquest"))
        {
        }
        public string Error
        {
            get { return GetMember<string>("Error"); }
        }
        public string GameState
        {
            get { return GetMember<string>("GameState"); }
        }
        public string LastCommand
        {
            get { return GetMember<string>("LastCommand"); }
        }
        public string LastTell
        {
            get { return GetMember<string>("LastTell"); }
        }
        public string LoginName
        {
            get { return GetMember<string>("LoginName"); }
        }
        public int MouseX
        {
            get { return GetMember<int>("MouseX"); }
        }
        public int MouseY
        {
            get { return GetMember<int>("MouseY"); }
        }
        public string MQ2DataError
        {
            get { return GetMember<string>("MQ2DataError"); }
        }
        public int Running
        {
            get { return GetMember<int>("Running"); }
        }
        public string Server
        {
            get { return GetMember<string>("Server"); }
        }
        public string SyntaxError
        {
            get { return GetMember<string>("SyntaxError"); }
        }
    }

    public class EqMerchant : LavishScriptAPI.LavishScriptObject
    {
        public EqMerchant()
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Merchant"))
        {
        }
        public int Items
        {
            get { return GetMember<int>("Items"); }
        }
        public float Markup
        {
            get { return GetMember<float>("Markup"); }
        }
        public bool Open
        {
            get { return GetMember<bool>("Open"); }
        }
    }

    public class EqRaid : LavishScriptAPI.LavishScriptObject
    {
        public EqRaid()
            : base(LavishScriptAPI.LavishScript.Objects.GetObject("Raid"))
        {
        }
        public float AverageLevel
        {
            get { return GetMember<float>("AverageLevel"); }
        }
        public int Looters
        {
            get { return GetMember<int>("Looters"); }
        }
        public int LootType
        {
            get { return GetMember<int>("LootType"); }
        }
        public int Members
        {
            get { return GetMember<int>("Members"); }
        }
        public int TotalLevels
        {
            get { return GetMember<int>("TotalLevels"); }
        }
    }

}

Amadeus
The Maestro
The Maestro
Posts: 2036
Joined: Sat Jun 29, 2002 3:51 pm

Post by Amadeus » Mon Aug 20, 2007 2:03 am

With the wrappers we do for my extensions, we also create a main "Extension" class that provides easy wrapping of the TLOs, so you can just make one "Extension" class object, and then have access to everything from there.

For example, here is a VERY small snippet:

Code: Select all

namespace Vanguard.ISXVG
{
    public class Extension
    {
        public Extension()
        {
        }

        public Character Me()
        {
                
            LavishScriptObject Obj = LavishScript.Objects.GetObject("Me");
            return new Character(Obj);
        }
        public Radar Radar(int Index)
        {
            LavishScriptObject Obj = LavishScript.Objects.GetObject("Radar", Index.ToString());
            return new Radar(Obj);
        }

        public Radar Radar(string Name)
        {
            LavishScriptObject Obj = LavishScript.Objects.GetObject("Radar",Name);
            return new Radar(Obj);
        }

        public Radar Radar()
        {
            LavishScriptObject Obj = LavishScript.Objects.GetObject("Radar");
            return new Radar(Obj);
        }

       // etc.. for all TLOs
    }
}

Code: Select all

namespace Vanguard.ISXVG
{
    public class Character : LavishScriptObject
    {
        public Character() 
            : base(LavishScript.Objects.GetObject("Me"))
        {
        }

        public Character(LavishScriptObject Copy) 
            : base(Copy)
        {
        }

        public string FName
        {
            get 
            { 
                return GetMember<string>("FName"); 
            }
        }

        // etc... for remainder of class
    }
}

Code: Select all

namespace Vanguard.ISXVG
{
    public class Radar : LavishScriptObject
    {

        public Radar(LavishScriptObject Obj)
            : base(Obj)
        {
        }

        public Radar(params string[] Args)
            : base(LavishScript.Objects.GetObject("Radar", Args))
        {
        }

        public Radar(int Index)
            : base(LavishScript.Objects.GetObject("Radar", Index.ToString()))
        {
        }

        public Radar()
            : base(LavishScript.Objects.GetObject("Radar", "1"))
        {
        }

        public bool ShowingMe
        {
            get
            {
                return GetMember<bool>("ShowingMe");
            }
        }
        // etc...
    }
}
...and etc...

Each class (Datatype) gets it's own .cs file and then there is an Extension.cs which basically just wraps up all the TLOs similar to my first paste here, and then there is one for Events. I don't think ISXEQ has any events, but if it does let me know and I'll show you the best way to deal with that.