[水怪RPG複雜化委員會]天空鬥技場興建計劃啟動

phpBB 2 MOD Support
無論是官方或非官方認證之外掛,安裝與使用問題討論。
(發表文章請按照公告格式發表,違者砍文)

版主: 版主管理群

dominic2708
星球普通子民
星球普通子民
文章: 21
註冊時間: 2003-12-23 05:25
聯繫:

文章 dominic2708 »

代碼: 選擇全部

要得到所有的東西則必須改下面兩行
將這行
$sql = "select count(*) as item_count from phpbb_rpg_items where in_which_store <= 2 and need_level <= $ulv and item_change >= $change";
改成
$sql = "select count(*) as item_count from phpbb_rpg_items where  need_level <= $ulv and item_change >= $change";
將這行
$sql = "select item_id, item_name from phpbb_rpg_items where in_which_store <= 2 and need_level <= $ulv and item_change >= $change order by item_id limit " . rand(0, $item_count) . " , 1";
改成
$sql = "select item_id, item_name from phpbb_rpg_items where need_level <= $ulv and item_change >= $change order by item_id limit " . rand(0, $item_count) . " , 1";
dominic2708
星球普通子民
星球普通子民
文章: 21
註冊時間: 2003-12-23 05:25
聯繫:

文章 dominic2708 »

代碼: 選擇全部

如果要會顯示你說的就必須 
這一句\r

$sql = "select item_id, item_name[color=#ff006e], in_which_store [/color]from phpbb_rpg_items where need_level <= $ulv and item_change >= $change order by item_id limit " . rand(0, $item_count) . " , 1"; 
新增紅色部份


將
$ret_msg .= "死因: $deadtype 並獲得若干道具: "; 
改成 
$ret_msg .= "死因: $deadtype "; 
然後這行 
$ret_msg .= $row2['item_name'] . ' '; 
改成 
switch ($row2['in_which_store']) { 
case '0' : 
$ret_msg .= "並獲得道具:" . $row2['item_name'] . ' '; 
break; 
case '1' : 
$ret_msg .= "並獲得武器:" . $row2['item_name'] . ' '; 
break; 
case '2' : 
$ret_msg .= "並獲得盔甲:" . $row2['item_name'] . ' '; 
break; 
case '3' : 
$ret_msg .= "並意外領悟:" . $row2['item_name'] . ' '; 
break; 
case '4' : 
$ret_msg .= "並獲得頭具:" . $row2['item_name'] . ' '; 
break; 

} 
剛第一次改時耍笨忘了提出in_which_store.......
頭像
ilove1291
星球公民
星球公民
文章: 171
註冊時間: 2003-04-19 22:44

文章 ilove1291 »

[php]<?php
function UserIsDead($wsql, $wsql2, $uid, $uname, $ulv, $deadtype, $is_npc = false)
{
global $db;

$ret_msg = '';
if ( $is_npc )
{
$sql = "select count(*) as dead_count, sum(rpg_level) as dead_level, sum(rpg_max_hp) as dead_money from phpbb_rpg_npc where rpg_cur_hp <= 0 and $wsql";
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
if ( $row['dead_count'] > 0 )
{
$sql = "select npc_id from phpbb_rpg_npc where rpg_cur_hp <= 0 and $wsql";
$result = $db->sql_query($sql);
if ( $row2 = $db->sql_fetchrow($result) )
{
$ret_msg = ' 擊敗: ';
do
{
$ret_msg .= ($row2['npc_name'] == '' ? '' . $row2['npc_id'] : $row2['npc_name']) . ' ';
}
while ( $row2 = $db->sql_fetchrow($result) );
$ret_msg .= "關鍵一擊: $deadtype ";
}
//掉寶率
// $sql = "select count(*) as item_count from phpbb_rpg_items where in_which_store <= 2 and need_level <= $ulv";
// $result = $db->sql_query($sql);
// $row2 = $db->sql_fetchrow($result);
// $item_count = $row2['item_count'] - 1;
// srand((double)microtime()*1000000);
// for ($i = 1; $i <= $row['dead_count']; $i++)
// {
// $sql = "select item_id, item_name from phpbb_rpg_items where in_which_store <= 2 and need_level <= $ulv order by item_id limit " . rand(0, $item_count) . " , 1";
// $result = $db->sql_query($sql);
srand((double)microtime()*1000000);
$change = rand(1, 100) ;
$sql = "select count(*) as item_count from phpbb_rpg_items where need_level <= $ulv and item_change >= $change";
$result = $db->sql_query($sql);
$row2 = $db->sql_fetchrow($result);
$item_count = $row2['item_count'] - 1;
for ($i = 1; $i <= $row['dead_count']; $i++)
{
$sql = "select item_id, item_name, in_which_store from phpbb_rpg_items where and need_level <= $ulv and item_change >= $change order by item_id limit " . rand(0, $item_count) . " , 1";
$result = $db->sql_query($sql);
$row2 = $db->sql_fetchrow($result);
switch ($row2['in_which_store']) {
case '0' :
$ret_msg .= "並獲得道具:" . $row2['item_name'] . ' ';
break;
case '1' :
$ret_msg .= "並獲得武器:" . $row2['item_name'] . ' ';
break;
case '2' :
$ret_msg .= "並獲得盔甲:" . $row2['item_name'] . ' ';
break;
case '3' :
$ret_msg .= "並意外領悟:" . $row2['item_name'] . ' ';
break;
case '4' :
$ret_msg .= "並獲得頭飾:" . $row2['item_name'] . ' ';
break;
case '5' :
$ret_msg .= "並獲得足具:" . $row2['item_name'] . ' ';
break;
case '6' :
$ret_msg .= "並獲得披風:" . $row2['item_name'] . ' ';
break;
case '7' :
$ret_msg .= "並獲得盾牌:" . $row2['item_name'] . ' ';
break;
case '8' :
$ret_msg .= "並獲得魔書:" . $row2['item_name'] . ' ';
break;
case '9' :
$ret_msg .= "並獲得飾品:" . $row2['item_name'] . ' ';
break;
}

$sql = "insert into phpbb_rpg_owns (user_id, item_id) values ($uid, " . $row2['item_id'] . ")";
$db->sql_query($sql);
//掉寶率
}
?>[/php]
他又不掉了真奇怪呢*.*
gigaguaze使出 普通攻擊 擊中 2116 損傷 473 點 擊敗: 2116 關鍵一擊: 普通攻擊(473)
都沒出現哩QQ 老師救命
dominic2708
星球普通子民
星球普通子民
文章: 21
註冊時間: 2003-12-23 05:25
聯繫:

文章 dominic2708 »

$sql = "select item_id, item_name, in_which_store from phpbb_rpg_items where and need_level <= $ulv and item_change >= $change order by item_id limit " . rand(0, $item_count) . " , 1";



這段where and need_level....多了and
^^...唷...你學得也很快唷..馬上就加了case...
頭像
ilove1291
星球公民
星球公民
文章: 171
註冊時間: 2003-04-19 22:44

文章 ilove1291 »

XD 學生真是粗心

我又遇到一個問題了
我想在轉職的時候寫入 USER最新的職業類別user_class 跟職業名稱user_nowjob

[php]<?php
$sql = "select position_fee, position_name from phpbb_rpg_position where position_class = $cid and position_order = $oid ";
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
if ($row['position_fee'] > $profiledata['user_money'])
$err_posmsg = '現金不足,無法繳交報名費!!';
}
else
{
message_die(GENERAL_ERROR, '無法取得考照報名費!!', '', __LINE__, __FILE__, $sql);
}
if ($err_posmsg == '')
{

$sql = "update " . CONFIG_TABLE . " set config_value = config_value + " . $row['position_fee'] . " where config_name = 'rpg_jackpot'";
$db->sql_query($sql);
$sql = "update " . USERS_TABLE . " set user_money = user_money - " . $row['position_fee'] . " where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$sql = "update " . USERS_TABLE . " set user_class = $cid where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$sql = "update " . USERS_TABLE . " set user_nowjob = " . $row['position_name'] . " where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$sql = "insert into phpbb_rpg_medals values (" . $profiledata['user_id'] . ", $cid, $oid, " . time() . ", 1)";
$db->sql_query($sql);
$sql = "update phpbb_rpg_medals set last_class = 0 where position_class = $cid and position_order < $oid and user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
UpdateRPGProperties($profiledata['user_id']);
$profiledata = get_userdata(intval($userdata['user_id']));
$lastlevel += UPGRADE_LEVEL;
}
unset($oid);
unset($cid);
?>[/php]
user_class可以寫入\r
但是user_nowjob寫不進去呢
dominic2708
星球普通子民
星球普通子民
文章: 21
註冊時間: 2003-12-23 05:25
聯繫:

文章 dominic2708 »

抱歉
這句我聽不懂???
我又遇到一個問題了
我想在轉職的時候寫入 USER最新的職業類別user_class 跟職業名稱user_nowjob
使用者的職業不是?在phpbb_user的rpg_medals 為什麼還有user_nowjob??這是你自己新增的嗎?
頭像
ilove1291
星球公民
星球公民
文章: 171
註冊時間: 2003-04-19 22:44

文章 ilove1291 »

dominic2708 寫:抱歉
這句我聽不懂???
我又遇到一個問題了
我想在轉職的時候寫入 USER最新的職業類別user_class 跟職業名稱user_nowjob
使用者的職業不是?在phpbb_user的rpg_medals 為什麼還有user_nowjob??這是你自己新增的嗎?
是滴
我再PHP_USERS增加了這兩個
因為我想取得使用者最後一次(最近一次)轉的職業
問題因該是這一段\r
[php]
$sql = "select position_fee, position_name from phpbb_rpg_position where position_class = $cid and position_order = $oid ";
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
if ($row['position_fee'] > $profiledata['user_money'])
$err_posmsg = '現金不足,無法繳交報名費!!';
}
else
{
message_die(GENERAL_ERROR, '無法取得考照報名費!!', '', __LINE__, __FILE__, $sql);
}
if ($err_posmsg == '')
{

$sql = "update " . USERS_TABLE . " set user_nowjob = " . $row['position_name'] . " where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
?>[/php]

如果我用position_fee 他可以寫的進去說~"~
[php]<?php
$sql = "update " . USERS_TABLE . " set user_nowjob = " . $row['position_fee'] . " where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
?>[/php]
dominic2708
星球普通子民
星球普通子民
文章: 21
註冊時間: 2003-12-23 05:25
聯繫:

文章 dominic2708 »

$sql = "update " . USERS_TABLE . " set user_nowjob = " . $row['position_name'] . " where user_id = " . $profiledata['user_id'];
這一句有個問題...這個$row['position_name']是舊的值.....再插入一次還是舊的
另外..這樣改為什麼不換成顯示..最後加入的職業就是最新的^^..這樣也少動一次sql存取
頭像
ilove1291
星球公民
星球公民
文章: 171
註冊時間: 2003-04-19 22:44

文章 ilove1291 »

dominic2708 寫:..最後加入的職業就是最新的^^..這樣也少動一次sql存取
現在的顯示是你有幾類職業就會都顯示出來

我想要新增一個最新轉的職業給eol判斷用 我想讓eol可以有職業外觀


[php]<?php
$sql = "select position_fee, position_name from phpbb_rpg_position where position_class = $cid and position_order = $oid ";
$result = $db->sql_query($sql);
?>[/php]這段對嗎?
dominic2708
星球普通子民
星球普通子民
文章: 21
註冊時間: 2003-12-23 05:25
聯繫:

文章 dominic2708 »

ilove1291 寫:
dominic2708 寫:..最後加入的職業就是最新的^^..這樣也少動一次sql存取
現在的顯示是你有幾類職業就會都顯示出來

我想要新增一個最新轉的職業給eol判斷用 我想讓eol可以有職業外觀


[php]<?php
$sql = "select position_fee, position_name from phpbb_rpg_position where position_class = $cid and position_order = $oid ";
$result = $db->sql_query($sql);
?>[/php]這段對嗎?
為什麼要取?position_fee這句沒問題...那個應該可以不用...不過這樣應該寫在另一段會比較好..我還在找中
頭像
ilove1291
星球公民
星球公民
文章: 171
註冊時間: 2003-04-19 22:44

文章 ilove1291 »

dominic2708 寫:
ilove1291 寫:
dominic2708 寫:..最後加入的職業就是最新的^^..這樣也少動一次sql存取
現在的顯示是你有幾類職業就會都顯示出來

我想要新增一個最新轉的職業給eol判斷用 我想讓eol可以有職業外觀


[php]<?php
$sql = "select position_fee, position_name from phpbb_rpg_position where position_class = $cid and position_order = $oid ";
$result = $db->sql_query($sql);
?>[/php]這段對嗎?
為什麼要取?position_fee這句沒問題...那個應該可以不用...不過這樣應該寫在另一段會比較好..我還在找中
因為我看他下面有
$sql = "update "
所以就試試看順便抓 position_name來update

本來是這樣\r
[php]<?php
$sql = "select position_fee from phpbb_rpg_position where position_class = $cid and position_order = $oid";
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
if ($row['position_fee'] > $profiledata['user_money'])
$err_posmsg = '現金不足,無法繳交報名費!!';
}
else
{
message_die(GENERAL_ERROR, '無法取得考照報名費!!', '', __LINE__, __FILE__, $sql);
}
if ($err_posmsg == '')
{

$sql = "update " . CONFIG_TABLE . " set config_value = config_value + " . $row['position_fee'] . " where config_name = 'rpg_jackpot'";
$db->sql_query($sql);
$sql = "update " . USERS_TABLE . " set user_money = user_money - " . $row['position_fee'] . " where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$sql = "insert into phpbb_rpg_medals values (" . $profiledata['user_id'] . ", $cid, $oid, " . time() . ", 1)";
$db->sql_query($sql);
$sql = "update phpbb_rpg_medals set last_class = 0 where position_class = $cid and position_order < $oid and user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
UpdateRPGProperties($profiledata['user_id']);
$profiledata = get_userdata(intval($userdata['user_id']));
$lastlevel += UPGRADE_LEVEL;
}
?>[/php]

我改的這樣\r
[php]<?php
$sql = "select position_fee, position_name from phpbb_rpg_position where position_class = $cid and position_order = $oid ";
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
if ($row['position_fee'] > $profiledata['user_money'])
$err_posmsg = '現金不足,無法繳交報名費!!';
}
else
{
message_die(GENERAL_ERROR, '無法取得考照報名費!!', '', __LINE__, __FILE__, $sql);
}
if ($err_posmsg == '')
{

$sql = "update " . CONFIG_TABLE . " set config_value = config_value + " . $row['position_fee'] . " where config_name = 'rpg_jackpot'";
$db->sql_query($sql);
$sql = "update " . USERS_TABLE . " set user_money = user_money - " . $row['position_fee'] . " where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$sql = "update " . USERS_TABLE . " set user_class = $cid where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$sql = "update phpbb_users set user_nowjob = " . $row['position_name'] . " where user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
$sql = "insert into phpbb_rpg_medals values (" . $profiledata['user_id'] . ", $cid, $oid, " . time() . ", 1)";
$db->sql_query($sql);
$sql = "update phpbb_rpg_medals set last_class = 0 where position_class = $cid and position_order < $oid and user_id = " . $profiledata['user_id'];
$db->sql_query($sql);
UpdateRPGProperties($profiledata['user_id']);
$profiledata = get_userdata(intval($userdata['user_id']));
$lastlevel += UPGRADE_LEVEL;
}
?>[/php]
dominic2708
星球普通子民
星球普通子民
文章: 21
註冊時間: 2003-12-23 05:25
聯繫:

文章 dominic2708 »

...不過我覺得這段寫在\r
function UpdateRPGProperties($uid)這個函數內比較方便...只要改幾個地方就可以不用寫sql="xxxxoooo"

總之都可以既然你已經這樣寫....就先試試
頭像
ilove1291
星球公民
星球公民
文章: 171
註冊時間: 2003-04-19 22:44

文章 ilove1291 »

dominic2708 寫:...不過我覺得這段寫在\r
function UpdateRPGProperties($uid)這個函數內比較方便
我的UpdateRPGProperties 長這樣\r
[php]<?php
function UpdateRPGProperties($uid)
{
global $db;

$attplus = 1.0;
$defplus = 1.0;
$magplus = 1.0;
$spdplus = 1.0;
$hp_plus = 0.0;
$mp_plus = 0.0;
$sql = 'SELECT MAX(position_order) as basetop FROM phpbb_rpg_position WHERE position_class = 0';
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, '無法取得基礎職業屬性!!', '', __LINE__, __FILE__, $sql);
}
if ( $row = $db->sql_fetchrow($result) )
{
$sql = 'SELECT * FROM phpbb_rpg_position WHERE position_class = 0 AND position_order = ' . $row['basetop'];
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, '無法取得基礎職業屬性!!', '', __LINE__, __FILE__, $sql);
}
if ( $row = $db->sql_fetchrow($result) )
{
// 取得基礎職業的標準值\r
$base_att = $row['attack_property'];
$base_def = $row['defense_property'];
$base_mag = $row['magic_property'];
$base_spd = $row['speed_property'];
$base_hpp = $row['hp_property'];
$base_mpp = $row['magic_property'];
}
$sql = 'SELECT p.* FROM phpbb_rpg_position p, phpbb_rpg_medals m WHERE p.position_class = m.position_class
AND p.position_order = m.position_order AND m.last_class = 1 AND m.position_class <> 0 AND m.user_id = ' . $uid;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, '無法取得專業職業屬性!!', '', __LINE__, __FILE__, $sql);
}
if ( $row = $db->sql_fetchrow($result) )
{
$i = 1;
$newposition = '';
do
{
if ($i == 1)
{
$attplus = $row['attack_property'];
$defplus = $row['defense_property'];
$magplus = $row['magic_property'];
$spdplus = $row['speed_property'];
$hp_plus = $row['hp_property'];
$mp_plus = $row['magic_property'];
$newposition = '<img alt=' . $row['position_name'] . ' src="images/position/' . $row['position_name'] . '.gif">';
}
else
{
$attplus += $row['attack_property'] - $base_att;
$defplus += $row['defense_property'] - $base_def;
$magplus += $row['magic_property'] - $base_mag;
$spdplus += $row['speed_property'] - $base_spd;
$hp_plus += $row['hp_property'] - $base_hpp;
$mp_plus += $row['magic_property'] - $base_mpp;
$newposition .= '<img alt=' . $row['position_name'] . ' src="images/position/' . $row['position_name'] . '.gif">';
}
$i++;
}
while ( $row = $db->sql_fetchrow($result) );

if(strlen($newposition) > 200)
{
$newposition = substr($newposition, 0, 200);
}
}
else
{
// 只有基礎職業
$sql = 'SELECT p.* FROM phpbb_rpg_position p, phpbb_rpg_medals m WHERE p.position_class = 0 AND m.last_class = 1
AND m.position_class = 0 AND p.position_order = m.position_order AND m.user_id = ' . $uid;
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, '無法取得基礎職業屬性!!', '', __LINE__, __FILE__, $sql);
}
if ( $row = $db->sql_fetchrow($result) )
{
$attplus = $row['attack_property'];
$defplus = $row['defense_property'];
$magplus = $row['magic_property'];
$spdplus = $row['speed_property'];
$hp_plus = $row['hp_property'];
$mp_plus = $row['magic_property'];
$newposition = '<img alt=' . $row['position_name'] . ' src="images/position/' . $row['position_name'] . '.gif">';
}
}
}
?>[/php]
總之都可以既然你已經這樣寫....就先試試
還是卡在不能update user_nowjob
dominic2708
星球普通子民
星球普通子民
文章: 21
註冊時間: 2003-12-23 05:25
聯繫:

文章 dominic2708 »

我發現我前面看錯了..你先試試你現在的..不行我再重看一次
dominic2708
星球普通子民
星球普通子民
文章: 21
註冊時間: 2003-12-23 05:25
聯繫:

文章 dominic2708 »

繼續試你之前的
把這句\r
$sql = "update phpbb_users set user_nowjob = " . $row['position_name'] . " where user_id = " . $profiledata['user_id'];
改成
$sql = "update " . USERS_TABLE . " set user_nowjob = " . $row['position_name'] . " where user_id = " . $profiledata['user_id'];


然後貼一下你nowjob的屬性看一下...除非你的phpbb_users是phpbb2_users
所以打phpbb_user不行
不服輸...不解決絕不放棄 :evil:
主題已鎖定

回到「外掛問題討論」