summaryrefslogblamecommitdiff
path: root/npc/craft/smith.txt
blob: ba2155210f7840f92ba231052c51144eaa961647 (plain) (tree)
1
2
3
4
5
6
7






                                     








                                                                                 

































                                                                                                                
// TMW2 Script
// Author:
//  Jesusalva
// Description:
//  Smith System (Player, Guild, NPC)
// Notes:
//  Base for Evol MR
// This one is more crazy. Cannot be equipping target craft.
// After successful craft, we use CraftDB return code to equip() the
// new item and apply a random option bonus based on crafter skills
// eg. setequipoption(EQI_HAND_R, 1, VAR_STRAMOUNT, 5)
// We should be able to apply several bonuses for the nicest experience :3
// We should also add a movespeed bonus... So demure can specialize herself in
// crafting really fast weapons in every aspects, and this system would allow her
// to do so :> But then, maybe we should have a crafting skill where players can
// allocate status points?

// Usage: SmithSystem ({scope})
// Scopes: CRAFT_NPC, CRAFT_PLAYER, CRAFT_GUILD
// If an invalid scope is passed, .knowledge won't be set but will be required
// Returns true on success, false on failure
function	script	SmithSystem	{
    // Set .scope, .knowledge and .success
    .scope=getarg(0, CRAFT_PLAYER);
    if (.scope == CRAFT_PLAYER)
        copyarray(.knowledge,RECIPES_EQUIPMENT,getarraysize(RECIPES_EQUIPMENT));
    else if (.scope == CRAFT_GUILD)
        copyarray(.knowledge,$@RECIPES_EQUIPMENT[getcharid(2)],getarraysize($@RECIPES_EQUIPMENT[getcharid(2)]));
    .success=false;

    setskin "craft4";
    .@var$ = requestcraft(4);
    .@craft = initcraft(.@var$);
    .@entry = findcraftentry(.@craft, CRAFT_EQUIPMENT);
    if (debug || $@GM_OVERRIDE) mes "found craft entry: " + .@entry;
    if (debug || $@GM_OVERRIDE) mes "knowledge value: " + .knowledge[.@entry];
    if (.@entry < 0) {
            .success=false;
    } else {
        if (.scope == CRAFT_NPC || .knowledge[.@entry]) {
            usecraft .@craft;
            .success=true;
        } else {
            .success=false;
        }
    }
    deletecraft .@craft;
    setskin "";
    return .success;
}