summaryrefslogtreecommitdiff
path: root/npc/functions/petsales.txt
blob: b98634670c77c253861a4f40e55b8f2d7442c73b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// TMW-2 Script
// Author: Jesusalva
// Desc:   Grand Hunter Pet Quest Utils.
// Note:   Remember to update GHQ and pet_detective on LoF Village (017-1)

// Core logic for Pet Detective. Doesn't checks for stock, allowing exploits.
// MobID, ItemID, Base Value
function	script	PDQ_InnerSwitch	{

    .@mid=getarg(0);
    .@iid=getarg(1);
    .@val=getarg(2, 30);

    .@qid=GHQ_GetQuestIDByMonsterID(.@mid);
    .@price=.@val*(PETMEMO[.@qid]+1)+PETMEMO[.@qid];

    mesn;
    mesq l("That'll cost you @@/@@ @@.", countitem(.@iid), .@price, getitemlink(.@iid));
    next;
    if (askyesno() == ASK_YES) {
        if (countitem(.@iid) >= .@price) {
            delitem .@iid, .@price;
            makepet .@mid;
            getexp .@price*BaseLevel, 0;
            PETMEMO[.@qid]+=1;
            mesn;
            mesq l("There you go!");
            return 1;
        } else {
            mesn;
            mesq l("You don't have that, lying is bad for health...");
        }
    }
    return 0;
}

// Returns GHMEMO[GHQ_GetQuestIDByMonsterID(PetName)]
// Arguments: PetName (eg. Maggot)
function	script	PDQ_CheckGHQ	{
    .@mid=GHQ_GetQuestIDByMonsterID(getarg(0));
    return GHMEMO[.@mid];
}