DarkMaster Posted December 7, 2009 Share Posted December 7, 2009 Вот функции написанные мной - проверяют есть ли данный бафф на цели или игроке. 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 Мне помогавет в моем аддона-писании, надеюсь и вам поможет ! З.Ы. Блин как вставлять нормально ? в виде кода ? Quote Link to comment Share on other sites More sharing options...
DarkMaster Posted December 7, 2009 Author Share Posted December 7, 2009 Подскажите как оформить код функций ввиде вставки кода чтоб с отсупами и тд ! а то не читабельно *)))) Quote Link to comment Share on other sites More sharing options...
Guest ZxZ666 Posted December 8, 2009 Share Posted December 8, 2009 Прицепить *.lua файлег с коментами("--<коммент>") =\ Quote Link to comment Share on other sites More sharing options...
Guest Slicom Posted December 8, 2009 Share Posted December 8, 2009 а как заюзать тот или иной бафф/дебафф по имени спела? Судя по ответам - никак) Тогда как по ид спела? Поправте : Runspell(id)? Или через акшнбар? Quote Link to comment Share on other sites More sharing options...
Guest Slicom Posted December 9, 2009 Share Posted December 9, 2009 Блин, скажите чтонить! Quote Link to comment Share on other sites More sharing options...
DarkMaster Posted December 9, 2009 Author Share Posted December 9, 2009 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) ) Я шас тебе расказал практически вс е что нужно чтоб написать мегга аддон. Я седня добрый *)))) Далее сам - включи фантазию *) Quote Link to comment Share on other sites More sharing options...
Recommended Posts