How do I craft my pantogram pants using mafia?

ereinion

Member
Especially in aftercore I often craft the same pants every day, and going through the 5 pulldown menus in the choice every time is something I'd like to automate. However, I can't figure out what the url used to do this / what other commands I'd use to accomplish my goal would be. Have any of you guys made any attempts at this, and if so, would you be willing to share how you went about it?
 

AlbinoRhino

Active member
This is from my personal library and is mainly focused on grabbing a pair for meat farming. Most of the notes I made when writing it are still included as comments and may or may not be helpful.

In any event, you can always find any particular link you are looking for by using the cli 'debug trace on/off' commands. Turn it on, click the link you want to capture, turn it off...then look in the TRACE log in your mafia folder for the link.

I pretty much quit working on it after I got it reliably making meat-farming pants but I think I wrote it so it could be developed further, if wanted.


PHP:
[CODE]
void usepanto(string modreq)
{
    item p = $item[portable pantogram];
    
    #pantogram_items (see item static list above)
    if    ( item_amount(p) == 0 )
    {
        #no iotm
        return;
    }
    
    if    ( get_property("_pantogramModifier") != "" )
    {
        #already used today
        return;
    }
    
    
    #==========================================================================
    #usage info & example links - pantogram
    #==========================================================================
    #fldst


        
        /* pantogram example - barf farm setup +60 meat


        use panto link: inv_use.php?pwd&which=99&whichitem=9573
        
        example creation link:
        mus +10 & st.res & HP +40 & -com & (req porquoise X1 i#706) +60% meat
        params?: m[mus/mys/mox] e[ele res] (sacrifices) s1[left?] s2[right of page] s3[middle?]
        %2C = comma
        negative numbers for non-item sacrifices
        LINK: choice.php?whichchoice=1270&pwd&option=1&m=1&e=5&s1=-1%2C0&s2=706%2C1&s3=-2%2C0
        _pantogramModifier = Muscle: 10, Stench Resistance: 2, Maximum HP: 40, Meat Drop: 60, Combat Rate: 5, Lasts Until Rollover: true




        #other items info (prices via fnd.ash: 2017.12.13)
        173 taco shell @ 76 [40 A] (x1) = +30% meat
        706 porquoise @ 10,000 [500 A] = +60% meat
        
        7338 tiny dancer @ 6,400 [135 A] (x1) = +30% item
        80 fairy gravy boat @ 6,780 [5 A] (x1) = +15% item
        
        prop: _pantogramModifier


         */
    #fldend
    #==========================================================================
    #END usage info & example links - pantogram
    
    boolean use_pp()
    {
        string upp = visit_url("inv_use.php?pwd&which=99&whichitem=9573");
        
        if    ( upp.index_of("You've already summoned") > -1 )
        {
            return false;
        }
        
        return true;
    }
    
    #retrieve panto items 1X ascension
    if    ( kl && !get_property("aaa_ARLibPantoItems").to_boolean() )
    {
        set_property("aaa_ARLibPantoItems", "true");
        cli_execute("arl.ash panto");
    }
    
    
    #http://kol.coldfront.net/thekolwiki/index.php/Pantagramming#Pant_Modifiers
    #modreq values
    #barffarm = Muscle: 10, Stench Resistance: 2, Maximum HP: 40, Meat Drop: 30 [taco shell 173], Combat Rate: 5
    #meat+c = Muscle: 10, Stench Resistance: 2, Maximum HP: 40, Meat Drop: 30 [taco shell 173], Combat Rate: 5
    #barffarm60 = Muscle: 10, Stench Resistance: 2, Maximum HP: 40, Meat Drop: 60 [porquoise 706], Combat Rate: 5
    #meat60+c = Muscle: 10, Stench Resistance: 2, Maximum HP: 40, Meat Drop: 60 [porquoise 706], Combat Rate: 5
    
    #%2C = comma
    #mafia will encode a '%' sign as %25 if used in the url - so %2C is submitted as %252C
    #from session log:
    #choice.php?whichchoice=1270&pwd&option=1&m=1&e=5&s1=-1%252C0&s2=706%252C1&s3=-2%252C0
    #this produces pants with only the m= & e= enchantments
    
    #http://wiki.kolmafia.us/index.php?title=Visit_url
    #buffer visit_url(string page ,boolean use_POST (def T) , boolean encoded (def F) )
    #performing a POST request if use_POST is omitted or true, or a GET request if false.
    #encoded is false if the parameter is not used. If set to true, then the url is assumed to be pre-encoded by the user.
    
    string getpants = "";
    #+com, +30% mt
    if    ( modreq == "barffarm" || modreq == "meat+c" )
    {
        if    ( logrtrv(1,$item[taco shell]) )
        {
            if    ( use_pp() )
            {
                getpants = visit_url("choice.php?whichchoice=1270&pwd&option=1&m=1&e=5&s1=-1%2C0&s2=173%2C1&s3=-2%2C0",true,true);
            }
        }
    }
    
    #+com, +60% mt
    if    ( modreq == "barffarm60" || modreq == "meat60+c" )
    {
        if    ( logrtrv(1,$item[porquoise]) )
        {
            if    ( use_pp() )
            {
                getpants = visit_url("choice.php?whichchoice=1270&pwd&option=1&m=1&e=5&s1=-1%2C0&s2=706%2C1&s3=-2%2C0",true,true);
            }
        }
    }
    
    
    
    
    #exit choice with nothing (ch#2 ?)
    if    ( getpants == "" )
    {
        getpants = visit_url("choice.php?whichchoice=1270&pwd&option=2");
    }
    else
    {
        bigp("PANTO: "+get_property("_pantogramModifier"),"green",3);
    }
    
    return;
}
[/CODE]
 

AlbinoRhino

Active member
More briefly, the creation link looks like this:

do this first to activate the choice page (the pants creation page is a choice.php page):
visit_url("inv_use.php?pwd&which=99&whichitem=9573");


example creation link:
mus +10 & st.res & HP +40 & -com & (req porquoise X1 i#706) +60% meat

choice.php?whichchoice=1270&pwd&option=1&m=1&e=5&s1=-1%2C0&s2=706%2C1&s3=-2%2C0

parameters:
m [mus/mys/mox] = 1 to 3 (corresponding to the list in the dropdown)
e [ele res] = 1 to 5 (corresponding)

(sacrifices) values are an item# & an amount, separated by a comma (in the form %2C)
s1 [dropdown on left side of bottom of pantogram page]
s2 [right of page] in the example, item #706 (porquoise) with an amount of 1
s3 [middle]

%2C = comma
negative numbers for non-item sacrifices (and amount = 0)

If you hardcode the '%2C' into your link you must use the 3-parameter version of 'visit_url()' so you can tell mafia that the link is already url-encoded.
 
Last edited:

ereinion

Member
Thanks a ton - I'll give it a go tomorrow, I already crafted my pants for today :p I had figured out the url to get to the choiceadventure, but I couldn't figure out the second one. Tried doing it in the mini-browser, but the button to actually craft the pants didn't show up there - I'll try to remember the debug option for next time :)
 
Top