diff --git a/moneydiff/src/moneydiff.lua b/moneydiff/src/moneydiff.lua index 74799a2..627d347 100644 --- a/moneydiff/src/moneydiff.lua +++ b/moneydiff/src/moneydiff.lua @@ -30,7 +30,7 @@ function MONEYDIFF_INIT() local diff = nowMoney - g.money; if diff > 10000 then local mapName = geMapTable.GetMapProp(g.map):GetName() - CHAT_SYSTEM(string.format("%sで%ssilver取得しました",mapName,acutil.addThousandsSeparator(diff))) + CHAT_SYSTEM(string.format("%s:%ss Get",mapName,acutil.addThousandsSeparator(diff))) end g.money = nowMoney; g.map = session.GetMapName() diff --git a/poisonpotautocharge/poisonpotautocharge.ipf b/poisonpotautocharge/poisonpotautocharge.ipf new file mode 100644 index 0000000..b12e47b Binary files /dev/null and b/poisonpotautocharge/poisonpotautocharge.ipf differ diff --git a/poisonpotautocharge/src/poisonpotautocharge.lua b/poisonpotautocharge/src/poisonpotautocharge.lua index 3487f46..ecc6ba2 100644 --- a/poisonpotautocharge/src/poisonpotautocharge.lua +++ b/poisonpotautocharge/src/poisonpotautocharge.lua @@ -1,72 +1,29 @@ local acutil = require('acutil'); -ui.SysMsg("Load poisonpot auto charge") +ui.SysMsg("Load Poisonpot Auto Charge") function POISONPOTAUTOCHARGE_ON_INIT(addon, frame) POISONPOT_AUTO_CHARGE() end function POISONPOT_AUTO_CHARGE() - - if hasPoisonJob() == nil then - return;end - - local poisonAmount = getPoisonAmount() - if poisonAmount == nil then - return;end - - local poisonpot = GET_POISONPOT_ID(); - - if poisonpot == nil then - return;end - - local cnt = math.floor((1000 - poisonAmount) / 200); - session.AddItemID(poisonpot, cnt); - EXECUTE_POISONPOT_COMMIT() -end - -function hasPoisonJob() - local frame = ui.GetFrame("sysmenu"); + local frame = ui.GetFrame("sysmenu"); local poisonpot = GET_CHILD(frame, "poisonpot", "ui::CButton"); - if poisonpot == nil then - return nil - end - return true -end - -function getPoisonAmount() + if not poisonpot then + return; + end + local myEtc = GetMyEtcObject(); local poisonAmount = myEtc['Wugushi_PoisonAmount']; - if poisonAmount < 700 then - return poisonAmount; + + local cnt = math.floor((1000 - poisonAmount) / 200); + if cnt < 1 then + return end - return nil -end - --- 645569 misc_poisonpot - -function GET_POISONPOT_ID() - local inventoryItems = session.GetInvItemList(); - - if inventoryItems == nil then - return nil;end + + local poison = session.GetInvItemByName('misc_poisonpot') + local poisonGUID = poison:GetIESID() - local index = inventoryItems:Head(); - local itemCount = session.GetInvItemList():Count(); - - for i = 0, itemCount - 1 do - local inventoryItem = inventoryItems:Element(index); - index = inventoryItems:Next(index); - - if inventoryItem == nil then - break;end - - local itemObj = GetIES(inventoryItem:GetObject()); - if itemObj == nil then - break;end - - if string.starts(itemObj.ClassName, "misc_poisonpot") then - return inventoryItem:GetIESID(); - end - end - return nil; -end \ No newline at end of file + session.ResetItemList() + session.AddItemID(poisonGUID, cnt); + EXECUTE_POISONPOT_COMMIT() +end