Example #1
0
 private static bool SetLeader()
 {
     foreach (PPlayer unit in ObjectManager.GetPlayers)
     {
         if (unit.Name.ToUpper().Equals(LeaderName))
         {
             leader = unit;
             return true;
         }
     }
     return false;
 }
Example #2
0
 public PPlayer ToPlayer(PPlayer obj)
 {
     return(new PPlayer(obj.BaseAddress));
 }
Example #3
0
 private static NameValuePair[] GetPlayerNameValuePairs(PPlayer me)
 {
     var wpUtils = new PPlayerUtils(me.BaseAddress);
     return wpUtils.GetNameValuePairs().ToArray();
 }
Example #4
0
        private static void ReadObjectList()
        {
            var currentObject = new PObject(Memory.Read <uint>(CurrentManager + (uint)Pointers.ObjectManager.FirstObject));

            LocalGUID = Memory.Read <UInt64>(CurrentManager + (uint)Pointers.ObjectManager.LocalGUID);
            while (currentObject.BaseAddress != UInt32.MinValue &&
                   currentObject.BaseAddress % 2 == UInt32.MinValue)
            {
                // Keep the static reference to the local player updated... at all times.
                if (currentObject.GUID == LocalGUID)
                {
                    //MessageBox.Show("Found localplayer! 0x" + currentObject.ToString("X8"));
                    MyPlayer.UpdateBaseAddress(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)
                    {
                        // We have a valid object that isn't in the object list already.
                        // So lets add it.
                        ObjectDictionary.Add(currentObject.GUID, obj);
                    }
                }
                else
                {
                    // The object already exists, just update the pointer.
                    ObjectDictionary[currentObject.GUID].UpdateBaseAddress(currentObject.BaseAddress);
                }
                // We need the next object.
                currentObject.BaseAddress =
                    Memory.Read <uint>(currentObject.BaseAddress + (uint)Pointers.ObjectManager.NextObject);
            }
        }
Example #5
0
 private static void ReadObjectList()
 {
     var currentObject = new PObject(Memory.Read<uint>(CurrentManager + (uint) Pointers.ObjectManager.FirstObject));
     LocalGUID = Memory.Read<UInt64>(CurrentManager + (uint) Pointers.ObjectManager.LocalGUID);
     while (currentObject.BaseAddress != UInt32.MinValue &&
            currentObject.BaseAddress%2 == UInt32.MinValue)
     {
         // Keep the static reference to the local player updated... at all times.
         if (currentObject.GUID == LocalGUID)
         {
             //MessageBox.Show("Found localplayer! 0x" + currentObject.ToString("X8"));
             MyPlayer.UpdateBaseAddress(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)
             {
                 // We have a valid object that isn't in the object list already.
                 // So lets add it.
                 ObjectDictionary.Add(currentObject.GUID, obj);
             }
         }
         else
         {
             // The object already exists, just update the pointer.
             ObjectDictionary[currentObject.GUID].UpdateBaseAddress(currentObject.BaseAddress);
         }
         // We need the next object.
         currentObject.BaseAddress =
             Memory.Read<uint>(currentObject.BaseAddress + (uint) Pointers.ObjectManager.NextObject);
     }
 }