[分享](V3)定時會戰

WOG設定安裝教學

版主: 涅魂, 簫哥


涅魂
 
文章: 4463
註冊時間: 2004-01-04 11:17 am
來自: Taiwan
性別: 男生

[分享](V3)定時會戰

文章涅魂 » 2007-04-23 10:03 pm

定時會戰 for WOG V3

這次因為必須在act與fight中共用,因此程式碼只能寫在兩者皆有使用的global.php中

若希望以勞力換取效率的話可以將時間設定與判定的部分(global.php的修改)移至wog_act_group.php和wog_fight_select.php內
[hr]開始修改[hr]
開啟檔案wog/class/wog_act_group.php 寫:In group_fire_list_peo() Function

尋找
代碼: 選擇全部
global $DB_site,$_POST,$wog_arry,$lang;

改為
代碼: 選擇全部
global $DB_site,$_POST,$wog_arry,$lang[color=red],$fire[/color];

尋找
代碼: 選擇全部
      if($group_main["g_fire"]==0)
      {
         alertWindowMsg($lang['wog_act_group_fireset']);
      }

改為
代碼: 選擇全部
      if($group_main["g_fire"]==0 [color=red]&& $fire==0[/color])
      {
         alertWindowMsg($lang['wog_act_group_fireset']);
      }

尋找
代碼: 選擇全部
$group=$DB_site->query("select a.g_id,a.g_name from wog_group_main a where a.g_id<>".$group_main[0]." and g_fire=1");

改為
代碼: 選擇全部
      if($fire==1)
      $group=$DB_site->query("select a.g_id,a.g_name from wog_group_main a where a.g_id<>".$group_main[0]." ");
      else
      $group=$DB_site->query("select a.g_id,a.g_name from wog_group_main a where a.g_id<>".$group_main[0]." and g_fire=1");

開啟檔案wog/class/wog_fight_select.php 寫:In fire_group() Function

尋找
代碼: 選擇全部
global $DB_site,$_POST,$wogclass,$wog_arry,$lang;

改為
代碼: 選擇全部
global $DB_site,$_POST,$wogclass,$wog_arry,$lang[color=red],$fire[/color];

尋找
代碼: 選擇全部
$sql="select a.g_a_hp,a.g_a_id,b.g_name,b.g_money from wog_group_area a,wog_group_main b where a.g_id=".$_POST["to_group"]." and a.g_a_type=".$_POST["g_a_type"]." and a.g_id=b.g_id and b.g_fire=1";

改為
代碼: 選擇全部
$sql="select a.g_a_hp,a.g_a_id,b.g_fire,b.g_name,b.g_money from wog_group_area a,wog_group_main b where a.g_id=".$_POST["to_group"]." and a.g_a_type=".$_POST["g_a_type"]." and a.g_id=b.g_id";

尋找
代碼: 選擇全部
if(!$p)

改為
代碼: 選擇全部
if(!$p || ($p['g_fire']==0 [color=red]&& $fire==0[/color]))

開啟檔案wog/forum_support/global.php 寫:尋找
代碼: 選擇全部
// end init db

下方,加上
代碼: 選擇全部
$begin_d=23;   ##begin_day
$end_d   =23;   ##end_day
$begin_h=0;   ##begin_hour
$end_h   =24;   ##end_hour
$fire=0;
$time_check=explode(',',date("d,H",time()));
if($time_check[0]>=$begin_d && $time_check[0]<=$end_d && $time_check[1]>=$begin_h && $time_check[1]<=$end_h)
$fire=1;

完畢,有任何問題歡迎指教^^


最後由 涅魂 於 2007-05-03 10:46 pm 編輯,總共編輯了 2 次。

leo199345
 
文章: 198
註冊時間: 2006-01-18 9:32 pm

文章leo199345 » 2007-04-23 10:20 pm

一安完一試就成功了

應該就沒有什麼問題

只是group_fight_list_peo是group_fire_list_peo

和fight_group是fire_group

兩個小錯誤@@"
[hr]

還有一個問題~~

如果要設定星期幾又要怎樣呢??~~

謝涅大




涅魂
 
文章: 4463
註冊時間: 2004-01-04 11:17 am
來自: Taiwan
性別: 男生

文章涅魂 » 2007-04-23 10:28 pm

喔喔,程式碼沒看清楚,抱歉^^"

至於若要換成禮拜的話改成這樣即可^^
代碼: 選擇全部
$begin_week=0;   ##begin_week
$end_week   =0;   ##end_week
$begin_h=0;   ##begin_hour
$end_h   =24;   ##end_hour
$fire=0;
$time_check=explode(',',date("w,H",time()));
if($time_check[0]>=$begin_week && $time_check[0]<=$end_week && $time_check[1]>=$begin_h && $time_check[1]<=$end_h)
$fire=1;

另外要注意,禮拜的代號是從0(禮拜日)~6(禮拜六)


圖檔

leo199345
 
文章: 198
註冊時間: 2006-01-18 9:32 pm

文章leo199345 » 2007-04-24 10:40 pm

再問一個問題...

要設定某幾天日子,,例如

1號,,12號,,24號.....

強制開公會戰..

又要怎寫??~



頭像
齋月
 
文章: 557
註冊時間: 2006-02-27 7:54 am

文章齋月 » 2007-04-25 2:27 am

use date()
http://us2.php.net/date

代碼: 選擇全部
$time_check=explode(',',date("w,H,d",time()));
if($time_check[2]==01 ||  $time_check[2]==12 || $time_check[2]==24)
$fire=1;


at school and bell was already rang..... so can't explain well @@
gotta go to class la~~ see ya

[hr]
回到家了~~ 上面的 date() 資料可以看一下。
相信會有用的~~

基本上就是這樣限制了。




回到 精華區

誰在線上

正在瀏覽這個版面的使用者:沒有註冊會員 和 4 位訪客

cron