public am_post(Automaton a)
 {
     session = a.session;
     firstname = a.firstname;
     lastname = a.lastname;
     connected = a.connected;
 }
 public override bool Excecute(Automaton am, GridClient client, bool force)
 {
     if (!client.Network.Connected) { result.message = "Not Connected to grid"; return true; }
     Console.WriteLine("[Stand] {0}",client.Self.Stand());
     result.success = true;
     return true;
 }
 public override bool Excecute(Automaton am, GridClient client, bool force)
 {
     if (!client.Network.Connected) { result.message = "Not Connected to grid"; return true; }
     client.Self.Crouch(true);
     result.success = true;
     return true;
 }
 public override bool Excecute(Automaton am, GridClient client, bool force)
 {
     if (!client.Network.Connected) { result.message = "Not Connected to grid"; return true; }
     result.data = am.GetTPOffers();
     result.success = true;
     return true;
 }
 public override bool Excecute(Automaton am, GridClient client, bool force)
 {
     am.ClearChatLog();
     result.success = true;
     result.message = "cleared chat log";
     return true;
 }
        public override bool Excecute(SteelCityAutomaton.Automaton am, OpenMetaverse.GridClient client, bool force)
        {
            if (!client.Network.Connected)
            {
                result.message = "Not Connected to grid"; return(true);
            }
            UUID target;

            result.data = uuid;
            if (UUID.TryParse(uuid, out target))
            {
                Primitive targetPrim = client.Network.CurrentSim.ObjectsPrimitives.Find(
                    delegate(Primitive prim)
                {
                    return(prim.ID == target);
                }
                    );

                if (targetPrim != null)
                {
                    client.Self.Touch(targetPrim.LocalID);
                    result.success = true;
                }
                else
                {
                    result.message = "Couldn't find prim";
                }
            }
            else
            {
                result.message = "Invalid uuid";
            }
            return(true);
        }
 public override bool Excecute(Automaton am, GridClient client, bool force)
 {
     if (!client.Network.Connected) { result.message = "Not Connected to grid"; return true; }
     result.data = user_id;
     if (am.AcceptTPOffer(user_id,false)) result.success = true;
     else result.message = "Unrecognized uuid";
     return true;
 }
 public override bool Excecute(Automaton am, GridClient client, bool force)
 {
     /*
     UUID grp;
     if(UUID.TryParse(group,out grp))
     {
         client.Groups.
     }
     */
     //UUID grp = client.g
     return true;
 }
        public override bool Excecute(Automaton am, GridClient client, bool force)
        {
            if (!client.Network.Connected) { result.message = "Not Connected to grid"; return true; }
            UUID target;
            if (UUID.TryParse(uuid, out target))
            {
                Vector3 location = client.Self.SimPosition;
                List<Primitive> prims = client.Network.CurrentSim.ObjectsPrimitives.FindAll(
                    delegate(Primitive prim)
                    {
                        return (prim.IsAttachment);
                    }
                );

                List<Primitive>p_prims = new List<Primitive>();
                List<Primitive>np_prims = new List<Primitive>();
                foreach (Primitive p in prims)
                {
                    if (p.Properties == null) np_prims.Add(p);
                    else p_prims.Add(p);
                }

                if (np_prims.Count > 0)
                {
                    bool complete = RequestObjectProperties(np_prims, 250, client);
                }

                p_prims.AddRange(np_prims);

                prims = p_prims;

                Dictionary<string, string> objs = new Dictionary<string, string>();

                //List<ObjectBones> objs = new List<ObjectBones>();

                foreach (Primitive p in prims)
                {
                    if(p.Properties != null)
                    {
                        if (p.Properties.OwnerID == target)
                        {
                            objs.Add(p.ID.ToString(), p.Properties.Name);
                        }
                    }
                }

                result.data = objs;
                result.success = true;
            }
            else result.message = "Invalid uuid";
            return true;
        }
 public override bool Excecute(Automaton am, GridClient client, bool force)
 {
     if (message != null && client.Network.Connected)
     {
         client.Self.Chat(message, channel, ChatType.Normal);
         result.success = true;
     }
     else
     {
         result.success = false;
         result.message = message;
     }
     return true;
 }
        public override bool Excecute(SteelCityAutomaton.Automaton am, OpenMetaverse.GridClient client, bool force)
        {
            if (!client.Network.Connected)
            {
                result.message = "Not Connected to grid"; return(true);
            }
            UUID target;

            if (UUID.TryParse(uuid, out target) && amount > 0)
            {
                client.Self.GiveAvatarMoney(target, amount, description);
                result.success = true;
            }
            else
            {
                result.message = "Invalid key or ammount";
            }
            return(true);
        }
 public override bool Excecute(Automaton am, GridClient client, bool force)
 {
     if (!client.Network.Connected) { result.message = "Not Connected to grid"; return true; }
     if (local)
     {
         OpenMetaverse.Vector3 pos = client.Self.SimPosition;
         x += pos.X;
         y += pos.Y;
         z += pos.Z;
     }
     uint regionX, regionY;
     Utils.LongToUInts(client.Network.CurrentSim.Handle, out regionX, out regionY);
     x += (double)regionX;
     y += (double)regionY;
     if (range <= 0) range = 2;
     am.AutoPilot(new Vector3d(x, y, z), range);
     result.success = true;
     return true;
 }
 public override bool Excecute(Automaton am, GridClient client, bool force)
 {
     if (!client.Network.Connected) { result.message = "Not Connected to grid"; return true; }
     if (uuid == null)
     {
         client.Self.SitOnGround();
         result.success = true;
     }
     else
     {
         UUID target;
         if (UUID.TryParse(uuid, out target))
         {
             client.Self.RequestSit(target, Vector3.Zero);
             client.Self.Sit();
             result.success = true;
         }
     }
     return true;
 }
 public override bool Excecute(Automaton am, GridClient client, bool force)
 {
     if (!client.Network.Connected) { result.message = "Not Connected to grid"; return true; }
     string res = string.Empty;
     if(path == null || path.Length < 1)path = "";
     if (filter == null || filter.Length < 1) filter = "";
     path = path.Trim().Trim('/');
     InventoryNode folder = FindFolder(client,path);
     if (folder != null)
     {
         foreach (var f in folder.Nodes.Values)
         {
             if (f.Data is InventoryFolder && !f.Data.Name.StartsWith("."))
             {
                 res += f.Data.Name + ",";
             }
         }
         result.success = true;
         result.data = res.TrimEnd(',');
     }
     else result.message = "Path Doesn't Exist";
     return true;
 }
 public override bool Excecute(Automaton am, GridClient client, bool force)
 {
     UUID scr;
     if (UUID.TryParse(uuid, out scr))
     {
         string msg;
         result.success = am.replyToPermissionRequest(uuid, perms, out msg);
         result.message = msg;
     }
     else result.message = "Invalid UUID";
     return true;
 }
 public RLVManager(Automaton am, GridClient client)
 {
     Enabled = false;
     Client  = client;
     Am      = am;
 }
 public override bool Excecute(Automaton am, GridClient client, bool force)
 {
     UUID target;
     result.success = false;
     if(UUID.TryParse(uuid, out target))
     {
         if (client.Network.Connected)
         {
             if (message != null && message.Length > 0)
             {
                 InstantMessage i = new InstantMessage();
                 i.FromAgentID = target;
                 i.Message = message;
                 am.newIM(i);
                 client.Self.InstantMessage(target, message);
                 result.success = true;
             }
             else
             {
                 result.message = "message null or 0 length [" + message + "]";
             }
         }
         else
         {
             result.message = "not connected";
         }
     }
     else
     {
         result.message = "uuid faised";
     }
     return true;
 }
 public override bool Excecute(Automaton am, GridClient client, bool force)
 {
     result.data = client.Self.ActiveGroup.ToString();
     result.success = true;
     return true;
 }
 public override bool Excecute(Automaton am, GridClient client, bool force)
 {
     if (am.total_dialogs > 0)
     {
         result.success = true;
         result.data = am.get_dialogs();
     }
     else result.message = "No Dialogs";
     return true;
 }
        public override bool Excecute(Dictionary<string, Automaton> automatons,string at)
        {
            if (firstname == null || firstname.Length < 1 || password.Length < 5)
            {
                result.success = false;
                result.data = "bad user/pass";
                return false;
            }
            foreach (var pair in automatons)
            {
                if(firstname.ToLower() == pair.Value.firstname.ToLower() &&
                    lastname.ToLower() == pair.Value.lastname.ToLower())
                {
                    result.success = false;
                    result.data = pair.Key;
                    result.message = "automaton exists";
                    return false;
                }
            }

            if (lastname == null || lastname.Length < 2) lastname = "Resident";
            //#if DEBUG
            //            string session = firstname.ToLower() + "." + lastname.ToLower();
            //#else
            string session = OpenMetaverse.UUID.Random().ToString();
            while (automatons.ContainsKey(at + session)) session = OpenMetaverse.UUID.Random().ToString();
            //#endif
            Automaton am = new Automaton(session, firstname, lastname, password);

            automatons.Add(at + session, am);
            result.data = session;
            result.success = true;
            return true;
        }
 public override bool Excecute(SteelCityAutomaton.Automaton am, OpenMetaverse.GridClient client, bool force)
 {
     result.data    = client.Self.Balance;
     result.success = true;
     return(true);
 }
 public override bool Excecute(Automaton am, GridClient client, bool force)
 {
     result.data = am.GetIMLogFrom(uuid, first);
     if (result.data != null) result.success = true;
     return true;
 }
        public override bool Excecute(Automaton am, GridClient client, bool force)
        {
            if (!client.Network.Connected) { result.message = "Not Connected to grid"; return true; }

            if (x == 0 && y == 0 && z == 0) result.message = "invalid/missing arguements";
            else
            {
                Vector3 newDirection;
                newDirection.X = (float)x;
                newDirection.Y = (float)y;
                newDirection.Z = (float)z;
                client.Self.Movement.TurnToward(newDirection);
                client.Self.Movement.SendUpdate(false);
                result.success = true;
            }
            return true;
        }
 public override bool Excecute(Automaton am, GridClient client, bool force)
 {
     Dictionary<string, int> ims = am.getIMSessions();
     if (ims.Count > 0) result.success = true;
     result.data = ims;
     return true;
 }
 public override bool Excecute(Automaton am, GridClient client, bool force)
 {
     if (!client.Network.Connected) { result.message = "Not Connected to grid"; return true; }
     UUID sound;
     if (UUID.TryParse(uuid, out sound))
     {
         client.Sound.PlaySound(sound);
         result.success = true;
         result.data = sound.ToString();
     }
     else result.message = "Invalid uuid for sound";
     return true;
 }
 public override bool Excecute(Automaton am, GridClient client, bool force)
 {
     result.success = am.Logout();
     return result.success;
 }
 public override bool Excecute(Automaton am, GridClient client, bool force)
 {
     string response = "";
     result.success = am.Login(out response);
     result.data = response;
     return result.success;
 }
 public override bool Excecute(Automaton am, GridClient client, bool force)
 {
     if (am.permission_requests > 0)
     {
         result.success = true;
         result.data = am.getPermissionRequests();
     }
     else result.message = "No Permission Requests";
     return true;
 }
 public override bool Excecute(Automaton am, GridClient client, bool force)
 {
     if (!client.Network.Connected) { result.message = "Not Connected to grid"; return true; }
     am.AutoPilotStop();
     result.success = true;
     return true;
 }
 public override bool Excecute(Automaton am, GridClient client, bool force)
 {
     if (!client.Network.Connected) { result.message = "Not Connected to grid"; return true; }
     UUID anim;
     if (UUID.TryParse(uuid, out anim))
     {
         client.Self.AnimationStop(anim, true);
         result.success = true;
     }
     else result.message = "Invalid UUID";
     return true;
 }
        public override bool Excecute(Automaton am, GridClient client, bool force)
        {
            if (!client.Network.Connected) { result.message = "Not Connected to grid"; return true; }
            List<string> data = new List<string>();

            if (name == null || name == "") name = "texture";
            TextureID = UUID.Zero;

            Console.WriteLine("Loading image " + url);
            byte[] jpeg2k = loadImage(url);
            if (jpeg2k == null)
            {
                Console.WriteLine("Failed to compress image to JPEG2000");
                return true;
            }
            Console.WriteLine("Finished compressing image to JPEG2000, uploading...");
            start = DateTime.Now;
            DoUpload(jpeg2k, name, client);

            if (UploadCompleteEvent.WaitOne(timeout, false))
            {
                if (TextureID != UUID.Zero)
                {
                    result.success = true;
                    data.Add(TextureID.ToString());
                }
                else result.success = false;
                Console.WriteLine(String.Format("Texture upload {0}: {1}", (TextureID != UUID.Zero) ? "succeeded" : "failed",
                    TextureID));
            }
            else result.success = false;
            data.Add(client.Self.Balance.ToString());
            result.data = data;
            return true;
        }
 public virtual bool Excecute(Automaton am, GridClient client, bool force)
 {
     return true;
 }
        public override bool Excecute(Automaton am, GridClient client, bool force)
        {
            if (!client.Network.Connected) { result.message = "Not Connected to grid"; return true; }
            UUID target;
            if (UUID.TryParse(uuid, out target))
            {

                if (message != "ignore" && button_index >= 0)
                {
                    client.Self.ReplyToScriptDialog(channel, button_index, message, target);
                }
                am.clear_dialog(target);
                result.success = true;
            }
            return true;
        }
 public override bool Excecute(Automaton am, GridClient client, bool force)
 {
     result.success = am.wipe_im_session(uuid);
     if (!result.success) result.message = "No im session with : " + uuid;
     return true;
 }