AGAMES 討論區
標題:
HKCZ Pet物品收集任務範本
[打印本頁]
作者:
dlalden
時間:
2008-11-9 15:42:34
標題:
HKCZ Pet物品收集任務範本
作 者: ntf
整 理: pmfromhk
適用版本: HKCZ Pet V1.9 or above
------------------------------------------------------------
應該不太多人用hkcz pet吧
不過都分享一下物品收集任務的範本
------------------------------------------------------------
<?
if(!defined('IN_HKCZMISSION')) { exit('Access Denied');}
$mission='item1';
$missiondetail[$mission][systemname]=$mission;
$missiondetail[$mission][name]=''; //這裡填寫任務名稱
$missiondetail[$mission][exp]='-'; //這裡填寫完成任務所獲經驗值
$missiondetail[$mission][money]='-'; //這裡填寫完成任務所獲寵物幣
$missiondetail[$mission][job]='0'; //這裡填寫參與任務的轉數
$missiondetail[$mission][level]='0'; //這裡填寫參與任務的等級
$missiondetail[$mission][extraitem]='typack'; //這裡填寫完成任務後的特殊獎勵(英文名稱)
if($mypetdata['mission']==$mission){
$showmissiontext=hkcz_showmission('1','mission','本任務是XXXXXXXXXXXX。','next','2'); //修改這裡
$temp['getdata']=@explode(",",$mypetdata['missionstat']);
if($mypetdata['missionstat']=='2'){
$temp['getdata']=hkczpet_missiongetitemdata('物品英文名','數量'); //修改這裡
if(!$temp['getdata']['itemname']){
hkczpet_missioncancel();
showmessage("系統找不到指定物品,本任務由系統取消。","pet.php?index=mode&mode=mission");
}
$showmissiontext=hkcz_showmission('2','mission',array($pokemon_jirachi,"請幫忙收集 <img src=\"{$imgpath}/pet/{$temp[getdata][pic]}\" alt\"{$temp[getdata][cname]}\"> {$temp[getdata][cname]} {$temp[getdata][randnum]}個。 任務完成我送你{$temp[getdata][missionprice]}個寵物幣喔!"),'exit',"3,{$temp[getdata][itemname]},{$temp[getdata][randnum]},{$temp[getdata][cname]},{$temp[getdata][missionprice]}"); //注意$pokemon_jirachi
}elseif($temp[getdata][0]=='3'){
$query=$db->query("select * from `{$tablepre}{$sqlpre}item` where `itemname`='{$temp[getdata][1]}'");
$zitemdata = $db->fetch_array($query);
$itemquery = $db->query("SELECT * FROM `{$tablepre}{$sqlpre}storage` WHERE `username`='$discuz_user' AND `itemname`='{$temp[getdata][1]}'");
$yitemdata = $db->fetch_array($itemquery);
$yitemdata['nums']= ($yitemdata[nums]) ? $yitemdata[nums] : '0';
if($yitemdata[nums]<$temp[getdata][2]){
//We do not have enough items
$showmissiontext=hkcz_showmission($mypetdata[missionstat],'mission',"<center>收集 {$temp[getdata][3]} x {$temp[getdata][2]} <br /> <img src=\"{$imgpath}/pet/{$zitemdata[pic]}\" alt\"{$temp[getdata][3]}\"><br />目前 {$yitemdata[nums]} / {$temp[getdata][2]}</center>",'null');
}else{
//We have enough items
$temp['missionstat']='4,'.$mypetdata[missionstat];
$showmissiontext=hkcz_showmission($mypetdata[missionstat],'mission',"<center>收集 {$temp[getdata][3]} x {$temp[getdata][2]} <br /> <img src=\"{$imgpath}/pet/{$zitemdata[pic]}\" alt\"{$temp[getdata][3]}\"><br /></center>",'next',"$temp[missionstat]");
}
}elseif($temp[getdata][0]=='4'){
// 4,3,itemanme,數目,物品名,$
$missiondetail[$mission]['money']=$temp[getdata][5];
$itemquery = $db->query("SELECT * FROM `{$tablepre}{$sqlpre}storage` WHERE `username`='$discuz_user' AND `itemname`='{$temp[getdata][2]}'");
$yitemdata = $db->fetch_array($itemquery);
//Re Check How many do we have
if($yitemdata[nums]<$temp[getdata][3]) {
hkczpet_missioncancel();
showmessage("系統錯誤,本任務由系統取消。","pet.php?index=mode&mode=mission");
}
if($index=='mode' && $mode=='mission'){
$nowitemnums=$yitemdata[nums]-$temp[getdata][3];
updatestoragebyid($nowitemnums,$yitemdata[id]); // Delete n From player's item
$showmissiontext=hkcz_showmission($mypetdata[missionstat],'mission','你的物品回收給系統。','finish','0');
}
}
}// end of this mission
hkczpet_missionend();
?>
複製代碼
有關$pokemon_jirachi:
$pokemon_jirachi是寵物小精靈的基拉祈
要修改/增加自己的圖片可以到mission/npcdata.php修改,修改方法如下:
在
$pokemon_jirachi=array('/images/pet/pet/pc/pc8.gif','基拉祈');
複製代碼
下加
$任意英文字符=array('圖片路徑','NPC名稱');
複製代碼
歡迎光臨 AGAMES 討論區 (http://forum.agames.hk/)
Powered by Discuz! X2