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

Модернизация AutoSellGrey


Ramzesgool
 Share

Recommended Posts

Существует такой аддон AutoSellGrey(продажа серого лута вендору).

Вот его код:

--------------------------------------------------------------------------------
-- EVENT HANDLERS
--------------------------------------------------------------------------------

-- Событие обновления списка вещей у тогровца, список обновляется в том числе при выкупе серых вещей:
function OnVendorListUpdated()
local currentBagSize = avatar.InventoryGetBaseBagSlotCount()
for slotIndex = 0, currentBagSize - 1 do
local itemId = avatar.GetInventoryItemId( slotIndex )
if itemId then
local itemQuality = itemLib.GetQuality( itemId )
local quality = itemQuality and itemQuality.quality
if quality and quality == ITEM_QUALITY_JUNK and avatar.SellItemToVendor then
avatar.SellItemToVendor( itemId ) -- for AO 2.0.09+
end
end
end
-- Повторный вызов не нужен, иначе не получится выкупить нужные серые вещи:
common.UnRegisterEventHandler(OnVendorListUpdated, "EVENT_VENDOR_LIST_UPDATED")
end

-- Событие начала разговора с NPC, который может быть торговцем:
function OnTalkStarted()
-- common.LogInfo( "common", common.FormatInt( guild.GetEnableTime( ).d, "%d" ) )
-- common.LogInfo( "common", common.FormatInt( guild.GetEnableTime( ).m, "%d" ) )
-- common.LogInfo( "common", common.FormatInt( guild.GetEnableTime( ).y, "%d" ) )
-- Теперь можно начать следить за обновлением списка вещей у торговца:
common.RegisterEventHandler(OnVendorListUpdated, "EVENT_VENDOR_LIST_UPDATED")
end

-- Событие окончания разговора с NPC, который может быть торговцем:
function OnTalkStopped()
-- Теперь нужно прекратить следить за обновлением списка вещей у торговца, на всякий случай:
common.UnRegisterEventHandler(OnVendorListUpdated, "EVENT_VENDOR_LIST_UPDATED")
end

--------------------------------------------------------------------------------
-- INITIALIZATION
--------------------------------------------------------------------------------
function Init()
-- События:
common.RegisterEventHandler(OnTalkStarted, "EVENT_TALK_STARTED")
common.RegisterEventHandler(OnTalkStopped, "EVENT_TALK_STOPPED")
end
--------------------------------------------------------------------------------
Init()
--------------------------------------------------------------------------------

Как я полный дуб в Lua, мне требуется помощь). У автора аддона нет свободного времени и он не может помочь. Что мне бы хотелось увидеть:

например: открыт у меня диалог с вендором, в сумке появляется серый лут, он тут же продается, т.е. мне не придется закрыть и открыть диалог заново. Автор сказал, что это возможно. Жду помощи, заранее премного благодарен! :)

Link to comment
Share on other sites

Огромное спасибо). Если надо, темку можете закрыть.

Я бы советовал еще проверять ведется ли взаимодействие с НПЦ (т.е. в начало функции вставить проверку) чтобы она не отрабатывала с ошибками когда ты просто бегаешь и подбираешь лут не торгуя с НПЦ.

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