#!/usr/bin/perl $lib_db_flg = 1; require '/home/rexi-jp/public_html/gx/lib/lib.pl'; require '/home/rexi-jp/public_html/gx_test/lib/mypage.pl'; $mycgi = 'mypage.cgi'; $file_mine = "mypage_mine.html"; $file_other = "mypage_other.html"; $hist_mine = "mypage_history.html"; $hist_other = "mypage_history_other.html"; $file_other_npc = "mypage_npc_other.html"; #$file_mine_npc = "mypage_mine_npc.html"; $file_mine_npc = "mypage_npc_other.html"; use CGI; use CGI::Carp qw(fatalsToBrowser); $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'}; $id = $ENV{'REMOTE_USER'}; $query = CGI->new; my @params = $query->param();#全てのパラメータ名を取得 なのでこれを$inにしてしまえば$inで使用可能 foreach my $param (@params) { $in{$param} = $query->param($param); } $uid = &get_usr_cookie; $pcid = &get_pcid_cookie; %out = %in; if (($pcid eq '' || $uid eq '') && $in{'pcid'} eq ''){&mypage_err("キャラクターが指定されていないか、ログインされていません。");} $dbh = &connectDB($mainDB); &date_rtn; if ($pcid eq $in{'pcid'} || $in{'pcid'} eq ''){ if (substr($pcid,0,2) ne 'xz'){ $myfile = $file_mine; $myhist = $hist_mine; } else{$myfile = $file_mine_npc;} #自分用Myページ表示 $out{'pcid'} = $pcid; $flg_mode = 0; } else{ if (substr($in{'pcid'},0,2) ne 'xz'){ $myfile = $file_other; $myhist = $hist_other; } else{$myfile = $file_other_npc;} $out{'pcid'} = $in{'pcid'}; $flg_mode = 1; } if ($in{'mode'} eq ''){ &mypage_mine; } elsif ($in{'mode'} eq 'combat_skill_convert'){ &combat_skill_convert; } elsif ($in{'mode'} eq 'combat_skill_convert_conf'){ &combat_skill_convert_conf; } elsif ($in{'mode'} eq 'combat_skill_convert_exe'){ &combat_skill_convert_exe; } elsif ($in{'mode'} eq 'spelling'){ &spelling; } elsif ($in{'mode'} eq 'spelling_conf'){ &spelling_conf; } elsif ($in{'mode'} eq 'spelling_entry'){ &spelling_entry; } elsif ($in{'mode'} eq 'setting'){ &setting; } elsif ($in{'mode'} eq 'free_setting_apply'){ &free_setting_apply; } elsif ($in{'mode'} eq 'free_setting_apply_conf'){ &free_setting_apply_conf; } elsif ($in{'mode'} eq 'free_setting_apply_set'){ &free_setting_apply_set; } elsif ($in{'mode'} eq 'free_setting_list'){ &free_setting_list; } elsif ($in{'mode'} eq 'free_setting_change_conf'){ &free_setting_change_conf; } elsif ($in{'mode'} eq 'free_setting_change_conf2'){ &free_setting_change_conf2; } elsif ($in{'mode'} eq 'free_setting_change_apply'){ &free_setting_change_apply; } elsif ($in{'mode'} eq 'portrait'){ &portrait; } elsif ($in{'mode'} eq 'portrait_detailed'){ &portrait_detailed; } elsif ($in{'mode'} eq 'portrait_maximize'){ &portrait_maximize; } elsif ($in{'mode'} eq 'portrait_comment_input'){ &portrait_comment_input; } elsif ($in{'mode'} eq 'portrait_comment_set'){ &portrait_comment_set; } elsif ($in{'mode'} eq 'portrait_fav_set'){ &portrait_fav_set; } elsif ($in{'mode'} eq 'portrait_change'){ &portrait_change; } elsif ($in{'mode'} eq 'portrait_set'){ &portrait_set; } elsif ($in{'mode'} eq 'icon_change'){ &icon_change; } elsif ($in{'mode'} eq 'icon_set'){ &icon_set; } elsif ($in{'mode'} eq 'icon_show_select'){ &icon_show_select; } elsif ($in{'mode'} eq 'history'){ &history; } elsif ($in{'mode'} eq 'training'){ &training; } elsif ($in{'mode'} eq 'training2'){ &training2; } elsif ($in{'mode'} eq 'training3'){ &training3; } elsif ($in{'mode'} eq 'training_conf'){ &training_conf; } elsif ($in{'mode'} eq 'memory'){ &memory; } elsif ($in{'mode'} eq 'memory_set'){ &memory_set; } elsif ($in{'mode'} eq 'memory_del'){ &memory_del; } elsif ($in{'mode'} eq 'monster'){ &monster; } elsif ($in{'mode'} eq 'monster_data'){ &monster_data; } elsif ($in{'mode'} eq 'portrait_set2'){ &portrait_set2; } elsif ($in{'mode'} eq 'vote_ms'){ &vote_ms; } elsif ($in{'mode'} eq 'vote_ms_conf'){ &vote_ms_conf; } elsif ($in{'mode'} eq 'vote_ms_reg'){ &vote_ms_reg; } elsif ($in{'mode'} eq 'replay'){ &replay; } elsif ($in{'mode'} eq 'introduce'){ &introduce; } elsif ($in{'mode'} eq 'introduce_conf'){ &introduce_conf; } elsif ($in{'mode'} eq 'introduce_list'){ &introduce_list; } elsif ($in{'mode'} eq 'introduce_send'){ &introduce_send; } elsif ($in{'mode'} eq 'introduce_receive'){ &introduce_receive; } elsif ($in{'mode'} eq 'introduce_receive2'){ &introduce_receive2; } elsif ($in{'mode'} eq 'introduce_use_point'){ &introduce_use_point; } elsif ($in{'mode'} eq 'introduce_use_point2'){ &introduce_use_point2; } elsif ($in{'mode'} eq 'introduce_use_point3'){ &introduce_use_point3; } elsif ($in{'mode'} eq 'halfway_training'){ &halfway_training; } elsif ($in{'mode'} eq 'halfway_training'){ &halfway_training; } elsif ($in{'mode'} eq 'halfway_training2'){ &halfway_training2; } elsif ($in{'mode'} eq 'halfway_training3'){ &halfway_training3; } elsif ($in{'mode'} eq 'halfway_training_conf'){ &halfway_training_conf; } elsif ($in{'mode'} eq 'pri_rep_apply'){ &pri_rep_apply; } elsif ($in{'mode'} eq 'pri_rep_apply_conf'){ &pri_rep_apply_conf; } elsif ($in{'mode'} eq 'pri_rep_apply_set'){ &pri_rep_apply_set; } elsif ($in{'mode'} eq 'pri_rep_setting_list'){ &pri_rep_setting_list; } elsif ($in{'mode'} eq 'pri_rep_setting_set'){ &pri_rep_setting_set; } elsif ($in{'mode'} eq 'pri_rep_setting_del'){ &pri_rep_setting_del; } elsif ($in{'mode'} eq 'private_replay'){ &private_replay; } elsif ($in{'mode'} eq 'monster_pt_set'){ &monster_pt_set; } elsif ($in{'mode'} eq 'icon_select'){ &icon_select; } elsif ($in{'mode'} eq 'icon_select_set'){ &icon_select_set; } elsif ($in{'mode'} eq 'scenario_result'){ &scenario_result; } elsif ($in{'mode'} eq 'item'){ &item; } elsif ($in{'mode'} eq 'replay'){ &replay; } elsif ($in{'mode'} eq 'kizuna'){ &kizuna; } else{ &mypage_err("不正なパラメータ"); } &disconDB($dbh); exit; #--------------------------------------- # 自分用Myページ表示 #--------------------------------------- sub mypage_mine { # if ($pcid eq ''){&mypage_err("キャラクターログインされていません。");} # if ($uid eq 2){$myfile = 'mypage_mine_t.html';} &com_data($in{'mode'},$out{'pcid'},$flg_mode,$in{'type'}); $out{'race_id'} = $race; if ($pcid eq $out{'pcid'} && substr($pcid,0,2) eq 'xz'){ $out{'npc_info'} .=<<"EOT"; [透過全身図設定] EOT if ($out{'spell'} eq ' '){ $out{'npc_info'} .=<<"EOT"; [英文字登録] EOT } } &out_enc; if ($in{'data_mode'} eq 1){ $myfile = $file_other; $myhist = $hist_other; $out{'pcid'} = $in{'pcid'}; $pcdat = ''; open FILE,$myfile; while(){ s/!(\w+)!/$out{$1}/g; $pcdat .= $_; } close FILE; return $pcdat; } else{ open FILE,$myfile; print $header; while(){ s/!(\w+)!/$out{$1}/g; print; } close FILE; } } #--------------------------------------- # 設定 #--------------------------------------- sub setting { &com_data($in{'mode'},$out{'pcid'},$flg_mode,$in{'type'}); $out{'dp'} = &dp_rtn($out{'pcid'},$dbh); # #NPC用設定 # if (substr($pcid,0,2) eq 'jz'){ # $out{'npcsettei'} =<<"EOT"; # #●NPC設定 #Myページに表示されるNPC情報を編集します。 # # #EOT # } $dbh_pl = &connectDB($plDB); $sql = "select sum(point) from introduce_point where uid = $uid;"; $ref = $dbh_pl->selectall_arrayref($sql) or &mypage_err("CODE:C-01エラーが発生しました。"); ($i_pt)=@{$ref->[0]}; if ($i_pt eq ''){$i_pt = 0;} $sql = "select count(*) from introduce_point where introduce_uid = $uid and contents = 'ユーザー登録' and flg = 0;"; $ref = $dbh_pl->selectall_arrayref($sql) or &mypage_err("CODE:C-01エラーが発生しました。"); ($i_tmp)=@{$ref->[0]}; if ($i_tmp ne '' && $i_tmp eq 1){ ## $out{'sup'} =<<"EOT"; ## ##EOT } $out{'i_pt'} = $i_pt; &disconDB($dbh_pl); if ($out{'spell'} eq ' '){ $out{'spelling'} =<<"EOT"; ◆英文字登録 キャラクターの英文字の綴りの設定を行います。 一度しか設定を行えませんので、ご注意ください。 EOT } # &out_enc; if (substr($pcid,0,2) eq 'xz'){ $ofname = "mypage_setup_npc.html"; } else{ $out{'ztcnt'} = (&halfway_point_rtn - &halfway_tp_rtn); if ($out{'ztcnt'} > 0){ $out{'tn'} =<<"EOT"; ◆初期鍛練 残り鍛練回数 $out{'ztcnt'} 中途入学(7月〜翌年3月)したキャラクターの鍛練を行います。 1回の鍛練で、魔法vaを1Lv修得することができます EOT } $sql = "select count(*) from free_set where pcid = '$pcid' and title is not null and result = 1;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:C-01エラーが発生しました。"); ($f_cnt)=@{$ref->[0]}; if ($f_cnt > 0){ $out{'fset_change'} =<<"EOT"; EOT } $sql = "select count(*) from pri_replay where pcid = '$pcid' and state = 0;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:C-01エラーが発生しました。"); ($out{'p_cnt'})=@{$ref->[0]}; $out{'ma_cnt'} = $t_seirei; $out{'ztp'} = &tp_rtn; $sql = "select b.name from poll a,master b where a.pcid = '$pcid' and a.msid = b.id order by a.reg_date;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:MH-02エラーが発生しました。"); foreach(@$ref) { ($ms_name)=@{$_}; $out{'fav_ms'} .= " $ms_name"; } $ofname = "mypage_setting.html"; } &out_enc; &html_out($ofname); } #--------------------------------------- # コンバート戦技必要DP算出 #--------------------------------------- sub combat_skill_ndp_rtn { $sql = "select sum(lv) from skill where pcid = '$pcid' and id >= 200 and id <= 243;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:CD-01エラーが発生しました。"); ($cn_cnt)=@{$ref->[0]}; if ($cn_cnt eq ''){$cn_cnt = 0;} $ndp = 0; if ($cn_cnt eq 0){$ndp = 45;} elsif ($cn_cnt eq 1){$ndp = 90;} elsif ($cn_cnt eq 2){$ndp = 135;} elsif ($cn_cnt eq 3){$ndp = 180;} elsif ($cn_cnt eq 4){$ndp = 225;} elsif ($cn_cnt eq 5){$ndp = 270;} elsif ($cn_cnt eq 6){$ndp = 315;} elsif ($cn_cnt eq 7){$ndp = 360;} elsif ($cn_cnt eq 8){$ndp = 405;} elsif ($cn_cnt >= 9){$ndp = 450;} return $ndp; } #--------------------------------------- # コンバート戦技選択 #--------------------------------------- sub combat_skill_convert { $dp = &dp_rtn($pcid,$dbh); $out{'dp'} = $dp; $ndp = &combat_skill_ndp_rtn; $out{'ndp'} = $ndp; #戦技(魔法Va)データ $sql = "select distinct a.id,b.name from magic a,magic_master b where a.pcid = '$pcid' and a.id = b.id and b.effect = '戦技' group by a.id,b.name order by a.id;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:MH-02エラーが発生しました。"); foreach(@$ref) { ($skill_id,$skill_name)=@{$_}; $sql2 = "select lv from magic where pcid = '$pcid' and id = $skill_id;"; $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:C-01エラーが発生しました。"); ($skill_lv)=@{$ref2->[0]}; if ($skill_lv < 3){$skill_lv = 1;} elsif ($skill_lv < 5){$skill_lv = 3;} elsif ($skill_lv < 8){$skill_lv = 5;} $flg = 0; foreach ($i=1;$i<=$skill_lv;$i++){ $rank = ''; if ($i eq 1){ $rank = '初級'; $lv = 1; } elsif ($i eq 3){ $rank = '中級'; $lv = 2; } elsif ($i eq 5){ $rank = '上級'; $lv = 3; } elsif ($i eq 8){ $rank = '仙級'; $lv = 4; } if ($rank ne ''){ # $sql2 = "select count(*) from skill_master a,skill b where a.base = $skill_id and a.field = $i and a.id = b.id and b.pcid = '$pcid';"; $sql2 = "select count(*) from skill_master a,skill b where a.base = $skill_id and a.id = b.id and b.pcid = '$pcid' and b.lv >= $lv;"; $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:C-01エラーが発生しました。"); ($skill_cnt)=@{$ref2->[0]}; if ($skill_cnt eq ''){$skill_cnt = 0;} if ($skill_cnt > 0){$btn = '修得済';} elsif ($flg eq 0){ $btn =<<"EOT"; EOT $flg = 1; } else{$btn = '修得不可';} $out{'list'} .=<<"EOT"; $skill_name$rank$btn EOT } } } &out_enc; &html_out("mypage_combat_skill01.html"); } #--------------------------------------- # コンバート戦技選択 #--------------------------------------- sub combat_skill_convert_conf { if ($in{'pcid'} ne $pcid){&mypage_err("現在ログインしているキャラクターと、戦技をスキル化しようとしているキャラクターが一致しません。");} $dp = &dp_rtn($pcid,$dbh); $out{'dp'} = $dp; $ndp = &combat_skill_ndp_rtn; $out{'ndp'} = $ndp; if ($dp < $ndp){&mypage_err("DPが不足しています。");} $sql = "select lv from magic where pcid = '$pcid' and id = $in{'id'};"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:C-01エラーが発生しました。"); ($skill_lv)=@{$ref->[0]}; if ($skill_lv < 3){ $skill_lv = 1; $rank = '初級'; } elsif ($skill_lv < 5){ $skill_lv = 3; $rank = '中級'; } elsif ($skill_lv < 8){ $skill_lv = 5; $rank = '上級'; } elsif ($skill_lv >= 8){ $skill_lv = 5; $rank = '仙級'; } $sql = "select count(*) from skill_master a,skill b where a.base = $in{'id'} and a.field = $skill_lv and a.id = b.id and b.pcid = '$pcid';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:C-02エラーが発生しました。"); ($cnt)=@{$ref->[0]}; if ($cnt ne '' && $cnt > 0){&mypage_err("指定の戦技は、既にスキル化しています。");} $sql = "select count(*) from skill_master a,skill b where a.base = $in{'id'} and a.field <= $skill_lv and a.id = b.id and b.pcid = '$pcid';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:C-02エラーが発生しました。"); ($cnt)=@{$ref->[0]}; if ($cnt eq 0){$skill_lv = 1;} elsif ($cnt eq 1){$skill_lv = 3;} elsif ($cnt eq 2){$skill_lv = 5;} elsif ($cnt eq 3){$skill_lv = 8;} $sql = "select name from skill_master where base = $in{'id'} and field = $skill_lv;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:C-02エラーが発生しました。"); ($out{'skill_name'})=@{$ref->[0]}; &out_enc; &html_out("mypage_combat_skill02.html"); } #--------------------------------------- # コンバート戦技修得 #--------------------------------------- sub combat_skill_convert_exe { if ($in{'pcid'} ne $pcid){&mypage_err("現在ログインしているキャラクターと、戦技をスキル化しようとしているキャラクターが一致しません。");} $dp = &dp_rtn($pcid,$dbh); $out{'dp'} = $dp; $ndp = &combat_skill_ndp_rtn; $out{'ndp'} = $ndp; if ($dp < $ndp){&mypage_err("DPが不足しています。");} $sql = "select lv from magic where pcid = '$pcid' and id = $in{'id'};"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:C-01エラーが発生しました。"); ($skill_lv)=@{$ref->[0]}; if ($skill_lv < 3){ $skill_lv = 1; $rank = '初級'; $sql = "select count(*) from skill where pcid = '$pcid';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:C-01Xエラーが発生しました。"); ($tmp_cnt)=@{$ref->[0]}; if ($tmp_cnt ne '' && $tmp_cnt >= 14){&mypage_err("修得済みスキル数が14未満でなければ新しい戦技をスキル化できません。");} } elsif ($skill_lv < 5){ $skill_lv = 3; $rank = '中級'; } elsif ($skill_lv < 8){ $skill_lv = 5; $rank = '上級'; } elsif ($skill_lv >= 8){ $skill_lv = 5; $rank = '仙級'; } $sql = "select count(*) from skill_master a,skill b where a.base = $in{'id'} and a.field = $skill_lv and a.id = b.id and b.pcid = '$pcid';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:C-02エラーが発生しました。"); ($cnt)=@{$ref->[0]}; if ($cnt ne '' && $cnt > 0){&mypage_err("指定の戦技は、既にスキル化しています。");} $sql = "select count(*) from skill_master a,skill b where a.base = $in{'id'} and a.field <= $skill_lv and a.id = b.id and b.pcid = '$pcid';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:C-02エラーが発生しました。"); ($cnt)=@{$ref->[0]}; if ($cnt eq 0){$skill_lv = 1;} elsif ($cnt eq 1){$skill_lv = 3;} elsif ($cnt eq 2){$skill_lv = 5;} elsif ($cnt eq 3){$skill_lv = 8;} $sql = "select id,name from skill_master where base = $in{'id'} and field = $skill_lv;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:C-02エラーが発生しました。"); ($skill_id,$out{'skill_name'})=@{$ref->[0]}; if ($skill_lv eq 1){ $sql = "insert into skill (pcid,id,lv) values ('$pcid',$skill_id,1);"; } else{ $sql = "select id from skill_master where base = $in{'id'} and field = 1;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:C-02エラーが発生しました。"); ($base_id)=@{$ref->[0]}; $sql = "update skill set lv = lv + 1 where pcid = '$pcid' and id = $base_id;"; } $dbh->do($sql) or &mypage_err("CODE:PD-01エラーが発生しました。"); $sql = "insert into alchemy_mass_work (pcid,use_dp,result,content) values ('$pcid',$ndp,-1,'戦技スキル化:$out{'skill_name'},$in{'id'},$skill_lv');"; $dbh->do($sql) or &mypage_err("CODE:PD-01エラーが発生しました。"); &out_enc; &html_out("mypage_combat_skill03.html"); } #--------------------------------------- # スペル登録フォーム #--------------------------------------- sub spelling { $sql = "select first_name,middle_name,family_name,race from character where pcid = '$pcid' and state = 0 and admission = 1;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:HT-01エラーが発生しました。"); ($first_name,$middle_name,$family_name,$race)=@{$ref->[0]}; if ($first_name ne ''){&mypage_err("既に登録されています。");} &out_enc; if(($race ne 6) && ($race ne 10)){ &html_out("mypage_spelling01.html"); }else{ &html_out("mypage_spelling01_sb.html"); } } #--------------------------------------- # スペル登録確認 #--------------------------------------- sub spelling_conf { $sql = "select first_name,middle_name,family_name,race from character where pcid = '$pcid' and state = 0 and admission = 1;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:HT-01エラーが発生しました。"); ($first_name,$middle_name,$family_name,$race)=@{$ref->[0]}; if ($first_name ne ''){&mypage_err("既に登録されています。");} if ($in{'first_name'} eq ''){&mypage_err("ファーストネームが入力されていません。");} if(($race ne 6) && ($race ne 10)){ if ($in{'family_name'} eq ''){&mypage_err("ラストネームが入力されていません。");} } if (&isAlpha($in{'first_name'}) eq 0){&mypage_err("ファーストネームは半角英字のみです。");} if(($race ne 6) && ($race ne 10)){ if (&isAlpha($in{'middle_name'}) eq 0){&mypage_err("ミドルネームは半角英字のみです。");} if (&isAlpha($in{'family_name'}) eq 0){&mypage_err("ラストネームは半角英字のみです。");} } if (length($in{'first_name'}) > 15){&mypage_err("ファーストネームは15文字までです。");} if(($race ne 6) && ($race ne 10)){ if (length($in{'middle_name'}) > 15){&mypage_err("ミドルネームは15文字までです。");} if (length($in{'family_name'}) > 15){&mypage_err("ラストネームは15文字までです。");} } $in{'first_name'} = uc(substr($in{'first_name'},0,1)) . lc(substr($in{'first_name'},1)); if(($race ne 6) && ($race ne 10)){ $in{'middle_name'} = uc(substr($in{'middle_name'},0,1)) . lc(substr($in{'middle_name'},1)); $in{'family_name'} = uc(substr($in{'family_name'},0,1)) . lc(substr($in{'family_name'},1)); } %out = %in; &out_enc; if(($race ne 6) && ($race ne 10)){ &html_out("mypage_spelling02.html"); }else{ &html_out("mypage_spelling02_sb.html"); } } #--------------------------------------- # スペル登録実行 #--------------------------------------- sub spelling_entry { $sql = "select first_name,middle_name,family_name,race from character where pcid = '$pcid' and state = 0 and admission = 1;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:HT-01エラーが発生しました。"); ($first_name,$middle_name,$family_name,$race)=@{$ref->[0]}; if ($first_name ne ''){&mypage_err("既に登録されています。");} if ($in{'first_name'} eq ''){&mypage_err("ファーストネームが入力されていません。");} if(($race ne 6) && ($race ne 10)){ if ($in{'family_name'} eq ''){&mypage_err("ラストネームが入力されていません。");} } if (&isAlpha($in{'first_name'}) ne 1){&mypage_err("ファーストネームは半角英字のみです。");} if(($race ne 6) && ($race ne 10)){ if ($in{'middle_name'} ne '' && &isAlpha($in{'middle_name'}) ne 1){&mypage_err("ミドルネームは半角英字のみです。");} if (&isAlpha($in{'family_name'}) ne 1){&mypage_err("ラストネームは半角英字のみです。");} } if (length($in{'first_name'}) > 15){&mypage_err("ファーストネームは15文字までです。");} if(($race ne 6) && ($race ne 10)){ if ($in{'middle_name'} ne '' && length($in{'middle_name'}) > 15){&mypage_err("ミドルネームは15文字までです。");} if (length($in{'family_name'}) > 15){&mypage_err("ラストネームは15文字までです。");} } $in{'first_name'} = uc(substr($in{'first_name'},0,1)) . substr($in{'first_name'},1); if(($race ne 6) && ($race ne 10)){ $in{'middle_name'} = uc(substr($in{'middle_name'},0,1)) . substr($in{'middle_name'},1); $in{'family_name'} = uc(substr($in{'family_name'},0,1)) . substr($in{'family_name'},1); } $sql = "update character set first_name = '$in{'first_name'}'"; if ($in{'middle_name'} ne ''){$sql .= ",middle_name = '$in{'middle_name'}'";} if(($race ne 6) && ($race ne 10)){ $sql .= ",family_name = '$in{'family_name'}' "; } $sql .= " where pcid = '$pcid';"; $dbh->do($sql) or &mypage_err("CODE:PD-01エラーが発生しました。"); print "Location: ./mypage_spelling_end.html\n\n"; } #--------------------------------------- # プライベートリプレイ申請画面 #--------------------------------------- sub pri_rep_apply { $sql = "select name from character where pcid = '$pcid';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:HT-01エラーが発生しました。"); ($name)=@{$ref->[0]}; $out{'pcname'} = "$name($pcid)"; $sql = "select now() + '-1 days';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:HT-02エラーが発生しました。"); ($max_day)=@{$ref->[0]}; $max_year = substr($max_day,0,4) - 1000; $max_month = substr($max_day,5,2); $max_day = substr($max_day,8,2); $sql = "select birth from character where pcid = '$pcid';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:HT-03エラーが発生しました。"); ($min_day)=@{$ref->[0]}; if (substr($min_day,0,1) eq 9){ $min_year = substr($min_day,0,3); $min_month = substr($min_day,4,2); $min_day = substr($min_day,7,2); } else{ $min_year = substr($min_day,0,4); $min_month = substr($min_day,5,2); $min_day = substr($min_day,8,2); } for($i=$min_year;$i<=$max_year;$i++){ $out{'rep_year'} .=<<"EOT"; $i EOT } &out_enc; &html_out("mypage_pri_rep01.html"); } #--------------------------------------- # プライベートリプレイ申請確認 #--------------------------------------- sub pri_rep_apply_conf { &in_enc; if ($in{'title'} eq ''){&mypage_err("「タイトル」が入力されていません。");} if ($in{'digest'} eq ''){&mypage_err("「ダイジェスト」が入力されていません。");} if ($in{'honbun'} eq ''){&mypage_err("「本文」が入力されていません。");} if (length($in{'title'}) > 30){&mypage_err("「タイトル」は全角15文字までです。");} if (index($in{'title'}, '\'') >= 0){&mypage_err("「タイトル」に使用できない文字「\'」が含まれています。");} if (index($in{'title'}, '"') >= 0){&mypage_err("「タイトル」に使用できない文字「\"」が含まれています。");} $tmp = &newline_remove($in{'digest'}); if (length($tmp) > 500){&mypage_err("「ダイジェスト」は全角250文字までです。");} if (index($in{'digest'}, '\'') >= 0){&mypage_err("「ダイジェスト」に使用できない文字「'」が含まれています。");} if (index($in{'digest'}, '"') >= 0){&mypage_err("「ダイジェスト」に使用できない文字「\"」が含まれています。");} $tmp = &newline_remove($in{'honbun'}); if (length($tmp) > 3000){&mypage_err("「本文」は全角1500文字までです。");} if (index($in{'honbun'}, '\'') >= 0){&mypage_err("「本文」に使用できない文字「'」が含まれています。");} if (index($in{'honbun'}, '"') >= 0){&mypage_err("「本文」に使用できない文字「\"」が含まれています。");} $sql = "select count(*) from pri_replay where pcid = '$pcid' and (apply_title = '$in{'title'}' or title = '$in{'title'}') and state in (0,1);"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:HT-01エラーが発生しました。"); ($cnt)=@{$ref->[0]}; if ($cnt ne '' && $cnt > 0){&err("既に承認済み、あるいは申請中のプラリプに同一タイトルがある為、申請できません。");} $apply_date = int($in{'apply_year'} + 1000) . '-' . $in{'apply_month'} . '-' . $in{'apply_day'}; $sql = "select now() + '-1 days' - to_timestamp('$apply_date','YYYY-MM-DD');"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:HT-01Aエラーが発生しました。"); ($check)=@{$ref->[0]}; if (substr($check,0,1) eq '-'){&mypage_err("本日以降の未来の日付を設定することはできません。");} $sql = "select birth from character where pcid = '$pcid';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:HT-03エラーが発生しました。"); ($min_day)=@{$ref->[0]}; if (substr($min_day,0,1) eq 9){ $min_year = substr($min_day,0,3); $min_month = substr($min_day,3,2); $min_day = substr($min_day,5,2); } else{ $min_year = substr($min_day,0,4); $min_month = substr($min_day,5,2); $min_day = substr($min_day,8,2); } $tar_date = int($min_year + 1000) . '-' . $min_month . '-' . $min_day; $sql = "select to_timestamp('$apply_date','YYYY-MM-DD') - to_timestamp('$tar_date','YYYY-MM-DD');"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:HT-01Bエラーが発生しました。"); ($check)=@{$ref->[0]}; # &mypage_err($check . "" . $sql); if (substr($check,0,1) eq '-'){&mypage_err("誕生日より前の日付を設定することはできません。");} $out{'apply_rep_date'} = $in{'apply_year'} . '-' . $in{'apply_month'} . '-' . $in{'apply_day'}; $sql = "select name from character where pcid = '$pcid';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:HT-01エラーが発生しました。"); ($name)=@{$ref->[0]}; $out{'pcname'} = "$name($pcid)"; $out{'digest_str'} = &newline_change($in{'digest'}); $out{'honbun_str'} = &newline_change($in{'honbun'}); &out_enc; &html_out("mypage_pri_rep02.html"); } #--------------------------------------- # プライベートリプレイ申請実行 #--------------------------------------- sub pri_rep_apply_set { &in_enc; if ($in{'apply_rep_date'} eq ''){&mypage_err("日付が設定されていません。");} $rc = 1; $rexc = &get_rex($pcid); if ($rexc < 1000){&mypage_err("残高が不足しているため、申請できません。");} $sql = "insert into pri_replay (pcid,apply_title,apply_digest,apply_text,rep_date) values ('$pcid','$in{'title'}','$in{'digest'}','$in{'honbun'}',to_timestamp('$in{'apply_rep_date'}','YYYY-MM-DD'));"; $dbh->do($sql) or &mypage_err("CODE:T-01Aエラーが発生しました。"); my $content = $sql; &log_write($pcid,'プラリプ申請',$content); if ($rc eq 1){ $er = &use_rex($pcid,undef,-1000,'プラリプ申請'); if ($er ne 0){ &sendmail('log@rexi.jp','gx@rexi.jp','プラリプ申請エラー',$er,$sql); } } print "Location: ./mypage_pri_rep_apply_end.html\n\n"; } #--------------------------------------- # プライベートリプレイ一覧 #--------------------------------------- sub pri_rep_setting_list { $sql = "select title,digest from pri_replay where pcid = '$pcid' and title is not null and set_flg = 1 and state = 0;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:HT-01エラーが発生しました。"); ($title,$digest)=@{$ref->[0]}; $digest = &newline_change($digest); if ($title eq ''){ $out{'set_rep'} =<<"EOT"; 未設定 EOT } else{ $out{'set_rep'} =<<"EOT"; $title EOT } $sql = "select seq,title,digest from pri_replay where pcid = '$pcid' and title is not null and state = 0 order by seq;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:MH-02エラーが発生しました。"); foreach(@$ref) { ($seq,$title,$digest)=@{$_}; $digest = &newline_change($digest); $out{'list'} .=<<"EOT"; $title EOT } &out_enc; &html_out("mypage_pri_rep03.html"); } #--------------------------------------- # プライベートリプレイ設定 #--------------------------------------- sub pri_rep_setting_set { if ($in{'seq'} eq ''){&mypage_err("プラリプが指定されていません。");} $sql = "update pri_replay set set_flg = 0 where pcid = '$pcid';"; $dbh->do($sql) or &mypage_err("CODE:PD-01エラーが発生しました。"); $sql = "update pri_replay set set_flg = 1 where pcid = '$pcid' and seq = $in{'seq'};"; $dbh->do($sql) or &mypage_err("CODE:PS-01エラーが発生しました。"); print "Location: ./$mycgi?mode=history\n\n"; # print "Location: ./$mycgi?mode=pri_rep_setting_list\n\n"; } #--------------------------------------- # プライベートリプレイ設定削除 #--------------------------------------- sub pri_rep_setting_del { $sql = "update pri_replay set set_flg = 0 where pcid = '$pcid';"; $dbh->do($sql) or &mypage_err("CODE:PD-01エラーが発生しました。"); print "Location: ./$mycgi?mode=pri_rep_setting_list\n\n"; } #--------------------------------------- # プライベートリプレイ表示 #--------------------------------------- sub private_replay { if ($in{'seq'} eq ''){&mypage_err("プラリプが指定されていません。");} $sql = "select title,digest,text from pri_replay where pcid = '$in{'pcid'}' and seq = $in{'seq'} and title is not null and state = 0;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:HT-01エラーが発生しました。"); ($out{'title'},$out{'digest'},$out{'text'})=@{$ref->[0]}; $out{'digest'} = &newline_change($out{'digest'}); $out{'text'} = &newline_change($out{'text'}); &out_enc; &html_out("mypage_pri_rep04.html"); } #--------------------------------------- # 中途入学対応鍛練可能回数返却 #--------------------------------------- sub halfway_point_rtn { $adm = $_[0]; if ($adm eq ''){ $sql = "select admission_date,reg_date from character where pcid = '$pcid';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:HT-01エラーが発生しました。"); ($admission_date,$reg_date)=@{$ref->[0]}; if ($admission_date eq ''){$admission_date = $reg_date;} $adm = substr($admission_date,0,4) . substr($admission_date,5,2); } if ($adm <= "200910"){ if ($adm <= "200909"){$t_num = 1;} elsif ($adm eq "200910"){$t_num = 2;} }elsif ($adm <= "200911"){ $m = substr($adm,4); if ($m eq "04" || $m eq "05" || $m eq "06"){$t_num = 0;} elsif ($m eq "07" || $m eq "08" || $m eq "09"){$t_num = 1;} elsif ($m eq "10" || $m eq "11" || $m eq "12"){$t_num = 2;} elsif ($m eq "01" || $m eq "02" || $m eq "03"){$t_num = 3;} }else{ $m = substr($adm,4); if ($m eq "03" || $m eq "04" || $m eq "05" || $m eq "06"){$t_num = 0;} elsif ($m eq "07" || $m eq "08" || $m eq "09"){$t_num = 1;} elsif ($m eq "10" || $m eq "11" || $m eq "12"){$t_num = 2;} elsif ($m eq "01" || $m eq "02"){$t_num = 3;} } return $t_num; } #--------------------------------------- # 中途入学対応鍛練可能TP返却 #--------------------------------------- sub halfway_tp_rtn { $adm = $_[0]; if ($adm eq ''){ $sql = "select admission_date,reg_date from character where pcid = '$pcid';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:HT-01エラーが発生しました。"); ($admission_date,$reg_date)=@{$ref->[0]}; if ($admission_date eq ''){$admission_date = $reg_date;} $adm = substr($admission_date,0,4) . substr($admission_date,5,2); } if ($adm eq "200904"){ $t_tp = 9; } elsif ($adm eq "200904"){ $t_tp = 9; } elsif ($adm eq "200905"){ $t_tp = 9; } elsif ($adm eq "200906"){ $t_tp = 9; } elsif ($adm eq "200907"){ $t_tp = 9; } elsif ($adm eq "200908"){ $t_tp = 9; } elsif ($adm eq "200909"){ $t_tp = 9; } elsif ($adm eq "200910"){ $t_tp = 9; } elsif ($adm eq "200911"){ $t_tp = 9; } elsif ($adm eq "200912"){ $t_tp = 9; } elsif ($adm eq "201001"){ $t_tp = 9; } elsif ($adm eq "201002"){ $t_tp = 9; } elsif ($adm eq "201003"){ $t_tp = 9; } return $t_tp; } #--------------------------------------- # 中途入学対応 #--------------------------------------- sub halfway_training { $sql = "select admission_date,reg_date from character where pcid = '$pcid';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:HT-01エラーが発生しました。"); ($admission_date,$reg_date)=@{$ref->[0]}; if ($admission_date eq ''){$admission_date = $reg_date;} $adm = substr($admission_date,0,4) . substr($admission_date,5,2); $t_num = &halfway_point_rtn($adm); $t_tp = &halfway_tp_rtn($adm); &cal_ability_rtn; $out{'ztcnt'} = ($t_num - &halfway_tp_rtn); # if ($out{'ztcnt'} eq '' || $out{'ztcnt'} <= 0){&mypage_err("既に可能な鍛練回数を超えています。");} $out{'lv1a'} = $b_kakutou; $out{'lv2a'} = $b_syageki; $out{'lv3a'} = $b_hansya; $out{'lv4a'} = $b_teikou; $out{'lv5a'} = $b_seirei; $out{'lv1b'} = $b_kakutou + 1; $out{'lv2b'} = $b_syageki + 1; $out{'lv3b'} = $b_hansya + 1; $out{'lv4b'} = $b_teikou + 1; $out{'lv5b'} = $b_seirei + 1; &html_out('mypage_halfway_tanren01.html'); } #--------------------------------------- # 中途鍛練2 #--------------------------------------- sub halfway_training2 { if ($in{'type'} eq 'ability'){ &halfway_training_conf; } elsif ($in{'type'} eq 'va'){ &halfway_training_va_list; } elsif (substr($in{'type'},0,5) eq 'skill'){ &halfway_training_skill_list; } } #--------------------------------------- # 中途鍛練確認 #--------------------------------------- sub halfway_training_conf { &cal_ability_rtn; $out{'ztcnt'} = int(&halfway_point_rtn - &halfway_tp_rtn); if ($out{'ztcnt'} eq '' || $out{'ztcnt'} <= 0){&mypage_err("既に可能な鍛練回数を超えています。");} if ($in{'type'} eq 'va'){$out{'tname'} = '魔法va';} elsif ($in{'type'} eq 'skill'){ $sqlm = "select name from skill_master where id = $in{'no'};"; $refm = $dbh->selectall_arrayref($sqlm) or &mypage_err("CODE:TC-01エラーが発生しました。"); ($out{'tname'})=@{$refm->[0]}; } elsif ($in{'type'} eq 6){ $sqlm = "select name from magic_master where id = $in{'no'};"; $refm = $dbh->selectall_arrayref($sqlm) or &mypage_err("CODE:TC-01エラーが発生しました。"); ($out{'tname'})=@{$refm->[0]}; } elsif ($in{'no'} eq 1){$out{'tname'} = '格闘力';} elsif ($in{'no'} eq 2){$out{'tname'} = '射撃力';} elsif ($in{'no'} eq 3){$out{'tname'} = '反射力';} elsif ($in{'no'} eq 4){$out{'tname'} = '抵抗力';} elsif ($in{'no'} eq 5){$out{'tname'} = '精霊力';} &html_out('mypage_halfway_tanren02.html'); } #--------------------------------------- # 中途鍛練(Vaリスト) #--------------------------------------- sub halfway_training_va_list { &cal_ability_rtn; $out{'ztcnt'} = int(&halfway_point_rtn - &halfway_tp_rtn); if ($out{'ztcnt'} eq '' || $out{'ztcnt'} <= 0){&mypage_err("既に可能な鍛練回数を超えています。");} $sql = "select class,lumina,race,lumina_lv from character where pcid = '$pcid';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:TV-01エラーが発生しました。"); ($c_class,$c_lumina,$c_race,$c_lumina_lv)=@{$ref->[0]}; if ($c_class eq 1){$c_class = 'W';} elsif ($c_class eq 2){$c_class = 'K';} elsif ($c_class eq 3){$c_class = 'P';} elsif ($c_class eq 4){$c_class = 'H';} # if ($c_lumina eq 1){$c_class = 'W';} $sql = "select id,rank,name,text,class,lumina,lv_limit,effect,range,scope,gs,time,lumina2 from magic_master where (class = '全' or class = '$c_class') and (lumina = '補' or lumina = '共' or lumina = '@lumina_str[$c_lumina]') and rank = 1 and lumina_lv <= $c_lumina_lv and race_limit is null order by id;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:TV-02エラーが発生しました。"); foreach(@$ref) { ($id,$rank,$name,$text,$class,$lumina,$lv_limit,$effect,$range,$scope,$gs,$time,$lumina2)=@{$_}; push ary_id,$id; push ary_rank,$rank; push ary_name,$name; push ary_text,$text; push ary_class,$class; push ary_lumina,$lumina; push ary_lv_limit,$lv_limit; push ary_effect,$effect; push ary_range,$range; push ary_scope,$scope; push ary_gs,$gs; push ary_time,$time; push ary_lumina2,$lumina2; } $t_r = '%' . $c_race . '%'; $sql = "select id,rank,name,text,class,lumina,lv_limit,effect,range,scope,gs,time,race_limit,lumina2 from magic_master where lumina_lv <= $c_lumina and (class = '全' or class = '$c_class') and (lumina = '補' or lumina = '共' or lumina = '@lumina_str[$c_lumina]') and rank = 1 and lumina_lv <= $c_lumina_lv and race_limit is not null and race_limit like '$t_r' order by id;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:TV-02エラーが発生しました。"); foreach(@$ref) { ($id,$rank,$name,$text,$class,$lumina,$lv_limit,$effect,$range,$scope,$gs,$time,$race_limit,$lumina2)=@{$_}; $r_flg = 0; @ary_tmp = (); @ary_tmp = split(/\,/,$race_limit); foreach(@ary_tmp){ if ($c_race eq $_){ $r_flg = 1; last; } } if ($r_flg eq 1){ push ary_id,$id; push ary_rank,$rank; push ary_name,$name; push ary_text,$text; push ary_class,$class; push ary_lumina,$lumina; push ary_lv_limit,$lv_limit; push ary_effect,$effect; push ary_range,$range; push ary_scope,$scope; push ary_gs,$gs; push ary_time,$time; push ary_lumina2,$lumina2; } } $i=0; foreach (@ary_id){ $id = @ary_id[$i]; $rank = @ary_rank[$i]; $name = @ary_name[$i]; $text = @ary_text[$i]; $class = @ary_class[$i]; $lumina = @ary_lumina[$i]; $lv_limit = @ary_lv_limit[$i]; $effect = @ary_effect[$i]; $range = @ary_range[$i]; $scope = @ary_scope[$i]; $gs = @ary_gs[$i]; $time = @ary_time[$i]; $lumina2 = @ary_lumina2[$i]; $i++; if ($gs eq ''){$gs = '−';} if ($lumina2 ne ''){$lumina = $lumina2;} $text =<<"EOT"; 効果:$effect 射程:$range 範囲:$scope 時間:$time Gs:$gs $text EOT $sql2 = "select count(*) from tp where pcid = '$pcid' and ((type = 0 and point < 0) or (type = 1 and point = 0)) and genre = 'va' and no = $id;"; $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:TV-03エラーが発生しました。"); ($n_lv)=@{$ref2->[0]}; $lv = $n_lv; $lv2 = $lv + 1; if ($n_lv eq '' || $n_lv eq 0){ $n_lv = '未修得'; $nx_lv = '1(初級)'; } else{ if ($n_lv < 3){$n_lv_str = '初級';} elsif ($n_lv >= 3 && $n_lv < 5){$n_lv_str = '中級';} elsif ($n_lv >= 5 && $n_lv eq 8){$n_lv_str = '上級';} $n_lv = "$n_lv($n_lv_str)"; $nx_lv = $n_lv + 1; if ($nx_lv < 3){$nx_lv_str = '初級';} elsif ($nx_lv < 5){$nx_lv_str = '中級';} elsif ($nx_lv eq 8){$nx_lv_str = '上級';} $nx_lv = "$nx_lv($nx_lv_str)"; } if ($lv >= $lv_limit){ $btn = 'Lv限界'; $nx_lv = '―'; } elsif ($t_seirei < $lv2){$btn = '精霊力不足';} elsif ($lv >= $lv_limit){ $btn = 'Lv限界'; $nx_lv = '―'; } elsif ($k_num ne '' && $k_num > 0){ $btn = '済み'; $nx_lv = '―'; } else{ $btn =<<"EOT"; EOT } $text = &newline_change($text); $out{'list'} .=<<"EOT"; $name$class$lumina$lv_limit$n_lv$nx_lv$btn EOT } &html_out('mypage_halfway_tanren04.html'); } #--------------------------------------- # 中途鍛練(スキルリスト) #--------------------------------------- sub halfway_training_skill_list { $out{'ztcnt'} = int(&halfway_point_rtn - &halfway_tp_rtn); if ($out{'ztcnt'} eq '' || $out{'ztcnt'} <= 0){&mypage_err("既に可能な鍛練回数を超えています。");} $bun = substr($in{'type'},5); $base_no = $bun; if ($bun eq 1){$bun = '身体';} elsif ($bun eq 2){$bun = '技術';} elsif ($bun eq 3){$bun = '知識';} $out{'bun'} = $bun; &cal_ability_rtn; $sql = "select id,name,base,info from skill_master where field = '$bun' order by id;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:TS-01エラーが発生しました。"); foreach(@$ref) { ($no,$skill_name,$base,$info)=@{$_}; $sqlm = "select lv from skill where pcid = '$pcid' and id = $no;"; $refm = $dbh->selectall_arrayref($sqlm) or &mypage_err("CODE:TS-02エラーが発生しました。"); ($slv)=@{$refm->[0]}; if ($slv eq ''){$slv = 0;} $slv2 = $slv + 1; if ($base eq 'VIT' && $t_vit <= $slv){$a_flg = 0;} elsif ($base eq 'SUB' && $t_sub <= $slv){$a_flg = 0;} elsif ($base eq 'DEX' && $t_dex <= $slv){$a_flg = 0;} elsif ($base eq 'PER' && $t_per <= $slv){$a_flg = 0;} elsif ($base eq 'INT' && $t_int <= $slv){$a_flg = 0;} elsif ($base eq 'MEN' && $t_men <= $slv){$a_flg = 0;} else{$a_flg = 1;} if ($a_flg eq 0){ $btn =<<"EOT"; 修得限界 EOT } elsif ($a_flg eq 1){ $btn =<<"EOT"; EOT } else{ $btn = '済み'; $slv2 = '―'; } $info = &newline_change($info); $out{'skill_list'} .=<<"EOT"; $skill_name$base$slv$slv2$btn EOT } &html_out('mypage_halfway_tanren03.html'); } #--------------------------------------- # 鍛練実行 #--------------------------------------- sub halfway_training3 { &cal_ability_rtn; $out{'ztcnt'} = int(&halfway_point_rtn - &halfway_tp_rtn); if ($out{'ztcnt'} eq '' || $out{'ztcnt'} <= 0){&mypage_err("既に可能な鍛練回数を超えています。");} if ($in{'type'} eq 'skill'){ } elsif ($in{'type'} eq 6){ $in{'type'} = 'va'; } else{ } $sql = "insert into tp (pcid,genre,no,type) values ('$pcid','$in{'type'}',$in{'no'},1);"; $dbh->do($sql) or &mypage_err("CODE:T-01エラーが発生しました。"); if ($in{'type'} eq 'skill'){ #スキル登録 $sql2 = "select count(*) from skill where pcid = '$pcid' and id = $in{'no'};"; $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:TV-03エラーが発生しました。"); ($cnt)=@{$ref2->[0]}; if ($cnt eq '' || $cnt eq 0){ $sql = "insert into skill (pcid,id,lv) values ('$pcid',$in{'no'},1);"; } else{ $sql = "update skill set lv = lv + 1 where pcid = '$pcid' and id = $in{'no'};"; } $dbh->do($sql) or &mypage_err("CODE:T-01Aエラーが発生しました。"); } elsif ($in{'type'} eq 'va'){ #魔法Va登録 $sql2 = "select count(*) from magic where pcid = '$pcid' and id = $in{'no'};"; $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:TV-03エラーが発生しました。"); ($cnt)=@{$ref2->[0]}; if ($cnt eq '' || $cnt eq 0){ $sql = "insert into magic (pcid,id,lv) values ('$pcid',$in{'no'},1);"; } else{ $sql = "update magic set lv = lv + 1 where pcid = '$pcid' and id = $in{'no'};"; } $dbh->do($sql) or &mypage_err("CODE:T-01Bエラーが発生しました。"); } print "Location: ./mypage.cgi?pcid=$pcid&mode=halfway_training\n\n"; } #--------------------------------------- # 友達紹介キャンペーン用プレゼントの一覧表示 #--------------------------------------- sub introduce_use_point { $dbh_pl = &connectDB($plDB); $sql = "select sum(point) from introduce_point where uid = $uid;"; $ref = $dbh_pl->selectall_arrayref($sql) or &mypage_err("CODE:C-01エラーが発生しました。"); ($out{'i_pt'})=@{$ref->[0]}; if ($out{'i_pt'} eq ''){$out{'i_pt'} = 0;} $sql = "select seq,id,point,name,text from introduce_campaign_item where game = 'GX' and state = 0 order by point,seq;"; $ref = $dbh_pl->selectall_arrayref($sql) or &mypage_err("CODE:MIL-01エラーが発生しました。"); foreach(@$ref) { ($seq,$id,$point,$name,$text)=@{$_}; if ($id ne ''){ $sql2 = "select name,text,category,weapon_category,ep,armer_n,armer_t,armer_b,armer_m,parts,possess,power,power_type,range,magic_flg,consumption from item_master where id = $id;"; $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:C-01エラーが発生しました。"); ($name,undef,$category,$weapon_category,$ep,$armer_n,$armer_t,$armer_b,$armer_m,$parts,$possess,$power,$power_type,$range,$magic_flg,$consumption)=@{$ref2->[0]}; # $text = &item_info($id,$name,$category,$weapon_category,$ep,$armer_n,$armer_t,$armer_b,$armer_m,$parts,$possess,$power,$power_type,$range,$magic_flg,$text,$consumption); } else{ } $text = &newline_change($text); $out{'list'} .=<<"EOT"; $name$point EOT } &disconDB($dbh_pl); &out_enc; &html_out("mypage_introduce_use_point01.html"); } #--------------------------------------- # 友達紹介キャンペーン用プレゼントの一覧表示 #--------------------------------------- sub introduce_use_point2 { if ($in{'seq'} eq ''){&mypage_err("プレゼントが選択されていません。");} $dbh_pl = &connectDB($plDB); $sql = "select sum(point) from introduce_point where uid = $uid;"; $ref = $dbh_pl->selectall_arrayref($sql) or &mypage_err("CODE:C-01エラーが発生しました。"); ($out{'i_pt'})=@{$ref->[0]}; if ($out{'i_pt'} eq ''){$out{'i_pt'} = 0;} $sql = "select id,point,name,text from introduce_campaign_item where game = 'GX' and seq = $in{'seq'};"; $ref = $dbh_pl->selectall_arrayref($sql) or &mypage_err("CODE:C-01エラーが発生しました。"); ($id,$point,$name,$text)=@{$ref->[0]}; if ($out{'i_pt'} < $point){&mypage_err("ポイントが不足している為、プレゼントを受け取れません。");} if ($point eq ''){&mypage_err("指定されたプレゼントは存在しません。");} $out{'ni_pt'} = $out{'i_pt'} - $point; $out{'seq'} = $in{'seq'}; &disconDB($dbh_pl); if ($id ne ''){ $sql2 = "select name,text,category,weapon_category,ep,armer_n,armer_t,armer_b,armer_m,parts,possess,power,power_type,range,magic_flg,consumption from item_master where id = $id;"; $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:C-01エラーが発生しました。"); ($name,undef,$category,$weapon_category,$ep,$armer_n,$armer_t,$armer_b,$armer_m,$parts,$possess,$power,$power_type,$range,$magic_flg,$consumption)=@{$ref2->[0]}; # $out{'text'} = &item_info($id,$name,$category,$weapon_category,$ep,$armer_n,$armer_t,$armer_b,$armer_m,$parts,$possess,$power,$power_type,$range,$magic_flg,$text,$consumption); } else{ } $out{'text'} = &newline_change($text); $out{'item_name'} = $name; &out_enc; &html_out("mypage_introduce_use_point02.html"); } #--------------------------------------- # 友達紹介キャンペーン用プレゼントの一覧表示 #--------------------------------------- sub introduce_use_point3 { if ($in{'seq'} eq ''){&mypage_err("プレゼントが選択されていません。");} $dbh_pl = &connectDB($plDB); $sql = "select sum(point) from introduce_point where uid = $uid;"; $ref = $dbh_pl->selectall_arrayref($sql) or &mypage_err("CODE:C-01エラーが発生しました。"); ($out{'i_pt'})=@{$ref->[0]}; if ($out{'i_pt'} eq ''){$out{'i_pt'} = 0;} $sql = "select id,point,name,text from introduce_campaign_item where game = 'GX' and seq = $in{'seq'};"; $ref = $dbh_pl->selectall_arrayref($sql) or &mypage_err("CODE:C-01エラーが発生しました。"); ($id,$point,$name,$text)=@{$ref->[0]}; if ($out{'i_pt'} < $point){&mypage_err("ポイントが不足している為、プレゼントを受け取れません。");} if ($point eq ''){&mypage_err("指定されたプレゼントは存在しません。");} $out{'ni_pt'} = $out{'i_pt'} - $point; $out{'seq'} = $in{'seq'}; if ($id ne ''){ $sql2 = "select name,text,category,weapon_category,ep,armer_n,armer_t,armer_b,armer_m,parts,possess,power,power_type,range,magic_flg,consumption from item_master where id = $id;"; $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:C-01エラーが発生しました。"); ($name,undef,$category,$weapon_category,$ep,$armer_n,$armer_t,$armer_b,$armer_m,$parts,$possess,$power,$power_type,$range,$magic_flg,$consumption)=@{$ref2->[0]}; } #アイテム付与 if ($id ne ''){ &item_issue($id,$pcid,0); $out{'body'} =<<"EOT"; 友達紹介キャンペーンプレゼントの受取申請を行いました。 反映まで少々お待ちください。 EOT } else{ $sql = "select name from character where pcid = '$pcid';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:C-03エラーが発生しました。"); ($pcname)=@{$ref->[0]}; $mbody =<<"EOT"; $pcname($pcid) $in{'seq'} $name $text EOT &sendmail('gx@rexi.jp','gx@rexi.jp','【GX】友達紹介キャンペーン用プレゼント受取',$mbody); } #ポイント減算 $d_point = $point * -1; $sql = "insert into introduce_point (uid,pcid,contents,details,point) values ($uid,'$pcid','プレゼント受取','SEQ:$in{'seq'},$name',$d_point)"; $dbh_pl->do($sql) or &mypage_err("CODE:FS-03エラーが発生しました。"); &disconDB($dbh_pl); if ($id ne ''){ print "Location: ./mypage_item.cgi\n\n"; } else{ &out_enc; &html_out("mypage_introduce_use_point03.html"); } } #--------------------------------------- # 紹介プレゼントを受取る #--------------------------------------- sub introduce_receive { $dbh_pl = &connectDB($plDB); $sql = "select count(*) from introduce_point where introduce_uid = $uid and contents = 'ユーザー登録' and flg = 0;"; $ref = $dbh_pl->selectall_arrayref($sql) or &mypage_err("CODE:C-01エラーが発生しました。"); ($i_tmp)=@{$ref->[0]}; if ($i_tmp eq '' || $i_tmp eq 0){&mypage_err("紹介プレゼントを受け取る権利を持っていません。");} &disconDB($dbh_pl); &out_enc; &html_out("mypage_introduce_receive01.html"); } #--------------------------------------- # 紹介プレゼントを受取る #--------------------------------------- sub introduce_receive2 { $dbh_pl = &connectDB($plDB); $sql = "select count(*) from introduce_point where introduce_uid = $uid and contents = 'ユーザー登録' and flg = 0;"; $ref = $dbh_pl->selectall_arrayref($sql) or &mypage_err("CODE:C-01エラーが発生しました。"); ($i_tmp)=@{$ref->[0]}; if ($i_tmp eq '' || $i_tmp eq 0){&mypage_err("紹介プレゼントを受け取る権利を持っていません。");} $sql = "update introduce_point set flg = 1 where introduce_uid = $uid and contents = 'ユーザー登録' and flg = 0;"; $dbh_pl->do($sql) or &mypage_err("CODE:FS-03エラーが発生しました。"); &disconDB($dbh_pl); &item_issue(3460,$pcid,0); print "Location: ./mypage_item.cgi\n\n"; } #--------------------------------------- # 紹介する #--------------------------------------- sub introduce { if ($uid eq ''){&mypage_err("ログインしなければ、この機能をご利用できません。");} $sql = "select count(*) from character where uid = '$uid' and state = 0 and admission = 1 and fame >= 50;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:FS-01エラーが発生しました。"); ($cnt)=@{$ref->[0]}; if ($cnt eq '' || $cnt eq 0){&mypage_err("名声値が50以上のキャラクターがいない場合、友達紹介を行えません。");} &out_enc; &html_out("mypage_introduce01.html"); } #--------------------------------------- # 紹介する #--------------------------------------- sub introduce_conf { if ($uid eq ''){&mypage_err("ログインしなければ、この機能をご利用できません。");} $sql = "select count(*) from character where uid = '$uid' and state = 0 and admission = 1 and fame >= 50;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:FS-01エラーが発生しました。"); ($cnt)=@{$ref->[0]}; if ($cnt eq '' || $cnt eq 0){&mypage_err("名声値が50以上のキャラクターがいない場合、友達紹介を行えません。");} if ($in{'fname'} eq ''){&mypage_err("「友達の名前」が入力されていません。");} if (length($in{'fname'}) > 20){&err("「友達の名前」は全角10文字までです。");} if ($in{'fmail'} eq ''){&mypage_err("「友達のメールアドレス」が入力されていません。");} if (&isMailAddress($in{'fmail'}) ne 1){&mypage_err("入力された「友達のメールアドレス」はメールアドレスではありません。");} if ($in{'hn'} eq ''){&mypage_err("「紹介者のハンドル」が入力されていません。");} if (length($in{'hn'}) > 20){&mypage_err("「紹介者のハンドル」は全角10文字までです。");} if ($in{'comment'} eq ''){&mypage_err("「紹介コメント」が入力されていません。");} $tmp = &newline_remove($in{'comment'}); if (length($tmp) > 600){&mypage_err("「紹介コメント」は全角300文字までです。");} $out{'comment2'} = &newline_change($in{'comment'}); $dbh_pl = &connectDB($plDB); $sql = "select count(*) from introduce where introduce_mail = '$in{'fmail'}';"; $ref = $dbh_pl->selectall_arrayref($sql) or &mypage_err("CODE:FS-01エラーが発生しました。"); ($tmp2)=@{$ref->[0]}; if ($tmp2 ne '' && $tmp2 > 0){&mypage_err("入力された「友達のメールアドレス」は既に紹介されています。");} &disconDB($dbh_pl); $out{'footer'} = $mailfooter; $out{'footer'} =~ s/\n//g; &out_enc; &html_out("mypage_introduce02.html"); } #--------------------------------------- # 紹介する #--------------------------------------- sub introduce_send { &in_enc; if ($uid eq ''){&mypage_err("ログインしなければ、この機能をご利用できません。");} $sql = "select count(*) from character where uid = '$uid' and state = 0 and admission = 1 and fame >= 50;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:FS-01エラーが発生しました。"); ($cnt)=@{$ref->[0]}; if ($cnt eq '' || $cnt eq 0){&mypage_err("名声値が50以上のキャラクターがいない場合、友達紹介を行えません。");} $dbh_pl = &connectDB($plDB); $sql = "select count(*) from introduce where introduce_mail = '$in{'fmail'}';"; $ref = $dbh_pl->selectall_arrayref($sql) or &mypage_err("CODE:FS-01エラーが発生しました。"); ($tmp2)=@{$ref->[0]}; if ($tmp2 ne '' && $tmp2 > 0){&err("入力された「友達のメールアドレス」は既に紹介されています。");} while (1){ $key = &CreateRandomPasswd; $sql = "select seq from introduce where seed = '$key';"; $ref = $dbh_pl->selectall_arrayref($sql) or &mypage_err("CODE:FS-02エラーが発生しました。"); ($seq)=@{$ref->[0]}; if ($seq eq ''){last;} } $sql = "insert into introduce (send_uid,send_hn,introduce_mail,introduce_hn,send_body,seed) values ($uid,'$in{'hn'}','$in{'fmail'}','$in{'fname'}','$in{'comment'}','$key');"; $dbh_pl->do($sql) or &mypage_err("CODE:FS-03エラーが発生しました。"); $mail_body =<<"EOT"; ◆◆◆ 神代七代 学園X 友達紹介キャンペーン ◆◆◆ $in{'fname'} 様 本メールは、REXiが運営するPBW(プレイ・バイ・ウェブ)、SINN(シン)、および、神代七代学園Xのお友達紹介キャンペーンを利用して、「$in{'hn'}」様から送信されたものです。 友達紹介キャンペーンを利用して、ゲームに登録すると、もれなく、キャンペーン限定マジックアイテムがもらえます。 両ゲームとも、登録・基本料は、すべて無料となっております。 是非この機会にご登録ください。 ∇紹介者「$in{'hn'}様」からのコメント $in{'comment'} ∇ゲームの確認、および、登録 ※下記のURLは、$in{'fname'}様専用URLとなっております。こちらをクリックした登録に限り、キャンペーンの対象となりますのでご注意ください。 なお、クリックしてから3日間のみ有効となっておりますので、ご注意ください。 http://rexi.jp/introduce/?key=$key $mailfooter EOT #∇紹介コード #$key &disconDB($dbh_pl); &sendmail($in{'fmail'},'gx@rexi.jp','【学園X】お友達からの紹介',$mail_body); print "Location: ./mypage_introduce_end.html\n\n"; } #--------------------------------------- # 紹介リスト #--------------------------------------- sub introduce_list { $dbh_pl = &connectDB($plDB); $sql = "select entry_date,introduce_hn,introduce_mail from introduce where send_uid = $uid order by seq;"; $ref = $dbh_pl->selectall_arrayref($sql) or &mypage_err("CODE:MIL-01エラーが発生しました。"); foreach(@$ref) { ($entry_date,$introduce_hn,$introduce_mail)=@{$_}; if ($entry_date eq ''){$ent = '登録待ち';} else{$ent = '登録';} $out{'list'} .=<<"EOT"; $ent$introduce_hn$introduce_mail EOT } &disconDB($dbh_pl); &out_enc; &html_out("mypage_int_list.html"); } #--------------------------------------- # マスターお気に入り登録 #--------------------------------------- sub vote_ms { # $sql = "select id,name from master where id not in ('sae','system','san','extra') and state = 0 and (type != 'CM' or type is null) order by id;"; $sql = "select id,name from master where id not in ('sae','system','san','extra','0188','0031') and state = 0 order by id;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:MH-02エラーが発生しました。"); foreach(@$ref) { ($ms_id,$ms_name)=@{$_}; $sql2 = "select msid from poll where pcid = '$pcid' and msid = '$ms_id';"; $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("エラーが発生しました。"); ($tmp)=@{$ref2->[0]}; if ($tmp eq ''){ $out{'list'} .=<<"EOT"; $ms_name EOT } } if ($out{'list'} eq ''){&mypage_err("選択できるマスターはありません。");} $sql = "select count(*) from poll where pcid = '$pcid';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:C-03エラーが発生しました。"); ($cnt)=@{$ref->[0]}; # if ($cnt ne '' && $cnt >= 3){ if ($cnt ne '' && $cnt >= 4){ $sql = "select a.msid,b.name from poll a,master b where a.pcid = '$pcid' and a.msid = b.id order by a.reg_date;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:MH-02エラーが発生しました。"); foreach(@$ref) { ($ms_id,$ms_name)=@{$_}; $list2 .=<<"EOT"; $ms_name EOT } $out{'list2'} =<<"EOT"; 4人を超えるマスターを登録しようとしています。 下記から削除するマスターを選択してください。 $list2 EOT } &out_enc; &html_out('mypage_vo01.html'); } #--------------------------------------- # マスターお気に入り登録確認 #--------------------------------------- sub vote_ms_conf { if ($in{'msid'} eq ''){&mypage_err("マスターが選択されていません。");} $sql = "select name from master where id = '$in{'msid'}';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:C-01エラーが発生しました。"); ($out{'msname'})=@{$ref->[0]}; if ($out{'msname'} eq ''){&mypage_err("指定されたマスターは存在しません。");} $sql = "select oid from poll where pcid = '$pcid' and msid = '$in{'msid'}';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:C-02エラーが発生しました。"); ($tmp)=@{$ref->[0]}; if ($tmp ne ''){&mypage_err("指定されたマスターは既に登録されています。");} $out{'msid'} = $in{'msid'}; $sql = "select count(*) from poll where pcid = '$pcid';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:C-03エラーが発生しました。"); ($cnt)=@{$ref->[0]}; if ($cnt ne '' && $cnt >= 4){ if ($in{'dmsid'} eq ''){&mypage_err("解除するマスターが選択されていません。");} $sql = "select b.name from poll a,master b where a.pcid = '$pcid' and a.msid = '$in{'dmsid'}' and a.msid = b.id;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:C-04エラーが発生しました。"); ($del_msname)=@{$ref->[0]}; $out{'caut'} =<<"EOT"; ※登録マスターが上限に達している為、下記のマスターを登録解除します。 解除マスター:$del_msname EOT $out{'dmsid'} = $in{'dmsid'}; } &out_enc; &html_out('mypage_vo02.html'); } #--------------------------------------- # マスターお気に入り登録実行 #--------------------------------------- sub vote_ms_reg { if ($in{'msid'} eq ''){&mypage_err("マスターが選択されていません。");} $sql = "select name from master where id = '$in{'msid'}';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:F-01エラーが発生しました。"); ($out{'msname'})=@{$ref->[0]}; if ($out{'msname'} eq ''){&mypage_err("指定されたマスターは存在しません。");} $sql = "select oid from poll where pcid = '$pcid' and msid = '$in{'msid'}';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:F-02エラーが発生しました。"); ($tmp)=@{$ref->[0]}; if ($tmp ne ''){&mypage_err("指定されたマスターは既に登録されています。");} $sql = "select count(*) from poll where pcid = '$pcid';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:F-03エラーが発生しました。"); ($cnt)=@{$ref->[0]}; if ($cnt ne '' && $cnt >= 4){ if ($in{'dmsid'} eq ''){&mypage_err("解除するマスターが選択されていません。");} &log_write($pcid,'お気に入り登録解除',$in{'dmsid'}); $sql = "delete from poll where pcid = '$pcid' and msid = '$in{'dmsid'}';"; $dbh->do($sql) or &mypage_err("CODE:F-05エラーが発生しました。"); } &log_write($pcid,'お気に入り登録',$in{'msid'}); $sql = "insert into poll (pcid,msid) values ('$pcid','$in{'msid'}');"; $dbh->do($sql) or &mypage_err("CODE:F-06エラーが発生しました。"); &out_enc; &html_out('mypage_vo03.html'); } #--------------------------------------- # 自由設定申請 #--------------------------------------- sub free_setting_apply { if (&free_setting_waku_chk >= 3){&mypage_err("既に自由設定を3つ設定、または申請中の為、新たに申請できません。");} &out_enc; &html_out('mypage_se01.html'); } #--------------------------------------- # 自由設定申請確認 #--------------------------------------- sub free_setting_apply_conf { if (&free_setting_waku_chk >= 3){&mypage_err("既に自由設定を3つ設定、または申請中の為、新たに申請できません。");} $yuryo_flg = &free_setting_yuryo_chk; if ($yuryo_flg eq 0){ $rc = 0; $out{'rc'} = '無料'; } else{ $rc = 1; $rexc = &get_rex($pcid); if ($rexc < 500){&mypage_err("残高が不足しているため、申請できません。");} $out{'rc'} = '500 Rex'; } &in_enc; $title = $in{'title'}; if ($title eq ''){&mypage_err("タイトルが入力されていません。");} $tmp = ''; $tmp = &hnkaku_chk($title); if ($tmp ne ''){&mypage_err("本文に使用できない文字「$tmp」が入力されています。");} $len = length ($title); if ($in{'type'} eq 1 && $len > 24){&mypage_err("タイトルの文字数が12文字を超えています。");} $naiyou = $in{'naiyou'}; if ($naiyou eq ''){&mypage_err("本文が入力されていません。");} $tmp = ''; $tmp = &hnkaku_chk($naiyou); if ($tmp ne ''){&mypage_err("本文に使用できない文字「$tmp」が入力されています。");} if ($naiyou =~ /\x8E/) {&mypage_err("本文に半角カナ文字が含まれています。");} $naiyou2 = &newline_remove($in{'naiyou'}); # $naiyou2 =~ s/\n//g; $len = length ($naiyou2); if ($len > 100){&mypage_err("本文の文字数が50文字を超えています。");} $naiyou =~ s/\n//g; $out{'naiyou2'} = $naiyou; # $sql = "select count(*) from free_set where pcid = '$pcid';"; # $ref = $dbh->selectall_arrayref($sql) or &mypage_err("エラーが発生しました。"); # ($cnt)=@{$ref->[0]}; # if ($cnt eq ''){$cnt = 0;} # if ($cnt < 3){$out{'rc'} = '無料';} # else{$out{'rc'} = '500 Rex';} &out_enc; &html_out('mypage_se02.html'); } #--------------------------------------- # 自由設定申請 #--------------------------------------- sub free_setting_apply_set { &in_enc; $cnt = &free_setting_waku_chk; if ($cnt >= 3){&mypage_err("既に自由設定を3つ設定、または申請中の為、新たに申請できません。");} $yuryo_flg = &free_setting_yuryo_chk; if ($yuryo_flg eq 0){$rc = 0;} else{ $rc = 1; $rexc = &get_rex($pcid); if ($rexc < 500){&mypage_err("残高が不足しているため、申請できません。");} } $sql = "insert into free_set (pcid,apply_title,apply_txt,free_flg) values ('$pcid','$in{'title'}','$in{'naiyou'}',$rc);"; $dbh->do($sql) or &mypage_err("エラーが発生しました。"); my $content = $sql; &log_write($pcid,'自由設定申請',$content); if ($rc eq 1){ $er = &use_rex($pcid,undef,-500,'自由設定申請'); if ($er ne 0){ &sendmail('log@rexi.jp','gx@rexi.jp','自由設定申請エラー',$er,$sql); } } &out_enc; &html_out('mypage_se03.html'); } #--------------------------------------- # 自由設定枠チェック #--------------------------------------- sub free_setting_waku_chk { $sql = "select count(*) from free_set where pcid = '$pcid' and result != 2;"; # $sql = "select count(*) from free_set where pcid = '$pcid' and free_flg = 0;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("エラーが発生しました。"); ($cnt)=@{$ref->[0]}; if ($cnt eq ''){$cnt = 0;} return $cnt; } #--------------------------------------- # 自由設定有料チェック #--------------------------------------- sub free_setting_yuryo_chk { $sql = "select count(*) from free_set where pcid = '$pcid' and free_flg = 0;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("エラーが発生しました。"); ($cnt)=@{$ref->[0]}; if ($cnt eq ''){$cnt = 0;} if ($cnt < 3){$rtn = 0;} else{$rtn = 1;} return $rtn; } #--------------------------------------- # 自由設定変更リスト #--------------------------------------- sub free_setting_list { $sql = "select seq,title from free_set where pcid = '$pcid' and title is not null and result = 1 order by seq;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:MH-02エラーが発生しました。"); foreach(@$ref) { ($seq,$title)=@{$_}; $out{'list'} .=<<"EOT"; $title EOT } if ($out{'list'} eq ''){&mypage_err("変更可能な自由設定はありません。");} &out_enc; &html_out('mypage_se04.html'); } #--------------------------------------- # 自由設定変更リスト #--------------------------------------- sub free_setting_change_conf { $sql = "select title,txt from free_set where pcid = '$pcid' and title is not null and result = 1 and seq = $in{'seq'};"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:MH-01エラーが発生しました。"); ($out{'title'},$out{'text'})=@{$ref->[0]}; if ($out{'title'} eq ''){&mypage_err("指定された自由設定は現在申請中か、指定が誤っています。");} &out_enc; &html_out('mypage_se05.html'); } #--------------------------------------- # 自由設定変更リスト #--------------------------------------- sub free_setting_change_conf2 { $sql = "select title,txt from free_set where pcid = '$pcid' and title is not null and result = 1 and seq = $in{'seq'};"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:MH-01エラーが発生しました。"); ($tmp,undef)=@{$ref->[0]}; if ($tmp eq ''){&mypage_err("指定された自由設定は現在申請中か、指定が誤っています。");} &in_enc; $title = $in{'title'}; if ($title eq ''){&mypage_err("タイトルが入力されていません。");} $tmp = ''; $tmp = &hnkaku_chk($title); if ($tmp ne ''){&mypage_err("本文に使用できない文字「$tmp」が入力されています。");} $len = length ($title); if ($in{'type'} eq 1 && $len > 24){&mypage_err("タイトルの文字数が12文字を超えています。");} $naiyou = $in{'naiyou'}; if ($naiyou eq ''){&mypage_err("本文が入力されていません。");} $tmp = ''; $tmp = &hnkaku_chk($naiyou); if ($tmp ne ''){&mypage_err("本文に使用できない文字「$tmp」が入力されています。");} if ($naiyou =~ /\x8E/) {&mypage_err("本文に半角カナ文字が含まれています。");} $naiyou2 = $naiyou; $naiyou2 =~ s/\n//g; $len = length ($naiyou2); if ($len > 100){&mypage_err("本文の文字数が50文字を超えています。");} $naiyou =~ s/\n//g; $out{'naiyou2'} = $naiyou; &out_enc; &html_out('mypage_se06.html'); } #--------------------------------------- # 自由設定変更リスト #--------------------------------------- sub free_setting_change_apply { &in_enc; $rexc = &get_rex($pcid); if ($rexc < 500){&mypage_err("残高が不足しているため、申請できません。");} $sql = "update free_set set apply_title = '$in{'title'}',apply_txt = '$in{'naiyou'}',result = 3,apply_date = now(),renew_num = renew_num + 1,free_flg = 1 where seq = $in{'seq'} and pcid = '$pcid';"; $dbh->do($sql) or &mypage_err("エラーが発生しました。$sql".$dbh->errstr); my $content = $sql; &log_write($pcid,'自由設定再申請',$content); $er = &use_rex($pcid,undef,-500,'自由設定再申請'); if ($er ne 0){ &sendmail('log@rexi.jp','gx@rexi.jp','自由設定再申請エラー',$er,$sql); } &out_enc; &html_out('mypage_se07.html'); } #--------------------------------------- # ヒストリー #--------------------------------------- sub history { require '/home/rexi-jp/public_html/gx/lib/scenario.pl'; if ($in{'pcid'} eq ''){$in{'pcid'} = $pcid;} if ($pcid ne $in{'pcid'}){$out{'ot'} = "_other";} &com_data($in{'mode'},$out{'pcid'},$flg_mode,$in{'type'}); %hash_date = (); %hash_head = (); %hash_title = (); %hash_msname = (); %hash_type = (); $ind = 0; #略歴データ $sql = "select birth,admission_date,reg_date,class,origin,lumina,race from character where pcid = '$in{'pcid'}';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:MH-01エラーが発生しました。"); ($birth,$admission_date,$reg_date,$class,$origin,$lumina,$race)=@{$ref->[0]}; if ($admission_date eq ''){$admission_date = $reg_date;} $admission_date = substr($admission_date,0,10); $admission_date =~ s/\-//g; $admission_date = int($admission_date); $admission_date -= 10000000; if ($admission_date < 10000000){$admission_date = '0' . $admission_date;} $hash_date{$ind} = $admission_date; $hash_head{$ind} = '入学'; if (substr($birth,1,2) eq 93){$ki = '一';} elsif (substr($birth,1,2) eq 94){$ki = '二';} elsif (substr($birth,1,2) eq 95){$ki = '三';} elsif (substr($birth,1,2) eq 96){$ki = '四';} elsif (substr($birth,1,2) eq 97){$ki = '五';} elsif (substr($birth,1,2) eq 98){$ki = '六';} elsif (substr($birth,1,2) eq 99){$ki = '七';} $kisei = '第' . $ki . '期生'; $hash_title{$ind} = "ローレック入学。$kisei @class_str[$class]"; $hash_msname{$ind} = ''; $birth = substr($birth,1,2) . '/' . substr($birth,3,2) . '/' . substr($birth,5); # $hash_head{$birth} = '誕生'; # $hash_title{$birth} = "@origin_str[$origin]として育ち、@lumina_str[$lumina]のルミナの才能を秘める。"; $aday = substr($admission_date,2,2) . '/' . substr($admission_date,4,2) . '/' . substr($admission_date,6,2); if(substr($aday,0,5) eq '12/03'){ if(substr($aday,-2) >= '12'){ $aday = '12/04/01'; } } if($race ne 6){ $out{'r_list'} =<<"EOT"; $aday$hash_head{$ind}$hash_title{$ind} $birth誕生@origin_str[$origin]として育ち、@lumina_str[$lumina]のルミナの才能を秘める。 EOT }else{ $out{'r_list'} =<<"EOT"; $aday$hash_head{$ind}$hash_title{$ind} ?/?/?誕生@origin_str[$origin]として育ち、@lumina_str[$lumina]のルミナの才能を秘める。 EOT } $ind++; #シナリオ参加データ $sql = "select b.playing_close + '-1 days',b.title,b.type,c.name,b.category,b.apply_state,b.replay_open_date,b.seq,b.scenario_reflection from scenario_member a,scenario b,master c where a.pcid = '$in{'pcid'}' and a.entry_state = 1 and a.scenario_seq = b.seq and b.title is not null and b.playing_close < now() and b.state = 0 and b.msid = c.id order by b.playing_close desc;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:MH-02エラーが発生しました。"); foreach(@$ref) { ($playing_close,$title,$type,$name,$category,$apply_state,$replay_open_date,$seq,$scenario_reflection)=@{$_}; $playing_close = '10' . substr($playing_close,2,8); $playing_close =~ s/\-//g; $hash_date{$ind} = $playing_close; $hash_head{$ind} = @sc_category_str2[$category]; $hash_title{$ind} = $title; if ($apply_state eq 5 && $replay_open_date ne ''){$hash_title{$ind} = '' . $title . '';} # if ($uid eq 2 || $uid eq 241){ if ($scenario_reflection eq 1 && (($in{'pcid'} eq '' && $pcid ne '') || $in{'pcid'} eq $pcid)){$hash_title{$ind} .= " [結果]";} # } $hash_msname{$ind} = $name; $ind++; } #プラリプ $sql = "select seq,rep_date,title,set_flg from pri_replay where pcid = '$in{'pcid'}' and state = 0 and rep_date is not null order by rep_date desc,seq;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:MH-02エラーが発生しました。"); foreach(@$ref) { ($seq,$rep_date,$title,$set_flg)=@{$_}; $rep_date = substr($rep_date,0,10); $rep_date =~ s/\-//g; $rep_date = int($rep_date); if ($rep_date < 10000000){$rep_date = '0' . $rep_date;} $radiobtn = ''; if ($pcid eq $in{'pcid'}){ if ($set_flg eq 1){$chk = 'checked';} else{$chk = '';} $radiobtn =<<"EOT"; EOT } $hday = substr($rep_date,2,2) . '/' . substr($rep_date,4,2) . '/' . substr($rep_date,6,2); $pri_list .=<<"EOT"; $hdayプラリプ$title$radiobtn EOT $hash_date{$ind} = $rep_date; $hash_head{$ind} = 'プラリプ'; $hash_title{$ind} = '' . $title . ''; $hash_msname{$ind} = ''; $ind++; } if ($pri_list ne ''){ if ($pcid eq $in{'pcid'}){ $out{'pri_list'} =<<"EOT"; EOT } $out{'pri_list'} .=<<"EOT"; ●公認プライベートリプレイ $pri_list EOT if ($pcid eq $in{'pcid'}){ $out{'pri_list'} .=<<"EOT"; EOT } $out{'pri_list'} .=<<"EOT"; EOT } foreach my $hkey (sort { $hash_date{$b} <=> $hash_date{$a} } keys %hash_date){ $hname = $hash_date{$hkey}; $hname = substr($hname,2,2) . '/' . substr($hname,4,2) . '/' . substr($hname,6,2); $hdbg .= $hkey . ':' . $hash_date{$hkey} . ':' . $hname . ''; if($hash_head{$hkey}eq "入学"){ if(substr($hname,0,5) eq '12/03'){ if(substr($hname,-2) >= '12'){ $hname = '12/04/01'; } } } $out{'a_list'} .=<<"EOT"; $hname$hash_head{$hkey}$hash_title{$hkey}$hash_msname{$hkey} EOT } #&mypage_err($hdbg); # foreach my $hname ( sort { $b <=> $a } keys %hash_head ){ # if (substr($hname,0,1) eq 9 && $hash_head{$hname} ne '誕生'){ # $idx = $hname; # $hname =~ s/\///g; # $hname = substr($hname,0,2) . '/' . substr($hname,2,2) . '/' . substr($hname,4,2); # $out{'a_list'} .=<<"EOT"; #$hname$hash_head{$idx}$hash_title{$idx} #EOT # $dbg2 .= "$hname,$hash_head{$idx},$hash_title{$idx},$hash_msname{$idx}"; # } # } $hash_head{$birth} = '誕生'; $hash_title{$birth} = "@origin_str[$origin]として育ち、@lumina_str[$lumina]のルミナの才能を秘める。"; if($race ne 6){ $out{'a_list'} .=<<"EOT"; $birth$hash_head{$birth}$hash_title{$birth} EOT }else{ $out{'a_list'} .=<<"EOT"; ?/?/?$hash_head{$birth}$hash_title{$birth} EOT } &html_out('mypage_history.html'); } #--------------------------------------- # 肖像画 #--------------------------------------- sub portrait { if ($in{'pcid'} eq ''){$in{'pcid'} = $pcid;} if ($pcid ne $in{'pcid'}){$out{'ot'} = "_other";} if (substr($pcid,0,2) eq 'xz'){$out{'ot'} = "_npc";} &com_data($in{'mode'},$out{'pcid'},$flg_mode,$in{'type'}); ## $sql = "select pdname,crname,file_name,url,substr(reg_date,1,10),comment,oid,pcid,plural_pcid from stars_data where (pcid = '$in{'pcid'}' or plural_pcid like '%$in{'pcid'}%') and state = 0 and substr(pdid,1,1) != 'V' order by reg_date desc;"; $sql = "select pdname,crname,file_name,url,substr(reg_date,1,10),comment,oid,pcid,plural_pcid from stars_data where (pcid = '$in{'pcid'}' or plural_pcid like '%$in{'pcid'}%') and state = 0 order by reg_date desc;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("エラーが発生しました。"); $out{'list'} =<<"EOT"; EOT $i = 1; foreach(@$ref) { ($pdname,$crname,$file_name,$url,$reg_date,$comment,$oid,$order_pcid,$plural_pcid)=@{$_}; @a = (); @a = split(/\,/,$plural_pcid); $plural_flg = 0; foreach(@a){ if ($_ eq $pcid){ $plural_flg = 1; last; } } $stars_file = "/home/rexi-jp/public_html/stars/data/gx/$file_name"; $stars_file_url = "http://rexi.jp/stars/data/gx/$file_name"; $stars_th_file = "/home/rexi-jp/public_html/stars/data/gx_thumbnail/$file_name"; $stars_th_file_url = "http://rexi.jp/stars/data/gx_thumbnail/$file_name"; if (!-e $stars_file){ $stars_file = "/home/rexi-jp/public_html/" . substr($url,15); $stars_file_url = "http://rexi.jp/" . substr($url,15); } ($format,$width,$height) = &GetImageSize($stars_file); if ($width < 100 && $height < 100){ $th_file = $stars_file_url; $w = $width; $h = $height; } else{ if (-e $stars_th_file){ $th_file = $stars_th_file_url; ($format,$twidth,$theight) = &GetImageSize($stars_th_file); $w = $twidth; $h = $theight; } else{ $th_file = $stars_file_url; if ($width > $height){ $w = 100; $h = $height * (100 / $width); } else{ $h = 100; $w = $width * (100 / $height); } } } my ($ex) = ($th_file =~ m|(\.[^./\\]+)$|); $comment =~ s/\n//g; if ($i eq 0){ $out{'list'} .=<<"EOT"; EOT } if ($comment ne ''){ if(($ex eq '.MP3') or ($ex eq '.mp3') or ($ex eq '.Mp3')){ }else{ $pdname = "" . $comment . ""; } } $cmbtn = ''; $fvcbox = ''; if ($pcid eq $in{'pcid'} && substr($pcid,0,2) ne 'xz' && $pcid eq $order_pcid){ if(($ex eq '.MP3') or ($ex eq '.mp3') or ($ex eq '.Mp3')){ }else{ $cmbtn =<<"EOT"; [コメント編集] EOT } } if ($pcid eq $in{'pcid'} && substr($pcid,0,2) ne 'xz' && $pcid eq $order_pcid){ # if ($pcid eq $in{'pcid'} && substr($pcid,0,2) ne 'xz' && ($pcid eq $order_pcid || $plural_flg eq 1)){ $cmbtn .= ''; $fvcbox =<<"EOT"; EOT } $out{'list'} .=<<"EOT"; $fvcbox EOT if(($ex eq '.MP3') or ($ex eq '.mp3') or ($ex eq '.Mp3')){ $out{'list'} .=<<"EOT"; EOT }else{ $out{'list'} .=<<"EOT"; EOT } $out{'list'} .=<<"EOT"; $crname $reg_date $pdname $cmbtn EOT if ($i eq 4){ $out{'list'} .=<<"EOT"; EOT $i = 0; } $i++; } $out{'list'} .=<<"EOT"; EOT if ($pcid eq $in{'pcid'}){ $out{'fvbtn'} =<<"EOT"; EOT } &out_enc; if (substr($in{'pcid'},0,2) eq 'xz'){$html_file = 'mypage_portrait_npc.html';} else{$html_file = 'mypage_portrait.html';} &html_out($html_file); } #--------------------------------------- # 肖像画詳細 #--------------------------------------- sub portrait_detailed { $sql = "select pdname,crname,substr(reg_date,1,10),plural_pcid,url,pcid from stars_data where file_name = '$in{'file'}' and (pcid = '$in{'pcid'}' or plural_pcid like '%$in{'pcid'}%') order by reg_date;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("エラーが発生しました。"); ($out{'pdname'},$out{'crname'},$out{'reg_date'},$plural_pcid,$url,$order_pcid)=@{$ref->[0]}; if ($out{'pdname'} eq ''){&mypage_err("対象のデータは存在しません。");} $stars_file = "/home/rexi-jp/public_html/stars/data/gx/$in{'file'}"; ($format,$width,$height) = &GetImageSize($stars_file); if (-e $stars_file){ $out{'img'} = "http://rexi.jp/stars/data/gx/$in{'file'}"; } else{ $out{'img'} = "http://rexi.jp/" . substr($url,15); $stars_file = "/home/rexi-jp/public_html/" . substr($url,15); } if ($width > 640){ $sfile = "/home/rexi-jp/public_html/gx/mypage/large_thum/$in{'file'}"; if (!-e $sfile){ system "convert -resize 640 +profile iptc -quality 100% $stars_file $sfile"; } $h = $height + 100; $w = $width + 100; $out{'a1'} = ""; $out{'a2'} = ""; $out{'img'} = "./large_thum/$in{'file'}"; } $out{'reg_date'} =~ s/\-/\//g; if ($plural_pcid ne ''){ @mem_pcid = split(/\,/,$plural_pcid); @mem_pcid = sort @mem_pcid; foreach (@mem_pcid){ $mpcid = $_; $sql = "select name from character where pcid = '$mpcid';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("エラーが発生しました。"); ($m_name)=@{$ref->[0]}; $mem .= "$m_name($mpcid)"; } } if ($order_pcid ne $in{'pcid'}){ $sql = "select name from character where pcid = '$order_pcid';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("エラーが発生しました。"); ($order_name)=@{$ref->[0]}; $out{'member'} = <<"EOT"; 発注キャラクター: $order_name($order_pcid) EOT } if ($mem ne ''){ $out{'member'} .= <<"EOT"; 参加キャラクター: $mem EOT } &out_enc; &html_out('mypage_portrait_detailed.html'); } #--------------------------------------- # 肖像画最大化 #--------------------------------------- sub portrait_maximize { $stars_file = "/home/rexi-jp/public_html/stars/data/gx/$in{'file'}"; ($format,$out{'width'},$out{'height'}) = &GetImageSize($stars_file); $out{'img'} = "http://rexi.jp/stars/data/gx/$in{'file'}"; &html_out('mypage_portrait_detailed2.html'); } #--------------------------------------- # 肖像画コメント入力 #--------------------------------------- sub portrait_comment_input { $sql = "select pdname,crname,comment,substr(reg_date,1,10),url from stars_data where file_name = '$in{'file'}' and pcid = '$pcid';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("エラーが発生しました。"); ($out{'pdname'},$out{'crname'},$out{'comment'},$out{'reg_date'},$url)=@{$ref->[0]}; if ($out{'pdname'} eq ''){&mypage_err("指定されたイラストは、現在ログインしているキャラクターの所有ではありません。");} $stars_file = "/home/rexi-jp/public_html/stars/data/gx/$in{'file'}"; if (-e $stars_file){ $out{'img'} = "http://rexi.jp/stars/data/gx/$in{'file'}"; } else{ $out{'img'} = "http://rexi.jp/" . substr($url,15); } $out{'reg_date'} =~ s/\-/\//g; $out{'file'} = $in{'file'}; &out_enc; &html_out('mypage_portrait_comment.html'); } #--------------------------------------- # 肖像画コメント設定 #--------------------------------------- sub portrait_comment_set { &in_enc; $len = length ($in{'comment'}); if ($len > 100){&mypage_err("コメントは全角50字までです。");} $in{'comment'} =~ s/\'/\\'/g; $sql = "update stars_data set comment = "; if ($in{'comment'} eq ''){$sql .= "NULL";} else{$sql .= "'$in{'comment'}'";} $sql .= " where pcid = '$pcid' and file_name = '$in{'file'}';"; $dbh->do($sql) or &mypage_err("エラーが発生しました。4"); print "Location: ./mypage.cgi?pcid=$pcid&mode=portrait\n\n"; } #--------------------------------------- # 肖像画お気に入り設定 #--------------------------------------- sub portrait_fav_set { $i = 0; $icnt = 0; $vcnt = 0; @fvp = (); foreach $key ( keys( %in ) ) { if (substr($key,0,3) eq 'fv_' && $in{$key} eq 1){ push fvp,substr($key,3); $t_oid .= substr($key,3) . ","; $i++; $ww = substr($key,3); ## $sql = "select substr(pdid,1,1) from stars_data where oid = substr($key,3);"; $sql = "select substr(pdid,1,1) from stars_data where file_name = '$ww';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("エラーが発生しました。$sql"); ($tmp)=@{$ref->[0]}; if ($tmp eq 'V'){$vcnt++;} else{$icnt++;} } } # $icnt = 0; # $vcnt = 0; # if ($t_oid ne ''){ # chop $t_oid; # $sql = "select count(*) from stars_data where oid in ($t_oid) and substr(pdid,1,1) != 'V';"; # $ref = $dbh->selectall_arrayref($sql) or &mypage_err("エラーが発生しました。"); # ($icnt)=@{$ref->[0]}; # $sql = "select count(*) from stars_data where oid in ($t_oid) and substr(pdid,1,1) = 'V';"; # $ref = $dbh->selectall_arrayref($sql) or &mypage_err("エラーが発生しました。"); # ($vcnt)=@{$ref->[0]}; # } # if ($i > 4){&mypage_err("お気に入り設定できるのは4つまでです。");} if ($icnt > 4){&mypage_err("お気に入り設定できるイラストは4つまでです。");} if ($vcnt > 4){&mypage_err("お気に入り設定できるセリフは4つまでです。");} $sql = "update stars_data set fav = 0 where pcid = '$pcid';"; $dbh->do($sql) or &mypage_err("エラーが発生しました。"); foreach (@fvp){ $sql = "update stars_data set fav = 1 where oid = $_;"; $dbh->do($sql) or &mypage_err("エラーが発生しました。"); } print "Location: ./mypage.cgi?pcid=$pcid\n\n"; } #--------------------------------------- # 透過全身図選択 #--------------------------------------- sub portrait_change { &com_data($in{'mode'},$out{'pcid'},$flg_mode,$in{'type'}); $sql = "select file_name,url,crname,pdid from stars_data where pcid = '$pcid' and pdid in ('G01','C10','G04') order by reg_date desc;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("エラーが発生しました。"); $i = 1; foreach(@$ref) { ($file_name,$url,$crname,$pdid)=@{$_}; if ($zensin eq $url){$chk = 'checked';} else{$chk = '';} $stars_th_file = "/home/rexi-jp/public_html/stars/data/gx_thumbnail/$file_name"; if (-e $stars_th_file){ $stars_th_file_url = "http://rexi.jp/stars/data/gx_thumbnail/$file_name"; } else{ $stars_th_file_url = "http://rexi.jp/" . substr($url,15); } if ($i eq 0){ $list .=<<"EOT"; EOT } ($format,$width,$height) = &GetImageSize('/home/rexi-jp/public_html/' . substr($stars_th_file_url,15)); $tmp = 100 / $height; $height = 100; $width = int($width * $tmp); $list .=<<"EOT"; $crname EOT if ($i eq 6){ $list .=<<"EOT"; EOT $i = 0; } $i++; } # if ($list eq ''){&mypage_err("選択できる透過全身図がありません。");} $out{'list'} =<<"EOT"; $list 未設定 EOT $c = 0; #コンテンツごとの全身図表示設定 foreach(@zensin_set_str){ $z_name = $_; $z_id = @zensin_set_id[$c]; $c_zensin = &zensin_ctl_rtn($z_id); if ($c_zensin eq ''){$c_zensin = $zensin;} $list = ''; $sql = "select file_name,url,crname,pdid from stars_data where pcid = '$pcid' and pdid in ('G01','C14','C10','G04') order by reg_date desc;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("エラーが発生しました。"); $i = 1; foreach(@$ref) { ($file_name,$url,$crname,$pdid)=@{$_}; if ($c_zensin eq $url){$chk = 'checked';} else{$chk = '';} $stars_th_file = "/home/rexi-jp/public_html/stars/data/gx_thumbnail/$file_name"; if (-e $stars_th_file){ $stars_th_file_url = "http://rexi.jp/stars/data/gx_thumbnail/$file_name"; } else{ $stars_th_file_url = "http://rexi.jp/" . substr($url,15); } if ($i eq 0){ $list .=<<"EOT"; EOT } ($format,$width,$height) = &GetImageSize('/home/rexi-jp/public_html/' . substr($stars_th_file_url,15)); $tmp = 100 / $height; $height = 100; $width = int($width * $tmp); $list .=<<"EOT"; $crname EOT if ($i eq 6){ $list .=<<"EOT"; EOT $i = 0; } $i++; } $out{'list2'} .=<<"EOT"; ◆$z_nameでの表示設定 $list 未設定 EOT $c++; } #部長 $sqlc = "select seq,name from club where leader = '$pcid' and state = 0 order by seq;"; $refc = $dbh->selectall_arrayref($sqlc) or &mypage_err("エラーが発生しました。"); foreach(@$refc) { ($seq,$cname)=@{$_}; $list = ''; $c_zensin = &zensin_ctl_rtn('club_leader',$seq); if ($c_zensin eq ''){$c_zensin = $zensin;} $sql = "select file_name,url,crname from stars_data where pcid = '$pcid' and pdid in ('G01','C14','G04') order by reg_date desc;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("エラーが発生しました。"); $i = 1; foreach(@$ref) { ($file_name,$url,$crname)=@{$_}; if ($c_zensin eq $url){$chk = 'checked';} else{$chk = '';} $stars_th_file = "/home/rexi-jp/public_html/stars/data/gx_thumbnail/$file_name"; $stars_th_file_url = "http://rexi.jp/stars/data/gx_thumbnail/$file_name"; if ($i eq 0){ $list .=<<"EOT"; EOT } ($format,$width,$height) = &GetImageSize('/home/rexi-jp/public_html/' . substr($stars_th_file_url,15)); $tmp = $height / 100; $height = 100; $width = int($width * $tmp); $list .=<<"EOT"; $crname EOT if ($i eq 6){ $list .=<<"EOT"; EOT $i = 0; } $i++; } $out{'list2'} .=<<"EOT"; ◆部活「$cname」での表示設定 $list 未設定 EOT } &html_out('mypage_portrait_select01.html'); } #--------------------------------------- # 透過全身図選択 #--------------------------------------- sub portrait_set { # if ($in{'def'} eq ''){&mypage_err("透過全身図が選択されていません。");} if ($in{'def'} ne ''){ $sql = "select url from stars_data where pcid = '$pcid' and pdid in ('G01','C14','C10','G04') and file_name = '$in{'def'}';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("エラーが発生しました。"); ($url)=@{$ref->[0]}; if ($url eq ''){&mypage_err("選択された透過全身図は存在しないか、他のキャラクターのデータです。");} } $sql = "update character set zensin = "; if ($in{'def'} eq ''){$sql .= "NULL";} else{$sql .= "'$url'";} $sql .= " where pcid = '$pcid';"; $dbh->do($sql) or &mypage_err("エラーが発生しました。"); &set_pczen_cookie($url); print "Location: ./mypage.cgi?pcid=$pcid\n\n"; } #--------------------------------------- # 透過全身図選択2 #--------------------------------------- sub portrait_set2 { # if ($in{'def'} eq ''){&mypage_err("透過全身図が選択されていません。");} if ($in{'def'} ne ''){ $sql = "select url from stars_data where pcid = '$pcid' and pdid in ('G01','C14','C10','G04') and file_name = '$in{'def'}';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:PT2-01エラーが発生しました。"); ($url)=@{$ref->[0]}; if ($url eq ''){&mypage_err("選択された透過全身図は存在しないか、他のキャラクターのデータです。");} } $sql = "select reg_date from zensin_ctl where pcid = '$pcid' and type = '$in{'type'}' and club_seq = "; if ($in{'club_seq'} eq ''){$sql .= "0;";} else{$sql .= "$in{'club_seq'};";} $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:PT2-02エラーが発生しました。"); ($tmp)=@{$ref->[0]}; # if($uid eq 2){&mypage_err($tmp);} if ($tmp ne ''){ $sql = "update zensin_ctl set zensin = "; # if ($in{'def'} eq ''){$sql .= "NULL";} if ($in{'def'} eq ''){$sql .= "'http://rexi.jp/gx/images/00_click.gif'";} else{$sql .= "'$url'";} $sql .= " where pcid = '$pcid' and type = '$in{'type'}'"; if ($in{'club_seq'} ne ''){$sql .= " and club_seq = $in{'club_seq'}";} else{$sql .= " and club_seq = 0";} $sql .= ";"; } else{ $sql = "insert into zensin_ctl (pcid,type,zensin,club_seq) values ('$pcid','$in{'type'}',"; if ($in{'def'} eq ''){$sql .= "'http://rexi.jp/gx/images/00_click.gif'";} else{$sql .= "'$url'";} if ($in{'club_seq'} eq ''){$sql .= ",0";} else{$sql .= ",$in{'club_seq'}";} $sql .= ");"; } $dbh->do($sql) or &mypage_err("CODE:PT2-03エラーが発生しました。"); print "Location: ./mypage.cgi?pcid=$pcid\n\n"; } #--------------------------------------- # 表示アイコン選択 #--------------------------------------- sub icon_show_select { &com_data($in{'mode'},$out{'pcid'},$flg_mode,$in{'type'}); $d_icon = &def_icon($class); $sql = "select file_name,url,crname from stars_data where pcid = '$pcid' and pdid in ('C02','C08') order by reg_date desc;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("エラーが発生しました。"); $i = 0; foreach(@$ref) { ($file_name,$url,$crname)=@{$_}; if ($out{'icon'} eq $url){$chk = 'checked';} else{$chk = '';} $stars_th_file = "/home/rexi-jp/public_html/data/gx/$file_name"; $stars_th_file_url = "http://rexi.jp/stars/data/gx/$file_name"; if ($i eq 0){ $list .=<<"EOT"; EOT } $list .=<<"EOT"; $crname EOT $i++; if ($i eq 6){ $list .=<<"EOT"; EOT $i = 0; } } if ($list eq ''){&mypage_err("選択できるアイコンがありません。");} $out{'list'} =<<"EOT"; $list EOT &html_out('mypage_icon_select01.html'); } #--------------------------------------- # 一覧表示アイコン選択 #--------------------------------------- sub icon_select { &com_data($in{'mode'},$out{'pcid'},$flg_mode,$in{'type'}); $d_icon = &def_icon($class); $sql = "select file_name,url,crname,icon_hidden from stars_data where pcid = '$pcid' and pdid in ('C02','C08') order by reg_date desc;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("エラーが発生しました。"); $i = 0; foreach(@$ref) { ($file_name,$url,$crname,$icon_hidden)=@{$_}; if ($icon_hidden eq 0){$chk = 'checked';} else{$chk = '';} $stars_th_file = "/home/rexi-jp/public_html/stars/data/gx/$file_name"; $stars_th_file_url = "$url"; if ($i eq 0){ $list .=<<"EOT"; EOT } $list .=<<"EOT"; $crname EOT $i++; if ($i eq 6){ $list .=<<"EOT"; EOT $i = 0; } } if ($list eq ''){&mypage_err("選択できるアイコンがありません。");} $out{'list'} =<<"EOT"; $list EOT &html_out('mypage_icon_select02.html'); } #--------------------------------------- # 一覧表示アイコン選択 #--------------------------------------- sub icon_select_set { $sql = "update stars_data set icon_hidden = 1 where pcid = '$pcid';"; $dbh->do($sql) or &mypage_err("エラーが発生しました。"); foreach $key (keys %in){ if (substr($key,0,5) eq 'icon_'){ $file = substr($key,5); if ($in{$key} eq 1){ $sql = "update stars_data set icon_hidden = 0 where pcid = '$pcid' and file_name = '$file';"; $dbh->do($sql) or &mypage_err("エラーが発生しました。"); } } } print "Location: ./mypage.cgi?pcid=$pcid\n\n"; } #--------------------------------------- # デフォルトアイコン選択 #--------------------------------------- sub icon_change { &com_data($in{'mode'},$out{'pcid'},$flg_mode,$in{'type'}); $d_icon = &def_icon($class); $sql = "select file_name,url,crname from stars_data where pcid = '$pcid' and pdid in ('C02','C08') order by reg_date desc;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("エラーが発生しました。"); $i = 0; foreach(@$ref) { ($file_name,$url,$crname)=@{$_}; if ($out{'icon'} eq $url){$chk = 'checked';} else{$chk = '';} $stars_th_file = "/home/rexi-jp/public_html/data/gx/$file_name"; $stars_th_file_url = "$url"; if ($i eq 0){ $list .=<<"EOT"; EOT } $list .=<<"EOT"; $crname EOT $i++; if ($i eq 6){ $list .=<<"EOT"; EOT $i = 0; } } if ($list eq ''){&mypage_err("選択できるアイコンがありません。");} $out{'list'} =<<"EOT"; $list EOT &html_out('mypage_icon_select01.html'); } #--------------------------------------- # アイコンセット #--------------------------------------- sub icon_set { if ($in{'def'} eq ''){&mypage_err("アイコンが選択されていません。");} $sql = "select url from stars_data where pcid = '$pcid' and pdid in ('C02','C08') and file_name = '$in{'def'}';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("エラーが発生しました。"); ($url)=@{$ref->[0]}; if ($url eq ''){&mypage_err("選択されたアイコンは存在しないか、他のキャラクターのデータです。");} $sql = "update character set icon = '$url' where pcid = '$pcid';"; $dbh->do($sql) or &mypage_err("エラーが発生しました。"); print "Location: ./mypage.cgi?pcid=$pcid\n\n"; } #--------------------------------------- # 鍛練 #--------------------------------------- sub training { &cal_ability_rtn; $out{'ztp'} = &tp_rtn; $out{'tcnt'} = &learning_num_rtn; $out{'lv1a'} = $b_kakutou; $out{'lv2a'} = $b_syageki; $out{'lv3a'} = $b_hansya; $out{'lv4a'} = $b_teikou; $out{'lv5a'} = $b_seirei; $out{'lv1b'} = $b_kakutou + 1; $out{'lv2b'} = $b_syageki + 1; $out{'lv3b'} = $b_hansya + 1; $out{'lv4b'} = $b_teikou + 1; $out{'lv5b'} = $b_seirei + 1; #格闘力の鍛練 $k_num = &learning_num_rtn('ability',1); $s_tp = &ntp_rtn(1); if ($k_num > 0){ $out{'btn1'} = '済み'; $out{'stp1'} = '―'; $out{'lv1b'} = '―'; } else{ $out{'stp1'} = $s_tp; $out{'btn1'} =<<"EOT"; EOT } #射撃力の鍛練 $k_num = &learning_num_rtn('ability',2); $s_tp = &ntp_rtn(2); if ($k_num > 0){ $out{'btn2'} = '済み'; $out{'stp2'} = '―'; $out{'lv2b'} = '―'; } else{ $out{'stp2'} = $s_tp; $out{'btn2'} =<<"EOT"; EOT } #反射力の鍛練 $k_num = &learning_num_rtn('ability',3); $s_tp = &ntp_rtn(3); if ($k_num > 0){ $out{'btn3'} = '済み'; $out{'stp3'} = '―'; $out{'lv3b'} = '―'; } else{ $out{'stp3'} = $s_tp; $out{'btn3'} =<<"EOT"; EOT } #抵抗力の鍛練 $k_num = &learning_num_rtn('ability',4); $s_tp = &ntp_rtn(4); if ($k_num > 0){ $out{'btn4'} = '済み'; $out{'stp4'} = '―'; $out{'lv4b'} = '―'; } else{ $out{'stp4'} = $s_tp; $out{'btn4'} =<<"EOT"; EOT } #精霊力の鍛練 $k_num = &learning_num_rtn('ability',5); $s_tp = &ntp_rtn(5); if ($k_num > 0){ $out{'btn5'} = '済み'; $out{'stp5'} = '―'; $out{'lv5b'} = '―'; } else{ $out{'stp5'} = $s_tp; $out{'btn5'} =<<"EOT"; EOT } #魔法vaの鍛練 $k_num = &learning_num_rtn('va'); $s_tp = &ntp_rtn(6); if ($k_num > 0){ $out{'btn6'} =<<"EOT"; データ確認 EOT $out{'lv6b'} = '―'; $out{'stp6'} = '―'; } else{ $out{'stp6'} = $s_tp; $out{'btn6'} =<<"EOT"; EOT } $sql = "select count(*) from skill where pcid = '$pcid' and lv > 0;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("エラーが発生しました。"); ($cnt)=@{$ref->[0]}; $l_s_btn = '修得数限界'; #一般スキル(身体系)の鍛練 $out{'btn7'} =<<"EOT"; EOT # if ($cnt ne '' && $cnt >= 14){$out{'btn7'} = $l_s_btn;} #一般スキル(技術系)の鍛練 $out{'btn8'} =<<"EOT"; EOT # if ($cnt ne '' && $cnt >= 14){$out{'btn8'} = $l_s_btn;} #一般スキル(知識系)の鍛練 $out{'btn9'} =<<"EOT"; EOT $sql = "select race from character where pcid = '$pcid';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:TV-01エラーが発生しました。"); ($c_race)=@{$ref->[0]}; if($c_race eq 6){ $out{'btn10'} =<<"EOT"; 一般スキル(妖精系)の修得様々 EOT }elsif($c_race eq 10){ $out{'btn10'} =<<"EOT"; 一般スキル(妖精系)の修得様々 EOT } # if ($cnt ne '' && $cnt >= 14){$out{'btn9'} = $l_s_btn;} &html_out('mypage_tanren01.html'); } #--------------------------------------- # 鍛練2 #--------------------------------------- sub training2 { if ($in{'type'} eq 'ability'){ &training_conf; } elsif ($in{'type'} eq 'va'){ &training_va_list; } elsif (substr($in{'type'},0,5) eq 'skill'){ &training_skill_list; } } #--------------------------------------- # 鍛練確認 #--------------------------------------- sub training_conf { &cal_ability_rtn; $k_num = &learning_num_rtn($in{'type'},$in{'no'}); if ($k_num ne '' && $k_num > 0){&mypage_err("既に今月の鍛練を行っています。");} $out{'ztp'} = &tp_rtn; if ($in{'type'} eq 'skill'){ $sqlm = "select field from skill_master where id = $in{'no'};"; $refm = $dbh->selectall_arrayref($sqlm) or &mypage_err("CODE:TC-01エラーが発生しました。"); ($bun)=@{$refm->[0]}; $base_no = &skill_field_no_rtn($bun); $out{'n_tp'} = &ntp_rtn('skill',$in{'no'},$base_no); } elsif ($in{'type'} eq 6){ $out{'n_tp'} = &ntp_rtn(6); } else{ $out{'n_tp'} = &ntp_rtn($in{'no'}); } if ($uid eq 2){$tmp = "残TP:$out{'ztp'},必要TP:$out{'n_tp'},TYPE:$in{'type'},NO:$in{'no'}";} if ($out{'ztp'} < $out{'n_tp'}){&mypage_err("TPが不足している為、鍛練を行えません。");} if ($in{'type'} eq 'va'){$out{'tname'} = '魔法va';} elsif ($in{'type'} eq 'skill'){ $sqlm = "select name from skill_master where id = $in{'no'};"; $refm = $dbh->selectall_arrayref($sqlm) or &mypage_err("CODE:TC-01エラーが発生しました。"); ($out{'tname'})=@{$refm->[0]}; } elsif ($in{'type'} eq 6){ $sqlm = "select name from magic_master where id = $in{'no'};"; $refm = $dbh->selectall_arrayref($sqlm) or &mypage_err("CODE:TC-01エラーが発生しました。"); ($out{'tname'})=@{$refm->[0]}; } elsif ($in{'no'} eq 1){$out{'tname'} = '格闘力';} elsif ($in{'no'} eq 2){$out{'tname'} = '射撃力';} elsif ($in{'no'} eq 3){$out{'tname'} = '反射力';} elsif ($in{'no'} eq 4){$out{'tname'} = '抵抗力';} elsif ($in{'no'} eq 5){$out{'tname'} = '精霊力';} &html_out('mypage_tanren02.html'); } #--------------------------------------- # 鍛練実行 #--------------------------------------- sub training3 { &cal_ability_rtn; $k_num = &learning_num_rtn($in{'type'},$in{'no'}); if ($k_num ne '' && $k_num > 0){&mypage_err("既に今月の鍛練を行っています。");} $out{'ztp'} = &tp_rtn; if ($in{'type'} eq 'skill'){ $sqlm = "select field from skill_master where id = $in{'no'};"; $refm = $dbh->selectall_arrayref($sqlm) or &mypage_err("CODE:TC-01エラーが発生しました。"); ($bun)=@{$refm->[0]}; $base_no = &skill_field_no_rtn($bun); $out{'n_tp'} = &ntp_rtn('skill',$in{'no'},$base_no); #&mypage_err("$out{'n_tp'},$in{'no'},$base_no"); } elsif ($in{'type'} eq 6){ $out{'n_tp'} = &ntp_rtn(6); $in{'type'} = 'va'; } else{ $out{'n_tp'} = &ntp_rtn($in{'no'}); } if ($out{'ztp'} < $out{'n_tp'}){&mypage_err("TPが不足している為、鍛練を行えません。");} $ztp = $out{'n_tp'} * -1; $sql = "insert into tp (pcid,point,genre,no) values ('$pcid',$ztp,'$in{'type'}',$in{'no'});"; #&mypage_err("$in{'type'},$in{'no'}$sql"); $dbh->do($sql) or &mypage_err("CODE:T-01エラーが発生しました。"); if ($in{'type'} eq 'skill'){ #スキル登録 $sql2 = "select count(*) from skill where pcid = '$pcid' and id = $in{'no'};"; $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:TV-03エラーが発生しました。"); ($cnt)=@{$ref2->[0]}; if ($cnt eq '' || $cnt eq 0){ $sql = "insert into skill (pcid,id,lv) values ('$pcid',$in{'no'},1);"; } else{ $sql = "update skill set lv = lv + 1 where pcid = '$pcid' and id = $in{'no'};"; } $dbh->do($sql) or &mypage_err("CODE:T-01エラーが発生しました。"); } elsif ($in{'type'} eq 'va'){ #魔法Va登録 $sql2 = "select count(*) from magic where pcid = '$pcid' and id = $in{'no'};"; $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:TV-03エラーが発生しました。"); ($cnt)=@{$ref2->[0]}; if ($cnt eq '' || $cnt eq 0){ if ($in{'no'} >= 300 && $in{'no'} <= 317){ $sql = "insert into magic (pcid,id,lv) values ('$pcid',$in{'no'},3);"; } else{ $sql = "insert into magic (pcid,id,lv) values ('$pcid',$in{'no'},1);"; } } else{ $sql = "update magic set lv = lv + 1 where pcid = '$pcid' and id = $in{'no'};"; } $dbh->do($sql) or &mypage_err("CODE:T-01エラーが発生しました。"); if ($in{'no'} >= 300 && $in{'no'} <= 317){ $sql2 = "select lv from magic where pcid = '$pcid' and id = $in{'no'};"; $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:TV-04エラーが発生しました。"); ($lv)=@{$ref2->[0]}; if ($lv ne '' && $lv eq 3){ if ($in{'no'} eq 300){$mon_id = 58;} #アースソウル elsif ($in{'no'} eq 301){$mon_id = 118;} #ユニコーン elsif ($in{'no'} eq 302){$mon_id = 139;} #ヒドラ elsif ($in{'no'} eq 303){$mon_id = 59;} #ドラケイ elsif ($in{'no'} eq 304){$mon_id = 119;} #ケルピー elsif ($in{'no'} eq 305){$mon_id = 140;} #サーペント elsif ($in{'no'} eq 306){$mon_id = 60;} #エシュロン elsif ($in{'no'} eq 307){$mon_id = 120;} #サラマンダー elsif ($in{'no'} eq 308){$mon_id = 141;} #フェニックス elsif ($in{'no'} eq 309){$mon_id = 61;} #シルフィード elsif ($in{'no'} eq 310){$mon_id = 121;} #トッドローリー elsif ($in{'no'} eq 311){$mon_id = 142;} #ワイバーン elsif ($in{'no'} eq 312){$mon_id = 62;} #メイフェ elsif ($in{'no'} eq 313){$mon_id = 122;} #シムル elsif ($in{'no'} eq 314){$mon_id = 143;} #ペガサス elsif ($in{'no'} eq 315){$mon_id = 63;} #ブリックル elsif ($in{'no'} eq 316){$mon_id = 123;} #バク elsif ($in{'no'} eq 317){$mon_id = 144;} #カーシー $sql3 = "insert into monster_point (pcid,scenario_seq,mon_id,point) values ('$pcid',0,$mon_id,100);"; $dbh->do($sql3) or &mypage_err("CODE:T-02エラーが発生しました。"); } } } print "Location: ./mypage.cgi?pcid=$pcid&mode=training\n\n"; } #--------------------------------------- # 鍛練(スキルリスト) #--------------------------------------- sub training_skill_list { $l_s_btn = '修得数限界'; $bun = substr($in{'type'},5); $base_no = $bun; if ($bun eq 1){$bun = '身体';} elsif ($bun eq 2){$bun = '技術';} elsif ($bun eq 3){$bun = '知識';} elsif ($bun eq 4){$bun = 'シフ';} elsif ($bun eq 5){$bun = 'ブラ';} if($bun eq 'シフ'){ $out{'bun'} = '妖精'; }elsif($bun eq 'ブラ'){ $out{'bun'} = '妖精'; }else{ $out{'bun'} = $bun; } &cal_ability_rtn; $out{'ztp'} = &tp_rtn; $out{'tcnt'} = &learning_num_rtn; $sql = "select count(*) from skill where pcid = '$pcid' and lv > 0;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("エラーが発生しました。"); ($skill_cnt)=@{$ref->[0]}; $sql = "select id,name,base,info from skill_master where field = '$bun' order by id;"; if(($bun ne 'シフ') && ($bun ne 'ブラ')){ $ss_cnt =0; $ss_max = 9999; }else{ $sql_c = "select count(a.*) from skill a,skill_master b where a.pcid = '$pcid' and a.lv > 0 and a.id = b.id and b.field = '$bun';"; $ref = $dbh->selectall_arrayref($sql_c) or &mypage_err("エラーが発生しました。"); ($ss_cnt)=@{$ref->[0]}; if($bun eq 'シフ'){ $ss_max = 2; }elsif($bun eq 'ブラ'){ $ss_max = 3; } ##3 if($ss_cnt >= 2) { ## &mypage_err("一般スキル($bun)系は2種類までしか取得できません。"); ## $sql = "select b.id,b.name,b.base,info from skill a,skill_master b where a.pcid = '$pcid' and a.lv > 0 and a.id = b.id and b.field = '$bun';"; ## }else{ ## $sql = "select id,name,base,info from skill_master where field = '$bun' order by id;"; ## } } $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:TS-01エラーが発生しました。"); foreach(@$ref) { ($no,$skill_name,$base,$info)=@{$_}; $sqlm = "select lv from skill where pcid = '$pcid' and id = $no;"; $refm = $dbh->selectall_arrayref($sqlm) or &mypage_err("CODE:TS-02エラーが発生しました。"); ($slv)=@{$refm->[0]}; if ($slv eq ''){$slv = 0;} $slv2 = $slv + 1; $ncp = 0; $ncp = &ntp_rtn('skill',$no,$base_no); $n = &learning_num_rtn('skill',$no); if ($base eq 'VIT' && $t_vit <= $slv){$a_flg = 0;} elsif ($base eq 'SUB' && $t_sub <= $slv){$a_flg = 0;} elsif ($base eq 'DEX' && $t_dex <= $slv){$a_flg = 0;} elsif ($base eq 'PER' && $t_per <= $slv){$a_flg = 0;} elsif ($base eq 'INT' && $t_int <= $slv){$a_flg = 0;} elsif ($base eq 'MEN' && $t_men <= $slv){$a_flg = 0;} else{$a_flg = 1;} if ($a_flg eq 0){ $btn =<<"EOT"; 天分限界 EOT } elsif ($slv eq 0 && $skill_cnt >= 14){$btn = $l_s_btn;} elsif (($n eq 0 || $n eq 0) && $a_flg eq 1){ $btn =<<"EOT"; EOT if($ss_cnt >= $ss_max){ $sqlc = "select count(*) from skill where pcid = '$pcid' and id = $no;"; $refc = $dbh->selectall_arrayref($sqlc) or &mypage_err("エラーが発生しました。"); ($scheck)=@{$refc->[0]}; if($scheck eq 0){ $btn = '―'; $slv2 = '―'; $ncp = '―'; $slv = '―'; } } } else{ $btn = '済み'; $slv2 = '―'; } $info = &newline_change($info); $out{'skill_list'} .=<<"EOT"; $skill_name$base$ncp$slv$slv2$btn EOT } &html_out('mypage_tanren03.html'); } #--------------------------------------- # 中級守護精霊返却 #--------------------------------------- sub lv2_syugo_id_rtn { my $in_s_id = $_[0]; my $in_class = $_[1]; $new_sid = ''; if ($in_class eq 'W'){ if ($in_s_id eq 151){$new_sid = 300;} elsif ($in_s_id eq 152){$new_sid = 301;} elsif ($in_s_id eq 153){$new_sid = 302;} elsif ($in_s_id eq 154){$new_sid = 303;} elsif ($in_s_id eq 155){$new_sid = 304;} elsif ($in_s_id eq 156){$new_sid = 305;} elsif ($in_s_id eq 157){$new_sid = 306;} elsif ($in_s_id eq 158){$new_sid = 307;} elsif ($in_s_id eq 159){$new_sid = 308;} elsif ($in_s_id eq 160){$new_sid = 309;} elsif ($in_s_id eq 161){$new_sid = 310;} elsif ($in_s_id eq 162){$new_sid = 311;} elsif ($in_s_id eq 163){$new_sid = 312;} elsif ($in_s_id eq 164){$new_sid = 313;} elsif ($in_s_id eq 165){$new_sid = 314;} elsif ($in_s_id eq 166){$new_sid = 315;} elsif ($in_s_id eq 167){$new_sid = 316;} elsif ($in_s_id eq 168){$new_sid = 317;} } elsif ($in_class eq 'K'){ if ($in_s_id eq 151){$new_sid = 318;} elsif ($in_s_id eq 152){$new_sid = 319;} elsif ($in_s_id eq 153){$new_sid = 320;} elsif ($in_s_id eq 154){$new_sid = 321;} elsif ($in_s_id eq 155){$new_sid = 322;} elsif ($in_s_id eq 156){$new_sid = 323;} elsif ($in_s_id eq 157){$new_sid = 324;} elsif ($in_s_id eq 158){$new_sid = 325;} elsif ($in_s_id eq 159){$new_sid = 326;} elsif ($in_s_id eq 160){$new_sid = 327;} elsif ($in_s_id eq 161){$new_sid = 328;} elsif ($in_s_id eq 162){$new_sid = 329;} elsif ($in_s_id eq 163){$new_sid = 330;} elsif ($in_s_id eq 164){$new_sid = 331;} elsif ($in_s_id eq 165){$new_sid = 332;} elsif ($in_s_id eq 166){$new_sid = 333;} elsif ($in_s_id eq 167){$new_sid = 334;} elsif ($in_s_id eq 168){$new_sid = 335;} } elsif ($in_class eq 'P'){ if ($in_s_id eq 151){$new_sid = 336;} elsif ($in_s_id eq 152){$new_sid = 337;} elsif ($in_s_id eq 153){$new_sid = 338;} elsif ($in_s_id eq 154){$new_sid = 339;} elsif ($in_s_id eq 155){$new_sid = 340;} elsif ($in_s_id eq 156){$new_sid = 341;} elsif ($in_s_id eq 157){$new_sid = 342;} elsif ($in_s_id eq 158){$new_sid = 343;} elsif ($in_s_id eq 159){$new_sid = 344;} elsif ($in_s_id eq 160){$new_sid = 345;} elsif ($in_s_id eq 161){$new_sid = 346;} elsif ($in_s_id eq 162){$new_sid = 347;} elsif ($in_s_id eq 163){$new_sid = 348;} elsif ($in_s_id eq 164){$new_sid = 349;} elsif ($in_s_id eq 165){$new_sid = 350;} elsif ($in_s_id eq 166){$new_sid = 351;} elsif ($in_s_id eq 167){$new_sid = 352;} elsif ($in_s_id eq 168){$new_sid = 353;} } elsif ($in_class eq 'H'){ if ($in_s_id eq 151){$new_sid = 354;} elsif ($in_s_id eq 152){$new_sid = 355;} elsif ($in_s_id eq 153){$new_sid = 356;} elsif ($in_s_id eq 154){$new_sid = 357;} elsif ($in_s_id eq 155){$new_sid = 358;} elsif ($in_s_id eq 156){$new_sid = 359;} elsif ($in_s_id eq 157){$new_sid = 360;} elsif ($in_s_id eq 158){$new_sid = 361;} elsif ($in_s_id eq 159){$new_sid = 362;} elsif ($in_s_id eq 160){$new_sid = 363;} elsif ($in_s_id eq 161){$new_sid = 364;} elsif ($in_s_id eq 162){$new_sid = 365;} elsif ($in_s_id eq 163){$new_sid = 366;} elsif ($in_s_id eq 164){$new_sid = 367;} elsif ($in_s_id eq 165){$new_sid = 368;} elsif ($in_s_id eq 166){$new_sid = 369;} elsif ($in_s_id eq 167){$new_sid = 370;} elsif ($in_s_id eq 168){$new_sid = 371;} } return $new_sid; } #--------------------------------------- # 鍛練(Vaリスト) #--------------------------------------- sub training_va_list { &cal_ability_rtn; $out{'ztp'} = &tp_rtn; $out{'tcnt'} = &learning_num_rtn; $k_num = &learning_num_rtn('va'); if($pcid eq 'xc2234'){ $k_num =0; } $s_tp = &ntp_rtn(6); $sql = "select class,lumina,race,lumina_lv from character where pcid = '$pcid';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:TV-01エラーが発生しました。"); ($c_class,$c_lumina,$c_race,$c_lumina_lv)=@{$ref->[0]}; if ($c_class eq 1){$c_class = 'W';} elsif ($c_class eq 2){$c_class = 'K';} elsif ($c_class eq 3){$c_class = 'P';} elsif ($c_class eq 4){$c_class = 'H';} # if ($c_lumina eq 1){$c_class = 'W';} # and (race_limit is null or race_limit = $c_race) ##if($pcid eq 'xc2234'){ ## $c_lumina_lv =2; ##} #守護精霊修得確認 # $sql = "select count(*),max(lv) from magic where pcid = '$pcid' and id >= 151 and id <= 168;"; $sql = "select id,max(lv) from magic where pcid = '$pcid' and ((id >= 151 and id <= 168) or (id >= 300 and id <= 353)) group by id;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:TV-01AXエラーが発生しました。"); ($s_id,$slv)=@{$ref->[0]}; $sql = "select id,rank,name,text,class,lumina,lv_limit,effect,range,scope,gs,time,lumina2,lumina_lv from magic_master where (class = '全' or class = '$c_class') and (lumina = '補' or lumina = '共' or lumina = '@lumina_str[$c_lumina]') and rank = 1 and lumina_lv <= $c_lumina_lv and race_limit is null order by id;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:TV-02エラーが発生しました。"); foreach(@$ref) { ($id,$rank,$name,$text,$class,$lumina,$lv_limit,$effect,$range,$scope,$gs,$time,$lumina2,$lumina_lv)=@{$_}; push ary_id,$id; push ary_rank,$rank; push ary_name,$name; push ary_text,$text; push ary_class,$class; push ary_lumina,$lumina; push ary_lv_limit,$lv_limit; push ary_effect,$effect; push ary_range,$range; push ary_scope,$scope; push ary_gs,$gs; push ary_time,$time; push ary_lumina2,$lumina2; push ary_lumina_lv,$lumina_lv; } $t_r = '%' . $c_race . '%'; $sql = "select id,rank,name,text,class,lumina,lv_limit,effect,range,scope,gs,time,race_limit,lumina2,lumina_lv from magic_master where (class = '全' or class = '$c_class') and (lumina = '補' or lumina = '共' or lumina = '@lumina_str[$c_lumina]') and rank = 1 and lumina_lv <= $c_lumina_lv and race_limit is not null and race_limit like '$t_r' order by id;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:TV-02エラーが発生しました。"); foreach(@$ref) { ($id,$rank,$name,$text,$class,$lumina,$lv_limit,$effect,$range,$scope,$gs,$time,$race_limit,$lumina2,$lumina_lv)=@{$_}; $r_flg = 0; @ary_tmp = (); @ary_tmp = split(/\,/,$race_limit); foreach(@ary_tmp){ if ($c_race eq $_){ $r_flg = 1; last; } } if ($r_flg eq 1){ push ary_id,$id; push ary_rank,$rank; push ary_name,$name; push ary_text,$text; push ary_class,$class; push ary_lumina,$lumina; push ary_lv_limit,$lv_limit; push ary_effect,$effect; push ary_range,$range; push ary_scope,$scope; push ary_gs,$gs; push ary_time,$time; push ary_lumina2,$lumina2; push ary_lumina_lv,$lumina_lv; } } $i=0; foreach (@ary_id){ $id = @ary_id[$i]; $rank = @ary_rank[$i]; $name = @ary_name[$i]; $text = @ary_text[$i]; $class = @ary_class[$i]; $lumina = @ary_lumina[$i]; $lv_limit = @ary_lv_limit[$i]; $effect = @ary_effect[$i]; $range = @ary_range[$i]; $scope = @ary_scope[$i]; $gs = @ary_gs[$i]; $time = @ary_time[$i]; $lumina2 = @ary_lumina2[$i]; $lumina_lv = @ary_lumina_lv[$i]; $i++; if ($gs eq ''){$gs = '−';} if ($lumina2 ne ''){$lumina = $lumina2;} $sql2 = "select count(*) from tp where pcid = '$pcid' and ((type = 0 and point < 0) or (type = 1 and point = 0)) and genre = 'va' and no = $id;"; $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:TV-03エラーが発生しました。"); ($n_lv)=@{$ref2->[0]}; $lv = $n_lv; $lv2 = $lv + 1; if($lv > 1){ $sql2 = "select text,effect,range,scope,gs,time from magic_master where id = $id and rank < $lv2 order by rank desc;"; $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:TV-03エラーが発生しました。"); ($text,$effect,$range,$scope,$gs,$time)=@{$ref2->[0]}; } if ($lv2 eq 3 || $lv2 eq 5 || $lv2 eq 8){ $sql2 = "select text,effect,range,scope,gs,time from magic_master where id = $id and rank = $lv2;"; $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:TV-03エラーが発生しました。"); ($text,$effect,$range,$scope,$gs,$time)=@{$ref2->[0]}; } $text =<<"EOT"; 効果:$effect 射程:$range 範囲:$scope 時間:$time Gs:$gs $text EOT ## $sql2 = "select count(*) from tp where pcid = '$pcid' and ((type = 0 and point < 0) or (type = 1 and point = 0)) and genre = 'va' and no = $id;"; ## $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:TV-03エラーが発生しました。"); ## ($n_lv)=@{$ref2->[0]}; $lv = $n_lv; $lv2 = $lv + 1; if ($n_lv eq '' || $n_lv eq 0){ $n_lv = '未修得'; $nx_lv = '1(初級)'; }else{ if($lv_limit > $lumina_lv){ $sql2 = "select count(*) from magic_master where id = $id and lumina_lv > $c_lumina_lv;"; $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:TV-032エラーが発生しました。"); ($tcnt)=@{$ref2->[0]}; ##if($id eq 324){ ##&err("if($lv_limit > $lumina_lv){{ $sql2"); ##} if($tcnt > 0){ $lv_limit = 1; ##&err($name. $lv."---".$lv_limit ); } } ##現在レベル if ($n_lv < 3){$n_lv_str = '初級';} elsif ($n_lv < 5){$n_lv_str = '中級';} elsif ($n_lv < 8){$n_lv_str = '上級';} elsif ($n_lv >= 8){$n_lv_str = '仙級';} $n_lv = "$n_lv($n_lv_str)"; $nx_lv = $n_lv + 1; ##鍛錬後レベル if ($nx_lv < 3){$nx_lv_str = '初級';} elsif ($nx_lv < 5){$nx_lv_str = '中級';} elsif ($nx_lv < 8){$nx_lv_str = '上級';} elsif ($nx_lv >= 8){$nx_lv_str = '仙級';} $nx_lv = "$nx_lv($nx_lv_str)"; } if ($lv >= $lv_limit){ $btn = 'Lv限界'; $nx_lv = '―'; } # elsif ($s_id2 ne '' && $slv2 eq 3 && $id >= 151 && $id <= 168 && $c_lumina_lv >= 3 && $id eq $s_id){ # $new_s_id = &lv2_syugo_id_rtn($s_id,$c_class); # $sql2 = "select rank,name,text,class,lumina,lv_limit,effect,range,scope,gs,time,race_limit,lumina2 from magic_master where id = $new_s_id and lumina_lv = 3 and class = '$c_class';"; # $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:TV-03エラーが発生しました。"); # ($rank,$name,$text,$class,$lumina,$lv_limit,$effect,$range,$scope,$gs,$time,$race_limit,$lumina2)=@{$ref2->[0]}; # $btn = '―'; # $nx_lv = '―'; # $n_lv = '―'; # } elsif ($t_seirei < $lv2){$btn = '精霊力不足';} elsif ($k_num ne '' && $k_num > 0){ $btn = '済み'; $nx_lv = '―'; } # elsif ($s_id ne '' && $slv eq 1 && $id >= 151 && $id <= 168 && $c_lumina_lv >= 3 && $id eq $s_id && $s_id2 eq ''){ # #守護精霊中級表示 # $new_s_id = &lv2_syugo_id_rtn($s_id,$c_class); # $btn =<<"EOT"; # # # # # # #EOT # $sql2 = "select rank,name,text,class,lumina,lv_limit,effect,range,scope,gs,time,race_limit,lumina2 from magic_master where id = $new_s_id and lumina_lv = 3 and class = '$c_class';"; # $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:TV-03エラーが発生しました。"); # ($rank,$name,$text,$class,$lumina,$lv_limit,$effect,$range,$scope,$gs,$time,$race_limit,$lumina2)=@{$ref2->[0]}; # $n_lv = '1(初級)'; # $nx_lv = '3(中級)'; # } elsif (($s_id ne '' && (($id >= 151 && $id <= 168) || ($id >= 300 && $id <= 353)) && $s_id ne $id) || $lumina_lv > $c_lumina_lv){ $btn = '―'; $nx_lv = '―'; } ## elsif(){ ## $c_lumina_lv ## } else{ $btn =<<"EOT"; EOT } #if ($uid eq 2){&mypage_err("$slv2 eq 3 && $id >= 151 && $id <= 168 && $s_id2 ne ''");} $text = &newline_change($text); $out{'list'} .=<<"EOT"; $name$class$lumina$lv_limit$s_tp$n_lv$nx_lv$btn EOT } &html_out('mypage_tanren04.html'); } #--------------------------------------- # 鍛練 一般スキル分野→No変換 #--------------------------------------- sub skill_field_no_rtn { if ($_[0] eq '身体'){return 1;} elsif ($_[0] eq '技術'){return 2;} elsif ($_[0] eq '知識'){return 3;} } #--------------------------------------- # 鍛練 修得回数返却(今月分) #--------------------------------------- sub learning_num_rtn { my $m_genre = $_[0]; my $m_no = $_[1]; my $m_num = 0; $sql = "select count(*) from tp where pcid = '$pcid' and point < 0 and type = 0 and substr(reg_date,1,7) = substr(now(),1,7) and genre = '$m_genre'"; if ($m_no ne ''){$sql .= " and no = $m_no";} $sql .= ";"; if ($m_genre eq '' && $m_no eq ''){ $sql = "select count(*) from tp where pcid = '$pcid' and type = 0 and point < 0 and substr(reg_date,1,7) = substr(now(),1,7);"; } # $sql = "select count(*) from training where pcid = '$pcid' and substr(t_date,1,7) = substr(now(),1,7) and genre = '$m_genre' and no = $m_no;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("エラーが発生しました。"); ($m_num)=@{$ref->[0]}; if ($m_num eq ''){$m_num = 0;} return $m_num; } #--------------------------------------- # 中途鍛練 残TP返却 #--------------------------------------- sub halfway_tp_rtn { my $z_tp = 0; $sql = "select count(*) from tp where pcid = '$pcid' and type = 1;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("エラーが発生しました。"); ($z_tp)=@{$ref->[0]}; if ($z_tp eq ''){$z_tp = 0;} return $z_tp; } #--------------------------------------- # 鍛練 残TP返却 #--------------------------------------- sub tp_rtn { my $z_tp = 0; # $sql = "select sum(point) from tp where pcid = '$pcid' and (substr(reg_date,1,7) = substr(now(),1,7) or substr(reg_date,1,7) = substr(now() + '-1 month',1,7));"; $sql = "select sum(point) from tp where pcid = '$pcid' and type = 0;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("エラーが発生しました。"); ($z_tp)=@{$ref->[0]}; if ($z_tp eq ''){$z_tp = 0;} # if ($uid eq 2){ # $z_tp += &halfway_tp_rtn; # } return $z_tp; } #--------------------------------------- # 鍛練 必要TP返却 #--------------------------------------- sub ntp_rtn { my $m_genre = $_[0]; my $m_no = $_[1]; my $m_base_no = $_[2]; my $base_tp = 0; $sql_m = "select class from character where pcid = '$pcid';"; $ref_m = $dbh->selectall_arrayref($sql_m) or &mypage_err("エラーが発生しました。"); ($m_class)=@{$ref_m->[0]}; if ($m_genre eq 1){ #格闘力 $base_tp = 10; if ($m_class eq 1){$base_tp += -3;} #ヴォルセルク elsif ($m_class eq 2){$base_tp += -1;} #キュベレー } elsif ($m_genre eq 2){ #射撃力 $base_tp = 8; if ($m_class eq 1){$base_tp += -2;} #ヴォルセルク elsif ($m_class eq 4){$base_tp += -3;} #ホーキポーキ } elsif ($m_genre eq 3){ #反射力 $base_tp = 8; if ($m_class eq 1){$base_tp += -3;} #ヴォルセルク elsif ($m_class eq 2){$base_tp += -1;} #キュベレー } elsif ($m_genre eq 4){ #抵抗力 $base_tp = 6; if ($m_class eq 2){$base_tp += -2;} #キュベレー elsif ($m_class eq 3){$base_tp += -3;} #パドマ elsif ($m_class eq 4){$base_tp += -1;} #ホーキポーキ } elsif ($m_genre eq 5){ #精霊力 $base_tp = 10; if ($m_class eq 2){$base_tp += -3;} #キュベレー elsif ($m_class eq 3){$base_tp += -2;} #パドマ elsif ($m_class eq 4){$base_tp += -1;} #ホーキポーキ } elsif ($m_genre eq 6){ #魔法va $base_tp = 9; if ($m_class eq 2){$base_tp += -1;} #キュベレー elsif ($m_class eq 3){$base_tp += -3;} #パドマ elsif ($m_class eq 4){$base_tp += -2;} #ホーキポーキ } elsif ($m_genre eq 'skill'){ #一般スキル $sqlx = "select origin from character where pcid = '$pcid';"; $refx = $dbh->selectall_arrayref($sqlx) or &mypage_err("エラーが発生しました。"); ($t_origin)=@{$refx->[0]}; $sqlx = "select training_point,origin_correct1,origin_correct2,origin_correct3,origin_correct4,origin_correct5,origin_correct6,origin_correct7,origin_correct8,origin_correct9,origin_correct10,origin_correct11,origin_correct12 from skill_master where id = $m_no;"; $refx = $dbh->selectall_arrayref($sqlx) or &mypage_err("エラーが発生しました。"); ($training_point,$origin_correct{1},$origin_correct{2},$origin_correct{3},$origin_correct{4},$origin_correct{5},$origin_correct{6},$origin_correct{7},$origin_correct{8},$origin_correct{9},$origin_correct{10},$origin_correct{11},$origin_correct{12})=@{$refx->[0]}; $base_tp = $training_point + $origin_correct{$t_origin}; # &err("$base_tp = $training_point + $origin_correct{$t_origin},$t_origin"); if ($m_base_no eq 1){ #一般スキル身体 if ($m_class eq 1){$base_tp += -1;} #ヴォルセルク elsif ($m_class eq 4){$base_tp += -1;} #ホーキポーキ } elsif ($m_base_no eq 2){ #一般スキル技術 if ($m_class eq 1){$base_tp += -1;} #ヴォルセルク elsif ($m_class eq 2){$base_tp += -1;} #キュベレー elsif ($m_class eq 4){$base_tp += -1;} #ホーキポーキ } elsif ($m_base_no eq 3){ #一般スキル知識 if ($m_class eq 2){$base_tp += -1;} #キュベレー elsif ($m_class eq 3){$base_tp += -2;} #パドマ elsif ($m_class eq 4){$base_tp += -1;} #ホーキポーキ } } #部活修正 $c_flg = 1; #ここに1入れたら全体反映 @n_seq = (); @c_seq = (); @a_seq = (); # if ($uid eq 2){$c_flg = 1;} if ($c_flg eq 1){ $f_cnt = 0; $a_cnt = 0; @now_club = (); $sql_m = "select count(*) from log where pcid = '$pcid' and head = '部活入部';"; $ref_m = $dbh->selectall_arrayref($sql_m) or &mypage_err("CODE:NTP-00エラーが発生しました。"); ($total_club_cnt)=@{$ref_m->[0]}; $sql_m = "select club_seq from club_member where pcid = '$pcid' and state = 0 order by club_seq;"; $ref_m = $dbh->selectall_arrayref($sql_m) or &mypage_err("CODE:NTP-03エラーが発生しました。"); #現在入ってる部活 foreach(@$ref_m) { ($seq)=@{$_}; push now_club,seq; } if ($total_club_cnt eq '' || $total_club_cnt <= 3){ $sql_m = "select content from log where pcid = '$pcid' and head = '部活入部' order by date limit 3;"; #最初入った3部活 $ref_m = $dbh->selectall_arrayref($sql_m) or &mypage_err("CODE:NTP-01エラーが発生しました。"); foreach(@$ref_m) { ($content)=@{$_}; chomp $content; foreach (@now_club){ if ($_ eq $content){ push n_seq,$content; $f_cnt++; } } } $c_cnt = 0; $sql_m = "select b.seq from club_member a,club b where a.pcid = '$pcid' and a.state = 0 and a.reg_date + '16 days' < now() and a.club_seq = b.seq and b.lv <= 3;"; $ref_m = $dbh->selectall_arrayref($sql_m) or &mypage_err("CODE:NTP-02エラーが発生しました。"); #16日以上経過した現在入ってる部活 foreach(@$ref_m) { ($seq)=@{$_}; push c_seq,$seq; $c_cnt++; } @r_seq = (); @r_seq = @c_seq; $sql_m = "select b.seq from club_member a,club b where a.pcid = '$pcid' and a.state = 0 and a.club_seq = b.seq and b.lv <= 3 order by a.reg_date;"; $ref_m = $dbh->selectall_arrayref($sql_m) or &mypage_err("CODE:NTP-03エラーが発生しました。"); #現在入ってる部活 foreach(@$ref_m) { ($seq)=@{$_}; push a_seq,$seq; $a_cnt++; } if ($c_cnt < $a_cnt){ $c_cnt = $a_cnt; @r_seq = (); @r_seq = @a_seq; #if ($uid eq 2){&mypage_err("$c_cnt,@r_seq");} } elsif ($c_cnt eq $a_cnt){ $d_flg = 4; @r_seq = (); @r_seq = @c_seq; } elsif ($f_cnt eq $c_cnt){ $d_flg = 1; @r_seq = (); @r_seq = @a_seq; } elsif ($f_cnt eq $a_cnt){ $d_flg = 2; $c_cnt = $a_cnt; @r_seq = (); @r_seq = @a_seq; } elsif ($f_cnt > $c_cnt){ $d_flg = 3; $c_cnt = $f_cnt; @r_seq = (); @r_seq = @f_seq; } elsif ($f_cnt eq 3 && $c_cnt <= 3){ $d_flg = 5; $c_cnt = 0; @r_seq = (); foreach(@a_seq){ $t1 = $_; foreach(@n_seq){ $t2 = $_; if ($t1 eq $t2){ push r_seq,$t1; $c_cnt++; } } } } } else{ $sql_m = "select count(*) from club_member a,club b where a.pcid = '$pcid' and a.state = 0 and a.reg_date + '16 days' < now() and a.club_seq = b.seq and b.lv <= 3;"; $ref_m = $dbh->selectall_arrayref($sql_m) or &mypage_err("CODE:NTP-04エラーが発生しました。"); ($c_cnt)=@{$ref_m->[0]}; $c_flg = 0; } } else{ $sql_m = "select count(*) from club_member a,club b where a.pcid = '$pcid' and a.state = 0 and a.reg_date + '16 days' < now() and a.club_seq = b.seq and b.lv <= 3;"; $ref_m = $dbh->selectall_arrayref($sql_m) or &mypage_err("CODE:NTP-04エラーが発生しました。"); ($c_cnt)=@{$ref_m->[0]}; } if ($c_cnt eq 1){$b_cor = -8;} elsif ($c_cnt eq 2){$b_cor = -4;} elsif ($c_cnt eq 3){$b_cor = -3;} else{$b_cor = 0;} # if ($uid eq 2){$b_cor = 0;} # if ($uid eq 2){&mypage_err("d_flg:$d_flg,c_cnt:$c_cnt,f_cnt:$f_cnt,a_cnt:$a_cnt,b_cor:$b_cor");} if ($c_flg eq 1){ $seq_in = ''; foreach(@r_seq){ $seq_in .= $_ . ","; } if ($seq_in ne ''){chop $seq_in;} if ($seq_in ne ''){ $sql_m = "select b.skill,b.tanren from club_member a,club b where a.pcid = '$pcid' and a.state = 0 and a.club_seq in ($seq_in) and a.club_seq = b.seq and b.lv <= 3;"; $ref_m = $dbh->selectall_arrayref($sql_m) or &mypage_err("CODE:NTP-05エラーが発生しました。"); } else{@ref_m = ();} } else{ $sql_m = "select b.skill,b.tanren from club_member a,club b where a.pcid = '$pcid' and a.state = 0 and a.reg_date + '16 days' < now() and a.club_seq = b.seq and b.lv <= 3;"; $ref_m = $dbh->selectall_arrayref($sql_m) or &mypage_err("CODE:NTP-05エラーが発生しました。"); } foreach(@$ref_m) { ($skill,$tanren)=@{$_}; if ($skill ne '' && $m_genre eq 'skill'){ chomp $skill; @ary_skill = (); @ary_skill = split(/\,/,$skill); foreach(@ary_skill){ $tstr = $_; chomp $tstr; if ($tstr eq $m_no){$base_tp += $b_cor;} } } if ($tanren ne '' && $m_genre ne 'skill'){ chomp $tanren; $m_dbg .= "$m_genre:$tanren"; @ary_tanren = (); @ary_tanren = split(/\,/,$tanren); foreach(@ary_tanren){ $tstr = $_; chomp $tstr; $m_dbg .= "$tstr,$m_genre,$base_tp,$b_cor"; if ($tstr eq '格闘の鍛練' && $m_genre eq 1){$base_tp += $b_cor;} elsif ($tstr eq '射撃の鍛練' && $m_genre eq 2){$base_tp += $b_cor;} elsif ($tstr eq '反射の鍛練' && $m_genre eq 3){$base_tp += $b_cor;} elsif ($tstr eq '抵抗の鍛練' && $m_genre eq 4){$base_tp += $b_cor;} elsif ($tstr eq '精霊の鍛練' && $m_genre eq 5){$base_tp += $b_cor;} elsif ($tstr eq '魔法vaの鍛練' && $m_genre eq 6){$base_tp += $b_cor;} $m_dbg .= "$tstr,$m_genre,$base_tp,$b_cor"; } } } # if ($uid eq 2 && $m_genre eq 3){&mypage_err($sql_m . "" . $m_genre . "" . $m_dbg);} if ($base_tp < 0){$base_tp = 0;} #回数修正 if ($m_genre >= 1 && $m_genre <= 5){$m_genre = 'ability';} # $sql_m = "select count(*) from tp where pcid = '$pcid' and point < 0 and genre = '$m_genre';"; # $sql_m = "select count(*) from tp where pcid = '$pcid' and point < 0;"; $sql_m = "select count(*) from tp where pcid = '$pcid' and type = 0 and point < 0 and substr(reg_date,1,7) = substr(now(),1,7);"; $ref_m = $dbh->selectall_arrayref($sql_m) or &mypage_err("エラーが発生しました。"); ($t_num)=@{$ref_m->[0]}; if ($t_num eq ''){$t_num = 0;} $t_num++; $base_tp += $t_num; #&mypage_err("$base_tp,$t_num"); return $base_tp; } #--------------------------------------- # 魔法Vaメモリー #--------------------------------------- sub memory { $sql = "select count(*) from va_memory where pcid = '$pcid';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:M-00エラーが発生しました。"); ($out{'m_cnt'})=@{$ref->[0]}; &cal_ability_rtn; $out{'able_cnt'} = $t_seirei; $sql = "select class,lumina,race,lumina_lv from character where pcid = '$pcid';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:TV-01エラーが発生しました。"); ($c_class,$c_lumina,$c_race,$c_lumina_lv)=@{$ref->[0]}; #守護精霊修得確認 $sql = "select id,max(lv) from magic where pcid = '$pcid' and ((id >= 151 and id <= 168) or (id >= 300 and id <= 353)) group by id;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:TV-01AXエラーが発生しました。"); ($s_id,$slv)=@{$ref->[0]}; # $sql = "select id,max(lv) from magic where pcid = '$pcid' and id >= 300 and id <= 317 group by id;"; # $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:TV-01AXエラーが発生しました。"); # ($s_id2,$slv2)=@{$ref->[0]}; #記憶済み $sql = "select y.seq,x.id,z.name,z.text,z.effect,z.range,z.scope,z.gs,z.time,x.rank from (select a.id,max(b.rank) as rank from (select id,lv from magic where pcid = '$pcid') a,magic_master b where a.id = b.id and b.rank <= a.lv group by a.id) x,va_memory y,magic_master z where y.pcid = '$pcid' and y.id = x.id and x.id = z.id and x.rank = z.rank order by x.id;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:M-01エラーが発生しました。"); foreach(@$ref) { ($seq,$id,$name,$text,$effect,$range,$scope,$gs,$time,$lv)=@{$_}; ##守護精霊 if((($id >= 151) and ($id <= 168)) or (($id >= 300) and ($id <= 535))){ $sql2 = "select count(*) from tp where pcid = '$pcid' and ((type = 0 and point < 0) or (type = 1 and point = 0)) and genre = 'va' and no = $id;"; $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:TV-03エラーが発生しました。"); ($va_rank)=@{$ref2->[0]}; if ($va_rank < 3){ $va_rank = 1; }else{ $va_rank = 3; } $sql2 = "select id,name,text,effect,range,scope,gs,time from magic_master where id = $id and rank = $va_rank;"; $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:TV-03エラーが発生しました。"); ($id,$name,$text,$effect,$range,$scope,$gs,$time)=@{$ref2->[0]}; } $text =<<"EOT"; 効果:$effect 射程:$range 範囲:$scope 時間:$time Gs:$gs $text EOT $text = &newline_change($text); $out{'memory_list'} .=<<"EOT"; $name EOT } #修得済みVaリスト $v_cnt=0; # $sql = "select c.id,c.rank,d.name,d.text,d.effect,d.range,d.scope,d.gs,d.time from (select a.id,max(b.rank) as rank from (select id,lv from magic where pcid = '$pcid' and id < 300) a,magic_master b where a.id = b.id and b.rank <= a.lv group by a.id) c,magic_master d where c.id = d.id and c.rank = d.rank order by c.id;"; $sql = "select c.id,c.rank,d.name,d.text,d.effect,d.range,d.scope,d.gs,d.time from (select a.id,max(b.rank) as rank from (select id,lv from magic where pcid = '$pcid') a,magic_master b where a.id = b.id and b.rank <= a.lv group by a.id) c,magic_master d where c.id = d.id and c.rank = d.rank order by c.id;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:M-02エラーが発生しました。"); foreach(@$ref) { ($id,$lv,$name,$text,$effect,$range,$scope,$gs,$time)=@{$_}; # if ($s_id2 ne '' && $slv2 eq 3 && $id >= 151 && $id <= 168 && $id eq $s_id){ # $sql2 = "select rank,name,text,class,lumina,lv_limit,effect,range,scope,gs,time,race_limit,lumina2 from magic_master where id = $s_id2 and lumina_lv = 3;"; # $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:TV-03エラーが発生しました。"); # ($rank,$name,$text,$class,$lumina,$lv_limit,$effect,$range,$scope,$gs,$time,$race_limit,$lumina2)=@{$ref2->[0]}; # $id = $s_id2; # } ##守護精霊 if((($id >= 151) and ($id <= 168)) or (($id >= 300) and ($id <= 535))){ $sql2 = "select count(*) from tp where pcid = '$pcid' and ((type = 0 and point < 0) or (type = 1 and point = 0)) and genre = 'va' and no = $id;"; $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:TV-03エラーが発生しました。"); ($va_rank)=@{$ref2->[0]}; if ($va_rank < 3){ $va_rank = 1; }else{ $va_rank = 3; } $sql2 = "select id,name,text,effect,range,scope,gs,time from magic_master where id = $id and rank = $va_rank;"; $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:TV-03エラーが発生しました。"); ($id,$name,$text,$effect,$range,$scope,$gs,$time)=@{$ref2->[0]}; } $text =<<"EOT"; 効果:$effect 射程:$range 範囲:$scope 時間:$time Gs:$gs $text EOT $text = &newline_change($text); $out{'list'} .=<<"EOT"; $name EOT $v_cnt++; } if ($v_cnt eq 0){&mypage_err("メモリーできる魔法vaはありません。");} &html_out('mypage_memory01.html'); } #--------------------------------------- # メモリーセット #--------------------------------------- sub memory_set { $sql = "select lv from magic where pcid = '$pcid' and id = $in{'id'};"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:M-01エラーが発生しました。"); ($lv)=@{$ref->[0]}; if ($lv eq 0 || $lv eq ''){&mypage_err("指定された魔法Vaは修得されていません。");} $sql = "select count(*) from va_memory where pcid = '$pcid';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:M-02エラーが発生しました。"); ($m_cnt)=@{$ref->[0]}; &cal_ability_rtn; if ($m_cnt >= $t_seirei){&mypage_err("メモリーできる魔法vaの数は「$t_seirei」個までです。");} # $sql = "insert into va_memory (pcid,id,rank) values ('$pcid',$in{'id'},$lv);"; $sql = "insert into va_memory (pcid,id) values ('$pcid',$in{'id'});"; $dbh->do($sql) or &mypage_err("エラーが発生しました。"); print "Location: ./mypage.cgi?mode=memory\n\n"; } #--------------------------------------- # メモリー削除 #--------------------------------------- sub memory_del { $sql = "delete from va_memory where pcid = '$pcid' and seq = $in{'seq'};"; $dbh->do($sql) or &mypage_err("エラーが発生しました。"); print "Location: ./mypage.cgi?mode=memory\n\n"; } #--------------------------------------- # モンスターポイント設定 #--------------------------------------- sub monster_pt_set { my $m_pcid = 'xa2601'; $sql_list = "select distinct a.pcid from scenario_member a,scenario b where a.pcid not in ('xa2601','xa2112') and a.entry_state = 1 and a.scenario_seq = b.seq and b.state = 0 and ((b.monster is not null and b.monster != '') or (b.monster2 is not null and b.monster2 != '')) and b.playing_close + '2 days' < now() order by a.pcid offset 230 limit 30;"; $ref_list = $dbh->selectall_arrayref($sql_list) or &mypage_err("CODE:M-01エラーが発生しました。"); foreach(@$ref_list) { ($m_pcid)=@{$_}; $tmpd .= $m_pcid . ''; #シナリオで出会ったモンスターリスト作成 %monster_list_pts = (); $sql = "select b.seq,b.monster,b.playing_close + '2 days',b.monster2 from scenario_member a,scenario b where a.pcid = '$m_pcid' and a.entry_state = 1 and a.scenario_seq = b.seq and b.state = 0 and ((b.monster is not null and b.monster != '') or (b.monster2 is not null and b.monster2 != ''))"; $sql .= " and b.playing_close + '2 days' < now()"; $sql .= " order by b.playing_close;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:M-01エラーが発生しました。"); foreach(@$ref) { ($sseq,$monster,$pclose_date,$monster2)=@{$_}; &cal_ability_rtn($m_pcid,undef,$sseq,$pclose_date); $pclose_date2 = substr($pclose_date,0,4) . substr($pclose_date,5,2) . substr($pclose_date,8,2); @ary_mons = (); @ary_mons = split(/\,/,$monster); if ($monster2 ne ''){ chomp $monster2; push ary_mons,$monster2; } foreach (@ary_mons){ $mons_id = $_; chomp $mons_id; #ポイント計算 if ($m_mon_id eq '' || ($m_mon_id ne '' && $m_mon_id eq $mons_id)){ if ($monster_list_pts{$mons_id} eq ''){$monster_list_pts{$mons_id} = 0;} $sql2 = "select category1,oblivion from monster_master where id = $mons_id;"; $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:M-02エラーが発生しました。"); ($ct1,$ob)=@{$ref2->[0]}; $ob = $ob / 10; if ($ct1 eq 'エルフィン' && $pclose_date2 <= "20091109"){$ct1 = 'エルフ';} $sk_name = "知識($ct1)"; $sql2 = "select a.lv from skill_scenario a,skill_master b where a.pcid = '$m_pcid' and scenario_seq = $sseq and a.id = b.id and b.name = '$sk_name';"; $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:M-02エラーが発生しました。"); ($s_lv)=@{$ref2->[0]}; $base_point = $t_int + $s_lv + 1; #元値:スキルLv+INT+1 $known_point = int($base_point * $ob); if ($known_point eq 0){$known_point = 1;} # $monster_list_pts{$mons_id} += $known_point; $sql3 = "select count(*) from monster_point where pcid = '$m_pcid' and scenario_seq = $sseq and mon_id = $mons_id;"; $ref3 = $dbh->selectall_arrayref($sql3) or &mypage_err("CODE:M-02エラーが発生しました。"); ($tmp)=@{$ref3->[0]}; if ($tmp eq '' || $tmp eq 0){ $sql3 = "insert into monster_point (pcid,scenario_seq,mon_id,point) values ('$m_pcid',$sseq,$mons_id,$known_point);"; $dbh->do($sql3) or &mypage_err("エラーが発生しました。$sql3" . $dbh->errstr); } } } } } &err("終了$tmpd"); } #--------------------------------------- # モンスター一覧 #--------------------------------------- sub monster { if ($in{'pcid'} eq ''){$in{'pcid'} = $pcid;} if ($pcid ne $in{'pcid'}){$out{'ot'} = "_other";} &com_data($in{'mode'},$out{'pcid'},$flg_mode,$in{'type'}); #シナリオで出会ったモンスターリスト作成 # if ($in{'pcid'} eq 'xa2112' || $in{'pcid'} eq 'xa2601'){ %monster_list_pts = &monster_list_rtn2($in{'pcid'}); # } # else{ # %monster_list_pts = &monster_list_rtn($in{'pcid'}); # } foreach my $id ( sort { $a <=> $b } keys %monster_list_pts ){ $sql = "select name,category1,category2,undecided_name,reaction,dark_lv,oblivion,text2 from monster_master where id = $id;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:M-02エラーが発生しました。"); ($name,$category1,$category2,$undecided_name,$reaction,$dark_lv,$oblivion,$text2)=@{$ref->[0]}; #ポイントによって表示項目内容を変更 # $name = '―'; $category = '―'; # $reaction = '―'; # $dark_lv = '―'; $secret_mark = '―'; $known_mark = '―'; $mon_id = &mon_id_rtn($id); if ($monster_list_pts{$id} eq 1){ #出会ったことがあるが全く覚えていない $name = '不明'; $category = '不明'; $reaction = '?'; $dark_lv = '?'; $secret_mark = '?'; $known_mark = '×'; } elsif ($monster_list_pts{$id} eq 2){ #なんとなく外見だけ覚えている $name = $undecided_name; $category = '不明'; $reaction = '?'; $dark_lv = '?'; $secret_mark = '?'; $known_mark = '―'; } elsif ($monster_list_pts{$id} >= 3 && $monster_list_pts{$id} <= 4){ #分類と、なんとなく外見だけ覚えている $name = $undecided_name; $category = $category1; $reaction = $reaction; $dark_lv = '?'; $secret_mark = '?'; $known_mark = '△'; } elsif ($monster_list_pts{$id} >= 5 && $monster_list_pts{$id} < 10){ #表面的な能力をすべて理解している $name = "" . $name . ""; $category = "$category1($category2)"; $reaction = $reaction; $dark_lv = '?'; $secret_mark = '?'; $known_mark = "○"; } elsif ($monster_list_pts{$id} >= 10){ #全てわかる $name = "" . $name . ""; $category = "$category1($category2)"; $reaction = $reaction; $dark_lv = $dark_lv; if ($text2 eq ''){$secret_mark = '無';} elsif ($text2 ne ''){$secret_mark = '有';} $known_mark = "◎"; } if ($uid eq 2){$id .= '/' . $monster_list_pts{$id};} $out{'list'} .=<<"EOT"; $mon_id$name$category$reaction$dark_lv$secret_mark$known_mark EOT } &html_out('mypage_monster.html'); } #--------------------------------------- # モンスター詳細データ #--------------------------------------- sub monster_data { if ($in{'pcid'} eq ''){&mypage_err("アクセスが不正です。");} if ($in{'mon_id'} eq ''){&mypage_err("モンスターが指定されていません。");} if (substr($in{'mon_id'},0,2) eq 'xm'){$in{'mon_id'} = int(substr($in{'mon_id'},2));} $out{'mon_id'} = &mon_id_rtn($in{'mon_id'}); if ($in{'pcid'} eq ''){$in{'pcid'} = $pcid;} if ($pcid ne $in{'pcid'}){$out{'ot'} = "_other";} $out{'fav_file'} = $in{'fav_file'}; # if ($in{'pcid'} eq 'xa2112' || $in{'pcid'} eq 'xa2601'){ %monster_list_pts = &monster_list_rtn2($in{'pcid'},$in{'mon_id'}); # } # else{ # %monster_list_pts = &monster_list_rtn($in{'pcid'},$in{'mon_id'}); # } if ($monster_list_pts{$in{'mon_id'}} <= 4){&mypage_err("まだ理解できていないので閲覧できません。");} $sql = "select name,category1,category2,undecided_name,reaction,dark_lv,intellect,oblivion,text1,text2,length,weight,lumina,appearance"; $sql .= ",fight_p,shoot_p,reflex,spirit,syugo,resist,hp,a_n,a_t,a_b,a_m,weapon1,weapon2,pow1,pow2,magic,magic2,a_kind,move from monster_master where id = $in{'mon_id'};"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:MD-01エラーが発生しました。"); ($out{'name'},$category1,$category2,$out{'undecided_name'},$out{'reaction'},$out{'dark_lv'},$intellect,$oblivion,$text1,$text2,$length,$weight,$lumina,$appearance ,$out{'fight_p'},$out{'shoot_p'},$out{'reflex'},$out{'spirit'},$out{'syugo'},$out{'resist'},$out{'hp'},$out{'a_n'},$out{'a_t'},$out{'a_b'},$out{'a_m'} ,$weapon1,$weapon2,$pow1,$pow2,$out{'magic'},$magic2,$out{'a_kind'},$out{'move'})=@{$ref->[0]}; if ($out{'name'} eq ''){&mypage_err("指定されたモンスターは存在しません。");} $oblivion = $oblivion / 10; $out{'category'} = "$category1($category2)"; $out{'int'} = @mon_int_str[$intellect]; $out{'length'} = $length / 10; $out{'weight'} = $weight / 10; if (@lumina_str[$lumina] eq ''){$out{'lumina_str'} = '';} else{ if ($lumina eq 9){$out{'lumina_str'} = @lumina_str[$lumina] . 'なルミナ';} elsif ($lumina eq 0){$out{'lumina_str'} = '';} else{$out{'lumina_str'} = @lumina_str[$lumina] . 'のルミナ';} } $out{'lumina_img'} = @myp_lumina[$lumina]; #忘却オーラについて[10=なし 1〜0.9=弱い 0.8〜0.7=あり 0.6〜0.5=やや強い 0.4以下=強い] if ($oblivion >= 10){$out{'ob_str'} = 'なし';} elsif ($oblivion <= 1 && $oblivion >= 0.9){$out{'ob_str'} = '弱い';} elsif ($oblivion <= 0.8 && $oblivion >= 0.7){$out{'ob_str'} = 'あり';} elsif ($oblivion <= 0.6 && $oblivion >= 0.5){$out{'ob_str'} = 'やや強い';} elsif ($oblivion <= 0.4){$out{'ob_str'} = '強い';} $out{'ap_str'} = @appearance_str[$appearance]; $out{'weapon1'} = @mon_weapon_str[$weapon1]; $out{'weapon2'} = @mon_weapon_str[$weapon2]; $gs1 = (@mon_weapon_gs[$weapon1] - $out{'reflex'}) / 10; #&mypage_err("$gs1 = (@mon_weapon_gs[$weapon1] - $out{'reflex'}) / 10"); $gs2 = (@mon_weapon_gs[$weapon2] - $out{'reflex'}) / 10; if ($weapon1 ne '' && $weapon1 ne 0){$out{'weapon1'} .= "($gs1)";} if ($weapon2 ne '' && $weapon2 ne 0){$out{'weapon2'} .= "($gs2)";} # $w_pow1 = @mon_weapon_pow[$weapon1] + $pow1; # $w_pow2 = @mon_weapon_pow[$weapon2] + $pow2; $w_pow1 = $pow1; $w_pow2 = $pow2; if ($weapon1 ne '' && $weapon1 ne 0){$out{'weapon1'} .= "$w_pow1";} if ($weapon2 ne '' && $weapon2 ne 0){$out{'weapon2'} .= "$w_pow2";} if ($out{'weapon1'} ne '' && $weapon1 ne 0){$out{'weapon1'} .= '(' . @mon_weapon_type[$weapon1] . ')';} if ($out{'weapon2'} ne '' && $weapon2 ne 0){$out{'weapon2'} .= '(' . @mon_weapon_type[$weapon2] . ')';} if ($out{'weapon1'} eq ''){$out{'weapon1'} = '−';} if ($out{'weapon2'} eq ''){$out{'weapon2'} = '−';} if ($magic2 ne ''){ @ary_ma = split(/\,/,$magic2); foreach (@ary_ma){ $ma .= @magic_class_str[$_] . " "; } if ($ma ne ''){ chop $ma; $out{'magic'} .= "($ma)"; } } #表示情報の制限 #&mypage_err($in{'mon_id'}); $text1 = &info_link_rtn($text1,'mon','mon_id',$in{'mon_id'}); $out{'text1'} = &newline_change($text1); if ($monster_list_pts{$in{'mon_id'}} < 10){$out{'dark_lv'} = '?';} if ($text2 ne '' && $monster_list_pts{$in{'mon_id'}} >= 10){ $text2 = &info_link_rtn($text2,'mon','mon_id',$in{'mon_id'}); $out{'text2'} = &newline_change($text2); $out{'text2_title'} = '◆秘めたる能力'; } #肖像画 $dbh_st = &connectDB('stars'); $i = 0; @fav_stars_img = (); if($in{'mon_id'} ne ''){ if(length($in{'mon_id'}) < 6){ $monid_wk = '000'.$in{'mon_id'}; $in{'mon_id'} = 'xm'.substr($monid_wk,-4); } $sql = "select a.delivered_filename1,substr(a.delivered_result_date,1,10),a.pcid,b.name from reservation a, creator b where delivered_result = 3 and (pdid = 'G03' or pdid = 'C17') and monster like '%$in{'mon_id'}%' and a.crid=b.id order by seq desc limit 4;"; $ref_st = $dbh_st->selectall_arrayref($sql) or &mypage_err("CODE:ST-01エラーが発生しました。"); foreach(@$ref_st) { ($monster_file,$reg_date,$tmp_pcid,$crname)=@{$_}; ##"" "http://rexi.jp/stars/data/gx" ##"" &err("$monster_file"); ## ($format,$width,$height) = &GetImageSize("/home/rexi-jp/public_html/gx/mypage/fv_portrait/$monster_file"); ($format,$width,$height) = &GetImageSize("/home/rexi-jp/public_html/stars/data/gx_thumbnail/$monster_file"); $th_file = "http://rexi.jp/stars/data/gx_thumbnail/$monster_file"; ## $sfile = "http://rexi.jp/gx/mypage/fv_portrait/$monster_file"; ## if (!-e $sfile){ ## $bfile = "/home/rexi-jp/public_html/stars/data/gx/$file_name"; ## if ($width > $height){ ## system "convert -resize 162 +profile iptc -quality 100% $bfile $sfile"; ## } ## else{ ## system "convert -resize x162 +profile iptc -quality 100% $bfile $sfile"; ## } ## ($format,$width,$height) = &GetImageSize("/home/rexi-jp/public_html/gx/mypage/fv_portrait/$file_name"); ## } $reg_date =~ s/\-/\//g; ## $fav_stars_img[$i] =<<"EOT"; ## ##EOT $fav_stars_img[$i] =<<"EOT"; EOT $fav_stars_crname[$i] = $crname; $fav_stars_reg_date[$i] = $reg_date; ## $fav_stars_comment[$i] = $comment; $fav_stars_w[$i] = $width; $fav_stars_h[$i] = $height; $fav_stars_pcid[$i] = $tmp_pcid; $sql2 = "select name from character where pcid = '$tmp_pcid';"; $ref = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:M-02エラーが発生しました。"); ($tmp_pcname)=@{$ref->[0]}; $fav_stars_pcname[$i] = $tmp_pcname; $i++; } if ($i > 0){ $out{'fav_stars'} =<<"EOT"; ◆肖像画◆ $fav_stars_img[0]$fav_stars_img[1]$fav_stars_img[2]$fav_stars_img[3] $fav_stars_crname[0]$fav_stars_crname[1]$fav_stars_crname[2]$fav_stars_crname[3] $fav_stars_reg_date[0]$fav_stars_reg_date[1]$fav_stars_reg_date[2]$fav_stars_reg_date[3] $fav_stars_pcid[0]$fav_stars_pcid[1]$fav_stars_pcid[2]$fav_stars_pcid[3] $fav_stars_pcname[0]$fav_stars_pcname[1]$fav_stars_pcname[2]$fav_stars_pcname[3] EOT }else{ $out{'fav_stars'} =''; } } &disconDB($dbh_st); &html_out('mypage_mon_other.html'); } #--------------------------------------- # モンスターリスト・ポイントデータ返却 #--------------------------------------- sub monster_list_rtn { my $m_pcid = $_[0]; my $m_mon_id = $_[1]; #シナリオで出会ったモンスターリスト作成 %monster_list_pts = (); $sql = "select b.seq,b.monster,b.playing_close + '2 days',b.monster2 from scenario_member a,scenario b where a.pcid = '$m_pcid' and a.entry_state = 1 and a.scenario_seq = b.seq and b.state = 0 and ((b.monster is not null and b.monster != '') or (b.monster2 is not null and b.monster2 != ''))"; if ($m_mon_id ne ''){$sql .= " and (b.monster like '%$m_mon_id%' or b.monster2 like '%$m_mon_id%')";} $sql .= " and b.playing_close + '2 days' < now()"; $sql .= " order by b.playing_close;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:M-01エラーが発生しました。"); foreach(@$ref) { ($sseq,$monster,$pclose_date,$monster2)=@{$_}; &cal_ability_rtn($out{'pcid'},undef,$sseq,$pclose_date); $pclose_date2 = substr($pclose_date,0,4) . substr($pclose_date,5,2) . substr($pclose_date,8,2); # if ($uid eq 2){&mypage_err("$l_age,$sseq,$pclose_date");} @ary_mons = (); @ary_mons = split(/\,/,$monster); if ($monster2 ne ''){ chomp $monster2; push ary_mons,$monster2; } foreach (@ary_mons){ $mons_id = $_; chomp $mons_id; #ポイント計算 if ($m_mon_id eq '' || ($m_mon_id ne '' && $m_mon_id eq $mons_id)){ if ($monster_list_pts{$mons_id} eq ''){$monster_list_pts{$mons_id} = 0;} $sql2 = "select category1,oblivion from monster_master where id = $mons_id;"; $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:M-02エラーが発生しました。"); ($ct1,$ob)=@{$ref2->[0]}; $ob = $ob / 10; if ($ct1 eq 'エルフィン' && $pclose_date2 <= "20091109"){$ct1 = 'エルフ';} $sk_name = "知識($ct1)"; $sql2 = "select a.lv from skill_scenario a,skill_master b where a.pcid = '$m_pcid' and scenario_seq = $sseq and a.id = b.id and b.name = '$sk_name';"; $ref2 = $dbh->selectall_arrayref($sql2) or &mypage_err("CODE:M-02エラーが発生しました。"); ($s_lv)=@{$ref2->[0]}; $base_point = $t_int + $s_lv + 1; #元値:スキルLv+INT+1 $known_point = int($base_point * $ob); if ($known_point eq 0){$known_point = 1;} $monster_list_pts{$mons_id} += $known_point; # &mypage_err("$id,$sk_name$base_point = $t_int + $s_lv + 1$known_point = int($base_point * $ob)$monster_list_pts{$mons_id}"); } } } return %monster_list_pts; } #--------------------------------------- # モンスターリスト・ポイントデータ返却(軽量版) #--------------------------------------- sub monster_list_rtn2 { my $m_pcid = $_[0]; my $m_mon_id = $_[1]; #シナリオで出会ったモンスターリスト作成 %monster_list_pts = (); $sql = "select mon_id,sum(point) from monster_point where pcid = '$m_pcid'"; if ($m_mon_id ne ''){$sql .= " and mon_id = $m_mon_id";} $sql .= " group by mon_id order by mon_id;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:M-01エラーが発生しました。"); foreach(@$ref) { ($mons_id,$ptn)=@{$_}; #ポイント計算 $monster_list_pts{$mons_id} = $ptn; } return %monster_list_pts; } #--------------------------------------- # 絆設定 #--------------------------------------- sub kizuna { print "Location: ./mypage_kizuna.cgi?mode=kizuna_show&pcid=$out{'pcid'}\n\n"; exit; } #--------------------------------------- # リプレイ表示 #--------------------------------------- sub replay { require '/home/rexi-jp/public_html/gx/lib/scenario.pl'; &date_rtn; if ($in{'seq'} eq ''){&err("不正なパラメータ");} $death_flg = 0; $sql = "select a.type,a.title,a.text,a.comment,op_illust,a.difficulty,a.reserve_close,a.playing_close,a.member_max,b.name,a.npc,a.option1,a.option2,a.option3,a.main_id,a.open_date,"; $sql .= "a.club_seq,a.category,a.replay_open_date + '7 days',a.replay,a.apply_effect,substr(a.playing_close + '2days',1,10),a.cmid,a.comic_open,a.npc_zensin1,a.npc_zensin2,a.show_img from scenario a,master b "; $sql .= "where a.seq = $in{'seq'} and a.apply_state = 5 and a.replay_open_date <= now() and a.replay_open_date is not null"; if ($uid ne 2){$sql .= " and a.msid != 'system'";} $sql .= " and a.state = 0 and a.msid = b.id;"; $ref = $dbh->selectall_arrayref($sql) or &err("CODE:C-02エラーが発生しました。"); ($type,$out{'title'},$out{'text'},$out{'comment'},$out{'op_illust'},$difficulty,$reserve_close,$playing_close,$out{'member_max'},$out{'ms_name'},$npc,$option1,$option2,$option3,$main_id,$open_date,$club_seq,$category,$replay_open_date,$out{'replay_str'},$effect,$playing_close2,$cmid,$comic_open,$npc_zensin1,$npc_zensin2,$show_img)=@{$ref->[0]}; $out{'ms_name'} = &chr_rtn($out{'ms_name'}); if ($cmid ne ''){ $sql = "select name from master where id = '$cmid';"; $ref = $dbh->selectall_arrayref($sql) or &err("CODE:C-02エラーが発生しました。"); ($cmname)=@{$ref->[0]}; $out{'ms_name'} .= '&' . $cmname; } $out{'scc'} = @sc_category_str2[$category]; $out{'type'} = @sc_type_icon[$type]; $out{'type_str'} = @scenario_type[$type]; if ($type eq 4){$out{'beginer'} = '(ビギナー)';} $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($tmp_start,2,8) . ' 24:00'; $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; $playing_close2 =~ s/\-//g; $playing_close2 =~ s/\://g; $playing_close2 =~ s/\ //g; #成否 if ($playing_close2 <= "$g_year$g_mon$g_mday" && $type ne 7){ $out{'effect'} = '../images/scenario/hanamaru_' . $effect . '.png'; } else{ $out{'effect'} = '../images/00_click.gif'; } #オプション if ($option1 > 0 || $option2 eq 1){ $out{'opt'} .=<<"EOT"; ■オプション EOT } if ($option1 > 0){ $out{'opt'} .=<<"EOT"; @option1_list[$option1] EOT } if ($option2 eq 1){ $out{'opt'} .=<<"EOT"; リアルタイム EOT } if ($option3 eq 1){ $sql = "select name from club where seq = $club_seq;"; $ref = $dbh->selectall_arrayref($sql) or &err("CODE:O-01Aエラーが発生しました。"); ($club_name)=@{$ref->[0]}; $out{'club'} =<<"EOT"; 部活$club_name EOT $sql = "select count(*) from club_member where pcid = '$pcid' and club_seq = $club_seq and state = 0;"; $ref = $dbh->selectall_arrayref($sql) or &err("CODE:O-01Bエラーが発生しました。"); ($club_member_flg)=@{$ref->[0]}; if ($club_member_flg eq ''){$club_member_flg = 0;} } #リアルタイム if ($option2 eq 1){ $opt .= ''; } #おまかせ if ($option1 eq 1){ $opt .= ''; } elsif ($option1 eq 2){ #お任せ&プレイング非公開 $opt .= ''; } if ($opt ne ''){ $out{'opt_list'} =<<"EOT"; オプション $opt EOT } if ($npc ne ''){ @ary_npc = split(/\,/,$npc); $out{'npc'} .=<<"EOT"; ■登場NPC EOT $n = 0; foreach (@ary_npc){ $npcid = $_; chomp $npcid; $sql = "select pcid,name,sex,birth,class,lumina,zensin,race from character where pcid = '$npcid';"; $ref = $dbh->selectall_arrayref($sql) or &err("CODE:O-01エラーが発生しました。"); ($n_pcid,$n_name1,$n_sex,$n_birth,$n_class,$n_lumina,$n_zensin,$n_race)=@{$ref->[0]}; if ($show_img eq ''){ if ($n eq 0 && $npc_zensin1 ne ''){$n_zensin = $npc_zensin1;} elsif ($n eq 1 && $npc_zensin2 ne ''){$n_zensin = $npc_zensin2;} if ($n_zensin ne '' && ($#ary_npc < 2 || $out{'zensin'} eq '')){ @a = split(/\//,$n_zensin); ($format,$width,$height) = &GetImageSize("/home/rexi-jp/public_html/gx/images/npc/@a[$#a]"); $out{'zensin'} =<<"EOT"; EOT } } if($n_race ne 6){ if ($n_birth ne ''){ $n_age = &calcAge($n_birth); } }else{ $n_age = '?'; } if ($n_age eq ''){$n_age = '?';} if ($n_sex eq 1){$n_sex = '♂';} elsif ($n_sex eq 2){$n_sex = '♀';} $npc_url =<<"EOT"; $n_name1($npcid)・$n_sex・$n_age歳・@class_str[$n_class]・@lumina_str[$n_lumina] EOT $out{'npc'} .=<<"EOT"; $npc_url EOT } } if ($npc_zensin1 eq '' && $npc_zensin2 eq '' && $show_img eq ''){$out{'zensin'} = '';} if ($show_img ne ''){ $n_file = "/home/rexi-jp/public_html/" . substr($show_img,15); ($format,$width,$height) = &GetImageSize($n_file); $out{'zensin'} =<<"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("CODE:O-01Aエラーが発生しました。"); ($mcnt)=@{$ref->[0]}; if ($mcnt eq ''){$mcnt = 0;} $out{'now_member_num'} = $mcnt; $out{'sup_num'} = 0; if ($type eq 5){ $out{'member_max'} = '―'; } $sql = "select b.pcid,b.name,b.sex,b.birth,b.class,b.lumina,b.race 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 &mypage_err("エラーが発生しました。"); $i = 0; $total_i = 0; foreach(@$ref) { ($m_pcid,$m_name1,$m_sex,$m_birth,$m_class,$m_lumina,$m_race)=@{$_}; if($m_race ne 6){ $m_age = &calcAge($m_birth); }else{ $m_age = '?'; } if ($m_sex eq 1){$m_sex = '♂';} elsif ($m_sex eq 2){$m_sex = '♀';} $out{'reserve_member'} .=<<"EOT"; $m_name1($m_pcid) EOT } $out{'text'} =~ s/\n//g; $out{'ms_comment'} =~ s/\n//g; @rep_dat = split(/\n/,$out{'replay_str'}); $out{'replay_str'} =~ s/\n//g; &date_rtn; $replay_open_date =~ s/\-//g; $replay_open_date = substr($replay_open_date,0,8); $playing_flg = 0; if ($replay_open_date >= "$g_year$g_mon$g_mday"){$playing_flg = 1;} #参加者一覧 $out{'mem_num'} = 0; @member_pcid = (); $sql = "select b.pcid,b.name,b.sex,b.birth,b.race 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("CODE:R-01エラーが発生しました。"); foreach(@$ref) { ($m_pcid,$m_name1,$m_sex,$m_birth,$m_race)=@{$_}; push member_pcid,$m_pcid; if($m_race ne 6){ $m_age = &calcAge($m_birth); }else{ $m_age = '?'; } if ($m_sex eq 1){$m_sex = '♂';} elsif ($m_sex eq 2){$m_sex = '♀';} if ($type ne 3 && $type ne 5){ $out{'member'} .=<<"EOT"; $m_name1($m_pcid)・$m_sex・$m_age EOT } $out{'mem_num'}++; } $i = 0; $sql = "select a.pcid,a.file,a.url,b.name,c.crname,a.replay_row,a.left_right from scenario_pinup a,character b,stars_data c where a.scenario_seq = $in{'seq'} and a.pcid = b.pcid and a.file = c.file_name order by a.reg_date desc;"; $ref = $dbh->selectall_arrayref($sql) or &err("エラーが発生しました。"); %rep_pin = (); %rep_pin_lr = (); %rep_pin_pcid = (); foreach(@$ref) { ($p_pcid,$file,$url,$p_name1,$crname,$replay_row,$left_right)=@{$_}; $rep_pin{$replay_row} = $file; $rep_pin_lr{$replay_row} = $left_right; $rep_pin_pcid{$replay_row} = $p_pcid; } $out{'pin'} = ''; $r = 1; $out{'replay_str'} = ''; foreach(@rep_dat){ $r_tmp = $_; foreach(@member_pcid){ $mem_pcid = $_; $mem_pcid2 = "(" . $mem_pcid . ')'; $r_tmp =~ s/($mem_pcid)/$mem_pcid2/g; } if ($rep_pin{$r} ne ''){ if ($rep_pin_lr{$r} eq 1){ $rep_p = &rep_pin_size($rep_pin{$r}); $out{'replay_str'} .=<<"EOT"; $r_tmp EOT } elsif ($rep_pin_lr{$r} eq 2){ $rep_p = &rep_pin_size($rep_pin{$r}); $out{'replay_str'} .=<<"EOT"; $r_tmp EOT } else{$out{'replay_str'} .= $r_tmp . '';} } else{$out{'replay_str'} .= $r_tmp . '';} $r++; } if ($rep_pin{0} ne 0){ $rep_p = &rep_pin_size($rep_pin{0}); if ($rep_pin_lr{0} eq 1){$out{'replay_str'} .= "" . '';} elsif ($rep_pin_lr{0} eq 2){$out{'replay_str'} .= "" . '';} } if ($in{'seq'} eq 965){ if (index($ENV{'HTTP_USER_AGENT'},'Safari') < 0 || index($ENV{'HTTP_USER_AGENT'},'Chrome') > 0){ $out{'reserve_member'} .=<<"EOT"; EOT } # else{ # $out{'reserve_member'} .=<<"EOT"; # # #EOT # } } #if ($uid eq 2){&mypage_err("$type,$comic_open");} if ($type >= 8 && $comic_open ne ''){ if (index($ENV{'HTTP_USER_AGENT'},'Safari') < 0 || index($ENV{'HTTP_USER_AGENT'},'Chrome') > 0){ $out{'reserve_member'} .=<<"EOT"; EOT } # else{ # $out{'reserve_member'} .=<<"EOT"; # # #EOT # } } if ($type eq 5){$html_file = 'mypage_replay_xh.html';} elsif ($type eq 10 || $type eq 11){$html_file = 'mypage_replay_comic.html';} else{$html_file = 'mypage_replay.html';} &out_enc; &html_out($html_file); } #--------------------------------------- # ピンナップサイズ調整 #--------------------------------------- sub rep_pin_size { my $rep_p_file = $_[0]; $p_file1 = "/home/rexi-jp/public_html/stars/data/gx/" . $rep_p_file; $p_file2 = "/home/rexi-jp/public_html/gx/scenario/rep_pin_sum/" . $rep_p_file; $rtn_file = "http://rexi.jp/stars/data/gx/$rep_p_file"; ($format,$width,$height) = &GetImageSize($p_file1); if ($width > 350){ if (!-e $p_file2){ system "convert -resize 350 +profile iptc -quality 100% $p_file1 $p_file2"; } $rtn_file = "http://rexi.jp/gx/scenario/rep_pin_sum/$rep_p_file"; } return $rtn_file; } #--------------------------------------- # シナリオ結果表示 #--------------------------------------- sub scenario_result { if ($in{'seq'} eq ''){&mypage_err("シナリオが選択されていません。");} require '/home/rexi-jp/public_html/gx/lib/scenario.pl'; $sql = "select b.title,b.type,b.apply_effect,b.playing_close + '1 days',b.playing_close + '4 days' from scenario_member a,scenario b where a.scenario_seq = $in{'seq'} and a.pcid = '$pcid' and a.entry_state = 1 and a.scenario_seq = b.seq and b.scenario_reflection = 1;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:TC-01エラーが発生しました。"); ($out{'title'},$type,$apply_effect,$p2d,$p3d)=@{$ref->[0]}; # elsif ($apply_effect eq 2){$apply_effect = '成功';} # elsif ($apply_effect eq 3){$apply_effect = '普通';} # elsif ($apply_effect eq 4){$apply_effect = '失敗';} if ($apply_effect eq 0 || $apply_effect eq ''){$apply_effect = 'ふつうです';} else{$apply_effect = @effect_str[$apply_effect];} $res_dir = "/home/rexi-jp/public_html/master_gx/scenario_result/"; $appry_wound_file = $res_dir . $in{'seq'} . "/wound.dat"; $appry_wound = ''; if (-e $appry_wound_file){ open FILE,"$appry_wound_file"; while(){ $tmp = $_; chomp $tmp; if ($tmp ne ''){ $appry_wound .= ',' . $tmp; } } close FILE; } $appry_item_damage_file = $res_dir . $in{'seq'} . "/item1.dat"; $appry_item_damage = ''; if (-e $appry_item_damage_file){ open FILE,"$appry_item_damage_file"; while(){ $tmp = $_; chomp $tmp; if ($tmp ne ''){ $apply_item_damage .= ',' . $tmp; } } close FILE; } $apply_item_lost_file = $res_dir . $in{'seq'} . "/item2.dat"; $apply_item_lost = ''; if (-e $apply_item_lost_file){ open FILE,"$apply_item_lost_file"; while(){ $tmp = $_; chomp $tmp; if ($tmp ne ''){ $apply_item_lost .= ',' . $tmp; } } close FILE; } if ($appry_wound ne ''){ @tmp_wound = (); @tmp_wound = split(/\,/,$appry_wound); foreach(@tmp_wound){ $tmp = $_; if ($tmp ne ''){ chomp $tmp; @a = (); @a = split(/\:/,$tmp); if (@a[0] eq $pcid){ $damage = @damage_str[@a[1]]; } } } } if ($apply_item_damage ne ''){ @tmp_a = (); @tmp_a = split(/\,/,$apply_item_damage); foreach(@tmp_a){ $tmp = $_; if ($tmp ne ''){ chomp $tmp; @a = (); @a = split(/\:/,$tmp); if (@a[0] eq $pcid){ $sql = "select b.name from item a,item_master b where a.seq = @a[1] and a.pcid = '@a[0]' and a.id = b.id;"; $ref = $dbh->selectall_arrayref($sql) or $errflg = 1; ($item_name)=@{$ref->[0]}; $damage_item .= $item_name . ","; } } } } if ($apply_item_lost ne ''){ @tmp_a = (); @tmp_a = split(/\,/,$apply_item_lost); foreach(@tmp_a){ $tmp = $_; if ($tmp ne ''){ chomp $tmp; @a = (); @a = split(/\:/,$tmp); if (@a[0] eq $pcid){ $sql = "select b.name from item a,item_master b where a.seq = @a[1] and a.pcid = '@a[0]' and a.id = b.id;"; $ref = $dbh->selectall_arrayref($sql) or $errflg = 1; ($item_name)=@{$ref->[0]}; $lost_item .= $item_name . ","; } } } } $sql = "select a.seq,b.name,b.consumption from item_scenario a,item_master b where a.scenario_seq = $in{'seq'} and a.pcid = '$pcid' and a.id = b.id and b.consumption in (3,4);"; $ref = $dbh->selectall_arrayref($sql) or $err_str = $dbh->errstr; foreach(@$ref) { ($itm_seq,$item_name,$item_consumption)=@{$_}; if ($item_consumption eq 3){ $damage_item .= $item_name . ","; } elsif ($item_consumption eq 4){ $lost_item .= $item_name . ","; } } #&err("$damage_item$lost_item"); $sql = "select a.item_id,b.name from distribution_item a,item_master b where a.pcid = '$pcid' and a.scenario_seq = $in{'seq'} and a.reflection = 1 and a.item_id = b.id order by a.item_id;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:TC-01BXエラーが発生しました。"); foreach(@$ref) { ($item_id,$item_name)=@{$_}; $issue_item .= $item_name . ","; } #### $sql = "select a.content,b.name from log a,item_master b where a.pcid = '$pcid' and a.date >= to_timestamp('$p2d','yyyy-mm-dd hh24:mi:ss') and a.date <= to_timestamp('$p3d','yyyy-mm-dd hh24:mi:ss') and a.ip = '$out{'title'}' and a.head = 'アイテム反映' and a.content = b.id order by a.content;"; $sql = "select a.content,b.name from log a,item_master b where a.pcid = '$pcid' and substr(a.date,1,10) >= substr(to_timestamp('$p2d','yyyy-mm-dd'),1,10) and substr(a.date,1,10) <= substr(to_timestamp('$p3d','yyyy-mm-dd'),1,10) and a.ip = '$out{'title'}' and a.head = 'アイテム反映' and a.content = b.id order by a.content;"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:TC-01Aエラーが発生しました。"); foreach(@$ref) { ($item_id,$item_name)=@{$_}; $issue_item .= $item_name . ","; } if ($damage_item ne ''){chop $damage_item;} if ($lost_item ne ''){chop $lost_item;} if ($issue_item ne ''){chop $issue_item;} ## $sql = "select content from log where pcid = '$pcid' and date >= to_timestamp('$p2d','yyyy-mm-dd hh24:mi:ss') and date <= to_timestamp('$p3d','yyyy-mm-dd hh24:mi:ss') and (head = '結果反映' or head = '訓練結果反映') and content like '%title:$out{'title'}%';"; $sql = "select content from log where pcid = '$pcid' and substr(date,1,10) >= substr(to_timestamp('$p2d','yyyy-mm-dd'),1,10) and substr(date,1,10) <= substr(to_timestamp('$p3d','yyyy-mm-dd'),1,10) and (head = '結果反映' or head = '補習結果反映') and content like '%title:$out{'title'}%';"; $ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:TC-01Bエラーが発生しました。"); ($content)=@{$ref->[0]}; @res_list = (); @res_list = split(/\,/,$content); @tmp_a = (); @tmp_a = split(/\:/,@res_list[1]); if (@tmp_a[0] eq 'up_tp'){$out{'up_tp'} = @tmp_a[1];} @tmp_b = (); @tmp_b = split(/\:/,@res_list[2]); if (@tmp_b[0] eq 'up_cp'){ $out{'up_cp'} = @tmp_b[1]; $out{'up_cp'} = $out{'up_cp'} / 10; } $body =<<"EOT"; シナリオ名:$out{'title'} EOT if ($type ne 7){ $body .=<<"EOT"; 成否:$apply_effect EOT } if ($out{'up_tp'} ne ''){ $body .=<<"EOT"; 取得TP:$out{'up_tp'} EOT } if ($out{'up_cp'} ne ''){ $body .=<<"EOT"; 取得CP:$out{'up_cp'} EOT } if ($issue_item ne ''){ $body .=<<"EOT"; 取得アイテム:$issue_item EOT } if ($type ne 7 && $damage_item ne ''){ $body .=<<"EOT"; 破損アイテム:$damage_item EOT } if ($type ne 7 && $lost_item ne ''){ $body .=<<"EOT"; 損失アイテム:$lost_item EOT } if ($damage ne ''){ $body .=<<"EOT"; 負傷:$damage EOT } $body .=<<"EOT"; EOT &mypage_err($body); }