code-upload (#1)

Upload code

Изменил(а) на 'README.md'

Изменил(а) на 'README.md'

Reviewed-on: https://src.lopar.us/lopar/AntiBK/pulls/1
Co-Authored-By: Ivor Barhansky <lopar@noreply.lopar.us>
Co-Committed-By: Ivor Barhansky <lopar@noreply.lopar.us>
This commit is contained in:
2021-02-11 16:13:04 +00:00
parent dcf2ea7f6d
commit 36bf662112
11279 changed files with 593072 additions and 0 deletions

38
scripts/bank.js Normal file
View File

@@ -0,0 +1,38 @@
$(function (){
$('body').on('click', 'input[name=add_kredit]', function (){
if (isNaN(parseFloat($('input[name=add_sum]').val())))
{
alert('Укажите сумму');
return false;
}
else
return confirm('Вы хотите положить на свой счет '+parseFloat($('input[name=add_sum]').val())+' кр. ?');
}).on('click', 'input[name=get_kredit]', function (){
if (isNaN(parseFloat($('input[name=get_sum]').val())))
{
alert('Укажите сумму');
return false;
}
else
return confirm('Вы хотите снять со своего счета '+parseFloat($('input[name=get_sum]').val())+' кр. ?');
}).on('click', 'input[name=transfer_kredit]', function (){
if (isNaN(parseFloat($('input[name=transfer_sum]').val())) || isNaN(parseInt($('input[name=id2]').val())))
{
alert('Укажите сумму и номер счета');
return false;
}
else
return confirm('Вы хотите перевести со своего счета '+parseFloat($('input[name=transfer_sum]').val())+' кр. на счет номер #'+parseInt($('input[name=id2]').val())+' ?');
}).on('click', 'input[name=convert_ekredit]', function (){
if (isNaN(parseFloat($('input[name=convert_sum]').val())))
{
alert('Укажите обмениваемую сумму');
return false;
}
else
return confirm('Вы хотите обменять '+parseFloat($('input[name=convert_sum]').val())+' екр. на кредиты ?');
}).on('click', 'input[name=close]', function (){
if (confirm('Если вы закроете счет, то для открытия нового счета вам придется снова заплатить 3.00 кр.\nЗакрыть счет?'))
location.href = '?do=delete';
});
});

39
scripts/cookies.js Normal file
View File

@@ -0,0 +1,39 @@
/*Установка куки*/
function setCookie (name, value, expires, path, domain, secure)
{
document.cookie = name + "=" + escape(value) +
((expires) ? "; expires=" + expires : "") +
((path) ? "; path=" + path : "") +
((domain) ? "; domain=" + domain : "") +
((secure) ? "; secure" : "");
}
function getCookie (name)
{
var cookie = " " + document.cookie;
var search = " " + name + "=";
var setStr = null;
var offset = 0;
var end = 0;
if (cookie.length > 0)
{
offset = cookie.indexOf(search);
if (offset != -1)
{
offset += search.length;
end = cookie.indexOf(";", offset)
if (end == -1)
end = cookie.length;
setStr = unescape(cookie.substring(offset, end));
}
}
return (setStr);
}
function getTimePlusHour ()
{
var now = new Date();
var hours = now.getHours();
now.setHours(hours + 1);
return now;
}

151
scripts/dialog.js Normal file
View File

@@ -0,0 +1,151 @@
var Hint3Name = '';
function fixspaces (s)
{
while (s.substr(s.length - 1, s.length) == " ")
s = s.substr(0, s.length - 1);
while (s.substr(0,1) == " ")
s = s.substr(1, s.length);
return (s);
}
function bank_open (ac_list, name)
{
var ac = ac_list.split(',');
var s;
var opt = '<select name="credit" size="0" style="width: 100px;">';
for (var i = 0; i < ac.length; i++)
{
opt += '<option value="' + ac[i] + '"' +((i == 0)?' selected' :'')+ '>'+ ac[i] + '</option>';
}
opt += '</select>';
s = '<table border="0" width="100%" cellspacing="0" cellpadding="2" >'+
'<tr><td colspan="2" align="center">Выберите счёт и введите пароль</td></tr>'+
'<tr>'+
'<td style="padding-left: 5px; text-align: right;">' + opt+ '&nbsp;<input style="width: 100px;" type="password" name="pass" size="12" maxlength="30"></td>'+
'<td><input type="image" src="#IMGSRC#" width="27" height="20" border="0" onclick="Loginbank();"></td>'+
'</tr>'+
'</table>';
s = crtmagic ('', 'Счёт в банке', s, '');
if (!name)
name = "hint3";
$('#'+name).html(s).css({'left': pos.x - 135 + "px", 'top': pos.y - 30 + "px", 'zIndex': '101'}).fadeIn('fast');
$('[name=credit]').focus();
Hint3Name = 'credit';
}
function dialogconfirm (title, script, text, mtype)
{
var s;
s = '<table border="0" width="100%" cellspacing="0" cellpadding="2"><tr><td colspan="2">'+text+
'</td></tr><tr><td width="50%" align="center"><input type="submit" name="yes" value="Да" style="width: 70%; cursor: pointer;" onclick="'+script+';"></td><td width="50%" align="center"><input type="button" style="width: 70%; cursor: pointer;" value="Нет" onclick="closehint3();"></td></tr></table>';
s = crtmagic(mtype, title, s);
$('#hint3').html(s);
var coor = getCenter($('#hint3').width(), $('#hint3').height());
$('#hint3').css({'left': coor.x, 'top': coor.y, 'zIndex': 200}).fadeIn('fast');
Hint3Name = "hint3";
}
function findLogin (title, script, name, defaultlogin, mtype, addon, noclose)
{
var s;
s = '<form action="'+script+'" method="get" name="slform" style="display: inline;">'+
'<table border="0" width="100%" cellspacing="0" cellpadding="2"><tr>'+
'<td colspan="2">Укажите логин персонажа:<small><br>(можно щелкнуть по логину в чате)</td></tr>'+
'<tr><td width="50%" align="right" style="padding-left: 5px;"><input style="width: 100%" type="text" name="'+name+'" value="'+defaultlogin+'"></td>'+
'<td width="50%"><input type="image" src="#IMGSRC#" width="27" height="20" border="0" onclick="slform.'+name+'.value = fixspaces (slform.'+name+'.value);">'+(addon ?addon :'')+'</td></tr></table></form>';
s = crtmagic(mtype, title, s, noclose);
$('#hint3').html(s).css({'left': 100, 'top': 50, 'zIndex': 200}).fadeIn('fast');
$('[name='+name+']').focus();
Hint3Name = name;
}
function foundmagictype (mtypes)
{
if (mtypes)
{
mtypes = mtypes + "";
if (mtypes.indexOf(',') == -1) return parseInt(mtypes);
var s = mtypes.split(',');
var found = 0;
var doubl = 0;
var maxfound = 0;
for (i = 0; i < s.length; i++)
{
var k = parseInt(s[i]);
if (k > maxfound)
{
found = i + 1;
maxfound = k;
doubl = 0;
}
else if (k == maxfound)
doubl = 1;
}
if (doubl)
return 0;
return found;
}
return 0;
}
function crtmagic (mtype, title, body, noclose)
{
var mtype = foundmagictype(mtype);
var names = new Array (
'neitral', 17, 6, 14, 17, 14, 7, 0, 0, 3,
'fire', 57, 30, 33, 20, 21, 14, 11, 11, 0,
'water', 57, 30, 33, 20, 21, 14, 11, 11, 0,
'air', 57, 30, 33, 20, 21, 14, 11, 11, 0,
'earth', 57,30, 33, 20, 21, 14, 11, 11, 0,
'white', 51, 25, 46, 44, 44, 10, 5, 5, 0,
'gray', 51, 25, 46, 44, 44, 10, 5, 5, 0,
'black', 51, 25, 46, 44, 44, 10, 5, 5, 0);
var colors = new Array ('B1A993','DDD5BF', 'ACA396','D3CEC8', '96B0C6', 'BDCDDB', 'AEC0C9', 'CFE1EA', 'AAA291', 'D5CDBC', 'BCBBB6', 'EFEEE9', '969592', 'DADADA', '72726B', 'A6A6A0');
while (body.indexOf('#IMGSRC#') >= 0)
body = body.replace('#IMGSRC#', 'i/misc/dmagic/'+names[mtype*10]+'_30.gif');
var s =
'<table width="270" border="0" align="center" cellpadding="0" cellspacing="0">'+
'<tr>'+
'<td width="100%">'+
'<table width="100%" border="0" cellspacing="0" cellpadding="0">'+
'<tr><td><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr>'+
'<td width="'+names[mtype*10+1]+'" align="left"><img src="i/misc/dmagic/b'+names[mtype*10]+'_03.gif" width="'+names[mtype*10+1]+'" height="'+names[mtype*10+2]+'"></td>'+
'<td width="100%" background="i/misc/dmagic/b'+names[mtype*10]+'_05.gif"></td>'+
'<td width="'+names[mtype*10+3]+'" align="right"><img src="i/misc/dmagic/b'+names[mtype*10]+'_07.gif" width="'+names[mtype*10+3]+'" height="'+names[mtype*10+2]+'"></td>'+
'</tr></table></td></tr>'+
'<tr>'+
'<td><table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>'+
(names[mtype*10+7] ?'<td width="'+names[mtype*10+7]+'"><div style="width: '+names[mtype*10+7]+'">&nbsp;</div></td>' :'')+
'<td width="5" background="i/misc/dmagic/b'+names[mtype*10]+'_19.gif">&nbsp;</td>'+
'<td width="100%" bgcolor="#'+colors[mtype*2]+'"' + (names[mtype*10+9] ?' style="padding-top: '+names[mtype*10+9]+'px;"' :'') + '>'+
'<table border="0" width="100%" cellspacing="0" cellpadding="0">'+
'<td align="center"><b>'+title+'</b></td>'+
'<td width="20" align="right" valign="top">' + ((noclose) ?'' :'<img id="clear" src="i/clearg.gif" width="13" height="13" style="cursor: pointer;" onclick="closehint3 ();">') + '&nbsp;</td>'+
'</table>'+
'<div align="center" style="background-color:#'+colors[mtype*2+1]+';">'+body+'</div>'+
'</td>'+
'<td width="5" background="i/misc/dmagic/b'+names[mtype*10]+'_17.gif">&nbsp;</td>'+
(names[mtype*10+8] ?'<td width="'+names[mtype*10+8]+'"><div style="width:'+names[mtype*10+8]+'px;">&nbsp;</div></td></td>' :'')+
'</tr></table></td>'+
'</tr>'+
'<tr><td><table width="100%" border="0" cellpadding="0" cellspacing="0"><tr>'+
'<td width="'+names[mtype*10+4]+'" align="left"><img src="i/misc/dmagic/b'+names[mtype*10]+'_27.gif" width="'+names[mtype*10+4]+'" height="'+names[mtype*10+6]+'"></td>'+
'<td width="100%" background="i/misc/dmagic/b'+names[mtype*10]+'_29.gif"></td>'+
'<td width="'+names[mtype*10+5]+'" align="right"><img src="i/misc/dmagic/b'+names[mtype*10]+'_31.gif" width="'+names[mtype*10+5]+'" height="'+names[mtype*10+6]+'"></td>'+
'</tr></table></td></tr>'+
'</table>'+
'</td>'+
'</tr>'+
'</table>';
return s;
}
function closehint3 ()
{
$('#hint3').fadeOut('fast', function (){$(this).html('');});
Hint3Name = '';
}

349
scripts/dialog_026_ru.js Normal file
View File

@@ -0,0 +1,349 @@
var Hint3Name = '';
var step = 0;
function errmess(s)
{
messid.innerHTML='<B>'+s+'</B>';
highlight();
}
function highlight()
{
if (step) return(0);
step=10;
setTimeout(dohi,50);
}
function dohi()
{
var hx=new Array(0,1,2,3,4,5,6,7,8,9,"A","B","C","D","E","F");
step--;
messid.style.color="#"+hx[Math.floor(15-step/2)]+((step&1)?"F":"8")+"0000";
if (step>0) setTimeout(dohi,50);
}
function fixspaces(s)
{
while (s.substr(s.length-1,s.length)==" ") s=s.substr(0,s.length-1);
while (s.substr(0,1)==" ") s=s.substr(1,s.length);
return(s);
}
// Заголовок, название скрипта, имя поля с логином
function findLogin(title, script, name, defaultlogin, mtype, addon, need_defend)
{
var s;
if (need_defend && defend == false)
defend = -1;
if (need_defend)
{
addon+="<INPUT type=hidden name='mdefend' value='"+defend+"'>";
addon+="<INPUT type=hidden name='enemy' value='"+enemy+"'>";
addon+="<INPUT type=hidden name='myid' value='"+myid+"'>";
}
s = '<table border=0 width=100% cellspacing="0" cellpadding="2"><tr><form action="'+script+'" method=POST name=slform><td colspan=2>'+
'Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)</TD></TR><TR><TD width=50% align=right style="padding-left:5"><INPUT style="width: 100%" TYPE="text" NAME="'+name+'" value="'+defaultlogin+'"></TD><TD width=50%><INPUT type=image SRC="#IMGSRC#" WIDTH="27" HEIGHT="20" BORDER=0 ALT="" onclick="slform.'+name+'.value=fixspaces(slform.'+name+'.value);">'+(addon?addon:'')+'</TD></TR></FORM></TABLE>';
s = crtmagic (mtype, title, s);
document.all("hint4").innerHTML = s;
document.all("hint4").style.visibility = "visible";
document.all("hint4").style.left = 100;
document.all("hint4").style.zIndex = 200;
document.all("hint4").style.top = document.body.scrollTop+50;
document.all(name).focus();
Hint3Name = name;
}
// Заголовок, название скрипта, имя поля с логином
function bank_info() {
alert('У Вас нет активных счетов. \n\n На правах рекламы: Вы можете открыть счёт в Банке БК,'+
' на Страшилкиной улице*\n\n* Мелким шрифтом: услуга платная.');
}
function bank_blocked(tm) {
var s = 'Ваши счета заблокированы (ещё '+ tm + ').';
alert(s);
}
function get_bank_pwd(){
}
function b_confirm(script, txt, mtype, addon, need_defend) {
if (need_defend && defend==false) {
defend=-1
// errmess("Блок не выбран."); return false;
}
if (need_defend) {
addon+="<INPUT type=hidden name='mdefend' value='"+defend+"'>";
addon+="<INPUT type=hidden name='enemy' value='"+enemy+"'>";
addon+="<INPUT type=hidden name='myid' value='"+myid+"'>";
}
dialogconfirm('Подтверждение', '/battle.pl', '<TABLE width=100%><TD><B>'+txt+'</B><BR>Использовать сейчас?</TABLE>'+addon, mtype);
}
function dialogconfirm(title, script, text, mtype) {
var s;
s='<table border=0 width=100% cellspacing="0" cellpadding="2"><tr><form action="'+script+'" method=POST name=slform><td colspan=2>'+
text+'</TD></TR><TR><TD width=50% align=left><INPUT TYPE="submit" name="tmpname423" value="Да" style="width:70%"></TD><TD width=50% align=right><INPUT type=button style="width:70%" value="Нет" onclick="closehint3();"></TD></TR></FORM></TABLE>';
s = crtmagic(mtype, title, s);
document.all("hint4").innerHTML = s;
document.all("hint4").style.visibility = "visible";
document.all("hint4").style.left = 100;
document.all("hint4").style.zIndex = 200;
document.all("hint4").style.top = document.body.scrollTop+50;
document.all("tmpname423").focus();
Hint3Name = name;
}
function dialogOK(title, text, mtype) {
var s;
s='<table border=0 width=100% cellspacing="0" cellpadding="2"><tr><td colspan=2>'+
text+'</TD></TR><TR><TD width=100% align=right><INPUT type=button style="width:70%" value="Закрыть" onclick="closehint3();"></TD></TR></FORM></TABLE>';
s = crtmagic(mtype, title, s);
document.all("hint4").innerHTML = s;
document.all("hint4").style.visibility = "visible";
document.all("hint4").style.left = 100;
document.all("hint4").style.zIndex = 200;
document.all("hint4").style.top = document.body.scrollTop+50;
Hint3Name = name;
}
function foundmagictype (mtypes) {
if (mtypes) {
mtypes=mtypes+"";
if (mtypes.indexOf(',') == -1) return parseInt(mtypes);
var s=mtypes.split(',');
var found=0;
var doubl=0;
var maxfound=0;
for (i=0; i < s.length; i++) {
var k=parseInt(s[i]);
if (k > maxfound) {
found=i + 1;
maxfound=k;
doubl=0;
} else {
if (k == maxfound) {doubl=1;}
}
}
if (doubl) {return 0};
return found;
}
return 0;
}
// Для магии. Заголовок, название скрипта, название магии, номер вещицы в рюкзаке, логин по умолчанию, описание доп. поля
function magicklogin(title, script, magickname, n, defaultlogin, extparam, mtype) {
var s = '<table border=0 width=100% cellspacing="0" cellpadding="2"><tr><form action="'+script+'" method=POST name=slform><input type=hidden name="use" value="'+magickname+'"><input type=hidden name="n" value="'+n+'"><td colspan=2>'+
'Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)</TD></TR><TR><TD style="padding-left:5" width=50% align=right><INPUT TYPE="text" NAME="param" value="'+defaultlogin+'" style="width: 100%"></TD><TD width=50%><INPUT type=image SRC="#IMGSRC#" WIDTH="27" HEIGHT="20" BORDER=0 ALT="" onclick="slform.param.value=fixspaces(slform.param.value);"></TD></TR>';
if (extparam != null && extparam != '') {
s = s + '<TR><td style="padding-left:5">'+extparam+'<BR><INPUT style="width: 100%" TYPE="text" NAME="param2"></TD><TD></TR>';
}
s = s + '</FORM></TABLE>';
s = crtmagic(mtype, title, s);
document.all("hint4").innerHTML = s;
document.all("hint4").style.visibility = "visible";
document.all("hint4").style.left = 100;
document.all("hint4").style.zIndex = 200;
document.all("hint4").style.top = document.body.scrollTop+50;
document.all("param").focus();
Hint3Name = 'param';
}
// Магия
function UseMagick(title, script, name, extparam, n, extparam2, mtype) {
if ((extparam != null)&&(extparam != '')) {
var t1='text',t2='text';
if (extparam.substr(0,1) == "!")
{
t1='password';
extparam=extparam.substr(1,extparam.length);
}
var s = '<table border=0 width=100% cellspacing="1" cellpadding="0"><TR><form action="'+script+'" method=POST name=slform><input type=hidden name="use" value="'+name+'"><input type=hidden name="n" value="'+n+'"><td colspan=2 align=left><NOBR><SMALL>'+
extparam + ':</NOBR></TD></TR><TR><TD width=100% align=left style="padding-left:5"><INPUT tabindex=1 style="width: 100%" TYPE="'+t1+'" id="param" NAME="param" value=""></TD><TD width=10%><INPUT type=image SRC="#IMGSRC#" WIDTH="27" HEIGHT="20" BORDER=0 ALT="" tabindex=3></TD></TR>';
if (extparam2 != null && extparam2 != '') {
if (extparam2.substr(0,1) == "!")
{
t2='password';
extparam2=extparam2.substr(1,extparam2.length);
}
s = s + '<TR><td colspan=2><NOBR><SMALL>'+extparam2+':</NOBR><TR style="padding-left:5"><TD><INPUT tabindex=2 TYPE="'+t2+'" NAME="param2" style="width: 50%"></TD><TD></TR>';
}
s += '</FORM></TABLE>';
s = crtmagic(mtype, title, s);
document.all("hint4").innerHTML = s;
document.all("hint4").style.visibility = "visible";
document.all("hint4").style.left = 100;
document.all("hint4").style.zIndex = 200;
document.all("hint4").style.top = document.body.scrollTop+50;
document.all("param").focus();
Hint3Name = 'param';
} else {
dialogconfirm('Подтверждение', script, '<TABLE width=100%><TD><IMG src="i/items/'+name+'.gif"></TD><TD>Использовать сейчас?</TABLE>'+
'<input type=hidden name="use" value="'+name+'"><input type=hidden name="n" value="'+n+'">', mtype);
}
}
// Закрывает окно ввода логина
function closehint3()
{
document.all("hint4").style.visibility="hidden";
Hint3Name='';
}
// Для боевой магии. Заголовок, название магии, номер вещицы в рюкзаке
function BmagickLogin(title, magickname, n, defaultlogin, extparam, mtype) {
if (defend==false) {
defend=-1;
// errmess("Блок не выбран."); return false;
}
var s = '<table border=0 width=100% cellspacing="0" cellpadding="2"><tr><form action="/battle.pl" method=POST name="bmagic" onsubmit="bmagic.mdefend.value=defend;"><input type=hidden name="use" value="'+magickname+'"><input type=hidden name="n" value="'+n+'"><input type=hidden name="mdefend" value="'+defend+'"><input type=hidden name="enemy" value="'+enemy+'"><input type=hidden name="myid" value="'+myid+'"><td colspan=2 align=left>'+
'Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)</TD></TR><TR><TD width=50% align=right><INPUT style="width: 100%" TYPE="text" id="param" NAME="param" value="'+defaultlogin+'"></TD><TD width=50%><INPUT type=image SRC="#IMGSRC#" WIDTH="27" HEIGHT="20" BORDER=0 ALT="" onclick="bmagic.param.value=fixspaces(bmagic.param.value);"></TD></TR>';
if (extparam != null && extparam != '') {
s = s + '<TR><td colspan=2>'+extparam+'<TR><TD style="padding-left:5"><INPUT style="width: 100%" TYPE="text" NAME="param2"><TD></TD></TR>';
}
s = s + '</FORM></TABLE>';
s = crtmagic(mtype, title, s);
document.all("hint4").innerHTML= s;
document.all("hint4").style.visibility = "visible";
document.all("hint4").style.left = 100;
document.all("hint4").style.zIndex = 200;
document.all("hint4").style.top = 60;
document.all("param").focus();
Hint3Name = 'param';
}
// Магия
function BUseMagick(name, extparam, n, mtype) {
if (defend==false) {
defend=-1;
// errmess("Блок не выбран."); return false;
}
if ((extparam != null)&&(extparam != '')) {
var s = prompt(extparam+':', '');
if ((s != null)&&(s != '')) {
re = /\%/g; s=s.replace(re, "%25");
re = /\+/g; s=s.replace(re, "%2B");
re = /\#/g; s=s.replace(re, "%23");
re = /\?/g; s=s.replace(re, "%3F");
re = /\&/g; s=s.replace(re, "%26");
window.location.href='/battle.pl?use='+name+'&param='+s+'&n='+n+'&mdefend='+defend+'&enemy='+enemy+'&myid='+myid;
}
} else {
dialogconfirm('Подтверждение', '/battle.pl', '<TABLE width=100%><TD><IMG src="i/items/'+name+'.gif"></TD><TD>Использовать сейчас?</TABLE>'+
'<input type=hidden name="use" value="'+name+'"><input type=hidden name="n" value="'+n+'"><input type=hidden name="mdefend" value="'+defend+'"><input type=hidden name="enemy" value="'+enemy+'"><input type=hidden name="myid" value="'+myid+'">', mtype);
}
}
function foundmagictype (mtypes)
{
if (mtypes) {
mtypes=mtypes+"";
if (mtypes.indexOf(',') == -1) return parseInt(mtypes);
var s=mtypes.split(',');
var found=0;
var doubl=0;
var maxfound=0;
for (i=0; i < s.length; i++) {
var k=parseInt(s[i]);
if (k > maxfound) {
found=i + 1;
maxfound=k;
doubl=0;
} else {
if (k == maxfound) {doubl=1;}
}
}
if (doubl) {return 0};
return found;
}
return 0;
}
function crtmagic (mtype, title, body, subm)
{
mtype = foundmagictype(mtype);
var names=new Array(
'neitral',17, 6, 14, 17, 14, 7,0,0, 3,
'fire', 57, 30, 33, 20, 21, 14, 11, 12, 0,
'water', 57, 30, 33, 20, 21, 14, 11, 12, 0,
'air', 57, 30, 33, 20, 21, 14, 11, 12, 0,
'earth', 57,30, 33, 20, 21, 14, 11, 12, 0,
'white', 51, 25, 46, 44, 44, 10, 5, 5, 0,
'gray', 51, 25, 46, 44, 44, 10, 5, 5, 0,
'black', 51, 25, 46, 44, 44, 10, 5, 5, 0);
var colors=new Array('B1A993','DDD5BF', 'ACA396','D3CEC8', '96B0C6', 'BDCDDB', 'AEC0C9', 'CFE1EA', 'AAA291', 'D5CDBC', 'BCBBB6', 'EFEEE9', '969592', 'DADADA', '72726B', 'A6A6A0');
while (body.indexOf('#IMGSRC#')>=0) body = body.replace('#IMGSRC#', 'i/misc/dmagic/'+names[mtype*10]+'_30.gif');
var s='<table width="270" border="0" align="center" cellpadding="0" cellspacing="0">'+
'<tr>'+
'<td width="100%">'+
'<table width="100%" border="0" cellspacing="0" cellpadding="0">'+
'<tr><td>'+
'<table width="100%" border="0" cellpadding="0" cellspacing="0">'+
'<tr>'+
'<td width="'+names[mtype*10+1]+'" align="left"><img src="i/misc/dmagic/b'+names[mtype*10]+'_03.gif" width="'+names[mtype*10+1]+'" height="'+names[mtype*10+2]+'"></td>'+
'<td width="100%" align="right" background="i/misc/dmagic/b'+names[mtype*10]+'_05.gif"></td>'+
'<td width="'+names[mtype*10+3]+'" align="right"><img src="i/misc/dmagic/b'+names[mtype*10]+'_07.gif" width="'+names[mtype*10+3]+'" height="'+names[mtype*10+2]+'"></td>'+
'</tr>'+
'</table></td>'+
'</tr>'+
'<tr><td>'+
'<table width="100%" border="0" cellspacing="0" cellpadding="0">'+
'<tr>'+
(names[mtype*10+7]?'<td width="'+names[mtype*10+7]+'"><SPAN style="width:'+names[mtype*10+7]+'">&nbsp;</SPAN></td>':'')+
'<td width="5" background="i/misc/dmagic/b'+names[mtype*10]+'_17.gif">&nbsp;</td>'+
'<td width="100%">'+
'<table width="100%" border="0" cellspacing="0" cellpadding="0">'+
'<tr><td bgcolor="#'+colors[mtype*2]+'"'+(names[mtype*10+9]?' style="padding-top: '+names[mtype*10+9]+'"':'')+' >'+
'<table border=0 width=100% cellspacing="0" cellpadding="0"><td style="padding-left: 20" align=center><B>'+title+
'</td><td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();" style=\'filter:Gray()\' onmouseover="this.filters.Gray.Enabled=false" onmouseout="this.filters.Gray.Enabled=true"><IMG src="i/clear.gif" width=13 height=13>&nbsp;</td></table>'+
'</td></tr>'+
'<tr>'+
'<td align="center" bgcolor="#'+colors[mtype*2+1]+'">'+body+
'</tr>'+
'</table></td>'+
'<td width="5" background="i/misc/dmagic/b'+names[mtype*10]+'_19.gif">&nbsp;</td>'+
(names[mtype*10+8]?'<td width="'+names[mtype*10+8]+'"><SPAN style="width:'+names[mtype*10+8]+'">&nbsp;</SPAN></td></td>':'')+
'</tr>'+
'</table></td>'+
'</tr>'+
'<tr><td>'+
'<table width="100%" border="0" cellpadding="0" cellspacing="0">'+
'<tr>'+
'<td width="'+names[mtype*10+4]+'" align="left"><img src="i/misc/dmagic/b'+names[mtype*10]+'_27.gif" width="'+names[mtype*10+4]+'" height="'+names[mtype*10+6]+'"></td>'+
'<td width="100%" align="right" background="i/misc/dmagic/b'+names[mtype*10]+'_29.gif"></td>'+
'<td width="'+names[mtype*10+5]+'" align="right"><img src="i/misc/dmagic/b'+names[mtype*10]+'_31.gif" width="'+names[mtype*10+5]+'" height="'+names[mtype*10+6]+'"></td>'+
'</tr>'+
'</table></td>'+
'</tr>'+
'</table></td>'+
'</tr>'+
'</table>';
return s;
}

20
scripts/fireworks.js Normal file
View File

@@ -0,0 +1,20 @@
var fireworks_types = new Array('04',21, '03',21, '05',21, '06',21, '07',27, '08',27, '02',34, '09',34, '10',34 );
function fireworks (x,y,type)
{
return start_fireworks(x,y,type);
}
function start_fireworks (x,y,type)
{
myFW = new JSFX.FireworkDisplay(1, "img/fw"+fireworks_types[type*2], fireworks_types[type*2+1], x, y);
myFW.start();
return false;
}
function stop_fireworks (id)
{
$('#'+id).css('display', 'none');
document.getElementById(id).removeNode(true);
return false;
}

3
scripts/forum.js Normal file
View File

@@ -0,0 +1,3 @@
$(function (){
$('body').on('click', '#gototech', function (){window.location = '../forum/?cat=11';});
});

142
scripts/info.js Normal file
View File

@@ -0,0 +1,142 @@
//-- Смена хитпоинтов
var delay = 3; // Каждые n сек. увеличение HP и MP на 1%
var redHP = 0.33; // меньше 30% красный цвет
var yellowHP = 0.66; // меньше 60% желтый цвет, иначе зеленый
var TimerOnHP = -1; // id таймера HP
var TimerOnMP = -1; // id таймера MP
var nowHP, maxHP, nowMP, maxMP, hspeed, mspeed;
function showHP (now, max, newspeed, mini)
{
nowHP = now;
maxHP = max;
hspeed = newspeed;
if (TimerOnHP >= 0)
{
clearTimeout(TimerOnHP);
TimerOnHP = -1;
}
if (mini)
setHPmini();
else
setHPlocal();
}
function setHPlocal ()
{
var plusHP = 0;
if (nowHP == maxHP)
TimerOnHP = -1;
else
{
plusHP = maxHP * hspeed * 0.00001;
nowHP += ((plusHP+nowHP) <= maxHP) ?plusHP :maxHP-nowHP;
TimerOnHP = 0;
}
var le = 120;
var h1 = Math.round((le / maxHP) * nowHP);
var h2 = le - h1;
if (nowHP / maxHP < redHP)
imag = 'img/icon/bk_life_red.gif';
else if (nowHP / maxHP < yellowHP)
imag = 'img/icon/bk_life_yellow.gif';
else
imag = 'img/icon/bk_life_green.gif';
var rhp = Math.round(nowHP) + "/" + maxHP;
var alt = 'Уровень жизни'+((plusHP > 0 && (difHP = maxHP-nowHP) > 0) ?'<br>Осталось: '+top.getFormatedTime(Math.round(difHP*delay/(plusHP*10))) :'');
$('#HP').html("<table border='0' cellpadding='0' cellspacing='0' width='120' align='center' style='padding-top: 1px;'><tr>"+
"<td style='position: absolute; width: 120px; font-size: 9px; color: white; font-weight: bold; margin-top: -2px; padding-left: 5px;' align='left' alt='"+alt+"'>"+rhp+"</td>"+
"<td style='width: "+h1+"px; height: 10px; background: url("+imag+") repeat-x;'></td>"+
"<td style='width: "+h2+"px; height: 10px; background: url(img/icon/bk_life_loose.gif) repeat-x;'></td>"+
"</tr></table>");
updateMmoves('HP', alt);
if (TimerOnHP != -1)
TimerOnHP = setTimeout(setHPlocal, delay * 100);
}
function showMP (now, max, newspeed)
{
if (max == 0)
return;
nowMP = now;
maxMP = max;
if (TimerOnMP >= 0)
{
clearTimeout(TimerOnMP);
TimerOnMP = -1;
}
mspeed = newspeed;
setMPlocal();
}
function setMPlocal ()
{
var plusMP = 0;
if (maxMP == 0)
return;
if (nowMP == maxMP)
TimerOnMP = -1
else
{
plusMP = maxMP * mspeed * 0.00001;
nowMP += ((plusMP+nowMP) <= maxMP) ?plusMP :maxMP-nowMP;
TimerOnMP = 0;
}
var le = 120;
var m1 = Math.round((le / maxMP) * nowMP);
var m2 = le - m1;
var rmp = Math.round(nowMP) + "/" + maxMP;
var alt = 'Уровень маны'+((plusMP > 0 && (difMP = maxMP-nowMP) > 0) ?'<br>Осталось: '+top.getFormatedTime(Math.round(difMP*delay/(plusMP*10))) :'')
$('#MP').html("<table border='0' cellpadding='0' cellspacing='0' width='"+le+"' align='center' style='margin-top: -1px;'><tr>"+
"<td style='position: absolute; width: "+le+"px; font-size: 9px; color: white; font-weight: bold; margin-top: -2px; padding-left: 5px; color: #80FFFF;' align='left' alt='"+alt+"'>"+rmp+"</td>"+
"<td style='width: "+m1+"px; height: 10px; background: url(img/icon/blue.gif) repeat-x;'></td>"+
"<td style='width: "+m2+"px; height: 10px; background: url(img/icon/bk_life_loose.gif) repeat-x;'></td>"+
"</tr></table>");
updateMmoves('MP', alt);
if (TimerOnMP != -1)
TimerOnMP = setTimeout(setMPlocal, delay * 100);
}
function setHPmini ()
{
var plusHP = 0;
if (nowHP == maxHP)
TimerOnHP = -1;
else
{
plusHP = maxHP * hspeed * 0.00001;
nowHP += ((plusHP+nowHP) <= maxHP) ?plusHP :maxHP-nowHP;
TimerOnHP = 0;
}
var le = 120;
var h1 = Math.round((le / maxHP) * nowHP);
var h2 = le - h1;
if (nowHP / maxHP < redHP)
imag = 'img/icon/bk_life_red.gif';
else if (nowHP / maxHP < yellowHP)
imag = 'img/icon/bk_life_yellow.gif';
else
imag = 'img/icon/bk_life_green.gif';
var rhp = Math.round(nowHP) + "/" + maxHP;
var alt = 'Уровень жизни'+((plusHP > 0 && (difHP = maxHP-nowHP) > 0) ?'<br>Осталось: '+top.getFormatedTime(Math.round(difHP*delay/(plusHP*10))) :'');
$('#HP').html(" <span style='font-size: 10px; cursor: default;' alt='"+alt+"'>"+rhp+"</span> <table border='0' cellpadding='0' cellspacing='0' width='120' style='display: inline; vertical-align: middle;'><tr>"+
"<td style='width: "+h1+"px; height: 10px; background: url("+imag+") repeat-x;'></td>"+
"<td style='width: "+h2+"px; height: 10px; background: url(img/icon/bk_life_loose.gif) repeat-x;'></td>"+
"</tr></table>");
updateMmoves('HP', alt);
if (TimerOnHP != -1)
TimerOnHP = setTimeout(setHPmini, delay * 100);
}
var pos = {};
$(function (){
$(document).on('mousemove', function (e){
pos.x = e.pageX - $(window).scrollLeft();
pos.y = e.pageY - $(window).scrollTop();
});
});

121
scripts/inventory.js Normal file
View File

@@ -0,0 +1,121 @@
function kmp ()
{
hideShow('#hint3', visual.hint_c_set, '');
$("[name=savekmp]").focus();
}
function sortInventory (type)
{
clearError();
$('html, body').animate({scrollTop: 0}, 500);
var num = $("#sort_"+type).attr('name');
$.post('ajax.php', {'do': 'sortinventory', 'type': type, 'num': num}, function (data){
var sort = top.exploder(data);
if (sort[0] == 'complete')
{
var section = getCookie('section');
num = (num == 1) ?0 :1;
$.post('ajax.php', {'do': 'showinventory', 'section': section, 'type': 'inv'}, function (data){
var inventory = top.exploder(data);
visual.show_any('#inventory', inventory[0]);
$('#sort_'+type).attr('name', num);
});
}
});
}
function increaseItemStat (id, stat)
{
clearError();
$.post('ajax.php', {'do': 'increaseitemstat', 'id': id, 'stat': stat}, function (data){
var incs = top.exploder(data);
if (incs[0] == 'complete')
visual.item_inc_stat(id, stat, incs);
else if (incs[0] == 'error')
showError(incs[1]);
});
}
function Loginbank()
{
clearError();
var credit = $('select[name=credit]').val();
var pass = $('input[name=pass]').val();
$.post('ajax.php', {'do': 'loginbank', 'credit': credit, 'pass': pass}, function (data){
closehint3();
var bank = top.exploder(data);
if (bank[0] == 'complete')
visual.show_any('#loginbank', bank[1]);
else if (bank[0] == 'error')
showError(bank[1]);
});
}
function UnLoginbank()
{
clearError();
$.post('ajax.php', {'do': 'unloginbank'}, function (data){
var unlogin = top.exploder(data);
visual.show_any('#loginbank', unlogin[0]);
});
}
function switchBars (type, bar)
{
clearError();
$.post('ajax.php', {'do': 'switchbars', 'bar': bar, 'type': type}, function (data){
var bars = top.exploder(data);
if (bars[0] == 'complete')
visual.bar_switch(bars);
});
}
function spoilerBar (bar)
{
clearError();
$.post('ajax.php', {'do': 'spoilerbar', 'bar': bar}, function (data){
var bars = top.exploder(data);
if (bars[0] == 'hide')
visual.bar_hide(bar);
else if (bars[0] == 'show')
visual.bar_show(bar);
});
}
function workSets (type, name)
{
clearError();
if (!name)
name = $("input[name=set_name]").val();
$.post('ajax.php', {'do': 'worksets', 'name': name, 'type': type}, function (data){
var set = top.exploder(data);
if (type == 'create' && set[0] == 'complete')
visual.set_create(name, set[1]);
else if (type == 'delete' && set[0] == 'complete')
visual.set_delete(name);
else if (type == 'show' && set[0] == 'complete')
hideShow('#hint3', visual.hint_set, set[1]);
else if (set[0] == 'error')
showError(set[1], name);
});
}
function deleteItem (id)
{
var dropall = ($('input[name=dropall]').is(':checked')) ?1 :0;
$.post('ajax.php', {'do': 'deleteitem', 'id': id, 'dropall': dropall}, function (data){
closehint3();
var item = top.exploder(data);
if (item[0] == 'complete')
visual.item_delete(item, id, dropall);
else if (item[0] == 'error')
showError(item[1]);
});
}
function bank_info ()
{
alert("У вас нет активных счетов.\n\nНа правах рекламы: Вы можете открыть счёт в Банке БК, на Страшилкиной улице*\n\n* Мелким шрифтом: услуга платная.");
}

793
scripts/jquery.color.js Normal file
View File

@@ -0,0 +1,793 @@
/*!
* jQuery Color Animations v2.1.2
* https://github.com/jquery/jquery-color
*
* Copyright 2013 jQuery Foundation and other contributors
* Released under the MIT license.
* http://jquery.org/license
*
* Date: Wed Jan 16 08:47:09 2013 -0600
*/
(function( jQuery, undefined ) {
var stepHooks = "backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor",
// plusequals test for += 100 -= 100
rplusequals = /^([\-+])=\s*(\d+\.?\d*)/,
// a set of RE's that can match strings and generate color tuples.
stringParsers = [{
re: /rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
parse: function( execResult ) {
return [
execResult[ 1 ],
execResult[ 2 ],
execResult[ 3 ],
execResult[ 4 ]
];
}
}, {
re: /rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
parse: function( execResult ) {
return [
execResult[ 1 ] * 2.55,
execResult[ 2 ] * 2.55,
execResult[ 3 ] * 2.55,
execResult[ 4 ]
];
}
}, {
// this regex ignores A-F because it's compared against an already lowercased string
re: /#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})/,
parse: function( execResult ) {
return [
parseInt( execResult[ 1 ], 16 ),
parseInt( execResult[ 2 ], 16 ),
parseInt( execResult[ 3 ], 16 )
];
}
}, {
// this regex ignores A-F because it's compared against an already lowercased string
re: /#([a-f0-9])([a-f0-9])([a-f0-9])/,
parse: function( execResult ) {
return [
parseInt( execResult[ 1 ] + execResult[ 1 ], 16 ),
parseInt( execResult[ 2 ] + execResult[ 2 ], 16 ),
parseInt( execResult[ 3 ] + execResult[ 3 ], 16 )
];
}
}, {
re: /hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,
space: "hsla",
parse: function( execResult ) {
return [
execResult[ 1 ],
execResult[ 2 ] / 100,
execResult[ 3 ] / 100,
execResult[ 4 ]
];
}
}],
// jQuery.Color( )
color = jQuery.Color = function( color, green, blue, alpha ) {
return new jQuery.Color.fn.parse( color, green, blue, alpha );
},
spaces = {
rgba: {
props: {
red: {
idx: 0,
type: "byte"
},
green: {
idx: 1,
type: "byte"
},
blue: {
idx: 2,
type: "byte"
}
}
},
hsla: {
props: {
hue: {
idx: 0,
type: "degrees"
},
saturation: {
idx: 1,
type: "percent"
},
lightness: {
idx: 2,
type: "percent"
}
}
}
},
propTypes = {
"byte": {
floor: true,
max: 255
},
"percent": {
max: 1
},
"degrees": {
mod: 360,
floor: true
}
},
support = color.support = {},
// element for support tests
supportElem = jQuery( "<p>" )[ 0 ],
// colors = jQuery.Color.names
colors,
// local aliases of functions called often
each = jQuery.each;
// determine rgba support immediately
supportElem.style.cssText = "background-color:rgba(1,1,1,.5)";
support.rgba = supportElem.style.backgroundColor.indexOf( "rgba" ) > -1;
// define cache name and alpha properties
// for rgba and hsla spaces
each( spaces, function( spaceName, space ) {
space.cache = "_" + spaceName;
space.props.alpha = {
idx: 3,
type: "percent",
def: 1
};
});
function clamp( value, prop, allowEmpty ) {
var type = propTypes[ prop.type ] || {};
if ( value == null ) {
return (allowEmpty || !prop.def) ? null : prop.def;
}
// ~~ is an short way of doing floor for positive numbers
value = type.floor ? ~~value : parseFloat( value );
// IE will pass in empty strings as value for alpha,
// which will hit this case
if ( isNaN( value ) ) {
return prop.def;
}
if ( type.mod ) {
// we add mod before modding to make sure that negatives values
// get converted properly: -10 -> 350
return (value + type.mod) % type.mod;
}
// for now all property types without mod have min and max
return 0 > value ? 0 : type.max < value ? type.max : value;
}
function stringParse( string ) {
var inst = color(),
rgba = inst._rgba = [];
string = string.toLowerCase();
each( stringParsers, function( i, parser ) {
var parsed,
match = parser.re.exec( string ),
values = match && parser.parse( match ),
spaceName = parser.space || "rgba";
if ( values ) {
parsed = inst[ spaceName ]( values );
// if this was an rgba parse the assignment might happen twice
// oh well....
inst[ spaces[ spaceName ].cache ] = parsed[ spaces[ spaceName ].cache ];
rgba = inst._rgba = parsed._rgba;
// exit each( stringParsers ) here because we matched
return false;
}
});
// Found a stringParser that handled it
if ( rgba.length ) {
// if this came from a parsed string, force "transparent" when alpha is 0
// chrome, (and maybe others) return "transparent" as rgba(0,0,0,0)
if ( rgba.join() === "0,0,0,0" ) {
jQuery.extend( rgba, colors.transparent );
}
return inst;
}
// named colors
return colors[ string ];
}
color.fn = jQuery.extend( color.prototype, {
parse: function( red, green, blue, alpha ) {
if ( red === undefined ) {
this._rgba = [ null, null, null, null ];
return this;
}
if ( red.jquery || red.nodeType ) {
red = jQuery( red ).css( green );
green = undefined;
}
var inst = this,
type = jQuery.type( red ),
rgba = this._rgba = [];
// more than 1 argument specified - assume ( red, green, blue, alpha )
if ( green !== undefined ) {
red = [ red, green, blue, alpha ];
type = "array";
}
if ( type === "string" ) {
return this.parse( stringParse( red ) || colors._default );
}
if ( type === "array" ) {
each( spaces.rgba.props, function( key, prop ) {
rgba[ prop.idx ] = clamp( red[ prop.idx ], prop );
});
return this;
}
if ( type === "object" ) {
if ( red instanceof color ) {
each( spaces, function( spaceName, space ) {
if ( red[ space.cache ] ) {
inst[ space.cache ] = red[ space.cache ].slice();
}
});
} else {
each( spaces, function( spaceName, space ) {
var cache = space.cache;
each( space.props, function( key, prop ) {
// if the cache doesn't exist, and we know how to convert
if ( !inst[ cache ] && space.to ) {
// if the value was null, we don't need to copy it
// if the key was alpha, we don't need to copy it either
if ( key === "alpha" || red[ key ] == null ) {
return;
}
inst[ cache ] = space.to( inst._rgba );
}
// this is the only case where we allow nulls for ALL properties.
// call clamp with alwaysAllowEmpty
inst[ cache ][ prop.idx ] = clamp( red[ key ], prop, true );
});
// everything defined but alpha?
if ( inst[ cache ] && jQuery.inArray( null, inst[ cache ].slice( 0, 3 ) ) < 0 ) {
// use the default of 1
inst[ cache ][ 3 ] = 1;
if ( space.from ) {
inst._rgba = space.from( inst[ cache ] );
}
}
});
}
return this;
}
},
is: function( compare ) {
var is = color( compare ),
same = true,
inst = this;
each( spaces, function( _, space ) {
var localCache,
isCache = is[ space.cache ];
if (isCache) {
localCache = inst[ space.cache ] || space.to && space.to( inst._rgba ) || [];
each( space.props, function( _, prop ) {
if ( isCache[ prop.idx ] != null ) {
same = ( isCache[ prop.idx ] === localCache[ prop.idx ] );
return same;
}
});
}
return same;
});
return same;
},
_space: function() {
var used = [],
inst = this;
each( spaces, function( spaceName, space ) {
if ( inst[ space.cache ] ) {
used.push( spaceName );
}
});
return used.pop();
},
transition: function( other, distance ) {
var end = color( other ),
spaceName = end._space(),
space = spaces[ spaceName ],
startColor = this.alpha() === 0 ? color( "transparent" ) : this,
start = startColor[ space.cache ] || space.to( startColor._rgba ),
result = start.slice();
end = end[ space.cache ];
each( space.props, function( key, prop ) {
var index = prop.idx,
startValue = start[ index ],
endValue = end[ index ],
type = propTypes[ prop.type ] || {};
// if null, don't override start value
if ( endValue === null ) {
return;
}
// if null - use end
if ( startValue === null ) {
result[ index ] = endValue;
} else {
if ( type.mod ) {
if ( endValue - startValue > type.mod / 2 ) {
startValue += type.mod;
} else if ( startValue - endValue > type.mod / 2 ) {
startValue -= type.mod;
}
}
result[ index ] = clamp( ( endValue - startValue ) * distance + startValue, prop );
}
});
return this[ spaceName ]( result );
},
blend: function( opaque ) {
// if we are already opaque - return ourself
if ( this._rgba[ 3 ] === 1 ) {
return this;
}
var rgb = this._rgba.slice(),
a = rgb.pop(),
blend = color( opaque )._rgba;
return color( jQuery.map( rgb, function( v, i ) {
return ( 1 - a ) * blend[ i ] + a * v;
}));
},
toRgbaString: function() {
var prefix = "rgba(",
rgba = jQuery.map( this._rgba, function( v, i ) {
return v == null ? ( i > 2 ? 1 : 0 ) : v;
});
if ( rgba[ 3 ] === 1 ) {
rgba.pop();
prefix = "rgb(";
}
return prefix + rgba.join() + ")";
},
toHslaString: function() {
var prefix = "hsla(",
hsla = jQuery.map( this.hsla(), function( v, i ) {
if ( v == null ) {
v = i > 2 ? 1 : 0;
}
// catch 1 and 2
if ( i && i < 3 ) {
v = Math.round( v * 100 ) + "%";
}
return v;
});
if ( hsla[ 3 ] === 1 ) {
hsla.pop();
prefix = "hsl(";
}
return prefix + hsla.join() + ")";
},
toHexString: function( includeAlpha ) {
var rgba = this._rgba.slice(),
alpha = rgba.pop();
if ( includeAlpha ) {
rgba.push( ~~( alpha * 255 ) );
}
return "#" + jQuery.map( rgba, function( v ) {
// default to 0 when nulls exist
v = ( v || 0 ).toString( 16 );
return v.length === 1 ? "0" + v : v;
}).join("");
},
toString: function() {
return this._rgba[ 3 ] === 0 ? "transparent" : this.toRgbaString();
}
});
color.fn.parse.prototype = color.fn;
// hsla conversions adapted from:
// https://code.google.com/p/maashaack/source/browse/packages/graphics/trunk/src/graphics/colors/HUE2RGB.as?r=5021
function hue2rgb( p, q, h ) {
h = ( h + 1 ) % 1;
if ( h * 6 < 1 ) {
return p + (q - p) * h * 6;
}
if ( h * 2 < 1) {
return q;
}
if ( h * 3 < 2 ) {
return p + (q - p) * ((2/3) - h) * 6;
}
return p;
}
spaces.hsla.to = function ( rgba ) {
if ( rgba[ 0 ] == null || rgba[ 1 ] == null || rgba[ 2 ] == null ) {
return [ null, null, null, rgba[ 3 ] ];
}
var r = rgba[ 0 ] / 255,
g = rgba[ 1 ] / 255,
b = rgba[ 2 ] / 255,
a = rgba[ 3 ],
max = Math.max( r, g, b ),
min = Math.min( r, g, b ),
diff = max - min,
add = max + min,
l = add * 0.5,
h, s;
if ( min === max ) {
h = 0;
} else if ( r === max ) {
h = ( 60 * ( g - b ) / diff ) + 360;
} else if ( g === max ) {
h = ( 60 * ( b - r ) / diff ) + 120;
} else {
h = ( 60 * ( r - g ) / diff ) + 240;
}
// chroma (diff) == 0 means greyscale which, by definition, saturation = 0%
// otherwise, saturation is based on the ratio of chroma (diff) to lightness (add)
if ( diff === 0 ) {
s = 0;
} else if ( l <= 0.5 ) {
s = diff / add;
} else {
s = diff / ( 2 - add );
}
return [ Math.round(h) % 360, s, l, a == null ? 1 : a ];
};
spaces.hsla.from = function ( hsla ) {
if ( hsla[ 0 ] == null || hsla[ 1 ] == null || hsla[ 2 ] == null ) {
return [ null, null, null, hsla[ 3 ] ];
}
var h = hsla[ 0 ] / 360,
s = hsla[ 1 ],
l = hsla[ 2 ],
a = hsla[ 3 ],
q = l <= 0.5 ? l * ( 1 + s ) : l + s - l * s,
p = 2 * l - q;
return [
Math.round( hue2rgb( p, q, h + ( 1 / 3 ) ) * 255 ),
Math.round( hue2rgb( p, q, h ) * 255 ),
Math.round( hue2rgb( p, q, h - ( 1 / 3 ) ) * 255 ),
a
];
};
each( spaces, function( spaceName, space ) {
var props = space.props,
cache = space.cache,
to = space.to,
from = space.from;
// makes rgba() and hsla()
color.fn[ spaceName ] = function( value ) {
// generate a cache for this space if it doesn't exist
if ( to && !this[ cache ] ) {
this[ cache ] = to( this._rgba );
}
if ( value === undefined ) {
return this[ cache ].slice();
}
var ret,
type = jQuery.type( value ),
arr = ( type === "array" || type === "object" ) ? value : arguments,
local = this[ cache ].slice();
each( props, function( key, prop ) {
var val = arr[ type === "object" ? key : prop.idx ];
if ( val == null ) {
val = local[ prop.idx ];
}
local[ prop.idx ] = clamp( val, prop );
});
if ( from ) {
ret = color( from( local ) );
ret[ cache ] = local;
return ret;
} else {
return color( local );
}
};
// makes red() green() blue() alpha() hue() saturation() lightness()
each( props, function( key, prop ) {
// alpha is included in more than one space
if ( color.fn[ key ] ) {
return;
}
color.fn[ key ] = function( value ) {
var vtype = jQuery.type( value ),
fn = ( key === "alpha" ? ( this._hsla ? "hsla" : "rgba" ) : spaceName ),
local = this[ fn ](),
cur = local[ prop.idx ],
match;
if ( vtype === "undefined" ) {
return cur;
}
if ( vtype === "function" ) {
value = value.call( this, cur );
vtype = jQuery.type( value );
}
if ( value == null && prop.empty ) {
return this;
}
if ( vtype === "string" ) {
match = rplusequals.exec( value );
if ( match ) {
value = cur + parseFloat( match[ 2 ] ) * ( match[ 1 ] === "+" ? 1 : -1 );
}
}
local[ prop.idx ] = value;
return this[ fn ]( local );
};
});
});
// add cssHook and .fx.step function for each named hook.
// accept a space separated string of properties
color.hook = function( hook ) {
var hooks = hook.split( " " );
each( hooks, function( i, hook ) {
jQuery.cssHooks[ hook ] = {
set: function( elem, value ) {
var parsed, curElem,
backgroundColor = "";
if ( value !== "transparent" && ( jQuery.type( value ) !== "string" || ( parsed = stringParse( value ) ) ) ) {
value = color( parsed || value );
if ( !support.rgba && value._rgba[ 3 ] !== 1 ) {
curElem = hook === "backgroundColor" ? elem.parentNode : elem;
while (
(backgroundColor === "" || backgroundColor === "transparent") &&
curElem && curElem.style
) {
try {
backgroundColor = jQuery.css( curElem, "backgroundColor" );
curElem = curElem.parentNode;
} catch ( e ) {
}
}
value = value.blend( backgroundColor && backgroundColor !== "transparent" ?
backgroundColor :
"_default" );
}
value = value.toRgbaString();
}
try {
elem.style[ hook ] = value;
} catch( e ) {
// wrapped to prevent IE from throwing errors on "invalid" values like 'auto' or 'inherit'
}
}
};
jQuery.fx.step[ hook ] = function( fx ) {
if ( !fx.colorInit ) {
fx.start = color( fx.elem, hook );
fx.end = color( fx.end );
fx.colorInit = true;
}
jQuery.cssHooks[ hook ].set( fx.elem, fx.start.transition( fx.end, fx.pos ) );
};
});
};
color.hook( stepHooks );
jQuery.cssHooks.borderColor = {
expand: function( value ) {
var expanded = {};
each( [ "Top", "Right", "Bottom", "Left" ], function( i, part ) {
expanded[ "border" + part + "Color" ] = value;
});
return expanded;
}
};
// Basic color names only.
// Usage of any of the other color names requires adding yourself or including
// jquery.color.svg-names.js.
colors = jQuery.Color.names = {
// 4.1. Basic color keywords
aqua: "#00ffff",
black: "#000000",
blue: "#0000ff",
fuchsia: "#ff00ff",
gray: "#808080",
green: "#008000",
lime: "#00ff00",
maroon: "#800000",
navy: "#000080",
olive: "#808000",
purple: "#800080",
red: "#ff0000",
silver: "#c0c0c0",
teal: "#008080",
white: "#ffffff",
yellow: "#ffff00",
aliceblue: "#f0f8ff",
antiquewhite: "#faebd7",
aquamarine: "#7fffd4",
azure: "#f0ffff",
beige: "#f5f5dc",
bisque: "#ffe4c4",
blanchedalmond: "#ffebcd",
blueviolet: "#8a2be2",
brown: "#a52a2a",
burlywood: "#deb887",
cadetblue: "#5f9ea0",
chartreuse: "#7fff00",
chocolate: "#d2691e",
coral: "#ff7f50",
cornflowerblue: "#6495ed",
cornsilk: "#fff8dc",
crimson: "#dc143c",
cyan: "#00ffff",
darkblue: "#00008b",
darkcyan: "#008b8b",
darkgoldenrod: "#b8860b",
darkgray: "#a9a9a9",
darkgreen: "#006400",
darkgrey: "#a9a9a9",
darkkhaki: "#bdb76b",
darkmagenta: "#8b008b",
darkolivegreen: "#556b2f",
darkorange: "#ff8c00",
darkorchid: "#9932cc",
darkred: "#8b0000",
darksalmon: "#e9967a",
darkseagreen: "#8fbc8f",
darkslateblue: "#483d8b",
darkslategray: "#2f4f4f",
darkslategrey: "#2f4f4f",
darkturquoise: "#00ced1",
darkviolet: "#9400d3",
deeppink: "#ff1493",
deepskyblue: "#00bfff",
dimgray: "#696969",
dimgrey: "#696969",
dodgerblue: "#1e90ff",
firebrick: "#b22222",
floralwhite: "#fffaf0",
forestgreen: "#228b22",
gainsboro: "#dcdcdc",
ghostwhite: "#f8f8ff",
gold: "#ffd700",
goldenrod: "#daa520",
greenyellow: "#adff2f",
grey: "#808080",
honeydew: "#f0fff0",
hotpink: "#ff69b4",
indianred: "#cd5c5c",
indigo: "#4b0082",
ivory: "#fffff0",
khaki: "#f0e68c",
lavender: "#e6e6fa",
lavenderblush: "#fff0f5",
lawngreen: "#7cfc00",
lemonchiffon: "#fffacd",
lightblue: "#add8e6",
lightcoral: "#f08080",
lightcyan: "#e0ffff",
lightgoldenrodyellow: "#fafad2",
lightgray: "#d3d3d3",
lightgreen: "#90ee90",
lightgrey: "#d3d3d3",
lightpink: "#ffb6c1",
lightsalmon: "#ffa07a",
lightseagreen: "#20b2aa",
lightskyblue: "#87cefa",
lightslategray: "#778899",
lightslategrey: "#778899",
lightsteelblue: "#b0c4de",
lightyellow: "#ffffe0",
limegreen: "#32cd32",
linen: "#faf0e6",
mediumaquamarine: "#66cdaa",
mediumblue: "#0000cd",
mediumorchid: "#ba55d3",
mediumpurple: "#9370db",
mediumseagreen: "#3cb371",
mediumslateblue: "#7b68ee",
mediumspringgreen: "#00fa9a",
mediumturquoise: "#48d1cc",
mediumvioletred: "#c71585",
midnightblue: "#191970",
mintcream: "#f5fffa",
mistyrose: "#ffe4e1",
moccasin: "#ffe4b5",
navajowhite: "#ffdead",
oldlace: "#fdf5e6",
olivedrab: "#6b8e23",
orange: "#ffa500",
orangered: "#ff4500",
orchid: "#da70d6",
palegoldenrod: "#eee8aa",
palegreen: "#98fb98",
paleturquoise: "#afeeee",
palevioletred: "#db7093",
papayawhip: "#ffefd5",
peachpuff: "#ffdab9",
peru: "#cd853f",
pink: "#ffc0cb",
plum: "#dda0dd",
powderblue: "#b0e0e6",
rosybrown: "#bc8f8f",
royalblue: "#4169e1",
saddlebrown: "#8b4513",
salmon: "#fa8072",
sandybrown: "#f4a460",
seagreen: "#2e8b57",
seashell: "#fff5ee",
sienna: "#a0522d",
skyblue: "#87ceeb",
slateblue: "#6a5acd",
slategray: "#708090",
slategrey: "#708090",
snow: "#fffafa",
springgreen: "#00ff7f",
steelblue: "#4682b4",
tan: "#d2b48c",
thistle: "#d8bfd8",
tomato: "#ff6347",
turquoise: "#40e0d0",
violet: "#ee82ee",
wheat: "#f5deb3",
whitesmoke: "#f5f5f5",
yellowgreen: "#9acd32",
// 4.2.3. "transparent" color keyword
transparent: [ null, null, null, 0 ],
_default: "#ffffff"
};
})( jQuery );

9205
scripts/jquery.js vendored Normal file

File diff suppressed because it is too large Load Diff

386
scripts/magic-main.js Normal file
View File

@@ -0,0 +1,386 @@
var Hint3Name = '';
step=0;
//книги
function book() {
var srcId, srcElement, targetElement;
srcElement = window.event.srcElement;
if (srcElement.className.toUpperCase() == "LEVEL1") {
srcID = srcElement.id.substr(0, srcElement.id.length-1);
targetElement = document.all(srcID + "s");
srcElement = document.all(srcID + "i");
if (targetElement.style.display == "none"){
targetElement.style.display = "";
if(srcID=="OUTchaR"){
}else{
targetElement.style.left = 100;
targetElement.style.top = document.body.scrollTop+50;
}
}else{
targetElement.style.display = "none";
}
}
}
document.onclick = book;
//свитки
function showmagic()
{
if(document.all("magicform").style.display=="none"){
document.all("magicform").style.display="";
}else{
document.all("magicform").style.display="none";
}
}
function errmess(s)
{
messid.innerHTML='<B>'+s+'</B>';
highlight();
}
function highlight()
{
if (step) return(0);
step=10;
setTimeout(dohi,50);
}
function dohi()
{
var hx=new Array(0,1,2,3,4,5,6,7,8,9,"A","B","C","D","E","F");
step--;
messid.style.color="#"+hx[Math.floor(15-step/2)]+((step&1)?"F":"8")+"0000";
if (step>0) setTimeout(dohi,50);
}
function fixspaces(s)
{
while (s.substr(s.length-1,s.length)==" ") s=s.substr(0,s.length-1);
while (s.substr(0,1)==" ") s=s.substr(1,s.length);
return(s);
}
// Заголовок, название скрипта, имя поля с логином
function form(title, script, name, opis, mtype) {
var s;
s='<table border=0 width=100% cellspacing="0" cellpadding="2"><tr><form action="'+script+'" method=POST name=slform><td colspan=2>'+
' '+opis+'</TD></TR><TR><TD width=50% align=right style="padding-left:5"><INPUT style="width: 100%" TYPE="text" NAME="'+name+'" value="'+defaultlogin+'"></TD><TD width=50%><INPUT type=image SRC="#IMGSRC#" WIDTH="27" HEIGHT="20" BORDER=0 ALT="" onclick="slform.'+name+'.value=fixspaces(slform.'+name+'.value);"></TD></TR></FORM></TABLE>';
s = crtmagic(mtype, title, s);
document.all("hint4").innerHTML = s;
document.all("hint4").style.visibility = "visible";
document.all("hint4").style.left = 100;
document.all("hint4").style.top = document.body.scrollTop+90;
document.all(name).focus();
Hint3Name = name;
}
//свиток с целью вне боя
function findlogin(title, script, name, defaultlogin, mtype) {
var s;
s='<table border=0 width=100% cellspacing="0" cellpadding="2"><tr><form action="'+script+'" method=POST name=slform><td colspan=2>'+
'Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)</TD></TR><TR><TD width=50% align=right style="padding-left:5"><INPUT style="width: 100%" TYPE="text" NAME="'+name+'" value="'+defaultlogin+'"></TD><TD width=50%><INPUT type=image SRC="#IMGSRC#" WIDTH="27" HEIGHT="20" BORDER=0 ALT="" onclick="slform.'+name+'.value=fixspaces(slform.'+name+'.value);"></TD></TR></FORM></TABLE>';
s = crtmagic(mtype, title, s);
document.all("hint4").innerHTML = s;
document.all("hint4").style.visibility = "visible";
document.all("hint4").style.left = 100;
document.all("hint4").style.top = document.body.scrollTop+90;
document.all(name).focus();
Hint3Name = name;
}
// Заголовок, название скрипта, имя поля с логином, логин по умолчанию, тип оформления, тип с целью или без
function bMag(title, script, name, defaultlogin, mtype, btype, text){
var s;
if(btype==1){
s='<table border=0 width=100% cellspacing="0" cellpadding="2"><tr>'+
'<form action="'+script+'" method=POST name=slform>'+
'<td colspan=2>'+
text+
'<br>Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)</TD>'+
'</TR><TR><TD width=50% align=right style="padding-left:5"><INPUT style="width: 100%" TYPE="text" NAME="'+name+'" value="'+defaultlogin+'"></TD>'+
'<TD width=50%><INPUT type=image SRC="#IMGSRC#" WIDTH="27" HEIGHT="20" BORDER=0 ALT="" onclick="slform.'+name+'.value=fixspaces(slform.'+name+'.value);"></TD></TR></FORM></TABLE>';
}else if(btype==2){
s='<table border=0 width=100% cellspacing="0" cellpadding="2"><tr>'+
'<form action="'+script+'" method=POST name=slform>'+
'<td colspan=2>'+
text+
'<br>Укаждите вашу цену:</TD>'+
'</TR><TR><TD width=50% align=right style="padding-left:5"><INPUT style="width: 100%" TYPE="text" NAME="'+name+'" value="'+defaultlogin+'"></TD>'+
'<TD width=50%><INPUT type=image SRC="#IMGSRC#" WIDTH="27" HEIGHT="20" BORDER=0 ALT="" onclick="slform.'+name+'.value=fixspaces(slform.'+name+'.value);"></TD></TR></FORM></TABLE>';
}
else{
s='<table border=0 width=100% cellspacing="0" cellpadding="2"><tr><form action="'+script+'" method=POST name=slform><td colspan=2>'+
text+'</TD></TR><TR><TD width=50% align=left><INPUT class=new TYPE="submit" name="tmpname423" value="Да" style="width:70%"></TD>'+
'<TD width=50% align=right><INPUT class=new type=button style="width:70%" value="Нет" onclick="closehint3();"></TD></TR></FORM></TABLE>';
}
s = crtmagic(mtype, title, s);
document.all("hint4").innerHTML = s;
document.all("hint4").style.visibility = "visible";
document.all("hint4").style.left = 140;
document.all("hint4").style.top = document.body.scrollTop+100;
document.all(name).focus();
Hint3Name = name;
}
//цель плюс причина
function loginP(title, script, name, defaultlogin, mtype) {
var s;
s='<table border=0 width=100% cellspacing="0" cellpadding="2"><tr><form action="'+script+'" method=POST name=slform><td colspan=2>'+
'Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)</TD></TR><TR><TD width=80% align=right style="padding-left:5"><INPUT style="width: 100%" TYPE="text" NAME="'+name+'" value="'+defaultlogin+'"></TD><TD width=20%></TD></TR><TR><TD colspan=2>'+
'Укажите причину:</TD></TR><TR><TD width=80% align=right style="padding-left:5"><INPUT style="width: 100%" TYPE="text" NAME="reason" value=""></TD><TD width=20%><INPUT type=image SRC="#IMGSRC#" WIDTH="27" HEIGHT="20" BORDER=0 ALT="" onclick="slform.'+name+'.value=fixspaces(slform.'+name+'.value);"></TD></TR></FORM></TABLE>';
s = crtmagic(mtype, title, s);
document.all("hint4").innerHTML = s;
document.all("hint4").style.visibility = "visible";
document.all("hint4").style.left = 100;
document.all("hint4").style.top = document.body.scrollTop+50;
document.all(name).focus();
Hint3Name = name;
}
//пдтвержение использования
function dialogconfirm(title, script, text, mtype) {
var s;
s='<table border=0 width=100% cellspacing="0" cellpadding="2"><tr><form action="'+script+'" method=POST name=slform><td colspan=2>'+
text+'</TD></TR><TR><TD width=50% align=left><INPUT class=new TYPE="submit" name="tmpname423" value="Да" style="width:70%"></TD><TD width=50% align=right><INPUT class=new type=button style="width:70%" value="Нет" onclick="closehint3();"></TD></TR></FORM></TABLE>';
s = crtmagic(mtype, title, s);
document.all("hint4").innerHTML = s;
document.all("hint4").style.visibility = "visible";
document.all("hint4").style.left = 100;
document.all("hint4").style.top = document.body.scrollTop+50;
document.all("tmpname423").focus();
Hint3Name = name;
}
//типа красивый алерт
function dialogOK(title, text, mtype) {
var s;
s='<table border=0 width=100% cellspacing="0" cellpadding="2"><tr><td colspan=2>'+
text+'</TD></TR><TR><TD width=100% align=right><INPUT type=button style="width:70%" value="Закрыть" onclick="closehint3();"></TD></TR></FORM></TABLE>';
s = crtmagic(mtype, title, s);
document.all("hint4").innerHTML = s;
document.all("hint4").style.visibility = "visible";
document.all("hint4").style.left = 100;
document.all("hint4").style.top = document.body.scrollTop+50;
Hint3Name = name;
}
function foundmagictype (mtypes) {
if (mtypes) {
mtypes=mtypes+"";
if (mtypes.indexOf(',') == -1) return parseInt(mtypes);
var s=mtypes.split(',');
var found=0;
var doubl=0;
var maxfound=0;
for (i=0; i < s.length; i++) {
var k=parseInt(s[i]);
if (k > maxfound) {
found=i + 1;
maxfound=k;
doubl=0;
} else {
if (k == maxfound) {doubl=1;}
}
}
if (doubl) {return 0};
return found;
}
return 0;
}
// Для магии. Заголовок, название скрипта, название магии, номер вещицы в рюкзаке, логин по умолчанию, описание доп. поля
//2 поля типа экстра форм
function magicklogin(title, script, magickname, n, defaultlogin, extparam, mtype) {
var s = '<table border=0 width=100% cellspacing="0" cellpadding="2"><tr><form action="'+script+'" method=POST name=slform><input type=hidden name="use" value="'+magickname+'"><input type=hidden name="n" value="'+n+'"><td colspan=2>'+
'Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)</TD></TR><TR><TD style="padding-left:5" width=50% align=right><INPUT TYPE="text" NAME="param" value="'+defaultlogin+'" style="width: 100%"></TD><TD width=50%><INPUT type=image SRC="#IMGSRC#" WIDTH="27" HEIGHT="20" BORDER=0 ALT="" onclick="slform.param.value=fixspaces(slform.param.value);"></TD></TR>';
if (extparam != null && extparam != '') {
s = s + '<TR><td style="padding-left:5">'+extparam+'<BR><INPUT style="width: 100%" TYPE="text" NAME="param2"></TD><TD></TR>';
}
s = s + '</FORM></TABLE>';
s = crtmagic(mtype, title, s);
document.all("hint4").innerHTML = s;
document.all("hint4").style.visibility = "visible";
document.all("hint4").style.left = 100;
document.all("hint4").style.top = document.body.scrollTop+50;
document.all("param").focus();
Hint3Name = 'param';
}
// Магия
//хз
function UseMagick(title, script, name, extparam, n, extparam2, mtype) {
if ((extparam != null)&&(extparam != '')) {
var t1='text',t2='text';
if (extparam.substr(0,1) == "!")
{
t1='password';
extparam=extparam.substr(1,extparam.length);
}
var s = '<table border=0 width=100% cellspacing="1" cellpadding="0"><TR><form action="'+script+'" method=POST name=slform><input type=hidden name="use" value="'+name+'"><input type=hidden name="n" value="'+n+'"><td colspan=2 align=left><NOBR><SMALL>'+
extparam + ':</NOBR></TD></TR><TR><TD width=100% align=left style="padding-left:5"><INPUT tabindex=1 style="width: 100%" TYPE="'+t1+'" id="param" NAME="param" value=""></TD><TD width=10%><INPUT type=image SRC="#IMGSRC#" WIDTH="27" HEIGHT="20" BORDER=0 ALT="" tabindex=3></TD></TR>';
if (extparam2 != null && extparam2 != '') {
if (extparam2.substr(0,1) == "!")
{
t2='password';
extparam2=extparam2.substr(1,extparam2.length);
}
s = s + '<TR><td colspan=2><NOBR><SMALL>'+extparam2+':</NOBR><TR style="padding-left:5"><TD><INPUT tabindex=2 TYPE="'+t2+'" NAME="param2" style="width: 50%"></TD><TD></TR>';
}
s += '</FORM></TABLE>';
s = crtmagic(mtype, title, s);
document.all("hint4").innerHTML = s;
document.all("hint4").style.visibility = "visible";
document.all("hint4").style.left = 100;
document.all("hint4").style.top = document.body.scrollTop+50;
document.all("param").focus();
Hint3Name = 'param';
} else {
dialogconfirm('Подтверждение', script, '<TABLE width=100%><TD><IMG src="http://img.combats.ru/i/items/'+name+'.gif"></TD><TD>Использовать сейчас?</TABLE>'+
'<input type=hidden name="use" value="'+name+'"><input type=hidden name="n" value="'+n+'">', mtype);
}
}
// Закрывает окно ввода логина
function closehint3()
{
document.all("hint4").style.visibility="hidden";
Hint3Name='';
}
// Для боевой магии. Заголовок, название магии, номер вещицы в рюкзаке
//с проверкой поля удара
function BmagickLogin(title, magickname, n, defaultlogin, extparam, mtype) {
if (defend==false) {
errmess("Блок не выбран.");
return false;
}
var s = '<table border=0 width=100% cellspacing="0" cellpadding="2"><tr><form action="/battle.pl" method=POST name="bmagic" onsubmit="bmagic.mdefend.value=defend;"><input type=hidden name="use" value="'+magickname+'"><input type=hidden name="n" value="'+n+'"><input type=hidden name="mdefend" value="'+defend+'"><input type=hidden name="enemy" value="'+enemy+'"><input type=hidden name="myid" value="'+myid+'"><td colspan=2 align=left>'+
'Укажите логин персонажа:<small><BR>(можно щелкнуть по логину в чате)</TD></TR><TR><TD width=50% align=right><INPUT style="width: 100%" TYPE="text" id="param" NAME="param" value="'+defaultlogin+'"></TD><TD width=50%><INPUT type=image SRC="#IMGSRC#" WIDTH="27" HEIGHT="20" BORDER=0 ALT="" onclick="bmagic.param.value=fixspaces(bmagic.param.value);"></TD></TR>';
if (extparam != null && extparam != '') {
s = s + '<TR><td colspan=2>'+extparam+'<TR><TD style="padding-left:5"><INPUT style="width: 100%" TYPE="text" NAME="param2"><TD></TD></TR>';
}
s = s + '</FORM></TABLE>';
s = crtmagic(mtype, title, s);
document.all("hint4").innerHTML= s;
document.all("hint4").style.visibility = "visible";
document.all("hint4").style.left = 100;
document.all("hint4").style.top = 60;
document.all("param").focus();
Hint3Name = 'param';
}
// Магия
function BUseMagick(name, extparam, n, mtype) {
if (defend==false) {
errmess("Блок не выбран.");
return false;
}
if ((extparam != null)&&(extparam != '')) {
var s = prompt(extparam+':', '');
if ((s != null)&&(s != '')) {
re = /\%/g; s=s.replace(re, "%25");
re = /\+/g; s=s.replace(re, "%2B");
re = /\#/g; s=s.replace(re, "%23");
re = /\?/g; s=s.replace(re, "%3F");
re = /\&/g; s=s.replace(re, "%26");
window.location.href='/battle.pl?use='+name+'&param='+s+'&n='+n+'&mdefend='+defend+'&enemy='+enemy+'&myid='+myid;
}
} else {
dialogconfirm('Подтверждение', '/battle.pl', '<TABLE width=100%><TD><IMG src="http://img.combats.ru/i/items/'+name+'.gif"></TD><TD>Использовать сейчас?</TABLE>'+
'<input type=hidden name="use" value="'+name+'"><input type=hidden name="n" value="'+n+'"><input type=hidden name="mdefend" value="'+defend+'"><input type=hidden name="enemy" value="'+enemy+'"><input type=hidden name="myid" value="'+myid+'">', mtype);
}
}
function crtmagic(mtype, title, body, subm) {
//name, XYX, X1-X2-Y2, pad.LRU
mtype=foundmagictype(mtype);
var names=new Array(
'neitral',17, 6, 14, 17, 14, 7,0,0, 3,
'fire', 57, 30, 33, 20, 21, 14, 11, 12, 0,
'water', 57, 30, 33, 20, 21, 14, 11, 12, 0,
'air', 57, 30, 33, 20, 21, 14, 11, 12, 0,
'earth', 57,30, 33, 20, 21, 14, 11, 12, 0,
'white', 51, 25, 46, 44, 44, 10, 5, 5, 0,
'gray', 51, 25, 46, 44, 44, 10, 5, 5, 0,
'black', 51, 25, 46, 44, 44, 10, 5, 5, 0);
var colors=new Array('B1A993','DDD5BF', 'ACA396','D3CEC8', '96B0C6', 'BDCDDB', 'AEC0C9', 'CFE1EA', 'AAA291', 'D5CDBC', 'BCBBB6', 'EFEEE9', '969592', 'DADADA', '72726B', 'A6A6A0');
while (body.indexOf('#IMGSRC#')>=0) body = body.replace('#IMGSRC#', 'img/dmagic/'+names[mtype*10]+'_30.gif');
var s='<table width="270" border="0" align="center" cellpadding="0" cellspacing="0">'+
'<tr>'+
'<td width="100%">'+
'<table width="100%" border="0" cellspacing="0" cellpadding="0">'+
'<tr><td>'+
'<table width="100%" border="0" cellpadding="0" cellspacing="0">'+
'<tr>'+
'<td width="'+names[mtype*10+1]+'" align="left"><img src="img/dmagic/b'+names[mtype*10]+'_03.gif" width="'+names[mtype*10+1]+'" height="'+names[mtype*10+2]+'"></td>'+
'<td width="100%" align="right" background="img/dmagic/b'+names[mtype*10]+'_05.gif"></td>'+
'<td width="'+names[mtype*10+3]+'" align="right"><img src="img/dmagic/b'+names[mtype*10]+'_07.gif" width="'+names[mtype*10+3]+'" height="'+names[mtype*10+2]+'"></td>'+
'</tr>'+
'</table></td>'+
'</tr>'+
'<tr><td>'+
'<table width="100%" border="0" cellspacing="0" cellpadding="0">'+
'<tr>'+
(names[mtype*10+7]?'<td width="'+names[mtype*10+7]+'"><SPAN style="width:'+names[mtype*10+7]+'">&nbsp;</SPAN></td>':'')+
'<td width="5" background="img/dmagic/b'+names[mtype*10]+'_17.gif">&nbsp;</td>'+
'<td width="100%">'+
'<table width="100%" border="0" cellspacing="0" cellpadding="0">'+
'<tr><td bgcolor="#'+colors[mtype*2]+'"'+(names[mtype*10+9]?' style="padding-top: '+names[mtype*10+9]+'"':'')+' >'+
'<table border=0 width=100% cellspacing="0" cellpadding="0"><td style="padding-left: 20" align=center><B>'+title+
'</td><td width=20 align=right valign=top style="cursor: hand" onclick="closehint3();" style=\'filter:Gray()\' onmouseover="this.filters.Gray.Enabled=false" onmouseout="this.filters.Gray.Enabled=true"><IMG src="img/dmagic/clear.gif" width=13 height=13>&nbsp;</td></table>'+
'</td></tr>'+
'<tr>'+
'<td align="center" bgcolor="#'+colors[mtype*2+1]+'">'+body+
'</tr>'+
'</table></td>'+
'<td width="5" background="img/dmagic/b'+names[mtype*10]+'_19.gif">&nbsp;</td>'+
(names[mtype*10+8]?'<td width="'+names[mtype*10+8]+'"><SPAN style="width:'+names[mtype*10+8]+'">&nbsp;</SPAN></td></td>':'')+
'</tr>'+
'</table></td>'+
'</tr>'+
'<tr><td>'+
'<table width="100%" border="0" cellpadding="0" cellspacing="0">'+
'<tr>'+
'<td width="'+names[mtype*10+4]+'" align="left"><img src="img/dmagic/b'+names[mtype*10]+'_27.gif" width="'+names[mtype*10+4]+'" height="'+names[mtype*10+6]+'"></td>'+
'<td width="100%" align="right" background="img/dmagic/b'+names[mtype*10]+'_29.gif"></td>'+
'<td width="'+names[mtype*10+5]+'" align="right"><img src="img/dmagic/b'+names[mtype*10]+'_31.gif" width="'+names[mtype*10+5]+'" height="'+names[mtype*10+6]+'"></td>'+
'</tr>'+
'</table></td>'+
'</tr>'+
'</table></td>'+
'</tr>'+
'</table>';
return s;
}

4
scripts/mail.js Normal file
View File

@@ -0,0 +1,4 @@
/*
$(function (){
}); */

317
scripts/main.js Normal file
View File

@@ -0,0 +1,317 @@
function getCenter (width, height)
{
var center = {};
var h = $('[name=main]', top.document).height();
var w = $('[name=main]', top.document).width();
center.x = (width <= w) ?(w - width)/2 :0;
center.y = (height <= h) ?(h - height)/2 :0;
return center;
}
function getCloseButton (vert, horiz, func)
{
return "<div style='position: absolute; "+vert+": 0px; "+horiz+": -15px; cursor: pointer; z-index: 200;'><img src='i/clear.gif' width='13' height='13' onclick="+func+"></div>"
}
function hideShow (selector, func, v)
{
$(selector).fadeOut('10000', function (){func(v); $(this).fadeIn('10000', function (){checkWindow();});});
}
function drop (id, img, txt)
{
var table = '<table width="100%"><td><img src="img/items/'+img+'"></td><td>Предмет <nobr><b>\''+txt+'\'</b></nobr> будет утерян, вы уверены ?</table>'+
'<input type="checkbox" name="dropall"><small> Все предметы этого вида</small>';
dialogconfirm('Выбросить предмет?', 'deleteItem(\''+id+'\');', table);
}
function drophlam ()
{
var table = '<table width=100%><tr><td width="10%"><img src="http://img.combats.com/i/items/just_junk.gif">'+
'</td><td>Выбросить разный хлам типа выписок, квитанций и увядших букетов?</td></tr>'+
'<tr><td colspan="2"><small><b style="color: red">Внимание!</b> Имеющие срок годности предметы, купленные за зубы (эликсиры, корм для животных и т.д.), будут уничтожены.</small></td></tr></table>'+
'<input type=hidden name=drophlam value="1"><input type=hidden name=sd4 value="' + sd4+'">';
dialogconfirm('Выбросить хлам?', 'main.pl', table);
}
function unstack (name, n, txt)
{
var table = '<TABLE width=100%><TD><IMG src="http://img.combats.com/i/items/'+name+
'.gif"></TD><TD>Разделить предмет <NOBR><B>\''+txt+'\'</B></NOBR></TABLE>'+
'<INPUT type=hidden name=unstack value="'+name+'"><INPUT type=hidden name=n value="'+n+'"><INPUT type=hidden name=sd4 value="' + sd4+'">'+
'Кол-во: <INPUT type=text name=quant value="1">';
// window.clipboardData.setData('Text', table);
dialogconfirm('Разделить предмет?', (specialscript?specialscript:'main.pl'),table);
}
function showError (error, parameters)
{
if (!parameters)
parameters = '';
$.post('ajax.php', {'do': 'geterror', 'error': error, 'parameters': parameters}, function (data){
var id = top.exploder(data);
visual.show_any('#error', id[0]);
});
}
function clearError ()
{
$('#error').fadeOut('10000', function (){$(this).html('');});
}
function showHelp (link)
{
$.post('encicl/help/'+link+'.html', function (data){
var id = top.exploder(data);
visual.show_help(id[0]);
});
}
function hideHelp ()
{
visual.hide_help();
}
function showInventory (section, type, mail_guid)
{
clearError();
var cur_section = getCookie('section');
if (cur_section == section && $("#inventory").html() != '')
return;
$('#section_'+cur_section+', #section_1').attr('bgcolor', '#d4d2d2');
$('#section_'+section).attr('bgcolor', '#a5a5a5');
setCookie('section', section, getTimePlusHour());
$.post('ajax.php', {'do': 'showinventory', 'section': section, 'type': type, 'mail_guid': mail_guid}, function (data){
var inventory = top.exploder(data);
visual.show_any('#inventory', inventory[0]);
});
}
function showShapes (available)
{
if (available)
{
$('#shape_a').css('backgroundColor', '#A9AFC0');
$('#shape_na').css('backgroundColor', '');
}
else
{
$('#shape_a').css('backgroundColor', '');
$('#shape_na').css('backgroundColor', '#A9AFC0');
}
$.post('ajax.php', {'do': 'showshapes', 'available': available}, function (data){
var shapes = top.exploder(data);
visual.show_any('#shapes', shapes[0]);
});
}
function chooseShape (shape)
{
$.post('ajax.php', {'do': 'chooseshape', 'shape': shape}, function (data){
var shapes = top.exploder(data);
if (shapes[0] == 'complete')
location.href = 'main.php?action=inv';
else if (shapes[0] == 'error')
showError(shapes[1]);
});
}
//-- Смена хитпоинтов
var delay = 3; // Каждые n сек. увеличение HP и MP на 1%
var redHP = 0.33; // меньше 30% красный цвет
var yellowHP = 0.66; // меньше 60% желтый цвет, иначе зеленый
var TimerOnHP = -1; // id таймера HP
var TimerOnMP = -1; // id таймера MP
var nowHP, maxHP, nowMP, maxMP, hspeed, mspeed;
function showHP (now, max, newspeed, mini)
{
nowHP = now;
maxHP = max;
hspeed = newspeed;
if (TimerOnHP >= 0)
{
clearTimeout(TimerOnHP);
TimerOnHP = -1;
}
if (mini)
setHPmini();
else
setHPlocal();
}
function setHPlocal ()
{
var plusHP = 0;
if (nowHP == maxHP)
TimerOnHP = -1;
else
{
plusHP = maxHP * hspeed * 0.00001;
nowHP += ((plusHP+nowHP) <= maxHP) ?plusHP :maxHP-nowHP;
TimerOnHP = 0;
}
var le = 120;
var h1 = Math.round((le / maxHP) * nowHP);
var h2 = le - h1;
if (nowHP / maxHP < redHP)
imag = 'img/icon/bk_life_red.gif';
else if (nowHP / maxHP < yellowHP)
imag = 'img/icon/bk_life_yellow.gif';
else
imag = 'img/icon/bk_life_green.gif';
var rhp = Math.round(nowHP) + "/" + maxHP;
var alt = 'Уровень жизни'+((plusHP > 0 && (difHP = maxHP-nowHP) > 0) ?'<br>Осталось: '+top.getFormatedTime(Math.round(difHP*delay/(plusHP*10))) :'');
$('#HP').html("<table border='0' cellpadding='0' cellspacing='0' width='120' align='center' style='padding-top: 1px;'><tr>"+
"<td style='position: absolute; width: 120px; font-size: 9px; color: white; font-weight: bold; margin-top: -2px; padding-left: 5px;' align='left' alt='"+alt+"'>"+rhp+"</td>"+
"<td style='width: "+h1+"px; height: 10px; background: url("+imag+") repeat-x;'></td>"+
"<td style='width: "+h2+"px; height: 10px; background: url(img/icon/bk_life_loose.gif) repeat-x;'></td>"+
"</tr></table>");
updateMmoves('HP', alt);
if (TimerOnHP != -1)
TimerOnHP = setTimeout(setHPlocal, delay * 100);
}
function showMP (now, max, newspeed)
{
if (max == 0)
return;
nowMP = now;
maxMP = max;
if (TimerOnMP >= 0)
{
clearTimeout(TimerOnMP);
TimerOnMP = -1;
}
mspeed = newspeed;
setMPlocal();
}
function setMPlocal ()
{
var plusMP = 0;
if (maxMP == 0)
return;
if (nowMP == maxMP)
TimerOnMP = -1
else
{
plusMP = maxMP * mspeed * 0.00001;
nowMP += ((plusMP+nowMP) <= maxMP) ?plusMP :maxMP-nowMP;
TimerOnMP = 0;
}
var le = 120;
var m1 = Math.round((le / maxMP) * nowMP);
var m2 = le - m1;
var rmp = Math.round(nowMP) + "/" + maxMP;
var alt = 'Уровень маны'+((plusMP > 0 && (difMP = maxMP-nowMP) > 0) ?'<br>Осталось: '+top.getFormatedTime(Math.round(difMP*delay/(plusMP*10))) :'')
$('#MP').html("<table border='0' cellpadding='0' cellspacing='0' width='"+le+"' align='center' style='margin-top: -1px;'><tr>"+
"<td style='position: absolute; width: "+le+"px; font-size: 9px; color: white; font-weight: bold; margin-top: -2px; padding-left: 5px; color: #80FFFF;' align='left' alt='"+alt+"'>"+rmp+"</td>"+
"<td style='width: "+m1+"px; height: 10px; background: url(img/icon/blue.gif) repeat-x;'></td>"+
"<td style='width: "+m2+"px; height: 10px; background: url(img/icon/bk_life_loose.gif) repeat-x;'></td>"+
"</tr></table>");
updateMmoves('MP', alt);
if (TimerOnMP != -1)
TimerOnMP = setTimeout(setMPlocal, delay * 100);
}
function setHPmini ()
{
var plusHP = 0;
if (nowHP == maxHP)
TimerOnHP = -1;
else
{
plusHP = maxHP * hspeed * 0.00001;
nowHP += ((plusHP+nowHP) <= maxHP) ?plusHP :maxHP-nowHP;
TimerOnHP = 0;
}
var le = 120;
var h1 = Math.round((le / maxHP) * nowHP);
var h2 = le - h1;
if (nowHP / maxHP < redHP)
imag = 'img/icon/bk_life_red.gif';
else if (nowHP / maxHP < yellowHP)
imag = 'img/icon/bk_life_yellow.gif';
else
imag = 'img/icon/bk_life_green.gif';
var rhp = Math.round(nowHP) + "/" + maxHP;
var alt = 'Уровень жизни'+((plusHP > 0 && (difHP = maxHP-nowHP) > 0) ?'<br>Осталось: '+top.getFormatedTime(Math.round(difHP*delay/(plusHP*10))) :'');
$('#HP').html(" <span style='font-size: 10px; cursor: default;' alt='"+alt+"'>"+rhp+"</span> <table border='0' cellpadding='0' cellspacing='0' width='120' style='display: inline; vertical-align: middle;'><tr>"+
"<td style='width: "+h1+"px; height: 10px; background: url("+imag+") repeat-x;'></td>"+
"<td style='width: "+h2+"px; height: 10px; background: url(img/icon/bk_life_loose.gif) repeat-x;'></td>"+
"</tr></table>");
updateMmoves('HP', alt);
if (TimerOnHP != -1)
TimerOnHP = setTimeout(setHPmini, delay * 100);
}
//-- Сломанные вещи
var broken = new Array ();
var i = 1;
function BrokenItems ()
{
$('.broken').each(function (){
bgcolor = $(this).parents('tr[bgColor]').attr('bgColor');
$(this).animate({backgroundColor: ((broken[i]) ?"#f88383" :bgcolor)}, 2000);
broken[i] = !broken[i];
i++;
});
i = 1;
}
function rdf (ifloat)
{
return Math.round(ifloat * 100) / 100;
}
function checkWindow ()
{
if ($('body').height() > $('[name=main]', top.document).height())
$('body').css('margin-right', '0px');
else
$('body').css('margin-right', '17px');
}
var pos = {};
$(function (){
$('.broken').each(function (){
broken[i] = true;
i++;
});
i = 1;
if ($('.broken').html() != undefined)
setInterval(BrokenItems, 4100);
$('body').on('mouseover mouseleave', '#clear', function (e){
if (e.type == 'mouseover')
$(this).attr('src', 'i/clear.gif');
else if (e.type == 'mouseleave')
$(this).attr('src', 'i/clearg.gif');
}).on('click', '#link', function (){
top.linkAction($(this).attr('link'));
}).on('click', '#hint', function (){
showHelp($(this).attr('link'));
}).on('click', '#refresh', function (){
location.reload();
}).on('click', '#forum', function (){
window.open('/forum');
}).on('click', 'input[type=button], input[type=radio], input[type=submit], a', function (){
$(this).blur();
});
$(document).on('mousemove', function (e){
pos.x = e.pageX - $(window).scrollLeft();
pos.y = e.pageY - $(window).scrollTop();
});
$(window).resize(checkWindow);
checkWindow();
});

87
scripts/move_check.js Normal file
View File

@@ -0,0 +1,87 @@
var solo_store, progressTimer;
var progressEnd = 32; // set to number of progress <span>'s.
var progressColor = '#00CC00'; // set to progress bar color
var mtime = parseInt(top.time_to_go); // set time to next step (seconds)
if (!mtime || mtime <= 0)
mtime = 0;
var progressInterval = Math.round(mtime * 1000 / progressEnd);
var is_accessible = true;
var progressAt = progressEnd;
function solo (n)
{
if (check_access())
window.location.href = 'main.php?action=go&room_go=' + n;
else if (n)
{
solo_store = n;
$.post('ajax.php', {'do': 'getroomname', 'room': n}, function (data){
var room = top.exploder(data);
visual.show_any('#add_text', room[0]);
});
ch_counter_color('red');
}
return false;
}
function clear_solo ()
{
$("#add_text").fadeOut('10000', function (){$('#add_text').html('')});
solo_store = false;
ch_counter_color('#00CC00');
return false;
}
function progress_clear ()
{
for (var i = 1; i <= progressEnd; i++)
$('#progress'+i).css('backgroundColor', 'transparent');
$('a.passage').addClass('dis_passage');
progressAt = 0;
is_accessible = false;
}
function check_access ()
{
return is_accessible;
}
function progress_update ()
{
progressAt++;
if (progressAt > progressEnd)
{
is_accessible = true;
$('a.dis_passage').removeClass('dis_passage');
if (solo_store)
solo(solo_store); // go to stored
}
else
{
$('#progress'+progressAt).css('backgroundColor', progressColor);
progressTimer = setTimeout(progress_update, progressInterval);
}
}
function ch_counter_color (color)
{
progressColor = color;
for (var i = 1; i <= progressAt; i++)
$('#progress'+i).css('backgroundColor', progressColor);
}
$(function (){
$('body').on('click', 'a.passage', function (){
return check_access();
});
if (mtime > 0)
{
progress_clear();
progress_update();
}
else
{
for (var i = 1; i <= progressEnd; i++)
$('#progress'+i).css('backgroundColor', progressColor);
}
});

96
scripts/register.js Normal file
View File

@@ -0,0 +1,96 @@
function exploder (data)
{
var variable = data.split('$$');
return variable;
}
function checkStep1 ()
{
var login = $('input[name=reg_login]').val();
$.post('ajax_register.php', {'do': 'checkstep1', 'login': login}, function (data){
var check = exploder(data);
if (check[0] == 'complete')
location.href = '?step=2';
else if (check[0] == 'error')
$('#error').show().html(check[1]);
});
}
function checkStep2 ()
{
var password = $('input[name=password]').val();
var password_confirm = $('input[name=password_confirm]').val();
$.post('ajax_register.php', {'do': 'checkstep2', 'password': password, 'password_confirm': password_confirm}, function (data){
var check = exploder(data);
if (check[0] == 'complete')
location.href = '?step=3';
else if (check[0] == 'error')
$('#error').show().html(check[1]);
});
}
function checkStep3 ()
{
var email = $('input[name=email]').val();
var secretquestion = $('input[name=secretquestion]').val();
var secretanswer = $('input[name=secretanswer]').val();
$.post('ajax_register.php', {'do': 'checkstep3', 'email': email, 'secretquestion': secretquestion, 'secretanswer': secretanswer}, function (data){
var check = exploder(data);
if (check[0] == 'complete')
location.href = '?step=4';
else if (check[0] == 'error')
$('#error').show().html(check[1]);
});
}
function checkStep4 ()
{
var name = $('input[name=name]').val();
var birth_day = $('select[name=birth_day]').val();
var birth_month = $('select[name=birth_month]').val();
var birth_year = $('select[name=birth_year]').val();
var sex = $('input[name=sex]').filter(":checked").val();
var city_n = $('select[name=city_n]').val();
var city = $('input[name=city]').val();
var icq = $('input[name=icq]').val();
var hide_icq = $('input[name=hide_icq]').is(':checked');
var deviz = $('input[name=deviz]').val();
var color = $('select[name=color]').val();
$.post('ajax_register.php', {'do': 'checkstep4', 'name': name, 'birth_day': birth_day, 'birth_month': birth_month, 'birth_year': birth_year, 'sex': sex, 'city_n': city_n, 'city': city, 'icq': icq, 'hide_icq': hide_icq, 'deviz': deviz, 'color': color}, function (data){
var check = exploder(data);
if (check[0] == 'complete')
location.href = '?step=5';
else if (check[0] == 'error')
$('#error').show().html(check[1]);
});
}
function checkStep5 ()
{
var rules1 = $('input[name=rules1]').is(':checked');
var rules2 = $('input[name=rules2]').is(':checked');
var code = $('input[name=code]').val();
$.post('ajax_register.php', {'do': 'checkstep5', 'rules1': rules1, 'rules2': rules2, 'code': code}, function (data){
var check = exploder(data);
if (check[0] == 'complete')
location.href = 'game.php';
else if (check[0] == 'error')
$('#error').show().html(check[1]);
});
}
$(function (){
$('input[name=reg_login]').keyup(function (){
$(this).val($(this).val().replace(/[^a-zA-Zа-яА-Я\- ]/g, ''));
});
$('input[name=icq]').keyup(function (){
$(this).val($(this).val().replace(/[^0-9]/g, ''));
});
$('input[name=code]').keyup(function (){
$(this).val($(this).val().replace(/[^0-9]/g, ''));
});
$('input').keypress(function (e) {
if (e.which == 13)
$('#next').click();
});
});

41
scripts/reminder.js Normal file
View File

@@ -0,0 +1,41 @@
function exploder (data)
{
var variable = data.split('$$');
return variable;
}
function checkRem1 ()
{
var login = $('input[name=login]').val();
$.post('ajax_register.php', {'do': 'checkrem1', 'login': login}, function (data){
var check = exploder(data);
if (check[0] == 'complete')
location.href = '?step=2';
else if (check[0] == 'error')
$('#error').html(check[1]);
});
}
function checkRem2 ()
{
var answer = $('input[name=answer]').val();
var birthday = $('input[name=birthday]').val();
var code = $('input[name=code]').val();
$.post('ajax_register.php', {'do': 'checkrem2', 'answer': answer, 'birthday': birthday, 'code': code}, function (data){
var check = exploder(data);
if (check[0] == 'complete')
location.href = '?step=3';
else if (check[0] == 'error')
$('#error').html(check[1]);
});
}
$(function (){
$('input[name=login]').keyup(function (){
$(this).val($(this).val().replace(/[^a-zA-Zа-яА-Я\- ]/g, ''));
});
$('input').keypress(function (e) {
if (e.which == 13)
$('#next').click();
});
});

187
scripts/scripts.js Normal file
View File

@@ -0,0 +1,187 @@
function getFormatedTime (time)
{
if (!time)
return 0;
var m = parseInt(time / 60);
time %= 60;
var s = time;
if (m == 0) return s+' cек.';
else return m+' мин. '+s+' cек.';
}
function strip_sc (str)
{
str = str.replace(/^\s+/, '');
str = str.replace(/\s*,\s*/g, ',');
str = str.substr(0, str.length - 1);
return str;
}
function trim (str)
{
str = str.replace(/^\s*/, '');
str = str.replace(/\s*$/, '');
return str;
}
function AddTo (login, bPrivate)
{
var c = frames.main.Hint3Name;
if (c != null && c != "")
{
$('#'+c+', [name='+c+']', main.document).val(login).focus();
return;
}
var txt = $('#text', talk.document).val();
var txtreg = txt;
var to = '';
var private = '';
var reg1 = new RegExp("(private|to)\\s*\\[(.+?)\\]", "");
while (res = txtreg.match(reg1))
{
action = res[1];
pr = res[2];
txtreg = txtreg.replace (reg1, '');
if (action == 'private')
{
pr_ar = pr.split(/,/);
for (i = 0; i < pr_ar.length; i++)
{
pr_ar[i] = trim(pr_ar[i]);
var slogin = pr_ar[i].replace (/([\^.*{}$%?\[\]+|\/\(\)])/g, "\\$1");
prReg = new RegExp (slogin+",", "");
if (!private.match(prReg))
private += pr_ar[i]+',';
}
}
if (action == 'to')
{
pr_ar = pr.split(/,/)
for (i = 0; i < pr_ar.length; i++)
{
pr_ar[i] = trim(pr_ar[i]);
var slogin = pr_ar[i].replace(/([\^.*{}$%?\[\]+|\/\(\)])/g, "\\$1");
prReg = new RegExp(slogin+",", "");
if (!to.match(prReg))
to += pr_ar[i]+',';
}
}
}
to = strip_sc (to);
private = strip_sc (private);
var to_str = ','+to+',';
var private_str = ','+private+',';
if (private)
private = 'private ['+private+'] ';
if (to)
to = 'to ['+to+'] ';
txtreg = txtreg.replace (/^\s+/, '');
txt = private + to + txtreg;
var ntxt = 'to ['+login+']';
var i = txt.indexOf (ntxt);
if (i != -1)
txt = txt.substr (0, i) + 'private ['+login+'] '+ txt.substr (i+ntxt.length, txt.length);
else
{
var ntxt2 = 'private ['+login+']';
i = txt.indexOf (ntxt2);
if (i != -1)
txt = txt.substr (0, i) + 'to ['+login+'] '+ txt.substr (i+ntxt2.length, txt.length);
else
{
var slogin = login.replace (/([\^.*{}$%?\[\]+|\/\(\)])/g, "\\$1");
reg = new RegExp (","+slogin+",", "");
flag = 0;
if (!private_str.match(reg) && txt.match(/private\s*\[.*\]/))
{
txt = txt.replace (/private\s*\[(.+)\]/, "private ["+login+",$1]");
flag = 1;
}
if (!to_str.match(reg) && txt.match(/to\s*\[.*\]/))
{
txt = txt.replace (/to\s*\[(.+)\]/, "to ["+login+",$1]");
flag = 1;
}
if (flag == 0 && !txt.match (/(to|private)\s*\[.*\]/))
txt = (( bPrivate ) ?'private ['+login+'] ' :'to ['+login+'] ') + txt;
}
}
$('#text', talk.document).val(txt).focus();
}
function AddToPrivate (login)
{
var s = $('#text', talk.document).val();
var reg2 = new RegExp ("private(\\s*)\\[(.*?)\\]", "");
var cs = s.replace (reg2, "private$1[,$2,]");
var slogin = login.replace (/([\^.*{}$%?\[\]+|\/\(\)])/g, "\\$1");
var reg = new RegExp ("private\\s*\\[.*,\\s*"+slogin+"\\s*,.*\\]", "");
var result = '';
var reg3 = new RegExp ("private\\s*\\[(.*?)\\]", "");
while (res = s.match(reg3))
{
result += res[1]+',';
s = s.replace (reg3, '');
}
result = result.replace (/,$/, '');
var prar = result.split (',');
for (i = 0; i < prar.length; i++)
{
prar[i] = prar[i].replace (/^\s+/, '');
prar[i] = prar[i].replace (/\s+$/, '');
}
var str = prar.join (', ');
if (str)
login += ', ';
space = ''
if (!s.match(/^\s+/))
space = ' ';
if (!cs.match(reg))
s = 'private ['+login+str+']' + space + s;
else
s = 'private ['+str+']' + space + s;
$('#text', talk.document).val(s).focus();
}
function linkAction (action)
{
frames.main.location.href = "main.php?action="+action;
}
function exploder (data)
{
if (data == '' || data == 'ajax_error')
location.href = 'index.php';
var variable = data.split('$$');
return variable;
}
function checkGame ()
{
var link = location.href.split("/");
if (link[link.length - 1] != 'game.php')
location.href = 'index.php';
try
{
var gframes = new Array($('[name=msg]').attr('src'), $('[name=user]').attr('src'), $('[name=talk]').attr('src'));
if (gframes[0] != 'msg.php' || gframes[1] != 'users.php' || gframes[2] != 'talk.php')
location.href = 'index.php';
}
catch(e){location.href = 'index.php';}
}
function cleanChat ()
{
$('#mes', msg.document).html('');
}
function exit ()
{
frames.main.dialogconfirm('Подтверждение', "top.linkAction('exit')", '<center>Вы уверены что хотите выйти из игры?</center>', 0);
}
var time_to_go = 0;
var city = '';

176
scripts/sha1.js Normal file
View File

@@ -0,0 +1,176 @@
function SHA1 (msg)
{
function rotate_left (n, s)
{
var t4 = (n<<s) | (n>>>(32-s));
return t4;
};
function lsb_hex (val)
{
var str="";
var i;
var vh;
var vl;
for (i = 0; i <= 6; i += 2)
{
vh = (val>>>(i*4+4))&0x0f;
vl = (val>>>(i*4))&0x0f;
str += vh.toString(16) + vl.toString(16);
}
return str;
};
function cvt_hex (val)
{
var str="";
var i;
var v;
for (i = 7; i >= 0; i--)
{
v = (val>>>(i*4))&0x0f;
str += v.toString(16);
}
return str;
};
function Utf8Encode (string)
{
string = string.replace(/\r\n/g, "\n");
var utftext = "";
for (var n = 0; n < string.length; n++)
{
var c = string.charCodeAt(n);
if (c < 128)
{
utftext += String.fromCharCode(c);
}
else if ((c > 127) && (c < 2048))
{
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
}
else
{
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
};
var blockstart;
var i, j;
var W = new Array(80);
var H0 = 0x67452301;
var H1 = 0xEFCDAB89;
var H2 = 0x98BADCFE;
var H3 = 0x10325476;
var H4 = 0xC3D2E1F0;
var A, B, C, D, E;
var temp;
msg = Utf8Encode(msg);
var msg_len = msg.length;
var word_array = new Array();
for (i = 0; i < msg_len - 3; i += 4)
{
j = msg.charCodeAt(i)<<24 | msg.charCodeAt(i+1)<<16 |
msg.charCodeAt(i+2)<<8 | msg.charCodeAt(i+3);
word_array.push( j );
}
switch (msg_len % 4)
{
case 0:
i = 0x080000000;
break;
case 1:
i = msg.charCodeAt(msg_len-1)<<24 | 0x0800000;
break;
case 2:
i = msg.charCodeAt(msg_len-2)<<24 | msg.charCodeAt(msg_len-1)<<16 | 0x08000;
break;
case 3:
i = msg.charCodeAt(msg_len-3)<<24 | msg.charCodeAt(msg_len-2)<<16 | msg.charCodeAt(msg_len-1)<<8 | 0x80;
break;
}
word_array.push(i);
while ((word_array.length % 16) != 14)
word_array.push( 0 );
word_array.push(msg_len>>>29);
word_array.push((msg_len<<3)&0x0ffffffff);
for (blockstart = 0; blockstart < word_array.length; blockstart += 16)
{
for (i = 0; i < 16; i++) W[i] = word_array[blockstart+i];
for (i = 16; i <= 79; i++) W[i] = rotate_left(W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16], 1);
A = H0;
B = H1;
C = H2;
D = H3;
E = H4;
for (i = 0; i <= 19; i++)
{
temp = (rotate_left(A,5) + ((B&C) | (~B&D)) + E + W[i] + 0x5A827999) & 0x0ffffffff;
E = D;
D = C;
C = rotate_left(B,30);
B = A;
A = temp;
}
for (i = 20; i <= 39; i++)
{
temp = (rotate_left(A,5) + (B ^ C ^ D) + E + W[i] + 0x6ED9EBA1) & 0x0ffffffff;
E = D;
D = C;
C = rotate_left(B,30);
B = A;
A = temp;
}
for (i = 40; i <= 59; i++)
{
temp = (rotate_left(A,5) + ((B&C) | (B&D) | (C&D)) + E + W[i] + 0x8F1BBCDC) & 0x0ffffffff;
E = D;
D = C;
C = rotate_left(B,30);
B = A;
A = temp;
}
for (i = 60; i <= 79; i++)
{
temp = (rotate_left(A,5) + (B ^ C ^ D) + E + W[i] + 0xCA62C1D6) & 0x0ffffffff;
E = D;
D = C;
C = rotate_left(B,30);
B = A;
A = temp;
}
H0 = (H0 + A) & 0x0ffffffff;
H1 = (H1 + B) & 0x0ffffffff;
H2 = (H2 + C) & 0x0ffffffff;
H3 = (H3 + D) & 0x0ffffffff;
H4 = (H4 + E) & 0x0ffffffff;
}
var temp = cvt_hex(H0) + cvt_hex(H1) + cvt_hex(H2) + cvt_hex(H3) + cvt_hex(H4);
return temp.toLowerCase();
}

73
scripts/shop.js Normal file
View File

@@ -0,0 +1,73 @@
function showShopSection (section_shop)
{
clearError();
var level_filter = $("input[name=level_filter]").val();
var name_filter = $("input[name=name_filter]").val();
$("#loadbar").show();
$.post('ajax.php', {'do': 'showshopsection', 'section_shop': section_shop, 'level_filter': level_filter, 'name_filter': name_filter}, function (data){
var section = top.exploder(data);
visual.show_section(section[0]);
});
}
function shopSection (section_shop)
{
var cur_section_shop = getCookie('section_shop');
if (section_shop)
{
$("#section_shop_"+cur_section_shop+", #section_shop_knife").css('backgroundColor', '');
$("#section_shop_"+section_shop).css('backgroundColor', '#C7C7C7');
setCookie('section_shop', section_shop, getTimePlusHour());
$.post('ajax.php', {'do': 'getshoptitle', 'section_shop': section_shop}, function (data){
var title = top.exploder(data);
visual.show_any('#shop_title', title[0]);
});
}
section_shop = getCookie('section_shop');
showShopSection(section_shop);
}
function buyItem (entry)
{
var count = ($('input[name=count]').val()) ?$('input[name=count]').val() :1;
$.post('ajax.php', {'do': 'buyitem', 'entry': entry, 'count': count}, function (data){
var item = top.exploder(data);
closehint3 ();
$('html, body').animate({scrollTop: 0}, 500);
if (item[0] == 'complete')
visual.item_buy(item);
else if (item[0] == 'error')
showError(item[1], item[2]);
});
}
function sellItem (id)
{
$.post('ajax.php', {'do': 'sellitem', 'id': id}, function (data){
var item = top.exploder(data);
if (item[0] == 'complete')
visual.item_sell(id, item);
else if (item[0] == 'error')
showError(item[1], item[2]);
});
}
function AddCount (entry, name, price, kr)
{
$("#hint3").html('<table width="100%" cellspacing="1" cellpadding="0" bgcolor="#CCC3AA"><tr><td align="center"><b>Купить неск. штук</b></td><td width="20" align="right" valign="top" style="cursor: pointer;" onclick="closehint3 ();"><strong>X</strong></td></tr><tr><td colspan="2" bgcolor="#FFF6DD"><center><b><i>'+name+'</i></b><br>'+
'Количество: <input type="text" name="count" size="6" value="1"><input type="hidden" name="price" value="'+price+'">&nbsp;<input style="cursor: pointer;" type="submit" value=" »» " onclick=\'buyItem ("'+entry+'");\'><br>Стоимость: <b><span id="full_price" style="color: #339900;">'+price+'</span></b> '+kr+
'</center></td></tr></table>').css({'left': pos.x + 50 + "px", 'top': pos.y - 25 + "px"}).fadeIn('fast');
$('[name=count]').focus();
}
$(function (){
$('body').on('keyup', 'input[name=count]', function (){
$(this).val($(this).val().replace(/[^0-9]/g, ''));
if ($(this).val() == '')
$(this).val(1);
var summ = rdf(parseFloat($('input[name=price]').val()) * parseInt($('input[name=count]').val()));
visual.show_any('#full_price', summ);
});
});

33
scripts/show.js Normal file
View File

@@ -0,0 +1,33 @@
function break_str (str, width, brk, cut)
{
if (str.length <= width || str.indexOf('<br>') > 0) return str;
brk = brk || '\n';
width = width || 75;
cut = cut || false;
var regex = '.{1,'+width+'}(\\s|$)' + (cut ?'|.{'+width+'}|.+' :'|\\S+?(\\s|$)');
return str.match(RegExp(regex, 'g')).join(brk);
}
function updateMmoves (id, text)
{
if ((pos.x + $(window).scrollLeft()) > $('#'+id).offset().left && (pos.x + $(window).scrollLeft()) < $('#'+id).offset().left + $('#'+id).width() && (pos.y + $(window).scrollTop()) > $('#'+id).offset().top && (pos.y + $(window).scrollTop()) < $('#'+id).offset().top + $('#'+id).height())
$("#mmoves").html('<small>' + break_str(text, 50, '<br>') + '</small>');
}
$(function (){
$('body').on('mousemove', 'img,a,td,span', function (e){
var x, y;
e.preventDefault();
if (!($(this).attr('alt')) || $(this).attr('alt') == '')
return;
$('body').append('<div id="mmoves"></div>');
$("#mmoves").html('<small>' + break_str($(this).attr('alt'), 50, '<br>') + '</small>');
var razX = $(window).width() - (e.pageX - $(window).scrollLeft()) - 25;
x = (razX < $("#mmoves").width()) ?$("#mmoves").width() + 15 :-15;
var razY = $(window).height() - (e.pageY - $(window).scrollTop()) - 25;
y = (razY < $("#mmoves").height()) ?$("#mmoves").height() + 15 :-15;
$("#mmoves").css({'left': e.pageX - x + 'px', 'top': e.pageY - y + 'px', 'visibility': 'visible'});
}).on('mouseleave', 'img,a,td,span', function (){
$("#mmoves").remove();
});
});

150
scripts/skills.js Normal file
View File

@@ -0,0 +1,150 @@
var clevel = '';
var arrChange = { };
var skillsArr = new Array ();
skillsArr["sword"] = 0;
skillsArr["bow"] = 0;
skillsArr["crossbow"] = 0;
skillsArr["fail"] = 0;
skillsArr["staff"] = 0;
skillsArr["knife"] = 0;
skillsArr["axe"] = 0;
skillsArr["fire"] = 0;
skillsArr["water"] = 0;
skillsArr["air"] = 0;
skillsArr["earth"] = 0;
skillsArr["light"] = 0;
skillsArr["gray"] = 0;
skillsArr["dark"] = 0;
function SetAllSkills (isOn)
{
var arrSkills = new Array("str", "dex", "con", "vit", "int", "wis", "spi");
for (var i in arrSkills)
{
var clname = (isOn) ?"skill" :"nonactive";
$('#plus_'+arrSkills[i]).attr('class', clname);
}
}
function ChangeButtonState (bid)
{
if ($('#save_button'+bid).attr('class') == 'nonactive')
$('#save_button'+bid).attr('class', 'active').removeAttr('disabled');
else
$('#save_button'+bid).attr({'class': 'nonactive', 'disabled': 'disabled'});
}
function MakeSkillStep (nDelta, id)
{
var n_UP = parseInt($('#ups').html()) | 0;
if ((n_UP - nDelta ) < 0)
return;
if (!arrChange[id])
arrChange[id] = 0;
if ((arrChange[id] + nDelta) < 0 )
{
$('#minus_'+id).attr('class', 'nonactive');
return;
}
SetAllSkills((n_UP - nDelta));
arrChange[id] += nDelta;
$('input[name=base_'+id+']').val(parseInt($('input[name=base_'+id+']').val()) + nDelta);
$('#inst_'+id).html(parseInt($('#inst_'+id).html()) + nDelta);
$('#ups').html(n_UP -= nDelta);
if (arrChange[id] == 0)
$('#minus_'+id).attr('class', 'nonactive');
else
$('#minus_'+id).attr('class', 'skill');
}
function ChangeAbility (id, nDelta, inst, maxval)
{
var nm_UP = parseInt($('#skills').html()) | 0;
if ((nm_UP - nDelta) < 0)
return;
if (!arrChange[id])
arrChange[id] = 0;
if ((arrChange[id] + nDelta ) == 0)
$('#minus_'+id).attr('class', 'nonactive');
if (nDelta > 0 && (arrChange[id] + nDelta + inst) == maxval)
{
skillsArr[id] = 1;
$('#plus_'+id).attr('class', 'nonactive');
}
if ((arrChange[id] + nDelta) < 0 )
return;
if (nDelta > 0 && (arrChange[id] + nDelta + inst) > maxval)
return;
arrChange[id] += nDelta;
if ((nm_UP - nDelta) == 0)
{
for (var i in skillsArr)
$('#plus_'+i).attr('class', 'nonactive');
}
$('[name=base_'+id+']').val(parseInt($('[name=base_'+id+']').val()) + nDelta);
$('#inst_'+id).html(parseInt($('#inst_'+id).html()) + nDelta);
$('#skills').html(nm_UP -= nDelta);
if (nDelta > 0)
prefix = "minus_";
else
{
prefix = "plus_";
skillsArr[id] = 0;
for (var i in skillsArr)
{
if (skillsArr[i] == 0)
$('#plus_'+i).attr('class', 'skill');
}
}
$('#'+prefix+id).attr('class', 'skill');
}
function setlevel (nm)
{
if (clevel != '' && clevel != nm)
{
$('#'+clevel).removeClass('tzSet tzOver');
$('#d'+clevel).css('display', 'none');
}
clevel = nm || 'L1';
setCookie('clevel', clevel, getTimePlusHour());
$('#'+clevel).addClass('tzSet');
$('#d'+clevel).css('display', 'block');
checkWindow();
}
$(function (){
if (c = getCookie ('clevel'))
clevel = c;
else
clevel = 'L5';
setlevel(clevel);
$('.tz').hover(
function ()
{
if (clevel != $(this).attr('id'))
$(this).addClass('tzOver');
},
function ()
{
if (clevel != $(this).attr('id'))
$(this).removeClass('tzOver');
}
).click(function (){
setlevel($(this).attr('id'));
});
});

70
scripts/snow.js Normal file
View File

@@ -0,0 +1,70 @@
function getRandomInt (min, max)
{
return Math.floor(Math.random() * (max - min + 1)) + min;
}
var snow_count = 20;
var snow_intensive = 2;
var snow_speed1 = 300;
var snow_speed2 = 200;
var snow_src = new Array ('img/snow1.gif', 'img/snow2.gif');
var snow_id = 1;
function snow_start ()
{
for (var i = 0 ; i < snow_count / snow_intensive ; i++)
{
for (var n = 0 ; n < snow_intensive ; n++)
{
setTimeout(snow_create, i * 1500);
}
}
}
function snow_create ()
{
snow_x = getRandomInt(0, $("#ione").width()-20);
snow_img = snow_src[Math.floor(Math.random()*snow_src.length)];
snow_elem = '<img id="snow'+snow_id+'" style="position: absolute; left: '+snow_x+'px; top: 0px; z-index: 102" src="'+snow_img+'" />';
$('#ione').append(snow_elem);
snow_move(snow_id, snow_img);
snow_id++;
}
function snow_move (id, type)
{
var remove = false;
var change_x = (type == 'img/snow2.gif') ?getRandomInt(-2, 2) :getRandomInt(-1, 1);
var change_y = (type == 'img/snow2.gif') ?getRandomInt(15, 20) :getRandomInt(20, 25);
var speed = (type == 'img/snow2.gif') ?snow_speed1 :snow_speed2;
if ((parseInt($('#snow'+id).css('top')) + change_y) > ($('#ione').height() - 40))
{
change_y = $('#ione').height() - 40 - parseInt($('#snow'+id).css('top'));
remove = true;
}
if ((parseInt($('#snow'+id).css('left')) + change_x) > $('#ione').width())
{
change_x = $('#ione').width() - parseInt($('#snow'+id).css('left'));
remove = true;
}
if ((parseInt($('#snow'+id).css('left')) + change_x) < 0)
{
change_x = -parseInt($('#snow'+id).css('left'));
remove = true;
}
$('#snow'+id).animate({top: '+='+change_y, left: '+='+change_x}, speed, function()
{
if (remove)
{
$(this).remove();
snow_create();
}
else
snow_move(id, type);
});
}
$(function (){
$('#ione').append('<div id="snow"></div>');
snow_start();
});

108
scripts/visual.js Normal file
View File

@@ -0,0 +1,108 @@
var visual = {
hint_c_set: function ()
{
$('#hint3').html('<table width="400" cellspacing="1" cellpadding="0" bgcolor="#CCC3AA">'+
'<tr><td align="center"><b>Запомнить комплект одежды</b></td>'+
'<td width="20" align="right" valign="top" style="cursor: pointer;" onclick="closehint3();"><big><b>x</b></big></td>'+
'</tr>'+
'<tr><td colspan="2">'+
'<table width="100%" cellspacing="0" cellpadding="5" bgcolor="#FFF6DD">'+
'<tr><td>Запомнить надетый комплект одежды, для быстрого переодевания. Подробнее об этой функции читайте в разделе <span id="hint" link="invent" class="nick">Подсказка</span>.<br>Введите название комплекта: <input type="text" name="set_name" maxlength="30"></td></tr>'+
'<tr><td align="center"><input type="submit" value="Запомнить" onclick=\'workSets ("create");\'></td></tr>'+
'</table>'+
'</td></tr></table>').css({left: pos.x - 200 + 'px', top: pos.y - 20 + 'px'});
},
hint_set: function (hint)
{
$('#hint3').html(hint+getCloseButton('top', 'left', 'closehint3();'));
var coor = getCenter($('#hint3').width(), $('#hint3').height());
$('#hint3').css({left: coor.x, top: coor.y});
},
bar_show: function (bar)
{
$('#spoiler_'+bar).attr({src: 'img/minus.gif', alt: 'Скрыть'});
$('#'+bar+'c').slideDown('slow', function (){checkWindow();});
updateMmoves('spoiler_'+bar, 'Скрыть');
},
bar_hide: function (bar)
{
$('#spoiler_'+bar).attr({src: 'img/plus.gif', alt: 'Показать'});
$('#'+bar+'c').slideUp('slow', function (){checkWindow();});
updateMmoves('spoiler_'+bar, 'Показать');
},
bar_switch: function (bars)
{
$('#bar_'+bars[1]).fadeOut('10000', function (){$(this).html(bars[4]).fadeIn('10000').attr('id', 'bar_')});
$('#bar_'+bars[3]).fadeOut('10000', function (){$(this).html(bars[2]).fadeIn('10000').attr('id', 'bar_'+bars[1]);$("#bar_").attr('id', 'bar_'+bars[3]);});
},
show_help: function (data)
{
$('body').css({overflow: 'hidden', marginRight: '17px'}).append('<div id="help"></div>');
$('#help').html(data);
var coor = getCenter($('#help').width(), $('#help').height());
$('#help').css({left: coor.x, top: coor.y}).before("<div id='help_bg' onclick='hideHelp();'></div>").fadeIn('10000');
$('#help_bg').css({width: $(document).width(), height: $(document).height()}).fadeIn('10000');
},
hide_help: function ()
{
$('#help').fadeOut('10000', function (){$(this).remove();});
$('#help_bg').fadeOut('10000', function (){$(this).remove();});
$('body').css('overflow', 'auto');
checkWindow();
},
show_section: function (str)
{
$('html, body').animate({scrollTop: 0}, 500);
this.show_any('#section', str);
$('#loadbar').hide();
},
show_any: function (selector, str) {hideShow(selector, function (){$(selector).html(str);}, str);},
set_create: function (name, str)
{
closehint3();
if (!($('div[name='+name.replace(' ', '_')+']').length))
$('#allsets').append(str);
$('div[name='+name.replace(' ', '_')+']').hide().fadeIn('10000');
checkWindow();
},
set_delete: function (name)
{
$('div[name='+name.replace(' ', '_')+']').fadeOut('10000', function (){$(this).remove(); checkWindow();});
},
item_buy: function (item)
{
if (item[3] == 400)
this.show_any('#money', item[1]);
else if (item[3] == 401)
this.show_any('#money_euro', item[1]);
this.show_any('#mass', item[2]);
showError(item[3], item[4]);
},
item_sell: function (id, item)
{
if (item[3] == 404)
this.show_any('#money', item[1]);
else if (item[3] == 405)
this.show_any('#money_euro', item[1]);
$('#item_id_'+id).slideUp('10000', function (){$(this).remove(); checkWindow();});
this.show_any('#mass', item[2]);
showError(item[3], item[4]);
},
item_delete: function (item, id, dropall)
{
var count_items = parseInt($('#count_items').html()) - item[2];
this.show_any('#mass', item[1]);
this.show_any('#count_items', count_items);
if (!dropall)
$('#item_id_'+id).slideUp('10000', function (){$(this).remove(); checkWindow();});
else if (dropall)
$('[name=item_entry_'+item[3]+']').slideUp('10000', function (){$(this).remove(); checkWindow();});
},
item_inc_stat: function (id, stat, incs)
{
$('#inc_'+id+'_'+stat+'_val').animate({color: '#00ff00'}, 500, function (){$(this).html('+'+incs[1]).animate({color: '#000000'}, 500);});
$('#inc_count_'+id).animate({color: '#ff0000'}, 500, function (){$(this).html(incs[2]).animate({color: '#000000'}, 500);});
if (incs[2] == 0)
$('input[type=image]').each(function (){if ($(this).attr('id') == 'inc_'+id+'_btn') $(this).hide();});
},
}