function RecruitProcess() { // 雇用数限界 if (MAX_CHAR <= count($this->char)) { return false; } include DATA_BASE_CHAR; if ($_POST["recruit"]) { // キャラのタイプ switch ($_POST["recruit_no"]) { case "1": $hire = 2000; $charNo = 1; break; case "2": $hire = 2000; $charNo = 2; break; case "3": $hire = 2500; $charNo = 3; break; case "4": $hire = 4000; $charNo = 4; break; default: ShowError("未选择人物", "margin15"); return false; } // 名前処理 if ($_POST["recruit_name"]) { if (is_numeric(strpos($_POST["recruit_name"], "\t"))) { return "error."; } $name = trim($_POST["recruit_name"]); $name = stripslashes($name); $len = strlen($name); if (0 == $len || 16 < $len) { ShowError("名称太短或太长", "margin15"); return false; } $name = htmlspecialchars($name, ENT_QUOTES); } else { ShowError("名称不能是空", "margin15"); return false; } //性別 if (!isset($_POST["recruit_gend"])) { ShowError("未选定性別", "margin15"); return false; } else { $Gender = $_POST["recruit_gend"] ? "♀" : "♂"; } // キャラデータをクラスに入れる $plus = array("name" => "{$name}", "gender" => $_POST["recruit_gend"]); $char = new char(); $char->SetCharData(array_merge(BaseCharStatus($charNo), $plus)); //雇用金 if ($hire <= $this->money) { $this->TakeMoney($hire); } else { ShowError("您没有足够的钱", "margin15"); return false; } // キャラを保存する $char->SaveCharData($this->id); ShowResult($char->Name() . "({$char->job_name}:{$Gender}) 加为同伴!", "margin15"); return true; } }
include "./class/class.char.php"; include "./class/global.php"; $folder = glob("./user/*"); //print("<pre>".print_r($folder,1)."</pre>"); foreach ($folder as $val) { $UserFile = glob($val . "/*.dat"); foreach ($UserFile as $FileName) { $file = basename($FileName, ".dat"); if (is_numeric($file)) { $chars[] = $FileName; } } //print("<pre>".print_r($UserFile,1)."</pre>"); } print '<table border="0" cellspacing="1"><tbody>'; foreach ($chars as $file) { $char = new char(ParseFile($file)); print "<tr><td>"; $char->ShowImage(); print "</td><td>"; print $char->Name(bold); print "</td><td>"; print "Lv:" . $char->level; print "</td><td>"; print "Str:{$char->str}<br />Int:{$char->int}<br />Dex:{$char->dex}<br />Spd:{$char->spd}"; print "</td></tr>"; } print "</tbody></table>"; ?> </body> </html>