Page 3 of 3

Re: boss buffing (items only atm)

Posted: Sun Feb 03, 2013 11:39 pm
by rock5
Had an idea. Maybe E0 is the cooldowns 'section'. Skills are 1 and are in the first section. Items are 3 so maybe the 3rd section. Wings was in between and sure enough it's 2.

Re: boss buffing (items only atm)

Posted: Mon Feb 04, 2013 6:57 am
by Jandrana
As far as I can see the new buff food available from the wedding area is missing. Maybe it is not yet known to everybody. It can be bought for phirius tokens. It does not overwrite any other buffs, lasts for 30 mins and stays even if you die.

I will try find the item IDs when I'm back at my game PC.

Re: boss buffing (items only atm)

Posted: Mon Feb 04, 2013 7:21 am
by lisa
Hmm haven't seen them yet, I'll have a look later but yeah Item ID's would be nice =)

Re: boss buffing (items only atm)

Posted: Mon Feb 04, 2013 2:44 pm
by Jandrana
Item Ids - I don't have all - the caster food is missing.

Meaningful Love Cake Slice (increases EP/TP gained in battle by 15% - lasts 30min) , ID:202895
Vanilla Strawberry Dessert (increases Str/Dex by 5% and patt by 1% - lasts 30min), ID:241959
Elegant Cuisine Delicacy (increase all attributes by 2% - lasts 30 min), ID:241965

Re: boss buffing (items only atm)

Posted: Mon Feb 04, 2013 6:04 pm
by lisa
thanks, I couldn't find the items on IS or anywhere else for that matter, got the buff info from memory, so it is untested.

Code: Select all

	{itemId = 202895, buffId = 850473, types = "both"},			-- Meaningful Love Cake Slice, possible other buffid 623767
	{itemId = 241959, buffId = 850476, types = "physical"},		-- Vanilla Strawberry Dessert, possible other buffid 623770
	{itemId = 241965, buffId = 850482, types = "both"},			-- Elegant Cuisine Delicacy, possible other buffid 623776
{itemId = 203024, buffId = 492469, types = "both"},			-- Blessing of the Flower God, possible other buffid 502704

Re: boss buffing (items only atm)

Posted: Mon Feb 04, 2013 11:12 pm
by lisa
ok finally I worked out a way to do it

After trying a few different things which were painful to actually use, I ended up just adding items to another temp table and recycling tables.

Code: Select all

local workingtable = itemtable
-- do stuff and add items to table tmptable
	workingtable = tmptable
	tmptable = {}
-- do stuff and add items to table tmptable
	workingtable = tmptable
	tmptable = {}
-- do stuff and add items to table tmptable
	workingtable = tmptable
	tmptable = {}
I have it so it filters out items on cooldown and ones with existing buff groups.

So now I am down to items I can actually use that won't overlap an existing buff.

Code so far takes 33 milliseconds, so speed is still good.

Next step is to determine which items to use out of overlapping groups.
example
2 types of food that will over ride each other, they have the same item.group value.

Next, next step will be to determine optimal order to use the items in.

Have we got a maximum duration for buffs from memory yet?

Re: boss buffing (items only atm)

Posted: Mon Feb 04, 2013 11:37 pm
by rock5
lisa wrote:Have we got a maximum duration for buffs from memory yet?
Well I have nothing about duration in my skills excel because the bot hasn't used duration for a while. I had a look through it anyway but didn't see anything. Which makes sense because the duration of an effect is part of the effect (ie. buff) not the skill itself. But I can have a look for it as an offset of the buff.

Re: boss buffing (items only atm)

Posted: Tue Feb 05, 2013 12:16 am
by rock5
Nearly missed it. I was about to report that I couldn't find it but decided to search floats, as unlikely as that would be, and found it.

0x9C off the buffs base adddress.

So

Code: Select all

print(memoryReadFloat(getProc(),GetItemAddress(buffid)+0x9C))

Re: boss buffing (items only atm)

Posted: Tue Feb 05, 2013 1:22 am
by lisa
lol that would explain why I couldn't find it either, I didn't look at float values.

I'll test it out, thanks

Re: boss buffing (items only atm)

Posted: Tue Feb 05, 2013 3:58 am
by lisa
Tests I did look good.

My head is about to explote lol

I am still trying to manipulate the table for over lapping items and deciding which to use, to make it simple I decided to just use the highest level required of the items in the group.

This is really doing my head in though, I really think I should have just started simple and expanded on it.

As an example I have a table like this, sorted to be in order so I can just do comparison to last value.

Code: Select all

1       -1
2       9
3       9
4       19
5       39
6       65
7       65
8       65
9       65
10      65
11      65
12      65
13      66
14      66
15      66
16      151
17      151
18      154
19      165
I want to end up with just

Code: Select all

1       -1
2       9
3       19
4       39
5       65
6       66
7       151
8       154
9       165
So far my logic seems messed up and I end up with

Code: Select all

1       9
2       65
3       66
4       151
So yeah still bashing my head on this 1.

lol yep needed to start simple, slaps forehead.

This works

Code: Select all

	local tmptable = {}
	local previtem
	local gg = {1,9,9,19,39,65,65,65,65, 65,65,65,66,66,66,151,151,154,165}
	for k,v in ipairs(gg) do
		if previtem and v ~= previtem then 		-- new group, finish off old group
			if previtem then
				table.insert(tmptable,previtem)
			end
		else 							-- old group
			previtem = v
		end
		previtem = v
	end

Re: boss buffing (items only atm)

Posted: Tue Feb 05, 2013 5:39 am
by lisa
yes simple was the way to go, working code

Code: Select all

	for k,v in ipairs(workingtable) do
		if #workingtable == 1 then 	-- special case of just 1 item
			table.insert(tmptable,v)
			break
		end
		if (previtem.group ~= nil and v.group ~= previtem.group) then 		-- new group, finish off old group
			table.insert(tmptable,previtem)
			if k == #workingtable then table.insert(tmptable,v) end -- last item
			previtem = v
			bestitem = {}
		else
			if previtem.group == nil then -- first item
				previtem = v
			else
				--deal with multiples here
				if bestitem.group == nil then 
					bestitem = v
				else
					if v.RequiredLvl > bestitem.RequiredLvl then -- just assume higher level is better.
						bestitem = v
					end 
				end
			end	
		end
	end
My previous not working properly code was twice as many lines.

Re: boss buffing (items only atm)

Posted: Tue Feb 05, 2013 6:00 am
by lisa
ok so testing works fine now =)


So now how to decide which items to choose when you have choices.

The higher level was purely for testing.

I am now working on longer lasting buffs and maybe items you get for free, like housemaid items.

longer lasting buffs was easy.

Code: Select all

if v.maxBuffTime > bestitem.maxBuffTime then -- use longer lasting buffs.
generally housemaid items have a long duration time, so I guess just doing the max duration would also decide to use housemaid items.


To be honest in most cases people won't have multiple items that can't be used at the same time but it is still a good idea to include it =)


End result code takes 113 milliseconds (not including using items), pretty happy with that
buffs1.png

Posted working version here

Re: boss buffing (items only atm)

Posted: Sat Feb 09, 2013 11:46 am
by Ego95
Are Mage,priest and druid still the only "magic" users?
The Warlock would be a magic user too ;)

I didn't try your userfunction because I usually don't need bufffood to kill mobs with the bot but how does he userfunction uses them? Is there a special order to use the buffs?

AlterEgo95

Re: boss buffing (items only atm)

Posted: Sat Feb 09, 2013 7:12 pm
by lisa
it will go through all of your inventory, including itemshop, transmuter bags.
checks your existing buffs
checks which items are on cooldown
checks for buffs that will over ride other buffs
checks for items that share the same cooldown

decides to use the items of shared cooldown/buff according
housemaid items, then longer buff durations then lvl V 1.6

It then uses the items in order of longest lasting buff first.
Cool so I guess it right about warlocks

Code: Select all

	if player.Class1 == CLASS_MAGE or player.Class1 == CLASS_PRIEST or player.Class1 == CLASS_DRUID or player.Class1 == CLASS_WARLOCK then
		playertype = "magic"
	else
		playertype = "physical"
	end
I didn't try your userfunction because I usually don't need bufffood to kill mobs with the bot
I mainly did it for buffing up before bosses in instances.

Re: boss buffing (items only atm)

Posted: Sat Jun 01, 2013 8:27 pm
by Cindy
So anything come out of this? I am finding I need to buff before bosses, trying to find some code rather than repeat the exercise from scratch.

Re: boss buffing (items only atm)

Posted: Sun Jun 02, 2013 12:50 am
by rock5
There is a link to her working version a few posts above.

Re: boss buffing (items only atm)

Posted: Sun Jun 02, 2013 2:05 am
by lisa
I added the link to the top of the first post on this topic aswell