Пример #1
0
        /// <summary>
        /// Lit la liste des objets du jeu
        /// </summary>
        private static void ReadObjectList()
        {
            var currentObject = new PObject(FirstObject);

            //var currentObject = FirstObject;
            //var nextObject = FirstObject;

            while (currentObject.BaseAddress != uint.MinValue && currentObject.BaseAddress % 2 == uint.MinValue)
            {
                if (currentObject.GUID == LocalGUID)
                {
                    MyPlayer.BaseAddress = currentObject.BaseAddress;
                }

                if (!ObjectDictionary.ContainsKey(currentObject.GUID))
                {
                    PObject obj = null;
                    // Add the object based on it's *actual* type. Note: WoW's Object descriptors for OBJECT_FIELD_TYPE
                    // is a bitmask. We want to use the type at 0x14, as it's an 'absolute' type.

                    /* switch (currentObject.Type)
                     * {
                     *  // Belive it or not, the base Object class is hardly used in WoW.
                     *  case (int)Constants.ObjectType.Object:
                     *      obj = new PObject(currentObject.BaseAddress);
                     *      break;
                     *  case (int)Constants.ObjectType.Unit:
                     *      obj = new PUnit(currentObject.BaseAddress);
                     *      break;
                     *  case (int)Constants.ObjectType.Player:
                     *      obj = new PPlayer(currentObject.BaseAddress);
                     *      break;
                     *  case (int)Constants.ObjectType.GameObject:
                     *      obj = new PGameObject(currentObject.BaseAddress);
                     *      break;
                     *  case (int)Constants.ObjectType.Item:
                     *      obj = new PItem(currentObject.BaseAddress);
                     *      break;
                     *  case (int)Constants.ObjectType.Container:
                     *      obj = new PContainer(currentObject.BaseAddress);
                     *      break;
                     *  // These two aren't used in most bots, as they're fairly pointless.
                     *  // They are AI and area triggers for NPCs handled by the client itself.
                     *  case (int)Constants.ObjectType.AiGroup:
                     *  case (int)Constants.ObjectType.AreaTrigger:
                     *      break;
                     * } */
                    if (obj != null)
                    {
                        ObjectDictionary.Add(currentObject.GUID, obj);
                    }
                }
                else
                {
                    ObjectDictionary[currentObject.GUID].BaseAddress = currentObject.BaseAddress;
                }

                currentObject.BaseAddress = Wow.ReadUInt(currentObject.BaseAddress + (uint)Common.Offsets.ObjectManager.NextObject);
            }
        }
Пример #2
0
    void OnEnable()
    {
        store = (ObjectDictionary <TKey, TValue>)target;

        keysProperty   = serializedObject.FindProperty("keys");
        valuesProperty = serializedObject.FindProperty("values");
    }
Пример #3
0
        public static void Refresh()
        {
            // Remove invalid objects.
            foreach (var o in ObjectDictionary)
            {
                o.Value.UpdateBaseAddress(uint.MinValue);
            }

            // Fill the new list.
            ReadObjectList();

            // Clear out old references.
            List <ulong> toRemove = (from o in ObjectDictionary
                                     where !o.Value.IsValid
                                     select o.Key).ToList();

            foreach (ulong guid in toRemove)
            {
                ObjectDictionary.Remove(guid);
            }

            // All done! Just make sure we pass up a valid list to the ObjectList.
            ObjectList = (from o in ObjectDictionary
                          where o.Value.IsValid
                          select o.Value).ToList();
        }
Пример #4
0
        ///////////////////////////////////////////////////////////////////////

        internal CallFrame(
            long frameId,
            long frameLevel,
            string name,
            ObjectDictionary tags,
            int index,
            int level,
            CallFrameFlags flags,
            IClientData auxiliaryData,
            IClientData resolveData,
            IClientData extraData,
            ICallFrame other,
            ICallFrame previous,
            ICallFrame next
            )
            : this(frameId, frameLevel, name, tags, index, level, flags,
                   null, auxiliaryData, resolveData, null, null, null,
                   null, false, false)
        {
            //
            // NOTE: Share the variables of this call frame with the original
            //       one.
            //
            this.other    = other;
            this.previous = previous;
            this.next     = next;
        }
Пример #5
0
        /// <summary>
        /// Pulses the ObjectManager, refreshing any objects it holds.
        /// </summary>
        public static void Pulse()
        {
            lock (_objPulse)
            {
                if (CurrentManager == IntPtr.Zero)
                {
                    Initialize(WowProcess);
                }

                foreach (var wowObject in ObjectDictionary)
                {
                    wowObject.Value.BaseAddress = IntPtr.Zero;
                }

                ReadObjectList();

                var remove =
                    ObjectDictionary.Where(o => o.Value.BaseAddress == IntPtr.Zero).Select(o => o.Key).ToArray();

                if (Me.BaseAddress == IntPtr.Zero || remove.Length == ObjectDictionary.Count)
                {
                    InvokePulsed(false);
                    return;
                }

                foreach (var guid in remove)
                {
                    ObjectDictionary.Remove(guid);
                }

                Objects = ObjectDictionary.Values.ToList();

                InvokePulsed(true);
            }
        }
Пример #6
0
    public void Initialize()
    {
        BigBoss.Debug.w(Logs.Main, "Starting Data Manager");
        NPCs              = new NPCDictionary <NPC, NPCInstance>();
        Items             = new ItemDictionary();
        Materials         = new ObjectDictionary <MaterialType>();
        PlayerProfessions = new ProfessionTitles();
        Strings           = new Dictionary <string, string>();
        LeveledItems      = new ObjectDictionary <LeveledItemList> ();

        List <UnityEngine.Object> files = new List <UnityEngine.Object>();

        files.AddRange(Resources.LoadAll("XML", typeof(TextAsset)));
        files.AddRange(Resources.LoadAll("XML/NPCs", typeof(TextAsset)));
        files.AddRange(Resources.LoadAll("XML/Strings", typeof(TextAsset)));
        files.AddRange(Resources.LoadAll("XML/Items", typeof(TextAsset)));
        files.AddRange(Resources.LoadAll("XML/LeveledLists", typeof(TextAsset)));

        foreach (UnityEngine.Object file in files)
        {
            #region DEBUG
            if (BigBoss.Debug.logging(Logs.XML))
            {
                BigBoss.Debug.w(Logs.XML, "Parsing " + file.name + ".xml");
            }
            #endregion
            ParseXML((file as TextAsset).text);
        }
    }
Пример #7
0
        private int CommandAssign(string line, int index, TemplateContext tc, string commandname, string param)
        {
            ObjectDictionary args     = ObjectDictionary.FromString(param);
            string           variable = null;

            if (args.ContainsKey("0"))
            {
                variable = args["0"].ToString();
            }
            else if (args.ContainsKey("var"))
            {
                variable = args["var"].ToString();
            }

            string value = null;

            if (args.ContainsKey("1"))
            {
                value = args["1"].ToString();
            }
            else if (args.ContainsKey("value"))
            {
                value = args["value"].ToString();
            }

            if ((variable == null) || (value == null))
            {
                LOG_ERR(string.Format("Error: Invalid syntax, should be '{0}{1} var-name expression{2}'", m_commandprefix, commandname, m_commandpostfix));
                return(index);
            }
            tc.dict[variable] = GetExpr(tc.dict, value);
            return(index);
        }
Пример #8
0
        private int CommandDef(string line, int index, TemplateContext tc, string commandname, string param)
        {
            string contents;

            index = Capture(line, index, m_commandprefix + commandname, m_commandprefix + "end" + commandname + m_commandpostfix, out contents);
            ObjectDictionary args     = ObjectDictionary.FromString(param);
            string           variable = null;

            if (args.ContainsKey("0"))
            {
                variable = args["0"].ToString();
            }
            else if (args.ContainsKey("var"))
            {
                variable = args["var"].ToString();
            }

            if (string.IsNullOrEmpty(variable))
            {
                LOG_ERR(string.Format("Error: Invalid syntax, should be '{0}{1} var-name{2}'", m_commandprefix, commandname, m_commandpostfix));
                return(index);
            }
            tc.dict[variable] = contents;
            return(index);
        }
Пример #9
0
    static void LoadObjects()
    {
        //not tested on real device yet

        //Items
        DirectoryInfo _info = new DirectoryInfo("Assets/Scripts/Lua/Items");

        FileInfo[] _files = _info.GetFiles("*.txt");
        for (int i = 0; i < _files.Length; i++)
        {
            string     _sName = _files[i].Name.Split('.')[0];
            GameObject obj    = new GameObject("Item");
            obj.AddComponent <SphereCollider>();
            obj.GetComponent <SphereCollider>().isTrigger = true;
            obj.GetComponent <SphereCollider>().radius    = 1.0f;
            obj.AddComponent <Item>();
            obj.GetComponent <Item>().m_LuaScript = _sName;
            obj.GetComponent <Item>().InitFromLuaFile();
            ObjectDictionary.GetItemDic().AddObject(_sName, obj);
            obj.transform.position += new Vector3(0, 0, 10000);
        }

        //Projectiles,to modify..........
//         _info = new DirectoryInfo("Assets/Resources/Prefabs/Projectiles");
//         _files = _info.GetFiles("*.prefab");
//         for (int i = 0; i < _files.Length; i++) {
//             string _sName = _files[i].Name.Split('.')[0];
//             GameObject _obj = (GameObject)Resources.Load("Prefabs/Projectiles/" + _sName);
//             _obj = Instantiate(_obj);
//             ObjectDictionary.GetProjectileDic().AddObject(_sName, _obj);
//         }
    }
Пример #10
0
        private int CommandExtract(string line, int index, TemplateContext tc, string commandname, string param)
        {
            ObjectDictionary args     = ObjectDictionary.FromString(param);
            string           variable = null;

            if (args.ContainsKey("0"))
            {
                variable = args["0"].ToString();
            }
            else if (args.ContainsKey("var"))
            {
                variable = args["var"].ToString();
            }

            if (string.IsNullOrEmpty(variable))
            {
                LOG_ERR(string.Format("Error: Invalid syntax, should be '{0}{1} var-name{2}'", m_commandprefix, commandname, m_commandpostfix));
                return(index);
            }
            object obj = tc.dict.GetObject(variable);

            if (obj == null)
            {
                LOG_ERR(string.Format("Error: Object {0} is not assigned.", variable));
                return(index);
            }
            Dispatch(tc, obj.ToString());
            return(index);
        }
Пример #11
0
 /// <summary>
 /// Make sure that properties decorated with an ignorable
 /// custom attribute are NOT included for serialization.
 /// </summary>
 /// <param name="obj">The object to scan.</param>
 /// <returns>
 /// An initialized instance of the <see cref="ObjectDictionary"/> class if
 /// there are properties to be ignored; otherwise, <paramref name="obj"/>.
 /// </returns>
 public static object RemoveIgnoredPropertiesFromObjectToBeSerialized(this object obj)
 {
     if (obj != null && obj.GetType().TryGetMetadata(out var metadata))
     {
         var dic       = new ObjectDictionary(obj);
         var different = false;
         foreach (var group in metadata)
         {
             foreach (var item in group.Items)
             {
                 var attr = item.Attribute;
                 var name = attr.GetProperty().Name;
                 if (attr.Ignore && dic.ContainsKey(name))
                 {
                     dic.Remove(name);
                     different = true;
                 }
             }
         }
         if (different)
         {
             return(dic);
         }
     }
     return(obj);
 }
Пример #12
0
        ///////////////////////////////////////////////////////////////////////

        public virtual ReturnCode ToDictionary(
            string pattern,
            bool noCase,
            ref ObjectDictionary dictionary,
            ref Result error
            )
        {
            if (dictionary == null)
            {
                dictionary = new ObjectDictionary();
            }

            foreach (KeyValuePair <TKey, TValue> pair in this)
            {
                string key = StringOps.GetStringFromObject(pair.Key);

                if ((pattern == null) ||
                    StringOps.Match(null, MatchMode.Glob, key, pattern, noCase))
                {
                    dictionary[key] = pair.Value; /* MERGE */
                }
            }

            return(ReturnCode.Ok);
        }
Пример #13
0
        internal static void Pulse()
        {
            while (!Closing)
            {
                lock (Locker)
                {
                    // Remove invalid objects.
                    foreach (var o in ObjectDictionary)
                    {
                        o.Value.UpdateBaseAddress(uint.MinValue);
                    }

                    // Fill the new list.
                    ReadObjectList();

                    // Clear out old references.
                    List <ulong> toRemove = (from o in ObjectDictionary
                                             where !o.Value.IsValid
                                             select o.Key).ToList();
                    foreach (ulong guid in toRemove)
                    {
                        ObjectDictionary.Remove(guid);
                    }

                    // All done! Just make sure we pass up a valid list to the ObjectList.
                    ObjectList = (from o in ObjectDictionary
                                  where o.Value.IsValid
                                  select o.Value).ToList();
                }
                Thread.Sleep(700);
            }
        }
Пример #14
0
        /// <summary>
        /// Call a standard API to run a model on a single image or other input, such as text file. Returns raw bytes of the output, such as JPEG data.
        /// </summary>
        /// <param name="model">The name of the model to run.</param>
        /// <param name="inputs_and_options">An anonymous object containing the inputs and options needed by the model, such as "image" or "style"</param>
        /// <returns>Byte array representing the output of the model, typically in JPEG format.</returns>
        public byte[] callStandardApiWithBinaryResponse(String model, Object inputs_and_options)
        {
            Dictionary <String, object> options = new ObjectDictionary(inputs_and_options);

            options["send_output_binary"] = "1";
            return(bytesApiCallMultipartForm(url_path: "api/" + model, dataObjectForForm: options));
        }
Пример #15
0
        public static Dictionary <string, object> GetAllUperCaseOf(IConfigurationSection config)
        {
            var result  = new ObjectDictionary();
            var keyDict = config.AsEnumerable(true).ToObjectDictionary();

            return(keyDict.MergeIntoObjectDictionary());
        }
 public SocketRequest(SocketMethod method, string[] parameter)
 {
     Parameter = new ObjectDictionary()
     {
         { "op", method.ToString().ToLower() }, { "args", parameter }
     };
     Method = method;
 }
Пример #17
0
        ///////////////////////////////////////////////////////////////////////

        #region Private Constructors
        private Namespace()
        {
            kind        = IdentifierKind.Namespace;
            id          = AttributeOps.GetObjectId(this);
            children    = new Dictionary <string, INamespace>();
            imports     = new ObjectDictionary();
            exportNames = new StringDictionary();
        }
Пример #18
0
        public void GetAllSecurityGroupsAsync(object context, EventHandler <GetAllSecurityGroupsCompletedEventArgs> action)
        {
            var guid = Guid.NewGuid();

            ObjectDictionary.Add(guid, context);
            GetAllSecurityGroupsCompletedEventHandlers.Add(guid, action);
            Client.GetAllSecurityGroupsAsync(App.Params.SiteUrl, guid);
        }
Пример #19
0
        public void GetPermissionNameForObjectAsync(object context, EventHandler <GetPermissionNameForObjectCompletedEventArgs> action, GlymaSecurableObject securableObject)
        {
            var guid = Guid.NewGuid();

            ObjectDictionary.Add(guid, context);
            GetPermissionNameForObjectCompletedEventHandlers.Add(guid, action);
            Client.GetPermissionNameForObjectAsync(App.Params.SiteUrl, securableObject, guid);
        }
Пример #20
0
 /// <summary>
 ///   テンプレートコマンドの登録
 /// </summary>
 private void RegisterCommand(string name, Command cmd)
 {
     if (m_command == null)
     {
         m_command = new ObjectDictionary(ObjectDictionary.KeyLengthComparer);
     }
     m_command[name] = cmd;
 }
Пример #21
0
        public void SetProjectManagerGroupAssociationsAsync(object context, EventHandler <SetProjectManagerGroupAssociationsCompletedEventArgs> action, GlymaSecurableObject securableObject)
        {
            var guid = Guid.NewGuid();

            ObjectDictionary.Add(guid, context);
            SetProjectManagerGroupAssociationsCompletedEventHandlers.Add(guid, action);
            Client.SetProjectManagerGroupAssociationsAsync(App.Params.SiteUrl, securableObject, guid);
        }
Пример #22
0
        public void UpdateSecurityAssociationsAsync(object context, EventHandler <UpdateSecurityAssociationsCompletedEventArgs> action, ObservableCollection <GlymaSecurityAssociation> updateQueries)
        {
            var guid = Guid.NewGuid();

            ObjectDictionary.Add(guid, context);
            UpdateSecurityAssociationsCompletedEventHandlers.Add(guid, action);
            Client.UpdateSecurityAssociationsAsync(App.Params.SiteUrl, updateQueries, guid);
        }
Пример #23
0
 public static ObjectDictionary GetItemDic()
 {
     if (s_ItemDic == null)
     {
         s_ItemDic = new ObjectDictionary();
     }
     return(s_ItemDic);
 }
Пример #24
0
 public IodineDictionary(ObjectDictionary dict)
     : base(TypeDefinition)
 {
     this.dict = dict;
     SetAttribute("__iter__", new BuiltinMethodCallback((VirtualMachine vm, IodineObject self, IodineObject [] args) => {
         return(GetIterator(vm));
     }, this));
 }
Пример #25
0
 internal WallDike(int type, CsvRwRouteParser.Direction direction, ObjectDictionary LeftObjects, ObjectDictionary RightObjects, bool exists = true)
 {
     Exists       = exists;
     Type         = type;
     Direction    = direction;
     leftObjects  = LeftObjects;
     rightObjects = RightObjects;
 }
Пример #26
0
        public void GetUsersPermissionLevelNameAsync(object context, EventHandler <GetUsersPermissionLevelNameCompletedEventArgs> action)
        {
            var guid = Guid.NewGuid();

            ObjectDictionary.Add(guid, context);
            GetUsersPermissionLevelNameCompletedEventHandlers.Add(guid, action);
            Client.GetUsersPermissionLevelNameAsync(App.Params.SiteUrl, guid);
        }
Пример #27
0
        public void GetSecurityAssociationsAsync(object context, EventHandler <GetSecurityAssociationsCompletedEventArgs> action, ObservableCollection <GlymaSecurityGroup> groups, GlymaSecurableObject securableObject)
        {
            var guid = Guid.NewGuid();

            ObjectDictionary.Add(guid, context);
            GetSecurityAssociationsCompletedEventHandlers.Add(guid, action);
            Client.GetSecurityAssociationsAsync(App.Params.SiteUrl, groups, securableObject, guid);
        }
Пример #28
0
 public static ITree <TNode> NodeAttributes <TNode>(this ITree <TNode> tree, Func <TNode, object> attrs)
 {
     //Contract.Requires( tree != null );
     return(tree.With(o => o.NodeAttributes = n =>
     {
         var aa = attrs(n);
         return aa == null ? null : ObjectDictionary.From(aa).ToDictionary(k => k.Key, k => Convert.ToString(k.Value));
     }));
 }
Пример #29
0
 /// <summary>
 ///   テンプレート変数の値定義
 /// </summary>
 /// <param name="var">変数名</param>
 /// <param name="val">変数の値</param>
 /// <remarks>
 ///   <para>
 ///     変数の値は、ToString()メソッドが定義されている任意のオブジェクト。
 ///
 ///     このオブジェクトがメンバを持つ場合、テンプレート内では
 ///     "変数名.メンバ名"でそのメンバの値を取り出すことができる。
 ///   </para>
 /// </remarks>
 protected void Assign(string var, object val)
 {
     if (m_dict == null)
     {
         m_dict = new ObjectDictionary(ObjectDictionary.KeyLengthComparer);
     }
     m_dict[var] = val;
     //LOG_DEBUG("Assign "+var+"=("+val.GetType().Name+")'"+val.ToString()+"'");
 }
Пример #30
0
        private string GetVariableValue(ObjectDictionary dict, string varparam)
        {
            if (varparam == null)
            {
                return(null);
            }
            bool htmlescape  = false;
            bool quoteescape = false;
            bool urlescape   = false;

            char[]   separators = " \t".ToCharArray();
            string[] p          = varparam.Trim(separators).Split(separators, 2);
            // 最初の要素が変数名。
            if (p[0].EndsWith(":h"))
            {
                p[0]       = p[0].Substring(0, p[0].Length - 2);
                htmlescape = true;
            }
            else if (p[0].EndsWith(":q"))
            {
                p[0]        = p[0].Substring(0, p[0].Length - 2);
                quoteescape = true;
            }
            else if (p[0].EndsWith(":u"))
            {
                p[0]      = p[0].Substring(0, p[0].Length - 2);
                urlescape = true;
            }
            object obj = dict.GetObject(p[0]);

            if (obj == null)
            {
                return(null);
            }
            // アサインされたオブジェクトにパラメータをセットする
            if (p.Length > 1)
            {
                SetParameters(p[0], obj, ObjectDictionary.FromString(p[1]));
            }
            // WebControl用の特例: Nameを自動セットする。
            SetParameterIfNull(p[0], obj, "Name", p[0]);
            // オブジェクトの文字列表現を返す。
            if (htmlescape)
            {
                return(HE(obj.ToString()));
            }
            if (quoteescape)
            {
                return(QE(obj.ToString()));
            }
            if (urlescape)
            {
                return(UE(obj.ToString()));
            }
            return(obj.ToString());
        }
Пример #31
0
       public static ObjectDictionary chatroomNames = new ObjectDictionary();// For rooms created at scenario time ONLY
 
       public static void Clear()
       {
           activeRegionNames = new ObjectDictionary();
           teamNames = new ObjectDictionary();
           ruleNames = new ObjectDictionary();
           scoreNames = new ObjectDictionary();
           speciesNames = new ObjectDictionary();
           unitNames = new ObjectDictionary();
           chatroomNames = new ObjectDictionary();
       }
Пример #32
0
        public Reveal_EventType(pRevealType rEvent)
            : base(rEvent.UnitID, rEvent.Time)
        {
            if (!NameLists.unitNames.ContainsKey(rEvent.UnitID)) throw new ApplicationException("Cannot reveal unknown unit " + rEvent.UnitID);

            if (null != rEvent.EngramRange)
            {
                this.Range = new EngramRange(rEvent.EngramRange);
            }
            this.initialLocation = new LocationType(rEvent.InitialLocation.X,
             rEvent.InitialLocation.Y, rEvent.InitialLocation.Z);


            this.initialState = rEvent.InitialState;
            if ("" == this.initialState)
            {
                this.initialState = "FullyFunctional";
            }
            else
            {
                if (!StatesForUnits.UnitHasState(rEvent.UnitID, rEvent.InitialState)) throw new ApplicationException("Cannot reveal " + rEvent.UnitID + " in initial state " + rEvent.InitialState + ", as state doesn't exist.");
            }


            //        this.Parameters = new ObjectDictionary(rEvent.StartupParameters);
            StateBody thisStartState = StatesForUnits.StateTable[Genealogy.GetBase(this.UnitID)][this.initialState];
            Parameters = thisStartState.Parameters.DeepCopy();
            ObjectDictionary incomingParameters = new ObjectDictionary(rEvent.StartupParameters);
            List<string> KeyList = incomingParameters.GetKeys();
            foreach (string k in KeyList)
            {
                Parameters[k] = incomingParameters[k];
            }
            string initialTag = "";
            if ((null != rEvent.InitialTag))
                initialTag = rEvent.InitialTag;
            Parameters["InitialTag"] = initialTag;
        }
Пример #33
0
 /// construct a scenario event (Overload 2); time is set to 0
 /// </summary>
 /// <param name="unitID">Identifier for a unit</param>
 public ScenarioEventType(string unitID)
 {
     this.UnitID = unitID;
     this.Time = 1;
     this.allUnits.Add(unitID);
     this.parameters = null;
     this.range = null;
 }