summaryrefslogtreecommitdiff
path: root/npc/commands/debug.txt
blob: 77ffe872748f807cfdf457d63def3e229cf89b3e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
// Evol Script
// Author: Gumi, Monwarez

function	script	GlobalDebugMenu	{
    function resetAll {
        function doReset {
            resetstatus;
            resetskill;
            resetlvl 1;
            dispbottom b("ALL PERMANENT STATUS BOOSTS WERE ALSO RESET");
            dispbottom l("Reset done!");
            if (getarg(0,0) == 3) {
                closedialog;
                doevent "::OnGlobalQuestReset"; // executes in all quest npcs // FIXME: maybe have a `resetquest` buildin?
                Zeny = 0;
                BankVault = 0;
                clearitem;
                warp "000-0", 0, 0; // starting point
                end; // script must end for doevent to execute
            }
            return;
        }
        clear;
        setnpcdialogtitle l("Debug - Reset");
        mes l("What do you want to reset?");
        select
            l("Abort"),
            l("Reset stats, skills, level"),
            l("Reset EVERYTHING"),
            rif(is_admin() && debug && !@allperms, l("Set All Perms")),
            l("Return to Debug menu");

        switch (@menu) {
            case 2:
            case 3: doReset @menu; return;
            case 4:
                if (!debug) atcommand("@ban 1h "+strcharinfo(0));
                if (!is_admin()) atcommand("@ban 2h "+strcharinfo(0));
                atcommand("@addperm all_skill");
                atcommand("@addperm all_equipment");
                atcommand("@addperm skill_unconditional");
                atcommand("@addperm join_chat");
                atcommand("@addperm hide_session");
                atcommand("@addperm any_warp");
                atcommand("@addperm view_hpmeter");
                atcommand("@addperm view_equipment");
                atcommand("@addperm receive_requests");
                atcommand("@addperm can_trade_bound");
                atcommand("@addperm bypass_nostorage");
                @allperms=true;
                break;
        }

        return;
    }

    do
    {
        clear;
        setnpcdialogtitle l("Debug");
        mes l("This menu allows you to modify your account data.");
        mes "";
        mes l("What do you want to do?");
        select
            l("Change my appearance"),
            l("Change my quests"),
            l("Reset"),
            rif(getarg(0,0), l("Return to Super Menu"));

        .@c = getarg(0,0) ? 2 : 1;

        switch (@menu)
        {
            case 1: BarberDebug .@c; break;
            case 4: GlobalQuestDebug .@c; break;
            case 5: resetAll; break;
            case 6: return;
        }
    } while(1);
}



-	script	@debug	32767,{
    end;

OnCall:
    if (!is_admin()) {
        end;
    }
    GlobalDebugMenu();
    closedialog;
    end;

OnSetVar:
    if (getarraysize(.@atcmd_parameters$) != 3)
        Exception("Usage: @set-var VARIABLE INDEX VALUE", RB_DISPBOTTOM|RB_ISFATAL);

    .@cmd$=array_shift(.@atcmd_parameters$);
    .@idx=atoi(array_shift(.@atcmd_parameters$));
    if (charat(.@atcmd_parameters$[0],
               getstrlen(.@atcmd_parameters$[0])-1) == "$")
        .@str=true;

    if (.@str)
        .@val$=array_shift(.@atcmd_parameters$);
    else
        .@val=array_shift(.@atcmd_parameters$);

    if (.@str)
        setd(sprintf("%s[%d]", .@cmd$, .@idx), .@val$);
    else
        setd(sprintf("%s[%d]", .@cmd$, .@idx), .@val);

    .@msg$=sprintf("%s[%d] is now: %s", .@cmd$, .@idx,
                   getd(sprintf("%s[%d]", .@cmd$, .@idx)));

    if (!is_staff())
        atcommand("@request System Information: "+.@msg$);
    else
        dispbottom(.@msg$);
    end;

// If the char is not a staff member, it'll be sent to GM Log instead
OnGetVar:
    if (getarraysize(.@atcmd_parameters$) != 2)
        Exception("Usage: @get-var VARIABLE INDEX", RB_DISPBOTTOM|RB_ISFATAL);

    .@cmd$=array_shift(.@atcmd_parameters$);
    .@idx=atoi(array_shift(.@atcmd_parameters$));

    .@mg$=sprintf("%s[%d] == %s", .@cmd$, .@idx,
                      getd(sprintf("%s[%d]", .@cmd$, .@idx)));

    if (!is_staff())
        atcommand("@request System Information: "+.@mg$);
    else
        dispbottom(.@mg$);
    end;

OnSClear:
    sc_end SC_ALL;
    sc_end SC_DAILYSENDMAILCNT;
    dispbottom l("Status Condition Cleared");
    end;

OnInit:
    bindatcmd "debug", "@debug::OnCall", 99, 99, 1;
    bindatcmd "getvar", "@debug::OnGetVar", 99, 99, 1;
    bindatcmd "get-var", "@debug::OnGetVar", 99, 99, 1;
    bindatcmd "setvar", "@debug::OnSetVar", 99, 99, 1;
    bindatcmd "set-var", "@debug::OnSetVar", 99, 99, 1;
    bindatcmd "sclear", "@debug::OnSClear", 99, 99, 1;
    end;
}