private void GameThread() { Chief.Game game = new Chief.Game(); game.Attach(this.SelectedProcess); AppendText("Attached" + Environment.NewLine); System.Threading.Thread.Sleep(250); Chief.PacketConfirmation waitForGo = delegate(object packet) { string msg = (packet as GameClient.SendMessage).Message; if (msg.ToLower() == "go") return true; else return false; }; game.WaitForPacket(D2Packets.GameClientPacket.SendMessage, waitForGo, 60 * 60 * 1000); AppendText("Started" + Environment.NewLine); //AppendText("Hero UID: " + game.Hero.UID + Environment.NewLine); //AppendText(" X: " + game.Hero.X + Environment.NewLine); //AppendText(" Y: " + game.Hero.Y + Environment.NewLine); /* Switch weapons | CTA bool hasCTABeenFound = false; for(int tries=0;tries<10;tries++) { if(game.Hero.GetItemAt(EquipmentLocation.LeftHand) != null) if(game.Hero.GetItemAt(EquipmentLocation.LeftHand).Runeword == BaseRuneword.GetByName("Call to Arms")) hasCTABeenFound = true; if(game.Hero.GetItemAt(EquipmentLocation.RightHand) != null) if(game.Hero.GetItemAt(EquipmentLocation.RightHand).Runeword == BaseRuneword.GetByName("Call to Arms")) hasCTABeenFound = true; if(hasCTABeenFound) break; if(tries == 9) AppendText("Tried switching to CTA 10 times, failed!" + Environment.NewLine); game.SwitchWeaponSlotWait(); } if (hasCTABeenFound) { game.SelectSkill(SkillHand.Right, SkillType.BattleCommand); game.CastRightSkill((int)game.Hero.X, (int)game.Hero.Y); System.Threading.Thread.Sleep(250); game.SelectSkill(SkillHand.Right, SkillType.BattleOrders); game.CastRightSkill((int)game.Hero.X, (int)game.Hero.Y); } */ /* Move from: start of act 5, to: Red Portal */ game.MoveWait(5103, 5043); game.MoveWait(5110, 5064); /* Eldritch */ game.WaypointInteract(game.Objects.Find("ExpansionWaypoint"), D2Data.WaypointDestination.FrigidHighlands); game.TeleportWait(3760, 5097); game.TeleportWait(3750, 5078); List eldritchAndMinions; while ((eldritchAndMinions = game.Units.FindAll("MinionExp")) == null) System.Threading.Thread.Sleep(10); AppendText("Found: " + eldritchAndMinions.Count + " MinionExp" + Environment.NewLine); for (int i = eldritchAndMinions.Count - 1; i > 0; i--) { AppendText("Targetting: " + eldritchAndMinions[i].UID + Environment.NewLine); while (eldritchAndMinions[i].State != GameServer.NPCMode.Dead && eldritchAndMinions[i].State != GameServer.NPCMode.Dying) { AppendText("Attacking: " + eldritchAndMinions[i].UID + Environment.NewLine); game.Attack(eldritchAndMinions[i], D2Data.SkillType.Lightning); System.Threading.Thread.Sleep(250); } } // Back to WP game.TeleportWait(3760, 5097); game.TeleportWait(3784, 5111); game.WaypointInteract(game.Objects.Find("ExpansionWildernessWaypoint"), D2Data.WaypointDestination.Harrogath); //*/ /* Pindle */ game.MoveWait(5119, 5090); game.MoveWait(5131, 5108); game.MoveWait(5119, 5120); game.PortalInteract(game.Objects.Find("PermanentTownPortal")); game.TeleportWait(10064, 13293); game.TeleportWait(10063, 13268); game.TeleportWait(10058, 13238); List pindleAndMinions; while ((pindleAndMinions = game.Units.FindAll("DefiledWarrior")) == null) System.Threading.Thread.Sleep(10); AppendText("Found: " + pindleAndMinions.Count + " DefiledWarriors" + Environment.NewLine); // Go backwards down the list of units, because pindle is the last one we get for (int i = pindleAndMinions.Count-1; i > 0; i--) { AppendText("Targetting: " + pindleAndMinions[i].UID + Environment.NewLine); while (pindleAndMinions[i].State != GameServer.NPCMode.Dead && pindleAndMinions[i].State != GameServer.NPCMode.Dying) { AppendText("Attacking: " + pindleAndMinions[i].UID + Environment.NewLine); game.Attack(pindleAndMinions[i], D2Data.SkillType.Lightning); System.Threading.Thread.Sleep(250); } } //*/ AppendText("All done, cleaning up!" + Environment.NewLine); // Clean up game.Clear(); }