дополнение The War Within

Открытый раздел для обсуждений
uaz266
Сообщения: 379
Зарегистрирован: 12 ноя 2016, 03:30

Re: дополнение The War Within

Сообщение uaz266 » Сегодня, 03:55

anry89 писал(а):
Вчера, 11:17
Вот мой полный рабочий код

Код: Выделить всё

GetSpellBookItemName = GetSpellBookItemName or C_SpellBook.GetSpellBookItemName
 GetNumSpellTabs = GetNumSpellTabs or C_SpellBook.GetNumSpellBookSkillLines
 GetSpellTabInfo = GetSpellTabInfo or function(tabLine)  skillLine = C_SpellBook.GetSpellBookSkillLineInfo(tabLine) if skillLine then return skillLine.name, skillLine.iconID, skillLine.itemIndexOffset, skillLine.numSpellBookItems, skillLine.isGuild, skillLine.offSpecID end end

PlayerHeroTrees = {}
function UpdateTalents()
    PlayerTalents = {}
    PlayerHeroTrees = {}

    local ActiveConfigID = C_ClassTalents.GetActiveConfigID()

    if ActiveConfigID then
        local ConfigInfo = C_Traits.GetConfigInfo(ActiveConfigID)

        if ConfigInfo then
            local treeIDs = ConfigInfo.treeIDs

            if treeIDs then
                for idx = 1, #treeIDs do
                    for _, TreeNodeID in pairs(C_Traits.GetTreeNodes(treeIDs[idx])) do
                        local NodeInfo = C_Traits.GetNodeInfo(ActiveConfigID, TreeNodeID)

                        if NodeInfo and NodeInfo.activeEntry and NodeInfo.activeRank > 0 then
                            local EntryInfo = C_Traits.GetEntryInfo(ActiveConfigID, NodeInfo.activeEntry.entryID)

                            if EntryInfo.definitionID then
                                local spellID = C_Traits.GetDefinitionInfo(EntryInfo.definitionID).spellID

                                PlayerTalents[tostring(spellID)] = true
                            end
                        end

                        if NodeInfo and NodeInfo.subTreeID then
                            local SubTreeInfo = C_Traits.GetSubTreeInfo(ActiveConfigID, NodeInfo.subTreeID)

                            if SubTreeInfo and SubTreeInfo.isActive then
                                PlayerHeroTrees[SubTreeInfo.name] = true
                            end
                        end
                    end
                end
            end
        end
    end

    for _, talentID in ipairs(C_SpecializationInfo.GetAllSelectedPvpTalentIDs()) do
        local _, _, _, _, _, spellID = GetPvpTalentInfoByID(talentID)

        PlayerTalents[tostring(spellID)] = true
        PlayerTalents[spellID] = true
    end
end

function IsHeroTree(TreeName)
    if PlayerHeroTrees[TreeName] ~= nil then
        return PlayerHeroTrees[TreeName]
    else
        return false
    end
end

function MyIsSpellInRange(SpellName, Unit)
    local in_range = C_Spell.IsSpellInRange(SpellName, Unit)

    if in_range == nil then return true else return in_range end
end

function CanCastUnit(SpellCode, Unit, InMove)
    return UnitExists(Unit) and UnitIsVisible(Unit) and not UnitIsDeadOrGhost(Unit) and Timers["WallBlock" .. UnitGUID(Unit)] == nil and Timers["UnitNotInFront" .. UnitGUID(Unit)] == nil and MyIsSpellInRange(SpellCode, Unit) and CanCast(SpellCode, InMove)
end

function GetSpellInfo(spellIdentifier)
    local data = C_Spell.GetSpellInfo(spellIdentifier)

    if data ~= nil then
        return data.name, 0, data.iconID, data.castTime, data.minRange, data.maxRange, data.spellID, data.originalIconID
    end
end

function GetSpellCooldown(spellIdentifier)
    local data = C_Spell.GetSpellCooldown(spellIdentifier)

    if data ~= nil then
        return data.startTime, data.duration, data.isEnabled, data.modRate
    end
end

function GetItemCooldown(spellIdentifier)
    local data = C_Item.GetItemCooldown(spellIdentifier)

    if data ~= nil then
        return data.startTime, data.duration, data.isEnabled, data.modRate
    end
end

function GetSpellCharges(spellIdentifier)
    local data = C_Spell.GetSpellCharges(spellIdentifier)

    if data ~= nil then
        return data.currentCharges, data.maxCharges, data.cooldownStartTime, data.cooldownDuration, data.chargeModRate
    end
end

function GetSpellDescription(spellIdentifier)
    return C_Spell.GetSpellDescription(spellIdentifier)
end

function IsSpellInRange(spellIdentifier, unit)
    return C_Spell.IsSpellInRange(spellIdentifier, unit)
end

function IsUsableSpell(spellIdentifier)
    return C_Spell.IsSpellUsable(spellIdentifier)
end

function GetSpellCount(spellIdentifier)
    return C_Spell.GetSpellCastCount(spellIdentifier)
end

function IsCurrentSpell(spellIdentifier)
    return C_Spell.IsCurrentSpell(spellIdentifier)
end

function GetSpellPowerCost(spellIdentifier)
    return C_Spell.GetSpellPowerCost(spellIdentifier)
end

function UnitAura(unit, i, kind)
    if kind == "HARMFUL" then
        local data = C_UnitAuras.GetDebuffDataByIndex(unit, i)

        if data ~= nil then
            return data.name, data.icon, data.applications, data.dispelName, data.duration, data.expirationTime, data.sourceUnit, nil, nil, data.spellId, data.canApplyAura, data.isBossDebuff, data.isFromPlayerOrPlayerPet
        end
    end

    if kind == "HELPFUL" then
        local data = C_UnitAuras.GetBuffDataByIndex(unit, i)

        if data ~= nil then
            return data.name, data.icon, data.applications, data.dispelName, data.duration, data.expirationTime, data.sourceUnit, nil, nil, data.spellId, data.canApplyAura, data.isBossDebuff, data.isFromPlayerOrPlayerPet
        end
    end
end
Да всё бьёт максимально хорошо работает, но есть одно но не работает каст предметов
Пример Изображение
Если сделать каст через макрос , то не отслеживает КД через пользовательский код GetItemCooldown() бот просто останавливается, хотел прикрутить КД "Камня здоровья" через слот сумки GetContainerItemCooldown() то же не получилось. Дальше мои познания заканчиваются. Может сможешь прикрутить "Камень здоровья"?

Ответить

Кто сейчас на конференции

Сейчас этот форум просматривают: нет зарегистрированных пользователей и 1 гость