転職所をクッキー対応にし、ゲーム内の移動で利用できる様にします。
ver.2からは転職可能な職業しかプルダウンに表示されないようになりました。
@設定追加
# ------------ 転職
$nj_pay = 300; # 転職に必要な金額
$def_ri = 0; # 転職した時にアイテムをリセットする(yes=1,no=0)
A# Main Program #に追加
if ($Fm{'mode'} eq 'change_menu') {require './pl/change_form.pl';&change_form }
if ($Fm{'mode'} eq 'class_change') {require './pl/change_form.pl';&change_form }
if ($Fm{'mode'} eq 'job_change') {require './pl/change_form.pl';&change_form }
B# Sub Normal Action #に追加
&input('radio','mode','change_menu','',"転職の神殿へ
\n");
CPLフォルダにサブルーチン追加
change_form.pl
change_menu.pl
class_change.pl
job_change.pl
(1)change_form.pl
# Sub change Form #
sub change_form {
require './pl/player_data.pl';
require './pl/change_menu.pl';
&header;
&table_top;
if ($Fm{'mode'} eq 'class_change'){require './pl/class_change.pl';&class_change;}
if ($Fm{'mode'} eq 'job_change') {require './pl/job_change.pl';&job_change;}
&msg;
&change_menu;
&player_data;
&table_bottom;
}
1;
(2)change_menu.pl
# Sub change Menu #
sub change_menu {
@ujblines = &opendat($cjbdat);
@ljblines = &opendat($jobdat);
&opensosdat;
&get_user("$Fm{'id'}");
print qq|
\n|;
print qq|\n|;
print qq|エリアス神殿:上位クラスに転職します | \n|;
print qq|\n|;
print qq|\n|;
&form('start');
print qq|\n|;
print qq|\n|;
print qq|\n|;
print qq|希望職種: | | \n|;
print qq|\n|;
&OKbuttoninform('on');
print qq| | |;
&form('end');
print qq| \n|;
print qq|\n|;
print qq|職業案内所:他の基本職に転職します | \n|;
print qq| \n|;
print qq|\n|;
&form('start');
print qq|\n|;
print qq|\n|;
print qq|\n|;
print qq|希望職種: | | \n|;
print qq|\n|;
&OKbuttoninform('on');
print qq| | |;
&form('end');
print qq| \n|;
print qq|\n|;
print qq|王宮 国王の言葉 | \n|;
print qq| \n|;
print qq|\n|;
print qq||;
print qq|\n|;
if ($king) { print qq|$king | \n| }
else { print qq|ありません| }
print qq| \n|;
print qq|\n|;
&form('start');
print qq|\n|;
&input('radio','mode','goodbye','',"町へ戻る\n");
print qq| | |;
print qq|\n|;
&OKbuttoninform('on');
print qq| | |;
&form('end');
print qq| \n|;
print qq| \n|;
print qq| | |;
}
1;
(3)class_change.pl
# Sub Class Change #
sub class_change {
if (!$Fm{'id'}) { push (@msg,'IDが未入力です'); return }
if (!$Fm{'pass'}) { push (@msg,'パスワードが未入力です'); return }
@rcdlines = &get_user("$Fm{'id'}");
if ($Fm{'pass'} ne $ps) { push (@msg,'パスワードが違います'); return }
@cjblines = &opendat($cjbdat);
foreach (0 .. @cjblines) {
($ujb,$usp,$uig,$uoj,$uct,$urt,$ukl,$uak,$udd,$uhp,$uxi) = split(/<>/,$cjblines[$_]);
if ($ujb eq $Fm{'ujb'}) {
$uoj =~ s/,/\,/g;
@ljbs = split(/,/,$uoj);
last;
}
}
foreach $ljb (@ljbs) { if ($jb eq $ljb) { $bingo = 1 } }
if (!$bingo) { push (@msg,"$jbは$Fm{'ujb'}にクラスチェンジできません"); return }
if ($uct) { if ($mn < $uct) { push (@msg,"クラスチェンジするには$uct\G必要です。"); return }}
if ($wn) { $rt = int($wn/($wn + $lz) * 100) * $wn - ($dt * 100) + ($kl * 100) } else { $rt = 0 }
if ($urt) { if ($rt < $urt) { push (@msg,"クラスチェンジするにはRateが$urt以上必要です。"); return }}
if ($ukl) { if ($kl < $ukl) { push (@msg,"クラスチェンジするには殺害数が$ukl以上必要です。"); return }}
$jb = $ujb; $sp .= $usp; $xp += $uhp;
$xi += $uxi; $mn -= $uct; $ak += $uak; $dd += $udd;
$ig = $uig if $uig;
&userout;
push (@msg,"クラスチェンジしました。今からあなたは$jbです。");
}
1;
(4)job_change.pl
# ------------------------- #
# Sub Job Change
# ------------------------- #
sub job_change {
if (!$Fm{'id'}) { push (@msg,'IDが未入力です'); return }
if (!$Fm{'pass'}) { push (@msg,'パスワードが未入力です'); return }
@rcdlines = &get_user("$Fm{'id'}");
if ($Fm{'pass'} ne $ps) { push (@msg,'パスワードが違います'); return }
if ($sp =~ /Pb/) { push (@msg,'質屋タイプは転職ができません'); return }
@ljblines = &opendat($jobdat);
foreach $line (@ljblines) {
($jbn,$jig,$jsp,$jhp,$jxi,$jak,$jdd,$jmn) = split(/<>/,$line);
if ($jbn eq $Fm{'ljb'}) { last }
}
if ($mn < $nj_pay) { push (@msg,"転職するには$nj_pay\G必要です。"); return }
$jb = $jbn; $ig = $jig; $sp = $jsp; $xp = $jhp; $xi = $jxi;
$ak = $jak; $dd = $jdd;
$ab = $db = 0; $bp = $bn = $fe = '';
&splititem;
foreach (0 .. $#items) {
($item,$sts,$price) = split(/△/,$items[$_]);
$sts =~ s/Q[swat]//g;
push(@newitems,"$item△$sts");
}
@items = @newitems;
&joinitem;
if ($def_ri) { $bg = '' }
$mn -= $nj_pay;
&userout;
push (@msg,"転職しました。今からあなたは$jbです。");
}
1;