#!/usr/bin/perl require '/home/rexi-jp/public_html/jj/lib/lib.pl'; require '/home/rexi-jp/public_html/jj/lib/scenario.pl'; require '/home/rexi-jp/public_html/jj/lib/mobile.pl'; $mycgi = 'opening.cgi'; $mid = $uid; $uid = ''; use CGI; use CGI::Carp qw(fatalsToBrowser); use File::Basename; $ip = $ENV{'REMOTE_ADDR'}; $host = gethostbyaddr(pack("C4", split(/\./, $ip)), 2); $host ||= $ENV{'REMOTE_HOST'}; $host ||= $ip; $referer=$ENV{'HTTP_REFERER'}; $script=$ENV{'SCRIPT_NAME'}; $uid = &get_usr_cookie; $pcid = &get_pcid_cookie; @school_str = ('','一年生','二年生','三年生','その他'); $query = CGI->new; my @params = $query->param();#全てのパラメータ名を取得 なのでこれを$inにしてしまえば$inで使用可能 foreach my $param (@params) { $in{$param} = $query->param($param); } if ($in{'seq'} eq ''){&err("不正なパラメータ");} $dbh = &connectDB($mainDB); #PC情報取得 $death_flg = &death_check($pcid,$dbh); $sql = "select name1,name3,attribute,class,sex,birth,last_say_name_scenario,last_say_icon_scenario,death from character where pcid = '$pcid';"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($out{'name1'},$name3,$attribute,$pcclass,$pcsex,$pcbirth,$last_say_name_scenario,$last_say_icon_scenario)=@{$ref->[0]}; $pcicon = &def_icon($pcclass,$attribute,$pcsex,$death); $sql = "select a.type,a.title,a.text,a.comment,op_illust,a.difficulty,a.source,a.attribute1,a.attribute2,a.reserve_close,a.playing_close,a.member_max,b.name,a.npc,a.option1,a.option2,a.main_id,a.another_flg,a.open_date from scenario a,master b where a.seq = $in{'seq'} and a.scenario_result = 1 and a.open_date <= now() and a.msid != 'system' and a.state = 0 and a.msid = b.id;"; if ($uid eq 2){ $sql = "select a.type,a.title,a.text,a.comment,op_illust,a.difficulty,a.source,a.attribute1,a.attribute2,a.reserve_close,a.playing_close,a.member_max,b.name,a.npc,a.option1,a.option2,a.main_id,a.another_flg,a.open_date from scenario a,master b where a.seq = $in{'seq'} and a.scenario_result = 1 and a.msid != 'system' and a.state = 0 and a.msid = b.id;"; } #if ($uid eq 4){ # $sql = "select a.type,a.title,a.text,a.comment,op_illust,a.difficulty,a.source,a.attribute1,a.attribute2,a.reserve_close,a.playing_close,a.member_max,b.name,a.npc,a.option1,a.option2,a.main_id,a.another_flg from scenario a,master b where a.seq = $in{'seq'} and a.scenario_result = 1 and a.msid = b.id;"; #} $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($type,$out{'title'},$out{'text'},$out{'comment'},$out{'op_illust'},$difficulty,$source,$attribute1,$attribute2,$reserve_close,$playing_close,$out{'member_max'},$out{'ms_name'},$npc,$option1,$option2,$main_id,$another_flg,$open_date)=@{$ref->[0]}; @atb_cnt = (); @atb_cnt = &atb_balance($out{'member_max'},$attribute1,$attribute2); $atb1_max = @atb_cnt[0]; $atb2_max = @atb_cnt[1]; $out{'ms_name'} = &chr_rtn($out{'ms_name'}); if ($out{'title'} eq ''){&err("該当するシナリオが見つかりませんでした。");} $out{'seq'} = $in{'seq'}; if ($in{'mode'} eq ''){ ⊤ } elsif ($in{'mode'} eq 'bbs_say'){ &bbs_say; } elsif ($in{'mode'} eq 'res_del'){ &res_del; } elsif ($in{'mode'} eq 'meeting'){ &meeting; } else{ &err("不正なパラメータ"); } &disconDB($dbh); exit; #--------------------------------------- # HTML出力 #--------------------------------------- sub html_out { $file = $_[0]; open FILE,$file; print $header; while(){ s/!(\w+)!/$out{$1}/g; print; } close FILE; exit; } #--------------------------------------- # TOP表示 #--------------------------------------- sub top { &date_rtn; $out{'type'} = @sc_type_icon[$type]; if ($type eq 4){$out{'beginer'} = '(ビギナー)';} $out{'source'} = @source_list[$source]; $out{'difficulty'} = @dif[$difficulty]; $tmp_start = &calDate(substr($playing_close,0,4),substr($playing_close,5,2),substr($playing_close,8,2),-1); # $out{'start'} = substr($playing_close,2,8); # $out{'start'} = substr($tmp_start,2,8) . ' 24:00'; $out{'start'} = substr($playing_close,2,14); $out{'start'} =~ s/\-/\//g; $out{'cost'} = @cost[$type]; if ($option2 eq 1){$out{'cost'} = $out{'cost'} + 300;} $out{'text'} =~ s/\n//g; $out{'text'} =~ s/\<\/H2>/\<\/H2>/g; $out{'text'} =~ s/\<\/H1>/\<\/H1>/g; $out{'comment'} =~ s/\n//g; $open_date = substr($open_date,0,10); $open_date =~ s/\-//g; $open_date =~ s/\://g; $open_date =~ s/\ //g; #オプション if ($option1 > 0){ $out{'opt'} =<<"EOT"; ■オプション @option1_list[$option1] EOT } if ($option2 eq 1){ if ($out{'opt'} eq ''){ $out{'opt'} =<<"EOT"; ■オプション EOT } $out{'opt'} .=<<"EOT"; リアルタイム EOT } if ($npc ne ''){ @ary_npc = split(/\,/,$npc); $out{'npc'} .=<<"EOT"; EOT $n = 0; foreach (@ary_npc){ $npc = $_; $sql = "select pcid,name1,name3,sex,birth,attribute,bustup2 from character where pcid = '$npc';"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($n_pcid,$n_name1,$n_name2,$n_sex,$n_birth,$n_attribute,$n_bustup2)=@{$ref->[0]}; if ($n eq 0){ $n_n_bustup2 = $n_bustup2; $n_n_pcid = $n_pcid; $n_n_name1 = $n_name1; $n_n_name2 = $n_name2; } if ($n_birth ne ''){ $n_age = &calcAge($n_birth); } if ($n_age eq ''){$n_age = '?';} if ($n_sex eq 1){$n_sex = '♂';} elsif ($n_sex eq 2){$n_sex = '♀';} if ($n_attribute eq 1){$n_attribute = '善';} elsif ($n_attribute eq 2){$n_attribute = '悪';} elsif ($n_attribute eq 0){$n_attribute = '中';} if ($another_flg eq 1){ $sql = "select school,sex,bustup from character_another where no = 1 and pcid = '$n_pcid' and state = 0;"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($school,$sex,$n_bustup2)=@{$ref->[0]}; @school_str = ('','一年生','二年生','三年生','その他'); $npc_url =<<"EOT"; ($n_pcid)$n_name2・@sex_mark[$sex]・@school_str[$school] EOT } elsif ($another_flg eq 2){ $sql = "select age,sex,bustup from character_another where no = 2 and pcid = '$n_pcid' and state = 0;"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($age,$sex,$n_bustup2)=@{$ref->[0]}; $npc_url =<<"EOT"; ($n_pcid)$n_name2・@sex_mark[$sex]・$age EOT } elsif ($another_flg eq 3){ $sql = "select age,sex,bustup,class from character_another where no = 3 and pcid = '$n_pcid' and state = 0;"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($age,$sex,$n_bustup2,$class)=@{$ref->[0]}; $npc_url =<<"EOT"; ($n_pcid)$n_name2・@sex_mark[$sex]・$age・$class EOT } else{ $npc_url =<<"EOT"; ($n_pcid)$n_name1($n_name2)・$n_attribute・$n_sex・$n_age EOT } $out{'npc'} .=<<"EOT"; $npc_url EOT $n++; } if ($n_n_bustup2 ne ''){ $out{'npc_img'} =<<"EOT"; EOT } } $sql = "select count(*) from scenario_member where scenario_seq = $in{'seq'} and (entry_state = 1 and reserve != 1);"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($mcnt)=@{$ref->[0]}; if ($mcnt eq ''){$mcnt = 0;} $out{'now_member_num'} = $mcnt; if ($type eq 3){ if ($attribute1 ne 100 && $attribute2 ne 100){ $out{'a_atb'} = '―'; $out{'b_atb'} = 'spacer.gif'; } else{ if ($attribute1 eq 100){$t = 1;} elsif ($attribute1 eq 0){$t = 5;} $out{'a_atb'} = @atb_str[$t]; $out{'b_atb'} = @atb_icon[$t]; } $out{'member_max'} = '―'; } else{ if ($attribute1 eq 100){$t = 1;} elsif ($attribute1 eq 70){$t = 2;} elsif ($attribute1 eq 50){$t = 3;} elsif ($attribute1 eq 30){$t = 4;} elsif ($attribute1 eq 0){$t = 5;} $out{'a_atb'} = @atb_str[$t]; $out{'b_atb'} = @atb_icon[$t]; if ($attribute1 eq 0 && $attribute2 eq 0){ $out{'a_atb'} = '―'; $out{'b_atb'} = 'spacer.gif'; } } if ($type eq 5){ # $out{'source'} = '―'; $out{'member_max'} = '―'; # $out{'now_member_num'} = '―'; } #サポート参加可能チェック $s_flg = 0; if ($pcid ne ''){ # if ($npc ne ''){$s_flg = 1;} # else{ $cnt = 0; $sql = "select a.target_pcid,b.name1,b.name3,b.sex,b.birth,b.attribute,b.icon,b.class from bonds a,character b,scenario_member c where a.pcid = '$pcid' and a.point >= 11 and a.target_pcid = b.pcid and b.state = 0 and b.attribute = $attribute and b.pcid = c.pcid and c.scenario_seq = $in{'seq'} and c.entry_state = 1 order by a.target_pcid;"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); foreach(@$ref) { ($tmps)=@{$_}; $cnt++; } $sql = "select a.base_seq from base_member a,base b where a.pcid = '$pcid' and a.state = 0 and a.base_seq = b.seq and b.state = 0;"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); foreach(@$ref) { ($base_seq)=@{$_}; $sql2 = "select a.pcid from base_member a,character b,scenario_member c where a.base_seq = $base_seq and a.state = 0 and a.pcid = b.pcid and b.state = 0 and b.attribute = $attribute and b.pcid = c.pcid and c.scenario_seq = $in{'seq'} and c.entry_state = 1 order by a.pcid;"; $ref2 = $dbh->selectall_arrayref($sql2) or &err("エラーが発生しました。"); foreach(@$ref2) { ($tmps)=@{$_}; $cnt++; } } if ($cnt > 0){$s_flg = 1;} # } } # $s_flg = 0; #現在のサポート参加者数 if ($type ne 3){ $sql = "select count(*) from scenario_member where scenario_seq = $in{'seq'} and entry_state = 11;"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($out{'sup_num'})=@{$ref->[0]}; if ($out{'sup_num'} eq ''){$out{'sup_num'} = 0;} $out{'sup_num'} =<<"EOT"; サポート参加人数:$out{'sup_num'} EOT } $tmp_reserve = $reserve_close; $tmp_reserve =~ s/\-//g; $tmp_reserve =~ s/\://g; $tmp_reserve =~ s/\ //g; $tmp_playing_close = $playing_close; $tmp_playing_close =~ s/\-//g; $tmp_playing_close =~ s/\://g; $tmp_playing_close =~ s/\ //g; $tmp_reserve_one = substr($tmp_reserve,0,8) . "010500"; $sql = "select entry_state,reserve from scenario_member where scenario_seq = $in{'seq'} and pcid = '$pcid';"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($entry_state,$reserve)=@{$ref->[0]}; if ($type ne 5 && $type ne 3){ if ($entry_state eq 1 || $entry_state eq 11){ $out{'trade'}=<<"EOT"; EOT } } #他シナリオ参加中チェック $sql = "select count(*) from scenario_member a,scenario b where a.pcid = '$pcid' and (a.entry_state = 1 or a.reserve = 1) and a.scenario_seq = b.seq and b.playing_close > (now() + '-3 days') and b.state = 0 and b.type != 5 and b.type != 3;"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($s_cnt1)=@{$ref->[0]}; if ($s_cnt1 eq ''){$s_cnt1 = 0;} if ($type eq 5){ $s_cnt1 = 0; } $sql = "select b.playing_close + '3 days',b.title,b.playing_close from scenario_member a,scenario b where a.pcid = '$pcid' and (a.entry_state = 1 or a.reserve = 1) and a.scenario_seq = b.seq and b.type != 5 and b.type != 3 and b.state = 0 order by b.playing_close desc limit 1;"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($limit_date,$tmp_title,$tmp_pclosed)=@{$ref->[0]}; $limit_date =~ s/\-//g; $limit_date =~ s/\://g; $limit_date =~ s/\ //g; $e_pclose = substr($playing_close,0,10); #イベントシナリオ参加チェック $sql = "select count(*) from scenario_member a,scenario b where a.pcid = '$pcid' and (a.entry_state = 1 or a.reserve = 1) and a.scenario_seq = b.seq and b.type = 3 and substr(b.playing_close,1,10) = '$e_pclose' and b.state = 0;"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($e_cnt)=@{$ref->[0]}; if ($e_cnt eq ''){$e_cnt = 0;} #イベントシナリオ時他シナリオ予約中チェック $sql = "select count(*) from scenario_member a,scenario b where a.pcid = '$pcid' and (a.entry_state = 1 or a.reserve = 1) and a.scenario_seq = b.seq and b.type != 3 and substr(b.playing_close,1,10) = '$e_pclose' and b.state = 0;"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($e2_cnt)=@{$ref->[0]}; if ($e2_cnt eq ''){$e2_cnt = 0;} #犯行声明チェック $c_flg = 0; $sql = "select open_plan_date,open_plan_date + '2 days',open_plan_date + '-2 days' from crime_declaration where pcid = '$pcid' and open_plan_date >= now() + '-7 days' and result <= 1 order by open_plan_date;"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); foreach(@$ref) { ($open_plan_date,$open_plan_date2,$open_plan_date3)=@{$_}; $open_plan_date = substr($open_plan_date,0,4) . substr($open_plan_date,5,2) . substr($open_plan_date,8,2); $open_plan_date2 = substr($open_plan_date2,0,4) . substr($open_plan_date2,5,2) . substr($open_plan_date2,8,2); $open_plan_date3 = substr($open_plan_date3,0,4) . substr($open_plan_date3,5,2) . substr($open_plan_date3,8,2); # if ($uid eq 2){&err("$open_plan_date,$open_date >= $open_plan_date3 && $open_date <= $open_plan_date2");} if ($open_date >= $open_plan_date3 && $open_date <= $open_plan_date2){$c_flg = 1;} } #ボタン if ($entry_state eq 1 && "$g_year$g_mon$g_mday$g_hour$g_min$g_sec" < $tmp_playing_close && $death_flg eq 0){ $out{'btn'} .=<<"EOT"; EOT } elsif ($entry_state eq 11 && "$g_year$g_mon$g_mday$g_hour$g_min$g_sec" < $tmp_playing_close && $death_flg eq 0){ $out{'btn'} .=<<"EOT"; EOT } if ($death_flg eq 1){ $out{'btn'} .=<<"EOT"; 死亡キャラクターは参加できません。 EOT } elsif ($reserve eq 1 && "$g_year$g_mon$g_mday$g_hour$g_min$g_sec" < $tmp_reserve && $pcid ne '' && $death_flg eq 0){ #予約中 # $out{'btn'} .=<<"EOT"; # #EOT } elsif ("$g_year$g_mon$g_mday$g_hour$g_min$g_sec" < $tmp_reserve && $limit_date <= $tmp_playing_close && $pcid ne '' && $type ne 5 && $e_cnt eq 0 && $c_flg eq 0 && $death_flg eq 0){ #予約受付中 # if ($uid eq 4){$m = "$g_year$g_mon$g_mday$g_hour$g_min$g_sec < $tmp_reserve && $limit_date >= $tmp_playing_close && $type ne 5";} $out{'btn'} .=<<"EOT"; ※このボタンを押しただけでは課金は行われません。 EOT } elsif ($c_flg eq 1 && $type ne 5 && $type ne 3 && $death eq 0){ $out{'btn'} .=<<"EOT"; 提出した犯行声明の前後2日間に公開された事件には、参加する事ができません。 EOT } elsif ($e_cnt > 0 && ($entry_state ne 1 && $entry_state ne 11)){ $out{'btn'} .=<<"EOT"; 出発日が重なっているイベントシナリオに参加している為、予約・参加できません。 EOT } elsif ($e2_cnt > 0 && ($entry_state ne 1 && $entry_state ne 11)){ $out{'btn'} .=<<"EOT"; 出発日が重なっているシナリオに予約、または参加している為、参加できません。 EOT } elsif ("$g_year$g_mon$g_mday$g_hour$g_min$g_sec" < $tmp_reserve && $limit_date >= $tmp_playing_close && $type ne 5 && $type ne 3 && ($entry_state ne 1 && $entry_state ne 11)){ $out{'btn'} .=<<"EOT"; 既に他のシナリオに入っているため、予約できません。$m EOT } elsif ("$g_year$g_mon$g_mday$g_hour$g_min$g_sec" >= $tmp_reserve && $limit_date > $tmp_playing_close && "$g_year$g_mon$g_mday$g_hour$g_min$g_sec" <= $tmp_playing_close && $type ne 5 && $type ne 3 && ($entry_state ne 1 && $entry_state ne 11)){ $out{'btn'} .=<<"EOT"; 既に他のシナリオに入っているため、参加できません。 EOT } elsif ("$g_year$g_mon$g_mday$g_hour$g_min$g_sec" >= $tmp_reserve && $reserve ne 1 && $entry_state ne 1 && $entry_state ne 11){ #一般参加開始 if ("$g_year$g_mon$g_mday$g_hour$g_min$g_sec" < $tmp_reserve_one){ #予約抽選が終わるまでの時間の場合 $sql = "select count(*) from scenario_member where scenario_seq = $in{'seq'} and (entry_state = 1 or reserve = 1);"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($mcnt)=@{$ref->[0]}; $out{'now_member_num'} = $mcnt; if ($t_cnt eq ''){$t_cnt = 0;} if ($another_flg eq 0){ @atb_cnt = (); @atb_cnt = &atb_balance($out{'member_max'},$attribute1,$attribute2); $atb1_max = @atb_cnt[0]; $atb2_max = @atb_cnt[1]; $sql = "select count(*) from scenario_member a,character b where a.scenario_seq = $in{'seq'} and (a.reserve = 1 or a.entry_state = 1) and a.pcid = b.pcid and b.attribute = 1;"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($t_cnt1)=@{$ref->[0]}; $sql = "select count(*) from scenario_member a,character b where a.scenario_seq = $in{'seq'} and (a.reserve = 1 or a.entry_state = 1) and a.pcid = b.pcid and b.attribute = 2;"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($t_cnt2)=@{$ref->[0]}; $sql = "select count(*) from scenario_member a,scenario b where a.pcid = '$pcid' and a.scenario_seq = b.seq and b.open_date >= now() and (a.reserve = 1 or a.entry_state = 1);"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($t_cnt)=@{$ref->[0]}; if ($t_cnt eq ''){$t_cnt = 0;} } elsif ($another_flg > 0){ $atb1_max = $out{'member_max'}; $atb2_max = $out{'member_max'}; $t_cnt1 = $mcnt; $t_cnt2 = $mcnt; } if ($type ne 5 && $type ne 3){ # if ((($attribute eq 1 && $t_cnt1 < $atb1_max) || ($attribute eq 2 && $t_cnt2 < $atb2_max)) && $t_cnt eq 0){ if ((($attribute eq 1 && $t_cnt1 >= $atb1_max) || ($attribute eq 2 && $t_cnt2 >= $atb2_max)) || ($out{'member_max'} <= $mcnt)){ $out{'btn'} .=<<"EOT"; 定員となりました。 EOT } elsif ((($attribute eq 1 && $t_cnt1 < $atb1_max) || ($attribute eq 2 && $t_cnt2 < $atb2_max)) && $t_cnt eq 0 && ($out{'member_max'} > $mcnt) && $death_flg eq 0){ if ($attribute eq 1){$zan = $atb1_max - $t_cnt1;} elsif ($attribute eq 2){$zan = $atb2_max - $t_cnt2;} if ($zan > $out{'member_max'} - $mcnt){$zan = $out{'member_max'} - $mcnt;} $out{'btn'} .=<<"EOT"; ↓このボタンを押しただけでは課金は行われません。 残りあと $zan 人 EOT } elsif ((($attribute1 eq 100 && $attribute eq 2) || ($attribute1 eq 0 && $attribute eq 1)) && $type ne 3){ $out{'btn'} .=<<"EOT"; 募集属性に一致しないため、参加できません。 EOT } elsif($mcnt >= $out{'member_max'}){ $out{'btn'} .=<<"EOT"; 定員となりました。 EOT } } elsif ($type eq 3){ if (($attribute1 eq 100 && $attribute eq 2) || ($attribute2 eq 100 && $attribute eq 1)){ $out{'btn'} .=<<"EOT"; 募集属性に一致しないため、参加できません。 EOT } if ($uid eq 2){ $out{'btn'} .=<<"EOT"; attribute1:$attribute1,attribute2:$attribute2 EOT } } elsif ($type eq 5){ #全体イベント用 $out{'btn'} .=<<"EOT"; ※このボタンを押しただけでは課金は行われません。 EOT } } elsif("$g_year$g_mon$g_mday$g_hour$g_min$g_sec" < $tmp_playing_close){ #一般参加受付中 $sql = "select count(*) from scenario_member a,character b where a.scenario_seq = $in{'seq'} and (a.entry_state = 1 or a.reserve = 1) and a.pcid = b.pcid and b.attribute = 1;"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($t_cnt1)=@{$ref->[0]}; $sql = "select count(*) from scenario_member a,character b where a.scenario_seq = $in{'seq'} and (a.entry_state = 1 or a.reserve = 1) and a.pcid = b.pcid and b.attribute = 2;"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($t_cnt2)=@{$ref->[0]}; if ($type ne 5 && $type ne 3){ $sql = "select count(*) from scenario_member a,scenario b where a.pcid = '$pcid' and a.scenario_seq = b.seq and b.open_date >= now() and (a.reserve = 1 or a.entry_state = 1);"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($t_cnt)=@{$ref->[0]}; if ($t_cnt eq ''){$t_cnt = 0;} $sql = "select count(*) from scenario_member where scenario_seq = $in{'seq'} and (entry_state = 1 or reserve = 1);"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($mem_cnt)=@{$ref->[0]}; if ($another_flg eq 0){ @atb_cnt = (); @atb_cnt = &atb_balance($out{'member_max'},$attribute1,$attribute2); $atb1_max = @atb_cnt[0]; $atb2_max = @atb_cnt[1]; } elsif ($another_flg > 0){ $atb1_max = $out{'member_max'}; $atb2_max = $out{'member_max'}; $t_cnt1 = $mem_cnt; $t_cnt2 = $mem_cnt; } if($mem_cnt >= $out{'member_max'}){ $out{'btn'} .=<<"EOT"; 定員となりました。 EOT } elsif ((($attribute eq 1 && $t_cnt1 < $atb1_max) || ($attribute eq 2 && $t_cnt2 < $atb2_max)) && $t_cnt eq 0 && $death_flg eq 0){ if ($attribute eq 1){$zan = $atb1_max - $t_cnt1;} elsif ($attribute eq 2){$zan = $atb2_max - $t_cnt2;} if ($zan > $out{'member_max'} - $mem_cnt){$zan = $out{'member_max'} - $mem_cnt;} $out{'btn'} .=<<"EOT"; ↓このボタンを押しただけでは課金は行われません。 残りあと $zan 人 EOT } # elsif (($attribute1 eq 100 && $attribute eq 2) || ($attribute1 eq 0 && $attribute eq 1)){ elsif ((($attribute1 eq 100 && $attribute eq 2) || ($attribute1 eq 0 && $attribute eq 1)) && $another_flg eq 0){ $out{'btn'} .=<<"EOT"; 募集属性に一致しないため、参加できません。 EOT } elsif ($attribute eq ''){ $out{'btn'} .=<<"EOT"; キャラクターが選択されていないので、参加できません。 EOT } elsif($mcnt >= $out{'member_max'}){ $out{'btn'} .=<<"EOT"; 定員となりました。 EOT } if ($uid eq 2){ $out{'btn'} .=<<"EOT"; mcnt:$mcnt,t_cnt2:$t_cnt2,atb2_max:$atb2_max EOT } } elsif($type eq 3){ $eflg = &entry_overlap($dbh,$pcid,$in{'seq'},1); if (($attribute1 eq 100 && $attribute eq 2) || ($attribute2 eq 100 && $attribute eq 1)){ $out{'btn'} .=<<"EOT"; 募集属性に一致しないため、参加できません。 EOT } elsif ($eflg eq 1 && $death_flg eq 0){ $out{'btn'} .=<<"EOT"; ※このボタンを押しただけでは課金は行われません。 EOT } else{ $out{'btn'} .=<<"EOT"; 出発日が同じイベントシナリオには参加できません。 EOT } } elsif($type eq 5){ $out{'btn'} .=<<"EOT"; ※このボタンを押しただけでは課金は行われません。 EOT } } } #サポート参加ボタン # if ("$g_year$g_mon$g_mday$g_hour$g_min$g_sec" >= $tmp_reserve && $entry_state ne 1 && $entry_state ne 11 && $s_flg eq 1 && "$g_year$g_mon$g_mday$g_hour$g_min$g_sec" <= $tmp_playing_close && $type ne 5 && $type ne 3 && $e_cnt eq 0){ if ("$g_year$g_mon$g_mday$g_hour$g_min$g_sec" >= $tmp_reserve && $entry_state ne 1 && $entry_state ne 11 && $s_flg eq 1 && "$g_year$g_mon$g_mday$g_hour$g_min$g_sec" <= $tmp_playing_close && $type ne 5 && $type ne 3 && $death_flg eq 0){ $out{'btn'} .=<<"EOT"; EOT } if ($main_id ne ''){ $out{'btn'} .=<<"EOT"; EOT } # if ($uid eq 2){ # $out{'btn'} .=<<"EOT"; #atb1_max:$atb1_max,atb2_max:$atb2_max #EOT # } #参加者一覧 if ("$g_year$g_mon$g_mday$g_hour$g_min$g_sec" < $tmp_reserve && $type ne 5){ #予約受付中 $out{'member_title'} = "■現在の予約者一覧"; $sql = "select b.pcid,b.name1,b.name3,b.sex,b.birth,b.attribute from scenario_member a,character b where a.scenario_seq = $in{'seq'} and a.reserve in (1,2,3) and a.pcid = b.pcid order by a.pcid;"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); $i = 0; foreach(@$ref) { ($m_pcid,$m_name1,$m_name2,$m_sex,$m_birth,$m_attribute)=@{$_}; $m_age = &calcAge($m_birth); if ($m_sex eq 1){$m_sex = '♂';} elsif ($m_sex eq 2){$m_sex = '♀';} if ($m_attribute eq 1){$m_attribute = '善';} elsif ($m_attribute eq 2){$m_attribute = '悪';} if ($i eq 0){ $out{'member'} .=<<"EOT"; ($m_pcid)$m_name1($m_name2)・$m_attribute・$m_sex・$m_age EOT $i = 1; } else{ $out{'member'} .=<<"EOT"; /($m_pcid)$m_name1($m_name2)・$m_attribute・$m_sex・$m_age EOT $i = 0; } } if ($i eq 1){$out{'member'} .= "";} } # elsif ("$g_year$g_mon$g_mday$g_hour$g_min$g_sec" < $tmp_playing_close){ elsif ("$g_year$g_mon$g_mday$g_hour$g_min$g_sec" >= $tmp_reserve){ $state_str = "参加募集中"; if ("$g_year$g_mon$g_mday$g_hour$g_min$g_sec" < $tmp_playing_close){$out{'member_title'} = "■現在の参加者一覧";} else{$out{'member_title'} = "■参加者一覧";} # $out{'member_title'} = "■現在の参加者一覧"; if ($uid eq 4){ $out{'member'} .=<<"EOT"; 善:$t_cnt1 悪:$t_cnt2 EOT } $sql = "select b.pcid,b.name1,b.name3,b.sex,b.birth,b.attribute from scenario_member a,character b where a.scenario_seq = $in{'seq'} and a.entry_state = 1 and a.pcid = b.pcid order by a.pcid;"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); $i = 0; $total_i = 0; foreach(@$ref) { ($m_pcid,$m_name1,$m_name2,$m_sex,$m_birth,$m_attribute)=@{$_}; $m_age = &calcAge($m_birth); if ($m_sex eq 1){$m_sex = '♂';} elsif ($m_sex eq 2){$m_sex = '♀';} if ($m_attribute eq 1){$m_attribute = '善';} elsif ($m_attribute eq 2){$m_attribute = '悪';} if ($another_flg eq 1){ $sql = "select school,sex from character_another where no = 1 and pcid = '$m_pcid' and state = 0;"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($school,$sex)=@{$ref->[0]}; $pc_url =<<"EOT"; $m_pcid $m_name2・@sex_mark[$sex]・@school_str[$school] EOT } elsif ($another_flg eq 2){ $sql = "select sex,age from character_another where no = 2 and pcid = '$m_pcid' and state = 0;"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($sex,$n_age)=@{$ref->[0]}; $pc_url =<<"EOT"; $m_pcid $m_name2・@sex_mark[$sex]・$n_age EOT } elsif ($another_flg eq 3){ $sql = "select sex,age,class from character_another where no = 3 and pcid = '$m_pcid' and state = 0;"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($sex,$n_age,$n_class)=@{$ref->[0]}; $pc_url =<<"EOT"; $m_pcid $m_name2・@sex_mark[$sex]・$n_age・$n_class EOT } else{ $pc_url =<<"EOT"; $m_pcid $m_name1($m_name2)・$m_sex・$m_age・$m_attribute EOT } if ($another_flg eq 0){$refl_num = 1;} else{$refl_num = 2;} $out{'member'} .= $pc_url; $i++; if ($i > $refl_num){ $out{'member'} .= ""; $i = 0; } else{$out{'member'} .= '/';} $total_i++; } if (substr($out{'member'},-2) eq '/'){$out{'member'} = substr($out{'member'},0,-2);} if ($i ne 0){$out{'member'} .= "";} } #打ち合わせ掲示板 if ($option2 eq 1){ $out{'btn'} .=<<"EOT"; $out{'trade'} EOT } # elsif ($type ne 5){ else{ if ($last_say_name_scenario eq 0){$nameselect1 = "checked";} elsif ($last_say_name_scenario eq 1){$nameselect2 = "checked";} else{$nameselect1 = "checked";} $meeting_bbs_log_dir = "/home/rexi-jp/public_html/jj/scenario/log/"; if ($in{'seq'} eq 348 || $in{'seq'} eq 388){$sakusen_btn = '04_bt_utiawase02.gif';} elsif ($in{'seq'} eq 467 || $in{'seq'} eq 551){$sakusen_btn = '../images/spacer.gif';} else{$sakusen_btn = '04_bt_utiawase.gif';} if ("$g_year$g_mon$g_mday$g_hour$g_min$g_sec" < $tmp_playing_close && "$g_year$g_mon$g_mday$g_hour$g_min$g_sec" > $tmp_reserve && $type ne 5){ if ($mid eq ''){ $out{'btn'} .=<<"EOT"; EOT } else{ $out{'btn'} .=<<"EOT"; EOT } $iconlist = &icon_list1($pcid,1); $log_dir = $meeting_bbs_log_dir . $in{'seq'}; #シナリオごと if (!-d $log_dir){ mkdir("$log_dir", 0755); } if ($another_flg eq 0){ $say_dir1 = $log_dir . '/1/'; #属性ごと if (!-d $say_dir1){ mkdir("$say_dir1", 0755); } $say_dir2 = $log_dir . '/2/'; #属性ごと if (!-d $say_dir2){ mkdir("$say_dir2", 0755); } #善 @resdat1 = (); @resdat1 = &bbs_say_dat($say_dir1); $max_say1 = $#resdat1; $max_say1++; #悪 @resdat2 = (); @resdat2 = &bbs_say_dat($say_dir2); $max_say2 = $#resdat2; $max_say2++; } elsif ($another_flg > 0){ $say_dir0 = $log_dir . '/0/'; #無属性 if (!-d $say_dir0){ mkdir("$say_dir0", 0755); } #無属性 @resdat0 = (); @resdat0 = &bbs_say_dat($say_dir0); $max_say0 = $#resdat0; $max_say0++; } if ($attribute eq 1 && $another_flg eq 0){ #発言ログディレクトリ #善 #ログ表示 @tem_log_ary = (); @tem_log_ary = @resdat1; $threaddat1 = &bbs_log_dat($say_dir1); $form2 = ''; #発言フォーム if ($entry_state eq 1 || $entry_state eq 11){$form1 = &bbs_say_form;} # if ($uid eq 2){&err($form1);} $threaddat1 =<<"EOT"; $form1 $threaddat1 EOT $threaddat2 =<<"EOT"; EOT $prvnxt1 =<<"EOT"; <<< 最近の発言 | 以前の発言 >>> EOT $prvnxt2 =<<"EOT"; EOT } elsif ($attribute eq 2 && $another_flg eq 0){ #発言ログディレクトリ #悪 #ログ表示 @tem_log_ary = (); @tem_log_ary = @resdat2; $threaddat2 = &bbs_log_dat($say_dir2); $form2 = ''; #発言フォーム if ($entry_state eq 1 || $entry_state eq 11){$form2 = &bbs_say_form;} $threaddat2 =<<"EOT"; $form2 $threaddat2 EOT $threaddat1 =<<"EOT"; EOT $prvnxt1 =<<"EOT"; EOT $prvnxt2 =<<"EOT"; <<< 最近の発言 | 以前の発言 >>> EOT } elsif ($another_flg > 0){ #発言ログディレクトリ #無属性 #ログ表示 @tem_log_ary = (); @tem_log_ary = @resdat0; $threaddat0 = &bbs_log_dat($say_dir0); $form0 = ''; #発言フォーム if ($entry_state eq 1 || $entry_state eq 11 || substr($pcid,0,2) eq 'ez'){$form0 = &bbs_say_form;} $threaddat0 =<<"EOT"; $form0 $threaddat0 EOT $prvnxt1 =<<"EOT"; EOT $prvnxt2 =<<"EOT"; <<< 最近の発言 | 以前の発言 >>> EOT } $out{'meeting'} =<<"EOT"; $out{'trade'} ■作戦ルーム EOT # if ($attribute1 ne 0 || ($type eq 3 && $another_flg eq 0)){ if (($attribute1 ne 0 || $type eq 3) && $another_flg eq 0){ $out{'meeting'} .=<<"EOT"; 発言:$max_say1 $prvnxt1 $threaddat1 EOT } # if ($attribute2 ne 0 || ($type eq 3 && $another_flg eq 0)){ if (($attribute2 ne 0 || $type eq 3) && $another_flg eq 0){ $out{'meeting'} .=<<"EOT"; 発言:$max_say2 $prvnxt2 $threaddat2 EOT } if ($another_flg > 0 && $option2 eq 0){ $out{'meeting'} .=<<"EOT"; 発言:$max_say0 $prvnxt2 $threaddat0 EOT } $out{'meeting'} .=<<"EOT"; EOT } } if ("$g_year$g_mon$g_mday$g_hour$g_min$g_sec" > $tmp_reserve && $scenario_state <= 2){ #予約受付終了後から調査中まで if ($type ne 5 && $type ne 3){ $out{'btn'} .=<<"EOT"; EOT } } if ($type eq 5 && $in{'seq'} eq 348){$out{'clist'} = &chat_data($option2);} if ($type eq 5 && $in{'seq'} eq 388){$out{'clist'} = &r_chat_top;} &out_enc; # if ($type eq 5 && $uid eq 4){ if ($type eq 5 && $in{'seq'} eq 251){ &html_out('rte_01_top_02.html'); } elsif ($type eq 5 && $in{'seq'} eq 301){ &html_out('rte_02_top_02.html'); } elsif ($type eq 5 && $in{'seq'} eq 348){ &html_out('rte_03_top_02.html'); } elsif ($type eq 5 && $in{'seq'} eq 388){ &html_out('rte_04_top_02.html'); } elsif ($type eq 5 && $in{'seq'} eq 467){ &html_out('rte_05_top_02.html'); } elsif ($type eq 5 && $in{'seq'} eq 551){ &html_out('rte_06_top_02.html'); } elsif ($type eq 5 && $in{'seq'} eq 616){ &html_out('rte_07_top_02.html'); } elsif ($type eq 5 && $in{'seq'} eq 693){ &html_out('rte_08_top_02.html'); } elsif ($type eq 5 && $in{'seq'} eq 773){ &html_out('rte_09_top_02.html'); } elsif ($type eq 5 && $in{'seq'} eq 838){ &html_out('rte_10_top_02.html'); } elsif ($type eq 5 && $in{'seq'} eq 991){ &html_out('gi/gi01/gi01_op2.html'); } elsif ($type eq 5 && $in{'seq'} eq 1123){ &html_out('gi/gi02/gi02_op2.html'); } elsif ($type eq 5 && $in{'seq'} eq 1200){ &html_out('gi/gi03/gi03_op2.html'); } elsif ($type eq 5 && $in{'seq'} eq 1257){ &html_out('gi/gi04/gi04_op2.html'); } elsif ($type eq 5 && $in{'seq'} eq 1309){ &html_out('gi/gi05/gi05_op2.html'); } elsif ($type eq 5 && $in{'seq'} eq 1407){ &html_out('gi/gi06/gi06_op2.html'); } elsif ($type eq 5 && $in{'seq'} eq 1488){ &html_out('gi/gi07/gi07_op2.html'); } elsif ($type eq 5 && $in{'seq'} eq 1522){ &html_out('gi/gi08/gi08_op1.html'); } elsif ($type eq 5 && $in{'seq'} eq 1547){ &html_out('gi/gi08/gi08_op2.html'); } elsif ($type eq 5 && $in{'seq'} eq 1580){ &html_out('gi/gi09/gi09_op1.html'); } elsif ($type eq 5 && $in{'seq'} eq 1607){ &html_out('gi/gi09/gi09_op2.html'); } elsif ($type eq 5 && $in{'seq'} eq 1636){ &html_out('gi/gi10/gi10_op1.html'); } elsif ($type eq 5 && $in{'seq'} eq 1673){ &html_out('gi/gi10/gi10_op2.html'); } else{ if ($mid eq ''){ &html_out('scenario_details.html'); } else{ $out{'meeting'} = ""; &html_out('scenario_details_m.html'); } } } #--------------------------------------- # 掲示板発言 #--------------------------------------- sub bbs_say { &in_enc; if ($in{'pcid'} ne $pcid){&err("現在ログインしてるキャラクターと、発言しようとしたキャラクターが一致しません。");} if ($in{'seq'} eq ''){&err("パラメータエラー");} $sql = "select a.title,b.name from scenario a,master b where a.seq = $in{'seq'} and a.scenario_result = 1 and a.state = 0 and a.msid = b.id;"; if ($uid eq 4){ $sql = "select a.title,b.name from scenario a,master b where a.seq = $in{'seq'} and a.scenario_result = 1 and a.msid = b.id;"; } $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($out{'title'},$out{'ms_name'})=@{$ref->[0]}; if ($out{'title'} eq ''){&err("該当するシナリオが見つかりませんでした。");} $tmp = $in{'say_comment'}; $tmp =~ s/\n//g; $tmp =~ s/\x0D\x0A|\x0D|\x0A//g; $len = length ($tmp); # if ($len > 400){&err("文字数制限を越えた発言は行えません。");} if ($len > 800){&err("文字数制限を越えた発言は行えません。");} #発言ログディレクトリ $meeting_bbs_log_dir = "/home/rexi-jp/public_html/jj/scenario/log/"; $log_dir = $meeting_bbs_log_dir . $in{'seq'}; #シナリオごと if ($attribute eq 1 && $another_flg eq 0){$say_dir = $log_dir . "/1";} elsif ($attribute eq 2 && $another_flg eq 0){$say_dir = $log_dir . "/2";} elsif ($another_flg > 0){$say_dir = $log_dir . "/0";} #ファイル名確定 &date_rtn; $fname = $say_dir. '/' . "$g_year$g_mon$g_mday$g_hour$g_min$g_sec" . '_' . $pcid . '.dat'; #発言内容 $pc_age = &calcAge($pcbirth); if ($pcsex eq 1){$pcsex = '♂';} elsif ($pcsex eq 2){$pcsex = '♀';} $pcclass = @class_str[$pcclass]; if (substr($pcclass,0,8) eq '改造人間'){$pcclass = '改造人間';} if ($in{'nameselect'} eq 0){$wname = $out{'name1'};} else{$wname = $name3;} if ($another_flg eq 1){ $sql = "select school,sex from character_another where no = 1 and pcid = '$pcid' and state = 0;"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($school,$sex)=@{$ref->[0]}; $pcsex = @sex_mark[$sex]; $pcclass = @school_str[$school]; $wname = $name3; } elsif ($another_flg eq 2){ $sql = "select sex,age from character_another where no = 2 and pcid = '$pcid' and state = 0;"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($sex,$pc_age)=@{$ref->[0]}; $pcsex = @sex_mark[$sex]; } $log_naka =<<"EOT"; $pcid $wname $in{'say_icon'} $attribute $pcsex $pcclass $pc_age $host $ip $in{'say_comment'} EOT open FILE,">$fname"; print FILE $log_naka; close FILE; $sql = "update character set last_say_name_scenario = $in{'nameselect'},last_say_icon_scenario = '$in{'say_icon'}' where pcid = '$pcid';"; $dbh->do($sql) or &err("エラーが発生しました。"); print "Location: ./opening.cgi?seq=$in{'seq'}\n\n"; } #--------------------------------------- # レス発言削除 #--------------------------------------- sub res_del { if ($in{'pcid'} ne $pcid){&err("現在ログインしてるキャラクターと、発言しようとしたキャラクターが一致しません。");} if ($in{'seq'} eq ''){&err("不正な処理です。");} if ($in{'sno'} eq ''){&err("不正な処理です。");} $meeting_bbs_log_dir = "/home/rexi-jp/public_html/jj/scenario/log/"; $log_dir = $meeting_bbs_log_dir . $in{'seq'}; #シナリオごと if ($attribute eq 1 && $another_flg eq 0){$log_dir = $log_dir . "/1/";} elsif ($attribute eq 2 && $another_flg eq 0){$log_dir = $log_dir . "/2/";} elsif ($another_flg ne 0){$log_dir = $log_dir . "/0/";} $dldir = $log_dir . 'del/'; if (!-d $dldir){ mkdir("$dldir", 0755); } use File::Copy; $log_f = $log_dir . $in{'sno'} . '_' . $pcid . '.dat'; $mv_f = $dldir . $in{'sno'} . '_' . $pcid . '.dat'; # &err($log_f); move $log_f, $mv_f or die &err("エラーが発生しました。"); print "Location: ./opening.cgi?seq=$in{'seq'}\n\n"; } #--------------------------------------- # チャット #--------------------------------------- sub chat_data { # my $opt2 = $_[0]; # if ($opt2 ne 1){return;} my $rclog_dir = "/home/rexi-jp/public_html/jj/scenario/chat_log/" . $in{'seq'} . "/"; # &err($rclog_dir); if (!-d $rclog_dir){ mkdir("$rclog_dir", 0755); } &date_rtn; #オープンチャット一覧取得 my $chat_ini_dir = "/home/rexi-jp/public_html/jj/scenario/chat_ini/" . $in{'seq'} . "/"; if (!-d $chat_ini_dir){ mkdir("$chat_ini_dir", 0755); } @inidat = (); opendir(DH, $chat_ini_dir); while (my $file = readdir DH) { next if $file =~ /^\.{1,2}$/; # '.'や'..'も取れるので、スキップする if (!-d "$chat_ini_dir$file"){ # &err($file); push inidat,$file; } } closedir DH; @inidat = sort @inidat; # &err($#inidat); foreach (@inidat){ $fname = $_; $fname2 = $chat_ini_dir . $fname; # &err($fname2); @ddd = (); @fileparse = (); my @fileparse = fileparse($fname2, '\.[^\.]+'); $id = @fileparse[0]; open FILE,$fname2; while(){ $tmp = $_; chomp $tmp; push ddd,$tmp; } #OPENチェック $open_flg = 0; if (@ddd[1] eq 1){$open_flg = 1;} #OPEN elsif (@ddd[1] eq 0){$open_flg = 0;} #CLOSE elsif (@ddd[1] eq 2){ #時間指定 if ((@ddd[2] eq '' || (@ddd[2] ne '' && @ddd[2] <= "$g_year$g_mon$g_mday$g_hour$g_min$g_sec")) && (@ddd[3] eq '' || (@ddd[3] ne '' && @ddd[3] >= "$g_year$g_mon$g_mday$g_hour$g_min$g_sec"))){$open_flg = 1;} } # &err($open_flg); #リンクフラグ $link_flg = 1; if (@ddd[4] ne 0 && $attribute ne @ddd[4] && $attribute ne 0){$link_flg = 0;} $a1 = ''; $a2 = ''; if ($link_flg eq 1){ $a1 = ""; $a2 = ""; } if ($open_flg eq 1){ #現在の発言総数を表示 $sdir = $rclog_dir . $id . '/'; @sdat = (); opendir(DH, $sdir); while (my $file = readdir DH) { next if $file =~ /^\.{1,2}$/; # '.'や'..'も取れるので、スキップする if (!-d "$sdir$file" && substr($file,0,14) <= "$g_year$g_mon$g_mday$g_hour$g_min$g_sec"){ push sdat,$file; } } closedir DH; @sdat = reverse sort @sdat; $num = $#sdat + 1; if (@sdat[0] ne ''){ $last_say_time = substr(@sdat[0],0,4) . "/" . substr(@sdat[0],4,2) . "/" . substr(@sdat[0],6,2) . " " . substr(@sdat[0],8,2) . ":" . substr(@sdat[0],10,2) . ":" . substr(@sdat[0],12,2); } else{$last_say_time = "";} if ($num < 0){$num = 0;} $timestr = ''; if (@ddd[1] ne 2){$timestr = '―';} elsif (@ddd[1] eq 2){ $timestr .= '〜'; if (@ddd[3] ne ''){$timestr .= substr(@ddd[3],0,4) . '/' . substr(@ddd[3],4,2) . '/' . substr(@ddd[3],6,2) . ' ' . substr(@ddd[3],8,2) . ':' . substr(@ddd[3],10,2);} } #入室制限 $atb_limit = ''; if (@ddd[4] eq 0 || @ddd[4] eq ''){$atb_limit = '―';} elsif (@ddd[4] eq 1){$atb_limit = 'ジャスティスのみ';} elsif (@ddd[4] eq 2){$atb_limit = 'ジョーカーのみ';} #変身制限 $hen = ''; if (@ddd[7] eq 1){$hen = '変身後のみ';} elsif (@ddd[7] eq 2){$hen = '人間時のみ';} else{$hen = '―';} #概要取得 $gai_dir = "/home/rexi-jp/public_html/jj/scenario/chat_data/" . $in{'seq'} . "/"; $fnamez = $gai_dir . $id . '_g.dat'; $gaiyou = ''; if (-e $fnamez){ open FILE,$fnamez; while(){ $gaiyou .= $_; } close FILE; } $gfile = $gai_dir . $id . "_s.dat"; if (-e $gfile){ $g =<<"EOT"; 詳細 EOT } else{$g = '';} if ($gaiyou eq ''){$gaiyou = '';} $clist .=<<"EOT"; $a1@ddd[0]$a2$atb_limit$hen$timestr$num$last_say_time$g $gaiyou$timedat EOT } } if ($clist ne ''){ $clist =<<"EOT"; $out{'trade'} ■作戦ルーム ルーム名入室制限変身制限利用可能時間総発言数最終発言時刻 $clist EOT } return $clist; } #--------------------------------------- # TOP表示 #--------------------------------------- sub r_chat_top { $rcm_dir = "/home/rexi-jp/public_html/jj/admin/r_chat_m/"; $gai_dir = "/home/rexi-jp/public_html/jj/admin/r_chat_m/list/"; $rclog_dir = "/home/rexi-jp/public_html/jj/r_chat/log/"; &date_rtn; #設定ファイルを取得 @inidat = (); opendir(DH, $rcm_dir); while (my $file = readdir DH) { next if $file =~ /^\.{1,2}$/; # '.'や'..'も取れるので、スキップする if (!-d "$rcm_dir$file"){ push inidat,$file; } } closedir DH; @inidat = sort @inidat; $i = 0; $p1 = 25; $p2 = 25; %say_pcid = (); $time_border = "20071225200000"; foreach (@inidat){ $fname = $_; $fname2 = $rcm_dir . $fname; @ddd = (); @fileparse = (); my @fileparse = fileparse($fname2, '\.[^\.]+'); $id = @fileparse[0]; open FILE,$fname2; while(){ $tmp = $_; chomp $tmp; push ddd,$tmp; } $open_flg = 1; if (@ddd[1] eq 1){$open_flg = 1;} elsif (@ddd[1] eq 0){$open_flg = 0;} elsif (@ddd[1] eq 2){ if ((@ddd[2] eq '' || (@ddd[2] ne '' && @ddd[2] <= "$g_year$g_mon$g_mday$g_hour$g_min$g_sec")) && (@ddd[3] eq '' || (@ddd[3] ne '' && @ddd[3] >= "$g_year$g_mon$g_mday$g_hour$g_min$g_sec"))){$open_flg = 1;} } $link_flg = 1; if (@ddd[4] ne 0 && $attribute ne @ddd[4] && $attribute ne 0){$link_flg = 0;} if (@ddd[5] eq 1 && substr($pcid,0,2) ne 'jz'){$link_flg = 0;} elsif (@ddd[5] eq 2 && substr($pcid,0,2) eq 'jz'){$link_flg = 0;} $a1 = ''; $a2 = ''; if ($link_flg eq 1){ $a1 = ""; $a2 = ""; } if ($open_flg eq 1){ #現在の発言総数を表示 $sdir = $rclog_dir . $id . '/'; @sdat = (); chdir $sdir or &err($!); @sdat = glob("*.dat"); chdir "/home/rexi-jp/public_html/jj/scenario/" or &err($!); $num = $#sdat + 1; @sdat = reverse sort @sdat; if (@sdat[0] ne ''){ $last_say_time = substr(@sdat[0],0,4) . "/" . substr(@sdat[0],4,2) . "/" . substr(@sdat[0],6,2) . " " . substr(@sdat[0],8,2) . ":" . substr(@sdat[0],10,2) . ":" . substr(@sdat[0],12,2); } else{$last_say_time = "";} if ($num < 0){$num = 0;} #有効時間表示 $timestr = ''; if (@ddd[1] ne 2){$timestr = '―';} elsif (@ddd[1] eq 2){ $timestr .= '〜'; if (@ddd[3] ne ''){$timestr .= substr(@ddd[3],0,4) . '/' . substr(@ddd[3],4,2) . '/' . substr(@ddd[3],6,2) . ' ' . substr(@ddd[3],8,2) . ':' . substr(@ddd[3],10,2);} } #入室制限 $atb_limit = ''; if (@ddd[4] eq 0 || @ddd[4] eq ''){$atb_limit = '―';} elsif (@ddd[4] eq 1){$atb_limit = 'ジャスティスのみ';} elsif (@ddd[4] eq 2){$atb_limit = 'ジョーカーのみ';} #変身制限 $hen = ''; if (@ddd[7] eq 1){$hen = '変身後のみ';} elsif (@ddd[7] eq 2){$hen = '人間時のみ';} else{$hen = '―';} #概要取得 $gai_dir = "/home/rexi-jp/public_html/jj/admin/r_chat_m/list/"; $fnamez = $gai_dir . $id . '_g.dat'; $gaiyou = ''; if (-e $fnamez){ open FILE,$fnamez; while(){ $gaiyou .= $_; } close FILE; } $gai_dir = "/home/rexi-jp/public_html/jj/admin/r_chat_m/list/"; $gfile = $gai_dir . $id . "_s.dat"; if (-e $gfile){ $g =<<"EOT"; 詳細 EOT } else{$g = '';} if ($gaiyou eq ''){$gaiyou = '';} # if ($id eq '0028' || $id eq '0029' || $id eq '0030'){ if ($id eq '0032' || $id eq '0033' || $id eq '0034'){ # if ($id eq '0099'){ $list .=<<"EOT"; $a1@ddd[0]$a2$atb_limit$hen$num$last_say_time$g $gaiyou$timedat EOT } } } if ($list ne ''){ $list =<<"EOT"; $out{'trade'} ■作戦ルーム ルーム名入室制限変身制限総発言数最終発言時刻 $list EOT } return $list; } #--------------------------------------- # 掲示板発言表示 #--------------------------------------- sub bbs_say_form { if ($another_flg > 0){ $n_frm =<<"EOT"; $name3 EOT } else{ $n_frm =<<"EOT"; $out{'name1'}$name3 EOT } if ($mid eq ''){ $form_say =<<"EOT"; 名前の選択:$n_frm アイコン:$iconlist ※全角400字まで EOT } else{ $form_say =<<"EOT"; 名前の選択 $n_frm アイコン $iconlist EOT } return $form_say; } #--------------------------------------- # 掲示板発言数取得 #--------------------------------------- sub bbs_say_dat { my $bbs_d = $_[0]; @bbs_array_d = (); opendir(DH, $bbs_d); while (my $file = readdir DH) { next if $file =~ /^\.{1,2}$/; # '.'や'..'も取れるので、スキップする if (!-d "$bbs_d$file"){ push bbs_array_d,$file; } } closedir DH; return @bbs_array_d; } #--------------------------------------- # 削除ボタン #--------------------------------------- sub bbs_del_btn { $d_btn =<<"EOT"; EOT return $d_btn; } #--------------------------------------- # ログ表示 #--------------------------------------- sub bbs_log_dat { $tem_s_dir = $_[0]; @tem_log_ary = reverse sort @tem_log_ary; $threaddat = ""; foreach (@tem_log_ary){ $fname = $_; $fname2 = $tem_s_dir . $fname; @ddd = (); open FILE,$fname2; while(){ push ddd,$_; } $x = 0; $ldat = ''; foreach(@ddd){ if ($x >= 9){ $ldat .= @ddd[$x]; } $x++; } $ldat =~ s/\x0D\x0A|\x0D|\x0A//g; $timedat = substr($fname,4,2) . '/' . substr($fname,6,2) . ' ' . substr($fname,8,2) . ':' . substr($fname,10,2); $sno = substr($fname,0,14); chomp @ddd[0]; if ($pcid eq @ddd[0]){$del_btn = &bbs_del_btn;} else{$del_btn = "";} $myurl = &mypage_url(@ddd[0]); if (@ddd[2] eq '' || @ddd[2] eq "\n"){ $sql_b = "select class,attribute,sex from character where pcid = '@ddd[0]';"; $ref_b = $dbh->selectall_arrayref($sql_b) or &err("エラーが発生しました。"); ($b_class,$b_attribute,$b_sex)=@{$ref_b->[0]}; @ddd[2] = &def_icon($b_class,$b_attribute,$b_sex); } $sql_s = "select entry_state from scenario_member where scenario_seq = $in{'seq'} and pcid = '@ddd[0]';"; $ref_s = $dbh->selectall_arrayref($sql_s) or &err("エラーが発生しました。"); ($b_entry_state)=@{$ref_s->[0]}; if ($b_entry_state eq 11){$b_entry_state = ' (サポート参加)';} else{$b_entry_state = '';} if ($mid ne ''){ # @ddd[2] = &m_icon(@ddd[2]); if ($another_flg eq 1){ $pcn_str =<<"EOT"; @ddd[0]・@ddd[1]・@ddd[4]・@ddd[5]$b_entry_state EOT } elsif ($another_flg eq 2){ $pcn_str =<<"EOT"; @ddd[0]・@ddd[1]・@ddd[4]・@ddd[6]$b_entry_state EOT } elsif ($another_flg eq 3){ $sql_b = "select class,age,sex from character_another where pcid = '@ddd[0]' and no = 3;"; $ref_b = $dbh->selectall_arrayref($sql_b) or &err("エラーが発生しました。"); ($b_class,$b_age,$b_sex)=@{$ref_b->[0]}; $pcn_str =<<"EOT"; @ddd[0]・@ddd[1]・$b_sex・$b_age・$b_class$b_entry_state EOT } else{ $pcn_str =<<"EOT"; @ddd[0]・@ddd[1]・@ddd[4]・@ddd[6]・@ddd[5]$b_entry_state EOT } } else{ if ($another_flg eq 1){ $pcn_str =<<"EOT"; @ddd[0]・@ddd[1]・@ddd[4]・@ddd[5]$b_entry_state EOT } elsif ($another_flg eq 2){ $pcn_str =<<"EOT"; @ddd[0]・@ddd[1]・@ddd[4]・@ddd[6]$b_entry_state EOT } elsif ($another_flg eq 3){ $sql_b = "select class,age,sex from character_another where pcid = '@ddd[0]' and no = 3;"; $ref_b = $dbh->selectall_arrayref($sql_b) or &err("エラーが発生しました。"); ($b_class,$b_age,$b_sex)=@{$ref_b->[0]}; $pcn_str =<<"EOT"; @ddd[0]・@ddd[1]・$b_class・@sex_mark[$b_sex]・$b_age$b_entry_state EOT } else{ $pcn_str =<<"EOT"; @ddd[0]・@ddd[1]・@ddd[4]・@ddd[6]・@ddd[5]$b_entry_state EOT } } chomp @ddd[2]; if ($mid ne ''){ @ddd[2] = "../mb/icon/" . &m_icon(@ddd[2]); $threaddat .=<<"EOT"; $pcn_str $timedat$del_btn $ldat EOT } else{ $threaddat .=<<"EOT"; $pcn_str$timedat$del_btn $ldat EOT } } return $threaddat; } #--------------------------------------- # 掲示板のみ表示(携帯) #--------------------------------------- sub meeting { $sql = "select entry_state from scenario_member where pcid = '$pcid' and scenario_seq = $in{'seq'};"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); ($entry_state)=@{$ref->[0]}; &date_rtn; $tmp_start = &calDate(substr($playing_close,0,4),substr($playing_close,5,2),substr($playing_close,8,2),-1); $out{'start'} = substr($tmp_start,2,8) . ' 24:00'; $out{'start'} =~ s/\-/\//g; $open_date = substr($open_date,0,10); $open_date =~ s/\-//g; $open_date =~ s/\://g; $open_date =~ s/\ //g; $tmp_reserve = $reserve_close; $tmp_reserve =~ s/\-//g; $tmp_reserve =~ s/\://g; $tmp_reserve =~ s/\ //g; $tmp_playing_close = $playing_close; $tmp_playing_close =~ s/\-//g; $tmp_playing_close =~ s/\://g; $tmp_playing_close =~ s/\ //g; $tmp_reserve_one = substr($tmp_reserve,0,8) . "010500"; if ($option2 eq 1){ print "Location: ../chat/\n\n"; } else{ if ($last_say_name_scenario eq 0){$nameselect1 = "checked";} elsif ($last_say_name_scenario eq 1){$nameselect2 = "checked";} else{$nameselect1 = "checked";} $meeting_bbs_log_dir = "/home/rexi-jp/public_html/jj/scenario/log/"; if ("$g_year$g_mon$g_mday$g_hour$g_min$g_sec" < $tmp_playing_close && "$g_year$g_mon$g_mday$g_hour$g_min$g_sec" > $tmp_reserve){ $iconlist = &icon_list1($pcid,1); $log_dir = $meeting_bbs_log_dir . $in{'seq'}; #シナリオごと if (!-d $log_dir){ mkdir("$log_dir", 0755); } if ($another_flg eq 0){ $say_dir1 = $log_dir . '/1/'; #属性ごと if (!-d $say_dir1){ mkdir("$say_dir1", 0755); } $say_dir2 = $log_dir . '/2/'; #属性ごと if (!-d $say_dir2){ mkdir("$say_dir2", 0755); } #善 @resdat1 = (); @resdat1 = &bbs_say_dat($say_dir1); $max_say1 = $#resdat1; $max_say1++; #悪 @resdat2 = (); @resdat2 = &bbs_say_dat($say_dir2); $max_say2 = $#resdat2; $max_say2++; } elsif ($another_flg eq 1){ $say_dir0 = $log_dir . '/0/'; #無属性 if (!-d $say_dir0){ mkdir("$say_dir0", 0755); } #無属性 @resdat0 = (); @resdat0 = &bbs_say_dat($say_dir0); $max_say0 = $#resdat0; $max_say0++; } if ($attribute eq 1 && $another_flg eq 0){ #発言ログディレクトリ #善 #ログ表示 @tem_log_ary = (); @tem_log_ary = @resdat1; $threaddat1 = &bbs_log_dat($say_dir1); $form2 = ''; #発言フォーム if ($entry_state eq 1 || $entry_state eq 11){$form1 = &bbs_say_form;} # if ($uid eq 2){&err($form1);} $threaddat1 =<<"EOT"; $form1 $threaddat1 EOT $threaddat2 =<<"EOT"; EOT $prvnxt1 =<<"EOT"; <<< 最近の発言 | 以前の発言 >>> EOT $prvnxt2 =<<"EOT"; EOT } elsif ($attribute eq 2 && $another_flg eq 0){ #発言ログディレクトリ #悪 #ログ表示 @tem_log_ary = (); @tem_log_ary = @resdat2; $threaddat2 = &bbs_log_dat($say_dir2); $form2 = ''; #発言フォーム if ($entry_state eq 1 || $entry_state eq 11){$form2 = &bbs_say_form;} $threaddat2 =<<"EOT"; $form2 $threaddat2 EOT $threaddat1 =<<"EOT"; EOT $prvnxt1 =<<"EOT"; EOT $prvnxt2 =<<"EOT"; <<< 最近の発言 | 以前の発言 >>> EOT } elsif ($another_flg eq 1){ #発言ログディレクトリ #無属性 #ログ表示 @tem_log_ary = (); @tem_log_ary = @resdat0; $threaddat0 = &bbs_log_dat($say_dir0); $form0 = ''; #発言フォーム if ($entry_state eq 1 || substr($pcid,0,2) eq 'ez'){$form0 = &bbs_say_form;} $threaddat0 =<<"EOT"; $form0 $threaddat0 EOT $prvnxt1 = ""; $prvnxt2 =<<"EOT"; <<< 最近の発言 | 以前の発言 >>> EOT } $out{'meeting'} =<<"EOT"; ■作戦ルーム EOT if ($attribute1 ne 0 || $type eq 3){ $out{'meeting'} .=<<"EOT"; ジャスティス専用発言:$max_say1 $prvnxt1 $threaddat1 EOT } if ($attribute2 ne 0 || $type eq 3){ $out{'meeting'} .=<<"EOT"; ジョーカー専用発言:$max_say2 $prvnxt2 $threaddat2 EOT } if ($another_flg eq 1 && $option2 eq 0){ $out{'meeting'} .=<<"EOT"; 発言:$max_say0 $prvnxt2 $threaddat0 EOT } $out{'meeting'} .=<<"EOT"; EOT } } &out_enc; &html_out('scenario_meeting_m.html'); }