這次不把npcupdata放在sea.cgi
直接放在
battle.cgi
找- sub enemy {
- &get_all_users;
- &form_table('up','100%',1);
- &reload;
- print qq|襲擊 |;
- &submit_button;
- print qq|</td></tr><tr><td align=left>\n|;
- foreach (@alllines) {
- ($uid,$uname,$usex,$uarea,$uport,$utactics) = (split(/<>/))[0,1,3,15,16,18];
- if ( ((($port != $uport) || !$port) && ($port || $uport || ($area != $uarea))) || $id == $uid) { next }
- $checked = !$first ? ' checked' : '';
- $surrender = $utactics == 3 ? ' 白旗' : '';
- $first =1;
- $sex_img = $usex ? $wmn_img : $man_img;
- $on_click = qq|onClick="return opWin('$listcgi?mode=uprofile&uid=$uid','win6')"|;
- print qq|<input type=radio name=uid value="$uid"$checked>\n|;
- print qq|<img src="$img/$sex_img"><a href="$listcgi?mode=uprofile&uid=$uid" $on_click target=_blank>$uname</a>$surrender<br>\n|;
- }
- if (!$sex_img) { print qq|附近沒有發現其他艦隊...| }
- print qq|<input type=hidden name=mode value="battle">\n|;
- &id_ps;
- &form_table('down');
- &b_lift;
- }
複製代碼 以下加上- #NPC#
- sub NPC_update{
- my @NPC_uid = ("00002"); # NPC ID
- my $NPCdir = 'npcdir'; # NPC帳戶資料存放目錄(※可更改 不可與usrdir相同)
-
- foreach (@NPC_uid) {
- my $NPC_load_file = new Nfile("$NPCdir\/$_\.dat",'read');
- my @npc_ilines = $NPC_load_file->read;
- if (!@npc_ilines) { &error("NPC資料讀取錯誤"); }
- if ($npc_ilines[0] eq "Read Error") {&msg("<font color="#FF0000">NPC檔案不存在!</font>");return;}
- my $NPC_save_file = new Nfile("$usrdir\/$_\.dat",'save');
- my @npc_update = $NPC_save_file->read;
- if (!@npc_update) { &error("NPC資料讀取錯誤"); }
- if ($npc_update[0] eq "Read Error") {&msg("<font color="#FF0000">NPC檔案不存在!</font>");return;}
- $NPC_save_file->write(@npc_ilines);
- }
- }
複製代碼 ========================
找- sub battle {
- .........
- &into_ind; &into_uind;
- &set_me;
- &set_u;
- 改成
- [code]
- #if($Npcship_total < 50 ){ #判斷如果小於50條船重新
- if ($uship_line =~ /武藏/) { #判斷全部船中 如果如果沒有武藏...
- }else { #如果沒有武藏...
- &NPC_update; #重生Npc
- #$ship[0][4]; = 中間那條船
- #$ship[2][4]; = 中間左邊那條船
- #$ship[1][4]; = 中間右邊那條船
- }
-
- &play;
- }
複製代碼 這如果NPC一條武藏也沒有了, 就會重生
至於重生後的NPC 會否出現新船名 還在研究中
//---------------------------------------------------------- if($uid == '00002'){
- $uship[0][4] ='測試改船名';
- $action = '';
- &set_u;
- }
複製代碼 這方法是失敗的
|