1 頁 (共 13 頁)

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

發表於 : 2004-01-03 00:04
ilove1291
:?: 請問我把fuction_eol.php的這一段刪掉可以阻止EOL
自動刪除NPC嗎??

[php]<?php
// 自爆
$sql = "delete from phpbb_rpg_npc where (rpg_cur_hp = rpg_max_hp and generate_time <= " . (time() - 21600) .
") or generate_time is null or generate_time <= " . (time() - 43200);
$db->sql_query($sql);
?>[/php]

詳細完整版如下

[php]<?php
function GenerateNPC()
{
global $db;

// 自爆
$sql = "delete from phpbb_rpg_npc where (rpg_cur_hp = rpg_max_hp and generate_time <= " . (time() - 21600) .
") or generate_time is null or generate_time <= " . (time() - 43200);
$db->sql_query($sql);

$rpg_lv = array();
$npc_lv = array();
$sql = "select distinct rpg_level from phpbb_rpg_npc where npc_name is null";
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
do
{
$npc_lv[] = $row['rpg_level'] - 5;
}
while ( $row = $db->sql_fetchrow($result) );
}
$sql = "select rpg_level from phpbb_users where rpg_eol_data is not null and right(rpg_eol_data, 6) <> '000086' and rpg_level not in (" .
implode(', ', $npc_lv) . ")";

$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
do
{
$rpg_lv[] = $row['rpg_level'] + 5;
}
while ( $row = $db->sql_fetchrow($result) );
}
$npc_count = 10;
$npc_level = 1;

// 普通路人
$sql = "select avg(rpg_level) as eol_level from phpbb_users where rpg_level > 10 and rpg_eol_data is not null";
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
$npc_level = $row['eol_level'];
}

$sql = "select count(*) as now_count from phpbb_rpg_npc where (npc_name is null or npc_name = '') and now_x < 24 and now_y > 47";
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
if ( $row['now_count'] < $npc_count )
{
for ($i = $row['now_count']; $i < $npc_count; $i++)
{
$rpg_lv[] = rand(($npc_level - 10 > 0 ? $npc_level - 10 : 1), $npc_level + 100);
}
}
}

if ( count($rpg_lv) > 0 )
{
srand((double)microtime()*1000000);
$sql = "select count(*) as map_count from phpbb_rpg_eol where map_id = 0 and can_not_pass = 0 and map_x < 24 and map_y > 47";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$map_count = $row['map_count'] - 1;
for ($i = 0; $i < count($rpg_lv); $i++)
{
$now_level = $rpg_lv[$i];
$rpg_max_hp = floor( $now_level * (100 + $now_level));
$rpg_attack = floor($now_level * rand((floor($now_level / 10) + 1) * 10, (floor($now_level / 10) * 2 + 5) * 10) / 10);
$rpg_defense = floor($now_level * rand((floor($now_level / 10) + 1) * 10, (floor($now_level / 10) * 2 + 5) * 10) / 10);
$rpg_magic = floor($now_level * rand((floor($now_level / 10) + 1) * 10, (floor($now_level / 10) * 2 + 5) * 10) / 10);
$rpg_speed = floor($now_level * rand((floor($now_level / 10) + 1) * 10, (floor($now_level / 10) * 2 + 5) * 10) / 10);
$sql = "insert into phpbb_rpg_npc (map_id, now_x, now_y, now_icon, now_dir, rpg_level,
rpg_cur_hp, rpg_max_hp, rpg_attack, rpg_defense, rpg_magic, rpg_speed, generate_time)
select map_id, map_x as now_x, map_y as now_y, '" . sprintf("%02d", rand(0, 22)) . "' as now_icon, " .
rand(0, 3) . " as now_dir, $now_level as now_level, $rpg_max_hp as rpg_cur_hp, $rpg_max_hp as rpg_max_hp,
$rpg_attack as rpg_attack, $rpg_defense as rpg_defense, $rpg_magic as rpg_magic, $rpg_speed as rpg_speed, " . time() .
" as generate_time from phpbb_rpg_eol where map_id = 0 and can_not_pass = 0 and map_x < 24 and map_y > 47 limit " . rand(0, $map_count) . ", 1";
$db->sql_query($sql);
}
}

// 進階路人
$npc_level = 0;
$sql = "select rpg_level from phpbb_users order by rpg_level desc limit 0, 20";
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
do
{
$npc_level += $row['rpg_level'];
}
while ( $row = $db->sql_fetchrow($result) );
}
$npc_level = floor($npc_level / 20);

$sql = "select count(*) as eol_count from phpbb_users
where rpg_eol_data is not null and right(rpg_eol_data, 6) <> '000086'";
$result = $db->sql_query($sql);
$npc_count = 10;
if ( $row = $db->sql_fetchrow($result) )
{
$npc_count = ($row['eol_count'] * 2 > 10 ? $row['eol_count'] * 2 : 10);
}

$sql = "select count(*) as now_count from phpbb_rpg_npc where (npc_name is null or npc_name = '') and rpg_level >= $npc_level";
$result = $db->sql_query($sql);
if ( $row = $db->sql_fetchrow($result) )
{
if ( $row['now_count'] < $npc_count )
{
$now_count = $row['now_count'];
srand((double)microtime()*1000000);
$sql = "select count(*) as map_count from phpbb_rpg_eol where map_id = 0 and can_not_pass = 0";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$map_count = $row['map_count'] - 1;
for ($i = $now_count; $i < $npc_count; $i++)
{
$now_level = rand($npc_level, $npc_level + 50);
$rpg_max_hp = floor( $now_level * (100 + $now_level));
$rpg_attack = floor($now_level * rand((floor($now_level / 10) + 1) * 10, (floor($now_level / 10) * 2 + 5) * 10) / 10);
$rpg_defense = floor($now_level * rand((floor($now_level / 10) + 1) * 10, (floor($now_level / 10) * 2 + 5) * 10) / 10);
$rpg_magic = floor($now_level * rand((floor($now_level / 10) + 1) * 10, (floor($now_level / 10) * 2 + 5) * 10) / 10);
$rpg_speed = floor($now_level * rand((floor($now_level / 10) + 1) * 10, (floor($now_level / 10) * 2 + 5) * 10) / 10);
$sql = "insert into phpbb_rpg_npc (map_id, now_x, now_y, now_icon, now_dir, rpg_level,
rpg_cur_hp, rpg_max_hp, rpg_attack, rpg_defense, rpg_magic, rpg_speed, generate_time)
select map_id, map_x as now_x, map_y as now_y, '" . sprintf("%02d", rand(0, 22)) . "' as now_icon, " .
rand(0, 3) . " as now_dir, $now_level as now_level, $rpg_max_hp as rpg_cur_hp, $rpg_max_hp as rpg_max_hp,
$rpg_attack as rpg_attack, $rpg_defense as rpg_defense, $rpg_magic as rpg_magic, $rpg_speed as rpg_speed, " . time() .
" as generate_time from phpbb_rpg_eol where map_id = 0 and can_not_pass = 0 limit " . rand(0, $map_count) . ", 1";
$db->sql_query($sql);
}
}
}

unset($i);
unset($npc_count);
unset($npc_level);
unset($now_level);
unset($rpg_max_hp);
unset($rpg_attack);
unset($rpg_defense);
unset($rpg_magic);
unset($rpg_speed);
unset($map_count);
unset($now_count);
unset($sql);
unset($row);
unset($result);
unset($rpg_lv);
unset($npc_lv);
}
?>[/php]

:?: 問題2: NPC產生的間隔數量要怎麼調整呢?_?

發表於 : 2004-01-03 00:14
吉川拓也
數量要怎麼調整呢?_?
找到 :

代碼: 選擇全部

$npc_count = [color=red]10[/color];
裡面紅色字就是數量 !!

另外 :

代碼: 選擇全部

$npc_level = [color=blue]1[/color]; 
裡面藍色字是等級 (預設)

在來 :

代碼: 選擇全部

$sql = "select avg(rpg_level) as eol_level from phpbb_users where rpg_level > [color=red]10[/color] 
裡面紅色部分是 NPC 出現等級 . > 或是 < 可自訂 !!

發表於 : 2004-01-03 21:00
ilove1291
修改成功
圖檔
變得好熱鬧阿~*
:lol: :?: 我想請問一下 我以前有看過 水怪道具功能詳解 可是現在找不到嚕 大大知道在哪嗎?
:?: 有沒有專門討論水怪程式的論壇(繁簡皆可)除了暗黑大陸(不給註冊嚕T_T)

發表於 : 2004-01-03 21:06
吉川拓也
竹貓就算是相當不錯的水怪支援網站了= =||
因為幾乎半數站長都有裝過rpg . 所以要說支援性這裡就很棒囉^^~

發表於 : 2004-01-03 22:21
ilove1291
吉川拓也 寫:竹貓就算是相當不錯的水怪支援網站了= =||
因為幾乎半數站長都有裝過rpg . 所以要說支援性這裡就很棒囉^^~
你的也很棒阿~*
吉川大 你可知水怪道具店裡面的道具的詳細功能?

發表於 : 2004-01-03 22:58
GeniusKiKi
ilove1291 寫:修改成功
變得好熱鬧阿~*
太熱鬧了一點吧~ 一.一|||
感覺不會怪怪的嗎~ 一.一|||

發表於 : 2004-01-03 23:05
看不出這個有什麼好玩的@@||
之前玩過不知道哪位大大站上的...
等走到敵人旁邊不知道已經過了幾分鐘了...= =||

發表於 : 2004-01-03 23:13
GeniusKiKi
文 寫:看不出這個有什麼好玩的@@||
之前玩過不知道哪位大大站上的...
等走到敵人旁邊不知道已經過了幾分鐘了...= =||
打發時間用的阿\r
你的問題應該是你自己等級太低

水怪 RPG 不是等級低的人可以玩的
因為等級低你打的動的人就少

也不是等級高的人可以玩的
因為你等級太高所有的人都不能打

發表於 : 2004-01-03 23:35
吉川拓也
ilove1291 寫:
吉川拓也 寫:竹貓就算是相當不錯的水怪支援網站了= =||
因為幾乎半數站長都有裝過rpg . 所以要說支援性這裡就很棒囉^^~
你的也很棒阿~*
吉川大 你可知水怪道具店裡面的道具的詳細功能?
詳細功能 ?
後台的還是 ? 錢台的道具使用功能 ?

發表於 : 2004-01-03 23:49
GeniusKiKi
吉川 大大可以分享一下水怪 RPG 的頭盔店嗎~ o_O

發表於 : 2004-01-03 23:53
吉川拓也
GeniusKiKi 寫:吉川 大大可以分享一下水怪 RPG 的頭盔店嗎~ o_O
頭盔目前還在測試中哩= =||
可能這一兩天再po上吧 . 這兩天已經在想盾牌了 ...
但是一堆名子想不出來 ...

發表於 : 2004-01-03 23:56
aiken
吉川先生~~
你的論壇在哪啊~~
找不到連結~想要參考看看咧~~
給個連結吧~~

發表於 : 2004-01-03 23:59
吉川拓也
aiken 寫:吉川先生~~
你的論壇在哪啊~~
找不到連結~想要參考看看咧~~
給個連結吧~~
我PM給你就好 ..
小論壇 . 不用PO網址啦= =||

發表於 : 2004-01-04 00:00
GeniusKiKi
aiken 寫:吉川先生~~
你的論壇在哪啊~~
找不到連結~想要參考看看咧~~
給個連結吧~~
阿呆
他的簽名檔圖片上按下滑鼠右鍵\r
選擇內容
你就會知道他從那邊來的了

http://nt66.com.tw/LineII/

發表於 : 2004-01-04 00:00
aiken
吉川拓也 寫:
aiken 寫:吉川先生~~
你的論壇在哪啊~~
找不到連結~想要參考看看咧~~
給個連結吧~~
我PM給你就好 ..
小論壇 . 不用PO網址啦= =||
噗~~會員一千多人逼進兩千人了咧...不是小論壇.....