summaryrefslogblamecommitdiff
path: root/npc/functions/vault.txt
blob: 69d9cbd4fab0d109f56d018e9d66465647197e48 (plain) (tree)
1
2
3
4
5
6
7
8
9





                     
                                         

                              




                       




                                                                                                            
                       
                           
                                                                                   




                                 

















                                                   







                                                  
                   
                
                                                
                 
                                                  
                 

                                                          

        
 



























                                                                        
// TMW-2 Script
// Author:
//    Jesusalva
//  Description:
//    Vault Utilities

function	script	getvaultid	{
    // FIXME: Make this False
    if ($BETASERVER && !debug)
        return ##VAULT;
    else
        return 0;
}

function	script	getvaultexp	{
    .@exp=getarg(0);
    if (.@exp > 100)
        Exception("ILLEGAL VAULT EXPERIENCE, FIXME URGENTLY. STOPPING SCRIPT BY FORCE WHILE DOING NOTHING.",
            RB_DEBUGMES | RB_IRCBROADCAST | RB_GLOBALANNOUNCE | RB_ISFATAL);
    if (getvaultid()) {
        ##VAULT_EXP+=.@exp;
        consoleinfo("Granting %d Soul Exp to %d under the Moubootaur's authority.",
                 .@exp, ##VAULT);
    }
    return;
}

function	script	export_vault	{
    // Send updates to Vault API
    if (getvaultid()) {
        .@api$=json_encode("UID", ##VAULT,
                           "GID", getcharid(3),
                           "VAR1N", "CRQUEST",
                           "VAR1V", ##01_CRQUEST,
                           //"VAR2N", "CRWORLD",
                           //"VAR2V", ##01_CRWORLD,
                           "VEXP", ##VAULT_EXP,
                           "GOTO", ##VAULT_GOTO,
                           "MLTO", ##VAULT_MLTO);
        ##VAULT_EXP=0;
        api_send(API_FLUSHVAULT, .@api$);
    }
    return;
}

// MirrorLakeSendTo(World, Lake)
function	script	MirrorLakeSendTo	{
    .@w=getarg(0);
    .@t=getarg(1);
    ##VAULT_GOTO=.@w;
    ##VAULT_MLTO=.@t;
    closeclientdialog;
    dispbottom l("Darkness fills your vision...");
    export_vault();
    sleep2(800);
    specialeffect FX_CIRCLE, SELF, getcharid(3);
    sleep2(1200);
    specialeffect FX_MGSHIELD, SELF, getcharid(3);
    sleep2(1200);
    kick(getcharid(3), 7); // 7 is not a valid kick reason
    //atcommand("@kick "+strcharinfo(0));
    end;
}


// BonusEXP({mobId})
function	script	BonusEXP	{
    // Only applies if you are not in TOP 3
    if (BaseLevel >= TOP3AVERAGELVL())
        return;

    // Permanent Level Boost
    if (#ADD_LVL) {
        .@mobId=getarg(0, killedrid);
        .@exp = min(#ADD_LVL, getmonsterinfo(.@mobId, MOB_BASEEXP) * 2);
        getexp .@exp, 0;
        #ADD_LVL-=.@exp;

        /*
        if ((readparam(BaseExp)+.@exp > readparam(NextBaseExp))) {
            do {
                if (BaseLevel >= TOP3AVERAGELVL()) break; // Boundaries
                .@v=readparam(NextBaseExp)-readparam(BaseExp);
                getexp .@v, 0;
                #ADD_LVL-=.@v;
            } while (readparam(BaseExp)+.@exp > readparam(NextBaseExp));
        }
        */
    }
    return;
}