Important: Please register to test the 20 minutes trial version or buy the bot!
Bot is ready for WoW 5.2 #16826
Wow Bot: CrawlerBot Last version: click here State: EU: working US: working

Author Topic: Another Balance Druid CustomClass Profile  (Read 662 times)

December 04, 2012, 23:14:27 PM

zukzuk

  • *
  • Posts: 139
  • Reputation: 66
    • View Profile
Improved version loosely based on kampfschaf's.

Source code should be more readable and it should perform more along the ways of what was probably intended.
« Last Edit: December 06, 2012, 19:25:31 PM by zukzuk »

December 06, 2012, 19:09:37 PM
Reply #1

zukzuk

  • *
  • Posts: 139
  • Reputation: 66
    • View Profile
Added usage of some talent spells when there's more than one attacker.

December 14, 2012, 11:16:27 AM
Reply #2

kampfschaf

  • ****
  • Posts: 349
  • Reputation: 29
  • me gusta.
    • View Profile
I like your formatting :)
I'm back and slowly getting back into my projects

December 14, 2012, 18:05:35 PM
Reply #3

zukzuk

  • *
  • Posts: 139
  • Reputation: 66
    • View Profile
It's still a lot more verbose than it has to be :-). Tried to keep it as readable as possible for people who aren't used to scripting while still trying to minimize the likelihood of introducing the sort of bugs that are immanent to many profiles on this forum.

Edit: the "functional" differences to your profile are that it uses more talent spells and prioritizes the spells properly. (since it returns control to the bot after every spellcast, not after a random "batch" of spells).
« Last Edit: December 14, 2012, 18:14:03 PM by zukzuk »

December 15, 2012, 10:11:06 AM
Reply #4

kampfschaf

  • ****
  • Posts: 349
  • Reputation: 29
  • me gusta.
    • View Profile
Still does cast Moonfire and Sunfire in a strange way, with random cast in between.
I thought it might be an improvement to build cascading spellchecks - like checking all spells again before casting a lower priority spell.

like
Code: Text
  1. check Moonfire(){ foo()}
  2. check Sunfire(){ check Moonfire(); foo()}
  3. check FillerSpell{check Sunfire(); foo()}
  4.  

Tried it on my fury warrior and it works way better. Gonna release it in the near future, but I got a ton of things to manage because I've been to hospital for some time.
I'm back and slowly getting back into my projects

December 15, 2012, 11:09:32 AM
Reply #5

zukzuk

  • *
  • Posts: 139
  • Reputation: 66
    • View Profile
Well, I thought about doing CustomClasses in a way so that it never returns control to the bot once Fight() has been called until GetAttackerCount is 0. Didn't try it yet though. This would, however, give you complete control about what is called when. Seemed to be too radically different from the current custom classes, so I didn't try it (no idea what changes might be implemented in the bot).

About the Moonfire + Sunfire stuff:

If you're talking about Pull(), you might have to increase the Sleep.

If you're talking about Fight(): if you want to make sure that the bot always casts moonfire+sunfire without anything in between, call it the same way as in Pull once you've changed that so it always does both casts.

Note that this would of course also prevent the bot from casting a heal.

December 15, 2012, 14:38:21 PM
Reply #6

kampfschaf

  • ****
  • Posts: 349
  • Reputation: 29
  • me gusta.
    • View Profile
Healing methods are always priority #1 ;)
I tried it in my 300 line Fury Warrior CC and it works quite well. I see a dps increase about 25% over the "simple" top-down CC design.
I'm back and slowly getting back into my projects

December 15, 2012, 14:41:46 PM
Reply #7

zukzuk

  • *
  • Posts: 139
  • Reputation: 66
    • View Profile
Well, those two statements are contradicting each other

"Still does cast Moonfire and Sunfire in a strange way, with random cast in between."

"Healing methods are always priority #1"

Either it casts Moonfire + Sunfire without anything in between, or it prioritizes heals over those. I think I described what's what regarding the profile I posted, I don't know about the one you're talking about (do warriors have heals even? :) ).

December 15, 2012, 16:48:56 PM
Reply #8

kampfschaf

  • ****
  • Posts: 349
  • Reputation: 29
  • me gusta.
    • View Profile
Didn't release the warrior CC yet. There's not much healing, but the "best practice" gameplay is driven by procs and priority queue much more than on a balance druid.

I did not mean healing spells interfering, I mean when there's a spell cast while not both dots are applied, resulting in a loss of DPS due to dots not ticking and missing potential shooting stars procs from dot crits.
I'm back and slowly getting back into my projects

January 13, 2013, 09:19:46 AM
Reply #9

Bastian1987

  • *
  • *
  • Posts: 23
  • Reputation: 0
    • View Profile
hammer 1+++++ 

wenn ein zweiter mob angreift , castet die eule starfall und heilt sich und greift keinen mehr an wartet bis der cd ready ist und wieder starfall

und wie änder ich die reg einstellungen

[09:21:07] - [Reg]: Start with 77.71% HP and 93.84% MP.
[09:21:07] - [Reg]: No bandages, no Healing, no food. This will take a while

ich bin neu im lua ändern, ist diese lua dann nur für eine classe ? bzw der bot ordner , wenn ich einen anderen bot starte muss ich den ordner kopieren ? oder die selbe exe einfach starten ?  :)

Code: [Select]
-- Module Regeneration
Regeneration = {};

-- Default Ini Settings
Regeneration.Ini2 = {
    ["DebugLevel"] = 3,
    ["PlayerClass"] = "",
    ["PlayerGUID"] = -1,
    ["DoRegeneration"] = true,
    ["HPLimit"] = 70,
    ["MPLimit"] = 70,
    ["UseBandages"] = false,
    ["AutoBandages"] = false,
    ["BandageId"] = 0,
    ["BandageDebuff"] = 11196,
    ["UseHealing"] = true,
    ["AutoHealing"] = true,
    ["HealId"] = 0,
    ["UseSummoning"] = true,
    ["SummonSpellId"] = 42955,
    ["SummonFoodId"] = 0,
    ["UseFood"] = true,
    ["AutoFood"] = true,
    ["FoodItemId"] = 0,
    ["FoodItemCount"] = 0,
    ["DrinkItemId"] = 0,
    ["DrinkItemCount"] = 0,
    ["ManaUser"] = false
};

Regeneration.Const = {
    ["FOOD_IDS"] = {133592,130748,130745,130743,130334,130333,130332,130330,130329,130328,130327,126540,126539,126538,126537,126536,126535,108034,108033,108030,108029,105233,105231,104935,104934,104922,104235,92735,87918,87757,87693,87637,87636,87604,87602,87601,87599,87597,87595,87594,87588,87587,87586,87584,87580,87577,87573,87572,87571,87570,87568,87567,87566,87544,80169,80168,71074,71073,71071,71068,66478,65422,65421,65420,65419,65418,64355,64056,61874,61829,58886,57649,53283,48720,46898,46812,46683,45618,45548,43777,43763,43180,42311,41030,40768,40745,40543,35271,35270,33773,33725,33269,33266,33264,33262,33260,33258,33255,33253,32112,29073,29008,28616,27094,26474,26472,26401,26260,25888,25886,25702,25700,25695,25660,24869,24800,24707,24005,22731,18234,18233,18232,18231,18230,18229,10257,10256,7737,6410,5007,5006,5005,5004,2639,1131,1129,1127,435,434},
    ["DRINK_IDS"] = {130341,130340,130339,130338,130337,130336,130335,118359,114731,113703,105590,105232,105230,105221,105209,104270,104269,104262,94468,92803,92800,92797,92736,87959,87958,80167,80166,72623,66041,64356,61830,57073,52911,46755,43706,43183,43182,43155,43154,34291,30024,29007,27089,26475,26473,26402,26261,25696,24355,22734,10250,1137,1135,1133,432,431,430}
};


-- Check functions

function Regeneration.CheckStealthMode()
    if HasBuff(Regeneration.Ini2.PlayerGUID,1784) then
        return;
    end
    if IsSpellReady(1784) then
        CastSpellByID(1784, 0, true);
    end
end

function Regeneration.IsRegenerationFinished()
    if Regeneration.IsPlayerEating() and PlayerHpPercent() < 100 then
        DoLogMessage("Not finished - Eating and HP("..string.format("%.2f",PlayerHpPercent())..") <100%.", LogDebugLevels.VERBOSEINFO)
        return false
        elseif Regeneration.IsPlayerDrinking() and Regeneration.Ini2.ManaUser and PlayerManaPercent() < 100 then
        DoLogMessage("Not finished - Drinking and MP("..string.format("%.2f",PlayerManaPercent())..") <100%.", LogDebugLevels.VERBOSEINFO)
        return false;
    elseif Regeneration.IsPlayerBelowHealthLimit() then
        DoLogMessage("Not finished - Player HP("..string.format("%.2f",PlayerHpPercent())..") < HP limit of "..Regeneration.Ini2.HPLimit..".", LogDebugLevels.VERBOSEINFO)
        return false;
    elseif Regeneration.Ini2.ManaUser and Regeneration.IsPlayerBelowManaLimit() then
        DoLogMessage("Not finished - Player MP("..string.format("%.2f",PlayerManaPercent())..") < MP limit of "..Regeneration.Ini2.MPLimit..".", LogDebugLevels.VERBOSEINFO)
        return false;
    else
        DoLogMessage("Finished - Player is ready to go.", LogDebugLevels.INFO)
        return true;
    end
end

function Regeneration.IsRegenerationNeeded()
    if not Regeneration.Ini2.DoRegeneration then
        DoLogMessage("Disabled by ini.", LogDebugLevels.VERBOSEINFO);
        return false
    elseif Regeneration.Ini2.ManaUser and Regeneration.IsPlayerBelowManaLimit() then
        DoLogMessage("Regeneration: Player below mana limit.", LogDebugLevels.VERBOSEINFO);
        return true
    elseif Regeneration.IsPlayerBelowHealthLimit() then
        DoLogMessage("Regeneration: Player below health limit.", LogDebugLevels.VERBOSEINFO);
        return true
    else
        DoLogMessage("No Regeneration: Mana/HP above limit.", LogDebugLevels.VERBOSEINFO);
        return false
    end
end

function Regeneration.IsPlayerEating()
    for i,v in ipairs(Regeneration.Const.FOOD_IDS) do
        if HasBuff(Regeneration.Ini2.PlayerGUID,v) then
            DoLogMessage("Player is eating: YES", LogDebugLevels.DEBUG);
            return true
        end
    end
    DoLogMessage("Player is eating: NO", LogDebugLevels.DEBUG);
    return false;
end

function Regeneration.IsPlayerDrinking()
    for i,v in ipairs(Regeneration.Const.DRINK_IDS) do
        if HasBuff(Regeneration.Ini2.PlayerGUID,v) then
            DoLogMessage("Player is drinking: YES", LogDebugLevels.DEBUG);
            return true
        end
    end
    DoLogMessage("Player is drinking: NO", LogDebugLevels.DEBUG);
    return false;
end

function Regeneration.GetPlayerRemainingChannelTime()
    LuaDoString('local spell, _, _, _, _, endTime = UnitChannelInfo("player");if spell then finishMillis = endTime - (GetTime()*1000); else finishMillis=0; end');
    local temp = tonumber(WowGetLuaValue("finishMillis"));
    if temp == nil then
        DoLogMessage("Remaining channel time could not be read, was nil.", LogDebugLevels.DEBUG);
        temp = 0;
    end
    DoLogMessage("Remaining channel time: "..(temp/1000).."s.", LogDebugLevels.DEBUG);
    return temp;
end

function Regeneration.IsPlayerBelowHealthLimit()
    if PlayerHpPercent() < Regeneration.Ini2.HPLimit then
        DoLogMessage('Player below health limit: YES', LogDebugLevels.VERBOSEDEBUG);
        return true;
    else
        DoLogMessage('Player below health limit: NO', LogDebugLevels.VERBOSEDEBUG);
        return false;
    end
end

function Regeneration.IsPlayerBelowManaLimit()
    if PlayerManaPercent() < Regeneration.Ini2.MPLimit then
        DoLogMessage('Player below mana limit: YES', LogDebugLevels.VERBOSEDEBUG);
        return true;
    else
        DoLogMessage('Player below mana limit: NO', LogDebugLevels.VERBOSEDEBUG);
        return false;
    end
end

-- Helper functions

function Regeneration.UseItemByID(id, wait)
    wait = wait or 500
    LuaDoString('local iName = GetItemInfo('..id..'); UseItemByName(iName);');
    Sleep(wait);
end

function Regeneration.IsRecuperateUsable()
    LuaDoString('local u, m = IsUsableSpell(GetSpellInfo(73651)); usableSpell=0; if u and not m then usableSpell=1; end;');
    local recReady = tonumber(WowGetLuaValue("usableSpell")) or 0;
    if recReady == 1 then return true; end;
    return false;
end
-- Regeneration functions

function Regeneration.UseBandage()
    DoLogMessage("Bandaging: "..Regeneration.Ini2.BandageId, LogDebugLevels.DEBUG);
    Regeneration.UseItemByID(Regeneration.Ini2.BandageId,500);
    if not HasBuff(Regeneration.Ini2.PlayerGUID,11196) then
        Regeneration.Ini2.UseBandages = false;
        DoLogMessage("Bandaging did not work, disabling bandage use.", LogDebugLevels.WARN);
        return;
    end
    while Regeneration.GetPlayerRemainingChannelTime() > 0 and PlayerHpPercent() < 100 do
        Sleep(50);
    end
end

function Regeneration.UseRecuperate()
    if IsSpellReady(73651) then
        DoLogMessage("Casting recuperate(ROGUE).", LogDebugLevels.DEBUG);
        CastSpellByID(73651, "player", true);
    end
end

function Regeneration.UseHeal()
    if IsSpellKnown(Regeneration.Ini2.HealId) and IsSpellReady(Regeneration.Ini2.HealId) then
        DoLogMessage("Casting heal: "..Regeneration.Ini2.HealId, LogDebugLevels.DEBUG);
        CastSpellByID(Regeneration.Ini2.HealId, "player", true);
    end
end

function Regeneration.UseMeal()
    if Regeneration.Ini2.FoodItemId ~= 0 and Regeneration.IsPlayerBelowHealthLimit() then
        DoLogMessage("Eating: "..Regeneration.Ini2.FoodItemId, LogDebugLevels.DEBUG);
        Regeneration.UseItemByID(Regeneration.Ini2.FoodItemId);
    end
    if Regeneration.Ini2.DrinkItemId ~= 0 and not Regeneration.IsPlayerDrinking() and Regeneration.Ini2.ManaUser and Regeneration.IsPlayerBelowManaLimit() then
        DoLogMessage("Drinking: "..Regeneration.Ini2.DrinkItemId, LogDebugLevels.DEBUG);
        Regeneration.UseItemByID(Regeneration.Ini2.DrinkItemId);
    end
end

-- Debugging functions and stuff

function DoLogMessage(msg, lvl)
    if lvl <= Regeneration.Ini2.DebugLevel then
        _Log("[Reg]: "..msg);
    end
end

LogDebugLevels = {
    ["OFF"] = 0;
    ["ERROR"] = 1;
    ["WARN"] = 2;
    ["INFO"] = 3;
    ["VERBOSEINFO"] = 4;
    ["DEBUG"] = 5;
    ["VERBOSEDEBUG"] = 6;
    ["VERBOSE"] = 7;
}

-- Load ini
function Regeneration.LoadIni2()
    local ini2C = os.clock();
   
    local r = Regeneration.Ini2;
    r.DebugLevel = tonumber(IniRead("Reg.ini","Settings","DebugLevel","3"))
    r.PlayerGUID = Player;
    DoLogMessage('Reading "Reg.ini".', LogDebugLevels.INFO);
    -- Settings
    if IniRead("Reg.ini","Settings","DoReg","1") ~= "1" then
        r.DoRegeneration = false;
        DoLogMessage("Using regeneration: NO", LogDebugLevels.INFO);
    else
        r.DoRegeneration = true;
        DoLogMessage("Using regeneration: YES", LogDebugLevels.VERBOSEINFO);
    end
    r.HPLimit = tonumber(IniRead("Reg.ini","Settings","HealthPer","70"));
    DoLogMessage("HP limit: "..r.HPLimit, LogDebugLevels.INFO);
    r.MPLimit = tonumber(IniRead("Reg.ini","Settings","PowerPer","70"));
    DoLogMessage("Mana limit: "..r.MPLimit, LogDebugLevels.INFO);
   
    if IniRead("Reg.ini","Bandages","UseBandages","0") == "1" then
        r.UseBandages = true;
    else
        r.UseBandages = false;
    end
   
    if IniRead("Reg.ini","Healing","UseHealing","0") == "1" then
        r.UseHealing = true;
    else
        r.UseHealing = false;
    end
   
    if IniRead("Reg.ini","Mage","UseSummoning","0") == "1" then
        r.UseSummoning = true;
    else
        r.UseSummoning = false;
    end
   
    if IniRead("Reg.ini","Food","UseFood","0") == "1" then
        r.UseFood = true;
    else
        r.UseFood = false;
    end
   
    -- Read Default + auto stuff with one lua call -> this is quite uggly
    local rFid = tonumber(IniRead("Reg.ini","Food","FoodItemId","0")) or 0;
    local rDid = tonumber(IniRead("Reg.ini","Food","DrinkItemId","0")) or 0;
   
    LuaDoString('fCount = GetItemCount('..rFid..'); dCount = GetItemCount('..rDid..'); local regBandageIds = {72986,72985,53051,53050,53049,34722,34721,21991,21990,14530,14529,8545,8544,6451,6450,3531,3530,2581,1251}; bandageId = 0; for i=1,table.getn(regBandageIds),1 do if GetItemCount(regBandageIds[i]) > 0 then bandageId=regBandageIds[i]; break; end; end; local regConjuredItemIds = {80618, 80610, 65517, 65516, 65515, 65500, 65499, 43523, 43518, 34062};conjuredId = 0;for i=1,table.getn(regConjuredItemIds),1 do if GetItemCount(regConjuredItemIds[i]) > 0 then conjuredId=regConjuredItemIds[i]; break; end; end;local _, pClass = UnitClass("player"); plClass = pClass; healSpellId = 0; if pClass=="PRIEST" then if IsSpellKnown(2060) then healSpellId=2060; elseif IsSpellKnown(2050) then healSpellId=2050; elseif IsSpellKnown(2061) then healSpellId=2061; end elseif pClass=="SHAMAN" then if IsSpellKnown(77472) then healSpellId=77472; elseif IsSpellKnown(8004) then healSpellId=8004; end elseif pClass=="PALADIN" then if IsSpellKnown(82326) then healSpellId=82326; elseif IsSpellKnown(635) then healSpellId=635; elseif IsSpellKnown(19750) then healSpellId=19750; end elseif pClass=="DRUID" then if IsSpellKnown(33763) then healSpellId=33763; elseif IsSpellKnown(8936) then healSpellId=8936; elseif IsSpellKnown(50464) then healSpellId=50464; elseif IsSpellKnown(5185) then healSpellId=5185; elseif IsSpellKnown(774) then healSpellId=774; end else healSpellId=0; end; powerType = UnitPowerType("player");');
    if r.UseBandages then
        r.BandageId = tonumber(WowGetLuaValue("bandageId")) or 0;
    end
    if r.UseSummoning then
        r.SummonFoodId = tonumber(WowGetLuaValue("conjuredId")) or 0;
    end
    if r.UseHealing then
        r.HealId = tonumber(WowGetLuaValue("healSpellId")) or 0;
    end
    r.PlayerClass = tostring(WowGetLuaValue("plClass")) or "";
    local pt = tonumber(WowGetLuaValue("powerType")) or -1;
    if pt == 0 then
        r.ManaUser = true;
    end
    if r.UseFood and rFid > 0 then
        r.FoodItemCount = tonumber(WowGetLuaValue("fCount")) or 0;
    end
    if r.UseFood and rDid > 0 then
        r.DrinkItemCount = tonumber(WowGetLuaValue("dCount")) or 0;
    end
   
    -- Bandages
    if r.UseBandages then
        DoLogMessage("Using bandages: YES", LogDebugLevels.INFO);
        if IniRead("Reg.ini","Bandages","AutoBandages","0") == "1" then
            r.AutoBandages = true;
            DoLogMessage("Automatic bandage selection: YES", LogDebugLevels.INFO);
            if r.BandageId == 0 then
                DoLogMessage("Could not find a bandage, disabling bandge use.", LogDebugLevels.WARN);
                r.UseBandages = false;
                r.AutoBandages = false;
            else
                DoLogMessage("Using bandage: "..r.BandageId, LogDebugLevels.INFO);
            end
        else
            r.AutoBandages = false;
            r.BandageId = tonumber(IniRead("Reg.ini","Bandages","BandageItemId","0"));
            if r.Bandage.Id < 1 then
                r.UseBandages = false;
                DoLogMessage("Bandages were on but no bandage set, disabling bandage use.", LogDebugLevels.WARN);
            else
                DoLogMessage("Using bandage: "..r.BandageId, LogDebugLevels.INFO);
            end
        end
    else
        DoLogMessage("Using bandages: NO", LogDebugLevels.VERBOSEINFO);
    end
   
« Last Edit: January 13, 2013, 10:35:42 AM by Bastian1987 »

January 14, 2013, 06:25:48 AM
Reply #10

Bastian1987

  • *
  • *
  • Posts: 23
  • Reputation: 0
    • View Profile
habs geschaft , jetzt nutzt er die specials bei mehr als einen mob und geht dann wieder in die rota :)

 

* Useful Links

WoW Bot - CrawlerBot
* Download
* Guides
* Info & Clip

* Useful Stuff