game/core1/static/scripts/location/auction.js
2022-06-07 00:30:34 +03:00

555 lines
28 KiB
JavaScript

// JavaScript Document
var locjs = {
data:{ },
type:0, //0 - ïðîñìîòð ðàçäåëîâ , 1 - ïðîñìîòð ðàçäåëîâ è êîíêðåòíîãî ïðåäìåòà , 2 - ïðîñìîòð ñâîèõ âåùåé (ñäà÷à) , 3 - ïðîñìîòð ñâîèõ âåùåé (çàáðàòü)
baseconnect:false,
start:function() {
this.getMenuHtml();
this.getTopMenu();
this.getDataItems(1);
//
locline.lineRefleshFinish();
},
reflesh:function() {
locline.lineRefleshFinish();
},
option_error:{
},
page_item:1,
option_item:1,
getDataItems:function( id ) {
this.option_item = id;
if( this.baseconnect == false ) {
locline.lineRefleshStart();
this.baseconnect = true;
$.getJSON('/core/auction/', {
'option_item':id,
'page':locjs.page_item,
},function(data) {
locjs.baseconnect = false;
//
locjs.data.user.massaNow = parseFloat(data.massaNow).toFixed(2);
locjs.data.user.massaMax = parseFloat(data.massaMax).toFixed(2);
locjs.data.user.money = parseFloat(data.money).toFixed(2);
//
if( data.toppages != undefined && data.toppages > 0 ) {
var tphtml = '';
var i = 1;
while( i <= data.toppages ) {
if( data.page == i ) {
tphtml = tphtml + '<a href="javascript:void(0);" onclick="locjs.page_item='+i+';locjs.getDataItems(locjs.option_item);" style="text-decoration: underline;">' + i + '</a> ';
}else{
tphtml = tphtml + '<a href="javascript:void(0);" onclick="locjs.page_item='+i+';locjs.getDataItems(locjs.option_item);">' + i + '</a> ';
}
i++;
}
$('#toppages_line').show();
$('#toppages').html( tphtml );
}else{
$('#toppages_line').hide();
$('#toppages').html( '--' );
}
//
if( data.item_data != undefined && data.item_data != 0 ) {
locjs.getItemsAuction( id , data.item_data );
}else{
locjs.getItemsAuction( id , {'x':0} );
}
//
$('#u_money').html( locjs.data.user.money + ' êð.' );
$('#u_massa').html( locjs.data.user.massaNow + '/' + locjs.data.user.massaMax );
//
locline.lineRefleshFinish();
//
});
}
},
console_sale:function(id, txt, kr) {
var s = prompt("Ñäåëàòü ñòàâêó íà \""+txt+"\". Óêàæèòå öåíó:", kr);
if ((s != null) && (s != '') && (s >= 0)) {
locjs.user_buy( id, kr );
}
},
buyItemsAuctionError:{
0:'',
1:'Ïðåäìåò íå íàéäåí, âîçìîæíî òîðãè óæå çàêîí÷èëèñü',
2:'Âû óæå ñäåëàëè ñòàâêó íà ýòîò ïðåäìåò, îæèäàéòå ïîêà å¸ ïåðåáüåò êòî-òî äðóãîé',
3:'Ìèíèìàëüíàÿ ñòàâêà 101% îò òåêóùåé ñòàâêè',
4:'Ìàêñèìàëüíàÿ ñòàâêà 200% îò òåêóùåé ñòàâêè',
5:'Ó âàñ íåäîñòàòî÷íî äåíåã äëÿ ñòàâêè',
6:'Âû íå ìîæåòå ó÷àñòâîâàòü â ñòàâêàõ íà ñâîè ïðåäìåòû'
},
user_buy:function( id, kr ) {
//
//this.option_item = id;
if( this.baseconnect == false ) {
locline.lineRefleshStart();
this.baseconnect = true;
$.getJSON('/core/auction/', {
'buy_item':id,
'kr':kr,
'page':locjs.page_item,
},function(data) {
locjs.baseconnect = false;
//
if( data.error != undefined ) {
if( locjs.buyItemsAuctionError[ data.error ] != undefined ) {
$('#error').html( locjs.buyItemsAuctionError[ data.error ] );
}else{
$('#error').html( 'Íåèçâåñòíàÿ îøèáêà. Êîä #'+data.error+'' );
}
$('#error').show();
$("body").animate({"scrollTop":0},0);
}else{
if( data.info != undefined ) {
alert('Âû óñïåøíî ñäåëàëè ñòàâêó!');
}
$('#error').html('');
$('#error').hide();
}
//
locline.lineRefleshFinish();
//
});
}
//
},
getItemsAuction:function( id , data ) {
var r = '';
if( id == 5 ) {
r += '<table width="100%" border="0" style="border:1px solid #a5a5a5;margin-top:5px;" cellspacing="0" cellpadding="0"><tr>'+
'<td align="center" valign="middle" bgcolor="#a5a5a5">Ïðåäìåò</td>'+
'<td width="144" align="center" valign="middle" bgcolor="#a5a5a5">&nbsp;</td>'+
'<td width="50%" align="center" valign="middle" bgcolor="#a5a5a5">&nbsp;</td>'+
'<td align="center" valign="middle" bgcolor="#a5a5a5">Óðîâåíü</td>'+
'<td align="center" valign="middle" bgcolor="#a5a5a5">Âëàäåëåö</td>'+
'<td align="center" valign="middle" bgcolor="#a5a5a5">Ñòàâêà</td>'+
'<td align="center" valign="middle" bgcolor="#a5a5a5">Ïîêóïàòåëü</td>'+
'<td align="center" valign="middle" bgcolor="#a5a5a5">Îñòàëîñü âðåìåíè</td>'+
'</tr>';
//ïðåäìåò
if( data.x != undefined && data.x > 0 ) {
var i = 0;
while( i < data.x ) {
if( data[i] != undefined ) {
var itm_data = itmjs.lookStats( data[i][20] );
if( itm_data['tr_lvl'] == undefined ) {
itm_data['tr_lvl'] = 0;
}
if( data[i].buy == '' ) {
data[i].buy = 'Íåò ïîêóïàòåëÿ';
}
if( data[i].user_ow == '' ) {
data[i].user_ow = '<i>Íåèçâåñòíî</i>';
}
if( data[i].time == '0 ñåê.' ) {
data[i].time = 'Òîðã çàêðûò.';
}
r += '<tr id="itm_auction' + data[i][22] + '">'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle"><img style="padding:10px;" onMouseOver="top.hi(this,\'' + this.replaceslashhint(itmjs.infoItem( data , i , 'auction_info' )) + '\',event,0,0,1,1,\'max-width:307px\')" onMouseOut="top.hic();" onMouseDown="top.hic();" src="https://img.new-combats.com/i/items/' + data[i][2] + '"></td>'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle"><button onclick="locjs.console_sale('+data[i].aid+',\''+data[i].name+'\',\'' + (data[i].prc2) + '\');" class="btn">Ñäåëàòü ñòàâêó</button></td>'+
//'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle"><img style="padding:10px;" src="https://img.new-combats.com/i/items/' + data[i][2] + '"><br><img src="https://img.new-combats.com/auc_watch_off.png" title="Îòñëåæèâàíèå (áóäåò îòîáðàæàòüñÿ â ðàçäåëå [Ñòàâêè])" class="cp"> <img src="https://img.new-combats.com/auc_bet1.png" title="Ñäåëàòü ñòàâêó" class="cp"></td>'+
'<td align="left" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;padding-left:10px;" valign="middle"><a onMouseOver="top.hi(this,\'' + this.replaceslashhint(itmjs.infoItem( data , i , 'auction_info' )) + '\',event,0,0,1,1,\'max-width:307px\')" onMouseOut="top.hic();" onMouseDown="top.hic();" href="https://new-combats.com/item/' + data[i].item_id + '" target="_blank">' + data[i].name + '</a> &nbsp; (Ìàññà: ' + data[i].massa + ')<br>Äîëãîâå÷íîñòü: ' + Math.ceil(data[i].iznosNOW) + '/' + Math.ceil(data[i].iznosMAX) + '</td>'+
//'<td align="left" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;padding-left:10px;" valign="middle">--</td>'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle">' + itm_data['tr_lvl'] + '</td>'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle">' + data[i].user_ow + '</td>'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle">' + data[i].prc + ' êð.</td>'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle">' + data[i].buy + '</td>'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle">' + data[i].time + '</td>'+
'</tr>';
//
}
i++;
}
}
r += '</table>';
if( data.x == undefined || data.x < 1 ) {
r += '<div style="border:1px solid #a5a5a5; padding:10px;" align="center">Íè÷åãî íå íàéäåíî</div>';
}
}else if( id == 1 ) {
r += '<table width="100%" border="0" style="border:1px solid #a5a5a5;margin-top:5px;" cellspacing="0" cellpadding="0"><tr>'+
'<td align="center" valign="middle" bgcolor="#a5a5a5">Ïðåäìåò</td>'+
'<td width="144" align="center" valign="middle" bgcolor="#a5a5a5">&nbsp;</td>'+
'<td width="50%" align="center" valign="middle" bgcolor="#a5a5a5">&nbsp;</td>'+
'<td align="center" valign="middle" bgcolor="#a5a5a5">Óðîâåíü</td>'+
'<td align="center" valign="middle" bgcolor="#a5a5a5">Âëàäåëåö</td>'+
'<td align="center" valign="middle" bgcolor="#a5a5a5">Ñòàâêà</td>'+
'<td align="center" valign="middle" bgcolor="#a5a5a5">Ïîêóïàòåëü</td>'+
'<td align="center" valign="middle" bgcolor="#a5a5a5">Îñòàëîñü âðåìåíè</td>'+
'</tr>';
//ïðåäìåò
if( data.x != undefined && data.x > 0 ) {
var i = 0;
while( i < data.x ) {
if( data[i] != undefined ) {
var itm_data = itmjs.lookStats( data[i][20] );
if( itm_data['tr_lvl'] == undefined ) {
itm_data['tr_lvl'] = 0;
}
if( data[i].buy == '' ) {
data[i].buy = 'Íåò ïîêóïàòåëÿ';
}
if( data[i].user_ow == '' ) {
data[i].user_ow = '<i>Íåèçâåñòíî</i>';
}
if( data[i].time == '0 ñåê.' ) {
data[i].time = 'Òîðã çàêðûò.';
}
r += '<tr id="itm_auction' + data[i][22] + '">'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle"><img style="padding:10px;" onMouseOver="top.hi(this,\'' + this.replaceslashhint(itmjs.infoItem( data , i , 'auction_info' )) + '\',event,0,0,1,1,\'max-width:307px\')" onMouseOut="top.hic();" onMouseDown="top.hic();" src="https://img.new-combats.com/i/items/' + data[i][2] + '"></td>'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle"><button onclick="locjs.console_sale('+data[i].aid+',\''+data[i].name+'\',\'' + (data[i].prc2) + '\');" class="btn">Ñäåëàòü ñòàâêó</button></td>'+
//'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle"><img style="padding:10px;" src="https://img.new-combats.com/i/items/' + data[i][2] + '"><br><img src="https://img.new-combats.com/auc_watch_off.png" title="Îòñëåæèâàíèå (áóäåò îòîáðàæàòüñÿ â ðàçäåëå [Ñòàâêè])" class="cp"> <img src="https://img.new-combats.com/auc_bet1.png" title="Ñäåëàòü ñòàâêó" class="cp"></td>'+
'<td align="left" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;padding-left:10px;" valign="middle"><a onMouseOver="top.hi(this,\'' + this.replaceslashhint(itmjs.infoItem( data , i , 'auction_info' )) + '\',event,0,0,1,1,\'max-width:307px\')" onMouseOut="top.hic();" onMouseDown="top.hic();" href="https://new-combats.com/item/' + data[i].item_id + '" target="_blank">' + data[i].name + '</a> &nbsp; (Ìàññà: ' + data[i].massa + ')<br>Äîëãîâå÷íîñòü: ' + Math.ceil(data[i].iznosNOW) + '/' + Math.ceil(data[i].iznosMAX) + '</td>'+
//'<td align="left" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;padding-left:10px;" valign="middle">--</td>'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle">' + itm_data['tr_lvl'] + '</td>'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle">' + data[i].user_ow + '</td>'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle">' + data[i].prc + ' êð.</td>'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle">' + data[i].buy + '</td>'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle">' + data[i].time + '</td>'+
'</tr>';
//
}
i++;
}
}
r += '</table>';
if( data.x == undefined || data.x < 1 ) {
r += '<div style="border:1px solid #a5a5a5; padding:10px;" align="center">Íè÷åãî íå íàéäåíî</div>';
}
}else if( id == 2 ) {
r += '<table width="100%" border="0" style="border:1px solid #a5a5a5;margin-top:5px;" cellspacing="0" cellpadding="0"><tr>'+
'<td align="center" valign="middle" bgcolor="#a5a5a5">Ïðåäìåò</td>'+
'<td width="50%" align="center" valign="middle" bgcolor="#a5a5a5">&nbsp;</td>'+
'<td align="center" valign="middle" bgcolor="#a5a5a5">Óðîâåíü</td>'+
'<td align="center" valign="middle" bgcolor="#a5a5a5">Âëàäåëåö</td>'+
'<td align="center" valign="middle" bgcolor="#a5a5a5">Ñòàâêà</td>'+
'<td align="center" valign="middle" bgcolor="#a5a5a5">Ïîêóïàòåëü</td>'+
'<td align="center" valign="middle" bgcolor="#a5a5a5">Îñòàëîñü âðåìåíè</td>'+
'</tr>';
//ïðåäìåò
if( data.x != undefined && data.x > 0 ) {
var i = 0;
while( i < data.x ) {
if( data[i] != undefined ) {
var itm_data = itmjs.lookStats( data[i][20] );
if( itm_data['tr_lvl'] == undefined ) {
itm_data['tr_lvl'] = 0;
}
if( data[i].buy == '' ) {
data[i].buy = 'Íåò ïîêóïàòåëÿ';
}
if( data[i].user_ow == '' ) {
data[i].user_ow = '<i>Íåèçâåñòíî</i>';
}
if( data[i].time == '0 ñåê.' ) {
data[i].time = 'Òîðã çàêðûò.';
}
r += '<tr id="itm_auction' + data[i][22] + '">'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle"><img style="padding:10px;" onMouseOver="top.hi(this,\'' + this.replaceslashhint(itmjs.infoItem( data , i , 'auction_info' )) + '\',event,0,0,1,1,\'max-width:307px\')" onMouseOut="top.hic();" onMouseDown="top.hic();" src="https://img.new-combats.com/i/items/' + data[i][2] + '"></td>'+
//'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle"><img style="padding:10px;" src="https://img.new-combats.com/i/items/' + data[i][2] + '"><br><img src="https://img.new-combats.com/auc_watch_off.png" title="Îòñëåæèâàíèå (áóäåò îòîáðàæàòüñÿ â ðàçäåëå [Ñòàâêè])" class="cp"> <img src="https://img.new-combats.com/auc_bet1.png" title="Ñäåëàòü ñòàâêó" class="cp"></td>'+
'<td align="left" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;padding-left:10px;" valign="middle"><a onMouseOver="top.hi(this,\'' + this.replaceslashhint(itmjs.infoItem( data , i , 'auction_info' )) + '\',event,0,0,1,1,\'max-width:307px\')" onMouseOut="top.hic();" onMouseDown="top.hic();" href="https://new-combats.com/item/' + data[i].item_id + '" target="_blank">' + data[i].name + '</a> &nbsp; (Ìàññà: ' + data[i].massa + ')<br>Äîëãîâå÷íîñòü: ' + Math.ceil(data[i].iznosNOW) + '/' + Math.ceil(data[i].iznosMAX) + '</td>'+
//'<td align="left" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;padding-left:10px;" valign="middle">--</td>'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle">' + itm_data['tr_lvl'] + '</td>'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle">' + data[i].user_ow + '</td>'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle">' + data[i].prc + ' êð.</td>'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle">' + data[i].buy + '</td>'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle">' + data[i].time + '</td>'+
'</tr>';
//
}
i++;
}
}
r += '</table>';
if( data.x == undefined || data.x < 1 ) {
r += '<div style="border:1px solid #a5a5a5; padding:10px;" align="center">Íè÷åãî íå íàéäåíî</div>';
}
}else if( id == 3 ) {
r += '<table width="100%" border="0" style="border:1px solid #a5a5a5;margin-top:5px;" cellspacing="0" cellpadding="0"><tr>'+
'<td width="120" align="center" valign="middle" bgcolor="#a5a5a5">Ïðåäìåò</td>'+
'<td width="50%" align="center" valign="middle" bgcolor="#a5a5a5">&nbsp;</td>'+
'<td align="center" valign="middle" bgcolor="#a5a5a5">Óðîâåíü</td>'+
'<td align="center" valign="middle" bgcolor="#a5a5a5">Ñòàâêà</td>'+
'<td align="center" valign="middle" bgcolor="#a5a5a5">Ïîêóïàòåëü</td>'+
'<td align="center" valign="middle" bgcolor="#a5a5a5">Îñòàëîñü âðåìåíè</td>'+
'</tr>';
//ïðåäìåò
if( data.x != undefined && data.x > 0 ) {
var i = 0;
while( i < data.x ) {
if( data[i] != undefined ) {
var itm_data = itmjs.lookStats( data[i][20] );
if( itm_data['tr_lvl'] == undefined ) {
itm_data['tr_lvl'] = 0;
}
if( data[i].buy == '' ) {
data[i].buy = 'Íåò ïîêóïàòåëÿ';
}
if( data[i].user_ow == '' ) {
data[i].user_ow = '<i>Íåèçâåñòíî</i>';
}
if( data[i].time == '0 ñåê.' ) {
data[i].time = 'Òîðã çàêðûò.';
}
r += '<tr id="itm_auction' + data[i][22] + '">'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle"><img style="padding:10px;" onMouseOver="top.hi(this,\'' + this.replaceslashhint(itmjs.infoItem( data , i , 'auction_info' )) + '\',event,0,0,1,1,\'max-width:307px\')" onMouseOut="top.hic();" onMouseDown="top.hic();" src="https://img.new-combats.com/i/items/' + data[i][2] + '"></td>'+
//'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle"><img style="padding:10px;" src="https://img.new-combats.com/i/items/' + data[i][2] + '"><br><img src="https://img.new-combats.com/auc_watch_off.png" title="Îòñëåæèâàíèå (áóäåò îòîáðàæàòüñÿ â ðàçäåëå [Ñòàâêè])" class="cp"> <img src="https://img.new-combats.com/auc_bet1.png" title="Ñäåëàòü ñòàâêó" class="cp"></td>'+
'<td align="left" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;padding-left:10px;" valign="middle"><a onMouseOver="top.hi(this,\'' + this.replaceslashhint(itmjs.infoItem( data , i , 'auction_info' )) + '\',event,0,0,1,1,\'max-width:307px\')" onMouseOut="top.hic();" onMouseDown="top.hic();" href="https://new-combats.com/item/' + data[i].item_id + '" target="_blank">' + data[i].name + '</a> &nbsp; (Ìàññà: ' + data[i].massa + ')<br>Äîëãîâå÷íîñòü: ' + Math.ceil(data[i].iznosNOW) + '/' + Math.ceil(data[i].iznosMAX) + '</td>'+
//'<td align="left" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;padding-left:10px;" valign="middle">--</td>'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle">' + itm_data['tr_lvl'] + '</td>'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle">' + data[i].prc + ' êð.</td>'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle">' + data[i].buy + '</td>'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle">' + data[i].time + '</td>'+
'</tr>';
//
}
i++;
}
}
r += '</table>';
if( data.x == undefined || data.x < 1 ) {
r += '<div style="border:1px solid #a5a5a5; padding:10px;" align="center">Íè÷åãî íå íàéäåíî</div>';
}
}else if( id == 4 ) {
if( locjs.data.user.silver >= 4 ) {
prcauc = 2.5;
}else{
prcauc = 10;
}
r += '<table width="100%" border="0" style="border:1px solid #a5a5a5;margin-top:5px;" cellspacing="0" cellpadding="0"><tr>'+
'<td width="120" align="center" valign="middle" bgcolor="#a5a5a5">Ïðåäìåò</td>'+
'<td width="50%" align="center" valign="middle" bgcolor="#a5a5a5">&nbsp;</td>'+
'<td align="center" valign="middle" bgcolor="#a5a5a5">Óðîâåíü</td>'+
'<td align="center" valign="middle" bgcolor="#a5a5a5">Íà÷àëüíàÿ ñòàâêà<br><small>(Âûñòàâëÿåòñÿ íà 24 ÷àñà. +' + prcauc + '% êîìèññèÿ)</small></td>'+
'</tr>';
//ïðåäìåò
if( data.x != undefined && data.x > 0 ) {
var i = 0;
while( i < data.x ) {
if( data[i] != undefined ) {
var itm_data = itmjs.lookStats( data[i][20] );
if( itm_data['tr_lvl'] == undefined ) {
itm_data['tr_lvl'] = 0;
}
r += '<tr id="itm_auction' + data[i][22] + '">'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle"><img style="padding:10px;" src="https://img.new-combats.com/i/items/' + data[i][2] + '"></td>'+
//'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle"><img style="padding:10px;" src="https://img.new-combats.com/i/items/' + data[i][2] + '"><br><img src="https://img.new-combats.com/auc_watch_off.png" title="Îòñëåæèâàíèå (áóäåò îòîáðàæàòüñÿ â ðàçäåëå [Ñòàâêè])" class="cp"> <img src="https://img.new-combats.com/auc_bet1.png" title="Ñäåëàòü ñòàâêó" class="cp"></td>'+
//'<td align="left" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;padding-left:10px;" valign="middle"><a href="https://new-combats.com/item/' + data[i].item_id + '" target="_blank">' + data[i].name + '</a> &nbsp; (Ìàññà: ' + data[i].massa + ')<br>Äîëãîâå÷íîñòü: ' + Math.ceil(data[i].iznosNOW) + '/' + Math.ceil(data[i].iznosMAX) + '</td>'+
'<td align="left" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;padding-left:10px;" valign="middle">' + itmjs.infoItem( data , i , 'auction_inventory' ) + '</td>'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle">' + itm_data['tr_lvl'] + '</td>'+
'<td align="center" style="border-top:1px solid #a5a5a5;border-right:1px solid #a5a5a5;" valign="middle"><input style="padding:5px;width:44px;text-align:center;" type="text" id="itm_add'+data[i][22]+'_price" value="0.00" /> êð. <input onclick="locjs.addItemsAuction(' + data[i][22] + ')" type="button" value="Âûñòàâèòü" class="btn" /></td>'+
'</tr>';
//
}
i++;
}
}
r += '</table>';
if( data.x == undefined || data.x < 1 ) {
r += '<div style="border:1px solid #a5a5a5; padding:10px;" align="center">Íè÷åãî íå íàéäåíî</div>';
}
}
$('#auction_content').html( r );
},
addItemsAuctionError:{
0:'Âñå ïðîøëî óñïåøíî',
1:'Ïîäõîäÿùèé ïðåäìåò íå íàéäåí ó âàñ â èíâåíòàðå',
2:'Íåëüçÿ ïðîäàòü ïðåäìåò äåøåâëå 1 êð.',
3:'Íåëüçÿ ïðîäàòü ïðåäìåò äîðîæå 1000000 êð.',
4:'Ó âàñ íåäîñòàòî÷íî êð. äëÿ âûñòàâëåíèÿ ïðåäìåòà. Òðåáóåòñÿ 10% îò âàøåé ñòàâêè.'
},
addItemsAuction:function(id) {
//
this.option_item = id;
if( this.baseconnect == false ) {
locline.lineRefleshStart();
this.baseconnect = true;
$.getJSON('/core/auction/', {
'add_item':id,
'price':$('#itm_add' + id + '_price').val(),
'page':locjs.page_item,
},function(data) {
locjs.baseconnect = false;
//
if( data.error != undefined ) {
if( locjs.addItemsAuctionError[ data.error ] != undefined ) {
$('#error').html( locjs.addItemsAuctionError[ data.error ] );
}else{
$('#error').html( 'Íåèçâåñòíàÿ îøèáêà. Êîä #'+data.error+'' );
}
$('#error').show();
$("body").animate({"scrollTop":0},0);
}else{
if( data.info != undefined ) {
if(data.info.x > 0) {
data.info.itm_name = data.info.itm_name + ' (x' + (1+data.info.x) + ')';
}
//$("body").animate({"scrollTop":0},0);
//$('#error').html( 'Âû óñïåøíî âûñòàâèëè ïðåäìåò &quot;' + data.info.itm_name + '&quot; íà ïðîäàæó çà ' + data.info.price + ' êð.' );
//$('#error').show();
$('#itm_auction' + data.info.id).hide();
}
$('#error').html('');
$('#error').hide();
}
//
locline.lineRefleshFinish();
//
});
}
//
},
getTopMenu:function() {
var r = '';
r += '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr>';
//
r += '<td align="left"><span class="maroontext">Ôèëèàë Àóêöèîíà</span> <b><u>(òåñòîâàÿ âåðñèÿ)</u></b></td>';
r += '<td align="right" id="toppages_line">Ñòðàíèöû: <span id="toppages">--</span> &nbsp; <button onclick="locjs.getDataItems(locjs.option_item);" class="btn">Îáíîâèòü</button></td>';
//
r += '</tr><tr>';
//
r += '<td align="left" valign="bottom"><table border="0" cellspacing="0" cellpadding="0"><tr>'
r += '<td style="padding:0 10px 0 10px;"><b>Çàëû:</b></td>';
r += '<td><div id="stylemenu1" class="asel"><a href="javascript:locjs.selectMenu(1);">Òîðãè</a></div></td>';
r += '<td><div id="stylemenu2" class="unasel"><a href="javascript:locjs.selectMenu(2);">Ñòàâêè</a></div></td>';
r += '<td><div id="stylemenu3" class="unasel"><a href="javascript:locjs.selectMenu(3);">Âàø ïðåäìåò</a></div></td>';
r += '<td><div id="stylemenu4" class="unasel"><a href="javascript:locjs.selectMenu(4);">Âûñòàâèòü ïðåäìåò</a></div></td>';
r += '<td><div id="stylemenu5" class="unasel"><a href="javascript:locjs.selectMenu(5);">Ðåäêèå ïðåäìåòû</a></div></td>';
r += '</tr></table></td>';
//
r += '<td style="display:none" align="right">Èìÿ: <input type="text" value=""> ';
r += '<select id="searchtype">'+
'<option value="0">Âñå</option>'+
'<option value="1">ñåðüãè</option>'+
'<option value="2">îæåðåëüÿ</option>'+
'<option value="3">îðóæèå</option>'+
'<option value="4">áðîíÿ</option>'+
'<option value="5">ïîÿñ</option>'+
'<option value="6">êîëüöî</option>'+
'<option value="7">øëåì</option>'+
'<option value="8">ùèò</option>'+
'<option value="9">ïåð÷àòêè</option>'+
'<option value="10">îáóâü</option>'+
'<option value="11">íàðó÷è</option>'+
'<option value="12">ðóáàõà</option>'+
'<option value="13">àìóíèöèÿ</option>'+
'<option value="14">çàêëèíàíèÿ</option>'+
'<option value="15">ýëèêñèðû</option>'+
'<option value="16">ìàòåðèàëû</option>'+
'<option value="17">Îñòàëüíûå</option>'+
'</select>';
r += ', óðîâåíü <input style="width:20px;text-align:center;" type="text" value="0">-<input style="width:20px;text-align:center;" type="text" value="21"> <button class="btn" >Ïîêàçàòü</button>';
r += '</td>'
//
r += '</tr></table>';
//
$('#auction_title').html( r );
//
//
//
},
getMenuHtml:function() {
var r = '';
r += '<div align="right">' + locline.line( this.data.user.timeGo, this.data.user.timeGoL , this.data.user.timeNow , 'locjs.reflesh();' ) +
'' + locline.room( this.data.locations ) + ''
+ '</div>';
//
r += '<br><small><div>Ó âàñ â íàëè÷èè: <b id="u_money" style="color:#339900;">' + this.data.user.money + ' êð.</b></div><div>Ìàññà: <span id="u_massa">' + parseInt(this.data.user.massaNow).toFixed(2) + '/' + parseInt(this.data.user.massaMax).toFixed(2) + '</span></div></small>';
//
$('#auction_menu').html( r );
locline.lineTimer();
},
selectMenu:function( id ) {
if( $('#stylemenu' + id).attr('id') == 'stylemenu' + id ) {
this.getDataItems( id );
var i = 1
while( i != - 1 ) {
if( $('#stylemenu' + i).attr('id') == 'stylemenu' + i ) {
//
$('#stylemenu' + i).removeClass('unasel');
$('#stylemenu' + i).removeClass('asel');
//
if( $('#stylemenu' + i).attr('id') == 'stylemenu' + id ) {
$('#stylemenu' + i).addClass('asel');
}else{
$('#stylemenu' + i).addClass('unasel');
}
//
}else{
i = -2;
}
i++;
}
}else{
alert('Ðàçäåë íå íàéäåí');
}
},
error:function( text ) {
$('#error').html( text );
if( text == '' ) {
$('#error').hide();
}else{
$('#error').show();
}
},
replaceslashhint:function(data) {
data = this.str_replace('"','',data);
data = this.str_replace("'","",data);
return data;
},
str_replace:function(search, replace, subject, count) {
var i = 0,
j = 0,
temp = '',
repl = '',
sl = 0,
fl = 0,
f = [].concat(search),
r = [].concat(replace),
s = subject,
ra = Object.prototype.toString.call(r) === '[object Array]',
sa = Object.prototype.toString.call(s) === '[object Array]';
s = [].concat(s);
if (count) {
this.window[count] = 0;
}
for (i = 0, sl = s.length; i < sl; i++) {
if (s[i] === '') {
continue;
}
for (j = 0, fl = f.length; j < fl; j++) {
temp = s[i] + '';
repl = ra ? (r[j] !== undefined ? r[j] : '') : r[0];
s[i] = (temp)
.split(f[j])
.join(repl);
if (count && s[i] !== temp) {
this.window[count] += (temp.length - s[i].length) / f[j].length;
}
}
}
return sa ? s : s[0];
}
};