вообщем покавырял я там...нечего не понял. все вроде верно а не работает и все тут...может ява файл править надо можеш со своим сравнить? вот мой файл quest.js
а вот quest_ajax.php проверь плиз я думаю в какомто из этих файлов косяк
PHP:
var QuestStep = 0;
var QuestDialogLeng = 0;
var ND = false;
var LD,DD;
var QCODE = '';
var QuestD,QuestP;
function StepByStep(cr)
{
QuestStep += cr;
d.getElementById('QuestDia').innerHTML = QuestD[QuestStep];
d.getElementById('QuestNav').innerHTML = DialogNav();
}
function DialogNav()
{
var navt = '';
if(QuestStep > 0) navt += '<a class="block_prev" href="javascript: StepByStep(-1);"></a>';
if(QuestStep < QuestDialogLeng) navt += '<a class="block_next" href="javascript: StepByStep(1);"></a>';
if((QuestStep == QuestDialogLeng) && QuestP[1][0])
{
switch(QuestP[1][0])
{
case 1: navt += '<a class="block_get" href="javascript: AjaxGet(\'quest_ajax.php?act=1&qid='+QuestP[1][2]+'&vcode='+QuestP[1][1]+'\');"></a>'; break;
case 2: navt += '<a class="block_end" href="javascript: AjaxGet(\'quest_ajax.php?act=2&qid='+QuestP[1][2]+'&vcode='+QuestP[1][1]+'\');"></a>'; break;
}
}
return (navt ? '<BR>'+navt : '');
}
function CreateDialogDiv()
{
ND = d.createElement('div');
ND.id = 'darker';
var userAgent = navigator.userAgent.toLowerCase();
if(userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) ND.className = 'TB_overlayMacFFBGHack';
else ND.className = 'TB_overlayBG';
d.body.appendChild(ND);
ND = d.createElement('div');
ND.id = 'block_uni';
ND.className = 'png';
d.body.appendChild(ND);
}
function RemoveDialogDiv()
{
d.body.removeChild(LD);
d.body.removeChild(DD);
ND = false;
}
function QuestReady()
{
if(ND === false)
{
CreateDialogDiv();
LD = d.getElementById('block_uni');
DD = d.getElementById('darker');
DD.style.display = 'block';
}
QuestD = eval(arr_res[1]);
QuestP = eval(arr_res[2]);
QuestStep = 0;
QuestDialogLeng = QuestD.length - 1;
LD.innerHTML = '<table border="0" cellpadding="0" cellspacing="0" class="block"><tr><td height="326" width="56" rowspan="3" class="block_l png"></td><td height="35" class="block_t png"></td><td class="block_r png" width="4" rowspan="3"></td></tr><tr><td class="block_bg" width="688" height="262"><table style="margin:0px auto 0 70px; width:595px;" border="0" cellpadding="0" cellspacing="0" width="100%"><tr><td class="text"><a class="block_close" href="javascript: RemoveDialogDiv();"><img src="http://localhost/image/1x1.gif" width="18" height="18" border=0></a><div id="QuestDia">'+QuestD[0]+'</div></td>'+(QuestP[0] ? '<td class="ava"><div><div class="ava_img"><img src="http://localhost/image/gameplay/faces/'+QuestP[0]+'" width="130" height="130" border="0"></div><div class="ava_border png"></div></div></td>' : '')+'</tr><tr><td colspan="2" class="buttons"><div id="QuestNav">'+DialogNav()+'</div></td></tr></table></td></tr><tr><td height="29" class="block_b png"> </td></tr></table>';
}
function QSel(QID)
{
AjaxGet('quest_ajax.php?vcode='+QCODE+'&act=1&qid='+QID+'&r='+Math.random());
}
function QActive(vcode)
{
QCODE = vcode;
AjaxGet('quest_ajax.php?vcode='+QCODE+'&act=1&r='+Math.random());
}
а вот quest_ajax.php проверь плиз я думаю в какомто из этих файлов косяк
PHP:
<?php
#GLOBALS OFF
header('Content-type: text/html; charset=windows-1251');
session_start();
include($_SERVER["DOCUMENT_ROOT"]."/includes/config.inc.php");
include($_SERVER["DOCUMENT_ROOT"]."/includes/functions.php");
foreach($_POST as $keypost=>$valp){
$valp = varcheck($valp);
$_POST[$keypost] = $valp;
}
foreach($_GET as $keyget=>$valg){
$valg = varcheck($valg);
$_GET[$keyget] = $valg;
}
$pers = GetUser($_SESSION['user']['login']);
list($pers['x'], $pers['y']) = explode('_', $pers['pos']);
$ShowQuestDialog = 0;
$Query = mysql_query("SELECT * FROM `quests` WHERE `loc`='".$pers['loc']."' AND `x`='".$pers['x']."' AND `y`='".$pers['y']."' AND `level_max`>='".$pers['level']."' AND `level_min`<='".$pers['level']."'");
$EndQuests = mysql_query("SELECT `quest_completed`.*, `quests`.* FROM `quests` INNER JOIN `quest_completed` ON `quests`.`id` = `quest_completed`.`que_id` WHERE `quest_completed`.`usr_id`='".$pers['id']."' AND `quest_completed`.`que_st`>'0' AND `quests`.`loc`='".$pers['loc']."' AND `quests`.`x`='".$pers['x']."' AND `quests`.`y`='".$pers['y']."' AND `quests`.`level_max`>='".$pers['level']."' AND `quests`.`level_min`<='".$pers['level']."'");
if(mysql_num_rows($Query) == mysql_num_rows($EndQuests)){
exit('QUEST@["Здравствуй '.$pers['login'].', для Вас сейчас нет никаких поручений."]@["",[0,"",]]');
}
if(empty($_GET['qid'])){
while($row = mysql_fetch_assoc($Query)){
$QuestStepOne = true;
include($_SERVER["DOCUMENT_ROOT"]."/includes/quests/quest-".$row['id'].".php");
$Quest = mysql_fetch_assoc(mysql_query("SELECT * FROM `quest_completed` WHERE `que_id`='".$row['id']."' AND `usr_id`='".$pers['id']."' AND `que_st` = '0'"));
echo'QUEST@['.(($Quest)?$Quest_Yes:$Quest_No).']@["'.$row['face'].'",['.(($Quest)?2:1).',"'.vCode().'",'.$row['id'].']]';
}
}else{
switch($_GET['act']){
case'1':
$GetQuest = mysql_fetch_assoc(mysql_query("SELECT * FROM `quests` WHERE `loc`='".$pers['loc']."' AND `x`='".$pers['x']."' AND `y`='".$pers['y']."' AND `id`='".intval($_GET['qid'])."'"));
if(!empty($GetQuest)){
$StatusQuest = mysql_fetch_assoc(mysql_query("SELECT * FROM `quest_completed` WHERE `usr_id`='".$pers['id']."' AND `que_id`='".$GetQuest['id']."' AND `que_st` = '0'"));
if(empty($StatusQuest)){
$QuestStepTwo = true;
include($_SERVER["DOCUMENT_ROOT"]."/includes/quests/quest-".$GetQuest['id'].".php");
mysql_query("INSERT INTO `quest_completed` (`usr_id`,`que_id`,`que_time_start`,`que_time_finish`,`que_query`,`que_name`,`que_desc`,`que_face`) VALUES ('".$pers['id']."','".$GetQuest['id']."','".time()."','".(time()+$GetQuest['time'])."','".$Need."','".$Quest_Name."','".$Quest_Desc."','".$GetQuest['face']."');");
echo'QUEST@['.$Quest_Get.']@["'.$GetQuest['face'].'",[0,"",'.$GetQuest['id'].']]';
}else{
echo'ERR';
}
}
break;
case'2':
$GetQuest = mysql_fetch_assoc(mysql_query("SELECT * FROM `quests` WHERE `loc`='".$pers['loc']."' AND `x`='".$pers['x']."' AND `y`='".$pers['y']."' AND `id`='".intval($_GET['qid'])."'"));
if(!empty($GetQuest)){
$StatusQuest = mysql_fetch_assoc(mysql_query("SELECT * FROM `quest_completed` WHERE `usr_id`='".$pers['id']."' AND `que_id`='".$GetQuest['id']."' AND `que_st` = '0'"));
if(!empty($StatusQuest)){
include($_SERVER["DOCUMENT_ROOT"]."/includes/quests/quest-".$GetQuest['id'].".php");
$Items = explode("@",$StatusQuest['que_query']);
$NumsQuest = 0;$NumsInvent = 0;
for($i=0;$i<count($Items);$i++){
$ItemNeed = explode(";",$Items[$i]);
$NumsQuest += $ItemNeed[1];
$NumsInvent += mysql_num_rows(mysql_query("SELECT * FROM `invent` WHERE `pl_id`='".$pers['id']."' AND `protype`='".$ItemNeed[0]."' AND `used`='0' AND `clan`='0' AND `gift_from`='' LIMIT ".$ItemNeed[1].""));
}
if($NumsQuest == $NumsInvent){
echo'QUEST@['.$Quest_Status_ok.']@["'.$StatusQuest['que_face'].'",[0,"",'.$StatusQuest['que_id'].']]@';
// Выдаем призы збираем вещи
for($i=0;$i<count($Items);$i++){
$ItemNeed = explode(";",$Items[$i]);
mysql_query("DELETE FROM `invent` WHERE `pl_id`='".$pers['id']."' AND `protype`='".$ItemNeed[0]."' AND `used`='0' AND `clan`='0' AND `gift_from`='' LIMIT ".$ItemNeed[1]."");
}
$exp = explode("|",$pers['exp']);
$QuestStepThree = true;
include($_SERVER["DOCUMENT_ROOT"]."/includes/quests/quest-".$GetQuest['id'].".php");
//Закончили с призами
exit;
}elseif($NumsQuest != $NumsInvent){
echo'QUEST@['.$Quest_Status_err.']@["'.$StatusQuest['que_face'].'",[0,"",'.$StatusQuest['que_id'].']]@';
}
}else{
echo'ERR';
}
}
break;
}
}
Последнее редактирование: