summaryrefslogblamecommitdiff
path: root/npc/functions/clear_vars.txt
blob: 76ab7bf7fa89d5b2a195c24473443d2296831d56 (plain) (tree)























































































































































































                                                                                                                                             
function	script	ClearVariables	{
    if(@login_event != 1) goto L_Deprecated;

    if(#BankAccount >= 0) return;
    if (Zeny >= -#BankAccount) {
        Zeny = Zeny + #BankAccount;
        #BankAccount = 0;
    }

    // Partial fix
    #BankAccount = #BankAccount + Zeny;
    Zeny = 0;
    return;
}


function	script	ClearGlobalVars	{
    $@loop = 5;
    goto L_FluffyClear;

L_FluffyClear:
    if ($@loop == 12)
        goto L_IlliaClear;

    $Record_Fluffy_Name$[$@loop] = "";
    $Record_Fluffy_Date$[$@loop] = "";
    $Record_Fluffy_Kills[$@loop] = 0;

    $@loop = $@loop + 1;
    goto L_FluffyClear;


L_IlliaClear:
    $@loop = 0;
    goto L_IlliaLoop;

L_IlliaLoop:
    if ($Illia_Win_Records$[$@loop] == "")
        goto L_EventClear;

    $Illia_Win_Records$[$@loop] = "";

    $@loop = $@loop + 1;
    goto L_IlliaLoop;

L_EventClear:
    $@loop = 0;

    $CandyOpsComplete = 0;

    $Easter_2010_Npc_State1 = 0;
    $Easter_2010_Npc_State2 = 0;
    $Easter_2010_Egg_Loc_State1 = 0;
    $Easter_2010_Egg_Loc_State2 = 0;
    $Easter_2010_Egg_Loc_State3 = 0;
    $Easter_2010_Egg_Loc_State4 = 0;
    $Easter_2010_Egg_Loc_State5 = 0;

    $hween10 = 0;
    $hween10_tondel = 0;
    $hween10_mmallow = 0;
    $hween10_jelskul = 0;
    $hween10_canpump = 0;

    $Golbenez_Inn_Cost = 0;

    $hween16 = 0;
    $hween16_tondel = 0;
    $hween16_mmallow = 0;
    $hween16_jelskul = 0;
    $hween16_canpump = 0;

    $state = 0;
    return;
}

function	script	mapexit	{
    debugmes "TRYING TO MAPEXIT IS DEPRECATED";
    return;
}

function	script	npcaction	{
    debugmes "Deprecated unitaction (did you mean npcsit; or whatever?)";
    return;
}

function	script	gmlog	{
    logmes(getarg(0), LOGMES_ATCOMMAND);
    return;
}

function	script	getx	{
    getmapxy(.@m$, .@x, .@y, 0);
    return .@x;
}

function	script	gety	{
    getmapxy(.@m$, .@x, .@y, 0);
    return .@y;
}

function	script	getnpcx	{
    return .x;
}

function	script	getnpcy	{
    return .y;
}

function	script	title	{
    setnpcdialogtitle getarg(0);
    return;
}

function	script	camera	{
    if (getarg(0, "") != "")
        setcamnpc getarg(0);
    else
        restorecam;
    return;
}

function	script	mapmask	{
    setmapmask getmapname(), getarg(0);
    return;
}

function	script	getmask	{
    return getmapmask(getmapname());
}

// isin( map, x1, y1, {[x2, y2][radius]} )
function	script	isin	{
    if (getmapxy(.@mapName$, .@xpos, .@ypos, 0) != 0)
        return false;
    if (.@mapName$ != getarg(0))
        return false;

    if (getarg(4,-1) < 0) {
        // Radius Based
        if (.@xpos >= getarg(1)-getarg(3) && .@xpos <= getarg(1)+getarg(3) && .@ypos >= getarg(2)-getarg(3) && .@ypos <= getarg(2)+getarg(3))
            return true;
    } else {
        // Coordinate based
        if (.@xpos >= getarg(1) && .@xpos <= getarg(3) && .@ypos >= getarg(2) && .@ypos <= getarg(4))
            return true;
    }
    return false;
}

// isat( map, x, y )
function	script	isat	{
    return isin(getarg(0), getarg(1), getarg(2), 0);
}

function	script	mesn	{
    if (getargcount() > 0) {
        .@s$ = "[" + getarg(0) + "]";
    } else {
        .@s$ = "[" + strnpcinfo(1) + "]";
    }
    mes .@s$;
    return;
}

// maptimer("<map>", <tick>, "<npc>::<event>")
function	script	maptimer	{
    .@c = getunits(BL_PC, .@players, false, getarg(0));
    for (.@i = 0; .@i < .@c; .@i++) {
        addtimer(getarg(1), getarg(2), .@players[.@i]);
    }
    return .@i;
}

// areatimer("<map>", <x1>, <y1>, <x2>, <y2>, <tick>, "<npc>::<event>")
function	script	areatimer	{
    .@c = getunits(BL_PC, .@players, false, getarg(0), getarg(1), getarg(2), getarg(3), getarg(4));
    for (.@i = 0; .@i < .@c; .@i++) {
        addtimer(getarg(5), getarg(6), .@players[.@i]);
    }
    return .@i;
}