public List <WowObject> getEnemies() { List <WowObject> enemies = new List <WowObject>(); int currObjPtr = objectManager + FIRST_OBJECT; int currObj = MemoryHandler.readInt(currObjPtr); int LocalGUID = 0xC0; Int64 playerGUID = MemoryHandler.readHexAsInt64(objectManager + LocalGUID); while (currObj != 0) { currObj = MemoryHandler.readInt(currObjPtr); WowObject enemy = new WowObject(); enemy.Guid = MemoryHandler.readUInt64((int)(currObj + ObjectOffsets.Guid)); enemy.Type = (short)(MemoryHandler.readUInt32((int)(currObj + ObjectOffsets.Type))); /*enemy.XPos = MemoryHandler.readFloat((int)(currObj + ObjectOffsets.Pos_X)); * enemy.YPos = MemoryHandler.readFloat((int)(currObj + ObjectOffsets.Pos_Y)); * enemy.ZPos = MemoryHandler.readFloat((int)(currObj + ObjectOffsets.Pos_Z)); * enemy.Rotation = MemoryHandler.readFloat((int)(currObj + ObjectOffsets.Rot)); * enemy.CurrentHealth = MemoryHandler.readUint((int)(currObj + ObjectOffsets.Health));*/ if (enemy.Type == 3) { enemy.Name = getMobNameFrmBase(currObj); enemy.Target = MemoryHandler.readHexAsInt64((int)(currObj + ObjectOffsets.Target_GUID)); if (enemy.Target == playerGUID) { HumanoidBot.metElite(enemy); enemies.Add(enemy); } } currObjPtr = currObj + NEXT_OBJECT; } return(enemies); }
public void printTargetData(Position3D playerPos) { while (true) { int currObjPtr = objectManager + FIRST_OBJECT; int currObj = MemoryHandler.readInt(currObjPtr); WowObject target = new WowObject(); Position3D otherPos = new Position3D(0, 0, 0); while (currObj != 0) { currObj = MemoryHandler.readInt(currObjPtr); if (MemoryHandler.readUInt64((int)Globals.CURR_TARGET_GUID) == MemoryHandler.readUInt64((int)(currObj + ObjectOffsets.Guid))) { target.Guid = MemoryHandler.readUInt64((int)(currObj + ObjectOffsets.Guid)); target.Name = getMobNameFrmBase(currObj); target.XPos = MemoryHandler.readFloat((int)(currObj + ObjectOffsets.Pos_X)); target.YPos = MemoryHandler.readFloat((int)(currObj + ObjectOffsets.Pos_Y)); target.ZPos = MemoryHandler.readFloat((int)(currObj + ObjectOffsets.Pos_Z)); otherPos = new Position3D(target.XPos, target.YPos, target.ZPos); } currObjPtr = currObj + NEXT_OBJECT; } System.Console.Clear(); System.Console.WriteLine(target.Name + ", " + target.Guid); System.Console.WriteLine(playerPos.distance(otherPos)); Thread.Sleep(200); } }
public void startMining(object mountNum) { isMining = true; player.goToPlace(startingPlaces[currentFarmingPlace]); while (isMining) { enemies = ObjectManager.sharedOM().getEnemies(); foreach (WowObject e in enemies) { if (!enemiesToLoot.Contains(e.Guid)) { enemiesToLoot.Add(e.Guid); } } //ha a következő pont közelébe van elenfél, akkor meg fogom támadni a "menj a köv helyre" részben enemyNearPos = ObjectManager.sharedOM().getEnemyNearPos(farmingPlaces[currentFarmingPlace][currentPoint]); if (!enemiesToLoot.Contains(enemyNearPos) && enemyNearPos != 0) { enemiesToLoot.Add(enemyNearPos); } //éledj if (player.isDead()) { System.Console.WriteLine("Ha hallott vagy éledj"); player.ressurrect(); currentPoint = 0; player.metElite = false; eliteGUID = 0; player.goToPlace(Darmend.landingPlace); player.interactWithMouseOver(Darmend.guid, 5000); for (int i = 0; i < 8; ++i) { ChatWriter.hitKey(ChatWriter.W); Thread.Sleep(60000); ChatWriter.hitKey(ChatWriter.S); } player.goToPlace(startingPlaces[currentFarmingPlace]); continue; } //lootolj else if (isThereEnemyToLoot()) { System.Console.WriteLine("Lootolj"); enemiesToRemove.Clear(); foreach (ulong guid in enemiesToLoot) { if (ObjectManager.sharedOM().getHealthByGUID(guid) == 0) { player.interactWithMouseOver(guid); enemiesToRemove.Add(guid); if (guid == eliteGUID) { eliteGUID = 0; } } } foreach (ulong guid in enemiesToRemove) { enemiesToLoot.Remove(guid); } } //harcolj else if (enemies.Count > 0) { System.Console.WriteLine("Harcolj"); WowObject enemy = enemies[0]; if (eliteGUID == 0) { player.attack(enemy.Guid); } else { player.attack(eliteGUID); } player.figth(); } //másik player /*else if(ObjectManager.sharedOM().isPlayerNear(player.getPosition3D())){ * if (!player.isMounted()) { * Position3D lastPos = player.getPosition3D(); * } * player.takeOff(); * while (ObjectManager.sharedOM().isPlayerNear(player.getPosition3D())) { * Thread.Sleep(1000); * } * player.goToPlace(posBeforeOtherCome); * }*/ //egyél else if (0.5f > player.getHPPercentage()) { if (shouldCannibalize) { player.cannibalize(); } if (0.5f > player.getHPPercentage()) { player.eat(); } } //menj a vendorhoz else if (goToVendor) { goToVendor = false; player.goToPlace(Darmend.landingPlace); player.interactWithMouseOver(Darmend.guid, 5000); player.goToPlace(startingPlaces[currentFarmingPlace]); } //menj a köv helyre else if (ObjectManager.sharedOM().getEnemies().Count < 1) { System.Console.WriteLine("Menj a köv helyre"); player.runTo(farmingPlaces[currentFarmingPlace][currentPoint]); triedToRun++; System.Console.WriteLine(currentPoint); if (triedToRun == 100) { triedToRun = 0; currentPoint = 0; eliteGUID = 0; player.metElite = false; currentFarmingPlace++; if (currentFarmingPlace == startingPlaces.Length) { currentFarmingPlace = 0; runNum++; } player.goToPlace(startingPlaces[currentFarmingPlace]); } //ha van a pont közelébe ellenfél akkor megtámadom else if (enemyNearPos != 0) { player.attack(enemyNearPos, true); } else if (player.nearPosition(farmingPlaces[currentFarmingPlace][currentPoint])) { currentPoint++; triedToRun = 0; //ha az adott farming place végén vagy, menj a következő farming place re if (currentPoint == farmingPlaces[currentFarmingPlace].Length) { currentPoint = 0; eliteGUID = 0; player.metElite = false; currentFarmingPlace++; if (currentFarmingPlace == startingPlaces.Length) { currentFarmingPlace = 0; runNum++; } if (runNum >= maxRun) { runNum = 0; goToVendor = true; } else { player.goToPlace(startingPlaces[currentFarmingPlace]); } } } } } }