示例#1
0
 private void SetBoolean(string command, Boolean value)
 {
     UODLL.SetTop(UOHandle, 0);
     UODLL.PushStrVal(UOHandle, "Set");
     UODLL.PushStrVal(UOHandle, command);
     UODLL.PushBoolean(UOHandle, value);
     UODLL.Execute(UOHandle);
 }
示例#2
0
        //Executes a GameDLL command, Idea taken from jultima http://code.google.com/p/jultima/
        public List <object> _executeCommand(bool ReturnResults, string CommandName, object[] args)
        {
            // Maybe return bool and results as an Out?
            List <object> Results = new List <object>();

            UODLL.SetTop(UOHandle, 0);
            UODLL.PushStrVal(UOHandle, "Call");
            UODLL.PushStrVal(UOHandle, CommandName);
            foreach (var o in args)
            {
                if (o is Int32) // (o.GetType() == typeof(int))
                {
                    UODLL.PushInteger(UOHandle, (int)o);
                }
                else if (o is string)
                {
                    UODLL.PushStrVal(UOHandle, (string)o);
                }
                else if (o is bool)
                {
                    UODLL.PushBoolean(UOHandle, (bool)o);
                }
            }
            if (UODLL.Execute(UOHandle) != 0)
            {
                return(null);
            }
            if (!ReturnResults)
            {
                return(null);
            }
            int objectcnt = UODLL.GetTop(UOHandle);

            for (int i = 1; i <= objectcnt; i++)
            {
                int gettype = UODLL.GetType(UOHandle, 1);
                switch (gettype)
                {
                case 1:
                    Results.Add(UODLL.GetBoolean(UOHandle, i).ToString());

                    break;

                case 3:
                    Results.Add(UODLL.GetInteger(UOHandle, i).ToString());
                    break;

                case 4:
                    Results.Add(Marshal.PtrToStringAnsi(UODLL.GetString(UOHandle, i)));
                    break;

                default:
                    throw new NotImplementedException();
                    break;
                }
            }
            return(Results);
        }
示例#3
0
 public int ScanItems(bool VisibleOnly)
 {
     UODLL.SetTop(UOHandle, 0);
     UODLL.PushStrVal(UOHandle, "Call");
     UODLL.PushStrVal(UOHandle, "ScanItems");
     UODLL.PushBoolean(UOHandle, VisibleOnly);
     if (UODLL.Execute(UOHandle) != 0)
     {
         return(0);
     }
     return(UODLL.GetInteger(UOHandle, 1));
 }