#!/usr/bin/perl
require '/home/rexi-jp/public_html/jj/lib/lib.pl';
require '/home/rexi-jp/public_html/jj/lib/mypage.pl';
$mycgi = 'mypage_info.cgi';
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);
}
if ($in{'mode'} eq ''){
&html_out;
exit;
}
$uid = &get_usr_cookie;
$dbh = &connectDB($mainDB);
if ($in{'mode'} eq 'skill'){
&skill;
}
elsif ($in{'mode'} eq 'item'){
&item;
}
elsif ($in{'mode'} eq 'esp'){
&esp;
}
elsif ($in{'mode'} eq 'sps'){
&sps;
}
elsif ($in{'mode'} eq 'sp_attack'){
&sp_attack;
}
elsif ($in{'mode'} eq 'free_set'){
&free_set;
}
elsif ($in{'mode'} eq 'fault'){
&fault;
}
else{
&html_out("不正なパラメータ");
}
&disconDB($dbh);
exit;
#---------------------------------------
# HTML出力
#---------------------------------------
sub html_out {
$out{'body'} = $_[0];
$Ret = &Jcode::getcode( $out{'body'} ) ;
if ($Ret eq 'euc'){
&Jcode::convert(\$out{'body'},'sjis');
}
open FILE,"mypage_info.html";
print $header;
while(){
s/!(\w+)!/$out{$1}/g;
print;
}
close FILE;
exit;
}
#---------------------------------------
# スキル表示
#---------------------------------------
sub skill {
$sql = "select name,info from skill_master where id = $in{'id'};";
$ref = $dbh->selectall_arrayref($sql) or &html_out("エラーが発生しました。");
($name,$info)=@{$ref->[0]};
$info =~ s/\n/
/g;
$body =<<"EOT";
$name
$info
EOT
&html_out($body);
}
#---------------------------------------
# アイテム表示
#---------------------------------------
sub item {
# $sql = "select b.name,b.text from item_master b where b.id = $in{'id'};";
$sql = "select a.original_info,b.name,b.text,b.power,b.kind,a.form,a.damage_flg,a.equip,b.weapon_category from item a,item_master b where a.seq = $in{'seq'} and a.pcid = '$in{'pcid'}' and a.id = b.id;";
if ($in{'sseq'} ne ''){
$sql = "select a.original_info,b.name,b.text,b.power,b.kind,a.form,a.damage_flg,a.equip,b.weapon_category from item_scenario a,item_master b where a.scenario_seq = $in{'sseq'} and a.seq = $in{'seq'} and a.pcid = '$in{'pcid'}' and a.id = b.id;";
}
if ($in{'type'} eq 'arms'){
$sql = "select '',b.name,b.text,b.power,b.kind,set_seq,a.damage_flg,a.equip,b.weapon_category from base_item a,item_master b where a.seq = $in{'seq'} and a.base_seq = $in{'base_seq'} and a.id = b.id;";
}
$ref = $dbh->selectall_arrayref($sql) or &html_out("エラーが発生しました。");
($original_info,$name,$text,$power,$kind,$form,$damage_flg,$equip,$weapon_category)=@{$ref->[0]};
# if ($original_info ne ''){$text = $original_info;}
if ($original_info ne '' && ($equip ne 12 || $kind eq '小型ロボ' || $kind eq '騎乗動物')){
$oflg = 1;
$text .=<<"EOT";
[オリジナル解説]
$original_info
EOT
}
elsif ($original_info ne '' && $equip eq 12 && $kind ne '小型ロボ'){$text = $original_info;}
if ($power ne '' && $power ne '−' && $power ne 0){
$sql = "select name1,name2,name3,name4,age,sex,class,attribute,birth,hometown,position,figure,training,fame,height,weight from character where pcid = '$in{'pcid'}';";
if ($in{'sseq'} ne ''){
$sql = "select name1,name2,name3,name4,age,sex,class,attribute,birth,hometown,position,figure,training,fame,height,weight from character_scenario where scenario_seq = $in{'sseq'} and pcid = '$in{'pcid'}';";
}
$ref = $dbh->selectall_arrayref($sql) or &mypage_err("エラーが発生しました。");
($name1,$name2,$name3,$name4,$age,$sex,$class,$attribute,$birth,$hometown,$position,$figure,$training,$fame,$height,$weight)=@{$ref->[0]};
&cal_ability($in{'pcid'},$age,$name1,$name3,$training,$sex,$hometown,$class,$figure,$fame,$height,$weight,1);
# &cal_ability($in{'pcid'},$age,$name1,$name3,$training,$sex,$hometown,$class,$figure,$fame,$height,$weight);
if ($kind eq '格闘武器' || $kind eq '投擲武器'){
$power1 = int($power) + $s1_5;
$power2 = int($power) + $s2_5;
$tmp2 .= "
$power1 = int($power) + $s1_5
$power2 = int($power) + $s2_5";
# if ($uid eq 4){&html_out("$power1 = $power + $s1_5
$power2 = $power + $s2_5
&cal_ability($in{'pcid'},$age,$name1,$name3,$training,$sex,$hometown,$class,$figure,$fame,$height,$weight,1)");}
if ($form eq 0){$power = "威力:$power2 / $power1
";}
elsif ($form eq 1){$power = "威力:− / $power1
";}
elsif ($form eq 2){$power = "威力:$power2 / −
";}
}
else{
$power = "威力:$power
";
}
# if ($in{'pcid'} eq 'ja0479'){$power .= ",$power";}
}
else{$power = '';}
$text =~ s/\n/
/g;
if ($oflg ne 1){
$sql = "select txt from free_set where pcid = '$in{'pcid'}' and item_seq = $in{'seq'} and result = 1;";
if ($in{'sseq'} ne ''){
$sql = "select txt from free_set_scenario where scenario_seq = $in{'sseq'} and pcid = '$in{'pcid'}' and item_seq = $in{'seq'};";
}
$ref = $dbh->selectall_arrayref($sql) or &html_out("エラーが発生しました。");
($txt)=@{$ref->[0]};
if ($txt ne ''){
$info3 =<<"EOT";
[オリジナル解説]
$txt
EOT
$info3 =~ s/\n/
/g;
}
}
# if ($damage_flg eq 1 && ($uid eq 4 || $uid eq 2)){
if ($damage_flg eq 1){
$d =<<"EOT";
※破損中により使用不可。
EOT
}
else{$d = '';}
@wpc = split(/\,/, $weapon_category);
foreach (@wpc){
$wcid = $_;
$wcstr .= @weapon_category_str[$wcid] . '/';
}
if ($wcstr ne ''){$wcstr = substr($wcstr,0,-2);}
$body =<<"EOT";
$name
$d
種類:$kind
EOT
if ($wcstr ne ''){
$body .=<<"EOT";
系統:$wcstr
EOT
}
if ($uid ne 2){$tmp2 = '';}
$body .=<<"EOT";
$power
$text
$info3
$tmp2
EOT
&html_out($body);
}
#---------------------------------------
# ESP表示
#---------------------------------------
sub esp {
$sql = "select name1,name2,name3,name4,age,sex,class,attribute,birth,hometown,position,figure,training,height,weight,fame from character where pcid = '$in{'pcid'}';";
if ($in{'sseq'} ne ''){
$sql = "select name1,name2,name3,name4,age,sex,class,attribute,birth,hometown,position,figure,training,height,weight,fame from character_scenario where scenario_seq = $in{'sseq'} and pcid = '$in{'pcid'}';";
}
$ref = $dbh->selectall_arrayref($sql) or &mypage_err("エラーが発生しました。");
($name1,$name2,$name3,$name4,$age,$sex,$class,$attribute,$birth,$hometown,$position,$figure,$training,$height,$weight,$fame)=@{$ref->[0]};
$age = &calcAge($birth);
$name1 = &chr_rtn($name1);
$name3 = &chr_rtn($name3);
&cal_ability($in{'pcid'},$age,$name1,$name3,$training,$sex,$hometown,$class,$figure,$fame,$height,$weight,undef,$in{'sseq'});
# &cal_ability($out{'pcid'},$out{'age'},$out{'name1'},$out{'name3'},$training,$sex,$out{'hometown'},$class,$figure,$fame,$out{'height'},$out{'weight'});
$sql = "select a.type,b.name,b.txt,b.txt2,b.txt3,b.txt4 from esp a,esp_easy_master b where a.no = $in{'id'} and a.pcid = '$in{'pcid'}' and a.no = b.id;";
if ($in{'sseq'} ne ''){
$sql = "select a.type,b.name,b.txt,b.txt2,b.txt3,b.txt4 from esp_scenario a,esp_easy_master b where a.scenario_seq = $in{'sseq'} and a.no = $in{'id'} and a.pcid = '$in{'pcid'}' and a.no = b.id;";
}
$ref = $dbh->selectall_arrayref($sql) or &html_out("エラーが発生しました。");
($type,$name,$text,$text2,$text3,$text4)=@{$ref->[0]};
if ($type eq 4){$ty = 18;}
else{$ty = $type;}
$sql = "select lv from skill where pcid = '$in{'pcid'}' and id = $ty;";
if ($in{'sseq'} ne ''){
$sql = "select lv from skill_scenario where scenario_seq = $in{'sseq'} and pcid = '$in{'pcid'}' and id = $ty;";
}
$ref = $dbh->selectall_arrayref($sql) or &html_out("エラーが発生しました。");
($lv)=@{$ref->[0]};
$rk1 = &skill_rank($s1_3,$lv);
$rk2 = &skill_rank($s2_3,$lv);
$rk_pt1 = &skill_rank($s1_3,$lv,1);
$rk_pt2 = &skill_rank($s2_3,$lv,1);
# if ($uid eq 2){$tmp = "
type:$type,lv:$lv
s1_3:$s1_3,s2_3:$s2_3
rk1:$rk1,rk2:$rk2
rk_pt1:$rk_pt1,rk_pt2,$rk_pt2
$sql
$in{'pcid'},$age,$name1,$name3,$training,$sex,$hometown,$class,$figure,$fame,$height,$weight";}
if (substr($rk1,0,2) eq substr($rk2,0,2)){
if (substr($rk1,0,2) eq '初'){$text = '初級
' . $text;}
elsif (substr($rk1,0,2) eq '専'){$text = '専門
' . $text2;}
elsif (substr($rk1,0,2) eq '達'){$text = '達人
' . $text3;}
elsif (substr($rk1,0,2) eq '超'){$text = '超越
' . $text4;}
}
else{
if (substr($rk1,0,2) eq '初'){$text_1 = '初級
' . $text;}
elsif (substr($rk1,0,2) eq '専'){$text_1 = '専門
' . $text2;}
elsif (substr($rk1,0,2) eq '達'){$text_1 = '達人
' . $text3;}
elsif (substr($rk1,0,2) eq '超'){$text_1 = '超越
' . $text4;}
if (substr($rk2,0,2) eq '初'){$text_2 = '初級
' . $text;}
elsif (substr($rk2,0,2) eq '専'){$text_2 = '専門
' . $text2;}
elsif (substr($rk2,0,2) eq '達'){$text_2 = '達人
' . $text3;}
elsif (substr($rk2,0,2) eq '超'){$text_2 = '超越
' . $text4;}
$text = $text_2 . "\n\n" . $text_1;
}
chomp $text;
$text =~ s/解説:\n//g;
$text =~ s/\n/
/g;
$body =<<"EOT";
$name
$text
$tmp
EOT
&html_out($body);
}
#---------------------------------------
# スペシャルステータス表示
#---------------------------------------
sub sps {
$sps = @sp_status_info[$in{'id'}];
$sps =~ s/\n/
/g;
$body =<<"EOT";
@sp_status_name[$in{'id'}]
$sps
EOT
&html_out($body);
}
#---------------------------------------
# 必殺技表示
#---------------------------------------
sub sp_attack {
$tbl = "sp_attack";
$sql = "select seq,original_name,routes,base_kind,item_seq,info,trait,item_id,weapon_category,skill_id from sp_attack where pcid = '$in{'pcid'}' and seq = $in{'seq'};";
if ($in{'training'} eq 1){
$sql = "select seq,original_name,routes,base_kind,item_seq,info,set_sa,item_id,'',skill_id,base_seq from tokkun where pcid = '$in{'pcid'}' and seq = $in{'seq'};";
}
else{
if ($in{'sseq'} ne ''){
$sql = "select seq,original_name,routes,base_kind,item_seq,info,trait,item_id,weapon_category,skill_id from sp_attack_scenario where scenario_seq = $in{'sseq'} and pcid = '$in{'pcid'}' and seq = $in{'seq'};";
}
}
$ref = $dbh->selectall_arrayref($sql) or &html_out("CODE:SP-01
エラーが発生しました。");
($spa_seq,$original_name1,$routes,$base_kind,$item_seq,$info,$trait,$item_id,$weapon_category,$skill_id,$base_seq)=@{$ref->[0]};
# if ($uid eq 2){&html_out("$base_seq");}
if ($in{'training'} eq 1 && $base_seq ne ''){
$sql = "select weapon_category from sp_attack where pcid = '$in{'pcid'}' and seq = $base_seq;";
$ref = $dbh->selectall_arrayref($sql) or &html_out("CODE:SP-01
エラーが発生しました。");
($weapon_category)=@{$ref->[0]};
}
# if ($uid eq 2){&err($weapon_category);}
if ($base_seq ne ''){
$add_trait = $trait;
$sql = "select original_name,routes,base_kind,item_seq,info,trait,item_id,skill_id from sp_attack where seq = $base_seq;";
$ref = $dbh->selectall_arrayref($sql) or &html_out("CODE:SP-02
エラーが発生しました。");
($original_name1,$routes,$base_kind,$item_seq,$info,$trait,$item_id,$skill_id)=@{$ref->[0]};
# if ($uid eq 2){&html_out("$routes,$base_kind,$item_seq,$info,$trait,$item_id,$skill_id");}
$trait .= ',' . $add_trait;
@bt = ();
@bt = split(/\,/, $add_trait);
foreach (@bt){
$bid = $_;
$sql = "select info from sa_trait where id = $bid;";
$ref = $dbh->selectall_arrayref($sql) or &html_out("CODE:SP-03
エラーが発生しました。");
($sa_info)=@{$ref->[0]};
$info .= "\n" . $sa_info;
}
# if ($uid eq 2){&mypage_err("$trait:$add_trait");}
}
# if ($form eq ''){$form = 0;}
$sql = "select name1,name2,name3,name4,age,sex,class,attribute,bustup1,bustup2";
$sql .= ",birth,motif,hometown,position,first,second,tone,figure,skin,hair,eye";
$sql .= ",main_color,sub_color1,sub_color2,height,weight,wheight,wweight,exp,fame";
if ($in{'sseq'} ne ''){
$sql .= ",training,sp,substr(ins_date,1,10) from character_scenario where scenario_seq = $in{'sseq'} and pcid = '$in{'pcid'}';";
}
else{
$sql .= ",training,sp,substr(ins_date,1,10) from character where pcid = '$in{'pcid'}';";
}
$ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:SP-04
エラーが発生しました。");
($out{'name1'},$out{'name2'},$out{'name3'},$out{'name4'},$out{'age'},$sex,$class,$attribute,$out{'bustup1'},$out{'bustup2'}
,$birth,$out{'motif'},$out{'hometown'},$position,$out{'first'},$out{'second'},$out{'tone'},$figure,$out{'skin'},$out{'hair'},$out{'eye'}
,$out{'main_color'},$out{'sub_color1'},$out{'sub_color2'},$out{'height'},$out{'weight'},$out{'wheight'},$out{'wweight'},$out{'exp'},$fame
,$training,$out{'sp'},$ins_date)=@{$ref->[0]};
$out{'age'} = &calcAge($birth);
#選択された基本の情報表示
@at = ();
@at = split(/\,/, $trait);
$per_a = 1;
$aflg_1 = 0;
$aflg_2 = 0;
foreach (@at){
$aid = $_;
if ($aid ne ''){
$per_t = 1;
$sql = "select attack from sa_trait where id = $aid;";
if ($uid eq 2){$dbgm = "$sql";}
$ref = $dbh->selectall_arrayref($sql) or &html_out("CODE:SP-05
エラーが発生しました。$dbgm");
($attack)=@{$ref->[0]};
$attack =~ s/\×//g;
$attack =~ s/\n//g;
$attck_str .= $attack.'
';
if ($attack eq '' || $attack eq '−' || $attack eq 0){$per_t = 1;}
elsif ($attack eq '重量+'){
$aflg_1 = 1;
$per_t = 1;
}
elsif ($attack eq '体重*0.15+'){
$aflg_2 = 1;
$per_t = 1;
}
else{
$per_t = $attack;
}
if ($uid eq 2){$tmp2 .= "
$aid,per_a:$per_a,per_t:$per_t";}
$per_a = $per_a * $per_t;
}
}
$sql = "select lv from skill where pcid = '$in{'pcid'}' and id = 4;"; #格闘
$ref = $dbh->selectall_arrayref($sql) or &html_out("CODE:SP-06
エラーが発生しました。");
($kakutou_lv)=@{$ref->[0]};
$sql = "select lv from skill where pcid = '$in{'pcid'}' and id = 5;"; #射撃
$ref = $dbh->selectall_arrayref($sql) or &html_out("CODE:SP-07
エラーが発生しました。");
($syageki_lv)=@{$ref->[0]};
if ($base_kind eq 0){ #アイテム
$flg = 0;
if ($weapon_category eq ''){
$sql = "select a.original_name,b.name,a.equip,a.form,b.kind,b.parts,b.power,b.weight from item a,item_master b where a.pcid = '$in{'pcid'}' and a.id = $item_id and a.equip > 0 and a.state = 0 and a.id = b.id;";
if ($in{'sseq'} ne ''){
$sql = "select a.original_name,b.name,a.equip,a.form,b.kind,b.parts,b.power,b.weight from item_scenario a,item_master b where a.scenario_seq = $in{'sseq'} and a.pcid = '$in{'pcid'}' and a.id = $item_id and a.equip > 0 and a.id = b.id;";
}
$ref = $dbh->selectall_arrayref($sql) or &html_out("CODE:SP-08
エラーが発生しました。");
($original_name,$name,$equip,$form,$kind,$parts,$power,$weight)=@{$ref->[0]};
if ($equip eq 0 || $equip eq ''){$flg = 1;}
if ($power eq '' || $power eq '−' || $power eq 0){$power = 0;}
if ($original_name ne ''){$name = $original_name;}
if ($name eq ''){
$sql = "select name from item_master where id = $item_id;";
$ref = $dbh->selectall_arrayref($sql) or &html_out("CODE:SP-08
エラーが発生しました。");
($name)=@{$ref->[0]};
}
}
#拡大
elsif ($weapon_category ne ''){
$name = @weapon_category_str[$weapon_category];
$kind = substr($name,0,8);
($iname,$i_power1,$i_power2,$k_power1,$k_power2,$i_weight_str1,$i_weight_str2) = &sa_kakudai($weapon_category);
# if ($uid eq 2){&html_out($i_weight2);}
if ($i_power1 eq '' && $i_power2 eq ''){$flg = 1;}
else{$flg = 0;}
$name .= $iname;
}
if ($parts eq 1){
&cal_ability($in{'pcid'},$out{'age'},$out{'name1'},$out{'name3'},$training,$sex,$out{'hometown'},$class,$figure,$fame,$out{'height'},$out{'weight'},1);
$punch1 = $s1_5;
$punch2 = $s2_5;
$kick1 = $s1_6;
$kick2 = $s2_6;
$a1 = $s1_7 * $per_a;
$a2 = $s2_7 * $per_a;
$bpower = "− / $a2";
$k_rk1 = &skill_rank($s1_1,$kakutou_lv);
$k_rk2 = &skill_rank($s2_1,$kakutou_lv);
$s_rk1 = &skill_rank($s1_2,$syageki_lv);
$s_rk2 = &skill_rank($s2_2,$syageki_lv);
$batk = "− / $k_rk2";
}
elsif ($kind eq '格闘武器'){
&cal_ability($in{'pcid'},$out{'age'},$out{'name1'},$out{'name3'},$training,$sex,$out{'hometown'},$class,$figure,$fame,$out{'height'},$out{'weight'},1);
$punch1 = $s1_5;
$punch2 = $s2_5;
$kick1 = $s1_6;
$kick2 = $s2_6;
$a1 = int(($punch1 + int($power)) * $per_a);
$a2 = int(($punch2 + int($power)) * $per_a);
if ($aflg_1 eq 1){
$a1 += $weight;
$a2 += $weight;
}
$k_rk1 = &skill_rank($s1_1,$kakutou_lv);
$k_rk2 = &skill_rank($s2_1,$kakutou_lv);
$k_rk1pt = &skill_rank($s1_1,$kakutou_lv,1);
$k_rk2pt = &skill_rank($s2_1,$kakutou_lv,1);
$s_rk1 = &skill_rank($s1_2,$syageki_lv);
$s_rk2 = &skill_rank($s2_2,$syageki_lv);
if ($flg eq 1){
$bpower = "− / −";
$batk = "− / −";
}
elsif ($form eq 0){
$bpower = "$a2 / $a1";
$batk = "$k_rk2 / $k_rk1";
}
elsif ($form eq 1){
$bpower = "− / $a1";
$batk = "− / $k_rk1";
}
elsif ($form eq 2){
$bpower = "$a2 / −";
$batk = "$k_rk2 / −";
}
# if ($uid eq 2){$batk .= "($k_rk2pt:$s2_1,$kakutou_lv / $k_rk1pt:$s1_1,$kakutou_lv)
$err_dat";}
if ($weapon_category ne ''){
@kp1 = split(/\,/,$k_power1);
@kp2 = split(/\,/,$k_power2);
@iw1 = split(/\,/,$i_weight_str1);
@iw2 = split(/\,/,$i_weight_str2);
# if ($uid eq 2){&html_out($i_weight2);}
$a1 = '';
$a2 = '';
$tmp2 = $attck_str;
$i = 0;
foreach(@kp1){
$tmp = $_;
$x1 = int(($punch1 + int($tmp)) * $per_a);
if ($aflg_1 eq 1){$x1 += @iw1[$i];}
$a1 .= $x1 . "・";
$tmp2 .= "
aflg_1:$aflg_1
iw1[$i]:@iw1[$i]
$x1 = int(($punch1 + int($tmp)) * $per_a)";
$i++;
}
if ($a1 ne ''){$a1 = substr($a1,0,-2);}
$i = 0;
foreach(@kp2){
$tmp = $_;
$x2 = int(($punch2 + int($tmp)) * $per_a);
if ($aflg_1 eq 1){$x2 += @iw2[$i];}
$a2 .= $x2 . "・";
$tmp2 .= "
i_weight2:$i_weight2
aflg_1:$aflg_1
iw2[$i]:@iw2[$i]
$x2 = int(($punch2 + int($tmp)) * $per_a)";
$i++;
}
if ($a2 ne ''){$a2 = substr($a2,0,-2);}
# $a1 = int(($punch1 + int($i_power2)) * $per_a);
# $a2 = int(($punch2 + int($i_power1)) * $per_a);
if ($i_power1 ne '' && $i_power2 ne ''){ #両方
$bpower = "$a2 / $a1";
$batk = "$k_rk2 / $k_rk1";
}
elsif ($i_power1 ne '' && $i_power2 eq ''){ #変身後のみ
$bpower = "− / $a1";
$batk = "− / $k_rk1";
}
elsif ($i_power1 eq '' && $i_power2 ne ''){ #人間時のみ
$bpower = "$a2 / −";
$batk = "$k_rk2 / −";
}
else{
$bpower = "− / −";
$batk = "− / −";
}
}
}
elsif ($kind eq '射撃武器'){
&cal_ability($in{'pcid'},$out{'age'},$out{'name1'},$out{'name3'},$training,$sex,$out{'hometown'},$class,$figure,$fame,$out{'height'},$out{'weight'},1);
$punch1 = $s1_5;
$punch2 = $s2_5;
$kick1 = $s1_6;
$kick2 = $s2_6;
$a1 = int(int($power) * $per_a);
$a2 = int(int($power) * $per_a);
$k_rk1 = &skill_rank($s1_1,$kakutou_lv);
$k_rk2 = &skill_rank($s2_1,$kakutou_lv);
$s_rk1 = &skill_rank($s1_2,$syageki_lv);
$s_rk2 = &skill_rank($s2_2,$syageki_lv);
if ($flg eq 1){
$bpower = "− / −";
$batk = "− / −";
}
elsif ($form eq 0){
$bpower = "$a2 / $a1";
$batk = "$s_rk2 / $s_rk1";
}
elsif ($form eq 1){
$bpower = "− / $a1";
$batk = "− / $s_rk1";
}
elsif ($form eq 2){
$bpower = "$a2 / −";
$batk = "$s_rk2 / −";
}
if ($weapon_category ne ''){
@kp1 = split(/\,/,$k_power1);
@kp2 = split(/\,/,$k_power2);
@iw1 = split(/\,/,$i_weight_str1);
@iw2 = split(/\,/,$i_weight_str2);
# $a1 = int(int($i_power1) * $per_a);
# $a2 = int(int($i_power2) * $per_a);
$a1 = '';
$a2 = '';
$tmp2 = $attck_str;
$i = 0;
foreach(@kp1){
$tmp = $_;
$x1 = int(int($tmp) * $per_a);
if ($aflg_1 eq 1){$x1 += @iw1[$i];}
$a1 .= $x1 . "・";
$tmp2 .= "
aflg_1:$aflg_1
iw1[$i]:@iw1[$i]
$x1 = int(int($tmp) * $per_a)";
$i++;
}
if ($a1 ne ''){$a1 = substr($a1,0,-2);}
$i = 0;
foreach(@kp2){
$tmp = $_;
$x2 = int(int($tmp) * $per_a);
if ($aflg_1 eq 1){$x2 += @iw2[$i];}
$a2 .= $x2 . "・";
$tmp2 .= "
i_weight2:$i_weight2
aflg_1:$aflg_1
iw2[$i]:@iw2[$i]
$x2 = int(int($tmp)) * $per_a)";
$i++;
}
if ($a2 ne ''){$a2 = substr($a2,0,-2);}
if ($i_power2 ne '' && $i_power1 ne ''){
$bpower = "$a2 / $a1";
$batk = "$s_rk2 / $s_rk1";
}
elsif ($i_power2 eq '' && $i_power1 ne ''){
$bpower = "− / $a1";
$batk = "− / $s_rk1";
}
elsif ($i_power2 ne '' && $i_power1 eq ''){
$bpower = "$a2 / −";
$batk = "$s_rk2 / −";
}
else{
$bpower = "− / −";
$batk = "− / −";
}
}
}
elsif ($kind eq '投擲武器'){
&cal_ability($in{'pcid'},$out{'age'},$out{'name1'},$out{'name3'},$training,$sex,$out{'hometown'},$class,$figure,$fame,$out{'height'},$out{'weight'},1);
$punch1 = $s1_5;
$punch2 = $s2_5;
$kick1 = $s1_6;
$kick2 = $s2_6;
$a1 = int(($punch1 + int($power)) * $per_a);
$a2 = int(($punch2 + int($power)) * $per_a);
$k_rk1 = &skill_rank($s1_1,$kakutou_lv);
$k_rk2 = &skill_rank($s2_1,$kakutou_lv);
$s_rk1 = &skill_rank($s1_2,$syageki_lv);
$s_rk2 = &skill_rank($s2_2,$syageki_lv);
if ($flg eq 1){
$bpower = "− / −";
$batk = "− / −";
}
elsif ($form eq 0){
$bpower = "$a2 / $a1";
$batk = "$k_rk2 / $k_rk1";
}
elsif ($form eq 1){
$bpower = "− / $a1";
$batk = "− / $k_rk1";
}
elsif ($form eq 2){
$bpower = "$a2 / −";
$batk = "$k_rk2 / −";
}
if ($weapon_category ne ''){
$a1 = int(($punch1 + int($i_power1)) * $per_a);
$a2 = int(($punch2 + int($i_power2)) * $per_a);
if ($i_power2 ne '' && $i_power1 ne ''){
$bpower = "$a2 / $a1";
$batk = "$k_rk2 / $k_rk1";
}
elsif ($i_power2 eq '' && $i_power1 ne ''){
$bpower = "− / $a1";
$batk = "− / $k_rk1";
}
elsif ($i_power2 ne '' && $i_power1 eq ''){
$bpower = "− / $a1";
$batk = "− / $k_rk1";
}
else{
$bpower = "− / −";
$batk = "− / −";
}
}
}
else{
$bpower = '−';
}
}
elsif ($base_kind eq 1 || $base_kind eq 2 || $base_kind eq 3){ #パンチ・キック・スープレックス
&pks;
}
$info =~ s/\n/
/g;
$info2 = '';
if ($in{'sseq'} eq ''){
if ($flg eq 1 && $in{'training'} eq ''){
$info2 = '必殺技の基本アイテムが装備されていない為、使用できません。
';
}
elsif ($in{'training'} eq 1){
$info2 = '未完成
実戦(シナリオ)での試技を行って下さい。
';
}
}
else{
$sql = "select playing_close from scenario where seq = $in{'sseq'};";
$ref = $dbh->selectall_arrayref($sql) or &html_out("CODE:SP-09A
エラーが発生しました。");
($playing_close)=@{$ref->[0]};
$sql = "select rest_num from tokkun where pcid = '$in{'pcid'}' and set_time <= to_timestamp('$playing_close', 'YYYY-MM-DD HH24:MI:SS') and seq = $in{'seq'} order by seq;";
if ($in{'sseq'} ne ''){
$sql = "select rest_num from tokkun_scenario where pcid = '$in{'pcid'}' and seq = $in{'seq'} and scenario_seq = $in{'sseq'};";
}
$ref = $dbh->selectall_arrayref($sql) or &html_out("CODE:SP-09B
エラーが発生しました。");
($rest_num)=@{$ref->[0]};
# if ($uid eq 2){&html_out($sql);}
if ($in{'training'} eq 1){
if ($rest_num eq 1){
$info2 = '実践トレーニング中
このシナリオで完成します。この必殺技が完成する描写を極力描いてあげてください。
';
}
else{
$info2 = '実践トレーニング中
このシナリオでは完成しません。リプレイに採用する場合は、うまくいかなかったものの、完成へと向けてそれなりの手ごたえがあった旨を描いてやって下さい。。
';
}
}
}
if ($spa_seq ne ''){
$sql = "select txt from free_set where pcid = '$in{'pcid'}' and spa_seq = $spa_seq and result = 1;";
$ref = $dbh->selectall_arrayref($sql) or &html_out("CODE:SP-09C
エラーが発生しました。");
($txt)=@{$ref->[0]};
}
if ($txt eq '' && $base_seq ne ''){
$sql = "select txt from free_set where pcid = '$in{'pcid'}' and spa_seq = $base_seq and result = 1;";
$ref = $dbh->selectall_arrayref($sql) or &html_out("CODE:SP-09D
エラーが発生しました。");
($txt)=@{$ref->[0]};
}
if ($txt ne ''){
$info3 =<<"EOT";
[オリジナル解説]
$txt
EOT
$info3 =~ s/\n/
/g;
}
$body =<<"EOT";
$original_name1
EOT
# if ($in{'training'} eq '' && @at[0] <= 16){
if (@at[0] <= 16){
$body .=<<"EOT";
基本:$name
威力:$bpower
命中:$batk
EOT
}
elsif (@at[0] >= 17){
if ($skill_id ne ''){
&cal_ability($in{'pcid'},$out{'age'},$out{'name1'},$out{'name3'},$training,$sex,$out{'hometown'},$class,$figure,$fame,$out{'height'},$out{'weight'},1);
$sql = "select a.lv,b.name,b.base from skill a,skill_master b where a.pcid = '$in{'pcid'}' and a.id = $skill_id and a.id = b.id;";
# if ($uid eq 2){&mypage_err($sql);}
$ref = $dbh->selectall_arrayref($sql) or &html_out("CODE:SP-10
エラーが発生しました。");
($skill_lv,$skill_name,$skill_base)=@{$ref->[0]};
if ($skill_base eq '格闘'){
$base_num1 = $s1_1;
$base_num2 = $s2_1;
}
elsif ($skill_base eq '操作'){
$base_num1 = $s1_2;
$base_num2 = $s2_2;
}
elsif ($skill_base eq '心'){
$base_num1 = $t1_1;
$base_num2 = $t2_1;
}
$rk1 = &skill_rank($base_num1,$skill_lv);
$rk2 = &skill_rank($base_num2,$skill_lv);
# if ($uid eq 2){
# $tmp = "$base_num1,$base_num2,$lv,$rk1,$rk2
";
# }
$body .=<<"EOT";
スキル:$skill_name
ランク:$rk2 / $rk1
$tmp
EOT
}
if ($skill_id eq 6){
#博士のみスキルランクによりテキスト変化
if (substr($rk1,0,2) eq '初'){
}
elsif (substr($rk1,0,2) eq '専'){
}
elsif (substr($rk1,0,2) eq '達'){
}
elsif (substr($rk1,0,2) eq '超'){
}
}
}
if ($uid ne 2){$tmp2 = '';}
$body .=<<"EOT";
$info2
$info
$info3
$tmp2
EOT
#系統:@spa_routes[$routes]
&html_out($body);
}
#---------------------------------------
# 必殺技表示
#---------------------------------------
sub free_set {
$sql = "select title,txt from free_set where pcid = '$in{'pcid'}' and seq = $in{'seq'} and result in (1,3);";
$ref = $dbh->selectall_arrayref($sql) or &html_out("エラーが発生しました。");
($title,$txt)=@{$ref->[0]};
$txt =~ s/\n/
/g;
$body =<<"EOT";
$title
$txt
EOT
&html_out($body);
}
#---------------------------------------
# 欠点表示
#---------------------------------------
sub fault {
$sql = "select fault from sp_status where pcid = '$in{'pcid'}' and no = $in{'no'} and fault is not null and fault != '';";
$ref = $dbh->selectall_arrayref($sql) or &html_out("エラーが発生しました。");
($fault_txt)=@{$ref->[0]};
$fault_txt =~ s/\n/
/g;
$body =<<"EOT";
$title
$fault_txt
EOT
&html_out($body);
}
#---------------------------------------
# 必殺技拡大用ロジック
#---------------------------------------
sub sa_kakudai {
$wc_id = $_[0];
$i_original_name1 = '';
$i_name1 = '';
$i_power1 = '';
$k_power1 = '';
$i_weight1 = '';
$i_original_name2 = '';
$i_name2 = '';
$i_power2 = '';
$k_power2 = '';
$i_weight2 = '';
#変身後
$prv_t_original_name = '';
$prv_t_name = '';
$prv_t_power = '';
$prv_w_category = '';
$prv_w_weight = '';
$sql = "select a.original_name,b.name,b.power,b.weapon_category,b.weight from item a,item_master b where a.pcid = '$in{'pcid'}' and a.form in (0,1) and a.equip > 0 and a.equip <= 11 and a.state = 0 and a.id = b.id and b.weapon_category is not null order by a.equip;";
$ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:C-A1
エラーが発生しました。");
foreach(@$ref) {
($t_original_name,$t_name,$t_power,$w_category,$w_weight)=@{$_};
if ($t_original_name ne $prv_t_original_name || $t_name ne $prv_t_name || $t_power ne $prv_t_power || $w_category ne $prv_w_category || $w_weight ne $prv_w_weight){
@wcs = ();
@wcs = split(/\,/,$w_category);
foreach (@wcs){
$temp = $_;
if ($temp eq $wc_id){
if ($t_original_name ne ''){$t_name = $t_original_name;}
$i_name1 .= $t_name . '・';
$i_power1 = $t_power;
$k_power1 .= $t_power . ',';
$i_weight1 .= $w_weight . ',';
# last;
}
}
}
$prv_t_original_name = $t_original_name;
$prv_t_name = $t_name;
$prv_t_power = $t_power;
$prv_w_category = $w_category;
$prv_w_weight = $w_weight;
}
if ($i_name1 ne ''){$i_name1 = substr($i_name1,0,-2);}
if ($k_power1 ne ''){$k_power1 = substr($k_power1,0,-1);}
if ($i_weight1 ne ''){$i_weight1 = substr($i_weight1,0,-1);}
#変身前
$prv_t_original_name = '';
$prv_t_name = '';
$prv_t_power = '';
$prv_w_category = '';
$prv_w_weight = '';
$sql = "select a.original_name,b.name,b.power,b.weapon_category,b.weight from item a,item_master b where a.pcid = '$in{'pcid'}' and a.form in (0,2) and a.equip > 0 and a.equip <= 11 and a.state = 0 and a.id = b.id and b.weapon_category is not null order by a.equip;";
# if ($uid eq 2){&html_out($sql);}
$ref = $dbh->selectall_arrayref($sql) or &mypage_err("CODE:C-A1
エラーが発生しました。");
foreach(@$ref) {
($t_original_name,$t_name,$t_power,$w_category,$w_weight)=@{$_};
if ($t_original_name ne $prv_t_original_name || $t_name ne $prv_t_name || $t_power ne $prv_t_power || $w_category ne $prv_w_category || $w_weight ne $prv_w_weight){
$lt .= "$t_name,$w_category
";
@wcs = ();
@wcs = split(/\,/,$w_category);
foreach (@wcs){
$temp = $_;
if ($temp eq $wc_id){
if ($t_original_name ne ''){$t_name = $t_original_name;}
$i_name2 .= $t_name . '・';
$i_power2 = $t_power;
$k_power2 .= $t_power . ',';
$i_weight2 .= $w_weight . ',';
# last;
}
}
}
$prv_t_original_name = $t_original_name;
$prv_t_name = $t_name;
$prv_t_power = $t_power;
$prv_w_category = $w_category;
$prv_w_weight = $w_weight;
}
if ($i_name2 ne ''){$i_name2 = substr($i_name2,0,-2);}
if ($k_power2 ne ''){$k_power2 = substr($k_power2,0,-1);}
if ($i_weight2 ne ''){$i_weight2 = substr($i_weight2,0,-1);}
#整形
$item_name_str = '';
if ($i_name2 ne '' && $i_name1 ne ''){$item_name_str = '
(' . $i_name2 . '/' . $i_name1 . ')';}
elsif ($i_name2 ne '' && $i_name1 eq ''){$item_name_str = '
(' . $i_name2 . '/―)';}
elsif ($i_name2 eq '' && $i_name1 ne ''){$item_name_str = '
(―/' . $i_name1 . ')';}
else{$item_name_str = '(―/―)';}
# if ($uid eq 2){&html_out("$k_power1,$k_power2");}
return ($item_name_str,$i_power1,$i_power2,$k_power1,$k_power2,$i_weight1,$i_weight2);
}
#---------------------------------------
# 必殺技表示(パンチ・キック・スープレックス)
#---------------------------------------
sub pks {
if ($base_kind eq 1){ #パンチ
&cal_ability($in{'pcid'},$out{'age'},$out{'name1'},$out{'name3'},$training,$sex,$out{'hometown'},$class,$figure,$fame,$out{'height'},$out{'weight'});
$name = 'パンチ';
$a1 = int(int($s1_5) * $per_a);
$a2 = int(int($s2_5) * $per_a);
$k_rk1 = &skill_rank($s1_1,$kakutou_lv);
$k_rk2 = &skill_rank($s2_1,$kakutou_lv);
$s_rk1 = &skill_rank($s1_2,$syageki_lv);
$s_rk2 = &skill_rank($s2_2,$syageki_lv);
$bpower = "$a2 / $a1";
$batk = "$k_rk2 / $k_rk1";
}
elsif ($base_kind eq 2){ #キック
&cal_ability($in{'pcid'},$out{'age'},$out{'name1'},$out{'name3'},$training,$sex,$out{'hometown'},$class,$figure,$fame,$out{'height'},$out{'weight'});
$name = 'キック';
$a1 = int(int($s1_6) * $per_a);
$a2 = int(int($s2_6) * $per_a);
$k_rk1 = &skill_rank($s1_1,$kakutou_lv);
$k_rk2 = &skill_rank($s2_1,$kakutou_lv);
$s_rk1 = &skill_rank($s1_2,$syageki_lv);
$s_rk2 = &skill_rank($s2_2,$syageki_lv);
$bpower = "$a2 / $a1";
$batk = "$k_rk2 / $k_rk1";
}
elsif ($base_kind eq 3){ #スープレックス
&cal_ability($in{'pcid'},$out{'age'},$out{'name1'},$out{'name3'},$training,$sex,$out{'hometown'},$class,$figure,$fame,$out{'height'},$out{'weight'},1);
$name = 'スープレックス';
$suplex1 = int ((($t1_3 * 4) + ($t1_2 * 1)) / 12.5);
$suplex2 = int ((($t2_3 * 4) + ($t2_2 * 1)) / 12.5);
$a1 = int(int($suplex1) * $per_a);
$a2 = int(int($suplex2) * $per_a);
$tmp2 .= "
aflg_2:$aflg_2
$a1 = int(int($suplex1) * $per_a)
$a2 = int(int($suplex2) * $per_a)
";
if ($aflg_2 eq 1){
$a1 += int($s_weight2 * 0.15);
$a2 += int($s_weight * 0.15);
}
$tmp2 .= "
a1:$a1
s_weight2:$s_weight2
a2:$a2
s_weight:$s_weight";
$k_rk1 = &skill_rank($s1_1,$kakutou_lv);
$k_rk2 = &skill_rank($s2_1,$kakutou_lv);
$s_rk1 = &skill_rank($s1_2,$syageki_lv);
$s_rk2 = &skill_rank($s2_2,$syageki_lv);
$bpower = "$a2 / $a1";
$batk = "$k_rk2 / $k_rk1";
}
}