如果是人氣很旺的WOG請不要貿然嘗試 (怕有BUG...)
如有BUG,請記得在此回報(回覆),或PM我。
簡介 寫:外掛名稱:重生館
外掛作者:~木林森~
外掛描述:使玩家可以利用重生系統重新由擁有較強能力的1等角色遊玩WOG。
在資料庫中輸入下列語法 寫:ALTER TABLE wog_player ADD p_rebirth smallint(10) DEFAULT '0' NOT NULL
編輯wog_act.php 寫:尋找
- 代碼: 選擇全部
case "bank":
前面加上
- 代碼: 選擇全部
case "rebirth":
include("./class/wog_act_rebirth.php");
switch ($_POST["act"])
{
case "rebirth_confirm":
rebirth_confirm($HTTP_COOKIE_VARS["wog_cookie"]);
break;
case "rebirth":
rebirth($HTTP_COOKIE_VARS["wog_cookie"]);
break;
}
break;
尋找
- 代碼: 選擇全部
//########################## kill begin #################
前面加上
- 代碼: 選擇全部
//########################## rebirth_confirm begin #################
function rebirth_confirm($user_id)
{
$wog_act_class = new wog_act_rebirth;
$wog_act_class->rebirth_confirm($user_id);
}
//########################## rebirth begin #################
function rebirth($user_id)
{
$wog_act_class = new wog_act_rebirth;
$wog_act_class->rebirth($user_id);
}
編輯wog.js 寫:尋找
- 代碼: 選擇全部
<input type="button" value="復活房" onClick=parent.act_click(\'chara\',\'revive\')>
後面加上
- 代碼: 選擇全部
<input type="button" value="重生館" onClick=parent.act_click("rebirth","rebirth_confirm")>
尋找
- 代碼: 選擇全部
function p1()
{
parent.peolist.document.location.reload();
window.setTimeout("p1()",120000);
}
window.setTimeout("p1()",120000);
後面加上
- 代碼: 選擇全部
function rebirth_confirm(rebirth_money,rebirth_lv,basic,total_point)
{
message_cls();
temp_st=new Array("str","smart","life","agl");
var view_name=parent.wog_view;
view_name.document.write('<form method="POST" action="wog_act.php">');
view_name.document.write('<INPUT TYPE="hidden" NAME="act" VALUE="rebirth"><INPUT TYPE="hidden" NAME="f" VALUE="rebirth">');
view_name.document.write('<p align="center"><font face="新細明體" color="#FF0000"><b>轉生需付'+rebirth_money+'元,等級須達到'+rebirth_lv+'等!!</b></font></p>');
view_name.document.write('<p align="center"><font face="新細明體" color="#FF0000"><b>如果裝備欄已滿,身上裝備將被遺棄!!</b></font></p>');
view_name.document.write('<p align="center"><tr><td class="b1">重設角色屬性:<input type="radio" name="s" value="1">地 <input type="radio" name="s" value="2">水 <input type="radio" name="s" value="3">火 <input type="radio" name="s" value="4">木 <input type="radio" name="s" value="5">風 <input type="radio" name="s" value="6">毒</td></tr></p>');
view_name.document.write('<p align="center"><tr><td class="b1">重設角色能力: 基本值 '+basic+'<table border="1" cellspacing="0" cellpadding="0"><tr><td class="b2" width="70">力量 '+basic+'</td><td class="b2" width="70">智力 '+basic+'</td><td class="b2" width="70">體力 '+basic+'</td><td class="b2" width="70">敏捷 '+basic+'</td></tr>');
view_name.document.write('<tr>');
for(var j=0;j<4;j++)
{
view_name.document.write('<td class="b1"><select name='+temp_st[j]+'>');
for(var i=1;i<16;i++)
{
view_name.document.write('<option value="'+i+'">+'+i);
}
view_name.document.write('</select></td>');
}
view_name.document.write('</tr></table></p>');
view_name.document.write('<p align="center"><tr><td class="b1">★你共有「<font color="#FF0000"><b>'+total_point+'</b></font>」點的加分點數可增加能力值,請自行分配。分配總和超出<font color="#FF0000"><b>'+total_point+'</b></font>以上則無法註冊。</td></tr></p>');
view_name.document.write('<p align="center"><font face="新細明體" color="#FF0000"><b>按下確認鈕確認重生,若不重生請勿點選!!</b></font></p>');
view_name.document.write('<p align="center"><input type="submit" value="確認重生"></p>');
view_name.document.write('</form>');
}
function rebirth_end(a)
{
message_cls();
var view_name=parent.wog_view;
var s=new Array;
s[1]="您未達到指定等級";
s[2]="金錢不足";
s[3]="這次的重生失敗了";
s[4]="您已經重獲新生了";
view_name.document.write(temp_table1);
view_name.document.write('<tr><td >'+s[a]+'!!</td></tr>')
view_name.document.write(temp_table2);
}
新增class/wog_act_rebirth.php 寫:<?
/***************************************************************************
外掛名稱: Rebirth MOD
外掛作者: ~木林森~ <http://holyfun.no-ip.org/holyfunbbs/>
外掛描述: 使玩家可以利用重生系統重新由擁有較強能力的1等角色遊玩WOG。
外掛版本: 1.0.0
***************************************************************************/
class wog_act_rebirth{
function rebirth_confirm($user_id)
{
global $DB_site,$wog_arry;
$p=$DB_site->query_first("select * from wog_player where p_id = '".$user_id."'");
if($p[p_userlv]==0 && $wog_arry["rebirth_vip"]==1){
alertWindowMsg("重生系統為VIP會員專用!");
}
if($p[p_rebirth]<1){
$basic=30;
}else{
$basic=$p[p_rebirth]*50;
}
showscript("parent.rebirth_confirm(".$wog_arry['rebirth_money'].",".$wog_arry['rebirth_lv'].",".$basic.",".$wog_arry['total_point'].")");
}
function rebirth($user_id)
{
global $DB_site,$_POST,$lang,$wog_arry;
$p=$DB_site->query_first("select * from wog_player where p_id=".$user_id."");
if($p[p_rebirth]<1){
$basic=30;
}else{
$basic=$p[p_rebirth]*50;
}
$luck=rand(10,20);
if($p[p_lv]<$wog_arry["rebirth_lv"]){
showscript("parent.rebirth_end(1)");
}elseif(!isset($_POST[s]) || empty($_POST[s])){
alertWindowMsg("您沒有選擇新的屬性!","javascript:history.go(-1)");
}elseif($p[p_money]<$wog_arry["rebirth_money"]){
showscript("parent.rebirth_end(2)");
}elseif( ((int)$_POST["str"]+(int)$_POST["smart"]+(int)$_POST["agl"]+(int)$_POST["life"]) > $wog_arry["total_point"] ){
alertWindowMsg("加分點數超過".$wog_arry["total_point"],"javascript:history.go(-1)");
}elseif($wog_arry["rebirth_fail"]==1 && rand(1,$wog_arry["rebirth_fail_max"])==1){
showscript("parent.rebirth_end(3)");
}else{
$d=$DB_site->query_first("select a_id,d_body_id,d_head_id,d_hand_id,d_foot_id,d_item_id from wog_player where p_id=".$user_id."");
for($i=0;$i<6;$i++){
if($d[$i]<>0){
switch($i)
{
case "0":
$a_id="a_id";
break;
case "1":
$a_id="d_body_id";
break;
case "2":
$a_id="d_head_id";
break;
case "3":
$a_id="d_hand_id";
break;
case "4":
$a_id="d_foot_id";
break;
case "5":
$a_id="d_item_id";
break;
}
$x=$DB_site->query_first("SELECT a.$a_id,b.$a_id,c.d_at,c.d_mat,c.d_df,c.d_mdf,c.d_agl FROM wog_item a,wog_player b,wog_df c WHERE a.p_id=$user_id AND b.p_id=$user_id AND c.d_id=b.$a_id");
$item=explode(",",$x[0]);
if(count($item)<10){
$x[0].=($x[0] == "")?$x[1]:",".$x[1];
$DB_site->query("update wog_item set $a_id='$x[0]' where p_id=$user_id");
}
$DB_site->query("UPDATE wog_player SET $a_id='',p_at=p_at-$x[d_at],p_mat=p_mat-$x[d_mat],p_df=p_df-$x[d_df],p_mdf=p_mdf-$x[d_mdf],p_agl=p_agl-$x[d_agl] WHERE p_id=$user_id");
}
}
$DB_site->query("INSERT INTO wog_message SET p_id=".$user_id.",title='收到來自系統的訊息:<br><table width=80% border=1 bordercolor=#999999 bgcolor=#333333 cellspacing=0 cellpadding=10><tr><td style=text-align:left><p align="center">順利重生!這是您第".($p[p_rebirth]+1)."次重生!</p></td></tr></table>',dateline=".time());
if($p[p_rebirth]==0){
$p[p_rebirth]=1;
}
$DB_site->query("update wog_player set p_lv=1,p_exp=0,p_nextexp=1000,p_at=".rand($p[p_rebirth]*2,$p[p_rebirth]*10)."+".($_POST["str"]+$basic).",
p_df=".rand($p[p_rebirth]*2,$p[p_rebirth]*10)."+".($_POST["str"]+$basic).",p_mat=".rand($p[p_rebirth]*2,$p[p_rebirth]*10)."+".($_POST["smart"]+$basic).",
p_mdf=".rand($p[p_rebirth]*2,$p[p_rebirth]*10)."+".($_POST["smart"]+$basic).", p_str=".rand($p[p_rebirth],$p[p_rebirth]*5)."+".($_POST["str"]+$basic).",p_life=".rand($p[p_rebirth],$p[p_rebirth]*5)."+".($_POST["life"]+$basic).",
p_smart=".rand($p[p_rebirth],$p[p_rebirth]*5)."+".($_POST["smart"]+$basic).",p_agl=".rand($p[p_rebirth],$p[p_rebirth]*5)."+".($_POST["agl"]+$basic).",p_au=".rand($p[p_rebirth]*2,$p[p_rebirth]*6)."+$basic/2,p_be=".rand($p[p_rebirth],$p[p_rebirth]*5)."+$basic/2,p_hp=".($_POST["life"]*2+$basic).",
p_hpmax=".($_POST["life"]*2+$basic).", p_luck=".$luck.",p_s=".$_POST[s].",ch_id=6,p_ch_s_id=0,
p_money=p_money-".$wog_arry["rebirth_money"].",p_rebirth=p_rebirth+1 where p_id=".$user_id);
showscript("parent.rebirth_end(4)");
}
}
}
?>
備註 寫:因為有修改到wog.js,所以記得要重新整理...