Exemplo n.º 1
0
 public static WoWGameObject ToWoWGameObject(WoWObject obj)
 {
     return(new WoWGameObject(obj.BaseAddress));
 }
Exemplo n.º 2
0
        private static List <WoWObject> GetObjects()
        {
            var objects = new List <WoWObject>();

            try
            {
                var currentObject =
                    new WoWObject(
                        BotManager.Memory.Read <IntPtr>(CurrentManager + (int)Offsets.ObjectManager.FirstObject));

                while (((currentObject.BaseAddress.ToInt64() & 1) == 0) && currentObject.BaseAddress != IntPtr.Zero)
                {
                    switch (currentObject.Type)
                    {
                    case (int)ObjectType.Unit:
                        objects.Add(new WoWUnit(currentObject.BaseAddress));
                        break;

                    case (int)ObjectType.Item:
                        objects.Add(new WoWItem(currentObject.BaseAddress));
                        break;

                    case (int)ObjectType.Container:
                        objects.Add(new WoWContainer(currentObject.BaseAddress));
                        break;

                    case (int)ObjectType.Corpse:
                        objects.Add(new WoWCorpse(currentObject.BaseAddress));
                        break;

                    case (int)ObjectType.Gameobject:
                        objects.Add(new WoWGameObject(currentObject.BaseAddress));
                        break;

                    case (int)ObjectType.Dynamicobject:
                        objects.Add(new WoWDynamicObject(currentObject.BaseAddress));
                        break;

                    case (int)ObjectType.Player:
                        objects.Add(currentObject.Guid == PlayerGuid
                                ? new WoWPlayerMe(currentObject.BaseAddress)
                                : new WoWPlayer(currentObject.BaseAddress));
                        break;

                    default:
                        objects.Add(currentObject);
                        break;
                    }



                    currentObject.BaseAddress =
                        BotManager.Memory.Read <IntPtr>(
                            currentObject.BaseAddress + (int)Offsets.ObjectManager.NextObject);
                }
            }
            catch (AccessViolationException)
            {
            }
            catch (Exception ex)
            {
                Logging.Log(ex);
            }

            return(objects);
        }