script.js
// drop a custom item (Boss only)
drop a custom item (Boss only)
drop a custom item ( Boss only )
function dropBossItem(param) {
        var text = $("#item_info_text"); 
        var img = $("#boss_item_img"); 
        if(item_modal_shown===false) {
            if (param !== 3) {
                var rand_drop = Math.floor((Math.random() * 3) + 1);
                if (rand_drop === 1) {
                    if (item_level_head < 10) {
                        item_level_head++;
                        img.attr("src", "resources/items/head/" + up_item_pfix + item_level_head + ".png");
                        text.text("You looted a level " + item_level_head + " head armour");
                        item_dropped = rand_drop.toString() + item_level_head.toString();
                    } else {
                        img.attr("src","resources/items/empty.png");
                        text.text("Spiders are loot technically...");
                    }
                } else if (rand_drop === 2) {
                    if (item_level_chest < 10) {
                        item_level_chest++;
                        img.attr("src","resources/items/chest/" + up_item_pfix + item_level_chest + ".png");
                        text.text("You looted a level " + item_level_chest + " chest armour");
                        item_dropped = rand_drop.toString() + item_level_chest.toString();
                    } else {
                        img.attr("src","resources/items/empty.png");
                        text.text("Spiders are loot technically...");
                    }
                } else if (rand_drop === 3) {
                    if (item_level_weapon < 10) {
                        item_level_weapon++;
                        img.attr("src","resources/items/weapons/swords/" + up_item_pfix + item_level_weapon + ".png");
                        text.text("You looted a level " + item_level_weapon + " sword");
                        item_dropped = rand_drop.toString() + item_level_weapon.toString();
                    } else {
                        img.attr("src","resources/items/empty.png");
                        text.text("Spiders are loot technically...");
                    }
                }
            }
            $("#new_item_modal").modal('show');
            item_modal_shown = true;
        }
    }
function dropBossItem ( param ) { var text = $ ( "#item_info_text" ) ; var img = $ ( "#boss_item_img" ) ; if ( item_modal_shown === false ) { if ( param !== 3 ) { var rand_drop = Math . floor ( ( Math . random ( ) * 3 ) + 1 ) ; if ( rand_drop === 1 ) { if ( item_level_head < 10 ) { item_level_head ++ ; img . attr ( "src" , "resources/items/head/" + up_item_pfix + item_level_head + ".png" ) ; text . text ( "You looted a level " + item_level_head + " head armour" ) ; item_dropped = rand_drop . toString ( ) + item_level_head . toString ( ) ; } else { img . attr ( "src" , "resources/items/empty.png" ) ; text . text ( "Spiders are loot technically..." ) ; } } else if ( rand_drop === 2 ) { if ( item_level_chest < 10 ) { item_level_chest ++ ; img . attr ( "src" , "resources/items/chest/" + up_item_pfix + item_level_chest + ".png" ) ; text . text ( "You looted a level " + item_level_chest + " chest armour" ) ; item_dropped = rand_drop . toString ( ) + item_level_chest . toString ( ) ; } else { img . attr ( "src" , "resources/items/empty.png" ) ; text . text ( "Spiders are loot technically..." ) ; } } else if ( rand_drop === 3 ) { if ( item_level_weapon < 10 ) { item_level_weapon ++ ; img . attr ( "src" , "resources/items/weapons/swords/" + up_item_pfix + item_level_weapon + ".png" ) ; text . text ( "You looted a level " + item_level_weapon + " sword" ) ; item_dropped = rand_drop . toString ( ) + item_level_weapon . toString ( ) ; } else { img . attr ( "src" , "resources/items/empty.png" ) ; text . text ( "Spiders are loot technically..." ) ; } } } $ ( "#new_item_modal" ) . modal ( 'show' ) ; item_modal_shown = true ; } }
drop a custom item (Boss only)
drop a custom item ( Boss only )
// define the element // define the element // have we shown the dialog before // check the drop rate // drop item confirmed // roll the dice on the type of item // HEAD // check if the head slot is at max level // increment // define the img src // define the text element // update the loot value holder // TODO: EXPAND THIS // drop nothing (for now) // define the img src // define the text element // CHEST // check if the head slot is at max level // increment // define the img src // define the text element // update the loot value holder // TODO: EXPAND THIS // drop nothing (for now) // define the img src // define the text element // WEAPON // check if the head slot is at max level // increment // define the img src // define the text element // update the loot value holder // TODO: EXPAND THIS // drop nothing (for now) // define the img src // define the text element // finally, show the dialog // update the var