summaryrefslogtreecommitdiff
path: root/npc/craft/tweak.txt
blob: b0eb9cdb2c4501d97ec3fe1e2e0531806a1d489a (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// TMW2 Script
// Author:
//  Jesusalva
// Description:
//  Smith System (Player, Guild, NPC)
// Notes:
//  It's like smithing, but it only change an item options

// Usage: SmithTweakReset ()
// Asks if player wants to remove an item options. And remove them.
function	script	SmithTweakReset	{
    mesc l("Note: This action cannot be undone."), 1;
    mes l("Drag and drop here the item you want to remove the options.");

    .@id=requestitemindex();
    mes "";

    // Ask player to confirm
    mesc l("Are you sure?"), 1;
    mesc l("Note: This action cannot be undone."), 1;
    if (!csys_Confirm(.@id))
        return;

    csys_Check(.@id);
    return;
}

// Usage: SmithTweakSystem ({price})
// Returns true on success, false on failure
function	script	SmithTweakSystem	{
    // Set .knowledge and the price
    .@price=getarg(0, 600);
    copyarray(.knowledge,RECIPES_EQUIPMENT,getarraysize(RECIPES_EQUIPMENT));

    mes l("Which item will you tweak?");
    mesc l("Note: You may fail to write skills to it."), 1;
    mesc l("Operation Cost: @@ GP", .@price), 3;

    if (Zeny < .@price)
        return false;

    .@id=requestitemindex();
    mes "";

    // Ask player to confirm
    if (!csys_Confirm(.@id))
        return false;

    // Take the money away
    Zeny-=.@price;

    // Check if you fail
    if (!csys_Check(.@id)) {
        mesc l("YOU FAIL! It is a simple item now."), 1;
        return false;
    }

    csys_Apply(.@id);
    mesc l("SUCCESS! Congratulations, the item was improved!"), 3;
    return true;
}