From 5187ebbf526e6afee214b65d2e6e8259ff9dc19c Mon Sep 17 00:00:00 2001 From: hide_d Date: Wed, 18 Apr 2018 22:34:13 +0900 Subject: [PATCH] =?UTF-8?q?=EC=B6=94=EB=B0=A9=20=EB=AA=B0=EC=88=98=20?= =?UTF-8?q?=EC=84=A0=ED=8F=AC=20=EB=93=B1=20=EC=83=81=ED=99=A9=EC=97=90?= =?UTF-8?q?=EC=84=9C=20=EB=A9=94=EC=8B=9C=EC=A7=80=20=20=EC=95=88=20?= =?UTF-8?q?=EB=82=98=ED=83=80=EB=82=98=EB=8A=94=20=EB=B2=84=EA=B7=B8=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/c_myBossInfo.php | 18 +++++++++++++++- hwe/func.php | 17 --------------- hwe/func_npc.php | 22 +++++++++++++++---- hwe/func_process_chief.php | 44 +++++++++++++++++++++++++++++++++++--- 4 files changed, 76 insertions(+), 25 deletions(-) diff --git a/hwe/c_myBossInfo.php b/hwe/c_myBossInfo.php index b149ddbb..795b5bdd 100644 --- a/hwe/c_myBossInfo.php +++ b/hwe/c_myBossInfo.php @@ -165,7 +165,23 @@ if($btn == "추방") { case 4: $str = "날 추방했으니 그 복수로 적국에 정보를 팔아 넘겨야겠군요. 그럼 이만."; break; } - PushMsg(1, 0, $general['picture'], $general['imgsvr'], "{$general['name']}:", $nation['color'], $nation['name'], $nation['color'], $str); + $src = new MessageTarget( + $general['no'], + $general['name'], + $general['nation'], + $nation['name'], + $nation['color'], + GetImageURL($general['imgsvr'], $general['picture']) + ); + $msg = new Message( + Message::MSGTYPE_PUBLIC, + $src, + $src, + $str, + new \DateTime(), + new \DateTime('9999-12-31') + ); + $msg->send(); } //국가 기술력 그대로 diff --git a/hwe/func.php b/hwe/func.php index 6ada2b7d..62207e58 100644 --- a/hwe/func.php +++ b/hwe/func.php @@ -1126,23 +1126,6 @@ function nationMsg() { echo "".$nation['msg'].""; } - -function PushMsg($type, $nation, $picture, $imgsvr, $from, $fromcolor, $to, $tocolor, $msg) { - if($nation == 0) { $nation = 0; } - if($fromcolor == "") { $fromcolor = "#FFFFFF"; } - if($to == "") { $to = "재야"; } - if($tocolor == "") { $tocolor = "#FFFFFF"; } - - $date = date('Y-m-d H:i:s'); - if($type == 1) { $file = "_all_msg.txt"; } - else { $file = "_nation_msg{$nation}.txt"; } - $fp = fopen(__dir__."/logs/{$file}", "a"); - //로그 파일에 기록 - $str = "{$type}|".StringUtil::padStringAlignRight($from,12," ")."|".StringUtil::padStringAlignRight($to,12," ")."|".$date."|".$msg."|".$fromcolor."|".$tocolor."|".$picture."|".$imgsvr; - fwrite($fp, "{$str}\n"); - fclose($fp); -} - function msgprint($msg, $name, $picture, $imgsvr, $when, $num, $type) { $db = DB::db(); $connect=$db->get(); diff --git a/hwe/func_npc.php b/hwe/func_npc.php index 095b118d..5e741a2f 100644 --- a/hwe/func_npc.php +++ b/hwe/func_npc.php @@ -286,10 +286,24 @@ function processAI($no) { case 6: $term = 30; break; case 7: $term = 60; break; } - if($general['npcid'] == 2000 && rand()%(24*$term) < 6) { - PushMsg(1, 0, $general['picture'], $general['imgsvr'], "{$general['name']}:", $nation['color'], $nation['name'], $nation['color'], $general['npcmsg']); - } elseif($general['npcmsg'] != "" && rand()%(24*$term) < 3) { - PushMsg(1, 0, $general['picture'], $general['imgsvr'], "{$general['name']}:", $nation['color'], $nation['name'], $nation['color'], $general['npcmsg']); + if($general['npcmsg'] != "" && rand()%(24*$term) < 3) { + $src = new MessageTarget( + $general['no'], + $general['name'], + $general['nation'], + $nation['name'], + $nation['color'], + GetImageURL($general['imgsvr'], $general['picture']) + ); + $msg = new Message( + Message::MSGTYPE_PUBLIC, + $src, + $src, + $general['npcmsg'], + new \DateTime(), + new \DateTime('9999-12-31') + ); + $msg->send(); } //재야인경우 diff --git a/hwe/func_process_chief.php b/hwe/func_process_chief.php index 275e96b6..fac6e7b4 100644 --- a/hwe/func_process_chief.php +++ b/hwe/func_process_chief.php @@ -173,7 +173,23 @@ function process_24(&$general) { case 4: $str = "몰수로 인한 사기 저하는 몰수로 얻은 물자보다 더 손해란걸 모른단 말인가!"; break; } - PushMsg(1, 0, $gen['picture'], $gen['imgsvr'], "{$gen['name']}:", $nation['color'], $nation['name'], $nation['color'], $str); + $src = new MessageTarget( + $gen['no'], + $gen['name'], + $gen['nation'], + $nation['name'], + $nation['color'], + GetImageURL($gen['imgsvr'], $gen['picture']) + ); + $msg = new Message( + Message::MSGTYPE_PUBLIC, + $src, + $src, + $str, + new \DateTime(), + new \DateTime('9999-12-31') + ); + $msg->send(); } $genlog[] = "●$dtype {$amount}을 몰수 당했습니다."; @@ -759,8 +775,30 @@ function process_62(&$general) { $msg = "【외교】{$admin['year']}년 {$admin['month']}월:{$younation['name']}에 선전포고"; $youmsg = "【외교】{$admin['year']}년 {$admin['month']}월:{$nation['name']}에서 선전포고"; - PushMsg(2, $nation['nation'], $general['picture'], $general['imgsvr'], "{$general['name']}:{$nation['name']}▶", $nation['color'], $younation['name'], $younation['color'], $msg); - PushMsg(3, $younation['nation'], $general['picture'], $general['imgsvr'], "{$general['name']}:{$nation['name']}▶", $nation['color'], $younation['name'], $younation['color'], $youmsg); + $src = new MessageTarget( + $general['no'], + $general['name'], + $general['nation'], + $nation['name'], + $nation['color'], + GetImageURL($general['imgsvr'], $general['picture']) + ); + $dest = new MessageTarget( + 0, + '', + $younation['nation'], + $younation['name'], + $younation['color'] + ); + $msg = new Message( + Message::MSGTYPE_NATIONAL, + $src, + $dest, + $str, + new \DateTime($general['turntime']), + new \DateTime('9999-12-31') + ); + $msg->send(true); } pushWorldHistory($history, $admin['year'], $admin['month']);