From 010c66f73c7e4c4b135e0e8f96916dee6b7ad897 Mon Sep 17 00:00:00 2001 From: natoto nakayama Date: Mon, 2 Jan 2017 23:10:47 +0900 Subject: [PATCH] ver 1.1 --- moneydiff/src/moneydiff.lua | 2 +- poisonpotautocharge/poisonpotautocharge.ipf | Bin 0 -> 876 bytes .../src/poisonpotautocharge.lua | 77 ++++-------------- 3 files changed, 18 insertions(+), 61 deletions(-) create mode 100644 poisonpotautocharge/poisonpotautocharge.ipf 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 0000000000000000000000000000000000000000..b12e47b1feacb3553445c7d454d01651aae3febf GIT binary patch literal 876 zcmXS&aM16t0guCZg^&DU?+kVndThVFkKvp~?ww;nQsJGKbL;zWJ1ym$*qm%#r9bWM zODne-hT@N|%-B9XoOy=Tw<&GMYU<|9zt20T&%b|L(EPg{6HH9flCF`N#a?*_N zVi^^yn5Re@Gwr|Z{^U>+ql@1$Zyz3)THR-hR6iT!RoAqVF`+S9)l4(9wX0eHK6Q6fHe)ew5#CgigS4PY$ z`_lJ&SIyS`X_F4I7#|gQH)Y@Ju$|jho~*F6y)tDRN9`vYe!G~Pj}N*3cvG2W68dw| zDSa+g&q;AsejRS)maaOCbeyq~X&v;<6PTXED(rvMw@yejMjWUmCcTG6! zx8|VB4X-Jtd!|3ItBO#HwPoC0y){)~)lHop!gGR?B<{scOPy)Da!SvZwAY(#AFMsF z-o5hihn@@1L_WoI9;sPd_xSjJi{~$n-aqJl&2<0V`HwUrBA3<{JwN~F*`srz@ejN2 zJiTx>_Tjm!RV{KZ=T}euAdn{NN?F#`j`G)5o+1l$aXDJl7R@hN(l1!)EOnZ@~e z1^Fe3r6u{v8Hq*dsrp#N^eS?5v>7;_EWB_RXi5?b0|UrJvP{Y;O=My?zyxv$$czAQ JRyGhD1OUmlmG}Sv literal 0 HcmV?d00001 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