Вход Регистрация
Файл: alinar.ru/JS/inventory_v01.js
Строк: 247
<?php
// JavaScript Document
var gperks = [0,0,0,0,0,0,0,0];
var 
inventory_type '';
var 
allow_to_dress false;

function 
show_inventory (type) {
    
inventory_type type;
    
query 'type='+type+'&vcode='+vk;
    
ajax_query ('show_inventory',query,'render_inventory');
}

function 
check_needs (need,is) {
    if (
need<=is) {
        
res need;
    }
    else {
        
allow_to_dress false;
        
res '<font color="#990000">'+need+'</font>';
    }
    return 
res;
}

function 
check_gives(info) {
    
info parseInt(info);
    if (
info>0) { info '+' info; }
    
res info;
    return 
res;
}

function 
render_inventory(info) {
    
info info.split('@');
    if (
info[0].indexOf('|')<0) { out '<b>В рюкзаке нет вещей данного типа</b>' }
    else {
        
out '<table width=100%>';
        for (
a=0,b=info.length;a<b;a++) {
            
allow_to_dress true;
            
info[a].split('|');
            
needs ''
            
needs needs 'Уровень: <b>' check_needs(v[2],pers[0]) + '</b>';
            if (
parseInt(v[3])!=0) { needs needs '<br>Сила: <b>' check_needs(v[3],pers[1]) + '</b>' }
            if (
parseInt(v[4])!=0) { needs needs '<br>Ловкость: <b>' check_needs(v[4],pers[2]) + '</b>' }
            if (
parseInt(v[5])!=0) { needs needs '<br>Удача: <b>' check_needs(v[5],pers[3]) + '</b>' }
            if (
parseInt(v[6])!=0) { needs needs '<br>Интеллект: <b>' check_needs(v[6],pers[4]) + '</b>' }
            if (
parseInt(v[7])!=0) { needs needs '<br>Мудрость: <b>' check_needs(v[7],pers[5]) + '</b>' }
            if (
parseInt(v[8])!=0) { needs needs '<br>Здоровье: <b>' check_needs(v[8],pers[6]) + '</b>' }
            
            if (
parseInt(v[29])!=0) { needs needs '<br>Рукопашный бой: <b>' check_needs(v[29],gperks[0]) + '</b>' }
            if (
parseInt(v[30])!=0) { needs needs '<br>Владение короткими клинками: <b>' check_needs(v[30],gperks[1]) + '</b>' }
            if (
parseInt(v[31])!=0) { needs needs '<br>Владение длинными клинками: <b>' check_needs(v[31],gperks[2]) + '</b>' }
            if (
parseInt(v[32])!=0) { needs needs '<br>Владение дробящим оружием: <b>' check_needs(v[32],gperks[3]) + '</b>' }
            if (
parseInt(v[33])!=0) { needs needs '<br>Владение посохами: <b>' check_needs(v[33],gperks[4]) + '</b>' }
            if (
parseInt(v[34])!=0) { needs needs '<br>Владение секирами и топорами: <b>' check_needs(v[34],gperks[5]) + '</b>' }
            if (
parseInt(v[35])!=0) { needs needs '<br>Владение инструментами: <b>' check_needs(v[35],gperks[6]) + '</b>' }
            if (
parseInt(v[36])!=0) { needs needs '<br>Очки действия: <b>' check_needs(v[36],gperks[7]) + '</b>' }
            
            
gives '';
            
gives gives 'Цена: <b>'+v[26]+' LM</b>';
            if (
parseInt(v[16])!=&& parseInt(v[17])!=0) { gives gives '<br>Удар: <b>' v[16] + '-' v[17] + '</b>' }
            if (
parseInt(v[9])!=0) { gives gives '<br>Сила: <b>' check_gives(v[9]) + '</b>' }
            if (
parseInt(v[10])!=0) { gives gives '<br>Ловкость: <b>' check_gives(v[10]) + '</b>' }
            if (
parseInt(v[11])!=0) { gives gives '<br>Удача: <b>' check_gives(v[11]) + '</b>' }
            if (
parseInt(v[12])!=0) { gives gives '<br>Интеллект: <b>' check_gives(v[12]) + '</b>' }
            if (
parseInt(v[13])!=0) { gives gives '<br>Мудрость: <b>' check_gives(v[13]) + '</b>' }
            if (
parseInt(v[14])!=0) { gives gives '<br>Здоровье: <b>' check_gives(v[14]) + '</b>' }
            if (
parseInt(v[27])!=0) { gives gives '<br>HP: <b>' check_gives(v[27]) + '</b>' }
            if (
parseInt(v[28])!=0) { gives gives '<br>MP: <b>' check_gives(v[28]) + '</b>' }
            if (
parseInt(v[18])!=0) { gives gives '<br>Броня: <b>' check_gives(v[18]) + '</b>' }
            if (
parseInt(v[19])!=0) { gives gives '<br>Резист: <b>' check_gives(v[19]) + '</b>' }
            if (
parseInt(v[20])!=0) { gives gives '<br>Ярость: <b>' check_gives(v[20]) + '%</b>' }
            if (
parseInt(v[21])!=0) { gives gives '<br>Уворот: <b>' check_gives(v[21]) + '%</b>' }
            if (
parseInt(v[22])!=0) { gives gives '<br>Точность: <b>' check_gives(v[22]) + '%</b>' }
            if (
parseInt(v[23])!=0) { gives gives '<br>Стойкость: <b>' check_gives(v[23]) + '%</b>' }
            if (
parseInt(v[24])!=0) { gives gives '<br>Скорость: <b>' check_gives(v[24]) + '%</b>' }
            if (
parseInt(v[25])!=0) { gives gives '<br>Пробой: <b>' check_gives(v[25]) + '%</b>' }
            
buttons '';
            if (
allow_to_dress==true) { buttons buttons '<input type=button value="Надеть" onclick="dress_on('+v[15]+');">' }
            
buttons buttons '<input type=button value="Продать ['+v[26]+' LM]" onclick="sell_item('+v[15]+');">';
            if (
buttons!='') {
                
buttons '<tr><td colspan=3 style="border:1px solid #666666;">' buttons '</td></tr>';
            }
            
out out '<tr><td><table width="100%" cellpadding=1 border="0" style="border:1px solid #666666;" cellspacing="0"><tr><td rowspan="2" style="border:1px solid #666666;" width="80" valign="middle" align="center"><img src="/images/weapons/'+v[1]+'.png" border=0></td><td colspan="2" style="border:1px solid #666666;"><font style="font-size:14px; font-weight:900; margin-left:15px;">'+v[0]+'</font></td></tr><tr><td style="border:1px solid #666666; font-size:12px;" width="45%" valign="top">' gives '</td><td style="border:1px solid #666666; font-size:12px;" width="45%" valign="top">'+needs+'</td></tr>'+buttons+'</table></tr></td>';
        }
        
out out '</table>';
    }
    
d('inventory_content').innerHTML out;
}

function 
dress_on(ID) {
    
query 'id='+ID+'&vcode='+vk;
    
ajax_query ('dress_on',query,'render_after_dress');
}

function 
dress_off(ID) {
    
query 'id='+ID+'&vcode='+vk;
    
ajax_query ('dress_off',query,'render_after_dress');
}

function 
render_after_dress(info) {
    if (
info!='FAIL') {
        
info info.split('@');
        
info1 info[0].split('|');
        
info2 info[1].split('|');
        
info3 info[2].split('&');
        
info3_1 info3[0].split('|');
        
info3_2 info3[1].split('|');
        
info3_3 info3[2].split('|');
        
info3_4 info3[3].split('|');
        
info3_5 info3[4].split('|');
        
info3_6 info3[5].split('|');
        
info3_7 info3[6].split('|');
        
info3_8 info3[7].split('|');
        
info3_9 info3[8].split('|');
        
info3_10 info3[9].split('|');
        
info3_11 info3[10].split('|');
        
pers_top(info1,[],[info2[27]]);
        
character([info3_1,info3_2,info3_3,info3_4,info3_5,info3_6,info3_7,info3_8,info3_9,info3_10,info3_11]);
        
pers_info(info2);
        
show_inventory(inventory_type);
    }
}

function 
sell_item(ID) {
    
query 'w_sell='+ID+'&vcode='+vk;
    
ajax_query ('sell_item',query,'render_after_sell');
}

function 
render_after_sell(info) {
    
info info.split('|');
    
message_window('success','Покупка',info[0],'ok','');
    
vk info[1];
    
show_inventory(inventory_type);
}
?>
Онлайн: 3
Реклама