viewing paste Unknown #49307 | Text

Posted on the
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
-   script  Loot Manager    FAKE_NPC,{
    end;
 
OnInit:
    bindatcmd("alootid", strnpcinfo(NPC_NAME)+"::OnAtCommand");
    end;
 
OnAtCommand:
    function ManageLoots;
    mes("What would you like to do?");
    if(select("Autoloot Item:Select a Loot Loadout")==1){
        mes("Maximum 10 Ids");
        mes("Input Item ID:");
        for (.@x = 0; .@x < 10; .@x++){
            while (@AlootID[.@x] > 0){
                .@x++;
            }
            if (.@x >= 10) {
                mes "10 Items inserted.";
                break;
            }
            mes("Loot# : "+ (.@x + 1));
            do {
                input(@AlootID[.@x]);
            } while(getitemname(@AlootID[.@x]) == "null");
            atcommand("@alootid +"+@AlootID[.@x]);
            next;
            mes("Add another?");
            if (select("Yes:No") == 2) {
                break;
            }
        }
    }
    next;
    mes("Select a Loot loadout.");
    for (.@i = 1; .@i <= 5; .@i++)
        .@Menu$ += (( getd( "ASlot_"+.@i+"$" ) == "" )?"^FF0000Empty Slot^000000":getd( "ASlot_"+.@i+"$" ) )+":";
    .@ASlot = select(.@Menu$);
    do {
        next;
        mes("Autoloots:");
        for(.@x = 0; .@x < getarraysize(@AlootID); .@x++) {
            mes(getitemname(@AlootID[.@x]) +", ");
        }
        if (getd( "ASlot_"+.@ASlot+"$" ) == "") {
            .@option = select("", "Save", "");
        } else {
            .@option = select("^0000FFLoad", "", "^FF0000Clear");
        }
        ManageLoots( .@ASlot,.@option);
    } while(.@option != 1);
    close();
 
    function    ManageLoots{
        .@slot = getarg(0);
        .@option = getarg(1);
        switch(.@option) {
            case 1: // Switch Loot
                atcommand("@alootid reset");
                .@var$ = getd("LootID_"+ .@slot +"$");
                explode(.@Tmp_array, .@var$, ":");
                for(.@x = 0;.@x < getarraysize(.@Tmp_array); .@x++)
                    atcommand("@alootid +"+.@Tmp_array[.@x]);
                message strcharinfo(0),"Loot Loadout has been ^FF0000Loaded^000000.";
                break;
            case 2: // Save Loot
                message strcharinfo(0),"Loot Loadout has been ^FF0000Saved^000000.";
                for(.@x = 0;.@x <getarraysize(@AlootID); .@x++){
                    .@lootIds$ += @AlootID[.@x]+":";
                }
                setd("LootID_"+ .@slot +"$", .@lootIds$);
                break;
            case 3: // Clear Loot
                message strcharinfo(0),"Loot Loadout has been ^FF0000Cleared^000000.";
                setd(("LootID_"+ .@slot +"$"),"");
                break;
        }
    return;
    }
}
Viewed 955 times, submitted by Dastgir.