summaryrefslogtreecommitdiff
path: root/npc/commands/grantpower.txt
blob: 0e678657ca235b6a5c9f41f9efdf07c5971909c1 (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
// TMW2 Script
//
// @grantpower <username>
// Grants a legendary weapon to <username>. Cannot be undone.
// Only way to bypass restrictions on legendary weapons.

-	script	@grantpower	32767,{
    end;

OnCall:
    .@request$ = "";
	.@request$ += implode(.@atcmd_parameters$, " ");
    if (is_admin()) {
        if (.@request$ == "" && !$LEGENDARYINIT) {
            inventoryplace Lightbringer, 3; // Script Handled: LB and AS
            getitembound DemureAxe, 1, 1;
            getitembound Tyranny, 1, 1;
            getitembound Runestaff, 1, 1;
            $LEGENDARYINIT=true;
            Exception("Legendary weapons not previously initialized.", RB_ISFATAL|RB_DISPBOTTOM);
        }
    }

    // Player is not attached
    .@id = getcharid(0, .@request$);
    if (!.@id) {
        Exception("Player not found.", RB_ISFATAL|RB_DISPBOTTOM);
    }
    mes ".:: " + l("Grant Power") + " ::.";
    mesc l("You're about to transfer a legendary weapon to @@.", .@request$), 1;
    mesc l("This action CANNOT BE UNDONE."), 1;
    mes l("Are you sure?");
    if (askyesno() == ASK_NO)
        close;
    mes "";
    mes ".:: " + l("Grant Power") + " ::.";
    mes l("Please select the weapon to transfer.");
    menuint
        l("None"), 0,
        rif(countitem(DemureAxe), l("Demure's Axe")), DemureAxe,
        rif(countitem(Tyranny), l("Tyranny")), Tyranny,
        rif(countitem(Runestaff), l("Runestaff")), Runestaff,
        rif(countitem(AegisShield), l("Aegis Shield")), AegisShield,
        l("Abort"), 0;
    mes "";
    .@ori=getcharid(0);
    .@ite=@menuret;
    if (!.@ite)
        close;

    // Transfer the weapon
    if (attachrid(.@id)) {
        getitembound .@ite, 1, 1; // Account bound or char bound? (1 or 4)
        dispbottom l("You received the @@ from @@.", getitemlink(.@ite), strcharinfo(0, "someone", .@ori));
        detachrid();
        attachrid(.@ori);
        delitem .@ite, 1;
    } else {
        Exception("Player not found.", RB_ISFATAL|RB_SPEECH);
    }

    close;

OnInit:
    bindatcmd "grantpower", "@grantpower::OnCall", 0, 100, 1;
}