function WriteARLog($s_to, $s_subj, $s_info) { global $LOGDIR, $AUTORESPONDLOG, $aServerVars, $php_errormsg; if (!isset($LOGDIR) || !isset($AUTORESPONDLOG) || empty($LOGDIR) || empty($AUTORESPONDLOG)) { return; } $log_file = $LOGDIR . "/" . $AUTORESPONDLOG; @($log_fp = fopen($log_file, "a")); if ($log_fp === false) { SendAlert(GetMessage(MSG_FILE_OPEN_ERROR, array("NAME" => $log_file, "TYPE" => "log", "ERROR" => CheckString($php_errormsg)))); return; } $a_entry = array(); $a_entry[] = gmdate("H:i:s d-M-y T"); // date/time in GMT $a_entry[] = $aServerVars['REMOTE_ADDR']; // remote IP address $a_entry[] = $s_to; // target email address $a_entry[] = $s_subj; // subject line $a_entry[] = $s_info; // information $s_log_entry = implode(",", $a_entry) . "\n"; fwrite($log_fp, $s_log_entry); fclose($log_fp); }
} $FTGname = DoStripSlashes($_REQUEST['name']); $FTGemail = DoStripSlashes($_REQUEST['email']); $FTGmessage = DoStripSlashes($_REQUEST['message']); $FTGsubmit = DoStripSlashes($_REQUEST['submit']); $validationFailed = false; # Fields Validations if (!CheckString($FTGname, 2, 0, kStringRangeFrom, kNo, kNo, kNo, '', kMandatory)) { $FTGErrorMessage['name'] = 'Please insert a valid name'; $validationFailed = true; } if (!CheckEmail($FTGemail, kMandatory)) { $FTGErrorMessage['email'] = 'Please insert a valid email address'; $validationFailed = true; } if (!CheckString($FTGmessage, 10, 0, kStringRangeFrom, kNo, kNo, kNo, '', kMandatory)) { $FTGErrorMessage['message'] = 'This field is required'; $validationFailed = true; } # Include message in error page and dump it to the browser if ($validationFailed === true) { $errorPage = '<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8" /><title>Error</title></head><body><div id="errors" class="padd">Errors found: <!--VALIDATIONERROR--></div></body></html>'; $errorPage = str_replace('<!--FIELDVALUE:name-->', $FTGname, $errorPage); $errorPage = str_replace('<!--FIELDVALUE:email-->', $FTGemail, $errorPage); $errorPage = str_replace('<!--FIELDVALUE:message-->', $FTGmessage, $errorPage); $errorPage = str_replace('<!--FIELDVALUE:submit-->', $FTGsubmit, $errorPage); $errorPage = str_replace('<!--ERRORMSG:name-->', $FTGErrorMessage['name'], $errorPage); $errorPage = str_replace('<!--ERRORMSG:email-->', $FTGErrorMessage['email'], $errorPage); $errorPage = str_replace('<!--ERRORMSG:message-->', $FTGErrorMessage['message'], $errorPage); $errorList = @implode("<br />\n", $FTGErrorMessage); $errorPage = str_replace('<!--VALIDATIONERROR-->', $errorList, $errorPage);
function CharStatProcess() { $char =& $this->char[$_GET["char"]]; if (!$char) { return false; } switch (true) { // ステータス上昇 case $_POST["stup"]: //ステータスポイント超過(ねんのための絶対値) $Sum = abs($_POST["upStr"]) + abs($_POST["upInt"]) + abs($_POST["upDex"]) + abs($_POST["upSpd"]) + abs($_POST["upLuk"]); if ($char->statuspoint < $Sum) { ShowError("状态点数过多", "margin15"); return false; } if ($Sum == 0) { return false; } $Stat = array("Str", "Int", "Dex", "Spd", "Luk"); foreach ($Stat as $val) { //最大値を超えないかチェック if (MAX_STATUS < $char->{strtolower($val)} + $_POST["up" . $val]) { ShowError("超过最大状态(" . MAX_STATUS . ")", "margin15"); return false; } } $char->str += $_POST["upStr"]; //ステータスを増やす $char->int += $_POST["upInt"]; $char->dex += $_POST["upDex"]; $char->spd += $_POST["upSpd"]; $char->luk += $_POST["upLuk"]; $char->SetHpSp(); $char->statuspoint -= $Sum; //ポイントを減らす。 print "<div class=\"margin15\">\n"; if ($_POST["upStr"]) { ShowResult("STR <span class=\"bold\">" . $_POST[upStr] . "</span> 上升。" . ($char->str - $_POST["upStr"]) . " -> " . $char->str . "<br />\n"); } if ($_POST["upInt"]) { ShowResult("INT <span class=\"bold\">" . $_POST[upInt] . "</span> 上升。" . ($char->int - $_POST["upInt"]) . " -> " . $char->int . "<br />\n"); } if ($_POST["upDex"]) { ShowResult("DEX <span class=\"bold\">" . $_POST[upDex] . "</span> 上升。" . ($char->dex - $_POST["upDex"]) . " -> " . $char->dex . "<br />\n"); } if ($_POST["upSpd"]) { ShowResult("SPD <span class=\"bold\">" . $_POST[upSpd] . "</span> 上升。" . ($char->spd - $_POST["upSpd"]) . " -> " . $char->spd . "<br />\n"); } if ($_POST["upLuk"]) { ShowResult("LUK <span class=\"bold\">" . $_POST[upLuk] . "</span> 上升。" . ($char->luk - $_POST["upLuk"]) . " -> " . $char->luk . "<br />\n"); } print "</div>\n"; $char->SaveCharData($this->id); return true; // 配置?他設定(防御) // 配置?他設定(防御) case $_POST["position"]: if ($_POST["position"] == "front") { $char->position = FRONT; $pos = "前卫(Front)"; } else { $char->position = BACK; $pos = "后卫(Back)"; } $char->guard = $_POST["guard"]; switch ($_POST["guard"]) { case "never": $guard = "放弃后卫"; break; case "life25": $guard = "体力25%以上时保护后卫"; break; case "life50": $guard = "体力50%以上时保护后卫"; break; case "life75": $guard = "体力75%以上时保护后卫"; break; case "prob25": $guard = "25%的概率保护后卫"; break; case "prob50": $guard = "50%的概率保护后卫"; break; case "prob75": $guard = "75%的概率保护后卫"; break; default: $guard = "必定保护后卫"; break; } $char->SaveCharData($this->id); ShowResult($char->Name() . " 的配置 {$pos} 。<br />作为前卫时 设置为{$guard} 。\n", "margin15"); return true; //行動設定 //行動設定 case $_POST["ChangePattern"]: $max = $char->MaxPatterns(); //記憶する模式と技の配列。 for ($i = 0; $i < $max; $i++) { $judge[] = $_POST["judge" . $i]; $quantity_post = (int) $_POST["quantity" . $i]; if (4 < strlen($quantity_post)) { $quantity_post = substr($quantity_post, 0, 4); } $quantity[] = $quantity_post; $action[] = $_POST["skill" . $i]; } //if($char->ChangePattern($judge,$action)) { if ($char->PatternSave($judge, $quantity, $action)) { $char->SaveCharData($this->id); ShowResult("战斗设置保存完成", "margin15"); return true; } ShowError("保存失败?请尝试报告03050242", "margin15"); return false; break; // 行動設定 兼 模擬戦 // 行動設定 兼 模擬戦 case $_POST["TestBattle"]: $max = $char->MaxPatterns(); //記憶する模式と技の配列。 for ($i = 0; $i < $max; $i++) { $judge[] = $_POST["judge" . $i]; $quantity_post = (int) $_POST["quantity" . $i]; if (4 < strlen($quantity_post)) { $quantity_post = substr($quantity_post, 0, 4); } $quantity[] = $quantity_post; $action[] = $_POST["skill" . $i]; } //if($char->ChangePattern($judge,$action)) { if ($char->PatternSave($judge, $quantity, $action)) { $char->SaveCharData($this->id); $this->CharTestDoppel(); } break; // 行動模式メモ(交換) // 行動模式メモ(交換) case $_POST["PatternMemo"]: if ($char->ChangePatternMemo()) { $char->SaveCharData($this->id); ShowResult("模式交换完成", "margin15"); return true; } break; // 指定行に追加 // 指定行に追加 case $_POST["AddNewPattern"]: if (!isset($_POST["PatternNumber"])) { return false; } if ($char->AddPattern($_POST["PatternNumber"])) { $char->SaveCharData($this->id); ShowResult("模式追加完成", "margin15"); return true; } break; // 指定行を削除 // 指定行を削除 case $_POST["DeletePattern"]: if (!isset($_POST["PatternNumber"])) { return false; } if ($char->DeletePattern($_POST["PatternNumber"])) { $char->SaveCharData($this->id); ShowResult("模式削除完成", "margin15"); return true; } break; // 指定箇所だけ装備をはずす // 指定箇所だけ装備をはずす case $_POST["remove"]: if (!$_POST["spot"]) { ShowError("没有选择需要去掉的装备", "margin15"); return false; } if (!$char->{$_POST["spot"]}) { // $this と $char の区別注意! ShowError("指定位置没有装备", "margin15"); return false; } $item = LoadItemData($char->{$_POST["spot"]}); if (!$item) { return false; } $this->AddItem($char->{$_POST["spot"]}); $this->SaveUserItem(); $char->{$_POST["spot"]} = NULL; $char->SaveCharData($this->id); SHowResult($char->Name() . " 的 {$item[name]} 解除。", "margin15"); return true; break; // 装備全部はずす // 装備全部はずす case $_POST["remove_all"]: if ($char->weapon || $char->shield || $char->armor || $char->item) { if ($char->weapon) { $this->AddItem($char->weapon); $char->weapon = NULL; } if ($char->shield) { $this->AddItem($char->shield); $char->shield = NULL; } if ($char->armor) { $this->AddItem($char->armor); $char->armor = NULL; } if ($char->item) { $this->AddItem($char->item); $char->item = NULL; } $this->SaveUserItem(); $char->SaveCharData($this->id); ShowResult($char->Name() . " 的装备全部解除", "margin15"); return true; } break; // 指定物を装備する // 指定物を装備する case $_POST["equip_item"]: $item_no = $_POST["item_no"]; if (!$this->item["{$item_no}"]) { //その道具を所持しているか ShowError("Item not exists.", "margin15"); return false; } $JobData = LoadJobData($char->job); $item = LoadItemData($item_no); //装備しようとしてる物 if (!in_array($item["type"], $JobData["equip"])) { //それが装備不可能なら? ShowError("{$char->job_name} can't equip {$item[name]}.", "margin15"); return false; } if (false === ($return = $char->Equip($item))) { ShowError("装备过重(handle不足).", "margin15"); return false; } else { $this->DeleteItem($item_no); foreach ($return as $no) { $this->AddItem($no); } } $this->SaveUserItem(); $char->SaveCharData($this->id); ShowResult("{$char->name} 的 {$item[name]} 装备.", "margin15"); return true; break; // スキル習得 // スキル習得 case $_POST["learnskill"]: if (!$_POST["newskill"]) { ShowError("没选定技能", "margin15"); return false; } $char->SetUser($this->id); list($result, $message) = $char->LearnNewSkill($_POST["newskill"]); if ($result) { $char->SaveCharData(); ShowResult($message, "margin15"); } else { ShowError($message, "margin15"); } return true; // クラスチェンジ(転職) // クラスチェンジ(転職) case $_POST["classchange"]: if (!$_POST["job"]) { ShowError("没选定职业", "margin15"); return false; } if ($char->ClassChange($_POST["job"])) { // 装備を全部解除 if ($char->weapon || $char->shield || $char->armor || $char->item) { if ($char->weapon) { $this->AddItem($char->weapon); $char->weapon = NULL; } if ($char->shield) { $this->AddItem($char->shield); $char->shield = NULL; } if ($char->armor) { $this->AddItem($char->armor); $char->armor = NULL; } if ($char->item) { $this->AddItem($char->item); $char->item = NULL; } $this->SaveUserItem(); } // 保存 $char->SaveCharData($this->id); ShowResult("转职完成", "margin15"); return true; } ShowError("failed.", "margin15"); return false; // 改名(表示) // 改名(表示) case $_POST["rename"]: $Name = $char->Name(); $message = <<<EOD <form action="?char={$_GET[char]}" method="post" class="margin15"> 半角英数16文字 (全角1文字=半角2文字)<br /> <input type="text" name="NewName" style="width:160px" class="text" /> <input type="submit" class="btn" name="NameChange" value="Change" /> <input type="submit" class="btn" value="Cancel" /> </form> EOD; print $message; return false; // 改名(処理) // 改名(処理) case $_POST["NewName"]: list($result, $return) = CheckString($_POST["NewName"], 16); if ($result === false) { ShowError($return, "margin15"); return false; } else { if ($result === true) { if ($this->DeleteItem("7500", 1) == 1) { ShowResult($char->Name() . " " . $return . " 改名完成。", "margin15"); $char->ChangeName($return); $char->SaveCharData($this->id); $this->SaveUserItem(); return true; } else { ShowError("没有道具。", "margin15"); return false; } return true; } } // 各種リセットの表示 // 各種リセットの表示 case $_POST["showreset"]: $Name = $char->Name(); print '<div class="margin15">' . "\n"; print "使用道具<br />\n"; print '<form action="?char=' . $_GET[char] . '" method="post">' . "\n"; print '<select name="itemUse">' . "\n"; $resetItem = array(7510, 7511, 7512, 7513, 7520); foreach ($resetItem as $itemNo) { if ($this->item[$itemNo]) { $item = LoadItemData($itemNo); print '<option value="' . $itemNo . '">' . $item[name] . " x" . $this->item[$itemNo] . '</option>' . "\n"; } } print "</select>\n"; print '<input type="submit" class="btn" name="resetVarious" value="重置">' . "\n"; print '<input type="submit" class="btn" value="取消">' . "\n"; print '</form>' . "\n"; print '</div>' . "\n"; break; // 各種リセットの処理 // 各種リセットの処理 case $_POST["resetVarious"]: switch ($_POST["itemUse"]) { case 7510: $lowLimit = 1; break; case 7511: $lowLimit = 30; break; case 7512: $lowLimit = 50; break; case 7513: $lowLimit = 100; break; // skill // skill case 7520: $skillReset = true; break; } // 石ころをSPD1に戻す道具にする if ($_POST["itemUse"] == 6000) { if ($this->DeleteItem(6000) == 0) { ShowError("没有道具。", "margin15"); return false; } if (1 < $char->spd) { $dif = $char->spd - 1; $char->spd -= $dif; $char->statuspoint += $dif; $char->SaveCharData($this->id); $this->SaveUserItem(); ShowResult("点数归还", "margin15"); return true; } } if ($lowLimit) { if (!$this->item[$_POST["itemUse"]]) { ShowError("没有道具。", "margin15"); return false; } if ($lowLimit < $char->str) { $dif = $char->str - $lowLimit; $char->str -= $dif; $pointBack += $dif; } if ($lowLimit < $char->int) { $dif = $char->int - $lowLimit; $char->int -= $dif; $pointBack += $dif; } if ($lowLimit < $char->dex) { $dif = $char->dex - $lowLimit; $char->dex -= $dif; $pointBack += $dif; } if ($lowLimit < $char->spd) { $dif = $char->spd - $lowLimit; $char->spd -= $dif; $pointBack += $dif; } if ($lowLimit < $char->luk) { $dif = $char->luk - $lowLimit; $char->luk -= $dif; $pointBack += $dif; } if ($pointBack) { if ($this->DeleteItem($_POST["itemUse"]) == 0) { ShowError("没有道具。", "margin15"); return false; } $char->statuspoint += $pointBack; // 装備も全部解除 if ($char->weapon || $char->shield || $char->armor || $char->item) { if ($char->weapon) { $this->AddItem($char->weapon); $char->weapon = NULL; } if ($char->shield) { $this->AddItem($char->shield); $char->shield = NULL; } if ($char->armor) { $this->AddItem($char->armor); $char->armor = NULL; } if ($char->item) { $this->AddItem($char->item); $char->item = NULL; } ShowResult($char->Name() . " 的所有装备解除", "margin15"); } $char->SaveCharData($this->id); $this->SaveUserItem(); ShowResult("点数归还成功", "margin15"); return true; } else { ShowError("点数归还失败", "margin15"); return false; } } if ($skillReset) { if (!$this->item[$_POST["itemUse"]]) { ShowError("没有道具。", "margin15"); return false; } if ($skillReset = true) { if ($char->job < 199) { $dif = ($char->level - 1) * 2 - $char->skillpoint; $char->skill = "1000<>1001"; $pointBack += $dif; } else { if ($char->job < 299) { $dif = ($char->level - 1) * 2 - $char->skillpoint; $char->skill = "1000<>1002<>3010"; $pointBack += $dif; } else { if ($char->job < 399) { $dif = ($char->level - 1) * 2 - $char->skillpoint; $char->skill = "1000<>3000<>3101"; $pointBack += $dif; } else { $dif = ($char->level - 1) * 2 - $char->skillpoint; $char->skill = "2300<>2310"; $pointBack += $dif; } } } } if ($pointBack) { if ($this->DeleteItem($_POST["itemUse"]) == 0) { ShowError("没有道具。", "margin15"); return false; } $char->skillpoint += $pointBack; $char->SaveCharData($this->id); $this->SaveUserItem(); ShowResult("技能重置成功", "margin15"); return true; } else { ShowError("技能重置失败", "margin15"); return false; } } break; // サヨナラ(表示) // サヨナラ(表示) case $_POST["byebye"]: $Name = $char->Name(); $message = <<<HTML_BYEBYE <div class="margin15"> {$Name} 解雇?<br> <form action="?char={$_GET[char]}" method="post"> <input type="submit" class="btn" name="kick" value="Yes"> <input type="submit" class="btn" value="No"> </form> </div> HTML_BYEBYE; print $message; return false; // サヨナラ(処理) // サヨナラ(処理) case $_POST["kick"]: //$this->DeleteChar($char->birth); $char->DeleteChar(); $host = $_SERVER['HTTP_HOST']; $uri = rtrim(dirname($_SERVER['PHP_SELF'])); //$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\'); $extra = INDEX; header("Location: http://{$host}{$uri}/{$extra}"); exit; break; } }
function CharStatProcess() { $char =& $this->char[$_GET["char"]]; if (!$char) { return false; } switch (true) { // ステータス上昇 case $_POST["stup"]: //ステータスポイント超過(ねんのための絶対値) $Sum = abs($_POST["upStr"]) + abs($_POST["upInt"]) + abs($_POST["upDex"]) + abs($_POST["upSpd"]) + abs($_POST["upLuk"]); if ($char->statuspoint < $Sum) { ShowError("ステータスポイント超過", "margin15"); return false; } if ($Sum == 0) { return false; } $Stat = array("Str", "Int", "Dex", "Spd", "Luk"); foreach ($Stat as $val) { //最大値を超えないかチェック if (MAX_STATUS < $char->{strtolower($val)} + $_POST["up" . $val]) { ShowError("最大ステータス超過(" . MAX_STATUS . ")", "margin15"); return false; } } $char->str += $_POST["upStr"]; //ステータスを増やす $char->int += $_POST["upInt"]; $char->dex += $_POST["upDex"]; $char->spd += $_POST["upSpd"]; $char->luk += $_POST["upLuk"]; $char->SetHpSp(); $char->statuspoint -= $Sum; //ポイントを減らす。 print "<div class=\"margin15\">\n"; if ($_POST["upStr"]) { ShowResult("STR が <span class=\"bold\">" . $_POST[upStr] . "</span> 上がった。" . ($char->str - $_POST["upStr"]) . " -> " . $char->str . "<br />\n"); } if ($_POST["upInt"]) { ShowResult("INT が <span class=\"bold\">" . $_POST[upInt] . "</span> 上がった。" . ($char->int - $_POST["upInt"]) . " -> " . $char->int . "<br />\n"); } if ($_POST["upDex"]) { ShowResult("DEX が <span class=\"bold\">" . $_POST[upDex] . "</span> 上がった。" . ($char->dex - $_POST["upDex"]) . " -> " . $char->dex . "<br />\n"); } if ($_POST["upSpd"]) { ShowResult("SPD が <span class=\"bold\">" . $_POST[upSpd] . "</span> 上がった。" . ($char->spd - $_POST["upSpd"]) . " -> " . $char->spd . "<br />\n"); } if ($_POST["upLuk"]) { ShowResult("LUK が <span class=\"bold\">" . $_POST[upLuk] . "</span> 上がった。" . ($char->luk - $_POST["upLuk"]) . " -> " . $char->luk . "<br />\n"); } print "</div>\n"; $char->SaveCharData($this->id); return true; // 配置・他設定(防御) // 配置・他設定(防御) case $_POST["position"]: if ($_POST["position"] == "front") { $char->position = FRONT; $pos = "前衛(Front)"; } else { $char->position = BACK; $pos = "後衛(Back)"; } $char->guard = $_POST["guard"]; switch ($_POST["guard"]) { case "never": $guard = "後衛を守らない"; break; case "life25": $guard = "体力が 25%以上なら 後衛を守る"; break; case "life50": $guard = "体力が 50%以上なら 後衛を守る"; break; case "life75": $guard = "体力が 75%以上なら 後衛を守る"; break; case "prob25": $guard = "25%の確率で 後衛を守る"; break; case "prob50": $guard = "50%の確率で 後衛を守る"; break; case "prob75": $guard = "75%の確率で 後衛を守る"; break; default: $guard = "必ず後衛を守る"; break; } $char->SaveCharData($this->id); ShowResult($char->Name() . " の配置を {$pos} に。<br />前衛の時 {$guard} ように設定。\n", "margin15"); return true; //行動設定 //行動設定 case $_POST["ChangePattern"]: $max = $char->MaxPatterns(); //記憶するパターンと技の配列。 for ($i = 0; $i < $max; $i++) { $judge[] = $_POST["judge" . $i]; $quantity_post = (int) $_POST["quantity" . $i]; if (4 < strlen($quantity_post)) { $quantity_post = substr($quantity_post, 0, 4); } $quantity[] = $quantity_post; $action[] = $_POST["skill" . $i]; } //if($char->ChangePattern($judge,$action)) { if ($char->PatternSave($judge, $quantity, $action)) { $char->SaveCharData($this->id); ShowResult("パターン設定保存 完了", "margin15"); return true; } ShowError("失敗したなんで?報告してみてください 03050242", "margin15"); return false; break; // 行動設定 兼 模擬戦 // 行動設定 兼 模擬戦 case $_POST["TestBattle"]: $max = $char->MaxPatterns(); //記憶するパターンと技の配列。 for ($i = 0; $i < $max; $i++) { $judge[] = $_POST["judge" . $i]; $quantity_post = (int) $_POST["quantity" . $i]; if (4 < strlen($quantity_post)) { $quantity_post = substr($quantity_post, 0, 4); } $quantity[] = $quantity_post; $action[] = $_POST["skill" . $i]; } //if($char->ChangePattern($judge,$action)) { if ($char->PatternSave($judge, $quantity, $action)) { $char->SaveCharData($this->id); $this->CharTestDoppel(); } break; // 行動パターンメモ(交換) // 行動パターンメモ(交換) case $_POST["PatternMemo"]: if ($char->ChangePatternMemo()) { $char->SaveCharData($this->id); ShowResult("パターン交換 完了", "margin15"); return true; } break; // 指定行に追加 // 指定行に追加 case $_POST["AddNewPattern"]: if (!isset($_POST["PatternNumber"])) { return false; } if ($char->AddPattern($_POST["PatternNumber"])) { $char->SaveCharData($this->id); ShowResult("パターン追加 完了", "margin15"); return true; } break; // 指定行を削除 // 指定行を削除 case $_POST["DeletePattern"]: if (!isset($_POST["PatternNumber"])) { return false; } if ($char->DeletePattern($_POST["PatternNumber"])) { $char->SaveCharData($this->id); ShowResult("パターン削除 完了", "margin15"); return true; } break; // 指定箇所だけ装備をはずす // 指定箇所だけ装備をはずす case $_POST["remove"]: if (!$_POST["spot"]) { ShowError("装備をはずす箇所が選択されていない", "margin15"); return false; } if (!$char->{$_POST["spot"]}) { // $this と $char の区別注意! ShowError("指定された箇所には装備無し", "margin15"); return false; } $item = LoadItemData($char->{$_POST["spot"]}); if (!$item) { return false; } $this->AddItem($char->{$_POST["spot"]}); $this->SaveUserItem(); $char->{$_POST["spot"]} = NULL; $char->SaveCharData($this->id); SHowResult($char->Name() . " の {$item[name]} を はずした。", "margin15"); return true; break; // 装備全部はずす // 装備全部はずす case $_POST["remove_all"]: if ($char->weapon || $char->shield || $char->armor || $char->item) { if ($char->weapon) { $this->AddItem($char->weapon); $char->weapon = NULL; } if ($char->shield) { $this->AddItem($char->shield); $char->shield = NULL; } if ($char->armor) { $this->AddItem($char->armor); $char->armor = NULL; } if ($char->item) { $this->AddItem($char->item); $char->item = NULL; } $this->SaveUserItem(); $char->SaveCharData($this->id); ShowResult($char->Name() . " の装備を 全部解除した", "margin15"); return true; } break; // 指定物を装備する // 指定物を装備する case $_POST["equip_item"]: $item_no = $_POST["item_no"]; if (!$this->item["{$item_no}"]) { //そのアイテムを所持しているか ShowError("Item not exists.", "margin15"); return false; } $JobData = LoadJobData($char->job); $item = LoadItemData($item_no); //装備しようとしてる物 if (!in_array($item["type"], $JobData["equip"])) { //それが装備不可能なら? ShowError("{$char->job_name} can't equip {$item[name]}.", "margin15"); return false; } if (false === ($return = $char->Equip($item))) { ShowError("Handle Over.", "margin15"); return false; } else { $this->DeleteItem($item_no); foreach ($return as $no) { $this->AddItem($no); } } $this->SaveUserItem(); $char->SaveCharData($this->id); ShowResult("{$char->name} は {$item[name]} を装備した.", "margin15"); return true; break; // スキル習得 // スキル習得 case $_POST["learnskill"]: if (!$_POST["newskill"]) { ShowError("スキル未選択", "margin15"); return false; } $char->SetUser($this->id); list($result, $message) = $char->LearnNewSkill($_POST["newskill"]); if ($result) { $char->SaveCharData(); ShowResult($message, "margin15"); } else { ShowError($message, "margin15"); } return true; // クラスチェンジ(転職) // クラスチェンジ(転職) case $_POST["classchange"]: if (!$_POST["job"]) { ShowError("職 未選択", "margin15"); return false; } if ($char->ClassChange($_POST["job"])) { // 装備を全部解除 if ($char->weapon || $char->shield || $char->armor || $char->item) { if ($char->weapon) { $this->AddItem($char->weapon); $char->weapon = NULL; } if ($char->shield) { $this->AddItem($char->shield); $char->shield = NULL; } if ($char->armor) { $this->AddItem($char->armor); $char->armor = NULL; } if ($char->item) { $this->AddItem($char->item); $char->item = NULL; } $this->SaveUserItem(); } // 保存 $char->SaveCharData($this->id); ShowResult("転職 完了", "margin15"); return true; } ShowError("failed.", "margin15"); return false; // 改名(表示) // 改名(表示) case $_POST["rename"]: $Name = $char->Name(); $message = <<<EOD <form action="?char={$_GET[char]}" method="post" class="margin15"> 半角英数16文字 (全角1文字=半角2文字)<br /> <input type="text" name="NewName" style="width:160px" class="text" /> <input type="submit" class="btn" name="NameChange" value="Change" /> <input type="submit" class="btn" value="Cancel" /> </form> EOD; print $message; return false; // 改名(処理) // 改名(処理) case $_POST["NewName"]: list($result, $return) = CheckString($_POST["NewName"], 16); if ($result === false) { ShowError($return, "margin15"); return false; } else { if ($result === true) { if ($this->DeleteItem("7500", 1) == 1) { ShowResult($char->Name() . " から " . $return . " へ改名しました。", "margin15"); $char->ChangeName($return); $char->SaveCharData($this->id); $this->SaveUserItem(); return true; } else { ShowError("アイテムがありません。", "margin15"); return false; } return true; } } // 各種リセットの表示 // 各種リセットの表示 case $_POST["showreset"]: $Name = $char->Name(); print '<div class="margin15">' . "\n"; print "使用するアイテム<br />\n"; print '<form action="?char=' . $_GET[char] . '" method="post">' . "\n"; print '<select name="itemUse">' . "\n"; $resetItem = array(7510, 7511, 7512, 7513, 7520); foreach ($resetItem as $itemNo) { if ($this->item[$itemNo]) { $item = LoadItemData($itemNo); print '<option value="' . $itemNo . '">' . $item[name] . " x" . $this->item[$itemNo] . '</option>' . "\n"; } } print "</select>\n"; print '<input type="submit" class="btn" name="resetVarious" value="Reset">' . "\n"; print '<input type="submit" class="btn" value="Cancel">' . "\n"; print '</form>' . "\n"; print '</div>' . "\n"; break; // 各種リセットの処理 // 各種リセットの処理 case $_POST["resetVarious"]: switch ($_POST["itemUse"]) { case 7510: $lowLimit = 1; break; case 7511: $lowLimit = 30; break; case 7512: $lowLimit = 50; break; case 7513: $lowLimit = 100; break; // skill // skill case 7520: $skillReset = true; break; } // 石ころをSPD1に戻すアイテムにする if ($_POST["itemUse"] == 6000) { if ($this->DeleteItem(6000) == 0) { ShowError("アイテムがありません。", "margin15"); return false; } if (1 < $char->spd) { $dif = $char->spd - 1; $char->spd -= $dif; $char->statuspoint += $dif; $char->SaveCharData($this->id); $this->SaveUserItem(); ShowResult("ポイント還元成功", "margin15"); return true; } } if ($lowLimit) { if (!$this->item[$_POST["itemUse"]]) { ShowError("アイテムがありません。", "margin15"); return false; } if ($lowLimit < $char->str) { $dif = $char->str - $lowLimit; $char->str -= $dif; $pointBack += $dif; } if ($lowLimit < $char->int) { $dif = $char->int - $lowLimit; $char->int -= $dif; $pointBack += $dif; } if ($lowLimit < $char->dex) { $dif = $char->dex - $lowLimit; $char->dex -= $dif; $pointBack += $dif; } if ($lowLimit < $char->spd) { $dif = $char->spd - $lowLimit; $char->spd -= $dif; $pointBack += $dif; } if ($lowLimit < $char->luk) { $dif = $char->luk - $lowLimit; $char->luk -= $dif; $pointBack += $dif; } if ($pointBack) { if ($this->DeleteItem($_POST["itemUse"]) == 0) { ShowError("アイテムがありません。", "margin15"); return false; } $char->statuspoint += $pointBack; // 装備も全部解除 if ($char->weapon || $char->shield || $char->armor || $char->item) { if ($char->weapon) { $this->AddItem($char->weapon); $char->weapon = NULL; } if ($char->shield) { $this->AddItem($char->shield); $char->shield = NULL; } if ($char->armor) { $this->AddItem($char->armor); $char->armor = NULL; } if ($char->item) { $this->AddItem($char->item); $char->item = NULL; } ShowResult($char->Name() . " の装備を 全部解除した", "margin15"); } $char->SaveCharData($this->id); $this->SaveUserItem(); ShowResult("ポイント還元成功", "margin15"); return true; } else { ShowError("ポイント還元失敗", "margin15"); return false; } } break; // サヨナラ(表示) // サヨナラ(表示) case $_POST["byebye"]: $Name = $char->Name(); $message = <<<HTML_BYEBYE <div class="margin15"> {$Name} を 解雇しますか?<br> <form action="?char={$_GET[char]}" method="post"> <input type="submit" class="btn" name="kick" value="Yes"> <input type="submit" class="btn" value="No"> </form> </div> HTML_BYEBYE; print $message; return false; // サヨナラ(処理) // サヨナラ(処理) case $_POST["kick"]: //$this->DeleteChar($char->birth); $char->DeleteChar(); $host = $_SERVER['HTTP_HOST']; $uri = rtrim(dirname($_SERVER['PHP_SELF'])); //$uri = rtrim(dirname($_SERVER['PHP_SELF']), '/\\'); $extra = INDEX; header("Location: http://{$host}{$uri}/{$extra}"); exit; break; } }