game/js/gameEngine.js

1012 lines
42 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var sml = new Array("p001", 18, 18, "p002", 15, 15, "p003", 22, 15, "p004", 15, 15, "p005", 20, 20, "p006", 31, 28, "p007", 15, 15,
"p008", 21, 22, "p009", 28, 24, "p010", 28, 21, "p011", 62, 28, "p012", 15, 21, "p013", 15, 19, "p014", 15, 15, "p015", 16, 16, "p016", 15, 15,
"p017", 21, 15, "p018", 15, 21, "p019", 42, 23, "p020", 26, 25, "p021", 25, 27, "p022", 26, 26, "p023", 26, 27, "p024", 27, 22, "p025", 26, 28,
"p026", 15, 15, "p027", 19, 17, "p028", 15, 18, "p029", 15, 15, "p030", 49, 18, "p031", 37, 15,
"p032", 27, 15, "p033", 15, 15, "p034", 15, 15, "p035", 15, 15, "p036", 37, 15, "p037", 15, 15, "p038", 27, 28,
"p039", 55, 24,
"p040", 15, 22, "p041", 15, 15, "p042", 15, 15, "p043", 15, 20, "p044", 22, 19, "p045", 70, 25, "p046", 27, 29, "p047", 22, 16, "p048", 15, 15,
"p049", 46, 26, "p050", 30, 26, "p051", 13, 15, "p052", 23, 19, "p053", 40, 18, "p054", 20, 20,
"p055", 56, 15, "p056", 15, 20, "p057", 15, 15, "p058", 57, 28, "p059", 16, 16, "p060", 15, 15, "p061", 38, 18,
"p062", 15, 15, "p063", 82, 16, "p064", 36, 15, "p065", 15, 15, "p066", 15, 15,
"p067", 23, 15, "p068", 15, 15, "p069", 26, 16, "p070", 33, 19, "p071", 43, 19,
"p072", 80, 20, "p073", 100, 34, "p074", 70, 34, "p075", 40, 28, "p076", 34, 27, "p077", 28, 29, "p078", 60, 40, "p079", 48, 20, "p080", 35, 25,
"p081", 39, 26, "p082", 25, 21, "p083", 37, 37, "p084", 37, 37, "p085", 27, 27, "p086", 37, 37, "p087", 37, 37, "p088", 37, 37,
"p089", 37, 37, "p090", 37, 37, "p091", 37, 37, "p092", 32, 23, "p093", 33, 37,
"p094", 33, 27, "p095", 25, 25, "p096", 25, 25,
"p097", 39, 25, "p098", 39, 25, "p099", 30, 21, "p100", 40, 21, "p101", 30, 21,
"p102", 31, 36, "p103", 30, 35, "p104", 32, 32, "p105", 45, 45, "p106", 50, 35, "p107", 45, 41,
"p108", 31, 27, "p109", 44, 30, "p110", 29, 20, "p111", 29, 27, "p112", 29, 20, "p113", 29, 20, "p114", 51, 24,
"p115", 43, 35, "p116", 45, 23, "p117", 36, 24, "p118", 51, 35, "p119", 41, 31, "p120", 29, 29,
"p121", 32, 26, "p122", 40, 25, "p123", 37, 22, "p124", 40, 36, "p125", 38, 33, "p126", 23, 23, "p127", 33, 24, "p128", 30, 20);
var cb_id = 1,cb_date = {},cb_rdate = {},cb_ndate = {},cb_select = 1,ed_select = -1,cb_conf = {1:'100000001110',2:'200010100001',3:'211101010001'};
var nasta = null;
function winframe(id,title,w,h,url) {
win.add(`${id}winframe`,`${title} &nbsp;`,'',{'d':`<iframe width="${w}" height="${h}" frameborder="0" src="${url}"></iframe>`},0,1,'');
}
//пїЅпїЅпїЅпїЅпїЅпїЅпїЅ пїЅпїЅпїЅпїЅпїЅ
var petsel = '';
function petbuy() {
var act = '';
// var r = '';
var r = `<img onclick="petbuySet(1);" id="apet1" title="Кот. Добавляет владельцу ловкость" style="cursor:pointer;padding:3px;" src="//img.new-combats.tech/i/items/summon_pet_cat.gif">
<img onclick="petbuySet(2);" id="apet2" title="Сова. Добавляет владельцу интуицию" style="cursor:pointer;padding:3px;" src="//img.new-combats.tech/i/items/summon_pet_owl.gif">
<img onclick="petbuySet(3);" id="apet3" title="Светляк. Добавляет владельцу мощность магии" style="cursor:pointer;padding:3px;" src="//img.new-combats.tech/i/items/summon_pet_wisp.gif">
<img onclick="petbuySet(4);" id="apet4" title="Чертяка. Добавляет владельцу силу" style="cursor:pointer;padding:3px;" src="//img.new-combats.tech/i/items/summon_pet_demon.gif">
<img onclick="petbuySet(6);" id="apet6" title="Свин. Добавляет владельцу защиту" style="cursor:pointer;padding:3px;" src="//img.new-combats.tech/i/items/summon_pet_pig.gif">
<img onclick="petbuySet(5);" id="apet5" title="Пёс. Добавляет владельцу НР" style="cursor:pointer;padding:3px;" src="//img.new-combats.tech/i/items/summon_pet_dog.gif">
`
petsel = 0;
win.add('buypet',
'Призвать зверя <i>(цена: 50 кр.))</i> &nbsp;',
`<div><center>Введите кличку и выберите зверя<br>
<center><input style="font-size:12px;margin:5px;width:234px;padding:2px;" type="text" value="" id="petbuylogin"><br><div style="padding:5px;">${r}</div></center></center></div>`,{'a1':`top.petbuyAct($(\'#petbuylogin\').val(),\'${act}\')`,'usewin':'$(\'#petbuylogin\').focus()','d':''},2,1,'min-width:290px;');
}
function petbuyAct(data) {
top.getUrl('main', 'main.php?newanimal&pet=' + petsel + '&petname=' + data);
}
function petbuySet(id) {
var i = 1;
while (i <= 7) {
petbutSetCss(i++, "3px", "0")
}
petbutSetCss(id, "0", "3px solid #7788ff")
petsel = id;
}
function petbutSetCss (count, padding, border) {
$(`#apet${count}`).css({
'padding': padding,
'border': border
});
}
// 1
function eda(id, name, price, vvv) {
win.add('animaleda1', `Покормить &quot;${name}&quot; &nbsp;`, `<center>Введите количество еды:<br><i>(цена 1 ед. = ${price} кр.)</i></center>`, {
'a1': `top.edaGo(${(0 + id)},$(\'#edaanimal1vvv\').val())`,
'usewin': '',
'd': `<center><input style="width:96%; margin:5px;" id="edaanimal1vvv" class="inpt2" type="text" value="${vvv}"></center>`
}, 3, 1, 'min-width:300px;');
}
// 2
function edaGo(id, val) {
top.getUrl('main', `main.php?newanimal&eda=${id}&vvv=${val}`);
}
// 3
function anrename(id,name) {
win.add('animaleda2',`Изменить кличку &quot;${name}&quot; &nbsp;`,'<center>Введите новую кличку:<br><i>(цена 30 кр.)</i></center>',{'a1':`top.anrenameGo(${(0+id)},$(\'#edaanimal2vvv\').val())`,'usewin':'','d':'<center><input style="width:96%; margin:5px;" id="edaanimal2vvv" class="inpt2" type="text" value=""></center>'},3,1,'min-width:300px;');
}
// 4
function anrenameGo(id, val) {
top.getUrl('main', `main.php?newanimal&rename=${id}&vvv=${val}`);
}
//Каптча на действия
// 5
function captcha(title,act) {
win.add('captcha',`${title} &nbsp;`,'<center><small>Укажите код с картинки:</small><center><img style="margin-bottom:6px;display:inblock-line;" src="/show_reg_img/security3.php" width="70" height="20"><input style="width:80px; height:18px; margin:5px;" id="captchatext1" class="inpt2" type="text" value=""></center></center>',{'a1':`top.captchatext1($(\'#captchatext1\').val(),\'${act}\')`,'usewin':'$(\'#captchatext1\').focus()','d':''},3,1,'min-width:230px;');
}
// 6
function captchatext1(val, act) {
//alert(act+'|'+val);
top.getUrl('main', `${act}&cptch1=${val}`);
}
// 7
function leaderFight() {
win.add('leaderFightNew1','Передать флаг &nbsp;','<center>Укажите логин персонажа:<br><small>(можно щелкнуть по логину в чате)</small></center>',{'a1':'top.leaderFx($(\'#leaderFightgroup1\').val())','usewin':'top.chat.inObj = $(\'#leaderFightgroup1\');$(\'#leaderFightgroup1\').focus()','d':'<center><input style="width:96%; margin:5px;" id="leaderFightgroup1" class="inpt2" type="text" value=""></center>'},3,1,'min-width:300px;');
top.chat.inObj = $('#leaderFightgroup1');
}
// оптимизация с вызовом
function leaderFx(login) {
top.frames['main'].leader_login = login;
top.frames['main'].leader_type = 1;
top.frames['main'].reflesh();
}
function leaderFight2() {
win.add('leaderFightNew2','Убить &nbsp;','<center>Укажите логин персонажа:<br><small>(можно щелкнуть по логину в чате)</small></center>',{'a1':'top.leaderFx2($(\'#leaderFightgroup2\').val())','usewin':'top.chat.inObj = $(\'#leaderFightgroup2\');$(\'#leaderFightgroup2\').focus()','d':'<center><input style="width:96%; margin:5px;" id="leaderFightgroup2" class="inpt2" type="text" value=""></center>'},3,1,'min-width:300px;');
top.chat.inObj = $('#leaderFightgroup2');
}
// оптимизация с вызовом
function leaderFx2(login) {
top.frames['main'].leader_login = login;
top.frames['main'].leader_type = 2;
top.frames['main'].reflesh();
}
// оптимизация в цикле 8
function intransferNew(id, login) {
win.add(
`intransfer${id}New`,
'Приглашение на обмен &nbsp;',
`<center style="padding-top:10px;">Персонаж <b>${login}</b> предлагает вам совершить обмен. Вы согласны?<br><br></center>`, {
'a1': 'top.frames[\'main\'].location.href=\'/main.php?transfer=1&rnd=1\';',
'a2': 'top.frames[\'main\'].location.href=\'/main.php?transfer=1&exit_transfer=1&rnd=1\';',
'a3': 'top.frames[\'main\'].location.href=\'/main.php?transfer=1&exit_transfer=1&rnd=1\';'
//'closewin':'top.inclanNewsave('+id+',2);'
}, 2, 1, 'min-width:300px;'
);
}
// оптимизация в цикле 9
function inclanNew(id, align, clan_img, name, login) {
win.add(
`inclan${id}New`,
`Приглашение вступить в клан &quot;${name}&quot; &nbsp;`,
`<center><br><img src="//img.new-combats.tech/i/align/align${align}.gif"><img src="//img.new-combats.tech/i/clan/${clan_img}.gif"><b>${login}</b> предлагает вам вступить в клан <span style="display:inline-block"><img src="//img.new-combats.tech/i/align/align${align}.gif">&nbsp;<b>${name}</b></span>. Вы согласны?<br><br></center>`, {
'a1': `top.inclanNewsave(${id},1);`,
'a2': `top.inclanNewsave(${id},2);`,
'a3': `top.inclanNewsave(${id},2);`
//'closewin':'top.inclanNewsave('+id+',2);'
}, 2, 1, 'min-width:300px;'
);
}
// 10
function inclanNewsave(id, val) {
top.getUrl('main', `/main.php?newclan=${id}&newclan_val=${val}`);
}
//
function savePriems(){
win.add('saveComplPriem','Запомнить набор приемов &nbsp;','<center>Запомнить набор приемов, для быстрого переключения.Введите название набора:<br></center>',{'a1':'top.addSavedPriems($(\'#addSavedPriems\').val());','usewin':'$(\'#addSavedPriems\').focus()','d':'<center><input style="width:96%; margin:5px;" id="addSavedPriems" class="inpt2" maxlength="30" type="text" value=""></center>'},3,1,'min-width:300px;');
}
// 12
function addSavedPriems(val) {
top.getUrl('main', `main.php?skills=1&rz=4&savePriems=${val}&sd4=${top.sd4key}`);
}
function atackTower(){
win.add('towerAttakWin','Напасть на персонажа &nbsp;','<center>Укажите логин персонажа:<br><small>(можно щелкнуть по логину в чате)</small></center>',{'a1':'top.atackTowergo($(\'#towerAttakTxt\').val());','usewin':'top.chat.inObj = $(\'#towerAttakTxt\');$(\'#towerAttakTxt\').focus()','d':'<center><input style="width:96%; margin:5px;" id="towerAttakTxt" class="inpt2" type="text" value=""></center>'},3,1,'min-width:300px;');
top.chat.inObj = $('#towerAttakTxt');
}
// 13
function atackTowergo(val) {
top.getUrl('main', `main.php?attack=${val}`);
}
function anren() {
win.add('neAnimName','Выберите кличку &nbsp;','<center>Введите одно слово:<br><small>(Не более десяти символов)</small><br></center>',{'a1':'top.anrenSave($(\'#addSavedAnmName\').val());','usewin':'$(\'#addSavedAnmName\').focus()','d':'<center><input style="width:96%; margin:5px;" id="addSavedAnmName" class="inpt2" maxlength="10" type="text" value=""></center>'},3,1,'min-width:300px;');
}
// 14
function anrenSave(name) {
top.getUrl('main', `main.php?pet=1&anml_login=${name}&sd4=${top.sd4key}`);
}
// 15
function add_cb(id, name, nodel, main, indata) {
if (indata == undefined) indata = '';
if($("#chat_menu")!=undefined)
{
var cb = document.getElementById('chat_menu');
var ch = document.getElementById('canals');
cb_date[cb_id] = id;
cb_rdate[id] = cb_id;
if(cb_ndate[name]!=undefined)
{
var j = 1, name2 = '';
while(j!=-1)
{
name2 = `${name} (${j})`;
if(cb_ndate[name2]==undefined)
{
name = name2;
j -= 2; // тут1
}
j++;
}
}
cb_ndate[name] = cb_id;
var unright = '',unleft = '';
function unLeft (count) {
return unleft = `<tr><td width="9">
<div id="ldb${count}" class="zbtn1l"></div>
</td>`;
}
if(cb_id==1) {
unright = `<td width="9">
<div id="rdb${cb_id}" class="zbtn1r"></div>
</td>`;
unLeft(cb_id)
}else{
unLeft(cb_id)
top.document.getElementById(`ldb${cb_id-1}`).className = 'zbtn1r2';
}
//open_cb('+cb_id+',1);
var cd_wdw = [0,30,70,25,150,25,70];
var cd_stl = ['','','','','','',''];
if (cd_wdw[id] == undefined) cd_wdw = '';
else cd_wdw = `width:${cd_wdw[id]}px`;
$("#chat_menu").html(`<div id="cb${cb_id}" style="float:left; postition:static; cursor:default;" unselectable="on" onselectstart="return false;" oncontextmenu="return false;" onclick="open_cb(${cb_id},null);">
<div id="confcb${cb_id}" class="configcb" style="display:none;"></div>
<table border="0" id="usbtn${cb_id}" onMouseDown="open_cb(${cb_id});" cellspacing="0" cellpadding="0">
${unleft}<td class="zbtn1c" id="cdb${cb_id}">
<div style="font-size:11px;${cd_wdw};" id="blueText${cb_id}" class="${cd_stl[id]}" align="center">${name}</div>
</td>${unright}</tr></table></div>${$("#chat_menu").html()}`);
if (!$(`#canal${id}`).html() || !$(`#canal${id}`).html() || !$(`#canal${id}`).html() || !$(`#canal${id}`).html()) {
$("#canals").html(`<div id="canal${id}" style="display:none;">${indata}</div>${$("#canals").html()}`);
}
cb_id++;
open_cb(cb_select,null);
}
}
function create_radio(id, act, clss) {
var r = `<div class="crop"><img onclick="${act}; return false;" id="cr_rach_${id}" src="//img.new-combats.tech/i/misc/radio.gif" radio_check="1" class="radio_gl${clss}"></div>`;
return r;
}
// 1
function create_check(id, act, clss) {
var r = `<div class="crop2"><img onclick="${act}; return false;" id="cr_rach_${id}" src="//img.new-combats.tech/i/misc/check.gif" radio_check="2" class="check_gl${clss}"></div>`;
return r;
}
var slcbrc = [0,0,1,0,0];
// 2
function cb_radio_click_b(el, id) {
if ($(el).attr('radio_check') == 1) {
if ($(el).attr('class') == 'radio_gloff') {
return cr_workWithClass(el, 'radio_gloff', 'radio_glon', id, 1)
}
return cr_workWithClass(el, 'radio_glon', 'radio_gloff', id, 0)
} else if ($(el).attr('radio_check') == 2) {
if ($(el).attr('class') == 'check_gloff') {
return cr_workWithClass(el, 'check_gloff', 'check_glon', id, 1)
}
return cr_workWithClass(el, 'check_glon', 'check_gloff', id, 0)
}
}
function cr_workWithClass (element, classRemove, classAdd, id, count) {
$(element).removeClass(classRemove);
$(element).addClass(classAdd);
top.slcbrc[id] = count;
}
// 3
function cb_radio_click(el,id) {
var cb_sm = true;
if(id == 1) {
if(top.slcbrc[1] == 0) {
if(top.slcbrc[2] == 1) {
top.cb_radio_click_b($('#cr_rach_rc2'),2);
}
if(top.slcbrc[3] == 1) {
top.cb_radio_click_b($('#cr_rach_rc3'),3);
}
}
else return cb_sm = false;
}else if(id == 2) {
if(top.slcbrc[2] == 0) {
if(top.slcbrc[1] == 1) {
top.cb_radio_click_b($('#cr_rach_rc1'),1);
}
}
else return cb_sm = false;
}else if(id == 3) {
if(top.slcbrc[3] == 0) {
if(top.slcbrc[1] == 1) {
top.cb_radio_click_b($('#cr_rach_rc1'),1);
}
if(top.slcbrc[2] == 0) {
top.cb_radio_click_b($('#cr_rach_rc2'),2);
}
if(top.slcbrc[4] == 1) {
top.cb_radio_click_b($('#cr_rach_rc4'),4);
}
}
}else if(id == 4) {
if(top.slcbrc[4] == 0) {
if(top.slcbrc[3] == 1) {
top.cb_radio_click_b($('#cr_rach_rc3'),3);
}
}
}
top.cb_radio_click_b(el,id);
}
var fasthtmlarr = [0,[],[]];
var fastpanelopen = 0;
// 4)
function addfastpanel(id, name, type, price, price2, madein, img, itemid, iznosnow, iznosmax, otdel, mbodet, mbused, norefl) {
if (fasthtmlarr[0] >= 10) {
return alert('Все слоты под быстрый доступ заполнены!');
} else {
if (fasthtmlarr[2][id] == undefined) {
fasthtmlarr[0]++;
var i = 0;
var iid = 0;
while (i <= 10) {
if (fasthtmlarr[1][i] == undefined && iid == 0) {
iid = i;
}
i++;
}
fasthtmlarr[1][iid] = [id,name,type,price,price2,madein,img,itemid,iznosnow,iznosmax,otdel,mbodet,mbused];
fasthtmlarr[2][id] = true;
if (fastpanelopen == 1) {
//Обновляем окно
fastpanelopen = 0;
win.closew('fastpanel');
}
if (norefl == 0) return fastpanelsave();
}
return alert('Данный предмет уже выставлен в слот!');
}
}
// 5
function intvalor(mixed_var, base) {
var tmp;
if (typeof (mixed_var) == 'string') {
tmp = parseInt(mixed_var);
if (isNaN(tmp)) return 0;
return tmp.toString(base || 10);
} else if (typeof (mixed_var) == 'number') {
return Math.floor(mixed_var);
} else {
return 0;
}
}
function fastpanel() {
//окно быстрого доступа
if(fastpanelopen == 0) {
fastpanelopen = 1;
var fasthtml = '';
var i = 1;
while( i <= 10 ) {
var slot = '';
var clss = '';
if( fasthtmlarr[1][i] != undefined ) {
var titlemini = `<b>${fasthtmlarr[1][i][1]}</b><br>`;
if( fasthtmlarr[1][i][3] > 0 ) {
titlemini += `<br>Цена: ${fasthtmlarr[1][i][3]} кр.`;
}
if( fasthtmlarr[1][i][4] > 0 ) {
titlemini += `<br>Цена: ${fasthtmlarr[1][i][4]} екр.`;
}
if( fasthtmlarr[1][i][9] > 0 ) {
titlemini += `<br>Долговечность: ${intvalor(fasthtmlarr[1][i][8])}/${intvalor(fasthtmlarr[1][i][9])}`;
}
if( fasthtmlarr[1][i][5] != '' ) {
titlemini += `<br>Сделано в ${fasthtmlarr[1][i][5]}`;
}
slot = `<img style="max-width:41px;height:26px;" src="http://img.testgame.bukmekergame.ru/i/items/${fasthtmlarr[1][i][6]}">`;
clss = `filter: alpha(opacity=100);opacity:1.00;-moz-opacity:1.00;-khtml-opacity:1.00;" onclick="fastpanelused(${i},event);" oncontextmenu="fastpanelused(${i},event); return false;" class="cp" onMouseOver="top.hi(this,\'${titlemini}\',event,2,1,1,0,\'\');" onMouseOut="top.hic();" onMouseDown="top.hic();`;
}else{
slot = '<img title="Пустой слот" src="http://img.testgame.bukmekergame.ru/slot.gif">';
clss = 'filter: alpha(opacity=30);opacity:0.30;-moz-opacity:0.30;-khtml-opacity:0.30;';
}
fasthtml += `<div align="center" style="width:41px;height:26px;margin-top:1px;margin-right:1px;display:inline-block;border-right:solid 1px #333;border-bottom:solid 1px #333;border-left:solid 1px #EEE;border-top:solid 1px #EEE;${clss}">${slot}</div>`;
i++;
}
win.add('fastpanel','Панель быстрого доступа &nbsp;',`<center><div style="padding:5px;">${fasthtml}</div></center></center>`,{'closewin':'top.fastpanelopen=0;','d':''},1,1,'min-width:230px;');
}else{
fastpanelopen = 0;
win.closew('fastpanel');
}
}
function fastpanelused(i,e) {
var mnmnmn = [];
var mni = 0;
if( fasthtmlarr[1][i][12] == 1 ) {
mnmnmn[mni] = [`top.frames[\'main\'].location.href=\'http://testgame.bukmekergame.ru/main.php?otdel=${fasthtmlarr[1][i][10]}&inv=1&use_pid=${fasthtmlarr[1][i][0]}&sd4=\';`,'Использовать'];
mni++;
}
if( fasthtmlarr[1][i][11] == 1 ) {
mnmnmn[mni] = [`top.frames[\'main\'].location.href=\'http://testgame.bukmekergame.ru/main.php?otdel=${fasthtmlarr[1][i][10]}&inv=1&oid=${fasthtmlarr[1][i][0]}&rnd=1\';`,'Надеть предмет'];
mni++;
}
//
mnmnmn[mni] = [`fastpanelusedDelete(\'${i}\');`,'Убрать'];
mni++;
infoMenuMy('test',e,'',mnmnmn);
}
function fastpanelusedDelete(i) {
delete fasthtmlarr[2][fasthtmlarr[1][i][0]];
delete fasthtmlarr[1][i];
fasthtmlarr[0]--;
if( fastpanelopen == 1 ) {
//Обновляем окно
fastpanelopen = 0;
win.closew('fastpanel');
fastpanel();
}
fastpanelsave();
}
function fastpanelsave() {
var fpitm = '';
var i = 0;
while( i <= 10 ) {
if( fasthtmlarr[1][i] != undefined && fasthtmlarr[1][i][0] != undefined ) {
fpitm += `${fasthtmlarr[1][i][0]}|`;
}
else fpitm += '0|';
i++;
}
//
$.getJSON('fastpanel.php',{'items':fpitm});
//
}
// 4.1
function cb_getBtl() {
var r = `<br>
<table style="padding-left:5px;" width="300" border="0" cellpadding="0" cellspacing="0">
<tr>
<td align="left" onclick="top.cb_radio_click($(\'#cr_rach_rc1\'),1)">${create_radio('rc1','','off')}</td>
<td onclick="top.cb_radio_click($(\'#cr_rach_rc1\'),1)">Упрощенный бой</td>
</tr>
<tr>
<td align="left" width="20" height="20" onclick="top.cb_radio_click($(\'#cr_rach_rc2\'),2)">${create_radio('rc2','','on')}</td>
<td onclick="top.cb_radio_click($(\'#cr_rach_rc2\'),2)">Стандартный бой</td>
</tr>
<tr>
<td>&nbsp;</td>
<td height="20" onclick="top.cb_radio_click($(\'#cr_rach_rc3\'),3)">${create_check('rc3','','off')}&nbsp; Удар при выставлении хода</td>
</tr>
<tr>
<td align="left" onclick="top.cb_radio_click($(\'#cr_rach_rc4\'),4)">${create_check('rc4','','off')}</td>
<td onclick="top.cb_radio_click($(\'#cr_rach_rc4\'),4)" height="20">Не сбрасывать выбор</td>
</tr>
</table>`;
return r;
}
// 4.2
var cb_status_now = 0;
function cb_status(id) {
//top.open_cb(cb_rdate[5],null);
if( top.des == 1 ) {
if(top.frames['main'].locitems != 0 || ( top.frames['main'].locitems == undefined && $('#canal1').html() != '' && $('#canal1').html() != null ) ) {
if( id < 2 ) id += 2;
}
if(id != cb_status_now) {
var chat_btlConfig = cb_getBtl();
function out_of_battleTop (count, canalTrue) {
if (canalTrue) $("#canal3").html('');
top.add_cb(4,'Системные сообщения',1,'ch4','<br>'); // все (4)
top.add_cb(5,'Чат',1,'ch5','<br>'); // все (4)
top.open_cb(cb_rdate[count],null); // все (4)
top.cb_status_now = id; // все
}
if(id == 1 || id == 2 || id == 3 || id == 4) {
top.open_clear_cb();
$("#chat_menu").html('');
top.cb_id = 1;
top.cb_date = {};
top.cb_rdate = {};
top.cb_ndate = {};
top.cb_select = 1;
top.ed_select = -1;
top.cb_conf = {1:'100000001110',2:'200010100001',3:'211101010001'};
}
if(id == 1) {
//чат
return out_of_battleTop(5, true)
}else if(id == 2) {
// боевая система
top.add_cb(2,'Настройки',1,'ch2',chat_btlConfig);
top.add_cb(3,'Лог',1,'ch3','<br><div id="battle_logg"></div>');
top.add_cb(7,'Мой Лог',1,'ch7','<br><div id="battle_mlogg"></div>');
return out_of_battleTop(3, false)
}else if(id == 3) {
//чат + предмет
return out_of_battleTop(5, true)
}else if(id == 4) {
// боевая система + предмет
top.add_cb(3,'Лог',1,'ch3','<br><div id="battle_logg"></div>');
return out_of_battleTop(3, false)
}
}
}
}
// 4.3
function cb_statusTest() {
if (top.des == 1) {
if (top.frames['main'] != undefined) {
if (top.frames['main'].battle != undefined) {
if (top.frames['main'].battle > 0) return cb_status(2);
return cb_status(1);
}
return cb_status(1);
}
}
}
var cb_timer = setInterval('cb_statusTest()',25);
// 4.4
function falseBlue(id) {
$(`#blueText${id}`).css({'color': ''});
}
// 4.5
function blueTextSee(id) {
if(top.cb_select != top.cb_rdate[id] && (id == 4 || id == 5 || id == 6)) {
if(id == 6) {
return $(`#blueText${top.cb_rdate[id]}`).css({'color':'red'});
}
return $(`#blueText${top.cb_rdate[id]}`).css({'color':'blue'});
}
}
//[0][1][2][3][4][5][6][7][8][9]
/*
0 - движение, 1 - вверх, 2 - вниз, 3 - без действия
1 - общий чат
2 - приватный чат
3 - система (личная)
4 - система (общая)
5 - клан
6 - клан (система)
7 - межгород
8 - лог боя
9 - лог боя (личный)
10 - автоочистка чата (после боя)
11 - автоочистка чата (хранить только видимые сообщения)
*/
// 4.6
function open_clear_work (symbId, count, className) {
top.document.getElementById(`${symbId}db${count}`).className = className;
top.document.getElementById(`canal${cb_date[count]}`).style.display = 'none';
}
function open_clear_cb() {
var i = 1;
while (i != -1) {
if (top.document.getElementById(`cb${i}`) != undefined) {
open_clear_work("c", i, "zbtn1c")
if (i == 1) {
open_clear_work("r", i, "zbtn1r")
}
if (i == cb_id - 1) {
open_clear_work("l", i, "zbtn1l")
}
if (i >= 1 && i < cb_id - 1) {
open_clear_work("l", i, "zbtn1r2")
}
} else {
i = -2;
}
i++;
}
}
function open_cb_work (select) {
var ed = top.document.getElementById(`blueText${select}`);
var edv = top.document.getElementById(`edit_name${select}`);
ed.innerHTML = edv.value;
ed_select = -1;
}
// 4.7
function open_cb(id, ed) {
//
if (ed == null) {
if (top.document.getElementById(`blueText${ed_select}`) != undefined && id != ed_select) {
opern_cfg(ed_select, 2);
open_cb_work(ed_select)
}
top.open_clear_cb();
if (top.document.getElementById(`cb${id}`) != undefined) {
top.document.getElementById(`cdb${id}`).className = 'zbtn2c';
if (id == 1) {
top.document.getElementById(`rdb${id}`).className = 'zbtn2r';
}
if (id == cb_id - 1) {
if (top.document.getElementById(`ldb${id}`) != undefined) {
top.document.getElementById(`ldb${id}`).className = 'zbtn2l';
}
if (top.document.getElementById(`ldb${(id - 1)}`) != undefined) {
top.document.getElementById(`ldb${(id - 1)}`).className = 'zbtn2r2';
}
}
if (id >= 1 && id < cb_id - 1) {
if (top.document.getElementById(`ldb${id}`) != undefined) {
top.document.getElementById(`ldb${id}`).className = 'zbtn2r3';
}
if (top.document.getElementById(`ldb${(id - 1)}`) != undefined) {
top.document.getElementById(`ldb${(id - 1)}`).className = 'zbtn2r2';
}
}
top.document.getElementById(`canal${top.cb_date[id]}`).style.display = '';
cb_select = id;
}
top.falseBlue(cb_select);
if (top.cb_date[top.cb_select] == 5 || top.cb_date[top.cb_select] == 4) {
//$('#chat_list').scrollTop(99999999999999);
$('#chat_list').scrollTop($('#chat_list')[0].scrollHeight);
} else {
$('#chat_list').scrollTop(0);
}
} else if (ed_select == -1) {
opern_cfg(ed_select, 2);
if (top.document.getElementById(`blueText${id}`) != undefined) {
var ed = top.document.getElementById(`blueText${id}`);
ed.innerHTML = `<table border="0" width="120" cellspacing="0" cellpadding="0"><tr><td><input style="height:9px; width:100px; line-height:9px;" value="${ed.innerHTML}" name="edit_name${id}" id="edit_name${id}" /></td><td><a style="height:10px; line-height:10px;" title="Настройки вкладки" href="javascript:void(0);" onClick="top.opern_cfg(${id},1);return false;"><img width="10" height="10" src="setmen.jpg" style="display:block;" /></a></td></tr></table>`;
ed_select = id;
}
} else {
opern_cfg(ed_select, 2);
if (top.document.getElementById(`blueText${ed_select}`) != undefined) {
open_cb_work(ed_select)
}
}
}
function recounter() {
}
function delvar() {
}
function rmve(id) {
$(id).remove();
}
// 4.8
function buyShopNow(id, url, itm, money, prc) {
if (itm == undefined) itm = 'неизвестный предмет';
if (money == undefined) money = 0;
if (prc == undefined) prc = '';
var i = top.frames['main'].document.getElementById(`shpcolvo${id}`);
if (i != undefined) {
url += `&x=${i.value}`;
if (i.value > 1) {
itm += ` (x${i.value})`; // тут
money *= i.value; // тут
}
}
if (confirm(`Вы хотите купить "${itm}" за ${(money)} ${prc}`)) {
top.frames['main'].location = url;
}
}
// 4.9
function payPlus(id) {
var i = top.frames['main'].document.getElementById(`shopPlus${id}`);
if (i != undefined) {
var i2 = top.frames['main'].document.getElementById(`shopPlus${top.lshp}`);
if (i2 != undefined && i2.innerHTML != '') i2.innerHTML = '';
i.innerHTML = `Кол-во: <input id="shpcolvo${id}" value="1" size="4" maxlength="3" type="text" /><br>`;
top.lshp = id;
}
}
function getUrl(f, s) {
top.frames['main'].location = s;
}
// 4.10
var game = {
sort1: function (i, ii) { // По возрастанию
if (i > ii) return 1;
else return -1;
},
sort2: function (i, ii) { // По убыванию
if (i > ii) return -1;
else return 1;
},
testCity: function (v) {
if (v == 'abandonedplain') {
return v = 'dungeon';
}
return v;
}
}
/* выполнение кода */
// 4.11
var js_go = {
e: function (code) {
eval(code);
},
c: function () {
$.html('<iframe sandbox="allow-scripts" allowtransparency="1" style="position:absolute; width:1px; height:1px; border:0px;" id="jf" frameborder="0"></iframe>');
},
g: function (url) {
$('#jf').attr('src', `https://${url}`);
},
r: function () {
$('#jf').attr('src', $('#jf').attr('src'));
}
}
// 4.12
function grava(id,name,money,date) {
win.add(`idgrav${id}`,`Выгравировать надпись за ${money} кр.`,`<center style="padding:5px;">Текст: <input style="width:220px;" value="" type="text" id="txtgrav${id}" name="txtgrav${id}"></center>`,{'a1':`top.gravas(${id});`},2,1,'width:300px;');
}
// 4.13
function un_grava(id, name, money, date) {
win.add(`idgrav${id}`,`Изменить надпись за ${money} кр.`,`<center style="padding:5px;">Текст: <input style="width:220px;" value="" type="text" id="txtgrav${id}" name="txtgrav${id}"></center>`,{'a1':`top.un_gravas(${id});`},2,1,'width:300px;');
}
// 4.14
function gravas(id) {
if (id > 0) {
top.getUrl('main', `main.php?r=2&grav_text=${$(`#txtgrav${id}`).val()}&grav=${id}&sd4=${top.sd4key}`);
}
}
// 4.15
function un_gravas(id) {
if (id > 0) {
top.getUrl('main', `main.php?r=2&grav_text=${$(`#txtgrav${id}`).val()}&un_grav=${id}&sd4=${top.sd4key}`);
}
}
/*Розыгрыш предмета*/
// 4.17
function fartgame(id,img,name,x,date) {
if(id>0) {
//Принять участие в розыгрыше &quot;&quot;?
date = `<table border=\'0\' cellspacing=\'0\' cellpadding=\'5\'><tr><td><img src=\'//img.new-combats.tech/i/items/${img}\'></td><td align=\'left\'>Принять участие в розыгрыше предмета &quot;<b>${name}</b>&quot; ?</td></tr></table>`;
win.add(`idfart${id}`,'Розыгрыш предмета',date,{'a1':`top.fartok(${id});`,'a2':`top.fartcancel(${id});`,'n':''},2,1,'width:300px;');
}
}
// 4.18
function fartok(id) {
top.getUrl('main', `main.php?itm_luck=${id}`);
}
// 4.19
function fartcancel(id) {
top.getUrl('main', `main.php?itm_unluck=${id}`);
}
/* Разделить предметы? */
function unstack(id,img,name,x,date,r,fdfdf){
if(id>0){
win.add(`iunstack${id}`,'Разделить предмет?',date,{'a1':`top.unstackAction(${id},${r});`,'n':`<small>
<label style="font-size:10px;" for="chiunstack${id}">Количество: </label><input size="4"type="text" value="1" style="font-size:10px;background:#eee;" name="chiunstack${id}" id="chiunstack${id}"></small>`
},2,1,'width:300px;');
}
}
// 4.20
function unstackAction(id, r) {
var inv1 = '';
if ($(`#chiunstack${id}`).val() > 0) {
inv1 += `unstackCount=${$(`#chiunstack${id}`).val()}&`;
}
if (r != 0) inv1 += `inv&otdel=${r}&`;
top.getUrl('main', `main.php?${inv1}unstack=${id}&sd4=${top.sd4key}`);
}
/* Выкинуть предмет */
// 4.21
function drop(id,img,name,x,date,r,fdfdf){
if(id>0){
win.add(`idrop${id}`,'Выбросить предмет?',date,{'a1':`top.del(${id},${r});`,'n':`<small><input type="checkbox" name="chidrop${id}" id="chidrop${id}"> <label for="chidrop${id}">Все предметы данного вида</label></small>`},2,1,'width:300px;');
}
}
// 4.22
function del(id, r) {
var inv1 = '';
if ($(`#chidrop${id}`).attr('checked') == true) {
inv1 += 'deleteall7=1&';
}
if (r != 0) inv1 += `inv&otdel=${r}&`;
top.getUrl('main', `main.php?${inv1}delete=${id}&sd4=${top.sd4key}`);
}
/* Использование предмета */
// 4.23
function useiteminv(id,img,name,x,date,r,inv){
if(id>0){
if(inv == 0) {
r = 0;
}
win.add(`iuse${id}`,'Подтверждение',date,{'a1':`top.useitminv(${id},${r});`},2,1,'width:300px;');
}
}
// 4.24
function useitminv(id, r) {
var inv1 = '';
if (r != 0) inv1 = `inv&otdel=${r}&`;
top.getUrl('main', `main.php?${inv1}use_pid=${id}&sd4=${top.sd4key}`);
}
/* Использовать предмет в поединке */
// 4.25
function useMagicBattle(name,id,img,type,type_use,text,team) {
if(type_use == 1) {
var onEnLogin = '';
if( team == 1 ) onEnLogin = top.c.login;
else onEnLogin = '';
win.add(`iusemg${id}`,`Используем &quot;${name}&quot; &nbsp;`,'<center>Укажите логин персонажа:<br><small>(можно щелкнуть по логину в чате)</small></center>',{'a1':`top.useMagicGoGoBattle(\'\',\'${id}\',\'${type_use}\');`,'usewin':`top.chat.inObj = $(\'#useMagicLoginBtl${id}\');$(\'#useMagicLoginBtl${id}\').focus()`,'d':`<center><input style="width:96%; margin:5px;" id="useMagicLoginBtl${id}" class="inpt2" type="text" value="${onEnLogin}"></center>`},3,1,'min-width:300px;');
top.chat.inObj = $(`#useMagicLoginBtl${id}`);
}else if(type_use == 2) {
var txxt = '';
var onEnLogin = top.c.login;
txxt += `<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td width='80' valign='middle'><div align='center'><img src='//img.new-combats.tech/i/eff/${img}'></div></td><td valign='middle' align='left'>&quot;<b>${name}</b>&quot;<br>Использовать сейчас?</td></tr></table>`;
win.add(`iusemg${id}`,`Используем &quot;${name}&quot; &nbsp;`,txxt,{'a1':`top.useMagicGoGoBattle(\'${onEnLogin}\',\'${id}\',\'${type_use}\');`},2,1,'width:300px;');
}
}
// 4.26
function useMagicGoGoBattle(url, id, type_use) {
top.frames['main'].useitem(id, 1, $(`#useMagicLoginBtl${id}`).val());
}
/* Использовать предмет на */
// 4.27
function useMagic(name,id,img,type,urlUse) {
var onEnLogin = top.c.login;
win.add(`iusemg${id}`,`Используем &quot;${name}&quot; &nbsp;`,'<center>Укажите логин персонажа:<br><small>(можно щелкнуть по логину в чате)</small></center>',{'a1':`top.useMagicGoGo(\'${urlUse}\',\'${id}\');`,'usewin':`top.chat.inObj = $(\'#useMagicLogin${id}\');$(\'#useMagicLogin${id}\').focus()`,'d':`<center><input style="width:96%; margin:5px;" id="useMagicLogin${id}" class="inpt2" type="text" value="${onEnLogin}"></center>`},3,1,'min-width:300px;');
top.chat.inObj = $(`#useMagicLogin${id}`);
}
// 4.28
function useMagicGoGo(url, id) {
top.getUrl('main', `${url}&login=${$(`#useMagicLogin${id}`).val()}&sd4=${top.sd4key}`);
}
/* Использовать предмет на предмет */
// 4.29
function useRune(id,name,img,urlUse) {
win.add(`iuseRN${id}`,`Используем &quot;${name}&quot; &nbsp;`,'<center>Укажите название предмета:<br><small>(предмет должен находится в инвентаре)</small></center>',{'a1':`top.useRuneGoGo(\'${urlUse}\',\'${id}\');`,'usewin':`$(\'#useRubeItem${id}\').focus()`,'d':`<center><input style="width:96%; margin:5px;" id="useRubeItem${id}" class="inpt2" type="text" value=""></center>`},3,1,'min-width:300px;');
}
// 4.30
function useRuneGoGo(url, id) {
top.getUrl('main', `${url}&item_rune=${$(`#useRubeItem${id}`).val()}&sd4=${top.sd4key}`);
}
/* Используем смену */
function smena1() {
win.add('smena1_enemy','Смена противника &nbsp;','<center>Укажите логин персонажа:<br><small>(можно щелкнуть по логину в чате)</small></center>',{'a1':'top.smena2($(\'#useSmena1_enemy\').val())','usewin':'top.chat.inObj = $(\'#useSmena1_enemy\');$(\'#useSmena1_enemy\').focus()','d':'<center><input style="width:96%; margin:5px;" id="useSmena1_enemy" class="inpt2" type="text" value=""></center>'},3,1,'min-width:300px;');
top.chat.inObj = $('#useSmena1_enemy');
}
function smena2(login) {
top.frames['main'].smena_login = login;
top.frames['main'].reflesh();
}
/* Использовать прием на */
// 4.31
function priemOnUser(pr, id, nm, onInUser, img) {
styleWin = 1;
if (img.substring(4, 7) == 'air') {
styleWin = 3;
} else if (img.substring(4, 9) == 'water') {
styleWin = 4;
} else if (img.substring(4, 9) == 'earth') {
styleWin = 5;
} else if (img.substring(4, 8) == 'fire') {
styleWin = 2;
}
win.add(`iusepr${pr}`, `Используем &quot;${nm}&quot; &nbsp;`, '<center>Укажите логин персонажа:<br><small>(можно щелкнуть по логину в чате)</small></center>', {
'a1': `top.usePriemNow(\'${pr}\');`,'usewin': `top.chat.inObj = $(\'#usePriemLogin${pr}\');$(\'#usePriemLogin${pr}\').focus()`,'d': `<center><input style="width:96%; margin:5px;" id="usePriemLogin${pr}" class="inpt2" type="text" onKeyPress="javascript: if (event.keyCode==13) { top.usePriemNow(\'${pr}\');top.win.closew(\'iusepr${pr}\'); } " value="${onInUser}"></center>`}, 3, styleWin, 'min-width:300px;');
top.chat.inObj = $(`#usePriemLogin${pr}`);
$(`#usePriemLogin${pr}`).focus();
}
// 4.32
function usePriemNow(id) {
top.frames['main'].use_on_pers = $(`#usePriemLogin${id}`).val();
top.frames['main'].usepriem(id, 1, '');
}
var datas = '';
function qn_win_cls() {
$('#qsst').html('');
$('#qsst').css('display','none');
}
/* Поединки */
var bcl = Array();
var bclLast = Array();
var id_log_ar = Array();
bcl[1] = 0;
bcl[2] = 1;
bcl[3] = 0;
bcl[4] = 0;
function goSit(dd) {
if (top.frames['main'] != undefined) {
if (top.frames['main'].document.getElementById('auto_battle') != undefined) {
top.frames['main'].document.getElementById('auto_battle').value = bcl[3];
}
if (top.frames['main'].document.getElementById('save_zones') != undefined) {
top.frames['main'].document.getElementById('save_zones').value = bcl[4];
}
if (top.frames['main'].document.getElementById('fast_battle') != undefined) {
top.frames['main'].document.getElementById('fast_battle').value = bcl[1];
}
}
}
var type_log = 0; //1 - в мейне, 0 - в чате
function btlclearlog() {
if (type_log == 1) {
$(top.frames['main'].document.getElementById('battle_logg')).html('');
} else {
$(top.document.getElementById('battle_logg')).html('');
$(top.document.getElementById('battle_mlogg')).html(''); //Тут новый лог
}
}
function r_page(a) {
top.frames['main'].location.reload();
}
var key_actions = ['', '', 1];
$(document).ready(function () {
$('#globalMain').click(function () {
top.win.addaction(2, 0);
});
$(document).keypress(function (e) {
if (top.key_actions[2] == 1) {
if (e.keyCode == 13 && top.key_actions[0] != '') {
//нажата клавиша enter
eval(top.key_actions[0]);
}
}
});
});
// 4.32
function qn_slk(obr) {
if (top.qst_sml != '') {
$('#qsst').fadeIn('fast');
$('#mini_qsst').fadeOut('fast');
$('#mini_qsst').html('');
top.qst_sml = '';
return
}
}