game/_incl_data/class/dialog.class.php
2022-06-07 00:30:34 +03:00

1501 lines
62 KiB
PHP

<?
if(!defined('GAME'))
{
die();
}
class dialog
{
public $info,$dText = '',$aText = '',$youInfo = '',$botInfo = '',$title = '',$p = 1,$pg = 1;
public function trnObj($x,$j)
{
$r = array(0=>0,1=>0);
$i = floor($x/$j);
$r = array(0=>$i,1=>$x-($i*$j));
return $r;
}
public function objLevel($t,$l)
{
$i = 1;
$r = 0;
while($i<=$l)
{
if(isset($t[$i]))
{
$r = $t[$i];
}
$i++;
}
return $r;
}
public function start($id)
{
global $u,$q,$c,$d,$code;
$this->info = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_dialog` WHERE `id` = "'.mysql_real_escape_string((int)$id).'" LIMIT 1'));
if(isset($this->info['id']))
{
$pg = 1;
$go = 1;
$txt = '';
//Ïåðåõîä ïî ñòðàíèöàì
if(isset($_GET['act']))
{
$ta = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_dlg` WHERE `type` = "0" AND `id` = "'.mysql_real_escape_string((int)$_GET['act']).'" AND `id_dg` = "'.$this->info['id'].'" LIMIT 1'));
if(isset($ta['id']))
{
$ta['action'] = $this->ltr($ta['action']);
$act = explode('|',$ta['action']);
$go1 = 1;
$needRep = array();
if($ta['tr'] != '') {
$i = 0;
$x = explode('|',$ta['tr']);
while($i < count($x)) {
//Òðåáîâàíèÿ
$k = explode('=',$x[$i]);
if($k[0]=='data') {
$date = explode('-',$k[1]);
$dd1 = $date[0];
$mm1 = $date[1];
$dd2 = $date[2];
$mm2 = $date[3];
$date1 = strtotime($dd1.'-'.$mm1.'-'.date('Y'));
$date2 = strtotime($dd2.'-'.$mm2.'-'.date('Y'));
if( $date1 > time() || $date2 < time() ) {
$go1 = 'delete';
$i = count($x);
}
}elseif($k[0]=='diact') {
//Äåéñòâèÿ
//user_id # all # all # lukaqst1 # -1
if($this->quest_act($k[1])==false) {
$go1 = 'delete';
$i = count($x);
}
}elseif($k[0]=='quest_end') {
//Êâåñò ìîæíî âûïîëíÿòü íåñêîëüêî ðàç â òåêóùåé ïåùåðå
$qlst = mysql_fetch_array(mysql_query('SELECT `id`,`vals` FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `vars` = "start_quest'.$k[1].'" ORDER BY `id` DESC LIMIT 1'));
if(isset($qlst['id']) && $qlst['vals'] != 'win' && $qlst['vals'] != 'end' && $qlst['vals'] != 'bad') {
$go1 = 0;
$txt .= '<br><b><font color=red>×òî-òî íå òàê, Âû óæå âçÿëè äàííîå çàäàíèå...</font>';
$pg = $ta['page'];
}
}elseif($k[0]=='quest_only_one') {
//Êâåñò ìîæíî âûïîëíÿòü òîëüêî îäèí ðàç
$qlst = mysql_fetch_array(mysql_query('SELECT `id`,`vals` FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `vars` = "start_quest'.$k[1].'" ORDER BY `id` DESC LIMIT 1'));
if(isset($qlst['id']) && ($qlst['vals'] == 'win' || $qlst['vals'] == 'bad')) {
$go1 = 0;
$txt .= '<br><b><font color=red>×òî-òî íå òàê, Âû óæå âûïîëíÿëè äàííîå çàäàíèå...</font>';
$pg = $ta['page'];
}
}elseif($k[0]=='quest_now') {
//Êâåñò äîëæåí áûòü âçÿò
$qlst = mysql_fetch_array(mysql_query('SELECT `id`,`vals` FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `vars` = "start_quest'.$k[1].'" ORDER BY `id` DESC LIMIT 1'));
if(isset($qlst['id']) && $qlst['vals'] != 'win' && $qlst['vals'] != 'end' && $qlst['vals'] != 'bad'){}else{
$go1 = 0;
$txt .= '<br><b><font color=red>×òî-òî íå òàê, òðåáóåòñÿ âçÿòü çàäàíèå...</font>';
$pg = $ta['page'];
}
}elseif($k[0]=='tr_itm') {
//Êâåñò òðåáóåò ïðåäìåò
$qlst = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "'.$k[1].'" AND `inOdet` = 0 AND `inTransfer` = 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1'));
if($qlst[0] < $k[2]){
$go1 = 0;
$itmqs = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "'.$k[1].'" LIMIT 1'));
if(isset($itmqs['id'])) {
$txt .= '<br><b><font color=red>Òðåáóåòñÿ ïðåäìåò &quot;'.$itmqs['name'].'&quot; (x'.$k[2].').</font>';
}
$pg = $ta['page'];
}
}elseif($k[0]=='tr_itmodet') {
//Êâåñò òðåáóåò ïðåäìåò
$k[1] = str_replace(',','" OR `item_id` = "',$k[1]);
$qlst = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND (`item_id` = "'.$k[1].'") AND `inOdet` > 0 AND `inTransfer` = 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1'));
if(!isset($qlst['id'])){
$go1 = 0;
$itmqs = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "'.$k[1].'" LIMIT 1'));
if(isset($itmqs['id'])) {
$txt .= '<br><b><font color=red>Òðåáóåòñÿ ïðåäìåò &quot;'.$itmqs['name'].'&quot;.</font>';
}
$pg = $ta['page'];
}
}elseif($k[0]=='tr_noitmodet') {
//Êâåñò òðåáóåò ïðåäìåò
$k[1] = str_replace(',','" OR `item_id` = "',$k[1]);
$qlst = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND (`item_id` = "'.$k[1].'") AND `inOdet` > 0 AND `inTransfer` = 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1'));
if(isset($qlst['id'])){
$go1 = 0;
$itmqs = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "'.$k[1].'" LIMIT 1'));
if(isset($itmqs['id'])) {
$txt .= '<br><b><font color=red>Ó âàñ óæå åñòü òðåáóåìûé ïðåäìåò &quot;'.$itmqs['name'].'&quot;.</font>';
}
$pg = $ta['page'];
}
}elseif($k[0]=='tr_noitm') {
//Êâåñò òðåáóåò ïðåäìåò
$k[1] = str_replace(',','" OR `item_id` = "',$k[1]);
$qlst = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND (`item_id` = "'.$k[1].'") AND `inTransfer` = 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1'));
if(isset($qlst['id'])){
$go1 = 0;
$itmqs = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "'.$k[1].'" LIMIT 1'));
if(isset($itmqs['id'])) {
$txt .= '<br><b><font color=red>Ó âàñ óæå åñòü òðåáóåìûé ïðåäìåò &quot;'.$itmqs['name'].'&quot;.</font>';
}
$pg = $ta['page'];
}
}elseif($k[0]=='del_itm') {
//Êâåñò óäàëÿåò ïðåäìåò
$qlst = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "'.$k[1].'" AND `inOdet` = 0 AND `inTransfer` = 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1'));
if(isset($qlst['id'])){
$itmqs = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "'.$k[1].'" LIMIT 1'));
if(isset($itmqs['id'])) {
if(mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `id` = "'.$qlst['id'].'" LIMIT 1')) {
$txt .= '<br><b><font color=red>Âû îòäàëè &quot;'.$itmqs['name'].'&quot;</font>';
}
}
$pg = $ta['page'];
}
} elseif( $k[0] == 'needRep' ) {
// ðàçãîâîð òðåáóåò ðåïóòàöèè â ïåùåðå.
$temp = explode(',', $k[1]);
$needRep = array('city' => $temp[0], 'rep' => (int)$temp[1]);
if( isset($needRep) ) { # Ïðîâåðÿåì ðåïóòàöèþ.
if($u->rep['rep'.$needRep['city']] < $needRep['rep'] ) {
$swapActStatus = 0;
$go1 = 0;
$txt = '<font color=red>ß òåáÿ ðàíüøå çäåñü íå âèäåë, óõîäè ïðî÷ü íåãîäíèê!</font>';
$pg = $ta['page'];
}
}
}
$i++;
}
}
if(isset($act[1]) && $go1 == 1){
$act1 = explode('=',$act[1]);
$act0 = explode('=',$act[0]);
if( $act0[0] == 'fileqst' ) {
if(file_exists('_incl_data/class/quest/'.htmlspecialchars($act0[1]).'.php')) {
include('_incl_data/class/quest/'.htmlspecialchars($act0[1]).'.php');
}else{
$txt .= '<br><b><font color=red>Êâåñò íå íàéäåí â ñïèñêàõ NPS...</b></font>';
}
$pg = $act[1];
}elseif( $act[0]=='dialog_act_update') {
$act33 = $this->dialog_act_update($act[2]);
if( $act33[0] == false ) {
if( $act33[1] == '' ) {
$txt .= '<br><b><font color=red>×òî-òî ïîøëî íå òàê...</b></font>';
}else{
$txt .= '<br><b><font color=red>'.$act33[1].'</font></b>';
}
}else{
$txt .= '<br><b><font color=red>'.$act33[1].'</font></b>';
}
$pg = $act[1];
}elseif( $act[0]=='quest_act' ) {
$txt .= '<br><b><font color=red>Âû ïîëó÷èëè íîâîå çàäàíèå.</b></font>';
mysql_query('INSERT INTO `dialog_act` (
`uid`,`city`,`time`,`var`,`val`,`btl_bot`,`itms`,`now`,`max`,`info`
) VALUES (
"'.$u->info['id'].'","'.$u->info['city'].'","'.time().'","'.mysql_real_escape_string($act1[0]).'","'.mysql_real_escape_string($act1[1]).'"
,"'.mysql_real_escape_string($act1[3]).'","'.mysql_real_escape_string($act1[4]).'","'.mysql_real_escape_string($act1[5]).'","'.mysql_real_escape_string($act1[6]).'","'.mysql_real_escape_string($act1[7]).'"
)');
$pg = $act1[2];
if( $act1[8] != 0 ) {
//Âûäàåì ïðåäìåò äëÿ êâåñòà
$itmb = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$act1[8].'" LIMIT 1'));
if(isset($itmb['id'])) {
$u->addItem($act1[8],$u->info['id'],'|nodelete=1');
$txt .= '<br><b><font color=red>Âû ïîëó÷èëè ïðåäìåò &quot;'.$itmb['name'].'&quot;</font></b>';
}
}
}elseif( $act[0]=='buyitm' ) {
$itmb = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$act1[0].'" LIMIT 1'));
if(isset($itmb['id'])) {
if( $u->info['money'] < $act1[1] ) {
$txt .= '<br><b><font color=red>Âàì íå õâàòàåò äåíåã äëÿ ïîêóïêè &quot;'.$itmb['name'].'&quot;, òðåáóåòñÿ '.$act1[1].' êð.';
}else{
$act1dt = '';
$txt .= '<br><b><font color=red>Âû óñïåøíî ïðèîáðåëè &quot;'.$itmb['name'].'&quot;';
if($act1[1] > 0) {
$txt .= ' çà '.$act1[1].' êð.';
$u->info['money'] -= $act1[1];
mysql_query('UPDATE `users` SET `money` = "'.$u->info['money'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
}
if($act1[2] > 0) {
$txt .= ' çà '.$act1[2].' åêð.';
}
if( $act1[3] > 0 ) {
$txt .= ' íà ñðîê '.$u->timeOut($act1[3]).'';
$act1dt .= '|srok='.$act1[3].'';
}
$txt .= '</font></b>';
$u->addItem($itmb['id'],$u->info['id'],$act1dt);
$pg = $act1[4];
}
}else{
$txt .= '<br><b><font color=red>Íåóäàëîñü ïðèîáðåñòè ïðåäìåò...</font></b>';
$pg = 1;
}
}elseif( $act1[0]=='quest' ) {
$pg = $act1[1];
$act2 = explode('=',$act[1]);
if($act2[0] > 0 && $q->testGood($act2[0])==1) {
//âûäàåì êâåñò
if($act2[1]!='0') {
//Âûäà÷à ïðåäìåòà
$ic1 = 0;
$act21 = explode(',',$act2[1]);
while($ic1 < count($act21)) {
$act3 = explode('-',$act21[$ic1]);
$itmqs = mysql_fetch_array(mysql_query('SELECT `id`,`name` FROM `items_main` WHERE `id` = "'.$act3[0].'" LIMIT 1'));
if(isset($itmqs['id'])) {
if($act3[2] > 1) {
//íåñêîëüêî
$txt .= '<br><b><font color=red>Âû ïîëó÷èëè ïðåäìåò &quot;'.$itmqs['name'].'&quot; (x'.$act3[2].' øò.).</font></b>';
}else{
//îäèí
$txt .= '<br><b><font color=red>Âû ïîëó÷èëè êâåñòîâûé ïðåäìåò &quot;'.$itmqs['name'].'&quot;.</font></b>';
}
$ic2 = 1;
while($ic2 <= $act3[2]) {
$u->addItem($itmqs['id'],$u->info['id'],'|quest_item=1',array('del'=>$act3[3]));
$ic2++;
}
}
$ic1++;
}
}
$q->startq($act2[0]);
$txt .= '<br><b><font color=red>'.$u->error.'.</font></b>';
$u->error = '';
} else {
$txt .= '<br><b><font color=red>Íå óäàëîñü ïîëó÷èòü çàäàíèå, íå ñîîòâåòñòâóþò óñëîâèÿ ïîëó÷åíèÿ...</font></b>';
}
} elseif($act[0]=='go' && $go1 == 1) {
$pg = $act[1];
} elseif($act[0]=='atackbot' && $go1 == 1) {
//Íàïàäåíèå íà ìîíñòðà
if( round((int)$act[1]) > 0 ) {
$btl_id = 0;
//$expB = -77.77;
$expB = 0;
$btl = array(
'players'=>'',
'timeout'=>180,
'type'=>0,
'invis'=>0,
'noinc'=>0,
'travmChance'=>0,
'typeBattle'=>0,
'addExp'=>$expB,
'money'=>0
);
$ins = mysql_query('INSERT INTO `battle` (`dungeon`,`dn_id`,`x`,`y`,`city`,`time_start`,`players`,`timeout`,`type`,`invis`,`noinc`,`travmChance`,`typeBattle`,`addExp`,`money`) VALUES (
"'.$d->info['id2'].'",
"'.$d->info['id'].'",
"'.$u->info['x'].'",
"'.$u->info['y'].'",
"'.$u->info['city'].'",
"'.time().'",
"'.$btl['players'].'",
"'.$btl['timeout'].'",
"'.$btl['type'].'",
"'.$btl['invis'].'",
"'.$btl['noinc'].'",
"'.$btl['travmChance'].'",
"'.$btl['typeBattle'].'",
"'.$btl['addExp'].'",
"'.$btl['money'].'")');
$btl_id = mysql_insert_id();
if($btl_id > 0) {
//Äîáàâëÿåì áîòîâ
$k = $u->addNewbot(round((int)$act[1]),NULL,NULL,array());
mysql_query('UPDATE `users` SET `battle` = "'.$btl_id.'" WHERE `id` = "'.$k['id'].'" LIMIT 1');
mysql_query('UPDATE `stats` SET `x`="'.$u->info['x'].'",`y`="'.$u->info['y'].'",`team` = "2" WHERE `id` = "'.$k['id'].'" LIMIT 1');
mysql_query('UPDATE `users` SET `battle` = "'.$btl_id.'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
mysql_query('UPDATE `stats` SET `team` = "1" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
}
header('location: main.php');
}else{
echo '<b><font title="'.$act[1].'" color=red>Ïîåäèíîê ïî÷åìó-òî íå íà÷àëñÿ...</font></b>';
}
die();
} elseif($act[0]=='goroom' && $go1 == 1) {
$u->info['room'] = $act[1];
mysql_query('UPDATE `users` SET `room` = "'.$u->info['room'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
header('location: main.php');
die();
} elseif($act[0]=='transfer2' && $go1 == 1) {
//Îáìåííèê òûêâîãîëîâîãî
$txt = '';
$xtik = 0; //Òðåáóåòñÿ òûêâ
if( $act[1] == 1 && true == false ) {
$txt .= 'Îáìåí 1...';
$xtik = 10;
$itik = 4465;
}elseif( $act[1] == 2 ) {
$txt .= 'Îáìåí 2...';
$xtik = 15;
$itik = 2143;
}elseif( $act[1] == 3 ) {
$txt .= 'Îáìåí 3...';
$xtik = 15;
$itik = 2144;
}elseif( $act[1] == 4 && true == false ) {
$txt .= 'Îáìåí 4...';
$xtik = 6;
//àðò âîèíà
$itik = -1;
}elseif( $act[1] == 5 && true == false ) {
$txt .= 'Îáìåí 5...';
$xtik = 6;
//àðò ìàãà
$itik = -2;
}elseif( $act[1] == 6 ) {
$txt .= 'Îáìåí 6...';
$xtik = 50;
//çíà÷îê 1
$itik = -3;
}elseif( $act[1] == 7 ) {
$txt .= 'Îáìåí 7...';
$xtik = 70;
//çíà÷îê 2
$itik = -4;
}else{
$txt .= 'Òûêâîãîëîâûé íå ìåíÿåò ýòîò õëàì...';
}
$txt = 'Îáìåííèê íà÷íåò ñâîþ ðàáîòó 3 íîÿáðÿ';
$itms = array();
$sp = mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "4504" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 100');
while($pl = mysql_fetch_array($sp)) {
$itms[$pl['item_id']]++;
}
$t = $this->trnObj($itms[4504],$xtik);
if($t[0] > 0) {
// $t[0] - ñêîëüêî ïðåäìåòîâ íàãðàäû äàåì, $cn[$i]['add'][0] - item_id ïðåäìåòà íàãðàäû
//óäàëÿåì èíãðèäèåíòû
$gdtik = 1;
if( $gdtik == 1 ) {
$upd = mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "4504" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" ORDER BY `inGroup` ASC LIMIT '.$xtik.'');
//echo 'UPDATE `items_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "4504" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT '.$t[0].'';
if($upd) {
if( $itik > 0 ) {
//Âûäàåì ïðåäìåòû
$u->addItem($itik,$u->info['id'],'|nosale=1|srok='.(7*86400).'',NULL,1);
$itm_nm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "'.$itik.'" LIMIT 1'));
$txt = 'Âû ïîëó÷èëè ïðåäìåò &quot;'.$itm_nm['name'].'&quot;';
}else{
//×òî-òî óíèêàëüíîå
if( $itik == -1 ) {
//Àðòåôàêò âîèí
$arts_1 = array();
$arts_lvl = $u->info['level'];
if( $arts_lvl < 4 ) {
$arts_lvl = 4;
}elseif( $arts_lvl > 10 ) {
$arts_lvl = 10;
}
$sp1 = mysql_query('SELECT `items_id` FROM `items_main_data` WHERE `data` LIKE "%|art=%" AND `data` LIKE "%tr_lvl='.$arts_lvl.'%" AND `data` NOT LIKE "%|tr_s5=%" AND `data` NOT LIKE "%|add_s6=%" AND `data` NOT LIKE "%|tr_s6=%"');
while( $pl1 = mysql_fetch_array($sp1) ) {
$arts_1[] = $pl1['items_id'];
}
$arts_1 = $arts_1[rand(0,count($arts_1)-1)];
if( $arts_1 > 0 ) {
$u->addItem($arts_1,$u->info['id'],'|sroknext=1|nosale=1|sleep_moroz=1|srok='.(86400/2).'',NULL,100);
}
$itm_nm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "'.$arts_1.'" LIMIT 1'));
$txt = 'Âû ïîëó÷èëè àðòåôàêò äëÿ âîèíà &quot;'.$itm_nm['name'].'&quot; íà ñðîê 12 ÷àñîâ.';
}elseif( $itik == -2 ) {
//Àðòåôàêò ìàãà
$arts_1 = array();
$arts_lvl = $u->info['level'];
if( $arts_lvl < 4 ) {
$arts_lvl = 4;
}elseif( $arts_lvl > 10 ) {
$arts_lvl = 10;
}
$sp1 = mysql_query('SELECT `items_id` FROM `items_main_data` WHERE `data` LIKE "%|art=%" AND `data` LIKE "%tr_lvl='.$arts_lvl.'%" AND ( `data` LIKE "%|tr_s6=%" OR `data` LIKE "%|add_s6=%")');
while( $pl1 = mysql_fetch_array($sp1) ) {
$arts_1[] = $pl1['items_id'];
}
$arts_1 = $arts_1[rand(0,count($arts_1)-1)];
if( $arts_1 > 0 ) {
$u->addItem($arts_1,$u->info['id'],'|sroknext=1|nosale=1|sleep_moroz=1|srok='.(86400/2).'',NULL,100);
}
$itm_nm = mysql_fetch_array(mysql_query('SELECT `name` FROM `items_main` WHERE `id` = "'.$arts_1.'" LIMIT 1'));
$txt = 'Âû ïîëó÷èëè àðòåôàêò äëÿ ìàãà &quot;'.$itm_nm['name'].'&quot; íà ñðîê 12 ÷àñîâ.';
}elseif( $itik == -3 ) {
//Çíà÷îê +1
mysql_query('DELETE FROM `users_ico` WHERE `uid` = "'.$u->info['id'].'" AND (`img` = "helloween_2014m1.gif" OR `img` = "helloween_2014m2.gif")');
mysql_query('INSERT INTO `users_ico` (`uid`,`time`,`text`,`img`,`endTime`,`bonus`,`type`,`x`) VALUES (
"'.$u->info['id'].'",
"'.time().'",
"<b>Õýëëîóèí</b>`'.date('Y').'<br>Îáûêíîâåííûé ñîáèðàòåëü òûêâ!",
"helloween_2014m1.gif",
"'.(time()+86400*365).'",
"add_m10=15|add_m11=15",
"1",
"1"
)');
$txt = 'Âû ïîëó÷èëè çíà÷îê &quot;Õýëëîóèí`'.date('Y').' Îáûêíîâåííûé&quot;';
}elseif( $itik == -4 ) {
//Çíà÷îê +5
mysql_query('DELETE FROM `users_ico` WHERE `uid` = "'.$u->info['id'].'" AND (`img` = "helloween_2014m1.gif" OR `img` = "helloween_2014m2.gif")');
mysql_query('INSERT INTO `users_ico` (`uid`,`time`,`text`,`img`,`endTime`,`bonus`,`type`,`x`) VALUES (
"'.$u->info['id'].'",
"'.time().'",
"<b>Õýëëîóèí</b>`'.date('Y').'<br>Ëó÷øèé ñîáèðàòåëü òûêâ!",
"helloween_2014m2.gif",
"'.(time()+86400*365).'",
"add_m10=15|add_m11=15",
"1",
"1"
)');
$txt = 'Âû ïîëó÷èëè çíà÷îê &quot;Õýëëîóèí`'.date('Y').' Ëó÷øèé&quot;';
}
}
}
}else{
$txt = 'Íåóäàëîñü ñîâåðøèòü îáìåí...';
}
}else{
$txt = 'Íåäîñòàòî÷íî òûêâ äëÿ îáìåíà...';
}
if($txt!=''){
$txt = '<br><font color="red">'.$txt.'</font>';
}
$pg = 3;
} elseif($act[0]=='transfer1' && $go1 == 1) {
//Ìåíÿåì ãàéêè è ïðî÷èé ìóñîð èç êàíàëèçàöèè íà æåòîíû
//ÈÕ áîëüøå ó òåáÿ íåòó... Íåñè åùå, Ëóêå íóæíî áîëüøå ÈÕ!
$pg = $act[1]; $itms = array();
$sp = mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND (`item_id` = "1002" OR `item_id` = "1003" OR `item_id` = "1004" OR `item_id` = "1005" OR (`item_id` >= "1009" AND`item_id` <= "1014")) AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 250');
while($pl = mysql_fetch_array($sp)) {
$itms[$pl['item_id']]++;
}
//Ïðåäìåòû
$cn = array(
0 => 3, //êîë-âî êëàññèôèêàöèé
1 => array(
//ãàéêà
1 => array('n'=>'Ãàéêà',0=>1002,1=>3,7=>9,8=>15),
//áîëò
2 => array('n'=>'Áîëò',0=>1003,1=>1,7=>3,8=>5),
//âåíòèëü
3 => array('n'=>'Âåíòèëü',0=>1005,1=>(1/3),7=>1,8=>2),
'add' => array(0=>1006,1=>'Æåòîí') //ïðåäìåò âîçíàãðàæäåíèÿ, áðîíçîâûé æåòîí
), //áðîíçà
2 => array(
//ãàéêà
1 => array('n'=>'×èñòàÿ ãàéêà',0=>1009,1=>3,7=>9,8=>15),
//áîëò
2 => array('n'=>'Äëèííûé Áîëò',0=>1010,1=>1,7=>3,8=>5),
//âåíòèëü
3 => array('n'=>'×èñòûé âåíòèëü',0=>1011,1=>(1/3),7=>1,8=>2),
'add' => array(0=>1007,1=>'Ñåðåáðÿíûé æåòîí') //ïðåäìåò âîçíàãðàæäåíèÿ, áðîíçîâûé æåòîí
), //ñåðåáðî
3 => array(
//ãàéêà
1 => array('n'=>'Ãàéêà ñ Ðåçüáîé',0=>1012,1=>3,7=>9,8=>15),
//áîëò
2 => array('n'=>'Íóæíûé áîëò',0=>1013,1=>1,7=>3,8=>5),
//âåíòèëü
3 => array('n'=>'Ðàáî÷èé âåíòèëü',0=>1014,1=>(1/3),7=>1,8=>2),
'add' => array(0=>1008,1=>'Çîëîòîé æåòîí') //ïðåäìåò âîçíàãðàæäåíèÿ, áðîíçîâûé æåòîí
) //çîëîòî
);
$i = 1;
while($i<=$cn[0])
{
$j = 1;
while($j<count($cn[$i][$j]))
{
$t = $cn[$i][$j];
$t = $this->trnObj($itms[$cn[$i][$j][0]],$this->objLevel($cn[$i][$j],$u->info['level']));
if($t[0]>0)
{
// $t[0] - ñêîëüêî ïðåäìåòîâ íàãðàäû äàåì, $cn[$i]['add'][0] - item_id ïðåäìåòà íàãðàäû
//óäàëÿåì èíãðèäèåíòû
$upd = mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "'.$cn[$i][$j][0].'" AND `delete` = "0" AND `inOdet` = "0" AND `inShop` = "0" LIMIT '.($t[0]*$this->objLevel($cn[$i][$j],$u->info['level'])).'');
if($upd)
{
$data = '|frompisher='.$d->info['id2'];
$e = 1;
while($e<=$t[0])
{
$u->addItem($cn[$i]['add'][0],$u->info['id'],$data);
$e++;
}
$txt .= $cn[$i][$j]['n'].' x'.($t[0]*$this->objLevel($cn[$i][$j],$u->info['level'])).' = '.$cn[$i]['add'][1].' x'.$t[0].'<br>';
}else{
$txt .= 'Íå óäàëîñü îáìåíÿòü ïðåäìåò &quot;'.$cn[$i][$j]['n'].'&quot;, ÷òî-òî íå òàê ...<br>';
}
}
$j++;
}
$i++;
}
if($txt!='') {
$txt = '<br><font color="red">'.$txt.'</font>';
}
} elseif($act[0]=='transfer3' && $go1 == 1) {
//ÈÕ áîëüøå ó òåáÿ íåòó... Íåñè åùå, Ëóêå íóæíî áîëüøå ÈÕ!
//Ñåðåáðî íà çîëîòî, 3 ê 1
$pg = $act[1]; $itms = array();
$sp = mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "1007" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 250');
while($pl = mysql_fetch_array($sp)) {
$itms[$pl['item_id']]++;
}
//Ïðåäìåòû
$cn = array(
0 => 1, //êîë-âî êëàññèôèêàöèé
1 => array(
//ãàéêà
1 => array('n'=>'Ñåðåáðÿíûé æåòîí',0=>1007,1=>3,7=>3,8=>3),
'add' => array(0=>1008,1=>'Çîëîòîé æåòîí') //ïðåäìåò âîçíàãðàæäåíèÿ, áðîíçîâûé æåòîí
)
);
$i = 1;
while($i<=$cn[0])
{
$j = 1;
while($j<count($cn[$i][$j]))
{
$t = $cn[$i][$j];
$t = $this->trnObj($itms[$cn[$i][$j][0]],$this->objLevel($cn[$i][$j],$u->info['level']));
if($t[0]>0)
{
// $t[0] - ñêîëüêî ïðåäìåòîâ íàãðàäû äàåì, $cn[$i]['add'][0] - item_id ïðåäìåòà íàãðàäû
//óäàëÿåì èíãðèäèåíòû
$upd = mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "'.$cn[$i][$j][0].'" AND `delete` = "0" AND `inOdet` = "0" AND `inShop` = "0" LIMIT '.($t[0]*$this->objLevel($cn[$i][$j],$u->info['level'])).'');
if($upd)
{
$data = '|frompisher='.$d->info['id2'];
$e = 1;
while($e<=$t[0])
{
$u->addItem($cn[$i]['add'][0],$u->info['id'],$data);
$e++;
}
$txt .= $cn[$i][$j]['n'].' x'.($t[0]*$this->objLevel($cn[$i][$j],$u->info['level'])).' = '.$cn[$i]['add'][1].' x'.$t[0].'<br>';
}else{
$txt .= 'Íå óäàëîñü îáìåíÿòü ïðåäìåò &quot;'.$cn[$i][$j]['n'].'&quot;, ÷òî-òî íå òàê ...<br>';
}
}
$j++;
}
$i++;
}
if($txt!='') {
$txt = '<br><font color="red">'.$txt.'</font>';
}
} elseif($act[0]=='transfer4' && $go1 == 1) {
//ÈÕ áîëüøå ó òåáÿ íåòó... Íåñè åùå, ìíå íóæíî áîëüøå ÈÕ!
//Çàñîðû ê çîëîòó, 20 ê 1
$pg = $act[1]; $itms = array();
$sp = mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "4728" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 250');
while($pl = mysql_fetch_array($sp)) {
$itms[$pl['item_id']]++;
}
//Ïðåäìåòû
$cn = array(
0 => 1, //êîë-âî êëàññèôèêàöèé
1 => array(
//ãàéêà
1 => array('n'=>'Çàñîðû',0=>4728,1=>20,7=>20,8=>20),
'add' => array(0=>1008,1=>'Çîëîòîé æåòîí') //ïðåäìåò âîçíàãðàæäåíèÿ, áðîíçîâûé æåòîí
)
);
$i = 1;
while($i<=$cn[0])
{
$j = 1;
while($j<count($cn[$i][$j]))
{
$t = $cn[$i][$j];
$t = $this->trnObj($itms[$cn[$i][$j][0]],$this->objLevel($cn[$i][$j],$u->info['level']));
if($t[0]>0)
{
// $t[0] - ñêîëüêî ïðåäìåòîâ íàãðàäû äàåì, $cn[$i]['add'][0] - item_id ïðåäìåòà íàãðàäû
//óäàëÿåì èíãðèäèåíòû
$upd = mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "'.$cn[$i][$j][0].'" AND `delete` = "0" AND `inOdet` = "0" AND `inShop` = "0" LIMIT '.($t[0]*$this->objLevel($cn[$i][$j],$u->info['level'])).'');
if($upd)
{
$data = '|frompisher='.$d->info['id2'];
$e = 1;
while($e<=$t[0])
{
$u->addItem($cn[$i]['add'][0],$u->info['id'],$data);
$e++;
}
$txt .= $cn[$i][$j]['n'].' x'.($t[0]*$this->objLevel($cn[$i][$j],$u->info['level'])).' = '.$cn[$i]['add'][1].' x'.$t[0].'<br>';
}else{
$txt .= 'Íå óäàëîñü îáìåíÿòü ïðåäìåò &quot;'.$cn[$i][$j]['n'].'&quot;, ÷òî-òî íå òàê ...<br>';
}
}
$j++;
}
$i++;
}
if( $txt == '' ) {
$txt = 'Íåîáõîäèìî ìèíèìóì 20 çàñîðîâ äëÿ îáìåíà.';
}
if($txt!='') {
$txt = '<br><font color="red">'.$txt.'</font>';
}
}elseif($act[0]=='transferSpells30' && $go1 == 1) {
//2553 2554
$keypr1 = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `delete` = 0 AND `item_id` = "2553" LIMIT 1'));
$keypr2 = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `delete` = 0 AND `item_id` = "2554" LIMIT 1'));
$txt = '';
if(isset($keypr1['id'],$keypr2['id'])) {
mysql_query('DELETE FROM `items_users` WHERE `id` = "'.$keypr1['id'].'" OR `id` = "'.$keypr2['id'].'" LIMIT 2');
$data = '|frompisher='.$d->info['id2'];
$u->addItem(2555,$u->info['id'],$data);
$txt = 'Âû óñïåøíî ïîëó÷èëè &quot;Ïèðàìèäàëüíûé êëþ÷&quot;';
}
if( $txt == '' ) {
$txt = 'Íåîáõîäèìî ïðèíåñòè äâà ðàçíûõ îñêîëêà...';
}
if($txt!='') {
$txt = '<br><font color="red">'.$txt.'</font>';
}
}elseif($act[0]=='transferSpells31' && $go1 == 1) {
$pg = $act[1]; $itms = array();
$sp = mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND (`item_id` = "2560" OR `item_id` = "2564" OR `item_id` = "2568" OR `item_id` = "2572" OR `item_id` = "2576") AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 250');
while($pl = mysql_fetch_array($sp)) {
$itms[$pl['item_id']]++;
}
$keypr = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `delete` = 0 AND `item_id` = "2555" LIMIT 1'));
if(!isset($keypr['id'])) {
$itms = array();
$txt = 'Íåîáõîäèì &quot;Ïèðàìèäàëüíûé êëþ÷&quot;, ó âàñ åãî íåò...';
}
//Ïðåäìåòû
$cn = array(
0 => 5, //êîë-âî êëàññèôèêàöèé
1 => array(
1 => array('n'=>'Çà÷àðîâàòü Óêðàøåíèå [0]',0=>2560,8=>3,'add'=>array(2561,'Çà÷àðîâàòü Óêðàøåíèå [1]')),
2 => array('n'=>'Çà÷àðîâàòü Îðóæèå [0]',0=>2564,8=>3,'add'=>array(2565,'Çà÷àðîâàòü Îðóæèå [1]')),
3 => array('n'=>'Çà÷àðîâàòü Áðîíþ [0]',0=>2568,8=>3,'add'=>array(2569,'Çà÷àðîâàòü Áðîíþ [1]')),
4 => array('n'=>'Çà÷àðîâàòü Ïåð÷àòêè [0]',0=>2572,8=>3,'add'=>array(2573,'Çà÷àðîâàòü Ïåð÷àòêè [1]')),
5 => array('n'=>'Çà÷àðîâàòü Øëåì [0]',0=>2576,8=>3,'add'=>array(2577,'Çà÷àðîâàòü Øëåì [1]'))
)
);
$i = 1;
while($i<=$cn[0])
{
$j = 1;
while($j<=$cn[0])
{
$t = $cn[$i][$j];
$t = $this->trnObj($itms[$cn[$i][$j][0]],$this->objLevel($cn[$i][$j],8));
if($t[0]>0)
{
$upd = mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "'.$cn[$i][$j][0].'" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT '.($t[0]*$this->objLevel($cn[$i][$j],$u->info['level'])).'');
if($upd)
{
$data = '|frompisher='.$d->info['id2'];
$e = 1;
while($e<=$t[0])
{
$u->addItem($cn[$i][$j]['add'][0],$u->info['id'],$data);
$e++;
}
mysql_query('DELETE FROM `items_users` WHERE `id` = "'.$keypr['id'].'" LIMIT 1');
$txt .= $cn[$i][$j]['n'].' x'.($t[0]*$this->objLevel($cn[$i][$j],$u->info['level'])).' = '.$cn[$i][$j]['add'][1].' x'.$t[0].'<br>';
}else{
$txt .= 'Íå óäàëîñü îáìåíÿòü ïðåäìåò &quot;'.$cn[$i][$j]['n'].'&quot;, ÷òî-òî íå òàê ...<br>';
}
$i = $cn[0];
$j = count($cn[$i][$j]);
}
$j++;
}
$i++;
}
if( $txt == '' ) {
$txt = 'Ó âàñ íå õâàòèëî íåîáõîäèìûõ ïðåäìåòîâ...';
}
if($txt!='') {
$txt = '<br><font color="red">'.$txt.'</font>';
}
}elseif($act[0]=='transferSpells32' && $go1 == 1) {
$pg = $act[1]; $itms = array();
$sp = mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND (`item_id` = "2561" OR `item_id` = "2565" OR `item_id` = "2569" OR `item_id` = "2573" OR `item_id` = "2577") AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 250');
while($pl = mysql_fetch_array($sp)) {
$itms[$pl['item_id']]++;
}
$keypr = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `delete` = 0 AND `item_id` = "2555" LIMIT 1'));
if(!isset($keypr['id'])) {
$itms = array();
$txt = 'Íåîáõîäèì &quot;Ïèðàìèäàëüíûé êëþ÷&quot;, ó âàñ åãî íåò...';
}
//Ïðåäìåòû
$cn = array(
0 => 5, //êîë-âî êëàññèôèêàöèé
1 => array(
1 => array('n'=>'Çà÷àðîâàòü Óêðàøåíèå [1]',0=>2561,8=>3,'add'=>array(2562,'Çà÷àðîâàòü Óêðàøåíèå [2]')),
2 => array('n'=>'Çà÷àðîâàòü Îðóæèå [1]',0=>2565,8=>3,'add'=>array(2566,'Çà÷àðîâàòü Îðóæèå [2]')),
3 => array('n'=>'Çà÷àðîâàòü Áðîíþ [1]',0=>2569,8=>3,'add'=>array(2570,'Çà÷àðîâàòü Áðîíþ [2]')),
4 => array('n'=>'Çà÷àðîâàòü Ïåð÷àòêè [0]',0=>2573,8=>3,'add'=>array(2574,'Çà÷àðîâàòü Ïåð÷àòêè [2]')),
5 => array('n'=>'Çà÷àðîâàòü Øëåì [1]',0=>2577,8=>3,'add'=>array(2578,'Çà÷àðîâàòü Øëåì [2]'))
)
);
$i = 1;
while($i<=$cn[0])
{
$j = 1;
while($j<=$cn[0])
{
$t = $cn[$i][$j];
$t = $this->trnObj($itms[$cn[$i][$j][0]],$this->objLevel($cn[$i][$j],8));
if($t[0]>0)
{
$upd = mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "'.$cn[$i][$j][0].'" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT '.($t[0]*$this->objLevel($cn[$i][$j],$u->info['level'])).'');
if($upd)
{
$data = '|frompisher='.$d->info['id2'];
$e = 1;
while($e<=$t[0])
{
$u->addItem($cn[$i][$j]['add'][0],$u->info['id'],$data);
$e++;
}
mysql_query('DELETE FROM `items_users` WHERE `id` = "'.$keypr['id'].'" LIMIT 1');
$txt .= $cn[$i][$j]['n'].' x'.($t[0]*$this->objLevel($cn[$i][$j],$u->info['level'])).' = '.$cn[$i][$j]['add'][1].' x'.$t[0].'<br>';
}else{
$txt .= 'Íå óäàëîñü îáìåíÿòü ïðåäìåò &quot;'.$cn[$i][$j]['n'].'&quot;, ÷òî-òî íå òàê ...<br>';
}
$i = $cn[0];
$j = count($cn[$i][$j]);
}
$j++;
}
$i++;
}
if( $txt == '' ) {
$txt = 'Ó âàñ íå õâàòèëî íåîáõîäèìûõ ïðåäìåòîâ...';
}
if($txt!='') {
$txt = '<br><font color="red">'.$txt.'</font>';
}
}elseif($act[0]=='transferSpells33' && $go1 == 1) {
$pg = $act[1]; $itms = array();
$sp = mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND (`item_id` = "2562" OR `item_id` = "2566" OR `item_id` = "2570" OR `item_id` = "2574" OR `item_id` = "2578") AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 250');
while($pl = mysql_fetch_array($sp)) {
$itms[$pl['item_id']]++;
}
$keypr = mysql_fetch_array(mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `delete` = 0 AND `item_id` = "2555" LIMIT 1'));
if(!isset($keypr['id'])) {
$itms = array();
$txt = 'Íåîáõîäèì &quot;Ïèðàìèäàëüíûé êëþ÷&quot;, ó âàñ åãî íåò...';
}
//Ïðåäìåòû
$cn = array(
0 => 5, //êîë-âî êëàññèôèêàöèé
1 => array(
1 => array('n'=>'Çà÷àðîâàòü Óêðàøåíèå [0]',0=>2562,8=>3,'add'=>array(2563,'Çà÷àðîâàòü Óêðàøåíèå [3]')),
2 => array('n'=>'Çà÷àðîâàòü Îðóæèå [0]',0=>2566,8=>3,'add'=>array(2567,'Çà÷àðîâàòü Îðóæèå [3]')),
3 => array('n'=>'Çà÷àðîâàòü Áðîíþ [0]',0=>2570,8=>3,'add'=>array(2571,'Çà÷àðîâàòü Áðîíþ [3]')),
4 => array('n'=>'Çà÷àðîâàòü Ïåð÷àòêè [0]',0=>2574,8=>3,'add'=>array(2575,'Çà÷àðîâàòü Ïåð÷àòêè [3]')),
5 => array('n'=>'Çà÷àðîâàòü Øëåì [0]',0=>2578,8=>3,'add'=>array(2579,'Çà÷àðîâàòü Øëåì [3]'))
)
);
$i = 1;
while($i<=$cn[0])
{
$j = 1;
while($j<=$cn[0])
{
$t = $cn[$i][$j];
$t = $this->trnObj($itms[$cn[$i][$j][0]],$this->objLevel($cn[$i][$j],8));
if($t[0]>0)
{
$upd = mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "'.$cn[$i][$j][0].'" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT '.($t[0]*$this->objLevel($cn[$i][$j],$u->info['level'])).'');
if($upd)
{
$data = '|frompisher='.$d->info['id2'];
$e = 1;
while($e<=$t[0])
{
$u->addItem($cn[$i][$j]['add'][0],$u->info['id'],$data);
$e++;
}
$txt .= $cn[$i][$j]['n'].' x'.($t[0]*$this->objLevel($cn[$i][$j],$u->info['level'])).' = '.$cn[$i][$j]['add'][1].' x'.$t[0].'<br>';
mysql_query('DELETE FROM `items_users` WHERE `id` = "'.$keypr['id'].'" LIMIT 1');
}else{
$txt .= 'Íå óäàëîñü îáìåíÿòü ïðåäìåò &quot;'.$cn[$i][$j]['n'].'&quot;, ÷òî-òî íå òàê ...<br>';
}
$i = $cn[0];
$j = count($cn[$i][$j]);
}
$j++;
}
$i++;
}
if( $txt == '' ) {
$txt = 'Ó âàñ íå õâàòèëî íåîáõîäèìûõ ïðåäìåòîâ...';
}
if($txt!='') {
$txt = '<br><font color="red">'.$txt.'</font>';
}
}elseif( $act[0] == 'GoHrumpShop' && $go1 == 1) { //îòïðàâëÿåìñÿ â ìàãàçèí Ðóëüôà Õðóìïòà (ïåùåðû ìãëû)
mysql_query('UPDATE `stats` SET `x` = "6",`y` = "73" WHERE `id` = "'.$u->info['id'].'" AND `dnow` = "'.$u->info['dnow'].'" LIMIT 1');
header('location: main.php');
die();
}elseif( $act[0] == 'swapItem' && $go1 == 1) {
$txt = '';
$swapItem = $act[1];
$swapError = $act[2];
$swapTrue = $act[3];
# Îáìåíèâàåì ïðåäìåòû ó Çàáûòîãî (Ìàñòåðñêàÿ Çàáûòûõ)
if( !isset($swapActStatus) ) $swapActStatus = 1; # Âñå îêåé, ïðîáëåì íåò!
$swapAct = array(); # Ñîáèðàåì äàííûå îá îáìåíå.
$temp = explode ("\\", $swapItem);
foreach ( $temp as $t ) {
$t = explode('=', $t);
if( $t[0] == 'tr' ) { // Íóæíû äëÿ îáìåíà
$temp2 = explode(',', $t[1]); $tr_items = array();
foreach( $temp2 as $t2 ) {
$temp3 = explode('x', $t2);
if( !isset($temp3[1]) ) $temp3[1] = 1; // Åñëè êîëè÷åñòâî íå çàäàíî, çàäàåì 1åä.
if( isset($temp3[2]) && $temp3[2]=='del' ) $temp3[2] = true; else $temp3[2]=false; // Óäàëÿåì äàæå ïðè íåóäà÷íîé ïîïûòêå ñîâåðøèòü îáìåí!
$tr_items[] = array('item_id' => $temp3[0], 'colvo' => (int)$temp3[1], 'delete' => $temp3[2]);
}
$swapAct['tr'] = $tr_items;
} elseif( $t[0] == 'needQuest' ){ // Åñëè íóæåí êàêîé-òî êâåñò äëÿ ïðèîáðåòåíèÿ.
} elseif( $t[0] == 'needRep' ){ // Åñëè íóæíà ðåïóòàöèÿ â ïîäçåìåëüè
$temp2 = explode(',', $t[1]); $need_rep = array();
$need_rep[] = array('city' => $temp2[0], 'rep' => (int)$temp2[1]);
$swapAct['need_rep'] = $need_rep;
} elseif( $t[0] == 'add' ){ // Êàêèå ïðåäìåòû äàåì.
$temp2 = explode(',', $t[1]); $add_items = array();
foreach($temp2 as $t2) {
$temp3 = explode('x', $t2);
if( !isset($temp3[1]) ) $temp3[1] = 1; // Åñëè êîëè÷åñòâî íå çàäàíî, çàäàåì 1åä.
$add_items[] = array('item_id' => $temp3[0], 'colvo' => (int)$temp3[1]);
}
$swapAct['add'] = $add_items;
} elseif( $t[0] == 'uses' ){ // Åñëè íóæíà ðåïóòàöèÿ â ïîäçåìåëüè
$swapAct['uses'] = $t[1];
}
} // Öèêë îáðàáîòêè äàííûõ ðàçãîâîðà.
unset($temp,$temp2,$temp3,$t2,$tr_items,$add_items);
if( $swapActStatus == 0 ) {
$txt = 'ß òåáÿ ðàíüøå çäåñü íå âèäåë, óõîäè ïðî÷ü íåãîäíèê!';
$pg = $swapError;
} elseif ( isset($swapAct['need_rep']) ) { # Ïðîâåðÿåì ðåïóòàöèþ.
foreach($swapAct['need_rep'] as $rep) { # Åñëè íåñêîëüêî ðåïóòàöèé
if($u->rep['rep'.$rep['city']] < $rep['rep'] ) {
$swapActStatus = 0;
$txt = 'ß òåáÿ ðàíüøå çäåñü íå âèäåë, óõîäè ïðî÷ü íåãîäíèê!';
$pg = $swapError;
}
}
}
if( isset($swapAct['uses']) ) { # Ïðîâåðÿåì êîëè÷åñòâî ðàç èñïîëüçîâàíèé.
#$swapAct['uses'] = mysql_fetch_array(mysql_query('SELECT `id`,`vals` FROM `actions` WHERE `room` = "'.$u->info['room'].'" AND `vals` = "masteryUses'.$u->info['dnow'].'" ORDER BY `id` DESC LIMIT '.$swapAct['uses'] .''));
if( isset($swapAct['uses']['id']) ) {
$swapActStatus = 0;
$txt = 'Êòî-òî óæå ïîáûâàë çäåñü è èñïîðòèë êóçíèöó, íè÷åãî íå ïîëó÷èòñÿ...';
$pg = 0;
}
}
if( isset($swapAct['tr']) AND $swapActStatus == 1 ) { # Ïðîâåðÿåì íåîáõîäèìûå ïðåäìåòû.
foreach($swapAct['tr'] as $item) { # Åñëè íåñêîëüêî ïðåäìåòîâ.
$item_info = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$item['item_id'].'" LIMIT 1'));
if( isset($item_info['id']) ) {
$query = mysql_query('SELECT * FROM `items_users` WHERE `item_id` = "'.$item['item_id'].'" AND `uid` = "'.$u->info['id'].'" AND `delete` = "0" AND `inShop` = "0" AND `inOdet` = "0" LIMIT '.$item['colvo'].'');
$j=0;
while( $t = mysql_fetch_array($query) ) {
$j++;
}
if( $j < $item['colvo'] ) {
$txt .= 'Ó âàñ íåäîñòàòî÷íî ïðåäìåòîâ "'.$item_info['name'].'"! ('.$item['item_id'].')<br/>';
$swapActStatus = 3;
$pg = $swapError;
} elseif( $swapActStatus != 3) {
$swapActStatus = 2;
}
}
}
}
if( isset($swapAct['tr']) AND $swapActStatus == 3 ) { # Çàáèðàåì ïðåäìåòû del==true.
$mess = 'Èçðàñõîäîâàíû ðåñóðñû: ';
$qsw = 0;
foreach($swapAct['tr'] as $item) { # Åñëè íåñêîëüêî ïðåäìåòîâ.
if ( $item['delete'] == true ){
$query = mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `item_id` = "'.$item['item_id'].'" AND `uid` = "'.$u->info['id'].'" AND `delete` = "0" AND `inShop` = "0" AND `inOdet` = "0" ORDER BY inGroup DESC LIMIT '.$item['colvo'].'');
if($query){
$item_info = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$item['item_id'].'" LIMIT 1'));
if( $qsw > 0 ) $mess .=', ';
$mess .= '"'.$item_info['name'].'"';
if( $item['colvo'] > 1 ) $mess .= '('.$item['item_id'].'øò)';
$qsw++;
}
}
}
$mess .= '.<br/>';
if( $qsw > 0 ) $txt .= $mess;
} elseif( isset($swapAct['tr']) AND $swapActStatus == 2 ) { # Çàáèðàåì ïðåäìåòû âñå.
$mess = 'Èçðàñõîäîâàíû ðåñóðñû: ';
$qsw = 0;
foreach($swapAct['tr'] as $item) {
$query = mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `item_id` = "'.$item['item_id'].'" AND `uid` = "'.$u->info['id'].'" AND (`delete` = "0" OR `delete` = "1000") AND `inShop` = "0" AND `inOdet` = "0" ORDER BY inGroup DESC LIMIT '.$item['colvo'].'');
if($query) {
$item_info = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$item['item_id'].'" LIMIT 1'));
if( $qsw > 0 ) $mess .=', ';
$mess .= '"'.$item_info['name'].'"';
if( $item['colvo'] > 1 ) $mess .= '('.$item['item_id'].'øò)';
$qsw++;
}
}
$mess .= '.<br/>';
if( $qsw > 0 ) $txt .= $mess;
}
if( isset($swapAct['add']) AND $swapActStatus == 2 ) { # Âûäàåì ïðåäìåòû.
foreach($swapAct['add'] as $item) {
$qsw = 0;
while($qsw < $item['colvo']) {
$txt .= '<br/>Âû ïîëó÷èëè ïðåäìåò';
$u->addItem($item['item_id'],$u->info['id']);
$qsw++;
}
}
mysql_query('INSERT INTO `actions` (`uid`,`time`,`city`,`room`,`vars`,`ip`,`vals`) VALUES ("'.$u->info['id'].'","'.time().'","'.$u->info['city'].'","'.$u->info['room'].'", "","'.mysql_real_escape_string($_SERVER['HTTP_X_REAL_IP']).'", "masteryUses'.$u->info['dnow'].'")');
$pg = $swapTrue;
}
if( $txt != '' ) {
$txt = '<br><font color="red">'.$txt.'</font>';
}
}
}
}
}
if($this->info['tr_room']!=0 && $this->info['tr_room']!=$u->info['room'])
{
$go = 0;
}
if($this->info['tr_dn']!=0) {
//òðåáóåò ïåùåðó
global $d;
if($this->info['tr_dn']!=$d->info['id2'])
{
$go = 0;
}elseif($this->info['x']!=0 || $this->info['y']!=0)
{
if($d->testLike($u->info['x'],$u->info['y'],$this->info['x'],$this->info['y'])!=1)
{
$go = 0;
}
//åñëè áîò ïîãèá
$dbot = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_bots` WHERE `dn` = "'.$u->info['dnow'].'" AND `x` = "'.$this->info['x'].'" AND `y` = "'.$this->info['y'].'" LIMIT 1'));
if(!isset($dbot['id2']))
{
$go = 0;
}
}
}
if($go==1) {
//dlg_nps:=:3=7
//êâåñò (ñ íàãðàäîé)
$qs_sp = mysql_query('SELECT `id`,`act_date` FROM `quests` WHERE `act_date` LIKE "%dlg_nps:=:'.$this->info['id'].'='.$pg.'=1=e%" LIMIT 1');
while($qs_pl = mysql_fetch_array($qs_sp)) {
$q->endq($qs_pl['id'],'win');
$gsex = explode('=e'.$this->info['id'].$pg.'=',$qs_pl['act_date']);
if($gsex[1] > 0) {
//âûäàåì äîáàâî÷íûé êâåñò
$q->startq($gsex[1]);
$txt .= '<br><font color="red"><b>Çàäàíèå èçìåíèëîñü</b></font>';
}
}
//êâåñò (áåç íàãðàäîé)
$qs_sp = mysql_query('SELECT `id`,`act_date` FROM `quests` WHERE `act_date` LIKE "%dlg_nps:=:'.$this->info['id'].'='.$pg.'=0=e%" LIMIT 1');
while($qs_pl = mysql_fetch_array($qs_sp)) {
$q->endq($qs_pl['id'],'end');
$gsex = explode('=e'.$this->info['id'].$pg.'=',$qs_pl['act_date']);
if($gsex[1] > 0) {
//âûäàåì äîáàâî÷íûé êâåñò $gsex[1]
$q->startq($gsex[1]);
$txt .= '<br><font color="red"><b>Çàäàíèå èçìåíèëîñü</b></font>';
}
}
$this->title = $this->info['text'];
$this->youInfo = $u->getInfoPers($u->info['id'],1);
$this->youInfo = $this->youInfo[0];
$this->botInfo = $this->infoBot($this->info['bot_id']);
//Äèàëîã
$qpl = mysql_fetch_array(mysql_query('SELECT * FROM `dungeon_dlg` WHERE `type` = "1" AND `qid` = "0" AND `id_dg` = "'.$this->info['id'].'" AND `page` = "'.((int)$pg).'" LIMIT 1'));
if( !isset($qpl['id']) ) {
if($txt == '' ){
$qpl['text'] = 'Äèàëîã íå íàéäåí ...';
} else {
$qpl['text'] = $txt.' (<a href="main.php?rnd='.$code.'">óéòè</a>)';
$txt = '';
}
} else {
$this->pg = $qpl['id'];
}
if( $u->info['admin'] > 0 ) {
if( isset($_GET['add_new_qid']) ) {
mysql_query('INSERT INTO `dungeon_dlg` (`type`,`qid`,`id_dg`,`text`) VALUES ("0","'.$qpl['id'].'","'.$this->info['id'].'","<i>Íîâûé âàðèàíò îòâåòà</i>")');
}
}
//Âàðèàíòû îòâåòà
$a = '';
$sp = mysql_query('SELECT * FROM `dungeon_dlg` WHERE `type` = "0" AND `qid` = "'.$qpl['id'].'" AND `id_dg` = "'.$this->info['id'].'" ORDER BY `sort` DESC LIMIT 25');
while($pl = mysql_fetch_array($sp))
{
$pl['action'] = $this->ltr($pl['action']);
$act = explode('|',$pl['action']);
if(isset($act[1]))
{
$pl['action'] = 'main.php?talk='.$this->info['id'].'&act='.$pl['id'].'&rnd='.$code;
}
$go1 = '';
if($pl['tr'] != '') {
$i = 0;
$x = explode('|',$pl['tr']);
while($i < count($x)) {
//Òðåáîâàíèÿ
$k = explode('=',$x[$i]);
if($k[0]=='data') {
$date = explode('-',$k[1]);
$dd1 = $date[0];
$mm1 = $date[1];
$dd2 = $date[2];
$mm2 = $date[3];
$date1 = strtotime($dd1.'-'.$mm1.'-'.date('Y'));
$date2 = strtotime($dd2.'-'.$mm2.'-'.date('Y'));
if( $date1 > time() || $date2 < time() ) {
$go1 = 'delete';
$i = count($x);
}
}elseif($k[0]=='diact') {
//Äåéñòâèÿ
//user_id # all # all # lukaqst1 # -1
if($this->quest_act($k[1])==false) {
$go1 = 'delete';
$i = count($x);
}
}elseif($k[0]=='quest_end') {
//Êâåñò ìîæíî âûïîëíÿòü íåñêîëüêî ðàç â òåêóùåé ïåùåðå
$qlst = mysql_fetch_array(mysql_query('SELECT `id`,`vals` FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `vars` = "start_quest'.$k[1].'" ORDER BY `id` DESC LIMIT 1'));
if(isset($qlst['id']) && $qlst['vals'] != 'win' && $qlst['vals'] != 'end' && $qlst['vals'] != 'bad') {
//$go1 .= "Âû óæå âçÿëè äàííîå çàäàíèå\n";
$go1 = 'delete';
$i = count($x);
}
}elseif($k[0]=='quest_only_one') {
//Êâåñò ìîæíî âûïîëíÿòü òîëüêî îäèí ðàç
$qlst = mysql_fetch_array(mysql_query('SELECT `id`,`vals` FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `vars` = "start_quest'.$k[1].'" ORDER BY `id` DESC LIMIT 1'));
if(isset($qlst['id']) && ($qlst['vals'] == 'win' || $qlst['vals'] == 'bad')) {
//$go1 .= "Âû óæå âçÿëè äàííîå çàäàíèå\n";
$go1 = 'delete';
$i = count($x);
}
}elseif($k[0]=='quest_now') {
//Êâåñò äîëæåí áûòü âçÿò
$qlst = mysql_fetch_array(mysql_query('SELECT `id`,`vals` FROM `actions` WHERE `uid` = "'.$u->info['id'].'" AND `vars` = "start_quest'.$k[1].'" ORDER BY `id` DESC LIMIT 1'));
if(isset($qlst['id']) && $qlst['vals'] != 'win' && $qlst['vals'] != 'end' && $qlst['vals'] != 'bad'){}else{
$go1 = 'delete';
$i = count($x);
}
}elseif($k[0]=='tr_itm') {
//Êâåñò òðåáóåò ïðåäìåò
$qlst = mysql_fetch_array(mysql_query('SELECT COUNT(`id`) FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "'.$k[1].'" AND `inOdet` = 0 AND `inTransfer` = 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1'));
if($qlst[0] < $k[2]){
$go1 = 'delete';
$i = count($x);
}
}elseif($k[0]=='tr_itmodet') {
//Êâåñò òðåáóåò ïðåäìåò
$k[1] = str_replace(',','" OR `item_id` = "',$k[1]);
$qlst = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND (`item_id` = "'.$k[1].'") AND `inOdet` > 0 AND `inTransfer` = 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1'));
if(!isset($qlst['id'])){
$go1 = 'delete';
$i = count($x);
}
}elseif($k[0]=='tr_noitmodet') {
//Êâåñò òðåáóåò ïðåäìåò
$k[1] = str_replace(',','" OR `item_id` = "',$k[1]);
$qlst = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND (`item_id` = "'.$k[1].'") AND `inTransfer` = 0 AND `inOdet` > 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1'));
if(isset($qlst['id'])){
$go1 = 'delete';
$i = count($x);
}
}elseif($k[0]=='tr_noitm') {
//Êâåñò òðåáóåò ïðåäìåò
$k[1] = str_replace(',','" OR `item_id` = "',$k[1]);
$qlst = mysql_fetch_array(mysql_query('SELECT `id` FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND (`item_id` = "'.$k[1].'") AND `inTransfer` = 0 AND `delete` = 0 AND `inShop` = 0 LIMIT 1'));
if(isset($qlst['id'])){
$go1 = 'delete';
$i = count($x);
}
}
$i++;
}
}
if($u->info['admin'] > 0) {
$a .= '<small>(<a href="javascript:window.open(\'https://new-combats.com/quest_dlg_edit.php?pid='.$pl['id'].'\',\'winEdi1\',\'width=850,height=400,top=400,left=500,resizable=no,scrollbars=yes,status=no\');" title="Ðåäàêòèðîâàòü âàðèàíò îòâåòà">ðåä.</a>)</small> &nbsp; ';
}
if($go1 == '') {
$a .= '&bull; <a href="'.$pl['action'].'">'.$pl['text'].'</a><br>';
}elseif($go1 == 'delete') {
if( $u->info['admin'] > 0 ) {
$a .= '&bull; <a style="color:#aeaeae" href="'.$pl['action'].'">'.$pl['text'].'</a><br>';
}
}else{
$a .= '<font color="#9A9A9A">&bull; <b>'.$pl['text'].'</b></font> <small title="'.$go1.'"> <b style="cursor:help"><font color=red>[?]</font></b></small><br>';
}
}
if($u->info['admin'] > 0) {
$a .= '<small style="border-top:1px solid #BABABA;padding-top:5px;display:block;margin-top:5px;"><a href="main.php?talk='.((int)$_GET['talk']).'&act='.((int)$_GET['act']).'&add_new_qid=1">Äîáàâèòü âàðèàíò îòâåòà</a></small>';
}
$this->dText = $qpl['text'].'<br>'.$txt;
$this->aText = $a;
}else{
$this->aText = '<center>Äèàëîã íå äîñòóïåí, âåðíóòüñÿ <a href="main.php?rnd='.$code.'">íàçàä</a><br></center>';
}
}else{
$this->aText = '<center>Äèàëîã íå íàéäåí, âåðíóòüñÿ <a href="main.php?rnd='.$code.'">íàçàä</a><br><font color="white">'.((int)$id).'</font></center>';
}
}
public function dialog_act_update($data) {
global $u;
$r = array(false,'');
$x = explode('#',$data);
$i = 0;
while( $i < count($x) ) {
$k = explode('=',$x[$i]);
$var = $k[0];
$val = $k[1];
if( $var == 'take_item' ) {
//Çàáèðàåì ïðåäìåò
$itms = array();
$sp = mysql_query('SELECT * FROM `items_users` WHERE `uid` = "'.$u->info['id'].'" AND `item_id` = "'.mysql_real_escape_string($val).'" AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = "0" AND `inShop` = "0" LIMIT 100');
while($pl = mysql_fetch_array($sp)) {
$itms[$pl['item_id']]++;
}
if($itms[$val] >= $k[2]) {
//$u->deleteItemID($val,$u->info['id'],$k[2]);
mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `item_id` = "'.mysql_real_escape_string($val).'" AND `uid` = "'.$u->info['id'].'" AND `inShop` = 0 AND `inTransfer` = 0 AND (`delete` = "0" OR `delete` = "1000") AND `inOdet` = 0 LIMIT '.round($k[2]));
}else{
$i = count($x);
$r[0] = false;
$itm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$val.'" LIMIT 1'));
$r[1] = 'Ó âàñ íåò íóæíîãî ïðåäìåòà! Òðåáóåòñÿ &quot;'.$itm['name'].'&quot;';
if( $k[2] > 1 ) {
$r[1] .= ' ('.$k[2].' øò.)';
}
}
//
}elseif( $var == 'add_item' ) {
$data_itm = '|frompisher=1';
$i1 = 0;
while( $i1 < $k[2] ) {
if( $val == 4797 ) {
//Ïîâåñòêà
if( $u->info['level'] >= 4 && $u->info['level'] <= 7 ) {
$val = 4797;
}elseif( $u->info['level'] >= 8 && $u->info['level'] <= 9 ) {
$val = 4798;
}else{
$val = 4799;
}
}
$u->addItem($val,$u->info['id'],$data_itm);
$i1++;
}
}elseif( $var == 'up' ) {
$tqst = mysql_fetch_array(mysql_query('SELECT * FROM `dialog_act` WHERE `uid` = "'.$u->info['id'].'" AND `var` = "'.mysql_real_escape_string($val).'" ORDER BY `id` DESC LIMIT 1'));
if(!isset($tqst['id'])) {
mysql_query('INSERT INTO `dialog_act` (
`uid`,`city`,`time`,`var`,`val`
) VALUES (
"'.$u->info['id'].'","'.$u->info['city'].'","'.time().'","'.mysql_real_escape_string($val).'","'.mysql_real_escape_string($k[2]).'"
)');
}else{
mysql_query('UPDATE `dialog_act` SET `val` = "'.mysql_real_escape_string($k[2]).'" WHERE `uid` = "'.$u->info['id'].'" AND `var` = "'.mysql_real_escape_string($val).'" ORDER BY `id` DESC LIMIT 1');
}
}elseif( $var == 'finish' ) {
$r[0] = true;
$r[1] = $val;
}
$i++;
}
return $r;
}
public function quest_act($data) {
global $u;
//
$r = true;
//
$f = explode('#',$data);
$ql = mysql_fetch_array(mysql_query('SELECT * FROM `dialog_act` WHERE `var` = "'.mysql_real_escape_string($f[3]).'" AND `uid` = "'.$u->info['id'].'" ORDER BY `id` DESC LIMIT 1'));
if(isset($ql['id'])) {
//user_id # all # all # lukaqst1 # -1
if( $f[0] == 'user_id' ) {
$f[0] = $u->info['id'];
}
//
if( $f[0] != $ql['uid'] && $f[0] != 'all' ) {
$r = false;
}elseif( $f[1] != $ql['city'] && $f[1] != 'all' ) {
$r = false;
}elseif( $f[2] != $ql['time'] && $f[2] != 'all' ) {
$r = false;
}elseif( $f[3] != $ql['var'] && $f[3] != 'all' ) {
$r = false;
}elseif( $f[4] == -1 ) {
//Íå äîëæåí âçÿòü çàäàíèå
$r = false;
}elseif( $f[4] != $ql['val'] ) {
$r = false;
}elseif( $f[5] == 1 && $ql['now'] < $ql['max'] ) {
$r = false;
}
}else{
if( $f[4] != -1 ) {
$r = false;
}
}
//
return $r;
}
public function ltr($v)
{
return $v;
}
public function infoBot($id)
{
global $c,$code;
$r = '';
$bot = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `id` = "'.((int)$id).'" LIMIT 1'));
if(isset($bot['id']))
{
//Õàðàêòåðèñòèêè îò ïðåäìåòîâ è èõ èçîáðàæåíèå
$witm = array();
$witm[1] = '<img width="60" height="60" style="display:block;" title="Ïóñòîé ñëîò øëåì" src="https://img.new-combats.com/i/items/w/w9.gif">';
$witm[2] = '<img width="60" height="40" style="display:block;" title="Ïóñòîé ñëîò íàðó÷è" src="https://img.new-combats.com/i/items/w/w13.gif">';
$witm[3] = '<img width="60" height="60" style="display:block;" title="Ïóñòîé ñëîò îðóæèå" src="https://img.new-combats.com/i/items/w/w3.gif">';
$witm[4] = '<img width="60" height="80" style="display:block;" title="Ïóñòîé ñëîò áðîíÿ" src="https://img.new-combats.com/i/items/w/w4.gif">';
$witm[7] = '<img width="60" height="40" style="display:block;" title="Ïóñòîé ñëîò ïîÿñ" src="https://img.new-combats.com/i/items/w/w5.gif">';
$witm[8] = '<img width="60" height="20" style="display:block;" title="Ïóñòîé ñëîò ñåðüãè" src="https://img.new-combats.com/i/items/w/w1.gif">';
$witm[9] = '<img width="60" height="20" style="display:block;" title="Ïóñòîé ñëîò îæåðåëüå" src="https://img.new-combats.com/i/items/w/w2.gif">';
$witm[10] = '<img width="20" height="20" style="display:block;" title="Ïóñòîé ñëîò êîëüöî" src="https://img.new-combats.com/i/items/w/w6.gif">';
$witm[11] = '<img width="20" height="20" style="display:block;" title="Ïóñòîé ñëîò êîëüöî" src="https://img.new-combats.com/i/items/w/w6.gif">';
$witm[12] = '<img width="20" height="20" style="display:block;" title="Ïóñòîé ñëîò êîëüöî" src="https://img.new-combats.com/i/items/w/w6.gif">';
$witm[13] = '<img width="60" height="40" style="display:block;" title="Ïóñòîé ñëîò ïåð÷àòêè" src="https://img.new-combats.com/i/items/w/w11.gif">';
$witm[14] = '<img width="60" height="60" style="display:block;" title="Ïóñòîé ñëîò ùèò" src="https://img.new-combats.com/i/items/w/w10.gif">';
$witm[16] = '<img width="60" height="80" style="display:block;" title="Ïóñòîé ñëîò ïîíîæè" src="https://img.new-combats.com/i/items/w/w19.gif">';
$witm[17] = '<img width="60" height="40" style="display:block;" title="Ïóñòîé ñëîò îáóâü" src="https://img.new-combats.com/i/items/w/w12.gif">';
//40-52 ñëîò ïîä ìàãèþ
$witm[53] = '<img style="display:block;" title="Ïóñòîé ñëîò ïðàâûé êàðìàí" src="https://img.new-combats.com/i/items/w/w15.gif">';
$witm[54] = '<img style="display:block;" title="Ïóñòîé ñëîò ëåâûé êàðìàí" src="https://img.new-combats.com/i/items/w/w15.gif">';
$witm[55] = '<img style="display:block;" title="Ïóñòîé ñëîò öåíòðàëüíûé êàðìàí" src="https://img.new-combats.com/i/items/w/w15.gif">';
$witm[56] = '<img style="display:block;" title="Ïóñòîé ñëîò ñìåíà" src="https://img.new-combats.com/i/items/w/w20.gif">';
$witm[57] = '<img style="display:block;" title="Ïóñòîé ñëîò ñìåíà" src="https://img.new-combats.com/i/items/w/w20.gif">';
$witm[58] = '<img style="display:block;" title="Ïóñòîé ñëîò ñìåíà" src="https://img.new-combats.com/i/items/w/w20.gif">';
$pb = '';
$hpmp = '??&nbsp;';
$eff = '';
$anml = '';
$oi = '';
$msl = '<img width="120" height="40" style="display:block" src="https://img.new-combats.com/i/slot_bottom.gif">';
$witmg = '';
if( $bot['level'] < 0 ) {
$bot['level'] = '??';
}
$r = '<div style="width:246px; padding:2px;" align="center"><b>'.$bot['login'].'</b> ['.$bot['level'].']<img src="https://img.new-combats.com/i/inf_.gif"></div>
<div style="width:240px; padding:2px; border-bottom:1px solid #666666; border-right:1px solid #666666; border-left:1px solid #FFFFFF; border-top:1px solid #FFFFFF;">
<div align="center"><!-- blocked -->'.$pb.'</div>
<table width="240" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="60" valign="top">
<table width="60" height="280" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="60">'.$witm[1].'</td>
</tr>
<tr>
<td height="40">'.$witm[2].'</td>
</tr>
<tr>
<td height="60">'.$witm[3].'</td>
</tr>
<tr>
<td height="80">'.$witm[4].'</td>
</tr>
<tr>
<td height="40">'.$witm[7].'</td>
</tr>
</table>
</td>
<td height="280" valign="top">
<table width="120" height="280" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="20" valign="top">
<!-- HP and MP -->
'.$hpmp.'
<!-- -->
</td>
</tr>
<tr>
<td valign="top">
<div style="position:relative;height:220px;">
<!-- îáðàç -->
<div style="position:absolute; width:120px; height:220px; z-index:1;"><a href="#obraz_pers"><img width="120" height="220" src="https://img.new-combats.com/i/obraz/'.$bot['sex'].'/'.$bot['obraz'].'" '.$oi.'></a></div>
<div style="position:absolute; width:120px; height:220px; z-index:3;" align="left">'.$eff.'</div>'.$anml.'
</div>
</td>
</tr>
<tr>
<td height="40"><div align="center">'.$msl.'</div></td>
</tr>
</table>
</td>
<td width="60" valign="top">
<table width="60" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="20">'.$witm[8].'</td>
</tr>
<tr>
<td height="20">'.$witm[9].'</td>
</tr>
<tr>
<td height="20"><table width="60" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="20" height="20">'.$witm[10].'</td>
<td width="20">'.$witm[11].'</td>
<td width="20">'.$witm[12].'</td>
</tr>
</table></td>
</tr>
<tr>
<td height="40">'.$witm[13].'</td>
</tr>
<tr>
<td height="60">'.$witm[14].'</td>
</tr>
<tr>
<td height="80">'.$witm[16].'</td>
</tr>
<tr>
<td height="40">'.$witm[17].'</td>
</tr>
</table>
</td>
</tr>
</table>'.$witmg.'
</div>';
}else{
$r = 'No information';
}
return $r;
}
}
$dialog = new dialog;
?>