diff --git a/che_close/_simul.php b/che_close/_simul.php index 7790a72..5421dee 100644 --- a/che_close/_simul.php +++ b/che_close/_simul.php @@ -206,6 +206,7 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평 //회피 $ratio = rand() % 100; // 0 ~ 99 $ratio2 = getRate($game, $general[crewtype], "avd"); //회피율 + $ratio2 = round($ratio2 * $general['train'] / 100); //훈련 반영 if($ratio < $ratio2 && $avoid == 1) { $msg .= "회피했다!
"; $myCrew /= 10; // 10%만 소모 @@ -570,6 +571,7 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평 //회피 $ratio = rand() % 100; // 0 ~ 99 $ratio2 = getRate($game, $general[crewtype], "avd"); //회피율 + $ratio2 = round($ratio2 * $general['train'] / 100); //훈련 반영 if($ratio < $ratio2 && $myAvoid == 1) { $msg .= "회피했다!
"; $myCrew /= 10; // 10%만 소모 @@ -578,6 +580,7 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평 //회피 $ratio = rand() % 100; // 0 ~ 99 $ratio2 = getRate($game, $oppose[crewtype], "avd"); //회피율 + $ratio2 = round($ratio2 * $oppose['train'] / 100); //훈련 반영 if($ratio < $ratio2 && $opAvoid == 1) { $msg .= "●상대가 회피했다!
"; $opCrew /= 10; // 10%만 소모 diff --git a/che_close/func.php b/che_close/func.php index cd662c1..b61a88e 100644 --- a/che_close/func.php +++ b/che_close/func.php @@ -12,6 +12,32 @@ function randF(){ return mt_rand() / mt_getrandmax(); } +/** + * 각 값의 비중에 따라 랜덤한 값을 선택 + * + * @param array 각 수치의 비중 + * + * @return object 선택된 랜덤 값의 key값. 단순 배열인 경우에는 index + */ +function ChooseRandomItem($items){ + $sum = 0; + foreach($items as $value){ + $sum += $value; + } + + $rd = randF()*$sum; + foreach($items as $key=>$value){ + if($rd <= $value){ + return $key; + } + $rd -= $value; + } + + //fallback. 이곳으로 빠지지 않음 + end($items); + return key($items); +} + // 37.5 ~ 75 function abilityRand() { $total = 150; @@ -90,7 +116,7 @@ function delInDir($dir) { deldir("$dir/$FolderOrFile"); } // recursive else { - unlink("$dir/$FolderOrFile"); + @unlink("$dir/$FolderOrFile"); } } } diff --git a/che_close/func_process.php b/che_close/func_process.php index d1247d8..4b719eb 100644 --- a/che_close/func_process.php +++ b/che_close/func_process.php @@ -108,27 +108,41 @@ function getGeneralIntel(&$general, $withInjury, $withItem, $withStatAdjust, $us * @return array 계산된 실패, 성공 확률 ('succ' => 성공 확률, 'fail' => 실패 확률) */ function CriticalRatioDomestic(&$general, $type) { - $leader = getGeneralLeadership($general, false, true, false, false); - $power = getGeneralPower($general, false, true, false, false); - $intel = getGeneralIntel($general, false, true, false, false); + $leader = getGeneralLeadership($general, false, true, true, false); + $power = getGeneralPower($general, false, true, true, false); + $intel = getGeneralIntel($general, false, true, true, false); $avg = ($leader+$power+$intel) / 3; - // 707010장수 18/21% 706515장수 16/27% 706020장수 14/33% xx50xx장수 10/50% + /* + * 능력치가 높아질 수록 성공 확률 감소. 실패 확률도 감소 + + * 무력 내정 기준(지력 내정 방식과 구조 동일) + 756510(32%/30%), 707010(28%/25%), 657510(23%/20%) + 106575(23%/20%), 107070(20%/17%), 107565(17%/15%) + 506040(33%/30%), 505050(43%/40%), 504060(50%/50%) + + * 통솔 내정 기준 + 756510(25%/22%), 707010(31%/28%), 657510(38%,35%), + 505050(50%,50%), 107070(50%,50%) + */ switch($type) { case 0: $ratio = $avg / $leader; break; case 1: $ratio = $avg / $power; break; case 2: $ratio = $avg / $intel; break; } - if($ratio > 1) $ratio = 1; + $ratio = min($ratio, 1.2); - $r[fail] = (0.2 / $ratio - 0.1) * 100; - $r[succ] = ($ratio - 0.5) * 100; + $fail = pow($ratio / 1.2, 1.4) - 0.3; + $succ = pow($ratio / 1.2, 1.5) - 0.25; - if($r[fail] < 0) { $r[fail] = 0; } - $r[succ] += $r[fail]; - if($r[succ] > 100) { $r[succ] = 100; } + $fail = min(max($fail, 0), 0.5); + $succ = min(max($succ, 0), 0.5); - return $r; + + return array( + 'succ'=>$succ, + 'fail'=>$fail + ); } /** @@ -154,10 +168,10 @@ function setLeadershipBonus(&$general, $nationLevel){ function CriticalScore($score, $type) { switch($type) { case 0: - $ratio = (rand()%9 + 20)/10; // 2.0~2.8 + $ratio = randF()*0.8 + 2.2; // 2.2~3.0 break; case 1: - $ratio = (rand()%3 + 2)/10; // 0.2~0.4 + $ratio = randF()*0.2 + 0.2; // 0.2~0.4 break; } return round($score * $ratio); @@ -214,20 +228,21 @@ function process_1($connect, &$general, $type) { // 군사 보정 if($general[level] == 3 && $general[no] == $city[gen2]) { $score *= 1.05; } - $rd = rand() % 100; + $rd = randF(); $r = CriticalRatioDomestic($general, 2); // 특기보정 : 경작, 상재 - if($type == 1 && $general[special] == 1) { $r[succ] += 10; $score *= 1.1; $admin[develcost] *= 0.8; } - if($type == 2 && $general[special] == 2) { $r[succ] += 10; $score *= 1.1; $admin[develcost] *= 0.8; } - + if($type == 1 && $general['special'] == 1) { $r['succ'] += 0.1; $score *= 1.1; $admin['develcost'] *= 0.8; } + if($type == 2 && $general['special'] == 2) { $r['succ'] += 0.1; $score *= 1.1; $admin['develcost'] *= 0.8; } + //민심 반영 + if($city['rate'] < 80) { $r['succ'] *= $city['rate'] / 80; } //버그방지 if($score < 1) $score = 1; - if($r[fail] > $rd) { + if($r['fail'] > $rd) { $score = CriticalScore($score, 1); $log[count($log)] = "●{$admin[month]}월:{$dtype}{$atype} 실패하여 $score 상승했습니다. <1>$date"; - } elseif($city[rate] >= 80 && $r[succ] > $rd) { + } elseif($r['succ'] + $r['fail'] > $rd) { $score = CriticalScore($score, 0); $log[count($log)] = "●{$admin[month]}월:{$dtype}{$atype} 성공하여 $score 상승했습니다. <1>$date"; } else { @@ -302,18 +317,20 @@ function process_3($connect, &$general) { // 군주, 참모, 모사 보정 if($general[level] == 12 || $general[level] == 11 || $general[level] == 9 || $general[level] == 7 || $general[level] == 5) { $score *= 1.05; } - $rd = rand() % 100; - $r = CriticalRatioDomestic($general, 0); + $rd = randF(); + $r = CriticalRatioDomestic($general, 2); // 특기보정 : 발명 - if($general[special] == 3) { $score *= 1.1; $admin[develcost] *= 0.8; $r[succ] += 10; } + if($general['special'] == 3) { $r['succ'] += 0.1; $score *= 1.1; $admin['develcost'] *= 0.8; } + //민심 반영 + if($city['rate'] < 80) { $r['succ'] *= $city['rate'] / 80; } //버그방지 if($score < 1) $score = 1; - if($r[fail] > $rd) { + if($r['fail'] > $rd) { $score = CriticalScore($score, 1); $log[count($log)] = "●{$admin[month]}월:{$dtype}를 실패하여 $score 상승했습니다. <1>$date"; - } elseif($city[rate] >= 80 && $r[succ] > $rd) { + } elseif($r['succ'] + $r['fail'] > $rd) { $score = CriticalScore($score, 0); $log[count($log)] = "●{$admin[month]}월:{$dtype}를 성공하여 $score 상승했습니다. <1>$date"; } else { @@ -397,18 +414,18 @@ function process_4($connect, &$general) { // 시중 보정 if($general[level] == 2 && $general[no] == $city[gen3]) { $score *= 1.05; } - $rd = rand() % 100; + $rd = randF(); $r = CriticalRatioDomestic($general, 0); // 특기보정 : 인덕 - if($general[special] == 20) { $r[succ] += 10; $admin[develcost] *= 0.8; $score *= 1.1; } + if($general['special'] == 20) { $r['succ'] += 0.1; $score *= 1.1; $admin['develcost'] *= 0.8; } //버그방지 if($score < 1) $score = 1; - if($r[fail] > $rd) { + if($r['fail'] > $rd) { $score = CriticalScore($score, 1); $log[count($log)] = "●{$admin[month]}월:선정을 실패하여 민심이 $score 상승했습니다. <1>$date"; - } elseif($r[succ] > $rd) { + } elseif($r['succ'] + $r['fail'] > $rd) { $score = CriticalScore($score, 0); $log[count($log)] = "●{$admin[month]}월:선정을 성공하여 민심이 $score 상승했습니다. <1>$date"; } else { @@ -492,19 +509,21 @@ function process_5($connect, &$general, $type) { // 태수 보정 if($general[level] == 4 && $general[no] == $city[gen1]) { $score *= 1.05; } - $rd = rand() % 100; // 현재 20% - $r = CriticalRatioDomestic($general, 0); + $rd = randF(); + $r = CriticalRatioDomestic($general, 1); // 특기보정 : 수비, 축성 - if($type == 1 && $general[special] == 11) { $r[succ] += 10; $score *= 1.1; $admin[develcost] *= 0.8; } - if($type == 2 && $general[special] == 10) { $r[succ] += 10; $score *= 1.1; $admin[develcost] *= 0.8; } + if($type == 1 && $general['special'] == 11) { $r['succ'] += 0.1; $score *= 1.1; $admin['develcost'] *= 0.8; } + if($type == 2 && $general['special'] == 10) { $r['succ'] += 0.1; $score *= 1.1; $admin['develcost'] *= 0.8; } + //민심 반영 + if($city['rate'] < 80) { $r['succ'] *= $city['rate'] / 80; } //버그방지 if($score < 1) $score = 1; - if($r[fail] > $rd) { + if($r['fail'] > $rd) { $score = CriticalScore($score, 1); $log[count($log)] = "●{$admin[month]}월:{$dtype}를 실패하여 $score 상승했습니다. <1>$date"; - } elseif($city[rate] >= 80 && $r[succ] > $rd) { + } elseif($r['succ'] + $r['fail'] > $rd) { $score = CriticalScore($score, 0); $log[count($log)] = "●{$admin[month]}월:{$dtype}를 성공하여 $score 상승했습니다. <1>$date"; } else { @@ -581,18 +600,18 @@ function process_7($connect, &$general) { // 시중 보정 if($general[level] == 2 && $general[no] == $city[gen3]) { $score *= 1.05; } - $rd = rand() % 100; // 현재 20% + $rd = randF(); $r = CriticalRatioDomestic($general, 0); // 특기보정 : 인덕 - if($general[special] == 20) { $r[succ] += 10; $score *= 1.1; $admin[develcost] *= 0.8; } + if($general['special'] == 20) { $r['succ'] += 0.1; $score *= 1.1; $admin['develcost'] *= 0.8; } //버그방지 if($score < 1) $score = 1; - if($r[fail] > $rd) { + if($r['fail'] > $rd) { $score = CriticalScore($score, 1); $log[count($log)] = "●{$admin[month]}월:장려를 실패하여 주민이 {$score}0명 증가했습니다. <1>$date"; - } elseif($r[succ] > $rd) { + } elseif($r['succ'] + $r['fail'] > $rd) { $score = CriticalScore($score, 0); $log[count($log)] = "●{$admin[month]}월:장려를 성공하여 주민이 {$score}0명 증가했습니다. <1>$date"; } else { @@ -675,18 +694,20 @@ function process_8($connect, &$general) { // 태수 보정 if($general[level] == 4 && $general[no] == $city[gen1]) { $score *= 1.05; } - $rd = rand() % 100; // 현재 20% - $r = CriticalRatioDomestic($general, 0); + $rd = randF(); + $r = CriticalRatioDomestic($general, 1); // 특기보정 : 통찰 - if($general[special] == 12) { $r[succ] += 10; $score *= 1.1; $admin[develcost] *= 0.8; } + if($general['special'] == 12) { $r['succ'] += 0.1; $score *= 1.1; $admin['develcost'] *= 0.8; } + //민심 반영 + if($city['rate'] < 80) { $r['succ'] *= $city['rate'] / 80; } //버그방지 if($score < 1) $score = 1; - if($r[fail] > $rd) { + if($r['fail'] > $rd) { $score = CriticalScore($score, 1); $log[count($log)] = "●{$admin[month]}월:{$dtype}을 실패하여 $score 강화했습니다. <1>$date"; - } elseif($city[rate] >= 80 && $r[succ] > $rd) { + } elseif($r['succ'] + $r['fail'] > $rd) { $score = CriticalScore($score, 0); $log[count($log)] = "●{$admin[month]}월:{$dtype}을 성공하여 $score 강화했습니다. <1>$date"; } else { @@ -784,7 +805,7 @@ function process_9($connect, &$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); } - switch(rand()%3) { + switch(ChooseRandomItem(array($general['leader'], $general['power'], $general['intel']))) { case 0: $general[leader2]++; $query = "update general set resturn='SUCCESS',leader2='$general[leader2]',dedication=dedication+'$ded',experience=experience+'$exp' where no='$general[no]'"; @@ -1960,7 +1981,7 @@ function process_29($connect, &$general) { if(rand() % $criteria > 0) { $exp = 100; $ded = 70; - switch(rand()%3) { + switch(ChooseRandomItem(array($general['leader'], $general['power'], $general['intel']))) { case 0: $general[leader2] += 1; break; case 1: $general[power2] += 1; break; case 2: $general[intel2] += 1; break; @@ -1970,7 +1991,7 @@ function process_29($connect, &$general) { // 탐색 성공 $exp = 200; $ded = 300; - switch(rand()%3) { + switch(ChooseRandomItem(array($general['leader'], $general['power'], $general['intel']))) { case 0: $general[leader2] += 3; break; case 1: $general[power2] += 3; break; case 2: $general[intel2] += 3; break; @@ -3913,7 +3934,7 @@ function process_49($connect, &$general) { MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); // 경험치 상승 - switch(rand()%3) { + switch(ChooseRandomItem(array($general['leader'], $general['power'], $general['intel']))) { case 0: $general[leader2]++; $query = "update general set leader2='$general[leader2]' where no='$general[no]'"; diff --git a/che_close/install.php b/che_close/install.php index 10f0fc7..04057a2 100644 --- a/che_close/install.php +++ b/che_close/install.php @@ -1,8 +1,23 @@
재설치하려면 해당 파일을 지우세요"); +include "lib.php"; - @chmod(".",0707); +$justReset = isset($_GET['just_reset'])?intval($_GET['just_reset']):0; + +if(file_exists("d_setting/set.php")){ + //DB 리셋만 하려는 것인지 검사 필요. + $connect = dbConn(); + requireUserLevel($connect, 5); + + if(!$justReset){ + error("이미 set.php가 생성되어 있습니다.

재설치하려면 해당 파일을 지우세요"); + } + +} +else{ + $justReset = 0; +} + +@chmod(".",0707); ?> @@ -72,9 +87,10 @@ if(!$check) {

- + diff --git a/che_close/install2.php b/che_close/install2.php index 4f2f068..15f6bf4 100644 --- a/che_close/install2.php +++ b/che_close/install2.php @@ -1,5 +1,8 @@ diff --git a/che_close/install2_ok.php b/che_close/install2_ok.php index 9473682..3891252 100644 --- a/che_close/install2_ok.php +++ b/che_close/install2_ok.php @@ -3,7 +3,7 @@ include "lib.php"; include "func.php"; $connect=dbConn(); - +requireUserLevel($connect, 5); $query = "select count(no) as cnt from general where user_id = 'admin'"; $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); @@ -80,7 +80,7 @@ if($img < 1) { $picture = 'default.jpg'; }; $connect ) or Error(__LINE__.MYDB_error($connect),""); -$pw = md5('12qw!@QW12qw!@QW'); +$pw = md5('12');//부운영자는 계정은 만들지만 로그인 가능하게 하진 않는다. $picture = 'pic_2.jpg'; if($img < 1) { $picture = 'default.jpg'; }; diff --git a/che_close/install_ok.php b/che_close/install_ok.php index f57a9ab..0c0a05d 100644 --- a/che_close/install_ok.php +++ b/che_close/install_ok.php @@ -3,22 +3,38 @@ include "lib.php"; include "schema.sql"; include "func.php"; -if(file_exists("d_setting/set.php")) error("이미 set.php가 생성되어 있습니다.

재설치하려면 해당 파일을 지우세요"); +$justReset = isset($_POST['just_reset'])?intval($_POST['just_reset']):0; -// 호스트네임, 아이디, DB네임, 비밀번호의 공백여부 검사 -if(isBlank($hostname)) Error("HostName을 입력하세요",""); -if(isBlank($user_id)) Error("User ID 를 입력하세요",""); -if(isBlank($dbname)) Error("DB NAME을 입력하세요",""); -// DB에 커넥트 하고 DB NAME으로 select DB -$connect = MYDB_connect($hostname,$user_id,$password) or Error("MySQL-DB Connect
Error!!!",""); -if(MYDB_error($connect)) Error(__LINE__.MYDB_error($connect),""); -MYDB_select_db($dbname, $connect) or Error("MySQL-DB Select
Error!!!",""); +if(file_exists("d_setting/set.php")){ + $connect = dbConn(); + requireUserLevel($connect, 5); + + if(!$justReset){ + error("이미 set.php가 생성되어 있습니다.

재설치하려면 해당 파일을 지우세요"); + } +} +else{ + $justReset = 0; +} + +if(!$justReset){ + // 호스트네임, 아이디, DB네임, 비밀번호의 공백여부 검사 + if(isBlank($hostname)) Error("HostName을 입력하세요",""); + if(isBlank($user_id)) Error("User ID 를 입력하세요",""); + if(isBlank($dbname)) Error("DB NAME을 입력하세요",""); + + // DB에 커넥트 하고 DB NAME으로 select DB + $connect = MYDB_connect($hostname,$user_id,$password) or Error("MySQL-DB Connect
Error!!!",""); + if(MYDB_error($connect)) Error(__LINE__.MYDB_error($connect),""); + MYDB_select_db($dbname, $connect) or Error("MySQL-DB Select
Error!!!",""); +} delInDir("logs"); delInDir("data/session"); @unlink("data/connected.php"); + // 관리자 테이블 삭제 if(isTable($connect, "game", $dbname)) @MYDB_query("drop table game", $connect) or Error("drop ".MYDB_error($connect),""); // 락 테이블 삭제 @@ -77,13 +93,15 @@ if(!isTable($connect, "statistic",$dbname)) @MYDB_query($statistic_schema, $conn // 연감 테이블 생성 if(!isTable($connect, "history",$dbname)) @MYDB_query($history_schema, $connect) or Error("create history ".MYDB_error($connect),""); -// 파일로 DB 정보 저장 -$file=@fopen("d_setting/set.php","w") or Error("set.php 파일 생성 실패

디렉토리의 퍼미션을 707로 주십시요",""); -@fwrite($file,"\n") or Error("set.php 파일 생성 실패

디렉토리의 퍼미션을 707로 주십시요",""); -@fclose($file); -@mkdir("data",0707); -@chmod("data",0707); -@chmod("d_setting/set.php",0707); +if(!$justReset){ + // 파일로 DB 정보 저장 + $file=@fopen("d_setting/set.php","w") or Error("set.php 파일 생성 실패

디렉토리의 퍼미션을 707로 주십시요",""); + @fwrite($file,"\n") or Error("set.php 파일 생성 실패

디렉토리의 퍼미션을 707로 주십시요",""); + @fclose($file); + @mkdir("data",0707); + @chmod("data",0707); + @chmod("d_setting/set.php",0707); +} $temp=MYDB_fetch_array(MYDB_query("select count(*) from general where level = '1'", $connect)); diff --git a/che_close/join_post.php b/che_close/join_post.php index 793c8bf..2f573b1 100644 --- a/che_close/join_post.php +++ b/che_close/join_post.php @@ -141,14 +141,23 @@ if($id_num) { } $city = $city[city]; - $total = 3 + rand() % 3; - $pleader = rand() % 100; - $ppower = rand() % 100; - $pintel = rand() % 100; - $rate = $pleader + $ppower + $pintel; - $pleader = floor($pleader / $rate * $total + 0.5); - $ppower = floor($ppower / $rate * $total + 0.5); - $pintel = floor($pintel / $rate * $total + 0.5); + + $pleader = 0; + $ppower = 0; + $pintel = 0; + for($statBonusCnt = 3 + rand() % 3; $statBonusCnt > 0; $statBonusCnt--){ + switch(ChooseRandomItem(array($leader, $power, $intel))){ + case 0: + $pleader++; + break; + case 1: + $ppower++; + break; + case 2: + $pintel++; + break; + } + } $leader = $leader + $pleader; $power = $power + $ppower; diff --git a/che_close/lib.php b/che_close/lib.php index 136369a..21063db 100644 --- a/che_close/lib.php +++ b/che_close/lib.php @@ -163,4 +163,59 @@ function PrintElapsedTime() { $_endTime = round(getMicroTime() - $_startTime, 3); echo "
- /inst_b_1.gif border=0 align=absmiddle> + +
경과시간 : {$_endTime}초
"; } + +function requireUserLevel($connect, $reqLevel=5){ + + if(isset($_SESSION['ownUserLevel']) && $_SESSION['ownUserLevel']>=$reqLevel){ + return; + } + + $p_id = isset($_SESSION['p_id'])?$_SESSION['p_id']:null; + if(!$p_id){ + + $query = "select count(*) as cnt from general where userlevel < $reqLevel limit 1"; + $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $cnt = MYDB_fetch_array($result); + + if($cnt['cnt'] == 0){ + //아직 제대로된 계정이 생성되지 않았다면 넘어간다. + //서버 리셋시 ~ 첫 유저 계정 생성시까지 취약점이 되지만, 구조상 어쩔 수 없다. + return; + } + + echo " + + + 로그인 되지 않음 + + + + + 각 서버에 로그인이 되지 않아 유저 정보를 확인할 수 없습니다. 서버 접속을 수행해주세요.
+ + "; + exit(); + } + + $query = "select userlevel from general where user_id='$p_id'"; + $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + $me = MYDB_fetch_array($result); + + if($me['userlevel'] < $reqLevel) { + echo " + + + 권한 부족 + + + + + 충분한 권한이 없습니다.
+ + "; + exit(); + } + + $_SESSION['ownUserLevel'] = $reqLevel; +} ?> diff --git a/che_close/logout_process.php b/che_close/logout_process.php index 00d3c88..20ddb89 100644 --- a/che_close/logout_process.php +++ b/che_close/logout_process.php @@ -12,11 +12,15 @@ $_SESSION[p_id] = ""; $_SESSION[p_name] = ""; $_SESSION[p_nation] = 0; +if(isset($_SEESION['ownUserLevel'])){ + unset($_SESSION['ownUserLevel']); +} + $id = $me[user_id]; $pw = $me[password]; $conmsg = $me[conmsg]; -//Ǻ +//���Ǻ��� ���� session_destroy(); echo ""; diff --git a/che_close/process_war.php b/che_close/process_war.php index 32cbbd4..ac8a3bf 100755 --- a/che_close/process_war.php +++ b/che_close/process_war.php @@ -301,11 +301,11 @@ function processWar($connect, $general, $city) { } } } elseif($general[crewtype] == 40) { // 정란 - $cityCrew = $cityCrew * 1.5; + $cityCrew = $cityCrew * 1.8; } elseif($general[crewtype] == 41) { // 충차 - $cityCrew = $cityCrew * 2.0; + $cityCrew = $cityCrew * 2.4; } elseif($general[crewtype] == 42) { // 벽력거 - $cityCrew = $cityCrew * 1.5; + $cityCrew = $cityCrew * 1.8; } //군주 공격 보정 10% if($general[level] == 12) { @@ -345,13 +345,14 @@ function processWar($connect, $general, $city) { //회피 $ratio = rand() % 100; // 0 ~ 99 $ratio2 = getRate($game, $general[crewtype], "avd"); //회피율 + $ratio2 = round($ratio2 * $general['train'] / 100); //훈련 반영 //특기보정 : 궁병 if($general[special2] == 51) { $ratio2 += 20; } //도구 보정 : 둔갑천서, 태평요술 if($general[item] == 26 || $general[item] == 25) { $ratio2 += 20; } if($ratio < $ratio2 && $avoid == 1) { $batlog[count($batlog)] = "회피했다!"; - $myCrew /= 10; // 10%만 소모 + $myCrew /= 5; // 20%만 소모 $avoid = 0; } @@ -1124,6 +1125,7 @@ function processWar($connect, $general, $city) { //회피 $ratio = rand() % 100; // 0 ~ 99 $ratio2 = getRate($game, $general[crewtype], "avd"); //회피율 + $ratio2 = round($ratio2 * $general['train'] / 100); //훈련 반영 //특기보정 : 돌격, 궁병 if($oppose[special2] == 60) { $ratio2 -= 100; } if($general[special2] == 51) { $ratio2 += 20; } @@ -1139,13 +1141,14 @@ function processWar($connect, $general, $city) { } else { $batlog[count($batlog)] = "회피했다!"; $oppbatlog[count($oppbatlog)] = "●상대가 회피했다!"; - $myCrew /= 10; // 10%만 소모 + $myCrew /= 5; // 20%만 소모 $myAvoid = 0; } } //회피 $ratio = rand() % 100; // 0 ~ 99 $ratio2 = getRate($game, $oppose[crewtype], "avd"); //회피율 + $ratio2 = round($ratio2 * $oppose['train'] / 100); //훈련 반영 // 특기보정 : 돌격, 궁병 if($general[special2] == 60) { $ratio2 -= 100; } if($oppose[special2] == 51) { $ratio2 += 20; } @@ -1167,7 +1170,7 @@ function processWar($connect, $general, $city) { } else { $oppbatlog[count($oppbatlog)] = "회피했다!"; $batlog[count($batlog)] = "●상대가 회피했다!"; - $opCrew /= 10; // 10%만 소모 + $opCrew /= 5; // 20%만 소모 $opAvoid = 0; } } @@ -1497,6 +1500,9 @@ function CriticalRatio3($general) { if ($crewtype >= 3) { $ratio /= 2; } + else{ + $ratio *= 0.7; + } $ratio = round($ratio); $ratio += 5; diff --git a/che_close/reset.php b/che_close/reset.php index 1ca0907..e3d4ace 100644 --- a/che_close/reset.php +++ b/che_close/reset.php @@ -5,29 +5,7 @@ include "schema.sql"; $connect = dbConn(); -print_r($_SESSION); -$query = "select userlevel from general where user_id='$_SESSION[p_id]'"; -$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); -$me = MYDB_fetch_array($result); - -if($me[userlevel] < 5) { - echo " - - -관리메뉴 - - - - -로그인 정보가 없습니다.
관리자라면 폐쇄중 로그인을 1회 실행해 주십시오.
-"; - banner(); - echo " - -"; - - exit(); -} +requireUserLevel($connect, 5); // 삭제 diff --git a/i_entrance/adminAction.js b/i_entrance/adminAction.js index 5fe0f79..868b999 100644 --- a/i_entrance/adminAction.js +++ b/i_entrance/adminAction.js @@ -79,7 +79,7 @@ function Entrance_AdminPost(server, select) { function(response, textStatus) { if(response.result == "SUCCESS") { Popup_WaitHide(); - if(select == 1) { + if(select == 1 || select == 3) { ReplaceFrame(response.installURL); } else { Replace(ENTRANCE+PHP); @@ -102,7 +102,7 @@ function Entrance_AdminNPCCreate(serverDir) { } function Entrance_AdminClosedLogin(serverDir) { - ReplaceFrame(serverDir+'_close'+W+'npc_login'+PHP); + ReplaceFrame(serverDir+'_close'+W+'index'+PHP); } function Entrance_AdminOpen119(serverDir) { diff --git a/i_entrance/adminInc.php b/i_entrance/adminInc.php index 5994943..79c6e8b 100644 --- a/i_entrance/adminInc.php +++ b/i_entrance/adminInc.php @@ -68,11 +68,11 @@ foreach($_serverDirs as $serverDir) {
- + + - - +
diff --git a/i_entrance/adminPost.php b/i_entrance/adminPost.php index 302cea3..39382d6 100644 --- a/i_entrance/adminPost.php +++ b/i_entrance/adminPost.php @@ -40,6 +40,9 @@ if($member['GRADE'] < 6) { rename(ROOT.W.$serverDir, ROOT.W.$serverDir."_rest"); rename(ROOT.W.$serverDir."_close", ROOT.W.$serverDir); $response['result'] = 'SUCCESS'; + } elseif($select == 3) { + $response['installURL'] = ROOT.W."{$serverDir}_close/install.php?just_reset=1"; + $response['result'] = 'SUCCESS'; } } else { $response['result'] = 'FAIL'; diff --git a/i_login/Action.js b/i_login/Action.js index 12331ac..387227b 100644 --- a/i_login/Action.js +++ b/i_login/Action.js @@ -1,3 +1,8 @@ +//localStorage for extremely old browsers +(function(){if(!this.localStorage)if(this.globalStorage)try{this.localStorage=this.globalStorage}catch(e){}else{var a=document.createElement("div");a.style.display="none";document.getElementsByTagName("head")[0].appendChild(a);if(a.addBehavior){a.addBehavior("#default#userdata");var d=this.localStorage={length:0,setItem:function(b,d){a.load("localStorage");b=c(b);a.getAttribute(b)||this.length++;a.setAttribute(b,d);a.save("localStorage")},getItem:function(b){a.load("localStorage");b=c(b);return a.getAttribute(b)}, +removeItem:function(b){a.load("localStorage");b=c(b);a.removeAttribute(b);a.save("localStorage");this.length--;if(0>this.length)this.length=0},clear:function(){a.load("localStorage");for(var b=0;attr=a.XMLDocument.documentElement.attributes[b++];)a.removeAttribute(attr.name);a.save("localStorage");this.length=0},key:function(b){a.load("localStorage");return a.XMLDocument.documentElement.attributes[b]}},c=function(a){return a.replace(/[^-._0-9A-Za-z\xb7\xc0-\xd6\xd8-\xf6\xf8-\u037d\u37f-\u1fff\u200c-\u200d\u203f\u2040\u2070-\u218f]/g, +"-")};a.load("localStorage");d.length=a.XMLDocument.documentElement.attributes.length}}})(); + function Login_Import() { ImportAction(HOME+I+LOGIN+W+FINDPW+W+ACTION); ImportAction(HOME+I+LOGIN+W+JOIN+W+ACTION); @@ -20,8 +25,6 @@ function Login_Init() { $(".Login_Emperior").click(function() { window.open('../che/a_emperior.php'); }); $(".Login_Traffic").click(function() { window.open('../che/a_traffic.php'); }); - $("#Login_00010007").focus(Login_DefaultConMsg); - $("#Login_00010008").click(Login_Findpw); $("#Login_00010009").click(Login_Join); $("#Login_00010010").click(Login_Login); @@ -42,15 +45,18 @@ function Login_Enter(e) { function Login_Update() { $("#Login_00010003").val(""); $("#Login_00010005").val(""); - $("#Login_00010007").val(""); + var oldLocation = localStorage.getItem('sammo_login_location'); + if(oldLocation){ + $("#Login_00010007").val(oldLocation); + } + else{ + $("#Login_00010007").val(""); + } + $("#Login_00010003").focus(); } -function Login_DefaultConMsg() { - $("#Login_00010007").val("자택"); -} - function Login_Login() { var id = $("#Login_00010003").val(); var pw = $("#Login_00010005").val(); @@ -78,6 +84,8 @@ function Login_Login() { return; } + localStorage.setItem('sammo_login_location',conmsg); + pw = hex_md5(pw+""+pw)+""+hex_md5(token); Popup_Wait(function() {