summaryrefslogblamecommitdiff
path: root/npc/commands/grantpower.txt
blob: 48d0f4140ce8c4426dfccb2e4f2da1c11af4399f (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12











                                                             
                     
                              







                                                                                                 

                             
                                    











                                                                                




                                                                




                                                                
                                                                    

                      
                       










                                                                                                           












                                                               









                                                             
// 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 (!$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(3, .@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.");
    mes "";
    mesc l("* Options will be removed after transfer is done.");
    mesc l("* Cards will be deleted after transfer is done.");
    mesc l("* Refine will be lost after transfer is done.");
    mes "";
    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(3);
    .@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;
        switch (.@ite) {
            case DemureAxe:
                $DEMUR_HOLDER$ = .@request$; break;
            case Tyranny:
                $TYRAN_HOLDER$ = .@request$; break;
            case Runestaff:
                $RUNES_HOLDER$ = .@request$; break;
            case AegisShield:
                $AEGIS_HOLDER$ = .@request$; break;
            default:
                Exception("Invalid legendary item "+str(.@ite),
                          RB_DEFAULT|RB_IRCBROADCAST); break;
        }
    } else {
        Exception("Player not found.", RB_ISFATAL|RB_SPEECH);
    }

    close;

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