private void Timer_OnElapsed() { var wowObjects = new List <WowObject>(); var activePlayer = game.GetGameObjects(wowObjects); var bobberThatBobbing = wowObjects.FirstOrDefault(i => i.OwnerGUID == activePlayer.GUID && i.Bobbing); if (bobberThatBobbing != null) { this.LogPrint("Got bit!"); Thread.Sleep(Utilities.Rnd.Next(500, 1000)); this.LogPrint("Interacting with bobber --> " + bobberThatBobbing.GUID); bobberThatBobbing.Interact(); Thread.Sleep(Utilities.Rnd.Next(500, 1000)); } if (!game.IsLooting && !activePlayer.InCombat) { if (activePlayer.CastingSpellID == 0 && activePlayer.ChannelSpellID == 0) { if (ApplyWaterWalkingIfNeeded(activePlayer)) { return; } if (DoBreakIfNeeded()) { return; } if (ApplyBestLureIfNeeded(activePlayer)) { return; } if (ApplySpecialLureIfNeeded(activePlayer)) { return; } if (ApplyArcaneLureIfNeeded(activePlayer)) { return; } if (ApplyLegionSpecialLureIfNeeded(activePlayer)) { return; } if (DoDalaranAchievementIfNeeded(activePlayer)) { return; } if (DoMargossRepIfNeeded(activePlayer)) { return; } Thread.Sleep(Utilities.Rnd.Next(500, 1000)); this.LogPrint($"Cast fishing --> ({FISHING_SPELL_NAME})"); game.CastSpellByName(FISHING_SPELL_NAME); Thread.Sleep(1500); } } }
public void OnPulse() { var activePlayer = game.GetGameObjects(); if (activePlayer != null) { if (!game.IsLooting) { if (activePlayer.CastingSpellID == 0 && activePlayer.ChannelSpellID == 0) { if (game.IsSpellKnown(51005)) // mill { if (settings.UseFastDraenorMill && activePlayer.ItemsInBags.Any(l => fastMillHerbs.Contains(l.EntryID) && l.StackSize >= 20)) { game.SendToChat($"/run {someRandomString}={{}}"); game.SendToChat($"/run local s=C_TradeSkillUI.GetFilteredRecipeIDs();local t={{}};if(#s>0) then for i=1,#s do C_TradeSkillUI.GetRecipeInfo(s[i], t);{someRandomString}[t.name]={{t.recipeID,t.numAvailable}}; end end"); game.SendToChat($"/run for n,i in pairs({someRandomString}) do if(strfind(n,\"Массовое измельчение\") and i[2]>0) then C_TradeSkillUI.CraftRecipe(i[1],i[2]);return; end end"); Thread.Sleep(2000); return; } if (activePlayer.ItemsInBags.Any(l => l.EntryID == 136926)) // Кошмарный стручок { game.UseItemByID(136926); Thread.Sleep(500); return; } var nextHerb = activePlayer.ItemsInBags.FirstOrDefault(l => herbs.Contains(l.EntryID) && l.StackSize >= 5); if (nextHerb != null) { game.CastSpellByName(Wowhead.GetSpellInfo(51005).Name); game.UseItem(nextHerb.BagID, nextHerb.SlotID); Thread.Sleep(500); return; } if (settings.LaunchInkCrafter) { this.AddPluginToRunning("InkCrafter"); } } if (game.IsSpellKnown(31252)) // prospect { DoProspect(); } if (game.IsSpellKnown(13262)) // disenchant { Thread.Sleep(1000); // pause to prevent disenchanting nonexistent item DoDisenchant(); } if ((DateTime.UtcNow - lastNotifiedAboutCompletion).TotalSeconds >= 60) { this.ShowNotify("Task is completed", false, true); lastNotifiedAboutCompletion = DateTime.UtcNow; } } else { Thread.Sleep(500); // wait for cast } } } }