Sooo I have a brand new problem. I'm trying to integrate the new curing items from achaea into my curing system without completely rewriting it. First, here's the code:
herbaff = {
"addiction",
"agoraphobia",
"asthma",
"blind",
"claustrophobia"
}
herbcure = {
addiction = GinsengFerrumChoice() or "ginseng",
agoraphobia = LobeliaArgentumChoice() or "lobelia",
asthma = KelpAurumChoice() or "kelp",
blind = BayberryArsenicChoice() or "bayberry",
claustrophobia = LobeliaArgentumChoice() or "lobelia",
}
function GinsengFerrumChoice ()
if outr.ginseng > 0 then
return "ginseng"
end
if outr.ferrum > 0 then
return "ferrum"
end
if inr.ginseng > 0 then
return "ginseng"
end
if inr.ferrum > 0 then
return "ferrum"
end
end
function CureHerb ()
for k, v in ipairs (herbaff) do
if aff[v] then
_G["herb"] = herbcure[v]
if not (herb == "hawthorn") then
if (tonumber(outr[herb]) > 0) then
if EatGo() then
HerbEat()
Send ("eat " .. herbcure[v])
return
end
elseif (tonumber(inr[herb]) > 0) then
if OutrGo() then
HerbOutr()
Send ("outr " .. herbcure[v])
return
end
end
elseif balance.hawthorn then
if (outr.hawthorn > 0) then
if EatGo() then
HerbEat()
Send ("eat hawthorn")
return
end
elseif (inr.hawthorn > 0) then
if OutrGo() then
HerbOutr()
Send ("outr hawthorn")
return
end
end
return
end
end
end
end
They pretty much made it so each affliction has two items that can cure it. My systems fine if I want to ONLY use the existing curing items, but i wanted to make it so that my curing system automatically uses the secondary item for each cure if I run out of the primary curing item. outr.<cure> refers to items that are in my inventory (and thus ready to be eaten) inr.<cure> refers to a cure that I have more of but are still in my rift.
In the case of the example function I showed, it would first check to see if I have ginseng in my inventory, then ferrum. If neither is in my inventory, it checks to see if either one is in my rift, checking ginseng first, then ferrum. |