From 39b66fd6261ee75bd9e0bb482384333aa6906e8c Mon Sep 17 00:00:00 2001 From: Hide_D Date: Mon, 28 Nov 2022 23:51:21 +0900 Subject: [PATCH] =?UTF-8?q?misc:=20=EC=82=AC=EC=9A=A9=EB=90=98=EC=A7=80=20?= =?UTF-8?q?=EC=95=8A=EB=8A=94=20=EA=B5=AC=EB=B2=84=EC=A0=84=20=EB=B6=80?= =?UTF-8?q?=EB=8C=80=ED=8E=B8=EC=84=B1=20=EC=BD=94=EB=93=9C=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .phan/config.php | 1 - hwe/j_troop.php | 146 ----------------------------------------------- hwe/ts/troop.ts | 120 -------------------------------------- 3 files changed, 267 deletions(-) delete mode 100644 hwe/j_troop.php delete mode 100644 hwe/ts/troop.ts diff --git a/.phan/config.php b/.phan/config.php index 1daf4128..973c8369 100644 --- a/.phan/config.php +++ b/.phan/config.php @@ -112,7 +112,6 @@ return [ 'hwe/j_set_my_setting.php', 'hwe/j_set_npc_control.php', 'hwe/j_simulate_battle.php', - 'hwe/j_troop.php', 'hwe/j_update_picked_general.php', 'hwe/j_vacation.php', 'hwe/lib.php', diff --git a/hwe/j_troop.php b/hwe/j_troop.php deleted file mode 100644 index 007912ba..00000000 --- a/hwe/j_troop.php +++ /dev/null @@ -1,146 +0,0 @@ -setReadOnly(); -$userID = $session::getUserID(); - -increaseRefresh("부대명령", 0); - -$db = DB::db(); - -$me = $db->queryFirstRow('SELECT `no`, name, nation, troop FROM general WHERE `owner`=%i', $userID); -$generalID = $me['no']; -$nationID = $me['nation']; - -if($action == '부대창설'){ - $name = StringUtil::neutralize($name); - if(!$name){ - Json::die([ - 'result'=>false, - 'reason'=>'부대 이름이 없습니다.' - ]); - } - if($me['troop'] != 0){ - Json::die([ - 'result'=>false, - 'reason'=>'이미 부대에 가입해있습니다.' - ]); - } - $db->insert('troop',[ - 'troop_leader'=>$generalID, - 'name'=>$name, - 'nation'=>$nationID, - ]); - - $db->update('general', [ - 'troop'=>$generalID, - ], 'no=%i',$generalID); - - Json::die([ - 'result'=>true, - 'reason'=>'success' - ]); -} - -if($action == '부대추방'){ - if (!$gen){ - Json::die([ - 'result'=>false, - 'reason'=>'장수를 지정해야 합니다.' - ]); - } - - $db->update('general', [ - 'troop'=>0 - ], 'no=%i AND troop = %i', $gen, $generalID); - - if($db->affectedRows() == 0){ - Json::die([ - 'result'=>false, - 'reason'=>'부대장이 아니거나, 장수를 잘못 지정했습니다.' - ]); - } - - Json::die([ - 'result'=>true, - 'reason'=>'success' - ]); -} - -if ($action == '부대가입') { - if(!$troop){ - Json::die([ - 'result'=>false, - 'reason'=>'부대를 지정해야 합니다.' - ]); - } - - if($me['troop'] === $generalID){ - Json::die([ - 'result'=>false, - 'reason'=>'부대장입니다.' - ]); - } - - $troopExists = $db->queryFirstField('SELECT `troop_leader` FROM `troop` WHERE `troop_leader` = %i AND `nation` = %i', $troop, $nationID); - - if (!$troopExists) { - Json::die([ - 'result'=>false, - 'reason'=>'올바른 부대장이 아닙니다.' - ]); - } - - $db->update('general', [ - 'troop'=>$troop - ], 'no=%i', $generalID); - - Json::die([ - 'result'=>true, - 'reason'=>'success' - ]); -} - -if($action == "부대탈퇴") { - - if($me['troop'] == 0){ - Json::die([ - 'result'=>false, - 'reason'=>'부대에 속해있지 않습니다.' - ]); - } - - //부대장일 경우 - if($me['troop'] === $generalID){ - $db->update('general', [ - 'troop'=>0 - ], 'troop=%i',$generalID); - $db->delete('troop', 'troop_leader=%i', $generalID); - } - else{ - $db->update('general', [ - 'troop'=>0 - ], 'no=%i', $generalID); - } - - Json::die([ - 'result'=>true, - 'reason'=>'success' - ]); -} - -Json::die([ - 'result'=>false, - 'reason'=>'올바르지 않은 명령입니다.' -]); \ No newline at end of file diff --git a/hwe/ts/troop.ts b/hwe/ts/troop.ts deleted file mode 100644 index edc898db..00000000 --- a/hwe/ts/troop.ts +++ /dev/null @@ -1,120 +0,0 @@ -import "@scss/troop.scss"; - -import { errUnknown } from "@/common_legacy"; -import { launchTroopPlugin } from "@/extPluginTroop"; -import jQuery from "jquery"; -import { SammoAPI } from "./SammoAPI"; -import { isString } from "lodash-es"; - -jQuery(function($){ - //btnJoinTroop, btnLeaveTroop, btnKickTroop, btnCreateTroop, btnChangeTroopName - $('#btnLeaveTroop').click(function(){ - if(!confirm("정말 부대를 탈퇴하시겠습니까?")){ - return false; - } - $.post({ - url:'j_troop.php', - dataType:'json', - data:{ - action:'부대탈퇴' - } - }).then(function(data){ - console.log(data); - if(!data.result){ - alert(data.reason); - location.reload(); - } - - location.reload(); - - }, errUnknown); - return false; - }); - - $('#btnCreateTroop').click(function(){ - $.post({ - url:'j_troop.php', - dataType:'json', - data:{ - action:'부대창설', - name:$('#newTroopName').val() - } - }).then(function(data){ - console.log(data); - if(!data.result){ - alert(data.reason); - location.reload(); - } - - location.reload(); - - }, errUnknown); - return false; - }); - - $('#btnChangeTroopName').on('click', async ()=>{ - try{ - await SammoAPI.Nation.SetTroopName({ - troopID: parseInt($('#changeNameTroopID').val() as string), - troopName: $('#changeTroopName').val() as string, - }); - location.reload(); - } - catch(e){ - console.error(e); - if(isString(e)){ - alert(e); - } - else{ - errUnknown(); - } - location.reload(); - } - return false; - }); - - $('#btnKickTroop').click(function(){ - $.post({ - url:'j_troop.php', - dataType:'json', - data:{ - action:'부대추방', - gen:$('#genNo').val() - } - }).then(function(data){ - console.log(data); - if(!data.result){ - alert(data.reason); - location.reload(); - } - - location.reload(); - - }, errUnknown); - return false; - }); - - $('#btnJoinTroop').click(function(){ - $.post({ - url:'j_troop.php', - dataType:'json', - data:{ - action:'부대가입', - troop:$('.troopId:checked').val() - } - }).then(function(data){ - console.log(data); - if(!data.result){ - alert(data.reason); - location.reload(); - } - - location.reload(); - - }, errUnknown); - return false; - }); - - - launchTroopPlugin($); -}); \ No newline at end of file