summaryrefslogblamecommitdiff
path: root/npc/craft/tweak.txt
blob: c6d966f4e9737bb78addb2a6ad7483dae974c1c1 (plain) (tree)

























                                                                            





                                                                 













                                                    
                                                         




                                                     
// TMW2 Script
// Author:
//  Jesusalva
// Description:
//  Smith System (Player, Guild, NPC)
// Notes:
//  It's like smithing, but it only change an item options

// Usage: SmithTweakSystem ({scope})
// Scopes: CRAFT_PLAYER, CRAFT_NPC
// Returns true on success, false on failure
function	script	SmithTweakSystem	{
    // Set .scope, .knowledge and .success
    .scope=getarg(0, CRAFT_PLAYER);
    copyarray(.knowledge,RECIPES_EQUIPMENT,getarraysize(RECIPES_EQUIPMENT));
    .success=false;

    mes l("Which item will you tweak?");
    mesc l("WARNING, ITEM MAY BREAK"), 1;

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

    if (.@id < 0)
        return false;

    // *getequipisenableopt(<equipment slot>) → cannot use here
    // Not an equipment
    if (!getiteminfo(.@id, ITEMINFO_LOC))
        return false;


    // Clear all five options
    setitemoptionbyindex(.@id, 0, 0, 0);
    setitemoptionbyindex(.@id, 1, 0, 0);
    setitemoptionbyindex(.@id, 2, 0, 0);
    setitemoptionbyindex(.@id, 3, 0, 0);
    setitemoptionbyindex(.@id, 4, 0, 0);

    // Check if you fail
    if (rand(0,10000) < 200) {
        mesc l("ITEM BREAKS, ALL OPTIONS LOST!"), 1;
        return false;
    }

    // Eh, apply some stuff for testing
    setitemoptionbyindex(.@id, 0, VAR_MAXHPAMOUNT, 2000);
    setitemoptionbyindex(.@id, 1, VAR_STRAMOUNT, 10);
    setitemoptionbyindex(.@id, 2, VAR_VITAMOUNT, -5);
    mesc l("SUCCESS!"), 3;
    return true;
}