Page 1 of 1

housemaid potions and foods

Posted: Fri Jan 14, 2011 12:24 pm
by Giram
This addon helps using potions and foods got from housemaids.

These lines can be placed for example in onLeaveCombat so it will use it after combat.

Code: Select all

useHousemaidPotions("speed");
useHousemaidPotions("frog");
useHousemaidPotions("luck");
useHousemaidPotions("clearThought");
useHousemaidPotions("crazyBreakout");
useHousemaidPotions("fullness");
useHousemaidPotions("gallopingGale");
useHousemaidPotions("MeatsauceBurrito");
useHousemaidPotions("caviarSandwich");
useHousemaidPotions("saltedFish");
useHousemaidPotions("deliciousSwampMix");
useHousemaidPotions("unimaginableSalad");
useHousemaidPotions("cheeseFishcake");
If some potion / food is missing you can post it and i update this addon. Just need name of the buff and the name of potion.

Re: housemaid potions and foods

Posted: Fri Jan 14, 2011 8:16 pm
by rock5
Can I make a small suggestion? Instead of

Code: Select all

			if not player:hasBuff(option.buffName) and inventory:itemTotalCount(option.potID) >= 1 then
use

Code: Select all

			if inventory:itemTotalCount(option.potID) >= 1 and not player:hasBuff(option.buffName)  then
That way, if you don't have the potion you save half a second that hasBuff would have taken to execute. hasBuff takes time to execute because it uses RoMScript().

Re: housemaid potions and foods

Posted: Fri Jan 14, 2011 8:53 pm
by Giram
Code has been optimized.

Re: housemaid potions and foods

Posted: Sat Jan 15, 2011 9:58 am
by jduartedj
Looks a lot like my UseFood() function but with a table! Seems nice. Maybe we could merge the two and submit for adding to the bot like i discussed with rock5 in my thread?

Re: housemaid potions and foods

Posted: Sat Jan 15, 2011 11:25 am
by Giram
I don't mind merging our works and it would be nice if my work will improve bot :)

But still i am not sure if this contains all potions / foods if it matters.

Re: housemaid potions and foods

Posted: Sat Jan 15, 2011 11:41 am
by jduartedj
Giram wrote:I don't mind merging our works and it would be nice if my work will improve bot :)

But still i am not sure if this contains all potions / foods if it matters.
We can look it up and include every housemaid pots/foods in the table including useless ones (go figure why but some people might wanna use them), also merging with mine would allow support for any item as long as it is user input, like UseFood(item,buff) (see my function for details).

Anyway I'm gonna have a look at both code and post a merge suggestion with a file, Then you can look at it and make your own suggestions and so on... ok?

Re: housemaid potions and foods

Posted: Sat Jan 15, 2011 11:59 am
by Giram
Post your work when you combine these.

Re: housemaid potions and foods

Posted: Sat Jan 15, 2011 1:21 pm
by rock5
You should do the table like this?

Code: Select all

itemTable ={
			speed = {potID = 207200, buffName = "Unbridled Enthusiasm", castTime = 0},
			frog = {potID = 207201, buffName = "Princely Look", castTime = 1000},
			luck = {potID = 207203, buffName = "Turn of Luck Powder Dust", castTime = 0},
			clearThought = {potID = 207202, buffName = "Clear Thought", castTime = 0},
			crazyBreakout = {potID = 207205, buffName = "", castTime = 1000},
			fullness = {potID = 207199, buffName = "Fullness", castTime = 0},
			gallopingGale = {potID = 207204, buffName = "Galloping Gale", castTime = 0},
			MeatsauceBurrito = {potID = 207213, buffName = "Spicy Meatsauce Burrito", castTime = 0},
			caviarSandwich = {potID = 207211, buffName = "Caviar Sandwich", castTime = 0},
			saltedFish = {potID = 207209, buffName = "Salted Fish with Sauce", castTime = 0},
			deliciousSwampMix = {potID = 207214, buffName = "Delicious Swamp Mix", castTime = 0},
			unimaginableSalad = {potID = 207215, buffName = "Unimaginable Salad", castTime = 0},
			cheeseFishcake = {potID = 207215, buffName = "Cheese Fishcake", castTime = 0}
			}
That way you don't have to search for the values.

Code: Select all

function useHousemaidPotions(_potionName)
	local option = itemTable[_cName]
	if option and inventory:itemTotalCount(option.potID) >= 1 and not player:hasBuff(option.buffName) then
		inventory:useItem(option.potID);
		
		if option.castTime > 0 then
			yrest(option.castTime);
		end
		
		inventory:update();
		yrest(750);
	end
end

Re: housemaid potions and foods

Posted: Sun Jan 16, 2011 10:58 pm
by jduartedj
Like I promised this is my suggestion:
useGoodie

Re: housemaid potions and foods

Posted: Tue Mar 08, 2011 10:42 pm
by j19861986
You forgot "Godspeed" potion from Crafting Maid and "Scarlet Love" Potion from Crafting Maid... that is for my needs
I still haven't checked buffname yet, so I leave it empty, will add the Buffname later...
look in code and tell me if it is correct

Code: Select all

[13] = {optionName = "cheeseFishcake", potID = 207215, buffName = "Cheese Fishcake", castTime = 0},
[14] = {optionName = "godspeed", potID = 207208, buffName = "", castTime = 0},
[15] = {optionName = "scarletlove", potID = 207206, buffName = "", castTime = 0}
}

Re: housemaid potions and foods

Posted: Wed Mar 09, 2011 9:09 am
by Giram
This project has been combined with jduartedj work. Newest version can be downloaded from this link:

http://www.solarstrike.net/phpBB3/viewt ... 949#p18949

To use that you need to use another command. for example:

Code: Select all

useGoodie("speed");