viewing paste Instance_Manager | Athena

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 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 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324
function        script  instance_getpoints      {
        // How much instance points obtain after completing an instance?
        // default : 10
        .@val = getarg(1,10);
       
        .@var$ = getarg(0);
        setd "IP_"+ .@var$, getd("IP_"+ .@var$) + .@val;
        dispbottom "=============================================", 0x00ff00;
        dispbottom "You have gained "+ .@val +" "+ .@var$ +" Instance Points.", 0x00ff00;
        dispbottom "Current "+ .@var$ +" Instance Points : "+ getd("IP_"+ .@var$), 0x00ff00;
        dispbottom "=============================================", 0x00ff00;
       
        return;
}
 
function        script  instance_ranking        {
        mes "[ "+ getarg(1) +" Instance Points Ranking ]";
        query_sql("SELECT char_id, CAST(`value` AS SIGNED) FROM `char_reg_num` WHERE `key` = '"+ "IP_"+ getarg(0) +"' ORDER BY CAST(`value` AS SIGNED) DESC LIMIT 5",.@cid,.@value);
        for(set .@i,0; .@i<getarraysize(.@cid); set .@i,.@i+1) {
                query_sql("SELECT `name` FROM `char` WHERE char_id = "+.@cid[.@i]+";",.@j$);
                set .@name$[.@i], .@j$;
        }
        if (!getarraysize(.@cid))
                mes "The rankings are empty.";
        else for(set .@i,0; .@i<getarraysize(.@cid); set .@i,.@i+1)
        mes "["+(.@i+1)+"] "+.@name$[.@i]+" ~ "+.@value[.@i]+" Instance Points";
        close;
}
 
-       script  shop_setting#ins        -1,{
OnInit:
        // Set items sold in instanced shop
        // NOTE: All shop will sell same items.
        //               Although it will use different
        //               point variables.
        setarray $@shop_items[0],
                6225, 8,
                6226, 8,
                7619, 8,
                7620, 8,
                42093, 10,
                14191, 20,      // <ID>, <PRICE>
                14236, 20,      // <ID>, <PRICE>
                14237, 20,
                14238, 20,
                14239, 20,
                14240, 20,
                14241, 20,
                17246, 30,
                17247, 30,
                6230, 20,
                6234, 20,
                42094, 50,
                41001, 200,
                41002, 200,
                41003, 200,
                41004, 200,
                41005, 200,
                41006, 200,
                41007, 200,
                41008, 200,
                41009, 200,
                41010, 200,
                41011, 200,
                41012, 200,
                41013, 200,
                41014, 200,
                41015, 200,
                41016, 200,
                41017, 200,
                41018, 200;
       
        freeloop(true);
        for ( .@s = 0; .@s < 35; .@s++ ) {
                npcshopdelitem "ins_pts_shop"+ .@s, 607;
                for(.@i = 0; .@i < getarraysize($@shop_items); .@i = .@i + 2)
                        npcshopadditem "ins_pts_shop"+ .@s, $@shop_items[.@i], $@shop_items[.@i + 1];
        }
        freeloop(false);
        end;
}
 
//prontera,165,101,3    script  Instance Manager        967,{
-       script  Instance Manager        -1,{
OnAtInstance:
function        F_Selected ;
function        F_instance_shop ;
        mes .n$;
        mes "How may I help you?";
        next;
        switch(select( "Manage Instance", (instance_id()) ? "^ff0000Reset running instance^000000":"", "Nothing")) {
        case 1:
                mes .n$;
                mes "Which instance would you like to manage?";
                mes " ";
                mes "^F08080You can view Rankings, Points, and Shop from each instances listed below:^000000";
                next;
                switch(select("Airship Assault", "Bakonawa Lake", "Bangungot Hospital", "Buwaya Cave", "Central Laboratory", "Charleston Crisis", "Devil Tower", "Eclage Interior", "Faceworms Nest", "Geffen Magic Tournament", "Ghost Palace", "Hazy Forest", "Horror Toy Factory", "Infinite Space", "Isle of Bios", "Last Room", "Malangdo Culvert", "Morse Cave", "Nightmarish Jitterbug", "Octupus Cave", "Old Glass Heim", (RitualofBlessing) ? "Ritual of Blessing":"", "Room Of Consiousness", "Sarah and Fenrir", (SaraMemory) ? "Sara Memory":"", "Sky Fortress", "Temple of Demon God", "Wolfchev Laboratory", "Jurassic Park", "Werner Laboratory Central Room", "Heart Hunter War Base")) {
                case 1: F_Selected( "Airship", "Airship Assult", 0, 82800); break;
                case 2: F_Selected( "Bakonawa", "Bakonawa Lake", 1); break;
                case 3: F_Selected( "Bangungot", "Bangungot Hospital", 2); break;
                case 4: F_Selected( "Buwaya", "Buwaya Cave", 3, 82800); break;
                case 5: F_Selected( "CentralLab", "Central Laboratory", 4, 82800); break;
                case 6: F_Selected( "Charleston", "Charleston Crisis", 5, 72000); break;
                case 7: F_Selected( "DevilTower", "Devil Tower", 6, 82800); break;
                case 8: F_Selected( "Eclage", "Eclage Interior", 7); break;
                case 9: F_Selected( "Faceworm", "Faceworms Nest", 8, 86400); break;
                case 10: F_Selected( "GeffenTourna", "Geffen Magic Tournament", 9, 82800); break;
                case 11: F_Selected( "GhostPalace", "Ghost Palace", 10, 82800); break;
                case 12: F_Selected( "HazyForest", "Hazy Forest", 11, 9000); break;
                case 13: F_Selected( "HorrorToyFac", "Horror Toy Factory", 12, 82800); break;
                case 14: F_Selected( "InfiniteSpace", "Infinite Space", 13); break;
                case 15: F_Selected( "BiosIsle", "Isle of Bios", 14, 82800); break;
                case 16: F_Selected( "LastRoom", "Last Room", 15, 82800); break;
                case 17: F_Selected( "Malangdo", "Malangdo Culvert", 16); break;
                case 18: F_Selected( "MorseCave", "Morse Cave", 17); break;
                case 19: F_Selected( "Nightmarish", "Nightmarish Jitterbug", 18, 82800); break;
                case 20: F_Selected( "Octupus", "Octupus Cave", 19, 10800); break;
                case 21: F_Selected( "OGH", "Old Glass Heim", 20, 82800); break;
                case 22: F_Selected( "RitualBlessing", "Ritual of Blessing", 21); break;
                case 23: F_Selected( "RoomOfConsc", "Room Of Consciousness", 22); break;
                case 24: F_Selected( "SarahAndFenrir", "Sarah and Fenrir", 23, 604800); break;
                case 25: F_Selected( "SaraMemory", "Sara Memory", 24, 72000); break;
                case 26: F_Selected( "SkyFort", "Sky Fortress", 25, 259200); break;
                case 27: F_Selected( "DemonGod", "Temple of Demon God", 26); break;
                case 28: F_Selected( "Wolfchev", "Wolfchev Laboratory", 27); break;
                case 29: F_Selected( "Jurassic", "Jurassic Park", 28, 43200); break;
                case 30: F_Selected( "WLCLab", "Werner Laboratory Central Room", 29); break;
                case 31: F_Selected( "HHWBase", "Heart Hunter War Base", 30); break;
                }
                end;
               
        case 2:
                if (is_party_leader() == false) {
                        mes "^ff0000Only the party leader can reset the instance.^000000";
                        close;
                }
                mes .n$;
                mes "Resetting the instance will delete all your current progress in it.";
                next;
                mes .n$;
                mes "Are you sure you want to reset the instance?";
                next;
                if(select("Yes:No")==2) end;
                instance_destroy();
                mes .n$;
                mes "Done!";
                close;                 
               
        default:
                break;
               
        }
        end;
       
function        F_Selected      {
        @var$ = getarg(0);
        .@insname$ = getarg(1);
        .@instance_sid = getarg(2);
        .@instance_id = .@instance_sid+1;
        .@ins_enter_time = getd("CD_"+ @var$);
        .@ins_lim_time = .@ins_enter_time + getarg(3,0);
        .@ins_cur_time = gettimetick(2);
        mes .n$;
        mes "You currently have "+ getd("IP_"+ @var$) +" "+ @var$ +" Instance Points.";
        .@ins_ent_t = (.@ins_lim_time - .@ins_cur_time);
        .@ins_h = (.@ins_ent_t / 3600);
        .@ins_m = (.@ins_ent_t - (.@ins_h * 3600)) / 60;
        .@ins_s = .@ins_ent_t - ((.@ins_h * 3600) + (.@ins_m * 60));
        if (.@ins_ent_t > 0) {
                mes "Cooldown:";
                mes "^ff00f7"+.@ins_h+"^000000 hours ^ff00f7"+.@ins_m+"^000000 minutes ^ff00f7"+.@ins_s+"^000000 seconds left to enter the next instance.";
                mes " ";
        }
        mes "What would you like to do?";
        next;
        switch(select(" View Top 5 Rank"," Open Instance Shop", (.@ins_ent_t > 0)?" Reset Instance":"",(getgmlevel() > 60) ? "Reset Ranking":"")) {
        case 1:
                instance_ranking( @var$ , .@insname$);
                break;
        case 2:
                F_instance_shop( .@instance_sid );
                break;
        case 3:
                switch ( .@instance_id ) {
                        case 1: .@qid_1 = 15050; .@qid_2 = 15051; break;
                        case 4: .@qid_1 = 4229; .@qid_2 = 0; break;
                        case 5: .@qid_1 = 12347; .@qid_2 = 0; break;
                        case 6: .@qid_1 = 13185; .@qid_2 = 0; break;
                        case 7: .@qid_1 = 7577; .@qid_2 = 0; break;
                        case 9: .@qid_1 = 12326; .@qid_2 = 0; break;
                        case 10: .@qid_1 = 9316; .@qid_2 = 0; break;
                        case 11: .@qid_1 = 1261; .@qid_2 = 0; break;
                        case 12: .@qid_1 = 7211; .@qid_2 = 0; break;
                        case 13: .@qid_1 = 12331; .@qid_2 = 0; break;
                        case 15: .@qid_1 = 15005; .@qid_2 = 15007; break;
                        case 16: .@qid_1 = 11379; .@qid_2 = 0; break;
                        case 19: .@qid_1 = 13182; .@qid_2 = 0; break;
                        case 20: .@qid_1 = 4197; .@qid_2 = 0; break;
                        case 21: .@qid_1 = 12317; .@qid_2 = 0; break;
                        case 24: .@qid_1 = 9336; .@qid_2 = 0; break;
                        case 25: .@qid_1 = 15002; .@qid_2 = 0; break;
                        case 26: .@qid_1 = 9419; .@qid_2 = 0; break;
                        case 29: .@qid_1 = 160011; .@qid_2 = 160010; break;
                        default: .@qid_1 = 0; .@qid_2 = 0; break;
                }
                if ( .@ins_ent_t > 0 /*&& checkquest(.@qid_1,PLAYTIME) == 2*/ ) {
                        if ( countitem(.reset_item) < 1 ) {
                                mes "You need 1 x "+getitemname(.reset_item)+" to reset this instance.";
                                close;
                        }
                        erasequest .@qid_1;
                        if (.@qid_2) erasequest .@qid_2;
                        set getd("CD_"+ @var$), 0;
                        delitem .reset_item, 1;
                        mes "You have successfully reset ^0000FF"+.@insname$+"^000000 instance.";
                        close;
                }
                mes "^0000FF"+.@insname$+"^000000 instance is not on cooldown.";
                close;
        case 4:
                mes "Resetting ranking will set ALL points of ALL characters to ZERO";
                mes " ";
                mes "Are you sure you want to continue?";
                next;
                if(select("Yes","No")==2)end;
                query_sql("UPDATE `char_reg_num` SET `value` = '0' WHERE `key` ='"+ @var$ +"'");
                mes "Done";
                close2;
                addrid(0);
                set @var$, 0;
        }
        end;
}
 
function        F_instance_shop {
        .@shopname$ = "ins_pts_shop"+ getarg(0); // shopname
        mes .n$;
        mes "Current Instance Points : "+ getd("IP_"+ @var$);  
        callshop .@shopname$,1;
        npcshopattach .@shopname$;
        end;
}
 
OnBuyItem:
        for(set .@i,0; .@i<getarraysize(@bought_nameid); set .@i,.@i+1)
                for(set .@j,0; .@j<getarraysize($@shop_items); set .@j,.@j+2)
                        if (@bought_nameid[.@i] == $@shop_items[.@j]) {
                                set .@cost, .@cost+($@shop_items[.@j+1]*@bought_quantity[.@i]);
                                break;
                        }
        if ( checkweight2 ( @bought_nameid, @bought_quantity ) == false ) {
                mes .n$;
                mes "It appears you cant carry them all";
                close;
        }
        if (.@cost > getd("IP_"+ @var$) ) {
                mes .n$;
                mes "You don't have enough points to purchase anything in the shop.";
                next;
                mes .n$;
                mes "You only have "+ getd("IP_"+ @var$) +" points left.";
        } else {
                mes .n$;
                mes "Items purchased:";
                mes "-----------------------------------";
                for(set .@i,0; .@i<getarraysize(@bought_nameid); set .@i,.@i+1) {
                        getitem @bought_nameid[.@i], @bought_quantity[.@i];
                        mes "  ^777777"+@bought_quantity[.@i]+"x "+getitemname(@bought_nameid[.@i])+"^000000";
                }
                mes "-----------------------------------";
                setd "IP_"+ @var$, getd("IP_"+ @var$) - .@cost;
                next;
                mes .n$;
                mes "You only have "+ getd("IP_"+ @var$) +" points left.";
               
        }
        deletearray @bought_nameid[0], getarraysize(@bought_nameid);
        deletearray @bought_quantity[0], getarraysize(@bought_quantity);
        close;
       
OnInit:
        .n$ = "[^ff0000 Instance Manager ^000000]";
        .reset_item = 43011; // item reset id
        bindatcmd "instance", strnpcinfo(0)+"::OnAtInstance";
        end;
}
// Dummy shops
-       shop    ins_pts_shop0   -1,607:-1  
-       shop    ins_pts_shop1   -1,607:-1  
-       shop    ins_pts_shop2   -1,607:-1  
-       shop    ins_pts_shop3   -1,607:-1  
-       shop    ins_pts_shop4   -1,607:-1  
-       shop    ins_pts_shop5   -1,607:-1  
-       shop    ins_pts_shop6   -1,607:-1  
-       shop    ins_pts_shop7   -1,607:-1  
-       shop    ins_pts_shop8   -1,607:-1  
-       shop    ins_pts_shop9   -1,607:-1  
-       shop    ins_pts_shop10  -1,607:-1  
-       shop    ins_pts_shop11  -1,607:-1  
-       shop    ins_pts_shop12  -1,607:-1  
-       shop    ins_pts_shop13  -1,607:-1  
-       shop    ins_pts_shop14  -1,607:-1  
-       shop    ins_pts_shop15  -1,607:-1  
-       shop    ins_pts_shop16  -1,607:-1  
-       shop    ins_pts_shop17  -1,607:-1  
-       shop    ins_pts_shop18  -1,607:-1  
-       shop    ins_pts_shop19  -1,607:-1  
-       shop    ins_pts_shop20  -1,607:-1  
-       shop    ins_pts_shop21  -1,607:-1  
-       shop    ins_pts_shop22  -1,607:-1  
-       shop    ins_pts_shop23  -1,607:-1  
-       shop    ins_pts_shop24  -1,607:-1  
-       shop    ins_pts_shop25  -1,607:-1  
-       shop    ins_pts_shop26  -1,607:-1  
-       shop    ins_pts_shop27  -1,607:-1  
-       shop    ins_pts_shop28  -1,607:-1  
-       shop    ins_pts_shop29  -1,607:-1  
-       shop    ins_pts_shop30  -1,607:-1  
-       shop    ins_pts_shop31  -1,607:-1  
-       shop    ins_pts_shop32  -1,607:-1  
-       shop    ins_pts_shop33  -1,607:-1  
-       shop    ins_pts_shop34  -1,607:-1
 
Viewed 686 times, submitted by pajodex.