Compare commits

...
228 Commits
Author SHA1 Message Date
Hide_D da7fcafb27 사령부 NPC 색상 2018-04-17 03:45:57 +09:00
Hide_D 7f7d8b2099 명장일람 표기 오류 수정 2018-04-17 03:43:22 +09:00
Hide_D b5fb2e9cf4 중원 정보 분쟁 현황을 제대로 보여줌 2018-04-17 03:39:17 +09:00
Hide_D d9ffdf9df8 외교 서신 밀리는 버그 수정 2018-04-17 03:23:02 +09:00
Hide_D f919187b91 불가침 메시지 수정 2018-04-17 03:22:53 +09:00
Hide_D d5ead5b74f 재야일때 secretlimit 경고 뜨는거 해결 2018-04-17 03:11:00 +09:00
Hide_D ec1be2c887 합병 항복 안되는 버그 수정 2018-04-17 03:10:38 +09:00
Hide_D af0c470923 부대 가입 안되는 버그 수정 2018-04-17 03:10:25 +09:00
Hide_D 78ce7d20e3 거래장 에러로그 수정 2018-04-17 03:10:18 +09:00
Hide_D 932ce9bf51 도시 정보 배경 안보이는 ㅓㄱ수정 2018-04-17 03:06:55 +09:00
Hide_D 3d602b49bf 메시지 표기 프레임 변경 2018-04-17 02:14:58 +09:00
Hide_D 33b7d228f9 긴급 천도 버그 수정 2018-04-17 02:14:48 +09:00
Hide_D 95a8fd5495 토너먼트 표기 2018-04-17 02:14:38 +09:00
Hide_D 87bc416fc7 인사부 표기 버그 수정 2018-04-17 02:14:31 +09:00
Hide_D 8c21eec168 메시지 관련 버그 우회 2018-04-17 01:55:12 +09:00
Hide_D 7ef3f0d5c5 임시로 외교 서신 받는 기능 추가 2018-04-17 01:54:57 +09:00
Hide_D e90e508005 빙의 후 페이지 이동 2018-04-17 01:54:42 +09:00
Hide_D 816daed570 warning 방지 2018-04-17 01:54:03 +09:00
Hide_D 3626266763 시작 년도가 없는 경우 설정 2018-04-17 01:53:55 +09:00
Hide_D 6c117a628c 가운데에 버튼 세트 추가 2018-04-17 01:53:45 +09:00
Hide_D d3225dfb41 버그 수정 2018-04-17 01:53:32 +09:00
Hide_D bd7e7540d8 사령부 출력 오동작 수정 2018-04-17 01:53:23 +09:00
Hide_D 48088748df schema 버그 수정. DB에서 Exception 제대로 안 던지는 버그 해결 2018-04-17 00:18:38 +09:00
Hide_D 7a5eecc3e1 갠메를 보냈을 때 알림 표시 2018-04-17 00:03:40 +09:00
Hide_D 51d7dede55 nation table에서 외교 서신 보관용 column 삭제 2018-04-16 23:58:36 +09:00
Hide_D bcad77ec06 사령턴 외교 서신 재구현 2018-04-16 23:53:54 +09:00
Hide_D 9b79d12521 재야에서는 국메가 안보내지던 버그 수정
일반장이 국메를 보낼 수 없던 버그 수정
외교 서신 클래스 에러 수정
2018-04-16 23:29:17 +09:00
Hide_D 4b33461c70 _admin2의 query를 수정.
- 메시지 전송을 새로 만든 구현을 사용함.
- 테이블 두개 (MEMBER, SYSTEM)을 소문자로 변경
2018-04-16 22:31:54 +09:00
Hide_D bc3a8fefd8 최근 메시지만 전송 받도록 수정. 2018-04-16 08:18:40 +09:00
Hide_D db97400b43 기본 갠메, 국메, 전메 동작 2018-04-16 02:20:05 +09:00
Hide_D 3ad4032239 메시지 입력 버그 수정 중 2018-04-16 02:06:05 +09:00
Hide_D 1d0fb7151d lib.php의 글로벌 변수를 GameConst로 이동
- 계략의 게임 내 영단어를 trick에서 sabotage로 변경
2018-04-16 02:05:46 +09:00
Hide_D 0c9099c868 메시지 첫 동작 2018-04-16 01:09:43 +09:00
Hide_D c87cbaa0a6 등용장 생성시 버그 수정 2018-04-16 00:03:48 +09:00
Hide_D 5a94bf434a css style에서 단위(px)가 설정되지 않은 것들 수정 2018-04-15 23:57:22 +09:00
Hide_D d567f3218a 재야를 따로 다루던 코드 제거 2018-04-15 23:51:46 +09:00
Hide_D 5d97c4ebea mailbox 리스트에서 '재야'를 내부 코드로 처리 2018-04-15 23:48:39 +09:00
Hide_D c3be464774 메시지 시스템 외부로 연결중. 2018-04-15 23:42:59 +09:00
Hide_D 0d1e10a2ce 소소한 수정 switch 무서워라.. 2018-04-15 23:42:47 +09:00
Hide_D 723a7bbfba 장수 생성 시 오류 나던 문제 해결
- Validation 문제
2018-04-15 23:42:30 +09:00
Hide_D 6a100ed2c1 국가 정보 반환시 0인 경우에 한해 재야도 반환.
- 재야의 색을 #000000 으로 설정
2018-04-15 23:41:36 +09:00
Hide_D 5a6cd7fb46 서버에서 아이콘 주소를 바로 돌려주는 기능 추가 2018-04-15 23:39:41 +09:00
Hide_D 871c99a67a 외교 서신 메시지 파트 구현 완료
- 메시지 전송시 수신자에게만 전송 가능한 옵션 추가
- 메시지 추가 옵션으로 delete 옵션 제시.
2018-04-15 21:40:21 +09:00
Hide_D 7bdde2ac8a 외교 서신 상세 내용 추가
- 등용장의 로그 부분은 메시지로 뺌
2018-04-15 21:01:42 +09:00
Hide_D 3564282acb 라이선스 추가 2018-04-15 16:35:38 +09:00
Hide_D 13e24dbcb4 이미지 다운로드도 추가 2018-04-15 16:22:57 +09:00
Hide_D 0026e9cb15 이미지 다운로드도 추가 2018-04-15 16:22:45 +09:00
Hide_D 156795d7e9 readme 추가 2018-04-15 16:17:32 +09:00
Hide_D e41d73b5bd Diplomacy 생성자에서 두 국가르 받도록 변경
인접국 판단 로직을 두경우로 나눔
Diplomacy 클래스 구현중...
2018-04-15 04:07:59 +09:00
Hide_D 655cd1700c DiplomaticMessage 작성중
ScoutMessage 버그 개선
2018-04-15 02:41:00 +09:00
Hide_D 9fb455d38a 등용장 거절시 함수명 버그 수정 2018-04-14 23:46:02 +09:00
Hide_D 879a1e1c61 등용장 내부 로직 처리를 분리 2018-04-14 23:10:46 +09:00
Hide_D e614092690 MessageTarget의 부모 클래스 Target 추가 2018-04-14 22:12:40 +09:00
Hide_D 4ebe51d978 \DateTime 오타 수정 2018-04-14 15:44:47 +09:00
Hide_D 10a29e584f 상수 경고 추가 2018-04-14 15:40:08 +09:00
Hide_D a88982940b 등용장 구현을 위한 ScoutMessage 클래스 완성 2018-04-14 15:37:52 +09:00
Hide_D b92a95cc07 이미지 빠진부분 마저 반영 2018-04-14 03:51:43 +09:00
Hide_D bffca5e163 새 병종 이미지 적용
- 64px 이미지 태그들을 width="64px"가 아니라 width="64"로 변경
2018-04-14 03:27:36 +09:00
Hide_D b56919a343 팝업 차단에 막히는 문제 해결... 2018-04-14 02:52:03 +09:00
Hide_D b797bab7e0 누락된 getReq 추가. 버그 수정 2018-04-14 02:42:58 +09:00
Hide_D a03d2cee63 lib.php에서 강제로 $_POST 추출을 시행하던 부분을 세부 파일로 이동. 2018-04-14 00:28:24 +09:00
Hide_D 67fef4b73d 전콘 적용 버그 수정
갱신정보 제대로 안보이는 문제 수정
분쟁 정보 제대로 안보이는 문제 수정
2018-04-14 00:15:54 +09:00
Hide_D 253a953dfe SQL Injection 대응을 위해 파일 상단에 Util::getReq 사용 2018-04-14 00:15:25 +09:00
Hide_D be7154284e 등용장 수락 코드 작성중 2018-04-13 15:48:47 +09:00
Hide_D 02f90842fe TM 서버 밸런스 패치 이식 2018-04-13 03:41:39 +09:00
Hide_D 0b17a289c8 내정 수치를 tm과 일치 2018-04-13 02:42:10 +09:00
Hide_D e858ad0c33 깜빡한 문구 수정 2018-04-13 02:17:22 +09:00
Hide_D fb1acfa09c 명전 초기값이 없어서 등록할 수 없는 버그 수정 2018-04-13 02:16:15 +09:00
Hide_D 033466edcc 공백지 점령용 예비 코드에 '수도'가 지정되지 않은 문제 해결
천통 가능
2018-04-13 01:52:27 +09:00
Hide_D 3a472506cf 버그 수정... 2018-04-13 01:35:47 +09:00
Hide_D cea015bd4d 전특, 내특 검색을 위한 별도 클래스 제작 2018-04-13 01:01:32 +09:00
Hide_D 8aaf161fd0 세력도 안보이는 문제 해결 2018-04-13 00:54:02 +09:00
Hide_D 1529ab6469 분리한 긴천 함수 호출 버그 2018-04-13 00:38:37 +09:00
Hide_D 1a3b456f39 긴천 함수 분리.
멸망시 등용장이 동작하지 않으므로 일단 끔
2018-04-13 00:26:21 +09:00
Hide_D ac3672a87e 긴천 위치가 엉뚱하게 되는 버그 수정.
getGenSpecial을 마구잡이로 부르는 함수로 인하여 우회
2018-04-13 00:06:32 +09:00
Hide_D a866cb63a4 getConquerNation 버그 수정 2018-04-12 21:32:04 +09:00
Hide_D 943251c56f 에러 코드 출력 방식 변경 2018-04-12 21:31:45 +09:00
Hide_D 4d2b10b979 에러 표기 방식 변경.
- DB 에러도 throw exception을 수행
- exception handler 추가.
- error 발생시 콜 스택을 json 형태로 보관
2018-04-12 21:24:28 +09:00
Hide_D c87614ab2d 연감 지도가 json 기반으로 바뀌었으므로 j 붙임 2018-04-12 20:53:19 +09:00
Hide_D 67dee551b6 분쟁현황 표기 버그 일부 추가 수정 2018-04-12 05:22:20 +09:00
Hide_D 2ee20ce92c 분쟁 코드를 json기반으로 변경 2018-04-12 05:17:32 +09:00
Hide_D cd8ec0687f 성벽 공격시 '국가'를 구해오는 과정에서 공백지를 고려하지 않은 부분 수정 2018-04-12 04:16:02 +09:00
Hide_D 6881b531d7 post type 빠진 것 추가 2018-04-12 04:00:29 +09:00
Hide_D 2eae9b2062 긴천 시 도시 참조하는 부분에 Undefined offset 문제 발생하는 것 해결 2018-04-12 03:34:09 +09:00
Hide_D b055baa7d3 출병시 인접 도시 체크 룰을 DB가 아니라 CityConst에 기반하도록 변경 2018-04-12 03:26:32 +09:00
Hide_D fc0ad32335 사령부 출력 에러 우회. 2018-04-12 03:08:36 +09:00
Hide_D 42cd2fafdd Json에 PASS_THROUGH 옵션 추가 2018-04-12 02:59:44 +09:00
Hide_D 6220d030dc $_POST, $_GET 남은 부분 제거. 연감 지도 받아오는 부분 재 작성 2018-04-12 02:57:53 +09:00
Hide_D 8961dd60a2 $_POST btn 빼먹은거 추가 2018-04-12 02:47:28 +09:00
Hide_D 2726bc13c4 b_myGenInfo 관직 제대로 표기 안된 문제 해결 2018-04-12 02:42:40 +09:00
Hide_D 967c14a972 $sel 변수를 이용한 잘못된 selected 출력 문제를 우회 2018-04-12 02:37:05 +09:00
Hide_D 74d86b7897 POST에 type, btn, gen 빠진것 보정 2018-04-12 02:31:30 +09:00
Hide_D 5a176568e9 b_tournament 진행중에 그래프 그리는 문제 해결 2018-04-12 02:21:11 +09:00
Hide_D 279478c15b 등용장 발부시 국가명 빼먹은 것 수정 2018-04-12 02:18:35 +09:00
Hide_D f5f7c81c20 헌납에서 방랑군일때는 헌납이 가능하게 했던 흔적 수정 2018-04-12 02:11:55 +09:00
Hide_D 3c2499580c checkStatistic() 함수 index 빈 것 해결 2018-04-12 02:08:54 +09:00
Hide_D 45a104f9c0 padString에 문자열 너비가 원하는 길이보다 길때 버그 수정
명장 일람 데이터가 비었을 때 발생하는 버그 수정.
2018-04-12 01:48:16 +09:00
Hide_D a5b0c7f99f 배신한 장수는 유니크를 못먹게 하려는 코드의 흔적을 제거(동작하지 않았음) 2018-04-12 01:40:22 +09:00
Hide_D 643a2822a0 퇴각시 $oppose를 해제하여 마지막 페이즈 쌀 소모하는 문제 해결. 2018-04-12 01:27:29 +09:00
Hide_D be8e22309f _traffic.txt 제대로 작성 못하는 버그 수정.
쌀 소모량 못 받아오는 버그 수정.
getAtt, getDef에서 $game이 더이상 필요없으므로 삭제
2018-04-12 01:16:37 +09:00
Hide_D 8273c3f231 optionsForCities array_map 빼먹은거 수정 2018-04-11 20:57:12 +09:00
Hide_D e9ceb0bdd6 Citys 함수명 변경 2018-04-11 20:49:26 +09:00
Hide_D c204f36aa7 강행 실해하던 것 해결 2018-04-11 20:19:42 +09:00
Hide_D 869ee4b233 레벨이 300이 되면 전투엔진이 터지는 문제 수정 2018-04-11 19:54:25 +09:00
Hide_D f0c6243964 연감 장수 동향 안뜨는 문제도 해결 2018-04-11 03:16:50 +09:00
Hide_D b46a197a5c 연감 지도 엔진 변경 2018-04-11 03:09:49 +09:00
Hide_D d39c04da76 '유기체' 삭제 관리자 명(Hide_D)와 서버명 HiDCHe 로 변경. 2018-04-11 02:20:23 +09:00
Hide_D 22f1f3c227 페이지 리다이렉트 방식 변경
<script>location.replace</script>에서 PHP redirect header를 직접 이용하는 방식으로.
2018-04-11 02:14:03 +09:00
Hide_D 2b3efd0924 전투 수식에 TM서버 내용 반영 2018-04-11 01:50:29 +09:00
Hide_D 3004b20c87 버그 패치
- 메인 페이지에서 턴 실행으로 세션락이 걸리지 않도록.
- 토너먼트에서 매 라운드마다 텍스트가 초기화 되지 않던 문제 해결
- 전투 로그 표기에서  불필요한 빈칸 제거
2018-04-11 01:08:12 +09:00
Hide_D 5c8194b36d 로그 출력 거꾸로 된 것 보정 2018-04-10 22:44:12 +09:00
Hide_D e487846c56 전투 로그 바꾼것 제대로 안나오는 것을 수정 2018-04-10 22:44:00 +09:00
Hide_D 0437d45997 벌점 기준을 현실화 2018-04-10 22:43:45 +09:00
Hide_D 8dd5154de3 searchDistance에서 거리 계산 종료 조건 버그 수정 2018-04-10 21:32:27 +09:00
Hide_D bc519284fb 도시 병종 체크 버그 수정 2018-04-10 21:28:10 +09:00
Hide_D 19e06cc12e 메인 페이지 새 버튼 추가 준비 2018-04-10 21:21:58 +09:00
Hide_D 16e5601651 checkLimit 함수에 입력값이 없어도 자동으로 수행하도록 변경 2018-04-10 21:20:57 +09:00
Hide_D 8f9077dff8 명장 일람 아이템 표기 버그 수정, 사령부 턴 정상 리다이렉트, 개인 기록 역순 표기 문제 해결 2018-04-10 21:20:35 +09:00
Hide_D 9831685bb9 병종 가격 계산 버그, 접경 계산 버그, 긴급 천도 버그 수정 2018-04-10 21:11:56 +09:00
Hide_D 1412834b60 턴 갱신, 당기기, 밀기 코드 재 작성 2018-04-10 21:11:12 +09:00
Hide_D b8636763c1 Message::send 반환값 정리 2018-04-10 02:53:35 +09:00
Hide_D fe4823bb8d sendToSender() 반환값 2018-04-10 02:52:18 +09:00
Hide_D 7ef9a2fdca msg send 반환 방식 변경 2018-04-10 02:51:13 +09:00
Hide_D 9f627ca2f8 함수 이름 변경 2018-04-10 02:46:01 +09:00
Hide_D 2404ab2047 메시지 클래스 새로 작성 2018-04-10 02:38:36 +09:00
Hide_D 50d1c4cd34 dateFormat에 포맷 추가. error 페이지 표기 수정 2018-04-09 03:21:11 +09:00
Hide_D 269a40ca9d stylesheet 잘못 불러오는 문제 해결.
jquery.redirect 추가.
global 변수 extract 우회가 제대로 동작하지 않던 문제 해결
2018-04-09 02:56:45 +09:00
Hide_D 2a814dbbf9 하드리셋 시 UniqueConst가 없어져 세션에서 generalID, generalName을 확인할 수 없는 문제 수정 2018-04-09 01:56:12 +09:00
Hide_D 59243bc34d FIXME를 달아두었던 RootDB::getServerBasepath 삭제! 2018-04-09 01:37:08 +09:00
Hide_D da89d81ef9 정적 분석 결과 반영 2018-04-09 01:29:29 +09:00
Hide_D 27d313c594 정적 분석기 결과 반영 2018-04-08 23:39:02 +09:00
Hide_D eeaae898ae 정적 분석 결과 반영. 2018-04-08 23:18:24 +09:00
Hide_D 9673ecfaa1 정적 분석 결과 반영. MYDB_close 삭제 2018-04-08 22:04:16 +09:00
Hide_D 4e22cf3515 round(something, 0); 을 Util::round(somehing); 으로 변경. 2018-04-08 21:52:14 +09:00
Hide_D 5b926ae5c5 정적 분석기 결과 반영. 빠진 POST 인자 입력 등 2018-04-08 20:51:40 +09:00
Hide_D b78fe22633 정적 분석 결과 반영. 베팅 코드는 새로 작성 2018-04-08 20:18:18 +09:00
Hide_D ba4ff29e4a floor를 intdiv로 변경 2018-04-08 19:46:26 +09:00
Hide_D f060716a3c phpuri 추가. root, shredIcon, gameIage 경로 계산 코드를 추가 2018-04-08 18:38:01 +09:00
Hide_D 9108ce3f19 js, html에서 참조하는 이미지 경로 수정 2018-04-08 17:59:39 +09:00
Hide_D e36a50889b 지도 데이터 이동. 기본 이미지 경로 수정 2018-04-08 17:24:11 +09:00
Hide_D ee2bcb5329 d_shared/common.css를 참조하도록 추가 2018-04-08 17:17:49 +09:00
Hide_D bc7efae08c 아이콘, 게임 이미지 경로를 일괄 지정 가능하도록 변경 2018-04-08 16:56:26 +09:00
Hide_D fe53fb9359 (기분상의 이유로) <?=$value;?>를 <?=$value?> 로 수정 2018-04-08 13:14:28 +09:00
Hide_D 463994df42 정적 분석 결과 반영. global 변수 몇몇 삭제 2018-04-08 12:56:56 +09:00
Hide_D 48a560cb4c 접속 가중치 개념 삭제. 2018-04-08 12:38:46 +09:00
Hide_D 493b3c7d97 normgeneral 삭제 2018-04-08 12:31:42 +09:00
Hide_D 7875e6885f 혹시 모를 foreach reference 제거 2018-04-08 11:59:42 +09:00
Hide_D f36df49ed8 Validator rul 함수 수정 2018-04-07 20:31:03 +09:00
Hide_D 1c1fb247b1 phpinfo.php 삭제. gitignore 추가 2018-04-07 20:06:24 +09:00
Hide_D cff76c9db9 array_merge 대신 + 기호로 충분한 경우(dictionary) +로 변경함. 2018-04-07 18:30:23 +09:00
Hide_D 3d06a13e72 & 연산기호 점검 겸. & -? &amp; 변경 2018-04-07 17:46:59 +09:00
Hide_D 85e6faf92c cutStringForWidth, subStringForWidth 재 구현 2018-04-07 16:57:21 +09:00
Hide_D f5494a69a2 불필요한 StringUtil 함수 제거 2018-04-07 16:28:16 +09:00
Hide_D 7afa36a2b8 StringUtil에 splitString, padString 추가 2018-04-07 16:27:58 +09:00
Hide_D 0cc7ba368a Util::array_get($_POST 류를 Util::getReq로 통합.
array_merge를 이상하게 처리하는 부분 수정
2018-04-07 15:16:46 +09:00
Hide_D 183efd073b getReq에 ifNull param 추가 2018-04-07 14:31:26 +09:00
Hide_D d6e2a84a36 Util::getReq phpdoc 수정 2018-04-07 14:25:10 +09:00
Hide_D 3e069d14f2 Util::getReq 함수 추가. 정적 분석 버그를 우회하기 위한 Validator::rule 함수 추가. 2018-04-07 14:24:20 +09:00
Hide_D 6140da5783 정적 분석 결과 반영. 익명 함수로 전환. POST 변수명. 2018-04-07 13:45:17 +09:00
Hide_D 28aa4c004b 정적 분석을 쉽게 하기 위해 일부분 손댐 2018-04-07 13:44:41 +09:00
Hide_D 61857ce56d phan 다시 등록 2018-04-07 12:45:09 +09:00
Hide_D 15d1c2829a PHAN 설정. sizeof 대신 count 사용 2018-04-07 00:07:18 +09:00
Hide_D a5bb9ba062 install.php 정적 분석 수정 2018-04-06 23:39:59 +09:00
Hide_D cfb2a2dbd5 정적 분석 결과 반영 2018-04-06 23:18:42 +09:00
Hide_D 0639fc3b83 정적 분석기 결과 반영 2018-04-06 22:10:05 +09:00
Hide_D d0e7358f68 정적 분석 결과 수정. 배열 선언 문제. 2018-04-06 20:32:57 +09:00
Hide_D ffc0fc0c6f 정적 분석기 결과 반영. 주로 배열 초기화. 변수 이름 실수 수정. 2018-04-06 20:06:28 +09:00
Hide_D 2bce82c73e PSR에 맞게 수정 2018-04-06 19:03:35 +09:00
Hide_D 37339b91b0 phan func 모두 추가 2018-04-06 18:34:31 +09:00
Hide_D 95c8d7ec0f index.php 정적 분석 2018-04-06 18:16:09 +09:00
Hide_D a1a34c30b3 phan 수정 2018-04-06 18:15:41 +09:00
Hide_D 5189a50b9d phan 정적분석기 준비 2018-04-06 18:07:34 +09:00
Hide_D 2d477d630c $session->userID 보다는 버그 확률이 낮은 Session::getUserID로 전환.
- 함수에서 $session->userID는 $session = Session::getInstance() 가 필요
2018-04-06 17:30:26 +09:00
Hide_D ceccb43f82 Session::Instance()를 명명법에 맞게 Session::getInstance() 로 변경 2018-04-06 16:47:24 +09:00
Hide_D 18101d9e90 myNation이 지정되었을 때 첩보 도시가 없을 때 도시가 뜨지 않는 문제 해결 2018-04-06 03:32:20 +09:00
Hide_D 56e6692817 지도에 필요한 데이터를 얻어오는 과정의 버그 수정 2018-04-06 03:30:44 +09:00
Hide_D 11a9985543 커맨드 버튼 재 구성.
$session 접근하는 변수에 Instance 지정
2018-04-06 03:27:17 +09:00
Hide_D 35e8fa952a Session의 login시 실패하는 위치값이 잘못된 것을 수전
Session의 requireGameLogin 조건 완화
index.php에서 로그인이 실패하더라도 턴 수행은 가능하도록 변경
2018-04-06 02:24:23 +09:00
Hide_D 0e82005a26 LogText 수정 2018-04-06 02:10:57 +09:00
Hide_D 1024f1c4dd 혹시 모를 utf-8 외의 환경 방지 2018-04-06 02:05:16 +09:00
Hide_D 7a6472d49d 의심 가는 취약점 구역 차단 2018-04-06 01:47:39 +09:00
Hide_D a0a2e2097c StringUtil 소소한 변경, Json 클래스에서 버려진 함수 제거 2018-04-06 01:04:03 +09:00
Hide_D 76543892bc Session 클래스 재정리 2018-04-05 03:14:50 +09:00
Hide_D 9c445e02b9 $connect를 $db=DB::db();$connect=$db->get(); 으로 변경하고 함수의 $connect를 모두 제거 2018-04-05 02:55:14 +09:00
Hide_D aebae6f485 argument extract 부분 일부 수정. (디버깅용 ㅜㅜ) 2018-04-05 02:28:37 +09:00
Hide_D 0c0ef213f9 dbConn 삭제. 2018-04-05 02:24:46 +09:00
Hide_D 51316abd42 $_SESSION 으로 직접 접근하는 코드들을 모두 Session 클래스로 통합 2018-04-05 02:04:43 +09:00
Hide_D b3e621fbfd increaseRefresh 수정
파일마다 Session 받아오는 코드가 잘못 된 경우 수정
2018-04-05 01:34:56 +09:00
Hide_D fae86dbff8 CheckLoginWithGeneralID()
를 직접 Session 클래스를 접근하는 방식으로 변경.
2018-04-05 00:55:22 +09:00
Hide_D 65171b4413 npc 선택에 validator 추가 2018-04-05 00:46:17 +09:00
Hide_D 90a81c91c4 장수 등록 / 빙의 코드 수정 (Validator, query), TM서버 추가 능력치 코드 이전
random 코드 버그 수정
일부 코드의 Session 참조 방식을 새롭게 추가한 방식으로 변경
2018-04-05 00:34:40 +09:00
Hide_D 3161ace557 Session::requireGameLogin 버그 수정 2018-04-04 03:13:35 +09:00
Hide_D d8b87f1e70 Session::requireGameLogin 버그 수정 2018-04-04 03:12:58 +09:00
Hide_D b507d3c844 index.php에서 checkTurn 위치 조정 2018-04-04 03:06:23 +09:00
Hide_D 36dd7fef19 Session::requireGameLogin() 추가. 앞으로 다양히 활용 가능.
getGeneralID(), getGeneralName(), isSigned() 제거
2018-04-04 03:02:35 +09:00
Hide_D 0405bf9fab d_setting을 classMap으로 보냈으므로 PSR4에서 제거 2018-04-04 02:53:04 +09:00
Hide_D fcbd801dc7 게임 코드에도 Composer의 ClassLoader를 이용하는 코드로 변경
입구 코드에서 WebUtil::setHeaderNoCache(); 수동 지정
에러 페이지 변경
2018-04-04 02:51:14 +09:00
Hide_D e1c97b1ca0 composer.phar 추가 2018-04-03 21:28:40 +09:00
Hide_D 6a62f5af0d toInt를 더 튼튼하게 개선. ROOT가 지정되었으므로 강제 지정하는 코드 해제 2018-04-03 21:22:52 +09:00
Hide_D 0c64087c0f _common.php 대신 composer로 대체 2018-04-03 21:15:12 +09:00
Hide_D e0cbf34d43 CheckLogin을 다시 구현.
- ajax 함수에서는 사용해선 안됨.
- 이외에선 index에서만 제대로 장수삭제처리를 하므로 문제 없을 것.
2018-04-03 03:05:26 +09:00
Hide_D cb56620728 부대 창 DB 함수를 변경 2018-04-03 02:59:08 +09:00
Hide_D 63f14f0009 '이동' 명령 바꿔봄 2018-04-03 02:44:51 +09:00
Hide_D 789714ee44 isClose함수 재설계 2018-04-03 02:19:03 +09:00
Hide_D c2d7e44400 기본 배경 : 검정, 기본 폰트색 : 흰색 설정.
isClose 함수 참조 문제 해결
2018-04-02 02:42:38 +09:00
Hide_D 3c49925999 NPC 사망시 사망 년도를 <에서 <= 로 수정 2018-04-02 02:32:53 +09:00
Hide_D 3e3f156359 history가 없는데 참조해서 발생하는 버그 수정 2018-04-02 02:31:17 +09:00
Hide_D 427532f0a5 supply에서 reference로 참조해야하는 것을 value로 참조한 문제 해결 2018-04-02 02:05:50 +09:00
Hide_D 6e876d3b9c 기존 Queue를 SplQueue로 대체하였으므로 삭제 2018-04-02 01:51:49 +09:00
Hide_D 86ecf37da6 거리 측정 함수 새로 작성
- 이용하는 함수도 수정
2018-04-02 01:50:51 +09:00
Hide_D c0e2ed7013 * generalID, generalName 동작 안하는 문제 해결
* Event 관련 클래스 표기 실수 해결
2018-04-02 01:50:21 +09:00
Hide_D 0cac139f65 Namespace 실수 해결.
수동 Event 등록시 Date가 아니라 date로 입력했던 문제 해결
2018-04-01 23:44:52 +09:00
Hide_D a70bf667a4 history 타입들을 text에서 mediumtext로 변경
시나리오 생성 시 장수수 처리 수정
2018-04-01 23:31:37 +09:00
Hide_D e1f646daa5 install시 자동 폐쇄 추가. 2018-04-01 22:59:22 +09:00
Hide_D 117643f592 방랑군이라 도시가 0일때 발생하는 문제 해결 2018-04-01 22:48:22 +09:00
Hide_D 4fab99b946 - history, log 관련 함수들을 일괄 변경
- 접속 장소(conmsg) 장소 제거
2018-04-01 22:43:14 +09:00
Hide_D 97c6904918 Setting에 closerServer, openServer를 통합. 서버 업데이트시 자동 폐쇄 상태로 2018-04-01 20:31:20 +09:00
Hide_D 4f113f210e 루트 서버 업데이트도 서버명 반환 2018-04-01 20:13:47 +09:00
Hide_D 77ff1d9e9a 업데이트 서버 코드 추가
- VersionGit 양식 변경
- 서버 입구 버전 표기
- FileTail 추가
Vscode에서 che, kwe, pwe, twe 무시
2018-04-01 20:12:22 +09:00
Hide_D 6ee8066c80 PublicRecord 함수 수정, json_encode, json_deocde를 Json로 통합 2018-04-01 19:16:00 +09:00
Hide_D 1f5f7e3591 GeneralPublicRecord 추가 2018-04-01 18:51:26 +09:00
Hide_D 5860a14dae php-tail 추가 2018-04-01 18:44:45 +09:00
Hide_D 74390602d8 pushHistory를 DB기반으로 변경 2018-04-01 05:18:17 +09:00
Hide_D d062fac671 지도 뻗는 문제 해결. commandlist 일부 문제 해결 2018-04-01 04:36:22 +09:00
Hide_D 6edabd5bcb generalID 부분 많이 수정.
index.php 로딩 에러 수정
2018-04-01 04:31:56 +09:00
Hide_D 762e7f72c3 버전 코드 통합 2018-04-01 04:12:03 +09:00
Hide_D 3eb0f22439 서버 버전 추가 2018-04-01 03:55:28 +09:00
Hide_D dbc877023b updateServer에 '마지막 서버'인 경우에는 git pull을 하도록 설정 2018-04-01 03:31:03 +09:00
309 changed files with 15940 additions and 11395 deletions
+4 -4
View File
@@ -22,16 +22,14 @@ pwe/.htaccess
twe/.htaccess twe/.htaccess
hwe/.htaccess hwe/.htaccess
d_shared
d_pic/*.jpg d_pic/*.jpg
d_pic/*.gif d_pic/*.gif
d_pic/*.png d_pic/*.png
d_setting/*.php d_setting/*.php
!d_setting/*.orig.php
!d_setting/_*.php
*/d_setting/*.php */d_setting/*.php
!*/d_setting/*.orig.php
!*/d_setting/_*.php
**/old/* **/old/*
test.php test.php
@@ -40,3 +38,5 @@ test.php
/kwe /kwe
/pwe /pwe
/twe /twe
phpinfo.php
+2
View File
@@ -0,0 +1,2 @@
RedirectMatch 404 /\.git
RedirectMatch 404 /\.gitignore
+91
View File
@@ -0,0 +1,91 @@
<?php
/**
* This configuration will be read and overlaid on top of the
* default configuration. Command line arguments will be applied
* after this file is read.
*/
return [
// Supported values: '7.0', '7.1', '7.2', null.
// If this is set to null,
// then Phan assumes the PHP version which is closest to the minor version
// of the php executable used to execute phan.
"target_php_version" => '7.0',
'backward_compatibility_checks ' => false,
'ignore_undeclared_variables_in_global_scope' => false,
'minimum_severity'=>\Phan\Issue::SEVERITY_LOW,
'file_list' => [
'f_config/config.php',
'hwe/MYDB.php',
'hwe/lib.php',
'hwe/func_auction.php',
'hwe/func_command.php',
'hwe/func_converter.php',
'hwe/func_diplomacy.php',
'hwe/func_gamerule.php',
'hwe/func_history.php',
'hwe/func_legacy.php',
'hwe/func_map.php',
'hwe/func_message.php',
'hwe/func_npc.php',
'hwe/func_process_chief.php',
'hwe/func_process_personnel.php',
'hwe/func_process_sabotage.php',
'hwe/func_process.php',
'hwe/func_string.php',
'hwe/func_template.php',
'hwe/func_time_event.php',
'hwe/func_tournament.php',
'hwe/process_war.php',
'hwe/func.php'
],
// A list of directories that should be parsed for class and
// method information. After excluding the directories
// defined in exclude_analysis_directory_list, the remaining
// files will be statically analyzed for errors.
//
// Thus, both first-party and third-party code being used by
// your application should be included in this list.
'directory_list' => [
'hwe/d_setting',
'hwe/sammo',
'd_setting',
'src/sammo',
'src/kakao',
'vendor'
],
'exclude_file_regex' => '/.*\.orig\.php$/',
// A directory list that defines files that will be excluded
// from static analysis, but whose class and method
// information should be included.
//
// Generally, you'll want to include the directories for
// third-party code (such as "vendor/") in this list.
//
// n.b.: If you'd like to parse but not analyze 3rd
// party code, directories containing that code
// should be added to the `directory_list` as
// to `exclude_analysis_directory_list`.
"exclude_analysis_directory_list" => [
'vendor/'
],
// A list of plugin files to execute.
// See https://github.com/phan/phan/tree/master/.phan/plugins for even more.
// (Pass these in as relative paths.
// The 0.10.2 release will allow passing 'AlwaysReturnPlugin' if referring to a plugin that is bundled with Phan)
'plugins' => [
// checks if a function, closure or method unconditionally returns.
// Checks for syntactically unreachable statements in
// the global scope or function bodies.
'UnreachableCodePlugin',
'DollarDollarPlugin',
'DuplicateArrayKeyPlugin',
'PregRegexCheckerPlugin',
'PrintfCheckerPlugin',
],
];
+9 -1
View File
@@ -7,10 +7,18 @@
"**/.DS_Store": true, "**/.DS_Store": true,
"**/logs/*.txt": true, "**/logs/*.txt": true,
"**/session/sess*":true, "**/session/sess*":true,
"/che":true,
"/kwe":true,
"/pwe":true,
"/twe":true,
}, },
"search.exclude": { "search.exclude": {
"e_lib/*":true, "e_lib/*":true,
"vendor/*":true "vendor/*":true,
"/che":true,
"/kwe":true,
"/pwe":true,
"/twe":true,
}, },
} }
+21
View File
@@ -0,0 +1,21 @@
The MIT License
Copyright (c) 2018 Hide_D, 62che
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
+60
View File
@@ -0,0 +1,60 @@
# 삼국지 모의전투 HiDCHe
삼국지 모의전투 유기체서버를 기반으로 더욱 더 진화한 서버입니다.
## 요구사항
* Apache2
* <code>mpm_event</code> 권장
* PHP 7.0 이상
* <code>php-fpm</code> 권장
* php에서 curl을 실행가능해야 합니다.
* MySQL 5.6 이상, 또는 MariaDB 10.0 이상
* <code>git</code>
* <code>curl</code>
Linux는 Ubuntu 16.04, Windows는 Windows 10에서 XAMPP를 사용한 환경에서 테스트되었습니다.
Docker를 이용한 설치는 계획중입니다.
## 설치
본 게임은 <code>git</code>을 이용한 업그레이드 시스템을 구현하였으므로, <code>git</code>이 필요합니다.
또한 웹 서비스 데몬을 운영중인 사용자(일반적으로 <code>www-data</code>, <code>apache</code>)에게 디렉토리 권한이 주어져야합니다.
### 다운로드
웹 데몬 user가 <code>www-data</code>인 경우 다음과 같이 입력하여 최신 배포버전과 이미지 파일을 얻을 수 있습니다.
```
sudo -u www-data git clone ssh://git@storage.hided.net:2525/devsam/core.git
git clone ssh://git@storage.hided.net:2525/devsam/image.git
```
> 이미지는 별도의 업데이트 기능을 제공하지 않습니다. 수동으로 <code>git pull</code>을 해야합니다.
### 설치
이후 해당 경로를 웹 브라우저를 통해 접근하여 설치를 진행할 수 있습니다.
Database 수는 로그인 관리 서버 1개, 내부 서버 5개로, 총 6개의 Database가 필요합니다. 내부 설정을 고쳐서 서버 수를 늘리거나 줄일 경우 그에 맞는 Database 수가 필요합니다. 또한 Database마다 관리할 별도의 계정을 만드는 것을 추천합니다.
설치 이후에는 서버관리 페이지에서 **업데이트** 명령을 통해 원 클릭 업데이트가 가능합니다.
## 카카오로그인 연동
현재 카카오로그인 API KEY를 입력하는 작업이 설치과정에 추가되어있지 않습니다.
<code>f_install/templates/KakaoKey.orig.php</code> 를 <code>d_setting/KakaoKey.php</code>로 복사한 후 API 키를 입력하여야 합니다.
## 라이선스
본 게임을 수정하거나 재배포할 경우 다음 중 하나의 라이선스를 선택하여 적용할 수 있습니다.
* MIT License
* GPL 2.0 또는 이후
만약 별도의 라이선스를 적용하고자 할 경우 Hide_D에게 문의하여 주십시오.
-9
View File
@@ -1,9 +0,0 @@
<?php
namespace sammo;
if(!defined('ROOT')){
define('ROOT', '.');
}
require_once(ROOT.'/f_config/config.php');
CustomHeader();
+14 -5
View File
@@ -1,6 +1,6 @@
{ {
"name":"sammo-hid/sammo", "name":"sammo-hid/sammo",
"description":"삼국지 모의전투 HiD", "description":"삼국지 모의전투 HiDCHe",
"license": [ "license": [
"MIT", "MIT",
"GPL-2.0-or-later", "GPL-2.0-or-later",
@@ -14,19 +14,28 @@
"leafo/scssphp": "^0.7.5", "leafo/scssphp": "^0.7.5",
"monolog/monolog": "^1.23", "monolog/monolog": "^1.23",
"firephp/firephp-core": "^0.4.0", "firephp/firephp-core": "^0.4.0",
"vlucas/valitron": "^1.4" "vlucas/valitron": "^1.4",
"php-extended/php-tail": "^2.1",
"pguardiario/phpuri": "^1.0"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"sammo\\": [ "sammo\\": [
"d_setting",
"src/sammo" "src/sammo"
], ],
"kakao\\": [ "kakao\\": [
"d_setting",
"src/kakao" "src/kakao"
] ]
} },
"classmap": [
"d_setting/"
],
"exclude-from-classmap": [
"**/*.orig.php"
],
"files":[
"f_config/config.php"
]
} }
} }
Generated
+114 -6
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "4659ec09c50a2ccd1b53194b3f53890a", "content-hash": "1753c2c2ad9fe40ecc5c6ae541dd2e78",
"packages": [ "packages": [
{ {
"name": "brandonwamboldt/utilphp", "name": "brandonwamboldt/utilphp",
@@ -90,16 +90,16 @@
}, },
{ {
"name": "guzzlehttp/guzzle", "name": "guzzlehttp/guzzle",
"version": "6.3.1", "version": "6.3.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/guzzle/guzzle.git", "url": "https://github.com/guzzle/guzzle.git",
"reference": "49e42e6539f775e80c74086a710a882e1d5a8111" "reference": "68d0ea14d5a3f42a20e87632a5f84931e2709c90"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/guzzle/guzzle/zipball/49e42e6539f775e80c74086a710a882e1d5a8111", "url": "https://api.github.com/repos/guzzle/guzzle/zipball/68d0ea14d5a3f42a20e87632a5f84931e2709c90",
"reference": "49e42e6539f775e80c74086a710a882e1d5a8111", "reference": "68d0ea14d5a3f42a20e87632a5f84931e2709c90",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -151,7 +151,7 @@
"rest", "rest",
"web service" "web service"
], ],
"time": "2018-03-26T12:06:26+00:00" "time": "2018-03-26T16:33:04+00:00"
}, },
{ {
"name": "guzzlehttp/promises", "name": "guzzlehttp/promises",
@@ -454,6 +454,114 @@
], ],
"time": "2017-06-19T01:22:40+00:00" "time": "2017-06-19T01:22:40+00:00"
}, },
{
"name": "pguardiario/phpuri",
"version": "1.0",
"source": {
"type": "git",
"url": "https://github.com/monkeysuffrage/phpuri.git",
"reference": "ad0a5ec033fe616cfef55578b9c7f2458be8fbfc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/monkeysuffrage/phpuri/zipball/ad0a5ec033fe616cfef55578b9c7f2458be8fbfc",
"reference": "ad0a5ec033fe616cfef55578b9c7f2458be8fbfc",
"shasum": ""
},
"type": "project",
"autoload": {
"files": [
"phpuri.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"description": "A php library for converting relative urls to absolute.",
"time": "2015-05-24T09:13:17+00:00"
},
{
"name": "php-extended/php-system",
"version": "1.3.0",
"source": {
"type": "git",
"url": "https://github.com/php-extended/php-system.git",
"reference": "66727d5dc0a665916bd7e08bcfb9820e7be1d20c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-extended/php-system/zipball/66727d5dc0a665916bd7e08bcfb9820e7be1d20c",
"reference": "66727d5dc0a665916bd7e08bcfb9820e7be1d20c",
"shasum": ""
},
"type": "library",
"autoload": {
"psr-4": {
"PhpExtended\\System\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Anastaszor",
"role": "developer"
}
],
"description": "A generic way to find informations about the running system",
"homepage": "https://github.com/php-extended/php-system",
"keywords": [
"operating system",
"os",
"php",
"system"
],
"time": "2017-01-14T11:56:24+00:00"
},
{
"name": "php-extended/php-tail",
"version": "2.1.1",
"source": {
"type": "git",
"url": "https://github.com/php-extended/php-tail.git",
"reference": "eabf7bee64f8c30fe9b9e1176562fdb903c54ae7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-extended/php-tail/zipball/eabf7bee64f8c30fe9b9e1176562fdb903c54ae7",
"reference": "eabf7bee64f8c30fe9b9e1176562fdb903c54ae7",
"shasum": ""
},
"require": {
"php-extended/php-system": "^1.2"
},
"type": "library",
"autoload": {
"psr-4": {
"PhpExtended\\Tail\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Anastaszor",
"role": "developer"
}
],
"description": "A smart way to tail files depending of the environment",
"homepage": "https://github.com/php-extended/php-tail",
"keywords": [
"cheat",
"mighty",
"naive",
"php",
"tail"
],
"time": "2017-07-25T13:52:42+00:00"
},
{ {
"name": "psr/http-message", "name": "psr/http-message",
"version": "1.0.1", "version": "1.0.1",
BIN
View File
Binary file not shown.
+1 -4
View File
@@ -1,7 +1,7 @@
@charset "utf-8"; @charset "utf-8";
* { margin: 0px; padding: 0px; } * { margin: 0px; padding: 0px; }
body { color:white; background-color:black; border-width:1; border-color:gray; } body { color:white; background-color:black; border-width:1px; border-color:gray; }
table { table {
border: solid 1px; border-spacing: 0px; border-collapse: separate; border-top-color: gray; border-left-color: gray; border-right-color: black; border-bottom-color: black; border: solid 1px; border-spacing: 0px; border-collapse: separate; border-top-color: gray; border-left-color: gray; border-right-color: black; border-bottom-color: black;
padding: 0px; padding: 0px;
@@ -100,9 +100,6 @@ button {
font-family: '맑은 고딕'; font-family: '맑은 고딕';
font-size: 13px; font-size: 13px;
} }
.bg0 { background-image:url('/images/back_walnut.jpg'); }
.bg1 { background-image:url('/images/back_green.jpg'); }
.bg2 { background-image:url('/images/back_blue.jpg'); }
.font0 { font-size: 10px; } .font0 { font-size: 10px; }
.font1 { font-size: 13px; } .font1 { font-size: 13px; }
-9
View File
@@ -1,9 +0,0 @@
<?php
namespace sammo;
if(!defined('ROOT')){
define('ROOT', '..');
}
require_once(ROOT.'/f_config/config.php');
CustomHeader();
+152
View File
@@ -0,0 +1,152 @@
/*
jQuery Redirect v1.1.1
Copyright (c) 2013-2017 Miguel Galante
Copyright (c) 2011-2013 Nemanja Avramovic, www.avramovic.info
Licensed under CC BY-SA 4.0 License: http://creativecommons.org/licenses/by-sa/4.0/
This means everyone is allowed to:
Share - copy and redistribute the material in any medium or format
Adapt - remix, transform, and build upon the material for any purpose, even commercially.
Under following conditions:
Attribution - You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
ShareAlike - If you remix, transform, or build upon the material, you must distribute your contributions under the same license as the original.
*/
(function ($) {
'use strict';
/**
* jQuery Redirect
* @param {string} url - Url of the redirection
* @param {Object} values - (optional) An object with the data to send. If not present will look for values as QueryString in the target url.
* @param {string} method - (optional) The HTTP verb can be GET or POST (defaults to POST)
* @param {string} target - (optional) The target of the form. "_blank" will open the url in a new window.
* @param {boolean} traditional - (optional) This provides the same function as jquery's ajax function. The brackets are omitted on the field name if its an array. This allows arrays to work with MVC.net among others.
* @param {boolean} redirectTop - (optional) If its called from a iframe, force to navigate the top window.
*/
$.redirect = function (url, values, method, target, traditional, redirectTop) {
redirectTop = redirectTop || false;
var generatedForm = $.redirect.getForm(url, values, method, target, traditional);
$('body', redirectTop ? window.top.document : undefined).append(generatedForm.form);
generatedForm.submit();
};
$.redirect.getForm = function (url, values, method, target, traditional) {
method = (method && ["GET", "POST", "PUT", "DELETE"].indexOf(method.toUpperCase()) !== -1) ? method.toUpperCase() : 'POST';
url = url.split("#");
var hash = url[1] ? ("#" + url[1]) : "";
url = url[0];
if (!values) {
var obj = $.parseUrl(url);
url = obj.url;
values = obj.params;
}
values = removeNulls(values);
var form = $('<form>')
.attr("method", method)
.attr("action", url + hash);
if (target) {
form.attr("target", target);
}
var submit = form[0].submit;
iterateValues(values, [], form, null, traditional);
return { form: form, submit: function () { submit.call(form[0]); } };
}
//Utility Functions
/**
* Url and QueryString Parser.
* @param {string} url - a Url to parse.
* @returns {object} an object with the parsed url with the following structure {url: URL, params:{ KEY: VALUE }}
*/
$.parseUrl = function (url) {
if (url.indexOf('?') === -1) {
return {
url: url,
params: {}
};
}
var parts = url.split('?'),
query_string = parts[1],
elems = query_string.split('&');
url = parts[0];
var i, pair, obj = {};
for (i = 0; i < elems.length; i += 1) {
pair = elems[i].split('=');
obj[pair[0]] = pair[1];
}
return {
url: url,
params: obj
};
};
//Private Functions
var getInput = function (name, value, parent, array, traditional) {
var parentString;
if (parent.length > 0) {
parentString = parent[0];
var i;
for (i = 1; i < parent.length; i += 1) {
parentString += "[" + parent[i] + "]";
}
if (array) {
if (traditional)
name = parentString;
else
name = parentString + "[" + name + "]";
} else {
name = parentString + "[" + name + "]";
}
}
return $("<input>").attr("type", "hidden")
.attr("name", name)
.attr("value", value);
};
var iterateValues = function (values, parent, form, isArray, traditional) {
var i, iterateParent = [];
Object.keys(values).forEach(function (i) {
if (typeof values[i] === "object") {
iterateParent = parent.slice();
iterateParent.push(i);
iterateValues(values[i], iterateParent, form, Array.isArray(values[i]), traditional);
} else {
form.append(getInput(i, values[i], parent, isArray, traditional));
}
});
};
var removeNulls = function (values) {
var propNames = Object.getOwnPropertyNames(values);
for (var i = 0; i < propNames.length; i++) {
var propName = propNames[i];
if (values[propName] === null || values[propName] === undefined) {
delete values[propName];
} else if (typeof values[propName] === 'object') {
values[propName] = removeNulls(values[propName]);
} else if (values[propName].length < 1) {
delete values[propName];
}
}
return values;
};
}(window.jQuery || window.Zepto || window.jqlite));
-10
View File
@@ -1,10 +0,0 @@
<?php
namespace sammo;
if(!defined('ROOT')){
define('ROOT', '..');
}
require_once(ROOT.'/f_config/config.php');
CustomHeader();
+78 -8
View File
@@ -1,14 +1,84 @@
<?php <?php
namespace sammo; namespace sammo;
ob_start(); define('ROOT', realpath(__dir__.'/..'));
require(__dir__.'/../vendor/autoload.php');
require_once(__dir__.'/func.php'); mb_internal_encoding("UTF-8");
mb_http_output('UTF-8');
mb_regex_encoding('UTF-8');
function getFriendlyErrorType($type)
{
switch($type)
{
case E_ERROR: // 1 //
return 'E_ERROR';
case E_WARNING: // 2 //
return 'E_WARNING';
case E_PARSE: // 4 //
return 'E_PARSE';
case E_NOTICE: // 8 //
return 'E_NOTICE';
case E_CORE_ERROR: // 16 //
return 'E_CORE_ERROR';
case E_CORE_WARNING: // 32 //
return 'E_CORE_WARNING';
case E_COMPILE_ERROR: // 64 //
return 'E_COMPILE_ERROR';
case E_COMPILE_WARNING: // 128 //
return 'E_COMPILE_WARNING';
case E_USER_ERROR: // 256 //
return 'E_USER_ERROR';
case E_USER_WARNING: // 512 //
return 'E_USER_WARNING';
case E_USER_NOTICE: // 1024 //
return 'E_USER_NOTICE';
case E_STRICT: // 2048 //
return 'E_STRICT';
case E_RECOVERABLE_ERROR: // 4096 //
return 'E_RECOVERABLE_ERROR';
case E_DEPRECATED: // 8192 //
return 'E_DEPRECATED';
case E_USER_DEPRECATED: // 16384 //
return 'E_USER_DEPRECATED';
}
return "{$type}";
}
function logErrorByCustomHandler(int $errno, string $errstr, string $errfile, int $errline, array $errcontext){
if (!(error_reporting() & $errno)) {
// This error code is not included in error_reporting, so let it fall
// through to the standard PHP error handler
return false;
}
$date = date("Ymd_His");
$e = new \Exception();
$data = Json::encode([
'date'=>$date,
'err'=>getFriendlyErrorType($errno),
'errstr'=>$errstr,
'trace'=>explode("\n", $e->getTraceAsString())
], Json::PRETTY);
file_put_contents(ROOT.'/d_log/err_log.txt',"$data\n", FILE_APPEND);
}
set_error_handler("\sammo\logErrorByCustomHandler");
function logExceptionByCustomHandler(\Throwable $e){
define('__LINE__',__FILE__." ".__FUNCTION__." ".__LINE__." : "); $date = date("Ymd_His");
define('IMAGE', '../../image');
define('IMAGES', '../../images'); $data = Json::encode([
//define('IMAGE', 'http://115.68.28.99/image'); 'date'=>$date,
//define('IMAGES', 'http://115.68.28.99/images'); 'err'=>get_class($e),
'errstr'=>$e->getMessage(),
'trace'=>explode("\n", $e->getTraceAsString())
], Json::PRETTY);
file_put_contents(ROOT.'/d_log/err_log.txt',"$data\n", FILE_APPEND);
throw $e;
}
set_exception_handler('\\sammo\\logExceptionByCustomHandler');
-28
View File
@@ -1,28 +0,0 @@
<?php
namespace sammo;
function CustomHeader() {
//xxx: CustomHeader를 제거하기 전까진 유지
WebUtil::setHeaderNoCache();
}
function logErrorByCustomHandler(int $errno, string $errstr, string $errfile, int $errline, array $errcontext){
if (!(error_reporting() & $errno)) {
// This error code is not included in error_reporting, so let it fall
// through to the standard PHP error handler
return false;
}
$date = date("Ymd_His");
file_put_contents(__DIR__.'/../d_log/err_log.txt',"$date, $errno, $errstr, $errfile, $errline\n", FILE_APPEND);
/* Don't execute PHP internal error handler */
//return true;
}
set_error_handler("\sammo\logErrorByCustomHandler");
function Error($msg) {
file_put_contents(ROOT.'/d_log/err.txt', $msg."\n", FILE_APPEND);
exit(1);
}
-10
View File
@@ -1,10 +0,0 @@
<?php
namespace sammo;
if(!defined('ROOT')){
define('ROOT', '..');
}
require_once(ROOT.'/f_config/config.php');
CustomHeader();
+56 -29
View File
@@ -1,9 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require('_common.php'); require(__dir__.'/../vendor/autoload.php');
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
@@ -22,7 +20,7 @@ require('_common.php');
</head> </head>
<body> <body>
<div class="container"> <div class="container">
<h1 class="row justify-content-md-center">삼국지 모의전투 HiD 설치</h1> <h1 class="row justify-content-md-center">삼국지 모의전투 HiDCHe 설치</h1>
<div class="row justify-content-md-center"> <div class="row justify-content-md-center">
<div class="col col-12 col-md-10 col-lg-7"> <div class="col col-12 col-md-10 col-lg-7">
@@ -33,52 +31,76 @@ require('_common.php');
<div class="card-body"> <div class="card-body">
<form id="db_form" method="post" action="#"> <form id="db_form" method="post" action="#">
<div class="form-group row"> <div class="form-group row">
<label for="db_host" class="col-sm-3 col-form-label">DB호스트</label> <label for="db_host" class="col-sm-4 col-form-label">DB호스트</label>
<div class="col-sm-9"> <div class="col-sm-8">
<input type="text" class="form-control" name="db_host" id="db_host" placeholder="호스트" value="localhost" /> <input type="text" class="form-control" name="db_host" id="db_host"
placeholder="호스트" value="localhost" />
</div> </div>
</div> </div>
<div class="form-group row"> <div class="form-group row">
<label for="db_port" class="col-sm-3 col-form-label">DB포트</label> <label for="db_port" class="col-sm-4 col-form-label">DB포트</label>
<div class="col-sm-9"> <div class="col-sm-8">
<input type="text" class="form-control" name="db_port" id="db_port" placeholder="접속 포트" value="3306" /> <input type="text" class="form-control" name="db_port" id="db_port"
placeholder="접속 포트" value="3306" />
</div> </div>
</div> </div>
<div class="form-group row"> <div class="form-group row">
<label for="db_id" class="col-sm-3 col-form-label">DB계정명</label> <label for="db_id" class="col-sm-4 col-form-label">DB계정명</label>
<div class="col-sm-9"> <div class="col-sm-8">
<input type="text" class="form-control" name="db_id" id="db_id" placeholder="DB계정"/> <input type="text" class="form-control" name="db_id" id="db_id" placeholder="DB계정"/>
</div> </div>
</div> </div>
<div class="form-group row"> <div class="form-group row">
<label for="db_pw" class="col-sm-3 col-form-label">DB비밀번호</label> <label for="db_pw" class="col-sm-4 col-form-label">DB비밀번호</label>
<div class="col-sm-9"> <div class="col-sm-8">
<input type="password" class="form-control" name="db_pw" id="db_pw" placeholder="DB비밀번호"/> <input type="password" class="form-control" name="db_pw" id="db_pw"
placeholder="DB비밀번호"/>
</div> </div>
</div> </div>
<div class="form-group row"> <div class="form-group row">
<label for="db_name" class="col-sm-3 col-form-label">DB명</label> <label for="db_name" class="col-sm-4 col-form-label">DB명</label>
<div class="col-sm-9"> <div class="col-sm-8">
<input type="text" class="form-control" name="db_name" id="db_name" placeholder="DB명(예:sammo)"/> <input type="text" class="form-control" name="db_name" id="db_name"
placeholder="DB명(예:sammo)"/>
</div> </div>
</div> </div>
<div class="form-group row"> <div class="form-group row">
<label for="serv_host" class="col-sm-3 col-form-label">접속 경로</label> <label for="serv_host" class="col-sm-4 col-form-label">접속 경로</label>
<div class="col-sm-9"> <div class="col-sm-8">
<input type="text" class="form-control" name="serv_host" id="serv_host" placeholder="접속경로(예:http://www.example.com)"/> <input type="text" class="form-control" name="serv_host" id="serv_host"
placeholder="접속경로(예:http://www.example.com)"/>
</div> </div>
</div> </div>
<div class="form-group row"> <div class="form-group row">
<div class="col-sm-3"></div> <label for="shared_icon_path" class="col-sm-4 col-form-label">공용 아이콘 주소</label>
<div class="col-sm-9"> <div class="col-sm-8">
<button type="submit" class="btn btn-primary btn-lg btn-block login-button">설정 파일 생성</button> <input type="text" class="form-control" name="shared_icon_path" id="shared_icon_path"
placeholder="공용 아이콘 주소(웹 주소, 또는 접속 경로에 따른 상대 주소)"
value="../image/icons" />
</div>
</div>
<div class="form-group row">
<label for="game_image_path" class="col-sm-4 col-form-label">게임 이미지 주소</label>
<div class="col-sm-8">
<input type="text" class="form-control" name="game_image_path" id="game_image_path"
placeholder="게임 이미지 주소(웹 주소, 또는 접속 경로에 따른 상대 주소)"
value="../image/game" />
</div>
</div>
<div class="form-group row">
<div class="col-sm-4"></div>
<div class="col-sm-8">
<button type="submit"
class="btn btn-primary btn-lg btn-block login-button">설정 파일 생성</button>
</div> </div>
</div> </div>
</form> </form>
@@ -94,7 +116,8 @@ require('_common.php');
<div class="form-group row"> <div class="form-group row">
<label for="username" class="col-sm-3 col-form-label">계정명</label> <label for="username" class="col-sm-3 col-form-label">계정명</label>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="text" class="form-control" name="username" id="username" placeholder="계정명"/> <input type="text" class="form-control" name="username" id="username"
placeholder="계정명"/>
</div> </div>
</div> </div>
@@ -102,21 +125,24 @@ require('_common.php');
<div class="form-group row"> <div class="form-group row">
<label for="password" class="col-sm-3 col-form-label">비밀번호</label> <label for="password" class="col-sm-3 col-form-label">비밀번호</label>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="password" class="form-control" name="password" id="password" placeholder="비밀번호"/> <input type="password" class="form-control" name="password" id="password"
placeholder="비밀번호"/>
</div> </div>
</div> </div>
<div class="form-group row"> <div class="form-group row">
<label for="confirm_password" class="col-sm-3 col-form-label">비밀번호 확인</label> <label for="confirm_password" class="col-sm-3 col-form-label">비밀번호 확인</label>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="password" class="form-control" name="confirm_password" id="confirm_password" placeholder="비밀번호 확인"/> <input type="password" class="form-control" name="confirm_password" id="confirm_password"
placeholder="비밀번호 확인"/>
</div> </div>
</div> </div>
<div class="form-group row"> <div class="form-group row">
<label for="nickname" class="col-sm-3 col-form-label">닉네임</label> <label for="nickname" class="col-sm-3 col-form-label">닉네임</label>
<div class="col-sm-9"> <div class="col-sm-9">
<input type="text" class="form-control" name="nickname" id="nickname" placeholder="닉네임" value="운영자"/> <input type="text" class="form-control" name="nickname" id="nickname"
placeholder="닉네임" value="운영자"/>
</div> </div>
</div> </div>
@@ -125,7 +151,8 @@ require('_common.php');
<div class="form-group row"> <div class="form-group row">
<div class="col-sm-3"></div> <div class="col-sm-3"></div>
<div class="col-sm-9"> <div class="col-sm-9">
<button type="submit" class="btn btn-primary btn-lg btn-block login-button">관리자 계정 생성</button> <button type="submit"
class="btn btn-primary btn-lg btn-block login-button">관리자 계정 생성</button>
</div> </div>
</div> </div>
</form> </form>
+7 -8
View File
@@ -1,15 +1,14 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php');
require('_common.php');
session_start(); session_start();
session_destroy(); session_destroy();
$username = mb_strtolower(Util::array_get($_POST['username']), 'utf-8'); $username = mb_strtolower(Util::getReq('username'), 'utf-8');
$password = Util::array_get($_POST['password']); $password = Util::getReq('password', 'string');
$nickname = Util::array_get($_POST['nickname']); $nickname = Util::getReq('nickname');
if(!$username || !$password || !$nickname){ if(!$username || !$password || !$nickname){
Json::die([ Json::die([
@@ -18,7 +17,7 @@ if(!$username || !$password || !$nickname){
]); ]);
} }
if(strlen($password)!=128){ if(strlen((string)$password)!=128){
Json::die([ Json::die([
'result'=>false, 'result'=>false,
'reason'=>'올바르지 않은 비밀번호 해시 포맷입니다.' 'reason'=>'올바르지 않은 비밀번호 해시 포맷입니다.'
@@ -65,12 +64,12 @@ $rootDB->insert('member_log', [
'member_no'=>$userID, 'member_no'=>$userID,
'date'=>$nowDate, 'date'=>$nowDate,
'action_type'=>'reg', 'action_type'=>'reg',
'action'=>json_encode([ 'action'=>Json::encode([
'type'=>'none', 'type'=>'none',
'aux'=>'admin', 'aux'=>'admin',
'id'=>$username, 'id'=>$username,
'name'=>$nickname 'name'=>$nickname
], JSON_UNESCAPED_UNICODE) ])
]); ]);
Json::die([ Json::die([
+14 -18
View File
@@ -1,20 +1,7 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php');
require('_common.php');
function dbConnFail($params){
Json::die([
'step'=>'conn_fail'
]);
}
function dbSQLFail($params){
Json::die([
'step'=>'sql_fail'
]);
}
if(!class_exists('\\sammo\\RootDB')){ if(!class_exists('\\sammo\\RootDB')){
Json::die([ Json::die([
@@ -25,11 +12,20 @@ if(!class_exists('\\sammo\\RootDB')){
$rootDB = RootDB::db(); $rootDB = RootDB::db();
$rootDB->throw_exception_on_nonsql_error = false; $rootDB->throw_exception_on_nonsql_error = false;
$rootDB->nonsql_error_handler = 'dbConnFail'; $rootDB->nonsql_error_handler = function($params){
$rootDB->error_handler = 'dbSQLFail'; Json::die([
'step'=>'conn_fail'
]);
};
$memberCnt = $rootDB->queryFirstField('SELECT count(`NO`) from MEMBER'); $rootDB->error_handler = function($params){
if($memberCnt === 0){ Json::die([
'step'=>'sql_fail'
]);
};
$memberCnt = $rootDB->queryFirstField('SELECT count(`NO`) from member');
if($memberCnt == 0){
Json::die([ Json::die([
'step'=>'admin', 'step'=>'admin',
'globalSalt'=>RootDB::getGlobalSalt() 'globalSalt'=>RootDB::getGlobalSalt()
+155 -55
View File
@@ -1,51 +1,39 @@
<?php <?php
namespace sammo; namespace sammo;
require('_common.php'); require(__dir__.'/../vendor/autoload.php');
function dbConnFail($params){ $host = Util::getReq('db_host');
Json::die([ $port = Util::getReq('db_port', 'int');
'result'=>false, $username = Util::getReq('db_id');
'reason'=>'DB 접속에 실패했습니다.' $password = Util::getReq('db_pw');
]); $dbName = Util::getReq('db_name');
} $servHost = Util::getReq('serv_host');
$sharedIconPath = Util::getReq('shared_icon_path');
$gameImagePath = Util::getReq('game_image_path');
function dbSQLFail($params){ if (!$host || !$port || !$username || !$password || !$dbName || !$servHost || !$sharedIconPath || !$gameImagePath) {
Json::die([
'result'=>false,
'reason'=>'SQL을 제대로 실행하지 못했습니다. DB상태를 확인해 주세요.'
]);
}
$host = Util::array_get($_POST['db_host']);
$port = Util::array_get($_POST['db_port']);
$username = Util::array_get($_POST['db_id']);
$password = Util::array_get($_POST['db_pw']);
$dbName = Util::array_get($_POST['db_name']);
$servHost = Util::array_get($_POST['serv_host']);
if(!$host || !$port || !$username || !$password || !$dbName || !$servHost){
Json::die([ Json::die([
'result'=>false, 'result'=>false,
'reason'=>'입력 값이 올바르지 않습니다' 'reason'=>'입력 값이 올바르지 않습니다'
]); ]);
} }
if(!filter_var($servHost, FILTER_VALIDATE_URL)){ if (!filter_var($servHost, FILTER_VALIDATE_URL)) {
Json::die([ Json::die([
'result'=>false, 'result'=>false,
'reason'=>'접속 경로가 올바르지 않습니다.' 'reason'=>'접속 경로가 올바르지 않습니다.'
]); ]);
} }
if(file_exists(ROOT.'/d_setting/RootDB.php') && is_dir(ROOT.'/d_setting/RootDB.php')){ if (file_exists(ROOT.'/d_setting/RootDB.php') && is_dir(ROOT.'/d_setting/RootDB.php')) {
Json::die([ Json::die([
'result'=>false, 'result'=>false,
'reason'=>'d_setting/RootDB.php 가 디렉토리입니다' 'reason'=>'d_setting/RootDB.php 가 디렉토리입니다'
]); ]);
} }
if(class_exists('\\sammo\\RootDB')){ if (class_exists('\\sammo\\RootDB')) {
Json::die([ Json::die([
'result'=>false, 'result'=>false,
'reason'=>'이미 RootDB.php 파일이 있습니다' 'reason'=>'이미 RootDB.php 파일이 있습니다'
@@ -53,82 +41,131 @@ if(class_exists('\\sammo\\RootDB')){
} }
//파일 권한 검사 //파일 권한 검사
if(file_exists(ROOT.'/d_pic') && !is_dir(ROOT.'/d_pic')){ if (file_exists(AppConf::getUserIconPathFS()) && !is_dir(AppConf::getUserIconPathFS())) {
Json::die([ Json::die([
'result'=>false, 'result'=>false,
'reason'=>'d_pic 이 디렉토리가 아닙니다' 'reason'=>AppConf::$userIconPath.' 이 디렉토리가 아닙니다'
]); ]);
} }
if(file_exists(ROOT.'/d_log') && !is_dir(ROOT.'/d_log')){ if (file_exists(ROOT.'/d_log') && !is_dir(ROOT.'/d_log')) {
Json::die([ Json::die([
'result'=>false, 'result'=>false,
'reason'=>'d_log 가 디렉토리가 아닙니다' 'reason'=>'d_log 가 디렉토리가 아닙니다'
]); ]);
} }
if(!file_exists(ROOT.'/d_setting')){ if (file_exists(ROOT.'/d_shared') && !is_dir(ROOT.'/d_shared')) {
Json::die([ Json::die([
'result'=>false, 'result'=>false,
'reason'=>'d_setting 이 존재하지 않습니다' 'reason'=>'d_shared 가 디렉토리가 아닙니다'
]); ]);
} }
if(!is_writable(ROOT.'/d_pic')){ if (file_exists(ROOT.'/d_setting') && !is_dir(ROOT.'/d_setting')) {
Json::die([ Json::die([
'result'=>false, 'result'=>false,
'reason'=>'d_pic 디렉토리의 쓰기 권한이 없습니다' 'reason'=>'d_shared 가 디렉토리가 아닙니다'
]); ]);
} }
if(!is_writable(ROOT.'/d_log')){ if (!file_exists(ROOT.'/d_log')
|| !file_exists(ROOT.'/d_shared')
|| !file_exists(ROOT.'/d_setting')
|| !file_exists(AppConf::getUserIconPathFS())
) {
if (!is_writable(ROOT)) {
Json::die([
'result'=>false,
'reason'=>'하위 디렉토리 생성 권한이 없습니다'
]);
}
//기본 파일 생성
if (!file_exists(AppConf::getUserIconPathFS())) {
mkdir(AppConf::getUserIconPathFS());
}
if (!file_exists(ROOT.'/d_log')) {
mkdir(ROOT.'/d_log');
}
if (!file_exists(ROOT.'/d_setting')) {
mkdir(ROOT.'/d_setting');
}
if (!file_exists(ROOT.'/d_shared')) {
mkdir(ROOT.'/d_shared');
}
}
if (!is_writable(AppConf::getUserIconPathFS())) {
Json::die([
'result'=>false,
'reason'=>AppConf::$userIconPath.' 디렉토리의 쓰기 권한이 없습니다'
]);
}
if (!is_writable(ROOT.'/d_log')) {
Json::die([ Json::die([
'result'=>false, 'result'=>false,
'reason'=>'d_log 디렉토리의 쓰기 권한이 없습니다' 'reason'=>'d_log 디렉토리의 쓰기 권한이 없습니다'
]); ]);
} }
if(!is_writable(ROOT.'/d_setting')){ if (!is_writable(ROOT.'/d_shared')) {
Json::die([
'result'=>false,
'reason'=>'d_shared 디렉토리의 쓰기 권한이 없습니다'
]);
}
if (!is_writable(ROOT.'/d_setting')) {
Json::die([ Json::die([
'result'=>false, 'result'=>false,
'reason'=>'d_setting 디렉토리의 쓰기 권한이 없습니다.' 'reason'=>'d_setting 디렉토리의 쓰기 권한이 없습니다.'
]); ]);
} }
//기본 파일 생성
if(!file_exists(ROOT.'/d_pic')){
mkdir(ROOT.'/d_pic');
}
if(!file_exists(ROOT.'/d_log')){
mkdir(ROOT.'/d_log');
}
if(!file_exists(ROOT.'/d_log/.htaccess')){ if (!file_exists(ROOT.'/d_log/.htaccess')) {
@file_put_contents(ROOT.'/d_log/.htaccess', 'Deny from all'); @file_put_contents(ROOT.'/d_log/.htaccess', 'Deny from all');
} }
if(!file_exists(ROOT.'/d_setting/.htaccess')){ if (!file_exists(ROOT.'/d_setting/.htaccess')) {
@file_put_contents(ROOT.'/d_setting/.htaccess', 'Deny from all'); @file_put_contents(ROOT.'/d_setting/.htaccess', 'Deny from all');
} }
//DB 접근 권한 검사 //DB 접근 권한 검사
$rootDB = new \MeekroDB($host,$username,$password,$dbName,$port,'utf8mb4'); $rootDB = new \MeekroDB($host, $username, $password, $dbName, $port, 'utf8mb4');
$rootDB->connect_options[MYSQLI_OPT_INT_AND_FLOAT_NATIVE] = true; $rootDB->connect_options[MYSQLI_OPT_INT_AND_FLOAT_NATIVE] = true;
$rootDB->throw_exception_on_nonsql_error = false; $rootDB->throw_exception_on_nonsql_error = false;
$rootDB->nonsql_error_handler = 'dbConnFail'; $rootDB->nonsql_error_handler = function ($params) {
$rootDB->error_handler = 'dbSQLFail'; Json::die([
'result'=>false,
'reason'=>'DB 접속에 실패했습니다.'
]);
};
$rootDB->error_handler = function ($params) {
Json::die([
'result'=>false,
'reason'=>'SQL을 제대로 실행하지 못했습니다. DB상태를 확인해 주세요.'
]);
};
$mysqli_obj = $rootDB->get(); //로그인에 실패할 경우 자동으로 dbConnFail()이 실행됨. $mysqli_obj = $rootDB->get(); //로그인에 실패할 경우 자동으로 dbConnFail()이 실행됨.
if($mysqli_obj->multi_query(file_get_contents(__dir__.'/sql/common_schema.sql'))){ if ($mysqli_obj->multi_query(file_get_contents(__dir__.'/sql/common_schema.sql'))) {
while(true){ while (true) {
if (!$mysqli_obj->more_results()) { if (!$mysqli_obj->more_results()) {
break; break;
} }
if(!$mysqli_obj->next_result()){ if (!$mysqli_obj->next_result()) {
break; break;
} }
} }
@@ -143,20 +180,83 @@ $rootDB->insert('system', array(
$globalSalt = bin2hex(random_bytes(16)); $globalSalt = bin2hex(random_bytes(16));
'@phan-var-force string $servHost';
'@phan-var-force string $sharedIconPath';
'@phan-var-force string $gameImagePath';
$sharedIconPath = WebUtil::resolveRelativePath($sharedIconPath, $servHost);
$gameImagePath = WebUtil::resolveRelativePath($gameImagePath, $servHost);
$result = Util::generateFileUsingSimpleTemplate( $result = Util::generateFileUsingSimpleTemplate(
ROOT.'/d_setting/RootDB.orig.php', __dir__.'/templates/ServConfig.orig.php',
ROOT.'/d_setting/RootDB.php',[ ROOT.'/d_setting/ServConfig.php',
[
'serverBasePath'=>$servHost,
'sharedIconPath'=>$sharedIconPath,
'gameImagePath'=>$gameImagePath
],
true
);
if ($result !== true) {
Json::die([
'result'=>false,
'reason'=>$result
]);
}
$result = Util::generateFileUsingSimpleTemplate(
__dir__.'/templates/common_path.orig.js',
ROOT.'/d_shared/common_path.js',
[
'serverBasePath'=>$servHost,
'sharedIconPath'=>$sharedIconPath,
'gameImagePath'=>$gameImagePath
],
true
);
if ($result !== true) {
Json::die([
'result'=>false,
'reason'=>$result
]);
}
$result = Util::generateFileUsingSimpleTemplate(
__dir__.'/templates/common.orig.css',
ROOT.'/d_shared/common.css',
[
'serverBasePath'=>$servHost,
'sharedIconPath'=>$sharedIconPath,
'gameImagePath'=>$gameImagePath
],
true
);
if ($result !== true) {
Json::die([
'result'=>false,
'reason'=>$result
]);
}
$result = Util::generateFileUsingSimpleTemplate(
__dir__.'/templates/RootDB.orig.php',
ROOT.'/d_setting/RootDB.php',
[
'host'=>$host, 'host'=>$host,
'user'=>$username, 'user'=>$username,
'password'=>$password, 'password'=>$password,
'dbName'=>$dbName, 'dbName'=>$dbName,
'port'=>$port, 'port'=>$port,
'globalSalt'=>$globalSalt, 'globalSalt'=>$globalSalt,
'serverBasePath'=>$servHost
] ]
); );
if($result !== true){ if ($result !== true) {
Json::die([ Json::die([
'result'=>false, 'result'=>false,
'reason'=>$result 'reason'=>$result
@@ -166,4 +266,4 @@ if($result !== true){
Json::die([ Json::die([
'result'=>true, 'result'=>true,
'reason'=>'success' 'reason'=>'success'
]); ]);
+3 -4
View File
@@ -2,7 +2,6 @@
DROP TABLE IF EXISTS `system`; DROP TABLE IF EXISTS `system`;
DROP TABLE IF EXISTS `member`; DROP TABLE IF EXISTS `member`;
DROP TABLE IF EXISTS `member_log`; DROP TABLE IF EXISTS `member_log`;
DROP TABLE IF EXISTS `auth_kakao`;
-- 시스템 테이블 -- 시스템 테이블
-- TODO:장기적으로는 key-value(json) storage 형태로 바꾸는게 나을 듯. -- TODO:장기적으로는 key-value(json) storage 형태로 바꾸는게 나을 듯.
@@ -15,7 +14,7 @@ CREATE TABLE `system` (
`MDF_DATE` DATETIME NULL DEFAULT NULL, `MDF_DATE` DATETIME NULL DEFAULT NULL,
PRIMARY KEY (`NO`) PRIMARY KEY (`NO`)
) )
ENGINE=InnoDB DEFAULT CHARSET=UTF8; ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- 회원 테이블 -- 회원 테이블
CREATE TABLE `member` ( CREATE TABLE `member` (
@@ -41,7 +40,7 @@ CREATE TABLE `member` (
UNIQUE INDEX `kauth_id` (`oauth_id`), UNIQUE INDEX `kauth_id` (`oauth_id`),
INDEX `delete_after` (`delete_after`) INDEX `delete_after` (`delete_after`)
) )
ENGINE=InnoDB DEFAULT CHARSET=UTF8; ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- 로그인 로그 테이블 -- 로그인 로그 테이블
CREATE TABLE `member_log` ( CREATE TABLE `member_log` (
@@ -54,4 +53,4 @@ CREATE TABLE `member_log` (
INDEX `action` (`member_no`, `action_type`, `date`), INDEX `action` (`member_no`, `action_type`, `date`),
INDEX `member` (`member_no`, `date`) INDEX `member` (`member_no`, `date`)
) )
ENGINE=MyISAM DEFAULT CHARSET=UTF8; ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
+1
View File
@@ -0,0 +1 @@
Deny from all
@@ -1,7 +1,8 @@
<?php <?php
namespace sammo; namespace sammo;
class RootDB{ class RootDB
{
private static $uDB = null; private static $uDB = null;
private static $host = '_tK_host_'; private static $host = '_tK_host_';
@@ -13,21 +14,25 @@ class RootDB{
private static $globalSalt = '_tK_globalSalt_'; private static $globalSalt = '_tK_globalSalt_';
private static $serverWebPath = '_tK_serverBasePath'; private function __construct()
{
private function __construct(){
} }
/** /**
* DB 객체 생성 * DB 객체 생성
* *
* @return \MeekroDB * @return \MeekroDB
* @suppress PhanTypeMismatchProperty
*/ */
public static function db(){ public static function db()
if(self::$uDB === null){ {
self::$uDB = new \MeekroDB(self::$host,self::$user,self::$password,self::$dbName,self::$port,self::$encoding); if (self::$uDB === null) {
self::$uDB = new \MeekroDB(self::$host, self::$user, self::$password, self::$dbName, self::$port, self::$encoding);
self::$uDB->connect_options[MYSQLI_OPT_INT_AND_FLOAT_NATIVE] = true; self::$uDB->connect_options[MYSQLI_OPT_INT_AND_FLOAT_NATIVE] = true;
self::$uDB->error_handler= function(){};
self::$uDB->throw_exception_on_error = true;
self::$uDB->throw_exception_on_nonsql_error = true;
} }
return self::$uDB; return self::$uDB;
} }
@@ -35,20 +40,11 @@ class RootDB{
/** /**
* 비밀번호 해시용 전역 SALT 반환 * 비밀번호 해시용 전역 SALT 반환
* 비밀번호는 sha512(usersalt|sha512(globalsalt|password|globalsalt)|usersalt); 순임 * 비밀번호는 sha512(usersalt|sha512(globalsalt|password|globalsalt)|usersalt); 순임
* *
* @return string * @return string
*/ */
public static function getGlobalSalt(){ public static function getGlobalSalt()
{
return self::$globalSalt; return self::$globalSalt;
} }
}
/**
* 서버 주소 반환. 서버의 경로가 하부 디렉토리인 경우에 하부 디렉토리까지 포함
*
* @return string
*/
public static function getServerBasepath(){
//FIXME: 더 좋은 위치가 있을 것.
return self::$globalSalt;
}
}
+45
View File
@@ -0,0 +1,45 @@
<?php
namespace sammo;
class ServConfig
{
private function __construct()
{
}
public static $serverWebPath = '_tK_serverBasePath_';
public static $sharedIconPath = '_tK_sharedIconPath_';
public static $gameImagePath = "_tK_gameImagePath_";
public static function getSharedIconPath(string $filepath='') : string
{
if($filepath){
return static::$sharedIconPath."/{$filepath}";
}
return static::$sharedIconPath;
}
public static function getUserIconPath(string $filepath='') : string
{
return AppConf::getUserIconPathWeb($filepath);
}
public static function getGameImagePath(string $filepath='') : string
{
if($filepath){
return static::$gameImagePath."/{$filepath}";
}
return static::$gameImagePath;
}
/**
* 서버 주소 반환. 서버의 경로가 하부 디렉토리인 경우에 하부 디렉토리까지 포함
*
* @return string
*/
public static function getServerBasepath() : string
{
return self::$serverWebPath;
}
}
+58
View File
@@ -0,0 +1,58 @@
@charset "utf-8";
.bg0 { background-image:url('_tK_gameImagePath_/back_walnut.jpg'); }
.bg1 { background-image:url('_tK_gameImagePath_/back_green.jpg'); }
.bg2 { background-image:url('_tK_gameImagePath_/back_blue.jpg'); }
.img_back {background-image:url('_tK_gameImagePath_/back.jpg'); }
/* 레거시. */
#bg0 { background-image:url('_tK_gameImagePath_/back_walnut.jpg'); }
#bg1 { background-image:url('_tK_gameImagePath_/back_green.jpg'); }
#bg2 { background-image:url('_tK_gameImagePath_/back_blue.jpg'); }
.map_detail .map_title{
background:
url('_tK_gameImagePath_/ltitle.jpg') no-repeat left,
url('_tK_gameImagePath_/rtitle.jpg') no-repeat right;
}
.map_detail.map_spring .map_title_text{
background:
url('_tK_gameImagePath_/ad.gif') no-repeat left,
url('_tK_gameImagePath_/spring.gif') no-repeat right;
}
.map_detail.map_summer .map_title_text{
background:
url('_tK_gameImagePath_/ad.gif') no-repeat left,
url('_tK_gameImagePath_/summer.gif') no-repeat right;
}
.map_detail.map_fall .map_title_text{
background:
url('_tK_gameImagePath_/ad.gif') no-repeat left,
url('_tK_gameImagePath_/fall.gif') no-repeat right;
}
.map_detail.map_winter .map_title_text{
background:
url('_tK_gameImagePath_/ad.gif') no-repeat left,
url('_tK_gameImagePath_/winter.gif') no-repeat right;
}
.map_spring .map_body{
background: url('_tK_gameImagePath_/map1.jpg') no-repeat;
}
.map_summer .map_body{
background: url('_tK_gameImagePath_/map2.jpg') no-repeat;
}
.map_fall .map_body{
background: url('_tK_gameImagePath_/map3.jpg') no-repeat;
}
.map_winter .map_body{
background: url('_tK_gameImagePath_/map4.jpg') no-repeat;
}
+5
View File
@@ -0,0 +1,5 @@
window.pathConfig = {
root:"_tK_serverBasePath_",
sharedIcon:"_tK_sharedIconPath_",
gameImage:"_tK_gameImagePath_"
};
+13 -25
View File
@@ -1,42 +1,30 @@
<?php <?php
namespace sammo; namespace sammo;
function MYDB_query($query, $connect)
function MYDB_connect($host, $id, $pw) { {
$conn = mysqli_connect($host, $id, $pw);
mysqli_query($conn, 'set names utf8mb4');
return $conn;
}
function MYDB_select_db($db, $connect) {
return mysqli_select_db($connect, $db);
}
function MYDB_query($query, $connect) {
return mysqli_query($connect, $query); return mysqli_query($connect, $query);
} }
function MYDB_num_rows($result) { function MYDB_num_rows(\mysqli_result $result) : int
{
return mysqli_num_rows($result); return mysqli_num_rows($result);
} }
function MYDB_fetch_array($result) { /**
* @return mixed[]
*/
function MYDB_fetch_array(\mysqli_result $result)
{
return mysqli_fetch_array($result); return mysqli_fetch_array($result);
} }
function MYDB_fetch_row($result) { function MYDB_fetch_row(\mysqli_result $result)
{
return mysqli_fetch_row($result); return mysqli_fetch_row($result);
} }
function MYDB_list_tables($db, $connect) { function MYDB_error($connect)
return mysqli_query($connect, "show tables"); {
}
function MYDB_error($connect) {
return mysqli_error($connect); return mysqli_error($connect);
} }
function MYDB_close($connect) {
return mysqli_close($connect);
}
+17 -15
View File
@@ -4,28 +4,29 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
$connect=dbConn(); $session = Session::requireGameLogin()->setReadOnly();
if($session->userGrade < 5) {
if(Session::getUserGrade() < 5) { ?><!DOCTYPE html>
echo "<!DOCTYPE html>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>관리메뉴</title> <title>관리메뉴</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
<body> <body>
관리자가 아닙니다.<br> 관리자가 아닙니다.<br>
"; <?=banner()?>
echo banner();
echo "
</body> </body>
</html>"; </html>
<?php
exit(); exit();
} }
$db = DB::db();
$connect=$db->get();
$query = "select turntime,tnmt_time from game"; $query = "select turntime,tnmt_time from game";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
@@ -37,16 +38,17 @@ $plock = MYDB_fetch_array($result);
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>삼국지 모의전투 PHP (유기체서버)</title> <title>삼국지 모의전투 HiDCHe</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
<body> <body>
<form action=_119_b.php method=post> <form action=_119_b.php method=post>
시간조정 : <input type=text size=3 name=minute><input type=submit name=btn value='분당김'><input type=submit name=btn value='분지연'> 최종갱신 : <?=$admin['turntime'];?><br> 시간조정 : <input type=text size=3 name=minute><input type=submit name=btn value='분당김'><input type=submit name=btn value='분지연'> 최종갱신 : <?=$admin['turntime']?><br>
시간조정 : <input type=text size=3 name=minute2><input type=submit name=btn value='토너분당김'><input type=submit name=btn value='토너분지연'> 토너먼트 : <?=$admin['tnmt_time'];?><br> 시간조정 : <input type=text size=3 name=minute2><input type=submit name=btn value='토너분당김'><input type=submit name=btn value='토너분지연'> 토너먼트 : <?=$admin['tnmt_time']?><br>
봉급지급 : <input type=submit name=btn value='금지급'><input type=submit name=btn value='쌀지급'><br> 봉급지급 : <input type=submit name=btn value='금지급'><input type=submit name=btn value='쌀지급'><br>
락 풀 기 : <input type=submit name=btn value='락걸기'><input type=submit name=btn value='락풀기'> 현재 : <?=$plock['plock']>0?"동결중":"가동중";?><br> 락 풀 기 : <input type=submit name=btn value='락걸기'><input type=submit name=btn value='락풀기'> 현재 : <?=$plock['plock']>0?"동결중":"가동중"?><br>
</form> </form>
</body> </body>
</html> </html>
+25 -8
View File
@@ -4,13 +4,31 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
$connect=dbConn();
if(Session::getUserGrade() < 5){ $session = Session::requireGameLogin()->setReadOnly();
//echo "<script>location.replace('_119.php');</script>"; if($session->userGrade < 5){
echo '_119.php';//TODO:debug all and replace header('location:_119.php');
die();
} }
$v = new Validator($_POST);
$v->rule('integer', [
'minute',
'minutes2'
]);
if(!$v->validate()){
Error($v->errorStr());
}
$btn = Util::getReq('btn');
$minute = Util::getReq('minute', 'int');
$minute2 = Util::getReq('minute2', 'int');
extractMissingPostToGlobals();
$db = DB::db();
$connect=$db->get();
switch($btn) { switch($btn) {
case "분당김": case "분당김":
$query = "update game set turntime=DATE_SUB(turntime, INTERVAL $minute MINUTE),starttime=DATE_SUB(starttime, INTERVAL $minute MINUTE),tnmt_time=DATE_SUB(tnmt_time, INTERVAL $minute MINUTE)"; $query = "update game set turntime=DATE_SUB(turntime, INTERVAL $minute MINUTE),starttime=DATE_SUB(starttime, INTERVAL $minute MINUTE),tnmt_time=DATE_SUB(tnmt_time, INTERVAL $minute MINUTE)";
@@ -37,10 +55,10 @@ case "토너분지연":
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
break; break;
case "금지급": case "금지급":
processGoldIncome($connect); processGoldIncome();
break; break;
case "쌀지급": case "쌀지급":
processRiceIncome($connect); processRiceIncome();
break; break;
case "락걸기": case "락걸기":
$query = "update plock set plock=1"; $query = "update plock set plock=1";
@@ -52,5 +70,4 @@ case "락풀기":
break; break;
} }
//echo "<script>location.replace('_119.php');</script>"; header('Location:_119.php');
echo '_119.php';//TODO:debug all and replace
+19 -18
View File
@@ -4,16 +4,16 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn();
if(Session::getUserGrade() < 5) { if($session->userGrade < 5) {
echo "<!DOCTYPE html> echo "<!DOCTYPE html>
<html> <html>
<head> <head>
<title>관리메뉴</title> <title>관리메뉴</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
<body> <body>
관리자가 아닙니다.<br> 관리자가 아닙니다.<br>
@@ -26,14 +26,18 @@ if(Session::getUserGrade() < 5) {
exit(); exit();
} }
$admin = getAdmin($connect); $db = DB::db();
$connect=$db->get();
$admin = getAdmin();
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>게임관리</title> <title>게임관리</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
<body> <body>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
@@ -42,35 +46,32 @@ $admin = getAdmin($connect);
<form name=form1 method=post action=_admin1_submit.php> <form name=form1 method=post action=_admin1_submit.php>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr><td width=110 align=right>운영자메세지</td> <tr><td width=110 align=right>운영자메세지</td>
<td colspan=3><input type=textarea size=90 style=color:white;background-color:black; name=msg value='<?=$admin['msg'];?>'><input type=submit name=btn value=변경></td></td> <td colspan=3><input type=textarea size=90 style=color:white;background-color:black; name=msg value='<?=$admin['msg']?>'><input type=submit name=btn value=변경></td></td>
</tr> </tr>
<tr><td width=110 align=right>중원정세추가</td> <tr><td width=110 align=right>중원정세추가</td>
<td colspan=3><input type=textarea size=90 maxlength=80 style=color:white;background-color:black; name=log><input type=submit name=btn value=로그쓰기></td></td> <td colspan=3><input type=textarea size=90 maxlength=80 style=color:white;background-color:black; name=log><input type=submit name=btn value=로그쓰기></td></td>
</tr> </tr>
<tr><td width=110 align=right>쿼리 요청</td>
<td colspan=3><input type=textarea size=90 maxlength=150 style=color:white;background-color:black; name=q><input type=submit name=btn value=요청></td></td>
</tr>
<tr> <tr>
<td width=110 align=right>시작시간변경</td> <td width=110 align=right>시작시간변경</td>
<td width=285><input type=text size=20 maxlength=20 style=color:white;background-color:black;text-align:right; name=starttime value='<?=$admin['starttime'];?>'><input type=submit name=btn value=변경1></td> <td width=285><input type=text size=20 maxlength=20 style=color:white;background-color:black;text-align:right; name=starttime value='<?=$admin['starttime']?>'><input type=submit name=btn value=변경1></td>
<td width=110 align=right>현재도시훈사</td> <td width=110 align=right>현재도시훈사</td>
<td width=285><?=$admin['city_rate'];?></td> <td width=285><?=$admin['city_rate']?></td>
</tr> </tr>
<tr> <tr>
<td width=110 align=right>최대 장수</td> <td width=110 align=right>최대 장수</td>
<td width=285><input type=text size=3 maxlength=3 style=color:white;background-color:black;text-align:right; name=maxgeneral value=<?=$admin['maxgeneral'];?>><input type=submit name=btn value=변경2></td> <td width=285><input type=text size=3 maxlength=3 style=color:white;background-color:black;text-align:right; name=maxgeneral value=<?=$admin['maxgeneral']?>><input type=submit name=btn value=변경2></td>
<td width=110 align=right>최대 국가</td> <td width=110 align=right>최대 국가</td>
<td width=285><input type=text size=3 maxlength=2 style=color:white;background-color:black;text-align:right; name=maxnation value=<?=$admin['maxnation'];?>><input type=submit name=btn value=변경3></td> <td width=285><input type=text size=3 maxlength=2 style=color:white;background-color:black;text-align:right; name=maxnation value=<?=$admin['maxnation']?>><input type=submit name=btn value=변경3></td>
</tr> </tr>
<tr> <tr>
<td width=110 align=right>기준 장수수</td> <td width=110 align=right></td>
<td width=285><input type=text size=3 maxlength=3 style=color:white;background-color:black;text-align:right; name=gen_rate value=<?=$admin['normgeneral'];?>><input type=submit name=btn value=변경5></td> <td width=285></td>
<td width=110 align=right>현재 수입률</td> <td width=110 align=right>현재 수입률</td>
<td width=285><?=$admin['gold_rate'];?>%</td> <td width=285><?=$admin['gold_rate']?>%</td>
</tr> </tr>
<tr> <tr>
<td width=110 align=right>시작 년도</td> <td width=110 align=right>시작 년도</td>
<td width=285><input type=text size=3 maxlength=3 style=color:white;background-color:black;text-align:right; name=startyear value='<?=$admin['startyear'];?>'><input type=submit name=btn value=변경4></td> <td width=285><input type=text size=3 maxlength=3 style=color:white;background-color:black;text-align:right; name=startyear value='<?=$admin['startyear']?>'><input type=submit name=btn value=변경4></td>
<td width=110 align=right>최근 갱신 시간</td> <td width=110 align=right>최근 갱신 시간</td>
<td width=285>&nbsp;<?=$admin['turntime']?></td> <td width=285>&nbsp;<?=$admin['turntime']?></td>
</tr> </tr>
+55 -41
View File
@@ -4,51 +4,67 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn();
$admin = getAdmin($connect); if ($session->userGrade < 5) {
header('location:_admin1.php');
if(Session::getUserGrade() < 5) { die();
//echo "<script>location.replace('_admin1.php');</script>";
echo '_admin1.php';//TODO:debug all and replace
} }
switch($btn) { $v = new Validator($_POST);
$v->rule('integer', [
'maxgeneral',
'minutes2'
])->rule('dateFormat', [
'starttime'
], 'Y-m-d H:i:s');
if (!$v->validate()) {
Error($v->errorStr());
}
$msg = Util::getReq('msg');
$btn = Util::getReq('btn');
$log = Util::getReq('log');
$starttime = Util::getReq('starttime', 'string', (new \DateTime())->format('Y-m-d H:i:s'));
$maxgeneral = Util::getReq('maxgeneral', 'int', GameConst::$defaultMaxGeneral);
$maxnation = Util::getReq('maxnation', 'int', GameConst::$defaultMaxNation);
$startyear = Util::getReq('startyear', 'int', GameConst::$defaultStartYear);
extractMissingPostToGlobals();
$db = DB::db();
$connect=$db->get();
$admin = getAdmin();
switch ($btn) {
case "변경": case "변경":
$msg = addslashes(SQ2DQ($msg)); $msg = addslashes(SQ2DQ($msg));
$query = "update game set msg='$msg'"; $query = "update game set msg='$msg'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
break;
case "요청":
$query = $q;
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
break; break;
case "로그쓰기": case "로그쓰기":
$lognum = $admin['historyindex'] + 1; $lognum = $admin['historyindex'] + 1;
if($lognum >= 29) { $lognum = 0; } if ($lognum >= 29) {
$history[0] = "<R>★</><S>{$log}</>"; $lognum = 0;
pushHistory($history); }
pushWorldHistory(["<R>★</><S>{$log}</>"]);
break; break;
case "변경1": case "변경1":
$query = "update game set starttime='$starttime'"; $query = "update game set starttime='$starttime'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
break; break;
case "변경2": case "변경2":
$query = "update game set maxgeneral='$maxgeneral'"; $query = "update game set maxgeneral='$maxgeneral'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
break; break;
case "변경3": case "변경3":
$query = "update game set maxnation='$maxnation'"; $query = "update game set maxnation='$maxnation'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
break; break;
case "변경4": case "변경4":
$query = "update game set startyear='$startyear'"; $query = "update game set startyear='$startyear'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
break;
case "변경5":
$query = "update game set normgeneral='$gen_rate'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
break; break;
case "1분턴": case "1분턴":
case "2분턴": case "2분턴":
@@ -58,7 +74,7 @@ switch($btn) {
case "30분턴": case "30분턴":
case "60분턴": case "60분턴":
case "120분턴": case "120분턴":
switch($btn) { switch ($btn) {
case "1분턴": $turnterm = 1; break; case "1분턴": $turnterm = 1; break;
case "2분턴": $turnterm = 2; break; case "2분턴": $turnterm = 2; break;
case "5분턴": $turnterm = 5; break; case "5분턴": $turnterm = 5; break;
@@ -73,38 +89,36 @@ switch($btn) {
$starttime = date("Y-m-d H:i:s", strtotime($admin['turntime']) - $turn * $unit); $starttime = date("Y-m-d H:i:s", strtotime($admin['turntime']) - $turn * $unit);
$starttime = cutTurn($starttime, $turnterm); $starttime = cutTurn($starttime, $turnterm);
$query = "update game set turnterm='$turnterm',starttime='$starttime'"; $query = "update game set turnterm='$turnterm',starttime='$starttime'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
// 턴시간이 길어지는 경우 랜덤턴 배정 // 턴시간이 길어지는 경우 랜덤턴 배정
if($turnterm < $admin['turnterm']) { if ($turnterm < $admin['turnterm']) {
$query = "select no from general"; $query = "select no from general";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$count = MYDB_num_rows($result); $count = MYDB_num_rows($result);
for($i=0; $i < $count; $i++) { for ($i=0; $i < $count; $i++) {
$gen = MYDB_fetch_array($result); $gen = MYDB_fetch_array($result);
$turntime = getRandTurn($turnterm); $turntime = getRandTurn($turnterm);
$query = "update general set turntime='$turntime' where no='{$gen['no']}'"; $query = "update general set turntime='$turntime' where no='{$gen['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
} }
// 턴시간이 너무 멀리 떨어진 선수 제대로 보정 // 턴시간이 너무 멀리 떨어진 선수 제대로 보정
} else { } else {
$query = "select no,turntime from general"; $query = "select no,turntime from general";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$count = MYDB_num_rows($result); $count = MYDB_num_rows($result);
for($i=0; $i < $count; $i++) { for ($i=0; $i < $count; $i++) {
$gen = MYDB_fetch_array($result); $gen = MYDB_fetch_array($result);
$num = floor((strtotime($gen['turntime']) - strtotime($admin['turntime'])) / $unit); $num = intdiv((strtotime($gen['turntime']) - strtotime($admin['turntime'])), $unit);
if($num > 0) { if ($num > 0) {
$gen['turntime'] = date("Y-m-d H:i:s", strtotime($gen['turntime']) - $unit * $num); $gen['turntime'] = date("Y-m-d H:i:s", strtotime($gen['turntime']) - $unit * $num);
$query = "update general set turntime='{$gen['turntime']}' where no='{$gen['no']}'"; $query = "update general set turntime='{$gen['turntime']}' where no='{$gen['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
} }
} }
} }
$history[] = "<R>★</>턴시간이 <C>$btn</>으로 변경됩니다.";
pushHistory($history); pushWorldHistory(["<R>★</>턴시간이 <C>$btn</>으로 변경됩니다."]);
break; break;
} }
//echo "<script>location.replace('_admin1.php');</script>"; header('location:_admin1.php');
echo '_admin1.php';//TODO:debug all and replace
+10 -14
View File
@@ -4,16 +4,16 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn();
if(Session::getUserGrade() < 5) { if($session->userGrade < 5) {
echo "<!DOCTYPE html> echo "<!DOCTYPE html>
<html> <html>
<head> <head>
<title>관리메뉴</title> <title>관리메뉴</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
<body> <body>
관리자가 아닙니다.<br> 관리자가 아닙니다.<br>
@@ -26,7 +26,10 @@ if(Session::getUserGrade() < 5) {
exit(); exit();
} }
$query = "select conlimit,conweight from game limit 1"; $db = DB::db();
$connect=$db->get();
$query = "select conlimit from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
?> ?>
@@ -35,7 +38,8 @@ $admin = MYDB_fetch_array($result);
<head> <head>
<title>회원관리</title> <title>회원관리</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
<body> <body>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
@@ -47,13 +51,6 @@ $admin = MYDB_fetch_array($result);
<td width=80 align=center>접속제한</td> <td width=80 align=center>접속제한</td>
<td width=713 align=center><input type=submit name=btn value='전체 접속허용'><input type=submit name=btn value='전체 접속제한'></td> <td width=713 align=center><input type=submit name=btn value='전체 접속허용'><input type=submit name=btn value='전체 접속제한'></td>
</tr> </tr>
<tr>
<td width=80 align=center>제한등급</td>
<td width=713 align=center>
<input type=text size=3 maxlength=3 name=conweight value=<?=$admin['conweight'];?> style=color:white;background-color:black;font-size:13px;>
<input type=submit name=btn value='접속가중치'>
</td>
</tr>
</table> </table>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr> <tr>
@@ -74,7 +71,6 @@ for($i=0; $i < $gencount; $i++) {
if($general['block'] > 0) { $style .= "background-color:red;"; } if($general['block'] > 0) { $style .= "background-color:red;"; }
if($general['npc'] >= 2) { $style .= "color:cyan;"; } if($general['npc'] >= 2) { $style .= "color:cyan;"; }
elseif($general['npc'] == 1) { $style .= "color:skyblue;"; } elseif($general['npc'] == 1) { $style .= "color:skyblue;"; }
if($general['con'] > $admin['conlimit']) { $style .= "color:red;"; }
echo " echo "
<option value={$general['no']} $style>{$general['name']}</option>"; <option value={$general['no']} $style>{$general['name']}</option>";
+246 -200
View File
@@ -3,8 +3,14 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
$btn = Util::getReq('btn');
$weap = Util::getReq('weap', 'int');
extractMissingPostToGlobals();
//로그인 검사 //로그인 검사
$session = Session::requireLogin()->loginGame(); $session = Session::requireLogin()->loginGame()->setReadOnly();
if($session->userGrade < 5) { if($session->userGrade < 5) {
header('location:_admin2.php'); header('location:_admin2.php');
@@ -15,293 +21,333 @@ if(!$generalID){
header('location:_admin2.php'); header('location:_admin2.php');
} }
$connect = dbConn(); $db = DB::db();
$connect=$db->get();
switch($btn) { switch($btn) {
case "전체 접속허용": case "전체 접속허용":
$query = "update general set con=0"; $db->update('general', [
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); 'con'=>0
], true);
break; break;
case "전체 접속제한": case "전체 접속제한":
$query = "update general set con=1000"; $db->update('general', [
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); 'con'=>1000
break; ], true);
case "접속가중치":
$query = "update game set conweight='$conweight'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
break; break;
case "블럭 해제": case "블럭 해제":
$db->update('general', [
'block'=>0
], '`no` IN %li', $genlist);
DB::db()->query('update general set block=0 where no IN %li', $genlist); DB::db()->query('update general set block=0 where no IN %li', $genlist);
break; break;
case "1단계 블럭": case "1단계 블럭":
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
$db = DB::db(); $db->update('general', [
$db->query('update general set block=1,killturn=24 where no IN %li',$genlist); 'block'=>1,
//FIXME: subquery로 하는게 더 빠를 듯. 'killturn'=>24
$uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist); ], '`no` IN %li', $genlist);
RootDB::db()->query('update MEMBER set block_num=block_num+1,block_date=%s where no IN %ls', $date, $uid); $uid = $db->queryFirstColumn('SELECT `owner` FROM general WHERE `no` IN %li', $genlist);
RootDB::db()->update('member',[
'block_num'=>$db->sqleval('block_num+1'),
'block_date'=>$date
], 'id IN %li', $uid);
break; break;
case "2단계 블럭": case "2단계 블럭":
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
$db = DB::db(); $db->update('general', [
$db->query('update general set gold=0,rice=0,block=2,killturn=24 where no IN %li',$genlist); 'gold'=>0,
'rice'=>0,
'block'=>2,
'killturn'=>24
], '`no` IN %li', $genlist);
$uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist); $uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist);
RootDB::db()->query('update MEMBER set block_num=block_num+1,block_date=%s where id IN %ls', $date, $uid); RootDB::db()->update('member',[
'block_num'=>$db->sqleval('block_num+1'),
'block_date'=>$date
], 'id IN %li', $uid);
break; break;
case "3단계 블럭": case "3단계 블럭":
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
$db = DB::db(); $db->update('general', [
$db->query('update general set gold=0,rice=0,block=3,killturn=24 where no IN %li',$genlist); 'gold'=>0,
$uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist); 'rice'=>0,
RootDB::db()->query('update MEMBER set block_num=block_num+1,block_date=%s where id IN %ls', $date, $uid); 'block'=>3,
'killturn'=>24
], '`no` IN %li', $genlist);
$uid = $db->queryFirstColumn('SELECT `owner` from general where no IN %li', $genlist);
RootDB::db()->update('member',[
'block_num'=>$db->sqleval('block_num+1'),
'block_date'=>$date
], 'id IN %li', $uid);
break; break;
case "무한삭턴": case "무한삭턴":
DB::db()->query('update general set killturn=8000 where no IN %li',$genlist); $db->update('general', [
'killturn'=>8000
], '`no` IN %li', $genlist);
break; break;
case "강제 사망": case "강제 사망":
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
DB::db()->query('update general set turn0=0,killturn=0,turntime=%s where no IN %li',$date, $genlist); $db->update('general', [
'turn0'=>0,
'killturn'=>0,
'turntime'=>$date,
], '`no` IN %li', $genlist);
break; break;
case "특기 부여": case "특기 부여":
$admin = DB::db()->queryFirstRow('select `year`, `month` from `game` where `no`=1'); list($year, $month) = $db->queryFirstList('select `year`, `month` from `game` where `no`=1');
for($i=0; $i < sizeof($genlist); $i++) { $src = MessageTarget::buildQuick($session->generalID);
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]); $text = "특기 부여!";
$msg = "특기 부여!";
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
}
for($i=0; $i < sizeof($genlist); $i++) {
$query = "select no,leader,power,intel from general where no='$genlist[$i]'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$general = MYDB_fetch_array($result);
$special2 = getSpecial2($connect, $general['leader'], $general['power'], $general['intel']); foreach($db->query("SELECT `no`,leader,power,intel,dex0,dex10,dex20,dex30,dex40 FROM general WHERE `no` IN %li", $genlist) as $general){
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($general['no']), $text, new DateTime(), new DateTime('9999-12-31'), []);
$msg->send(true);
$query = "update general set specage2=age,special2='$special2' where no='{$general['no']}'"; $specialWar = SpecialityConst::pickSpecialWar($general);
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $db->update('general', [
'specage2'=>$db->sqleval('age'),
$log[0] = "<C>●</>특기 【<b><L>".getGenSpecial($special2)."</></b>】(을)를 익혔습니다!"; 'special2'=>$specialWar
addHistory($general, "<C>●</>{$admin['year']}{$admin['month']}월:특기 【<b><C>".getGenSpecial($special2)."</></b>】(을)를 습득"); ], 'no=%i', $general['no']);
pushGenLog($general, $log); $specialWarName = SpecialityConst::WAR[$specialWar][0];
pushGeneralHistory($general, "<C>●</>{$year}{$month}월:특기 【<b><C>{$specialWarName}</></b>】(을)를 습득");
pushGenLog($general, ["<C>●</>특기 【<b><L>{$specialWarName}</></b>】(을)를 익혔습니다!"]);
} }
break; break;
case "경험치1000": case "경험치1000":
for($i=0; $i < sizeof($genlist); $i++) { $src = MessageTarget::buildQuick($session->generalID);
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]); $text = $btn." 지급!";
$msg = $btn." 지급!"; foreach($genlist as $generalID){
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg); $msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
} $msg->send(true);
for($i=0; $i < sizeof($genlist); $i++) {
$query = "update general set experience=experience+1000 where no='$genlist[$i]'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
$db->update('general',[
'experience'=>$db->sqleval('experience+1000')
], '`no` IN %li', $genlist);
break; break;
case "공헌치1000": case "공헌치1000":
for($i=0; $i < sizeof($genlist); $i++) { $src = MessageTarget::buildQuick($session->generalID);
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]); $text = $btn." 지급!";
$msg = $btn." 지급!"; foreach($genlist as $generalID){
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg); $msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
} $msg->send(true);
for($i=0; $i < sizeof($genlist); $i++) {
$query = "update general set dedication=dedication+1000 where no='$genlist[$i]'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
$db->update('general',[
'dedication'=>$db->sqleval('dedication+1000')
], '`no` IN %li', $genlist);
break; break;
case "보숙10000": case "보숙10000":
for($i=0; $i < sizeof($genlist); $i++) { $src = MessageTarget::buildQuick($session->generalID);
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]); $text = "보병숙련도+10000 지급!";
$msg = "보병숙련도+10000 지급!"; foreach($genlist as $generalID){
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg); $msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
} $msg->send(true);
for($i=0; $i < sizeof($genlist); $i++) {
$query = "update general set dex0=dex0+10000 where no='$genlist[$i]'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
$db->update('general',[
'dex0'=>$db->sqleval('dex0+10000')
], '`no` IN %li', $genlist);
break; break;
case "궁숙10000": case "궁숙10000":
for($i=0; $i < sizeof($genlist); $i++) { $src = MessageTarget::buildQuick($session->generalID);
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]); $text = "궁병숙련도+10000 지급!";
$msg = "궁병숙련도+10000 지급!"; foreach($genlist as $generalID){
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg); $msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
} $msg->send(true);
for($i=0; $i < sizeof($genlist); $i++) {
$query = "update general set dex10=dex10+10000 where no='$genlist[$i]'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
$db->update('general',[
'dex10'=>$db->sqleval('dex10+10000')
], '`no` IN %li', $genlist);
break; break;
case "기숙10000": case "기숙10000":
for($i=0; $i < sizeof($genlist); $i++) { $src = MessageTarget::buildQuick($session->generalID);
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]); $text = "기병숙련도+10000 지급!";
$msg = "기병숙련도+10000 지급!"; foreach($genlist as $generalID){
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg); $msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
} $msg->send(true);
for($i=0; $i < sizeof($genlist); $i++) {
$query = "update general set dex20=dex20+10000 where no='$genlist[$i]'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
$db->update('general',[
'dex20'=>$db->sqleval('dex20+10000')
], '`no` IN %li', $genlist);
break; break;
case "귀숙10000": case "귀숙10000":
for($i=0; $i < sizeof($genlist); $i++) { $src = MessageTarget::buildQuick($session->generalID);
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]); $text = "귀병숙련도+10000 지급!";
$msg = "귀병숙련도+10000 지급!"; foreach($genlist as $generalID){
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg); $msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
} $msg->send(true);
for($i=0; $i < sizeof($genlist); $i++) {
$query = "update general set dex30=dex30+10000 where no='$genlist[$i]'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
$db->update('general',[
'dex30'=>$db->sqleval('dex30+10000')
], '`no` IN %li', $genlist);
break; break;
case "차숙10000": case "차숙10000":
for($i=0; $i < sizeof($genlist); $i++) { $src = MessageTarget::buildQuick($session->generalID);
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]); $text = "차병숙련도+10000 지급!";
$msg = "차병숙련도+10000 지급!"; foreach($genlist as $generalID){
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg); $msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
} $msg->send(true);
for($i=0; $i < sizeof($genlist); $i++) {
$query = "update general set dex40=dex40+10000 where no='$genlist[$i]'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
$db->update('general',[
'dex40'=>$db->sqleval('dex40+10000')
], '`no` IN %li', $genlist);
break; break;
case "접속 허용": case "접속 허용":
for($i=0; $i < sizeof($genlist); $i++) { $db->update('genera',[
$query = "update general set con=0 where no='$genlist[$i]'"; 'con'=>0
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); ], '`no` IN %li', $genlist);
}
break; break;
case "접속 제한": case "접속 제한":
for($i=0; $i < sizeof($genlist); $i++) { $db->update('genera',[
$query = "update general set con=1000 where no='$genlist[$i]'"; 'con'=>1000
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); ], '`no` IN %li', $genlist);
}
break; break;
case "메세지 전달": case "메세지 전달":
//TODO:새 갠메 시스템으로 변경 $text = $msg;
$date = date('Y-m-d H:i:s'); foreach($genlist as $generalID){
for($i=0; $i < sizeof($genlist); $i++) { $msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]); $msg->send(true);
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
} }
break; break;
case "무기지급": case "무기지급":
$date = date('Y-m-d H:i:s');
for($i=0; $i < sizeof($genlist); $i++) { if($weap == 0) {
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]); $text = "무기 회수!";
if($weap == 0) { $msg = "무기 회수!"; }
else { $msg = getWeapName($weap)." 지급!"; }
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
} }
for($i=0; $i < sizeof($genlist); $i++) { else {
if($weap == 0) { $text = getWeapName($weap)." 지급!";
$query = "update general set weap='0' where no='$genlist[$i]'"; }
} else {
$query = "update general set weap='$weap' where no='$genlist[$i]' and weap<'$weap'"; foreach($genlist as $generalID){
} $msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $msg->send(true);
}
if($weap == 0){
$db->update('general', [
'weap'=>0
], '`no` IN %li', $genlist);
}
else{
$db->update('general', [
'weap'=>$weap
], '`no` IN %li AND weap < %i', $genlist, $weap);
} }
break; break;
case "책지급": case "책지급":
$date = date('Y-m-d H:i:s'); if($weap == 0) {
for($i=0; $i < sizeof($genlist); $i++) { $text = "책 회수!";
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
if($weap == 0) { $msg = "서적 회수!"; }
else { $msg = getBookName($weap)." 지급!"; }
// 상대에게 발송
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
} }
for($i=0; $i < sizeof($genlist); $i++) { else {
if($weap == 0) { $text = getBookName($weap)." 지급!";
$query = "update general set book='0' where no='$genlist[$i]'"; }
} else {
$query = "update general set book='$weap' where no='$genlist[$i]' and book<'$weap'"; foreach($genlist as $generalID){
} $msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $msg->send(true);
}
if($weap == 0){
$db->update('general', [
'book'=>0
], '`no` IN %li', $genlist);
}
else{
$db->update('general', [
'book'=>$weap
], '`no` IN %li AND book < %i', $genlist, $weap);
} }
break; break;
case "말지급": case "말지급":
$date = date('Y-m-d H:i:s'); if($weap == 0) {
for($i=0; $i < sizeof($genlist); $i++) { $text = "말 회수!";
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
if($weap == 0) { $msg = "말 회수!"; }
else { $msg = getHorseName($weap)." 지급!"; }
// 상대에게 발송
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
} }
for($i=0; $i < sizeof($genlist); $i++) { else {
if($weap == 0) { $text = getHorseName($weap)." 지급!";
$query = "update general set horse='0' where no='$genlist[$i]'"; }
} else {
$query = "update general set horse='$weap' where no='$genlist[$i]' and horse<'$weap'"; foreach($genlist as $generalID){
} $msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $msg->send(true);
}
if($weap == 0){
$db->update('general', [
'horse'=>0
], '`no` IN %li', $genlist);
}
else{
$db->update('general', [
'horse'=>$weap
], '`no` IN %li AND horse < %i', $genlist, $weap);
} }
break; break;
case "도구지급": case "도구지급":
$date = date('Y-m-d H:i:s'); if($weap == 0) {
for($i=0; $i < sizeof($genlist); $i++) { $text = "특수도구 회수!";
$you = DB::db()->queryFirstRow('select `no`, `nation` from `general` where `no` = %i', $genlist[$i]);
if($weap == 0) { $msg = "특수도구 회수!"; }
else { $msg = getItemName($weap)." 지급!"; }
// 상대에게 발송
sendMessage('private', ['id'=>$generalID, 'nation_id'=>0], ['id'=>$you['no'], 'nation_id'=>$you['nation']], $msg);
} }
for($i=0; $i < sizeof($genlist); $i++) { else {
if($weap == 0) { $text = getItemName($weap)." 지급!";
$query = "update general set item='0' where no='$genlist[$i]'"; }
} else {
$query = "update general set item='$weap' where no='$genlist[$i]' and item<'$weap'"; foreach($genlist as $generalID){
} $msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new DateTime(), new DateTime('9999-12-31'), []);
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $msg->send(true);
}
if($weap == 0){
$db->update('general', [
'item'=>0
], '`no` IN %li', $genlist);
}
else{
$db->update('general', [
'item'=>$weap
], '`no` IN %li AND item < %i', $genlist, $weap);
} }
break; break;
case "NPC해제": case "NPC해제":
for($i=0; $i < sizeof($genlist); $i++) { $db->update('general', [
$query = "update general set npc=1 where no='$genlist[$i]'"; 'npc'=>1
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); ], '`no` IN %li', $genlist);
}
break; break;
case "하야입력": case "하야입력":
for($i=0; $i < sizeof($genlist); $i++) { $db->update('general', [
$query = "update general set turn0='00000000000045' where no='$genlist[$i]'"; 'turn0'=>'00000000000045'
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); ], '`no` IN %li', $genlist);
}
break; break;
case "방랑해산": case "방랑해산":
for($i=0; $i < sizeof($genlist); $i++) { $db->update('general', [
$query = "update general set turn0='00000000000047',turn1='00000000000056' where no='$genlist[$i]'"; 'turn0'=>'00000000000047',
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); 'turn1'=>'00000000000056'
} ], '`no` IN %li', $genlist);
break; break;
case "NPC설정": case "NPC설정":
for($i=0; $i < sizeof($genlist); $i++) { $db->update('general', [
$query = "update general set npc=2 where no='$genlist[$i]'"; 'npc'=>2
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); ], '`no` IN %li', $genlist);
}
break; break;
case "00턴": case "00턴":
$query = "select turnterm from game limit 1"; $turnterm = $db->queryFirstField('SELECT turnterm FROM game LIMIT 1');
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result);
for($i=0; $i < sizeof($genlist); $i++) { foreach($genlist as $generalID){
$turntime = getRandTurn($admin['turnterm']); $turntime = getRandTurn($turnterm);
$cutTurn = cutTurn($turntime, $admin['turnterm']); $cutTurn = cutTurn($turntime, $turnterm);
$query = "update general set turntime='$cutTurn' where no='$genlist[$i]'"; $db->update('general', [
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); 'turntime'=>$curTurn
], '`no` IN %li', $genlist);
} }
break; break;
case "랜덤턴": case "랜덤턴":
$query = "select turnterm from game limit 1"; foreach($genlist as $generalID){
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $turntime = getRandTurn($turnterm);
$admin = MYDB_fetch_array($result); $db->update('general', [
'turntime'=>$turntime
for($i=0; $i < sizeof($genlist); $i++) { ], '`no` IN %li', $genlist);
$turntime = getRandTurn($admin['turnterm']);
$query = "update general set turntime='$turntime' where no='$genlist[$i]'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
break; break;
} }
//echo "<script>location.replace('_admin2.php');</script>"; header('location:_admin2.php');
echo '_admin2.php';//TODO:debug all and replace
+11 -12
View File
@@ -4,16 +4,16 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn();
if(Session::getUserGrade() < 5) { if($session->userGrade < 5) {
echo "<!DOCTYPE html> echo "<!DOCTYPE html>
<html> <html>
<head> <head>
<title>관리메뉴</title> <title>관리메뉴</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
<body> <body>
관리자가 아닙니다.<br> 관리자가 아닙니다.<br>
@@ -26,6 +26,9 @@ if(Session::getUserGrade() < 5) {
exit(); exit();
} }
$db = DB::db();
$connect=$db->get();
$query = "select conlimit from game limit 1"; $query = "select conlimit from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
@@ -35,7 +38,8 @@ $admin = MYDB_fetch_array($result);
<head> <head>
<title>멀티관리</title> <title>멀티관리</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
<body> <body>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
@@ -92,7 +96,6 @@ echo "
<td align=center width=180>최근로그인</td> <td align=center width=180>최근로그인</td>
<td align=center width=129>IP</td> <td align=center width=129>IP</td>
<td align=center width=100>ID</td> <td align=center width=100>ID</td>
<td align=center width=278>-</td>
</tr> </tr>
<tr> <tr>
<?php <?php
@@ -103,11 +106,10 @@ $genName = "";
$genDate = ""; $genDate = "";
$genIP = ""; $genIP = "";
$genID = ""; $genID = "";
$conMsg = "";
for($i=0; $i < $ipCount; $i++) { for($i=0; $i < $ipCount; $i++) {
$ip = MYDB_fetch_array($result); $ip = MYDB_fetch_array($result);
$query = "select name,ip,lastconnect,owner,block,conmsg from general where ip like '{$ip['ip2']}%' and npc<2 order by ip"; $query = "select name,ip,lastconnect,owner,block from general where ip like '{$ip['ip2']}%' and npc<2 order by ip";
$genResult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $genResult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$genCount = MYDB_num_rows($genResult); $genCount = MYDB_num_rows($genResult);
for($k=0; $k < $genCount; $k++) { for($k=0; $k < $genCount; $k++) {
@@ -117,20 +119,17 @@ for($i=0; $i < $ipCount; $i++) {
$genDate .= $gen['lastconnect']."<br>"; $genDate .= $gen['lastconnect']."<br>";
$genIP .= $gen['ip']."<br>"; $genIP .= $gen['ip']."<br>";
$genID .= $gen['owner']."<br>"; $genID .= $gen['owner']."<br>";
$conMsg .= $gen['conmsg']."<br>";
} }
$genName .= "<br>"; $genName .= "<br>";
$genDate .= "<br>"; $genDate .= "<br>";
$genIP .= "<br>"; $genIP .= "<br>";
$genID .= "<br>"; $genID .= "<br>";
$conMsg .= "<br>";
} }
echo " echo "
<td align=right>$genName</td> <td align=right>$genName</td>
<td>$genDate</td> <td>$genDate</td>
<td>$genIP</td> <td>$genIP</td>
<td>$genID</td> <td>$genID</td>";
<td>$conMsg</td>";
?> ?>
</tr> </tr>
</table> </table>
+17 -12
View File
@@ -4,14 +4,21 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn();
if(Session::getUserGrade() < 5) { if($session->userGrade < 5) {
//echo "<script>location.replace('_admin4.php');</script>"; header('location:_admin4.php');
echo '_admin4.php';//TODO:debug all and replace die();
} }
$btn = Util::getReq('btn');
$genlist = Util::getReq('genlist', 'array_int');
extractMissingPostToGlobals();
$db = DB::db();
$connect=$db->get();
//NOTE: 왜 기능이 admin2와 admin4가 같이 있는가? //NOTE: 왜 기능이 admin2와 admin4가 같이 있는가?
//NOTE: 왜 블럭 시 admin4에선 금쌀을 없애지 않는가? //NOTE: 왜 블럭 시 admin4에선 금쌀을 없애지 않는가?
switch($btn) { switch($btn) {
@@ -24,21 +31,21 @@ switch($btn) {
$db->query('update general set block=1,killturn=24 where no IN %li',$genlist); $db->query('update general set block=1,killturn=24 where no IN %li',$genlist);
//FIXME: subquery로 하는게 더 빠를 듯. //FIXME: subquery로 하는게 더 빠를 듯.
$uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist); $uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist);
RootDB::db()->query('update MEMBER set block_num=block_num+1,block_date=%s where id IN %ls', $date, $uid); RootDB::db()->query('update member set block_num=block_num+1,block_date=%s where id IN %ls', $date, $uid);
break; break;
case "2단계 블럭": case "2단계 블럭":
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
$db = DB::db(); $db = DB::db();
$db->query('update general set block=2,killturn=24 where no IN %li',$genlist); $db->query('update general set block=2,killturn=24 where no IN %li',$genlist);
$uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist); $uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist);
RootDB::db()->query('update MEMBER set block_num=block_num+1,block_date=%s where id IN %ls', $date, $uid); RootDB::db()->query('update member set block_num=block_num+1,block_date=%s where id IN %ls', $date, $uid);
break; break;
case "3단계 블럭": case "3단계 블럭":
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
$db = DB::db(); $db = DB::db();
$db->query('update general set block=3,killturn=24 where no IN %li',$genlist); $db->query('update general set block=3,killturn=24 where no IN %li',$genlist);
$uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist); $uid = $db->queryFirstColumn('select owner from general where no IN %li', $genlist);
RootDB::db()->query('update MEMBER set block_num=block_num+1,block_date=%s where id IN %ls', $date, $uid); RootDB::db()->query('update member set block_num=block_num+1,block_date=%s where id IN %ls', $date, $uid);
break; break;
case "무한삭턴": case "무한삭턴":
DB::db()->query('update general set killturn=8000 where no IN %li',$genlist); DB::db()->query('update general set killturn=8000 where no IN %li',$genlist);
@@ -50,12 +57,10 @@ switch($btn) {
case "메세지 전달": case "메세지 전달":
//TODO:새 갠메 시스템으로 변경 //TODO:새 갠메 시스템으로 변경
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
$msg; for($i=0; $i < count($genlist); $i++) {
for($i=0; $i < sizeof($genlist); $i++) {
} }
break; break;
} }
//echo "<script>location.replace('_admin4.php');</script>"; header('location:_admin4.php');
echo '_admin4.php'; //TODO:debug all and replace
+53 -40
View File
@@ -3,17 +3,30 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
//로그인 검사
CheckLogin();
$connect = dbConn();
if(Session::getUserGrade() < 5) { $type = Util::getReq('type', 'int', 0);
$type2 = Util::getReq('type2', 'int', 0);
if($type < 0 || $type > 17){
$type = 0;
}
if($type2 < 0 || $type2 > 6){
$type2 = 0;
}
extractMissingPostToGlobals();
//로그인 검사
$session = Session::requireGameLogin()->setReadOnly();
if($session->userGrade < 5) {
echo "<!DOCTYPE html> echo "<!DOCTYPE html>
<html> <html>
<head> <head>
<title>관리메뉴</title> <title>관리메뉴</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
<body> <body>
관리자가 아닙니다.<br> 관리자가 아닙니다.<br>
@@ -26,12 +39,11 @@ if(Session::getUserGrade() < 5) {
exit(); exit();
} }
if($type == 0) { $db = DB::db();
$type = 0; $connect=$db->get();
}
if($type2 == 0) { $sel = [];
$type2 = 0; $sel2 = [];
}
$sel[$type] = "selected"; $sel[$type] = "selected";
$sel2[$type2] = "selected"; $sel2[$type2] = "selected";
@@ -44,7 +56,8 @@ $admin = MYDB_fetch_array($result);
<head> <head>
<title>일제정보</title> <title>일제정보</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
<body> <body>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
@@ -52,33 +65,33 @@ $admin = MYDB_fetch_array($result);
<tr><td> <tr><td>
<form name=form1 method=post>정렬순서 : <form name=form1 method=post>정렬순서 :
<select name=type size=1> <select name=type size=1>
<option <?=$sel[0];?> value=0>국력</option> <option <?=$sel[0]??''?> value=0>국력</option>
<option <?=$sel[1];?> value=1>장수</option> <option <?=$sel[1]??''?> value=1>장수</option>
<option <?=$sel[2];?> value=2>기술</option> <option <?=$sel[2]??''?> value=2>기술</option>
<option <?=$sel[3];?> value=3>국고</option> <option <?=$sel[3]??''?> value=3>국고</option>
<option <?=$sel[4];?> value=4>병량</option> <option <?=$sel[4]??''?> value=4>병량</option>
<option <?=$sel[5];?> value=5>평금</option> <option <?=$sel[5]??''?> value=5>평금</option>
<option <?=$sel[6];?> value=6>평쌀</option> <option <?=$sel[6]??''?> value=6>평쌀</option>
<option <?=$sel[7];?> value=7>평통</option> <option <?=$sel[7]??''?> value=7>평통</option>
<option <?=$sel[8];?> value=8>평무</option> <option <?=$sel[8]??''?> value=8>평무</option>
<option <?=$sel[9];?> value=9>평지</option> <option <?=$sel[9]??''?> value=9>평지</option>
<option <?=$sel[10];?> value=10>평Lv</option> <option <?=$sel[10]??''?> value=10>평Lv</option>
<option <?=$sel[11];?> value=11>접속률</option> <option <?=$sel[11]??''?> value=11>접속률</option>
<option <?=$sel[12];?> value=12>단기접</option> <option <?=$sel[12]??''?> value=12>단기접</option>
<option <?=$sel[13];?> value=13>보숙</option> <option <?=$sel[13]??''?> value=13>보숙</option>
<option <?=$sel[14];?> value=14>궁숙</option> <option <?=$sel[14]??''?> value=14>궁숙</option>
<option <?=$sel[15];?> value=15>기숙</option> <option <?=$sel[15]??''?> value=15>기숙</option>
<option <?=$sel[16];?> value=16>귀숙</option> <option <?=$sel[16]??''?> value=16>귀숙</option>
<option <?=$sel[17];?> value=17>차숙</option> <option <?=$sel[17]??''?> value=17>차숙</option>
</select> </select>
<select name=type2 size=1> <select name=type2 size=1>
<option <?=$sel2[0];?> value=0>국력</option> <option <?=$sel2[0]??''?> value=0>국력</option>
<option <?=$sel2[1];?> value=1>국가별성향</option> <option <?=$sel2[1]??''?> value=1>국가별성향</option>
<option <?=$sel2[2];?> value=2>국가성향</option> <option <?=$sel2[2]??''?> value=2>국가성향</option>
<option <?=$sel2[3];?> value=3>장수성격</option> <option <?=$sel2[3]??''?> value=3>장수성격</option>
<option <?=$sel2[4];?> value=4>장수특기</option> <option <?=$sel2[4]??''?> value=4>장수특기</option>
<option <?=$sel2[5];?> value=5>병종수</option> <option <?=$sel2[5]??''?> value=5>병종수</option>
<option <?=$sel2[6];?> value=6>기타</option> <option <?=$sel2[6]??''?> value=6>기타</option>
</select> </select>
<input type=submit value='정렬하기'> <input type=submit value='정렬하기'>
</form> </form>
@@ -145,7 +158,7 @@ SELECT
A.chemi, A.chemi,
A.color, A.color,
A.tech, A.tech,
A.tricklimit, A.sabotagelimit,
A.gold, A.gold,
A.rice, A.rice,
COUNT(B.nation) AS gennum, COUNT(B.nation) AS gennum,
@@ -220,7 +233,7 @@ for($i=0; $i < $nationCount; $i++) {
<td align=center>&nbsp;{$gen['cnt']}&nbsp;</td> <td align=center>&nbsp;{$gen['cnt']}&nbsp;</td>
<td align=center>&nbsp;{$city['cnt']}&nbsp;</td> <td align=center>&nbsp;{$city['cnt']}&nbsp;</td>
<td align=center>&nbsp;{$nation['tech']}&nbsp;</td> <td align=center>&nbsp;{$nation['tech']}&nbsp;</td>
<td align=center>&nbsp;{$nation['tricklimit']}&nbsp;</td> <td align=center>&nbsp;{$nation['sabotagelimit']}&nbsp;</td>
<td align=center>&nbsp;{$nation['gold']}&nbsp;</td> <td align=center>&nbsp;{$nation['gold']}&nbsp;</td>
<td align=center>&nbsp;{$nation['rice']}&nbsp;</td> <td align=center>&nbsp;{$nation['rice']}&nbsp;</td>
<td align=center>&nbsp;{$gen['avgg']}&nbsp;</td> <td align=center>&nbsp;{$gen['avgg']}&nbsp;</td>
@@ -250,7 +263,7 @@ for($i=0; $i < $nationCount; $i++) {
?> ?>
</table> </table>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr><td><?php TrickLog(20); ?></td></tr> <tr><td><?=getSabotageLogRecent(20)?></td></tr>
</table> </table>
<table align=center width=1760 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px; id=bg0> <table align=center width=1760 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px; id=bg0>
+24 -12
View File
@@ -3,28 +3,40 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
//로그인 검사
CheckLogin();
$connect = dbConn();
if(Session::getUserGrade() < 5) { $btn = Util::getReq('btn');
//echo "<script>location.replace('_admin5.php');</script>"; $nation = Util::getReq('nation', 'int');
echo '_admin5.php';//TODO:debug all and replace
extractMissingPostToGlobals();
//로그인 검사
$session = Session::requireGameLogin()->setReadOnly();
$userID = Session::getUserID();
if($session->userGrade < 5) {
header('location:_admin5.php');
die();
} }
$db = DB::db();
$connect=$db->get();
switch($btn) { switch($btn) {
case "국가변경": case "국가변경":
if($nation == 0) { if($nation == 0) {
$query = "update general set nation=0,level=0 where owner='{$_SESSION['userID']}'"; $db->update('general', [
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); 'nation'=>0,
'level'=>0,
], 'owner=%i', $userID);
} else { } else {
$query = "update general set nation='{$nation}',level=1 where owner='{$_SESSION['userID']}'"; $db->update('general', [
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); 'nation'=>$nation,
'level'=>1,
], 'owner=%i', $userID);
} }
break; break;
} }
//echo "<script>location.replace('_admin5.php');</script>"; header('location:_admin5.php');
echo '_admin5.php';//TODO:debug all and replace
+22 -14
View File
@@ -3,17 +3,24 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
//로그인 검사
CheckLogin();
$connect = dbConn();
if(Session::getUserGrade() < 5) { $type = Util::getReq('type', 'int', 0);
if($type < 0 || $type > 4){
$type = 0;
}
extractMissingPostToGlobals();
//로그인 검사
$session = Session::requireGameLogin()->setReadOnly();
if($session->userGrade < 5) {
echo "<!DOCTYPE html> echo "<!DOCTYPE html>
<html> <html>
<head> <head>
<title>관리메뉴</title> <title>관리메뉴</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
<body> <body>
관리자가 아닙니다.<br> 관리자가 아닙니다.<br>
@@ -26,9 +33,9 @@ if(Session::getUserGrade() < 5) {
exit(); exit();
} }
if($type == 0) { $db = DB::db();
$type = 0; $connect=$db->get();
}
$sel[$type] = "selected"; $sel[$type] = "selected";
?> ?>
@@ -37,18 +44,19 @@ $sel[$type] = "selected";
<head> <head>
<title>접속정보</title> <title>접속정보</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
<body> <body>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr><td>접 속 정 보<br><?=closeButton()?></td></tr> <tr><td>접 속 정 보<br><?=closeButton()?></td></tr>
<tr><td><form name=form1 method=post>정렬순서 : <tr><td><form name=form1 method=post>정렬순서 :
<select name=type size=1> <select name=type size=1>
<option <?=$sel[0];?> value=0>접속률</option> <option <?=$sel[0]??''?> value=0>접속률</option>
<option <?=$sel[1];?> value=1>총갱신</option> <option <?=$sel[1]??''?> value=1>총갱신</option>
<option <?=$sel[2];?> value=2>갱신/턴</option> <option <?=$sel[2]??''?> value=2>갱신/턴</option>
<option <?=$sel[3];?> value=3>총로그인</option> <option <?=$sel[3]??''?> value=3>총로그인</option>
<option <?=$sel[4];?> value=4>갱신/로그인</option> <option <?=$sel[4]??''?> value=4>갱신/로그인</option>
</select> </select>
<input type=submit value='정렬하기'></form> <input type=submit value='정렬하기'></form>
</td></tr> </td></tr>
+30 -18
View File
@@ -3,17 +3,28 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
//로그인 검사
CheckLogin();
$connect = dbConn();
if(Session::getUserGrade() < 5) { $btn = Util::getReq('btn');
$gen = Util::getReq('gen', 'int', 0);
$type = Util::getReq('type', 'int', 0);
if($type < 0 || $type > 3){
$type = 0;
}
extractMissingPostToGlobals();
//로그인 검사
$session = Session::requireGameLogin()->setReadOnly();
if($session->userGrade < 5) {
echo "<!DOCTYPE html> echo "<!DOCTYPE html>
<html> <html>
<head> <head>
<title>관리메뉴</title> <title>관리메뉴</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
<body> <body>
관리자가 아닙니다.<br> 관리자가 아닙니다.<br>
@@ -26,13 +37,13 @@ if(Session::getUserGrade() < 5) {
exit(); exit();
} }
$db = DB::db();
$connect=$db->get();
if($btn == '정렬하기') { if($btn == '정렬하기') {
$gen = 0; $gen = 0;
} }
if($type == 0) {
$type = 0;
}
$sel[$type] = "selected"; $sel[$type] = "selected";
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
@@ -40,7 +51,8 @@ $sel[$type] = "selected";
<head> <head>
<title>로그정보</title> <title>로그정보</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
<body> <body>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
@@ -49,10 +61,10 @@ $sel[$type] = "selected";
<form name=form1 method=post> <form name=form1 method=post>
정렬순서 : 정렬순서 :
<select name=type size=1> <select name=type size=1>
<option <?=$sel[0];?> value=0>최근턴</option> <option <?=$sel[0]??''?> value=0>최근턴</option>
<option <?=$sel[1];?> value=1>최근전투</option> <option <?=$sel[1]??''?> value=1>최근전투</option>
<option <?=$sel[2];?> value=2>장수명</option> <option <?=$sel[2]??''?> value=2>장수명</option>
<option <?=$sel[3];?> value=3>전투수</option> <option <?=$sel[3]??''?> value=3>전투수</option>
</select> </select>
<input type=submit name=btn value='정렬하기'> <input type=submit name=btn value='정렬하기'>
대상장수 : 대상장수 :
@@ -94,7 +106,7 @@ for($i=0; $i < $gencount; $i++) {
</tr> </tr>
<tr> <tr>
<td valign=top> <td valign=top>
<?php generalInfo($connect, $gen); generalInfo2($connect, $gen); ?> <?php generalInfo($gen); generalInfo2($gen); ?>
</td> </td>
<td valign=top>&nbsp; <td valign=top>&nbsp;
</td> </td>
@@ -105,10 +117,10 @@ for($i=0; $i < $gencount; $i++) {
</tr> </tr>
<tr> <tr>
<td valign=top> <td valign=top>
<?php MyLog($gen, 24); ?> <?=getGenLogRecent($gen, 24)?>
</td> </td>
<td valign=top> <td valign=top>
<?php MyBatLog($gen, 24); ?> <?=getBatLogRecent($gen, 24)?>
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -117,10 +129,10 @@ for($i=0; $i < $gencount; $i++) {
</tr> </tr>
<tr> <tr>
<td valign=top> <td valign=top>
<?php MyHistory($connect, $gen); ?> <?=getGeneralHistoryAll($gen)?>
</td> </td>
<td valign=top> <td valign=top>
<?php MyBatRes($gen, 24); ?> <?=getBatResRecent($gen, 24)?>
</td> </td>
</tr> </tr>
</table> </table>
+41 -29
View File
@@ -3,17 +3,24 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
//로그인 검사
CheckLogin();
$connect = dbConn();
if(Session::getUserGrade() < 5) { $btn = Util::getReq('btn');
$gen = Util::getReq('gen', 'int', 0);
$type = 0;
extractMissingPostToGlobals();
//로그인 검사
$session = Session::requireGameLogin()->setReadOnly();
if ($session->userGrade < 5) {
echo "<!DOCTYPE html> echo "<!DOCTYPE html>
<html> <html>
<head> <head>
<title>관리메뉴</title> <title>관리메뉴</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
<body> <body>
관리자가 아닙니다.<br> 관리자가 아닙니다.<br>
@@ -26,13 +33,13 @@ if(Session::getUserGrade() < 5) {
exit(); exit();
} }
if($btn == '정렬하기') { $db = DB::db();
$connect=$db->get();
if ($btn == '정렬하기') {
$gen = 0; $gen = 0;
} }
if($type == 0) {
$type = 0;
}
$sel[$type] = "selected"; $sel[$type] = "selected";
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
@@ -40,7 +47,8 @@ $sel[$type] = "selected";
<head> <head>
<title>외교정보</title> <title>외교정보</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
<body> <body>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
@@ -49,7 +57,7 @@ $sel[$type] = "selected";
<form name=form1 method=post> <form name=form1 method=post>
정렬순서 : 정렬순서 :
<select name=type size=1> <select name=type size=1>
<option <?=$sel[0];?> value=0>상태</option> <option <?=$sel[0]??''?> value=0>상태</option>
</select> </select>
<input type=submit name=btn value='정렬하기'> <input type=submit name=btn value='정렬하기'>
</form> </form>
@@ -66,31 +74,33 @@ $sel[$type] = "selected";
</tr> </tr>
<?php <?php
foreach(getAllNationStaticInfo() as $nation){ $nationName = [];
$nationColor = [];
foreach (getAllNationStaticInfo() as $nation) {
$nationName[$nation['nation']] = $nation['name']; $nationName[$nation['nation']] = $nation['name'];
$nationColor[$nation['nation']] = $nation['color']; $nationColor[$nation['nation']] = $nation['color'];
} }
switch($type) {
case 0: $query = "select * from diplomacy where me < you order by state desc"; break; $query = "select * from diplomacy where me < you order by state desc";
}
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$dipcount = MYDB_num_rows($result); $dipcount = MYDB_num_rows($result);
for($i=0; $i < $dipcount; $i++) { for ($i=0; $i < $dipcount; $i++) {
$dip = MYDB_fetch_array($result); $dip = MYDB_fetch_array($result);
$me = $dip['me']; $me = $dip['me'];
$you = $dip['you']; $you = $dip['you'];
$query = "select reserved,showing from diplomacy where you='$me' and me='$you'"; $query = "select reserved,showing from diplomacy where you='$me' and me='$you'";
$result2 = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result2 = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$dip2 = MYDB_fetch_array($result2); $dip2 = MYDB_fetch_array($result2);
if($dip['state'] == 2 && $dip['fixed'] == "" && $dip['reserved'] == "" && $dip2['reserved'] == "") { if ($dip['state'] == 2 && $dip['fixed'] == "" && $dip['reserved'] == "" && $dip2['reserved'] == "") {
continue; continue;
} }
switch($dip['state']) { switch ($dip['state']) {
case 0: $state = "<font color=red>교 전</font>"; break; case 0: $state = "<font color=red>교 전</font>"; break;
case 1: $state = "<font color=magenta>선포중</font>"; break; case 1: $state = "<font color=magenta>선포중</font>"; break;
case 2: $state = "통 상"; break; case 2: $state = "통 상"; break;
@@ -103,34 +113,36 @@ for($i=0; $i < $dipcount; $i++) {
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
$note = ""; $note = "";
if($dip['fixed'] != "") { if ($dip['fixed'] != "") {
if($dip['state'] == 7) { if ($dip['state'] == 7) {
$note .= $dip['fixed']; $note .= $dip['fixed'];
} else { } else {
$note .= "<font color=gray>{$dip['fixed']}</font>"; $note .= "<font color=gray>{$dip['fixed']}</font>";
} }
if($dip['reserved'] != "" || $dip2['reserved'] != "") { if ($dip['reserved'] != "" || $dip2['reserved'] != "") {
$note .= "<br>"; $note .= "<br>";
} }
} }
if($dip['reserved'] != "") { if ($dip['reserved'] != "") {
if($dip['showing'] >= $date) { if ($dip['showing'] >= $date) {
$note .= "<font color=skyblue>아국측 제의</font>: {$dip['reserved']}"; $note .= "<font color=skyblue>아국측 제의</font>: {$dip['reserved']}";
} else { } else {
$note .= "<font color=gray>아국측 제의: {$dip['reserved']}</font>"; $note .= "<font color=gray>아국측 제의: {$dip['reserved']}</font>";
} }
if($dip2['reserved'] != "") { if ($dip2['reserved'] != "") {
$note .= "<br>"; $note .= "<br>";
} }
} }
if($dip2['reserved'] != "") { if ($dip2['reserved'] != "") {
if($dip2['showing'] >= $date) { if ($dip2['showing'] >= $date) {
$note .= "<font color=limegreen>상대측 제의</font>: {$dip2['reserved']}"; $note .= "<font color=limegreen>상대측 제의</font>: {$dip2['reserved']}";
} else { } else {
$note .= "<font color=gray>상대측 제의: {$dip2['reserved']}</font>"; $note .= "<font color=gray>상대측 제의: {$dip2['reserved']}</font>";
} }
} }
if($note == "") { $note = "&nbsp;"; } if ($note == "") {
$note = "&nbsp;";
}
echo " echo "
<tr> <tr>
+420 -382
View File
@@ -4,18 +4,29 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
$session = Session::requireGameLogin()->setReadOnly();
$userID = Session::getUserID();
//로그인 검사 //로그인 검사
$isgen = Util::array_get($_POST['isgen'], ''); $isgen = Util::getReq('isgen');
$tech1 = Util::array_get($_POST['tech1'], 0);
$tech2 =Util::array_get($_POST['tech2'], 0); $leader1 = Util::getReq('leader1', 'int', 0);
$dex10 = Util::array_get($_POST['dex10'], 0); $power1 = Util::getReq('power1', 'int', 0);
$dex110 = Util::array_get($_POST['dex110'], 0); $intel1 = Util::getReq('intel1', 'int', 0);
$dex120 = Util::array_get($_POST['dex120'], 0); $type1 = Util::getReq('type1', 'int', 0);
$dex130 = Util::array_get($_POST['dex130'], 0); $crew1 = Util::getReq('crew1', 'int', 0);
$dex140 = Util::array_get($_POST['dex140'], 0); $train1 = Util::getReq('train1', 'int', 0);
$atmos1 = Util::getReq('atmos1', 'int', 0);
$level1 = Util::getReq('level1', 'int', 0);
$explevel1 = Util::getReq('explevel1', 'int', 0);
$tech1 = Util::getReq('tech1', 'int', 0);
$dex10 = Util::getReq('dex10', 'int', 0);
$dex110 = Util::getReq('dex110', 'int', 0);
$dex120 = Util::getReq('dex120', 'int', 0);
$dex130 = Util::getReq('dex130', 'int', 0);
$dex140 = Util::getReq('dex140', 'int', 0);
$dx10 = array_fill(0, 20, ''); $dx10 = array_fill(0, 20, '');
$dx110 = array_fill(0, 20, ''); $dx110 = array_fill(0, 20, '');
@@ -23,11 +34,22 @@ $dx120 = array_fill(0, 20, '');
$dx130 = array_fill(0, 20, ''); $dx130 = array_fill(0, 20, '');
$dx140 = array_fill(0, 20, ''); $dx140 = array_fill(0, 20, '');
$dex20 = Util::array_get($_POST['dex20'], 0); $leader2 = Util::getReq('leader2', 'int', 0);
$dex210 = Util::array_get($_POST['dex210'], 0); $power2 = Util::getReq('power2', 'int', 0);
$dex220 = Util::array_get($_POST['dex220'], 0); $intel2 = Util::getReq('intel2', 'int', 0);
$dex230 = Util::array_get($_POST['dex230'], 0); $type2 = Util::getReq('type2', 'int', 0);
$dex240 = Util::array_get($_POST['dex240'], 0); $crew2 = Util::getReq('crew2', 'int', 0);
$train2 = Util::getReq('train2', 'int', 0);
$atmos2 = Util::getReq('atmos2', 'int', 0);
$level2 = Util::getReq('level2', 'int', 0);
$explevel2 = Util::getReq('explevel2', 'int', 0);
$tech2 = Util::getReq('tech2', 'int', 0);
$dex20 = Util::getReq('dex20', 'int', 0);
$dex210 = Util::getReq('dex210', 'int', 0);
$dex220 = Util::getReq('dex220', 'int', 0);
$dex230 = Util::getReq('dex230', 'int', 0);
$dex240 = Util::getReq('dex240', 'int', 0);
$dx20 = array_fill(0, 20, ''); $dx20 = array_fill(0, 20, '');
$dx210 = array_fill(0, 20, ''); $dx210 = array_fill(0, 20, '');
@@ -35,6 +57,11 @@ $dx220 = array_fill(0, 20, '');
$dx230 = array_fill(0, 20, ''); $dx230 = array_fill(0, 20, '');
$dx240 = array_fill(0, 20, ''); $dx240 = array_fill(0, 20, '');
$def = Util::getReq('def', 'int', 0);
$wall = Util::getReq('wall', 'int', 0);
$atmos3 = Util::getReq('atmos3', 'int', 0);
$train3 = Util::getReq('train3', 'int', 0);
$sellevel1 = array_fill(0, 13, ''); $sellevel1 = array_fill(0, 13, '');
$sel1 = array_fill(0,44, ''); $sel1 = array_fill(0,44, '');
$tch1 = array_fill(0,11, ''); $tch1 = array_fill(0,11, '');
@@ -46,11 +73,11 @@ $tch2 = array_fill(0,11, '');
$dec = 0; $dec = 0;
$rice = 0; $rice = 0;
CheckLogin(); $db = DB::db();
$connect = dbConn(); $connect=$db->get();
increaseRefresh("시뮬", 2); increaseRefresh("시뮬", 2);
$query = "select no,tournament,con,turntime from general where owner='{$_SESSION['userID']}'"; $query = "select no,tournament,con,turntime from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
@@ -61,7 +88,7 @@ $game = MYDB_fetch_array($result);
$con = checkLimit($me['con'], $game['conlimit']); $con = checkLimit($me['con'], $game['conlimit']);
if($con >= 2) { printLimitMsg($me['turntime']); exit(); } if($con >= 2) { printLimitMsg($me['turntime']); exit(); }
if(Session::getUserGrade() < 3) { if($session->userGrade < 3) {
echo "특별회원이 아닙니다."; echo "특별회원이 아닙니다.";
exit(); exit();
} }
@@ -79,6 +106,18 @@ if($isgen == "장수평균" || $isgen == "성벽평균") {
$simulCount = 1; $simulCount = 1;
} }
$general = [
'no'=>1
];
$oppose = [
'no'=>2
];
$city = [
'gen1'=>0,
'gen2'=>0,
'gen3'=>0,
];
if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평균" || $isgen == "성벽평균") { if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평균" || $isgen == "성벽평균") {
$msg2 = ""; $msg2 = "";
for($i=0; $i < $simulCount; $i++) { for($i=0; $i < $simulCount; $i++) {
@@ -155,8 +194,8 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
$mykillnum = 0; $mydeathnum = 0; $mykillnum = 0; $mydeathnum = 0;
while($phase < $warphase) { while($phase < $warphase) {
$phase++; $phase++;
$myAtt = getAtt($game, $general, $tech1, 0); $myAtt = getAtt($general, $tech1, 0);
$myDef = getDef($game, $general, $tech1); $myDef = getDef($general, $tech1);
$cityAtt = getCityAtt($city); $cityAtt = getCityAtt($city);
$cityDef = getCityDef($city); $cityDef = getCityDef($city);
@@ -177,7 +216,7 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
$avoid = 1; $avoid = 1;
// 병종간 특성 // 병종간 특성
if(floor($general['crewtype']/10) == 3) { // 귀병 if(intdiv($general['crewtype'], 10) == 3) { // 귀병
$int = $general['intel'] + getBookEff($general['book']); $int = $general['intel'] + getBookEff($general['book']);
if($general['crewtype'] == 30) { if($general['crewtype'] == 30) {
$ratio2 = $int * 5; // 0~500 즉 50% $ratio2 = $int * 5; // 0~500 즉 50%
@@ -273,9 +312,9 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
$cityCrew *= (rand() % 21 + 90)/100; // 90~110% $cityCrew *= (rand() % 21 + 90)/100; // 90~110%
$myCrew *= (rand() % 21 + 90)/100; // 90~110% $myCrew *= (rand() % 21 + 90)/100; // 90~110%
$general['crew'] -= round($myCrew); $general['crew'] -= Util::round($myCrew);
$city['def'] -= round($cityCrew); $city['def'] -= Util::round($cityCrew);
$city['wall'] -= round($cityCrew); $city['wall'] -= Util::round($cityCrew);
$tempMyCrew = $myCrew; $tempCityCrew = $cityCrew; $tempMyCrew = $myCrew; $tempCityCrew = $cityCrew;
$tempGeneralCrew = $general['crew']; $tempCityDef = $city['def']; $tempGeneralCrew = $general['crew']; $tempCityDef = $city['def'];
@@ -283,14 +322,14 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
if($city['wall'] <= 0) { $city['wall'] = 0; } if($city['wall'] <= 0) { $city['wall'] = 0; }
if($city['def'] < 0) { if($city['def'] < 0) {
$offset = round($tempCityDef*$tempMyCrew/$tempCityCrew); $offset = Util::round($tempCityDef*$tempMyCrew/$tempCityCrew);
$myCrew += $offset; $myCrew += $offset;
$general['crew'] -= $offset; $general['crew'] -= $offset;
$cityCrew += $tempCityDef; $cityCrew += $tempCityDef;
$city['def'] = 0; $city['def'] = 0;
} }
if($general['crew'] < 0) { if($general['crew'] < 0) {
$offset = round($tempGeneralCrew*$tempCityCrew/$tempMyCrew); $offset = Util::round($tempGeneralCrew*$tempCityCrew/$tempMyCrew);
$cityCrew += $offset; $cityCrew += $offset;
$city['def'] -= $offset; $city['def'] -= $offset;
$myCrew += $tempGeneralCrew; $myCrew += $tempGeneralCrew;
@@ -299,9 +338,9 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
$exp += $cityCrew; $exp += $cityCrew;
$opexp += $myCrew; $opexp += $myCrew;
$general['crew'] = round($general['crew']); $general['crew'] = Util::round($general['crew']);
$cityCrew = round($cityCrew); $cityCrew = Util::round($cityCrew);
$myCrew = round($myCrew); $myCrew = Util::round($myCrew);
$myAtt = round($myAtt, 2); $myAtt = round($myAtt, 2);
$myDef = round($myDef, 2); $myDef = round($myDef, 2);
$cityAtt = round($cityAtt, 2); $cityAtt = round($cityAtt, 2);
@@ -315,14 +354,14 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
} }
// 도시쌀 소모 계산 // 도시쌀 소모 계산
$opexp = round($opexp / 50); $opexp = Util::round($opexp / 50);
$rice = round($opexp * 4 * getCrewtypeRice($game, 0, 0) * ($train3/100 - 0.2)); $rice = Util::round($opexp * 4 * getCrewtypeRice(0, 0) * ($train3/100 - 0.2));
//원래대로 스케일링 //원래대로 스케일링
$city['def'] = round($city['def'] / 10); $city['def'] = Util::round($city['def'] / 10);
$city['wall'] = round($city['wall'] / 10); $city['wall'] = Util::round($city['wall'] / 10);
//내정 감소 //내정 감소
$dec = round($cityCrew / 10); $dec = Util::round($cityCrew / 10);
$city['agri'] -= $dec; $city['agri'] -= $dec;
$city['comm'] -= $dec; $city['comm'] -= $dec;
$city['secu'] -= $dec; $city['secu'] -= $dec;
@@ -346,10 +385,10 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
while($phase < $warphase) { while($phase < $warphase) {
$phase++; $phase++;
$myAtt = getAtt($game, $general, $tech1, 0); $myAtt = getAtt($general, $tech1, 0);
$myDef = getDef($game, $general, $tech1); $myDef = getDef($general, $tech1);
$opAtt = getAtt($game, $oppose, $tech2, 0); $opAtt = getAtt($oppose, $tech2, 0);
$opDef = getDef($game, $oppose, $tech2); $opDef = getDef($oppose, $tech2);
// 감소할 병사 수 // 감소할 병사 수
$myCrew = GameConst::$armperphase + $opAtt - $myDef; $myCrew = GameConst::$armperphase + $opAtt - $myDef;
$opCrew = GameConst::$armperphase + $myAtt - $opDef; $opCrew = GameConst::$armperphase + $myAtt - $opDef;
@@ -367,7 +406,7 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
$myAvoid = 1; $myAvoid = 1;
$opAvoid = 1; $opAvoid = 1;
// 병종간 특성 // 병종간 특성
if(floor($general['crewtype']/10) == 3) { // 귀병 if(intdiv($general['crewtype'], 10) == 3) { // 귀병
$int = $general['intel'] + getBookEff($general['book']); $int = $general['intel'] + getBookEff($general['book']);
if($general['crewtype'] == 30) { if($general['crewtype'] == 30) {
$ratio2 = $int * 5; // 0~500 즉 50% $ratio2 = $int * 5; // 0~500 즉 50%
@@ -449,7 +488,7 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
} }
// 상대 장수 병종간 특성 // 상대 장수 병종간 특성
if(floor($oppose['crewtype']/10) == 3) { // 귀병 if(intdiv($oppose['crewtype'], 10) == 3) { // 귀병
$int = $oppose['intel'] + getBookEff($oppose['book']); $int = $oppose['intel'] + getBookEff($oppose['book']);
if($oppose['crewtype'] == 30) { if($oppose['crewtype'] == 30) {
$ratio2 = $int * 5; // 0~500 즉 50% $ratio2 = $int * 5; // 0~500 즉 50%
@@ -544,44 +583,44 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
// my 입장 상성 // my 입장 상성
// 보병계열 > 궁병계열 // 보병계열 > 궁병계열
if(floor($general['crewtype']/10) == 0 && floor($oppose['crewtype']/10) == 1) { if(intdiv($general['crewtype'], 10) == 0 && intdiv($oppose['crewtype'], 10) == 1) {
$myCrew *= 0.8; $myCrew *= 0.8;
$opCrew *= 1.2; $opCrew *= 1.2;
} }
// 궁병계열 > 기병계열 // 궁병계열 > 기병계열
if(floor($general['crewtype']/10) == 1 && floor($oppose['crewtype']/10) == 2) { if(intdiv($general['crewtype'], 10) == 1 && intdiv($oppose['crewtype'], 10) == 2) {
$myCrew *= 0.8; $myCrew *= 0.8;
$opCrew *= 1.2; $opCrew *= 1.2;
} }
// 기병계열 > 보병계열 // 기병계열 > 보병계열
if(floor($general['crewtype']/10) == 2 && floor($oppose['crewtype']/10) == 0) { if(intdiv($general['crewtype'], 10) == 2 && intdiv($oppose['crewtype'], 10) == 0) {
$myCrew *= 0.8; $myCrew *= 0.8;
$opCrew *= 1.2; $opCrew *= 1.2;
} }
// 차병계열 // 차병계열
if(floor($general['crewtype']/10) == 4) { if(intdiv($general['crewtype'], 10) == 4) {
$myCrew *= 1.2; $myCrew *= 1.2;
$opCrew *= 0.8; $opCrew *= 0.8;
} }
// op 입장 상성 // op 입장 상성
// 보병계열 > 궁병계열 // 보병계열 > 궁병계열
if(floor($oppose['crewtype']/10) == 0 && floor($general['crewtype']/10) == 1) { if(intdiv($oppose['crewtype'], 10) == 0 && intdiv($general['crewtype'], 10) == 1) {
$opCrew *= 0.8; $opCrew *= 0.8;
$myCrew *= 1.2; $myCrew *= 1.2;
} }
// 궁병계열 > 기병계열 // 궁병계열 > 기병계열
if(floor($oppose['crewtype']/10) == 1 && floor($general['crewtype']/10) == 2) { if(intdiv($oppose['crewtype'], 10) == 1 && intdiv($general['crewtype'], 10) == 2) {
$opCrew *= 0.8; $opCrew *= 0.8;
$myCrew *= 1.2; $myCrew *= 1.2;
} }
// 기병계열 > 보병계열 // 기병계열 > 보병계열
if(floor($oppose['crewtype']/10) == 2 && floor($general['crewtype']/10) == 0) { if(intdiv($oppose['crewtype'], 10) == 2 && intdiv($general['crewtype'], 10) == 0) {
$opCrew *= 0.8; $opCrew *= 0.8;
$myCrew *= 1.2; $myCrew *= 1.2;
} }
// 차병계열 // 차병계열
if(floor($oppose['crewtype']/10) == 4) { if(intdiv($oppose['crewtype'], 10) == 4) {
$opCrew *= 1.2; $opCrew *= 1.2;
$myCrew *= 0.8; $myCrew *= 0.8;
} }
@@ -645,8 +684,8 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
$opCrew *= (rand() % 21 + 90)/100; // 90~110% $opCrew *= (rand() % 21 + 90)/100; // 90~110%
$myCrew *= (rand() % 21 + 90)/100; // 90~110% $myCrew *= (rand() % 21 + 90)/100; // 90~110%
$general['crew'] -= round($myCrew); $general['crew'] -= Util::round($myCrew);
$oppose['crew'] -= round($opCrew); $oppose['crew'] -= Util::round($opCrew);
$tempMyCrew = $myCrew; $tempOpCrew = $opCrew; $tempMyCrew = $myCrew; $tempOpCrew = $opCrew;
$tempGeneralCrew = $general['crew']; $tempOpposeCrew = $oppose['crew']; $tempGeneralCrew = $general['crew']; $tempOpposeCrew = $oppose['crew'];
if($general['crew'] <= 0 && $oppose['crew'] <= 0) { if($general['crew'] <= 0 && $oppose['crew'] <= 0) {
@@ -654,13 +693,13 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
$r2 = $tempOpposeCrew / $tempOpCrew; $r2 = $tempOpposeCrew / $tempOpCrew;
if($r1 > $r2) { if($r1 > $r2) {
$offset = round($tempOpposeCrew*$tempMyCrew/$tempOpCrew); $offset = Util::round($tempOpposeCrew*$tempMyCrew/$tempOpCrew);
$myCrew += $offset; $myCrew += $offset;
$general['crew'] -= $offset; $general['crew'] -= $offset;
$opCrew += $tempOpposeCrew; $opCrew += $tempOpposeCrew;
$oppose['crew'] = 0; $oppose['crew'] = 0;
} else { } else {
$offset = round($tempGeneralCrew*$tempOpCrew/$tempMyCrew); $offset = Util::round($tempGeneralCrew*$tempOpCrew/$tempMyCrew);
$opCrew += $offset; $opCrew += $offset;
$oppose['crew'] -= $offset; $oppose['crew'] -= $offset;
$myCrew += $tempGeneralCrew; $myCrew += $tempGeneralCrew;
@@ -668,14 +707,14 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
} }
} elseif($general['crew'] * $oppose['crew'] <= 0) { } elseif($general['crew'] * $oppose['crew'] <= 0) {
if($oppose['crew'] < 0) { if($oppose['crew'] < 0) {
$offset = round($tempOpposeCrew*$tempMyCrew/$tempOpCrew); $offset = Util::round($tempOpposeCrew*$tempMyCrew/$tempOpCrew);
$myCrew += $offset; $myCrew += $offset;
$general['crew'] -= $offset; $general['crew'] -= $offset;
$opCrew += $tempOpposeCrew; $opCrew += $tempOpposeCrew;
$oppose['crew'] = 0; $oppose['crew'] = 0;
} }
if($general['crew'] < 0) { if($general['crew'] < 0) {
$offset = round($tempGeneralCrew*$tempOpCrew/$tempMyCrew); $offset = Util::round($tempGeneralCrew*$tempOpCrew/$tempMyCrew);
$opCrew += $offset; $opCrew += $offset;
$oppose['crew'] -= $offset; $oppose['crew'] -= $offset;
$myCrew += $tempGeneralCrew; $myCrew += $tempGeneralCrew;
@@ -685,10 +724,10 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
$exp += $opCrew; $exp += $opCrew;
$opexp += $myCrew; $opexp += $myCrew;
$general['crew'] = round($general['crew']); $general['crew'] = Util::round($general['crew']);
$oppose['crew'] = round($oppose['crew']); $oppose['crew'] = Util::round($oppose['crew']);
$myCrew = round($myCrew); $myCrew = Util::round($myCrew);
$opCrew = round($opCrew); $opCrew = Util::round($opCrew);
$myAtt = round($myAtt, 2); $myAtt = round($myAtt, 2);
$myDef = round($myDef, 2); $myDef = round($myDef, 2);
$opAtt = round($opAtt, 2); $opAtt = round($opAtt, 2);
@@ -707,10 +746,10 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
} }
// 공헌, 명성 상승 // 공헌, 명성 상승
$exp = round($exp / 50); $exp = Util::round($exp / 50);
$ricing = ($exp * 5 * getCrewtypeRice($game, $general['crewtype'], $tech1)); $ricing = ($exp * 5 * getCrewtypeRice($general['crewtype'], $tech1));
$msg .= "★ 【공격장수】공헌 상승 : $exp 쌀 소비 : {$exp}x5x".getCrewtypeRice($game, $general['crewtype'], $tech1)." = $ricing<br>"; $msg .= "★ 【공격장수】공헌 상승 : $exp 쌀 소비 : {$exp}x5x".getCrewtypeRice($general['crewtype'], $tech1)." = $ricing<br>";
// $msg2 .= "★ 【공격장수】공헌 상승 : $exp 쌀 소비 : {$exp}x5x".getCrewtypeRice($game, $general['crewtype'], $tech1)." = $ricing<br>"; // $msg2 .= "★ 【공격장수】공헌 상승 : $exp 쌀 소비 : {$exp}x5x".getCrewtypeRice($general['crewtype'], $tech1)." = $ricing<br>";
$msg = ConvertLog($msg, 1); $msg = ConvertLog($msg, 1);
@@ -732,11 +771,11 @@ if($isgen == "장수공격" || $isgen == "성벽공격" || $isgen == "장수평
$msg2 .= "{$simulCount}회 평균<br>"; $msg2 .= "{$simulCount}회 평균<br>";
$msg2 .= "<S>★</>병사수 변화 : <C>-$mydeathnumSum</> vs <C>-$mykillnumSum</>   "; $msg2 .= "<S>★</>병사수 변화 : <C>-$mydeathnumSum</> vs <C>-$mykillnumSum</>   ";
$msg2 .= "<R>★</>【성벽】내정 감소량 : $expSum2 【성벽】쌀 소모 : $ricingSum2<br>"; $msg2 .= "<R>★</>【성벽】내정 감소량 : $expSum2 【성벽】쌀 소모 : $ricingSum2<br>";
$msg2 .= "★ 【공격장수】공헌 상승 : $expSum 쌀 소비 : {$expSum}x5x".getCrewtypeRice($game, $general['crewtype'], $tech1)." = $ricingSum<br>"; $msg2 .= "★ 【공격장수】공헌 상승 : $expSum 쌀 소비 : {$expSum}x5x".getCrewtypeRice($general['crewtype'], $tech1)." = $ricingSum<br>";
} elseif($isgen == "장수평균") { } elseif($isgen == "장수평균") {
$msg2 .= "{$simulCount}회 평균<br>"; $msg2 .= "{$simulCount}회 평균<br>";
$msg2 .= "<S>★</>병사수 변화 : <C>-$mydeathnumSum</> vs <C>-$mykillnumSum</>   "; $msg2 .= "<S>★</>병사수 변화 : <C>-$mydeathnumSum</> vs <C>-$mykillnumSum</>   ";
$msg2 .= "★ 【공격장수】공헌 상승 : $expSum 쌀 소비 : {$expSum}x5x".getCrewtypeRice($game, $general['crewtype'], $tech1)." = $ricingSum<br>"; $msg2 .= "★ 【공격장수】공헌 상승 : $expSum 쌀 소비 : {$expSum}x5x".getCrewtypeRice($general['crewtype'], $tech1)." = $ricingSum<br>";
} }
$msg2 = ConvertLog($msg2, 1); $msg2 = ConvertLog($msg2, 1);
@@ -1101,12 +1140,11 @@ switch($dex240) {
<head> <head>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<title>전투시뮬레이션</title> <title>전투시뮬레이션</title>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
<style type="text/css"> <style type="text/css">
<!--
select { background-color:black;color:white; } select { background-color:black;color:white; }
input { background-color:black;color:white; } input { background-color:black;color:white; }
-->
</style> </style>
</head> </head>
@@ -1122,180 +1160,180 @@ input { background-color:black;color:white; }
<tr> <tr>
<td>관직 <td>관직
<select name=level1 size=1> <select name=level1 size=1>
<option <?=$sellevel1[1];?> value=1>일반</option> <option <?=$sellevel1[1]?> value=1>일반</option>
<option <?=$sellevel1[5];?> value=5>제3모사</option> <option <?=$sellevel1[5]?> value=5>제3모사</option>
<option <?=$sellevel1[6];?> value=6>제3장군</option> <option <?=$sellevel1[6]?> value=6>제3장군</option>
<option <?=$sellevel1[7];?> value=7>제2모사</option> <option <?=$sellevel1[7]?> value=7>제2모사</option>
<option <?=$sellevel1[8];?> value=8>제2장군</option> <option <?=$sellevel1[8]?> value=8>제2장군</option>
<option <?=$sellevel1[9];?> value=9>제1모사</option> <option <?=$sellevel1[9]?> value=9>제1모사</option>
<option <?=$sellevel1[10];?> value=10>제1장군</option> <option <?=$sellevel1[10]?> value=10>제1장군</option>
<option <?=$sellevel1[11];?> value=11>참모</option> <option <?=$sellevel1[11]?> value=11>참모</option>
<option <?=$sellevel1[12];?> value=12>군주</option> <option <?=$sellevel1[12]?> value=12>군주</option>
</select> </select>
</td> </td>
<td>관직 <td>관직
<select name=level2 size=1> <select name=level2 size=1>
<option <?=$sellevel2[1];?> value=1>일반</option> <option <?=$sellevel2[1]?> value=1>일반</option>
<option <?=$sellevel2[5];?> value=5>제3모사</option> <option <?=$sellevel2[5]?> value=5>제3모사</option>
<option <?=$sellevel2[6];?> value=6>제3장군</option> <option <?=$sellevel2[6]?> value=6>제3장군</option>
<option <?=$sellevel2[7];?> value=7>제2모사</option> <option <?=$sellevel2[7]?> value=7>제2모사</option>
<option <?=$sellevel2[8];?> value=8>제2장군</option> <option <?=$sellevel2[8]?> value=8>제2장군</option>
<option <?=$sellevel2[9];?> value=9>제1모사</option> <option <?=$sellevel2[9]?> value=9>제1모사</option>
<option <?=$sellevel2[10];?> value=10>제1장군</option> <option <?=$sellevel2[10]?> value=10>제1장군</option>
<option <?=$sellevel2[11];?> value=11>참모</option> <option <?=$sellevel2[11]?> value=11>참모</option>
<option <?=$sellevel2[12];?> value=12>군주</option> <option <?=$sellevel2[12]?> value=12>군주</option>
</select> </select>
</td> </td>
<td>-</td> <td>-</td>
<tr> <tr>
<td>Lv <input size=2 maxlength=2 name=explevel1 value=<?=$explevel1;?>></td> <td>Lv <input size=2 maxlength=2 name=explevel1 value=<?=$explevel1?>></td>
<td>Lv <input size=2 maxlength=2 name=explevel2 value=<?=$explevel2;?>></td> <td>Lv <input size=2 maxlength=2 name=explevel2 value=<?=$explevel2?>></td>
<td>-</td> <td>-</td>
</tr> </tr>
<tr> <tr>
<td>통솔 <input size=3 maxlength=3 name=leader1 value=<?=$leader1;?>></td> <td>통솔 <input size=3 maxlength=3 name=leader1 value=<?=$leader1?>></td>
<td>통솔 <input size=3 maxlength=3 name=leader2 value=<?=$leader2;?>></td> <td>통솔 <input size=3 maxlength=3 name=leader2 value=<?=$leader2?>></td>
<td>-</td> <td>-</td>
</tr> </tr>
<tr> <tr>
<td>무력 <input size=3 maxlength=3 name=power1 value=<?=$power1;?>></td> <td>무력 <input size=3 maxlength=3 name=power1 value=<?=$power1?>></td>
<td>무력 <input size=3 maxlength=3 name=power2 value=<?=$power2;?>></td> <td>무력 <input size=3 maxlength=3 name=power2 value=<?=$power2?>></td>
<td>-</td> <td>-</td>
</tr> </tr>
<tr> <tr>
<td>지력 <input size=3 maxlength=3 name=intel1 value=<?=$intel1;?>></td> <td>지력 <input size=3 maxlength=3 name=intel1 value=<?=$intel1?>></td>
<td>지력 <input size=3 maxlength=3 name=intel2 value=<?=$intel2;?>></td> <td>지력 <input size=3 maxlength=3 name=intel2 value=<?=$intel2?>></td>
<td>-</td> <td>-</td>
</tr> </tr>
<tr> <tr>
<td>병종 <td>병종
<select name=type1 size=1> <select name=type1 size=1>
<option value=0>--------</option> <option value=0>--------</option>
<option <?=$sel1[0];?> value=0>보병</option> <option <?=$sel1[0]?> value=0>보병</option>
<option <?=$sel1[1];?> value=1>청주병</option> <option <?=$sel1[1]?> value=1>청주병</option>
<option <?=$sel1[2];?> value=2>수병</option> <option <?=$sel1[2]?> value=2>수병</option>
<option <?=$sel1[3];?> value=3>자객병</option> <option <?=$sel1[3]?> value=3>자객병</option>
<option <?=$sel1[4];?> value=4>근위병</option> <option <?=$sel1[4]?> value=4>근위병</option>
<option <?=$sel1[5];?> value=5>등갑병</option> <option <?=$sel1[5]?> value=5>등갑병</option>
<option value=0>--------</option> <option value=0>--------</option>
<option <?=$sel1[10];?> value=10>궁병</option> <option <?=$sel1[10]?> value=10>궁병</option>
<option <?=$sel1[11];?> value=11>궁기병</option> <option <?=$sel1[11]?> value=11>궁기병</option>
<option <?=$sel1[12];?> value=12>연노병</option> <option <?=$sel1[12]?> value=12>연노병</option>
<option <?=$sel1[13];?> value=13>강궁병</option> <option <?=$sel1[13]?> value=13>강궁병</option>
<option <?=$sel1[14];?> value=14>석궁병</option> <option <?=$sel1[14]?> value=14>석궁병</option>
<option value=0>--------</option> <option value=0>--------</option>
<option <?=$sel1[20];?> value=20>기병</option> <option <?=$sel1[20]?> value=20>기병</option>
<option <?=$sel1[21];?> value=21>백마병</option> <option <?=$sel1[21]?> value=21>백마병</option>
<option <?=$sel1[22];?> value=22>중장기병</option> <option <?=$sel1[22]?> value=22>중장기병</option>
<option <?=$sel1[23];?> value=23>돌격기병</option> <option <?=$sel1[23]?> value=23>돌격기병</option>
<option <?=$sel1[24];?> value=24>철기병</option> <option <?=$sel1[24]?> value=24>철기병</option>
<option <?=$sel1[25];?> value=25>수렵기병</option> <option <?=$sel1[25]?> value=25>수렵기병</option>
<option <?=$sel1[26];?> value=26>맹수병</option> <option <?=$sel1[26]?> value=26>맹수병</option>
<option <?=$sel1[27];?> value=27>호표기병</option> <option <?=$sel1[27]?> value=27>호표기병</option>
<option value=0>--------</option> <option value=0>--------</option>
<option <?=$sel1[30];?> value=30>귀병</option> <option <?=$sel1[30]?> value=30>귀병</option>
<option <?=$sel1[31];?> value=31>신귀병</option> <option <?=$sel1[31]?> value=31>신귀병</option>
<option <?=$sel1[32];?> value=32>백귀병</option> <option <?=$sel1[32]?> value=32>백귀병</option>
<option <?=$sel1[33];?> value=33>흑귀병</option> <option <?=$sel1[33]?> value=33>흑귀병</option>
<option <?=$sel1[34];?> value=34>악귀병</option> <option <?=$sel1[34]?> value=34>악귀병</option>
<option <?=$sel1[35];?> value=35>남귀병</option> <option <?=$sel1[35]?> value=35>남귀병</option>
<option <?=$sel1[36];?> value=36>황귀병</option> <option <?=$sel1[36]?> value=36>황귀병</option>
<option <?=$sel1[37];?> value=37>천귀병</option> <option <?=$sel1[37]?> value=37>천귀병</option>
<option <?=$sel1[38];?> value=38>마귀병</option> <option <?=$sel1[38]?> value=38>마귀병</option>
<option value=0>--------</option> <option value=0>--------</option>
<option <?=$sel1[40];?> value=40>정란</option> <option <?=$sel1[40]?> value=40>정란</option>
<option <?=$sel1[41];?> value=41>충차</option> <option <?=$sel1[41]?> value=41>충차</option>
<option <?=$sel1[42];?> value=42>벽력거</option> <option <?=$sel1[42]?> value=42>벽력거</option>
<option <?=$sel1[43];?> value=43>목우</option> <option <?=$sel1[43]?> value=43>목우</option>
</select> </select>
</td> </td>
<td>병종 <td>병종
<select name=type2 size=1> <select name=type2 size=1>
<option value=0>--------</option> <option value=0>--------</option>
<option <?=$sel2[0];?> value=0>보병</option> <option <?=$sel2[0]?> value=0>보병</option>
<option <?=$sel2[1];?> value=1>청주병</option> <option <?=$sel2[1]?> value=1>청주병</option>
<option <?=$sel2[2];?> value=2>수병</option> <option <?=$sel2[2]?> value=2>수병</option>
<option <?=$sel2[3];?> value=3>자객병</option> <option <?=$sel2[3]?> value=3>자객병</option>
<option <?=$sel2[4];?> value=4>근위병</option> <option <?=$sel2[4]?> value=4>근위병</option>
<option <?=$sel2[5];?> value=5>등갑병</option> <option <?=$sel2[5]?> value=5>등갑병</option>
<option value=0>--------</option> <option value=0>--------</option>
<option <?=$sel2[10];?> value=10>궁병</option> <option <?=$sel2[10]?> value=10>궁병</option>
<option <?=$sel2[11];?> value=11>궁기병</option> <option <?=$sel2[11]?> value=11>궁기병</option>
<option <?=$sel2[12];?> value=12>연노병</option> <option <?=$sel2[12]?> value=12>연노병</option>
<option <?=$sel2[13];?> value=13>강궁병</option> <option <?=$sel2[13]?> value=13>강궁병</option>
<option <?=$sel2[14];?> value=14>석궁병</option> <option <?=$sel2[14]?> value=14>석궁병</option>
<option value=0>--------</option> <option value=0>--------</option>
<option <?=$sel2[20];?> value=20>기병</option> <option <?=$sel2[20]?> value=20>기병</option>
<option <?=$sel2[21];?> value=21>백마병</option> <option <?=$sel2[21]?> value=21>백마병</option>
<option <?=$sel2[22];?> value=22>중장기병</option> <option <?=$sel2[22]?> value=22>중장기병</option>
<option <?=$sel2[23];?> value=23>돌격기병</option> <option <?=$sel2[23]?> value=23>돌격기병</option>
<option <?=$sel2[24];?> value=24>철기병</option> <option <?=$sel2[24]?> value=24>철기병</option>
<option <?=$sel2[25];?> value=25>수렵기병</option> <option <?=$sel2[25]?> value=25>수렵기병</option>
<option <?=$sel2[26];?> value=26>맹수병</option> <option <?=$sel2[26]?> value=26>맹수병</option>
<option <?=$sel2[27];?> value=27>호표기병</option> <option <?=$sel2[27]?> value=27>호표기병</option>
<option value=0>--------</option> <option value=0>--------</option>
<option <?=$sel2[30];?> value=30>귀병</option> <option <?=$sel2[30]?> value=30>귀병</option>
<option <?=$sel2[31];?> value=31>신귀병</option> <option <?=$sel2[31]?> value=31>신귀병</option>
<option <?=$sel2[32];?> value=32>백귀병</option> <option <?=$sel2[32]?> value=32>백귀병</option>
<option <?=$sel2[33];?> value=33>흑귀병</option> <option <?=$sel2[33]?> value=33>흑귀병</option>
<option <?=$sel2[34];?> value=34>악귀병</option> <option <?=$sel2[34]?> value=34>악귀병</option>
<option <?=$sel2[35];?> value=35>남귀병</option> <option <?=$sel2[35]?> value=35>남귀병</option>
<option <?=$sel2[36];?> value=36>황귀병</option> <option <?=$sel2[36]?> value=36>황귀병</option>
<option <?=$sel2[37];?> value=37>천귀병</option> <option <?=$sel2[37]?> value=37>천귀병</option>
<option <?=$sel2[38];?> value=38>마귀병</option> <option <?=$sel2[38]?> value=38>마귀병</option>
<option value=0>--------</option> <option value=0>--------</option>
<option <?=$sel2[40];?> value=40>정란</option> <option <?=$sel2[40]?> value=40>정란</option>
<option <?=$sel2[41];?> value=41>충차</option> <option <?=$sel2[41]?> value=41>충차</option>
<option <?=$sel2[42];?> value=42>벽력거</option> <option <?=$sel2[42]?> value=42>벽력거</option>
<option <?=$sel2[43];?> value=43>목우</option> <option <?=$sel2[43]?> value=43>목우</option>
</select> </select>
</td> </td>
<td>성벽 <input size=4 maxlength=4 name=wall value=<?=$wall;?>></td> <td>성벽 <input size=4 maxlength=4 name=wall value=<?=$wall?>></td>
</tr> </tr>
<tr> <tr>
<td>병력 <input size=5 maxlength=5 name=crew1 value=<?=$crew1;?>></td> <td>병력 <input size=5 maxlength=5 name=crew1 value=<?=$crew1?>></td>
<td>병력 <input size=5 maxlength=5 name=crew2 value=<?=$crew2;?>></td> <td>병력 <input size=5 maxlength=5 name=crew2 value=<?=$crew2?>></td>
<td>수비 <input size=4 maxlength=4 name=def value=<?=$def;?>></td> <td>수비 <input size=4 maxlength=4 name=def value=<?=$def?>></td>
</tr> </tr>
<tr> <tr>
<td>훈련 <input size=3 maxlength=3 name=train1 value=<?=$train1;?>></td> <td>훈련 <input size=3 maxlength=3 name=train1 value=<?=$train1?>></td>
<td>훈련 <input size=3 maxlength=3 name=train2 value=<?=$train2;?>></td> <td>훈련 <input size=3 maxlength=3 name=train2 value=<?=$train2?>></td>
<td>훈련 <input size=3 maxlength=3 name=train3 value=<?=$train3;?>></td> <td>훈련 <input size=3 maxlength=3 name=train3 value=<?=$train3?>></td>
</tr> </tr>
<tr> <tr>
<td>사기 <input size=3 maxlength=3 name=atmos1 value=<?=$atmos1;?>></td> <td>사기 <input size=3 maxlength=3 name=atmos1 value=<?=$atmos1?>></td>
<td>사기 <input size=3 maxlength=3 name=atmos2 value=<?=$atmos2;?>></td> <td>사기 <input size=3 maxlength=3 name=atmos2 value=<?=$atmos2?>></td>
<td>사기 <input size=3 maxlength=3 name=atmos3 value=<?=$atmos3;?>></td> <td>사기 <input size=3 maxlength=3 name=atmos3 value=<?=$atmos3?>></td>
</tr> </tr>
<tr> <tr>
<td>기술 <td>기술
<select name=tech1 size=1> <select name=tech1 size=1>
<option <?=$tch1[0];?> value=0>0등급</option> <option <?=$tch1[0]?> value=0>0등급</option>
<option <?=$tch1[1];?> value=1000>1등급</option> <option <?=$tch1[1]?> value=1000>1등급</option>
<option <?=$tch1[2];?> value=2000>2등급</option> <option <?=$tch1[2]?> value=2000>2등급</option>
<option <?=$tch1[3];?> value=3000>3등급</option> <option <?=$tch1[3]?> value=3000>3등급</option>
<option <?=$tch1[4];?> value=4000>4등급</option> <option <?=$tch1[4]?> value=4000>4등급</option>
<option <?=$tch1[5];?> value=5000>5등급</option> <option <?=$tch1[5]?> value=5000>5등급</option>
<option <?=$tch1[6];?> value=6000>6등급</option> <option <?=$tch1[6]?> value=6000>6등급</option>
<option <?=$tch1[7];?> value=7000>7등급</option> <option <?=$tch1[7]?> value=7000>7등급</option>
<option <?=$tch1[8];?> value=8000>8등급</option> <option <?=$tch1[8]?> value=8000>8등급</option>
<option <?=$tch1[9];?> value=9000>9등급</option> <option <?=$tch1[9]?> value=9000>9등급</option>
<option <?=$tch1[10];?> value=10000>10등급</option> <option <?=$tch1[10]?> value=10000>10등급</option>
</select> </select>
</td> </td>
<td>기술 <td>기술
<select name=tech2 size=1> <select name=tech2 size=1>
<option <?=$tch2[0];?> value=0>0등급</option> <option <?=$tch2[0]?> value=0>0등급</option>
<option <?=$tch2[1];?> value=1000>1등급</option> <option <?=$tch2[1]?> value=1000>1등급</option>
<option <?=$tch2[2];?> value=2000>2등급</option> <option <?=$tch2[2]?> value=2000>2등급</option>
<option <?=$tch2[3];?> value=3000>3등급</option> <option <?=$tch2[3]?> value=3000>3등급</option>
<option <?=$tch2[4];?> value=4000>4등급</option> <option <?=$tch2[4]?> value=4000>4등급</option>
<option <?=$tch2[5];?> value=5000>5등급</option> <option <?=$tch2[5]?> value=5000>5등급</option>
<option <?=$tch2[6];?> value=6000>6등급</option> <option <?=$tch2[6]?> value=6000>6등급</option>
<option <?=$tch2[7];?> value=7000>7등급</option> <option <?=$tch2[7]?> value=7000>7등급</option>
<option <?=$tch2[8];?> value=8000>8등급</option> <option <?=$tch2[8]?> value=8000>8등급</option>
<option <?=$tch2[9];?> value=9000>9등급</option> <option <?=$tch2[9]?> value=9000>9등급</option>
<option <?=$tch2[10];?> value=10000>10등급</option> <option <?=$tch2[10]?> value=10000>10등급</option>
</select> </select>
</td> </td>
<td>-</td> <td>-</td>
@@ -1303,224 +1341,224 @@ input { background-color:black;color:white; }
<tr> <tr>
<td>보 <td>보
<select name=dex10 size=1> <select name=dex10 size=1>
<option <?=$dx10[0];?> value=0>F</option> <option <?=$dx10[0]?> value=0>F</option>
<option <?=$dx10[1];?> value=2500>E-</option> <option <?=$dx10[1]?> value=2500>E-</option>
<option <?=$dx10[2];?> value=7500>E</option> <option <?=$dx10[2]?> value=7500>E</option>
<option <?=$dx10[3];?> value=15000>E+</option> <option <?=$dx10[3]?> value=15000>E+</option>
<option <?=$dx10[4];?> value=25000>D-</option> <option <?=$dx10[4]?> value=25000>D-</option>
<option <?=$dx10[5];?> value=37500>D</option> <option <?=$dx10[5]?> value=37500>D</option>
<option <?=$dx10[6];?> value=52500>D+</option> <option <?=$dx10[6]?> value=52500>D+</option>
<option <?=$dx10[7];?> value=70000>C-</option> <option <?=$dx10[7]?> value=70000>C-</option>
<option <?=$dx10[8];?> value=90000>C</option> <option <?=$dx10[8]?> value=90000>C</option>
<option <?=$dx10[9];?> value=112500>C+</option> <option <?=$dx10[9]?> value=112500>C+</option>
<option <?=$dx10[10];?> value=137500>B-</option> <option <?=$dx10[10]?> value=137500>B-</option>
<option <?=$dx10[11];?> value=165000>B</option> <option <?=$dx10[11]?> value=165000>B</option>
<option <?=$dx10[12];?> value=195000>B+</option> <option <?=$dx10[12]?> value=195000>B+</option>
<option <?=$dx10[13];?> value=227500>A-</option> <option <?=$dx10[13]?> value=227500>A-</option>
<option <?=$dx10[14];?> value=262500>A</option> <option <?=$dx10[14]?> value=262500>A</option>
<option <?=$dx10[15];?> value=300000>A+</option> <option <?=$dx10[15]?> value=300000>A+</option>
<option <?=$dx10[16];?> value=340000>S</option> <option <?=$dx10[16]?> value=340000>S</option>
<option <?=$dx10[17];?> value=382500>SS</option> <option <?=$dx10[17]?> value=382500>SS</option>
<option <?=$dx10[18];?> value=427500>SSS</option> <option <?=$dx10[18]?> value=427500>SSS</option>
</select> </select>
<select name=dex110 size=1> <select name=dex110 size=1>
<option <?=$dx110[0];?> value=0>F</option> <option <?=$dx110[0]?> value=0>F</option>
<option <?=$dx110[1];?> value=2500>E-</option> <option <?=$dx110[1]?> value=2500>E-</option>
<option <?=$dx110[2];?> value=7500>E</option> <option <?=$dx110[2]?> value=7500>E</option>
<option <?=$dx110[3];?> value=15000>E+</option> <option <?=$dx110[3]?> value=15000>E+</option>
<option <?=$dx110[4];?> value=25000>D-</option> <option <?=$dx110[4]?> value=25000>D-</option>
<option <?=$dx110[5];?> value=37500>D</option> <option <?=$dx110[5]?> value=37500>D</option>
<option <?=$dx110[6];?> value=52500>D+</option> <option <?=$dx110[6]?> value=52500>D+</option>
<option <?=$dx110[7];?> value=70000>C-</option> <option <?=$dx110[7]?> value=70000>C-</option>
<option <?=$dx110[8];?> value=90000>C</option> <option <?=$dx110[8]?> value=90000>C</option>
<option <?=$dx110[9];?> value=112500>C+</option> <option <?=$dx110[9]?> value=112500>C+</option>
<option <?=$dx110[10];?> value=137500>B-</option> <option <?=$dx110[10]?> value=137500>B-</option>
<option <?=$dx110[11];?> value=165000>B</option> <option <?=$dx110[11]?> value=165000>B</option>
<option <?=$dx110[12];?> value=195000>B+</option> <option <?=$dx110[12]?> value=195000>B+</option>
<option <?=$dx110[13];?> value=227500>A-</option> <option <?=$dx110[13]?> value=227500>A-</option>
<option <?=$dx110[14];?> value=262500>A</option> <option <?=$dx110[14]?> value=262500>A</option>
<option <?=$dx110[15];?> value=300000>A+</option> <option <?=$dx110[15]?> value=300000>A+</option>
<option <?=$dx110[16];?> value=340000>S</option> <option <?=$dx110[16]?> value=340000>S</option>
<option <?=$dx110[17];?> value=382500>SS</option> <option <?=$dx110[17]?> value=382500>SS</option>
<option <?=$dx110[18];?> value=427500>SSS</option> <option <?=$dx110[18]?> value=427500>SSS</option>
</select> </select>
<select name=dex120 size=1> <select name=dex120 size=1>
<option <?=$dx120[0];?> value=0>F</option> <option <?=$dx120[0]?> value=0>F</option>
<option <?=$dx120[1];?> value=2500>E-</option> <option <?=$dx120[1]?> value=2500>E-</option>
<option <?=$dx120[2];?> value=7500>E</option> <option <?=$dx120[2]?> value=7500>E</option>
<option <?=$dx120[3];?> value=15000>E+</option> <option <?=$dx120[3]?> value=15000>E+</option>
<option <?=$dx120[4];?> value=25000>D-</option> <option <?=$dx120[4]?> value=25000>D-</option>
<option <?=$dx120[5];?> value=37500>D</option> <option <?=$dx120[5]?> value=37500>D</option>
<option <?=$dx120[6];?> value=52500>D+</option> <option <?=$dx120[6]?> value=52500>D+</option>
<option <?=$dx120[7];?> value=70000>C-</option> <option <?=$dx120[7]?> value=70000>C-</option>
<option <?=$dx120[8];?> value=90000>C</option> <option <?=$dx120[8]?> value=90000>C</option>
<option <?=$dx120[9];?> value=112500>C+</option> <option <?=$dx120[9]?> value=112500>C+</option>
<option <?=$dx120[10];?> value=137500>B-</option> <option <?=$dx120[10]?> value=137500>B-</option>
<option <?=$dx120[11];?> value=165000>B</option> <option <?=$dx120[11]?> value=165000>B</option>
<option <?=$dx120[12];?> value=195000>B+</option> <option <?=$dx120[12]?> value=195000>B+</option>
<option <?=$dx120[13];?> value=227500>A-</option> <option <?=$dx120[13]?> value=227500>A-</option>
<option <?=$dx120[14];?> value=262500>A</option> <option <?=$dx120[14]?> value=262500>A</option>
<option <?=$dx120[15];?> value=300000>A+</option> <option <?=$dx120[15]?> value=300000>A+</option>
<option <?=$dx120[16];?> value=340000>S</option> <option <?=$dx120[16]?> value=340000>S</option>
<option <?=$dx120[17];?> value=382500>SS</option> <option <?=$dx120[17]?> value=382500>SS</option>
<option <?=$dx120[18];?> value=427500>SSS</option> <option <?=$dx120[18]?> value=427500>SSS</option>
</select> </select>
<select name=dex130 size=1> <select name=dex130 size=1>
<option <?=$dx130[0];?> value=0>F</option> <option <?=$dx130[0]?> value=0>F</option>
<option <?=$dx130[1];?> value=2500>E-</option> <option <?=$dx130[1]?> value=2500>E-</option>
<option <?=$dx130[2];?> value=7500>E</option> <option <?=$dx130[2]?> value=7500>E</option>
<option <?=$dx130[3];?> value=15000>E+</option> <option <?=$dx130[3]?> value=15000>E+</option>
<option <?=$dx130[4];?> value=25000>D-</option> <option <?=$dx130[4]?> value=25000>D-</option>
<option <?=$dx130[5];?> value=37500>D</option> <option <?=$dx130[5]?> value=37500>D</option>
<option <?=$dx130[6];?> value=52500>D+</option> <option <?=$dx130[6]?> value=52500>D+</option>
<option <?=$dx130[7];?> value=70000>C-</option> <option <?=$dx130[7]?> value=70000>C-</option>
<option <?=$dx130[8];?> value=90000>C</option> <option <?=$dx130[8]?> value=90000>C</option>
<option <?=$dx130[9];?> value=112500>C+</option> <option <?=$dx130[9]?> value=112500>C+</option>
<option <?=$dx130[10];?> value=137500>B-</option> <option <?=$dx130[10]?> value=137500>B-</option>
<option <?=$dx130[11];?> value=165000>B</option> <option <?=$dx130[11]?> value=165000>B</option>
<option <?=$dx130[12];?> value=195000>B+</option> <option <?=$dx130[12]?> value=195000>B+</option>
<option <?=$dx130[13];?> value=227500>A-</option> <option <?=$dx130[13]?> value=227500>A-</option>
<option <?=$dx130[14];?> value=262500>A</option> <option <?=$dx130[14]?> value=262500>A</option>
<option <?=$dx130[15];?> value=300000>A+</option> <option <?=$dx130[15]?> value=300000>A+</option>
<option <?=$dx130[16];?> value=340000>S</option> <option <?=$dx130[16]?> value=340000>S</option>
<option <?=$dx130[17];?> value=382500>SS</option> <option <?=$dx130[17]?> value=382500>SS</option>
<option <?=$dx130[18];?> value=427500>SSS</option> <option <?=$dx130[18]?> value=427500>SSS</option>
</select> </select>
<select name=dex140 size=1> <select name=dex140 size=1>
<option <?=$dx140[0];?> value=0>F</option> <option <?=$dx140[0]?> value=0>F</option>
<option <?=$dx140[1];?> value=2500>E-</option> <option <?=$dx140[1]?> value=2500>E-</option>
<option <?=$dx140[2];?> value=7500>E</option> <option <?=$dx140[2]?> value=7500>E</option>
<option <?=$dx140[3];?> value=15000>E+</option> <option <?=$dx140[3]?> value=15000>E+</option>
<option <?=$dx140[4];?> value=25000>D-</option> <option <?=$dx140[4]?> value=25000>D-</option>
<option <?=$dx140[5];?> value=37500>D</option> <option <?=$dx140[5]?> value=37500>D</option>
<option <?=$dx140[6];?> value=52500>D+</option> <option <?=$dx140[6]?> value=52500>D+</option>
<option <?=$dx140[7];?> value=70000>C-</option> <option <?=$dx140[7]?> value=70000>C-</option>
<option <?=$dx140[8];?> value=90000>C</option> <option <?=$dx140[8]?> value=90000>C</option>
<option <?=$dx140[9];?> value=112500>C+</option> <option <?=$dx140[9]?> value=112500>C+</option>
<option <?=$dx140[10];?> value=137500>B-</option> <option <?=$dx140[10]?> value=137500>B-</option>
<option <?=$dx140[11];?> value=165000>B</option> <option <?=$dx140[11]?> value=165000>B</option>
<option <?=$dx140[12];?> value=195000>B+</option> <option <?=$dx140[12]?> value=195000>B+</option>
<option <?=$dx140[13];?> value=227500>A-</option> <option <?=$dx140[13]?> value=227500>A-</option>
<option <?=$dx140[14];?> value=262500>A</option> <option <?=$dx140[14]?> value=262500>A</option>
<option <?=$dx140[15];?> value=300000>A+</option> <option <?=$dx140[15]?> value=300000>A+</option>
<option <?=$dx140[16];?> value=340000>S</option> <option <?=$dx140[16]?> value=340000>S</option>
<option <?=$dx140[17];?> value=382500>SS</option> <option <?=$dx140[17]?> value=382500>SS</option>
<option <?=$dx140[18];?> value=427500>SSS</option> <option <?=$dx140[18]?> value=427500>SSS</option>
</select> </select>
</td> </td>
<td>보 <td>보
<select name=dex20 size=1> <select name=dex20 size=1>
<option <?=$dx20[0];?> value=0>F</option> <option <?=$dx20[0]?> value=0>F</option>
<option <?=$dx20[1];?> value=2500>E-</option> <option <?=$dx20[1]?> value=2500>E-</option>
<option <?=$dx20[2];?> value=7500>E</option> <option <?=$dx20[2]?> value=7500>E</option>
<option <?=$dx20[3];?> value=15000>E+</option> <option <?=$dx20[3]?> value=15000>E+</option>
<option <?=$dx20[4];?> value=25000>D-</option> <option <?=$dx20[4]?> value=25000>D-</option>
<option <?=$dx20[5];?> value=37500>D</option> <option <?=$dx20[5]?> value=37500>D</option>
<option <?=$dx20[6];?> value=52500>D+</option> <option <?=$dx20[6]?> value=52500>D+</option>
<option <?=$dx20[7];?> value=70000>C-</option> <option <?=$dx20[7]?> value=70000>C-</option>
<option <?=$dx20[8];?> value=90000>C</option> <option <?=$dx20[8]?> value=90000>C</option>
<option <?=$dx20[9];?> value=112500>C+</option> <option <?=$dx20[9]?> value=112500>C+</option>
<option <?=$dx20[10];?> value=137500>B-</option> <option <?=$dx20[10]?> value=137500>B-</option>
<option <?=$dx20[11];?> value=165000>B</option> <option <?=$dx20[11]?> value=165000>B</option>
<option <?=$dx20[12];?> value=195000>B+</option> <option <?=$dx20[12]?> value=195000>B+</option>
<option <?=$dx20[13];?> value=227500>A-</option> <option <?=$dx20[13]?> value=227500>A-</option>
<option <?=$dx20[14];?> value=262500>A</option> <option <?=$dx20[14]?> value=262500>A</option>
<option <?=$dx20[15];?> value=300000>A+</option> <option <?=$dx20[15]?> value=300000>A+</option>
<option <?=$dx20[16];?> value=340000>S</option> <option <?=$dx20[16]?> value=340000>S</option>
<option <?=$dx20[17];?> value=382500>SS</option> <option <?=$dx20[17]?> value=382500>SS</option>
<option <?=$dx20[18];?> value=427500>SSS</option> <option <?=$dx20[18]?> value=427500>SSS</option>
</select> </select>
<select name=dex210 size=1> <select name=dex210 size=1>
<option <?=$dx210[0];?> value=0>F</option> <option <?=$dx210[0]?> value=0>F</option>
<option <?=$dx210[1];?> value=2500>E-</option> <option <?=$dx210[1]?> value=2500>E-</option>
<option <?=$dx210[2];?> value=7500>E</option> <option <?=$dx210[2]?> value=7500>E</option>
<option <?=$dx210[3];?> value=15000>E+</option> <option <?=$dx210[3]?> value=15000>E+</option>
<option <?=$dx210[4];?> value=25000>D-</option> <option <?=$dx210[4]?> value=25000>D-</option>
<option <?=$dx210[5];?> value=37500>D</option> <option <?=$dx210[5]?> value=37500>D</option>
<option <?=$dx210[6];?> value=52500>D+</option> <option <?=$dx210[6]?> value=52500>D+</option>
<option <?=$dx210[7];?> value=70000>C-</option> <option <?=$dx210[7]?> value=70000>C-</option>
<option <?=$dx210[8];?> value=90000>C</option> <option <?=$dx210[8]?> value=90000>C</option>
<option <?=$dx210[9];?> value=112500>C+</option> <option <?=$dx210[9]?> value=112500>C+</option>
<option <?=$dx210[10];?> value=137500>B-</option> <option <?=$dx210[10]?> value=137500>B-</option>
<option <?=$dx210[11];?> value=165000>B</option> <option <?=$dx210[11]?> value=165000>B</option>
<option <?=$dx210[12];?> value=195000>B+</option> <option <?=$dx210[12]?> value=195000>B+</option>
<option <?=$dx210[13];?> value=227500>A-</option> <option <?=$dx210[13]?> value=227500>A-</option>
<option <?=$dx210[14];?> value=262500>A</option> <option <?=$dx210[14]?> value=262500>A</option>
<option <?=$dx210[15];?> value=300000>A+</option> <option <?=$dx210[15]?> value=300000>A+</option>
<option <?=$dx210[16];?> value=340000>S</option> <option <?=$dx210[16]?> value=340000>S</option>
<option <?=$dx210[17];?> value=382500>SS</option> <option <?=$dx210[17]?> value=382500>SS</option>
<option <?=$dx210[18];?> value=427500>SSS</option> <option <?=$dx210[18]?> value=427500>SSS</option>
</select> </select>
<select name=dex220 size=1> <select name=dex220 size=1>
<option <?=$dx220[0];?> value=0>F</option> <option <?=$dx220[0]?> value=0>F</option>
<option <?=$dx220[1];?> value=2500>E-</option> <option <?=$dx220[1]?> value=2500>E-</option>
<option <?=$dx220[2];?> value=7500>E</option> <option <?=$dx220[2]?> value=7500>E</option>
<option <?=$dx220[3];?> value=15000>E+</option> <option <?=$dx220[3]?> value=15000>E+</option>
<option <?=$dx220[4];?> value=25000>D-</option> <option <?=$dx220[4]?> value=25000>D-</option>
<option <?=$dx220[5];?> value=37500>D</option> <option <?=$dx220[5]?> value=37500>D</option>
<option <?=$dx220[6];?> value=52500>D+</option> <option <?=$dx220[6]?> value=52500>D+</option>
<option <?=$dx220[7];?> value=70000>C-</option> <option <?=$dx220[7]?> value=70000>C-</option>
<option <?=$dx220[8];?> value=90000>C</option> <option <?=$dx220[8]?> value=90000>C</option>
<option <?=$dx220[9];?> value=112500>C+</option> <option <?=$dx220[9]?> value=112500>C+</option>
<option <?=$dx220[10];?> value=137500>B-</option> <option <?=$dx220[10]?> value=137500>B-</option>
<option <?=$dx220[11];?> value=165000>B</option> <option <?=$dx220[11]?> value=165000>B</option>
<option <?=$dx220[12];?> value=195000>B+</option> <option <?=$dx220[12]?> value=195000>B+</option>
<option <?=$dx220[13];?> value=227500>A-</option> <option <?=$dx220[13]?> value=227500>A-</option>
<option <?=$dx220[14];?> value=262500>A</option> <option <?=$dx220[14]?> value=262500>A</option>
<option <?=$dx220[15];?> value=300000>A+</option> <option <?=$dx220[15]?> value=300000>A+</option>
<option <?=$dx220[16];?> value=340000>S</option> <option <?=$dx220[16]?> value=340000>S</option>
<option <?=$dx220[17];?> value=382500>SS</option> <option <?=$dx220[17]?> value=382500>SS</option>
<option <?=$dx220[18];?> value=427500>SSS</option> <option <?=$dx220[18]?> value=427500>SSS</option>
</select> </select>
<select name=dex230 size=1> <select name=dex230 size=1>
<option <?=$dx230[0];?> value=0>F</option> <option <?=$dx230[0]?> value=0>F</option>
<option <?=$dx230[1];?> value=2500>E-</option> <option <?=$dx230[1]?> value=2500>E-</option>
<option <?=$dx230[2];?> value=7500>E</option> <option <?=$dx230[2]?> value=7500>E</option>
<option <?=$dx230[3];?> value=15000>E+</option> <option <?=$dx230[3]?> value=15000>E+</option>
<option <?=$dx230[4];?> value=25000>D-</option> <option <?=$dx230[4]?> value=25000>D-</option>
<option <?=$dx230[5];?> value=37500>D</option> <option <?=$dx230[5]?> value=37500>D</option>
<option <?=$dx230[6];?> value=52500>D+</option> <option <?=$dx230[6]?> value=52500>D+</option>
<option <?=$dx230[7];?> value=70000>C-</option> <option <?=$dx230[7]?> value=70000>C-</option>
<option <?=$dx230[8];?> value=90000>C</option> <option <?=$dx230[8]?> value=90000>C</option>
<option <?=$dx230[9];?> value=112500>C+</option> <option <?=$dx230[9]?> value=112500>C+</option>
<option <?=$dx230[10];?> value=137500>B-</option> <option <?=$dx230[10]?> value=137500>B-</option>
<option <?=$dx230[11];?> value=165000>B</option> <option <?=$dx230[11]?> value=165000>B</option>
<option <?=$dx230[12];?> value=195000>B+</option> <option <?=$dx230[12]?> value=195000>B+</option>
<option <?=$dx230[13];?> value=227500>A-</option> <option <?=$dx230[13]?> value=227500>A-</option>
<option <?=$dx230[14];?> value=262500>A</option> <option <?=$dx230[14]?> value=262500>A</option>
<option <?=$dx230[15];?> value=300000>A+</option> <option <?=$dx230[15]?> value=300000>A+</option>
<option <?=$dx230[16];?> value=340000>S</option> <option <?=$dx230[16]?> value=340000>S</option>
<option <?=$dx230[17];?> value=382500>SS</option> <option <?=$dx230[17]?> value=382500>SS</option>
<option <?=$dx230[18];?> value=427500>SSS</option> <option <?=$dx230[18]?> value=427500>SSS</option>
</select> </select>
<select name=dex240 size=1> <select name=dex240 size=1>
<option <?=$dx240[0];?> value=0>F</option> <option <?=$dx240[0]?> value=0>F</option>
<option <?=$dx240[1];?> value=2500>E-</option> <option <?=$dx240[1]?> value=2500>E-</option>
<option <?=$dx240[2];?> value=7500>E</option> <option <?=$dx240[2]?> value=7500>E</option>
<option <?=$dx240[3];?> value=15000>E+</option> <option <?=$dx240[3]?> value=15000>E+</option>
<option <?=$dx240[4];?> value=25000>D-</option> <option <?=$dx240[4]?> value=25000>D-</option>
<option <?=$dx240[5];?> value=37500>D</option> <option <?=$dx240[5]?> value=37500>D</option>
<option <?=$dx240[6];?> value=52500>D+</option> <option <?=$dx240[6]?> value=52500>D+</option>
<option <?=$dx240[7];?> value=70000>C-</option> <option <?=$dx240[7]?> value=70000>C-</option>
<option <?=$dx240[8];?> value=90000>C</option> <option <?=$dx240[8]?> value=90000>C</option>
<option <?=$dx240[9];?> value=112500>C+</option> <option <?=$dx240[9]?> value=112500>C+</option>
<option <?=$dx240[10];?> value=137500>B-</option> <option <?=$dx240[10]?> value=137500>B-</option>
<option <?=$dx240[11];?> value=165000>B</option> <option <?=$dx240[11]?> value=165000>B</option>
<option <?=$dx240[12];?> value=195000>B+</option> <option <?=$dx240[12]?> value=195000>B+</option>
<option <?=$dx240[13];?> value=227500>A-</option> <option <?=$dx240[13]?> value=227500>A-</option>
<option <?=$dx240[14];?> value=262500>A</option> <option <?=$dx240[14]?> value=262500>A</option>
<option <?=$dx240[15];?> value=300000>A+</option> <option <?=$dx240[15]?> value=300000>A+</option>
<option <?=$dx240[16];?> value=340000>S</option> <option <?=$dx240[16]?> value=340000>S</option>
<option <?=$dx240[17];?> value=382500>SS</option> <option <?=$dx240[17]?> value=382500>SS</option>
<option <?=$dx240[18];?> value=427500>SSS</option> <option <?=$dx240[18]?> value=427500>SSS</option>
</select> </select>
</td> </td>
<td>-</td> <td>-</td>
@@ -1529,11 +1567,11 @@ input { background-color:black;color:white; }
<td>-</td> <td>-</td>
<td> <td>
<input type=submit name=isgen value=장수공격> <input type=submit name=isgen value=장수공격>
<?='<input type=submit name=isgen value=장수평균>';?> <?='<input type=submit name=isgen value=장수평균>'?>
</td> </td>
<td> <td>
<input type=submit name=isgen value=성벽공격> <input type=submit name=isgen value=성벽공격>
<?='<input type=submit name=isgen value=성벽평균>';?> <?='<input type=submit name=isgen value=성벽평균>'?>
</td> </td>
</tr> </tr>
<tr><td colspan=3> <tr><td colspan=3>
@@ -1605,7 +1643,7 @@ function printSimul($game, $i) {
$ric = $game["ric{$i}"]; $ric = $game["ric{$i}"];
echo " echo "
<tr> <tr>
<td align=right>".getTypename($i)."</td> <td align=right>".GameUnitConst::byId($i)->name."</td>
<td align=center>$att</td> <td align=center>$att</td>
<td align=center>$def</td> <td align=center>$def</td>
<td align=center>$spd</td> <td align=center>$spd</td>
+109 -62
View File
@@ -3,21 +3,33 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
$btn = Util::getReq('btn');
extractMissingPostToGlobals();
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
increaseRefresh("명장일람", 2); increaseRefresh("명장일람", 2);
$query = "select conlimit from game limit 1"; $query = "select conlimit from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$query = "select con,turntime from general where owner='{$_SESSION['userID']}'"; $query = "select con,turntime from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
$con = checkLimit($me['con'], $admin['conlimit']); $con = checkLimit($me['con'], $admin['conlimit']);
if($con >= 2) { printLimitMsg($me['turntime']); exit(); } if ($con >= 2) {
printLimitMsg($me['turntime']);
exit();
}
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
@@ -25,7 +37,8 @@ if($con >= 2) { printLimitMsg($me['turntime']); exit(); }
<head> <head>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<title>명장일람</title> <title>명장일람</title>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
@@ -43,13 +56,16 @@ if($con >= 2) { printLimitMsg($me['turntime']); exit(); }
</table> </table>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<?php <?php
if(isset($btn) && $btn == "NPC 보기") { if (isset($btn) && $btn == "NPC 보기") {
//FIXME: query가 너무 적나라.
$sel = "npc>=2"; $sel = "npc>=2";
} else { } else {
$sel = "npc<2"; $sel = "npc<2";
} }
foreach(getAllNationStaticInfo() as $nation){ $nationName = ['재야'];
$nationColor = ['#000000'];
foreach (getAllNationStaticInfo() as $nation) {
$nationName[$nation['nation']] = $nation['name']; $nationName[$nation['nation']] = $nation['name'];
$nationColor[$nation['nation']] = $nation['color']; $nationColor[$nation['nation']] = $nation['color'];
} }
@@ -77,8 +93,15 @@ $type = array(
"베 팅 수 익 금", "베 팅 수 익 금",
"베 팅 수 익 률" "베 팅 수 익 률"
); );
for($i=0; $i < 21; $i++) {
switch($i) {
for ($i=0; $i < 21; $i++) {
$name = [];
$data = [];
$color = [];
$pic = [];
switch ($i) {
case 0: $query = "select nation,no,name,picture,imgsvr,experience as data from general where $sel order by data desc limit 0,10"; break; case 0: $query = "select nation,no,name,picture,imgsvr,experience as data from general where $sel order by data desc limit 0,10"; break;
case 1: $query = "select nation,no,name,picture,imgsvr,dedication as data from general where $sel order by data desc limit 0,10"; break; case 1: $query = "select nation,no,name,picture,imgsvr,dedication as data from general where $sel order by data desc limit 0,10"; break;
case 2: $query = "select nation,no,name,picture,imgsvr,firenum as data from general where $sel order by data desc limit 0,10"; break; case 2: $query = "select nation,no,name,picture,imgsvr,firenum as data from general where $sel order by data desc limit 0,10"; break;
@@ -101,65 +124,76 @@ for($i=0; $i < 21; $i++) {
case 19: $query = "select nation,no,name,picture,imgsvr,betwingold as data from general where $sel order by data desc limit 0,10"; break; case 19: $query = "select nation,no,name,picture,imgsvr,betwingold as data from general where $sel order by data desc limit 0,10"; break;
case 20: $query = "select nation,no,name,picture,imgsvr,betwingold/betgold*10000 as data from general where $sel and betgold >= 1000 order by data desc limit 0,10"; break; case 20: $query = "select nation,no,name,picture,imgsvr,betwingold/betgold*10000 as data from general where $sel and betgold >= 1000 order by data desc limit 0,10"; break;
} }
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
echo " echo "
<tr><td align=center colspan=10 id=bg1><font size=4>$type[$i]</font></td></tr> <tr><td align=center colspan=10 id=bg1><font size=4>$type[$i]</font></td></tr>
<tr align=center id=bg2><td>1위</td><td>2위</td><td>3위</td><td>4위</td><td>5위</td><td>6위</td><td>7위</td><td>8위</td><td>9위</td><td>10위</td></tr> <tr align=center id=bg2><td>1위</td><td>2위</td><td>3위</td><td>4위</td><td>5위</td><td>6위</td><td>7위</td><td>8위</td><td>9위</td><td>10위</td></tr>
<tr>"; <tr>";
for($k=0; $k < 10; $k++) { for ($k=0; $k < 10; $k++) {
$gen = MYDB_fetch_array($result); $gen = MYDB_fetch_array($result);
if($i != 2) { if ($i != 2) {
if(isset($gen)) { if (isset($gen)) {
$name[$k] = $gen['name']; $name[$k] = $gen['name'];
$nation[$k] = $gen['nation'] == 0 ? "재야" : $nationName[$gen['nation']]; $nation[$k] = $nationName[$gen['nation']];
$data[$k] = $gen['data']; $data[$k] = $gen['data'];
$color[$k] = $gen['nation'] == 0 ? "#FFFFFF" : $nationColor[$gen['nation']]; $color[$k] = $nationColor[$gen['nation']];
$pic[$k] = $gen['picture']; $pic[$k] = $gen['picture'];
}else{ } else {
$name[$k] = "-"; $name[$k] = "-";
$nation[$k] = "-"; $nation[$k] = "-";
$data[$k] = "-"; $data[$k] = "-";
$color[$k] = $_basecolor4; $color[$k] = GameConst::$basecolor4;
$pic[$k] = ""; $pic[$k] = "";
} }
} else { } else {
$name[$k] = "???"; $name[$k] = "???";
$nation[$k] = "???"; $nation[$k] = "???";
$data[$k] = $gen['data']; $data[$k] = $gen['data'];
$color[$k] = $_basecolor4; $color[$k] = GameConst::$basecolor4;
$gen['imgsvr'] = 0; $gen['imgsvr'] = 0;
$pic[$k] = "9999.jpg"; $pic[$k] = "9999.jpg";
} }
if($color[$k] == "") $color[$k] = $_basecolor4; if ($color[$k] == "") {
if($nation[$k] == "") $nation[$k] = "&nbsp;"; $color[$k] = GameConst::$basecolor4;
if($pic[$k] == "") { }
if ($nation[$k] == "") {
$nation[$k] = "&nbsp;";
}
if ($pic[$k] == "") {
echo "<td align=center>&nbsp;</td>"; echo "<td align=center>&nbsp;</td>";
} else { } else {
$imageTemp = GetImageURL($gen['imgsvr']); $imageTemp = GetImageURL($gen['imgsvr']);
echo "<td align=center><img src={$imageTemp}/{$pic[$k]}></img></td>"; echo "<td align=center><img width='64' height='64' src={$imageTemp}/{$pic[$k]}></td>";
} }
} }
echo "</tr><tr>"; echo "</tr><tr>";
for($k=0; $k < 10; $k++) { for ($k=0; $k < 10; $k++) {
echo "<td align=center style=background-color:{$color[$k]};color:".newColor($color[$k]).">{$nation[$k]}</td>"; echo "<td align=center style=background-color:{$color[$k]};color:".newColor($color[$k]).">{$nation[$k]}</td>";
} }
echo "</tr><tr>"; echo "</tr><tr>";
for($k=0; $k < 10; $k++) { for ($k=0; $k < 10; $k++) {
echo "<td align=center style=background-color:{$color[$k]};color:".newColor($color[$k]).">{$name[$k]}</td>"; echo "<td align=center style=background-color:{$color[$k]};color:".newColor($color[$k]).">{$name[$k]}</td>";
} }
echo "</tr><tr>"; echo "</tr><tr>";
for($k=0; $k < 10; $k++) { for ($k=0; $k < 10; $k++) {
if($i == 5 || $i == 7 || $i == 20) { $data[$k] = floor($data[$k]/100).".".($data[$k]%100)." %"; } if($data[$k] === '-'){
if($i >= 13 && $i <= 16) { $data[$k] = floor($data[$k]/100).".".($data[$k]%100)." %"; } //do Nothing
}
else if ($i == 5 || $i == 7 || $i == 20) {
$data[$k] = intdiv($data[$k], 100).".".($data[$k]%100)." %";
}
else if ($i >= 13 && $i <= 16) {
$data[$k] = intdiv($data[$k], 100).".".($data[$k]%100)." %";
}
echo "<td align=center>{$data[$k]}</td>"; echo "<td align=center>{$data[$k]}</td>";
} }
echo "</tr><tr><td colspan=10 height=5 id=bg1></td></tr>"; echo "</tr><tr><td colspan=10 height=5 id=bg1></td></tr>";
@@ -186,57 +220,66 @@ $call = array(
); );
$func = array( $func = array(
"getHorseName", "\\sammo\\getHorseName",
"getWeapName", "\\sammo\\getWeapName",
"getBookName", "\\sammo\\getBookName",
"getItemName" "\\sammo\\getItemName"
); );
for($i=0; $i < 4; $i++) { for ($i=0; $i < 4; $i++) {
$name = [];
$data = [];
$color = [];
$pic = [];
echo " echo "
<tr><td align=center colspan=10 id=bg1><font size=4>$type[$i]</font></td></tr> <tr><td align=center colspan=10 id=bg1><font size=4>$type[$i]</font></td></tr>
<tr align=center id=bg2>"; <tr align=center id=bg2>";
for($k=26; $k > 16; $k--) { for ($k=26; $k > 16; $k--) {
$str = $func[$i]($k); $str = $func[$i]($k);
echo "<td>".$str."</td>"; echo "<td>".$str."</td>";
} }
echo "</tr><tr>"; echo "</tr><tr>";
for($k=26; $k > 16; $k--) { for ($k=26; $k > 16; $k--) {
$query = "select nation,no,name,picture,imgsvr from general where {$call[$i]}={$k}"; $query = "select nation,no,name,picture,imgsvr from general where {$call[$i]}={$k}";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$gen = MYDB_fetch_array($result); $gen = MYDB_fetch_array($result);
if(isset($gen)) { if (isset($gen)) {
$name[$k] = $gen['name']; $name[$k] = $gen['name'];
$nation[$k] = $gen['nation'] == 0 ? "재야" : $nationName[$gen['nation']]; $nation[$k] = $nationName[$gen['nation']];
$color[$k] = $gen['nation'] == 0 ? "#FFFFFF" : $nationColor[$gen['nation']]; $color[$k] = $nationColor[$gen['nation']];
$pic[$k] = $gen['picture']; $pic[$k] = $gen['picture'];
}else{ } else {
$name[$k] = "미발견"; $name[$k] = "미발견";
$nation[$k] = "-"; $nation[$k] = "-";
$color[$k] = ""; $color[$k] = "";
$pic[$k] = ""; $pic[$k] = "";
} }
if($color[$k] == "") $color[$k] = $_basecolor4; if ($color[$k] == "") {
if($nation[$k] == "") $nation[$k] = "&nbsp;"; $color[$k] = GameConst::$basecolor4;
if($pic[$k] == "") { }
if ($nation[$k] == "") {
$nation[$k] = "&nbsp;";
}
if ($pic[$k] == "") {
echo "<td align=center>&nbsp;</td>"; echo "<td align=center>&nbsp;</td>";
} else { } else {
$imageTemp = GetImageURL($gen['imgsvr']); $imageTemp = GetImageURL($gen['imgsvr']??0);
echo "<td align=center><img src={$imageTemp}/{$pic[$k]}></img></td>"; echo "<td align=center><img width='64' height='64' src={$imageTemp}/{$pic[$k]}></img></td>";
} }
} }
echo "</tr><tr>"; echo "</tr><tr>";
for($k=26; $k > 16; $k--) { for ($k=26; $k > 16; $k--) {
echo "<td align=center style=background-color:{$color[$k]};color:".newColor($color[$k]).">{$nation[$k]}</td>"; echo "<td align=center style=background-color:{$color[$k]};color:".newColor($color[$k]).">{$nation[$k]}</td>";
} }
echo "</tr><tr>"; echo "</tr><tr>";
for($k=26; $k > 16; $k--) { for ($k=26; $k > 16; $k--) {
echo "<td align=center style=background-color:{$color[$k]};color:".newColor($color[$k]).">{$name[$k]}</td>"; echo "<td align=center style=background-color:{$color[$k]};color:".newColor($color[$k]).">{$name[$k]}</td>";
} }
@@ -244,47 +287,51 @@ for($i=0; $i < 4; $i++) {
echo " echo "
<tr align=center id=bg2>"; <tr align=center id=bg2>";
for($k=16; $k > 6; $k--) { for ($k=16; $k > 6; $k--) {
$str = $func[$i]($k); $str = $func[$i]($k);
echo "<td>".$str."</td>"; echo "<td>".$str."</td>";
} }
echo "</tr><tr>"; echo "</tr><tr>";
for($k=16; $k > 6; $k--) { for ($k=16; $k > 6; $k--) {
$query = "select nation,no,name,picture,imgsvr from general where {$call[$i]}={$k}"; $query = "select nation,no,name,picture,imgsvr from general where {$call[$i]}={$k}";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$gen = MYDB_fetch_array($result); $gen = MYDB_fetch_array($result);
if(isset($gen)) { if (isset($gen)) {
$name[$k] = $gen['name']; $name[$k] = $gen['name'];
$nation[$k] = $gen['nation'] == 0 ? "재야" : $nationName[$gen['nation']]; $nation[$k] = $nationName[$gen['nation']];
$color[$k] = $gen['nation'] == 0 ? "#FFFFFF" : $nationColor[$gen['nation']]; $color[$k] = $nationColor[$gen['nation']];
$pic[$k] = $gen['picture']; $pic[$k] = $gen['picture'];
}else{ } else {
$name[$k] = "미발견"; $name[$k] = "미발견";
$nation[$k] = "-"; $nation[$k] = "-";
$color[$k] = ""; $color[$k] = "";
$pic[$k] = ""; $pic[$k] = "";
} }
if($color[$k] == "") $color[$k] = $_basecolor4; if ($color[$k] == "") {
if($nation[$k] == "") $nation[$k] = "&nbsp;"; $color[$k] = GameConst::$basecolor4;
if($pic[$k] == "") { }
if ($nation[$k] == "") {
$nation[$k] = "&nbsp;";
}
if ($pic[$k] == "") {
echo "<td align=center>&nbsp;</td>"; echo "<td align=center>&nbsp;</td>";
} else { } else {
$imageTemp = GetImageURL($gen['imgsvr']); $imageTemp = GetImageURL($gen['imgsvr']??0);
echo "<td align=center><img src={$imageTemp}/{$pic[$k]}></img></td>"; echo "<td align=center><img width='64' height='64' src={$imageTemp}/{$pic[$k]}></img></td>";
} }
} }
echo "</tr><tr>"; echo "</tr><tr>";
for($k=16; $k > 6; $k--) { for ($k=16; $k > 6; $k--) {
echo "<td align=center style=background-color:{$color[$k]};color:".newColor($color[$k]).">{$nation[$k]}</td>"; echo "<td align=center style=background-color:{$color[$k]};color:".newColor($color[$k]).">{$nation[$k]}</td>";
} }
echo "</tr><tr>"; echo "</tr><tr>";
for($k=16; $k > 6; $k--) { for ($k=16; $k > 6; $k--) {
echo "<td align=center style=background-color:{$color[$k]};color:".newColor($color[$k]).">{$name[$k]}</td>"; echo "<td align=center style=background-color:{$color[$k]};color:".newColor($color[$k]).">{$name[$k]}</td>";
} }
+14 -8
View File
@@ -3,7 +3,14 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
$connect = dbConn();
$select = Util::getReq('select', 'int', 0);
extractMissingPostToGlobals();
$db = DB::db();
$connect=$db->get();
increaseRefresh("왕조일람", 2); increaseRefresh("왕조일람", 2);
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
@@ -12,7 +19,8 @@ increaseRefresh("왕조일람", 2);
<head> <head>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<title>왕조일람</title> <title>왕조일람</title>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
@@ -25,12 +33,12 @@ increaseRefresh("왕조일람", 2);
<?php <?php
if($select == 0) { if ($select == 0) {
$query = "select * from emperior order by no desc"; $query = "select * from emperior order by no desc";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$empcount = MYDB_num_rows($result); $empcount = MYDB_num_rows($result);
for($i=0; $i < $empcount; $i++) { for ($i=0; $i < $empcount; $i++) {
$emperior = MYDB_fetch_array($result); $emperior = MYDB_fetch_array($result);
echo " echo "
@@ -73,11 +81,9 @@ if($select == 0) {
} }
} else { } else {
$query = "select * from emperior where no='$select'"; $query = "select * from emperior where no='$select'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$emperior = MYDB_fetch_array($result); $emperior = MYDB_fetch_array($result);
//background={$image}/{$emperior['l12pic']}
echo " echo "
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style='font-size:13px;word-break:break-all;color:white;' id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style='font-size:13px;word-break:break-all;color:white;' id=bg0>
<tr> <tr>
+14 -8
View File
@@ -3,7 +3,14 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
$connect = dbConn();
$select = Util::getReq('select', 'int', 0);
extractMissingPostToGlobals();
$db = DB::db();
$connect=$db->get();
increaseRefresh("왕조일람", 2); increaseRefresh("왕조일람", 2);
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
@@ -12,7 +19,8 @@ increaseRefresh("왕조일람", 2);
<head> <head>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<title>왕조일람</title> <title>왕조일람</title>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
@@ -25,12 +33,12 @@ increaseRefresh("왕조일람", 2);
<?php <?php
if($select == 0) { if ($select == 0) {
$query = "select * from emperior_table order by no desc"; $query = "select * from emperior_table order by no desc";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$empcount = MYDB_num_rows($result); $empcount = MYDB_num_rows($result);
for($i=0; $i < $empcount; $i++) { for ($i=0; $i < $empcount; $i++) {
$emperior = MYDB_fetch_array($result); $emperior = MYDB_fetch_array($result);
echo " echo "
@@ -73,11 +81,9 @@ if($select == 0) {
} }
} else { } else {
$query = "select * from emperior_table where no='$select'"; $query = "select * from emperior_table where no='$select'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$emperior = MYDB_fetch_array($result); $emperior = MYDB_fetch_array($result);
//background={$image}/{$emperior['l12pic']}
echo " echo "
<form action=a_emperior2.php method=post> <form action=a_emperior2.php method=post>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
+50 -28
View File
@@ -3,23 +3,35 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
$type = Util::getReq('type', 'int', 9);
extractMissingPostToGlobals();
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
increaseRefresh("장수일람", 2); increaseRefresh("장수일람", 2);
$query = "select conlimit from game limit 1"; $query = "select conlimit from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$query = "select con,turntime from general where owner='{$_SESSION['userID']}'"; $query = "select con,turntime from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
$con = checkLimit($me['con'], $admin['conlimit']); $con = checkLimit($me['con'], $admin['conlimit']);
if($con >= 2) { printLimitMsg($me['turntime']); exit(); } if ($con >= 2) {
printLimitMsg($me['turntime']);
exit();
}
if(!isset($type) || $type == 0) { if ($type <= 0 || $type > 15) {
$type = 9; $type = 9;
} }
@@ -30,8 +42,9 @@ if(!isset($type) || $type == 0) {
<head> <head>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<title>장수일람</title> <title>장수일람</title>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<script type="text/javascript" src=<?="../e_lib/jquery-3.2.1.min.js";?>></script> <link rel='stylesheet' href='css/common.css' type='text/css'>
<script type="text/javascript" src="../e_lib/jquery-3.2.1.min.js"></script>
</head> </head>
@@ -60,13 +73,15 @@ if(!isset($type) || $type == 0) {
</td></tr> </td></tr>
</table> </table>
<?php <?php
$nationname = [];
$nationlevel = [];
$nationname[0] = "-"; $nationname[0] = "-";
foreach(getAllNationStaticInfo() as $nation){ foreach (getAllNationStaticInfo() as $nation) {
$nationname[$nation['nation']] = $nation['name']; $nationname[$nation['nation']] = $nation['name'];
$nationlevel[$nation['nation']] = $nation['level']; $nationlevel[$nation['nation']] = $nation['level'];
} }
switch($type) { switch ($type) { //FIXME: $query 처리 조심.
case 1: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by nation"; break; case 1: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by nation"; break;
case 2: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by leader desc"; break; case 2: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by leader desc"; break;
case 3: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by power desc"; break; case 3: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by power desc"; break;
@@ -75,6 +90,7 @@ switch($type) {
case 6: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by dedication desc"; break; case 6: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by dedication desc"; break;
case 7: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by level desc"; break; case 7: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by level desc"; break;
case 8: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by killturn"; break; case 8: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by killturn"; break;
default:
case 9: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by connect desc"; break; case 9: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by connect desc"; break;
case 10: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by experience desc"; break; case 10: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by experience desc"; break;
case 11: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by personal"; break; case 11: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by personal"; break;
@@ -83,7 +99,7 @@ switch($type) {
case 14: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by age desc"; break; case 14: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by age desc"; break;
case 15: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by npc desc"; break; case 15: $query = "select picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leader,power,intel,experience,dedication,level,killturn,connect from general order by npc desc"; break;
} }
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$gencount = MYDB_num_rows($genresult); $gencount = MYDB_num_rows($genresult);
echo" echo"
@@ -105,27 +121,27 @@ echo"
<td width=45 align=center id=bg1>삭턴</td> <td width=45 align=center id=bg1>삭턴</td>
<td width=84 align=center id=bg1>벌점</td> <td width=84 align=center id=bg1>벌점</td>
</tr>"; </tr>";
for($j=0; $j < $gencount; $j++) { for ($j=0; $j < $gencount; $j++) {
$general = MYDB_fetch_array($genresult); $general = MYDB_fetch_array($genresult);
$nation = $nationname[$general['nation']]; $nation = $nationname[$general['nation']];
if($general['level'] == 12) { if ($general['level'] == 12) {
$lbonus = $nationlevel[$general['nation']] * 2; $lbonus = $nationlevel[$general['nation']] * 2;
} elseif($general['level'] >= 5) { } elseif ($general['level'] >= 5) {
$lbonus = $nationlevel[$general['nation']]; $lbonus = $nationlevel[$general['nation']];
} else { } else {
$lbonus = 0; $lbonus = 0;
} }
if($lbonus > 0) { if ($lbonus > 0) {
$lbonus = "<font color=cyan>+{$lbonus}</font>"; $lbonus = "<font color=cyan>+{$lbonus}</font>";
} else { } else {
$lbonus = ""; $lbonus = "";
} }
if($general['injury'] > 0) { if ($general['injury'] > 0) {
$leader = floor($general['leader'] * (100 - $general['injury'])/100); $leader = intdiv($general['leader'] * (100 - $general['injury']), 100);
$power = floor($general['power'] * (100 - $general['injury'])/100); $power = intdiv($general['power'] * (100 - $general['injury']), 100);
$intel = floor($general['intel'] * (100 - $general['injury'])/100); $intel = intdiv($general['intel'] * (100 - $general['injury']), 100);
$leader = "<font color=red>{$leader}</font>{$lbonus}"; $leader = "<font color=red>{$leader}</font>{$lbonus}";
$power = "<font color=red>{$power}</font>"; $power = "<font color=red>{$power}</font>";
$intel = "<font color=red>{$intel}</font>"; $intel = "<font color=red>{$intel}</font>";
@@ -135,16 +151,20 @@ for($j=0; $j < $gencount; $j++) {
$intel = "{$general['intel']}"; $intel = "{$general['intel']}";
} }
if($general['npc'] >= 2) { $name = "<font color=cyan>{$general['name']}</font>"; } if ($general['npc'] >= 2) {
elseif($general['npc'] == 1) { $name = "<font color=skyblue>{$general['name']}</font>"; } $name = "<font color=cyan>{$general['name']}</font>";
else { $name = "{$general['name']}"; } } elseif ($general['npc'] == 1) {
$name = "<font color=skyblue>{$general['name']}</font>";
} else {
$name = "{$general['name']}";
}
$general['connect'] = round($general['connect'] / 10, 0) * 10; $general['connect'] = Util::round($general['connect'] / 10) * 10;
$imageTemp = GetImageURL($general['imgsvr']); $imageTemp = GetImageURL($general['imgsvr']);
echo " echo "
<tr> <tr>
<td align=center><img src={$imageTemp}/{$general['picture']}></img></td> <td align=center><img width='64' height='64' src={$imageTemp}/{$general['picture']}></img></td>
<td align=center>$name</td> <td align=center>$name</td>
<td align=center>{$general['age']}세</td> <td align=center>{$general['age']}세</td>
<td align=center>".getGenChar($general['personal'])."</td> <td align=center>".getGenChar($general['personal'])."</td>
@@ -153,19 +173,21 @@ for($j=0; $j < $gencount; $j++) {
<td align=center>{$nation}</td> <td align=center>{$nation}</td>
<td align=center>".getHonor($general['experience'])."</td> <td align=center>".getHonor($general['experience'])."</td>
<td align=center>".getDed($general['dedication'])."</td> <td align=center>".getDed($general['dedication'])."</td>
<td align=center>"; echo getLevel($general['level']); echo "</td> <td align=center>";
echo getLevel($general['level']);
echo "</td>
<td align=center>$leader</td> <td align=center>$leader</td>
<td align=center>$power</td> <td align=center>$power</td>
<td align=center>$intel</td> <td align=center>$intel</td>
<td align=center>{$general['killturn']}</td> <td align=center>{$general['killturn']}</td>
<td align=center>{$general['connect']}"; echo "<br>【".getConnect($general['connect'])."】</td> <td align=center>{$general['connect']}";
echo "<br>【".getConnect($general['connect'])."】</td>
</tr>"; </tr>";
} }
echo " echo "
</table> </table>
"; ";
MYDB_close($connect);
?> ?>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
+39 -21
View File
@@ -3,7 +3,10 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
$connect = dbConn();
$db = DB::db();
$connect=$db->get();
increaseRefresh("명예의전당", 2); increaseRefresh("명예의전당", 2);
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
@@ -12,12 +15,13 @@ increaseRefresh("명예의전당", 2);
<head> <head>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<title>명예의 전당</title> <title>명예의 전당</title>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
<body> <body>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=Font-size:13;word-break:break-all; id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=Font-size:13px;word-break:break-all; id=bg0>
<tr><td>명 예 의 전 당<br><?=closeButton()?></td></tr> <tr><td>명 예 의 전 당<br><?=closeButton()?></td></tr>
</table> </table>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
@@ -45,58 +49,72 @@ $type = array(
"베 팅 수 익 금", "베 팅 수 익 금",
"베 팅 수 익 률" "베 팅 수 익 률"
); );
for($i=0; $i < 21; $i++) { for ($i=0; $i < 21; $i++) {
$name = [];
$nation = [];
$data = [];
$color = [];
$pic = [];
$query = "select * from hall where type={$i} order by rank"; $query = "select * from hall where type={$i} order by rank";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
echo " echo "
<tr><td align=center colspan=10 id=bg1><font size=4>$type[$i]</font></td></tr> <tr><td align=center colspan=10 id=bg1><font size=4>$type[$i]</font></td></tr>
<tr align=center id=bg2><td>1위</td><td>2위</td><td>3위</td><td>4위</td><td>5위</td><td>6위</td><td>7위</td><td>8위</td><td>9위</td><td>10위</td></tr> <tr align=center id=bg2><td>1위</td><td>2위</td><td>3위</td><td>4위</td><td>5위</td><td>6위</td><td>7위</td><td>8위</td><td>9위</td><td>10위</td></tr>
<tr>"; <tr>";
for($k=0; $k < 10; $k++) { for ($k=0; $k < 10; $k++) {
$gen = MYDB_fetch_array($result); $gen = MYDB_fetch_array($result);
$name[$k] = $gen['name']; $name[$k] = $gen['name'];
$nation[$k] = $gen['nation']; $nation[$k] = $gen['nation'];
$data[$k] = $gen['data']; $data[$k] = $gen['data'];
$color[$k] = $gen['color']; $color[$k] = $gen['color'];
$pic[$k] = $gen['picture']; $pic[$k] = $gen['picture'];
if($color[$k] == "") $color[$k] = $_basecolor4; if ($color[$k] == "") {
if($nation[$k] == "") $nation[$k] = "&nbsp;"; $color[$k] = GameConst::$basecolor4;
/*
if($pic[$k] == "") {
echo "<td align=center>&nbsp;</td>";
} else {
$imageTemp = GetImageURL($gen['imgsvr']);
echo "<td align=center><img src={$imageTemp}/{$pic[$k]}></img></td>";
} }
*/ if ($nation[$k] == "") {
$nation[$k] = "&nbsp;";
}
/*
if($pic[$k] == "") {
echo "<td align=center>&nbsp;</td>";
} else {
$imageTemp = GetImageURL($gen['imgsvr']);
echo "<td align=center><img width='64' height='64' src={$imageTemp}/{$pic[$k]}></img></td>";
}
*/
} }
// echo "</tr><tr>"; // echo "</tr><tr>";
for($k=0; $k < 10; $k++) { for ($k=0; $k < 10; $k++) {
echo "<td align=center style=background-color:{$color[$k]};color:".newColor($color[$k]).">{$nation[$k]}</td>"; echo "<td align=center style=background-color:{$color[$k]};color:".newColor($color[$k]).">{$nation[$k]}</td>";
} }
echo "</tr><tr>"; echo "</tr><tr>";
for($k=0; $k < 10; $k++) { for ($k=0; $k < 10; $k++) {
echo "<td align=center style=background-color:{$color[$k]};color:".newColor($color[$k]).">{$name[$k]}</td>"; echo "<td align=center style=background-color:{$color[$k]};color:".newColor($color[$k]).">{$name[$k]}</td>";
} }
echo "</tr><tr>"; echo "</tr><tr>";
for($k=0; $k < 10; $k++) { for ($k=0; $k < 10; $k++) {
if($i == 5 || $i == 7 || $i == 20) { $data[$k] = floor($data[$k]/100).".".($data[$k]%100)." %"; } if ($i == 5 || $i == 7 || $i == 20) {
if($i >= 13 && $i <= 16) { $data[$k] = floor($data[$k]/100).".".($data[$k]%100)." %"; } $data[$k] = intdiv($data[$k], 100).".".($data[$k]%100)." %";
}
if ($i >= 13 && $i <= 16) {
$data[$k] = intdiv($data[$k], 100).".".($data[$k]%100)." %";
}
echo "<td align=center>{$data[$k]}</td>"; echo "<td align=center>{$data[$k]}</td>";
} }
echo "</tr><tr><td colspan=10 height=5 id=bg1></td></tr>"; echo "</tr><tr><td colspan=10 height=5 id=bg1></td></tr>";
} }
?> ?>
</table> </table>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=Font-size:13;word-break:break-all; id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr><td><?=closeButton()?></td></tr> <tr><td><?=closeButton()?></td></tr>
<tr><td><?=banner()?> </td></tr> <tr><td><?=banner()?> </td></tr>
</table> </table>
+61 -32
View File
@@ -3,54 +3,70 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
$yearmonth = $_POST['yearmonth']; $btn = Util::getReq('btn');
$yearmonth = Util::getReq('yearmonth', 'int');
extractMissingPostToGlobals();
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
increaseRefresh("연감", 5); increaseRefresh("연감", 5);
$query = "select startyear,year,month,conlimit from game limit 1"; $query = "select startyear,year,month,conlimit from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$query = "select map,con,turntime from general where owner='{$_SESSION['userID']}'"; $query = "select map,con,turntime from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
$con = checkLimit($me['con'], $admin['conlimit']); $con = checkLimit($me['con'], $admin['conlimit']);
if($con >= 2) { printLimitMsg($me['turntime']); exit(); } if ($con >= 2) {
printLimitMsg($me['turntime']);
exit();
}
$query = "select year,month from history order by no limit 1"; $query = "select year,month from history order by no limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$history = MYDB_fetch_array($result); $history = MYDB_fetch_array($result);
$s = ($history['year']*12) + $history['month']; $s = ($history['year']*12) + $history['month'];
$query = "select year,month from history order by no desc limit 1"; $query = "select year,month from history order by no desc limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$history = MYDB_fetch_array($result); $history = MYDB_fetch_array($result);
$e = ($history['year']*12) + $history['month']; $e = ($history['year']*12) + $history['month'];
if(!$yearmonth) { //FIXME: $yearmonth가 올바르지 않을 경우에 처리가 필요.
if (!$yearmonth) {
$year = $admin['year']; $year = $admin['year'];
$month = $admin['month'] - 1; $month = $admin['month'] - 1;
} else { } else {
$year = substr($yearmonth, 0, 3) - 0; $year = intdiv($yearmonth, 100);
$month = substr($yearmonth, 3, 2) - 0; $month = $yearmonth % 100;
if($btn == "◀◀ 이전달") { if ($btn == "◀◀ 이전달") {
$month -= 1; $month -= 1;
} elseif($btn == "다음달 ▶▶") { } elseif ($btn == "다음달 ▶▶") {
$month += 1; $month += 1;
} }
} }
$now = ($year*12) + $month; $now = ($year*12) + $month;
if($now < $s) { $now = $s; } if ($now < $s) {
if($now > $e) { $now = $e; } $now = $s;
}
if ($now > $e) {
$now = $e;
}
$year = floor($now / 12); $year = intdiv($now, 12);
$month = $now % 12; $month = $now % 12;
if($month <= 0) { if ($month <= 0) {
$year -= 1; $year -= 1;
$month += 12; $month += 12;
} }
@@ -62,7 +78,15 @@ if($month <= 0) {
<head> <head>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<title>연감</title> <title>연감</title>
<link rel=stylesheet href=css/common.css type=text/css> <script src="../e_lib/jquery-3.2.1.min.js"></script>
<script src="../d_shared/common_path.js"></script>
<script src="js/common.js"></script>
<script src="js/base_map.js"></script>
<script src="js/map.js"></script>
<link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
<link href="css/map.css" rel="stylesheet">
</head> </head>
@@ -76,12 +100,12 @@ if($month <= 0) {
<select name=yearmonth size=1> <select name=yearmonth size=1>
<?php <?php
$query = "select year,month from history"; $query = "select year,month from history";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$histCount = MYDB_num_rows($result); $histCount = MYDB_num_rows($result);
for($i=0; $i < $histCount; $i++) { for ($i=0; $i < $histCount; $i++) {
$history = MYDB_fetch_array($result); $history = MYDB_fetch_array($result);
$value = "".$history['year'].StringUtil::Fill2($history['month'], 2, "0"); $value = "".$history['year'].StringUtil::padStringAlignRight($history['month'], 2, "0");
if($history['year'] == $year && $history['month'] == $month) { if ($history['year'] == $year && $history['month'] == $month) {
echo " echo "
<option selected value={$value}>{$history['year']}년 {$history['month']}월</option>"; <option selected value={$value}>{$history['year']}년 {$history['month']}월</option>";
} else { } else {
@@ -91,7 +115,7 @@ for($i=0; $i < $histCount; $i++) {
} }
$query = "select log,genlog,nation,power,gen,city from history where year='$year' and month='$month'"; $query = "select log,genlog,nation,power,gen,city from history where year='$year' and month='$month'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$history = MYDB_fetch_array($result); $history = MYDB_fetch_array($result);
?> ?>
</select> </select>
@@ -104,13 +128,12 @@ $history = MYDB_fetch_array($result);
<tr><td colspan=5 align=center id=bg1>중 원 지 도</td></tr> <tr><td colspan=5 align=center id=bg1>중 원 지 도</td></tr>
<tr height=520> <tr height=520>
<td width=698> <td width=698>
<iframe src='map_history.php?year=<?=$year;?>&month=<?=$month;?>' width=698 height=520 frameborder=0 marginwidth=0 marginheight=0 topmargin=0 scrolling=no> <?=getMapHtml();?>
</iframe>
</td> <td width=98 valign=top><?=$history['nation']?></td>
<td width=98 valign=top><?=$history['nation'];?></td> <td width=78 valign=top><?=$history['power']?></td>
<td width=78 valign=top><?=$history['power'];?></td> <td width=58 valign=top><?=$history['gen']?></td>
<td width=58 valign=top><?=$history['gen'];?></td> <td width=58 valign=top><?=$history['city']?></td>
<td width=58 valign=top><?=$history['city'];?></td>
</tr> </tr>
<tr><td colspan=5 align=center id=bg1>중 원 정 세</td></tr> <tr><td colspan=5 align=center id=bg1>중 원 정 세</td></tr>
<tr> <tr>
@@ -129,7 +152,13 @@ $history = MYDB_fetch_array($result);
<tr><td><?=closeButton()?></td></tr> <tr><td><?=closeButton()?></td></tr>
<tr><td><?=banner()?> </td></tr> <tr><td><?=banner()?> </td></tr>
</table> </table>
<script>
reloadWorldMap({
targetJson:'j_map_history.php?year=<?=$year?>&month=<?=$month?>',
showMe:false,
neutralView:true
});
</script>
<?php PrintElapsedTime(); ?> <?php PrintElapsedTime(); ?>
</body> </body>
</html> </html>
+9 -4
View File
@@ -4,15 +4,19 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
increaseRefresh("세력일람", 2); increaseRefresh("세력일람", 2);
$query = "select conlimit from game limit 1"; $query = "select conlimit from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$query = "select con,turntime from general where owner='{$_SESSION['userID']}'"; $query = "select con,turntime from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
@@ -25,7 +29,8 @@ if($con >= 2) { printLimitMsg($me['turntime']); exit(); }
<head> <head>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<title>세력일람</title> <title>세력일람</title>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
+35 -20
View File
@@ -3,12 +3,21 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
$connect = dbConn();
increaseRefresh("빙의일람", 2);
if($type == 0) { $type = Util::getReq('type', 'int', 1);
extractMissingPostToGlobals();
if($type <= 0 || $type > 8){
$type = 1; $type = 1;
} }
$db = DB::db();
$connect=$db->get();
increaseRefresh("빙의일람", 2);
$sel = [];
$sel[$type] = "selected"; $sel[$type] = "selected";
?> ?>
@@ -18,7 +27,8 @@ $sel[$type] = "selected";
<head> <head>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<title>빙의일람</title> <title>빙의일람</title>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
@@ -27,25 +37,27 @@ $sel[$type] = "selected";
<tr><td>빙 의 일 람<br><?=closeButton()?></td></tr> <tr><td>빙 의 일 람<br><?=closeButton()?></td></tr>
<tr><td><form name=form1 method=post>정렬순서 : <tr><td><form name=form1 method=post>정렬순서 :
<select name=type size=1> <select name=type size=1>
<option <?=$sel[1];?> value=1>이름</option> <option <?=$sel[1]??''?> value=1>이름</option>
<option <?=$sel[2];?> value=2>국가</option> <option <?=$sel[2]??''?> value=2>국가</option>
<option <?=$sel[3];?> value=3>종능</option> <option <?=$sel[3]??''?> value=3>종능</option>
<option <?=$sel[4];?> value=4>통솔</option> <option <?=$sel[4]??''?> value=4>통솔</option>
<option <?=$sel[5];?> value=5>무력</option> <option <?=$sel[5]??''?> value=5>무력</option>
<option <?=$sel[6];?> value=6>지력</option> <option <?=$sel[6]??''?> value=6>지력</option>
<option <?=$sel[7];?> value=7>명성</option> <option <?=$sel[7]??''?> value=7>명성</option>
<option <?=$sel[8];?> value=8>계급</option> <option <?=$sel[8]??''?> value=8>계급</option>
</select> </select>
<input type=submit value='정렬하기'></form> <input type=submit value='정렬하기'></form>
</td></tr> </td></tr>
</table> </table>
<?php <?php
$nationname = [];
$nationname[0] = "-"; $nationname[0] = "-";
foreach(getAllNationStaticInfo() as $nation){ foreach (getAllNationStaticInfo() as $nation) {
$nationname[$nation['nation']] = $nation['name']; $nationname[$nation['nation']] = $nation['name'];
} }
switch($type) { switch ($type) {//FIXME: $query 처리 부실
default:
case 1: $query = "select npc,nation,name,name2,special,special2,personal,leader,power,intel,leader+power+intel as sum,explevel,experience,dedication from general where npc=1 order by binary(name)"; break; case 1: $query = "select npc,nation,name,name2,special,special2,personal,leader,power,intel,leader+power+intel as sum,explevel,experience,dedication from general where npc=1 order by binary(name)"; break;
case 2: $query = "select npc,nation,name,name2,special,special2,personal,leader,power,intel,leader+power+intel as sum,explevel,experience,dedication from general where npc=1 order by nation"; break; case 2: $query = "select npc,nation,name,name2,special,special2,personal,leader,power,intel,leader+power+intel as sum,explevel,experience,dedication from general where npc=1 order by nation"; break;
case 3: $query = "select npc,nation,name,name2,special,special2,personal,leader,power,intel,leader+power+intel as sum,explevel,experience,dedication from general where npc=1 order by sum desc"; break; case 3: $query = "select npc,nation,name,name2,special,special2,personal,leader,power,intel,leader+power+intel as sum,explevel,experience,dedication from general where npc=1 order by sum desc"; break;
@@ -55,7 +67,7 @@ switch($type) {
case 7: $query = "select npc,nation,name,name2,special,special2,personal,leader,power,intel,leader+power+intel as sum,explevel,experience,dedication from general where npc=1 order by experience"; break; case 7: $query = "select npc,nation,name,name2,special,special2,personal,leader,power,intel,leader+power+intel as sum,explevel,experience,dedication from general where npc=1 order by experience"; break;
case 8: $query = "select npc,nation,name,name2,special,special2,personal,leader,power,intel,leader+power+intel as sum,explevel,experience,dedication from general where npc=1 order by dedication"; break; case 8: $query = "select npc,nation,name,name2,special,special2,personal,leader,power,intel,leader+power+intel as sum,explevel,experience,dedication from general where npc=1 order by dedication"; break;
} }
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$gencount = MYDB_num_rows($genresult); $gencount = MYDB_num_rows($genresult);
echo" echo"
@@ -74,13 +86,17 @@ echo"
<td width=78 align=center id=bg1>명성</td> <td width=78 align=center id=bg1>명성</td>
<td width=78 align=center id=bg1>계급</td> <td width=78 align=center id=bg1>계급</td>
</tr>"; </tr>";
for($j=0; $j < $gencount; $j++) { for ($j=0; $j < $gencount; $j++) {
$general = MYDB_fetch_array($genresult); $general = MYDB_fetch_array($genresult);
$nation = $nationname[$general['nation']]; $nation = $nationname[$general['nation']];
if($general['npc'] >= 2) { $name = "<font color=cyan>{$general['name']}</font>"; } if ($general['npc'] >= 2) {
elseif($general['npc'] == 1) { $name = "<font color=skyblue>{$general['name']}</font>"; } $name = "<font color=cyan>{$general['name']}</font>";
else { $name = "{$general['name']}"; } } elseif ($general['npc'] == 1) {
$name = "<font color=skyblue>{$general['name']}</font>";
} else {
$name = "{$general['name']}";
}
echo " echo "
<tr> <tr>
@@ -102,7 +118,6 @@ echo "
</table> </table>
"; ";
MYDB_close($connect);
?> ?>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
+12 -6
View File
@@ -4,16 +4,20 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
increaseRefresh("세력도", 2); increaseRefresh("세력도", 2);
checkTurn($connect); checkTurn();
$query = "select conlimit from game limit 1"; $query = "select conlimit from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$query = "select map,con,turntime from general where owner='{$_SESSION['userID']}'"; $query = "select map,con,turntime from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
@@ -27,6 +31,7 @@ if($con >= 2) { printLimitMsg($me['turntime']); exit(); }
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>세력도</title> <title>세력도</title>
<script src="../e_lib/jquery-3.2.1.min.js"></script> <script src="../e_lib/jquery-3.2.1.min.js"></script>
<script src="../d_shared/common_path.js"></script>
<script src="js/common.js"></script> <script src="js/common.js"></script>
<script src="js/base_map.js"></script> <script src="js/base_map.js"></script>
<script src="js/map.js"></script> <script src="js/map.js"></script>
@@ -40,6 +45,7 @@ $(function(){
}); });
</script> </script>
<link href="../d_shared/common.css" rel="stylesheet">
<link href="css/normalize.css" rel="stylesheet"> <link href="css/normalize.css" rel="stylesheet">
<link href="css/common.css" rel="stylesheet"> <link href="css/common.css" rel="stylesheet">
<link href="css/map.css" rel="stylesheet"> <link href="css/map.css" rel="stylesheet">
@@ -53,7 +59,7 @@ $(function(){
<table align=center width=1200 height=520 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=1200 height=520 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr height=520> <tr height=520>
<td width=498 valign=top> <td width=498 valign=top>
<?php AllLog(34); ?> <?=getGeneralPublicRecordRecent(34)?>
</td> </td>
<td width=698> <td width=698>
<?=getMapHtml()?> <?=getMapHtml()?>
@@ -61,7 +67,7 @@ $(function(){
</tr> </tr>
<tr> <tr>
<td colspan=2 valign=top> <td colspan=2 valign=top>
<?php History(34); ?> <?php getWorldHistoryRecent(34); ?>
</td> </td>
</tr> </tr>
</table> </table>
+109 -73
View File
@@ -3,42 +3,54 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
$connect = dbConn();
$db = DB::db();
$connect=$db->get();
increaseRefresh("갱신정보", 2); increaseRefresh("갱신정보", 2);
$query = "select year,month,refresh,maxrefresh,maxonline from game limit 1"; $query = "select year,month,refresh,maxrefresh,maxonline from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$game = MYDB_fetch_array($result); $game = MYDB_fetch_array($result);
$fp = @fopen("logs/_traffic.txt", "r"); $log = getRawFileLogRecent(__dir__.'/logs/_traffic.txt', 11, 100);
@fseek($fp, -1000, SEEK_END);
$file = @fread($fp, 1000); $date = [];
@fclose($fp); $year = [];
$log = explode("\n",$file); $month = [];
$str = ""; $refresh = [];
for($i=0; $i < $count; $i++) { $str .= ConvertLog($log[count($log)-2-$i])."<br>"; } $online = [];
echo $str;
$curonline = getOnlineNum(); $curonline = getOnlineNum();
for($i=0; $i < 11; $i++) { $visibleLogs = min(11, count($log));
$parse = explode("|", $log[count($log)-12+$i]); for ($i=0; $i < $visibleLogs; $i++) {
$parse = explode("|", $log[count($log)-$visibleLogs+$i]);
$date[$i] = trim($parse[0]); $date[$i] = trim($parse[0]);
$year[$i] = trim($parse[1]); $year[$i] = trim($parse[1]);
$month[$i] = trim($parse[2]); $month[$i] = trim($parse[2]);
$refresh[$i] = trim($parse[3]); $refresh[$i] = trim($parse[3]);
$online[$i] = trim($parse[4]); $online[$i] = trim($parse[4]);
} }
if($game['maxrefresh'] == 0) { $game['maxrefresh'] = 1; } if ($game['maxrefresh'] == 0) {
if($game['maxrefresh'] < $game['refresh']) { $game['maxrefresh'] = $game['refresh']; } $game['maxrefresh'] = 1;
if($game['maxonline'] == 0) { $game['maxonline'] = 1; } }
if($game['maxonline'] < $curonline) { $game['maxonline'] = $curonline; } if ($game['maxrefresh'] < $game['refresh']) {
$game['maxrefresh'] = $game['refresh'];
}
if ($game['maxonline'] == 0) {
$game['maxonline'] = 1;
}
if ($game['maxonline'] < $curonline) {
$game['maxonline'] = $curonline;
}
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>트래픽정보</title> <title>트래픽정보</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
<body> <body>
@@ -51,97 +63,119 @@ if($game['maxonline'] < $curonline) { $game['maxonline'] = $curonline; }
<table align=center border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr><td colspan=4 align=center id=bg2><font size=5>접 속 량</font></td></tr> <tr><td colspan=4 align=center id=bg2><font size=5>접 속 량</font></td></tr>
<?php <?php
for($i=0; $i < 11; $i++) { for ($i=0; $i < $visibleLogs; $i++) {
$w = round($refresh[$i] / $game['maxrefresh'] * 100, 1); $w = round($refresh[$i] / $game['maxrefresh'] * 100, 1);
if($w >= 100) { $w -= 0.1; } if ($w >= 100) {
if($refresh[$i] < 10 && $w < 3) { $w = 3; } $w -= 0.1;
elseif($refresh[$i] < 100 && $w < 6) { $w = 6; } }
elseif($refresh[$i] < 1000 && $w < 9) { $w = 9; } if ($refresh[$i] < 10 && $w < 3) {
$w = 3;
} elseif ($refresh[$i] < 100 && $w < 6) {
$w = 6;
} elseif ($refresh[$i] < 1000 && $w < 9) {
$w = 9;
}
$w2 = round(100 - $w, 1); $w2 = round(100 - $w, 1);
$color = getColor($w); $color = getTrafficColor($w);
$dt = substr($date[$i], 11, 5); $dt = substr($date[$i], 11, 5); ?>
echo "
<tr height=30> <tr height=30>
<td width=100 align=center>{$year[$i]}년 {$month[$i]}월</td> <td width=100 align=center><?=$year[$i]?>년 <?=$month[$i]?>월</td>
<td width=60 align=center id=bg2>{$dt}</td> <td width=60 align=center id=bg2><?=$dt?></td>
<td width=2 align=center id=bg1></td> <td width=2 align=center id=bg1></td>
<td width=320 align=center> <td width=320 align=center>
<table align=center width=100% height=30 border=0 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=100% height=30 border=0 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr> <tr>
<td width={$w}% bgcolor={$color} align=right>{$refresh[$i]}&nbsp;</td> <td width=<?=$w?>% bgcolor=<?=$color?> align=right><?=$refresh[$i]?>&nbsp;</td>
<td width={$w2}% id=bg0><font size=1>&nbsp;</font></td> <td width=<?=$w2?>% id=bg0><font size=1>&nbsp;</font></td>
</tr> </tr>
</table> </table>
</td> </td>
</tr> </tr>
"; <?php
} }
$w = round($game['refresh'] / $game['maxrefresh'] * 100, 1); $w = round($game['refresh'] / $game['maxrefresh'] * 100, 1);
if($w >= 100) { $w -= 0.1; } if ($w >= 100) {
if($game['refresh'] < 10 && $w < 3) { $w = 3; } $w -= 0.1;
elseif($game['refresh'] < 100 && $w < 6) { $w = 6; } }
elseif($game['refresh'] < 1000 && $w < 9) { $w = 9; } if ($game['refresh'] < 10 && $w < 3) {
$w = 3;
} elseif ($game['refresh'] < 100 && $w < 6) {
$w = 6;
} elseif ($game['refresh'] < 1000 && $w < 9) {
$w = 9;
}
$w2 = round(100 - $w, 1); $w2 = round(100 - $w, 1);
$color = getColor($w); $color = getTrafficColor($w);
$dt = date('H:i'); $dt = date('H:i');
echo " ?>
<tr height=30> <tr height=30>
<td width=100 align=center>{$game['year']}년 {$game['month']}월</td> <td width=100 align=center><?=$game['year']?>년 <?=$game['month']?>월</td>
<td width=60 align=center id=bg2>{$dt}</td> <td width=60 align=center id=bg2><?=$dt?></td>
<td width=2 align=center id=bg1></td> <td width=2 align=center id=bg1></td>
<td width=320 align=center> <td width=320 align=center>
<table align=center width=100% height=30 border=0 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=100% height=30 border=0 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr> <tr>
<td width={$w}% bgcolor={$color} align=right>{$game['refresh']}&nbsp;</td> <td width=<?=$w?>% bgcolor=<?=$color?> align=right><?=$game['refresh']?>&nbsp;</td>
<td width={$w2}% id=bg0><font size=1>&nbsp;</font></td> <td width=<?=$w2?>% id=bg0><font size=1>&nbsp;</font></td>
</tr> </tr>
</table> </table>
</td> </td>
</tr> </tr>
<tr><td colspan=4 height=5 align=center id=bg1></td></tr> <tr><td colspan=4 height=5 align=center id=bg1></td></tr>
<tr> <tr>
<td colspan=4 height=30 align=center id=bg0>최고기록: {$game['maxrefresh']}</td> <td colspan=4 height=30 align=center id=bg0>최고기록: <?=$game['maxrefresh']?></td>
</tr> </tr>
";
?>
</table> </table>
</td> </td>
<td align=right> <td align=right>
<table align=center border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr><td colspan=4 align=center id=bg2><font size=5>접 속 자</font></td></tr> <tr><td colspan=4 align=center id=bg2><font size=5>접 속 자</font></td></tr>
<?php <?php
for($i=0; $i < 11; $i++) { for ($i=0; $i < $visibleLogs; $i++) {
$w = round($online[$i] / $game['maxonline'] * 100, 1); $w = round($online[$i] / $game['maxonline'] * 100, 1);
if($w >= 100) { $w -= 0.1; } if ($w >= 100) {
if($online[$i] < 10 && $w < 3) { $w = 3; } $w -= 0.1;
elseif($online[$i] < 100 && $w < 6) { $w = 6; } }
elseif($online[$i] < 1000 && $w < 9) { $w = 9; } if ($online[$i] < 10 && $w < 3) {
$w = 3;
} elseif ($online[$i] < 100 && $w < 6) {
$w = 6;
} elseif ($online[$i] < 1000 && $w < 9) {
$w = 9;
}
$w2 = round(100 - $w, 1); $w2 = round(100 - $w, 1);
$color = getColor($w); $color = getTrafficColor($w);
$dt = substr($date[$i], 11, 5); $dt = substr($date[$i], 11, 5); ?>
echo "
<tr height=30> <tr height=30>
<td width=100 align=center>{$year[$i]}년 {$month[$i]}월</td> <td width=100 align=center><?=$year[$i]?>년 <?=$month[$i]?>월</td>
<td width=60 align=center id=bg2>{$dt}</td> <td width=60 align=center id=bg2><?=$dt?></td>
<td width=2 align=center id=bg1></td> <td width=2 align=center id=bg1></td>
<td width=320 align=center> <td width=320 align=center>
<table align=center width=100% height=30 border=0 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=100% height=30 border=0 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr> <tr>
<td width={$w}% bgcolor={$color} align=right>{$online[$i]}&nbsp;</td> <td width=<?=$w?>% bgcolor=<?=$color?> align=right><?=$online[$i]?>&nbsp;</td>
<td width={$w2}% id=bg0><font size=1>&nbsp;</font></td> <td width=<?=$w2?>% id=bg0><font size=1>&nbsp;</font></td>
</tr> </tr>
</table> </table>
</td> </td>
</tr> </tr>
"; <?php
} }
$w = round($curonline / $game['maxonline'] * 100, 1); $w = round($curonline / $game['maxonline'] * 100, 1);
if($w >= 100) { $w -= 0.1; } if ($w >= 100) {
if($curonline < 10 && $w < 3) { $w = 3; } $w -= 0.1;
elseif($curonline < 100 && $w < 6) { $w = 6; } }
elseif($curonline < 1000 && $w < 9) { $w = 9; } if ($curonline < 10 && $w < 3) {
$w = 3;
} elseif ($curonline < 100 && $w < 6) {
$w = 6;
} elseif ($curonline < 1000 && $w < 9) {
$w = 9;
}
$w2 = round(100 - $w, 1); $w2 = round(100 - $w, 1);
$color = getColor($w); $color = getTrafficColor($w);
$dt = date('H:i'); $dt = date('H:i');
echo " echo "
<tr height=30> <tr height=30>
@@ -171,14 +205,14 @@ echo "
<tr><td colspan=3 align=center id=bg2><font size=5>주 의 대 상 자 (순간과도갱신)</font></td></tr> <tr><td colspan=3 align=center id=bg2><font size=5>주 의 대 상 자 (순간과도갱신)</font></td></tr>
<?php <?php
$query = "select sum(refresh) as refresh,sum(connect) as connect from general"; $query = "select sum(refresh) as refresh,sum(connect) as connect from general";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$user = MYDB_fetch_array($result); $user = MYDB_fetch_array($result);
$user['connect'] = round($user['connect'], 1); $user['connect'] = round($user['connect'], 1);
$maxrefresh = $user['refresh']; $maxrefresh = $user['refresh'];
$w = round($maxrefresh / $maxrefresh * 100, 1); $w = round($maxrefresh / $maxrefresh * 100, 1);
$w2 = round(100 - $w, 1); $w2 = round(100 - $w, 1);
$color = getColor($w); $color = getTrafficColor($w);
echo " echo "
<tr id=bg2> <tr id=bg2>
<td width=98 align=center>주의대상자</td> <td width=98 align=center>주의대상자</td>
@@ -200,14 +234,14 @@ echo "
"; ";
$query = "select name,refresh,connect from general order by refresh desc limit 0,5"; $query = "select name,refresh,connect from general order by refresh desc limit 0,5";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$count = MYDB_num_rows($result); $count = MYDB_num_rows($result);
for($i=0; $i < $count; $i++) { for ($i=0; $i < $count; $i++) {
$user = MYDB_fetch_array($result); $user = MYDB_fetch_array($result);
$w = round($user['refresh'] / $maxrefresh * 100, 1); $w = round($user['refresh'] / $maxrefresh * 100, 1);
$w2 = round(100 - $w, 1); $w2 = round(100 - $w, 1);
$color = getColor($w); $color = getTrafficColor($w);
echo " echo "
<tr> <tr>
<td width=98 align=center>{$user['name']}</td> <td width=98 align=center>{$user['name']}</td>
@@ -235,26 +269,28 @@ for($i=0; $i < $count; $i++) {
</html> </html>
<?php <?php
function getColor($per) { function getTrafficColor($per)
{
$r = getHex($per); $r = getHex($per);
$b = getHex(100 - $per); $b = getHex(100 - $per);
$color = $r . "00" . $b; $color = $r . "00" . $b;
return $color; return $color;
} }
function getHex($dec) { function getHex($dec)
$hex = floor($dec * 255 / 100); {
$code = getHexCode(floor($hex / 16)); $hex = intdiv($dec * 255, 100);
$code = getHexCode(intdiv($hex, 16));
$code .= getHexCode($hex % 16); $code .= getHexCode($hex % 16);
return $code; return $code;
} }
function getHexCode($hex) { function getHexCode($hex)
switch($hex) { {
switch ($hex) {
case 0: return "0"; case 1: return "1"; case 2: return "2"; case 3: return "3"; case 0: return "0"; case 1: return "1"; case 2: return "2"; case 3: return "3";
case 4: return "4"; case 5: return "5"; case 6: return "6"; case 7: return "7"; case 4: return "4"; case 5: return "5"; case 6: return "6"; case 7: return "7";
case 8: return "8"; case 9: return "9"; case 10: return "A"; case 11: return "B"; case 8: return "8"; case 9: return "9"; case 10: return "A"; case 11: return "B";
case 12: return "C"; case 13: return "D"; case 14: return "E"; case 15: return "F"; case 12: return "C"; case 13: return "D"; case 14: return "E"; case 15: return "F";
} }
} }
+94 -65
View File
@@ -3,19 +3,24 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
$connect = dbConn();
$session = Session::requireGameLogin()->setReadOnly();
$userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
increaseRefresh("설문조사", 1); increaseRefresh("설문조사", 1);
$query = "select no,vote from general where owner='{$_SESSION['userID']}'"; $query = "select no,vote from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
$query = "select develcost,voteopen,vote,votecomment from game limit 1"; $query = "select develcost,voteopen,vote,votecomment from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$vote = explode("|", $admin['vote']); $vote = explode("|", $admin['vote']);
if($vote[0] == "") { if ($vote[0] == "") {
$vote[0] = "-"; $vote[0] = "-";
} }
@@ -25,7 +30,8 @@ if($vote[0] == "") {
<head> <head>
<title>설문조사</title> <title>설문조사</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
<script type="text/javascript"> <script type="text/javascript">
function captureKey(e) { function captureKey(e) {
if(e.keyCode == 13 && e.srcElement.type == 'text') { if(e.keyCode == 13 && e.srcElement.type == 'text') {
@@ -43,15 +49,15 @@ function captureKey(e) {
</table> </table>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<form name=form1 action=c_vote.php method=post> <form name=form1 action=c_vote.php method=post>
<tr><td colspan=3 align=center id=bg2><font size=5>설 문 조 사 (<?=$admin['develcost']*5;?>금과 추첨으로 유니크템 증정!)</font></td></tr> <tr><td colspan=3 align=center id=bg2><font size=5>설 문 조 사 (<?=$admin['develcost']*5?>금과 추첨으로 유니크템 증정!)</font></td></tr>
<?php <?php
if(Session::getUserGrade() >= 5) { if ($session->userGrade >= 5) {
echo " echo "
<tr> <tr>
<td width=48 align=center><input type=submit name=btn value='알림'></td> <td width=48 align=center><input type=submit name=btn value='알림'></td>
<td width=98 align=center><input type=submit name=btn value='수정'></td> <td width=98 align=center><input type=submit name=btn value='수정'></td>
<td width=848 align=left><input type=text name=title style=width:848;></td> <td width=848 align=left><input type=text name=title style=width:848px;></td>
</tr> </tr>
"; ";
} }
@@ -65,29 +71,29 @@ echo "
"; ";
$query = "select no from general where vote>0 and npc<2"; $query = "select no from general where vote>0 and npc<2";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$voteCount = MYDB_num_rows($result); $voteCount = MYDB_num_rows($result);
$query = "select no from general where npc<2"; $query = "select no from general where npc<2";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$allCount = MYDB_num_rows($result); $allCount = MYDB_num_rows($result);
$percentage = round($voteCount / $allCount * 100, 1); $percentage = round($voteCount / $allCount * 100, 1);
$voteTypeCount = count($vote); $voteTypeCount = count($vote);
for($i=1; $i < $voteTypeCount; $i++) { for ($i=1; $i < $voteTypeCount; $i++) {
echo " echo "
<tr> <tr>
<td width=48 align=center style=color:".getNewColor($i)."; bgcolor=".getColor($i).">{$i}.</td> <td width=48 align=center style=color:".getNewColor($i)."; bgcolor=".getVoteColor($i).">{$i}.</td>
<td width=98 align=center> <td width=98 align=center>
"; ";
if($me['vote'] == 0 && $me['no'] > 0) { if ($me['vote'] == 0 && $me['no'] > 0) {
echo " echo "
<input type=radio name=sel value={$i}> <input type=radio name=sel value={$i}>
"; ";
} elseif($admin['voteopen'] >= 1 || Session::getUserGrade() >= 5) { } elseif ($admin['voteopen'] >= 1 || $session->userGrade >= 5) {
$query = "select no from general where vote='{$i}'"; $query = "select no from general where vote='{$i}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$vCount = MYDB_num_rows($result); $vCount = MYDB_num_rows($result);
$per = @round($vCount / $voteCount * 100, 1); $per = @round($vCount / $voteCount * 100, 1);
@@ -106,7 +112,7 @@ for($i=1; $i < $voteTypeCount; $i++) {
echo " echo "
<tr> <tr>
"; ";
if($me['vote'] == 0 && $me['no'] > 0) { if ($me['vote'] == 0 && $me['no'] > 0) {
echo " echo "
<td align=center>투표</td> <td align=center>투표</td>
<td align=center><input type=submit name=btn value='투표'></td> <td align=center><input type=submit name=btn value='투표'></td>
@@ -121,17 +127,17 @@ echo "
</tr> </tr>
"; ";
if(Session::getUserGrade() >= 5) { if ($session->userGrade >= 5) {
echo " echo "
<tr> <tr>
<td align=center><input type=submit name=btn value='리셋'></td> <td align=center><input type=submit name=btn value='리셋'></td>
<td align=center><input type=submit name=btn value='추가'></td> <td align=center><input type=submit name=btn value='추가'></td>
<td align=left><input type=text name=str style=width:848;></td> <td align=left><input type=text name=str style=width:848px;></td>
</tr> </tr>
"; ";
} }
if($admin['votecomment'] != "") { if ($admin['votecomment'] != "") {
$comment = explode("|", $admin['votecomment']); $comment = explode("|", $admin['votecomment']);
$commentCount = count($comment); $commentCount = count($comment);
} else { } else {
@@ -144,7 +150,7 @@ echo "
<td colspan=4 align=center id=bg1>댓 글</td> <td colspan=4 align=center id=bg1>댓 글</td>
</tr> </tr>
"; ";
for($i=0; $i < $commentCount; $i++) { for ($i=0; $i < $commentCount; $i++) {
$cmt = explode(":", $comment[$i]); $cmt = explode(":", $comment[$i]);
$cmt[2] = Tag2Code($cmt[2]); $cmt[2] = Tag2Code($cmt[2]);
$j = $i+1; $j = $i+1;
@@ -157,12 +163,12 @@ for($i=0; $i < $commentCount; $i++) {
</tr> </tr>
"; ";
} }
if($me['no'] > 0) { if ($me['no'] > 0) {
echo " echo "
<tr> <tr>
<td width=108 colspan=2 align=center>-</td> <td width=108 colspan=2 align=center>-</td>
<td width=83 align=center><input type=submit name=btn value='댓글'></td> <td width=83 align=center><input type=submit name=btn value='댓글'></td>
<td align=left><input type=text name=comment maxlength=60 style=width:798; onkeydown='return captureKey(event)'></td> <td align=left><input type=text name=comment maxlength=60 style=width:798px; onkeydown='return captureKey(event)'></td>
</tr> </tr>
"; ";
} }
@@ -173,7 +179,7 @@ if($me['no'] > 0) {
<tr><td colspan=3 align=center id=bg2><font size=5> <tr><td colspan=3 align=center id=bg2><font size=5>
전 체 통 계 전 체 통 계
<?php <?php
if(Session::getUserGrade() >= 5) { if ($session->userGrade >= 5) {
echo " echo "
<input type=submit name=btn value='숨김'> <input type=submit name=btn value='숨김'>
<input type=submit name=btn value='전체통계만'> <input type=submit name=btn value='전체통계만'>
@@ -182,7 +188,7 @@ if(Session::getUserGrade() >= 5) {
echo " echo "
</font></td></tr>"; </font></td></tr>";
if($admin['voteopen'] >= 1 || Session::getUserGrade() >= 5) { if ($admin['voteopen'] >= 1 || $session->userGrade >= 5) {
echo " echo "
<tr> <tr>
<td width=98 align=center>전 체</td> <td width=98 align=center>전 체</td>
@@ -192,26 +198,43 @@ if($admin['voteopen'] >= 1 || Session::getUserGrade() >= 5) {
<tr> <tr>
"; ";
$query = "select no from general where npc<2"; $memCount = $db->queryFirstField('SELECT count(`no`) FROM general WHERE npc<2');
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); if ($memCount == 0) {
$memCount = MYDB_num_rows($result); $memCount = 1;
$query = "select nation,vote from general where npc<2";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$count = MYDB_num_rows($result);
for($i=0; $i < $count; $i++) {
$vote = MYDB_fetch_array($result);
$totalVote[$vote['vote']]++;
if($vote['vote'] > 0) { $nationVoteCount[$vote['nation']]++; }
$nationVote[$vote['nation']][$vote['vote']]++;
} }
for($i=0; $i < $voteTypeCount; $i++) { $totalVote = [];
$per = @round($totalVote[$i] / $memCount * 100, 1); $nationVoteCount = [[0]];
$nationVote = [[]];
foreach ($db->query("SELECT nation, vote, count(`no`) as cnt FROM general WHERE npc<2 GROUP BY nation, vote") as $row) {
$nation = $row['nation'];
$vote = $row['vote'];
$cnt = $row['cnt'];
if (!isset($totalVote[$vote])) {
$totalVote[$vote] = 0;
}
if (!isset($nationVoteCount[$nation])) {
$nationVoteCount[$nation] = 0;
$nationVote[$nation] = [];
}
if (!isset($nationVote[$nation][$vote])) {
$nationVote[$nation][$vote] = 0;
}
$totalVote[$vote] += $cnt;
$nationVoteCount[$nation] += $cnt;
$nationVote[$nation][$vote] += $cnt;
}
for ($i=0; $i < $voteTypeCount; $i++) {
$per = round(($totalVote[$i]??0) / $memCount * 100, 1);
// if($per < 5) { $vote['cnt'] = "&nbsp;"; } // if($per < 5) { $vote['cnt'] = "&nbsp;"; }
echo " echo "
<td width={$per}% align=center style=color:".getNewColor($i)."; bgcolor=".getColor($i).">{$totalVote[$i]}</td> <td width={$per}% align=center style=color:".getNewColor($i)."; bgcolor=".getVoteColor($i).">{$totalVote[$i]}</td>
"; ";
} }
@@ -223,13 +246,18 @@ if($admin['voteopen'] >= 1 || Session::getUserGrade() >= 5) {
"; ";
} }
if($admin['voteopen'] >= 2 || Session::getUserGrade() >= 5) { if ($admin['voteopen'] >= 2 || $session->userGrade >= 5) {
$query = "select no from general where nation=0 and npc<2"; $query = "select no from general where nation=0 and npc<2";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$memCount = MYDB_num_rows($result); $memCount = MYDB_num_rows($result);
if ($memCount == 0) {
$memCount = 1;
}
if(!$nationVoteCount[0]) { $nationVoteCount[0] = 0; } if (!isset($nationVoteCount[0])) {
$percentage = @round($nationVoteCount[0] / $memCount * 100, 1); $nationVoteCount[0] = 0;
}
$percentage = round($nationVoteCount[0] / $memCount * 100, 1);
echo " echo "
<tr> <tr>
@@ -240,11 +268,11 @@ if($admin['voteopen'] >= 2 || Session::getUserGrade() >= 5) {
<tr> <tr>
"; ";
for($i=0; $i < $voteTypeCount; $i++) { for ($i=0; $i < $voteTypeCount; $i++) {
$per = @round($nationVote[0][$i] / $memCount * 100, 1); $per = round(Util::array_get($nationVote[0][$i], 0) / $memCount * 100, 1);
// if($per < 5) { $vote['cnt'] = "&nbsp;"; } // if($per < 5) { $vote['cnt'] = "&nbsp;"; }
echo " echo "
<td width={$per}% align=center style=color:".getNewColor($i)."; bgcolor=".getColor($i).">{$nationVote[0][$i]}</td> <td width={$per}% align=center style=color:".getNewColor($i)."; bgcolor=".getVoteColor($i).">{$nationVote[0][$i]}</td>
"; ";
} }
@@ -256,32 +284,32 @@ if($admin['voteopen'] >= 2 || Session::getUserGrade() >= 5) {
"; ";
$query = "select nation,color,name,gennum from nation order by gennum desc"; $query = "select nation,color,name,gennum from nation order by gennum desc";
$nationResult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $nationResult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$nationcount = MYDB_num_rows($nationResult); $nationcount = MYDB_num_rows($nationResult);
for($i=0; $i < $nationcount; $i++) { for ($i=0; $i < $nationcount; $i++) {
$nation = MYDB_fetch_array($nationResult); $nation = MYDB_fetch_array($nationResult);
$query = "select no from general where nation='{$nation['nation']}' and npc<2"; $query = "select no from general where nation='{$nation['nation']}' and npc<2";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$memCount = MYDB_num_rows($result); $memCount = MYDB_num_rows($result);
if(!$nationVoteCount[$nation['nation']]) { $nationVoteCount[$nation['nation']] = 0; } $voteCount = $nationVoteCount[$nation['nation']] ?? 0;
$percentage = @round($nationVoteCount[$nation['nation']] / $memCount * 100, 1); $percentage = round($voteCount / $memCount * 100, 1);
echo " echo "
<tr> <tr>
<td align=center style=color:".newColor($nation['color'])."; bgcolor={$nation['color']}>{$nation['name']}</td> <td align=center style=color:".newColor($nation['color'])."; bgcolor={$nation['color']}>{$nation['name']}</td>
<td align=center>{$nationVoteCount[$nation['nation']]} / {$memCount} ({$percentage} %)</td> <td align=center>{$voteCount} / {$memCount} ({$percentage} %)</td>
<td align=center> <td align=center>
<table align=center width=100% height=100% border=0 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=100% height=100% border=0 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr> <tr>
"; ";
for($k=0; $k < $voteTypeCount; $k++) { for ($k=0; $k < $voteTypeCount; $k++) {
$per = @round($nationVote[$nation['nation']][$k] / $memCount * 100, 1); $per = round($nationVote[$nation['nation']][$k] / $memCount * 100, 1);
// if($per < 5) { $vote['cnt'] = "&nbsp;"; } // if($per < 5) { $vote['cnt'] = "&nbsp;"; }
echo " echo "
<td width={$per}% align=center style=color:".getNewColor($k)."; bgcolor=".getColor($k).">{$nationVote[$nation['nation']][$k]}</td> <td width={$per}% align=center style=color:".getNewColor($k)."; bgcolor=".getVoteColor($k).">{$nationVote[$nation['nation']][$k]}</td>
"; ";
} }
@@ -305,12 +333,14 @@ if($admin['voteopen'] >= 2 || Session::getUserGrade() >= 5) {
</html> </html>
<?php <?php
function getColor($type) { function getVoteColor($type)
if($type > 0) { {
if ($type > 0) {
$type = (($type - 1) % 7) + 1; $type = (($type - 1) % 7) + 1;
} }
switch($type) { switch ($type) {
default:
case 0: $color = "black"; break; case 0: $color = "black"; break;
case 1: $color = "red"; break; case 1: $color = "red"; break;
case 2: $color = "orange"; break; case 2: $color = "orange"; break;
@@ -324,12 +354,13 @@ function getColor($type) {
return $color; return $color;
} }
function getNewColor($type) { function getNewColor($type)
if($type > 0) { {
if ($type > 0) {
$type = (($type - 1) % 7) + 1; $type = (($type - 1) % 7) + 1;
} }
switch($type) { switch ($type) {
case 2: $color = "black"; break; case 2: $color = "black"; break;
case 3: $color = "black"; break; case 3: $color = "black"; break;
default:$color = "white"; break; default:$color = "white"; break;
@@ -337,5 +368,3 @@ function getNewColor($type) {
return $color; return $color;
} }
+83 -37
View File
@@ -3,47 +3,65 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
$msg = Util::getReq('msg');
$msg2 = Util::getReq('msg2');
extractMissingPostToGlobals();
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
increaseRefresh("거래장", 2); increaseRefresh("거래장", 2);
$query = "select no,special,con,turntime from general where owner='{$_SESSION['userID']}'"; $query = "select no,special,con,turntime from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
$query = "select conlimit from game limit 1"; $query = "select conlimit from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$con = checkLimit($me['con'], $admin['conlimit']); $con = checkLimit($me['con'], $admin['conlimit']);
if($con >= 2) { printLimitMsg($me['turntime']); exit(); } if ($con >= 2) {
printLimitMsg($me['turntime']);
exit();
}
$query = "select no from auction where no1='{$me['no']}'"; $query = "select no from auction where no1='{$me['no']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$tradeCount = MYDB_num_rows($result); $tradeCount = MYDB_num_rows($result);
$query = "select no from auction where no2='{$me['no']}'"; $query = "select no from auction where no2='{$me['no']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$bidCount = MYDB_num_rows($result); $bidCount = MYDB_num_rows($result);
$btCount = $tradeCount + $bidCount; $btCount = $tradeCount + $bidCount;
if(Session::getUserGrade() >= 5 || ($me['special'] != 30 && $btCount < 1) || ($me['special'] == 30 && $btCount < 3)) { if ($session->userGrade >= 5 || ($me['special'] != 30 && $btCount < 1) || ($me['special'] == 30 && $btCount < 3)) {
$btn = "submit"; $btn = "submit";
} else { } else {
$btn = "hidden"; $btn = "hidden";
} }
if($msg == "") $msg = "-"; if ($msg == "") {
if($msg2 == "") $msg2 = "-"; $msg = "-";
}
if ($msg2 == "") {
$msg2 = "-";
}
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<title>거래장</title> <title>거래장</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
<body> <body>
@@ -69,21 +87,35 @@ if($msg2 == "") $msg2 = "-";
</tr> </tr>
<?php <?php
$query = "select * from auction where type=0 order by expire"; $query = "select * from auction where type=0 order by expire";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$count = MYDB_num_rows($result); $count = MYDB_num_rows($result);
$chk = 0; $chk = 0;
for($i=0; $i < $count; $i++) { for ($i=0; $i < $count; $i++) {
$auction = MYDB_fetch_array($result); $auction = MYDB_fetch_array($result);
$itemname = GetStuffName($auction['stuff']); $itemname = GetStuffName($auction['stuff']);
$radio = ""; $alert = ""; $alert2 = ""; $radio = "";
if($auction['no1'] == $me['no']) { $radio = " disabled"; } $alert = "";
elseif($auction['no2'] > 0 && $auction['amount'] * 2 <= $auction['value'] && $auction['stuff'] == 0) { $radio = " disabled"; $alert = "<font color=red>"; $alert2 = "</font>"; } $alert2 = "";
elseif($auction['no2'] > 0 && $auction['topv'] <= $auction['value']) { $radio = " disabled"; $alert = "<font color=red>"; $alert2 = "</font>"; } if ($auction['no1'] == $me['no']) {
elseif($chk == 0) { $radio = " checked"; $chk = 1; } $radio = " disabled";
} elseif ($auction['no2'] > 0 && $auction['amount'] * 2 <= $auction['value'] && $auction['stuff'] == 0) {
$radio = " disabled";
$alert = "<font color=red>";
$alert2 = "</font>";
} elseif ($auction['no2'] > 0 && $auction['topv'] <= $auction['value']) {
$radio = " disabled";
$alert = "<font color=red>";
$alert2 = "</font>";
} elseif ($chk == 0) {
$radio = " checked";
$chk = 1;
}
$pv = round($auction['value'] * 100 / $auction['amount']) / 100 + 0.001; $pv = round($auction['value'] * 100 / $auction['amount']) / 100 + 0.001;
$pv = substr($pv, 0, 4); $pv = substr((string)$pv, 0, 4);
if($auction['stuff'] != 0) { $pv = '-'; } if ($auction['stuff'] != 0) {
$pv = '-';
}
echo " echo "
<tr align=center> <tr align=center>
<td>{$auction['no']}</td> <td>{$auction['no']}</td>
@@ -103,13 +135,13 @@ for($i=0; $i < $count; $i++) {
?> ?>
<tr height=25> <tr height=25>
<td align=center id=bg1>등록결과</td> <td align=center id=bg1>등록결과</td>
<td colspan=10><?=ConvertLog($msg);?></td> <td colspan=10><?=ConvertLog($msg)?></td>
</tr> </tr>
<tr> <tr>
<td align=center id=bg1>입찰등록</td> <td align=center id=bg1>입찰등록</td>
<td colspan=10> <td colspan=10>
 지불할 금액: <input type=text style=color:white;background-color:black; size=6 maxlength=6 name=value>  지불할 금액: <input type=text style=color:white;background-color:black; size=6 maxlength=6 name=value>
<input type=<?=$btn;?> name=btn value='구매시도' onclick='return confirm("정말 입찰하시겠습니까?");'> <input type=<?=$btn?> name=btn value='구매시도' onclick='return confirm("정말 입찰하시겠습니까?");'>
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -122,7 +154,7 @@ for($i=0; $i < $count; $i++) {
 판매량: <input type=text style=color:white;background-color:black; size=5 maxlength=5 name=amount value=1000>  판매량: <input type=text style=color:white;background-color:black; size=5 maxlength=5 name=amount value=1000>
 시작가: <input type=text style=color:white;background-color:black; size=5 maxlength=5 name=cost value=500>  시작가: <input type=text style=color:white;background-color:black; size=5 maxlength=5 name=cost value=500>
 즉구가: <input type=text style=color:white;background-color:black; size=5 maxlength=5 name=topv value=2000>  즉구가: <input type=text style=color:white;background-color:black; size=5 maxlength=5 name=topv value=2000>
<input type=<?=$btn;?> name=btn value='판매' onclick='return confirm("정말 판매하시겠습니까?");'> <input type=<?=$btn?> name=btn value='판매' onclick='return confirm("정말 판매하시겠습니까?");'>
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -153,21 +185,35 @@ for($i=0; $i < $count; $i++) {
</tr> </tr>
<?php <?php
$query = "select * from auction where type=1 order by expire"; $query = "select * from auction where type=1 order by expire";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$count = MYDB_num_rows($result); $count = MYDB_num_rows($result);
$chk = 0; $chk = 0;
for($i=0; $i < $count; $i++) { for ($i=0; $i < $count; $i++) {
$auction = MYDB_fetch_array($result); $auction = MYDB_fetch_array($result);
$itemname = GetStuffName($auction['stuff']); $itemname = GetStuffName($auction['stuff']);
$radio = ""; $alert = ""; $alert2 = ""; $radio = "";
if($auction['no1'] == $me['no']) { $radio = " disabled"; } $alert = "";
elseif($auction['no2'] > 0 && $auction['amount'] >= $auction['value'] * 2 && $auction['stuff'] == 0) { $radio = " disabled"; $alert = "<font color=red>"; $alert2 = "</font>"; } $alert2 = "";
elseif($auction['no2'] > 0 && $auction['topv'] >= $auction['value']) { $radio = " disabled"; $alert = "<font color=red>"; $alert2 = "</font>"; } if ($auction['no1'] == $me['no']) {
elseif($chk == 0) { $radio = " checked"; $chk = 1; } $radio = " disabled";
} elseif ($auction['no2'] > 0 && $auction['amount'] >= $auction['value'] * 2 && $auction['stuff'] == 0) {
$radio = " disabled";
$alert = "<font color=red>";
$alert2 = "</font>";
} elseif ($auction['no2'] > 0 && $auction['topv'] >= $auction['value']) {
$radio = " disabled";
$alert = "<font color=red>";
$alert2 = "</font>";
} elseif ($chk == 0) {
$radio = " checked";
$chk = 1;
}
$pv = round($auction['value'] * 100 / $auction['amount']) / 100 + 0.001; $pv = round($auction['value'] * 100 / $auction['amount']) / 100 + 0.001;
$pv = substr($pv, 0, 4); $pv = substr((string)$pv, 0, 4);
if($auction['stuff'] != 0) { $pv = '-'; } if ($auction['stuff'] != 0) {
$pv = '-';
}
echo " echo "
<tr align=center> <tr align=center>
<td>{$auction['no']}</td> <td>{$auction['no']}</td>
@@ -187,13 +233,13 @@ for($i=0; $i < $count; $i++) {
?> ?>
<tr height=25> <tr height=25>
<td align=center id=bg1>등록결과</td> <td align=center id=bg1>등록결과</td>
<td colspan=10><?=ConvertLog($msg2);?></td> <td colspan=10><?=ConvertLog($msg2)?></td>
</tr> </tr>
<tr> <tr>
<td align=center id=bg1>입찰등록</td> <td align=center id=bg1>입찰등록</td>
<td colspan=10> <td colspan=10>
 수령할 금액: <input type=text style=color:white;background-color:black; size=6 maxlength=6 name=value>  수령할 금액: <input type=text style=color:white;background-color:black; size=6 maxlength=6 name=value>
<input type=<?=$btn;?> name=btn value='판매시도' onclick='return confirm("정말 입찰하시겠습니까?");'> <input type=<?=$btn?> name=btn value='판매시도' onclick='return confirm("정말 입찰하시겠습니까?");'>
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -206,7 +252,7 @@ for($i=0; $i < $count; $i++) {
 구입량: <input type=text style=color:white;background-color:black; size=5 maxlength=5 name=amount value=1000>  구입량: <input type=text style=color:white;background-color:black; size=5 maxlength=5 name=amount value=1000>
 시작가: <input type=text style=color:white;background-color:black; size=5 maxlength=5 name=cost value=2000>  시작가: <input type=text style=color:white;background-color:black; size=5 maxlength=5 name=cost value=2000>
 즉구가: <input type=text style=color:white;background-color:black; size=5 maxlength=5 name=topv value=500>  즉구가: <input type=text style=color:white;background-color:black; size=5 maxlength=5 name=topv value=500>
<input type=<?=$btn;?> name=btn value='구매' onclick='return confirm("정말 구매하시겠습니까?");'> <input type=<?=$btn?> name=btn value='구매' onclick='return confirm("정말 구매하시겠습니까?");'>
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -222,7 +268,7 @@ for($i=0; $i < $count; $i++) {
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr><td align=center id=bg2><font size=5>최 근 기 록</font></td></tr> <tr><td align=center id=bg2><font size=5>최 근 기 록</font></td></tr>
<tr><td> <tr><td>
<?=AuctionLog(20);?> <?=getAuctionLogRecent(20)?>
</td></tr> </td></tr>
<tr><td align=center id=bg2><font size=5>도 움 말</font></td></tr> <tr><td align=center id=bg2><font size=5>도 움 말</font></td></tr>
<tr><td> <tr><td>
+51 -29
View File
@@ -3,51 +3,71 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
$v = new Validator($_POST + $_GET);
$v->rule('required', 'gen')
->rule('integer', 'gen');
$btn = Util::getReq('btn');
$gen = Util::getReq('gen', 'int', 0);
$type = Util::getReq('type', 'int', 0);
if ($type < 0 || $type > 3) {
$type = 0;
}
extractMissingPostToGlobals();
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
increaseRefresh("감찰부", 2); increaseRefresh("감찰부", 2);
//전투 추진을 위해 갱신 //전투 추진을 위해 갱신
checkTurn($connect); checkTurn();
$query = "select conlimit from game limit 1"; $query = "select conlimit from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$query = "select nation from general where no='$gen'"; $query = "select nation from general where no='$gen'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$general = MYDB_fetch_array($result); $general = MYDB_fetch_array($result);
$query = "select no,nation,level,con,turntime,belong from general where owner='{$_SESSION['userID']}'"; $query = "select no,nation,level,con,turntime,belong from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
$query = "select secretlimit from nation where nation='{$me['nation']}'"; $query = "select secretlimit from nation where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$nation = MYDB_fetch_array($result); $nation = MYDB_fetch_array($result);
$con = checkLimit($me['con'], $admin['conlimit']); $con = checkLimit($me['con'], $admin['conlimit']);
if($con >= 2) { printLimitMsg($me['turntime']); exit(); } if ($con >= 2) {
printLimitMsg($me['turntime']);
exit();
}
//재야인 경우 //재야인 경우
$meLevel = $me['level']; $meLevel = $me['level'];
if($meLevel == 0 || ($meLevel == 1 && $me['belong'] < $nation['secretlimit'])) { if ($meLevel == 0 || ($meLevel == 1 && $me['belong'] < $nation['secretlimit'])) {
echo "수뇌부가 아니거나 사관년도가 부족합니다."; echo "수뇌부가 아니거나 사관년도가 부족합니다.";
exit(); exit();
} }
//잘못된 접근 //잘못된 접근
if($general['nation'] != $me['nation']) { if ($general['nation'] != $me['nation']) {
$gen = 0; $gen = 0;
} }
if($btn == '정렬하기') { if ($btn == '정렬하기') {
$gen = 0; $gen = 0;
} }
if($type == 0) { $sel = [];
$type = 0;
}
$sel[$type] = "selected"; $sel[$type] = "selected";
?> ?>
@@ -57,7 +77,8 @@ $sel[$type] = "selected";
<head> <head>
<title>감찰부</title> <title>감찰부</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
@@ -68,31 +89,32 @@ $sel[$type] = "selected";
<form name=form1 method=post> <form name=form1 method=post>
정렬순서 : 정렬순서 :
<select name=type size=1> <select name=type size=1>
<option <?=$sel[0];?> value=0>최근턴</option> <option <?=$sel[0]??''?> value=0>최근턴</option>
<option <?=$sel[1];?> value=1>최근전투</option> <option <?=$sel[1]??''?> value=1>최근전투</option>
<option <?=$sel[2];?> value=2>장수명</option> <option <?=$sel[2]??''?> value=2>장수명</option>
<option <?=$sel[3];?> value=3>전투수</option> <option <?=$sel[3]??''?> value=3>전투수</option>
</select> </select>
<input type=submit name=btn value='정렬하기'> <input type=submit name=btn value='정렬하기'>
대상장수 : 대상장수 :
<select name=gen size=1> <select name=gen size=1>
<?php <?php
switch($type) { switch ($type) {
default:
case 0: $query = "select no,name from general where nation='{$me['nation']}' order by turntime desc"; break; case 0: $query = "select no,name from general where nation='{$me['nation']}' order by turntime desc"; break;
case 1: $query = "select no,name from general where nation='{$me['nation']}' order by recwar desc"; break; case 1: $query = "select no,name from general where nation='{$me['nation']}' order by recwar desc"; break;
case 2: $query = "select no,name from general where nation='{$me['nation']}' order by npc,binary(name)"; break; case 2: $query = "select no,name from general where nation='{$me['nation']}' order by npc,binary(name)"; break;
case 3: $query = "select no,name from general where nation='{$me['nation']}' order by warnum desc"; break; case 3: $query = "select no,name from general where nation='{$me['nation']}' order by warnum desc"; break;
} }
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$gencount = MYDB_num_rows($result); $gencount = MYDB_num_rows($result);
for($i=0; $i < $gencount; $i++) { for ($i=0; $i < $gencount; $i++) {
$general = MYDB_fetch_array($result); $general = MYDB_fetch_array($result);
// 선택 없으면 맨 처음 장수 // 선택 없으면 맨 처음 장수
if($gen == 0) { if ($gen == 0) {
$gen = $general['no']; $gen = $general['no'];
} }
if($gen == $general['no']) { if ($gen == $general['no']) {
echo " echo "
<option selected value={$general['no']}>{$general['name']}</option>"; <option selected value={$general['no']}>{$general['name']}</option>";
} else { } else {
@@ -113,10 +135,10 @@ for($i=0; $i < $gencount; $i++) {
</tr> </tr>
<tr> <tr>
<td valign=top> <td valign=top>
<?php generalInfo($connect, $gen); generalInfo2($connect, $gen); ?> <?php generalInfo($gen); generalInfo2($gen); ?>
</td> </td>
<td valign=top> <td valign=top>
<?php MyHistory($connect, $gen); ?> <?=getGeneralHistoryAll($gen)?>
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -125,10 +147,10 @@ for($i=0; $i < $gencount; $i++) {
</tr> </tr>
<tr> <tr>
<td valign=top> <td valign=top>
<?php MyBatLog($gen, 24); ?> <?=getBatLogRecent($gen, 24)?>
</td> </td>
<td valign=top> <td valign=top>
<?php MyBatRes($gen, 24); ?> <?=getBatResRecent($gen, 24)?>
</td> </td>
</tr> </tr>
</table> </table>
+153 -85
View File
@@ -4,23 +4,31 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
increaseRefresh("베팅장", 1);
checkTurn($connect);
$query = "select no,tournament,con,turntime,bet0+bet1+bet2+bet3+bet4+bet5+bet6+bet7+bet8+bet9+bet10+bet11+bet12+bet13+bet14+bet15 as bet from general where owner='{$_SESSION['userID']}'"; $db = DB::db();
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $connect=$db->get();
increaseRefresh("베팅장", 1);
checkTurn();
$query = "select no,tournament,con,turntime,bet0+bet1+bet2+bet3+bet4+bet5+bet6+bet7+bet8+bet9+bet10+bet11+bet12+bet13+bet14+bet15 as bet from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
$query = "select conlimit,tournament,phase,tnmt_type,develcost,bet0,bet1,bet2,bet3,bet4,bet5,bet6,bet7,bet8,bet9,bet10,bet11,bet12,bet13,bet14,bet15,bet0+bet1+bet2+bet3+bet4+bet5+bet6+bet7+bet8+bet9+bet10+bet11+bet12+bet13+bet14+bet15 as bet from game limit 1"; $query = "select conlimit,tournament,phase,tnmt_type,develcost,bet0,bet1,bet2,bet3,bet4,bet5,bet6,bet7,bet8,bet9,bet10,bet11,bet12,bet13,bet14,bet15,bet0+bet1+bet2+bet3+bet4+bet5+bet6+bet7+bet8+bet9+bet10+bet11+bet12+bet13+bet14+bet15 as bet from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$con = checkLimit($me['con'], $admin['conlimit']); $con = checkLimit($me['con'], $admin['conlimit']);
if($con >= 2) { printLimitMsg($me['turntime']); exit(); } if ($con >= 2) {
printLimitMsg($me['turntime']);
exit();
}
switch($admin['tnmt_type']) { switch ($admin['tnmt_type']) {
default: throw new \RuntimeException('Invalid tnmt_type');break;
case 0: $tnmt_type = "<font color=cyan>전력전</font>"; $tp = "tot"; $tp2 = "종합"; $tp3 = "total"; break; case 0: $tnmt_type = "<font color=cyan>전력전</font>"; $tp = "tot"; $tp2 = "종합"; $tp3 = "total"; break;
case 1: $tnmt_type = "<font color=cyan>통솔전</font>"; $tp = "ldr"; $tp2 = "통솔"; $tp3 = "leader"; break; case 1: $tnmt_type = "<font color=cyan>통솔전</font>"; $tp = "ldr"; $tp2 = "통솔"; $tp3 = "leader"; break;
case 2: $tnmt_type = "<font color=cyan>일기토</font>"; $tp = "pwr"; $tp2 = "무력"; $tp3 = "power"; break; case 2: $tnmt_type = "<font color=cyan>일기토</font>"; $tp = "pwr"; $tp2 = "무력"; $tp3 = "power"; break;
@@ -28,25 +36,27 @@ case 3: $tnmt_type = "<font color=cyan>설전</font>"; $tp = "itl"; $tp2 = "
} }
$str1 = getTournament($admin['tournament']); $str1 = getTournament($admin['tournament']);
$str2 = getTournamentTime($connect); $str2 = getTournamentTime();
$str3 = getTournamentTerm($connect); $str3 = getTournamentTerm();
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<?php if($con == 1) { MessageBox("접속제한이 얼마 남지 않았습니다!"); } ?> <?php if ($con == 1) {
MessageBox("접속제한이 얼마 남지 않았습니다!");
} ?>
<head> <head>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<title>베팅장</title> <title>베팅장</title>
<style> <style>
body { color:white; background-color:black; border-width:1; border-color:gray; } body { color:white; background-color:black; border-width:1px; border-color:gray; }
table { font-family:'맑은 고딕'; line-height:110%; } table { font-family:'맑은 고딕'; line-height:110%; }
font { font-family:'맑은 고딕'; line-height:110%; } font { font-family:'맑은 고딕'; line-height:110%; }
input { font-family:'맑은 고딕'; line-height:110%; height:20px } input { font-family:'맑은 고딕'; line-height:110%; height:20px }
select { font-family:'굴림'; line-height:100%; } select { font-family:'굴림'; line-height:100%; }
#bg0 { background-image:url(<?=$images;?>/back_walnut.jpg); } #bg0 { background-image:url(<?=ServConfig::$gameImagePath?>/back_walnut.jpg); }
#bg1 { background-image:url(<?=$images;?>/back_green.jpg); } #bg1 { background-image:url(<?=ServConfig::$gameImagePath?>/back_green.jpg); }
#bg2 { background-image:url(<?=$images;?>/back_blue.jpg); } #bg2 { background-image:url(<?=ServConfig::$gameImagePath?>/back_blue.jpg); }
</style> </style>
</head> </head>
@@ -55,22 +65,27 @@ select { font-family:'굴림'; line-height:100%; }
<table align=center width=1120 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=1120 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr><td>베 팅 장<br><?=closeButton()?></td></tr> <tr><td>베 팅 장<br><?=closeButton()?></td></tr>
</table> </table>
<table align=center width=1120 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:10;word-break:break-all; id=bg0> <table align=center width=1120 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:10px;word-break:break-all; id=bg0>
<tr><td colspan=16><input type=button value='갱신' onclick='location.reload()'></td></tr> <tr><td colspan=16><input type=button value='갱신' onclick='location.reload()'></td></tr>
<tr><td colspan=16 align=center><font color=white size=6><?=$tnmt_type;?> (<?=$str1.", ".$str2.", ".$str3;?>)</font></td></tr> <tr><td colspan=16 align=center><font color=white size=6><?=$tnmt_type?> (<?=$str1.", ".$str2.", ".$str3?>)</font></td></tr>
<tr><td height=50 colspan=16 align=center id=bg2><font color=limegreen size=6>16강 상황</font><br><font color=orange size=3>(전체 금액 : <?=$admin['bet'];?> / 내 투자 금액 : <?=$me['bet'];?>)</font></td></tr> <tr><td height=50 colspan=16 align=center id=bg2><font color=limegreen size=6>16강 상황</font><br><font color=orange size=3>(전체 금액 : <?=$admin['bet']?> / 내 투자 금액 : <?=$me['bet']?>)</font></td></tr>
</table> </table>
<table align=center width=1120 border=0 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:10;word-break:break-all; id=bg0> <table align=center width=1120 border=0 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:10px;word-break:break-all; id=bg0>
<tr align=center><td height=10 colspan=16></td></tr> <tr align=center><td height=10 colspan=16></td></tr>
<tr align=center> <tr align=center>
<?php <?php
$query = "select npc,name,win from tournament where grp>=60 order by grp, grp_no"; $query = "select npc,name,win from tournament where grp>=60 order by grp, grp_no";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
for($i=0; $i < 1; $i++) { for ($i=0; $i < 1; $i++) {
$general = MYDB_fetch_array($result); $general = MYDB_fetch_array($result);
if($general['name'] == "") { $general['name'] = "-"; } if ($general['name'] == "") {
if($general['npc'] >= 2) { $general['name'] = "<font color=cyan>".$general['name']."</font>"; } $general['name'] = "-";
elseif($general['npc'] == 1) { $general['name'] = "<font color=skyblue>".$general['name']."</font>"; } }
if ($general['npc'] >= 2) {
$general['name'] = "<font color=cyan>".$general['name']."</font>";
} elseif ($general['npc'] == 1) {
$general['name'] = "<font color=skyblue>".$general['name']."</font>";
}
echo "<td colspan=16>{$general['name']}</td>"; echo "<td colspan=16>{$general['name']}</td>";
} }
@@ -79,18 +94,32 @@ echo "
<tr align=center>"; <tr align=center>";
$query = "select npc,name,win from tournament where grp>=50 order by grp, grp_no"; $query = "select npc,name,win from tournament where grp>=50 order by grp, grp_no";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
for($i=0; $i < 1; $i++) { $cent[$i] = "<font color=white>"; } $cent = [];
for($i=0; $i < 2; $i++) { $line = [];
$gen = [];
for ($i=0; $i < 1; $i++) {
$cent[$i] = "<font color=white>";
}
for ($i=0; $i < 2; $i++) {
$general = MYDB_fetch_array($result); $general = MYDB_fetch_array($result);
if($general['name'] == "") { $general['name'] = "-"; } if ($general['name'] == "") {
if($general['npc'] >= 2) { $general['name'] = "<font color=cyan>".$general['name']."</font>"; } $general['name'] = "-";
elseif($general['npc'] == 1) { $general['name'] = "<font color=skyblue>".$general['name']."</font>"; } }
if($general['win'] > 0) { $line[$i] = "<font color=red>"; $cent[floor($i/2)] = "<font color=red>"; } if ($general['npc'] >= 2) {
else { $line[$i] = "<font color=white>"; } $general['name'] = "<font color=cyan>".$general['name']."</font>";
} elseif ($general['npc'] == 1) {
$general['name'] = "<font color=skyblue>".$general['name']."</font>";
}
if ($general['win'] > 0) {
$line[$i] = "<font color=red>";
$cent[intdiv($i, 2)] = "<font color=red>";
} else {
$line[$i] = "<font color=white>";
}
$gen[$i] = $general['name']; $gen[$i] = $general['name'];
} }
for($i=0; $i < 1; $i++) { for ($i=0; $i < 1; $i++) {
$cent[$i] = $cent[$i]."┻"."</font>"; $cent[$i] = $cent[$i]."┻"."</font>";
$line[$i*2] = $line[$i*2]."┏━━━━━━━━━━━━━━━━━━━━━━━━━━━"."</font>"; $line[$i*2] = $line[$i*2]."┏━━━━━━━━━━━━━━━━━━━━━━━━━━━"."</font>";
$line[$i*2+1] = $line[$i*2+1]."━━━━━━━━━━━━━━━━━━━━━━━━━━━┓"."</font>"; $line[$i*2+1] = $line[$i*2+1]."━━━━━━━━━━━━━━━━━━━━━━━━━━━┓"."</font>";
@@ -100,7 +129,7 @@ echo "
</tr> </tr>
<tr align=center>"; <tr align=center>";
for($i=0; $i < 2; $i++) { for ($i=0; $i < 2; $i++) {
echo "<td colspan=8>{$gen[$i]}</td>"; echo "<td colspan=8>{$gen[$i]}</td>";
} }
@@ -109,18 +138,29 @@ echo "
<tr align=center>"; <tr align=center>";
$query = "select npc,name,win from tournament where grp>=40 order by grp, grp_no"; $query = "select npc,name,win from tournament where grp>=40 order by grp, grp_no";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
for($i=0; $i < 2; $i++) { $cent[$i] = "<font color=white>"; } for ($i=0; $i < 2; $i++) {
for($i=0; $i < 4; $i++) { $cent[$i] = "<font color=white>";
}
for ($i=0; $i < 4; $i++) {
$general = MYDB_fetch_array($result); $general = MYDB_fetch_array($result);
if($general['name'] == "") { $general['name'] = "-"; } if ($general['name'] == "") {
if($general['npc'] >= 2) { $general['name'] = "<font color=cyan>".$general['name']."</font>"; } $general['name'] = "-";
elseif($general['npc'] == 1) { $general['name'] = "<font color=skyblue>".$general['name']."</font>"; } }
if($general['win'] > 0) { $line[$i] = "<font color=red>"; $cent[floor($i/2)] = "<font color=red>"; } if ($general['npc'] >= 2) {
else { $line[$i] = "<font color=white>"; } $general['name'] = "<font color=cyan>".$general['name']."</font>";
} elseif ($general['npc'] == 1) {
$general['name'] = "<font color=skyblue>".$general['name']."</font>";
}
if ($general['win'] > 0) {
$line[$i] = "<font color=red>";
$cent[intdiv($i, 2)] = "<font color=red>";
} else {
$line[$i] = "<font color=white>";
}
$gen[$i] = $general['name']; $gen[$i] = $general['name'];
} }
for($i=0; $i < 2; $i++) { for ($i=0; $i < 2; $i++) {
$cent[$i] = $cent[$i]."┻"."</font>"; $cent[$i] = $cent[$i]."┻"."</font>";
$line[$i*2] = $line[$i*2]."┏━━━━━━━━━━━━━"."</font>"; $line[$i*2] = $line[$i*2]."┏━━━━━━━━━━━━━"."</font>";
$line[$i*2+1] = $line[$i*2+1]."━━━━━━━━━━━━━┓"."</font>"; $line[$i*2+1] = $line[$i*2+1]."━━━━━━━━━━━━━┓"."</font>";
@@ -130,7 +170,7 @@ echo "
</tr> </tr>
<tr align=center>"; <tr align=center>";
for($i=0; $i < 4; $i++) { for ($i=0; $i < 4; $i++) {
echo "<td colspan=4>{$gen[$i]}</td>"; echo "<td colspan=4>{$gen[$i]}</td>";
} }
@@ -139,18 +179,29 @@ echo "
<tr align=center>"; <tr align=center>";
$query = "select npc,name,win from tournament where grp>=30 order by grp, grp_no"; $query = "select npc,name,win from tournament where grp>=30 order by grp, grp_no";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
for($i=0; $i < 4; $i++) { $cent[$i] = "<font color=white>"; } for ($i=0; $i < 4; $i++) {
for($i=0; $i < 8; $i++) { $cent[$i] = "<font color=white>";
}
for ($i=0; $i < 8; $i++) {
$general = MYDB_fetch_array($result); $general = MYDB_fetch_array($result);
if($general['name'] == "") { $general['name'] = "-"; } if ($general['name'] == "") {
if($general['npc'] >= 2) { $general['name'] = "<font color=cyan>".$general['name']."</font>"; } $general['name'] = "-";
elseif($general['npc'] == 1) { $general['name'] = "<font color=skyblue>".$general['name']."</font>"; } }
if($general['win'] > 0) { $line[$i] = "<font color=red>"; $cent[floor($i/2)] = "<font color=red>"; } if ($general['npc'] >= 2) {
else { $line[$i] = "<font color=white>"; } $general['name'] = "<font color=cyan>".$general['name']."</font>";
} elseif ($general['npc'] == 1) {
$general['name'] = "<font color=skyblue>".$general['name']."</font>";
}
if ($general['win'] > 0) {
$line[$i] = "<font color=red>";
$cent[intdiv($i, 2)] = "<font color=red>";
} else {
$line[$i] = "<font color=white>";
}
$gen[$i] = $general['name']; $gen[$i] = $general['name'];
} }
for($i=0; $i < 4; $i++) { for ($i=0; $i < 4; $i++) {
$cent[$i] = $cent[$i]."┻"."</font>"; $cent[$i] = $cent[$i]."┻"."</font>";
$line[$i*2] = $line[$i*2]."┏━━━━━━"."</font>"; $line[$i*2] = $line[$i*2]."┏━━━━━━"."</font>";
$line[$i*2+1] = $line[$i*2+1]."━━━━━━┓"."</font>"; $line[$i*2+1] = $line[$i*2+1]."━━━━━━┓"."</font>";
@@ -160,7 +211,7 @@ echo "
</tr> </tr>
<tr align=center>"; <tr align=center>";
for($i=0; $i < 8; $i++) { for ($i=0; $i < 8; $i++) {
echo "<td colspan=2>{$gen[$i]}</td>"; echo "<td colspan=2>{$gen[$i]}</td>";
} }
@@ -169,18 +220,29 @@ echo "
<tr align=center>"; <tr align=center>";
$query = "select npc,name,win from tournament where grp>=20 order by grp, grp_no"; $query = "select npc,name,win from tournament where grp>=20 order by grp, grp_no";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
for($i=0; $i < 8; $i++) { $cent[$i] = "<font color=white>"; } for ($i=0; $i < 8; $i++) {
for($i=0; $i < 16; $i++) { $cent[$i] = "<font color=white>";
}
for ($i=0; $i < 16; $i++) {
$general = MYDB_fetch_array($result); $general = MYDB_fetch_array($result);
if($general['name'] == "") { $general['name'] = "-"; } if ($general['name'] == "") {
if($general['npc'] >= 2) { $general['name'] = "<font color=cyan>".$general['name']."</font>"; } $general['name'] = "-";
elseif($general['npc'] == 1) { $general['name'] = "<font color=skyblue>".$general['name']."</font>"; } }
if($general['win'] > 0) { $line[$i] = "<font color=red>"; $cent[floor($i/2)] = "<font color=red>"; } if ($general['npc'] >= 2) {
else { $line[$i] = "<font color=white>"; } $general['name'] = "<font color=cyan>".$general['name']."</font>";
} elseif ($general['npc'] == 1) {
$general['name'] = "<font color=skyblue>".$general['name']."</font>";
}
if ($general['win'] > 0) {
$line[$i] = "<font color=red>";
$cent[intdiv($i, 2)] = "<font color=red>";
} else {
$line[$i] = "<font color=white>";
}
$gen[$i] = $general['name']; $gen[$i] = $general['name'];
} }
for($i=0; $i < 8; $i++) { for ($i=0; $i < 8; $i++) {
$cent[$i] = $cent[$i]."┻"."</font>"; $cent[$i] = $cent[$i]."┻"."</font>";
$line[$i*2] = $line[$i*2]."┏━━"."</font>"; $line[$i*2] = $line[$i*2]."┏━━"."</font>";
$line[$i*2+1] = $line[$i*2+1]."━━┓"."</font>"; $line[$i*2+1] = $line[$i*2+1]."━━┓"."</font>";
@@ -190,24 +252,30 @@ echo "
</tr> </tr>
<tr align=center>"; <tr align=center>";
for($i=0; $i < 16; $i++) { for ($i=0; $i < 16; $i++) {
echo "<td width=70>{$gen[$i]}</td>"; echo "<td width=70>{$gen[$i]}</td>";
} }
$query = "select bet0,bet1,bet2,bet3,bet4,bet5,bet6,bet7,bet8,bet9,bet10,bet11,bet12,bet13,bet14,bet15 from general where owner='{$_SESSION['userID']}'"; $query = "select bet0,bet1,bet2,bet3,bet4,bet5,bet6,bet7,bet8,bet9,bet10,bet11,bet12,bet13,bet14,bet15 from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
for($i=0; $i < 16; $i++) { $myBet = [];
$bet = [];
$gold = [];
for ($i=0; $i < 16; $i++) {
$myBet[$i] = $me["bet{$i}"]; $myBet[$i] = $me["bet{$i}"];
} }
for($i=0; $i < 16; $i++) { for ($i=0; $i < 16; $i++) {
$bet[$i] = @round($admin['bet'] / $admin["bet{$i}"], 2); $bet[$i] = @round($admin['bet'] / $admin["bet{$i}"], 2);
if($bet[$i] == 0) { $bet[$i] = "∞"; } if ($bet[$i] == 0) {
$bet[$i] = "∞";
}
} }
for($i=0; $i < 16; $i++) { for ($i=0; $i < 16; $i++) {
$gold[$i] = round($myBet[$i] * $bet[$i]); $gold[$i] = Util::round($myBet[$i] * $bet[$i]);
} }
?> ?>
</tr> </tr>
@@ -218,7 +286,7 @@ for($i=0; $i < 16; $i++) {
echo " echo "
<tr align=center>"; <tr align=center>";
for($i=0; $i < 16; $i++) { for ($i=0; $i < 16; $i++) {
echo "<td width=70><font color=skyblue>{$bet[$i]}</font></td>"; echo "<td width=70><font color=skyblue>{$bet[$i]}</font></td>";
} }
?> ?>
@@ -229,7 +297,7 @@ for($i=0; $i < 16; $i++) {
</tr> </tr>
<tr align=center> <tr align=center>
<?php <?php
for($i=0; $i < 16; $i++) { for ($i=0; $i < 16; $i++) {
echo "<td><font color=orange>{$myBet[$i]}</font></td>"; echo "<td><font color=orange>{$myBet[$i]}</font></td>";
} }
?> ?>
@@ -240,7 +308,7 @@ for($i=0; $i < 16; $i++) {
</tr> </tr>
<tr align=center> <tr align=center>
<?php <?php
for($i=0; $i < 16; $i++) { for ($i=0; $i < 16; $i++) {
echo "<td><font color=cyan>{$gold[$i]}</font></td>"; echo "<td><font color=cyan>{$gold[$i]}</font></td>";
} }
@@ -248,12 +316,12 @@ echo "
</tr> </tr>
<tr align=center><td height=10 colspan=16></td></tr>"; <tr align=center><td height=10 colspan=16></td></tr>";
if($admin['tournament'] == 6) { if ($admin['tournament'] == 6) {
echo " echo "
<form method=post action=c_betting.php> <form method=post action=c_betting.php>
<tr align=center>"; <tr align=center>";
for($i=0; $i < 16; $i++) { for ($i=0; $i < 16; $i++) {
echo " echo "
<td> <td>
<select size=1 name=gold{$i} style=color:white;background-color:black;> <select size=1 name=gold{$i} style=color:white;background-color:black;>
@@ -272,7 +340,7 @@ if($admin['tournament'] == 6) {
</tr> </tr>
<tr align=center>"; <tr align=center>";
for($i=0; $i < 16; $i++) { for ($i=0; $i < 16; $i++) {
echo " echo "
<td><input type=submit name=btn{$i} value=베팅! style=width:100%;color:white;background-color:black;></td>"; <td><input type=submit name=btn{$i} value=베팅! style=width:100%;color:white;background-color:black;></td>";
} }
@@ -297,12 +365,12 @@ if($admin['tournament'] == 6) {
<tr align=center> <tr align=center>
<?php <?php
$type1 = Array("전 력 전", "통 솔 전", "일 기 토", "설 전"); $type1 = array("전 력 전", "통 솔 전", "일 기 토", "설 전");
$type2 = Array("종합", "통솔", "무력", "지력"); $type2 = array("종합", "통솔", "무력", "지력");
$type3 = Array("tt", "tl", "tp", "ti"); $type3 = array("tt", "tl", "tp", "ti");
$type4 = Array("total", "leader", "power", "intel"); $type4 = array("total", "leader", "power", "intel");
for($i=0; $i < 4; $i++) { for ($i=0; $i < 4; $i++) {
$grp = $i; $grp = $i;
echo " echo "
<td> <td>
@@ -311,8 +379,8 @@ for($i=0; $i < 4; $i++) {
<tr id=bg1><td align=center>순</td><td align=center>장수</td><td align=center>{$type2[$i]}</td><td align=center>경</td><td align=center>승</td><td align=center>무</td><td align=center>패</td><td align=center>점</td><td align=center>勝</td></tr>"; <tr id=bg1><td align=center>순</td><td align=center>장수</td><td align=center>{$type2[$i]}</td><td align=center>경</td><td align=center>승</td><td align=center>무</td><td align=center>패</td><td align=center>점</td><td align=center>勝</td></tr>";
$query = "select npc,name,leader,power,intel,leader+power+intel as total,{$type3[$i]}p as prize,{$type3[$i]}w+{$type3[$i]}d+{$type3[$i]}l as game,{$type3[$i]}w as win,{$type3[$i]}d as draw,{$type3[$i]}l as lose,{$type3[$i]}g as gl from general order by gl desc, game desc, win desc, draw desc, lose, no limit 0,30"; $query = "select npc,name,leader,power,intel,leader+power+intel as total,{$type3[$i]}p as prize,{$type3[$i]}w+{$type3[$i]}d+{$type3[$i]}l as game,{$type3[$i]}w as win,{$type3[$i]}d as draw,{$type3[$i]}l as lose,{$type3[$i]}g as gl from general order by gl desc, game desc, win desc, draw desc, lose, no limit 0,30";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
for($k=1; $k <= 30; $k++) { for ($k=1; $k <= 30; $k++) {
$general = MYDB_fetch_array($result); $general = MYDB_fetch_array($result);
printRow($k, $general['npc'], $general['name'], $general[$type4[$i]], $general['game'], $general['win'], $general['draw'], $general['lose'], $general['gl'], $general['prize'], 0); printRow($k, $general['npc'], $general['name'], $general[$type4[$i]], $general['game'], $general['win'], $general['draw'], $general['lose'], $general['gl'], $general['prize'], 0);
} }
+13 -8
View File
@@ -4,11 +4,15 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
increaseRefresh("기밀실", 1); increaseRefresh("기밀실", 1);
$query = "select no,nation,level from general where owner='{$_SESSION['userID']}'"; $query = "select no,nation,level from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
@@ -23,7 +27,8 @@ if($me['level'] < 5) {
<head> <head>
<title>기밀실</title> <title>기밀실</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
@@ -32,11 +37,11 @@ if($me['level'] < 5) {
<tr><td>기 밀 실<br><?=backButton()?></td></tr> <tr><td>기 밀 실<br><?=backButton()?></td></tr>
<form name=form1 method=post action=c_chiefboard.php> <form name=form1 method=post action=c_chiefboard.php>
<tr><td align=center> <tr><td align=center>
제목 <input type=textarea maxlength=50 name=title style=color:white;background-color:black;width:830;> 제목 <input type=textarea maxlength=50 name=title style=color:white;background-color:black;width:830px;>
</td> </td>
</tr> </tr>
<tr><td> <tr><td>
<textarea name=msg style=color:white;background-color:black;width:998;height:200;></textarea><br> <textarea name=msg style=color:white;background-color:black;width:998px;height:200px;></textarea><br>
<input type=submit value=저장하기> <input type=submit value=저장하기>
<input type=hidden name=num value=-1> <input type=hidden name=num value=-1>
</td></tr> </td></tr>
@@ -44,7 +49,7 @@ if($me['level'] < 5) {
</table> </table>
<br> <br>
<?php <?php
$nation = getNation($connect, $me['nation']); $nation = getNation($me['nation']);
//20개 메세지 //20개 메세지
$index = $nation['coreindex']; $index = $nation['coreindex'];
@@ -53,7 +58,7 @@ for($i=0; $i < 20; $i++) {
$query = "select name,picture,imgsvr from general where no='$nation[$who]'"; $query = "select name,picture,imgsvr from general where no='$nation[$who]'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$general = MYDB_fetch_array($result); $general = MYDB_fetch_array($result);
if($nation["coreboard{$index}"] != '') { msgprint($connect, $nation["coreboard{$index}"], $general['name'], $general['picture'], $general['imgsvr'], $nation["coreboard{$index}_when"], $index, 1); } if($nation["coreboard{$index}"] != '') { msgprint($nation["coreboard{$index}"], $general['name'], $general['picture'], $general['imgsvr'], $nation["coreboard{$index}_when"], $index, 1); }
$index--; $index--;
if($index < 0) { $index = 19; } if($index < 0) { $index = 19; }
} }
+58 -37
View File
@@ -4,15 +4,19 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
increaseRefresh("사령부", 1); increaseRefresh("사령부", 1);
$query = "select conlimit from game limit 1"; $query = "select conlimit from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$query = "select no,nation,level,con,turntime,belong from general where owner='{$_SESSION['userID']}'"; $query = "select no,nation,level,con,turntime,belong from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
@@ -53,8 +57,10 @@ $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""
$nation = MYDB_fetch_array($result); $nation = MYDB_fetch_array($result);
$lv = getNationChiefLevel($nation['level']); $lv = getNationChiefLevel($nation['level']);
$turn = [];
$gen = [[],[],[],[],[],[],[],[],[],[],[],[]];
for($i=12; $i >= $lv; $i--) { for($i=12; $i >= $lv; $i--) {
$turn[$i] = getCoreTurn($connect, $nation, $i); $turn[$i] = getCoreTurn($nation, $i);
$query = "select name,turntime,npc from general where level={$i} and nation='{$me['nation']}'"; $query = "select name,turntime,npc from general where level={$i} and nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
@@ -67,7 +73,8 @@ for($i=12; $i >= $lv; $i--) {
<head> <head>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<title>사령부</title> <title>사령부</title>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
<script type="text/javascript"> <script type="text/javascript">
function turn(type) { function turn(type) {
if(type == 0) location.replace('turn_push_core.php'); if(type == 0) location.replace('turn_push_core.php');
@@ -88,48 +95,62 @@ function turn(type) {
$year = $admin['year']; $year = $admin['year'];
$month = $admin['month']; $month = $admin['month'];
$date = substr(date('Y-m-d H:i:s'), 14); $date = substr(date('Y-m-d H:i:s'), 14);
$totaldate = [];
$turntime = [];
$turndate = [];
for($i=12; $i >= $lv; $i--) { for($i=12; $i >= $lv; $i--) {
$totaldate[$i] = $gen[$i]['turntime']; $totaldate[$i] = $gen[$i]['turntime'];
$turntime[$i] = substr($gen[$i]['turntime'], 14); $turntime[$i] = substr($gen[$i]['turntime'], 14);
} }
//FIXME: 각 칸을 div로 놓으면 네개씩 출력하는 삽질이 필요없다.
for($k=0; $k < 2; $k++) { for($k=0; $k < 2; $k++) {
$l4 = 12 - $k; $l3 = 10 - $k; $l2 = 8 - $k; $l1 = 6 - $k; $l4 = 12 - $k; $l3 = 10 - $k; $l2 = 8 - $k; $l1 = 6 - $k;
if ($gen[$l4]['npc'] >= 2) { $gen[$l4]['name'] = "<font color=cyan>".$gen[$l4]['name']."</font>"; } if(!isset($gen[$l4])){
elseif($gen[$l4]['npc'] == 1) { $gen[$l4]['name'] = "<font color=skyblue>".$gen[$l4]['name']."</font>"; } $gen[$l4] = [
if ($gen[$l3]['npc'] >= 2) { $gen[$l3]['name'] = "<font color=cyan>".$gen[$l3]['name']."</font>"; } 'npc'=>0,
elseif($gen[$l3]['npc'] == 1) { $gen[$l3]['name'] = "<font color=skyblue>".$gen[$l3]['name']."</font>"; } 'name'=>0
if ($gen[$l2]['npc'] >= 2) { $gen[$l2]['name'] = "<font color=cyan>".$gen[$l2]['name']."</font>"; } ];
elseif($gen[$l2]['npc'] == 1) { $gen[$l2]['name'] = "<font color=skyblue>".$gen[$l2]['name']."</font>"; } }
if ($gen[$l1]['npc'] >= 2) { $gen[$l1]['name'] = "<font color=cyan>".$gen[$l1]['name']."</font>"; }
elseif($gen[$l1]['npc'] == 1) { $gen[$l1]['name'] = "<font color=skyblue>".$gen[$l1]['name']."</font>"; } if ($gen[$l4]['npc'] >= 2) { $gen[$l4]['name'] = "<font color=cyan>".($gen[$l4]['name']??'')."</font>"; }
elseif($gen[$l4]['npc'] == 1) { $gen[$l4]['name'] = "<font color=skyblue>".($gen[$l4]['name']??'')."</font>"; }
if ($gen[$l3]['npc'] >= 2) { $gen[$l3]['name'] = "<font color=cyan>".($gen[$l3]['name']??'')."</font>"; }
elseif($gen[$l3]['npc'] == 1) { $gen[$l3]['name'] = "<font color=skyblue>".($gen[$l3]['name']??'')."</font>"; }
if ($gen[$l2]['npc'] >= 2) { $gen[$l2]['name'] = "<font color=cyan>".($gen[$l2]['name']??'')."</font>"; }
elseif($gen[$l2]['npc'] == 1) { $gen[$l2]['name'] = "<font color=skyblue>".($gen[$l2]['name']??'')."</font>"; }
if ($gen[$l1]['npc'] >= 2) { $gen[$l1]['name'] = "<font color=cyan>".($gen[$l1]['name']??'')."</font>"; }
elseif($gen[$l1]['npc'] == 1) { $gen[$l1]['name'] = "<font color=skyblue>".($gen[$l1]['name']??'')."</font>"; }
echo " echo "
<tr> <tr>
<td align=center id=bg1>.</td> <td align=center id=bg1>.</td>
<td colspan=2 align=center id=bg1><b>".getLevel($l4, $nation['level'])." : {$gen[$l4]['name']}</b></td> <td colspan=2 align=center id=bg1><b>".getLevel($l4, $nation['level'])." : ".($gen[$l4]['name']??'')."</b></td>
<td colspan=2 align=center id=bg1><b>".getLevel($l3, $nation['level'])." : {$gen[$l3]['name']}</b></td> <td colspan=2 align=center id=bg1><b>".getLevel($l3, $nation['level'])." : ".($gen[$l3]['name']??'')."</b></td>
<td colspan=2 align=center id=bg1><b>".getLevel($l2, $nation['level'])." : {$gen[$l2]['name']}</b></td> <td colspan=2 align=center id=bg1><b>".getLevel($l2, $nation['level'])." : ".($gen[$l2]['name']??'')."</b></td>
<td colspan=2 align=center id=bg1><b>".getLevel($l1, $nation['level'])." : {$gen[$l1]['name']}</b></td> <td colspan=2 align=center id=bg1><b>".getLevel($l1, $nation['level'])." : ".($gen[$l1]['name']??'')."</b></td>
<td align=center id=bg1>.</td> <td align=center id=bg1>.</td>
</tr> </tr>
"; ";
for($i=0; $i < 12; $i++) { for($i=0; $i < 12; $i++) {
$turndate[$l4] = substr($totaldate[$l4], 11, 5); $turndate[$l4] = substr($totaldate[$l4]??'', 11, 5);
$turndate[$l3] = substr($totaldate[$l3], 11, 5); $turndate[$l3] = substr($totaldate[$l3]??'', 11, 5);
$turndate[$l2] = substr($totaldate[$l2], 11, 5); $turndate[$l2] = substr($totaldate[$l2]??'', 11, 5);
$turndate[$l1] = substr($totaldate[$l1], 11, 5); $turndate[$l1] = substr($totaldate[$l1]??'', 11, 5);
$j = $i + 1; $j = $i + 1;
$td4 = ($turndate[$l4] == "") ? "-" : $turndate[$l4]; $td4 = $turndate[$l4]??"-";
$td3 = ($turndate[$l3] == "") ? "-" : $turndate[$l3]; $td3 = $turndate[$l3]??"-";
$td2 = ($turndate[$l2] == "") ? "-" : $turndate[$l2]; $td2 = $turndate[$l2]??"-";
$td1 = ($turndate[$l1] == "") ? "-" : $turndate[$l1]; $td1 = $turndate[$l1]??"-";
$tn4 = ($turn[$l4][$i] == "") ? "-" : $turn[$l4][$i]; $tn4 = $turn[$l4][$i]??"-";
$tn3 = ($turn[$l3][$i] == "") ? "-" : $turn[$l3][$i]; $tn3 = $turn[$l3][$i]??"-";
$tn2 = ($turn[$l2][$i] == "") ? "-" : $turn[$l2][$i]; $tn2 = $turn[$l2][$i]??"-";
$tn1 = ($turn[$l1][$i] == "") ? "-" : $turn[$l1][$i]; $tn1 = $turn[$l1][$i]??"-";
echo " echo "
<tr> <tr>
<td width=28 align=center id=bg0><b>$j</b></td> <td width=28 align=center id=bg0><b>$j</b></td>
@@ -144,20 +165,20 @@ for($k=0; $k < 2; $k++) {
<td width=28 align=center id=bg0><b>$j</b></td> <td width=28 align=center id=bg0><b>$j</b></td>
</tr> </tr>
"; ";
if($totaldate[$l4] != "") { $totaldate[$l4] = addTurn($totaldate[$l4], $admin['turnterm']); } if($totaldate[$l4]??'') { $totaldate[$l4] = addTurn($totaldate[$l4], $admin['turnterm']); }
if($totaldate[$l3] != "") { $totaldate[$l3] = addTurn($totaldate[$l3], $admin['turnterm']); } if($totaldate[$l3]??'') { $totaldate[$l3] = addTurn($totaldate[$l3], $admin['turnterm']); }
if($totaldate[$l2] != "") { $totaldate[$l2] = addTurn($totaldate[$l2], $admin['turnterm']); } if($totaldate[$l2]??'') { $totaldate[$l2] = addTurn($totaldate[$l2], $admin['turnterm']); }
if($totaldate[$l1] != "") { $totaldate[$l1] = addTurn($totaldate[$l1], $admin['turnterm']); } if($totaldate[$l1]??'') { $totaldate[$l1] = addTurn($totaldate[$l1], $admin['turnterm']); }
} }
if($k == 0) { if($k == 0) {
echo "<form action=processing.php method=post><tr><td colspan=5 align=right>"; echo "<form action=processing.php method=post><tr><td colspan=5 align=right>";
echo CoreTurnTable(); echo CoreTurnTable();
echo "</td><td colspan=5> echo "</td><td colspan=5>
<input type={$btn2} style=background-color:$_basecolor2;color:white;width:58;font-size:13px; value='미루기▼' onclick='turn(0)'> <input type={$btn2} style=background-color:".GameConst::$basecolor2.";color:white;width:58px;font-size:13px; value='미루기▼' onclick='turn(0)'>
<input type={$btn2} style=background-color:$_basecolor2;color:white;width:58;font-size:13px; value='▲당기기' onclick='turn(1)'> <input type={$btn2} style=background-color:".GameConst::$basecolor2.";color:white;width:58px;font-size:13px; value='▲당기기' onclick='turn(1)'>
<br>"; <br>";
CoreCommandTable($connect); CoreCommandTable();
echo "<input type={$btn} style=background-color:$_basecolor2;color:white;width:55;font-size:13px; value='실 행'></td></tr></form>"; echo "<input type={$btn} style=background-color:".GameConst::$basecolor2.";color:white;width:55px;font-size:13px; value='실 행'></td></tr></form>";
} }
} }
+64 -58
View File
@@ -3,12 +3,21 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
$citylist = Util::getReq('citylist', 'int');
extractMissingPostToGlobals();
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
increaseRefresh("현재도시", 1); increaseRefresh("현재도시", 1);
$query = "select no,nation,level,city from general where owner='{$_SESSION['userID']}'"; $query = "select no,nation,level,city from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
@@ -23,7 +32,8 @@ $myNation = MYDB_fetch_array($result);
<head> <head>
<title>도시정보</title> <title>도시정보</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel=stylesheet href=css/common.css type=text/css> <link href="../d_shared/common.css" rel="stylesheet">
<link href="css/common.css" rel="stylesheet">
</head> </head>
@@ -36,9 +46,11 @@ $myNation = MYDB_fetch_array($result);
<tr> <tr>
<td width=998> <td width=998>
<form name=cityselect method=get>도시선택 : <form name=cityselect method=get>도시선택 :
<select name=citylist size=1 style=color:white;background-color:black;width:798;> <select name=citylist size=1 style=color:white;background-color:black;width:798px;>
<?php <?php
if(!array_key_exists('citylist', $_REQUEST) || $_REQUEST['citylist'] == '') { $_REQUEST['citylist'] = $me['city']; } if(!$citylist){
$citylist = $me['city'];
}
// 재야일때는 현재 도시만 // 재야일때는 현재 도시만
$valid = 0; $valid = 0;
@@ -48,8 +60,8 @@ if($me['level'] == 0) {
$city = MYDB_fetch_array($cityresult); $city = MYDB_fetch_array($cityresult);
echo " echo "
<option value={$city['city']}"; <option value={$city['city']}";
if($city['city'] == $_REQUEST['citylist']) { echo " selected"; $valid = 1; } if($city['city'] == $citylist) { echo " selected"; $valid = 1; }
echo ">==================================================【".StringUtil::Fill($city['name'], 4, '_')."】"; echo ">==================================================【".StringUtil::padString($city['name'], 4, '_')."】";
if($city['nation'] == 0) echo "공백지"; if($city['nation'] == 0) echo "공백지";
elseif($me['nation'] == $city['nation']) echo "본국=="; elseif($me['nation'] == $city['nation']) echo "본국==";
else echo "타국=="; else echo "타국==";
@@ -64,8 +76,8 @@ if($me['level'] == 0) {
$city = MYDB_fetch_array($cityresult); $city = MYDB_fetch_array($cityresult);
echo " echo "
<option value={$city['city']}"; <option value={$city['city']}";
if($city['city'] == $_REQUEST['citylist']) { echo " selected"; $valid = 1; } if($city['city'] == $citylist) { echo " selected"; $valid = 1; }
echo ">==================================================【".StringUtil::Fill($city['name'], 4, '_')."】"; echo ">==================================================【".StringUtil::padString($city['name'], 4, '_')."】";
if($city['nation'] == 0) echo "공백지"; if($city['nation'] == 0) echo "공백지";
elseif($me['nation'] == $city['nation']) echo "본국=="; elseif($me['nation'] == $city['nation']) echo "본국==";
else echo "타국=="; else echo "타국==";
@@ -81,8 +93,8 @@ if($me['level'] == 0) {
$city = MYDB_fetch_array($cityresult); $city = MYDB_fetch_array($cityresult);
echo " echo "
<option value={$city['city']}"; <option value={$city['city']}";
if($city['city'] == $_REQUEST['citylist']) { echo " selected"; $valid = 1; } if($city['city'] == $citylist) { echo " selected"; $valid = 1; }
echo ">==================================================【".StringUtil::Fill($city['name'], 4, '_')."】"; echo ">==================================================【".StringUtil::padString($city['name'], 4, '_')."】";
if($city['nation'] == 0) echo "공백지"; if($city['nation'] == 0) echo "공백지";
elseif($me['nation'] == $city['nation']) echo "본국=="; elseif($me['nation'] == $city['nation']) echo "본국==";
else echo "타국=="; else echo "타국==";
@@ -93,9 +105,9 @@ if($me['level'] == 0) {
if($myNation['level'] > 0) { if($myNation['level'] > 0) {
// 첩보도시도 목록에 추가 // 첩보도시도 목록에 추가
$where = 'city=0'; $where = 'city=0';
$citys = explode("|", $myNation['spy']); $cities = array_map('intval',explode("|", $myNation['spy']));
for($i=0; $i < count($citys); $i++) { foreach($cities as $citySpy) {
$city = floor($citys[$i]/10); $city = intdiv($citySpy, 10);
$where .= " or city='{$city}'"; $where .= " or city='{$city}'";
} }
@@ -107,8 +119,8 @@ if($myNation['level'] > 0) {
$city = MYDB_fetch_array($cityresult); $city = MYDB_fetch_array($cityresult);
echo " echo "
<option value={$city['city']}"; <option value={$city['city']}";
if($city['city'] == $_REQUEST['citylist']) { echo " selected"; $valid = 1; } if($city['city'] == $citylist) { echo " selected"; $valid = 1; }
echo ">==================================================【".StringUtil::Fill($city['name'], 4, '_')."】"; echo ">==================================================【".StringUtil::padString($city['name'], 4, '_')."】";
if($city['nation'] == 0) echo "공백지"; if($city['nation'] == 0) echo "공백지";
elseif($me['nation'] == $city['nation']) echo "본국=="; elseif($me['nation'] == $city['nation']) echo "본국==";
else echo "타국=="; else echo "타국==";
@@ -127,28 +139,21 @@ echo "
</table> </table>
<br>"; <br>";
unset($city);
// 첩보된 도시까지만 허용 // 첩보된 도시까지만 허용
if($valid == 0 && Session::getUserGrade() < 5) { if($valid == 0 && $session->userGrade < 5) {
$_REQUEST['citylist'] = $me['city']; $citylist = $me['city'];
} }
$query = "select * from city where city='{$_REQUEST['citylist']}'"; // 도시 이름 목록
$cityresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$city = MYDB_fetch_array($cityresult);
$city = $db->queryFirstRow('SELECT * FROM city WHERE city=%i', $citylist);
$nation = getNationStaticInfo($city['nation']); $nation = getNationStaticInfo($city['nation']);
$query = "select name from general where no='{$city['gen1']}'"; // 태수 이름 //태수, 군사, 시중
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $gen1 = $db->queryFirstRow('SELECT `name`, npc FROM general WHERE `no`=%i', $city['gen1']);
$gen1 = MYDB_fetch_array($genresult); $gen2 = $db->queryFirstRow('SELECT `name`, npc FROM general WHERE `no`=%i', $city['gen2']);
$gen3 = $db->queryFirstRow('SELECT `name`, npc FROM general WHERE `no`=%i', $city['gen3']);
$query = "select name from general where no='{$city['gen2']}'"; // 군사 이름
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$gen2 = MYDB_fetch_array($genresult);
$query = "select name from general where no='{$city['gen3']}'"; // 시중 이름
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$gen3 = MYDB_fetch_array($genresult);
if($city['trade'] == 0) { if($city['trade'] == 0) {
$city['trade'] = "- "; $city['trade'] = "- ";
@@ -159,44 +164,43 @@ if($city['trade'] == 0) {
<tr><td><?=backButton()?></td></tr> <tr><td><?=backButton()?></td></tr>
</table> </table>
<?php
echo "
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg2> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg2>
<tr> <tr>
<td colspan=12 align=center style=color:".newColor($nation['color'])."; bgcolor={$nation['color']}>【 ".CityConst::$regionMap[$city['region']]." | ".CityConst::$levelMap[$city['level']]."{$city['name']}</td> <td colspan=12 align=center style=color:"<?=newColor($nation['color'])?>"; bgcolor=<?=$nation['color']?>>【 <?=CityConst::$regionMap[$city['region']]?> | <?=CityConst::$levelMap[$city['level']]?><?=$city['name']?></td>
</tr> </tr>
<tr> <tr>
<td align=center width=48 id=bg1>주민</td> <td align=center width=48 id=bg1>주민</td>
<td align=center width=112>{$city['pop']}/{$city['pop2']}</td> <td align=center width=112><?=$city['pop']?>/<?=$city['pop2']?></td>
<td align=center width=48 id=bg1>농업</td> <td align=center width=48 id=bg1>농업</td>
<td align=center width=108>{$city['agri']}/{$city['agri2']}</td> <td align=center width=108><?=$city['agri']?>/<?=$city['agri2']?></td>
<td align=center width=48 id=bg1>상업</td> <td align=center width=48 id=bg1>상업</td>
<td align=center width=108>{$city['comm']}/{$city['comm2']}</td> <td align=center width=108><?=$city['comm']?>/<?=$city['comm2']?></td>
<td align=center width=48 id=bg1>치안</td> <td align=center width=48 id=bg1>치안</td>
<td align=center width=108>{$city['secu']}/{$city['secu2']}</td> <td align=center width=108><?=$city['secu']?>/<?=$city['secu2']?></td>
<td align=center width=48 id=bg1>수비</td> <td align=center width=48 id=bg1>수비</td>
<td align=center width=108>{$city['def']}/{$city['def2']}</td> <td align=center width=108><?=$city['def']?>/<?=$city['def2']?></td>
<td align=center width=48 id=bg1>성벽</td> <td align=center width=48 id=bg1>성벽</td>
<td align=center width=108>{$city['wall']}/{$city['wall2']}</td> <td align=center width=108><?=$city['wall']?>/<?=$city['wall2']?></td>
</tr> </tr>
<tr> <tr>
<td align=center id=bg1>민심</td> <td align=center id=bg1>민심</td>
<td align=center>{$city['rate']}</td> <td align=center><?=$city['rate']?></td>
<td align=center id=bg1>시세</td> <td align=center id=bg1>시세</td>
<td align=center>{$city['trade']}%</td> <td align=center><?=$city['trade']?>%</td>
<td align=center id=bg1>인구</td> <td align=center id=bg1>인구</td>
<td align=center>".round($city['pop']/$city['pop2']*100, 2)." %</td> <td align=center><?=round($city['pop']/$city['pop2']*100, 2)?>%</td>
<td align=center id=bg1>태수</td> <td align=center id=bg1>태수</td>
<td align=center>";echo $gen1['name']==''?"-":"{$gen1['name']}";echo "</td> <td align=center><?=$gen1['name']??'-'?></td>
<td align=center id=bg1>군사</td> <td align=center id=bg1>군사</td>
<td align=center>";echo $gen2['name']==''?"-":"{$gen2['name']}";echo "</td> <td align=center><?=$gen2['name']??'-'?></td>
<td align=center id=bg1>시중</td> <td align=center id=bg1>시중</td>
<td align=center>";echo $gen3['name']==''?"-":"{$gen3['name']}";echo "</td> <td align=center><?=$gen3['name']??'-'?></td>
</tr> </tr>
<tr> <tr>
<td align=center id=bg1>장수</td> <td align=center id=bg1>장수</td>
<td colspan=11>"; <td colspan=11>
$query = "select name from general where city='{$city['city']}' and nation='{$city['nation']}'"; // 장수 목록 <?php
$query = "select name, npc from general where city='{$city['city']}' and nation='{$city['nation']}'"; // 장수 목록
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$gencount = MYDB_num_rows($genresult); $gencount = MYDB_num_rows($genresult);
if($gencount == 0) echo "-"; if($gencount == 0) echo "-";
@@ -204,15 +208,17 @@ echo "
$general = MYDB_fetch_array($genresult); $general = MYDB_fetch_array($genresult);
echo "{$general['name']}, "; echo "{$general['name']}, ";
} }
echo " ?>
</td> </td>
</tr> </tr>
</table>"; </table>
<?php
$query = "select npc,mode,no,picture,imgsvr,name,injury,leader,power,intel,level,nation,crewtype,crew,train,atmos,term,turn0,turn1,turn2,turn3,turn4,turn5 from general where city='{$city['city']}' order by dedication desc"; // 장수 목록 $query = "select npc,mode,no,picture,imgsvr,name,injury,leader,power,intel,level,nation,crewtype,crew,train,atmos,term,turn0,turn1,turn2,turn3,turn4,turn5 from general where city='{$city['city']}' order by dedication desc"; // 장수 목록
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$gencount = MYDB_num_rows($genresult); $gencount = MYDB_num_rows($genresult);
$nationname = [];
$nationlevel = [];
foreach(getAllNationStaticInfo() as $nation){ foreach(getAllNationStaticInfo() as $nation){
$nationname[$nation['nation']] = $nation['name']; $nationname[$nation['nation']] = $nation['name'];
$nationlevel[$nation['nation']] = $nation['level']; $nationlevel[$nation['nation']] = $nation['level'];
@@ -255,9 +261,9 @@ for($j=0; $j < $gencount; $j++) {
} }
if($general['injury'] > 0) { if($general['injury'] > 0) {
$leader = floor($general['leader'] * (100 - $general['injury'])/100); $leader = intdiv($general['leader'] * (100 - $general['injury']), 100);
$power = floor($general['power'] * (100 - $general['injury'])/100); $power = intdiv($general['power'] * (100 - $general['injury']), 100);
$intel = floor($general['intel'] * (100 - $general['injury'])/100); $intel = intdiv($general['intel'] * (100 - $general['injury']), 100);
$leader = "<font color=red>{$leader}</font>{$lbonus}"; $leader = "<font color=red>{$leader}</font>{$lbonus}";
$power = "<font color=red>{$power}</font>"; $power = "<font color=red>{$power}</font>";
$intel = "<font color=red>{$intel}</font>"; $intel = "<font color=red>{$intel}</font>";
@@ -279,7 +285,7 @@ for($j=0; $j < $gencount; $j++) {
<td align=center>$intel</td> <td align=center>$intel</td>
<td align=center>".getLevel($general['level'])."</td>"; <td align=center>".getLevel($general['level'])."</td>";
//아국장수이거나 보는 사람이 운영자일때 보여줌 //아국장수이거나 보는 사람이 운영자일때 보여줌
if(($general['nation'] != 0 && $general['nation'] == $myNation['nation']) || Session::getUserGrade() >= 5) { if(($general['nation'] != 0 && $general['nation'] == $myNation['nation']) || $session->userGrade >= 5) {
switch($general['mode']) { switch($general['mode']) {
case 0: $mode = "×"; break; case 0: $mode = "×"; break;
case 1: $mode = "○"; break; case 1: $mode = "○"; break;
@@ -299,7 +305,7 @@ for($j=0; $j < $gencount; $j++) {
echo " echo "
<td> <td>
<font size=1>"; <font size=1>";
$turn = getTurn($connect, $general, 1); $turn = getTurn($general, 1);
for($i=0; $i < 4; $i++) { for($i=0; $i < 4; $i++) {
$k = $i+1; $k = $i+1;
+73 -52
View File
@@ -4,32 +4,44 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
increaseRefresh("내무부", 1); increaseRefresh("내무부", 1);
$query = "select conlimit from game limit 1"; $query = "select conlimit from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$query = "select no,nation,level,con,turntime,belong from general where owner='{$_SESSION['userID']}'"; $query = "select no,nation,level,con,turntime,belong from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
$query = "select secretlimit from nation where nation='{$me['nation']}'"; $query = "select secretlimit from nation where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$nation = MYDB_fetch_array($result); $nation = MYDB_fetch_array($result);
$con = checkLimit($me['con'], $admin['conlimit']); $con = checkLimit($me['con'], $admin['conlimit']);
if($con >= 2) { printLimitMsg($me['turntime']); exit(); } if ($con >= 2) {
printLimitMsg($me['turntime']);
exit();
}
if($me['level'] == 0 || ($me['level'] == 1 && $me['belong'] < $nation['secretlimit'])) { if ($me['level'] == 0 || ($me['level'] == 1 && $me['belong'] < $nation['secretlimit'])) {
echo "수뇌부가 아니거나 사관년도가 부족합니다."; echo "수뇌부가 아니거나 사관년도가 부족합니다.";
exit(); exit();
} }
if($me['level'] >= 5) { $btn = "submit"; $read = ""; } if ($me['level'] >= 5) {
else { $btn = "hidden"; $read = "readonly"; } $btn = "submit";
$read = "";
} else {
$btn = "hidden";
$read = "readonly";
}
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
@@ -37,7 +49,8 @@ else { $btn = "hidden"; $read = "readonly"; }
<head> <head>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<title>내무부</title> <title>내무부</title>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
@@ -59,20 +72,20 @@ else { $btn = "hidden"; $read = "readonly"; }
</tr> </tr>
<?php <?php
$query = "select year,month from game limit 1"; $query = "select year,month from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$query = "select nation,name,color,power,gennum from nation order by power desc"; $query = "select nation,name,color,power,gennum from nation order by power desc";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$nationcount = MYDB_num_rows($result); $nationcount = MYDB_num_rows($result);
for($i=0; $i < $nationcount; $i++) { for ($i=0; $i < $nationcount; $i++) {
$nation = MYDB_fetch_array($result); $nation = MYDB_fetch_array($result);
// 아국표시 // 아국표시
if($nation['nation'] == $me['nation']) { if ($nation['nation'] == $me['nation']) {
//속령수 //속령수
$query = "select city from city where nation='{$nation['nation']}'"; $query = "select city from city where nation='{$nation['nation']}'";
$result2 = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result2 = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$citycount = MYDB_num_rows($result2); $citycount = MYDB_num_rows($result2);
echo " echo "
<tr> <tr>
@@ -90,17 +103,17 @@ for($i=0; $i < $nationcount; $i++) {
} }
$query = "select state,term,fixed,reserved,showing from diplomacy where me='{$me['nation']}' and you='{$nation['nation']}'"; $query = "select state,term,fixed,reserved,showing from diplomacy where me='{$me['nation']}' and you='{$nation['nation']}'";
$result2 = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result2 = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$dip = MYDB_fetch_array($result2); $dip = MYDB_fetch_array($result2);
$query = "select reserved,showing from diplomacy where you='{$me['nation']}' and me='{$nation['nation']}'"; $query = "select reserved,showing from diplomacy where you='{$me['nation']}' and me='{$nation['nation']}'";
$result2 = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result2 = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$dip2 = MYDB_fetch_array($result2); $dip2 = MYDB_fetch_array($result2);
//속령수 //속령수
$query = "select city from city where nation='{$nation['nation']}'"; $query = "select city from city where nation='{$nation['nation']}'";
$result2 = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result2 = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$citycount = MYDB_num_rows($result2); $citycount = MYDB_num_rows($result2);
switch($dip['state']) { switch ($dip['state']) {
case 0: $state = "<font color=red>교 전</font>"; break; case 0: $state = "<font color=red>교 전</font>"; break;
case 1: $state = "<font color=magenta>선포중</font>"; break; case 1: $state = "<font color=magenta>선포중</font>"; break;
case 2: $state = "통 상"; break; case 2: $state = "통 상"; break;
@@ -112,40 +125,42 @@ for($i=0; $i < $nationcount; $i++) {
} }
$term = $admin['year'] * 12 + $admin['month'] + $dip['term']; $term = $admin['year'] * 12 + $admin['month'] + $dip['term'];
$year = floor($term / 12); $year = intdiv($term, 12);
$month = $term % 12; $month = $term % 12;
if($month == 0) { if ($month == 0) {
$month = 12; $month = 12;
$year--; $year--;
} }
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
$note = ""; $note = "";
if($dip['fixed'] != "") { if ($dip['fixed'] != "") {
if($dip['state'] == 7) { if ($dip['state'] == 7) {
$note .= $dip['fixed']; $note .= $dip['fixed'];
} else { } else {
$note .= "<font color=gray>{$dip['fixed']}</font>"; $note .= "<font color=gray>{$dip['fixed']}</font>";
} }
if($dip['reserved'] != "" || $dip2['reserved'] != "") { if ($dip['reserved'] != "" || $dip2['reserved'] != "") {
$note .= "<br>"; $note .= "<br>";
} }
} }
if($dip['showing'] >= $date) { if ($dip['showing'] >= $date) {
if($dip['reserved'] != "") { if ($dip['reserved'] != "") {
$note .= "<font color=skyblue>아국측 제의</font>: ".$dip['reserved']; $note .= "<font color=skyblue>아국측 제의</font>: ".$dip['reserved'];
if($dip2['reserved'] != "") { if ($dip2['reserved'] != "") {
$note .= "<br>"; $note .= "<br>";
} }
} }
} }
if($dip2['showing'] >= $date) { if ($dip2['showing'] >= $date) {
if($dip2['reserved'] != "") { if ($dip2['reserved'] != "") {
$note .= "<font color=limegreen>상대측 제의</font>: ".$dip2['reserved']; $note .= "<font color=limegreen>상대측 제의</font>: ".$dip2['reserved'];
} }
} }
if($note == "") { $note = "&nbsp;"; } if ($note == "") {
$note = "&nbsp;";
}
echo " echo "
<tr> <tr>
@@ -154,7 +169,7 @@ for($i=0; $i < $nationcount; $i++) {
<td align=center>{$nation['gennum']}</td> <td align=center>{$nation['gennum']}</td>
<td align=center>$citycount</td> <td align=center>$citycount</td>
<td align=center>$state</td>"; <td align=center>$state</td>";
if($dip['term'] != 0) { if ($dip['term'] != 0) {
echo" echo"
<td align=center>{$dip['term']} 개월</td> <td align=center>{$dip['term']} 개월</td>
<td align=center>{$year}年 {$month}月</td>"; <td align=center>{$year}年 {$month}月</td>";
@@ -172,42 +187,48 @@ echo "
"; ";
$query = "select nation,name,color,type,msg,gold,rice,bill,rate,scout,war,scoutmsg,secretlimit from nation where nation='{$me['nation']}'"; $query = "select nation,name,color,type,msg,gold,rice,bill,rate,scout,war,scoutmsg,secretlimit from nation where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$nation = MYDB_fetch_array($result); $nation = MYDB_fetch_array($result);
$query = "select gold_rate,rice_rate from game limit 1"; $query = "select gold_rate,rice_rate from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
// 금 수지 // 금 수지
$deadIncome = getDeadIncome($connect, $nation['nation'], $nation['type'], $admin['gold_rate']); $deadIncome = getDeadIncome($nation['nation'], $nation['type'], $admin['gold_rate']);
$goldincomeList = getGoldIncome($connect, $nation['nation'], $nation['rate'], $admin['gold_rate'], $nation['type']); $goldincomeList = getGoldIncome($nation['nation'], $nation['rate'], $admin['gold_rate'], $nation['type']);
$goldincome = $goldincomeList[0] + $goldincomeList[1] + $deadIncome; $goldincome = $goldincomeList[0] + $goldincomeList[1] + $deadIncome;
$goldoutcome = getGoldOutcome($connect, $nation['nation'], $nation['bill']); $goldoutcome = getGoldOutcome($nation['nation'], $nation['bill']);
$riceincomeList = getRiceIncome($connect, $nation['nation'], $nation['rate'], $admin['rice_rate'], $nation['type']); $riceincomeList = getRiceIncome($nation['nation'], $nation['rate'], $admin['rice_rate'], $nation['type']);
$riceincome = $riceincomeList[0] + $riceincomeList[1]; $riceincome = $riceincomeList[0] + $riceincomeList[1];
$riceoutcome = getRiceOutcome($connect, $nation['nation'], $nation['bill']); $riceoutcome = getRiceOutcome($nation['nation'], $nation['bill']);
$budgetgold = $nation['gold'] + $goldincome - $goldoutcome + $deadIncome; $budgetgold = $nation['gold'] + $goldincome - $goldoutcome + $deadIncome;
$budgetrice = $nation['rice'] + $riceincome - $riceoutcome; $budgetrice = $nation['rice'] + $riceincome - $riceoutcome;
$budgetgolddiff = $goldincome - $goldoutcome + $deadIncome; $budgetgolddiff = $goldincome - $goldoutcome + $deadIncome;
$budgetricediff = $riceincome - $riceoutcome; $budgetricediff = $riceincome - $riceoutcome;
if($budgetgolddiff > 0) { $budgetgolddiff = "+{$budgetgolddiff}"; } if ($budgetgolddiff > 0) {
else { $budgetgolddiff = "$budgetgolddiff"; } $budgetgolddiff = "+{$budgetgolddiff}";
if($budgetricediff > 0) { $budgetricediff = "+{$budgetricediff}"; } } else {
else { $budgetricediff = "$budgetricediff"; } $budgetgolddiff = "$budgetgolddiff";
}
if ($budgetricediff > 0) {
$budgetricediff = "+{$budgetricediff}";
} else {
$budgetricediff = "$budgetricediff";
}
?> ?>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<form name=form1 method=post action=c_dipcenter.php> <form name=form1 method=post action=c_dipcenter.php>
<tr><td colspan=2 height=10></td></tr> <tr><td colspan=2 height=10></td></tr>
<tr><td colspan=2 align=center bgcolor=orange>국 가 방 침 & 임관 권유 메세지</td></tr> <tr><td colspan=2 align=center bgcolor=orange>국 가 방 침 &amp; 임관 권유 메세지</td></tr>
<tr><td colspan=2 id=bg1>국가 방침 <input type=text <?=$read;?> maxlength=500 style=color:white;background-color:black;width:830; name=msg value='<?=$nation['msg'];?>'><input type=<?=$btn;?> name=btn value=국가방침></td></tr> <tr><td colspan=2 id=bg1>국가 방침 <input type=text <?=$read?> maxlength=500 style=color:white;background-color:black;width:830px; name=msg value='<?=$nation['msg']?>'><input type=<?=$btn?> name=btn value=국가방침></td></tr>
<tr><td colspan=2 id=bg1>임관 권유 <input type=text <?=$read;?> maxlength=500 style=color:white;background-color:black;width:830; name=scoutmsg value='<?=$nation['scoutmsg'];?>'><input type=<?=$btn;?> name=btn value=임관권유></td></tr> <tr><td colspan=2 id=bg1>임관 권유 <input type=text <?=$read?> maxlength=500 style=color:white;background-color:black;width:830px; name=scoutmsg value='<?=$nation['scoutmsg']?>'><input type=<?=$btn?> name=btn value=임관권유></td></tr>
<tr><td colspan=2>900 x 200px 넘는 크기를 점유할 시 통보없이 제한될 수 있습니다.</td></tr> <tr><td colspan=2>900 x 200px 넘는 크기를 점유할 시 통보없이 제한될 수 있습니다.</td></tr>
<tr><td colspan=2 height=10></td></tr> <tr><td colspan=2 height=10></td></tr>
<tr><td colspan=2 align=center bgcolor=green>예 산 & 정 책</td></tr> <tr><td colspan=2 align=center bgcolor=green>예 산 &amp; 정 책</td></tr>
<tr> <tr>
<td colspan=2> <td colspan=2>
<table width=998 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table width=998 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
@@ -250,20 +271,20 @@ echo "
?> ?>
<tr> <tr>
<td align=right id=bg1>세율 (5 ~ 30%)&nbsp;&nbsp;&nbsp;</td> <td align=right id=bg1>세율 (5 ~ 30%)&nbsp;&nbsp;&nbsp;</td>
<td align=center><input type=text <?=$read;?> name=rate style=text-align:right;color:white;background-color:black; size=3 maxlength=3 value=<?=$nation['rate']?>>% <input type=<?=$btn;?> name=btn value=세율></td> <td align=center><input type=text <?=$read?> name=rate style=text-align:right;color:white;background-color:black; size=3 maxlength=3 value=<?=$nation['rate']?>>% <input type=<?=$btn?> name=btn value=세율></td>
<td align=right id=bg1>봉급 지급율 (20 ~ 200%)&nbsp;&nbsp;&nbsp;</td> <td align=right id=bg1>봉급 지급율 (20 ~ 200%)&nbsp;&nbsp;&nbsp;</td>
<td align=center><input type=text <?=$read;?> name=bill style=text-align:right;color:white;background-color:black; size=3 maxlength=3 value=<?=$nation['bill']?>>% <input type=<?=$btn;?> name=btn value=지급율></td> <td align=center><input type=text <?=$read?> name=bill style=text-align:right;color:white;background-color:black; size=3 maxlength=3 value=<?=$nation['bill']?>>% <input type=<?=$btn?> name=btn value=지급율></td>
</tr> </tr>
<tr> <tr>
<td align=right id=bg1>기밀 권한 (1 ~ 99년)&nbsp;&nbsp;&nbsp;</td> <td align=right id=bg1>기밀 권한 (1 ~ 99년)&nbsp;&nbsp;&nbsp;</td>
<td align=center><input type=text <?=$read;?> name=secretlimit style=text-align:right;color:white;background-color:black; size=3 maxlength=3 value=<?=$nation['secretlimit']?>>년 <input type=<?=$btn;?> name=btn value=기밀권한></td> <td align=center><input type=text <?=$read?> name=secretlimit style=text-align:right;color:white;background-color:black; size=3 maxlength=3 value=<?=$nation['secretlimit']?>>년 <input type=<?=$btn?> name=btn value=기밀권한></td>
<td align=right id=bg1>임관&전쟁 변경 가능</td> <td align=right id=bg1>임관&전쟁 변경 가능</td>
<td align=center>무제한</td> <td align=center>무제한</td>
</tr> </tr>
<tr> <tr>
<td colspan=4 align=center> <td colspan=4 align=center>
<?php <?php
if($nation['scout'] == 0) { if ($nation['scout'] == 0) {
echo " echo "
<input type=$btn name=btn value='임관 금지'>"; <input type=$btn name=btn value='임관 금지'>";
} else { } else {
@@ -271,7 +292,7 @@ if($nation['scout'] == 0) {
<input type=$btn name=btn value='임관 허가'>"; <input type=$btn name=btn value='임관 허가'>";
} }
if($nation['war'] == 0) { if ($nation['war'] == 0) {
echo " echo "
<input type=$btn name=btn value='전쟁 금지'>"; <input type=$btn name=btn value='전쟁 금지'>";
} else { } else {
+97 -83
View File
@@ -4,22 +4,27 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
increaseRefresh("중원정보", 1); increaseRefresh("중원정보", 1);
$query = "select turnterm from game limit 1"; $query = "select turnterm from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$query = "select no,nation,map from general where owner='{$_SESSION['userID']}'"; $query = "select no,nation,map from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
$query = "select nation,color,name,power,gennum from nation where level>0 order by power desc"; $query = "select nation,color,name,power,gennum from nation where level>0 order by power desc";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$nationcount = MYDB_num_rows($result); $nationcount = MYDB_num_rows($result);
$nationnum = array(); $nationnum = [];
$nationname = [];
$nationStr = ""; $nationStr = "";
$powerStr = ""; $powerStr = "";
@@ -33,9 +38,8 @@ for($i=0; $i < $nationcount; $i++) {
$citycount = MYDB_num_rows($cityresult); $citycount = MYDB_num_rows($cityresult);
$nationnum[count($nationnum)] = $nation['nation']; $nationnum[] = $nation['nation'];
$nationname[$nation['nation']] = $nation['name']; $nationname[$nation['nation']] = $nation['name'];
$nationcolor[$nation['nation']] = $nation['color'];
$nationStr .= "<font color=cyan>◆</font> <font style=color:".newColor($nation['color']).";background-color:{$nation['color']};>{$nation['name']}</font><br>"; $nationStr .= "<font color=cyan>◆</font> <font style=color:".newColor($nation['color']).";background-color:{$nation['color']};>{$nation['name']}</font><br>";
$powerStr .= "국력 {$nation['power']}<br>"; $powerStr .= "국력 {$nation['power']}<br>";
@@ -43,6 +47,31 @@ for($i=0; $i < $nationcount; $i++) {
$cityStr .= "속령 $citycount<br>"; $cityStr .= "속령 $citycount<br>";
} }
$realConflict = [];
foreach ($db->queryAllLists('SELECT city, `name`, conflict FROM city WHERE conflict!=%s', '{}') as list(
$cityID,
$cityName,
$rawConflict
))
{
$conflict = Json::decode($rawConflict);
if (count($conflict)<2) {
continue;
}
$sum = array_sum($conflict);
foreach ($conflict as $nationID=>$killnum) {
$conflict[$nationID] = ['killnum'=>$killnum];
$conflict[$nationID]['percent'] = round(100*$killnum / $sum, 1);
$conflict[$nationID]['name'] = $nationname[$nationID];
$conflict[$nationID]['color'] = getNationStaticInfo($nationID)['color'];
}
$realConflict[] = [$cityID, $cityName, $conflict];
};
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
@@ -51,6 +80,7 @@ for($i=0; $i < $nationcount; $i++) {
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>중원정보</title> <title>중원정보</title>
<script src="../e_lib/jquery-3.2.1.min.js"></script> <script src="../e_lib/jquery-3.2.1.min.js"></script>
<script src="../d_shared/common_path.js"></script>
<script src="js/common.js"></script> <script src="js/common.js"></script>
<script src="js/base_map.js"></script> <script src="js/base_map.js"></script>
<script src="js/map.js"></script> <script src="js/map.js"></script>
@@ -65,6 +95,7 @@ $(function(){
}); });
</script> </script>
<link href="css/normalize.css" rel="stylesheet"> <link href="css/normalize.css" rel="stylesheet">
<link href="../d_shared/common.css" rel="stylesheet">
<link href="css/common.css" rel="stylesheet"> <link href="css/common.css" rel="stylesheet">
<link href="css/map.css" rel="stylesheet"> <link href="css/map.css" rel="stylesheet">
@@ -76,23 +107,25 @@ $(function(){
</table> </table>
<br> <br>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr><td colspan=<?=$nationcount+1;?> align=center bgcolor=blue>외 교 현 황</td></tr> <tr><td colspan=<?=$nationcount+1?> align=center bgcolor=blue>외 교 현 황</td></tr>
<?php <?php
echo " echo "
<tr> <tr>
<td align=center width=108 style=background-color:$_basecolor2;>&nbsp;</td>"; <td align=center width=108 style=background-color:".GameConst::$basecolor2.";>&nbsp;</td>";
if($nationcount != 0) { if($nationcount != 0) {
$width = floor(888 / $nationcount); $width = intdiv(888, $nationcount);
} }
for($i=0; $i < $nationcount; $i++) { for($i=0; $i < $nationcount; $i++) {
echo " echo "
<td align=center width={$width} style=background-color:{$nationcolor[$nationnum[$i]]};color:".newColor($nationcolor[$nationnum[$i]]).";>{$nationname[$nationnum[$i]]}</td>"; <td align=center width={$width} style=background-color:".getNationStaticInfo($nationnum[$i])['color'].";color:".newColor(getNationStaticInfo($nationnum[$i])['color']).";>{$nationname[$nationnum[$i]]}</td>";
} }
echo " echo "
</tr>"; </tr>";
$state = [];
for($i=0; $i < $nationcount; $i++) { for($i=0; $i < $nationcount; $i++) {
$query = "select you,state from diplomacy where me='$nationnum[$i]'"; $query = "select you,state from diplomacy where me='$nationnum[$i]'";
$dipresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $dipresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
@@ -103,7 +136,7 @@ for($i=0; $i < $nationcount; $i++) {
} }
echo " echo "
<tr> <tr>
<td align=center style=background-color:{$nationcolor[$nationnum[$i]]};color:".newColor($nationcolor[$nationnum[$i]]).";>{$nationname[$nationnum[$i]]}</td>"; <td align=center style=background-color:".getNationStaticInfo($nationnum[$i])['color'].";color:".newColor(getNationStaticInfo($nationnum[$i])['color']).";>{$nationname[$nationnum[$i]]}</td>";
for($k=0; $k < $nationcount; $k++) { for($k=0; $k < $nationcount; $k++) {
if($i == $k) { if($i == $k) {
@@ -113,7 +146,7 @@ for($i=0; $i < $nationcount; $i++) {
case 0: $str = "<font color=red>★</font>"; break; case 0: $str = "<font color=red>★</font>"; break;
case 1: $str = "<font color=magenta>▲</font>"; break; case 1: $str = "<font color=magenta>▲</font>"; break;
case 2: case 2:
if($nationnum[$i] == $me['nation'] || $nationnum[$k] == $me['nation'] || Session::getUserGrade() >= 5) { $str = "ㆍ"; } if($nationnum[$i] == $me['nation'] || $nationnum[$k] == $me['nation'] || $session->userGrade >= 5) { $str = "ㆍ"; }
else { $str = "?"; } else { $str = "?"; }
// $str = "ㆍ"; // $str = "ㆍ";
break; break;
@@ -122,14 +155,14 @@ for($i=0; $i < $nationcount; $i++) {
case 5: $str = "<font color=cyan>◎</font>"; break; case 5: $str = "<font color=cyan>◎</font>"; break;
case 6: $str = "<font color=cyan>◎</font>"; break; case 6: $str = "<font color=cyan>◎</font>"; break;
case 7: case 7:
if($nationnum[$i] == $me['nation'] || $nationnum[$k] == $me['nation'] || Session::getUserGrade() >= 5) { $str = "<font color=green>@</font>"; } if($nationnum[$i] == $me['nation'] || $nationnum[$k] == $me['nation'] || $session->userGrade >= 5) { $str = "<font color=green>@</font>"; }
else { $str = "?"; } else { $str = "?"; }
// $str = "<font color=limegreen>@</font>"; // $str = "<font color=limegreen>@</font>";
break; break;
} }
} }
if($nationnum[$i] == $me['nation'] || $nationnum[$k] == $me['nation']) { $backcolor = "style=background-color:$_basecolor3;"; } if($nationnum[$i] == $me['nation'] || $nationnum[$k] == $me['nation']) { $backcolor = "style=background-color:".GameConst::$basecolor3.";"; }
else { $backcolor = ""; } else { $backcolor = ""; }
echo " echo "
@@ -140,79 +173,60 @@ for($i=0; $i < $nationcount; $i++) {
"; ";
} }
?> ?>
<tr><td colspan=<?=$nationcount+1;?> align=center>불가침 : <font color=limegreen>@</font>, 통합 : <font color=cyan>○</font>, 합병 : <font color=skyblue>◎</font>, 통상 : ㆍ, 선포 : <font color=magenta>▲</font>, 교전 : <font color=red>★</font></td></tr> <tr><td colspan=<?=$nationcount+1?> align=center>불가침 : <font color=limegreen>@</font>, 통합 : <font color=cyan>○</font>, 합병 : <font color=skyblue>◎</font>, 통상 : ㆍ, 선포 : <font color=magenta>▲</font>, 교전 : <font color=red>★</font></td></tr>
</table> </table>
<?php
$query = "select city,name,conflict,conflict2 from city where conflict like '%|%'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$citycount = MYDB_num_rows($result);
if($citycount != 0) { <?php if ($realConflict) : ?>
echo "
<br> <br>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table
<tr><td colspan=2 align=center bgcolor=magenta>분 쟁 현 황</td></tr>"; align='center'
} width=1000
border=1
for($i=0; $i < $citycount; $i++) { cellspacing=0
$city = MYDB_fetch_array($result); cellpadding=0
bordercolordark='gray'
if($city['conflict'] != "") { bordercolorlight='black'
$nation = explode("|", $city['conflict']); style='font-size:13px;word-break:break-all;'
$killnum = explode("|", $city['conflict2']); class='bg0'
>
$seq = mySort($killnum); // 큰 순서대로 순서를 구한다. <tr><td colspan=2 align=center bgcolor=magenta>분 쟁 현 황</td></tr>
<?php foreach($realConflict as list($cityID, $cityName, $conflict)): ?>
$sum = 0; <tr>
for($k=0; $k < count($killnum); $k++) { <td align=center width=48><?=$cityName?></td>
$sum += $killnum[$k]; <td width=948>
} <table
echo " border=0
<tr> cellspacing=0
<td align=center width=48>{$city['name']}</td> cellpadding=0
<td width=948>"; bordercolordark='gray'
for($k=0; $k < count($nation); $k++) { bordercolorlight='black'
$per = 100*$killnum[$seq[$k]] / $sum; style='font-size:13px;word-break:break-all;width:100%;'
$graph1 = $per / 100 * 798; class='bg0'
$per = round($per, 1); >
echo " <?php foreach($conflict as $item): ?>
<table border=0 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <tr>
<tr> <td
<td width=98 align=right style=color:".newColor($nationcolor[$nation[$seq[$k]]]).";background-color:{$nationcolor[$nation[$seq[$k]]]};>{$nationname[$nation[$seq[$k]]]}&nbsp;</td> width=98
<td width=48 align=right>{$per}%&nbsp;</td> align=right
<td width=$graph1 style=background-color:{$nationcolor[$nation[$seq[$k]]]};></td> style='color:<?=newColor($item['color'])?>;background-color:<?=$item['color']?>;'
<td width=*></td> ><?=$item['name']?>&nbsp;</td>
</tr> <td width=48 align=right><?=(float)$item['percent']?> %&nbsp;</td>
</table>"; <td width=*><div
} style='display:inline-block;width:<?=$item['percent']?>%;background-color:<?=$item['color']?>;'
echo " >&nbsp;</div></td>
</td> </tr>
</tr> <?php endforeach; ?>
<tr><td colspan=2 height=5 id=bg1></td></tr>"; </table>
}
} </td>
</tr>
function mySort($killnum) { <?php endforeach; ?>
for($i=0; $i < count($killnum); $i++) { <tr><td colspan=2 height=5 id=bg1></td></tr>
$seq[$i] = $i;
}
for($i=0; $i < count($killnum); $i++) {
$max = 0;
for($k=0; $k < count($killnum); $k++) {
if($max < $killnum[$k]) {
$max = $killnum[$k];
$index = $k;
}
}
$seq[$i] = $index;
$killnum[$index] = 0;
}
return $seq;
}
?>
</table> </table>
<?php endif; ?>
<br> <br>
<table class="bg0" align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style="font-size:13px;word-break:break-all;"> <table class="bg0" align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style="font-size:13px;word-break:break-all;">
<tr> <tr>
+64 -45
View File
@@ -3,44 +3,60 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
$type = Util::getReq('type', 'int', 7);
if ($type <= 0 || $type > 8) {
$type = 7;
}
extractMissingPostToGlobals();
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
increaseRefresh("암행부", 2); increaseRefresh("암행부", 2);
$query = "select conlimit from game limit 1"; $query = "select conlimit from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$query = "select no,nation,level,con,turntime,belong from general where owner='{$_SESSION['userID']}'"; $query = "select no,nation,level,con,turntime,belong from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
$query = "select level,secretlimit from nation where nation='{$me['nation']}'"; $query = "select level,secretlimit from nation where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$nation = MYDB_fetch_array($result); $nation = MYDB_fetch_array($result);
$con = checkLimit($me['con'], $admin['conlimit']); $con = checkLimit($me['con'], $admin['conlimit']);
if($con >= 2) { printLimitMsg($me['turntime']); exit(); } if ($con >= 2) {
printLimitMsg($me['turntime']);
exit();
}
if($me['level'] == 0 || ($me['level'] == 1 && $me['belong'] < $nation['secretlimit'])) { if ($me['level'] == 0 || ($me['level'] == 1 && $me['belong'] < $nation['secretlimit'])) {
echo "수뇌부가 아니거나 사관년도가 부족합니다."; echo "수뇌부가 아니거나 사관년도가 부족합니다.";
exit(); exit();
} }
if($type == 0) { $sel = [];
$type = 7;
}
$sel[$type] = "selected"; $sel[$type] = "selected";
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<?php if($con == 1) { MessageBox("접속제한이 얼마 남지 않았습니다!"); } ?> <?php if ($con == 1) {
MessageBox("접속제한이 얼마 남지 않았습니다!");
} ?>
<head> <head>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<title>암행부</title> <title>암행부</title>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
@@ -49,29 +65,29 @@ $sel[$type] = "selected";
<tr><td>암 행 부<br><?=closeButton()?></td></tr> <tr><td>암 행 부<br><?=closeButton()?></td></tr>
<tr><td><form name=form1 method=post>정렬순서 : <tr><td><form name=form1 method=post>정렬순서 :
<select name=type size=1> <select name=type size=1>
<option <?=$sel[1];?> value=1>자금</option> <option <?=$sel[1]??''?> value=1>자금</option>
<option <?=$sel[2];?> value=2>군량</option> <option <?=$sel[2]??''?> value=2>군량</option>
<option <?=$sel[3];?> value=3>도시</option> <option <?=$sel[3]??''?> value=3>도시</option>
<option <?=$sel[4];?> value=4>병종</option> <option <?=$sel[4]??''?> value=4>병종</option>
<option <?=$sel[5];?> value=5>병사</option> <option <?=$sel[5]??''?> value=5>병사</option>
<option <?=$sel[6];?> value=6>삭제턴</option> <option <?=$sel[6]??''?> value=6>삭제턴</option>
<option <?=$sel[7];?> value=7>턴</option> <option <?=$sel[7]??''?> value=7>턴</option>
<option <?=$sel[8];?> value=8>부대</option> <option <?=$sel[8]??''?> value=8>부대</option>
</select> </select>
<input type=submit value='정렬하기'></form> <input type=submit value='정렬하기'></form>
</td></tr> </td></tr>
</table> </table>
<?php <?php
$query = "select troop,name from troop where nation='{$me['nation']}'"; $query = "select troop,name from troop where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$troopCount = MYDB_num_rows($result); $troopCount = MYDB_num_rows($result);
$troopName = [];
for($i=0; $i < $troopCount; $i++) { for ($i=0; $i < $troopCount; $i++) {
$troop = MYDB_fetch_array($result); $troop = MYDB_fetch_array($result);
$troopName[$troop['troop']] = $troop['name']; $troopName[$troop['troop']] = $troop['name'];
} }
switch($type) { switch ($type) {
case 1: $query = "select npc,mode,no,level,troop,city,injury,leader,power,intel,experience,name,gold,rice,crewtype,crew,train,atmos,killturn,turntime,term,turn0,turn1,turn2,turn3,turn4 from general where nation='{$me['nation']}' order by gold desc"; break; case 1: $query = "select npc,mode,no,level,troop,city,injury,leader,power,intel,experience,name,gold,rice,crewtype,crew,train,atmos,killturn,turntime,term,turn0,turn1,turn2,turn3,turn4 from general where nation='{$me['nation']}' order by gold desc"; break;
case 2: $query = "select npc,mode,no,level,troop,city,injury,leader,power,intel,experience,name,gold,rice,crewtype,crew,train,atmos,killturn,turntime,term,turn0,turn1,turn2,turn3,turn4 from general where nation='{$me['nation']}' order by rice desc"; break; case 2: $query = "select npc,mode,no,level,troop,city,injury,leader,power,intel,experience,name,gold,rice,crewtype,crew,train,atmos,killturn,turntime,term,turn0,turn1,turn2,turn3,turn4 from general where nation='{$me['nation']}' order by rice desc"; break;
case 3: $query = "select npc,mode,no,level,troop,city,injury,leader,power,intel,experience,name,gold,rice,crewtype,crew,train,atmos,killturn,turntime,term,turn0,turn1,turn2,turn3,turn4 from general where nation='{$me['nation']}' order by city"; break; case 3: $query = "select npc,mode,no,level,troop,city,injury,leader,power,intel,experience,name,gold,rice,crewtype,crew,train,atmos,killturn,turntime,term,turn0,turn1,turn2,turn3,turn4 from general where nation='{$me['nation']}' order by city"; break;
@@ -81,7 +97,7 @@ switch($type) {
case 7: $query = "select npc,mode,no,level,troop,city,injury,leader,power,intel,experience,name,gold,rice,crewtype,crew,train,atmos,killturn,turntime,term,turn0,turn1,turn2,turn3,turn4 from general where nation='{$me['nation']}' order by turntime"; break; case 7: $query = "select npc,mode,no,level,troop,city,injury,leader,power,intel,experience,name,gold,rice,crewtype,crew,train,atmos,killturn,turntime,term,turn0,turn1,turn2,turn3,turn4 from general where nation='{$me['nation']}' order by turntime"; break;
case 8: $query = "select npc,mode,no,level,troop,city,injury,leader,power,intel,experience,name,gold,rice,crewtype,crew,train,atmos,killturn,turntime,term,turn0,turn1,turn2,turn3,turn4 from general where nation='{$me['nation']}' order by troop desc"; break; case 8: $query = "select npc,mode,no,level,troop,city,injury,leader,power,intel,experience,name,gold,rice,crewtype,crew,train,atmos,killturn,turntime,term,turn0,turn1,turn2,turn3,turn4 from general where nation='{$me['nation']}' order by troop desc"; break;
} }
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$gencount = MYDB_num_rows($genresult); $gencount = MYDB_num_rows($genresult);
echo" echo"
@@ -102,28 +118,28 @@ echo"
<td width=58 align=center id=bg1>삭턴</td> <td width=58 align=center id=bg1>삭턴</td>
<td width=58 align=center id=bg1>턴</td> <td width=58 align=center id=bg1>턴</td>
</tr>"; </tr>";
for($j=0; $j < $gencount; $j++) { for ($j=0; $j < $gencount; $j++) {
$general = MYDB_fetch_array($genresult); $general = MYDB_fetch_array($genresult);
$city = CityConst::byID($general['city'])->name; $city = CityConst::byID($general['city'])->name;
$troop = $troopName[$general['troop']] == "" ? "-" : $troopName[$general['troop']]; $troop = $troopName[$general['troop']]??'-';
if($general['level'] == 12) { if ($general['level'] == 12) {
$lbonus = $nation['level'] * 2; $lbonus = $nation['level'] * 2;
} elseif($general['level'] >= 5) { } elseif ($general['level'] >= 5) {
$lbonus = $nation['level']; $lbonus = $nation['level'];
} else { } else {
$lbonus = 0; $lbonus = 0;
} }
if($lbonus > 0) { if ($lbonus > 0) {
$lbonus = "<font color=cyan>+{$lbonus}</font>"; $lbonus = "<font color=cyan>+{$lbonus}</font>";
} else { } else {
$lbonus = ""; $lbonus = "";
} }
if($general['injury'] > 0) { if ($general['injury'] > 0) {
$leader = floor($general['leader'] * (100 - $general['injury'])/100); $leader = intdiv($general['leader'] * (100 - $general['injury']), 100);
$power = floor($general['power'] * (100 - $general['injury'])/100); $power = intdiv($general['power'] * (100 - $general['injury']), 100);
$intel = floor($general['intel'] * (100 - $general['injury'])/100); $intel = intdiv($general['intel'] * (100 - $general['injury']), 100);
$leader = "<font color=red>{$leader}</font>{$lbonus}"; $leader = "<font color=red>{$leader}</font>{$lbonus}";
$power = "<font color=red>{$power}</font>"; $power = "<font color=red>{$power}</font>";
$intel = "<font color=red>{$intel}</font>"; $intel = "<font color=red>{$intel}</font>";
@@ -133,11 +149,15 @@ for($j=0; $j < $gencount; $j++) {
$intel = "{$general['intel']}"; $intel = "{$general['intel']}";
} }
if($general['npc'] >= 2) { $name = "<font color=cyan>{$general['name']}</font>"; } if ($general['npc'] >= 2) {
elseif($general['npc'] == 1) { $name = "<font color=skyblue>{$general['name']}</font>"; } $name = "<font color=cyan>{$general['name']}</font>";
else { $name = "{$general['name']}"; } } elseif ($general['npc'] == 1) {
$name = "<font color=skyblue>{$general['name']}</font>";
} else {
$name = "{$general['name']}";
}
switch($general['mode']) { switch ($general['mode']) {
case 0: $mode = "×"; break; case 0: $mode = "×"; break;
case 1: $mode = "○"; break; case 1: $mode = "○"; break;
case 2: $mode = "◎"; break; case 2: $mode = "◎"; break;
@@ -156,7 +176,7 @@ for($j=0; $j < $gencount; $j++) {
<td align=center>{$general['crew']}</td> <td align=center>{$general['crew']}</td>
<td align=center>{$general['train']}</td> <td align=center>{$general['train']}</td>
<td align=center>{$general['atmos']}</td>"; <td align=center>{$general['atmos']}</td>";
if($general['npc'] >= 2) { if ($general['npc'] >= 2) {
echo " echo "
<td> <td>
<font size=3>NPC 장수"; <font size=3>NPC 장수";
@@ -164,10 +184,10 @@ for($j=0; $j < $gencount; $j++) {
echo " echo "
<td> <td>
<font size=1>"; <font size=1>";
$turn = getTurn($connect, $general, 1, 0); $turn = getTurn($general, 1, 0);
for($i=0; $i < 5; $i++) { for ($i=0; $i < 5; $i++) {
$turn[$i] = StringUtil::SubStrForWidth($turn[$i], 0, 20); $turn[$i] = StringUtil::subStringForWidth($turn[$i], 0, 20);
$k = $i+1; $k = $i+1;
echo " echo "
&nbsp;$k : $turn[$i] <br>"; &nbsp;$k : $turn[$i] <br>";
@@ -177,14 +197,13 @@ for($j=0; $j < $gencount; $j++) {
</font> </font>
</td> </td>
<td align=center>{$general['killturn']}</td> <td align=center>{$general['killturn']}</td>
<td align=center>".substr($general['turntime'],14,5)."</td> <td align=center>".substr($general['turntime'], 14, 5)."</td>
</tr>"; </tr>";
} }
echo " echo "
</table> </table>
"; ";
MYDB_close($connect);
?> ?>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
+30 -22
View File
@@ -4,13 +4,17 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
increaseRefresh("인사부", 1); increaseRefresh("인사부", 1);
//훼섭 추방을 위해 갱신 //훼섭 추방을 위해 갱신
checkTurn($connect); checkTurn();
$query = "select no,nation,level from general where owner='{$_SESSION['userID']}'"; $query = "select no,nation,level from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
@@ -27,7 +31,8 @@ if($meLevel == 0) {
<head> <head>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<title>인사부</title> <title>인사부</title>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
<script type="text/javascript"> <script type="text/javascript">
function out() { function out() {
return confirm('정말 추방하시겠습니까?'); return confirm('정말 추방하시겠습니까?');
@@ -54,6 +59,7 @@ else { $btn = "hidden"; }
$query = "select name,level,picture,imgsvr,belong from general where nation='{$nation['nation']}' and level>={$lv} order by level desc"; $query = "select name,level,picture,imgsvr,belong from general where nation='{$nation['nation']}' and level>={$lv} order by level desc";
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$level = [];
for($i=12; $i >= $lv; $i--) { for($i=12; $i >= $lv; $i--) {
$levels = MYDB_fetch_array($genresult); $levels = MYDB_fetch_array($genresult);
$level[$levels['level']] = $levels; $level[$levels['level']] = $levels;
@@ -75,18 +81,18 @@ echo "
"; ";
for($i=12; $i >= $lv; $i-=2) { for($i=12; $i >= $lv; $i-=2) {
$i1 = $i; $i2 = $i - 1; $i1 = $i; $i2 = $i - 1;
$imageTemp1 = GetImageURL($level[$i1]['imgsvr']); $imageTemp1 = GetImageURL($level[$i1]['imgsvr']??0);
$imageTemp2 = GetImageURL($level[$i2]['imgsvr']); $imageTemp2 = GetImageURL($level[$i2]['imgsvr']??0);
echo " ?>
<tr> <tr>
<td width=98 align=center id=bg1><font size=4>".getLevel($i1, $nation['level'])."</font></td> <td width=98 align=center id=bg1><font size=4><?=getLevel($i1, $nation['level'])?></font></td>
<td width=64 height=64 background={$imageTemp1}/{$level[$i1]['picture']}>&nbsp;</td> <td width=64 height=64 style='background:no-repeat center url("<?=$imageTemp1?>/<?=$level[$i1]['picture']??'default.jpg'?>");background-size:64px;'></td>
<td width=332><font size=4>";echo $level[$i1]['name']==''?"-":$level[$i1]['name']; echo " ({$level[$i1]['belong']}년)</font></td> <td width=332><font size=4><?=$level[$i1]['name']??'-'?>(<?=$level[$i1]['belong']??'-'?>년)</font></td>
<td width=98 align=center id=bg1><font size=4>".getLevel($i2, $nation['level'])."</font></td> <td width=98 align=center id=bg1><font size=4><?=getLevel($i2, $nation['level'])?></font></td>
<td width=64 height=64 background={$imageTemp2}/{$level[$i2]['picture']}>&nbsp;</td> <td width=64 height=64 style='background:no-repeat center url("<?=$imageTemp2?>/<?=$level[$i2]['picture']??'default.jpg'?>");background-size:64px;'></td>
<td width=332><font size=4>";echo $level[$i2]['name']==''?"-":$level[$i2]['name']; echo " ({$level[$i2]['belong']}년)</font></td> <td width=332><font size=4><?=$level[$i2]['name']??'-'?>(<?=$level[$i2]['belong']??'-'?>년)</font></td>
</tr> </tr>
"; <?php
} }
echo " echo "
@@ -207,12 +213,13 @@ echo "
</tr> </tr>
"; ";
$querys[10] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and power>='".GameConst::$goodgenpower."' order by npc,binary(name)"; $queries = [];
$querys[9] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and intel>='".GameConst::$goodgenintel."' order by npc,binary(name)"; $queries[10] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and power>='".GameConst::$goodgenpower."' order by npc,binary(name)";
$querys[8] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and power>='".GameConst::$goodgenpower."' order by npc,binary(name)"; $queries[9] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and intel>='".GameConst::$goodgenintel."' order by npc,binary(name)";
$querys[7] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and intel>='".GameConst::$goodgenintel."' order by npc,binary(name)"; $queries[8] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and power>='".GameConst::$goodgenpower."' order by npc,binary(name)";
$querys[6] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and power>='".GameConst::$goodgenpower."' order by npc,binary(name)"; $queries[7] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and intel>='".GameConst::$goodgenintel."' order by npc,binary(name)";
$querys[5] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and intel>='".GameConst::$goodgenintel."' order by npc,binary(name)"; $queries[6] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and power>='".GameConst::$goodgenpower."' order by npc,binary(name)";
$queries[5] = "select no,name,level,city from general where nation='{$me['nation']}' and level!='12' and intel>='".GameConst::$goodgenintel."' order by npc,binary(name)";
for($i=10; $i >= $lv; $i--) { for($i=10; $i >= $lv; $i--) {
if($i % 2 == 0) { echo "<tr>"; } if($i % 2 == 0) { echo "<tr>"; }
@@ -227,7 +234,7 @@ for($i=10; $i >= $lv; $i--) {
<select name=genlist size=1 style=color:white;background-color:black;> <select name=genlist size=1 style=color:white;background-color:black;>
<option value=0>____공석____</option>"; <option value=0>____공석____</option>";
$query = $querys[$i]; $query = $queries[$i];
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$gencount = MYDB_num_rows($result); $gencount = MYDB_num_rows($result);
@@ -438,6 +445,7 @@ echo "
</tr> </tr>
"; ";
$citylevel = [];
$citylevel[1] = "수"; $citylevel[1] = "수";
$citylevel[2] = "진"; $citylevel[2] = "진";
$citylevel[3] = "관"; $citylevel[3] = "관";
+84 -55
View File
@@ -3,24 +3,33 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
$type = Util::getReq('type', 'int', 10);
if ($type <= 0 || $type > 12) {
$type = 10;
}
extractMissingPostToGlobals();
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
increaseRefresh("세력도시", 1); increaseRefresh("세력도시", 1);
$query = "select no,nation,level from general where owner='{$_SESSION['userID']}'"; $query = "select no,nation,level from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
if($me['level'] == 0) { if ($me['level'] == 0) {
echo "재야입니다."; echo "재야입니다.";
exit(); exit();
} }
if($type == 0) { $sel = [$type => "selected"];
$type = 10;
}
$sel[$type] = "selected";
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
@@ -29,7 +38,8 @@ $sel[$type] = "selected";
<head> <head>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<title>세력도시</title> <title>세력도시</title>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
@@ -38,70 +48,77 @@ $sel[$type] = "selected";
<tr><td>세 력 도 시<br><?=backButton()?></td></tr> <tr><td>세 력 도 시<br><?=backButton()?></td></tr>
<tr><td><form name=form1 method=post>정렬순서 : <tr><td><form name=form1 method=post>정렬순서 :
<select name=type size=1> <select name=type size=1>
<option <?=$sel[1];?> value=1>기본</option> <option <?=$sel[1]??''?> value=1>기본</option>
<option <?=$sel[2];?> value=2>인구</option> <option <?=$sel[2]??''?> value=2>인구</option>
<option <?=$sel[3];?> value=3>인구율</option> <option <?=$sel[3]??''?> value=3>인구율</option>
<option <?=$sel[4];?> value=4>민심</option> <option <?=$sel[4]??''?> value=4>민심</option>
<option <?=$sel[5];?> value=5>농업</option> <option <?=$sel[5]??''?> value=5>농업</option>
<option <?=$sel[6];?> value=6>상업</option> <option <?=$sel[6]??''?> value=6>상업</option>
<option <?=$sel[7];?> value=7>치안</option> <option <?=$sel[7]??''?> value=7>치안</option>
<option <?=$sel[8];?> value=8>수비</option> <option <?=$sel[8]??''?> value=8>수비</option>
<option <?=$sel[9];?> value=9>성벽</option> <option <?=$sel[9]??''?> value=9>성벽</option>
<option <?=$sel[10];?> value=10>시세</option> <option <?=$sel[10]??''?> value=10>시세</option>
<option <?=$sel[11];?> value=11>지역</option> <option <?=$sel[11]??''?> value=11>지역</option>
<option <?=$sel[12];?> value=12>규모</option> <option <?=$sel[12]??''?> value=12>규모</option>
</select> </select>
<input type=submit value='정렬하기'></form> <input type=submit value='정렬하기'></form>
</td></tr> </td></tr>
</table> </table>
<?php <?php
$query = "select nation from general where owner='{$_SESSION['userID']}'"; $query = "select nation from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
$nation = getNationStaticInfo($me['nation']); //국가정보 $nation = getNationStaticInfo($me['nation']); //국가정보
switch($type) { $query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}'";
case 1: $query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}'"; break;
case 2: $query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}' order by pop desc"; break; switch ($type) {
case 3: $query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}' order by poprate desc"; break; case 1: break;
case 4: $query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}' order by rate desc"; break; case 2: $query .= " order by pop desc"; break;
case 5: $query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}' order by agri desc"; break; case 3: $query .= " order by poprate desc"; break;
case 6: $query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}' order by comm desc"; break; case 4: $query .= " order by rate desc"; break;
case 7: $query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}' order by secu desc"; break; case 5: $query .= " order by agri desc"; break;
case 8: $query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}' order by def desc"; break; case 6: $query .= " order by comm desc"; break;
case 9: $query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}' order by wall desc"; break; case 7: $query .= " order by secu desc"; break;
case 10: $query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}' order by trade desc"; break; case 8: $query .= " order by def desc"; break;
case 11: $query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}' order by region,level desc"; break; case 9: $query .= " order by wall desc"; break;
case 12: $query = "select *,pop/pop2 as poprate from city where nation='{$me['nation']}' order by level desc, region"; break; case 10: $query .= " order by trade desc"; break;
case 11: $query .= " order by region,level desc"; break;
case 12: $query .= " order by level desc, region"; break;
} }
$cityresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $cityresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$citycount = MYDB_num_rows($cityresult); $citycount = MYDB_num_rows($cityresult);
for($j=0; $j < $citycount; $j++) { $region = 0;
$level = 0;
for ($j=0; $j < $citycount; $j++) {
$city = MYDB_fetch_array($cityresult); $city = MYDB_fetch_array($cityresult);
if($city['city'] == $nation['capital']) { $city['name'] = "<font color=cyan>[{$city['name']}]</font>"; } if ($city['city'] == $nation['capital']) {
$city['name'] = "<font color=cyan>[{$city['name']}]</font>";
}
$query = "select name from general where no='{$city['gen1']}'"; // 태수 $query = "select name from general where no='{$city['gen1']}'"; // 태수
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$gen1 = MYDB_fetch_array($genresult); $gen1 = MYDB_fetch_array($genresult);
$query = "select name from general where no='{$city['gen2']}'"; // 군사 $query = "select name from general where no='{$city['gen2']}'"; // 군사
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$gen2 = MYDB_fetch_array($genresult); $gen2 = MYDB_fetch_array($genresult);
$query = "select name from general where no='{$city['gen3']}'"; // 시중 $query = "select name from general where no='{$city['gen3']}'"; // 시중
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$gen3 = MYDB_fetch_array($genresult); $gen3 = MYDB_fetch_array($genresult);
if($type == 10 && $city['region'] != $region) { if ($type == 10 && $city['region'] != $region) {
echo "<br>"; echo "<br>";
$region = $city['region']; $region = $city['region'];
} elseif($type == 11 && $city['level'] != $level) { } elseif ($type == 11 && $city['level'] != $level) {
echo "<br>"; echo "<br>";
$level = $city['level']; $level = $city['level'];
} }
if($city['trade'] == 0) { if ($city['trade'] == 0) {
$city['trade'] = "- "; $city['trade'] = "- ";
} }
@@ -132,24 +149,36 @@ for($j=0; $j < $citycount; $j++) {
<td align=center id=bg1>인구</td> <td align=center id=bg1>인구</td>
<td align=center>".round($city['pop']/$city['pop2']*100, 2)." %</td> <td align=center>".round($city['pop']/$city['pop2']*100, 2)." %</td>
<td align=center id=bg1>태수</td> <td align=center id=bg1>태수</td>
<td align=center>";echo $gen1['name']==''?"-":"{$gen1['name']}";echo "</td> <td align=center>";
echo $gen1['name']==''?"-":"{$gen1['name']}";
echo "</td>
<td align=center id=bg1>군사</td> <td align=center id=bg1>군사</td>
<td align=center>";echo $gen2['name']==''?"-":"{$gen2['name']}";echo "</td> <td align=center>";
echo $gen2['name']==''?"-":"{$gen2['name']}";
echo "</td>
<td align=center id=bg1>시중</td> <td align=center id=bg1>시중</td>
<td align=center>";echo $gen3['name']==''?"-":"{$gen3['name']}";echo "</td> <td align=center>";
echo $gen3['name']==''?"-":"{$gen3['name']}";
echo "</td>
</tr> </tr>
<tr> <tr>
<td align=center id=bg1>장수</td> <td align=center id=bg1>장수</td>
<td colspan=11>"; <td colspan=11>";
$query = "select npc,name from general where city='{$city['city']}' and nation='{$me['nation']}'"; // 장수 목록 $query = "select npc,name from general where city='{$city['city']}' and nation='{$me['nation']}'"; // 장수 목록
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$gencount = MYDB_num_rows($genresult); $gencount = MYDB_num_rows($genresult);
if($gencount == 0) echo "-"; if ($gencount == 0) {
for($i=0; $i < $gencount; $i++) { echo "-";
}
for ($i=0; $i < $gencount; $i++) {
$general = MYDB_fetch_array($genresult); $general = MYDB_fetch_array($genresult);
if($general['npc'] >= 2) { echo "<font color=cyan>{$general['name']}, </font>"; } if ($general['npc'] >= 2) {
elseif($general['npc'] == 1) { echo "<font color=skyblue>{$general['name']}, </font>"; } echo "<font color=cyan>{$general['name']}, </font>";
else { echo "{$general['name']}, "; } } elseif ($general['npc'] == 1) {
echo "<font color=skyblue>{$general['name']}, </font>";
} else {
echo "{$general['name']}, ";
}
} }
echo " echo "
</td> </td>
+76 -44
View File
@@ -3,12 +3,24 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
$type = Util::getReq('type', 'int', 1);
if($type <= 0 || $type > 15) {
$type = 1;
}
extractMissingPostToGlobals();
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
increaseRefresh("세력장수", 1); increaseRefresh("세력장수", 1);
$query = "select no,nation,level from general where owner='{$_SESSION['userID']}'"; $query = "select no,nation,level from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
@@ -17,11 +29,7 @@ if($me['level'] == 0) {
exit(); exit();
} }
$sel = [$type => "selected"];
if($type == 0) {
$type = 1;
}
$sel[$type] = "selected";
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
@@ -30,7 +38,8 @@ $sel[$type] = "selected";
<head> <head>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<title>세력장수</title> <title>세력장수</title>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
@@ -39,21 +48,21 @@ $sel[$type] = "selected";
<tr><td>세 력 장 수<br><?=backButton()?></td></tr> <tr><td>세 력 장 수<br><?=backButton()?></td></tr>
<tr><td><form name=form1 method=post>정렬순서 : <tr><td><form name=form1 method=post>정렬순서 :
<select name=type size=1> <select name=type size=1>
<option <?=$sel[1];?> value=1>관직</option> <option <?=$sel[1]??''?> value=1>관직</option>
<option <?=$sel[2];?> value=2>계급</option> <option <?=$sel[2]??''?> value=2>계급</option>
<option <?=$sel[3];?> value=3>명성</option> <option <?=$sel[3]??''?> value=3>명성</option>
<option <?=$sel[4];?> value=4>통솔</option> <option <?=$sel[4]??''?> value=4>통솔</option>
<option <?=$sel[5];?> value=5>무력</option> <option <?=$sel[5]??''?> value=5>무력</option>
<option <?=$sel[6];?> value=6>지력</option> <option <?=$sel[6]??''?> value=6>지력</option>
<option <?=$sel[7];?> value=7>자금</option> <option <?=$sel[7]??''?> value=7>자금</option>
<option <?=$sel[8];?> value=8>군량</option> <option <?=$sel[8]??''?> value=8>군량</option>
<option <?=$sel[9];?> value=9>병사</option> <option <?=$sel[9]??''?> value=9>병사</option>
<option <?=$sel[10];?> value=10>벌점</option> <option <?=$sel[10]??''?> value=10>벌점</option>
<option <?=$sel[11];?> value=11>성격</option> <option <?=$sel[11]??''?> value=11>성격</option>
<option <?=$sel[12];?> value=12>내특</option> <option <?=$sel[12]??''?> value=12>내특</option>
<option <?=$sel[13];?> value=13>전특</option> <option <?=$sel[13]??''?> value=13>전특</option>
<option <?=$sel[14];?> value=14>사관</option> <option <?=$sel[14]??''?> value=14>사관</option>
<option <?=$sel[15];?> value=15>NPC</option> <option <?=$sel[15]??''?> value=15>NPC</option>
</select> </select>
<input type=submit value='정렬하기'></form> <input type=submit value='정렬하기'></form>
</td></tr> </td></tr>
@@ -61,23 +70,46 @@ $sel[$type] = "selected";
<?php <?php
$nationLevel = DB::db()->queryFirstField('select level from nation where nation = %i', $me['nation']); $nationLevel = DB::db()->queryFirstField('select level from nation where nation = %i', $me['nation']);
$orderByText = '';//FIXME: 쿼리 재작성
switch($type) { switch($type) {
case 1: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by level desc"; break; case 1: $orderByText = " order by level desc"; break;
case 2: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by dedication desc"; break; case 2: $orderByText = " order by dedication desc"; break;
case 3: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by experience desc"; break; case 3: $orderByText = " order by experience desc"; break;
case 4: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by leader desc"; break; case 4: $orderByText = " order by leader desc"; break;
case 5: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by power desc"; break; case 5: $orderByText = " order by power desc"; break;
case 6: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by intel desc"; break; case 6: $orderByText = " order by intel desc"; break;
case 7: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by gold desc"; break; case 7: $orderByText = " order by gold desc"; break;
case 8: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by rice desc"; break; case 8: $orderByText = " order by rice desc"; break;
case 9: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by crew desc"; break; case 9: $orderByText = " order by crew desc"; break;
case 10: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by connect desc"; break; case 10: $orderByText = " order by connect desc"; break;
case 11: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by personal"; break; case 11: $orderByText = " order by personal"; break;
case 12: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by special desc"; break; case 12: $orderByText = " order by special desc"; break;
case 13: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by special2 desc"; break; case 13: $orderByText = " order by special2 desc"; break;
case 14: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by belong desc"; break; case 14: $orderByText = " order by belong desc"; break;
case 15: $query = "select npc,special,special2,personal,picture,imgsvr,name,level,dedication,experience,injury,leader,power,intel,gold,rice,belong,connect,killturn from general where nation='{$me['nation']}' order by npc desc"; break; case 15: $orderByText = " order by npc desc"; break;
} }
$query =
"select
npc,
special,
special2,
personal,
picture,
imgsvr,
name,
level,
dedication,
experience,
injury,
leader,
power,
intel,
gold,
rice,
belong,
connect,
killturn
from general where nation='{$me['nation']}' ".$orderByText;
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$gencount = MYDB_num_rows($genresult); $gencount = MYDB_num_rows($genresult);
@@ -117,9 +149,9 @@ for($j=0; $j < $gencount; $j++) {
} }
if($general['injury'] > 0) { if($general['injury'] > 0) {
$leader = floor($general['leader'] * (100 - $general['injury'])/100); $leader = intdiv($general['leader'] * (100 - $general['injury']), 100);
$power = floor($general['power'] * (100 - $general['injury'])/100); $power = intdiv($general['power'] * (100 - $general['injury']), 100);
$intel = floor($general['intel'] * (100 - $general['injury'])/100); $intel = intdiv($general['intel'] * (100 - $general['injury']), 100);
$leader = "<font color=red>{$leader}</font>{$lbonus}"; $leader = "<font color=red>{$leader}</font>{$lbonus}";
$power = "<font color=red>{$power}</font>"; $power = "<font color=red>{$power}</font>";
$intel = "<font color=red>{$intel}</font>"; $intel = "<font color=red>{$intel}</font>";
@@ -136,9 +168,9 @@ for($j=0; $j < $gencount; $j++) {
$imageTemp = GetImageURL($general['imgsvr']); $imageTemp = GetImageURL($general['imgsvr']);
echo " echo "
<tr> <tr>
<td align=center background={$imageTemp}/{$general['picture']} height=64></td> <td align=center style='background:no-repeat center url(\"{$imageTemp}/{$general['picture']}\");background-size:64px;' height=64></td>
<td align=center>$name</td> <td align=center>$name</td>
<td align=center>"; echo getLevel($general['level'], $nation['level']); echo "</td> <td align=center>"; echo getLevel($general['level'], $nationLevel); echo "</td>
<td align=center>".getDed($general['dedication'])."</td> <td align=center>".getDed($general['dedication'])."</td>
<td align=center>".getHonor($general['experience'])."</td> <td align=center>".getHonor($general['experience'])."</td>
<td align=center>".getBill($general['dedication'])."</td> <td align=center>".getBill($general['dedication'])."</td>
+18 -10
View File
@@ -4,11 +4,15 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
increaseRefresh("세력정보", 1); increaseRefresh("세력정보", 1);
$query = "select no,nation,level from general where owner='{$_SESSION['userID']}'"; $query = "select no,nation,level from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
@@ -23,7 +27,8 @@ if($me['level'] == 0) {
<head> <head>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<title>세력정보</title> <title>세력정보</title>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
@@ -33,7 +38,7 @@ if($me['level'] == 0) {
</table> </table>
<br> <br>
<?php <?php
$query = "select nation from general where owner='{$_SESSION['userID']}'"; $query = "select nation from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
@@ -45,6 +50,9 @@ $query = "select city,name,pop,pop2 from city where nation='{$nation['nation']}'
$cityresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $cityresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$citycount = MYDB_num_rows($cityresult); $citycount = MYDB_num_rows($cityresult);
$totalpop = 0;
$maxpop = 0;
$cityname = [];
for($j=0; $j < $citycount; $j++) { for($j=0; $j < $citycount; $j++) {
$city = MYDB_fetch_array($cityresult); $city = MYDB_fetch_array($cityresult);
if($city['city'] == $nation['capital']) { $cityname[$j] = "<font color=cyan>[{$city['name']}]</font>"; } if($city['city'] == $nation['capital']) { $cityname[$j] = "<font color=cyan>[{$city['name']}]</font>"; }
@@ -61,14 +69,14 @@ $query = "select gold_rate,rice_rate from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
// 금 수지 // 금 수지
$deadIncome = getDeadIncome($connect, $nation['nation'], $nation['type'], $admin['gold_rate']); $deadIncome = getDeadIncome($nation['nation'], $nation['type'], $admin['gold_rate']);
$goldincomeList = getGoldIncome($connect, $nation['nation'], $nation['rate'], $admin['gold_rate'], $nation['type']); $goldincomeList = getGoldIncome($nation['nation'], $nation['rate'], $admin['gold_rate'], $nation['type']);
$goldincome = $goldincomeList[0] + $goldincomeList[1] + $deadIncome; $goldincome = $goldincomeList[0] + $goldincomeList[1] + $deadIncome;
$goldoutcome = getGoldOutcome($connect, $nation['nation'], $nation['bill']); $goldoutcome = getGoldOutcome($nation['nation'], $nation['bill']);
$riceincomeList = getRiceIncome($connect, $nation['nation'], $nation['rate'], $admin['rice_rate'], $nation['type']); $riceincomeList = getRiceIncome($nation['nation'], $nation['rate'], $admin['rice_rate'], $nation['type']);
$riceincome = $riceincomeList[0] + $riceincomeList[1]; $riceincome = $riceincomeList[0] + $riceincomeList[1];
$riceoutcome = getRiceOutcome($connect, $nation['nation'], $nation['bill']); $riceoutcome = getRiceOutcome($nation['nation'], $nation['bill']);
$budgetgold = $nation['gold'] + $goldincome - $goldoutcome + $deadIncome; $budgetgold = $nation['gold'] + $goldincome - $goldoutcome + $deadIncome;
+51 -23
View File
@@ -3,34 +3,62 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
$btn = Util::getReq('btn');
$map = Util::getReq('map', 'int', 0);
$mode = Util::getReq('mode', 'int', 2);
$tnmt = Util::getReq('tnmt', 'int', 1);
extractMissingPostToGlobals();
if($map < 0 || $map > 2){
$map = 0;
}
if($mode < 0 || $mode > 2){
$mode = 2;
}
if($tnmt < 0 || $tnmt > 1){
$tnmt = 1;
}
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
increaseRefresh("내정보", 1); increaseRefresh("내정보", 1);
$query = "select myset from general where owner='{$_SESSION['userID']}'"; $query = "select myset from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
if($me['myset'] > 0) { if ($me['myset'] > 0) {
$submit = 'submit'; $submit = 'submit';
} else { } else {
$submit = 'hidden'; $submit = 'hidden';
} }
if($btn == "설정저장" && $me['myset'] > 0) { if ($btn == "설정저장" && $me['myset'] > 0) {
if($me['myset'] > 1) { if ($me['myset'] > 1) {
$submit = 'submit'; $submit = 'submit';
} else { } else {
$submit = 'hidden'; $submit = 'hidden';
} }
$query = "update general set myset=myset-1,map='$map',mode='$mode',tnmt='$tnmt' where owner='{$_SESSION['userID']}'"; $db->update('general', [
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); 'myset'=>$db->sqleval('myset-1'),
'map'=>$map,
'mode'=>$mode,
'tnmt'=>$tnmt
], 'owner=%i', $userID);
} }
$query = "select no,map,mode,tnmt,myset from general where owner='{$_SESSION['userID']}'"; $query = "select no,map,mode,tnmt,myset from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
?> ?>
@@ -39,12 +67,12 @@ $me = MYDB_fetch_array($result);
<head> <head>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<title>내정보</title> <title>내정보</title>
<link rel=stylesheet href="css/common.css" type=text/css> <link href="../d_shared/common.css" rel="stylesheet">
<link rel=stylesheet href="css/common.css">
<script type="text/javascript"> <script type="text/javascript">
function go(type) { function go(type) {
if(type == 0){ if(type == 0){
//location.replace('c_vacation.php'); location.replace('c_vacation.php');
console.log('c_vacation.php');//TODO:debug all and replace
} }
} }
</script> </script>
@@ -58,8 +86,8 @@ function go(type) {
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr> <tr>
<td width=50%> <td width=50%>
<?php myInfo($connect); ?> <?php myInfo(); ?>
<?php myInfo2($connect); ?> <?php myInfo2(); ?>
</td> </td>
<td width=50% valign=top> <td width=50% valign=top>
<form name=form1 action=b_myPage.php method=post> <form name=form1 action=b_myPage.php method=post>
@@ -78,11 +106,11 @@ function go(type) {
<input type=radio name=mode value=1 <?=$me['mode']==1?"checked":""; ?>>○(훈사60) <input type=radio name=mode value=1 <?=$me['mode']==1?"checked":""; ?>>○(훈사60)
<input type=radio name=mode value=0 <?=$me['mode']==0?"checked":""; ?>>× <input type=radio name=mode value=0 <?=$me['mode']==0?"checked":""; ?>>×
】<br><br> 】<br><br>
&nbsp;&nbsp;&nbsp;&nbsp;<input type=<?=$submit;?> name=btn style=background-color:<?=$_basecolor2;?>;color:white;width:160;height:30;font-size:13px; value=설정저장><br> &nbsp;&nbsp;&nbsp;&nbsp;<input type=<?=$submit?> name=btn style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;height:30px;font-size:13px; value=설정저장><br>
&nbsp;&nbsp;&nbsp;&nbsp;∞<font color=orange>설정저장은 이달중 <?=$me['myset'];?>회 남았습니다.</font><br><br> &nbsp;&nbsp;&nbsp;&nbsp;∞<font color=orange>설정저장은 이달중 <?=$me['myset']?>회 남았습니다.</font><br><br>
</form> </form>
&nbsp;&nbsp;&nbsp;&nbsp;휴 가 신 청<br> &nbsp;&nbsp;&nbsp;&nbsp;휴 가 신 청<br>
&nbsp;&nbsp;&nbsp;&nbsp;<input type=button style=background-color:<?=$_basecolor2;?>;color:white;width:160;height:30;font-size:13px; value=휴가신청 onclick='go(0)'> &nbsp;&nbsp;&nbsp;&nbsp;<input type=button style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;height:30px;font-size:13px; value=휴가신청 onclick='go(0)'>
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -91,10 +119,10 @@ function go(type) {
</tr> </tr>
<tr> <tr>
<td valign=top> <td valign=top>
<?php MyLog($me['no'], 24); ?> <?=getGenLogRecent($me['no'], 24)?>
</td> </td>
<td valign=top> <td valign=top>
<?php MyBatLog($me['no'], 24); ?> <?=getBatLogRecent($me['no'], 24)?>
</td> </td>
</tr> </tr>
<tr> <tr>
@@ -103,10 +131,10 @@ function go(type) {
</tr> </tr>
<tr> <tr>
<td valign=top> <td valign=top>
<?php MyHistory($connect, $me['no']); ?> <?=getGeneralHistoryAll($me['no'])?>
</td> </td>
<td valign=top> <td valign=top>
<?php MyBatRes($me['no'], 24); ?> <?=getBatResRecent($me['no'], 24)?>
</td> </td>
</tr> </tr>
</table> </table>
+13 -8
View File
@@ -4,11 +4,15 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
increaseRefresh("회의실", 1); increaseRefresh("회의실", 1);
$query = "select no,nation from general where owner='{$_SESSION['userID']}'"; $query = "select no,nation from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
@@ -18,7 +22,8 @@ $me = MYDB_fetch_array($result);
<head> <head>
<title>회의실</title> <title>회의실</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
@@ -27,11 +32,11 @@ $me = MYDB_fetch_array($result);
<tr><td>회 의 실<br><?=backButton()?></td></tr> <tr><td>회 의 실<br><?=backButton()?></td></tr>
<form name=form1 method=post action=c_nationboard.php> <form name=form1 method=post action=c_nationboard.php>
<tr><td align=center> <tr><td align=center>
제목 <input type=textarea maxlength=50 name=title style=color:white;background-color:black;width:830;> 제목 <input type=textarea maxlength=50 name=title style=color:white;background-color:black;width:830px;>
</td> </td>
</tr> </tr>
<tr><td> <tr><td>
<textarea name=msg style=color:white;background-color:black;width:998;height:200;></textarea><br> <textarea name=msg style=color:white;background-color:black;width:998px;height:200px;></textarea><br>
<input type=submit value=저장하기> <input type=submit value=저장하기>
<input type=hidden name=num value=-1> <input type=hidden name=num value=-1>
</td></tr> </td></tr>
@@ -39,7 +44,7 @@ $me = MYDB_fetch_array($result);
</table> </table>
<br> <br>
<?php <?php
$nation = getNation($connect, $me['nation']); $nation = getNation($me['nation']);
//20개 메세지 //20개 메세지
$index = $nation['boardindex']; $index = $nation['boardindex'];
@@ -48,7 +53,7 @@ for($i=0; $i < 20; $i++) {
$query = "select name,picture,imgsvr from general where no='$nation[$who]'"; $query = "select name,picture,imgsvr from general where no='$nation[$who]'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$general = MYDB_fetch_array($result); $general = MYDB_fetch_array($result);
if($nation["board{$index}"] != '') { msgprint($connect, $nation["board{$index}"], $general['name'], $general['picture'], $general['imgsvr'], $nation["board{$index}_when"], $index, 0); } if($nation["board{$index}"] != '') { msgprint($nation["board{$index}"], $general['name'], $general['picture'], $general['imgsvr'], $nation["board{$index}_when"], $index, 0); }
$index--; $index--;
if($index < 0) { $index = 19; } if($index < 0) { $index = 19; }
} }
+11 -6
View File
@@ -4,8 +4,12 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
increaseRefresh("국법", 1); increaseRefresh("국법", 1);
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
@@ -13,7 +17,8 @@ increaseRefresh("국법", 1);
<head> <head>
<title>국법</title> <title>국법</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
@@ -23,7 +28,7 @@ increaseRefresh("국법", 1);
<tr><td> <tr><td>
<?php <?php
$query = "select no,nation,level from general where owner='{$_SESSION['userID']}'"; $query = "select no,nation,level from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
@@ -34,12 +39,12 @@ $nation = MYDB_fetch_array($result);
if($me['level'] >= 5) { if($me['level'] >= 5) {
echo " echo "
<form name=form1 method=post action=c_nationrule.php> <form name=form1 method=post action=c_nationrule.php>
<textarea name=msg style=color:white;background-color:black;width:998;height:500;>{$nation['rule']}</textarea><br> <textarea name=msg style=color:white;background-color:black;width:998px;height:500px;>{$nation['rule']}</textarea><br>
<input type=submit value=저장하기> <input type=submit value=저장하기>
</form>"; </form>";
} else { } else {
echo " echo "
<textarea name=msg style=color:white;background-color:black;width:998;height:500; readonly>{$nation['rule']}</textarea><br>"; <textarea name=msg style=color:white;background-color:black;width:998px;height:500px; readonly>{$nation['rule']}</textarea><br>";
} }
?> ?>
+207 -106
View File
@@ -4,23 +4,31 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
increaseRefresh("토너먼트", 1);
checkTurn($connect);
$query = "select no,tournament,con,turntime from general where owner='{$_SESSION['userID']}'"; $db = DB::db();
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $connect=$db->get();
increaseRefresh("토너먼트", 1);
checkTurn();
$query = "select no,tournament,con,turntime from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
$query = "select conlimit,tournament,phase,tnmt_msg,tnmt_type,develcost,tnmt_trig from game limit 1"; $query = "select conlimit,tournament,phase,tnmt_msg,tnmt_type,develcost,tnmt_trig from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$con = checkLimit($me['con'], $admin['conlimit']); $con = checkLimit($me['con'], $admin['conlimit']);
if($con >= 2) { printLimitMsg($me['turntime']); exit(); } if ($con >= 2) {
printLimitMsg($me['turntime']);
exit();
}
switch($admin['tnmt_type']) { switch ($admin['tnmt_type']) {
default: throw new \RuntimeException('invalid tnmt_type');
case 0: $tnmt_type = "<font color=cyan>전력전</font>"; $tp = "tot"; $tp2 = "종합"; $tp3 = "total"; break; case 0: $tnmt_type = "<font color=cyan>전력전</font>"; $tp = "tot"; $tp2 = "종합"; $tp3 = "total"; break;
case 1: $tnmt_type = "<font color=cyan>통솔전</font>"; $tp = "ldr"; $tp2 = "통솔"; $tp3 = "leader"; break; case 1: $tnmt_type = "<font color=cyan>통솔전</font>"; $tp = "ldr"; $tp2 = "통솔"; $tp3 = "leader"; break;
case 2: $tnmt_type = "<font color=cyan>일기토</font>"; $tp = "pwr"; $tp2 = "무력"; $tp3 = "power"; break; case 2: $tnmt_type = "<font color=cyan>일기토</font>"; $tp = "pwr"; $tp2 = "무력"; $tp3 = "power"; break;
@@ -30,19 +38,21 @@ case 3: $tnmt_type = "<font color=cyan>설전</font>"; $tp = "itl"; $tp2 = "
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<?php if($con == 1) { MessageBox("접속제한이 얼마 남지 않았습니다! 제한량이 모자라다면 참여를 해보세요^^"); } ?> <?php if ($con == 1) {
MessageBox("접속제한이 얼마 남지 않았습니다! 제한량이 모자라다면 참여를 해보세요^^");
} ?>
<head> <head>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<title>토너먼트</title> <title>토너먼트</title>
<style> <style>
body { color:white; background-color:black; border-width:1; border-color:gray; } body { color:white; background-color:black; border-width:1px; border-color:gray; }
table { font-family:'맑은 고딕'; line-height:110%; } table { font-family:'맑은 고딕'; line-height:110%; }
font { font-family:'맑은 고딕'; line-height:110%; } font { font-family:'맑은 고딕'; line-height:110%; }
input { font-family:'맑은 고딕'; line-height:110%; height:20px } input { font-family:'맑은 고딕'; line-height:110%; height:20px }
select { font-family:'굴림'; line-height:100%; } select { font-family:'굴림'; line-height:100%; }
#bg0 { background-image:url(<?=$images;?>/back_walnut.jpg); } #bg0 { background-image:url(<?=ServConfig::$gameImagePath?>/back_walnut.jpg); }
#bg1 { background-image:url(<?=$images;?>/back_green.jpg); } #bg1 { background-image:url(<?=ServConfig::$gameImagePath?>/back_green.jpg); }
#bg2 { background-image:url(<?=$images;?>/back_blue.jpg); } #bg2 { background-image:url(<?=ServConfig::$gameImagePath?>/back_blue.jpg); }
</style> </style>
</head> </head>
@@ -53,14 +63,15 @@ select { font-family:'굴림'; line-height:100%; }
</table> </table>
<table align=center border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<?php <?php
if(Session::getUserGrade() >= 5) { if ($session->userGrade >= 5) {
$sel = [];
echo " echo "
<form method=post action=c_tournament.php> <form method=post action=c_tournament.php>
<tr><td colspan=8><input type=textarea size=150 style=color:white;background-color:black; name=msg><input type=submit name=btn value='메시지'></td></tr> <tr><td colspan=8><input type=textarea size=150 style=color:white;background-color:black; name=msg><input type=submit name=btn value='메시지'></td></tr>
<tr><td colspan=8> <tr><td colspan=8>
<input type=button value='갱신' onclick='location.reload()'>"; <input type=button value='갱신' onclick='location.reload()'>";
switch($admin['tnmt_trig']) { switch ($admin['tnmt_trig']) {
case 0: $sel[0] = "selected"; break; case 0: $sel[0] = "selected"; break;
case 1: $sel[1] = "selected"; break; case 1: $sel[1] = "selected"; break;
case 2: $sel[2] = "selected"; break; case 2: $sel[2] = "selected"; break;
@@ -71,8 +82,8 @@ if(Session::getUserGrade() >= 5) {
case 7: $sel[7] = "selected"; break; case 7: $sel[7] = "selected"; break;
} }
if($admin['tournament'] == 0) { if ($admin['tournament'] == 0) {
echo " ?>
<select name=auto size=1 style=color:white;background-color:black;> <select name=auto size=1 style=color:white;background-color:black;>
<option style=color:white; value=0>수동진행</option> <option style=color:white; value=0>수동진행</option>
<option style=color:white; value=1>12분 05일</option> <option style=color:white; value=1>12분 05일</option>
@@ -91,36 +102,42 @@ if(Session::getUserGrade() >= 5) {
</select> </select>
<input type=submit name=btn value='개최'> <input type=submit name=btn value='개최'>
<select name=trig size=1 style=color:white;background-color:black;> <select name=trig size=1 style=color:white;background-color:black;>
<option style=color:white; value=0 {$sel[0]}>수동진행</option> <option style=color:white; value=0 <?=$sel[0]??''?>>수동진행</option>
<option style=color:white; value=1 {$sel[1]}>12분 05일</option> <option style=color:white; value=1 <?=$sel[1]??''?>>12분 05일</option>
<option style=color:white; value=2 {$sel[2]}>07분 10시</option> <option style=color:white; value=2 <?=$sel[2]??''?>>07분 10시</option>
<option style=color:white; value=3 {$sel[3]}>03분 04시</option> <option style=color:white; value=3 <?=$sel[3]??''?>>03분 04시</option>
<option style=color:white; value=4 {$sel[4]}>01분 82분</option> <option style=color:white; value=4 <?=$sel[4]??''?>>01분 82분</option>
<option style=color:white; value=5 {$sel[5]}>30초 41분</option> <option style=color:white; value=5 <?=$sel[5]??''?>>30초 41분</option>
<option style=color:white; value=6 {$sel[6]}>15초 21분</option> <option style=color:white; value=6 <?=$sel[6]??''?>>15초 21분</option>
<option style=color:white; value=7 {$sel[7]}>05초 07분</option> <option style=color:white; value=7 <?=$sel[7]??''?>>05초 07분</option>
</select> </select>
<input type=submit name=btn value='자동개최설정'> <input type=submit name=btn value='자동개최설정'>
<input type=submit name=btn value='포상'> <input type=submit name=btn value='포상'>
<input type=submit name=btn value='회수'>"; } <input type=submit name=btn value='회수'>
else { <?php
} else {
echo "<input type=submit name=btn value='중단' onclick='return confirm(\"진짜 중단하시겠습니까?\")'>"; echo "<input type=submit name=btn value='중단' onclick='return confirm(\"진짜 중단하시겠습니까?\")'>";
} }
switch($admin['tournament']) { switch ($admin['tournament']) {
case 1: case 1:
echo "<select name=gen size=1 style=color:white;background-color:black;>"; echo "<select name=gen size=1 style=color:white;background-color:black;>";
$query = "select no,name,npc,tnmt,leader,power,intel,leader+power+intel as total from general where tournament=0 and gold>='{$admin['develcost']}' order by {$tp3} desc"; $query = "select no,name,npc,tnmt,leader,power,intel,leader+power+intel as total from general where tournament=0 and gold>='{$admin['develcost']}' order by {$tp3} desc";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$genCount = MYDB_num_rows($result); $genCount = MYDB_num_rows($result);
for($i=0; $i < $genCount; $i++) { for ($i=0; $i < $genCount; $i++) {
$general = MYDB_fetch_array($result); $general = MYDB_fetch_array($result);
if($general['npc'] >= 2) { $npc = "cyan"; } if ($general['npc'] >= 2) {
elseif($general['npc'] == 1) { $npc = "skyblue"; } $npc = "cyan";
elseif($general['tnmt'] > 0) { $npc = "blue"; } } elseif ($general['npc'] == 1) {
else { $npc = "white"; } $npc = "skyblue";
} elseif ($general['tnmt'] > 0) {
$npc = "blue";
} else {
$npc = "white";
}
echo "<option style=color:{$npc}; value={$general['no']}>[{$general[$tp3]}]{$general['name']}</option>"; echo "<option style=color:{$npc}; value={$general['no']}>[{$general[$tp3]}]{$general['name']}</option>";
} }
echo " echo "
@@ -151,18 +168,18 @@ if(Session::getUserGrade() >= 5) {
echo " echo "
</td></tr> </td></tr>
</form>"; </form>";
} elseif($me['no'] > 0 && $me['tournament'] == 0 && $admin['tournament'] == 1) { } elseif ($me['no'] > 0 && $me['tournament'] == 0 && $admin['tournament'] == 1) {
echo "<form method=post action=c_tournament.php><tr><td colspan=8><input type=button value='갱신' onclick='location.reload()'><input type=submit name=btn value='참가' onclick='return confirm(\"참가비 금{$admin['develcost']}이 필요합니다. 참가하시겠습니까?\")'></td></tr></form>"; echo "<form method=post action=c_tournament.php><tr><td colspan=8><input type=button value='갱신' onclick='location.reload()'><input type=submit name=btn value='참가' onclick='return confirm(\"참가비 금{$admin['develcost']}이 필요합니다. 참가하시겠습니까?\")'></td></tr></form>";
} else { } else {
echo "<tr><td colspan=8><input type=button value='갱신' onclick='location.reload()'></td></tr>"; echo "<tr><td colspan=8><input type=button value='갱신' onclick='location.reload()'></td></tr>";
} }
$str1 = getTournament($admin['tournament']); $str1 = getTournament($admin['tournament']);
$str2 = getTournamentTime($connect); $str2 = getTournamentTime();
$str3 = getTournamentTerm($connect); $str3 = getTournamentTerm();
?> ?>
<tr><td colspan=8>운영자 메세지 : <font color=orange size=5><?=$admin['tnmt_msg'];?></font></td></tr> <tr><td colspan=8>운영자 메세지 : <font color=orange size=5><?=$admin['tnmt_msg']?></font></td></tr>
<tr><td colspan=8 align=center><font color=white size=6><?=$tnmt_type;?> (<?=$str1.", ".$str2.", ".$str3;?>)</font></td></tr> <tr><td colspan=8 align=center><font color=white size=6><?=$tnmt_type?> (<?=$str1.", ".$str2.", ".$str3?>)</font></td></tr>
<tr><td colspan=8 align=center id=bg2><font color=magenta size=5>16강 승자전</font></td></tr> <tr><td colspan=8 align=center id=bg2><font color=magenta size=5>16강 승자전</font></td></tr>
<tr><td height=10 colspan=8 align=center></td></tr> <tr><td height=10 colspan=8 align=center></td></tr>
<?php <?php
@@ -174,12 +191,21 @@ echo "
<tr align=center>"; <tr align=center>";
$query = "select npc,name,win from tournament where grp>=60 order by grp, grp_no"; $query = "select npc,name,win from tournament where grp>=60 order by grp, grp_no";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
for($i=0; $i < 1; $i++) { for ($i=0; $i < 1; $i++) {
$general = MYDB_fetch_array($result); $general = MYDB_fetch_array($result) ?? [
if($general['name'] == "") { $general['name'] = "-"; } 'name'=>'',
if($general['npc'] >= 2) { $general['name'] = "<font color=cyan>".$general['name']."</font>"; } 'npc'=>0,
elseif($general['npc'] == 1) { $general['name'] = "<font color=skyblue>".$general['name']."</font>"; } 'win'=>0
];
if ($general['name'] == "") {
$general['name'] = "-";
}
if ($general['npc'] >= 2) {
$general['name'] = "<font color=cyan>".$general['name']."</font>";
} elseif ($general['npc'] == 1) {
$general['name'] = "<font color=skyblue>".$general['name']."</font>";
}
echo "<td colspan=16>{$general['name']}</td>"; echo "<td colspan=16>{$general['name']}</td>";
} }
@@ -188,18 +214,38 @@ echo "
<tr align=center>"; <tr align=center>";
$query = "select npc,name,win from tournament where grp>=50 order by grp, grp_no"; $query = "select npc,name,win from tournament where grp>=50 order by grp, grp_no";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
for($i=0; $i < 1; $i++) { $cent[$i] = "<font color=white>"; } $cent = [];
for($i=0; $i < 2; $i++) { for ($i=0; $i < 1; $i++) {
$general = MYDB_fetch_array($result); $cent[$i] = "<font color=white>";
if($general['name'] == "") { $general['name'] = "-"; } }
if($general['npc'] >= 2) { $general['name'] = "<font color=cyan>".$general['name']."</font>"; } $line = [];
elseif($general['npc'] == 1) { $general['name'] = "<font color=skyblue>".$general['name']."</font>"; } $gen = [];
if($general['win'] > 0) { $line[$i] = "<font color=red>"; $cent[floor($i/2)] = "<font color=red>"; } for ($i=0; $i < 2; $i++) {
else { $line[$i] = "<font color=white>"; } //FIXME: 다시 작성. null인 경우엔 어쩌려고?
$general = MYDB_fetch_array($result) ?? [
'name'=>'',
'npc'=>0,
'win'=>0
];
if ($general['name'] == "") {
$general['name'] = "-";
}
if ($general['npc'] >= 2) {
$general['name'] = "<font color=cyan>".$general['name']."</font>";
} elseif ($general['npc'] == 1) {
$general['name'] = "<font color=skyblue>".$general['name']."</font>";
}
if ($general['win'] > 0) {
$line[$i] = "<font color=red>";
$cent[intdiv($i, 2)] = "<font color=red>";
} else {
$line[$i] = "<font color=white>";
}
$gen[$i] = $general['name']; $gen[$i] = $general['name'];
} }
for($i=0; $i < 1; $i++) { for ($i=0; $i < 1; $i++) {
$cent[$i] = $cent[$i]."┻"."</font>"; $cent[$i] = $cent[$i]."┻"."</font>";
$line[$i*2] = $line[$i*2]."┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"."</font>"; $line[$i*2] = $line[$i*2]."┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"."</font>";
$line[$i*2+1] = $line[$i*2+1]."━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓"."</font>"; $line[$i*2+1] = $line[$i*2+1]."━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓"."</font>";
@@ -209,7 +255,7 @@ echo "
</tr> </tr>
<tr align=center>"; <tr align=center>";
for($i=0; $i < 2; $i++) { for ($i=0; $i < 2; $i++) {
echo "<td colspan=8>{$gen[$i]}</td>"; echo "<td colspan=8>{$gen[$i]}</td>";
} }
@@ -218,18 +264,33 @@ echo "
<tr align=center>"; <tr align=center>";
$query = "select npc,name,win from tournament where grp>=40 order by grp, grp_no"; $query = "select npc,name,win from tournament where grp>=40 order by grp, grp_no";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
for($i=0; $i < 2; $i++) { $cent[$i] = "<font color=white>"; } for ($i=0; $i < 2; $i++) {
for($i=0; $i < 4; $i++) { $cent[$i] = "<font color=white>";
$general = MYDB_fetch_array($result); }
if($general['name'] == "") { $general['name'] = "-"; } for ($i=0; $i < 4; $i++) {
if($general['npc'] >= 2) { $general['name'] = "<font color=cyan>".$general['name']."</font>"; } $general = MYDB_fetch_array($result) ?? [
elseif($general['npc'] == 1) { $general['name'] = "<font color=skyblue>".$general['name']."</font>"; } 'name'=>'',
if($general['win'] > 0) { $line[$i] = "<font color=red>"; $cent[floor($i/2)] = "<font color=red>"; } 'npc'=>0,
else { $line[$i] = "<font color=white>"; } 'win'=>0
];
if ($general['name'] == "") {
$general['name'] = "-";
}
if ($general['npc'] >= 2) {
$general['name'] = "<font color=cyan>".$general['name']."</font>";
} elseif ($general['npc'] == 1) {
$general['name'] = "<font color=skyblue>".$general['name']."</font>";
}
if ($general['win'] > 0) {
$line[$i] = "<font color=red>";
$cent[intdiv($i, 2)] = "<font color=red>";
} else {
$line[$i] = "<font color=white>";
}
$gen[$i] = $general['name']; $gen[$i] = $general['name'];
} }
for($i=0; $i < 2; $i++) { for ($i=0; $i < 2; $i++) {
$cent[$i] = $cent[$i]."┻"."</font>"; $cent[$i] = $cent[$i]."┻"."</font>";
$line[$i*2] = $line[$i*2]."┏━━━━━━━━━━━━━━━━━━"."</font>"; $line[$i*2] = $line[$i*2]."┏━━━━━━━━━━━━━━━━━━"."</font>";
$line[$i*2+1] = $line[$i*2+1]."━━━━━━━━━━━━━━━━━━┓"."</font>"; $line[$i*2+1] = $line[$i*2+1]."━━━━━━━━━━━━━━━━━━┓"."</font>";
@@ -239,7 +300,7 @@ echo "
</tr> </tr>
<tr align=center>"; <tr align=center>";
for($i=0; $i < 4; $i++) { for ($i=0; $i < 4; $i++) {
echo "<td colspan=4>{$gen[$i]}</td>"; echo "<td colspan=4>{$gen[$i]}</td>";
} }
@@ -248,18 +309,33 @@ echo "
<tr align=center>"; <tr align=center>";
$query = "select npc,name,win from tournament where grp>=30 order by grp, grp_no"; $query = "select npc,name,win from tournament where grp>=30 order by grp, grp_no";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
for($i=0; $i < 4; $i++) { $cent[$i] = "<font color=white>"; } for ($i=0; $i < 4; $i++) {
for($i=0; $i < 8; $i++) { $cent[$i] = "<font color=white>";
$general = MYDB_fetch_array($result); }
if($general['name'] == "") { $general['name'] = "-"; } for ($i=0; $i < 8; $i++) {
if($general['npc'] >= 2) { $general['name'] = "<font color=cyan>".$general['name']."</font>"; } $general = MYDB_fetch_array($result) ?? [
elseif($general['npc'] == 1) { $general['name'] = "<font color=skyblue>".$general['name']."</font>"; } 'name'=>'',
if($general['win'] > 0) { $line[$i] = "<font color=red>"; $cent[floor($i/2)] = "<font color=red>"; } 'npc'=>0,
else { $line[$i] = "<font color=white>"; } 'win'=>0
];
if ($general['name'] == "") {
$general['name'] = "-";
}
if ($general['npc'] >= 2) {
$general['name'] = "<font color=cyan>".$general['name']."</font>";
} elseif ($general['npc'] == 1) {
$general['name'] = "<font color=skyblue>".$general['name']."</font>";
}
if ($general['win'] > 0) {
$line[$i] = "<font color=red>";
$cent[intdiv($i, 2)] = "<font color=red>";
} else {
$line[$i] = "<font color=white>";
}
$gen[$i] = $general['name']; $gen[$i] = $general['name'];
} }
for($i=0; $i < 4; $i++) { for ($i=0; $i < 4; $i++) {
$cent[$i] = $cent[$i]."┻"."</font>"; $cent[$i] = $cent[$i]."┻"."</font>";
$line[$i*2] = $line[$i*2]."┏━━━━━━━━━"."</font>"; $line[$i*2] = $line[$i*2]."┏━━━━━━━━━"."</font>";
$line[$i*2+1] = $line[$i*2+1]."━━━━━━━━━┓"."</font>"; $line[$i*2+1] = $line[$i*2+1]."━━━━━━━━━┓"."</font>";
@@ -269,7 +345,7 @@ echo "
</tr> </tr>
<tr align=center>"; <tr align=center>";
for($i=0; $i < 8; $i++) { for ($i=0; $i < 8; $i++) {
echo "<td colspan=2>{$gen[$i]}</td>"; echo "<td colspan=2>{$gen[$i]}</td>";
} }
@@ -278,18 +354,33 @@ echo "
<tr align=center>"; <tr align=center>";
$query = "select npc,name,win from tournament where grp>=20 order by grp, grp_no"; $query = "select npc,name,win from tournament where grp>=20 order by grp, grp_no";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
for($i=0; $i < 8; $i++) { $cent[$i] = "<font color=white>"; } for ($i=0; $i < 8; $i++) {
for($i=0; $i < 16; $i++) { $cent[$i] = "<font color=white>";
$general = MYDB_fetch_array($result); }
if($general['name'] == "") { $general['name'] = "-"; } for ($i=0; $i < 16; $i++) {
if($general['npc'] >= 2) { $general['name'] = "<font color=cyan>".$general['name']."</font>"; } $general = MYDB_fetch_array($result) ?? [
elseif($general['npc'] == 1) { $general['name'] = "<font color=skyblue>".$general['name']."</font>"; } 'name'=>'',
if($general['win'] > 0) { $line[$i] = "<font color=red>"; $cent[floor($i/2)] = "<font color=red>"; } 'npc'=>0,
else { $line[$i] = "<font color=white>"; } 'win'=>0
];
if ($general['name'] == "") {
$general['name'] = "-";
}
if ($general['npc'] >= 2) {
$general['name'] = "<font color=cyan>".$general['name']."</font>";
} elseif ($general['npc'] == 1) {
$general['name'] = "<font color=skyblue>".$general['name']."</font>";
}
if ($general['win'] > 0) {
$line[$i] = "<font color=red>";
$cent[intdiv($i, 2)] = "<font color=red>";
} else {
$line[$i] = "<font color=white>";
}
$gen[$i] = $general['name']; $gen[$i] = $general['name'];
} }
for($i=0; $i < 8; $i++) { for ($i=0; $i < 8; $i++) {
$cent[$i] = $cent[$i]."┻"."</font>"; $cent[$i] = $cent[$i]."┻"."</font>";
$line[$i*2] = $line[$i*2]."┏━━━━"."</font>"; $line[$i*2] = $line[$i*2]."┏━━━━"."</font>";
$line[$i*2+1] = $line[$i*2+1]."━━━━┓"."</font>"; $line[$i*2+1] = $line[$i*2+1]."━━━━┓"."</font>";
@@ -299,7 +390,7 @@ echo "
</tr> </tr>
<tr align=center>"; <tr align=center>";
for($i=0; $i < 16; $i++) { for ($i=0; $i < 16; $i++) {
echo "<td width=125>{$gen[$i]}</td>"; echo "<td width=125>{$gen[$i]}</td>";
} }
@@ -307,17 +398,21 @@ echo"
</tr>"; </tr>";
$query = "select tournament,bet0,bet1,bet2,bet3,bet4,bet5,bet6,bet7,bet8,bet9,bet10,bet11,bet12,bet13,bet14,bet15,bet0+bet1+bet2+bet3+bet4+bet5+bet6+bet7+bet8+bet9+bet10+bet11+bet12+bet13+bet14+bet15 as bet from game limit 1"; $query = "select tournament,bet0,bet1,bet2,bet3,bet4,bet5,bet6,bet7,bet8,bet9,bet10,bet11,bet12,bet13,bet14,bet15,bet0+bet1+bet2+bet3+bet4+bet5+bet6+bet7+bet8+bet9+bet10+bet11+bet12+bet13+bet14+bet15 as bet from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$betting = MYDB_fetch_array($result); $betting = MYDB_fetch_array($result);
for($i=0; $i < 16; $i++) { $bet = [];
$bet[$i] = @round($betting['bet'] / $betting["bet{$i}"], 2); for ($i=0; $i < 16; $i++) {
if($bet[$i] == 0) { $bet[$i] = "∞"; } if($betting['bet'] == 0){
$bet[$i] = '∞';
continue;
}
$bet[$i] = round($betting['bet'] / $betting["bet{$i}"], 2);
} }
echo " echo "
<tr align=center>"; <tr align=center>";
for($i=0; $i < 16; $i++) { for ($i=0; $i < 16; $i++) {
echo "<td><font color=skyblue>{$bet[$i]}</font></td>"; echo "<td><font color=skyblue>{$bet[$i]}</font></td>";
} }
@@ -329,15 +424,17 @@ echo "
</td> </td>
</tr>"; </tr>";
if($admin['tournament'] >= 7 || $admin['tournament'] == 0) { printFighting($admin['tournament'], $admin['phase']); } if ($admin['tournament'] >= 7 || $admin['tournament'] == 0) {
printFighting($admin['tournament'], $admin['phase']);
}
echo " echo "
<tr><td height=10 colspan=8 align=center></td></tr> <tr><td height=10 colspan=8 align=center></td></tr>
<tr><td colspan=8 align=center id=bg2><font color=orange size=5>조별 본선 순위</font></td></tr> <tr><td colspan=8 align=center id=bg2><font color=orange size=5>조별 본선 순위</font></td></tr>
<tr>"; <tr>";
$num = Array("一", "二", "三", "四", "五", "六", "七", "八"); $num = array("一", "二", "三", "四", "五", "六", "七", "八");
for($i=0; $i < 8; $i++) { for ($i=0; $i < 8; $i++) {
$grp = $i + 10; $grp = $i + 10;
echo " echo "
<td> <td>
@@ -346,8 +443,8 @@ for($i=0; $i < 8; $i++) {
<tr id=bg1><td align=center>순</td><td align=center>장수</td><td align=center>{$tp2}</td><td align=center>경</td><td align=center>승</td><td align=center>무</td><td align=center>패</td><td align=center>점</td><td align=center>득</td></tr>"; <tr id=bg1><td align=center>순</td><td align=center>장수</td><td align=center>{$tp2}</td><td align=center>경</td><td align=center>승</td><td align=center>무</td><td align=center>패</td><td align=center>점</td><td align=center>득</td></tr>";
$query = "select npc,name,ldr,pwr,itl,ldr+pwr+itl as tot,prmt,win+draw+lose as game,win,draw,lose,gl,win*3+draw as gd from tournament where grp='$grp' order by gd desc, gl desc, seq"; $query = "select npc,name,ldr,pwr,itl,ldr+pwr+itl as tot,prmt,win+draw+lose as game,win,draw,lose,gl,win*3+draw as gd from tournament where grp='$grp' order by gd desc, gl desc, seq";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
for($k=1; $k <= 4; $k++) { for ($k=1; $k <= 4; $k++) {
$general = MYDB_fetch_array($result); $general = MYDB_fetch_array($result);
printRow($k, $general['npc'], $general['name'], $general[$tp], $general['game'], $general['win'], $general['draw'], $general['lose'], $general['gd'], $general['gl'], $general['prmt']); printRow($k, $general['npc'], $general['name'], $general[$tp], $general['game'], $general['win'], $general['draw'], $general['lose'], $general['gd'], $general['gl'], $general['prmt']);
} }
@@ -356,12 +453,14 @@ for($i=0; $i < 8; $i++) {
</td>"; </td>";
} }
echo "</tr>"; echo "</tr>";
if($admin['tournament'] == 4 || $admin['tournament'] == 5) { printFighting($admin['tournament'], $admin['phase']); } if ($admin['tournament'] == 4 || $admin['tournament'] == 5) {
printFighting($admin['tournament'], $admin['phase']);
}
echo " echo "
<tr><td colspan=8 align=center id=bg2><font color=yellow size=5>조별 예선 순위</font></td></tr> <tr><td colspan=8 align=center id=bg2><font color=yellow size=5>조별 예선 순위</font></td></tr>
<tr>"; <tr>";
for($i=0; $i < 8; $i++) { for ($i=0; $i < 8; $i++) {
$grp = $i; $grp = $i;
echo " echo "
<td> <td>
@@ -370,8 +469,8 @@ for($i=0; $i < 8; $i++) {
<tr id=bg1><td align=center>순</td><td align=center>장수</td><td align=center>{$tp2}</td><td align=center>경</td><td align=center>승</td><td align=center>무</td><td align=center>패</td><td align=center>점</td><td align=center>득</td></tr>"; <tr id=bg1><td align=center>순</td><td align=center>장수</td><td align=center>{$tp2}</td><td align=center>경</td><td align=center>승</td><td align=center>무</td><td align=center>패</td><td align=center>점</td><td align=center>득</td></tr>";
$query = "select npc,name,ldr,pwr,itl,ldr+pwr+itl as tot,prmt,win+draw+lose as game,win,draw,lose,gl,win*3+draw as gd from tournament where grp='$grp' order by gd desc, gl desc, seq"; $query = "select npc,name,ldr,pwr,itl,ldr+pwr+itl as tot,prmt,win+draw+lose as game,win,draw,lose,gl,win*3+draw as gd from tournament where grp='$grp' order by gd desc, gl desc, seq";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
for($k=1; $k <= 8; $k++) { for ($k=1; $k <= 8; $k++) {
$general = MYDB_fetch_array($result); $general = MYDB_fetch_array($result);
printRow($k, $general['npc'], $general['name'], $general[$tp], $general['game'], $general['win'], $general['draw'], $general['lose'], $general['gd'], $general['gl'], $general['prmt']); printRow($k, $general['npc'], $general['name'], $general[$tp], $general['game'], $general['win'], $general['draw'], $general['lose'], $general['gd'], $general['gl'], $general['prmt']);
} }
@@ -380,13 +479,15 @@ for($i=0; $i < 8; $i++) {
</td>"; </td>";
} }
if($admin['tournament'] == 2 || $admin['tournament'] == 3) { printFighting($admin['tournament'], $admin['phase']); } if ($admin['tournament'] == 2 || $admin['tournament'] == 3) {
printFighting($admin['tournament'], $admin['phase']);
}
?> ?>
</tr> </tr>
<tr><td colspan=8> <tr><td colspan=8>
<font color=white size=2> <font color=white size=2>
ㆍ예선은 홈&어웨이 풀리그로 진행됩니다. (총 14경기)<br> ㆍ예선은 홈&amp;어웨이 풀리그로 진행됩니다. (총 14경기)<br>
ㆍ상위 4명이 본선에 진출하게 되며 조추첨을 통해 조가 배정됩니다.<br> ㆍ상위 4명이 본선에 진출하게 되며 조추첨을 통해 조가 배정됩니다.<br>
ㆍ각 조1위가 시드1로 랜덤하게 조에 배정되며, 역시 각 조2위가 시드2로 랜덤하게 조에 배정됩니다.<br> ㆍ각 조1위가 시드1로 랜덤하게 조에 배정되며, 역시 각 조2위가 시드2로 랜덤하게 조에 배정됩니다.<br>
ㆍ그후 남은 3, 4위는 완전 랜덤하게 모든 조에 랜덤하게 배정됩니다.<br> ㆍ그후 남은 3, 4위는 완전 랜덤하게 모든 조에 랜덤하게 배정됩니다.<br>
+13 -9
View File
@@ -4,11 +4,15 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
increaseRefresh("부대편성", 1); increaseRefresh("부대편성", 1);
$query = "select no,nation,troop from general where owner='{$_SESSION['userID']}'"; $query = "select no,nation,troop from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
@@ -22,7 +26,8 @@ $troopcount = MYDB_num_rows($result);
<head> <head>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<title>부대편성</title> <title>부대편성</title>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
</head> </head>
@@ -77,7 +82,7 @@ for($i=0; $i < $troopcount; $i++) {
<tr> <tr>
<td align=center rowspan=2><input "; echo $i==0?"checked ":""; echo "type=radio name=troop value='{$troop['troop']}'></td> <td align=center rowspan=2><input "; echo $i==0?"checked ":""; echo "type=radio name=troop value='{$troop['troop']}'></td>
<td align=center >{$troop['name']}<br>【 $cityname 】</td> <td align=center >{$troop['name']}<br>【 $cityname 】</td>
<td height=64 background={$imageTemp}/{$picture}>&nbsp;</td> <td height=64 style='background:no-repeat center url(\"{$imageTemp}/{$picture}\");background-size:64px;'>&nbsp;</td>
<td rowspan=2 width=662>$genlist</td> <td rowspan=2 width=662>$genlist</td>
<td rowspan=2>$turn</td> <td rowspan=2>$turn</td>
</tr> </tr>
@@ -88,7 +93,7 @@ for($i=0; $i < $troopcount; $i++) {
<tr> <tr>
<td align=center rowspan=2>&nbsp;</td> <td align=center rowspan=2>&nbsp;</td>
<td align=center >{$troop['name']}<br>【 $cityname 】</td> <td align=center >{$troop['name']}<br>【 $cityname 】</td>
<td height=64 background={$imageTemp}/{$picture}>&nbsp;</td> <td height=64 style='background:no-repeat center url(\"{$imageTemp}/{$picture}\");background-size:64px;'>&nbsp;</td>
<td rowspan=2 width=662>$genlist</td> <td rowspan=2 width=662>$genlist</td>
<td rowspan=2>"; <td rowspan=2>";
@@ -97,7 +102,7 @@ for($i=0; $i < $troopcount; $i++) {
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$genCount = MYDB_num_rows($genresult); $genCount = MYDB_num_rows($genresult);
echo " echo "
<select name=gen size=3 style=color:white;background-color:black;font-size:13px;width:98;>"; <select name=gen size=3 style=color:white;background-color:black;font-size:13px;width:98px;>";
for($k=0; $k < $genCount; $k++) { for($k=0; $k < $genCount; $k++) {
$general = MYDB_fetch_array($genresult); $general = MYDB_fetch_array($genresult);
echo " echo "
@@ -105,7 +110,7 @@ for($i=0; $i < $troopcount; $i++) {
} }
echo " echo "
</select><br> </select><br>
<input type=submit name=btn value='부 대 추 방' style=width:100;height:25;>"; <input type=submit name=btn value='부 대 추 방' style=width:100px;height:25px;>";
} else { } else {
echo $turn; echo $turn;
} }
@@ -147,7 +152,6 @@ echo "
</tr> </tr>
</table>"; </table>";
MYDB_close($connect);
?> ?>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0> <table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr><td><?=backButton()?></td></tr> <tr><td><?=backButton()?></td></tr>
+147 -73
View File
@@ -3,39 +3,71 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
$v = new Validator($_POST + $_GET);
$v->rule('integer', [
'amount',
'cost',
'topv',
'value',
'term',
'stuff',
'sel'
]);
$btn = Util::getReq('btn');
$amount = Util::getReq('amount', 'int');
$cost = Util::getReq('cost', 'int');
$topv = Util::getReq('topv', 'int');
$value = Util::getReq('value', 'int');
$term = Util::getReq('term', 'int');
$stuff = Util::getReq('stuff', 'int');
$sel = Util::getReq('sel', 'int');
$msg = '';
$msg2 = '';
extractMissingPostToGlobals();
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
increaseRefresh("입찰", 1); increaseRefresh("입찰", 1);
$query = "select turnterm from game limit 1"; $query = "select turnterm from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$query = "select no,name,gold,rice,special from general where owner='{$_SESSION['userID']}'"; $query = "select no,name,gold,rice,special from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
$query = "select no from auction where no1='{$me['no']}'"; $query = "select no from auction where no1='{$me['no']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$tradeCount = MYDB_num_rows($result); $tradeCount = MYDB_num_rows($result);
$query = "select no from auction where no2='{$me['no']}'"; $query = "select no from auction where no2='{$me['no']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$bidCount = MYDB_num_rows($result); $bidCount = MYDB_num_rows($result);
$btCount = $tradeCount + $bidCount; $btCount = $tradeCount + $bidCount;
$unit = $admin['turnterm'] * 60; $unit = $admin['turnterm'] * 60;
$amount = round($amount / 10) * 10; $amount = Util::round($amount / 10) * 10;
$cost = round($cost / 10) * 10; $cost = Util::round($cost / 10) * 10;
$topv = round($topv / 10) * 10; $topv = Util::round($topv / 10) * 10;
$value = round($value / 10) * 10; $value = Util::round($value / 10) * 10;
if($term > 24) $term = 24; if ($term > 24) {
$term = 24;
}
$valid = 1; $valid = 1;
if(Session::getUserGrade() >= 5 || ($me['special'] != 30 && $btCount < 1) || ($me['special'] == 30 && $btCount < 3)) { if ($session->userGrade >= 5 || ($me['special'] != 30 && $btCount < 1) || ($me['special'] == 30 && $btCount < 3)) {
} else { } else {
$msg = "ㆍ<span class='ev_warning'>더이상 등록할 수 없습니다.</span>"; $msg = "ㆍ<span class='ev_warning'>더이상 등록할 수 없습니다.</span>";
$msg2 = "ㆍ<span class='ev_warning'>더이상 등록할 수 없습니다.</span>"; $msg2 = "ㆍ<span class='ev_warning'>더이상 등록할 수 없습니다.</span>";
@@ -43,167 +75,209 @@ if(Session::getUserGrade() >= 5 || ($me['special'] != 30 && $btCount < 1) || ($m
$btn = "hidden"; $btn = "hidden";
} }
if($btn == "판매") { if ($btn == "판매") {
if($stuff != 0) { if ($stuff != 0) {
$msg = "ㆍ<span class='ev_warning'>현재 쌀만 거래 가능합니다.</span>"; $msg = "ㆍ<span class='ev_warning'>현재 쌀만 거래 가능합니다.</span>";
$valid = 0; $valid = 0;
} }
if($term < 0 || $term > 24) { if ($term < 0 || $term > 24) {
$msg = "ㆍ<span class='ev_warning'>종료기한은 1 ~ 24 턴 이어야 합니다.</span>"; $msg = "ㆍ<span class='ev_warning'>종료기한은 1 ~ 24 턴 이어야 합니다.</span>";
$valid = 0; $valid = 0;
} }
if($amount < 100 || $amount > 10000) { if ($amount < 100 || $amount > 10000) {
$msg = "ㆍ<span class='ev_warning'>거래량은 100 ~ 10000 이어야 합니다.</span>"; $msg = "ㆍ<span class='ev_warning'>거래량은 100 ~ 10000 이어야 합니다.</span>";
$valid = 0; $valid = 0;
} }
if($cost > $amount * 2 || $cost * 2 < $amount) { if ($cost > $amount * 2 || $cost * 2 < $amount) {
$msg = "ㆍ<span class='ev_warning'>시작판매가는 50% ~ 200% 이어야 합니다.</span>"; $msg = "ㆍ<span class='ev_warning'>시작판매가는 50% ~ 200% 이어야 합니다.</span>";
$valid = 0; $valid = 0;
} }
if($topv < $amount*1.1 || $topv > $amount * 2) { if ($topv < $amount*1.1 || $topv > $amount * 2) {
$msg = "ㆍ<span class='ev_warning'>즉시판매가는 110% ~ 200% 이어야 합니다.</span>"; $msg = "ㆍ<span class='ev_warning'>즉시판매가는 110% ~ 200% 이어야 합니다.</span>";
$valid = 0; $valid = 0;
} }
if($topv < $cost*1.1) { if ($topv < $cost*1.1) {
$msg = "ㆍ<span class='ev_warning'>즉시판매가는 시작판매가의 110% 이상이어야 합니다.</span>"; $msg = "ㆍ<span class='ev_warning'>즉시판매가는 시작판매가의 110% 이상이어야 합니다.</span>";
$valid = 0; $valid = 0;
} }
if($amount > $me['rice'] - 1000) { if ($amount > $me['rice'] - 1000) {
$msg = "ㆍ<span class='ev_warning'>기본 군량 1000은 거래할 수 없습니다.</span>"; $msg = "ㆍ<span class='ev_warning'>기본 군량 1000은 거래할 수 없습니다.</span>";
$valid = 0; $valid = 0;
} }
if($valid == 1) { if ($valid == 1) {
$msg = "ㆍ<span class='ev_success'>등록 성공.</span>"; $msg = "ㆍ<span class='ev_success'>등록 성공.</span>";
$date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit * $term); $date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit * $term);
$query = "insert into auction (type, no1, name1, stuff, amount, cost, value, topv, expire) values (0, '{$me['no']}', '{$me['name']}', '$stuff', '$amount', '$cost', '$cost', '$topv', '$date')"; $db->insert('auction', [
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); 'type'=>0,
'no1'=>$me['no'],
'name1'=>$me['name'],
'stuff'=>$stuff,
'amount'=>$amount,
'cost'=>$cost,
'value'=>$cost,
'topv'=>$topv,
'expire'=>$date
]);
} }
} elseif($btn == "구매시도") { } elseif ($btn == "구매시도") {
$query = "select no2,value,topv,expire,amount from auction where no='$sel'"; $query = "select no2,value,topv,expire,amount from auction where no='$sel'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$auction = MYDB_fetch_array($result); $auction = MYDB_fetch_array($result);
if($value == $auction['topv']) { if ($value == $auction['topv']) {
$valid = 2; $valid = 2;
} }
if(!$auction) { if (!$auction) {
$msg = "ㆍ<span class='ev_warning'>종료된 거래입니다.</span>"; $msg = "ㆍ<span class='ev_warning'>종료된 거래입니다.</span>";
$valid = 0; $valid = 0;
} }
/* /*
if($stuff != 0) { if($stuff != 0) {
$msg = "ㆍ<span class='ev_warning'>현재 쌀만 거래 가능합니다.</span>"; $msg = "ㆍ<span class='ev_warning'>현재 쌀만 거래 가능합니다.</span>";
$valid = 0; $valid = 0;
} }
*/ */
if($auction['no2'] > 0 && $value <= $auction['value']) { if ($auction['no2'] > 0 && $value <= $auction['value']) {
$msg = "ㆍ<span class='ev_warning'>현재판매가보다 높게 입찰해야 합니다.</span>"; $msg = "ㆍ<span class='ev_warning'>현재판매가보다 높게 입찰해야 합니다.</span>";
$valid = 0; $valid = 0;
} }
if($value < $auction['value']) { if ($value < $auction['value']) {
$msg = "ㆍ<span class='ev_warning'>현재판매가보다 높게 입찰해야 합니다.</span>"; $msg = "ㆍ<span class='ev_warning'>현재판매가보다 높게 입찰해야 합니다.</span>";
$valid = 0; $valid = 0;
} }
if($value > $auction['topv']) { if ($value > $auction['topv']) {
$msg = "ㆍ<span class='ev_warning'>즉시판매가보다 높을 수 없습니다.</span>"; $msg = "ㆍ<span class='ev_warning'>즉시판매가보다 높을 수 없습니다.</span>";
$valid = 0; $valid = 0;
} }
if($value > $me['gold'] - 1000) { if ($value > $me['gold'] - 1000) {
$msg = "ㆍ<span class='ev_warning'>기본 자금 1000은 거래할 수 없습니다.</span>"; $msg = "ㆍ<span class='ev_warning'>기본 자금 1000은 거래할 수 없습니다.</span>";
$valid = 0; $valid = 0;
} }
if($valid == 1) { if ($valid == 1) {
$msg = "ㆍ<span class='ev_success'>입찰 성공.</span> 거래완료는 빨라도 현재로부터 1턴 뒤입니다."; $msg = "ㆍ<span class='ev_success'>입찰 성공.</span> 거래완료는 빨라도 현재로부터 1턴 뒤입니다.";
$date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit); $date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit);
if($auction['expire'] > $date) $date = $auction['expire']; if ($auction['expire'] > $date) {
$query = "update auction set value='$value',no2='{$me['no']}',name2='{$me['name']}',expire='$date' where no='$sel'"; $date = $auction['expire'];
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); }
} elseif($valid == 2) {
$db->update('auction', [
'value'=>$value,
'no2'=>$me['no'],
'name2'=>$me['name'],
'expire'=>$date,
], 'no=%i', $sel);
} elseif ($valid == 2) {
$msg = "ㆍ<span class='ev_success'>즉시판매 성공.</span> 거래완료는 빨라도 현재로부터 1턴 뒤입니다."; $msg = "ㆍ<span class='ev_success'>즉시판매 성공.</span> 거래완료는 빨라도 현재로부터 1턴 뒤입니다.";
$date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit); $date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit);
$query = "update auction set value='$value',no2='{$me['no']}',name2='{$me['name']}',expire='$date' where no='$sel'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $db->update('auction', [
'value'=>$value,
'no2'=>$me['no'],
'name2'=>$me['name'],
'expire'=>$date,
], 'no=%i', $sel);
} }
} elseif($btn == "구매") { } elseif ($btn == "구매") {
if($stuff != 0) { if ($stuff != 0) {
$msg2 = "ㆍ<span class='ev_warning'>현재 쌀만 거래 가능합니다.</span>"; $msg2 = "ㆍ<span class='ev_warning'>현재 쌀만 거래 가능합니다.</span>";
$valid = 0; $valid = 0;
} }
if($term < 0 || $term > 24) { if ($term < 0 || $term > 24) {
$msg2 = "ㆍ<span class='ev_warning'>종료기한은 1 ~ 24 턴 이어야 합니다.</span>"; $msg2 = "ㆍ<span class='ev_warning'>종료기한은 1 ~ 24 턴 이어야 합니다.</span>";
$valid = 0; $valid = 0;
} }
if($amount < 100 || $amount > 10000) { if ($amount < 100 || $amount > 10000) {
$msg2 = "ㆍ<span class='ev_warning'>거래량은 100 ~ 10000 이어야 합니다.</span>"; $msg2 = "ㆍ<span class='ev_warning'>거래량은 100 ~ 10000 이어야 합니다.</span>";
$valid = 0; $valid = 0;
} }
if($cost > $amount * 2 || $cost * 2 < $amount) { if ($cost > $amount * 2 || $cost * 2 < $amount) {
$msg2 = "ㆍ<span class='ev_warning'>시작구매가는 50% ~ 200% 이어야 합니다.</span>"; $msg2 = "ㆍ<span class='ev_warning'>시작구매가는 50% ~ 200% 이어야 합니다.</span>";
$valid = 0; $valid = 0;
} }
if($topv < $amount * 0.5 || $topv > $amount * 0.9) { if ($topv < $amount * 0.5 || $topv > $amount * 0.9) {
$msg2 = "ㆍ<span class='ev_warning'>즉시구매가는 50% ~ 90% 이어야 합니다.</span>"; $msg2 = "ㆍ<span class='ev_warning'>즉시구매가는 50% ~ 90% 이어야 합니다.</span>";
$valid = 0; $valid = 0;
} }
if($topv > $cost * 0.9) { if ($topv > $cost * 0.9) {
$msg2 = "ㆍ<span class='ev_warning'>즉시구매가는 시작구매가의 90% 이하이어야 합니다.</span>"; $msg2 = "ㆍ<span class='ev_warning'>즉시구매가는 시작구매가의 90% 이하이어야 합니다.</span>";
$valid = 0; $valid = 0;
} }
if($cost > $me['gold'] - 1000) { if ($cost > $me['gold'] - 1000) {
$msg2 = "ㆍ<span class='ev_warning'>기본 자금 1000은 거래할 수 없습니다.</span>"; $msg2 = "ㆍ<span class='ev_warning'>기본 자금 1000은 거래할 수 없습니다.</span>";
$valid = 0; $valid = 0;
} }
if($valid == 1) { if ($valid == 1) {
$msg2 = "ㆍ<span class='ev_success'>등록 성공.</span>"; $msg2 = "ㆍ<span class='ev_success'>등록 성공.</span>";
$date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit * $term); $date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit * $term);
$query = "insert into auction (type, no1, name1, stuff, amount, cost, value, topv, expire) values (1, '{$me['no']}', '{$me['name']}', '$stuff', '$amount', '$cost', '$cost', '$topv', '$date')";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $db->insert('auction', [
'type'=>1,
'no1'=>$me['no'],
'name1'=>$me['name'],
'stuff'=>$stuff,
'amount'=>$amount,
'cost'=>$cost,
'value'=>$cost,
'topv'=>$topv,
'expire'=>$date
]);
} }
} elseif($btn == "판매시도") { } elseif ($btn == "판매시도") {
$query = "select no2,value,topv,expire,amount from auction where no='$sel'"; $query = "select no2,value,topv,expire,amount from auction where no='$sel'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
$auction = MYDB_fetch_array($result); $auction = MYDB_fetch_array($result);
if($value == $auction['topv']) { if ($value == $auction['topv']) {
$valid = 2; $valid = 2;
} }
if(!$auction) { if (!$auction) {
$msg2 = "ㆍ<span class='ev_warning'>종료된 거래입니다.</span>"; $msg2 = "ㆍ<span class='ev_warning'>종료된 거래입니다.</span>";
$valid = 0; $valid = 0;
} }
if($stuff != 0) { if ($stuff != 0) {
$msg2 = "ㆍ<span class='ev_warning'>현재 쌀만 거래 가능합니다.</span>"; $msg2 = "ㆍ<span class='ev_warning'>현재 쌀만 거래 가능합니다.</span>";
$valid = 0; $valid = 0;
} }
if($auction['no2'] > 0 && $value >= $auction['value']) { if ($auction['no2'] > 0 && $value >= $auction['value']) {
$msg2 = "ㆍ<span class='ev_warning'>현재구매가보다 낮게 입찰해야 합니다.</span>"; $msg2 = "ㆍ<span class='ev_warning'>현재구매가보다 낮게 입찰해야 합니다.</span>";
$valid = 0; $valid = 0;
} }
if($value > $auction['value']) { if ($value > $auction['value']) {
$msg2 = "ㆍ<span class='ev_warning'>현재구매가보다 낮게 입찰해야 합니다.</span>"; $msg2 = "ㆍ<span class='ev_warning'>현재구매가보다 낮게 입찰해야 합니다.</span>";
$valid = 0; $valid = 0;
} }
if($value < $auction['topv']) { if ($value < $auction['topv']) {
$msg2 = "ㆍ<span class='ev_warning'>즉시구매가보다 낮을 수 없습니다.</span>"; $msg2 = "ㆍ<span class='ev_warning'>즉시구매가보다 낮을 수 없습니다.</span>";
$valid = 0; $valid = 0;
} }
if($value > $me['rice'] - 1000) { if ($value > $me['rice'] - 1000) {
$msg2 = "ㆍ<span class='ev_warning'>기본 군량 1000은 거래할 수 없습니다.</span>"; $msg2 = "ㆍ<span class='ev_warning'>기본 군량 1000은 거래할 수 없습니다.</span>";
$valid = 0; $valid = 0;
} }
if($valid == 1) { if ($valid == 1) {
$msg2 = "ㆍ<span class='ev_success'>입찰 성공.</span> 거래완료는 빨라도 현재로부터 1턴 뒤입니다."; $msg2 = "ㆍ<span class='ev_success'>입찰 성공.</span> 거래완료는 빨라도 현재로부터 1턴 뒤입니다.";
$date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit); $date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit);
if($auction['expire'] > $date) $date = $auction['expire']; if ($auction['expire'] > $date) {
$query = "update auction set value='$value',no2='{$me['no']}',name2='{$me['name']}',expire='$date' where no='$sel'"; $date = $auction['expire'];
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); }
} elseif($valid == 2) {
$db->update('auction', [
'value'=>$value,
'no2'=>$me['no'],
'name2'=>$me['name'],
'expire'=>$date,
], 'no=%i', $sel);
} elseif ($valid == 2) {
$msg2 = "ㆍ<span class='ev_success'>즉시구매 성공.</span> 거래완료는 빨라도 현재로부터 1턴 뒤입니다."; $msg2 = "ㆍ<span class='ev_success'>즉시구매 성공.</span> 거래완료는 빨라도 현재로부터 1턴 뒤입니다.";
$date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit); $date = date("Y-m-d H:i:s", strtotime(date("Y-m-d H:i:s")) + $unit);
$query = "update auction set value='$value',no2='{$me['no']}',name2='{$me['name']}',expire='$date' where no='$sel'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $db->update('auction', [
'value'=>$value,
'no2'=>$me['no'],
'name2'=>$me['name'],
'expire'=>$date,
], 'no=%i', $sel);
} }
} }
Submit("b_auction.php", $msg, $msg2); Submit("b_auction.php", $msg, $msg2);
+55 -35
View File
@@ -4,44 +4,64 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
// $btn0~15, $gold0~15 // $btn0~15, $gold0~15
//FIXME: 으악!!!!! 왜?! idx를 지정하고 gold를 지정하라고!
//로그인 검사 $betTarget = -1;
CheckLogin(); $betGold = -1;
$connect = dbConn(); for($i=0;$i<16;$i++){
increaseRefresh("베팅", 1); $textBtn = "btn{$i}";
$textGold = "gold{$i}";
$query = "select tournament,phase,tnmt_type,develcost from game limit 1"; $btn = Util::getReq($textBtn);
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $gold = Util::getReq($textGold, 'int');
$admin = MYDB_fetch_array($result); if($btn === "베팅!" && $gold){
$betTarget = $i;
if($admin['tournament'] != 6) { $betGold = $gold;
//echo "<script>location.replace('b_betting.php');</script>"; break;
echo 'b_betting.php';//TODO:debug all and replace
exit();
}
$query = "select gold,bet0,bet1,bet2,bet3,bet4,bet5,bet6,bet7,bet8,bet9,bet10,bet11,bet12,bet13,bet14,bet15,bet0+bet1+bet2+bet3+bet4+bet5+bet6+bet7+bet8+bet9+bet10+bet11+bet12+bet13+bet14+bet15 as bet from general where owner='{$_SESSION['userID']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result);
for($i=0; $i < 16; $i++) {
if(${"btn{$i}"} == "베팅!") {
$gold = ${"gold{$i}"};
$mebet = $me["bet{$i}"];
if($gold >= 10 && $gold <= 1000) {
if($gold + 500 <= $me['gold'] && $gold + $mebet <= 1000 && $gold + $me['bet'] <= 1000) {
$query = "update general set gold=gold-'$gold',bet{$i}=bet{$i}+'$gold',betgold=betgold+'$gold' where owner='{$_SESSION['userID']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$query = "update game set bet{$i}=bet{$i}+'$gold'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
}
}
} }
} }
?> if($betGold == -1){
extractMissingPostToGlobals();
}
<!--<script>location.replace('b_betting.php');</script>//TODO:debug all and replace-->
b_betting.php if($betTarget < 0 || $betGold < 10 || $betGold > 1000){
header('Location: b_betting.php');
exit();
}
//로그인 검사
$session = Session::requireGameLogin()->setReadOnly();
$userID = Session::getUserID();
$db = DB::db();
increaseRefresh("베팅", 1);
$tournament = $db->queryFirstField('SELECT tournament FROM game LIMIT 1');
if($tournament != 6) {
header('Location: b_betting.php');
exit();
}
$bets = $db->queryFirstList('SELECT bet0,bet1,bet2,bet3,bet4,bet5,bet6,bet7,bet8,bet9,bet10,bet11,bet12,bet13,bet14,bet15,gold FROM general WHERE `owner`=%i', $userID);
$myGold = array_pop($bets);
$totalBet = array_sum($bets);
//NOTE: 위 코드에서 $betTarget은 0~15의 정수임이 보장된다.
$oldBet = $bets[$betTarget];
if($betGold + 500 <= $myGold && $betGold + $oldBet <= 1000 && $betGold + $totalBet <= 1000) {
$db->update('general', [
'gold'=>$db->sqleval('gold - %i', $betGold),
"bet{$betTarget}"=>$db->sqleval("bet{$betTarget} + %i", $betGold),
'betgold'=>$db->sqleval('betgold + %i', $betGold)
], 'owner = %i', $userID);
$db->update('game', [
"bet{$betTarget}"=>$db->sqleval("bet{$betTarget} + %i", $betGold)
], true);
}
header('location: b_betting.php');
+46 -39
View File
@@ -3,51 +3,58 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
$title = Util::getReq('title');
$msg = Util::getReq('msg');
$num = Util::getReq('num', 'int');
$reply = Util::getReq('reply');
// $title, $msg, $num // $title, $msg, $num
extractMissingPostToGlobals();
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
if(getBlockLevel() != 1 && getBlockLevel() != 3) { $db = DB::db();
$query = "select no,nation from general where owner='{$_SESSION['userID']}'"; $connect=$db->get();
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result);
$title = str_replace("|", " ", $title); if (getBlockLevel() == 1 || getBlockLevel() == 3) {
$msg = str_replace("|", " ", $msg); header('location:b_chiefboard.php');
$reply = str_replace("|", " ", $reply); die();
$title = trim($title);
$msg = trim($msg);
$reply = trim($reply);
$nation = getNation($connect, $me['nation']);
//새글 추가시
if($num == -1 && $title != "" && $msg != "") {
$num = $nation['coreindex'] + 1;
if($num >= 20) { $num = 0; }
$msg = $title."|".$msg;
$msg = addslashes(SQ2DQ($msg));
$date = date('Y-m-d H:i:s');
$query = "update nation set coreboard{$num}='$msg',coreboard{$num}_who='{$me['no']}',coreboard{$num}_when='$date' where nation='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$query = "update nation set coreindex='$num' where nation='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
//$num에 댓글시
} elseif($num >= 0 && $reply != "") {
$newmsg = $nation["coreboard{$num}"]."|".$me['no']."|".$reply;
$newmsg = addslashes(SQ2DQ($newmsg));
$query = "update nation set coreboard{$num}='$newmsg' where nation='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
}
} }
//echo "<script>location.replace('b_chiefboard.php');</script>"; $query = "select no,nation from general where owner='{$userID}'";
echo 'b_chiefboard.php';//TODO:debug all and replace $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
?> $me = MYDB_fetch_array($result);
</body> $title = str_replace("|", " ", $title);
</html> $msg = str_replace("|", " ", $msg);
$reply = str_replace("|", " ", $reply);
$title = trim($title);
$msg = trim($msg);
$reply = trim($reply);
$nation = getNation($me['nation']);
//새글 추가시
if($num == -1 && $title != "" && $msg != "") {
$num = $nation['coreindex'] + 1;
if($num >= 20) { $num = 0; }
$msg = $title."|".$msg;
$msg = addslashes(SQ2DQ($msg));
$date = date('Y-m-d H:i:s');
$query = "update nation set coreboard{$num}='$msg',coreboard{$num}_who='{$me['no']}',coreboard{$num}_when='$date' where nation='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$query = "update nation set coreindex='$num' where nation='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
//$num에 댓글시
} elseif($num >= 0 && $reply != "") {
$newmsg = $nation["coreboard{$num}"]."|".$me['no']."|".$reply;
$newmsg = addslashes(SQ2DQ($newmsg));
$query = "update nation set coreboard{$num}='$newmsg' where nation='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
}
header('location:b_chiefboard.php');
+18 -11
View File
@@ -5,20 +5,29 @@ include "lib.php";
include "func.php"; include "func.php";
// $btn, $msg, $scoutmsg, $rate, $bill, $secretlimit // $btn, $msg, $scoutmsg, $rate, $bill, $secretlimit
//로그인 검사 $btn = Util::getReq('btn');
CheckLogin(); $msg = Util::getReq('msg');
$connect = dbConn(); $scoutmsg = Util::getReq('scoutmsg');
$rate = Util::getReq('rate', 'int');
$bill = Util::getReq('bill', 'int');
$secretlimit = Util::getReq('secretlimit', 'int');
$query = "select no,nation,level from general where owner='{$_SESSION['userID']}'"; extractMissingPostToGlobals();
//로그인 검사
$session = Session::requireGameLogin()->setReadOnly();
$userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
$query = "select no,nation,level from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
$btn = $_POST['btn'];
//내가 수뇌부이어야함 //내가 수뇌부이어야함
if($me['level'] < 5) { if($me['level'] < 5) {
//echo "<script>location.replace('b_myBossInfo.php');</script>"; header('location:b_myBossInfo.php');
echo 'b_myBossInfo.php';//TODO:debug all and replace
exit(); exit();
} }
@@ -59,7 +68,5 @@ if($btn == "국가방침") {
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
//echo "<script>location.replace('b_dipcenter.php');</script>"; header('location:b_dipcenter.php');
echo 'b_dipcenter.php';//TODO:debug all and replace
+66 -43
View File
@@ -4,18 +4,37 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
// $turn, $command, $cost, $name, $nationname, $note, $double, $third, $fourth // $turn, $command, $cost, $name, $nationname, $note, $double, $third, $fourth
$turn = Util::getReq('turn', 'array_int');
$command = Util::getReq('command', 'int', 0);
$cost = Util::getReq('cost', 'int');
$name = Util::getReq('name');
$nationname = Util::getReq('nationname', 'string', '');
$note = Util::getReq('note', 'string', '');
$double = Util::getReq('double', 'int', 0);
$third = Util::getReq('third', 'int', 0);
$fourth = Util::getReq('fourth', 'int', 0);
extractMissingPostToGlobals();
if(!$turn){
$turn = [0];
}
'@phan-var int $double';
'@phan-var int $third';
'@phan-var int $fourth';
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
if($command < 0) { $command = 0; } if($command < 0) { $command = 0; }
if($double < 0) { $double = 0; } if($double < 0) { $double = 0; }
if($third < 0) { $third = 0; } if($third < 0) { $third = 0; }
if($fourth < 0) { $fourth = 0; } if($fourth < 0) { $fourth = 0; }
$double = round($double, 0);
$third = round($third, 0);
$fourth = round($fourth, 0);
if($command > 99) { $command = 0; } if($command > 99) { $command = 0; }
if($double > 9999) { $double = 9999; } if($double > 9999) { $double = 9999; }
if($third > 9999) { $third = 9999; } if($third > 9999) { $third = 9999; }
@@ -30,23 +49,25 @@ if($command == 46) {
$name = str_replace(" ", "", $name); $name = str_replace(" ", "", $name);
$name = str_replace(" ", "", $name); $name = str_replace(" ", "", $name);
if($name == "") { $name = "무명"; } if($name == "") { $name = "무명"; }
$name = StringUtil::SubStrForWidth($name, 0, 12); $name = StringUtil::subStringForWidth($name, 0, 12);
$query = "update general set makenation='{$name}' where owner='{$_SESSION['userID']}'"; $db->update('general', [
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); 'makenation'=>$name
], 'owner=%i', $userID);
$count = sizeof($turn); $query = [];
$str = "con=con"; foreach($turn as $turnIdx){
for($i=0; $i < $count; $i++) { $query['turn'.$turnIdx] = $comStr;
$str .= ",turn{$turn[$i]}='{$comStr}'";
} }
$query = "update general set {$str} where owner='{$_SESSION['userID']}'"; $db->update('general', $query, 'owner=%i', $userID);
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); header('Location:./');
//echo "<script>location.replace('index.php');</script>"; die();
echo 'index.php';//TODO:debug all and replace
}
//통합제의 //통합제의
} elseif($command == 53) { if($command == 53) {
$query = "select nation,level from general where owner='{$_SESSION['userID']}'"; $query = "select nation,level from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
@@ -56,12 +77,12 @@ if($command == 46) {
$nationname = str_replace(" ", "", $nationname); $nationname = str_replace(" ", "", $nationname);
$nationname = str_replace(" ", "", $nationname); $nationname = str_replace(" ", "", $nationname);
if($nationname == "") { $nationname = "무명"; } if($nationname == "") { $nationname = "무명"; }
$nationname = StringUtil::SubStrForWidth($nationname, 0, 12); $nationname = StringUtil::subStringForWidth($nationname, 0, 12);
$query = "update general set makenation='{$nationname}' where level>=5 and nation='{$me['nation']}'"; $query = "update general set makenation='{$nationname}' where level>=5 and nation='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$count = sizeof($turn); $count = count($turn);
$str = "type=type"; $str = "type=type";
for($i=0; $i < $count; $i++) { for($i=0; $i < $count; $i++) {
$str .= ",l{$me['level']}turn{$turn[$i]}='{$comStr}'"; $str .= ",l{$me['level']}turn{$turn[$i]}='{$comStr}'";
@@ -69,11 +90,13 @@ if($command == 46) {
$query = "update nation set {$str} where nation='{$me['nation']}'"; $query = "update nation set {$str} where nation='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
//echo "<script>location.replace('b_chiefcenter.php');</script>"; header('location:b_chiefcenter.php');
echo 'b_chiefcenter.php';//TODO:debug all and replace die();
}
//불가침 //불가침
} elseif($command == 61) { if($command == 61) {
$query = "select nation,level from general where owner='{$_SESSION['userID']}'"; $query = "select nation,level from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
@@ -82,12 +105,12 @@ if($command == 46) {
$note = str_replace("|", "", $note); $note = str_replace("|", "", $note);
$note = str_replace(" ", "", $note); $note = str_replace(" ", "", $note);
$note = str_replace(" ", "", $note); $note = str_replace(" ", "", $note);
$note = StringUtil::SubStrForWidth($note, 0, 90); $note = StringUtil::subStringForWidth($note, 0, 90);
$query = "update diplomacy set reserved='{$note}' where me='{$me['nation']}' and you='$double'"; $query = "update diplomacy set reserved='{$note}' where me='{$me['nation']}' and you='$double'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$count = sizeof($turn); $count = count($turn);
$str = "type=type"; $str = "type=type";
for($i=0; $i < $count; $i++) { for($i=0; $i < $count; $i++) {
$str .= ",l{$me['level']}turn{$turn[$i]}='{$comStr}'"; $str .= ",l{$me['level']}turn{$turn[$i]}='{$comStr}'";
@@ -95,21 +118,24 @@ if($command == 46) {
$query = "update nation set {$str} where nation='{$me['nation']}'"; $query = "update nation set {$str} where nation='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
//echo "<script>location.replace('b_chiefcenter.php');</script>";
echo 'b_chiefcenter.php';//TODO:debug all and replace header('location:b_chiefcenter.php');
die();
}
//포상, 몰수, 발령, 항복권고, 원조 //포상, 몰수, 발령, 항복권고, 원조
//선전포고, 종전, 파기, 초토화, 천도, 증축, 감축 //선전포고, 종전, 파기, 초토화, 천도, 증축, 감축
//백성동원, 수몰, 허보, 피장파장, 의병모집, 이호경식, 급습 //백성동원, 수몰, 허보, 피장파장, 의병모집, 이호경식, 급습
//국기변경 //국기변경
} elseif($command == 23 || $command == 24 || $command == 27 || $command == 51 || $command == 52 || $command > 60) { if($command == 23 || $command == 24 || $command == 27 || $command == 51 || $command == 52 || $command > 60) {
$query = "select no,nation,level from general where owner='{$_SESSION['userID']}'"; $query = "select no,nation,level from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
if(($command == 23 || $command == 24 || $command == 27) && $me['no'] == $third) { if(($command == 23 || $command == 24 || $command == 27) && $me['no'] == $third) {
// 자기자신에게 악용 금지 // 자기자신에게 악용 금지
} elseif($me['level'] >= 5) { } elseif($me['level'] >= 5) {
$count = sizeof($turn); $count = count($turn);
$str = "type=type"; $str = "type=type";
for($i=0; $i < $count; $i++) { for($i=0; $i < $count; $i++) {
$str .= ",l{$me['level']}turn{$turn[$i]}='{$comStr}'"; $str .= ",l{$me['level']}turn{$turn[$i]}='{$comStr}'";
@@ -117,18 +143,15 @@ if($command == 46) {
$query = "update nation set {$str} where nation='{$me['nation']}'"; $query = "update nation set {$str} where nation='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
//echo "<script>location.replace('b_chiefcenter.php');</script>"; header('location:b_chiefcenter.php');
echo 'b_chiefcenter.php';//TODO:debug all and replace die();
} else {
$count = sizeof($turn);
$str = "con=con";
for($i=0; $i < $count; $i++) {
$str .= ",turn{$turn[$i]}='{$comStr}'";
}
$query = "update general set {$str} where owner='{$_SESSION['userID']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
//echo "<script>location.replace('index.php');</script>";
echo 'index.php';//TODO:debug all and replace
} }
//일반 턴
$query = [];
foreach($turn as $turnIdx){
$query['turn'.$turnIdx] = $comStr;
}
$db->update('general', $query, 'owner=%i', $userID);
header('Location:./');
+68 -16
View File
@@ -5,15 +5,26 @@ include "lib.php";
include "func.php"; include "func.php";
// $btn, $level, $genlist, $outlist // $btn, $level, $genlist, $outlist
$btn = Util::getReq('btn');
$level = Util::getReq('level', 'int');
$genlist = Util::getReq('genlist', 'int');
$outlist = Util::getReq('outlist', 'int');
$citylist = Util::getReq('citylist', 'int');
extractMissingPostToGlobals();
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
$query = "select startyear,year,month from game limit 1"; $query = "select startyear,year,month from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$query = "select no,nation,level from general where owner='{$_SESSION['userID']}'"; $query = "select no,nation,level from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
$meLevel = $me['level']; $meLevel = $me['level'];
@@ -22,15 +33,27 @@ $query = "select no from general where nation='{$me['nation']}' and level=12";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$ruler = MYDB_fetch_array($result); $ruler = MYDB_fetch_array($result);
//수뇌가 아니면 아무것도 할 수 없음
if($meLevel < 5){
header('location:b_myBossInfo.php');
exit();
}
if($btn == "임명") { if($btn == "임명") {
$query = "select no,nation,level,leader,power,intel from general where no='$genlist'"; $query = "select no,nation,level,leader,power,intel from general where no='$genlist'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$general = MYDB_fetch_array($result); $general = MYDB_fetch_array($result);
if(!$general){
header('location:b_myBossInfo.php');
exit();
}
//임명할사람이 군주이면 불가, 내가 수뇌부이어야함, 공석아닌때는 국가가 같아야함 //임명할사람이 군주이면 불가, 내가 수뇌부이어야함, 공석아닌때는 국가가 같아야함
if($general['level'] == 12 || $meLevel < 5 || ($general['nation'] != $me['nation'] && $genlist != 0)) { if($general['level'] == 12 || $meLevel < 5 || ($general['nation'] != $me['nation'] && $genlist != 0)) {
//echo "<script>location.replace('b_myBossInfo.php');</script>";
echo 'b_myBossInfo.php';//TODO:debug all and replace header('location:b_myBossInfo.php');
exit(); exit();
} }
} elseif($btn == "추방") { } elseif($btn == "추방") {
@@ -38,12 +61,22 @@ if($btn == "임명") {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$general = MYDB_fetch_array($result); $general = MYDB_fetch_array($result);
//추방할사람이 군주이면 불가, 내가 수뇌부이어야함, 공석아닌때는 국가가 같아야함 if(!$general){
if($general['level'] == 12 || $meLevel < 5 || ($general['nation'] != $me['nation'] && $outlist != 0)) { header('location:b_myBossInfo.php');
//echo "<script>location.replace('b_myBossInfo.php');</script>";
echo 'b_myBossInfo.php';//TODO:debug all and replace
exit(); exit();
} }
//추방할사람이 군주이면 불가, 내가 수뇌부이어야함, 공석아닌때는 국가가 같아야함
if($general['level'] == 12 || $meLevel < 5 || ($general['nation'] != $me['nation'] && $outlist != 0)) {
header('location:b_myBossInfo.php');
exit();
}
}
//나와 대상 장수는 국가가 같아야 함
if($me['nation'] != $general['nation']){
header('location:b_myBossInfo.php');
exit();
} }
if($btn == "추방") { if($btn == "추방") {
@@ -51,6 +84,8 @@ if($btn == "추방") {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$nation = MYDB_fetch_array($result); $nation = MYDB_fetch_array($result);
$alllog = [];
//이미 지정했다면 무시 //이미 지정했다면 무시
if($nation["l{$meLevel}set"] == 0 && $general['level'] > 0 && $general['level'] < 12) { if($nation["l{$meLevel}set"] == 0 && $general['level'] > 0 && $general['level'] < 12) {
$query = "select no from diplomacy where me='{$general['nation']}' and state>='3' and state<='4'"; $query = "select no from diplomacy where me='{$general['nation']}' and state>='3' and state<='4'";
@@ -159,12 +194,16 @@ if($btn == "추방") {
$query = "select year,month from game limit 1"; $query = "select year,month from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
addHistory($general, "<C>●</>{$admin['year']}{$admin['month']}월:<D>{$nation['name']}</>에서 추방됨"); pushGeneralHistory($general, "<C>●</>{$admin['year']}{$admin['month']}월:<D>{$nation['name']}</>에서 추방됨");
pushGenLog($general, $log); pushGenLog($general, $log);
pushAllLog($alllog); pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
} }
} elseif($btn == "임명" && $level >= 5 && $level <= 11) { header('location:b_myBossInfo.php');
die();
}
if($btn == "임명" && $level >= 5 && $level <= 11) {
$query = "select l{$level}set,level,chemi from nation where nation='{$me['nation']}'"; $query = "select l{$level}set,level,chemi from nation where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$nation = MYDB_fetch_array($result); $nation = MYDB_fetch_array($result);
@@ -211,17 +250,27 @@ if($btn == "추방") {
} }
} }
} }
} elseif($btn == "임명" && $level >= 2 && $level <= 4 && $citylist > 0) { header('location:b_myBossInfo.php');
die();
}
if($btn == "임명" && $level >= 2 && $level <= 4 && $citylist > 0) {
switch($level) { switch($level) {
case 4: $lv = 1; break; case 4: $lv = 1; break;
case 3: $lv = 2; break; case 3: $lv = 2; break;
case 2: $lv = 3; break; case 2: $lv = 3; break;
} }
$query = "select gen{$lv} from city where city='$citylist'"; $query = "select gen{$lv} from city where nation='{$me['nation']}' and city='$citylist'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$city = MYDB_fetch_array($result); $city = MYDB_fetch_array($result);
if(!$city){
header('location:b_myBossInfo.php');
die();
}
$oldlist = $city["gen{$lv}"]; $oldlist = $city["gen{$lv}"];
if($oldlist != 0) { if($oldlist != 0) {
//기존 장수 일반으로 //기존 장수 일반으로
$query = "update general set level=1 where no='$oldlist'"; $query = "update general set level=1 where no='$oldlist'";
@@ -237,6 +286,7 @@ if($btn == "추방") {
case 3: if($general['intel'] >= GameConst::$goodgenintel) { $valid = 1; } break; case 3: if($general['intel'] >= GameConst::$goodgenintel) { $valid = 1; } break;
default: $valid = 1; break; default: $valid = 1; break;
} }
if($valid == 1) { if($valid == 1) {
// 신임 장수의 원래 자리 해제 // 신임 장수의 원래 자리 해제
$query = "update city set gen1=0 where gen1='$genlist'"; $query = "update city set gen1=0 where gen1='$genlist'";
@@ -252,9 +302,11 @@ if($btn == "추방") {
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
} }
header('location:b_myBossInfo.php');
die();
} }
//echo "<script>location.replace('b_myBossInfo.php');</script>";
echo 'b_myBossInfo.php';//TODO:debug all and replace header('location:b_myBossInfo.php');
+13 -12
View File
@@ -4,13 +4,21 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
// $title, $msg, $num // $title, $msg, $num
$title = Util::getReq('title');
$msg = Util::getReq('msg');
$num = Util::getReq('num', 'int');
extractMissingPostToGlobals();
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
if(getBlockLevel() != 1 && getBlockLevel() != 3) { if(getBlockLevel() != 1 && getBlockLevel() != 3) {
$query = "select no,nation from general where owner='{$_SESSION['userID']}'"; $query = "select no,nation from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
@@ -21,7 +29,7 @@ if(getBlockLevel() != 1 && getBlockLevel() != 3) {
$msg = trim($msg); $msg = trim($msg);
$reply = trim($reply); $reply = trim($reply);
$nation = getNation($connect, $me['nation']); $nation = getNation($me['nation']);
//새글 추가시 //새글 추가시
if($num == -1 && $title != "" && $msg != "") { if($num == -1 && $title != "" && $msg != "") {
@@ -44,11 +52,4 @@ if(getBlockLevel() != 1 && getBlockLevel() != 3) {
} }
} }
//echo "<script>location.replace('b_nationboard.php');</script>"; header('location:b_nationboard.php');
echo 'b_nationboard.php';//TODO:debug all and replace
?>
</body>
</html>
+10 -6
View File
@@ -4,12 +4,18 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
// $msg // $msg
$msg = Util::getReq('msg');
extractMissingPostToGlobals();
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$query = "select no,nation from general where owner='{$_SESSION['userID']}'"; $db = DB::db();
$connect=$db->get();
$query = "select no,nation from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
@@ -18,6 +24,4 @@ $msg = addslashes(SQ2DQ($msg));
$query = "update nation set rule='$msg' where nation='{$me['nation']}'"; $query = "update nation set rule='$msg' where nation='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
//echo "<script>location.replace('b_nationrule.php');</script>"; header('location:b_nationrule.php');
echo 'b_nationrule.php';//TODO:debug all and replace
+119 -43
View File
@@ -4,16 +4,30 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
// $btn, $msg // $btn, $msg
$btn = Util::getReq('btn');
$msg = Util::getReq('msg');
//관리자용
$auto = Util::getReq('auto', 'int');
$type = Util::getReq('type', 'int');
$gen = Util::getReq('gen', 'int');
$sel = Util::getReq('sel', 'int');
$trig = Util::getReq('trig', 'int');
extractMissingPostToGlobals();
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
$query = "select tournament,phase,tnmt_type,develcost from game limit 1"; $query = "select tournament,phase,tnmt_type,develcost from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$query = "select no,name,tournament from general where owner='{$_SESSION['userID']}'"; $query = "select no,name,tournament from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
@@ -24,17 +38,71 @@ case 2: $tp = "power"; $tp2 = "일기토"; $tp3 = "power"; break;
case 3: $tp = "intel"; $tp2 = "설전"; $tp3 = "intel"; break; case 3: $tp = "intel"; $tp2 = "설전"; $tp3 = "intel"; break;
} }
if($me['tournament'] == 1 && Session::getUserGrade() < 5) { echo "<script>location.replace('b_tournament.php');</script>"; exit(); } if($btn == '참가') {
$query = "select no,name,npc,leader,power,intel,explevel,gold,horse,weap,book from general where no='{$me['no']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$general = MYDB_fetch_array($result);
if($btn == "자동개최설정" && Session::getUserGrade() >= 5) { //{$admin['develcost']}원 참가비
$query = "update game set tnmt_trig={$trig}"; if($general['gold'] < $admin['develcost']) {
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); header('location:b_tournament.php');
} elseif($btn == "개최" && Session::getUserGrade() >= 5) { exit(1);
startTournament($connect, $auto, $type); }
} elseif($btn == "중단" && Session::getUserGrade() >= 5) { $general['gold'] -= $admin['develcost'];
$query = "update game set tnmt_auto=0, tournament=0, phase=0";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $query = "select grp from tournament where grp<10 group by grp having count(*)=8";
} elseif((($btn == "투입" || $btn == "무명투입" || $btn == "쪼렙투입" || $btn == "일반투입" || $btn == "굇수투입" || $btn == "랜덤투입") && Session::getUserGrade() >= 5) || $btn == "참가") { $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$grpCount = MYDB_num_rows($result);
$occupied = [];
for($i=0; $i < $grpCount; $i++) {
$grp = MYDB_fetch_array($result);
$occupied[$grp['grp']] = 1;
}
$map = [];
for($i=0; $i < 8; $i++) {
if($occupied[$i] == 0) {
$map[] = $i;
}
}
if($grpCount < 8) {
$grp = $map[rand() % count($map)];
$query = "select grp from tournament where grp='$grp'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$grpCount = MYDB_num_rows($result);
$query = "insert into tournament (no, npc, name, ldr, pwr, itl, lvl, grp, grp_no, h, w, b) values ('{$general['no']}', '{$general['npc']}', '{$general['name']}', '{$general['leader']}', '{$general['power']}', '{$general['intel']}', '{$general['explevel']}', '$grp', '$grpCount', '{$general['horse']}', '{$general['weap']}', '{$general['book']}')";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$query = "update general set tournament=1,gold='{$general['gold']}' where no='{$general['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
}
$query = "select grp from tournament where grp<10 group by grp having count(*)=8";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$grpCount = MYDB_num_rows($result);
if($grpCount >= 8) {
$query = "update game set tournament=2, phase=0";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
}
header('location:b_tournament.php');
die();
}
if($session->userGrade < 5) {
header('location:b_tournament.php');
exit();
}
if($btn == "자동개최설정") {
$db->update('game', ['tnmt_trig'=>$trig], true);
} elseif($btn == "개최") {
startTournament($auto, $type);
} elseif($btn == "중단") {
$db->update('game', [
'tnmt_auto'=>0,
'tournament'=>0,
'phase'=>0
], true);
} elseif($btn == "투입" || $btn == "무명투입" || $btn == "쪼렙투입" || $btn == "일반투입" || $btn == "굇수투입" || $btn == "랜덤투입") {
if($btn == "투입") { if($btn == "투입") {
$query = "select no,name,npc,leader,power,intel,explevel,gold,horse,weap,book from general where no='$gen'"; $query = "select no,name,npc,leader,power,intel,explevel,gold,horse,weap,book from general where no='$gen'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
@@ -84,26 +152,20 @@ if($btn == "자동개최설정" && Session::getUserGrade() >= 5) {
$general = MYDB_fetch_array($result); $general = MYDB_fetch_array($result);
$general['gold'] -= $admin['develcost']; $general['gold'] -= $admin['develcost'];
//참가 //참가
} else {
$query = "select no,name,npc,leader,power,intel,explevel,gold,horse,weap,book from general where no='{$me['no']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$general = MYDB_fetch_array($result);
//{$admin['develcost']}원 참가비
if($general['gold'] < $admin['develcost']) { echo "<script>location.replace('b_tournament.php');</script>"; exit(1); }
$general['gold'] -= $admin['develcost'];
} }
$query = "select grp from tournament where grp<10 group by grp having count(*)=8"; $query = "select grp from tournament where grp<10 group by grp having count(*)=8";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$grpCount = MYDB_num_rows($result); $grpCount = MYDB_num_rows($result);
$occupied = [];
for($i=0; $i < $grpCount; $i++) { for($i=0; $i < $grpCount; $i++) {
$grp = MYDB_fetch_array($result); $grp = MYDB_fetch_array($result);
$occupied[$grp['grp']] = 1; $occupied[$grp['grp']] = 1;
} }
$map = [];
for($i=0; $i < 8; $i++) { for($i=0; $i < 8; $i++) {
if($occupied[$i] == 0) { if($occupied[$i] == 0) {
$map[count($map)] = $i; $map[] = $i;
} }
} }
@@ -125,8 +187,10 @@ if($btn == "자동개최설정" && Session::getUserGrade() >= 5) {
$query = "update game set tournament=2, phase=0"; $query = "update game set tournament=2, phase=0";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
} elseif(($btn == "쪼렙전부투입" || $btn == "일반전부투입" || $btn == "굇수전부투입" || $btn == "랜덤전부투입") && Session::getUserGrade() >= 5) {
} elseif($btn == "쪼렙전부투입" || $btn == "일반전부투입" || $btn == "굇수전부투입" || $btn == "랜덤전부투입") {
$z = 0; $z = 0;
$code = [];
for($i=0; $i < 8; $i++) { for($i=0; $i < 8; $i++) {
$query = "select grp from tournament where grp='$i'"; $query = "select grp from tournament where grp='$i'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
@@ -169,7 +233,7 @@ if($btn == "자동개최설정" && Session::getUserGrade() >= 5) {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$general = MYDB_fetch_array($result); $general = MYDB_fetch_array($result);
$grp = floor($code[$i] / 10); $grp = intdiv($code[$i], 10);
$grp_no = $code[$i] % 10; $grp_no = $code[$i] % 10;
$query = "insert into tournament (no, npc, name, ldr, pwr, itl, lvl, grp, grp_no, h, w, b) values ('{$general['no']}', '{$general['npc']}', '{$general['name']}', '{$general['leader']}', '{$general['power']}', '{$general['intel']}', '{$general['explevel']}', '$grp', '$grp_no', '{$general['horse']}', '{$general['weap']}', '{$general['book']}')"; $query = "insert into tournament (no, npc, name, ldr, pwr, itl, lvl, grp, grp_no, h, w, b) values ('{$general['no']}', '{$general['npc']}', '{$general['name']}', '{$general['leader']}', '{$general['power']}', '{$general['intel']}', '{$general['explevel']}', '$grp', '$grp_no', '{$general['horse']}', '{$general['weap']}', '{$general['book']}')";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
@@ -179,30 +243,42 @@ if($btn == "자동개최설정" && Session::getUserGrade() >= 5) {
$query = "update game set tournament=2, phase=0"; $query = "update game set tournament=2, phase=0";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} elseif($btn == "무명전부투입" && Session::getUserGrade() >= 5) { fillLowGenAll($connect); } elseif($btn == "무명전부투입") {
} elseif($btn == "예선" && Session::getUserGrade() >= 5) { qualify($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); fillLowGenAll();
} elseif($btn == "예선전부" && Session::getUserGrade() >= 5) { qualifyAll($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); } elseif($btn == "예선") {
} elseif($btn == "추첨" && Session::getUserGrade() >= 5) { selection($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); qualify($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
} elseif($btn == "추첨전부" && Session::getUserGrade() >= 5) { selectionAll($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); } elseif($btn == "예선전부") {
} elseif($btn == "본선" && Session::getUserGrade() >= 5) { finallySingle($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); qualifyAll($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
} elseif($btn == "본선전부" && Session::getUserGrade() >= 5) { finallyAll($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); } elseif($btn == "추첨") {
} elseif($btn == "배정" && Session::getUserGrade() >= 5) { final16set($connect); selection($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
} elseif($btn == "베팅마감" && Session::getUserGrade() >= 5) { } elseif($btn == "추첨전부") {
selectionAll($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
} elseif($btn == "본선") {
finallySingle($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
} elseif($btn == "본선전부") {
finallyAll($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
} elseif($btn == "배정") {
final16set();
} elseif($btn == "베팅마감") {
$dt = date("Y-m-d H:i:s", time() + 60); $dt = date("Y-m-d H:i:s", time() + 60);
$query = "update game set tournament='7',phase='0',tnmt_time='$dt'"; $query = "update game set tournament='7',phase='0',tnmt_time='$dt'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} elseif($btn == "16강" && Session::getUserGrade() >= 5) { finalFight($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase'], 16); } elseif($btn == "16강") {
} elseif($btn == "8강" && Session::getUserGrade() >= 5) { finalFight($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase'], 8); finalFight($admin['tnmt_type'], $admin['tournament'], $admin['phase'], 16);
} elseif($btn == "4" && Session::getUserGrade() >= 5) { finalFight($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase'], 4); } elseif($btn == "8") {
} elseif($btn == "결승" && Session::getUserGrade() >= 5) { finalFight($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase'], 2); finalFight($admin['tnmt_type'], $admin['tournament'], $admin['phase'], 8);
} elseif($btn == "포상" && Session::getUserGrade() >= 5) { setGift($connect, $admin['tnmt_type'], $admin['tournament'], $admin['phase']); } elseif($btn == "4강") {
} elseif($btn == "회수" && Session::getUserGrade() >= 5) { setRefund($connect); finalFight($admin['tnmt_type'], $admin['tournament'], $admin['phase'], 4);
} elseif($btn == "메시지" && Session::getUserGrade() >= 5) { } elseif($btn == "결승") {
finalFight($admin['tnmt_type'], $admin['tournament'], $admin['phase'], 2);
} elseif($btn == "포상") {
setGift($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
} elseif($btn == "회수") {
setRefund();
} elseif($btn == "메시지") {
$msg = addslashes(SQ2DQ($msg)); $msg = addslashes(SQ2DQ($msg));
$query = "update game set tnmt_msg='$msg'"; $query = "update game set tnmt_msg='$msg'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
?>
<!--<script>location.replace('b_tournament.php');</script> //TODO:debug all and replace --> header('location:b_tournament.php');
b_tournament.php
+44 -34
View File
@@ -4,55 +4,65 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
// $btn, $name, $troop // $btn, $name, $troop
$btn = Util::getReq('btn');
$name = Util::getReq('name');
$gen = Util::getReq('gen', 'int');
$troop = Util::getReq('troop', 'int');
extractMissingPostToGlobals();
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = $session::getUserID();
$query = "select no,nation,troop from general where owner='{$_SESSION['userID']}'"; $db = DB::db();
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = $db->queryFirstRow('SELECT `no`, nation, troop FROM general WHERE `owner`=%i', $userID);
$name = trim($name); $name = trim($name);
$name = addslashes(SQ2DQ($name));
if($btn == "부 대 창 설" && $name != "" && $me['troop'] == 0) { if($btn == "부 대 창 설" && $name != "" && $me['troop'] == 0) {
$query = "insert into troop (name,nation,no) values ('$name','{$me['nation']}','{$me['no']}')"; $db->insert('troop',[
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); 'name'=>$name,
'nation'=>$me['nation'],
'no'=>$me['no']
]);
$troopID = $db->insertId();
$query = "select troop from troop where no='{$me['no']}'"; $db->update('general', [
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); 'troop'=>$troopID
$troop = MYDB_fetch_array($result); ], 'no=%i',$me['no']);
$query = "update general set troop='{$troop['troop']}' where no='{$me['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} elseif($btn == "부 대 변 경" && $name != "") { } elseif($btn == "부 대 변 경" && $name != "") {
$query = "update troop set name='$name' where no='{$me['no']}'"; $db->update('troop', [
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); 'name'=>$name
], 'no=%i',$me['no']);
} elseif($btn == "부 대 추 방" && $gen != 0) { } elseif($btn == "부 대 추 방" && $gen != 0) {
$query = "update general set troop='0' where no='$gen'"; $db->update('general', [
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); 'troop'=>0
], 'no=%i AND troop=(SELECT troop FROM troop WHERE no = %i)', $gen, $me['no']);
} elseif($btn == "부 대 가 입" && $troop != 0) { } elseif($btn == "부 대 가 입" && $troop != 0) {
$query = "update general set troop='$troop' where no='{$me['no']}'"; $troopLeader = $db->queryFirstField('SELECT `no` FROM troop WHERE troop=%i', $troop);
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $troopLeaderNation = $db->queryFirstField('SELECT `nation` FROM `general` WHERE `no`=%i AND `nation`=%i', $troopLeader, $me['nation']);
if($troopLeaderNation){
$db->update('general', [
'troop'=>$troop
], 'no=%i', $me['no']);
}
} elseif($btn == "부 대 탈 퇴") { } elseif($btn == "부 대 탈 퇴") {
$query = "select no from troop where troop='{$me['troop']}'"; $troopLeader = $db->queryFirstField('SELECT `no` FROM troop WHERE troop=%i', $me['troop']);
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$troop = MYDB_fetch_array($result);
//부대장일 경우 //부대장일 경우
if($troop['no'] == $me['no']) { if($troopLeader == $me['no']) {
// 모두 탈퇴 // 모두 탈퇴
$query = "update general set troop='0' where troop='{$me['troop']}'"; $db->update('general', [
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); 'troop'=>0
], 'troop=%i',$me['troop']);
// 부대 삭제 // 부대 삭제
$query = "delete from troop where troop='{$me['troop']}'"; $db->delete('troop', 'troop=%i', $me['troop']);
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} else { } else {
$query = "update general set troop='0' where no='{$me['no']}'"; $db->update('general', [
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); 'troop'=>0
], 'no=%i', $me['no']);
} }
} }
echo "<script>location.replace('b_troop.php');</script>"; header('Location:b_troop.php');
MYDB_close($connect);
+8 -5
View File
@@ -4,8 +4,11 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
$query = "select killturn from game limit 1"; $query = "select killturn from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
@@ -13,9 +16,9 @@ $admin = MYDB_fetch_array($result);
$admin['killturn'] *= 3; $admin['killturn'] *= 3;
$query = "update general set killturn='{$admin['killturn']}' where owner='{$_SESSION['userID']}'"; $query = "update general set killturn='{$admin['killturn']}' where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
//echo "<script>location.replace('b_myPage.php');</script>";
echo 'b_myPage.php'; //TODO:debug all and replace header('location:b_myPage.php');
+21 -15
View File
@@ -3,25 +3,37 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
$btn = Util::getReq('btn');
$sel = Util::getReq('sel', 'int');
$comment = Util::getReq('comment');
$title = Util::getReq('title');
$str = Util::getReq('str');
extractMissingPostToGlobals();
//로그인 검사 //로그인 검사
CheckLogin(); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn(); $userID = Session::getUserID();
$db = DB::db();
$connect=$db->get();
$query = "select develcost,vote,votecomment from game limit 1"; $query = "select develcost,vote,votecomment from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$query = "select no,vote,name,nation,horse,weap,book,item,npc from general where owner='{$_SESSION['userID']}'"; $query = "select no,vote,name,nation,horse,weap,book,item,npc from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
if($btn == "투표" && $me['vote'] == 0 && $sel > 0) { if($btn == "투표" && $me['vote'] == 0 && $sel > 0) {
$develcost = $admin['develcost'] * 5; $develcost = $admin['develcost'] * 5;
$query = "update general set gold=gold+{$develcost},vote='{$sel}' where owner='{$_SESSION['userID']}'"; $query = "update general set gold=gold+{$develcost},vote='{$sel}' where owner='{$userID}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$log = array(); $log = [];
$log = uniqueItem($connect, $me, $log, 1); $log = uniqueItem($me, $log, 1);
pushGenLog($me, $log); pushGenLog($me, $log);
} }
else if($btn == "댓글" && $comment != "") { else if($btn == "댓글" && $comment != "") {
@@ -31,9 +43,6 @@ else if($btn == "댓글" && $comment != "") {
$comment = addslashes(SQ2DQ($comment)); $comment = addslashes(SQ2DQ($comment));
$nation = getNationStaticInfo($me['nation']); $nation = getNationStaticInfo($me['nation']);
if($nation == null) {
$nation['name'] = "재야";
}
if($admin['votecomment'] != "") { $admin['votecomment'] .= "|"; } if($admin['votecomment'] != "") { $admin['votecomment'] .= "|"; }
$admin['votecomment'] .= "{$nation['name']}:{$me['name']}:{$comment}"; $admin['votecomment'] .= "{$nation['name']}:{$me['name']}:{$comment}";
@@ -45,9 +54,8 @@ else if($btn == "댓글" && $comment != "") {
} }
if(Session::getUserGrade() < 5){ if($session->userGrade < 5){
echo "<!--<script>location.replace('a_vote.php');</script>"; //TODO:debug all and replace --> header('location:a_vote.php');
echo 'a_vote.php ';
die(); die();
} }
@@ -86,7 +94,5 @@ if($btn == "수정") {
$query = "update game set voteopen=2"; $query = "update game set voteopen=2";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
?>
<!--<script>location.replace('a_vote.php');</script>"; //TODO:debug all and replace --> header('location:a_vote.php');
a_vote.php
+19 -9
View File
@@ -4,8 +4,10 @@ namespace sammo;
include "lib.php"; include "lib.php";
include "func.php"; include "func.php";
//로그인 검사 //로그인 검사
CheckLogin(1); $session = Session::requireGameLogin()->setReadOnly();
$connect = dbConn();
$db = DB::db();
$connect=$db->get();
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
@@ -13,8 +15,14 @@ $connect = dbConn();
<head> <head>
<title>커맨드리스트</title> <title>커맨드리스트</title>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'> <meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<link rel=stylesheet href=css/common.css type=text/css> <link rel='stylesheet' href='../d_shared/common.css' type='text/css'>
<link rel='stylesheet' href='css/common.css' type='text/css'>
<script type="text/javascript"> <script type="text/javascript">
<?php
if(!$session->isLoggedIn()){
echo 'window.parent.location.href = "../";';
}
?>
function myclock() { function myclock() {
lastday = new Array(31,28,31,30,31,30,31,31,30,31,30,31); lastday = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
@@ -55,11 +63,13 @@ function myclock() {
</head> </head>
<body OnLoad='myclock()'> <body OnLoad='myclock()'>
<?php <?php
myCommandList($connect); myCommandList();
function myCommandList() {
$db = DB::db();
$connect=$db->get();
$userID = Session::getUserID();
function myCommandList($connect) {
global $_basecolor, $_basecolor2, $_basecolor3;
global $images;
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
// 명령 목록 // 명령 목록
@@ -67,10 +77,10 @@ function myCommandList($connect) {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$query = "select no,turntime,term,turn0,turn1,turn2,turn3,turn4,turn5,turn6,turn7,turn8,turn9,turn10,turn11,turn12,turn13,turn14,turn15,turn16,turn17,turn18,turn19,turn20,turn21,turn22,turn23 from general where owner='{$_SESSION['userID']}'"; $query = "select no,turntime,term,turn0,turn1,turn2,turn3,turn4,turn5,turn6,turn7,turn8,turn9,turn10,turn11,turn12,turn13,turn14,turn15,turn16,turn17,turn18,turn19,turn20,turn21,turn22,turn23 from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
$turn = getTurn($connect, $me, 2); $turn = getTurn($me, 2);
echo "<table width=300 height=700 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg2> echo "<table width=300 height=700 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg2>
<form name=clock> <form name=clock>
+8 -21
View File
@@ -1,31 +1,14 @@
@charset "UTF-8"; @charset "UTF-8";
html, body{
background-color:black;
color:white;
}
table { font-family:'맑은 고딕'; line-height:110%; } table { font-family:'맑은 고딕'; line-height:110%; }
font { font-family:'맑은 고딕'; line-height:110%; } font { font-family:'맑은 고딕'; line-height:110%; }
input { font-family:'맑은 고딕'; line-height:110%; height:20px } input { font-family:'맑은 고딕'; line-height:110%; height:20px }
select { font-family:'굴림'; line-height:100%; } select { font-family:'굴림'; line-height:100%; }
#bg0 {
background-image:url('/images/back_walnut.jpg');
}
#bg1 {
background-image:url('/images/back_green.jpg');
}
#bg2 {
background-image:url('/images/back_blue.jpg');
}
.bg0{
background-image:url('/images/back_walnut.jpg');
}
.bg1{
background-image:url('/images/back_green.jpg');
}
.bg2{
background-image:url('/images/back_blue.jpg');
}
/* */ /* */
@@ -65,6 +48,10 @@ select { font-family:'굴림'; line-height:100%; }
content:"◆"; content:"◆";
} }
.small_war_log{
display:inline-block;
}
.small_war_log .war_type_attack{ .small_war_log .war_type_attack{
color:cyan; color:cyan;
} }
+28 -1
View File
@@ -1,7 +1,10 @@
@charset "UTF-8"; @charset "UTF-8";
body { body {
color:white; background-color:black; border-width:1px; border-color:gray; background-image:url('/images/back.jpg'); background-position:center; background-repeat:repeat-y; color:white;
background-color:black;
border-width:1px;
border-color:gray; background-position:center; background-repeat:repeat-y;
} }
#container { #container {
@@ -26,6 +29,30 @@ color:white; background-color:black; border-width:1px; border-color:gray; backgr
display:block; display:block;
} }
.commandButton {
float:left;
width:111px;
height:30px;
font-weight:bold;
font-size:13px;
margin:0;
display:block;
}
.commandButton:disabled::before{
content:'【'
}
.commandButton:disabled::after{
content:'】'
}
.commandButton:disabled{
background-color:transparent !important;
color:gray !important;
border-color:transparent !important;
}
.toolbarButton2 { .toolbarButton2 {
float:left; float:left;
background-color:#225500; background-color:#225500;
+2 -48
View File
@@ -11,12 +11,6 @@
text-align:center; text-align:center;
} }
.map_detail .map_title{
background:
url('/images/ltitle.jpg') no-repeat left,
url('/images/rtitle.jpg') no-repeat right;
}
.map_title_text{ .map_title_text{
margin:auto; margin:auto;
text-align:center; text-align:center;
@@ -27,52 +21,12 @@
font-weight:bold; font-weight:bold;
} }
.map_detail.map_spring .map_title_text{
background:
url('/images/ad.gif') no-repeat left,
url('/images/spring.gif') no-repeat right;
}
.map_detail.map_summer .map_title_text{
background:
url('/images/ad.gif') no-repeat left,
url('/images/summer.gif') no-repeat right;
}
.map_detail.map_fall .map_title_text{
background:
url('/images/ad.gif') no-repeat left,
url('/images/fall.gif') no-repeat right;
}
.map_detail.map_winter .map_title_text{
background:
url('/images/ad.gif') no-repeat left,
url('/images/winter.gif') no-repeat right;
}
.map_body{ .map_body{
width:700px; width:700px;
height:500px; height:500px;
position:relative; position:relative;
} }
.map_spring .map_body{
background: url('/images/map1.jpg') no-repeat;
}
.map_summer .map_body{
background: url('/images/map2.jpg') no-repeat;
}
.map_fall .map_body{
background: url('/images/map3.jpg') no-repeat;
}
.map_winter .map_body{
background: url('/images/map4.jpg') no-repeat;
}
.world_map .city_tooltip{ .world_map .city_tooltip{
position: absolute; position: absolute;
z-index:6; z-index:6;
@@ -135,7 +89,7 @@
/* /*
.map_detail .city_base.city_level_{0} .city_bg{ .map_detail .city_base.city_level_{0} .city_bg{
//$img = loadImg('/images/cast_{0}.gif'); //$img = loadImg('cast_{0}.gif');
//$parent = cssSelect('.city_base'); //$parent = cssSelect('.city_base');
width: $img.width; width: $img.width;
height: $img.height; height: $img.height;
@@ -222,7 +176,7 @@
/* /*
.map_detail .city_base.city_level_{0} .city_img{ .map_detail .city_base.city_level_{0} .city_img{
//$img = loadImg('/images/cast_{0}.gif'); //$img = loadImg('cast_{0}.gif');
//$parent = cssSelect('.city_base'); //$parent = cssSelect('.city_base');
width: $img.width; width: $img.width;
height: $img.height; height: $img.height;
+147
View File
@@ -0,0 +1,147 @@
@charset "UTF-8";
/*임시용 */
#container{
width:1000px;
margin:auto;
font-size:13px;
}
/*임시용 끝*/
#message_board section{
overflow-y:auto;
overflow-x:hidden;
max-width:498px;
}
.msg_plate{
width:100%;
border-bottom:groove 0.1em;
border-left:groove 0.1em;
border-right:groove 0.1em;
height:64px;
font-size:12px;
word-break:break-all;
color:white;
}
.msg_plate_private{
background-color:#5d1e1a;
}
.msg_plate_public{
background-color:#141c65;
}
.msg_plate_national, .msg_plate_diplomacy{
background-color:#00582c;
}
.public_message{
height:667px;
}
.private_message{
height:667px;
}
.national_message{
height:1350px;
}
.msg_icon{
float:left;
width:64px;
height:64px;
border-right:groove 0.1em;
}
.msg_time{
font-size:0.75em;
font-weight:normal;
}
.msg_header{
font-weight: bold;
margin-bottom:3px;
color:white;
}
#msg_input{
color:white;
background-color:black;
font-size:12px;
width:720px;
height:15px;
}
#mailbox_list{
color:white;
background-color:black;
font-size:12px;
width:160px;
}
.board_header{
color:white;
border:groove 0.1em;
}
.board_side{
height:1370px;
width:498px;
overflow-y: hidden;
display:inline-block;
border-left:groove 1px;
border-right:groove 1px;
border-bottom:groove 1px;
}
.msg_body{
padding-left:64px;
}
.msg_target{
margin:2px 2px 0 2px;
padding:2px 3px;
display:inline-block;
box-shadow: 2px 2px black;
border-radius: 3px;
}
/*
.public_message .msg_target{
box-shadow: 2px 2px darkslategrey;
}
*/
.msg_target.msg_bright{
color:black;
}
.msg_target.msg_dark{
color:white;
}
.msg_from_to{
display:inline-block;
}
.msg_content{
margin-left:10px;
margin-right:5px;
}
.msg_prompt{
text-align:right;
margin-top:5px;
margin-right:5px;
}
#mailbox_list option{
color:white;
background-color:black;
}
-120
View File
@@ -1,120 +0,0 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
//로그인 검사
CheckLogin(1);
$connect = dbConn();
//$when = ($when + 1) * 2;
$query = "select year,month from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result);
$query = "select no,name,nation,level,picture,imgsvr from general where owner='{$_SESSION['userID']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result);
$query = "select no,nation,name from general where no='$gen'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$you = MYDB_fetch_array($result);
$query = "select name,surlimit,color from nation where nation='{$you['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$younation = MYDB_fetch_array($result);
$query = "select name,gold,rice,surlimit,color,dip{$num} as dipmsg from nation where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$mynation = MYDB_fetch_array($result);
$query = "select pop from city where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$citycount = MYDB_num_rows($result);
$query = "select city from city where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$losecitynum = MYDB_num_rows($result);
$query = "select city from city where nation='{$you['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$wincitynum = MYDB_num_rows($result);
//아국과의 관계
$query = "select state,term from diplomacy where me='{$me['nation']}' and you='{$you['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$dip = MYDB_fetch_array($result);
//상대국의 제의조건
$query = "select reserved from diplomacy where me='{$you['nation']}' and you='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$dip2 = MYDB_fetch_array($result);
if($ok == "수락") {
// 서신 보낸 후 멸망,선양 등 했을때.
if($me['level'] < 5) {
$mylog[] = "<C>●</>수뇌부가 아니므로 불가능합니다. 불가침 실패.";
} elseif($dip['term'] == $when*12 && $dip['state'] == 7) {
$mylog[] = "<C>●</>이미 수락했습니다. 불가침 실패.";
} elseif($losecitynum == 0) {
$mylog[] = "<C>●</>방랑군이므로 불가능합니다. 불가침 실패.";
} elseif($wincitynum == 0) {
$mylog[] = "<C>●</>상대가 방랑군이므로 불가능합니다. 불가침 실패.";
} elseif($dip['state'] == 0) {
$mylog[] = "<C>●</>아국과 교전중입니다. 불가침 실패.";
} elseif($dip['state'] == 1) {
$mylog[] = "<C>●</>아국과 선포중입니다. 불가침 실패.";
} elseif($dip['state'] == 3 || $dip['state'] == 4) {
$mylog[] = "<C>●</>아국과 합병중입니다. 불가침 실패.";
} elseif($mynation['dipmsg'] == "") {
$mylog[] = "<C>●</>이미 거절했습니다. 불가침 실패.";
} else {
// $alllog[] = "<C>●</>{$admin['month']}월:<Y>{$me['name']}</>(이)가 <D><b>{$younation['name']}</b></>(와)과 <M>불가침</>에 합의.";
// $history[] = "<C>●</>{$admin['year']}년 {$admin['month']}월:<Y><b>【불가침】</b></><D><b>{$mynation['name']}</b></>(이)가 <D><b>{$younation['name']}</b></>(와)과 불가침 조약을 체결했습니다.";
$youlog[] = "<C>●</><D><b>{$mynation['name']}</b></>(와)과 <C>$when</>년 불가침에 성공했습니다.";
$mylog[] = "<C>●</><D><b>{$younation['name']}</b></>(와)과 <C>$when</>년 불가침에 합의했습니다.";
addHistory($you, "<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$mynation['name']}</b></>(와)과 {$when}년 불가침 성공");
addHistory($me, "<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$younation['name']}</b></>(와)과 {$when}년 불가침 수락");
//국메로 저장
$msg = "【외교】{$admin['year']}{$admin['month']}월:{$younation['name']}(와)과 {$when}년 불가침 합의, 비고: {$dip2['reserved']}";
$youmsg = "【외교】{$admin['year']}{$admin['month']}월:{$mynation['name']}(와)과 {$when}년 불가침 합의, 비고: {$dip2['reserved']}";
PushMsg(2, $me['nation'], $me['picture'], $me['imgsvr'], "{$me['name']}:{$mynation['name']}", $mynation['color'], $younation['name'], $younation['color'], $msg);
PushMsg(3, $you['nation'], $me['picture'], $me['imgsvr'], "{$me['name']}:{$mynation['name']}", $mynation['color'], $younation['name'], $younation['color'], $youmsg);
$when = $when * 12;
//외교 변경
$query = "update diplomacy set state='7',term='$when',fixed='{$dip2['reserved']}' where me='{$me['nation']}' and you='{$you['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$query = "update diplomacy set state='7',term='$when',fixed='{$dip2['reserved']}' where me='{$you['nation']}' and you='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
}
//조건 지움
$query = "update diplomacy set reserved='' where me='{$you['nation']}' and you='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
//현 메세지 지움
$query = "update nation set dip{$num}='',dip{$num}_who='0',dip{$num}_when='' where nation='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} else {
$youlog[] = "<C>●</><Y>{$mynation['name']}</>(이)가 불가침을 거부했습니다.";
$mylog[] = "<C>●</><D>{$younation['name']}</>(와)과 불가침을 거부했습니다.";
//조건 지움
$query = "update diplomacy set reserved='' where me='{$you['nation']}' and you='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
//현 메세지 지움
$query = "update nation set dip{$num}='',dip{$num}_who='0',dip{$num}_when='' where nation='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
}
pushGenLog($me, $mylog);
pushGenLog($you, $youlog);
//pushAllLog($alllog);
//pushHistory($history);
echo "<script>location.replace('msglist.php');</script>";
-99
View File
@@ -1,99 +0,0 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
//로그인 검사
CheckLogin(1);
$connect = dbConn();
$query = "select year,month from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result);
$query = "select no,name,nation,level,picture,imgsvr from general where owner='{$_SESSION['userID']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result);
$query = "select no,nation from general where no='$gen'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$you = MYDB_fetch_array($result);
$query = "select name,surlimit,color from nation where nation='{$you['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$younation = MYDB_fetch_array($result);
$query = "select name,gold,rice,surlimit,color,dip{$num} as dipmsg from nation where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$mynation = MYDB_fetch_array($result);
$query = "select pop from city where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$citycount = MYDB_num_rows($result);
$query = "select city from city where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$losecitynum = MYDB_num_rows($result);
$query = "select city from city where nation='{$you['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$wincitynum = MYDB_num_rows($result);
//아국과의 관계
$query = "select state from diplomacy where me='{$me['nation']}' and you='{$you['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$dip = MYDB_fetch_array($result);
if($ok == "수락") {
// 서신 보낸 후 멸망,선양 등 했을때.
if($me['level'] < 5) {
$mylog[] = "<C>●</>수뇌부가 아니므로 불가능합니다. 파기 실패.";
} elseif($losecitynum == 0) {
$mylog[] = "<C>●</>방랑군이므로 불가능합니다. 파기 실패.";
} elseif($wincitynum == 0) {
$mylog[] = "<C>●</>상대가 방랑군이므로 불가능합니다. 파기 실패.";
} elseif($dip['state'] != 7) {
$mylog[] = "<C>●</>아국과 불가침중이 아닙니다. 파기 실패.";
} elseif($mynation['dipmsg'] == "") {
$mylog[] = "<C>●</>이미 거절했습니다. 파기 실패.";
} else {
$alllog[] = "<C>●</>{$admin['month']}월:<Y>{$me['name']}</>(이)가 <D><b>{$younation['name']}</b></>(와)과 <M>조약 파기</>에 합의.";
$history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<Y><b>【파기】</b></><D><b>{$mynation['name']}</b></>(이)가 <D><b>{$younation['name']}</b></>(와)과 불가침을 파기 하였습니다.";
$youlog[] = "<C>●</><D><b>{$mynation['name']}</b></>(와)과 파기에 성공했습니다.";
$mylog[] = "<C>●</><D><b>{$younation['name']}</b></>(와)과 파기에 합의했습니다.";
addHistory($you, "<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$mynation['name']}</b></>(와)과 파기 성공");
addHistory($me, "<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$younation['name']}</b></>(와)과 파기 수락");
//외교 변경
$query = "update diplomacy set state='2',term='0' where me='{$me['nation']}' and you='{$you['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$query = "update diplomacy set state='2',term='0' where me='{$you['nation']}' and you='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
//국메로 저장
$msg = "【외교】{$admin['year']}{$admin['month']}월:{$younation['name']}(와)과 불가침 파기 동의";
$youmsg = "【외교】{$admin['year']}{$admin['month']}월:{$mynation['name']}(와)과 불가침 파기 동의";
PushMsg(2, $me['nation'], $me['picture'], $me['imgsvr'], "{$me['name']}:{$mynation['name']}", $mynation['color'], $younation['name'], $younation['color'], $msg);
PushMsg(3, $you['nation'], $me['picture'], $me['imgsvr'], "{$me['name']}:{$mynation['name']}", $mynation['color'], $younation['name'], $younation['color'], $youmsg);
}
//현 메세지 지움
$query = "update nation set dip{$num}='',dip{$num}_who='0',dip{$num}_when='' where nation='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} else {
$youlog[] = "<C>●</><Y>{$mynation['name']}</>(이)가 파기를 거부했습니다.";
$mylog[] = "<C>●</><D>{$younation['name']}</>(와)과 파기를 거부했습니다.";
//현 메세지 지움
$query = "update nation set dip{$num}='',dip{$num}_who='0',dip{$num}_when='' where nation='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
}
pushGenLog($me, $mylog);
pushGenLog($you, $youlog);
pushAllLog($alllog);
pushHistory($history);
echo "<script>location.replace('msglist.php');</script>";
-104
View File
@@ -1,104 +0,0 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
//로그인 검사
CheckLogin(1);
$connect = dbConn();
$query = "select year,month from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result);
$query = "select no,name,nation,level,picture,imgsvr from general where owner='{$_SESSION['userID']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result);
$query = "select no,nation from general where no='$gen'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$you = MYDB_fetch_array($result);
$query = "select nation,name,surlimit,color from nation where nation='{$you['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$younation = MYDB_fetch_array($result);
$query = "select nation,name,gold,rice,surlimit,color,dip{$num} as dipmsg from nation where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$mynation = MYDB_fetch_array($result);
$query = "select pop from city where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$citycount = MYDB_num_rows($result);
$query = "select city from city where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$losecitynum = MYDB_num_rows($result);
$query = "select city from city where nation='{$you['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$wincitynum = MYDB_num_rows($result);
//아국과의 관계
$query = "select state from diplomacy where me='{$me['nation']}' and you='{$you['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$dip = MYDB_fetch_array($result);
if($ok == "수락") {
// 서신 보낸 후 멸망,선양 등 했을때.
if($me['level'] < 5) {
$mylog[] = "<C>●</>수뇌부가 아니므로 불가능합니다. 종전 실패.";
} elseif($losecitynum == 0) {
$mylog[] = "<C>●</>방랑군이므로 불가능합니다. 종전 실패.";
} elseif($wincitynum == 0) {
$mylog[] = "<C>●</>상대가 방랑군이므로 불가능합니다. 종전 실패.";
} elseif($dip['state'] != 0 && $dip['state'] != 1) {
$mylog[] = "<C>●</>아국과 교전중이 아닙니다. 종전 실패.";
} elseif($mynation['dipmsg'] == "") {
$mylog[] = "<C>●</>이미 거절했습니다. 불가침 실패.";
} else {
$alllog[] = "<C>●</>{$admin['month']}월:<Y>{$me['name']}</>(이)가 <D><b>{$younation['name']}</b></>(와)과 <M>종전 합의</> 하였습니다.";
$history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<Y><b>【종전】</b></><D><b>{$mynation['name']}</b></>(이)가 <D><b>{$younation['name']}</b></>(와)과 <M>종전 합의</> 하였습니다.";
$youlog[] = "<C>●</><D><b>{$mynation['name']}</b></>(와)과 종전에 성공했습니다.";
$mylog[] = "<C>●</><D><b>{$younation['name']}</b></>(와)과 종전에 합의했습니다.";
addHistory($you, "<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$mynation['name']}</b></>(와)과 종전 성공");
addHistory($me, "<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$younation['name']}</b></>(와)과 종전 수락");
//외교 변경
$query = "update diplomacy set state='2',term='0' where me='{$mynation['nation']}' and you='{$younation['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$query = "update diplomacy set state='2',term='0' where me='{$younation['nation']}' and you='{$mynation['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
//외교제한
$query = "update nation set surlimit=24 where nation='{$mynation['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$query = "update nation set surlimit=24 where nation='{$younation['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
//국메로 저장
$msg = "【외교】{$admin['year']}{$admin['month']}월:{$younation['name']}(와)과 종전 동의";
$youmsg = "【외교】{$admin['year']}{$admin['month']}월:{$mynation['name']}(와)과 종전 동의";
PushMsg(2, $mynation['nation'], $me['picture'], $me['imgsvr'], "{$me['name']}:{$mynation['name']}", $mynation['color'], $younation['name'], $younation['color'], $msg);
PushMsg(3, $younation['nation'], $me['picture'], $me['imgsvr'], "{$me['name']}:{$mynation['name']}", $mynation['color'], $younation['name'], $younation['color'], $youmsg);
}
//현 메세지 지움
$query = "update nation set dip{$num}='',dip{$num}_who='0',dip{$num}_when='' where nation='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} else {
$youlog[] = "<C>●</><Y>{$mynation['name']}</>(이)가 종전을 거부했습니다.";
$mylog[] = "<C>●</><D>{$younation['name']}</>(와)과 종전을 거부했습니다.";
//현 메세지 지움
$query = "update nation set dip{$num}='',dip{$num}_who='0',dip{$num}_when='' where nation='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
}
pushGenLog($me, $mylog);
pushGenLog($you, $youlog);
pushAllLog($alllog);
pushHistory($history);
echo "<script>location.replace('msglist.php');</script>";
-138
View File
@@ -1,138 +0,0 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
//로그인 검사
CheckLogin(1);
$connect = dbConn();
$query = "select year,month from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result);
$query = "select no,name,nation,level,picture,imgsvr from general where owner='{$_SESSION['userID']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result);
$query = "select no,name,nation from general where no='$gen'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$you = MYDB_fetch_array($result);
$query = "select round(avg(power)) as power,round(avg(gennum)) as gennum from nation where level>=1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$avgnation = MYDB_fetch_array($result);
$query = "select round(std(power)) as power,round(std(gennum)) as gennum from nation where level>=1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$stdnation = MYDB_fetch_array($result);
$query = "select nation,name,gennum,power,surlimit,color from nation where nation='{$you['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$younation = MYDB_fetch_array($result);
$query = "select nation,name,gennum,power,gold,rice,surlimit,color,dip{$num} as dipmsg from nation where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$mynation = MYDB_fetch_array($result);
$query = "select city from city where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$losecitynum = MYDB_num_rows($result);
$query = "select city from city where nation='{$you['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$wincitynum = MYDB_num_rows($result);
//아국과의 관계
$query = "select state from diplomacy where me='{$me['nation']}' and you='{$you['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$dip = MYDB_fetch_array($result);
//대상국이 외교 진행중(선포중,교전중,합병수락중,통합수락중)일때
$query = "select state from diplomacy where me='{$you['nation']}' and (state='0' or state='1' or state='3' or state='5')";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$dipcount = MYDB_num_rows($result);
//대상국B이 아국C과 교전중인 국가A와 불가침중일때 불가(A=B 불가침, A=C(아국) 교전, B<-C(아국) 항복)
$query = "select you,state from diplomacy where me='{$me['nation']}' and (state='0' or state='1')";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$warcount = MYDB_num_rows($result);
// 아국과 교전중인 국가 골라냄
$valid = 1;
for($i=0; $i < $warcount; $i++) {
$acdip = MYDB_fetch_array($result);
//교전중 국가A와 대상국B 외교 확인
$query = "select state from diplomacy where me='{$acdip['you']}' and you='{$you['nation']}'";
$dipresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$abdip = MYDB_fetch_array($dipresult);
if($abdip['state'] == 7) {
$valid = 0;
}
}
if($ok == "수락") {
// 서신 보낸 후 멸망 했을때.
if($me['level'] < 5) {
$mylog[] = "<C>●</>수뇌부가 아니므로 불가능합니다. 통합 실패.";
} elseif($mynation['surlimit'] > 0) {
$mylog[] = "<C>●</>본국이 외교제한이 지나지 않았습니다. 통합 실패.";
} elseif($younation['surlimit'] > 0) {
$mylog[] = "<C>●</>상대국이 외교제한이 지나지 않았습니다. 통합 실패.";
} elseif($losecitynum == 0) {
$mylog[] = "<C>●</>방랑군이므로 불가능합니다. 통합 실패.";
} elseif($wincitynum == 0) {
$mylog[] = "<C>●</>상대가 방랑군이므로 불가능합니다. 통합 실패.";
} elseif($mynation['power']+$younation['power'] > $avgnation['power']+$stdnation['power']) {
$mylog[] = "<C>●</>양국 국력이 너무 높습니다. 통합 실패.";
} elseif($mynation['gennum']+$younation['gennum'] > $avgnation['gennum']+$stdnation['gennum']) {
$mylog[] = "<C>●</>양국 장수가 많습니다. 통합 실패.";
} elseif(!isClose($connect, $younation['nation'], $mynation['nation'])) {
$mylog[] = "<C>●</>인접한 국가가 아니므로 불가능합니다. 통합 실패.";
} elseif($dip['state'] == 0) {
$mylog[] = "<C>●</>아국과 교전중입니다. 통합 실패.";
} elseif($dipcount != 0) {
$mylog[] = "<C>●</>상대국이 외교 진행중입니다. 통합 실패.";
} elseif($valid == 0) {
$mylog[] = "<C>●</>상대국이 아국의 교전국과 불가침중입니다. 통합 실패.";
} elseif($mynation['dipmsg'] == "") {
$mylog[] = "<C>●</>이미 거절했습니다. 불가침 실패.";
} else {
$youlog[] = "<C>●</><D><b>{$mynation['name']}</b></>(이)가 통합에 동의했습니다.";
$history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<Y><b>【통합시도】</b></><D><b>{$mynation['name']}</b></>(와)과 <D><b>{$younation['name']}</b></>(이)가 통합을 시도합니다.";
$mylog[] = "<C>●</><D><b>{$younation['name']}</b></>(와)과 통합에 동의했습니다.";
$alllog[] = "<C>●</>{$admin['month']}월:<Y>{$me['name']}</>(이)가 <D><b>{$younation['name']}</b></>(와)과 <M>통합</>에 동의하였습니다.";
addHistory($you, "<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$mynation['name']}</b></>(와)과 통합 시도");
addHistory($me, "<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$younation['name']}</b></>(와)과 통합 시도");
//외교 변경
$query = "update diplomacy set state='3',term='24' where me='{$mynation['nation']}' and you='{$younation['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$query = "update diplomacy set state='4',term='24' where me='{$younation['nation']}' and you='{$mynation['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
//국메로 저장
$msg = "【외교】{$admin['year']}{$admin['month']}월:{$younation['name']}(와)과 통합에 합의";
$youmsg = "【외교】{$admin['year']}{$admin['month']}월:{$mynation['name']}(와)과 통합에 합의";
PushMsg(2, $mynation['nation'], $me['picture'], $me['imgsvr'], "{$me['name']}:{$mynation['name']}", $mynation['color'], $younation['name'], $younation['color'], $msg);
PushMsg(3, $younation['nation'], $me['picture'], $me['imgsvr'], "{$me['name']}:{$mynation['name']}", $mynation['color'], $younation['name'], $younation['color'], $youmsg);
}
//현 메세지 지움
$query = "update nation set dip{$num}='',dip{$num}_who='0',dip{$num}_when='' where nation='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} else {
$youlog[] = "<C>●</><Y>{$mynation['name']}</>(이)가 항복을 거부했습니다.";
$mylog[] = "<C>●</><D>{$younation['name']}</>(으)로 항복을 거부했습니다.";
//현 메세지 지움
$query = "update nation set dip{$num}='',dip{$num}_who='0',dip{$num}_when='' where nation='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
}
pushGenLog($me, $mylog);
pushGenLog($you, $youlog);
pushAllLog($alllog);
pushHistory($history);
echo "<script>location.replace('msglist.php');</script>";
-170
View File
@@ -1,170 +0,0 @@
<?php
namespace sammo;
//TODO: 등용장 재 디자인.
//xxx: 일단 비활성화
header('Location:msglist.php');
die();
include "lib.php";
include "func.php";
//로그인 검사
CheckLogin(1);
$connect = dbConn();
$query = "select startyear,year,month,killturn from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result);
$query = "select no,name,nation,nations,level,troop,npc,gold,rice from general where owner='{$_SESSION['userID']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result);
$query = "select no,nation from general where no='$gen'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$you = MYDB_fetch_array($result);
$query = "select name,nation,level,capital,scout from nation where nation='{$you['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$nation = MYDB_fetch_array($result);
if($ok == "수락" && $me['level'] < 12 && $nation['level'] > 0 && $nation['scout'] == 0 && $me['nation'] != $nation['nation'] && $admin['year'] >= $admin['startyear']+3 && strpos($me['nations'], ",{$nation['nation']},") === false) {
$youlog[] = "<C>●</><Y>{$me['name']}</> 등용에 성공했습니다.";
$alllog[] = "<C>●</>{$admin['month']}월:<Y>{$me['name']}</>(이)가 <D><b>{$nation['name']}</b></>(으)로 <S>망명</>하였습니다.";
$mylog[] = "<C>●</><D>{$nation['name']}</>(으)로 망명하여 수도로 이동합니다.";
addHistory($you, "<C>●</>{$admin['year']}{$admin['month']}월:<Y>{$me['name']}</> 등용에 성공");
addHistory($me, "<C>●</>{$admin['year']}{$admin['month']}월:<D>{$nation['name']}</>(으)로 망명");
// 임관내역 추가
$me['nations'] .= "{$nation['nation']},";
// 국가 변경, 도시 변경, 일반으로, 수도로
$query = "update general set killturn='{$admin['killturn']}',belong=1,nation='{$you['nation']}',nations='{$me['nations']}',level=1,city='{$nation['capital']}' where no='{$me['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
// 재야가 아니면 명성N*10% 공헌N*10%감소
if($me['level'] > 0) {
// 1000 1000 남기고 환수
if($me['gold'] > 1000) { $gold = $me['gold'] - 1000; $me['gold'] = 1000; } else { $gold = 0; }
if($me['rice'] > 1000) { $rice = $me['rice'] - 1000; $me['rice'] = 1000; } else { $rice = 0; }
$query = "update general set gold='{$me['gold']}',rice='{$me['rice']}',betray=betray+1,dedication=dedication*(1-0.1*betray),experience=experience*(1-0.1*betray) where no='{$me['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$query = "update nation set gold=gold+'$gold',rice=rice+'$rice' where nation='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} else {
//재야이면 100 100 증가
$query = "update general set dedication=dedication+100,experience=experience+100 where no='{$me['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
}
//유저이면 삭턴 리셋
if($me['npc'] < 2) {
$query = "update general set killturn='{$admin['killturn']}' where no='{$me['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
}
//태수 군사 시중 해제
switch($me['level']) {
case 4:
$query = "update city set gen1=0 where gen1='{$me['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
break;
case 3:
$query = "update city set gen2=0 where gen2='{$me['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
break;
case 2:
$query = "update city set gen3=0 where gen3='{$me['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
break;
}
//등용자 명성, 공헌 상승
$query = "update general set dedication=dedication+100,experience=experience+100 where no='{$you['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
// 부대 처리
$query = "select no from troop where troop='{$me['troop']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$troop = MYDB_fetch_array($result);
//부대장일 경우
if($troop['no'] == $me['no']) {
// 모두 탈퇴
$query = "update general set troop='0' where troop='{$me['troop']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
// 부대 삭제
$query = "delete from troop where troop='{$me['troop']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} else {
$query = "update general set troop='0' where no='{$me['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
}
//국가 기술력 그대로
$query = "select no from general where nation='{$nation['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$gencount = MYDB_num_rows($result);
$gennum = $gencount;
if($gencount < 10) $gencount = 10;
$query = "update nation set totaltech=tech*'$gencount',gennum='$gennum' where nation='{$nation['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
//기존 국가 기술력 그대로
$query = "select no from general where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$gencount = MYDB_num_rows($result);
$gennum = $gencount;
if($gencount < 10) $gencount = 10;
$query = "update nation set totaltech=tech*'$gencount',gennum='$gennum' where nation='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
//현 메세지 수정
$query = "update general set msg{$num}='{$nation['name']}(으)로 등용 제의 수락',msg{$num}_type='10' where no='{$me['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} elseif($me['level'] == 12) {
$mylog[] = "<C>●</>군주입니다. 등용 수락 불가.";
//현 메세지 지움
$query = "update general set msg{$num}='{$nation['name']}(으)로 등용 제의 수락 불가',msg{$num}_type='10' where no='{$me['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} elseif($nation['level'] == 0) {
$mylog[] = "<C>●</>없는 국가이거나 방랑군입니다. 등용 수락 불가.";
//현 메세지 지움
$query = "update general set msg{$num}='{$nation['name']}(으)로 등용 제의 수락 불가',msg{$num}_type='10' where no='{$me['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} elseif($nation['scout'] != 0) {
$mylog[] = "<C>●</>임관 금지중입니다. 등용 수락 불가.";
//현 메세지 지움
$query = "update general set msg{$num}='{$nation['name']}(으)로 등용 제의 수락 불가',msg{$num}_type='10' where no='{$me['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} elseif($admin['year'] < $admin['startyear']+3) {
$mylog[] = "<C>●</>초반 제한중입니다. 등용 수락 불가.";
//현 메세지 지움
$query = "update general set msg{$num}='{$nation['name']}(으)로 등용 제의 수락 불가',msg{$num}_type='10' where no='{$me['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} elseif(strpos($me['nations'], ",{$nation['nation']},") > 0) {
$mylog[] = "<C>●</>이미 임관했었던 국가입니다. 등용 수락 불가.";
//현 메세지 지움
$query = "update general set msg{$num}='{$nation['name']}(으)로 등용 제의 수락 불가',msg{$num}_type='10' where no='{$me['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} else {
$youlog[] = "<C>●</><Y>{$me['name']}</>(이)가 등용을 거부했습니다.";
$mylog[] = "<C>●</><D>{$nation['name']}</>(으)로 망명을 거부했습니다.";
//현 메세지 지움
$query = "update general set msg{$num}='{$nation['name']}(으)로 등용 제의 거부',msg{$num}_type='10' where no='{$me['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
}
pushGenLog($me, $mylog);
pushGenLog($you, $youlog);
pushAllLog($alllog);
pushHistory($history);
echo "<script>location.replace('msglist.php');</script>";
+5
View File
@@ -21,11 +21,16 @@ class DB{
* DB 객체 생성 * DB 객체 생성
* *
* @return \MeekroDB * @return \MeekroDB
* @suppress PhanTypeMismatchProperty
*/ */
public static function db(){ public static function db(){
if(self::$uDB === null){ if(self::$uDB === null){
self::$uDB = new \MeekroDB(self::$host,self::$user,self::$password,self::$dbName,self::$port,self::$encoding); self::$uDB = new \MeekroDB(self::$host,self::$user,self::$password,self::$dbName,self::$port,self::$encoding);
self::$uDB->connect_options[MYSQLI_OPT_INT_AND_FLOAT_NATIVE] = true; self::$uDB->connect_options[MYSQLI_OPT_INT_AND_FLOAT_NATIVE] = true;
self::$uDB->error_handler= function(){};
self::$uDB->throw_exception_on_error = true;
self::$uDB->throw_exception_on_nonsql_error = true;
} }
return self::$uDB; return self::$uDB;
} }
+9
View File
@@ -0,0 +1,9 @@
<?php
namespace sammo;
class VersionGit{
public static $version = '_tK_verionGit_';
private function __construct(){}
}
//{"version":"_tK_verionGit_"}
-10
View File
@@ -1,10 +0,0 @@
<?php
namespace sammo;
if(!defined('ROOT')){
define('ROOT', '../..');
}
require_once(ROOT.'/f_config/config.php');
CustomHeader();
-128
View File
@@ -1,128 +0,0 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
//로그인 검사
CheckLogin(1);
$connect = dbConn();
$query = "select year,month from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result);
$query = "select no,name,nation,level,picture,imgsvr from general where owner='{$_SESSION['userID']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result);
$query = "select no,nation from general where no='$gen'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$you = MYDB_fetch_array($result);
$query = "select nation,name,power,gold,rice,surlimit,color from nation where nation='{$you['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$younation = MYDB_fetch_array($result);
$query = "select nation,name,power,surlimit,color,dip{$num} as dipmsg from nation where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$mynation = MYDB_fetch_array($result);
$query = "select city from city where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$losecitynum = MYDB_num_rows($result);
$query = "select city from city where nation='{$you['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$wincitynum = MYDB_num_rows($result);
//아국과의 관계
$query = "select state from diplomacy where me='{$me['nation']}' and you='{$you['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$dip = MYDB_fetch_array($result);
//대상국이 외교 진행중(선포중,교전중,합병수락중,통합수락중)일때
$query = "select state from diplomacy where me='{$you['nation']}' and (state='0' or state='1' or state='3' or state='5')";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$dipcount = MYDB_num_rows($result);
//대상국B이 아국C과 교전중인 국가A와 불가침중일때 불가(A=B 불가침, A=C(아국) 교전, B<-C(아국) 항복)
$query = "select you,state from diplomacy where me='{$me['nation']}' and (state='0' or state='1')";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$warcount = MYDB_num_rows($result);
// 아국과 교전중인 국가 골라냄
$valid = 1;
for($i=0; $i < $warcount; $i++) {
$acdip = MYDB_fetch_array($result);
//교전중 국가A와 대상국B 외교 확인
$query = "select state from diplomacy where me='{$acdip['you']}' and you='{$you['nation']}'";
$dipresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$abdip = MYDB_fetch_array($dipresult);
if($abdip['state'] == 7) {
$valid = 0;
}
}
if($ok == "수락") {
// 서신 보낸 후 멸망 했을때.
if($me['level'] < 5) {
$mylog[] = "<C>●</>수뇌부가 아니므로 불가능합니다. 투항 실패.";
} elseif($mynation['surlimit'] > 0) {
$mylog[] = "<C>●</>본국이 외교제한이 지나지 않았습니다. 투항 실패.";
} elseif($younation['surlimit'] > 0) {
$mylog[] = "<C>●</>상대국이 외교제한이 지나지 않았습니다. 투항 실패.";
// } elseif($losecitynum == 0) {
// $mylog[] = "<C>●</>방랑군이므로 불가능합니다. 투항 실패.";
} elseif($wincitynum == 0) {
$mylog[] = "<C>●</>상대가 방랑군이므로 불가능합니다. 투항 실패.";
} elseif($younation['power'] / $mynation['power'] <= 3) {
$mylog[] = "<C>●</>아국과 상대국의 국력차이가 크지 않습니다. 투항 실패.";
} elseif($losecitynum != 0 && !isClose($connect, $younation['nation'], $mynation['nation'])) {
$mylog[] = "<C>●</>인접한 국가가 아니므로 불가능합니다. 투항 실패.";
} elseif($dip['state'] == 0) {
$mylog[] = "<C>●</>아국과 교전중입니다. 투항 실패.";
} elseif($dipcount != 0) {
$mylog[] = "<C>●</>상대국이 외교 진행중입니다. 투항 실패.";
} elseif($valid == 0) {
$mylog[] = "<C>●</>상대국이 아국의 교전국과 불가침중입니다. 투항 실패.";
} elseif($mynation['dipmsg'] == "") {
$mylog[] = "<C>●</>이미 거절했습니다. 불가침 실패.";
} else {
$youlog[] = "<C>●</><D><b>{$mynation['name']}</b></>(이)가 합병에 동의했습니다.";
$history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<Y><b>【합병시도】</b></><D><b>{$mynation['name']}</b></>(와)과 <D><b>{$younation['name']}</b></>(이)가 합병을 시도합니다.";
$mylog[] = "<C>●</><D><b>{$younation['name']}</b></>(와)과 합병에 동의했습니다.";
$alllog[] = "<C>●</>{$admin['month']}월:<Y>{$me['name']}</>(이)가 <D><b>{$younation['name']}</b></>(와)과 <M>합병</>에 동의하였습니다.";
addHistory($you, "<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$mynation['name']}</b></>(와)과 합병 시도");
addHistory($me, "<C>●</>{$admin['year']}{$admin['month']}월:<D><b>{$younation['name']}</b></>(와)과 합병 시도");
//외교 변경
$query = "update diplomacy set state='5',term='24' where me='{$mynation['nation']}' and you='{$younation['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$query = "update diplomacy set state='6',term='24' where me='{$younation['nation']}' and you='{$mynation['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
//국메로 저장
$msg = "【외교】{$admin['year']}{$admin['month']}월:{$younation['name']}(와)과 합병에 동의";
$youmsg = "【외교】{$admin['year']}{$admin['month']}월:{$mynation['name']}(와)과 합병에 동의";
PushMsg(2, $mynation['nation'], $me['picture'], $me['imgsvr'], "{$me['name']}:{$mynation['name']}", $mynation['color'], $younation['name'], $younation['color'], $msg);
PushMsg(3, $younation['nation'], $me['picture'], $me['imgsvr'], "{$me['name']}:{$mynation['name']}", $mynation['color'], $younation['name'], $younation['color'], $youmsg);
}
//현 메세지 지움
$query = "update nation set dip{$num}='',dip{$num}_who='0',dip{$num}_when='' where nation='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} else {
$youlog[] = "<C>●</><Y>{$mynation['name']}</>(이)가 항복을 거부했습니다.";
$mylog[] = "<C>●</><D>{$younation['name']}</>(으)로 항복을 거부했습니다.";
//현 메세지 지움
$query = "update nation set dip{$num}='',dip{$num}_who='0',dip{$num}_when='' where nation='{$me['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
}
pushGenLog($me, $mylog);
pushGenLog($you, $youlog);
pushAllLog($alllog);
pushHistory($history);
echo "<script>location.replace('msglist.php');</script>";
-32
View File
@@ -1,32 +0,0 @@
<?php
namespace sammo;
file_put_contents("logs/_db_bug.txt", $message."\n", FILE_APPEND);
?>
<!DOCTYPE html>
<html>
<head>
<meta HTTP-EQUIV='Content-Type' CONTENT='text/html; charset=utf-8'>
<title>에러</title>
<link rel=stylesheet href=css/common.css type=text/css>
</head>
<body>
<br><br><br><br><br>
<table align=center width=1000 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg0>
<tr><td align=center style=background-color:225500;><font color=orange size=5>서 버 에 러</font></td></tr>
<tr>
<td>
<font color=white size=3>두가지 중 한가지 이유일 수 있습니다.<br><br>
1. 현재 서버가 처리중입니다. 몇초 후 아래 버튼을 눌러주세요.<br><br>
2. 오랫동안 이 메세지가 뜰 경우는 서버에 에러가 발생하여 잠시 중단된 상태입니다.<br>
&nbsp;&nbsp;&nbsp;운영자가 처리할 때까지 기다려주세요.</font>
</td>
</tr>
<tr><td align=center><font color=white size=3>잠시 후 아래의 버튼을 눌러주세요.</font></td></tr>
<tr><td align=center><input type=button value='몇초간 지난 후 눌러주세요' onclick=location.replace('index.php')></td></tr>
<tr><td align=center><?=$message;?></td></tr>
</table>
</body>
</html>
+463 -691
View File
@@ -1,11 +1,10 @@
<?php <?php
namespace sammo; namespace sammo;
require(__dir__.'/../vendor/autoload.php');
require_once 'process_war.php'; require_once 'process_war.php';
require_once 'func_gamerule.php'; require_once 'func_gamerule.php';
require_once 'func_process.php'; require_once 'func_process.php';
require_once 'func_process_trick.php'; require_once 'func_process_sabotage.php';
require_once 'func_process_chief.php'; require_once 'func_process_chief.php';
require_once 'func_process_personnel.php'; require_once 'func_process_personnel.php';
require_once 'func_npc.php'; require_once 'func_npc.php';
@@ -19,101 +18,12 @@ require_once 'func_time_event.php';
require_once('func_template.php'); require_once('func_template.php');
require_once('func_message.php'); require_once('func_message.php');
require_once('func_map.php'); require_once('func_map.php');
require_once('func_diplomacy.php');
require_once('func_command.php'); require_once('func_command.php');
/**
* 로그인한 유저의 장수 id를 받아옴
*
* @return int|null
*/
function getGeneralID($forceExit=false, $countLogin=true){
$userID = Session::getUserID();
if(!$userID){ //유저id 없으면 어차피 의미 없음.
return null;
}
$idKey = DB::prefix().'p_no';
$generalID = Util::array_get($_SESSION[$idKey], null);
if($generalID){
return $generalID;
}
$db = DB::db();
//흠?
$generalID = $db->queryFirstField('select no from general where owner = %i', $userID);
if(!$generalID && $forceExit){
header('Location:..');
die();
}
if($generalID && $countLogin){
//로그인으로 처리
//XXX: 'get' 함수인데 update가 들어가있다.
//TODO: 조금더 적절한 형태의 로그인 카운트를 생각해볼 것
$query=$db->query("update general set logcnt=logcnt+1 ,ip = %s_ip,lastconnect=%s_lastConnect,conmsg=%s_conmsg where owner= %s_userID",[
'ip' => getenv("REMOTE_ADDR"),
'lastConnect' => date('Y-m-d H:i:s'),
'conmsg' => Util::array_get($_SESSION['conmsg'], ''),
'userID' => $userID
]);
$_SESSION[$idKey] = $generalID;
}
return $generalID;
}
/**
* 로그인한 유저의 장수명을 받아옴
*
* @return string|null
*/
function getGeneralName($forceExit=false)
{
$generalID = getGeneralID();
if(!$generalID){
if($forceExit){
header('Location:..');
die();
}
return null;
}
$nameKey = DB::prefix().'p_name';
$generalName = Util::array_get($_SESSION[$nameKey], null);
if($generalName){
return $generalName;
}
//흠?
$generalName = DB::db()->queryFirstField('select name from general where no = %i', $generalID);
if(!$generalName){
//이게 말이 돼?
resetSessionGeneralValues();
if($forceExit){
header('Location:..');
die();
}
}
if($generalName){
$_SESSION[$nameKey] = $generalName;
}
return $generalName;
}
/** /**
* nationID를 이용하여 국가의 '어지간해선' 변경되지 않는 정보(이름, 색, 성향, 규모, 수도)를 반환해줌 * nationID를 이용하여 국가의 '어지간해선' 변경되지 않는 정보(이름, 색, 성향, 규모, 수도)를 반환해줌
* *
* @param int|null $nationID 국가 코드, -1인 경우 전체, null인 경우 수행하지 않음 * @param int|null $nationID 국가 코드, -1인 경우 전체, null인 경우 수행하지 않음. 0인 경우에는 재야임
* @param bool $forceRefresh 강제 갱신 여부 * @param bool $forceRefresh 강제 갱신 여부
* *
* @return array|null nationID에 해당하는 국가가 있을 경우 array 반환. 그외의 경우 null * @return array|null nationID에 해당하는 국가가 있을 경우 array 반환. 그외의 경우 null
@@ -121,13 +31,24 @@ function getGeneralName($forceExit=false)
function getNationStaticInfo($nationID, $forceRefresh=false) function getNationStaticInfo($nationID, $forceRefresh=false)
{ {
static $nationList = null; static $nationList = null;
static $freeNation = [
'nation'=>0,
'name'=>'재야',
'color'=>'#000000',
'type'=>0,
'level'=>0,
'capital'=>0
];
if ($forceRefresh) { if ($forceRefresh) {
$nationList = null; $nationList = null;
} }
if($nationID === null || $nationID == 0){ if ($nationID === null) {
return null; return null;
}
if($nationID === 0){
return $freeNation;
} }
if($nationList === null){ if($nationList === null){
@@ -156,39 +77,33 @@ function getAllNationStaticInfo(){
return getNationStaticInfo(-1); return getNationStaticInfo(-1);
} }
function GetImageURL($imgsvr) { function GetImageURL($imgsvr, $filepath='') {
global $image, $image1;
if($imgsvr == 0) { if($imgsvr == 0) {
return $image; return ServConfig::getSharedIconPath($filepath);
} else { } else {
return $image1; return AppConf::getUserIconPathWeb($filepath);
} }
} }
/** /**
* generalID를 이용해 각 서버 등록 여부를 확인함 * @param null|int $con 장수의 벌점
* * @param null|int $conlimit 최대 벌점
* FIXME: 현재의 구현으로는 session에 p_no가 남아있지만 general 테이블에서는 삭제되어있는 진풍경(!)이 펼쳐질 수도 있음.
* 장수가 사망했을 때에 바로 테이블에서 삭제하는 것이 아니라 삭제 플래그를 설정하는 것이 나을 것임.
* (퀘 섭등 NPC가 빙의할 경우에도 마찬가지!)
*
* 세팅된 플래그는 새롭게 장수를 생성하거나, 새로 빙의할 때 초기화하는 것이 적절한 해결책일 것.
*
* @return bool
*/ */
function isSigned(){ function checkLimit($con = null, $conlimit = null) {
$generalID = getGeneralID(); $session = Session::getInstance();
if(!$generalID){ if($session->userGrade>=4){
return false;
}
return true;
}
function checkLimit($con, $conlimit) {
if(Session::getUserGrade()>=4){
return 0; return 0;
} }
$db = DB::db();
if($con === null){
$con = $db->queryFirstField('SELECT con FROM general WHERE `owner`=%i', Session::getUserID());
}
if($conlimit === null){
$conlimit = $db->queryFirstField('SELECT conlimit FROM game LIMIT 1');
}
if($con > $conlimit) { if($con > $conlimit) {
return 2; return 2;
//접속제한 90%이면 경고문구 //접속제한 90%이면 경고문구
@@ -200,7 +115,7 @@ function checkLimit($con, $conlimit) {
} }
function getBlockLevel() { function getBlockLevel() {
return DB::db()->queryFirstField('select block from general where no = %i', getGeneralID()); return DB::db()->queryFirstField('select block from general where no = %i', Session::getInstance()->generalID);
} }
function getRandGenName() { function getRandGenName() {
@@ -224,15 +139,17 @@ function getRandGenName() {
function cityInfo($connect) { function cityInfo() {
global $_basecolor, $_basecolor2, $images; $db = DB::db();
$connect=$db->get();
$userID = Session::getUserID();
$query = "select no,city from general where owner='{$_SESSION['userID']}'"; $query = "select no,city from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
// 도시 정보 // 도시 정보
$city = getCity($connect, $me['city']); $city = getCity($me['city']);
$nation = getNationStaticInfo($city['nation']); $nation = getNationStaticInfo($city['nation']);
@@ -251,10 +168,14 @@ function cityInfo($connect) {
$tradeStr = $city['trade'] . "%"; $tradeStr = $city['trade'] . "%";
} }
if($nation['color'] == "" ) { $nation['color'] = "000000"; } if(!$nation){
$nation = getNationStaticInfo(0);
}
if($nation['color'] == "" ) { $nation['color'] = "#000000"; }
echo "<table width=640 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg2> echo "<table width=640 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg2>
<tr><td colspan=8 align=center style=height:20;color:".newColor($nation['color']).";background-color:{$nation['color']};font-weight:bold;font-size:13px;>【 ".CityConst::$regionMap[$city['region']]." | ".CityConst::$levelMap[$city['level']]."{$city['name']}</td></tr> <tr><td colspan=8 align=center style=height:20px;color:".newColor($nation['color']).";background-color:{$nation['color']};font-weight:bold;font-size:13px;>【 ".CityConst::$regionMap[$city['region']]." | ".CityConst::$levelMap[$city['level']]."{$city['name']}</td></tr>
<tr><td colspan=8 align=center style=height:20;color:".newColor($nation['color']).";background-color:{$nation['color']}><b>"; <tr><td colspan=8 align=center style=height:20px;color:".newColor($nation['color']).";background-color:{$nation['color']}><b>";
if($city['nation'] == 0) { if($city['nation'] == 0) {
echo "공 백 지"; echo "공 백 지";
@@ -267,7 +188,7 @@ function cityInfo($connect) {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$gen1 = MYDB_fetch_array($result); $gen1 = MYDB_fetch_array($result);
} else { } else {
$gen1['name'] = '-'; $gen1 = ['name'=>'-'];
} }
if($city['gen2'] > 0) { if($city['gen2'] > 0) {
@@ -275,7 +196,7 @@ function cityInfo($connect) {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$gen2 = MYDB_fetch_array($result); $gen2 = MYDB_fetch_array($result);
} else { } else {
$gen2['name'] = '-'; $gen2 = ['name'=>'-'];
} }
if($city['gen3'] > 0) { if($city['gen3'] > 0) {
@@ -283,7 +204,7 @@ function cityInfo($connect) {
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$gen3 = MYDB_fetch_array($result); $gen3 = MYDB_fetch_array($result);
} else { } else {
$gen3['name'] = '-'; $gen3 = ['name'=>'-'];
} }
echo " echo "
@@ -335,18 +256,20 @@ function cityInfo($connect) {
"; ";
} }
function myNationInfo($connect) { function myNationInfo() {
global $_basecolor, $_basecolor2, $images; $db = DB::db();
$connect=$db->get();
$userID = Session::getUserID();
$query = "select startyear,year from game limit 1"; $query = "select startyear,year from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$query = "select no,nation from general where owner='{$_SESSION['userID']}'"; $query = "select no,nation from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
$query = "select nation,name,color,power,msg,gold,rice,bill,rate,scout,war,tricklimit,surlimit,tech,totaltech,level,type from nation where nation='{$me['nation']}'"; $query = "select nation,name,color,power,msg,gold,rice,bill,rate,scout,war,sabotagelimit,surlimit,tech,totaltech,level,type from nation where nation='{$me['nation']}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$nation = MYDB_fetch_array($result); $nation = MYDB_fetch_array($result);
@@ -383,9 +306,9 @@ function myNationInfo($connect) {
</tr> </tr>
<tr> <tr>
<td width=68 align=center id=bg1><b>".getLevel(12, $nation['level'])."</b></td> <td width=68 align=center id=bg1><b>".getLevel(12, $nation['level'])."</b></td>
<td width=178 align=center>";echo $level12==''?"-":"{$level12['name']}"; echo "</td> <td width=178 align=center>";echo $level12?$level12['name']:"-"; echo "</td>
<td width=68 align=center id=bg1><b>".getLevel(11, $nation['level'])."</b></td> <td width=68 align=center id=bg1><b>".getLevel(11, $nation['level'])."</b></td>
<td width=178 align=center>";echo $level11==''?"-":"{$level11['name']}"; echo "</td> <td width=178 align=center>";echo $level11?$level11['name']:"-"; echo "</td>
</tr> </tr>
<tr> <tr>
<td align=center id=bg1><b>총주민</b></td> <td align=center id=bg1><b>총주민</b></td>
@@ -426,14 +349,14 @@ function myNationInfo($connect) {
$nation['tech'] = "$techCall / {$nation['tech']}"; $nation['tech'] = "$techCall / {$nation['tech']}";
if($me['nation']==0){ if($me['nation']==0){
$nation['tricklimit'] = "<font color=white>해당 없음</font>"; $nation['sabotagelimit'] = "<font color=white>해당 없음</font>";
$nation['surlimit'] = "<font color=white>해당 없음</font>"; $nation['surlimit'] = "<font color=white>해당 없음</font>";
$nation['scout'] = "<font color=white>해당 없음</font>"; $nation['scout'] = "<font color=white>해당 없음</font>";
$nation['war'] = "<font color=white>해당 없음</font>"; $nation['war'] = "<font color=white>해당 없음</font>";
$nation['power'] = "<font color=white>해당 없음</font>"; $nation['power'] = "<font color=white>해당 없음</font>";
} else { } else {
if($nation['tricklimit'] != 0) { $nation['tricklimit'] = "<font color=red>{$nation['tricklimit']}턴</font>"; } if($nation['sabotagelimit'] != 0) { $nation['sabotagelimit'] = "<font color=red>{$nation['sabotagelimit']}턴</font>"; }
else { $nation['tricklimit'] = "<font color=limegreen>가 능</font>"; } else { $nation['sabotagelimit'] = "<font color=limegreen>가 능</font>"; }
if($nation['surlimit'] != 0) { $nation['surlimit'] = "<font color=red>{$nation['surlimit']}턴</font>"; } if($nation['surlimit'] != 0) { $nation['surlimit'] = "<font color=red>{$nation['surlimit']}턴</font>"; }
else { $nation['surlimit'] = "<font color=limegreen>가 능</font>"; } else { $nation['surlimit'] = "<font color=limegreen>가 능</font>"; }
@@ -464,7 +387,7 @@ function myNationInfo($connect) {
</tr> </tr>
<tr> <tr>
<td align=center id=bg1><b>전 략</b></td> <td align=center id=bg1><b>전 략</b></td>
<td align=center>{$nation['tricklimit']}</td> <td align=center>{$nation['sabotagelimit']}</td>
<td align=center id=bg1><b>외 교</b></td> <td align=center id=bg1><b>외 교</b></td>
<td align=center>{$nation['surlimit']}</td> <td align=center>{$nation['surlimit']}</td>
</tr> </tr>
@@ -510,17 +433,21 @@ function commandGroup($typename, $type=0) {
} }
} }
function commandTable($connect) { function commandTable() {
$db = DB::db();
$connect=$db->get();
$userID = Session::getUserID();
$query = "select startyear,year,develcost,scenario from game limit 1"; $query = "select startyear,year,develcost,scenario from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$query = "select no,npc,troop,city,nation,level,crew,makelimit,special from general where owner='{$_SESSION['userID']}'"; $query = "select no,npc,troop,city,nation,level,crew,makelimit,special from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
$troop = getTroop($connect, $me['troop']); $troop = getTroop($me['troop']);
$city = getCity($connect, $me['city']); $city = getCity($me['city']);
$nationcount = count(getAllNationStaticInfo()); $nationcount = count(getAllNationStaticInfo());
@@ -559,14 +486,14 @@ function commandTable($connect) {
if($nation['type'] == 2 || $nation['type'] == 4 || $nation['type'] == 7 || $nation['type'] == 10) { $develcostE *= 0.8; $colorE = 1; } if($nation['type'] == 2 || $nation['type'] == 4 || $nation['type'] == 7 || $nation['type'] == 10) { $develcostE *= 0.8; $colorE = 1; }
if($nation['type'] == 1 || $nation['type'] == 3 || $nation['type'] == 9) { $develcostE *= 1.2; $colorE = 2; } if($nation['type'] == 1 || $nation['type'] == 3 || $nation['type'] == 9) { $develcostE *= 1.2; $colorE = 2; }
$develcostA = round($develcostA); $develcostA = Util::round($develcostA);
$develcostB = round($develcostB); $develcostB = Util::round($develcostB);
$develcostC = round($develcostC); $develcostC = Util::round($develcostC);
$develcostD = round($develcostD); $develcostD = Util::round($develcostD);
$develcostE = round($develcostE); $develcostE = Util::round($develcostE);
echo " echo "
<select name=commandtype size=1 style=width:260px;color:white;background-color:black;font-size:12;>"; <select name=commandtype size=1 style=width:260px;color:white;background-color:black;font-size:12px;>";
addCommand("휴 식", 0); addCommand("휴 식", 0);
addCommand("요 양", 50); addCommand("요 양", 50);
commandGroup("========= 내 정 =========="); commandGroup("========= 내 정 ==========");
@@ -660,13 +587,11 @@ function commandTable($connect) {
addCommand("탈취(무력경험, 자금$develcost5, 군량$develcost5)", 33); addCommand("탈취(무력경험, 자금$develcost5, 군량$develcost5)", 33);
addCommand("파괴(무력경험, 자금$develcost5, 군량$develcost5)", 34); addCommand("파괴(무력경험, 자금$develcost5, 군량$develcost5)", 34);
addCommand("선동(통솔경험, 자금$develcost5, 군량$develcost5)", 35); addCommand("선동(통솔경험, 자금$develcost5, 군량$develcost5)", 35);
// addCommand("기습(통, 무, 지, 자금$develcost10, 군량$develcost10)", 36);
} else { } else {
addCommand("화계(지력경험, 자금$develcost5, 군량$develcost5)", 32, 0); addCommand("화계(지력경험, 자금$develcost5, 군량$develcost5)", 32, 0);
addCommand("탈취(무력경험, 자금$develcost5, 군량$develcost5)", 33, 0); addCommand("탈취(무력경험, 자금$develcost5, 군량$develcost5)", 33, 0);
addCommand("파괴(무력경험, 자금$develcost5, 군량$develcost5)", 34, 0); addCommand("파괴(무력경험, 자금$develcost5, 군량$develcost5)", 34, 0);
addCommand("선동(통솔경험, 자금$develcost5, 군량$develcost5)", 35, 0); addCommand("선동(통솔경험, 자금$develcost5, 군량$develcost5)", 35, 0);
// addCommand("기습(통, 무, 지, 자금500, 군량500)", 36, 0);
} }
commandGroup("", 1); commandGroup("", 1);
commandGroup("========= 개 인 =========="); commandGroup("========= 개 인 ==========");
@@ -744,12 +669,16 @@ function commandTable($connect) {
"; ";
} }
function CoreCommandTable($connect) { function CoreCommandTable() {
$db = DB::db();
$connect=$db->get();
$userID = Session::getUserID();
$query = "select develcost from game limit 1"; $query = "select develcost from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
$query = "select no,nation,city,level from general where owner='{$_SESSION['userID']}'"; $query = "select no,nation,city,level from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
@@ -779,11 +708,7 @@ function CoreCommandTable($connect) {
addCommand("몰수", 24, $valid); addCommand("몰수", 24, $valid);
commandGroup("", 1); commandGroup("", 1);
commandGroup("====== 외 교 ======"); commandGroup("====== 외 교 ======");
if($citycount <= 4) { addCommand("통합 제의", 53, $valid);
addCommand("통합 제의", 53, $valid);
} else {
addCommand("통합 제의", 53, 0);
}
addCommand("항복 권고", 51, $valid); addCommand("항복 권고", 51, $valid);
if($nation['level'] >= 2) { if($nation['level'] >= 2) {
@@ -797,33 +722,29 @@ function CoreCommandTable($connect) {
addCommand("파기 제의", 64, $valid); addCommand("파기 제의", 64, $valid);
commandGroup("", 1); commandGroup("", 1);
commandGroup("====== 특 수 ======"); commandGroup("====== 특 수 ======");
if($citycount >= 5) { addCommand("초토화", 65, $valid);
addCommand("초토화", 65, $valid);
} else {
addCommand("초토화", 65, 0);
}
addCommand("천도/3턴(금쌀{$admin['develcost']}0)", 66, $valid); addCommand("천도/3턴(금쌀{$admin['develcost']}0)", 66, $valid);
$cost = $admin['develcost'] * 500 + 60000; // 7만~13만 $cost = $admin['develcost'] * 500 + 60000; // 7만~13만
addCommand("증축/6턴(금쌀{$cost})", 67, $valid); addCommand("증축/6턴(금쌀{$cost})", 67, $valid);
addCommand("감축/6턴", 68, $valid); addCommand("감축/6턴", 68, $valid);
commandGroup("", 1); commandGroup("", 1);
commandGroup("====== 전 략 ======"); commandGroup("====== 전 략 ======");
$term = round(sqrt($genCount*8)*10); $term = Util::round(sqrt($genCount*8)*10);
addCommand("필사즉생/3턴(전략{$term})", 71, $valid); addCommand("필사즉생/3턴(전략{$term})", 71, $valid);
$term = round(sqrt($genCount*4)*10); $term = Util::round(sqrt($genCount*4)*10);
addCommand("백성동원/1턴(전략{$term})", 72, $valid); addCommand("백성동원/1턴(전략{$term})", 72, $valid);
$term = round(sqrt($genCount*4)*10); $term = Util::round(sqrt($genCount*4)*10);
addCommand("수몰/3턴(전략{$term})", 73, $valid); addCommand("수몰/3턴(전략{$term})", 73, $valid);
$term = round(sqrt($genCount*4)*10); $term = Util::round(sqrt($genCount*4)*10);
addCommand("허보/2턴(전략{$term})", 74, $valid); addCommand("허보/2턴(전략{$term})", 74, $valid);
$term = round(sqrt($genCount*2)*10); $term = Util::round(sqrt($genCount*2)*10);
if($term < 72) { $term = 72; } if($term < 72) { $term = 72; }
addCommand("피장파장/3턴(전략{$term})", 75, $valid); addCommand("피장파장/3턴(전략{$term})", 75, $valid);
$term = round(sqrt($genCount*10)*10); $term = Util::round(sqrt($genCount*10)*10);
addCommand("의병모집/3턴(전략{$term})", 76, $valid); addCommand("의병모집/3턴(전략{$term})", 76, $valid);
$term = round(sqrt($genCount*16)*10); $term = Util::round(sqrt($genCount*16)*10);
addCommand("이호경식/1턴(전략{$term})", 77, $valid); addCommand("이호경식/1턴(전략{$term})", 77, $valid);
$term = round(sqrt($genCount*16)*10); $term = Util::round(sqrt($genCount*16)*10);
addCommand("급습/1턴(전략{$term})", 78, $valid); addCommand("급습/1턴(전략{$term})", 78, $valid);
commandGroup("", 1); commandGroup("", 1);
commandGroup("====== 기 타 ======"); commandGroup("====== 기 타 ======");
@@ -838,18 +759,23 @@ function CoreCommandTable($connect) {
"; ";
} }
function myInfo($connect) { function myInfo() {
$query = "select no from general where owner='{$_SESSION['userID']}'"; $db = DB::db();
$connect=$db->get();
$userID = Session::getUserID();
$query = "select no from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
generalInfo($connect, $me['no']); generalInfo($me['no']);
} }
function generalInfo($connect, $no) { function generalInfo($no) {
global $_basecolor, $_basecolor2, $image, $images; $db = DB::db();
$connect=$db->get();
$query = "select img from game limit 1"; $query = "select show_img_level from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
@@ -872,7 +798,7 @@ function generalInfo($connect, $no) {
$lbonus = ""; $lbonus = "";
} }
$troop = getTroop($connect, $general['troop']); $troop = getTroop($general['troop']);
$level = getLevel($general['level'], $nation['level']); $level = getLevel($general['level'], $nation['level']);
if($general['level'] == 2) { if($general['level'] == 2) {
@@ -898,9 +824,9 @@ function generalInfo($connect, $no) {
$horsename = getHorseName($general['horse']); $horsename = getHorseName($general['horse']);
$itemname = getItemName($general['item']); $itemname = getItemName($general['item']);
if($general['injury'] > 0) { if($general['injury'] > 0) {
$leader = floor($general['leader'] * (100 - $general['injury'])/100); $leader = intdiv($general['leader'] * (100 - $general['injury']), 100);
$power = floor($general['power'] * (100 - $general['injury'])/100); $power = intdiv($general['power'] * (100 - $general['injury']), 100);
$intel = floor($general['intel'] * (100 - $general['injury'])/100); $intel = intdiv($general['intel'] * (100 - $general['injury']), 100);
} else { } else {
$leader = $general['leader']; $leader = $general['leader'];
$power = $general['power']; $power = $general['power'];
@@ -915,13 +841,13 @@ function generalInfo($connect, $no) {
$remaining = substr($general['turntime'], 14, 2) - date('i'); $remaining = substr($general['turntime'], 14, 2) - date('i');
if($remaining < 0) { $remaining = 60 + $remaining; } if($remaining < 0) { $remaining = 60 + $remaining; }
if($nation['color'] == "") { $nation['color'] = "000000"; } if($nation['color'] == "") { $nation['color'] = "#000000"; }
if($general['age'] < 60) { $general['age'] = "<font color=limegreen>{$general['age']} 세</font>"; } if($general['age'] < 60) { $general['age'] = "<font color=limegreen>{$general['age']} 세</font>"; }
elseif($general['age'] < 80) { $general['age'] = "<font color=yellow>{$general['age']} 세</font>"; } elseif($general['age'] < 80) { $general['age'] = "<font color=yellow>{$general['age']} 세</font>"; }
else { $general['age'] = "<font color=red>{$general['age']} 세</font>"; } else { $general['age'] = "<font color=red>{$general['age']} 세</font>"; }
$general['connect'] = round($general['connect'] / 10, 0) * 10; $general['connect'] = Util::round($general['connect'] / 10) * 10;
$special = $general['special'] == 0 ? "{$general['specage']}" : "<font color=limegreen>".getGenSpecial($general['special'])."</font>"; $special = $general['special'] == 0 ? "{$general['specage']}" : "<font color=limegreen>".getGenSpecial($general['special'])."</font>";
$special2 = $general['special2'] == 0 ? "{$general['specage2']}" : "<font color=limegreen>".getGenSpecial($general['special2'])."</font>"; $special2 = $general['special2'] == 0 ? "{$general['specage2']}" : "<font color=limegreen>".getGenSpecial($general['special2'])."</font>";
@@ -946,13 +872,13 @@ function generalInfo($connect, $no) {
elseif($general['mode'] == 1) { $general['mode'] = "<font color=limegreen>수비 함(훈사60)</font>"; } elseif($general['mode'] == 1) { $general['mode'] = "<font color=limegreen>수비 함(훈사60)</font>"; }
else { $general['mode'] = "<font color=red>수비 안함</font>"; } else { $general['mode'] = "<font color=red>수비 안함</font>"; }
$weapImage = "{$images}/weap{$general['crewtype']}.jpg"; $weapImage = ServConfig::$gameImagePath."/weap{$general['crewtype']}.png";
if($admin['show_img_level'] < 2) { $weapImage = "{$image}/default.jpg"; }; if($admin['show_img_level'] < 2) { $weapImage = ServConfig::$sharedIconPath."/default.jpg"; };
$imageTemp = GetImageURL($general['imgsvr']); $imageTemp = GetImageURL($general['imgsvr']);
echo "<table width=498 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg2> echo "<table width=498 border=1 cellspacing=0 cellpadding=0 bordercolordark=gray bordercolorlight=black style=font-size:13px;word-break:break-all; id=bg2>
<tr> <tr>
<td width=64 height=64 align=center rowspan=3 background={$imageTemp}/{$general['picture']}>&nbsp;</td> <td width=64 height=64 align=center rowspan=3 style='background:no-repeat center url(\"{$imageTemp}/{$general['picture']}\");background-size:64px;'>&nbsp;</td>
<td align=center colspan=9 height=16 style=color:".newColor($nation['color']).";background-color:{$nation['color']};font-weight:bold;font-size:13px;>{$specUser} {$general['name']}{$level} | {$call} | {$color}{$injury}</font> 】 ".substr($general['turntime'], 11)."</td> <td align=center colspan=9 height=16 style=color:".newColor($nation['color']).";background-color:{$nation['color']};font-weight:bold;font-size:13px;>{$general['name']}{$level} | {$call} | {$color}{$injury}</font> 】 ".substr($general['turntime'], 11)."</td>
</tr> </tr>
<tr height=16> <tr height=16>
<td align=center id=bg1><b>통솔</b></td> <td align=center id=bg1><b>통솔</b></td>
@@ -974,7 +900,7 @@ function generalInfo($connect, $no) {
<td align=center colspan=2><font size=1>$bookname</font></td> <td align=center colspan=2><font size=1>$bookname</font></td>
</tr> </tr>
<tr> <tr>
<td align=center height=64 rowspan=3 background={$weapImage}>&nbsp;</td> <td align=center height=64 rowspan=3 style='background:no-repeat center url(\"{$weapImage}\");background-size:64px;'></td>
<td align=center id=bg1><b>자금</b></td> <td align=center id=bg1><b>자금</b></td>
<td align=center colspan=2>{$general['gold']}</td> <td align=center colspan=2>{$general['gold']}</td>
<td align=center id=bg1><b>군량</b></td> <td align=center id=bg1><b>군량</b></td>
@@ -1022,16 +948,21 @@ function generalInfo($connect, $no) {
</table>"; </table>";
} }
function myInfo2($connect) { function myInfo2() {
$query = "select no from general where owner='{$_SESSION['userID']}'"; $db = DB::db();
$connect=$db->get();
$userID = Session::getUserID();
$query = "select no from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
generalInfo2($connect, $me['no']); generalInfo2($me['no']);
} }
function generalInfo2($connect, $no) { function generalInfo2($no) {
global $_basecolor, $_basecolor2, $image, $images, $_dexLimit; $db = DB::db();
$connect=$db->get();
$query = "select personal,experience,dedication,firenum,warnum,killnum,deathnum,killcrew,deathcrew,belong,killnum*100/warnum as winrate,killcrew/deathcrew*100 as killrate,dex0,dex10,dex20,dex30,dex40 from general where no='$no'"; $query = "select personal,experience,dedication,firenum,warnum,killnum,deathnum,killcrew,deathcrew,belong,killnum*100/warnum as winrate,killcrew/deathcrew*100 as killrate,dex0,dex10,dex20,dex30,dex40 from general where no='$no'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
@@ -1055,11 +986,11 @@ function generalInfo2($connect, $no) {
$dedication = getDed($general['dedication'])." ({$general['dedication']})"; break; $dedication = getDed($general['dedication'])." ({$general['dedication']})"; break;
} }
$dex0 = $general['dex0'] / $_dexLimit * 100; $dex0 = $general['dex0'] / GameConst::$dexLimit * 100;
$dex10 = $general['dex10'] / $_dexLimit * 100; $dex10 = $general['dex10'] / GameConst::$dexLimit * 100;
$dex20 = $general['dex20'] / $_dexLimit * 100; $dex20 = $general['dex20'] / GameConst::$dexLimit * 100;
$dex30 = $general['dex30'] / $_dexLimit * 100; $dex30 = $general['dex30'] / GameConst::$dexLimit * 100;
$dex40 = $general['dex40'] / $_dexLimit * 100; $dex40 = $general['dex40'] / GameConst::$dexLimit * 100;
if($dex0 > 100) { $dex0 = 100; } if($dex0 > 100) { $dex0 = 100; }
if($dex10 > 100) { $dex10 = 100; } if($dex10 > 100) { $dex10 = 100; }
@@ -1136,258 +1067,10 @@ function generalInfo2($connect, $no) {
</table>"; </table>";
} }
function pushTrickLog($log) { function adminMsg() {
$size = count($log); $db = DB::db();
if($size > 0) { $connect=$db->get();
$fp = fopen("logs/_tricklog.txt", "a");
for($i=0; $i < $size; $i++) {
fwrite($fp, $log[$i]."\n");
}
fclose($fp);
}
}
function pushProcessLog($log) {
$size = count($log);
if($size > 0) {
$date = date('Y_m_d');
$fp = fopen("logs/_{$date}_processlog.txt", "a");
for($i=0; $i < $size; $i++) {
fwrite($fp, $log[$i]."\n");
}
fclose($fp);
}
}
function delStepLog() {
$date = date('Y_m_d');
@unlink("logs/_{$date}_steplog.txt");
}
function pushStepLog($log) {
$date = date('Y_m_d');
$fp = fopen("logs/_{$date}_steplog.txt", "a");
fwrite($fp, $log."\n");
fclose($fp);
}
function pushLockLog($log) {
$size = count($log);
if($size > 0) {
$date = date('Y_m_d');
$fp = fopen("logs/_{$date}_locklog.txt", "a");
for($i=0; $i < $size; $i++) {
fwrite($fp, $log[$i]."\n");
}
fclose($fp);
}
}
function pushAdminLog($log) {
$size = count($log);
if($size > 0) {
$fp = fopen("logs/_adminlog.txt", "a");
for($i=0; $i < $size; $i++) {
fwrite($fp, $log[$i]."\n");
}
fclose($fp);
}
}
function pushAuctionLog($log) {
$size = count($log);
if($size > 0) {
$fp = fopen("logs/_auctionlog.txt", "a");
for($i=0; $i < $size; $i++) {
fwrite($fp, $log[$i]."\n");
}
fclose($fp);
}
}
function pushGenLog($general, $log) {
$size = count($log);
if($size > 0) {
$fp = fopen("logs/gen{$general['no']}.txt", "a");
for($i=0; $i < $size; $i++) {
fwrite($fp, $log[$i]."\n");
}
fclose($fp);
}
}
function pushBatRes($general, $log) {
$size = count($log);
if($size > 0) {
$fp = fopen("logs/batres{$general['no']}.txt", "a");
for($i=0; $i < $size; $i++) {
fwrite($fp, $log[$i]."\n");
}
fclose($fp);
}
}
function pushBatLog($general, $log) {
$size = count($log);
if($size > 0) {
$fp = fopen("logs/batlog{$general['no']}.txt", "a");
for($i=0; $i < $size; $i++) {
fwrite($fp, $log[$i]."\n");
}
fclose($fp);
}
}
function pushAllLog($log) {
$text = join("\n", $log)."\n";
file_put_contents(__dir__.'/logs/_alllog.txt', $text, FILE_APPEND);
}
function pushHistory($history) {
$text = join("\n", $history)."\n";
file_put_contents(__dir__.'/logs/_history.txt', $text, FILE_APPEND);
}
function getRawLog($path, $count, $line_length){
//TODO: tail과 유사한 형태로 처리할 수 있는게 나을 듯. 그 이전에 파일 로그는 좀... ㅜㅜ
if(!file_exists($path)){
return null;
}
$fp = fopen($path, 'r');
@fseek(fp, -$count * $line_length, SEEK_END);
$data = fread($fp, $count * $line_length);
fclose($fp);
}
function TrickLog($count) {
if(!file_exists("logs/_tricklog.txt")){
return '';
}
$fp = @fopen("logs/_tricklog.txt", "r");
@fseek($fp, -$count*150, SEEK_END);
$file = @fread($fp, $count*150);
@fclose($fp);
$log = explode("\n",$file);
$str = "";
for($i=0; $i < $count; $i++) { $str .= ConvertLog($log[count($log)-2-$i])."<br>"; }
echo $str;
}
function AllLog($count) {
if(!file_exists("logs/_alllog.txt")){
return '';
}
$fp = @fopen("logs/_alllog.txt", "r");
@fseek($fp, -$count*300, SEEK_END);
$file = @fread($fp, $count*300);
@fclose($fp);
$log = explode("\n",$file);
$str = "";
for($i=0; $i < $count; $i++) {
$str .= isset($log[count($log)-2-$i]) ? ConvertLog($log[count($log)-2-$i])."<br>" : "<br>";
}
echo $str;
}
function AuctionLog($count) {
if(!file_exists("logs/_auctionlog.txt")){
return '';
}
$fp = @fopen("logs/_auctionlog.txt", "r");
@fseek($fp, -$count*300, SEEK_END);
$file = @fread($fp, $count*300);
@fclose($fp);
$log = explode("\n",$file);
$str = "";
for($i=0; $i < $count; $i++) { $str .= ConvertLog($log[count($log)-2-$i])."<br>"; }
echo $str;
}
function History($count) {
if(!file_exists("logs/_history.txt")){
return '';
}
$fp = @fopen("logs/_history.txt", "r");
@fseek($fp, -300*$count, SEEK_END); //
$file = @fread($fp, $count*300);
@fclose($fp);
$log = explode("\n",$file);
$str = "";
for($i=0; $i < $count; $i++) {
$str .= isset($log[count($log)-2-$i]) ? ConvertLog($log[count($log)-2-$i])."<br>" : "<br>";
}
echo $str;
}
function MyLog($no, $count) {
if(!file_exists("logs/gen{$no}.txt")){
return '';
}
$fp = @fopen("logs/gen{$no}.txt", "r");
@fseek($fp, -$count*300, SEEK_END);
$file = @fread($fp, $count*300);
@fclose($fp);
$log = explode("\n",$file);
$str = "";
for($i=0; $i < $count; $i++) {
$str .= isset($log[count($log)-2-$i]) ? ConvertLog($log[count($log)-2-$i])."<br>" : "<br>";
}
echo $str;
}
function MyBatRes($no, $count) {
if(!file_exists("logs/batres{$no}.txt")){
return '';
}
$fp = @fopen("logs/batres{$no}.txt", "r");
@fseek($fp, -$count*300, SEEK_END);
$file = @fread($fp, $count*300);
@fclose($fp);
$log = explode("\n",$file);
$str = "";
for($i=0; $i < $count; $i++) {
$str .= isset($log[count($log)-2-$i]) ? ConvertLog($log[count($log)-2-$i])."<br>" : "<br>";
}
echo $str;
}
function MyBatLog($no, $count) {
if(!file_exists("logs/batlog{$no}.txt")){
return '';
}
$fp = @fopen("logs/batlog{$no}.txt", "r");
@fseek($fp, -$count*300, SEEK_END);
$file = @fread($fp, $count*300);
@fclose($fp);
$log = explode("\n",$file);
$str = "";
for($i=0; $i < $count; $i++) {
$str .= isset($log[count($log)-2-$i]) ? ConvertLog($log[count($log)-2-$i])."<br>" : "<br>";
}
echo $str;
}
function MyHistory($connect, $no) {
$query = "select history from general where no='$no'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$general = MYDB_fetch_array($result);
echo ConvertLog($general['history']);
}
function addHistory($me, $history) {
DB::db()->query("update general set history=concat(%s, history) where no=%i",
$history.'<br>', $me['no']);
}
function addNationHistory($nation, $history) {
//FIXME: update 쿼리만으로도 구성 가능해보임.
$nation['history'] = "{$nation['history']}{$history}<br>";
DB::db()->query("update nation set history=concat(%s, history) where nation=%i",
$history.'<br>', $nation['nation']);
}
function adminMsg($connect) {
$query = "select msg from game limit 1"; $query = "select msg from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
@@ -1400,35 +1083,41 @@ function getOnlineNum() {
return DB::db()->queryFirstField('select `online` from `game` where `no`=1'); return DB::db()->queryFirstField('select `online` from `game` where `no`=1');
} }
function onlinegen($connect) { function onlinegen() {
$db = DB::db();
$connect=$db->get();
$onlinegen = ""; $onlinegen = "";
$generalID = getGeneralID(); $generalID = Session::getInstance()->generalID;
$nationID = DB::db()->queryFirstField('select `nation` from `general` where `no` = %i', $generalID); $nationID = DB::db()->queryFirstField('select `nation` from `general` where `no` = %i', $generalID);
if($nationID !== null || Util::toInt($nationID) === 0) { if($nationID === null || Util::toInt($nationID) === 0) {
$query = "select onlinegen from game limit 1"; $query = "select onlinegen from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$game = MYDB_fetch_array($result); $game = MYDB_fetch_array($result);
$onlinegen = $game['onlinegen']; $onlinegen = $game['onlinegen'];
} else { } else {
$query = "select onlinegen from nation where nation='{$_SESSION['p_nation']}'"; $onlinegen = DB::db()->queryFirstField('select onlinegen from nation where nation=%i',$nationID);
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$nation = MYDB_fetch_array($result);
$onlinegen = $nation['onlinegen'];
} }
return $onlinegen; return $onlinegen;
} }
function onlineNation($connect) { function onlineNation() {
$db = DB::db();
$connect=$db->get();
$query = "select onlinenation from game limit 1"; $query = "select onlinenation from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$game = MYDB_fetch_array($result); $game = MYDB_fetch_array($result);
return $game['onlinenation']; return $game['onlinenation'];
} }
function nationMsg($connect) { function nationMsg() {
$query = "select no,nation from general where owner='{$_SESSION['userID']}'"; $db = DB::db();
$connect=$db->get();
$userID = Session::getUserID();
$query = "select no,nation from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
@@ -1451,13 +1140,14 @@ function PushMsg($type, $nation, $picture, $imgsvr, $from, $fromcolor, $to, $toc
else { $file = "_nation_msg{$nation}.txt"; } else { $file = "_nation_msg{$nation}.txt"; }
$fp = fopen("logs/{$file}", "a"); $fp = fopen("logs/{$file}", "a");
//로그 파일에 기록 //로그 파일에 기록
$str = "{$type}|".StringUtil::Fill($from,12," ")."|".StringUtil::Fill($to,12," ")."|".$date."|".$msg."|".$fromcolor."|".$tocolor."|".$picture."|".$imgsvr; $str = "{$type}|".StringUtil::padStringAlignRight($from,12," ")."|".StringUtil::padStringAlignRight($to,12," ")."|".$date."|".$msg."|".$fromcolor."|".$tocolor."|".$picture."|".$imgsvr;
fwrite($fp, "{$str}\n"); fwrite($fp, "{$str}\n");
fclose($fp); fclose($fp);
} }
function msgprint($connect, $msg, $name, $picture, $imgsvr, $when, $num, $type) { function msgprint($msg, $name, $picture, $imgsvr, $when, $num, $type) {
global $_basecolor2, $_basecolor4, $images; $db = DB::db();
$connect=$db->get();
$message = explode("|", $msg); $message = explode("|", $msg);
$count = (count($message) - 2)/2; $count = (count($message) - 2)/2;
@@ -1478,7 +1168,7 @@ function msgprint($connect, $msg, $name, $picture, $imgsvr, $when, $num, $type)
<td width=148 align=center id=bg1>$when</td> <td width=148 align=center id=bg1>$when</td>
</tr> </tr>
<tr> <tr>
<td width=64 height=64 valign=top><img src={$imageTemp}/{$picture} width=64 height=64 border=0></td> <td width=64 height=64 valign=top><img width='64' height='64' src={$imageTemp}/{$picture} border=0></td>
<td width=932 colspan=2>$message[1]</td> <td width=932 colspan=2>$message[1]</td>
</tr>"; </tr>";
for($i=0; $i < $count; $i++) { for($i=0; $i < $count; $i++) {
@@ -1498,7 +1188,7 @@ function msgprint($connect, $msg, $name, $picture, $imgsvr, $when, $num, $type)
<form name=reply_form{$num} method=post action=$board> <form name=reply_form{$num} method=post action=$board>
<td width=64 align=center>댓글달기</td> <td width=64 align=center>댓글달기</td>
<td width=932 colspan=2> <td width=932 colspan=2>
<input type=textarea name=reply maxlength=250 style=color:white;background-color:black;width:830;> <input type=textarea name=reply maxlength=250 style=color:white;background-color:black;width:830px;>
<input type=submit value=댓글달기> <input type=submit value=댓글달기>
<input type=hidden name=num value=$num> <input type=hidden name=num value=$num>
</td> </td>
@@ -1510,7 +1200,12 @@ function msgprint($connect, $msg, $name, $picture, $imgsvr, $when, $num, $type)
function banner() { function banner() {
return sprintf('<font size=2>%s / %s <br> %s</font>', GameConst::$version, GameConst::$banner, GameConst::$helper); return sprintf(
'<font size=2>%s %s / %s <br> %s</font>',
GameConst::$title,
VersionGit::$version,
GameConst::$banner,
GameConst::$helper);
} }
function addTurn($date, int $turnterm, int $turn=1) { function addTurn($date, int $turnterm, int $turn=1) {
@@ -1567,26 +1262,43 @@ function cutDay($date, int $turnterm) {
} }
function increaseRefresh($type="", $cnt=1) { function increaseRefresh($type="", $cnt=1) {
$generalID = Session:: //FIXME: 로그인, 비로그인 시 처리가 명확하지 않음
$session = Session::getInstance();
$generalID = $session->generalID;
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
DB::db()->query('UPDATE game set refresh=refresh+%i where `no`=1', $cnt); $db = DB::db();
$db->update('game', [
'refresh'=>$db->sqleval('refresh+%i', $cnt)
], true);
if(!Util::array_get($_SESSION['userID'], null)) { if($generalID) {
DB::db()->query('UPDATE general set `lastrefresh`=%s_date, `con`=`con`+%i_cnt, `connect`=`connect`+%i_cnt, refcnt=refcnt+%i_cnt, refresh=refresh+%i_cnt where `no`=%i_no',[ $db->update('general', [
'date'=>$date, 'lastrefresh'=>$date,
'cnt'=>$cnt, 'con'=>$db->sqleval('con + %i', $cnt),
'owner'->getGeneralID() 'connect'=>$db->sqleval('connect + %i', $cnt),
]); 'refcnt'=>$db->sqleval('refcnt + %i', $cnt),
'refresh'=>$db->sqleval('refresh + %i', $cnt)
], 'owner=%i', $generalID);
} }
$date = date('Y_m_d H:i:s'); $date = date('Y_m_d H:i:s');
$date2 = substr($date, 0, 10); $date2 = substr($date, 0, 10);
$online = getOnlineNum(); $online = getOnlineNum();
$fp = fopen("logs/_{$date2}_refresh.txt", "a"); file_put_contents(
$msg = StringUtil::Fill2($date,20," ").StringUtil::Fill2($_SESSION['userName'],13," ").StringUtil::Fill2($_SESSION['p_name'],13," ").StringUtil::Fill2($_SESSION['p_ip'],16," ").StringUtil::Fill2($type, 10, " ")." 동접자: {$online}"; "logs/_{$date2}_refresh.txt",
fwrite($fp, $msg."\n"); sprintf(
fclose($fp); "%s, %s, %s, %s, %s, %d\n",
$date,
$session->userName,
$session->generalName,
$session->ip,
$type,
$online
),
FILE_APPEND
);
$proxy_headers = array( $proxy_headers = array(
'HTTP_VIA', 'HTTP_VIA',
@@ -1611,9 +1323,16 @@ function increaseRefresh($type="", $cnt=1) {
if(isset($_SERVER[$x])) $str .= "//{$x}:{$_SERVER[$x]}"; if(isset($_SERVER[$x])) $str .= "//{$x}:{$_SERVER[$x]}";
} }
if($str != "") { if($str != "") {
file_put_contents("logs/_{$date2}_ipcheck.txt", file_put_contents(
sprintf("ID:%s//name:%s//REMOTE_ADDR:%s%s\n", "logs/_{$date2}_ipcheck.txt",
$_SESSION['userName'],$_SESSION['p_name'],$_SERVER['REMOTE_ADDR'],$str), FILE_APPEND); sprintf(
"%s, %s, %s%s\n",
$session->userName,
$session->generalName,
$_SERVER['REMOTE_ADDR'],
$str
),
FILE_APPEND);
} }
} }
@@ -1637,23 +1356,26 @@ function updateTraffic() {
'maxonline'=>$game['maxonline'] 'maxonline'=>$game['maxonline']
], true); ], true);
$db->update('general', ['refresh'=>0]); $db->update('general', ['refresh'=>0], true);
$date = date('Y-m-d H:i:s'); $date = date('Y-m-d H:i:s');
$fp = fopen("logs/_traffic.txt", "a");
//일시|년|월|총갱신|접속자|최다갱신자 //일시|년|월|총갱신|접속자|최다갱신자
$msg = StringUtil::Fill2($date,20," ")."|".StringUtil::Fill2($game['year'],3," ")."|".StringUtil::Fill2($game['month'],2," ")."|".StringUtil::Fill2($game['refresh'],8," ")."|".StringUtil::Fill2($online,5," ")."|".StringUtil::Fill2($user['name']."(".$user['refresh'].")",20," "); file_put_contents(__dir__."/logs/_traffic.txt",
fwrite($fp, $msg."\n"); StringUtil::padStringAlignRight($date,20," ")
fclose($fp); ."|".StringUtil::padStringAlignRight($game['year'],3," ")
."|".StringUtil::padStringAlignRight($game['month'],2," ")
."|".StringUtil::padStringAlignRight($game['refresh'],8," ")
."|".StringUtil::padStringAlignRight($online,5," ")
."|".StringUtil::padStringAlignRight($user['name']."(".$user['refresh'].")",20," ")
, FILE_APPEND);
} }
function CheckOverhead() { function CheckOverhead() {
//서버정보 //서버정보
$db = DB::db(); $db = DB::db();
$admin = $db->queryFirstRow('SELECT conweight, turnterm, conlimit from GAME LIMIT 1'); $admin = $db->queryFirstRow('SELECT turnterm, conlimit from GAME LIMIT 1');
$con = $admin['turnterm'] * 6; $con = Util::round(pow($admin['turnterm'], 0.6) * 3) * 10;
$con *= $admin['conweight'] / 100;
if($con != $admin['conlimit']){ if($con != $admin['conlimit']){
@@ -1688,7 +1410,12 @@ function tryLock() {
function unlock() { function unlock() {
// 풀림 // 풀림
//NOTE: unlock에는 table lock이 필요없는가? //NOTE: unlock에는 table lock이 필요없는가?
DB::db()->query("update plock set plock=0"); $db = DB::db();
$db->query("lock tables plock write");
$db->update('plock', [
'plock'=>0
], true);
$db->query("unlock tables");
} }
function timeover() { function timeover() {
@@ -1703,7 +1430,10 @@ function timeover() {
else { return 0; } else { return 0; }
} }
function checkDelay($connect) { function checkDelay() {
$db = DB::db();
$connect=$db->get();
//서버정보 //서버정보
$query = "select turnterm,now() as now,TIMESTAMPDIFF(MINUTE,turntime,now()) as offset from game limit 1"; $query = "select turnterm,now() as now,TIMESTAMPDIFF(MINUTE,turntime,now()) as offset from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
@@ -1720,7 +1450,7 @@ function checkDelay($connect) {
$threshold = 3; $threshold = 3;
} }
//지연 해야할 밀린 턴 횟수 //지연 해야할 밀린 턴 횟수
$iter = floor($admin['offset'] / $term); $iter = intdiv($admin['offset'], $term);
if($iter > $threshold) { if($iter > $threshold) {
$minute = $iter * $term; $minute = $iter * $term;
$query = "update game set turntime=DATE_ADD(turntime, INTERVAL $minute MINUTE),starttime=DATE_ADD(starttime, INTERVAL $minute MINUTE),tnmt_time=DATE_ADD(tnmt_time, INTERVAL $minute MINUTE)"; $query = "update game set turntime=DATE_ADD(turntime, INTERVAL $minute MINUTE),starttime=DATE_ADD(starttime, INTERVAL $minute MINUTE),tnmt_time=DATE_ADD(tnmt_time, INTERVAL $minute MINUTE)";
@@ -1732,12 +1462,16 @@ function checkDelay($connect) {
} }
} }
function updateOnline($connect) { function updateOnline() {
$db = DB::db();
$connect=$db->get();
$nationname = ["재야"];
//국가별 이름 매핑 //국가별 이름 매핑
foreach(getAllNationStaticInfo() as $nation) { foreach(getAllNationStaticInfo() as $nation) {
$nationname[$nation['nation']] = $nation['name']; $nationname[$nation['nation']] = $nation['name'];
} }
$nationname[0] = "재야";
//동접수 //동접수
$query = "select no,name,nation from general where lastrefresh > DATE_SUB(NOW(), INTERVAL 5 MINUTE)"; $query = "select no,name,nation from general where lastrefresh > DATE_SUB(NOW(), INTERVAL 5 MINUTE)";
@@ -1777,7 +1511,12 @@ function updateOnline($connect) {
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
function checkTurn($connect) { function checkTurn() {
$db = DB::db();
$connect=$db->get();
$alllog = [];
// 잦은 갱신 금지 현재 5초당 1회 // 잦은 갱신 금지 현재 5초당 1회
if(!timeover()) { return; } if(!timeover()) { return; }
// 현재 처리중이면 접근 불가 // 현재 처리중이면 접근 불가
@@ -1793,16 +1532,16 @@ function checkTurn($connect) {
return; return;
} }
$locklog[0] = "- checkTurn() : ".date('Y-m-d H:i:s')." : ".$_SESSION['userName']; $session = Session::getInstance();
pushLockLog($locklog);
pushLockLog(["- checkTurn() : ".date('Y-m-d H:i:s')." : ".$session->userName]);
// 파일락 해제 // 파일락 해제
if(!flock($fp, LOCK_UN)) { return; } if(!flock($fp, LOCK_UN)) { return; }
// 세마포어 해제 // 세마포어 해제
//if(!@sem_release($sema)) { echo "치명적 에러! 유기체에게 문의하세요!"; exit(1); } //if(!@sem_release($sema)) { echo "치명적 에러! Hide_D에게 문의하세요!"; exit(1); }
$locklog[0] = "- checkTurn() 입 : ".date('Y-m-d H:i:s')." : ".$_SESSION['userName']; pushLockLog(["- checkTurn() 입 : ".date('Y-m-d H:i:s')." : ".$session->userName]);
pushLockLog($locklog);
//if(STEP_LOG) delStepLog(); //if(STEP_LOG) delStepLog();
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', 진입'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', 진입');
@@ -1818,10 +1557,10 @@ function checkTurn($connect) {
} }
// 1턴이상 갱신 없었으면 서버 지연 // 1턴이상 갱신 없었으면 서버 지연
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', checkDelay'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', checkDelay');
checkDelay($connect); checkDelay();
// 접속자수, 접속국가, 국가별 접속장수 갱신 // 접속자수, 접속국가, 국가별 접속장수 갱신
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', checkDelay'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', checkDelay');
updateOnline($connect); updateOnline();
//접속자 수 따라서 갱신제한 변경 //접속자 수 따라서 갱신제한 변경
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', CheckOverhead'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', CheckOverhead');
CheckOverhead(); CheckOverhead();
@@ -1848,15 +1587,15 @@ function checkTurn($connect) {
//if(PROCESS_LOG) pushProcessLog($processlog); //if(PROCESS_LOG) pushProcessLog($processlog);
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processAI'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processAI');
if($general['npc'] >= 2) { processAI($connect, $general['no']); } // npc AI 처리 if($general['npc'] >= 2) { processAI($general['no']); } // npc AI 처리
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', PreprocessCommand'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', PreprocessCommand');
PreprocessCommand($connect, $general['no']); PreprocessCommand($general['no']);
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processCommand'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processCommand');
processCommand($connect, $general['no']); processCommand($general['no']);
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateCommand'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateCommand');
updateCommand($connect, $general['no']); updateCommand($general['no']);
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateTurntime'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateTurntime');
updateTurntime($connect, $general['no']); updateTurntime($general['no']);
} }
@@ -1865,10 +1604,9 @@ function checkTurn($connect) {
updateTraffic(); updateTraffic();
// 1달마다 처리하는 것들, 벌점 감소 및 건국,전턴,합병 -1, 군량 소모 // 1달마다 처리하는 것들, 벌점 감소 및 건국,전턴,합병 -1, 군량 소모
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', preUpdateMonthly'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', preUpdateMonthly');
$result = preUpdateMonthly($connect); $result = preUpdateMonthly();
if($result == false) { if($result == false) {
$locklog[0] = "-- checkTurn() 오류출 : ".date('Y-m-d H:i:s')." : ".$_SESSION['userName']; pushLockLog(["-- checkTurn() 오류출 : ".date('Y-m-d H:i:s')." : ".$session->userName]);
pushLockLog($locklog);
// 잡금 해제 // 잡금 해제
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', unlock'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', unlock');
@@ -1877,69 +1615,66 @@ function checkTurn($connect) {
} }
// 그 시각 년도,월 저장 // 그 시각 년도,월 저장
$dt = turnDate($connect, $nextTurn); $dt = turnDate($nextTurn);
$admin['year'] = $dt[0]; $admin['month'] = $dt[1]; $admin['year'] = $dt[0]; $admin['month'] = $dt[1];
$locklog[0] = "-- checkTurn() ".$admin['month']."월 : ".date('Y-m-d H:i:s')." : ".$_SESSION['userName']; pushLockLog(["-- checkTurn() ".$admin['month']."월 : ".date('Y-m-d H:i:s')." : ".$session->userName]);
pushLockLog($locklog);
// 이벤트 핸들러 동작 // 이벤트 핸들러 동작
foreach (DB::db()->query('SELECT * from event') as $rawEvent) { foreach (DB::db()->query('SELECT * from event') as $rawEvent) {
$eventID = $rawEvent['id']; $eventID = $rawEvent['id'];
$cond = Json::decode($rawEvent['cond']); $cond = Json::decode($rawEvent['condition']);
$action = Json::decode($rawEvent['action']); $action = Json::decode($rawEvent['action']);
$event = new Event\EventHandler($cond, $action); $event = new Event\EventHandler($cond, $action);
$event->tryRunEvent(array_merge([ $event->tryRunEvent(['currentEventID'=>$eventID] + $admin);
'currentEventID'=>$eventID
], $admin));
} }
// 분기계산. 장수들 턴보다 먼저 있다면 먼저처리 // 분기계산. 장수들 턴보다 먼저 있다면 먼저처리
if($admin['month'] == 1) { if($admin['month'] == 1) {
// NPC 등장 // NPC 등장
//if($admin['scenario'] > 0 && $admin['scenario'] < 20) { RegNPC($connect); } //if($admin['scenario'] > 0 && $admin['scenario'] < 20) { RegNPC(); }
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processGoldIncome'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processGoldIncome');
processGoldIncome($connect); processGoldIncome();
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processSpring'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processSpring');
processSpring($connect); processSpring();
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateYearly'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateYearly');
updateYearly($connect); updateYearly();
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateQuaterly'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateQuaterly');
updateQuaterly($connect); updateQuaterly();
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', disaster'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', disaster');
disaster($connect); disaster();
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', tradeRate'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', tradeRate');
tradeRate($connect); tradeRate();
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', addAge'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', addAge');
addAge($connect); addAge();
// 새해 알림 // 새해 알림
$alllog[] = "<C>◆</>{$admin['month']}월:<C>{$admin['year']}</>년이 되었습니다."; $alllog[] = "<C>◆</>{$admin['month']}월:<C>{$admin['year']}</>년이 되었습니다.";
pushAllLog($alllog); pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
} elseif($admin['month'] == 4) { } elseif($admin['month'] == 4) {
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateQuaterly'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateQuaterly');
updateQuaterly($connect); updateQuaterly();
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', disaster'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', disaster');
disaster($connect); disaster();
} elseif($admin['month'] == 7) { } elseif($admin['month'] == 7) {
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processRiceIncome'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processRiceIncome');
processRiceIncome($connect); processRiceIncome();
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processFall'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processFall');
processFall($connect); processFall();
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateQuaterly'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateQuaterly');
updateQuaterly($connect); updateQuaterly();
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', disaster'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', disaster');
disaster($connect); disaster();
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', tradeRate'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', tradeRate');
tradeRate($connect); tradeRate();
} elseif($admin['month'] == 10) { } elseif($admin['month'] == 10) {
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateQuaterly'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateQuaterly');
updateQuaterly($connect); updateQuaterly();
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', disaster'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', disaster');
disaster($connect); disaster();
} }
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', postUpdateMonthly'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', postUpdateMonthly');
postUpdateMonthly($connect); postUpdateMonthly();
// 다음달로 넘김 // 다음달로 넘김
$prevTurn = $nextTurn; $prevTurn = $nextTurn;
@@ -1953,7 +1688,7 @@ function checkTurn($connect) {
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
// 그 시각 년도,월 저장 // 그 시각 년도,월 저장
$dt = turnDate($connect, $prevTurn); $dt = turnDate($prevTurn);
$admin['year'] = $dt[0]; $admin['month'] = $dt[1]; $admin['year'] = $dt[0]; $admin['month'] = $dt[1];
// 현재시간의 월턴시간 이후 분단위 장수 처리 // 현재시간의 월턴시간 이후 분단위 장수 처리
do { do {
@@ -1968,15 +1703,15 @@ function checkTurn($connect) {
//if(PROCESS_LOG) pushProcessLog($processlog); //if(PROCESS_LOG) pushProcessLog($processlog);
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processAI'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processAI');
if($general['npc'] >= 2) { processAI($connect, $general['no']); } // npc AI 처리 if($general['npc'] >= 2) { processAI($general['no']); } // npc AI 처리
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', PreprocessCommand'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', PreprocessCommand');
PreprocessCommand($connect, $general['no']); PreprocessCommand($general['no']);
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processCommand'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processCommand');
processCommand($connect, $general['no']); processCommand($general['no']);
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateCommand'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateCommand');
updateCommand($connect, $general['no']); updateCommand($general['no']);
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateTurntime'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', updateTurntime');
updateTurntime($connect, $general['no']); updateTurntime($general['no']);
} }
} while($gencount > 0); } while($gencount > 0);
@@ -1985,36 +1720,30 @@ function checkTurn($connect) {
$query = "update game set turntime='$date'"; $query = "update game set turntime='$date'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
// 3턴 전 시간
$letterdate = subTurn($date, $admin['turnterm'], 3);
//기한 지난 외교 메세지 지움(3개월 유지)
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', '.__LINE__);
for($i=0; $i < 5; $i++) {
$query = "update nation set dip{$i}='',dip{$i}_who='0',dip{$i}_type='0',dip{$i}_when='' where dip{$i}_when < '$letterdate'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
}
// 부상 과도 제한 // 부상 과도 제한
$query = "update general set injury='80' where injury>'80'"; $query = "update general set injury='80' where injury>'80'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
//토너먼트 처리 //토너먼트 처리
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processTournament'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processTournament');
processTournament($connect); processTournament();
//거래 처리 //거래 처리
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processAuction'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', processAuction');
processAuction($connect); processAuction();
// 잡금 해제 // 잡금 해제
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', unlock'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', unlock');
unlock(); unlock();
$locklog[0] = "- checkTurn() 출 : ".date('Y-m-d H:i:s')." : ".$_SESSION['userName']; pushLockLog(["- checkTurn() 출 : ".date('Y-m-d H:i:s')." : ".$session->userName]);
pushLockLog($locklog);
//if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', finish'); //if(STEP_LOG) pushStepLog(date('Y-m-d H:i:s').', finish');
return true; return true;
} }
function addAge($connect) { function addAge() {
$db = DB::db();
$connect=$db->get();
//나이와 호봉 증가 //나이와 호봉 증가
$query = "update general set age=age+1,belong=belong+1"; $query = "update general set age=age+1,belong=belong+1";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
@@ -2030,13 +1759,12 @@ function addAge($connect) {
for($i=0; $i < $gencount; $i++) { for($i=0; $i < $gencount; $i++) {
$general = MYDB_fetch_array($result); $general = MYDB_fetch_array($result);
$special = getSpecial($connect, $general['leader'], $general['power'], $general['intel']); $special = getSpecial($general['leader'], $general['power'], $general['intel']);
$query = "update general set special='$special' where no='{$general['no']}'"; $query = "update general set special='$special' where no='{$general['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$log[0] = "<C>●</>특기 【<b><L>".getGenSpecial($special)."</></b>】(을)를 익혔습니다!"; pushGeneralHistory($general, "<C>●</>{$admin['year']}{$admin['month']}월:특기 【<b><C>".getGenSpecial($special)."</></b>】(을)를 습득");
addHistory($general, "<C>●</>{$admin['year']}{$admin['month']}월:특기 【<b><C>".getGenSpecial($special)."</></b>】(을)를 습득"); pushGenLog($general, "<C>●</>특기 【<b><L>".getGenSpecial($special)."</></b>】(을)를 익혔습니다!");
pushGenLog($general, $log);
} }
$query = "select no,name,nation,leader,power,intel,npc,dex0,dex10,dex20,dex30,dex40 from general where specage2<=age and special2='0'"; $query = "select no,name,nation,leader,power,intel,npc,dex0,dex10,dex20,dex30,dex40 from general where specage2<=age and special2='0'";
@@ -2045,19 +1773,21 @@ function addAge($connect) {
for($i=0; $i < $gencount; $i++) { for($i=0; $i < $gencount; $i++) {
$general = MYDB_fetch_array($result); $general = MYDB_fetch_array($result);
$special2 = getSpecial2($connect, $general['leader'], $general['power'], $general['intel'], 0, $general['dex0'], $general['dex10'], $general['dex20'], $general['dex30'], $general['dex40']); $special2 = getSpecial2($general['leader'], $general['power'], $general['intel'], 0, $general['dex0'], $general['dex10'], $general['dex20'], $general['dex30'], $general['dex40']);
$query = "update general set special2='$special2' where no='{$general['no']}'"; $query = "update general set special2='$special2' where no='{$general['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$log[0] = "<C>●</>특기 【<b><L>".getGenSpecial($special2)."</></b>】(을)를 익혔습니다!"; pushGeneralHistory($general, "<C>●</>{$admin['year']}{$admin['month']}월:특기 【<b><C>".getGenSpecial($special2)."</></b>】(을)를 습득");
addHistory($general, "<C>●</>{$admin['year']}{$admin['month']}월:특기 【<b><C>".getGenSpecial($special2)."</></b>】(을)를 습득"); pushGenLog($general, "<C>●</>특기 【<b><L>".getGenSpecial($special2)."</></b>】(을)를 익혔습니다!");
pushGenLog($general, $log);
} }
} }
} }
function turnDate($connect, $curtime) { function turnDate($curtime) {
$db = DB::db();
$connect=$db->get();
$query = "select startyear,starttime,turnterm,year,month from game limit 1"; $query = "select startyear,starttime,turnterm,year,month from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
@@ -2066,9 +1796,9 @@ function turnDate($connect, $curtime) {
$curturn = cutTurn($curtime, $admin['turnterm']); $curturn = cutTurn($curtime, $admin['turnterm']);
$num = 0; $num = 0;
$term = $admin['turnterm']*60; $term = $admin['turnterm']*60;
$num = floor((strtotime($curturn) - strtotime($turn)) / $term); $num = intdiv((strtotime($curturn) - strtotime($turn)), $term);
$year = $admin['startyear'] + floor($num / 12); $year = $admin['startyear'] + intdiv($num, 12);
$month = 1 + (12+$num) % 12; $month = 1 + (12+$num) % 12;
// 바뀐 경우만 업데이트 // 바뀐 경우만 업데이트
@@ -2076,13 +1806,15 @@ function turnDate($connect, $curtime) {
$query = "update game set year='$year',month='$month'"; $query = "update game set year='$year',month='$month'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
$value[0] = $year;
$value[1] = $month; return [$year, $month];
return $value;
} }
function triggerTournament($connect) { function triggerTournament() {
$db = DB::db();
$connect=$db->get();
$query = "select tournament,tnmt_trig from game limit 1"; $query = "select tournament,tnmt_trig from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
@@ -2092,11 +1824,15 @@ function triggerTournament($connect) {
$type = rand() % 6; // 0 : 전력전, 1 : 통솔전, 2 : 일기토, 3 : 설전 $type = rand() % 6; // 0 : 전력전, 1 : 통솔전, 2 : 일기토, 3 : 설전
//전력전 50%, 통, 일, 설 각 17% //전력전 50%, 통, 일, 설 각 17%
if($type > 3) { $type = 0; } if($type > 3) { $type = 0; }
startTournament($connect, $admin['tnmt_trig'], $type); startTournament($admin['tnmt_trig'], $type);
} }
} }
function PreprocessCommand($connect, $no) { function PreprocessCommand($no) {
$db = DB::db();
$connect=$db->get();
$log = [];
$query = "select no,name,city,injury,special2,item,turn0 from general where no='$no'"; $query = "select no,name,city,injury,special2,item,turn0 from general where no='$no'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$general = MYDB_fetch_array($result); $general = MYDB_fetch_array($result);
@@ -2109,8 +1845,7 @@ function PreprocessCommand($connect, $no) {
$query = "update general set injury=0 where no='$no'"; $query = "update general set injury=0 where no='$no'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$log[0] = "<C>●</><C>의술</>을 펼쳐 스스로 치료합니다!"; pushGenLog($general, "<C>●</><C>의술</>을 펼쳐 스스로 치료합니다!");
pushGenLog($general, $log);
} }
$query = "select no,name,injury from general where city='{$general['city']}' and injury>10 order by rand()"; $query = "select no,name,injury from general where city='{$general['city']}' and injury>10 order by rand()";
@@ -2119,7 +1854,7 @@ function PreprocessCommand($connect, $no) {
if($patientCount > 0) { if($patientCount > 0) {
// 50% 확률로 치료 // 50% 확률로 치료
$patientCount = round($patientCount * 0.5); $patientCount = Util::round($patientCount * 0.5);
$patientName = ""; $patientName = "";
for($i=0; $i < $patientCount; $i++) { for($i=0; $i < $patientCount; $i++) {
@@ -2129,8 +1864,7 @@ function PreprocessCommand($connect, $no) {
$query = "update general set injury=0 where no='{$patient['no']}'"; $query = "update general set injury=0 where no='{$patient['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$log[0] = "<C>●</><Y>{$general['name']}</>(이)가 <C>의술</>로써 치료해줍니다!"; pushGenLog($patient, "<C>●</><Y>{$general['name']}</>(이)가 <C>의술</>로써 치료해줍니다!");
pushGenLog($patient, $log);
if($patientName == "") { if($patientName == "") {
$patientName = $patient['name']; $patientName = $patient['name'];
@@ -2138,12 +1872,11 @@ function PreprocessCommand($connect, $no) {
} }
if($patientCount == 1) { if($patientCount == 1) {
$log[0] = "<C>●</><C>의술</>을 펼쳐 도시의 장수 <Y>{$patientName}</>(을)를 치료합니다!"; pushGenLog($general, "<C>●</><C>의술</>을 펼쳐 도시의 장수 <Y>{$patientName}</>(을)를 치료합니다!");
} else { } else {
$patientCount -= 1; $patientCount -= 1;
$log[0] = "<C>●</><C>의술</>을 펼쳐 도시의 장수들 <Y>{$patientName}</> 외 <C>{$patientCount}</>명을 치료합니다!"; pushGenLog($general, "<C>●</><C>의술</>을 펼쳐 도시의 장수들 <Y>{$patientName}</> 외 <C>{$patientCount}</>명을 치료합니다!");
} }
pushGenLog($general, $log);
} }
} }
@@ -2175,7 +1908,12 @@ function PreprocessCommand($connect, $no) {
} }
function updateTurntime($connect, $no) { function updateTurntime($no) {
$db = DB::db();
$connect=$db->get();
$alllog = [];
$log = [];
$query = "select year,month,isUnited,turnterm from game limit 1"; $query = "select year,month,isUnited,turnterm from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
@@ -2194,15 +1932,15 @@ function updateTurntime($connect, $no) {
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$alllog[0] = "<C>●</>{$admin['month']}월:<Y>{$general['name2']}</>(이)가 <Y>{$general['name']}</>의 육체에서 <S>유체이탈</>합니다!"; $alllog[0] = "<C>●</>{$admin['month']}월:<Y>{$general['name2']}</>(이)가 <Y>{$general['name']}</>의 육체에서 <S>유체이탈</>합니다!";
pushAllLog($alllog); pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
if($admin['isUnited'] == 0) { if($admin['isUnited'] == 0) {
CheckHall($connect, $no); CheckHall($no);
} }
} else { } else {
// 군주였으면 유지 이음 // 군주였으면 유지 이음
if($general['level'] == 12) { if($general['level'] == 12) {
nextRuler($connect, $general); nextRuler($general);
} }
//도시의 태수, 군사, 시중직도 초기화 //도시의 태수, 군사, 시중직도 초기화
@@ -2307,7 +2045,7 @@ function updateTurntime($connect, $no) {
} }
} }
pushAllLog($alllog); pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
return; return;
} }
@@ -2315,18 +2053,18 @@ function updateTurntime($connect, $no) {
if($general['age'] >= 80 && $general['npc'] == 0) { if($general['age'] >= 80 && $general['npc'] == 0) {
if($admin['isUnited'] == 0) { if($admin['isUnited'] == 0) {
CheckHall($connect, $no); CheckHall($no);
} }
$query = "update general set leader=leader*0.85,power=power*0.85,intel=intel*0.85,injury=0,experience=experience*0.5,dedication=dedication*0.5,firenum=0,warnum=0,killnum=0,deathnum=0,killcrew=0,deathcrew=0,age=20,specage=0,specage2=0,crew=crew*0.85,dex0=dex0*0.5,dex10=dex10*0.5,dex20=dex20*0.5,dex30=dex30*0.5,dex40=dex40*0.5 where no='$no'"; $query = "update general set leader=leader*0.85,power=power*0.85,intel=intel*0.85,injury=0,experience=experience*0.5,dedication=dedication*0.5,firenum=0,warnum=0,killnum=0,deathnum=0,killcrew=0,deathcrew=0,age=20,specage=0,specage2=0,crew=crew*0.85,dex0=dex0*0.5,dex10=dex10*0.5,dex20=dex20*0.5,dex30=dex30*0.5,dex40=dex40*0.5 where no='$no'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$alllog[0] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>(이)가 <R>은퇴</>하고 그 자손이 유지를 이어받았습니다."; $alllog[0] = "<C>●</>{$admin['month']}월:<Y>{$general['name']}</>(이)가 <R>은퇴</>하고 그 자손이 유지를 이어받았습니다.";
pushAllLog($alllog); pushGeneralPublicRecord($alllog, $admin['year'], $admin['month']);
$log[0] = "<C>●</>나이가 들어 <R>은퇴</>하고 자손에게 자리를 물려줍니다."; $log[0] = "<C>●</>나이가 들어 <R>은퇴</>하고 자손에게 자리를 물려줍니다.";
pushGenLog($general, $log); pushGenLog($general, $log);
addHistory($general, "<C>●</>{$admin['year']}{$admin['month']}월:나이가 들어 은퇴하고, 자손에게 관직을 물려줌"); pushGeneralHistory($general, "<C>●</>{$admin['year']}{$admin['month']}월:나이가 들어 은퇴하고, 자손에게 관직을 물려줌");
} }
$turntime = addTurn($general['turntime'], $admin['turnterm']); $turntime = addTurn($general['turntime'], $admin['turnterm']);
@@ -2335,7 +2073,10 @@ function updateTurntime($connect, $no) {
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
} }
function CheckHall($connect, $no) { function CheckHall($no) {
$db = DB::db();
$connect=$db->get();
$type = array( $type = array(
"experience", "experience",
"dedication", "dedication",
@@ -2417,8 +2158,15 @@ function CheckHall($connect, $no) {
} }
function uniqueItem($connect, $general, $log, $vote=0) { function uniqueItem($general, $log, $vote=0) {
if($general['npc'] >= 2 || $general['betray'] > 1) { return $log; } $db = DB::db();
$connect=$db->get();
$alllog = [];
$history = [];
$occupied = [];
$item = [];
if($general['npc'] >= 2) { return $log; }
if($general['weap'] > 6 || $general['book'] > 6 || $general['horse'] > 6 || $general['item'] > 6) { return $log; } if($general['weap'] > 6 || $general['book'] > 6 || $general['horse'] > 6 || $general['item'] > 6) { return $log; }
$query = "select year,month,scenario from game limit 1"; $query = "select year,month,scenario from game limit 1";
@@ -2432,9 +2180,9 @@ function uniqueItem($connect, $general, $log, $vote=0) {
if($game['scenario'] == 0) { $prob = $gen['cnt'] * 5; } // 5~6개월에 하나씩 등장 if($game['scenario'] == 0) { $prob = $gen['cnt'] * 5; } // 5~6개월에 하나씩 등장
else { $prob = $gen['cnt']; } // 1~2개월에 하나씩 등장 else { $prob = $gen['cnt']; } // 1~2개월에 하나씩 등장
if($vote == 1) { $prob = round($gen['cnt'] * 0.7 / 3); } // 투표율 70%, 투표 한번에 2~3개 등장 if($vote == 1) { $prob = Util::round($gen['cnt'] * 0.7 / 3); } // 투표율 70%, 투표 한번에 2~3개 등장
elseif($vote == 2) { $prob = round($gen['cnt'] / 10 / 2); } // 랜임시 2개(10%) 등장(200명중 20명 랜임시도?) elseif($vote == 2) { $prob = Util::round($gen['cnt'] / 10 / 2); } // 랜임시 2개(10%) 등장(200명중 20명 랜임시도?)
elseif($vote == 3) { $prob = round($gen['cnt'] / 10 / 4); } // 건국시 4개(20%) 등장(200명시 20국 정도 됨) elseif($vote == 3) { $prob = Util::round($gen['cnt'] / 10 / 4); } // 건국시 4개(20%) 등장(200명시 20국 정도 됨)
if($prob < 3) { $prob = 3; } if($prob < 3) { $prob = 3; }
//아이템 습득 상황 //아이템 습득 상황
@@ -2457,7 +2205,7 @@ function uniqueItem($connect, $general, $log, $vote=0) {
} }
for($i=7; $i <= 26; $i++) { for($i=7; $i <= 26; $i++) {
if($occupied[$i] == 0) { if($occupied[$i] == 0) {
$item[count($item)] = $i; $item[] = $i;
} }
} }
$it = $item[rand() % count($item)]; $it = $item[rand() % count($item)];
@@ -2467,15 +2215,11 @@ function uniqueItem($connect, $general, $log, $vote=0) {
$nation = getNationStaticInfo($general['nation']); $nation = getNationStaticInfo($general['nation']);
if($nation == null) {
$nation['name'] = "재야";
}
switch($sel) { switch($sel) {
case 0: case 0:
$log[] = "<C>●</><C>".getWeapName($it)."</>(을)를 습득했습니다!"; $log[] = "<C>●</><C>".getWeapName($it)."</>(을)를 습득했습니다!";
$alllog[0] = "<C>●</>{$game['month']}월:<Y>{$general['name']}</>(이)가 <C>".getWeapName($it)."</>(을)를 습득했습니다!"; $alllog[0] = "<C>●</>{$game['month']}월:<Y>{$general['name']}</>(이)가 <C>".getWeapName($it)."</>(을)를 습득했습니다!";
addHistory($general, "<C>●</>{$game['year']}{$game['month']}월:<C>".getWeapName($it)."</>(을)를 습득"); pushGeneralHistory($general, "<C>●</>{$game['year']}{$game['month']}월:<C>".getWeapName($it)."</>(을)를 습득");
if($vote == 0) { if($vote == 0) {
$history[0] = "<C>●</>{$game['year']}{$game['month']}월:<C><b>【아이템】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getWeapName($it)."</>(을)를 습득했습니다!"; $history[0] = "<C>●</>{$game['year']}{$game['month']}월:<C><b>【아이템】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getWeapName($it)."</>(을)를 습득했습니다!";
} elseif($vote == 1) { } elseif($vote == 1) {
@@ -2489,7 +2233,7 @@ function uniqueItem($connect, $general, $log, $vote=0) {
case 1: case 1:
$log[] = "<C>●</><C>".getBookName($it)."</>(을)를 습득했습니다!"; $log[] = "<C>●</><C>".getBookName($it)."</>(을)를 습득했습니다!";
$alllog[0] = "<C>●</>{$game['month']}월:<Y>{$general['name']}</>(이)가 <C>".getBookName($it)."</>(을)를 습득했습니다!"; $alllog[0] = "<C>●</>{$game['month']}월:<Y>{$general['name']}</>(이)가 <C>".getBookName($it)."</>(을)를 습득했습니다!";
addHistory($general, "<C>●</>{$game['year']}{$game['month']}월:<C>".getBookName($it)."</>(을)를 습득"); pushGeneralHistory($general, "<C>●</>{$game['year']}{$game['month']}월:<C>".getBookName($it)."</>(을)를 습득");
if($vote == 0) { if($vote == 0) {
$history[0] = "<C>●</>{$game['year']}{$game['month']}월:<C><b>【아이템】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getBookName($it)."</>(을)를 습득했습니다!"; $history[0] = "<C>●</>{$game['year']}{$game['month']}월:<C><b>【아이템】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getBookName($it)."</>(을)를 습득했습니다!";
} elseif($vote == 1) { } elseif($vote == 1) {
@@ -2503,7 +2247,7 @@ function uniqueItem($connect, $general, $log, $vote=0) {
case 2: case 2:
$log[] = "<C>●</><C>".getHorseName($it)."</>(을)를 습득했습니다!"; $log[] = "<C>●</><C>".getHorseName($it)."</>(을)를 습득했습니다!";
$alllog[0] = "<C>●</>{$game['month']}월:<Y>{$general['name']}</>(이)가 <C>".getHorseName($it)."</>(을)를 습득했습니다!"; $alllog[0] = "<C>●</>{$game['month']}월:<Y>{$general['name']}</>(이)가 <C>".getHorseName($it)."</>(을)를 습득했습니다!";
addHistory($general, "<C>●</>{$game['year']}{$game['month']}월:<C>".getHorseName($it)."</>(을)를 습득"); pushGeneralHistory($general, "<C>●</>{$game['year']}{$game['month']}월:<C>".getHorseName($it)."</>(을)를 습득");
if($vote == 0) { if($vote == 0) {
$history[0] = "<C>●</>{$game['year']}{$game['month']}월:<C><b>【아이템】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getHorseName($it)."</>(을)를 습득했습니다!"; $history[0] = "<C>●</>{$game['year']}{$game['month']}월:<C><b>【아이템】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getHorseName($it)."</>(을)를 습득했습니다!";
} elseif($vote == 1) { } elseif($vote == 1) {
@@ -2517,7 +2261,7 @@ function uniqueItem($connect, $general, $log, $vote=0) {
case 3: case 3:
$log[] = "<C>●</><C>".getItemName($it)."</>(을)를 습득했습니다!"; $log[] = "<C>●</><C>".getItemName($it)."</>(을)를 습득했습니다!";
$alllog[0] = "<C>●</>{$game['month']}월:<Y>{$general['name']}</>(이)가 <C>".getItemName($it)."</>(을)를 습득했습니다!"; $alllog[0] = "<C>●</>{$game['month']}월:<Y>{$general['name']}</>(이)가 <C>".getItemName($it)."</>(을)를 습득했습니다!";
addHistory($general, "<C>●</>{$game['year']}{$game['month']}월:<C>".getItemName($it)."</>(을)를 습득"); pushGeneralHistory($general, "<C>●</>{$game['year']}{$game['month']}월:<C>".getItemName($it)."</>(을)를 습득");
if($vote == 0) { if($vote == 0) {
$history[0] = "<C>●</>{$game['year']}{$game['month']}월:<C><b>【아이템】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getItemName($it)."</>(을)를 습득했습니다!"; $history[0] = "<C>●</>{$game['year']}{$game['month']}월:<C><b>【아이템】</b></><D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>(이)가 <C>".getItemName($it)."</>(을)를 습득했습니다!";
} elseif($vote == 1) { } elseif($vote == 1) {
@@ -2529,14 +2273,16 @@ function uniqueItem($connect, $general, $log, $vote=0) {
} }
break; break;
} }
pushAllLog($alllog); pushGeneralPublicRecord($alllog, $game['year'], $game['month']);
pushHistory($history); pushWorldHistory($history, $game['year'], $game['month']);
} }
} }
return $log; return $log;
} }
function checkAbility($connect, $general, $log) { function checkAbility($general, $log) {
$db = DB::db();
$connect=$db->get();
$limit = GameConst::$upgradeLimit; $limit = GameConst::$upgradeLimit;
@@ -2583,7 +2329,10 @@ function checkAbility($connect, $general, $log) {
return $log; return $log;
} }
function checkDedication($connect, $general, $log) { function checkDedication($general, $log) {
$db = DB::db();
$connect=$db->get();
$dedlevel = getDedLevel($general['dedication']); $dedlevel = getDedLevel($general['dedication']);
$query = "update general set dedlevel='$dedlevel' where no='{$general['no']}'"; $query = "update general set dedlevel='$dedlevel' where no='{$general['no']}'";
@@ -2600,7 +2349,10 @@ function checkDedication($connect, $general, $log) {
return $log; return $log;
} }
function checkExperience($connect, $general, $log) { function checkExperience($general, $log) {
$db = DB::db();
$connect=$db->get();
$explevel = getExpLevel($general['experience']); $explevel = getExpLevel($general['experience']);
$query = "update general set explevel='$explevel' where no='{$general['no']}'"; $query = "update general set explevel='$explevel' where no='{$general['no']}'";
@@ -2617,7 +2369,10 @@ function checkExperience($connect, $general, $log) {
return $log; return $log;
} }
function getAdmin($connect) { function getAdmin() {
$db = DB::db();
$connect=$db->get();
$query = "select * from game limit 1"; $query = "select * from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
@@ -2625,15 +2380,22 @@ function getAdmin($connect) {
return $admin; return $admin;
} }
function getMe($connect) { function getMe() {
$query = "select * from general where owner='{$_SESSION['userID']}'"; $db = DB::db();
$connect=$db->get();
$userID = Session::getUserID();
$query = "select * from general where owner='{$userID}'";
$result = MYDB_query($query, $connect) or Error("접속자가 많아 접속을 중단합니다. 잠시후 갱신해주세요.<br>getMe : ".MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error("접속자가 많아 접속을 중단합니다. 잠시후 갱신해주세요.<br>getMe : ".MYDB_error($connect),"");
$me = MYDB_fetch_array($result); $me = MYDB_fetch_array($result);
return $me; return $me;
} }
function getTroop($connect, $troop) { function getTroop($troop) {
$db = DB::db();
$connect=$db->get();
$query = "select * from troop where troop='$troop'"; $query = "select * from troop where troop='$troop'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$troop = MYDB_fetch_array($result); $troop = MYDB_fetch_array($result);
@@ -2641,7 +2403,10 @@ function getTroop($connect, $troop) {
return $troop; return $troop;
} }
function getCity($connect, $city, $sel="*") { function getCity($city, $sel="*") {
$db = DB::db();
$connect=$db->get();
$query = "select {$sel} from city where city='$city'"; $query = "select {$sel} from city where city='$city'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$city = MYDB_fetch_array($result); $city = MYDB_fetch_array($result);
@@ -2649,7 +2414,10 @@ function getCity($connect, $city, $sel="*") {
return $city; return $city;
} }
function getNation($connect, $nation) { function getNation($nation) {
$db = DB::db();
$connect=$db->get();
$query = "select * from nation where nation='$nation'"; $query = "select * from nation where nation='$nation'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$nation = MYDB_fetch_array($result); $nation = MYDB_fetch_array($result);
@@ -2657,7 +2425,11 @@ function getNation($connect, $nation) {
return $nation; return $nation;
} }
function deleteNation($connect, $general) { function deleteNation($general) {
$db = DB::db();
$connect=$db->get();
$history = [];
$date = substr($general['turntime'],11,5); $date = substr($general['turntime'],11,5);
$query = "select year,month from game limit 1"; $query = "select year,month from game limit 1";
@@ -2684,11 +2456,14 @@ function deleteNation($connect, $general) {
$query = "delete from diplomacy where me='{$general['nation']}' or you='{$general['nation']}'"; $query = "delete from diplomacy where me='{$general['nation']}' or you='{$general['nation']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
pushHistory($history); pushWorldHistory($history, $admin['year'], $admin['month']);
refreshNationStaticInfo(); refreshNationStaticInfo();
} }
function nextRuler($connect, $general) { function nextRuler($general) {
$db = DB::db();
$connect=$db->get();
$query = "select year,month from game limit 1"; $query = "select year,month from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
@@ -2724,8 +2499,8 @@ function nextRuler($connect, $general) {
// 아무도 없으면 국가 삭제 // 아무도 없으면 국가 삭제
if($corecount == 0) { if($corecount == 0) {
//분쟁기록 모두 지움 //분쟁기록 모두 지움
DeleteConflict($connect, $general['nation']); DeleteConflict($general['nation']);
deleteNation($connect, $general); deleteNation($general);
return; return;
} else { } else {
$nextruler = MYDB_fetch_array($result); $nextruler = MYDB_fetch_array($result);
@@ -2747,92 +2522,85 @@ function nextRuler($connect, $general) {
$query = "update city set gen3=0 where gen3='{$nextruler['no']}'"; $query = "update city set gen3=0 where gen3='{$nextruler['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$history[] = "<C>●</>{$admin['year']}{$admin['month']}월:<C><b>【유지】</b></><Y>{$nextruler['name']}</>(이)가 <D><b>{$nation['name']}</b></>의 유지를 이어 받았습니다"; $history = ["<C>●</>{$admin['year']}{$admin['month']}월:<C><b>【유지】</b></><Y>{$nextruler['name']}</>(이)가 <D><b>{$nation['name']}</b></>의 유지를 이어 받았습니다"];
pushHistory($history); pushWorldHistory($history, $admin['year'], $admin['month']);
addNationHistory($nation, "<C>●</>{$admin['year']}{$admin['month']}월:<C><b>【유지】</b></><Y>{$nextruler['name']}</>(이)가 <D><b>{$nation['name']}</b></>의 유지를 이어 받음."); pushNationHistory($nation, "<C>●</>{$admin['year']}{$admin['month']}월:<C><b>【유지】</b></><Y>{$nextruler['name']}</>(이)가 <D><b>{$nation['name']}</b></>의 유지를 이어 받음.");
// 장수 삭제 및 부대처리는 checkTurn에서 // 장수 삭제 및 부대처리는 checkTurn에서
} }
/**
* $maxDist 이내의 도시를 검색하는 함수
* @param $from 기준 도시 코드
* @param $maxDist 검색하고자 하는 최대 거리
* @param $distForm 리턴 타입. true일 경우 $result[$dist] = [...$city] 이며, false일 경우 $result[$city] = $dist 임
*/
function searchDistance(int $from, int $maxDist=99, bool $distForm = false) {
$queue = new \SplQueue();
function distance($connect, $from, $maxDist=99) { $cities = [];
include_once("queue.php"); $distanceList = [];
$query = "select city,path from city"; $queue->enqueue([$from, 0]);
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$cityNum = MYDB_num_rows($result);
for($i=0; $i < $cityNum; $i++) {
$city = MYDB_fetch_array($result);
$cityPath[$city['city']] = $city['path'];
$dist[$city['city']] = 99;
}
$select = 0; while(!$queue->isEmpty()){
$queue = new Queue(20); list($cityID, $dist) = $queue->dequeue();
$queue2 = new Queue(20); if(key_exists($cityID, $cities)){
$q = $queue; continue;
$q2 = $queue2; }
$distance = $dist[$from] = 0;
$q->push($from); if(!key_exists($dist, $distanceList)){
while($q->getSize() > 0 || $q2->getSize() > 0) { $distanceList[$dist] = [];
$distance++; }
if($distance > $maxDist) return $dist; $distanceList[$dist][] = $cityID;
while($q->getSize() > 0) {
$city = $q->pop(); $cities[$cityID] = $dist;
unset($path); if($dist >= $maxDist){
$path = explode("|", $cityPath[$city]); continue;
for($i=0; $i < count($path); $i++) { }
if($dist[$path[$i]] > $distance) {
$dist[$path[$i]] = $distance; foreach(array_keys(CityConst::byID($cityID)->path) as $connCityID){
$q2->push($path[$i]); if(key_exists($connCityID, $cities)){
} continue;
} }
$queue->enqueue([$connCityID, $dist+1]);
} }
if($select == 0) {
$q2 = $queue;
$q = $queue2;
} else {
$q = $queue;
$q2 = $queue2;
}
$select = 1 - $select;
} }
return $dist; if($distForm){
unset($distanceList[0]);
return $distanceList;
}
else{
return $cities;
}
} }
function isClose($connect, $nation1, $nation2) { function isClose(int $nation1, int $nation2, bool $includeNoSupply=true) {
$isClose = 0; $db = DB::db();
// $nation1의 모든 도시
$query = "select path from city where nation='$nation1'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$citycount = MYDB_num_rows($result);
// 국가의 모든 도시 검색 $nation1Cities = [];
for($i=0; $i < $citycount; $i++) {
$city = MYDB_fetch_array($result);
// 각 도시당 모든 인접 도시 플래그 세팅 if($includeNoSupply){
$path = explode("|", $city['path']); $supplySql = '';
for($j=0; $j < count($path); $j++) { }
$barrier[$path[$j]] = 1; else{
$supplySql = 'AND supply = 1';
}
foreach($db->queryFirstColumn('SELECT city FROM city WHERE nation = %i %l', $nation1, $supplySql) as $city){
$nation1Cities[$city] = $city;
}
foreach($db->queryFirstColumn('SELECT city FROM city WHERE nation = %i %l', $nation2, $supplySql) as $city){
foreach(array_keys(CityConst::byID($city)->path) as $adjCity){
if(key_exists($adjCity, $nation1Cities)){
return true;
}
} }
} }
// $nation2의 모든 도시 선택 return false;
$query = "select city from city where nation='$nation2'";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$citycount = MYDB_num_rows($result);
for($i=0; $i < $citycount; $i++) {
$city = MYDB_fetch_array($result);
if($barrier[$city['city']] == 1) {
$isClose = 1;
}
}
return $isClose;
} }
function CharExperience($exp, $personal) { function CharExperience($exp, $personal) {
@@ -2842,7 +2610,7 @@ function CharExperience($exp, $personal) {
case 4: case 5: case 7: case 10: case 4: case 5: case 7: case 10:
$exp *= 0.9; break; $exp *= 0.9; break;
} }
$exp = round($exp); $exp = Util::round($exp);
return $exp; return $exp;
} }
@@ -2852,7 +2620,7 @@ function CharDedication($ded, $personal) {
case 10: case 10:
$ded *= 0.9; break; $ded *= 0.9; break;
} }
$ded = round($ded); $ded = Util::round($ded);
return $ded; return $ded;
} }
@@ -2899,7 +2667,11 @@ function CharCritical($rate, $personal) {
return $rate; return $rate;
} }
function TrickInjury($connect, $city, $type=0) { function SabotageInjury($city, $type=0) {
$db = DB::db();
$connect=$db->get();
$log = [];
$query = "select year,month from game limit 1"; $query = "select year,month from game limit 1";
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); $result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
$admin = MYDB_fetch_array($result); $admin = MYDB_fetch_array($result);
@@ -2917,7 +2689,7 @@ function TrickInjury($connect, $city, $type=0) {
$injury = rand() % 100; $injury = rand() % 100;
if($injury < 30) { // 부상률 30% if($injury < 30) { // 부상률 30%
$injury = floor($injury / 2) + 1; // 부상 1~16 $injury = intdiv($injury, 2) + 1; // 부상 1~16
$query = "update general set crew=crew*0.98,atmos=atmos*0.98,train=train*0.98,injury=injury+'$injury' where no='{$general['no']}'"; $query = "update general set crew=crew*0.98,atmos=atmos*0.98,train=train*0.98,injury=injury+'$injury' where no='{$general['no']}'";
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),""); MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");

Some files were not shown because too many files have changed in this diff Show More