Jump to content
Alloder.pro  about Allods with love 😱
Search In
  • More options...
Find results that contain...
Find results in...

Servers monitoring and the Addons Editor

We present you two legends. All dreams come true.

Servers monitoring The Addons Editor

Digest April

We talk about what was done and updated in the past month. We help keep abreast of events.

Read more

Game tooltips

Tooltips provide a way for 3rd party fansites and extensions to display detailed information on mouseover.

Read more

Проверка на баффы дебафы


DarkMaster
 Share

Recommended Posts

Вот функции написанные мной - проверяют есть ли данный бафф на цели или игроке.

function GetPlayerBuffByDebugName( buffname )

local buff_count = unit.GetBuffCount( avatar.GetId() )

local buff

if buff_count > 0 then

for i = 0, buff_count - 1 do

buff = unit.GetBuff( avatar.GetId(), i )

if buff then

if buff.debugName == buffname then

return buff

end

end

end

end

return nil

end

function GetTargetBuffByDebugName( buffname )

local Target = avatar.GetTarget()

if Target then

local buff_count = unit.GetBuffCount( Target )

local buff

if buff_count > 0 then

for i = 0, buff_count - 1 do

buff = unit.GetBuff( Target, i )

if buff then

if buff.debugName == buffname then

return buff

end

end

end

end

end

return nil

end

Узнать какое у баффа имя можно вот так :

function WriteAllPlayerBuffInfoToCfg()

local buff_count = unit.GetBuffCount( avatar.GetId() )

local buff

local section = {}

if buff_count > 0 then

for i = 0, buff_count - 1 do

buff = unit.GetBuff( avatar.GetId(), i )

section = buff.debugName

end

end

common.SetGlobalConfigSection( "PLAYER_BUFF_LIBRARY", section )

end

function WriteAllTargetBuffInfoToCfg()

local Target = avatar.GetTarget()

if Target then

local buff_count = unit.GetBuffCount( Target )

local buff

local section = {}

if buff_count > 0 then

for i = 0, buff_count - 1 do

buff = unit.GetBuff( Target, i )

section = buff.debugName

end

end

common.SetGlobalConfigSection( "TARGET_BUFF_LIBRARY", section )

end

end

Пример использования: Просто вызываем функции потом в personal.cfg смотрим секции TARGET_BUFF_LIBRARY и PLAYER_BUFF_LIBRARY

WriteAllPlayerBuffInfoToCfg()

WriteAllTargetBuffInfoToCfg()

Пример использования функций проверок

local HolyStrikeDebuff = GetTargetBuffByDebugName( "Mechanics/Spells/Paladin/HolyStrike/Buff01.xdb" )

if ((MarkOfCrusaderDebuff == nill) or (MarkOfCrusaderDebuff.stackCount<3)) then

Например вывести мессайдж о том что на цели нужное количество дебафов *))))

end

Мне помогавет в моем аддона-писании, надеюсь и вам поможет !

З.Ы. Блин как вставлять нормально ? в виде кода ?

Link to comment
Share on other sites

а как заюзать тот или иной бафф/дебафф по имени спела?

Судя по ответам - никак)

Тогда как по ид спела? Поправте :

Runspell(id)?

Или через акшнбар?

Link to comment
Share on other sites

function GetActionInfo( slotId )

local actionInfo = avatar.GetActionInfo( slotId )

if actionInfo then

actionInfo.valid = IsActionTypeValid( actionInfo.type )

actionInfo.enabled = true

actionInfo.texture = GetTexture( "Placeholder" )

else

actionInfo = { valid = false }

end

actionInfo.slotId = slotId

if actionInfo.valid then

if actionInfo.type == ACTION_TYPE_SPELL then

actionInfo = GetSpellInfo( actionInfo )

elseif actionInfo.type == ACTION_TYPE_ITEM then

actionInfo = GetItemInfo( actionInfo )

end

end

return actionInfo

end

Функция берет то инфо о спелле в слоте

function GetSpellIDFromActionSlot( actioninfo )

local spellInfo = avatar.GetSpellObjectInfo( actioninfo.id )

if spellInfo then

return spellInfo.id

end

return -1

end

Функция берет спелл ИД из акшенинфо

function CastSpell( spellId )

local spellInfo = avatar.GetSpellInfo( spellId )

if spellInfo.targetType == SPELL_TYPE_POINT

and ( spellInfo.prepared or spellInfo.launchWhenReady )

then

--trace( "Cast AE" )

common.SendEvent( "SCRIPT_REQUEST_AEMARKER", { spellId = spellInfo.id } )

else

--trace( "RunSpell" )

common.SendEvent( "SCRIPT_CANCEL_AEMARKER", {} )

avatar.RunSpell( spellInfo.id )

end

end

Функция кастует спелл *)))

юзать так:

local ActionSlotInfo0 = GetActionInfo( 0 ) -- 1 slot

CastSpell( GetSpellIDFromActionSlot(ActionSlotInfo0) )

Я шас тебе расказал практически вс е что нужно чтоб написать мегга аддон. Я седня добрый *)))) Далее сам - включи фантазию *)

Link to comment
Share on other sites

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

By using our site you agree to the Terms of Use