game/staticOLD/scripts/user.js

159 lines
4.3 KiB
JavaScript

var u = {
wName:{
0:['íåèçâåñòíî',20,20],
1:['ñåðüãè',60,20],
2:['îæåðåëüå'],
3:['îðóæèå'],
4:['áðîíÿ'],
5:['slot5'],
6:['slot6'],
7:['êîëüöî'],
8:['êîëüöî'],
9:['êîëüöî'],
10:['øëåì'],
11:['slot11'],
12:['ïåð÷àòêè'],
13:['îáóâü'],
14:['ùèò']
},
userHealthData:{},
userHealth:function( timeStart , hp , mp , hpAll , mpAll , minHP , minMP , block ) {
var html = '';
/*
if( timeStart == 0 ) {
timeStart = GameEngine.timenow();
}
*/
//Ïðîâåðÿåì ñêîëêüî ÍÐ è ÌÐ íà äàííûé ìîìåíò
var timeLast = GameEngine.timenow()-timeStart;
timeStart = GameEngine.timenow();
GameEngine.c( hp );
hp += hpAll/100*((timeLast/(minHP*60))*100);
//
if( hp > hpAll ) {
hp = hpAll;
}else if( hp < 0 ) {
hp = 0;
}
if( $(block) != undefined && hp < hpAll ) {
clearTimeout(this.userHealthData[$(block).attr('id')]);
this.userHealthData[$(block).attr('id')] = setTimeout(function(){ u.userHealth( timeStart , hp , mp , hpAll , mpAll , minHP , minMP , block ); },500);
}
var hpl = Math.floor( Math.floor(hp) / Math.floor(hpAll) * 100 );
var hpr = 100-hpl;
html += '<table border="0" cellspacing="0" cellpadding="0">'+
'<tr height="10">'+
'<td width="14"><img class="wib" src="/static/images/herz.gif" width="10" height="9"></td>'+
'<td width="150">';
//
if( hpl < 33 ) {
html += '<img class="wib" src="/static/images/1red.gif" width="' + hpl + '%" height="10">';
}else if( hpl < 66 ) {
html += '<img class="wib" src="/static/images/1yellow.gif" width="' + hpl + '%" height="10">';
}else{
html += '<img class="wib" src="/static/images/1green.gif" width="' + hpl + '%" height="10">';
}
//
html += '<img class="wib" src="/static/images/1silver.gif" width="' + hpr + '%" height="10">'+
//
'</td>'+
'<td>:&nbsp;' + Math.floor(hp) + '/' + hpAll + '</td>'+
'</tr>'+
'<tr>'+
'<td></td>'+
'<td></td>'+
'<td></td>'+
'</tr>'+
'</table>';
if( block != null ) {
$(block).html( html );
}else{
return html;
}
},
userInfoLogin:function( id , login , level , align , clan ) {
var html = '';
html += '<b>' + login + '</b> [' + level + ']';
html += '<a href="/userinfo/' + id + '" target="_blank"><img src="/static/images/inf.gif" width="12" height="11"></a>';
return html;
},
userInformation:function( data , block ) {
/*
0 - id
1 - ëîãèí
2 - óðîâåíü
3 - ïîë
4 - îáðàç
5 - ñêëîííîñòü
6 - êëàí
7 - ïðåäìåòû íà ïåðñîíàæå
*/
var html = '';
html += '<div align="center">' + this.userInfoLogin( data[0] , data[1] , data[2] , data[4] , data[5] ) + '</div>';
html += '<table width="250" border="0" cellspacing="0" cellpadding="0"><tr><td align="center" valign="top">';
html += '<div id="hpblock' + data[0] + '"></div>';
html += '<div class="ws_border">';
html += '<div class="w_l">';
//
html += this.wDisplay( data[7] , 1 );
html += this.wDisplay( data[7] , 2 );
html += this.wDisplay( data[7] , 3 );
html += this.wDisplay( data[7] , [ 4 , 5 , 6 ] );
html += this.wDisplay( data[7] , 7 );
html += this.wDisplay( data[7] , 8 );
html += this.wDisplay( data[7] , 9 );
//
html += '</div>';
//
html += '<div class="w_c">';
//
html += this.oDisplay( data[5] , 0 );
//
html += '</div>';
//
html += '<div class="w_l">';
//
html += this.wDisplay( data[7] , [ 10 , 11 ] );
html += this.wDisplay( data[7] , 12 );
html += this.wDisplay( data[7] , 14 );
html += this.wDisplay( data[7] , 13 );
//
html += '</div>';
html += '</div>';
html += '</td></tr></table>';
if( html == '' ) {
html = '<div align="center">Undefined data</div>';
}
$(block).html( html );
//Çàïóñêàåì ðåãåí ÍÐ \ ÌÐ
this.userHealth( data[8][0] , data[8][1] , data[8][3] , data[8][2] , data[8][4] , data[8][5] , data[8][6] , $(block).find('#hpblock' + data[0] + '') );
},
wDisplay:function( itm , w ) {
var html = '';
if( html == '' ) {
if( typeof w == 'object' ) {
w = w[0];
}
html = '<img title="Ïóñòîé ñëîò ' + this.wName[w][0] + '" class="wi" width="' + this.wName[w][1] + '" height="' + this.wName[w][2] + '" src="/static/images/items/w/w' + w + '.gif">';
}
return html;
},
oDisplay:function( img , sex ) {
var html = '';
html += '<img width="76" height="209" src="/static/images/chars/' + sex + '/' + img + '">';
return html;
}
};