azerothcore

Need any helps wi-th: Buff rangs etc


My level of English is bad. So I will try to explain by giving examples.

I have 5 items that are overlaid on the player buff Let's conditionally call them: 1, 2, 3, 4, 5 These items have a spell: 11, 12, 13, 14, 15, Binding spells and items: 1 - 11, 2 - 12, 3 - 13, 4 - 14, 5 - 15,

Question. How to make the player activate, for example, item 2. But after activation he couldn't use item 1?

Example: 43463 Scroll of Agility VII 43464 Scroll of Agility VIII

That's not in the example. But there is one more thing. You need to make sure that you cannot use subject 3 after using subject 2. As long as the spell (12) is not over, item 3 (4.5) cannot be used.


Solution

  • If you need to make this in LUA

    local ItemEntry ={
      --ItemEntry, Spell, PreviousSpell
      {1, 11, 0},
      {2, 12, 11},
      {3, 13, 12},
      {4, 14, 13},
      {5, 15, 14};
    }
    
    local function OnUseItem(event, player, itemEntry)
      for i=1, #ItemEntry do
        if itemEntry == ItemEntry[i][1]then
          local pAura = player:HasAura(ItemEntry[i][3])
          if pAura == true then
            local pAura = player:GetAura(ItemEntry[i][3])
            if pAura <= ItemEntry[i][3]then
              player:RemoveAura(ItemEntry[i][3])
            end
          end
        end
      end
    end
    RegisterPlayerEvent(31, OnUseItem)