summaryrefslogblamecommitdiff
path: root/npc/010-4-1/katze.txt
blob: f7ee65e872ad2d11874644c78cf763b95094ef90 (plain) (tree)
1
2
3
4
5
6
7
8
9
10



                   
                                              


                                                       

                                           
         



                                    
         
                                                             
                                                                                    













                                                                                                 





































                                                                                                                                                                                                                                                                                                  




































                                                                                                                    
 
                                                                                   




                      
        
 


                   







































































                                                                        
                                                             




                                                                       
                                                                                   



























                                                                                                                                   






                                                                                                            







                                                       


        
// TMW2/LOF Script.
// Author:
//    Jesusalva
// Description:
//  Katze the Cat, guardian of Katzei Village.
// Variables:
//  $KATZE_DONATION = int
//  CaveQuest_Katze ( state, today_contribution, date )

010-4-1,44,30,0	script	Katze	NPC_KATZE,{
    mesn;
    if (isequipped(CatEars))
        mesq l("Meow, fellow cat!");
    else
        mesq l("Meow.");
    next;
    if (getq(LoFQuest_Inspector) == 5) goto L_InspectorQuest;
    if (getq(LoFQuest_Inspector) >= 6 && getq(CaveQuest_Katze) == 1) goto L_CatEars;
    mesn strcharinfo(0);
    mesq l("What is a cat doing in the middle of the desert?");
    next;
    mesn;
    mesq l("Why, I'm waiting for donors, of course. Don't you see the pot there?");
    next;
    mesn strcharinfo(0);
    mesq l("Do I gain anything by donating?");
    next;
    mesn;
    mesq l("My gratitude and the knowledge you helped to make this cave a nicer place to live?");
    compareandsetq CaveQuest_Katze, 0, 1;
    npctalk3 l("Did you knew that %s's generosity is legendary?", rand_sponsor());
    close;

L_InspectorQuest:
    mesc l("You ask Katze about the recent cheese robberies in Dimond's Cove.");
    next;
    mesn;
    mesq l("It was... an itch I couldn't scratch. But meow! I paid the fair price for the cheese I took.");
    next;
    mesn;
    mesq l("I know %s are rare and expensive. They should have more than covered the costs for what I took.", getitemlink(GoldenApple));
    next;
    mesc l("You spend some time explaining to Katze about how trade works.");
    next;
    mesn;
    mesq l("So you want me to sell the Apple to some vendor, and then purchase the Cheese with the money? Sure, just tell me the name of a NPC which buys %s and sells %s. But I warn you, they must be close, in either Tulimshar or Halinarzo.", getitemlink(GoldenApple), getitemlink(Cheese));
    next;
    input .@ans$;
    // I won't even bother blackboxing this one
    if (!riddlevalidation(.@ans$, "Juliet", l("Juliet"))) {
        mesn;
        mesq l("Don't be ridiculous and stop wasting my time.");
        mesc l("%s scrathes you! -%s HP.", .name$, fnum(Hp/5));
        percentheal -20, 0;
        close;
    }
    mesn;
    mesq l("Nard's nurse and shipkeeper? Yeah, I can do that, I can get a copy of his ship schedule rather easily.");
    next;
    inventoryplace GoldenApple, 1;
    mesn;
    mesq l("Well %s, you're not as incompentent as you look! Meow, here, you can have this %s, as a token of my appreciation.", strcharinfo(0), getitemlink(GoldenApple));
    next;
    mesn;
    mesq l("Let's be friends from now on, meow!");
    setq LoFQuest_Inspector, 6, 0;
    getitem GoldenApple, 1;
    getexp 60000, 600;
    close;

L_CatEars:
    mesn;
    mesq l("Actually, while we're friends, you don't look like a cat, which is weird. I guess we should fix that.");
    next;
    mesn;
    mesq l("Please bring me the following, and I'll make a fine cat out of you!");
    next;
    mesc b(l(".:: Katze's Request ::.")), 3;
    msObjective(countitem(WhiteFur) >= 250, l("* %d %s", 250, getitemlink(WhiteFur)));
    msObjective(countitem(Milk)     >= 200, l("* %d %s", 200, getitemlink(Milk)));
    msObjective(countitem(DuckFeather) >= 150, l("* %d %s", 150, getitemlink(DuckFeather)));
    msObjective(countitem(RawLog)   >= 50, l("* %d %s", 50, getitemlink(RawLog)));
    msObjective(countitem(BlackDye) >= 1,  l("* %d %s", 1, getitemlink(BlackDye)));
    if (countitem(WhiteFur)     < 250 ||
        countitem(Milk)         < 200 ||
        countitem(DuckFeather)  < 150 ||
        countitem(RawLog)       <  50 ||
        countitem(BlackDye)     <   1)
        close;
    mesc l("Deliver the items to Katze?"), 1;
    if (askyesno() == ASK_NO) { closeclientdialog; close; }
    inventoryplace CatEars, 1;
    delitem WhiteFur, 250;
    delitem Milk, 200;
    delitem DuckFeather, 150;
    delitem RawLog, 50;
    delitem BlackDye, 1;
    getitem CatEars, 1;
    getexp 92000, 8000;
    setq1 CaveQuest_Katze, 2;
    mesn;
    mesq l("Purrfect! Now wear this %s and... Vóila! You look like me, meow!", getitemlink(CatEars));
    next;
    mesn;
    mesq l("Come visit me whenever, meow!");
    // TODO: Unlock access to Katze's Village
    close;

// At some times, she goes to rob the bank... No, just kidding, but she has errands
OnClock1945:
    disablenpc .name$;
    end;
OnClock2015:
    enablenpc .name$;
    end;

OnInit:
    .distance=5;
    .sex = G_OTHER;

OnLoadMobilia:
    if ($KATZE_DONATION >= 5000)
        setcells "010-4-1", 44, 31, 44, 31, 2, "Katze_Books1";
    if ($KATZE_DONATION >= 10000)
        setcells "010-4-1", 43, 29, 43, 29, 2, "Katze_Hat1";
    if ($KATZE_DONATION >= 25000)
        setcells "010-4-1", 44, 22, 44, 22, 2, "Katze_Paint1";
    if ($KATZE_DONATION >= 60000)
        setcells "010-4-1", 46, 29, 46, 29, 2, "Katze_Flower1";
    if ($KATZE_DONATION >= 120000)
        setcells "010-4-1", 40, 33, 40, 33, 2, "Katze_Paint2";
    if ($KATZE_DONATION >= 250000)
        setcells "010-4-1", 40, 28, 40, 28, 2, "Katze_Books2";
    if ($KATZE_DONATION >= 500000)
        setcells "010-4-1", 46, 35, 46, 35, 2, "Katze_Flower2";
    if ($KATZE_DONATION >= 1000000)
        setcells "010-4-1", 46, 22, 46, 22, 2, "Katze_Paint3";
    if ($KATZE_DONATION >= 1500000)
        setcells "010-4-1", 41, 22, 41, 22, 2, "Katze_Cooks1";
    if ($KATZE_DONATION >= 2500000)
        setcells "010-4-1", 47, 30, 47, 30, 2, "Katze_Cooks2";
    if ($KATZE_DONATION >= 3000000)
        setcells "010-4-1", 42, 29, 42, 29, 2, "Katze_Cryst1";
    if ($KATZE_DONATION >= 3500000)
        setcells "010-4-1", 45, 31, 45, 31, 2, "Katze_Candle";
    if ($KATZE_DONATION >= 4000000)
        setcells "010-4-1", 46, 33, 46, 33, 2, "Katze_Paint4";
    if ($KATZE_DONATION >= 4500000)
        setcells "010-4-1", 47, 29, 47, 29, 2, "Katze_Desks1";
    if ($KATZE_DONATION >= 5000000)
        setcells "010-4-1", 48, 29, 48, 29, 2, "Katze_Cooks3";
    if ($KATZE_DONATION >= 6000000)
        setcells "010-4-1", 41, 28, 41, 28, 2, "Katze_Books3";
    if ($KATZE_DONATION >= 7000000)
        setcells "010-4-1", 45, 22, 45, 22, 2, "Katze_Paint5";
    if ($KATZE_DONATION >= 8000000)
        setcells "010-4-1", 37, 28, 37, 28, 2, "Katze_Flower3";
    if ($KATZE_DONATION >= 9000000)
        setcells "010-4-1", 43, 22, 43, 22, 2, "Katze_Cooks4";
    if ($KATZE_DONATION >= 1000000)
        setcells "010-4-1", 39, 33, 39, 33, 2, "Katze_Clock1";
    if ($KATZE_DONATION >= 1250000)
        setcells "010-4-1", 53, 24, 53, 24, 2, "Katze_Notes1";
    if ($KATZE_DONATION >= 1500000)
        setcells "010-4-1", 56, 25, 56, 25, 2, "Katze_Gifts1";
    if ($KATZE_DONATION >= 1750000)
        setcells "010-4-1", 40, 22, 40, 22, 2, "Katze_Cooks5";
    if ($KATZE_DONATION >= 2000000)
        setcells "010-4-1", 53, 26, 53, 26, 2, "Katze_Anvil1";
    if ($KATZE_DONATION >= 2500000)
        setcells "010-4-1", 35, 20, 35, 21, 2, "Katze_Statue1";
    end;
}

010-4-1,46,30,0	script	Pot#Katze	NPC_NO_SPRITE,{
    .@q = getq(CaveQuest_Katze);
    .@q3 = getq3(CaveQuest_Katze);
    // Quest not started
    if (!.@q) end;
    // Daily limit reset
    if (.@q3 != gettimeparam(GETTIME_DAYOFMONTH))
        setq CaveQuest_Katze, .@q, 0, gettimeparam(GETTIME_DAYOFMONTH);
    // Main loop
    mes "##B" + l("Drag and drop an item from your inventory.") + "##b";

    .@id = requestitem();

    // Check for donation restrictions
    if (.@id < 1) {
        mesc l("You give up.");
        close;
    } else if (checkbound(.@id) && .@id != LeatherSuitcase) {
        mesc l("You cannot donate bound items!");
        close;
    } else if ((getiteminfo(.@id, ITEMINFO_TRADE) & ITR_NOSELLTONPC)) {
        mesc l("This item cannot be given to NPCs!");
        close;
    } else if (!getiteminfo(.@id, ITEMINFO_MAXCHANCE) && .@id != LeatherSuitcase) {
        mesc l("This item is too precious, you cannot part with it!");
        close;
    } else if (getiteminfo(.@id, ITEMINFO_TYPE) != IT_HEALING &&
                 getiteminfo(.@id, ITEMINFO_TYPE) != IT_USABLE &&
                 getiteminfo(.@id, ITEMINFO_TYPE) != IT_ETC) {
        mesc l("You can only donate generic items to Katze.");
        close;
    }

    // Limit checks
    .@q2 = getq2(CaveQuest_Katze);
    .@gp = getiteminfo(.@id, ITEMINFO_SELLPRICE);
    if ((.@q2 + .@gp) > .limit) {
        mesc l("You cannot donate this item, as Katze is no beggar and she'll not allow you to impoverish yourself for her sake.");
        mesc l("Daily limit: %s / %s GP", fnum(.@q2 + .@gp), fnum(.limit)), 1;
        close;
    }

    // Everything went fine, so confirm & complete the donation
    mesc l("Are you sure you want to donate a %s to Katze?", getitemlink(.@id)), 1;
    if (askyesno() == ASK_YES) {
        delitem .@id, 1;
        setq2 CaveQuest_Katze, .@q2 + .@gp;
        $KATZE_DONATION += .@gp;
        npctalk l("Why %s, thank you!", strcharinfo(0)), "Katze";
        if ($@GM_OVERRIDE)
            debugmes sprintf("Katze Donations: %s", fnum($KATZE_DONATION));
        donpcevent "Katze::OnLoadMobilia";
        // Handle quest items
        if (.@id == LeatherSuitcase) {
            $KATZE_DONATION += rand2(500); // The suitcase contents
            compareandsetq LoFQuest_Inspector, 4, 5;
            getexp 5000, 100;
            dispbottom l("Now I should be able to ask Katze about the cheese robbery in the Land of Fire.");
        }
    }
    closeclientdialog;
    close;

OnInit:
    .distance=2;
    .sex = G_OTHER;
    .limit = 10000; // Max worth you can donate at once
    end;
}