--====== User Options ======--
usepot = true -- set to true if you want the script to use mount speed pot in your inventory if it finds one. It doesn't matter if you set this to true even if you don't have any pots. This switch is just for people who might wanna save their pots for something else so they don't want the script to use it. Anything other than true will make it default to false.
gethighestreward = false -- set to true if you want to complete the quest ONLY when you're going to get five certificates (meaning, you had a fast run and completed it with more than 2.5 minutes left). The script will cancel the quest and redo it until it gets a fast time. Setting this to anything other than true will make it default to false.
npctalktime = nil -- this is only relevant if you set gethighestreward to true. You will have to account for how many seconds it takes your character to talk to the npc and complete the quest. If you have high ping, then make sure this number is set high enough, do some testing to make sure. If set to nil, it will default to 5.
nextwp = "" -- sets the next waypoint file you want to load after this waypoint finishes.
--==========================--
questid = 422917
drunk = 620787
chill = 620789
npc = 111452 -- Pechores
pot = inventory:findItem(207204)
claimreward = getTEXT("SC_BEERDAY_29") -- ChoiceOption(2)
exchange = getTEXT("SC_BEERDAY_32") -- ChoiceOption(1)
function toboolean(arg)
return type(arg) == "string" and arg == "true" or type(arg) == "boolean" and arg == true
end
gethighestreward = toboolean(gethighestreward)
usepot = toboolean(usepot)
npctalktime = tonumber(npctalktime) or 5
limit = 150 + npctalktime
function drink()
player:updateBuffs()
yrest(10)
local juice = inventory:findItem(240506)
if juice and not player:hasBuff(drunk) then
for i = 1, 9 do
juice:use()
yrest(250)
end
printf("Your current Speed is %s.\n",math.floor(mSpeed()))
end
end
function quest()
return getQuestStatus(questid)
end
function cancel()
printf("Canceling quest.\n")
CancelQuest(questid)
yrest(500)
end
function mSpeed()
local mounted = memoryReadInt(getProc(), player.Address + addresses.charPtrMounted_offset)
local spd = memoryReadFloat(getProc(), mounted + 0x40);
return spd
end
player:update()
yrest(500)
if 2 > inventory:itemTotalCount(0) then
cprintf(cli.lightred,"\nThere Is Not Enough Bag Space For The Quest Item/s.\n\n")
error("Not enough Bag Space.")
end
if usepot and pot then
pot:use()
yrest(500)
end
if not player.Mounted then
repeat
player:mount()
yrest(500)
player:updateMounted()
yrest(500)
until player.Mounted
end
cancel()
__WPL:setWaypointIndex(1)
if quest() == "not accepted" then
local retries = 0
repeat
player:target_NPC(npc);
yrest(500)
AcceptQuestByName(questid)
yrest(500)
retries = retries + 1
until quest() ~= "not accepted" or retries == 8
if retries == 8 then
print("Seems like the char has already done the quest for today.")
loadPaths(nextwp)
else
registerTimer("Drink", 100, drink);
end
end
player:target_NPC(119194); -- Juice Party Station Employee
player:target_NPC(119194);
player:target_NPC(119194);
player:target_NPC(119194);
player:target_NPC(119194);
if quest() == "complete" then
if gethighestreward and player:hasBuff(chill) and limit > player:getBuff(chill).TimeLeft then
cancel()
printf("Couldn't do quest fast enough. Redoing Quest.\n")
loadPaths(__WPL.FileName)
end
repeat
player:target_NPC(npc);
yrest(500)
CompleteQuestByName(questid)
yrest(500)
until quest() ~= "complete"
unregisterTimer("Drink");
if inventory:itemTotalCount(205941) >= 15 then -- Juice Festival Attendance Certificate
repeat
player:target_NPC(121361); -- Juice Festival Reward Commissioner
yrest(500)
ChoiceOptionByName(claimreward)
yrest(1000)
ChoiceOptionByName(exchange)
until 15 > inventory:itemTotalCount(205941)
end
loadPaths(nextwp)
else
if quest() == "incomplete" then
cancel()
printf("Something went wrong during the run. Reloading WP.\n")
end
loadPaths(__WPL.FileName)
end