Feature - Implemented [patch] Tea Party command + Daily Deeds entry

Aankhen

Member
This patch adds a simple ‘teaparty <hat>’ command that uses a "DRINK ME" potion if necessary, equips the hat, gets the buff and re-equips whatever you were wearing earlier. It also adds an entry in the Daily Deeds panel indicating whether you’ve gotten the buff today.

Sample output:
Code:
> help teaparty

teaparty hat - Get a buff from the Mad Tea Party while wearing specified hat

> teaparty

You don't have a .

> teaparty h

[h] has too many matches.

> teaparty turban

Using 1 "DRINK ME" potion...
You acquire an effect: Down the Rabbit Hole (duration: 20 Adventures)
Finished using 1 "DRINK ME" potion.
Putting on paperclip turban...
Equipment changed.
Getting Bottle in front of Me (Spell Damage +15) from the Mad Tea Party...
Encounter: The Mad Tea Party
You acquire an effect: Bottle in front of Me (duration: 30 Adventures)
Putting on Crown of Thrones...
Equipment changed.

EDIT:
Added missing patch.
 

Attachments

  • tea-party-command.patch
    16.6 KB · Views: 62
Last edited:

Bale

Minion
It would be nice if the hatter command used hats and Drink Me potions like this:

alias tea => ashq string h = $string[%%]; boolean tea = get_property("_madTeaParty").to_boolean(); if(h == ""){cli_execute("hatter"); if(tea) print("You've already partied today!"); else print("Tea + Parties = Teh Win! Go party today."); exit;} void out(string p){print(p, "red"); exit;} if(tea) out("You've already drunk tea today. Do some adventuring!"); item hat = h.to_item(); if(hat.to_slot() != $slot[hat]) out(h+" is not a hat!"); if(item_amount(hat) < 1) out("You don't have a "+hat); if(have_effect($effect[Down the Rabbit Hole])< 1){if(item_amount($item["DRINK ME" potion ]) < 1) out("You need a \"Drink Me\" Potion to drink tea!"); else use(1, $item["DRINK ME" potion ]);} item old_hat = equipped_item($slot[hat]); equip(hat); visit_url("rabbithole.php?action=teaparty"); visit_url("choice.php?pwd&whichchoice=441&option=1&choiceform2=Try+to+get+a+seat"); equip(old_hat);

If the hatter command isn't amended that way, I'm fine since I have my alias. And now everyone else does also.

Let's put in some line breaks and indentation to make it easier to read. ;)

PHP:
string h = $string[%%]; 
boolean tea = get_property("_madTeaParty").to_boolean(); 
if(h == "")
{
   cli_execute("hatter"); 
   if(tea) 
      print("You've already partied today!"); 
   else print("Tea + Parties = Teh Win! Go party today."); 
   exit;
}
void out(string p)
{
   print(p, "red"); 
   exit;
} 
if(tea) 
   out("You've already drunk tea today. Do some adventuring!"); 
item hat = h.to_item(); 
if(hat.to_slot() != $slot[hat]) 
   out(h+" is not a hat!"); 
if(item_amount(hat) < 1) 
   out("You don't have a "+hat); 
if(have_effect($effect[Down the Rabbit Hole])< 1)
{
   if(item_amount($item["DRINK ME" potion ]) < 1) 
      out("You need a \"Drink Me\" Potion to drink tea!"); 
   else use(1, $item["DRINK ME" potion ]);
} 
item old_hat = equipped_item($slot[hat]); 
equip(hat); 
visit_url("rabbithole.php?action=teaparty"); 
visit_url("choice.php?pwd&whichchoice=441&option=1&choiceform2=Try+to+get+a+seat"); 
equip(old_hat);
 
Last edited:

Aankhen

Member
You didn't attach the patch.
Huh, odd, it was listed in the attachments when I was posting.
Also, is there a reason it isn't combined with the hatter command?
I figured they were conceptually different. That said, what Bale posted makes sense to me, so I’ll update the patch later today. I edited in the missing original meanwhile for posterity. :)
 
Last edited:

Theraze

Active member
They look (superficially, at least) to be the same file... both are 16.6kb. Is that the case?
 

Aankhen

Member
Merged it with the ‘hatter’ command and removed the dependency on the VIP key.
Code:
> hatter turtleban

Searching for ""drink me" potion"...
Purchasing "DRINK ME" potion (1 @ 290)...
You acquire an item: "DRINK ME" potion
Purchases complete.
Using 1 "DRINK ME" potion...
You acquire an effect: Down the Rabbit Hole (duration: 20 Adventures)
Finished using 1 "DRINK ME" potion.
Putting on bubblewrap bottlecap turtleban...
Equipment changed.
Getting Quadrilled (+20% Items from Monsters) from the Mad Tea Party...
Encounter: The Mad Tea Party
You acquire an effect: Quadrilled (duration: 30 Adventures)
Putting on Crown of Thrones...
Equipment changed.

> hatter turtleban

You have already attended a Tea Party today.
Bale, I was wondering: why not just use retrieve_item() rather than failing if you don’t have a potion? If you don’t have Mafia set up to buy stuff from the mall, it’ll say as much, while if you do have it set up to buy stuff… isn’t it because you want it to handle these little things?
 

Attachments

  • tea-party-buff.patch
    16.8 KB · Views: 57

Bale

Minion
Bale, I was wondering: why not just use retrieve_item() rather than failing if you don’t have a potion? If you don’t have Mafia set up to buy stuff from the mall, it’ll say as much, while if you do have it set up to buy stuff… isn’t it because you want it to handle these little things?

You're absolutely right. I should have done it like that. if(!retrieve_item( would have been better.
 

Aankhen

Member
Ah, I thought it was a design decision.

EDIT:
The logic for the Daily Deeds panel was flipped.
 

Attachments

  • tea-party-buff.patch
    16.8 KB · Views: 51
Last edited:

fronobulax

Developer
Staff member
Does this do anything that is not already available in Bale's scripting work? If so, can someone explain what that is and then redo the patch so it will work a year later?
 

slyz

Developer
It would be nice for Mafia to know how to receive Mad Hatter buffs, so the Maximizer could be aware of them.
 

Aankhen

Member
Does this do anything that is not already available in Bale's scripting work? If so, can someone explain what that is and then redo the patch so it will work a year later?
The only differences are that it integrates with the ‘hatter’ command and it prints the details of the expected result. I’m attaching the version of the patch that I’m using at present.
 

Attachments

  • tea-party-command.patch
    6.4 KB · Views: 39
Last edited:

roippi

Developer
It would be nice for Mafia to know how to receive Mad Hatter buffs, so the Maximizer could be aware of them.

That would indeed be nice. Perhaps that should be pulled out to a separate feature request?

Aside: my eventual goal is to have a combobox in daily deeds that is smartly populated with available hatter buffs. That is pretty much reliant on RabbitholeRequest being a "proper" request as in UseItem and UseSkill (and various children thereof).

Ah, I thought it was a design decision.

EDIT:
The logic for the Daily Deeds panel was flipped.

A quick look at your patch and I see some use of generics and foreach loops, both java 1.5 features. Mafia is still 1.4 compliant, I believe.
 
Last edited:

roippi

Developer
r10322 applies a modified version of Aankhen's patch.

I'd still like to see hatter buffs tied in to the acquisition system as per above, but I'll go ahead and mark this implemented.
 
Top