summaryrefslogblamecommitdiff
path: root/npc/craft/tweak.txt
blob: 4110bd3a14aa0ae31de8203401f1e40644c2d331 (plain) (tree)
1
2
3
4
5
6
7
8







                                                          














                                                                         
                     


           
                                    

                                                 
                           
 


                                         







                                                   
                                        

                                                                            

                                                                               
                                                           
                                                
 

                                  
                     



                            

                            

                     
                                         

                                                                        




                                                                                                      



                                                                       
                                 
                                 
                    
 
                        
                            
                                                        


                     
                     
                                                                  

                
// 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	{
    .@price=getarg(0, 600);

	// Adjust price
	.@price=POL_AdjustPrice(.@price);

    // How many times more can you tweak?
    // You get 1 action, capped to 6
    .@left=gettimeparam(GETTIME_HOUR)-SMITH_TWEAKS;
    if (.@left > 6) {
        .@left=6;
        SMITH_TWEAKS=gettimeparam(GETTIME_HOUR)-6;
    }

    mes l("Which item will you tweak?");
    mesc l("Note: You can only perform this operation @@/6 times.", .@left);
    mesc l("You recover a tweaking point every hour.");
    mesc l("EXPERTS ONLY - If you are not a talented crafter, avoid this."), 1;
    mesc l("The item must have a previous bonus, which WILL BE LOST!"), 1;
    mesc l("Note: You may fail to write skills to it."), 1;
    mesc l("Operation Cost: @@ GP", .@price), 3;

    // Do you have money or AP
    if (Zeny < .@price || !.@left)
        return false;

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

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

    // If the item have no bonuses - fail
    setarray .@AlwaysTweaks, BlacksmithAxe, Dustynator, Lightbringer,
                             DemureAxe, Tyranny, Runestaff, AegisShield;
    delinventorylist();
    getinventorylist();
    .@x=@inventorylist_id[.@id];

    if (getitemoptionidbyindex(.@id, 0) <= 0 && !is_master() && array_find(.@AlwaysTweaks, .@x) < 0) {
        mesc l("This item have no bonuses, and cannot be tweaked."), 1;
        return false;
    }

    // Take the money and AP away
	POL_PlayerMoney(.@price);
    SMITH_TWEAKS+=1;

    // 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;
}