| - + | |
| =allButton()?> | |
|
-
+
+
+
+ 전체 메시지(최고99자)
+
+ 개인 메시지(최고99자)
+
+
+
+
+ 국가 메시지(최고99자)
+
+ | |
| diff --git a/twe/j_msgsubmit.php b/twe/j_msgsubmit.php index a74f4b84..595c2c15 100644 --- a/twe/j_msgsubmit.php +++ b/twe/j_msgsubmit.php @@ -74,13 +74,6 @@ if($con >= 2) { ]); } -//FIXME: 원래는 필요없는 값이지만 예전 코드와 꼬일 수 있어 유지함. -$msg = str_replace('|', '', $msg); - -//TODO: 몰라서 임시로 값 세팅해봄. 추후에 용도를 확인하고 수정 필요 -//$s = 50; -//$msg = _String::SubStrForWidth($msg, $s, 198); - //SubStrForWidth는 반각은 1, 전각은 2로 측정하는듯 보이나, 대부분 글자수 단위로 카운트 하고 있어 mb_substr로 처리함. $msg = mb_substr($msg, 0, 99, 'UTF-8'); $msg = trim($msg); @@ -109,7 +102,7 @@ if($src['nation_id'] != 0) { // 전체 메세지 if($destMailbox == 9999) { - sendMessage('public', $src, [], $msg, $date); + sendMessage('public', $src, null, $msg, $date); // 국가 메세지 } elseif($destMailbox >= 9000) { @@ -119,9 +112,9 @@ if($destMailbox == 9999) { else{ $real_nation = $dest - 9000; } - $nation = $db->queryFirstRow('select nation,name,color from nation where nation=%i',$real_nation); + $nation = getNationStaticInfo($real_nation); - if($nation === NULL || empty($nation)){ + if($nation === null || empty($nation)){ $dest = ['nation_id' => 0]; } else{ @@ -167,15 +160,14 @@ if($destMailbox == 9999) { 'id' => $destMailbox, 'name' => $dest_user['name'] ]; - if($dest_user['nation'] != 0){ - $nation = $db->queryFirstRow('select nation,name,color from nation where nation=%i',$dest_user['nation']); - - $color = $nation['color']; + $destNation = getNationStaticInfo($dest_user['nation']); + if($destNation){ + $color = $destNation['color']; $color = str_replace('##', '#', $color); //FIXME: nation table에서 color가 #포함된 걸로 바뀔 경우를 대비 $dest['color'] = $color; - $dest['nation'] = $nation['name']; - $dest['nation_id'] = $nation['nation']; + $dest['nation'] = $destNation['name']; + $dest['nation_id'] = $destNation['nation']; } sendMessage('private', $src, $dest, $msg, $date); } diff --git a/twe/lib.php b/twe/lib.php index e51ab70c..a3862b3f 100644 --- a/twe/lib.php +++ b/twe/lib.php @@ -252,6 +252,17 @@ function LogText($prefix, $variable){ fclose($fp); } +function ArrayToDict($arr, $keyName){ + $result = []; + + foreach($arr as $obj){ + $key = $obj[$keyName]; + $result[$key] = $obj; + } + + return $result; +} + function dictToArray($dict, $keys){ $result = []; @@ -288,6 +299,14 @@ function isDict(&$array){ function eraseNullValue(&$dict, $depth=512){ //TODO:Test 추가 + if($dict === null){ + return null; + } + + if(is_array($dict) && empty($dict)){ + return null; + } + if($depth <= 0){ return $dict; } @@ -297,10 +316,19 @@ function eraseNullValue(&$dict, $depth=512){ unset($dict[$key]); } else if(isDict($value)){ - $dict[$key] = eraseNullKey($value, $depth - 1); + $newValue = eraseNullKey($value, $depth - 1); + if($newValue === null){ + unset($dict[$key]); + } + else{ + $dict[$key] = $newValue; + } + } } + + return $dict; } diff --git a/twe/process_war.php b/twe/process_war.php index 89a9ae7d..2d5fe0ad 100644 --- a/twe/process_war.php +++ b/twe/process_war.php @@ -1735,18 +1735,14 @@ function ConquerCity($connect, $game, $general, $city, $nation, $destnation) { $loseGeneralGold += $loseGold; $loseGeneralRice += $loseRice; - /* - //TODO:등용장 재디자인 - //xxx: 일단 끔 //모두 등용장 발부 if($nation['name'] == "강족" || $nation['name'] == "저족" || $nation['name'] == "흉노족" || $nation['name'] == "남만족" || $nation['name'] == "산월족" || $nation['name'] == "오환족" || $nation['name'] == "왜족") { //등용장 미발부 } elseif(rand() % 100 < 50) { - ScoutMsg($connect, $ruler['no'], $nation['name'], $gen['no'], $gen['msgindex']); + sendScoutMsg($connect, $ruler['no'], $nation['name'], $gen['no'], $gen['msgindex']); } - */ //NPC인 경우 10% 확률로 임관(엔장, 인재, 의병) if($gen['npc'] >= 2 && $gen['npc'] <= 4 && rand() % 100 < 10) { @@ -1864,6 +1860,8 @@ function ConquerCity($connect, $game, $general, $city, $nation, $destnation) { //장수 사기 감소 $query = "update general set atmos=atmos*0.8 where nation='{$destnation['nation']}'"; MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); + + getNationStaticInfo(null, true); } } |