Compare commits

..
436 Commits
Author SHA1 Message Date
Hide_D 4ca33cb007 fix: 전투 시뮬레이터 UI 깨짐 수정 2021-12-16 03:34:34 +09:00
Hide_D 96515fd16c fix: 내정보/설정에 툴팁이 해제되어있음 2021-12-16 03:23:36 +09:00
Hide_D d736e2d947 refacor: customCSS 코드 분리 2021-12-16 03:23:11 +09:00
Hide_D 7631d99ce6 game: 척사 강화. 15%p -> 20%p 2021-12-16 03:12:37 +09:00
Hide_D 6ddeed82c0 fix: 500px/1000px 모드 2차 수정 2021-12-16 02:36:50 +09:00
Hide_D ffc8242aae fix: 500px/1000px 모드 설정 2021-12-16 02:32:33 +09:00
Hide_D 2767bf70d9 feat: 내 정보/설정 페이지 반응형, 500px/1000px 설정 2021-12-16 02:26:07 +09:00
Hide_D fa7c7794d0 feat: 상/하단 돌아가기 버튼을 bootstrap으로 변경 2021-12-16 01:56:44 +09:00
Hide_D 015e9e54dc feat: 임시 500px/1000px 모드 추가 2021-12-16 01:53:23 +09:00
Hide_D 7dc9863b49 fix: 지도 옵션 버튼의 초기화 이벤트 시점이 다른 점 수정
- 항상 통제 가능한 localStorage 기준으로 변경
2021-12-16 01:24:41 +09:00
Hide_D f13960a56a game: 토너먼터 자동 참가 시, 능력치에 기반 2021-12-16 01:05:59 +09:00
Hide_D ba6370d206 fix: AI 전쟁 상태 정의를 다시. 2021-12-16 01:02:41 +09:00
Hide_D 32fd8c481a fix: 토너먼트 warning 제거 2021-12-15 22:27:37 +09:00
Hide_D e9264e6f13 scenario: 애니집결 업데이트 2021-12-15 20:10:04 +09:00
Hide_D 93e6a056d4 game: 저격 버프, 견고 효과 중 저격,필살 너프
- 저격 성공시 증가하는 사기량 증가
  - 전특만, 몇몇 유니크 제외
- 저격이 성벽에도 발동
  - 사기 상승만 추가, 성벽 너프 없음
- 견고 효과 변경
  - 필살 무효 -> 필살 확률 20% 감소
  - 저격 무효 -> 저격은 받지만 부상 무효
2021-12-15 16:34:07 +09:00
Hide_D 3610f2cbd4 fix: 기본 DummyGeneral에 NPC 타입 3번 부여 2021-12-15 12:01:50 +09:00
Hide_D 0c51544e2e fix: 베팅 결과에서 실제 장수가 아닌 총합(0번)을 가져오는 버그 수정 2021-12-15 12:00:54 +09:00
Hide_D 8f1f477054 fix: mergeQueryColumn의 기본 값에 npc 추가 2021-12-15 11:57:45 +09:00
Hide_D 0b72925f09 fix: 토너먼트 값에서 npc를 안받아옴 2021-12-15 09:09:35 +09:00
Hide_D 9fb477facc game: NPC국이 접경이 사라져도 5개월가량은 기다림 2021-12-15 03:34:49 +09:00
Hide_D 3c474e5551 game: 반환은 4개월 이전에도 이루어지도록 수정 2021-12-15 03:19:02 +09:00
Hide_D 9217f0aaf5 game: 시작한지 4개월째부터 유산으로 유니그 획득 가능 2021-12-15 03:13:24 +09:00
Hide_D dddf4ccf6e build: webpack 캐시를 버전이 바뀌어도 계속 사용하도록 설정 2021-12-15 02:28:47 +09:00
Hide_D 4de010cb1e fix: 빙의 장수의 유산 포인트 적용 문제 수정
- 빙의장의 유산 포인트가 천통시엔 미적용.
- NPC 시절 베팅 결과가 반영되는 오류
  - 베팅횟수+0, 베팅성공+1, 베팅금액+ 문제
2021-12-15 02:15:38 +09:00
Hide_D d2ed7a4a80 Merge pull request 'feat: webpack 빌드 통일, TipTap 에디터 적용' (#201) from unifyBuildPath into devel
Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/201
2021-12-14 02:24:17 +09:00
Hide_D 311d5c42a8 fix: 메인페이지, 임관권유 페이지에 적용 2021-12-14 02:05:59 +09:00
Hide_D 3c6a884663 feat: TipTap 이미지 적용 2021-12-14 02:03:05 +09:00
Hide_D 1bfd0018b1 feat(WIP): tiptap 에디터 기능 구현 2021-12-13 21:45:49 +09:00
Hide_D 2c3a9b93c7 feat(WIP): 새 에디터 2021-12-13 03:24:14 +09:00
Hide_D 0961220fdd feat: 국방, 임관메시지 에디터에 TipTap 적용 2021-12-13 02:03:54 +09:00
Hide_D c8b2f28c7c build: esbuild-loader에서 es2021 2021-12-12 21:55:20 +09:00
Hide_D 3f7cc163ec refac: vue 파일 구조 변경 2021-12-12 21:48:48 +09:00
Hide_D 8ede84c176 build(WIP): printDist를 모든 코드에 적용
- 현재 summernote 미작동
2021-12-12 19:26:27 +09:00
Hide_D 6a7f62f2c2 build(WIP): php단에서 변경된 dist_js에 맞게 js,css 로드
- fix: webpack 출력물 문제
- webpack splitChunks 파일 통일
2021-12-12 16:33:20 +09:00
Hide_D 0b82024caa fix: 에러 없이 emit 된 경우에만 빌드 완료 표지 출력 2021-12-12 15:28:52 +09:00
Hide_D fd057ebb05 build(WIP): 빌드 결과물을 서버 주소에 관계없이 통일 2021-12-12 13:52:55 +09:00
Hide_D 47e6958446 feat: 글꼴 속성 시험 적용 2021-12-12 12:53:50 +09:00
Hide_D 690fe46931 fix: 추가 수정 2021-12-11 23:22:12 +09:00
Hide_D 10ec7b55d0 fix: 등용 수락이 불가능한 버그 수정 2021-12-11 23:20:32 +09:00
Hide_D 5079db5ceb fix: showErrorLog 페이지 디스플레이 수정 2021-12-11 23:10:34 +09:00
Hide_D dd4f664724 fix: 유산 포인트 반영시 ownerID가 아니라 generalID 를 사용하는 버그 2021-12-11 22:56:08 +09:00
Hide_D 932e8ca093 fix: 상단 버튼 안되는 버그 수정 2021-12-11 14:05:06 +09:00
Hide_D 193e6eb9ca fix: 메인페이지 갱신 버튼이 일부만 동작하는 버그 2021-12-11 13:52:00 +09:00
Hide_D e28b878a68 fix: 베팅에 사용할 값을 가져오지 못하는 버그 수정 2021-12-11 13:19:46 +09:00
Hide_D 4d6f64cf96 build: 약간 변경 2021-12-11 12:44:51 +09:00
Hide_D 6441fc09e4 misc: scss 파일 정리 2021-12-11 12:12:16 +09:00
Hide_D d8c54b4632 fix: main 페이지가 vue로 통합되었으므로 printCSS 변경 2021-12-11 11:55:17 +09:00
Hide_D a8f2c9787d misc: main의 외부 초기화 코드를 내부로 이동 2021-12-11 11:52:02 +09:00
Hide_D dfb10c1b44 fix: initTooltip과 bootstrap-vue-3 충돌 문제 해결
- 기타 data-bs 안붙은거 마저 수정
2021-12-11 11:37:41 +09:00
Hide_D 95bd5b539f fix(WIP): bootstrap4 잔여 코드 수정 중
- 이상하게도 ingame에서 bootstrap이 충돌 중
2021-12-11 04:45:39 +09:00
Hide_D c811a56557 fix: 비급 위압이 갱신된 위압을 따르지 않음 2021-12-11 03:31:09 +09:00
Hide_D 5892ddcad8 misc: 줄어튼 선택기에 맞게 갱신버튼 이동 2021-12-11 03:30:01 +09:00
Hide_D 111a81766e misc: bootstrap4 toast 사용코드 제거 2021-12-11 03:21:47 +09:00
Hide_D 5819045a01 misc: 여백을 위해 ReservedCommand 16->15 2021-12-11 02:57:32 +09:00
Hide_D b8f19e11ff Merge pull request 'refactor: bootstrap4 => bootstrap5' (#200) from no_bootstrap4 into devel
Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/200
2021-12-11 02:53:55 +09:00
Hide_D d3c73579d9 refactor: goodbye bootstrap4 2021-12-11 02:50:24 +09:00
Hide_D 5f001ee091 fix: bootstrap5 modal 2021-12-11 00:30:01 +09:00
Hide_D 741c67c7cb fix: bootstrap5 modal 2021-12-11 00:28:59 +09:00
Hide_D 9456406009 fix: login에서 modal을 Bootstrap5 Modal로 2021-12-11 00:20:11 +09:00
Hide_D 8464f96e40 refactor: common_ts 분리 후 일괄 로드 2021-12-11 00:07:59 +09:00
Hide_D 3c23e0fb93 fix: webpack image.ext revert 2021-12-10 23:33:39 +09:00
Hide_D 18807a642a fix: 앞선 refactor에서 경로 문제 수정 2021-12-10 23:12:35 +09:00
Hide_D 975f77e907 refactor: 상대경로를 @ 시작 절대경로로 2021-12-10 22:34:14 +09:00
Hide_D bd42042a61 refactor(WIP): scss, ts 공통 파일 묶기 2021-12-10 21:45:02 +09:00
Hide_D 9134a7d9f6 fix: lint error fix 2021-12-10 02:55:53 +09:00
Hide_D 53d65c31db dep: update packages 2021-12-10 02:53:12 +09:00
Hide_D 612f15ebad feat(WIP): gateway bootstrap 호출 제거 진행
- 메인페이지 미동작
2021-12-10 02:47:10 +09:00
Hide_D 33378c96ec dep: 이전 버전들과의 호환성을 위해 bootstrap5 명명 유지 2021-12-10 02:28:13 +09:00
Hide_D 703e2f51be feat(WIP): bootstrap 5 tooltip 적용
- bootstrap4 용의 popper.js 제거
- jquery기반 bootstrap tooltip 제거
2021-12-10 02:26:08 +09:00
Hide_D 7d8fa7f1c4 dep(WIP): bootstrap4 1차 제거 2021-12-10 02:02:38 +09:00
Hide_D 62089ef2c2 fix: 수비자 숙련 변경 2021-12-09 23:58:57 +09:00
Hide_D 1d946aa525 game: 수비자의 상대 병종을 0에서 0.1로 변경, 공격자 대비로는 10% 2021-12-09 01:59:04 +09:00
Hide_D 19b62a632b game: 궁병 회피 살짝 너프 2021-12-09 01:32:17 +09:00
Hide_D cbd5b7fc5e game: 백이병 추가
- 성도 특수 병종
- 숨겨진 상성 수치
2021-12-09 01:00:27 +09:00
Hide_D 58673fb385 feat: (예약)plock을 세부 구분할 예정 2021-12-09 00:51:10 +09:00
Hide_D 26ea6a6c69 fix: KVStorage의 기본 상태가 turnOnCache가 아니었던 점 수정 2021-12-09 00:36:15 +09:00
Hide_D 1727d34853 game: 빙의장도 유산 획득이 가능하도록 수정
- 유산 실 반영 시점을 은퇴, 천통 시점으로 변경
2021-12-09 00:26:47 +09:00
Hide_D fc3b854add fix: 빙의가 불가능한 버그 수정 2021-12-09 00:01:20 +09:00
Hide_D dba8e5d699 feat: 턴 선택기 실행 후 초기화시, 이전 턴 기억 2021-12-08 21:22:52 +09:00
Hide_D f3df6f7202 feat: 검색 모드 켬/끔 추가 2021-12-08 21:01:16 +09:00
Hide_D 3cbf1eba30 fix: AI 유저장 포상 버그 수정 2021-12-08 01:54:00 +09:00
Hide_D 4623cfbe06 fix: webp가 업로드 가능하나, 메시지 표기가 누락된 버그 수정 2021-12-08 01:38:23 +09:00
Hide_D d4d8e0045b misc: 턴 선택기에 기본턴 선택. 다른 턴 선택시 무효화. 2021-12-08 01:36:59 +09:00
Hide_D ea4f1643d4 misc: 하단 바 세부 항목 크기 확대 2021-12-08 01:31:34 +09:00
Hide_D 5a2ea3496e misc: 턴 입력이 아무것도 없으면 1턴 2021-12-08 01:23:58 +09:00
Hide_D 6dd77dd632 misc: 하단 바, type2 버튼에 밑줄 2021-12-08 01:19:29 +09:00
Hide_D d4279b0cb7 misc: 턴선택이 없을 경우 안내 2021-12-08 01:12:03 +09:00
Hide_D 601222a60d misc: 턴선택기 기본값을 무효화. 2021-12-08 01:11:14 +09:00
Hide_D 9c541735b7 fix: initial-scale=1 제거 2021-12-08 01:06:56 +09:00
Hide_D 858f7139ff fix: 구 sidebar 코드 제거 2021-12-08 01:01:25 +09:00
Hide_D a326ad3c66 fix: 풀모드 메시지함 grid 깨짐 수정 2021-12-08 00:55:54 +09:00
Hide_D 33751a06fe feat: 스마트폰용 하단 바 구현, 버튼 템플릿 변경 2021-12-08 00:24:40 +09:00
Hide_D 8cbe92ca46 fix: anchor 이동에서 #을 남기지 않도록 2021-12-07 02:27:42 +09:00
Hide_D 5587a358ce feat: 초성 검색에서 '알파벳' 대신 검색 추가 2021-12-07 02:03:10 +09:00
Hide_D 40b52dd517 fix: auto500px 가로모드 미설정 버그 수정 2021-12-07 01:54:22 +09:00
Hide_D 5424869d8e Revert "misc: auto500px 필요없음."
This reverts commit 2b5f38ca52.
2021-12-07 01:44:36 +09:00
Hide_D 68a2534d1b misc: auto500px 필요없음. 2021-12-07 01:38:26 +09:00
Hide_D 1699190334 misc: 스마트폰 모드에서 '명령으로' 추가 2021-12-07 01:22:09 +09:00
Hide_D d86d96acc1 misc: 초기 스마트폰 크기 관련 수정 2021-12-07 01:19:38 +09:00
Hide_D f70dbf9cf3 fix: 12px -> 12.5px 2021-12-07 01:01:39 +09:00
Hide_D 33a1681536 fix: font 정렬, 전체선택->턴 선택 2021-12-07 00:51:20 +09:00
Hide_D fcb8da95ca misc: 기본 글꼴 크기를13px -> 14px 2021-12-07 00:37:23 +09:00
Hide_D e8148ab4dc misc,dep: 기본 글꼴을 Pretendard로 일괄 적용용 2021-12-07 00:27:50 +09:00
Hide_D c14f06615e fix: 하단 버튼이 container 밖으로 벗어나는 문제 수정 2021-12-05 23:58:06 +09:00
Hide_D 1c0b28eacd game: 랜덤 임관 밸런스 수정 2021-12-05 23:47:56 +09:00
Hide_D d317a84b09 feat: 턴 선택기에 복합 커맨드 선택 적용 (#199)
- vue-multiselect 기반
- 초성 검색
- 이득, 불리 표기
- 불가 표기
- 선택후 단축 표기

Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/199
Co-authored-by: hide_d <hided62@gmail.com>
Co-committed-by: hide_d <hided62@gmail.com>
2021-12-05 23:02:27 +09:00
Hide_D 3972cf0194 fix: summernote 최신 버전에서 jQuery require 우회 2021-12-05 03:32:48 +09:00
Hide_D 6d408ac2b1 dep: vue-select 4.0 추가가 2021-12-04 14:11:37 +09:00
Hide_D 8338f8aaa0 misc: 턴선택기에서 모두 선택, 당기기, 미루기 위치 조절절 2021-12-04 13:49:59 +09:00
Hide_D fbd0561420 refac: 500px 모드 변환기 분리 2021-12-04 11:42:26 +09:00
Hide_D de854cc02c misc: 턴선택기 실행버튼 크기 50% 증가 2021-12-04 11:12:42 +09:00
Hide_D 822e161e2e misc: 500px 레이아웃 순서 변경 2021-12-04 02:11:59 +09:00
Hide_D b60bf9fdf9 fix: float-tabs가 sticky보다 아래에 오는 버그 수정 2021-12-04 01:13:50 +09:00
Hide_D 14b0a043d4 feat: 500px 모드에서, 메시지 입력기가 메시지창을 쫓아감 2021-12-04 01:07:05 +09:00
Hide_D a2f5d66597 misc: 500px 레이아웃 구성 변경 2021-12-04 00:42:51 +09:00
Hide_D c02bc26799 misc: 갱신/로비로 버튼 위치 이동 2021-12-04 00:10:41 +09:00
Hide_D 932afec74a fix: buttonPlate에 gap 추가 2021-12-03 23:44:55 +09:00
Hide_D 3da67e7d97 fix: 사령부 ajax 모드 2021-12-03 16:03:02 +09:00
Hide_D 0c95b958aa feat: 메인페이지 화면비 자동 조정 2021-12-03 16:00:38 +09:00
Hide_D 8895ac329a fix: 메인 화면 오동작 요소 수정
- 설문조사 항목 표기
- 설문조사 항목 marquee로 틀어짐(제거)
- 1000xp 모드에서 도시 툴팁 가려지는 문제 수정정
2021-12-03 15:26:45 +09:00
Hide_D cf0416e976 fix: nation color-code #330000 2021-12-03 02:18:13 +09:00
Hide_D f8f3e4d9e8 feat: 500px 모드 나머지 최적화 2021-12-03 02:07:34 +09:00
Hide_D d6bee9aa6d fix: 메인 페이지, 장수 동향, 개인 기록, 중원 정세 띠 2021-12-03 00:18:18 +09:00
Hide_D 2d5e99a0d6 feat: 500xp 모드에서 오른쪽 고속 이동 툴바 2021-12-03 00:14:22 +09:00
Hide_D 97b71347a6 fix: 500px 모드를 확실하게 명시 2021-12-02 22:01:29 +09:00
Hide_D 10e3a0814f misc: 메시지 받아오는 갯수 감소 2021-12-02 21:41:33 +09:00
Hide_D f909df204a fix: .toolbarButton2 2021-11-30 02:00:35 +09:00
Hide_D 661e6cc5da misc: ReservedCommand 색을 약간 수정
- 딱히 어룰린다는 느낌은 여전히 없다.
2021-11-30 01:58:42 +09:00
Hide_D b2b911ec81 fix: 메인페이지 '이전 메시지 불러오기'를 전체 너비로 2021-11-30 01:44:02 +09:00
Hide_D f238077944 fix: 메인 페이지 시나리오 표기, 줄 바꿈 2021-11-30 01:40:49 +09:00
Hide_D 3c930dacb8 feat: 나머지 메인 버튼도 lumen 버튼으로 통일 2021-11-30 01:38:07 +09:00
Hide_D 6dcb46c0b8 feat: commandButton을 lumen 버튼으로 2021-11-30 01:09:37 +09:00
Hide_D 27c7a5a3ad feat: 국가별 색 버튼을 lumen button profile에 맞춰 작성 2021-11-30 00:54:08 +09:00
Hide_D 846bdfdc88 feat(in-progress): 턴선택기 연월에 select, 강조 표기 2021-11-29 01:19:25 +09:00
Hide_D a2026cb3fd feat(in-progress): 턴 선택기에서 select와 toggle 분리 2021-11-29 01:17:36 +09:00
Hide_D 06fa539293 feat(in-progress): 커맨드 목록 UI/UX 정리 2021-11-29 01:00:52 +09:00
Hide_D 752f69d3ef misc: common.css를 bootstrap5를 포함한 css로 변경 2021-11-28 23:09:37 +09:00
Hide_D 897997b8ac feat: 메인화면의 도시정보를 500px, 700px 가변 2021-11-28 22:22:52 +09:00
Hide_D 526fa11c20 fix: 500px 지도모드에서 tooltip 위치 조정 2021-11-28 19:24:31 +09:00
Hide_D 8eda98ff4c feat(in-progress): 메인메뉴 지도를 500px 모드에 맞게 수정 2021-11-28 18:54:37 +09:00
Hide_D 99d7a26b98 dep: bootstrap5 custom 조합 darkly + lumen 2021-11-28 18:03:18 +09:00
Hide_D 0aaadf9536 feat: 턴 선택기를 vue 기반으로 변경 2021-11-28 01:57:46 +09:00
Hide_D 9adcbecce4 feat(in-progress): 턴 조작기를 vue로 분리 2021-11-27 15:40:31 +09:00
Hide_D 6605a84f2c dep: bootstrap 2021-11-27 15:40:00 +09:00
Hide_D 6c9510d8f4 fix(in-progress): viewport width를 500으로 진행하기로 2021-11-27 02:15:39 +09:00
Hide_D 03a62dc23f fix(in-progress): viewport width를 360px 폰에서 맞게 수정 2021-11-27 02:10:08 +09:00
Hide_D 93efacbef5 feat(in-progress): 메인페이지 기본 반응형 전환.
- full, half 모드
2021-11-27 01:53:00 +09:00
Hide_D b6b28de8e2 feat(in-progress): 메인 페이지에서 table 제거 2021-11-26 21:40:55 +09:00
Hide_D faaed40b39 fix: 비쟁장에 쟁장 공식이 섞여서, 최소 포상 금쌀이 꼬이는 문제 수정 2021-11-26 19:53:12 +09:00
Hide_D 6b035f64d2 fix: branch 못 알아낸 건 unknown으로 하기 2021-11-26 19:11:50 +09:00
Hide_D 9f049dcb18 fix: branch 가져오는 표기법 다시 수정 2021-11-26 19:05:59 +09:00
Hide_D 0141449e4f fix: git ignore 빠진부분 수정정 2021-11-26 19:03:34 +09:00
Hide_D 4ce49f259d fix: origin branch를 제대로 파싱하지 못하는 버그 수정 2021-11-26 18:56:04 +09:00
Hide_D 0f35569e05 fix: 삭제된 기능인 '폐쇄중 로그인'을 UI에서도 제거 2021-11-26 18:48:00 +09:00
Hide_D 1c4dabed72 feat: 버전 표기에 branch명 같이 표기 2021-11-26 18:44:18 +09:00
Hide_D 38114c0639 game: 수비자 피살 숙련도 0, 사살 숙련도 0.9->0.8 2021-11-26 17:42:50 +09:00
Hide_D 527c8370f1 fix: 권한 없는 유저가 수락 버튼을 누를 시, 아예 메시지가 사라지는 버그 수정 2021-11-20 14:00:01 +09:00
Hide_D 6a9a57e2bc fix: '최소 전투 가능 병력 수'를 매우 높여 출병 금지가 가능한 문제 수정 2021-11-20 00:37:07 +09:00
Hide_D 7b6f1b510e feat: 전쟁 금지/허가 여부 횟수 제한 부활 2021-11-19 23:43:00 +09:00
Hide_D 94bc7547d6 game: 출병은 일반내정보다 먼저여야함 2021-11-19 23:10:32 +09:00
Hide_D 5a4552aaff fix: 방어력 증가 세팅이 잘못됨. 2021-11-17 23:08:57 +09:00
Hide_D 06e314d301 game: 보병 수비시 방어력 5% 증가 2021-11-17 23:00:40 +09:00
Hide_D 8bead301ef game: NPC 베팅 판돈 스케일 증가가 2021-11-16 23:45:33 +09:00
Hide_D 6282445f7d feat: 토너먼트 베팅에서 모든 NPC가 10원씩 베팅함
- 추가로 베팅 공지
2021-11-16 23:12:32 +09:00
Hide_D bf244533f7 game: 국력, 랜임 계산식에서 유저장 전투력 계수를 NPC의 1.5로 설정 2021-11-16 22:40:47 +09:00
Hide_D 5ebfaf24ee feat: 토너먼트 비중을 강제로 조정 2021-11-16 22:18:29 +09:00
Hide_D 0c0283dc02 feat: '능동 행동 수' 유산 포인트 추가
- 거병, 건국, 방량, 선양, 모반
- 임관, 랜덤임관, 장수대상임관, 등용수락, 하야
- 출병(500명 이상, 훈사 7070 초과)
- 인재탐색 성공(난도에 따라 추가 보정)
- 첩보(예외, 0.5)
- 증축, 감축, 국기변경, 국호변경, 천도성공
2021-11-16 21:38:55 +09:00
Hide_D 375b08be87 feat: NPC정책 최대 포상량 지정 2021-11-16 20:45:16 +09:00
Hide_D cbc8f94b0a game: 국고가 2000 밑으로 가더라도 무조건 물자조달만 하지는 않게 수정정 2021-11-16 20:01:50 +09:00
Hide_D bdac8d163d game: 전특 요구 포인트 감소, 버프 요구 포인트 감소 2021-11-16 19:37:16 +09:00
Hide_D 1f61f37841 fix: 토큰 갱신 시 UserID가 잘못된 버그 수정정 2021-11-14 22:55:37 +09:00
Hide_D 51d523ae72 game: 국력 계산식에 랜덤임관 계산식 일부를 반영 2021-11-14 18:45:28 +09:00
Hide_D 3f9e4962e6 fix: 서버 정지로 의심되는 opcache_reset 해제
- 현재 validate timestamp를 켜서 사용하도록 유도
2021-11-14 13:31:30 +09:00
Hide_D f8fc4fe56b misc: 미활용 함수/상수 제거 2021-11-14 13:20:19 +09:00
Hide_D fb64b7e412 feat: NPC 거병, 이동 로직 대폭 개선
- 근처에 세울 도시를 보고 거병
- 원하는 도시를 정하고 그 도시를 향해 이동
2021-11-14 05:06:39 +09:00
Hide_D 3209cfbc45 fix: warning 제거거 2021-11-14 04:15:04 +09:00
Hide_D 8a99476136 game: 랜덤임관 평가 기준 변경
- 전투 기준을 총 전투 대신 대인 전투로
- 내정 능력에 무력, 지력 비율 반영영
2021-11-14 02:51:40 +09:00
Hide_D eb80f8d111 feat: 자율행동 표기를 휴식(자율행동)으로 변경 2021-11-14 02:47:53 +09:00
Hide_D afde3ce54d game: 랜덤임관 가중치 변경 2021-11-14 02:39:09 +09:00
Hide_D c4b61fec17 game: 작위 보상에도 최대 보유 유니크 수 적용 2021-11-14 00:50:09 +09:00
Hide_D 0b74abf300 game: 랜덤임관 로직에 전투력과 내정능력을 적극적으로 반영영 2021-11-14 00:46:46 +09:00
Hide_D e6c3c9f1d4 fix: 자율턴에서 '월' 표기 빠짐 2021-11-13 16:48:49 +09:00
Hide_D 4e7560b4ed feat: 자율행동 휴식을 명시적으로 자율행동으로 표기 2021-11-13 16:37:47 +09:00
Hide_D 542491b278 feat: 자율턴 한계 표기 2021-11-13 16:33:11 +09:00
Hide_D d36439355d fix: 자율행동턴 시간 제한이 동작하지 않던 버그 수정 2021-11-13 16:05:03 +09:00
Hide_D 4a80815b39 game: 기간별 최대 유니크 획득 수 변경경 2021-11-13 02:25:52 +09:00
Hide_D 6dc57f2566 fix: 자동로그인 과정 버그 수정정 2021-11-11 00:37:29 +09:00
Hide_D 07e8511ce1 game: snipe_combat 제거거 2021-11-08 23:31:56 +09:00
Hide_D 8e927831f5 fix: dummySession 인자 수정정 2021-11-08 23:27:37 +09:00
Hide_D 2c533d2ab3 dep: package update 2021-11-08 16:10:01 +09:00
Hide_D 38208750e7 game: 수비자는 전멸 시 증가하는 사기량을 50%만 적용 2021-11-08 15:20:23 +09:00
Hide_D df14d7c306 game: 반계 효과 유니크 시도 확률 반감 2021-11-08 15:16:15 +09:00
Hide_D b3612db7d2 game: 피장파장 턴을 60턴 기준으로 변경(72턴 동일) 2021-11-08 15:11:24 +09:00
Hide_D 8d90da659e game: 피장파장 딜레이를 최소 72턴으로로 2021-11-08 15:10:45 +09:00
Hide_D f8ddbc0622 game: 종횡가 전략 딜레이를 1/2에서 3/4으로로 2021-11-08 15:08:21 +09:00
Hide_D 673b7054aa 자동 로그인 (#196)
자동 로그인 구현

- login_token 테이블
- reqNonce -> loginByToken
- sha512(token + nonce)

Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/196
Co-authored-by: hide_d <hided62@gmail.com>
Co-committed-by: hide_d <hided62@gmail.com>
2021-11-08 04:23:07 +09:00
Hide_D 1472cbf257 game: 장비매매 시 도구 유니크 덮어지지 않게 2021-10-29 02:21:53 +09:00
Hide_D d806935c58 fix: 작위 보상이 군주인 경우 반영이 안되는 버그 수정 2021-10-27 02:04:10 +09:00
Hide_D 6b56eb79e1 fix: 403 페이지 redirect 버그 수정 2021-10-27 01:29:19 +09:00
Hide_D d2aea16744 balance: 초기 +5%, -2% 추가가 2021-10-16 21:50:41 +09:00
Hide_D bb800f032e balance: 쌍무쌍 적용 불가, 무쌍 중반 이후 대폭 너프프 2021-10-16 21:22:28 +09:00
Hide_D 64b9f9443e fix: 랜덤 임관 비중 계산식에서 u장 포함 2021-10-14 02:01:12 +09:00
Hide_D fd2d3a0e06 fix: 창 닫기가 필요한 창은 window.open으로 열어야함 2021-10-14 01:12:21 +09:00
Hide_D 08d678bdb8 fix: CreateManyNPC에서 npcCount가 0이면 fillCnt가 무시 2021-10-14 00:37:08 +09:00
Hide_D 418007e572 balance: 초반 NPC 생성 시 모든 국가를 채울 수 있을 정도로는 제공 2021-10-14 00:36:06 +09:00
Hide_D 4a1bccdf75 balance: 탈취량을 도시 내정치에 기반하도록 변경 2021-10-14 00:16:44 +09:00
Hide_D 00c0b59e9d balance: 랜임 시 의병장, 집합장 카운트는 제외 2021-10-13 02:05:04 +09:00
Hide_D ac82c8ff0b fix(misc): 상대가 치료시 '붉게' 표기 2021-10-13 02:01:41 +09:00
Hide_D f4bef8a090 fix: 인탐, 의병에서 숙련도가 지정되지 않는 버그 수정 2021-10-13 01:56:06 +09:00
Hide_D d8a1055bff fix: DummyGeneral에 유산 관련 포인트 함수가 누락된 부분 수정 2021-10-12 02:25:24 +09:00
Hide_D d672ce4d80 fix: set_error_handler를 못잡는 문제 해결
기타 소소한 버그
- 피장파장 입력시 warning을 계속 일으키는 버그(동작 문제는 없음)
- 토너먼트에서 승리,패배,무승부 외에 MustNotBeReachedException이 throw되지 않음(동작 문제는 없음)
2021-10-12 01:43:54 +09:00
Hide_D 43ec361d03 dep: update phan 2021-10-12 01:36:02 +09:00
Hide_D c3c99c5f76 fix: 공격자 전투력 판정 문제 수정 2021-10-12 01:31:16 +09:00
Hide_D eb1e1421ab fix(misc): phan 2021-10-12 01:30:37 +09:00
Hide_D e8a1d87919 Merge pull request 'balance: 무쌍 너프, NPC 출병 금지 불가' (#195) from balance_210923 into devel
Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/195
2021-10-10 13:30:01 +09:00
Hide_D 921ba6811d balance: 무쌍 너프, NPC 출병 금지 불가 2021-09-23 03:59:08 +09:00
Hide_D 906dd241b4 fix: RootDB template 2021-09-23 03:08:49 +09:00
Hide_D 3f0cd2ad64 fix: illuminate 2021-09-21 03:13:07 +09:00
Hide_D 41420d1954 Illuminate: ready. (critical)
- DB에서 illuminate를 가져올 수 있도록 설정
- 업그레이듵 불가, RootDB, DB를 직접 수정해야함
2021-09-21 03:06:42 +09:00
Hide_D 6e5a72b170 fix: 자동 사령턴 조정이 되지 않는 버그 2021-09-19 15:44:49 +09:00
Hide_D 4b19e6aec8 fix: 명예의 전당 검색 2021-09-19 13:38:40 +09:00
Hide_D 58572cbc36 scenario: 쿠키런 킹덤 임시 구현 2021-09-19 03:03:05 +09:00
Hide_D 096d5766bf conf: vue-style-loader에 esbuild-loader적용 2021-09-18 04:53:26 +09:00
Hide_D f5c5b56492 dep: babel-loader + ts-loader => esbuild-loader 2021-09-18 04:31:31 +09:00
Hide_D 69c69d63e6 dep: package upgrade 2021-09-18 03:52:27 +09:00
Hide_D 3fd8b21867 misc: lint warning, 불필요 파일 정리 2021-09-18 03:49:04 +09:00
Hide_D 8660e8cd85 fix: NPC포상 설정 메시지 수정 2021-09-18 03:42:20 +09:00
Hide_D 8458f725f2 fix: 사망 시 유산 포인트 관련 환불/초기화가 없는 문제 2021-09-18 03:36:08 +09:00
Hide_D 366678c965 fix: 장수 생성창 보이기/숨기기, 턴 시간 고정 표기 수정 2021-09-18 02:49:47 +09:00
Hide_D 336b5668db fix & inheritAction: 랜덤 유니크 습득시 환불 가능하게 수정 2021-09-18 00:15:00 +09:00
Hide_D 55886269ea inheritAction: 설문조사에서는 특정 유니크 구입 기능 해제 2021-09-18 00:06:20 +09:00
Hide_D 0b3698595b fix: hash -> gitHash 2021-09-17 23:40:47 +09:00
Hide_D 05e43a39db fix: 턴 초기화, 전특 초기화 표기 방식 변경 2021-09-17 23:37:53 +09:00
Hide_D 5737ad3db2 fix: 턴 초기화, 특기 초기화 포인트 안내가 1스텝 늦음 2021-09-17 23:34:33 +09:00
Hide_D 4ac174eb9a fix: 반계시도에는 구분 코드가 동작하지 않았음 2021-09-17 23:17:13 +09:00
Hide_D 895eec10b4 fix: 비급 반계가 전특 반계와 같이 동작하지 않는 버그 수정 2021-09-17 23:07:45 +09:00
Hide_D e0d891e89a fix: 재야일 때에는 임관 년도 증가하지 않도록 2021-09-17 03:14:14 +09:00
Hide_D adf7734b85 fix: 생성하자마자 임관 1년차로 나오는 문제 수정 2021-09-17 03:12:38 +09:00
Hide_D 5362be9c21 inheritPoint: 로그 기록 2021-09-17 02:39:11 +09:00
Hide_D 847ece52f2 fix: summernote.css 2021-09-16 22:39:19 +09:00
Hide_D 851c59d22c fix: 유저전투장 긴급포상 쌀 2021-09-16 22:37:31 +09:00
Hide_D 0669534bba fix: 궁 유니크 저격 계수 2021-09-16 22:24:29 +09:00
Hide_D 05db47e62a fix: 설문조사에서 환불 불가능한 문제 수정 2021-09-16 22:06:57 +09:00
Hide_D 4a0e608d1c fix: itemTrials 삭제 후 통째로 array가 비면 array도 마저 삭제 2021-09-16 22:00:35 +09:00
Hide_D 45fe73af86 fix: eventColumn에 aux 추가 2021-09-16 21:47:32 +09:00
Hide_D 4d9fcd657f fix: vote에서 aux 2021-09-16 21:43:37 +09:00
Hide_D a057deb0fe fix: 유니크를 얻는 턴이 아니더라도 환불은 하도록 수정 2021-09-16 21:38:43 +09:00
Hide_D 4766210a7d 랜임 실패시 실행 턴. 요양 -> 인탐 2021-09-16 21:24:52 +09:00
Hide_D fd26aae6d3 schema 변경 2021-09-16 04:13:34 +09:00
Hide_DandGitea c5c092cc8e Join: 양식 일부 수정 2021-09-15 19:06:15 +00:00
Hide_DandGitea 58c0a21d90 fix: 턴 시간 변경 코드 2021-09-15 19:06:15 +00:00
Hide_DandGitea 8dc567f966 fix: LazyVarUpdate unset 2021-09-15 19:06:15 +00:00
Hide_DandGitea 942b2752f5 fix: previous inheritPoint 지정값 버그 2021-09-15 19:06:15 +00:00
Hide_DandGitea b9259353f4 misc: layout 2021-09-15 19:06:15 +00:00
Hide_DandGitea 86c614dd40 inheritAction: UI 1차 완성 2021-09-15 19:06:15 +00:00
Hide_DandGitea 1a010a16a9 miisc: 간격 조절 2021-09-15 19:06:15 +00:00
Hide_DandGitea d5b5726b1e InheritAction: UI 턴 초기화, 전투 특기 초기화, 랜덤 유니크
- 턴 초기화에 버그가 있는듯?
2021-09-15 19:06:15 +00:00
Hide_DandGitea d06f3b6bdf inheritStore: 버프/디버프 구매 UI 2021-09-15 19:06:15 +00:00
Hide_DandGitea 97a28f716c inheritAction: 특정 전특 획득 2021-09-15 19:06:15 +00:00
Hide_DandGitea f54bdfcea0 Inherit: Action 완료? 2021-09-15 19:06:15 +00:00
Hide_DandGitea 5958c4b0ba InheritAction: 유니크 입찰, 랜덤 아이템 2021-09-15 19:06:15 +00:00
Hide_DandGitea 7c3db881c7 dep: bootstrap-vue-3 추가
- 아직 없는 기능이 많으므로 단순 출력은 CoreUI Vue 동시 활용
- 불편..
2021-09-15 19:06:15 +00:00
Hide_DandGitea 51ee2e1b2c misc: License 2021-09-15 19:06:15 +00:00
Hide_DandGitea baa813004b fix: 메인페이지 지도를 반응형으로 2021-09-15 19:06:15 +00:00
Hide_DandGitea 86b5269d3d inheritPoint: 가입폼
- 기본 동작
- 턴시간에는 버그 있음
2021-09-15 19:06:15 +00:00
Hide_DandGitea 860e6dacac vue: join 생성 완료 메시지 2021-09-15 19:06:15 +00:00
Hide_DandGitea 22025bd89e vue: join 2021-09-15 19:06:15 +00:00
Hide_DandGitea ed9301455d fix: inheritSkill 연산을 위해 aux 필요 2021-09-15 19:06:15 +00:00
Hide_DandGitea 35df84e059 fix: maxPhase 연산에서는 oppose가 없음 2021-09-15 19:06:15 +00:00
Hide_DandGitea 62deebf310 fix: inheritUnique 처리 수정 2021-09-15 19:06:15 +00:00
Hide_DandGitea 7ed4bd5c01 build: join 페이지 준비 2021-09-15 19:06:15 +00:00
Hide_DandGitea c8eb9332b4 misc: 오타 수정 2021-09-15 19:06:15 +00:00
Hide_DandGitea 1df55f9168 api: gateway, ingame 모두 가능하도록 변경 2021-09-15 19:06:15 +00:00
Hide_DandGitea b726c6aa96 유산 포인트로 랜덤 유니크 획득 2021-09-15 19:06:15 +00:00
Hide_DandGitea 0a71962652 balance: 아이템 습득 확률 조정
- 아이템을 소유할 수록, 획득 확률이 기존보다 훨씬 더 낮아진다.
2021-09-15 19:06:15 +00:00
Hide_DandGitea 160946ef74 feat: 아이템 유산포인트로 입찰한 경우 최종적으로 얻는 기능 추가 2021-09-15 19:06:15 +00:00
Hide_DandGitea 1dc67317dc balance: 유니크 아이템을 얻을 수 있는 커맨드 증가
- 강행, 거병, 견문, 군량매매, 귀환, 등용, 물자조달, 이동, 장비매매, 증여, 헌납
2021-09-15 19:06:15 +00:00
Hide_DandGitea 08f4a2e8bf feat: TriggerInheritBuff 구현 2021-09-15 19:06:15 +00:00
Hide_DandGitea 11ffdaa8f7 feat: '계략약화' 특성을 onCalcOpposeStat으로 이동 2021-09-15 19:06:15 +00:00
Hide_DandGitea 0f853303a4 feat: 전투 상대방의 특정 수치를 접근할 수 있는 callback류 생성 2021-09-15 19:06:15 +00:00
Hide_DandGitea d225eb9b16 inheritBuff 준비 2021-09-15 19:06:15 +00:00
Hide_D d926e4b8bc api: 규격 정의 2021-09-12 04:59:34 +09:00
Hide_D 3e2df1d4d8 api: join 2021-09-12 03:22:11 +09:00
Hide_D d670dbf081 feat: 장수 생성 시 유산 포인트에 따라 생성해주는 기능 추가 2021-09-12 02:59:49 +09:00
Hide_D f510a312e3 fix: 은퇴용 유산 포인트 코드가 항상 적용되는 문제 수정 2021-09-12 02:07:29 +09:00
Hide_D 19c44e3d31 fix: 수뇌가 소재 도시에 도시 관련 사령턴(백동 등) 실행시 발생하는 버그 수정
- 백동 + 성수 등등
2021-09-11 19:35:30 +09:00
Hide_D d0848aee67 fix: 가오픈 정보 안나오는 버그 수정 2021-09-10 22:49:30 +09:00
Hide_D f4b4b6811c fix: bootstrap4 package order 문제
- vue3 + bootstrap5 적용 전까진 고통 받아야...
- 당분간 Popper, jQuery가 제대로 export 되었는지 확인 필요
2021-09-10 22:26:14 +09:00
Hide_D fecb3f1f7b fix: gateway tooltip 2021-09-10 21:38:32 +09:00
Hide_D 4c924c0763 fix: 내 정보 로그 추가 불러오기 안되는 문제 수정 2021-09-10 21:05:26 +09:00
Hide_D f1e8d70554 fix: browser support 범위 추가 2021-09-10 18:43:29 +09:00
Hide_D 7d11bc152e fix: 오타 수정 2021-09-09 01:27:29 +09:00
Hide_D fdf0a3135a Merge pull request '스크립트 기반을 WebPack + Babel + TypeScript + Vue3으로 변경' (#191) from ts_convert into devel
Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/191
2021-09-09 01:00:42 +09:00
Hide_D 3a1a455c48 [empty] this is a empty commit 2021-09-09 00:59:10 +09:00
Hide_D 3a786e835b Squashed commit of the following:
commit 3ef363a01e
Author: hide_d <hided62@gmail.com>
Date:   Mon Sep 6 02:30:00 2021 +0900

    fix: 은퇴 시 숙련 포인트를 지나치게 많이 받는 문제 수정

commit 9e68bc90c2
Author: hide_d <hided62@gmail.com>
Date:   Mon Sep 6 02:17:56 2021 +0900

    재야에서 도시보기 warning

commit d2590607c2
Author: hide_d <hided62@gmail.com>
Date:   Sun Sep 5 23:05:06 2021 +0900

    fix: div 0

commit 2bce6e4f02
Author: hide_d <hided62@gmail.com>
Date:   Sun Sep 5 23:02:52 2021 +0900

    warning 메시지 수정

commit e64812da72
Author: hide_d <hided62@gmail.com>
Date:   Sat Sep 4 03:42:09 2021 +0900

    fix: m장, 의병장 숙련이 설정되지 않는 버그 수정

commit 7cd40fca03
Author: hide_d <hided62@gmail.com>
Date:   Sat Aug 21 16:04:03 2021 +0900

    fix: 모병/징병에서 조건 검사부 통솔 계산값

commit d1568a3b2c
Author: hide_d <hided62@gmail.com>
Date:   Sat Aug 21 02:50:54 2021 +0900

    허보에 수몰이 같이 들어간 버그 수정

commit e7dcc84afc
Author: hide_d <hided62@gmail.com>
Date:   Thu Aug 19 14:51:50 2021 +0900

    REAMDME.md 버전 수정

commit 8eaa940d4e
Author: hide_d <hided62@gmail.com>
Date:   Wed Aug 18 20:40:37 2021 +0900

    Revert "fix: 7.2에서 오동작 버그 수정"

    This reverts commit 9997675b1d.

commit 9997675b1d
Author: hide_d <hided62@gmail.com>
Date:   Wed Aug 18 20:32:47 2021 +0900

    fix: 7.2에서 오동작 버그 수정

commit 9ef566f11f
Author: hide_d <hided62@gmail.com>
Date:   Wed Aug 18 20:26:31 2021 +0900

    fix: 아이템중 WarActivateSkill 관련 중첩 해제 버그 수정
2021-09-09 00:53:35 +09:00
Hide_D c70181132f build: 서버별 build가 다를 가능성 고려 2021-09-09 00:32:42 +09:00
Hide_D 538615a1f5 fix: tryNpmInstall 이후 genJS까지 실행해야 안전 2021-09-09 00:17:27 +09:00
Hide_D aa20a60a1c fix: recent_map 에러 2021-09-08 23:55:37 +09:00
Hide_D 69fa1dac6c install: php 단에서 npm 설치 환경 구성 2021-09-08 23:50:38 +09:00
Hide_D 3ab349af6e dep: build script 변경 2021-09-08 22:39:14 +09:00
Hide_D 97ac7deb2f misc: npc_control 기존 파일 제거 2021-09-08 21:06:21 +09:00
Hide_D 3230cafb9f 요구사항에 nodejs 요구 추가 2021-09-08 20:41:55 +09:00
Hide_D 394284d8de vue: NPCControl
- 외향  모사(딱히 의미는 없으나..)
- 약간 반응형
2021-09-08 20:39:04 +09:00
Hide_D 6323b174c6 webpack: 최적화 옵션 변경 2021-09-08 03:29:43 +09:00
Hide_D 3d3e0e5139 vue: NPCControl
- 일단 모든 기능 작동
2021-09-08 03:04:40 +09:00
Hide_D ffc7d4bacc vue: NPCControl(WIP) 메인 기능 동작 2021-09-08 02:48:46 +09:00
Hide_D 598236a1d2 vue: NPCControl(WIP) 2021-09-07 03:03:25 +09:00
Hide_D 69207519bd vue-component: NumberInputWithInfo 2021-09-07 00:29:38 +09:00
Hide_D 022eb1012f ts: numberWithCommas 분리 2021-09-07 00:16:28 +09:00
Hide_D 0a9c59f91e fix: 은퇴 시 숙련 포인트를 지나치게 많이 받는 문제 수정 2021-09-06 02:30:00 +09:00
Hide_D 7ebb22b892 재야에서 도시보기 warning 2021-09-06 02:17:56 +09:00
Hide_D 3dc7fc6f14 vue: NPCControl(WIP) 2021-09-06 02:12:28 +09:00
Hide_D 90dea7517b fix: div 0 2021-09-05 23:05:06 +09:00
Hide_D eae48f9564 warning 메시지 수정 2021-09-05 23:02:52 +09:00
Hide_D dd7afba5f5 delete-old: board 2021-09-05 21:27:41 +09:00
Hide_D 73357b6777 CssMinimizer 적용 2021-09-05 18:20:39 +09:00
Hide_D 53df6bbcc6 vue: board 2021-09-05 17:52:39 +09:00
Hide_D 9871559227 vue: Board(WIP) 2021-09-05 03:59:00 +09:00
Hide_D 9cbead1ddc defer 대응 2021-09-05 03:32:57 +09:00
Hide_D 6402028c17 fix: m장, 의병장 숙련이 설정되지 않는 버그 수정 2021-09-04 03:42:09 +09:00
Hide_D 76bd65cf53 vue: inheritPoint 샘플 작성 2021-09-04 00:06:54 +09:00
Hide_D 6e4113de11 vue: inheritPoint(WIP) 2021-09-03 02:42:50 +09:00
Hide_D 12f37f76c7 dep: ready for vue3 2021-09-02 23:03:19 +09:00
Hide_D acd77b2c0a web_pack_config 2021-09-02 01:51:37 +09:00
Hide_D f4fb4ec00d misc: move gateway path 2021-09-02 00:46:33 +09:00
Hide_D 46ae4669ea misc: msg template 통합 2021-08-31 02:35:50 +09:00
Hide_D 67b2dbfe98 js2ts: kingdomList 2021-08-31 02:27:00 +09:00
Hide_D 4f3b39fbfa js2ts: seleect_general_from_pool 2021-08-31 01:03:22 +09:00
Hide_D a28fc52309 js2ts: join 2021-08-30 02:11:07 +09:00
Hide_D d5f0d60794 js2ts: history 2021-08-30 02:02:53 +09:00
Hide_D 72e65587df js2ts: processing - plugin 구조 마저 변경 2021-08-30 01:47:42 +09:00
Hide_D b4d4d90784 js2ts: hallOfFame 2021-08-30 01:43:01 +09:00
Hide_D 3f81fb759d misc: 기존파일 제거 2021-08-30 01:38:24 +09:00
Hide_D d995b39e02 js2ts: currentCity 2021-08-30 01:30:56 +09:00
Hide_D 3bd09a1aa4 core: getJSFiles -> getJSPlugins
- 각각 js를 불러오기보다.. 초기화 함수를 직접 호출
- lazy loading은 어차피 나중에 새로 만들거니까 안 함.
2021-08-30 01:14:20 +09:00
Hide_D a6ff951c98 js2ts: diplomacy
- select2 관련 문제 해결?
2021-08-30 00:27:04 +09:00
Hide_D 604b1557e8 legacy: #bg0, #bg1, #bg2 제거 2021-08-29 02:16:12 +09:00
Hide_D 279bd5c71a misc: Pooper export, summernote lang 2021-08-29 02:05:16 +09:00
Hide_D 97dfb02ab6 js2ts: dipcenter(WIP)
- summernote 이식
- summernote/imageFip plugin 이식
2021-08-29 01:39:03 +09:00
Hide_D 32c7b02303 misc: 미사용 파일 제거 2021-08-28 23:40:37 +09:00
Hide_D e135835e61 jquery-redirect 제거 2021-08-28 23:34:11 +09:00
Hide_D 7ed9a8075c js2ts: main(WIP)
- jquery-redirect 제거
- linkifyStr import
2021-08-28 23:14:07 +09:00
Hide_D ead8110fb4 watch에 dev 모드 추가 2021-08-28 23:13:22 +09:00
Hide_D 586b1b6c15 dep: js package version up
- typscript
- sass
- typescript-eslint
- vue
- core-js
2021-08-28 19:03:28 +09:00
Hide_D e1727c8d80 fix: admin_member path 2021-08-28 18:56:50 +09:00
Hide_D 7bd8a7ff35 fix: msg 기본 동작 2021-08-28 17:25:33 +09:00
Hide_D de48651ae7 feat: exportWindow
- global을 지저분하게 하지 않고, window에 출력만 해줌
2021-08-28 17:20:44 +09:00
Hide_D 9902e07be0 js2ts: msg(WIP) 2021-08-28 06:26:25 +09:00
Hide_D 5e4b38895e js2ts: msg(WIP) 2021-08-28 06:23:25 +09:00
Hide_D 38bbbf261a js2ts: msg(WIP) 2021-08-28 06:22:30 +09:00
Hide_D def0a52578 String format 확장 제거 2021-08-27 03:53:15 +09:00
Hide_D 4f1f87bda0 fix: extExpandCity (format func) 2021-08-27 03:41:32 +09:00
Hide_D 15f9faa2fa js2ts: extExpandCity
- 이부분은 완벽히 새로만들어야 하므로 유지
2021-08-27 03:39:59 +09:00
Hide_D 7257491d8b js2ts: myCityInfo(wip) 2021-08-27 03:36:35 +09:00
Hide_D c19b2a9ebe luxon -> date-fns 2021-08-26 22:50:02 +09:00
Hide_D 54e7fd0293 misc: type module 지정 2021-08-26 21:50:06 +09:00
Hide_D 21f3a2082b misc: delete old gateway install.js 2021-08-26 21:20:47 +09:00
Hide_D f647eb5a7b js2ts: gateway install 2021-08-26 21:20:08 +09:00
Hide_D d7b1db0081 feat: jqValidateForm에 Values Type 지정 2021-08-26 21:10:02 +09:00
Hide_D 11511316d1 js2ts: index(login)
- fix-workaround: popper 로드
2021-08-26 18:11:51 +09:00
Hide_D 95a93c2c44 misc: 사용하지 않은 deprecated 함수 마저 제거 2021-08-26 04:00:52 +09:00
Hide_D 815ce10c25 misc: 개발용 코드 삭제 2021-08-26 03:39:33 +09:00
Hide_D 5f13bfe8a1 js2ts: join user 2021-08-26 03:35:49 +09:00
Hide_D 5cd494c00a js2ts: admin_userlist 2021-08-26 02:28:18 +09:00
Hide_D 5a0a8bedc1 refac: escapeHtml, nl2br, TemplateEngine 분리 2021-08-26 01:37:46 +09:00
Hide_D 3b9884160b js2ts: entrance, webpack(entrance/dist_js) 2021-08-26 01:25:58 +09:00
Hide_D 5b2b01328a webpack: dynamic js build on update 2021-08-25 03:35:51 +09:00
Hide_D e5b51dcd16 genJS 2021-08-25 02:55:11 +09:00
Hide_D 4d8b816acf target별 JS 생성 2021-08-25 02:44:46 +09:00
Hide_D fa109c1b0b feat: VersionGit hash 추가. dynamic추가. 버전 변수 방식 변경 2021-08-25 02:12:35 +09:00
Hide_D b987fce627 feat: VersionGit에 'hash' 추가.(WIP) 2021-08-25 02:05:27 +09:00
Hide_D b072cc3266 gitignore 준비 2021-08-25 01:22:03 +09:00
Hide_D 366b40ea90 build: boosInfo, myPage, convertFormData 2021-08-22 20:13:08 +09:00
Hide_D 3d3daa205d js2ts: bossInfo, myPage
- convertFormData에서 null -> ''
2021-08-22 15:45:10 +09:00
Hide_D 665ebbd11a js2ts: bossInfo 2021-08-22 14:49:03 +09:00
Hide_D 52a5a7697d fix: 리셋 옵션에서 '기본사령턴' 2021-08-22 02:48:14 +09:00
Hide_D 97a38d516a dep: package 2021-08-22 02:40:27 +09:00
Hide_D e89475bf52 dep: webpack cache
- 개발용
2021-08-22 02:31:10 +09:00
Hide_D 90a78b05ce dep: overwrite
- TODO: 서버에서 npm run build를 자동으로 해야함
2021-08-22 02:11:33 +09:00
Hide_D 8c6eff15f0 dep: missing select2 2021-08-22 02:06:50 +09:00
Hide_D 824c58b391 build: board 2021-08-21 21:41:43 +09:00
Hide_D b97500430c js2ts: board 2021-08-21 21:41:32 +09:00
Hide_D bacafc67c9 build: util.ts 분리 2021-08-21 20:45:24 +09:00
Hide_D f23ebcdc2d js2ts: util.ts 분리 2021-08-21 20:45:10 +09:00
Hide_D edbe8e3561 build: betting 2021-08-21 20:38:24 +09:00
Hide_D 05d1e33b30 js2ts: betting 2021-08-21 20:38:15 +09:00
Hide_D 96b60ce0f5 fix: 모병/징병에서 조건 검사부 통솔 계산값 2021-08-21 16:04:03 +09:00
Hide_D 6174bc7ffd build: select_npc 2021-08-21 05:16:07 +09:00
Hide_D 3bd022e03a js2ts: select_npc 2021-08-21 05:15:58 +09:00
Hide_D b0cc5b0b60 build: processing 2021-08-21 04:40:55 +09:00
Hide_D 5493f70458 js2ts: processing
- select2 version dependency 문제로 import는 유지
2021-08-21 04:40:40 +09:00
Hide_D 323b3d9d16 허보에 수몰이 같이 들어간 버그 수정 2021-08-21 02:50:54 +09:00
Hide_D 1b0742ad2a build: processing plugin 2021-08-21 00:30:05 +09:00
Hide_D 2eb7217f49 js2ts: processing plugin 정리 2021-08-21 00:29:50 +09:00
Hide_D b6f5a286b0 build: recent_map 2021-08-20 04:59:13 +09:00
Hide_D 66c496fb10 gateway: 입구의 지도를 iframe으로 변경 2021-08-20 04:58:45 +09:00
Hide_D 56ca588c1e gateway: 입구의 지도를 iframe으로 변경 2021-08-20 04:58:05 +09:00
Hide_D e2b09caff3 build: processing parts 2021-08-20 03:24:14 +09:00
Hide_D a5b4a4c59f js2ts: processing parts(WIP) 2021-08-20 03:24:03 +09:00
Hide_D a70312a90a build: battle_simulator 2021-08-20 02:55:07 +09:00
Hide_D 6c6a3238cb js2ts: battle_simulator 2021-08-20 02:54:57 +09:00
Hide_D 9af10d4bcb misc: showErrorLog
현재 에러로그에는 javascript가 필요하지 않음
2021-08-20 01:40:03 +09:00
Hide_D f6e1b4611e build: install & jqValidateForm 2021-08-20 01:31:32 +09:00
Hide_D 7bc762d357 js2ts-fix: install 2021-08-20 01:31:18 +09:00
Hide_D 8edf1da92b fix: jqValidateForm에서 복합 타입(radio, checkbox) 처리 오류 수정 2021-08-20 01:30:34 +09:00
Hide_D a18baf2ffe REAMDME.md 버전 수정 2021-08-19 14:51:50 +09:00
Hide_D 2d41bf8f2f Revert "fix: 7.2에서 오동작 버그 수정"
This reverts commit 9997675b1d.
2021-08-18 20:40:37 +09:00
Hide_D 334778bdae fix: 7.2에서 오동작 버그 수정 2021-08-18 20:32:47 +09:00
Hide_D 1b46a06eee fix: 아이템중 WarActivateSkill 관련 중첩 해제 버그 수정 2021-08-18 20:26:31 +09:00
Hide_D 1e860e9443 js2ts & wip: install
- jqValidateForm에 전/후처리 추가
2021-08-18 02:59:58 +09:00
Hide_D 0b973672d2 build-misc: BundleAnalyzerPlugin 2021-08-17 02:56:11 +09:00
Hide_D 868ed85c7f build: user_info 2021-08-17 02:25:15 +09:00
Hide_D 6f2a24ec66 js2ts: user_info
- moment js 사용 대상 제거
- sha512 추가
- 비어있는 func.js 제거
2021-08-17 02:25:04 +09:00
Hide_D e5d5899a15 build: entrance 2021-08-17 01:05:54 +09:00
Hide_D 243473a97d js2ts: entrance
- j_server_get_status 반환형 수정
- getDateTimeNow 추가
- common에서 TemplateEngine 코드 버그 수정
2021-08-17 01:05:41 +09:00
Hide_D 28d71b8ce2 js2ts: install_db.php
- jqValidateForm 구현
  - async-validator + 수작업
- common.js 없이 ventor -> 타겟 ts 직접
2021-08-16 23:50:12 +09:00
Hide_D 1acbf90261 gateway printJS 변경 2021-08-16 23:46:53 +09:00
Hide_D 94229f84a3 fix-dep: 로그인 대문 dependency문제로 지도 안나오는 문제 해결 2021-08-16 16:09:54 +09:00
Hide_D cead74238a build: map 2021-08-16 03:29:54 +09:00
Hide_D 73c60ea94c js2ts: map 2021-08-16 03:29:44 +09:00
Hide_D 73638da4db misc: 미사용 파일 삭제 2021-08-16 01:11:38 +09:00
Hide_D bc218b73e1 js2ts: chiefCenter
- common: unwrap_any
- jQuery export 수정
- axios로 변경
- moment -> luxon
2021-08-16 01:06:17 +09:00
Hide_D aac6632f4b js2ts: vendor, evergreen browsers
- IE11 제외(webpack)
- vendor에 bootstrap, jquery 번들
- common.js에서 번들된 jquery, bootstrap 초기화
- 기본 printJS 코드를 common_path, vendors, common으로 고정
2021-08-15 22:55:08 +09:00
Hide_D fdba3fdc74 js2ts: ext.plugin_troop
- async await 대응
- axios 준비
- troop.css
2021-08-15 21:04:06 +09:00
Hide_D 21bb61ec82 js2ts: common 분리, troop.js 2021-08-15 20:19:47 +09:00
Hide_D ce1203d64d js->ts: common.js 2021-08-15 19:59:34 +09:00
Hide_D 56daf15c8e webpack: scss, vue (#189)
WebPack에 scss와 vue를 사용할 수 있도록 세팅.

현재는 php서버와 코드가 강하게 엮여있기 때문에 vue-cli 대신 수동으로 webpack에 등록.

파일 번들링 경로는 다음과 같음

- scss + style -> css
- ts -> js

Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/189
Co-authored-by: hide_d <hided62@gmail.com>
Co-committed-by: hide_d <hided62@gmail.com>
2021-08-14 05:47:16 +09:00
Hide_D 96faa924d8 Merge pull request 'PHP8 버전 대응, 버그 수정' (#188) from php8 into devel
Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/188
2021-08-13 00:00:32 +09:00
Hide_D ee8854451c fix: phan 지시에 따라 일부 버그 수정
- null && key_exists 버그
- or assign이 integer 대상이므로 직접 연산
- false 대신 0 입력한 곳 수정
- 자체 Deprecate 처리한 함수 회피
- 초기화되지 않은 [] 확인하여 처리
- sleep은 정수만 받으므로 usleep으로 변경
- 선언하지 않고 그냥 사용하던 member 변수 선언
- boolean operation 순서 틀린 부분 수정
2021-08-12 23:58:20 +09:00
Hide_D 0975e925a9 use class, function 커맨드를 php8에서 사용할 수 있도록 수정
- \ 토큰 해석 문제
- VSCode 자동 완성 문제로 use function \sammo\{ 를 모두 해제
2021-08-12 22:35:42 +09:00
Hide_D 83d6a2169b 유산 포인트 시스템, 추가 기수 대비 (#187)
- 유산 포인트
  - 기수 뒤로도 누적되는 포인트
  - 생존, 최대 임관년 수, 최대 연속 내정 성공, 병종 상성 우위 횟수, 전투 횟수, 계략 성공 횟수, 천통 기여(규모 상승, 천통 수뇌, 천통 군주), 숙련도, 토너먼트, 베팅 당첨
  - 유산 관리 페이지 제공

- 태수국
  - 181년 1월에 자동 생성되는 u장수국
  - 시간이 지나면 사실상 자동 소멸
  - 유저국과는 4칸 거리, 서로는 2칸 거리
  - 이 시스템으로 인해 m장 거병 차단

- NPC 원조시 불가침
  - 1년 세수만큼 받은 경우 24개월 불가침 제안
  - 최소 6개월
  - 불가침을 받지 않고 추가 원조한 경우 계속해서 기간 상승
  - 단, 불가침 수락 전에 선포를 할 수 있음

Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/187
Co-authored-by: hide_d <hided62@gmail.com>
Co-committed-by: hide_d <hided62@gmail.com>
2021-08-11 21:57:52 +09:00
Hide_D 21e7a4d966 Dep: update
주로 PHAN
2021-08-06 22:39:09 +09:00
Hide_D 404cd24855 작위보상 비중 수정 2021-05-02 02:00:16 +09:00
Hide_D b4ad72ee67 환약을 유니크로 습득하는 버그 수정 2021-05-01 23:48:01 +09:00
Hide_D bea628b619 환약을 습득하게 되는 버그 수정 2021-05-01 23:46:33 +09:00
Hide_D 3637e54982 유니크 onCalcStat 버그 수정 2021-05-01 23:38:06 +09:00
3344 changed files with 272814 additions and 68239 deletions
+15
View File
@@ -0,0 +1,15 @@
{
"presets": [
[
"@babel/preset-env",
{
"useBuiltIns": "usage",
"corejs": 3,
"modules": false
}
]
],
"plugins": [
"lodash"
]
}
+42
View File
@@ -0,0 +1,42 @@
module.exports = {
root: true,
parser: "vue-eslint-parser",
"env": {
"browser": true,
"es2021": true
},
ignorePatterns: ['*.test.ts', '.eslintrc.cjs', 'webpack.config.cjs', '*.js'],
overrides: [{
files: ['*.ts', '*.tsx', "*.vue"],
}],
plugins: [
"@typescript-eslint"
],
extends: [
"eslint:recommended",
"plugin:vue/vue3-essential",
"plugin:@typescript-eslint/recommended"
],
parserOptions: {
"sourceType": "module",
"project": "./tsconfig.json",
"ecmaVersion": 2021,
"parser": "@typescript-eslint/parser",
extraFileExtensions: ['.vue']
},
rules: {
'@typescript-eslint/no-floating-promises': 'error',
},
settings: {
'import/resolver': {
alias: {
map: [
['@', './hwe/ts'],
['@util', './hwe/ts/util'],
['@scss', './hwe/scss'],
]
}
}
},
};
+16 -1
View File
@@ -4,7 +4,8 @@
!.vscode/launch.json
!.vscode/extensions.json
/node_modules
package-lock.json
# 체섭 ignore
@@ -26,15 +27,24 @@ hwe/.htaccess
d_shared
/d_pic
d_pic/*.jpg
d_pic/*.gif
d_pic/*.png
d_pic/*.webp
d_pic/uploaded_image
*/dist_misc/*
*/dist_js/*
*/dist_css/*
/dist_misc/*
/dist_js/*
/dist_css/*
d_setting/*.php
*/d_setting/*.php
*/d_setting/templates/*.php
!*.orig.php
*/data/file_cache
@@ -51,3 +61,8 @@ test.php
phpinfo.php
vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/*
*.sqlite3
ingame/js/*
ingame/css/*
gateway/js/*
gateway/css/*
+46 -32
View File
@@ -7,7 +7,7 @@
*/
return [
// Supported values: `'5.6'`, `'7.0'`, `'7.1'`, `'7.2'`, `'7.3'`,
// `'7.4'`, `null`.
// `'7.4'`, `'8.0'`, `'8.1'`, `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.
@@ -15,21 +15,34 @@ return [
// Note that the **only** effect of choosing `'5.6'` is to infer
// that functions removed in php 7.0 exist.
// (See `backward_compatibility_checks` for additional options)
"target_php_version" => '7.3',
'backward_compatibility_checks ' => false,
'minimum_severity'=>\Phan\Issue::SEVERITY_NORMAL,
"target_php_version" => '8.0',
'backward_compatibility_checks ' => true,
'minimum_severity' => \Phan\Issue::SEVERITY_NORMAL,
'file_list' => [
'f_config/config.php',
'hwe/_119_b.php',
'hwe/_119.php',
'hwe/a_bestGeneral.php',
'hwe/a_emperior.php',
'hwe/a_emperior2.php',
'hwe/_admin1.php',
'hwe/_admin1_submit.php',
'hwe/_admin2.php',
'hwe/_admin2_submit.php',
'hwe/_admin4.php',
'hwe/_admin4_submit.php',
'hwe/_admin5.php',
'hwe/_admin5_submit.php',
'hwe/_admin7.php',
'hwe/_admin8.php',
'hwe/_admin_force_rehall.php',
'hwe/a_emperior_detail.php',
'hwe/a_emperior.php',
'hwe/a_genList.php',
'hwe/a_hallOfFame.php',
'hwe/a_history.php',
'hwe/a_kingdomList.php',
'hwe/a_npcList.php',
'hwe/api.php',
'hwe/a_status.php',
'hwe/a_traffic.php',
'hwe/a_vote.php',
@@ -54,7 +67,6 @@ return [
'hwe/c_dipcenter.php',
'hwe/c_tournament.php',
'hwe/c_vote.php',
'hwe/func.php',
'hwe/func_auction.php',
'hwe/func_command.php',
'hwe/func_converter.php',
@@ -63,16 +75,15 @@ return [
'hwe/func_legacy.php',
'hwe/func_map.php',
'hwe/func_message.php',
'hwe/func.php',
'hwe/func_process.php',
'hwe/func_string.php',
'hwe/func_template.php',
'hwe/func_time_event.php',
'hwe/func_tournament.php',
'hwe/index.php',
'hwe/install.php',
'hwe/install_db.php',
'hwe/join.php',
'hwe/join_post.php',
'hwe/install.php',
'hwe/j_adjust_icon.php',
'hwe/j_autoreset.php',
'hwe/j_basic_info.php',
@@ -87,20 +98,23 @@ return [
'hwe/j_diplomacy_respond_letter.php',
'hwe/j_diplomacy_rollback_letter.php',
'hwe/j_diplomacy_send_letter.php',
'hwe/j_export_simulator_object.php',
'hwe/j_general_log_old.php',
'hwe/j_general_set_permission.php',
'hwe/j_general_turn.php',
'hwe/j_get_basic_general_list.php',
'hwe/j_getChiefTurn.php',
'hwe/j_get_city_list.php',
'hwe/j_get_general_list.php',
'hwe/j_get_nation_general_list.php',
'hwe/j_get_reserved_command.php',
'hwe/j_get_select_npc_token.php',
'hwe/j_get_select_pool.php',
'hwe/j_image_upload.php',
'hwe/j_install.php',
'hwe/j_install_db.php',
'hwe/j_install.php',
'hwe/j_load_scenarios.php',
'hwe/j_map.php',
'hwe/j_map_history.php',
'hwe/j_map.php',
'hwe/j_map_recent.php',
'hwe/j_msg_contact_list.php',
'hwe/j_msg_decide_opt.php',
'hwe/j_msg_delete.php',
@@ -108,31 +122,30 @@ return [
'hwe/j_msg_get_recent.php',
'hwe/j_msg_submit.php',
'hwe/j_myBossInfo.php',
'hwe/j_raise_event.php',
'hwe/j_select_npc.php',
'hwe/j_select_picked_general.php',
'hwe/j_server_basic_info.php',
'hwe/j_set_chief_command.php',
'hwe/j_set_general_command.php',
'hwe/j_set_my_setting.php',
'hwe/j_set_npc_control.php',
'hwe/j_simulate_battle.php',
'hwe/j_troop.php',
'hwe/j_update_picked_general.php',
'hwe/j_vacation.php',
'hwe/lib.php',
'hwe/process_war.php',
'hwe/proc.php',
'hwe/readme.php',
'hwe/recent_map.php',
'hwe/select_general_from_pool.php',
'hwe/select_npc.php',
'hwe/t_board.php',
'hwe/t_diplomacy.php',
'hwe/_119.php',
'hwe/_119_b.php',
'hwe/_admin1.php',
'hwe/_admin1_submit.php',
'hwe/_admin2.php',
'hwe/_admin2_submit.php',
'hwe/_admin4.php',
'hwe/_admin4_submit.php',
'hwe/_admin5.php',
'hwe/_admin5_submit.php',
'hwe/_admin7.php',
'hwe/_admin8.php',
'hwe/_admin_force_rehall.php',
'hwe/v_board.php',
'hwe/v_inheritPoint.php',
'hwe/v_join.php',
'hwe/v_NPCControl.php',
],
// A list of directories that should be parsed for class and
@@ -143,9 +156,9 @@ return [
// 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',
'hwe/d_setting',
'hwe/sammo',
'd_setting',
'src/sammo',
'src/kakao',
'vendor'
@@ -169,6 +182,7 @@ return [
'suppress_issue_types' => [
'PhanUnreferencedUseNormal',
'PhanTypeArraySuspiciousNullable',
],
// A list of plugin files to execute.
@@ -185,4 +199,4 @@ return [
'PregRegexCheckerPlugin',
'PrintfCheckerPlugin',
],
];
];
+2 -2
View File
@@ -5,7 +5,7 @@
<title>닫혀 있습니다.</title>
<script>
setTimeout(function(){
window.location = window.location+'/../';
window.location.href = '../';
}, 5000);
</script>
<style>
@@ -13,7 +13,7 @@
background-color:black;
color:yellow;
}
</style>
</head>
<body>
+1 -1
View File
@@ -1,6 +1,6 @@
The MIT License
Copyright (c) 2020 Hide_D, 62che
Copyright (c) 2021 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
+10 -8
View File
@@ -5,22 +5,24 @@
## 요구사항
* Apache2
* <code>mpm_event</code> 권장
* PHP 7.3 이상
* <code>php-fpm</code> 권장
* Apache2 또는 nginx
* Apache2인 경우 `mpm_event` 권장
* PHP 8.0 이상
* `php-fpm` 권장
* php에서 curl, pdo-sqlite을 실행가능해야 합니다.
* mysqli, mysqlnd
* gd
* mbstring
* NodeJS 14 이상
* 내부의 git을 통해 upgrade 때 `webpack build` 용도로 필요합니다.
* MariaDB 10.2.1 이상
* 현재 MySQL은 지원하지 않습니다.
* <code>git</code>
* <code>curl</code>
* `git`
* `curl`
Linux는 Ubuntu 18.04, 20.04, Windows는 Windows 10에서 XAMPP, WSL2를 사용한 환경에서 테스트되었습니다.
Linux는 Ubuntu 18.04, 20.04, Windows는 WSL2를 사용한 환경에서 테스트되었습니다.
Docker를 이용한 설치는 테스트버전만 제공됩니다.
Docker를 이용한 설치도 제공하고 있습니다.
## Docker를 이용한 설치
+12
View File
@@ -0,0 +1,12 @@
<?php
namespace sammo;
require(__DIR__ . '/vendor/autoload.php');
if (!class_exists('\\sammo\\RootDB')) {
Json::dieWithReason('No DB');
}
APIHelper::launch(dirname(__FILE__));
+6 -5
View File
@@ -8,7 +8,7 @@
],
"config": {
"platform": {
"php": "7.3"
"php": "8.0"
}
},
"require": {
@@ -16,7 +16,6 @@
"sergeytsalkov/meekrodb": "^2.3",
"league/plates": "^3.3",
"guzzlehttp/guzzle": "^6.3",
"scssphp/scssphp": "^1.0",
"monolog/monolog": "^1.23",
"firephp/firephp-core": "^0.4.0",
"vlucas/valitron": "^1.4",
@@ -26,9 +25,11 @@
"ezyang/htmlpurifier": "^4.10",
"xemlock/htmlpurifier-html5": "^0.1.7",
"catfan/medoo": "^1.5",
"phan/phan": "^2.7",
"phan/phan": "*",
"erusev/parsedown-extra": "^0.8.1",
"nette/caching": "^3.0"
"nette/caching": "^3.0",
"illuminate/database": "^8.61",
"illuminate/events": "^8.61"
},
"autoload": {
"psr-4": {
@@ -49,5 +50,5 @@
"f_config/config.php"
]
}
}
Generated
+2206 -349
View File
File diff suppressed because it is too large Load Diff
+7 -13
View File
@@ -2,7 +2,7 @@
body {
color: white;
background-color: black;
font-family: '맑은 고딕';
font-family: 'Pretendard';
}
table {
@@ -14,10 +14,9 @@ table {
border-right-color: black;
border-bottom-color: black;
padding: 0px;
font-size: 13px;
font-size: 14px;
word-break: break-all;
text-align: center;
font-family: '맑은 고딕';
}
th,
@@ -30,10 +29,9 @@ td {
border-right-color: black;
border-bottom-color: black;
padding: 0px;
font-size: 13px;
font-size: 14px;
word-break: break-all;
text-align: center;
font-family: '맑은 고딕';
}
a.just_link {
@@ -70,11 +68,9 @@ a.just_link {
border-right-color: black;
border-bottom-color: black;
padding: 0px;
font-size: 13px;
font-size: 14px;
word-break: break-all;
text-align: center;
font-family: '맑은 고딕';
;
}
.obj_fill {
@@ -87,8 +83,7 @@ button.with_skin {
padding: 0 4px;
background-color: black;
color: white;
font-family: '맑은 고딕';
font-size: 13px;
font-size: 14px;
}
button.with_skin:disabled {
@@ -98,8 +93,7 @@ button.with_skin:disabled {
input.with_skin {
background-color: black;
color: white;
font-family: '맑은 고딕';
font-size: 13px;
font-size: 14px;
}
input.with_skin:disabled {
@@ -111,7 +105,7 @@ input.with_skin:disabled {
}
.font1 {
font-size: 13px;
font-size: 14px;
}
.font2 {
+3 -3
View File
@@ -7,10 +7,10 @@ body, html{
margin-top: 70px;
}
h1.title {
h1.title {
font-size: 50px;
font-family: 'Passion One', cursive;
font-weight: 400;
font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic';
font-weight: 400;
}
hr{
+3 -3
View File
@@ -7,10 +7,10 @@
margin-top: 70px;
}
h1.title {
h1.title {
font-size: 50px;
font-family: 'Passion One', cursive;
font-weight: 400;
font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic';
font-weight: 400;
}
hr{
+3 -3
View File
File diff suppressed because one or more lines are too long
+41 -16
View File
@@ -15,35 +15,35 @@ ini_set("session.gc_maxlifetime", '604800'); // seconds
function getFriendlyErrorType($type)
{
switch ($type) {
case E_ERROR: // 1 //
case E_ERROR: // 1 //
return 'E_ERROR';
case E_WARNING: // 2 //
case E_WARNING: // 2 //
return 'E_WARNING';
case E_PARSE: // 4 //
case E_PARSE: // 4 //
return 'E_PARSE';
case E_NOTICE: // 8 //
case E_NOTICE: // 8 //
return 'E_NOTICE';
case E_CORE_ERROR: // 16 //
case E_CORE_ERROR: // 16 //
return 'E_CORE_ERROR';
case E_CORE_WARNING: // 32 //
case E_CORE_WARNING: // 32 //
return 'E_CORE_WARNING';
case E_COMPILE_ERROR: // 64 //
case E_COMPILE_ERROR: // 64 //
return 'E_COMPILE_ERROR';
case E_COMPILE_WARNING: // 128 //
case E_COMPILE_WARNING: // 128 //
return 'E_COMPILE_WARNING';
case E_USER_ERROR: // 256 //
case E_USER_ERROR: // 256 //
return 'E_USER_ERROR';
case E_USER_WARNING: // 512 //
case E_USER_WARNING: // 512 //
return 'E_USER_WARNING';
case E_USER_NOTICE: // 1024 //
case E_USER_NOTICE: // 1024 //
return 'E_USER_NOTICE';
case E_STRICT: // 2048 //
case E_STRICT: // 2048 //
return 'E_STRICT';
case E_RECOVERABLE_ERROR: // 4096 //
case E_RECOVERABLE_ERROR: // 4096 //
return 'E_RECOVERABLE_ERROR';
case E_DEPRECATED: // 8192 //
case E_DEPRECATED: // 8192 //
return 'E_DEPRECATED';
case E_USER_DEPRECATED: // 16384 //
case E_USER_DEPRECATED: // 16384 //
return 'E_USER_DEPRECATED';
}
return "{$type}";
@@ -134,7 +134,7 @@ function logErrorByCustomHandler(int $errno, string $errstr, string $errfile, in
getExceptionTraceAsString($e)
);
}
set_error_handler("\sammo\logErrorByCustomHandler");
set_error_handler("\\sammo\\logErrorByCustomHandler");
function logExceptionByCustomHandler(\Throwable $e)
@@ -151,3 +151,28 @@ function logExceptionByCustomHandler(\Throwable $e)
throw $e;
}
set_exception_handler('\\sammo\\logExceptionByCustomHandler');
function getAPIExecutorClass($path){
static $basePath = __NAMESPACE__.'\\API\\';
if(is_string($path)){
}
else if(is_array($path)){
$path = join('\\', $path);
}
else{
throw new \InvalidArgumentException("{$path}는 올바른 API 지시자가 아님");
}
$classPath = str_replace('/', '\\', $basePath.$path);
if(class_exists($classPath)){
return $classPath;
}
throw new \InvalidArgumentException("{$path}는 올바른 API 경로가 아님");
}
function buildAPIExecutorClass($type, string $rootPath, array $args):\sammo\BaseAPI{
$class = getAPIExecutorClass($type);
return new $class($rootPath, $args);
}
+163 -174
View File
@@ -1,202 +1,191 @@
<?php
namespace sammo;
require(__DIR__.'/../vendor/autoload.php');
require(__DIR__ . '/../vendor/autoload.php');
?>
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>설치</title>
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('../e_lib/jquery.validate.min.js')?>
<?=WebUtil::printJS('../e_lib/sha512.min.js')?>
<?=WebUtil::printJS('../js/common.js')?>
<?=WebUtil::printJS('../js/install.js')?>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../css/install.css')?>
<?php /* NOTE: 설치 이전에는 ServConfig가 준비되어있지 않으므로 예외로 수동 지정 */ ?>
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printJS('../dist_js/gateway/vendors.js') ?>
<?= WebUtil::printCSS('../dist_js/gateway/vendor.css') ?>
<?= WebUtil::printJS('../dist_js/gateway/common_ts.js') ?>
<?= WebUtil::printCSS('../dist_js/gateway/common_ts.css') ?>
<?= WebUtil::printJS('../dist_js/gateway/install.js') ?>
<?= WebUtil::printCSS('../dist_js/gateway/install.css') ?>
<?= WebUtil::printCSS('../css/install.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
</head>
<body>
<div class="container">
<h1 class="row justify-content-md-center">삼국지 모의전투 HiDCHe 설치</h1>
<div class="row justify-content-md-center">
<div class="col col-12 col-md-10 col-lg-7">
<div class="card" id="db_form_card" style="display:none">
<h3 class="card-header">
설치(DB 설정)
</h3>
<div class="card-body">
<form id="db_form" method="post" action="#">
<div class="form-group row">
<label for="db_host" class="col-sm-4 col-form-label">DB호스트</label>
<div class="col-sm-8">
<input type="text" class="form-control" name="db_host" id="db_host"
placeholder="호스트" value="localhost" />
</div>
</div>
<div class="form-group row">
<label for="db_port" class="col-sm-4 col-form-label">DB포트</label>
<div class="col-sm-8">
<input type="text" class="form-control" name="db_port" id="db_port"
placeholder="접속 포트" value="3306" />
</div>
</div>
<div class="form-group row">
<label for="db_id" class="col-sm-4 col-form-label">DB계정명</label>
<div class="col-sm-8">
<input type="text" class="form-control" name="db_id" id="db_id" placeholder="DB계정"/>
</div>
</div>
<div class="form-group row">
<label for="db_pw" class="col-sm-4 col-form-label">DB비밀번호</label>
<div class="col-sm-8">
<input type="password" class="form-control" name="db_pw" id="db_pw"
placeholder="DB비밀번호"/>
</div>
</div>
<div class="form-group row">
<label for="db_name" class="col-sm-4 col-form-label">DB명</label>
<div class="col-sm-8">
<input type="text" class="form-control" name="db_name" id="db_name"
placeholder="DB명(예:sammo)"/>
</div>
</div>
<div class="form-group row">
<label for="serv_host" class="col-sm-4 col-form-label">접속 경로</label>
<div class="col-sm-8">
<input type="text" class="form-control" name="serv_host" id="serv_host"
placeholder="접속경로(예:http://www.example.com)"/>
</div>
</div>
<div class="form-group row">
<label for="shared_icon_path" class="col-sm-4 col-form-label">공용 아이콘 주소</label>
<div class="col-sm-8">
<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">
<label for="image_request_key" class="col-sm-4 col-form-label">이미지 갱신 키</label>
<div class="input-group col-sm-8">
<input type="text" class="form-control" name="image_request_key" id="image_request_key"
placeholder="이미지 서버의 hook/HashKey.php의 값과 동일하게"
value="" />
<div class="input-group-append">
<button id="btn_random_generate_key" class="btn btn-secondary" type="button">랜덤 생성</button>
<div class="col col-12 col-md-10 col-lg-7">
<div class="card" id="db_form_card" style="display:none">
<h3 class="card-header">
설치(DB 설정)
</h3>
<div class="card-body">
<form id="db_form" method="post" action="#">
<div class="form-group row">
<label for="db_host" class="col-sm-4 col-form-label">DB호스트</label>
<div class="col-sm-8">
<input type="text" class="form-control" name="db_host" id="db_host" placeholder="호스트" value="localhost" />
</div>
</div>
</div>
</div>
<hr style="width:100%; border-top: 1px solid lightgray;">
<div class="form-group row">
<label for="db_port" class="col-sm-4 col-form-label">DB포트</label>
<div class="col-sm-8">
<input type="text" class="form-control" name="db_port" id="db_port" placeholder="접속 포트" value="3306" />
</div>
</div>
<div class="form-group row">
<label for="kakao_rest_key" class="col-sm-4 col-form-label">카카오 API Rest Key</label>
<div class="col-sm-8">
<input type="text" class="form-control" name="kakao_rest_key" id="kakao_rest_key"
placeholder="카카오톡 API의 Rest Key"
value="" />
</div>
</div>
<div class="form-group row">
<label for="db_id" class="col-sm-4 col-form-label">DB계정명</label>
<div class="col-sm-8">
<input type="text" class="form-control" name="db_id" id="db_id" placeholder="DB계정" />
</div>
</div>
<div class="form-group row">
<label for="kakao_admin_key" class="col-sm-4 col-form-label">카카오 API Admin Key</label>
<div class="col-sm-8">
<input type="text" class="form-control" name="kakao_admin_key" id="kakao_admin_key"
placeholder="카카오톡 API의 Admin Key"
value="" />
</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 class="form-group row">
<label for="db_pw" class="col-sm-4 col-form-label">DB비밀번호</label>
<div class="col-sm-8">
<input type="password" class="form-control" name="db_pw" id="db_pw" placeholder="DB비밀번호" />
</div>
</div>
<div class="form-group row">
<label for="db_name" class="col-sm-4 col-form-label">DB명</label>
<div class="col-sm-8">
<input type="text" class="form-control" name="db_name" id="db_name" placeholder="DB명(예:sammo)" />
</div>
</div>
<div class="form-group row">
<label for="serv_host" class="col-sm-4 col-form-label">접속 경로</label>
<div class="col-sm-8">
<input type="text" class="form-control" name="serv_host" id="serv_host" placeholder="접속경로(예:http://www.example.com)" />
</div>
</div>
<div class="form-group row">
<label for="shared_icon_path" class="col-sm-4 col-form-label">공용 아이콘 주소</label>
<div class="col-sm-8">
<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">
<label for="image_request_key" class="col-sm-4 col-form-label">이미지 갱신 키</label>
<div class="input-group col-sm-8">
<input type="text" class="form-control" name="image_request_key" id="image_request_key" placeholder="이미지 서버의 hook/HashKey.php의 값과 동일하게" value="" />
<div class="input-group-text">
<button id="btn_random_generate_key" class="btn btn-secondary" type="button">랜덤 생성</button>
</div>
</div>
</div>
<hr style="width:100%; border-top: 1px solid lightgray;">
<div class="form-group row">
<label for="kakao_rest_key" class="col-sm-4 col-form-label">카카오 API Rest Key</label>
<div class="col-sm-8">
<input type="text" class="form-control" name="kakao_rest_key" id="kakao_rest_key" placeholder="카카오톡 API의 Rest Key" value="" />
</div>
</div>
<div class="form-group row">
<label for="kakao_admin_key" class="col-sm-4 col-form-label">카카오 API Admin Key</label>
<div class="col-sm-8">
<input type="text" class="form-control" name="kakao_admin_key" id="kakao_admin_key" placeholder="카카오톡 API의 Admin Key" value="" />
</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>
</form>
</div>
</form>
</div>
<!--DB 폼 끝-->
<div class="card" id="admin_form_card" style="display:none">
<h3 class="card-header">
설치(관리자 생성)
</h3>
<div class="card-body">
<form id="admin_form" method="post" action="#">
<div class="form-group row">
<label for="username" class="col-sm-3 col-form-label">계정명</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="username" id="username" placeholder="계정명" />
</div>
</div>
<div class="form-group row">
<label for="password" class="col-sm-3 col-form-label">비밀번호</label>
<div class="col-sm-9">
<input type="password" class="form-control" name="password" id="password" placeholder="비밀번호" />
</div>
</div>
<div class="form-group row">
<label for="confirm_password" class="col-sm-3 col-form-label">비밀번호 확인</label>
<div class="col-sm-9">
<input type="password" class="form-control" name="confirm_password" id="confirm_password" placeholder="비밀번호 확인" />
</div>
</div>
<div class="form-group row">
<label for="nickname" class="col-sm-3 col-form-label">닉네임</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="nickname" id="nickname" placeholder="닉네임" value="운영자" />
</div>
</div>
<input type="hidden" id="global_salt" name="global_salt">
<div class="form-group row">
<div class="col-sm-3"></div>
<div class="col-sm-9">
<button type="submit" class="btn btn-primary btn-lg btn-block login-button">관리자 계정 생성</button>
</div>
</div>
</form>
</div>
</div>
<!--ADMIN 폼 끝-->
<!-- TODO: conf_kakao.php -->
</div>
</div><!--DB 폼 끝-->
<div class="card" id="admin_form_card" style="display:none">
<h3 class="card-header">
설치(관리자 생성)
</h3>
<div class="card-body">
<form id="admin_form" method="post" action="#">
<div class="form-group row">
<label for="username" class="col-sm-3 col-form-label">계정명</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="username" id="username"
placeholder="계정명"/>
</div>
</div>
<div class="form-group row">
<label for="password" class="col-sm-3 col-form-label">비밀번호</label>
<div class="col-sm-9">
<input type="password" class="form-control" name="password" id="password"
placeholder="비밀번호"/>
</div>
</div>
<div class="form-group row">
<label for="confirm_password" class="col-sm-3 col-form-label">비밀번호 확인</label>
<div class="col-sm-9">
<input type="password" class="form-control" name="confirm_password" id="confirm_password"
placeholder="비밀번호 확인"/>
</div>
</div>
<div class="form-group row">
<label for="nickname" class="col-sm-3 col-form-label">닉네임</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="nickname" id="nickname"
placeholder="닉네임" value="운영자"/>
</div>
</div>
<input type="hidden" id="global_salt" name="global_salt">
<div class="form-group row">
<div class="col-sm-3"></div>
<div class="col-sm-9">
<button type="submit"
class="btn btn-primary btn-lg btn-block login-button">관리자 계정 생성</button>
</div>
</div>
</form>
</div>
</div><!--ADMIN 폼 끝-->
<!-- TODO: conf_kakao.php -->
</div>
</div>
</div>
</body>
</html>
</html>
+17 -2
View File
@@ -58,7 +58,7 @@ CREATE TABLE `member_log` (
INDEX `action` (`member_no`, `action_type`, `date`),
INDEX `member` (`member_no`, `date`)
)
ENGINE=MyISAM DEFAULT CHARSET=utf8mb4;
ENGINE=Aria DEFAULT CHARSET=utf8mb4;
###################
# KV storage
@@ -72,4 +72,19 @@ CREATE TABLE if not exists `storage` (
UNIQUE INDEX `key` (`namespace`, `key`)
)
COLLATE='utf8mb4_general_ci'
ENGINE=MyISAM
ENGINE=Aria;
CREATE TABLE `login_token` (
`id` INT(11) NOT NULL AUTO_INCREMENT,
`user_id` INT(11) NOT NULL,
`base_token` VARCHAR(20) NOT NULL COLLATE 'utf8mb4_general_ci',
`reg_ip` VARCHAR(40) NOT NULL COLLATE 'utf8mb4_general_ci',
`reg_date` DATETIME NOT NULL,
`expire_date` DATETIME NOT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `by_token` (`base_token`),
INDEX `by_date` (`user_id`, `expire_date`)
)
COLLATE='utf8mb4_general_ci'
ENGINE=Aria
;
+1
View File
@@ -1,6 +1,7 @@
<?php
namespace kakao;
// @suppress PhanRedefineClass
class KakaoKey{
const REST_KEY = '_tK_REST_API_KEY_';
const ADMIN_KEY = '_tK_ADMIN_KEY_';
+31
View File
@@ -2,9 +2,15 @@
namespace sammo;
//https://hub.packtpub.com/eloquent-without-laravel/
use Illuminate\Database\Capsule\Manager as Capsule;
use Illuminate\Events\Dispatcher;
use Illuminate\Container\Container;
class RootDB
{
private static $uDB = null;
private static ?Capsule $uIlluminate = null;
private static $host = '_tK_host_';
private static $user = '_tK_user_';
@@ -12,6 +18,8 @@ class RootDB
private static $dbName = '_tK_dbName_';
private static $port = _tK_port_;
private static $encoding = 'utf8mb4';
private static $collation = 'utf8mb4_general_ci';
private static $globalSalt = '_tK_globalSalt_';
@@ -19,6 +27,29 @@ class RootDB
{
}
public static function illuminate(): Capsule
{
if(self::$uIlluminate !== null){
return self::$uIlluminate;
}
$capsule = new Capsule;
$capsule->addConnection([
'driver' => 'mysql',
'host' => self::$host,
'database' => self::$dbName,
'username' => self::$user,
'password' => self::$password,
'charset' => self::$encoding,
'collation' => self::$collation,
], 'root');
$capsule->setEventDispatcher(new Dispatcher(new Container));
$capsule->bootEloquent();
self::$uIlluminate = $capsule;
return $capsule;
}
/**
* DB 객체 생성
*
+5 -10
View File
@@ -6,38 +6,33 @@
.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_/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_/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_/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_/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_/ad.gif') no-repeat left,
url('_tK_gameImagePath_/winter.gif') no-repeat right;
}
+2 -2
View File
@@ -24,7 +24,8 @@ $plock = $db->queryFirstField('SELECT plock FROM plock');
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<?= WebUtil::printDist('ts', 'common', true) ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
</head>
<body>
<form action=_119_b.php method=post>
@@ -35,4 +36,3 @@ $plock = $db->queryFirstField('SELECT plock FROM plock');
</form>
</body>
</html>
+2 -1
View File
@@ -22,7 +22,8 @@ $admin = getAdmin();
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<?= WebUtil::printDist('ts', 'common', true) ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
</head>
<body>
<table align=center width=1000 class="tb_layout bg0">
+4 -3
View File
@@ -23,7 +23,8 @@ $db = DB::db();
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<?= WebUtil::printCSS('css/common.css') ?>
<?= WebUtil::printDist('ts', 'common', true) ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
</head>
<body>
@@ -50,7 +51,7 @@ $db = DB::db();
<?php
echo "
<select name=genlist[] size=20 multiple style='color:white;background-color:black;font-size:13px'>";
<select name=genlist[] size=20 multiple style='color:white;background-color:black;font-size:14px'>";
$generalList = $db->query('SELECT `no`, `name`, npc, `block` FROM general ORDER BY npc, binary(`name`)');
foreach ($generalList as $general) {
@@ -73,7 +74,7 @@ $db = DB::db();
</td>
<td width=100 align=center>아이템 지급</td>
<td width=504>
<select name=weapon size=1 style='color:white;background-color:black;font-size:13px'>";
<select name=weapon size=1 style='color:white;background-color:black;font-size:14px'>";
foreach (GameConst::$allItems as $itemCategories) {
foreach ($itemCategories as $item => $cnt) {
if ($cnt == 0) {
+1
View File
@@ -342,6 +342,7 @@ switch ($btn) {
}
break;
case "랜덤턴":
$turnterm = $gameStor->turnterm;
foreach ($genlist as $generalID) {
$turntime = getRandTurn($turnterm);
$db->update('general', [
+15 -13
View File
@@ -23,8 +23,9 @@ $ipGroupList = Util::arrayGroupBy(
'ip_c'
);
function colorBlockedName($general){
if(!$general['blocked']){
function colorBlockedName($general)
{
if (!$general['blocked']) {
return $general['name'];
}
return "<span style='color:magenta;'>{$general['name']}</span>";
@@ -40,7 +41,8 @@ function colorBlockedName($general){
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<?= WebUtil::printCSS('css/common.css') ?>
<?= WebUtil::printDist('ts', 'common', true) ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
</head>
<body>
@@ -61,7 +63,7 @@ function colorBlockedName($general){
<?php
echo "
<select name=genlist[] size=20 multiple style='color:white;background-color:black;font-size:13px'>";
<select name=genlist[] size=20 multiple style='color:white;background-color:black;font-size:14px'>";
foreach ($db->query('SELECT no,name,npc,block,con from general where ip!=\'\' order by npc,ip') as $general) {
$style = "style=;";
@@ -106,15 +108,15 @@ function colorBlockedName($general){
<td align=center width=180>최근로그인</td>
<td align=center width=129>IP</td>
<td align=center width=100>ID</td>
</tr>
<?php foreach($ipGroupList as $ipGroupC=>$users): ?>
<tr>
<td><?=join('<br>',array_map('\sammo\colorBlockedName', $users))?></td>
<td><?=join('<br>',array_column($users, 'lastconnect'))?></td>
<td><?=join('<br>',array_column($users, 'ip'))?></td>
<td><?=join('<br>',array_column($users, 'owner'))?></td>
</tr>
<?php endforeach; ?>
</tr>
<?php foreach ($ipGroupList as $ipGroupC => $users) : ?>
<tr>
<td><?= join('<br>', array_map('\sammo\colorBlockedName', $users)) ?></td>
<td><?= join('<br>', array_column($users, 'lastconnect')) ?></td>
<td><?= join('<br>', array_column($users, 'ip')) ?></td>
<td><?= join('<br>', array_column($users, 'owner')) ?></td>
</tr>
<?php endforeach; ?>
</table>
<?php
//NOTE: password의 md5 해시가 같은지 확인하는 방식으로는 앞으로 잡아낼 수 없다. 폐기
+7 -6
View File
@@ -39,7 +39,8 @@ $sel2[$type2] = "selected";
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<?= WebUtil::printCSS('css/common.css') ?>
<?= WebUtil::printDist('ts', 'common', true) ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
</head>
<body>
@@ -99,7 +100,7 @@ $sel2[$type2] = "selected";
</table>
<table align=center width=1600 class="tb_layout bg0">
<tr id=bg1>
<tr class='bg1'>
<td align=center>국명</td>
<td align=center>접률</td>
<td align=center>단접</td>
@@ -211,7 +212,7 @@ GROUP BY B.nation
$query .= " order by avg(B.dex5) desc";
break;
}
foreach($db->query($query) as $nation){
foreach ($db->query($query) as $nation) {
$gen = $db->queryFirstRow('SELECT COUNT(*) as cnt,
ROUND(AVG(gold)) as avgg,
ROUND(AVG(rice)) as avgr,
@@ -220,7 +221,7 @@ GROUP BY B.nation
ROUND(AVG(intel), 1) as avgi,
ROUND(AVG(explevel), 1) as avge,
SUM(crew) as crew
from general where nation=%i',$nation['nation']);
from general where nation=%i', $nation['nation']);
$city = $db->queryFirstRow('SELECT COUNT(*) as cnt,
SUM(pop) as pop, SUM(pop_max) as pop_max,
@@ -278,7 +279,7 @@ from city where nation=%i', $nation['nation']);
</table>
<table align=center width=1760 class="tb_layout bg0">
<tr id=bg1>
<tr class='bg1'>
<td width=30 align=center>년</td>
<td width=30 align=center>월</td>
<td width=50 align=center>국가수</td>
@@ -311,7 +312,7 @@ from city where nation=%i', $nation['nation']);
?>
</tr>
<?php
foreach($db->query('SELECT * from statistic where month=1 or no=1') as $stat){
foreach ($db->query('SELECT * from statistic where month=1 or no=1') as $stat) {
echo "
<tr>
<td align=center>{$stat['year']}</td>
+11 -10
View File
@@ -52,9 +52,9 @@ if ($reqArgType === 0) {
$generalBasicList = $db->query('SELECT no, name, nation, npc, turntime, %b FROM general', $reqQueryType);
} else if ($reqArgType === 2) {
$generalBasicList = $db->query(
'SELECT no, name, nation, npc, turntime, value as %b
FROM general LEFT JOIN rank_data
ON general.no = rank_data.general_id
'SELECT no, name, nation, npc, turntime, value as %b
FROM general LEFT JOIN rank_data
ON general.no = rank_data.general_id
WHERE rank_data.type = %s',
$reqQueryType,
$reqQueryType
@@ -86,7 +86,8 @@ $generalObj = General::createGeneralObjFromDB($gen);
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<?= WebUtil::printCSS('css/common.css') ?>
<?= WebUtil::printDist('ts', 'common', true) ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
</head>
<body>
@@ -117,10 +118,10 @@ $generalObj = General::createGeneralObjFromDB($gen);
</table>
<table width=1000 align=center class='tb_layout bg0'>
<tr>
<td width=50% align=center id=bg1>
<td width=50% align=center class='bg1'>
<font color=skyblue size=3>장 수 정 보</font>
</td>
<td width=50% align=center id=bg1>
<td width=50% align=center class='bg1'>
<font color=orange size=3>-</font>
</td>
</tr>
@@ -133,10 +134,10 @@ $generalObj = General::createGeneralObjFromDB($gen);
</td>
</tr>
<tr>
<td align=center id=bg1>
<td align=center class='bg1'>
<font color=skyblue size=3>개인 기록</font>
</td>
<td align=center id=bg1>
<td align=center class='bg1'>
<font color=orange size=3>전투 기록</font>
</td>
</tr>
@@ -149,10 +150,10 @@ $generalObj = General::createGeneralObjFromDB($gen);
</td>
</tr>
<tr>
<td align=center id=bg1>
<td align=center class='bg1'>
<font color=skyblue size=3>장수 열전</font>
</td>
<td align=center id=bg1>
<td align=center class='bg1'>
<font color=orange size=3>전투 결과</font>
</td>
</tr>
+87 -64
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -25,75 +26,97 @@ $sel[$type] = "selected";
?>
<!DOCTYPE html>
<html>
<head>
<title>외교정보</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<title>외교정보</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<?= WebUtil::printDist('ts', 'common', true) ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
</head>
<body>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td>외 교 정 보<br><?=closeButton()?></td></tr>
<tr><td>
<form name=form1 method=post>
정렬순서 :
<select name=type size=1>
<option <?=$sel[0]??''?> value=0>상태</option>
</select>
<input type=submit name=btn value='정렬하기'>
</form>
</td></tr>
</table>
<table width=1000 align=center class='tb_layout bg0'>
<tr><td colspan=9 align=center bgcolor=blue>외 교 관 계</td></tr>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td>외 교 정 보<br><?= closeButton() ?></td>
</tr>
<tr>
<td>
<form name=form1 method=post>
정렬순서 :
<select name=type size=1>
<option <?= $sel[0] ?? '' ?> value=0>상태</option>
</select>
<input type=submit name=btn value='정렬하기'>
</form>
</td>
</tr>
</table>
<table width=1000 align=center class='tb_layout bg0'>
<tr>
<td colspan=9 align=center bgcolor=blue>외 교 관 계</td>
</tr>
<tr>
<td width=130 align=center class='bg1'>국 가 명</td>
<td width=130 align=center class='bg1'>국 가 명</td>
<td width=80 align=center class='bg1'>상 태</td>
<td width=60 align=center class='bg1'>기 간</td>
</tr>
<?php
$nationName = [];
$nationColor = [];
foreach (getAllNationStaticInfo() as $nation) {
$nationName[$nation['nation']] = $nation['name'];
$nationColor[$nation['nation']] = $nation['color'];
}
foreach ($db->query('SELECT * from diplomacy where me < you order by state desc') as $dip) {
$me = $dip['me'];
$you = $dip['you'];
if ($dip['state'] == 2) {
continue;
}
switch ($dip['state']) {
case 0:
$state = "<font color=red>교 전</font>";
break;
case 1:
$state = "<font color=magenta>선포중</font>";
break;
case 2:
$state = "통 상";
break;
case 7:
$state = "<font color=green>불가침</font>";
break;
}
$date = TimeUtil::now();
echo "
<tr>
<td width=130 align=center id=bg1>국 가 명</td>
<td width=130 align=center id=bg1>국 가 명</td>
<td width=80 align=center id=bg1>상 태</td>
<td width=60 align=center id=bg1>기 간</td>
</tr>
<?php
$nationName = [];
$nationColor = [];
foreach (getAllNationStaticInfo() as $nation) {
$nationName[$nation['nation']] = $nation['name'];
$nationColor[$nation['nation']] = $nation['color'];
}
foreach($db->query('SELECT * from diplomacy where me < you order by state desc') as $dip){
$me = $dip['me'];
$you = $dip['you'];
if ($dip['state'] == 2) {
continue;
}
switch ($dip['state']) {
case 0: $state = "<font color=red>교 전</font>"; break;
case 1: $state = "<font color=magenta>선포중</font>"; break;
case 2: $state = "통 상"; break;
case 7: $state = "<font color=green>불가침</font>"; break;
}
$date = TimeUtil::now();
echo "
<tr>
<td align=center style=color:".newColor($nationColor[$me]).";background-color:{$nationColor[$me]};>$nationName[$me]</td>
<td align=center style=color:".newColor($nationColor[$you]).";background-color:{$nationColor[$you]};>$nationName[$you]</td>
<td align=center style=color:" . newColor($nationColor[$me]) . ";background-color:{$nationColor[$me]};>$nationName[$me]</td>
<td align=center style=color:" . newColor($nationColor[$you]) . ";background-color:{$nationColor[$you]};>$nationName[$you]</td>
<td align=center>$state</td>
<td align=center>{$dip['term']} 개월</td>
</tr>";
}
?>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td><?=closeButton()?></td></tr>
<tr><td><?=banner()?> </td></tr>
</table>
}
?>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td><?= closeButton() ?></td>
</tr>
<tr>
<td><?= banner() ?> </td>
</tr>
</table>
</body>
</html>
</html>
+6
View File
@@ -24,3 +24,9 @@ foreach ($db->queryFirstColumn(
) as $generalNo) {
CheckHall($generalNo);
}
foreach(General::createGeneralObjListFromDB($db->queryFirstColumn('SELECT `no` FROM general WHERE npc = 0')) as $genObj){
$genObj->mergeTotalInheritancePoint(true);
applyInheritanceUser($genObj->getVar('owner'));
$genObj->clearInheritancePoint();
}
+348 -305
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -14,327 +15,369 @@ $db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
increaseRefresh("명장일람", 1);
$templates = new \League\Plates\Engine(__DIR__.'/templates');
$templates = new \League\Plates\Engine(__DIR__ . '/templates');
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1136" />
<title><?=UniqueConst::$serverName?>: 명장일람</title>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<?=WebUtil::printCSS('css/hallOfFame.css')?>
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('js/common.js')?>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1136" />
<title><?= UniqueConst::$serverName ?>: 명장일람</title>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printCSS('css/hallOfFame.css') ?>
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printDist('ts', 'common') ?>
</head>
<body>
<table align=center width=1100 class='tb_layout bg0'>
<tr><td>명 장 일 람<br><?=closeButton()?></td></tr>
</table>
<table align=center width=1100 class='tb_layout bg0'>
<form name=form1 action=a_bestGeneral.php method=post>
<tr><td align=center>
<input type=submit name=btn value='유저 보기'>
<input type=submit name=btn value='NPC 보기'>
</td></tr>
</form>
</table>
<div style="margin:auto;width:1100px;">
<?php
<table align=center width=1100 class='tb_layout bg0'>
<tr>
<td>명 장 일 람<br><?= closeButton() ?></td>
</tr>
</table>
<table align=center width=1100 class='tb_layout bg0'>
<form name=form1 action=a_bestGeneral.php method=post>
<tr>
<td align=center>
<input type=submit name=btn value='유저 보기'>
<input type=submit name=btn value='NPC 보기'>
</td>
</tr>
</form>
</table>
<div style="margin:auto;width:1100px;">
<?php
$ownerNameList = [];
if($gameStor->isunited){
foreach(RootDB::db()->queryAllLists('SELECT no, name FROM member') as [$ownerID, $ownerName]){
$ownerNameList[$ownerID] = $ownerName;
}
}
$ownerNameList = [];
if ($gameStor->isunited) {
foreach (RootDB::db()->queryAllLists('SELECT no, name FROM member') as [$ownerID, $ownerName]) {
$ownerNameList[$ownerID] = $ownerName;
}
}
$nationName = [0=>'재야'];
$nationColor = [0=>'#000000'];
foreach (getAllNationStaticInfo() as $nation) {
$nationName[$nation['nation']] = $nation['name'];
$nationColor[$nation['nation']] = $nation['color'];
}
$nationName = [0 => '재야'];
$nationColor = [0 => '#000000'];
foreach (getAllNationStaticInfo() as $nation) {
$nationName[$nation['nation']] = $nation['name'];
$nationColor[$nation['nation']] = $nation['color'];
}
$types = [
["명 성", "int", function($v){$v['value'] = $v['experience']; return $v; }],
["계 급", "int", function($v){$v['value'] = $v['dedication']; return $v; }],
["계 략 성 공", "int", function($v) use ($gameStor){
$v['value'] = $v['firenum'];
if($gameStor->isunited){
return $v;
}
$v['nationName'] = '???';
$v['pictureFullPath'] = GetImageURL(0)."/default.jpg";
$v['name'] = '???';
$v['ownerName'] = null;
$v['bgColor'] = GameConst::$basecolor4;
$v['fgColor'] = newColor($v['bgColor']);
return $v;
}],
["전 투 횟 수", "int", function($v){$v['value'] = $v['warnum']; return $v; }],
["승 리", "int", function($v){$v['value'] = $v['killnum']; return $v; }],
["승 률", "percent", function($v){
if($v['warnum'] < 10){
$v['value'] = 0;
}
else{
$v['value'] = $v['killnum'] / max(1, $v['warnum']);
}
return $v;
}],
["점 령", "int", function($v){$v['value'] = $v['occupied']; return $v; }],
["사 살", "int", function($v){$v['value'] = $v['killcrew']; return $v; }],
["살 상 률", "percent", function($v){
if($v['warnum'] < 10){
$v['value'] = 0;
}
else{
$v['value'] = $v['killcrew'] / max(1, $v['deathcrew']);
}
return $v;
}],
["대 인 사 살", "int", function($v){$v['value'] = $v['killcrew_person']; return $v; }],
["대 인 살 상 률", "percent", function($v){
if($v['warnum'] < 10){
$v['value'] = 0;
}
else{
$v['value'] = $v['killcrew_person'] / max(1, $v['deathcrew_person']);
}
return $v;
}],
["보 병 숙 련 도", "int", function($v){$v['value'] = $v['dex1']; return $v; }],
["궁 병 숙 련 도", "int", function($v){$v['value'] = $v['dex2']; return $v; }],
["기 병 숙 련 도", "int", function($v){$v['value'] = $v['dex3']; return $v; }],
["귀 병 숙 련 도", "int", function($v){$v['value'] = $v['dex4']; return $v; }],
["차 병 숙 련 도", "int", function($v){$v['value'] = $v['dex5']; return $v; }],
["전 력 전 승 률", "percent", function($v){
$totalCnt = $v['ttw']+$v['ttd']+$v['ttl'];
if($totalCnt < 50){
$v['value'] = 0;
}
else{
$v['value'] = $v['ttw']/max(1, $totalCnt);
}
return $v;
}],
["통 솔 전 승 률", "percent", function($v){
$totalCnt = $v['tlw']+$v['tld']+$v['tll'];
if($totalCnt < 50){
$v['value'] = 0;
}
else{
$v['value'] = $v['tlw']/max(1, $totalCnt);
}
return $v;
}],
["일 기 토 승 률", "percent", function($v){
$totalCnt = $v['tsw']+$v['tsd']+$v['tsl'];
if($totalCnt < 50){
$v['value'] = 0;
}
else{
$v['value'] = $v['tsw']/max(1, $totalCnt);
}
return $v;
}],
["설 전 승 률", "percent", function($v){
$totalCnt = $v['tiw']+$v['tid']+$v['til'];
if($totalCnt < 50){
$v['value'] = 0;
}
else{
$v['value'] = $v['tiw']/max(1, $totalCnt);
}
return $v;
}],
["베 팅 투 자 액", "int", function($v){$v['value'] = $v['betgold']; return $v; }],
["베 팅 당 첨", "int", function($v){$v['value'] = $v['betwin']; return $v; }],
["베 팅 수 익 금", "int", function($v){$v['value'] = $v['betwingold']; return $v; }],
["베 팅 수 익 률", "percent", function($v){
if($v['betgold'] < GameConst::$defaultGold){
$v['value'] = 0;
}
else{
$v['value'] = $v['betwingold']/max(1, $v['betgold']);
}
return $v;
}],
];
$types = [
["명 성", "int", function ($v) {
$v['value'] = $v['experience'];
return $v;
}],
["계 급", "int", function ($v) {
$v['value'] = $v['dedication'];
return $v;
}],
["계 략 성 공", "int", function ($v) use ($gameStor) {
$v['value'] = $v['firenum'];
if ($gameStor->isunited) {
return $v;
}
$v['nationName'] = '???';
$v['pictureFullPath'] = GetImageURL(0) . "/default.jpg";
$v['name'] = '???';
$v['ownerName'] = null;
$v['bgColor'] = GameConst::$basecolor4;
$v['fgColor'] = newColor($v['bgColor']);
return $v;
}],
["전 투 횟 수", "int", function ($v) {
$v['value'] = $v['warnum'];
return $v;
}],
["승 리", "int", function ($v) {
$v['value'] = $v['killnum'];
return $v;
}],
["승 률", "percent", function ($v) {
if ($v['warnum'] < 10) {
$v['value'] = 0;
} else {
$v['value'] = $v['killnum'] / max(1, $v['warnum']);
}
return $v;
}],
["점 령", "int", function ($v) {
$v['value'] = $v['occupied'];
return $v;
}],
["사 살", "int", function ($v) {
$v['value'] = $v['killcrew'];
return $v;
}],
["살 상 률", "percent", function ($v) {
if ($v['warnum'] < 10) {
$v['value'] = 0;
} else {
$v['value'] = $v['killcrew'] / max(1, $v['deathcrew']);
}
return $v;
}],
["대 인 사 살", "int", function ($v) {
$v['value'] = $v['killcrew_person'];
return $v;
}],
["대 인 살 상 률", "percent", function ($v) {
if ($v['warnum'] < 10) {
$v['value'] = 0;
} else {
$v['value'] = $v['killcrew_person'] / max(1, $v['deathcrew_person']);
}
return $v;
}],
["보 병 숙 련 도", "int", function ($v) {
$v['value'] = $v['dex1'];
return $v;
}],
["궁 병 숙 련 도", "int", function ($v) {
$v['value'] = $v['dex2'];
return $v;
}],
["기 병 숙 련 도", "int", function ($v) {
$v['value'] = $v['dex3'];
return $v;
}],
["귀 병 숙 련 도", "int", function ($v) {
$v['value'] = $v['dex4'];
return $v;
}],
["차 병 숙 련 도", "int", function ($v) {
$v['value'] = $v['dex5'];
return $v;
}],
["전 력 전 승 률", "percent", function ($v) {
$totalCnt = $v['ttw'] + $v['ttd'] + $v['ttl'];
if ($totalCnt < 50) {
$v['value'] = 0;
} else {
$v['value'] = $v['ttw'] / max(1, $totalCnt);
}
return $v;
}],
["통 솔 전 승 률", "percent", function ($v) {
$totalCnt = $v['tlw'] + $v['tld'] + $v['tll'];
if ($totalCnt < 50) {
$v['value'] = 0;
} else {
$v['value'] = $v['tlw'] / max(1, $totalCnt);
}
return $v;
}],
["일 기 토 승 률", "percent", function ($v) {
$totalCnt = $v['tsw'] + $v['tsd'] + $v['tsl'];
if ($totalCnt < 50) {
$v['value'] = 0;
} else {
$v['value'] = $v['tsw'] / max(1, $totalCnt);
}
return $v;
}],
["설 전 승 률", "percent", function ($v) {
$totalCnt = $v['tiw'] + $v['tid'] + $v['til'];
if ($totalCnt < 50) {
$v['value'] = 0;
} else {
$v['value'] = $v['tiw'] / max(1, $totalCnt);
}
$generals = [];
foreach($db->query(
"SELECT nation,no,name,owner_name as ownerName, owner, picture, imgsvr,
return $v;
}],
["베 팅 투 자 액", "int", function ($v) {
$v['value'] = $v['betgold'];
return $v;
}],
["베 팅 당 첨", "int", function ($v) {
$v['value'] = $v['betwin'];
return $v;
}],
["베 팅 수 익 금", "int", function ($v) {
$v['value'] = $v['betwingold'];
return $v;
}],
["베 팅 수 익 률", "percent", function ($v) {
if ($v['betgold'] < GameConst::$defaultGold) {
$v['value'] = 0;
} else {
$v['value'] = $v['betwingold'] / max(1, $v['betgold']);
}
return $v;
}],
];
$generals = [];
foreach ($db->query(
"SELECT nation,no,name,owner_name as ownerName, owner, picture, imgsvr,
experience, dedication,
dex1, dex2, dex3, dex4, dex5,
horse, weapon, book, item
FROM general WHERE %l", $btn == "NPC 보기"?"npc>=2":"npc<2") as $general
){
$generalID = $general['no'];
$general['bgColor'] = $nationColor[$general['nation']]??GameConst::$basecolor4;
$general['fgColor'] = newColor($general['bgColor']);
$general['nationName'] = $nationName[$general['nation']];
if(key_exists('picture', $general)){
$imageTemp = GetImageURL($general['imgsvr']);
$general['pictureFullPath'] = "$imageTemp/{$general['picture']}";
}
else{
$general['pictureFullPath'] = GetImageURL(0)."/default.jpg";
}
dex1, dex2, dex3, dex4, dex5,
horse, weapon, book, item
FROM general WHERE %l",
$btn == "NPC 보기" ? "npc>=2" : "npc<2"
) as $general) {
$generalID = $general['no'];
$general['bgColor'] = $nationColor[$general['nation']] ?? GameConst::$basecolor4;
$general['fgColor'] = newColor($general['bgColor']);
$general['nationName'] = $nationName[$general['nation']];
$generals[$generalID] = $general;
}
foreach($db->queryAllLists('SELECT general_id, `type`, `value` FROM rank_data') as [$generalID, $typeKey, $value]){
if(!key_exists($generalID, $generals)){
continue;
}
$generals[$generalID][$typeKey] = $value;
}
$templates = new \League\Plates\Engine('templates');
foreach($types as $idx=>[$typeName, $typeValue, $typeFunc]){
$validCnt = 0;
$typeGenerals = array_map(function($general) use($typeValue, $typeFunc, &$validCnt, $ownerNameList){
$general['ownerName'] = $ownerNameList[$general['owner']]??null;
$general = ($typeFunc)($general);
$value = $general['value'];
if($value > 0){
$validCnt+=1;
}
if($typeValue == 'percent'){
$general['printValue'] = number_format($value*100, 2).'%';
}
else {
$general['printValue'] = number_format($value);
}
return $general;
}, $generals);
usort($typeGenerals, function($lhs, $rhs){
//내림차순
return -($lhs['value'] <=> $rhs['value']);
});
echo $templates->render('hallOfFrame', [
'typeName'=>$typeName,
'generals'=>array_slice($typeGenerals, 0, min(10, $validCnt))
]);
}
?>
</div>
<div style="margin:auto;width:1100px;margin-top:5px;">
<?php
//유니크 아이템 소유자
$itemTypes = [
'horse'=>'명 마',
'weapon'=>'명 검',
'book'=>'명 서',
'item'=>'도 구'
];
$simpleItemTypes = array_keys($itemTypes); array_map(function($itemType){return $itemType[1];}, $itemTypes);
$itemOwners = [];
foreach($generals as $general){
foreach($itemTypes as $itemType=>$itemTypeName){
$itemClassName = $general[$itemType];
$itemClass = buildItemClass($itemClassName);
if($itemClass->isBuyable()){
continue;
}
if(key_exists($itemClassName, $itemOwners)){
$itemOwners[$itemClassName][] = $general;
}
else{
$itemOwners[$itemClassName] = [$general];
}
}
}
foreach(GameConst::$allItems as $itemType=>$itemList){
$itemNameType = $itemTypes[$itemType];
$itemList = array_reverse($itemList, true);
$itemRanker = [];
foreach($itemList as $itemClassName=>$itemCnt){
if($itemCnt==0){
continue;
}
$itemClass = buildItemClass($itemClassName);
if($itemClass->isBuyable()){
continue;
}
$info = $itemClass->getInfo();
$name = $itemClass->getName();
if($info){
$name = $templates->render('tooltip', [
'text'=>$name,
'info'=>$info,
]);
}
foreach(Util::range($itemCnt) as $itemIdx){
if(($itemOwners[$itemClassName][$itemIdx]??null) === null){
$emptyCard = [
'rankName' => $name,
'pictureFullPath' => GetImageURL(0)."/default.jpg",
'value'=>$itemClassName,
'name'=>'미발견',
'bgColor'=>GameConst::$basecolor4,
'fgColor'=>newColor(GameConst::$basecolor4),
];
$itemRanker[] = $emptyCard;
continue;
if (key_exists('picture', $general)) {
$imageTemp = GetImageURL($general['imgsvr']);
$general['pictureFullPath'] = "$imageTemp/{$general['picture']}";
} else {
$general['pictureFullPath'] = GetImageURL(0) . "/default.jpg";
}
$general = $itemOwners[$itemClassName][$itemIdx];
$card = [
'rankName' => $name,
'pictureFullPath' => $general['pictureFullPath'],
'value'=>$itemClassName,
'nationName'=>$general['nationName'],
'name'=>$general['name'],
'bgColor'=>$general['bgColor'],
'fgColor'=>$general['fgColor'],
];
$itemRanker[] = $card;
$generals[$generalID] = $general;
}
}
echo $templates->render('hallOfFrame', [
'typeName'=>$itemNameType,
'generals'=>$itemRanker
]);
}
?>
</div>
<table align=center width=1100 class='tb_layout bg0'>
<tr><td><?=closeButton()?></td></tr>
<tr><td><?=banner()?> </td></tr>
</table>
</body>
</html>
foreach ($db->queryAllLists('SELECT general_id, `type`, `value` FROM rank_data') as [$generalID, $typeKey, $value]) {
if (!key_exists($generalID, $generals)) {
continue;
}
$generals[$generalID][$typeKey] = $value;
}
$templates = new \League\Plates\Engine('templates');
foreach ($types as $idx => [$typeName, $typeValue, $typeFunc]) {
$validCnt = 0;
$typeGenerals = array_map(function ($general) use ($typeValue, $typeFunc, &$validCnt, $ownerNameList) {
$general['ownerName'] = $ownerNameList[$general['owner']] ?? null;
$general = ($typeFunc)($general);
$value = $general['value'];
if ($value > 0) {
$validCnt += 1;
}
if ($typeValue == 'percent') {
$general['printValue'] = number_format($value * 100, 2) . '%';
} else {
$general['printValue'] = number_format($value);
}
return $general;
}, $generals);
usort($typeGenerals, function ($lhs, $rhs) {
//내림차순
return - ($lhs['value'] <=> $rhs['value']);
});
echo $templates->render('hallOfFrame', [
'typeName' => $typeName,
'generals' => array_slice($typeGenerals, 0, min(10, $validCnt))
]);
}
?>
</div>
<div style="margin:auto;width:1100px;margin-top:5px;">
<?php
//유니크 아이템 소유자
$itemTypes = [
'horse' => '명 마',
'weapon' => '명 검',
'book' => '명 서',
'item' => '도 구'
];
$simpleItemTypes = array_keys($itemTypes);
array_map(function ($itemType) {
return $itemType[1];
}, $itemTypes);
$itemOwners = [];
foreach ($generals as $general) {
foreach ($itemTypes as $itemType => $itemTypeName) {
$itemClassName = $general[$itemType];
$itemClass = buildItemClass($itemClassName);
if ($itemClass->isBuyable()) {
continue;
}
if (key_exists($itemClassName, $itemOwners)) {
$itemOwners[$itemClassName][] = $general;
} else {
$itemOwners[$itemClassName] = [$general];
}
}
}
foreach (GameConst::$allItems as $itemType => $itemList) {
$itemNameType = $itemTypes[$itemType];
$itemList = array_reverse($itemList, true);
$itemRanker = [];
foreach ($itemList as $itemClassName => $itemCnt) {
if ($itemCnt == 0) {
continue;
}
$itemClass = buildItemClass($itemClassName);
if ($itemClass->isBuyable()) {
continue;
}
$info = $itemClass->getInfo();
$name = $itemClass->getName();
if ($info) {
$name = $templates->render('tooltip', [
'text' => $name,
'info' => $info,
]);
}
foreach (Util::range($itemCnt) as $itemIdx) {
if (($itemOwners[$itemClassName][$itemIdx] ?? null) === null) {
$emptyCard = [
'rankName' => $name,
'pictureFullPath' => GetImageURL(0) . "/default.jpg",
'value' => $itemClassName,
'name' => '미발견',
'bgColor' => GameConst::$basecolor4,
'fgColor' => newColor(GameConst::$basecolor4),
];
$itemRanker[] = $emptyCard;
continue;
}
$general = $itemOwners[$itemClassName][$itemIdx];
$card = [
'rankName' => $name,
'pictureFullPath' => $general['pictureFullPath'],
'value' => $itemClassName,
'nationName' => $general['nationName'],
'name' => $general['name'],
'bgColor' => $general['bgColor'],
'fgColor' => $general['fgColor'],
];
$itemRanker[] = $card;
}
}
echo $templates->render('hallOfFrame', [
'typeName' => $itemNameType,
'generals' => $itemRanker
]);
}
?>
</div>
<table align=center width=1100 class='tb_layout bg0'>
<tr>
<td><?= closeButton() ?></td>
</tr>
<tr>
<td><?= banner() ?> </td>
</tr>
</table>
</body>
</html>
+101 -95
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -12,118 +13,123 @@ increaseRefresh("왕조일람", 1);
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?=UniqueConst::$serverName?>: 왕조일람</title>
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('js/common.js')?>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?= UniqueConst::$serverName ?>: 왕조일람</title>
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printDist('ts', 'common') ?>
</head>
<body>
<table align=center width=1000 class="tb_layout bg0">
<tr><td>역 대 왕 조<br>
<button onclick=window.close()>창 닫기</button><br>
</td></tr>
</table>
<table align=center width=1000 class="tb_layout bg0">
<tr>
<td>역 대 왕 조<br>
<button onclick=window.close()>창 닫기</button><br>
</td>
</tr>
</table>
<?php
<?php
$showCurrentNation = true;
$showCurrentNation = true;
$emperiors = $db->query('SELECT * FROM emperior ORDER BY `no` DESC');
$emperiors = $db->query('SELECT * FROM emperior ORDER BY `no` DESC');
if($emperiors){
$serverID = $emperior[0]['server_id']??($emperior[0]['serverID']??null);
if($serverID == UniqueConst::$serverID){
$showCurrentNation = false;
if ($emperiors) {
$serverID = $emperior[0]['server_id'] ?? ($emperior[0]['serverID'] ?? null);
if ($serverID == UniqueConst::$serverID) {
$showCurrentNation = false;
}
}
}
if ($showCurrentNation) {
$gameStor = KVStorage::getStorage($db, 'game_env');
[$year, $month] = $gameStor->getValuesAsArray(['year', 'month']);
?>
if ($showCurrentNation) {
$gameStor = KVStorage::getStorage($db, 'game_env');
[$year, $month] = $gameStor->getValuesAsArray(['year', 'month']);
?>
<table align=center width=1000 style="margin-top:10px;" class='tb_layout bg0'>
<tr>
<td style="background-color:#333333;" align=center colspan=8>
<font size=5>현재 (<?=$year?>年 <?=$month?>月)</font>
<a href="a_history.php"><button type='button'>역사 보기</button></a>
</td>
</tr>
</table>
<table align=center width=1000 style="margin-top:10px;" class='tb_layout bg0'>
<tr>
<td style="background-color:#333333;" align=center colspan=8>
<font size=5>현재 (<?= $year ?>年 <?= $month ?>月)</font>
<a href="a_history.php"><button type='button'>역사 보기</button></a>
</td>
</tr>
</table>
<?php
}
<?php
}
foreach($emperiors as $emperior){
$serverID = $emperior['server_id']??($emperior['serverID']??null);
?>
foreach ($emperiors as $emperior) {
$serverID = $emperior['server_id'] ?? ($emperior['serverID'] ?? null);
?>
<table align=center width=1000 style="margin-top:10px;" class='tb_layout bg0'>
<tr>
<td bgcolor=skyblue align=center colspan=8>
<font size=5><?=$emperior['phase']?></font>
<a href="a_emperior_detail.php?select=<?=$emperior['no']?>"><button type='button'>자세히</button></a>
<?php if($emperior['server_id']): ?>
<a href="a_history.php?serverID=<?=$emperior['server_id']?>"><button type='button'>역사 보기</button></a>
<?php endif ?>
</td>
</tr>
<tr>
<td align=center style='color:<?=newColor($emperior['color'])?>;background-color:<?=$emperior['color']?>' colspan=8>
<font size=5><?=$emperior['name']?> (<?=$emperior['year']?>年 <?=$emperior['month']?>月)</font>
</td>
</tr>
<tr>
<td id=bg1 align=center width=80>국 력</td>
<td align=center width=170><?=$emperior['power']?></td>
<td id=bg1 align=center width=80>장 수</td>
<td align=center width=170><?=$emperior['gennum']?></td>
<td id=bg1 align=center width=80>속 령</td>
<td align=center width=170><?=$emperior['citynum']?></td>
<td id=bg1 align=center width=80>성 향</td>
<td align=center width=170><?=$emperior['type']?></td>
</tr>
<tr>
<td id=bg1 align=center>황 제</td>
<td align=center><?=$emperior['l12name']?></td>
<td id=bg1 align=center>승 상</td>
<td align=center><?=$emperior['l11name']?></td>
<td id=bg1 align=center>표 기 장 군</td>
<td align=center><?=$emperior['l10name']?></td>
<td id=bg1 align=center>사 공</td>
<td align=center><?=$emperior['l9name']?></td>
</tr>
<tr>
<td id=bg1 align=center>거 기 장 군</td>
<td align=center><?=$emperior['l8name']?></td>
<td id=bg1 align=center>태 위</td>
<td align=center><?=$emperior['l7name']?></td>
<td id=bg1 align=center>위 장 군</td>
<td align=center><?=$emperior['l6name']?></td>
<td id=bg1 align=center>사 도</td>
<td align=center><?=$emperior['l5name']?></td>
</tr>
</table>
<table align=center width=1000 style="margin-top:10px;" class='tb_layout bg0'>
<tr>
<td bgcolor=skyblue align=center colspan=8>
<font size=5><?= $emperior['phase'] ?></font>
<a href="a_emperior_detail.php?select=<?= $emperior['no'] ?>"><button type='button'>자세히</button></a>
<?php if ($emperior['server_id']) : ?>
<a href="a_history.php?serverID=<?= $emperior['server_id'] ?>"><button type='button'>역사 보기</button></a>
<?php endif ?>
</td>
</tr>
<tr>
<td align=center style='color:<?= newColor($emperior['color']) ?>;background-color:<?= $emperior['color'] ?>' colspan=8>
<font size=5><?= $emperior['name'] ?> (<?= $emperior['year'] ?>年 <?= $emperior['month'] ?>月)</font>
</td>
</tr>
<tr>
<td class='bg1' align=center width=80>국 력</td>
<td align=center width=170><?= $emperior['power'] ?></td>
<td class='bg1' align=center width=80>장 수</td>
<td align=center width=170><?= $emperior['gennum'] ?></td>
<td class='bg1' align=center width=80>속 령</td>
<td align=center width=170><?= $emperior['citynum'] ?></td>
<td class='bg1' align=center width=80>성 향</td>
<td align=center width=170><?= $emperior['type'] ?></td>
</tr>
<tr>
<td class='bg1' align=center>황 제</td>
<td align=center><?= $emperior['l12name'] ?></td>
<td class='bg1' align=center>승 상</td>
<td align=center><?= $emperior['l11name'] ?></td>
<td class='bg1' align=center>표 기 장 군</td>
<td align=center><?= $emperior['l10name'] ?></td>
<td class='bg1' align=center>사 공</td>
<td align=center><?= $emperior['l9name'] ?></td>
</tr>
<tr>
<td class='bg1' align=center>거 기 장 군</td>
<td align=center><?= $emperior['l8name'] ?></td>
<td class='bg1' align=center>태 위</td>
<td align=center><?= $emperior['l7name'] ?></td>
<td class='bg1' align=center>위 장 군</td>
<td align=center><?= $emperior['l6name'] ?></td>
<td class='bg1' align=center>사 도</td>
<td align=center><?= $emperior['l5name'] ?></td>
</tr>
</table>
<?php
}
?>
<?php
}
?>
<table style="margin-top:10px;" align=center width=1000 class='tb_layout bg0'>
<tr><td><?=closeButton()?></td></tr>
<tr><td><?=banner()?></td></tr>
</table>
<table style="margin-top:10px;" align=center width=1000 class='tb_layout bg0'>
<tr>
<td><?= closeButton() ?></td>
</tr>
<tr>
<td><?= banner() ?></td>
</tr>
</table>
</body>
</html>
+183 -179
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -13,8 +14,8 @@ $templates->registerFunction('ConvertLog', '\sammo\ConvertLog');
$templates->registerFunction('newColor', '\sammo\newColor');
increaseRefresh("왕조일람", 1);
$emperior = $db->queryFirstRow('SELECT * FROM emperior WHERE `no`=%i',$select);
$serverID = $emperior['server_id']??($emperior['serverID']??null);
$emperior = $db->queryFirstRow('SELECT * FROM emperior WHERE `no`=%i', $select);
$serverID = $emperior['server_id'] ?? ($emperior['serverID'] ?? null);
?>
@@ -22,196 +23,199 @@ $serverID = $emperior['server_id']??($emperior['serverID']??null);
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?=UniqueConst::$serverName?>: 왕조일람</title>
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('js/common.js')?>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?= UniqueConst::$serverName ?>: 왕조일람</title>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<?= WebUtil::printDist('ts', 'common', true) ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
</head>
<body>
<table align=center width=1000 class="tb_layout bg0">
<tr><td>역 대 왕 조<br>
<button onclick=window.close()>창 닫기</button>
<div style="float:right;"><a href="a_emperior.php"><button type='button'>전체보기</button></a><div>
</td></tr>
<table align=center width=1000 class="tb_layout bg0">
<tr>
<td>역 대 왕 조<br>
<button onclick=window.close()>창 닫기</button>
<div style="float:right;"><a href="a_emperior.php"><button type='button'>전체보기</button></a>
<div>
</td>
</tr>
</table>
</table>
<?php
<?php
if($emperior):
?>
if ($emperior) :
?>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td bgcolor=skyblue align=center colspan=6>
<font size=5><?=$emperior['phase']?></font>
</td>
</tr>
<tr>
<td id=bg1 width=98 align=center>국 가 수<br>(최종 / 최대)</td>
<td align=center width=398 colspan=2><?=$emperior['nation_count']?></td>
<td id=bg1 width=98 align=center>장 수 수<br>(최종 / 최대)</td>
<td align=center width=398 colspan=2><?=$emperior['gen_count']?></td>
</tr>
<tr>
<td id=bg1 align=center>등 장 국 가</td>
<td colspan=5><?=$emperior['nation_name']?></td>
</tr>
<tr>
<td id=bg1 align=center>국가별 성향</td>
<td colspan=5><?=$emperior['nation_hist']?></td>
</tr>
<tr>
<td id=bg1 align=center>장 수 성 격</td>
<td colspan=5><?=$emperior['personal_hist']?></td>
</tr>
<tr>
<td id=bg1 align=center>장 수 특 기</td>
<td colspan=5><?=$emperior['special_hist']?></td>
</tr>
<tr>
<td align=center style=color:<?=newColor($emperior['color'])?>; bgcolor=<?=$emperior['color']?> colspan=6>
<font size=5><?=$emperior['name']?> (<?=$emperior['year']?>年 <?=$emperior['month']?>月)</font>
</td>
</tr>
<tr>
<td id=bg1 width=98 align=center>국 력</td>
<td align=center width=398 colspan=2><?=$emperior['power']?></td>
<td id=bg1 width=98 align=center>성 향</td>
<td align=center width=398 colspan=2><?=$emperior['type']?></td>
</tr>
<tr>
<td id=bg1 width=98 align=center>장 수</td>
<td align=center width=398 colspan=2><?=$emperior['gennum']?></td>
<td id=bg1 width=98 align=center>속 령</td>
<td align=center width=398 colspan=2><?=$emperior['citynum']?></td>
</tr>
<tr>
<td id=bg1 align=center>총 인 구</td>
<td align=center colspan=2><?=$emperior['pop']?></td>
<td id=bg1 align=center>인 구 율</td>
<td align=center colspan=2><?=$emperior['poprate']?></td>
</tr>
<tr>
<td id=bg1 align=center>국 고</td>
<td align=center colspan=2><?=$emperior['gold']?></td>
<td id=bg1 align=center>병 량</td>
<td align=center colspan=2><?=$emperior['rice']?></td>
</tr>
<tr>
<td id=bg1 align=center>황 제</td>
<td width=64>&nbsp;</td>
<td width=332><?=$emperior['l12name']?></td>
<td id=bg1 align=center>승 상</td>
<td width=64>&nbsp;</td>
<td width=332><?=$emperior['l11name']?></td>
</tr>
<tr>
<td id=bg1 align=center>위 장 군</td>
<td width=64>&nbsp;</td>
<td width=332><?=$emperior['l10name']?></td>
<td id=bg1 align=center>사 공</td>
<td width=64>&nbsp;</td>
<td width=332><?=$emperior['l9name']?></td>
</tr>
<tr>
<td id=bg1 align=center>표 기 장 군</td>
<td width=64>&nbsp;</td>
<td width=332><?=$emperior['l8name']?></td>
<td id=bg1 align=center>태 위</td>
<td width=64>&nbsp;</td>
<td width=332><?=$emperior['l7name']?></td>
</tr>
<tr>
<td id=bg1 align=center>거 기 장 군</td>
<td width=64>&nbsp;</td>
<td width=332><?=$emperior['l6name']?></td>
<td id=bg1 align=center>사 도</td>
<td width=64>&nbsp;</td>
<td width=332><?=$emperior['l5name']?></td>
</tr>
<tr>
<td id=bg1 align=center>오 호 장 군</td>
<td colspan=5><?=$emperior['tiger']?></td>
</tr>
<tr>
<td id=bg1 align=center>건 안 칠 자</td>
<td colspan=5><?=$emperior['eagle']?></td>
</tr>
<tr>
<td id=bg1 align=center>장 수 들<br>(공헌도 순서)</td>
<td colspan=5><?=$emperior['gen']?></td>
</tr>
<tr>
<td id=bg1 align=center>역 사 기 록</td>
<td colspan=5><?=formatHistoryToHTML(Json::decode($emperior['history']))?></td>
</tr>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td bgcolor=skyblue align=center colspan=6>
<font size=5><?= $emperior['phase'] ?></font>
</td>
</tr>
<tr>
<td class='bg1' width=98 align=center>국 가 수<br>(최종 / 최대)</td>
<td align=center width=398 colspan=2><?= $emperior['nation_count'] ?></td>
<td class='bg1' width=98 align=center>장 수 수<br>(최종 / 최대)</td>
<td align=center width=398 colspan=2><?= $emperior['gen_count'] ?></td>
</tr>
<tr>
<td class='bg1' align=center>등 장 국 가</td>
<td colspan=5><?= $emperior['nation_name'] ?></td>
</tr>
<tr>
<td class='bg1' align=center>국가별 성향</td>
<td colspan=5><?= $emperior['nation_hist'] ?></td>
</tr>
<tr>
<td class='bg1' align=center>장 수 성 격</td>
<td colspan=5><?= $emperior['personal_hist'] ?></td>
</tr>
<tr>
<td class='bg1' align=center>장 수 특 기</td>
<td colspan=5><?= $emperior['special_hist'] ?></td>
</tr>
<tr>
<td align=center style=color:<?= newColor($emperior['color']) ?>; bgcolor=<?= $emperior['color'] ?> colspan=6>
<font size=5><?= $emperior['name'] ?> (<?= $emperior['year'] ?>年 <?= $emperior['month'] ?>月)</font>
</td>
</tr>
<tr>
<td class='bg1' width=98 align=center>국 력</td>
<td align=center width=398 colspan=2><?= $emperior['power'] ?></td>
<td class='bg1' width=98 align=center>성 향</td>
<td align=center width=398 colspan=2><?= $emperior['type'] ?></td>
</tr>
<tr>
<td class='bg1' width=98 align=center>장 수</td>
<td align=center width=398 colspan=2><?= $emperior['gennum'] ?></td>
<td class='bg1' width=98 align=center>속 령</td>
<td align=center width=398 colspan=2><?= $emperior['citynum'] ?></td>
</tr>
<tr>
<td class='bg1' align=center>총 인 구</td>
<td align=center colspan=2><?= $emperior['pop'] ?></td>
<td class='bg1' align=center>인 구 율</td>
<td align=center colspan=2><?= $emperior['poprate'] ?></td>
</tr>
<tr>
<td class='bg1' align=center>국 고</td>
<td align=center colspan=2><?= $emperior['gold'] ?></td>
<td class='bg1' align=center>병 량</td>
<td align=center colspan=2><?= $emperior['rice'] ?></td>
</tr>
<tr>
<td class='bg1' align=center>황 제</td>
<td width=64>&nbsp;</td>
<td width=332><?= $emperior['l12name'] ?></td>
<td class='bg1' align=center>승 상</td>
<td width=64>&nbsp;</td>
<td width=332><?= $emperior['l11name'] ?></td>
</tr>
<tr>
<td class='bg1' align=center>위 장 군</td>
<td width=64>&nbsp;</td>
<td width=332><?= $emperior['l10name'] ?></td>
<td class='bg1' align=center>사 공</td>
<td width=64>&nbsp;</td>
<td width=332><?= $emperior['l9name'] ?></td>
</tr>
<tr>
<td class='bg1' align=center>표 기 장 군</td>
<td width=64>&nbsp;</td>
<td width=332><?= $emperior['l8name'] ?></td>
<td class='bg1' align=center>태 위</td>
<td width=64>&nbsp;</td>
<td width=332><?= $emperior['l7name'] ?></td>
</tr>
<tr>
<td class='bg1' align=center>거 기 장 군</td>
<td width=64>&nbsp;</td>
<td width=332><?= $emperior['l6name'] ?></td>
<td class='bg1' align=center>사 도</td>
<td width=64>&nbsp;</td>
<td width=332><?= $emperior['l5name'] ?></td>
</tr>
<tr>
<td class='bg1' align=center>오 호 장 군</td>
<td colspan=5><?= $emperior['tiger'] ?></td>
</tr>
<tr>
<td class='bg1' align=center>건 안 칠 자</td>
<td colspan=5><?= $emperior['eagle'] ?></td>
</tr>
<tr>
<td class='bg1' align=center>장 수 들<br>(공헌도 순서)</td>
<td colspan=5><?= $emperior['gen'] ?></td>
</tr>
<tr>
<td class='bg1' align=center>역 사 기 록</td>
<td colspan=5><?= formatHistoryToHTML(Json::decode($emperior['history'])) ?></td>
</tr>
</table>
<?php
endif;
<?php
endif;
$showServers = $emperior;
$showServers = $emperior;
if(!$serverID){
$serverID = UniqueConst::$serverID;
}
if($showServers){
$nations = $db->query('SELECT * FROM ng_old_nations WHERE server_id=%s ORDER BY date DESC', $serverID);
foreach($nations as $nation){
if(!$nation['nation']??null){
continue;
}
$nation += Json::decode($nation['data']);
$nation['typeName'] = getNationType($nation['type']);
$nation['levelName'] = getNationLevel($nation['level']);
/** @var int[]|null $nationGenerals */
$nationGenerals = $nation['generals'];
if($nationGenerals){
$generals = $db->query('SELECT `general_no`, `name`, `last_yearmonth` FROM ng_old_generals WHERE server_id=%s AND general_no IN %li', $serverID, $nationGenerals);
if(count($generals) != count($nationGenerals) && $serverID == UniqueConst::$serverID){
$liveGenerals = $nationGenerals;
foreach($generals as $general){
if(in_array($general['general_no'], $nationGenerals)){
unset($nationGenerals[$general['general_no']]);
}
}
$liveGenerals = $db->query('SELECT `no`as`general_no`, `name` FROM general WHERE no IN %li', $liveGenerals);
$nation['generalsFull'] = array_merge($liveGenerals, $generals);
}
else{
$nation['generalsFull'] = $generals;
}
}
else{
$nation['generalsFull'] = [];
}
if(key_exists('aux', $nation) && !is_array($nation['aux'])){
$nation += Json::decode($nation['aux']);
}
echo $templates->render('oldNation', $nation);
if (!$serverID) {
$serverID = UniqueConst::$serverID;
}
}
?>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td><?=closeButton()?></td></tr>
<tr><td><?=banner()?></td></tr>
</table>
if ($showServers) {
$nations = $db->query('SELECT * FROM ng_old_nations WHERE server_id=%s ORDER BY date DESC', $serverID);
foreach ($nations as $nation) {
if (!$nation['nation'] ?? null) {
continue;
}
$nation += Json::decode($nation['data']);
$nation['typeName'] = getNationType($nation['type']);
$nation['levelName'] = getNationLevel($nation['level']);
/** @var int[]|null $nationGenerals */
$nationGenerals = $nation['generals'];
if ($nationGenerals) {
$generals = $db->query('SELECT `general_no`, `name`, `last_yearmonth` FROM ng_old_generals WHERE server_id=%s AND general_no IN %li', $serverID, $nationGenerals);
if (count($generals) != count($nationGenerals) && $serverID == UniqueConst::$serverID) {
$liveGenerals = $nationGenerals;
foreach ($generals as $general) {
if (in_array($general['general_no'], $nationGenerals)) {
unset($nationGenerals[$general['general_no']]);
}
}
$liveGenerals = $db->query('SELECT `no`as`general_no`, `name` FROM general WHERE no IN %li', $liveGenerals);
$nation['generalsFull'] = array_merge($liveGenerals, $generals);
} else {
$nation['generalsFull'] = $generals;
}
} else {
$nation['generalsFull'] = [];
}
if (key_exists('aux', $nation) && !is_array($nation['aux'])) {
$nation += Json::decode($nation['aux']);
}
echo $templates->render('oldNation', $nation);
}
}
?>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td><?= closeButton() ?></td>
</tr>
<tr>
<td><?= banner() ?></td>
</tr>
</table>
</body>
</html>
+144 -136
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -28,8 +29,8 @@ if ($type <= 0 || $type > 15) {
}
$ownerNameList = [];
if($gameStor->isunited){
foreach(RootDB::db()->queryAllLists('SELECT no, name FROM member') as [$ownerID, $ownerName]){
if ($gameStor->isunited) {
foreach (RootDB::db()->queryAllLists('SELECT no, name FROM member') as [$ownerID, $ownerName]) {
$ownerNameList[$ownerID] = $ownerName;
}
}
@@ -39,177 +40,184 @@ if($gameStor->isunited){
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?=UniqueConst::$serverName?>: 장수일람</title>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('../d_shared/common_path.js')?>
<?=WebUtil::printJS('js/common.js')?>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?= UniqueConst::$serverName ?>: 장수일람</title>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printDist('ts', 'common') ?>
</head>
<body>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td>장 수 일 람<br><?=closeButton()?></td></tr>
<tr><td><form name=form1 method=post>정렬순서 :
<select id='viewType' name='type' size=1>
<option value=1>국가</option>
<option value=2>통솔</option>
<option value=3>무력</option>
<option value=4>지력</option>
<option value=5>명성</option>
<option value=6>계급</option>
<option value=7>관직</option>
<option value=8>삭턴</option>
<option value=9>벌점</option>
<option value=10>Lv</option>
<option value=11>성격</option>
<option value=12>내특</option>
<option value=13>전특</option>
<option value=14>연령</option>
<option value=15>NPC</option>
</select>
<input type=submit value='정렬하기'></form>
</td></tr>
</table>
<?php
$nationname = [];
$nationlevel = [];
$nationname[0] = "-";
foreach (getAllNationStaticInfo() as $nation) {
$nationname[$nation['nation']] = $nation['name'];
$nationlevel[$nation['nation']] = $nation['level'];
}
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td>장 수 일 람<br><?= closeButton() ?></td>
</tr>
<tr>
<td>
<form name=form1 method=post>정렬순서 :
<select id='viewType' name='type' size=1>
<option value=1>국가</option>
<option value=2>통솔</option>
<option value=3>무력</option>
<option value=4>지력</option>
<option value=5>명성</option>
<option value=6>계급</option>
<option value=7>관직</option>
<option value=8>삭턴</option>
<option value=9>벌점</option>
<option value=10>Lv</option>
<option value=11>성격</option>
<option value=12>내특</option>
<option value=13>전특</option>
<option value=14>연령</option>
<option value=15>NPC</option>
</select>
<input type=submit value='정렬하기'>
</form>
</td>
</tr>
</table>
<?php
$nationname = [];
$nationlevel = [];
$nationname[0] = "-";
foreach (getAllNationStaticInfo() as $nation) {
$nationname[$nation['nation']] = $nation['name'];
$nationlevel[$nation['nation']] = $nation['level'];
}
[$orderKey, $orderDesc] = [
1=>['nation', false],
2=>['leadership', true],
3=>['strength', true],
4=>['intel', true],
5=>['experience', true],
6=>['dedication', true],
7=>['officer_level', true],
8=>['killturn', false],
9=>['connect', true],
10=>['experience', true],
11=>['personal', true],
12=>['special', true],
13=>['special2', true],
14=>['age', true],
15=>['npc', true],
][$type];
[$orderKey, $orderDesc] = [
1 => ['nation', false],
2 => ['leadership', true],
3 => ['strength', true],
4 => ['intel', true],
5 => ['experience', true],
6 => ['dedication', true],
7 => ['officer_level', true],
8 => ['killturn', false],
9 => ['connect', true],
10 => ['experience', true],
11 => ['personal', true],
12 => ['special', true],
13 => ['special2', true],
14 => ['age', true],
15 => ['npc', true],
][$type];
$generalList = $db->query('SELECT owner,no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leadership,strength,intel,experience,dedication,officer_level,killturn,connect from general order by %b %l', $orderKey, $orderDesc?'desc':'');
$generalList = $db->query('SELECT owner,no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leadership,strength,intel,experience,dedication,officer_level,killturn,connect from general order by %b %l', $orderKey, $orderDesc ? 'desc' : '');
echo"
echo "
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td width=64 align=center id=bg1>얼 굴</td>
<td width=140 align=center id=bg1>이 름</td>
<td width=45 align=center id=bg1>연령</td>
<td width=45 align=center id=bg1>성격</td>
<td width=80 align=center id=bg1>특기</td>
<td width=45 align=center id=bg1>레 벨</td>
<td width=140 align=center id=bg1>국 가</td>
<td width=55 align=center id=bg1>명 성</td>
<td width=55 align=center id=bg1>계 급</td>
<td width=75 align=center id=bg1>관 직</td>
<td width=45 align=center id=bg1>통솔</td>
<td width=45 align=center id=bg1>무력</td>
<td width=45 align=center id=bg1>지력</td>
<td width=45 align=center id=bg1>삭턴</td>
<td width=70 align=center id=bg1>벌점</td>
<td width=64 align=center class='bg1'>얼 굴</td>
<td width=140 align=center class='bg1'>이 름</td>
<td width=45 align=center class='bg1'>연령</td>
<td width=45 align=center class='bg1'>성격</td>
<td width=80 align=center class='bg1'>특기</td>
<td width=45 align=center class='bg1'>레 벨</td>
<td width=140 align=center class='bg1'>국 가</td>
<td width=55 align=center class='bg1'>명 성</td>
<td width=55 align=center class='bg1'>계 급</td>
<td width=75 align=center class='bg1'>관 직</td>
<td width=45 align=center class='bg1'>통솔</td>
<td width=45 align=center class='bg1'>무력</td>
<td width=45 align=center class='bg1'>지력</td>
<td width=45 align=center class='bg1'>삭턴</td>
<td width=70 align=center class='bg1'>벌점</td>
</tr>";
foreach($generalList as $general){
$nation = $nationname[$general['nation']];
foreach ($generalList as $general) {
$nation = $nationname[$general['nation']];
$lbonus = calcLeadershipBonus($general['officer_level'], $nationlevel[$general['nation']]??0);
if ($lbonus > 0) {
$lbonusText = "<font color=cyan>+{$lbonus}</font>";
} else {
$lbonusText = "";
}
$lbonus = calcLeadershipBonus($general['officer_level'], $nationlevel[$general['nation']] ?? 0);
if ($lbonus > 0) {
$lbonusText = "<font color=cyan>+{$lbonus}</font>";
} else {
$lbonusText = "";
}
if ($general['injury'] > 0) {
$leadership = intdiv($general['leadership'] * (100 - $general['injury']), 100);
$strength = intdiv($general['strength'] * (100 - $general['injury']), 100);
$intel = intdiv($general['intel'] * (100 - $general['injury']), 100);
$leadership = "<font color=red>{$leadership}</font>{$lbonusText}";
$strength = "<font color=red>{$strength}</font>";
$intel = "<font color=red>{$intel}</font>";
} else {
$leadership = "{$general['leadership']}{$lbonusText}";
$strength = "{$general['strength']}";
$intel = "{$general['intel']}";
}
if ($general['injury'] > 0) {
$leadership = intdiv($general['leadership'] * (100 - $general['injury']), 100);
$strength = intdiv($general['strength'] * (100 - $general['injury']), 100);
$intel = intdiv($general['intel'] * (100 - $general['injury']), 100);
$leadership = "<font color=red>{$leadership}</font>{$lbonusText}";
$strength = "<font color=red>{$strength}</font>";
$intel = "<font color=red>{$intel}</font>";
} else {
$leadership = "{$general['leadership']}{$lbonusText}";
$strength = "{$general['strength']}";
$intel = "{$general['intel']}";
}
if ($general['npc'] >= 2) {
$name = "<font color=cyan>{$general['name']}</font>";
} elseif ($general['npc'] == 1) {
$name = "<font color=skyblue>{$general['name']}</font>";
} else {
$name = "{$general['name']}";
}
if(key_exists($general['owner'], $ownerNameList)){
$name = $name.'<br><small>('.$ownerNameList[$general['owner']].')</small>';
}
if ($general['npc'] >= 2) {
$name = "<font color=cyan>{$general['name']}</font>";
} elseif ($general['npc'] == 1) {
$name = "<font color=skyblue>{$general['name']}</font>";
} else {
$name = "{$general['name']}";
}
$general['connect'] = Util::round($general['connect'], -1);
if (key_exists($general['owner'], $ownerNameList)) {
$name = $name . '<br><small>(' . $ownerNameList[$general['owner']] . ')</small>';
}
$imageTemp = GetImageURL($general['imgsvr']);
echo "
<tr data-general-id='{$general['no']}'
data-general-wounded='{$general['injury']}'
$general['connect'] = Util::round($general['connect'], -1);
$imageTemp = GetImageURL($general['imgsvr']);
echo "
<tr data-general-id='{$general['no']}'
data-general-wounded='{$general['injury']}'
data-general-leadership='{$general['leadership']}'
data-general-leadership-bonus='{$lbonus}'
data-general-strength='{$general['strength']}'
data-general-intel='{$general['intel']}'
data-is-npc='".($general['npc']>=2?'true':'false')."'
data-is-npc='" . ($general['npc'] >= 2 ? 'true' : 'false') . "'
>
<td align=center><img class='generalIcon' width='64' height='64' src='{$imageTemp}/{$general['picture']}'></img></td>
<td align=center>$name</td>
<td align=center>{$general['age']}세</td>
<td align=center>".displayCharInfo($general['personal'])."</td>
<td align=center>".displaySpecialDomesticInfo($general['special'])." / ".displaySpecialWarInfo($general['special2'])."</td>
<td align=center>Lv ".getExpLevel($general['experience'])."</td>
<td align=center>" . displayCharInfo($general['personal']) . "</td>
<td align=center>" . displaySpecialDomesticInfo($general['special']) . " / " . displaySpecialWarInfo($general['special2']) . "</td>
<td align=center>Lv " . getExpLevel($general['experience']) . "</td>
<td align=center>{$nation}</td>
<td align=center>".getHonor($general['experience'])."</td>
<td align=center>".getDed($general['dedication'])."</td>
<td align=center>" . getHonor($general['experience']) . "</td>
<td align=center>" . getDed($general['dedication']) . "</td>
<td align=center>";
echo getOfficerLevelText($general['officer_level']);
echo "</td>
echo getOfficerLevelText($general['officer_level']);
echo "</td>
<td align=center>$leadership</td>
<td align=center>$strength</td>
<td align=center>$intel</td>
<td align=center>{$general['killturn']}</td>
<td align=center>{$general['connect']}";
echo "<br>【".getConnect($general['connect'])."】</td>
echo "<br>【" . getConnect($general['connect']) . "】</td>
</tr>";
}
echo "
}
echo "
</table>
";
?>
?>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td><?=closeButton()?></td></tr>
<tr><td><?=banner()?></td></tr>
</table>
<script type="text/javascript">
$(document).ready(function() {
$("#viewType").val("<?=$type?>").attr("selected", "selected");
});
</script>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td><?= closeButton() ?></td>
</tr>
<tr>
<td><?= banner() ?></td>
</tr>
</table>
<script type="text/javascript">
$(document).ready(function() {
$("#viewType").val("<?= $type ?>").attr("selected", "selected");
});
</script>
</body>
</html>
</html>
+121 -129
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -12,13 +13,13 @@ $db = DB::db();
increaseRefresh("명예의전당", 1);
$scenarioList = (function(){
$scenarioList = (function () {
$db = DB::db();
$scenarioList= [];
foreach($db->query('SELECT season, scenario_name as name, count(scenario) as cnt, scenario from ng_games group by season, scenario order by season desc, scenario asc') as $scenarioInfo){
$scenarioList = [];
foreach ($db->query('SELECT season, scenario_name as name, count(scenario) as cnt, scenario from ng_games group by season, scenario order by season desc, scenario asc') as $scenarioInfo) {
$seasonIdx = $scenarioInfo['season'];
$scenarioIdx = $scenarioInfo['scenario'];
if(!key_exists($seasonIdx, $scenarioList)){
if (!key_exists($seasonIdx, $scenarioList)) {
$scenarioList[$seasonIdx] = [];
}
$scenarioList[$seasonIdx][$scenarioIdx] = $scenarioInfo;
@@ -28,11 +29,10 @@ $scenarioList = (function(){
if($scenarioIdx !== null || key_exists($scenarioIdx, $scenarioList)){
if ($scenarioIdx && key_exists($scenarioIdx, $scenarioList[$seasonIdx] ?? [])) {
$searchScenarioName = $scenarioList[$seasonIdx][$scenarioIdx]['name'];
$searchFilter = $db->sqleval('season = %i AND scenario = %i', $seasonIdx, $scenarioIdx);
}
else{
} else {
$searchScenarioName = '* 모두 *';
$searchFilter = $db->sqleval('season = %i', $seasonIdx);
}
@@ -42,137 +42,129 @@ else{
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1136" />
<title><?=UniqueConst::$serverName?>: 명예의 전당</title>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<?=WebUtil::printCSS('css/hallOfFame.css')?>
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/jquery.redirect.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('js/common.js')?>
<?=WebUtil::printJs('js/hallOfFame.js')?>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1136" />
<title><?= UniqueConst::$serverName ?>: 명예의 전당</title>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printCSS('css/hallOfFame.css') ?>
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printDist('ts', ['common', 'hallOfFame']) ?>
</head>
<body>
<table align=center width=1100 class='tb_layout bg0'>
<tr><td>명 예 의 전 당<br><?=closeButton()?></td></tr>
<tr><td>
시나리오 검색 : <select id="by_scenario" name="by_scenario">
<?php foreach($scenarioList as $iterSeasonIdx=>$subScenarioList): ?>
<option
data-season="<?=$iterSeasonIdx?>"
value=""
<?=($iterSeasonIdx == $seasonIdx && $scenarioIdx === null)?"selected='selected'":''?>
>* 시즌 : <?=$iterSeasonIdx?> 종합 *</option>
<?php foreach($subScenarioList as $info): ?>
<option
data-season="<?=$iterSeasonIdx?>"
value="<?=$info['scenario']?>"
<?=($iterSeasonIdx == $seasonIdx && $info['scenario']===$scenarioIdx)?"selected='selected'":''?>
><?=$info['name']?>(<?=$info['cnt']?>회)</option>
<?php endforeach; ?>
<?php endforeach; ?>
?>
</select>
</td></tr>
</table>
<div style="margin:auto;width:1100px;">
<?php
$types = [
'experience'=>['명 성', 'int'],
'dedication'=>['계 급', 'int'],
'firenum'=>['계 략 성 공', 'int'],
'warnum'=>['전 투 횟 수', 'int'],
'killnum'=>['승 리', 'int'],
'winrate'=>['승 률', 'percent'],
'occupied'=>['점 령', 'int'],
'killcrew'=>['사 살', 'int'],
'killrate'=>['살 상 률', 'percent'],
'killcrew_person'=>['대 인 사 살', 'int'],
'killrate_person'=>['대 인 살 상 률', 'percent'],
'dex1'=>[' 병 숙 련 도', 'int'],
'dex2'=>['궁 병 숙 련 도', 'int'],
'dex3'=>['기 병 숙 련 도', 'int'],
'dex4'=>['귀 병 숙 련 도', 'int'],
'dex5'=>['차 병 숙 련 도', 'int'],
'ttrate'=>['전 력 전 승 률', 'percent'],
'tlrate'=>['통 솔 전 승 률', 'percent'],
'tsrate'=>['일 기 토 승 률', 'percent'],
'tirate'=>['설 전 승 률', 'percent'],
'betgold'=>['베 팅 투 자 액', 'int'],
'betwin'=>['베 팅 당 첨', 'int'],
'betwingold'=>['베 팅 수 익 금', 'int'],
'betrate'=>['베 팅 수 익 률', 'percent'],
];
<table align=center width=1100 class='tb_layout bg0'>
<tr>
<td>명 예 의 전 당<br><?= closeButton() ?></td>
</tr>
<tr>
<td>
시나리오 검색 : <select id="by_scenario" name="by_scenario">
<?php foreach ($scenarioList as $iterSeasonIdx => $subScenarioList) : ?>
<option data-season="<?= $iterSeasonIdx ?>" value="" <?= ($iterSeasonIdx == $seasonIdx && $scenarioIdx === null) ? "selected='selected'" : '' ?>>* 시즌 : <?= $iterSeasonIdx ?> 종합 *</option>
<?php foreach ($subScenarioList as $info) : ?>
<option data-season="<?= $iterSeasonIdx ?>" value="<?= $info['scenario'] ?>" <?= ($iterSeasonIdx == $seasonIdx && $info['scenario'] === $scenarioIdx) ? "selected='selected'" : '' ?>><?= $info['name'] ?>(<?= $info['cnt'] ?>회)</option>
<?php endforeach; ?>
<?php endforeach; ?>
?>
</select>
</td>
</tr>
</table>
<div style="margin:auto;width:1100px;">
<?php
$types = [
'experience' => ['명 성', 'int'],
'dedication' => ['계 급', 'int'],
'firenum' => ['계 략 성 공', 'int'],
'warnum' => ['전 투 횟 수', 'int'],
'killnum' => ['승 리', 'int'],
'winrate' => ['승 률', 'percent'],
'occupied' => ['점 령', 'int'],
'killcrew' => ['사 살', 'int'],
'killrate' => ['살 상 률', 'percent'],
'killcrew_person' => ['대 인 사 살', 'int'],
'killrate_person' => ['대 인 살 상 률', 'percent'],
'dex1' => ['보 병 숙 련 도', 'int'],
'dex2' => ['궁 병 숙 련 도', 'int'],
'dex3' => ['기 병 숙 련 도', 'int'],
'dex4' => ['귀 병 숙 련 도', 'int'],
'dex5' => [' 병 숙 련 도', 'int'],
'ttrate' => ['전 력 전 승 률', 'percent'],
'tlrate' => ['통 솔 전 승 률', 'percent'],
'tsrate' => ['일 기 토 승 률', 'percent'],
'tirate' => ['설 전 승 률', 'percent'],
'betgold' => ['베 팅 투 자 액', 'int'],
'betwin' => ['베 팅 당 첨', 'int'],
'betwingold' => ['베 팅 수 익 금', 'int'],
'betrate' => ['베 팅 수 익 률', 'percent'],
];
$templates = new \League\Plates\Engine('templates');
$templates = new \League\Plates\Engine('templates');
$ownerNameList = [];
foreach(RootDB::db()->queryAllLists('SELECT no, name FROM member') as [$ownerID, $ownerName]){
$ownerNameList[$ownerID] = $ownerName;
}
foreach($types as $typeName=>[$typeDescribe, $typeValue]) {
$hallResult = $db->query('SELECT * FROM hall WHERE `type`=%s AND %? ORDER BY `value` DESC LIMIT 10', $typeName, $searchFilter);
$hallResult = array_map(function($general)use($typeValue, $ownerNameList){
$aux = Json::decode($general['aux']);
$general += $aux;
if(key_exists($general['owner'], $ownerNameList)){
$general['ownerName'] = $ownerNameList[$general['owner']];
$ownerNameList = [];
foreach (RootDB::db()->queryAllLists('SELECT no, name FROM member') as [$ownerID, $ownerName]) {
$ownerNameList[$ownerID] = $ownerName;
}
if(!key_exists('bgColor', $general)){
if(!key_exists('color', $general)){
$general['bgColor'] = GameConst::$basecolor4;
}
else{
$general['bgColor'] = $general['color'];
}
}
if(!key_exists('fgColor', $general)){
$general['fgColor'] = newColor($general['bgColor']);
}
foreach ($types as $typeName => [$typeDescribe, $typeValue]) {
$hallResult = $db->query('SELECT * FROM hall WHERE `type`=%s AND %? ORDER BY `value` DESC LIMIT 10', $typeName, $searchFilter);
if(key_exists('picture', $general)){
$imageTemp = GetImageURL($general['imgsvr']);
$general['pictureFullPath'] = "$imageTemp/{$general['picture']}";
}
else{
$general['pictureFullPath'] = GetImageURL(0)."/default.jpg";
}
$hallResult = array_map(function ($general) use ($typeValue, $ownerNameList) {
$aux = Json::decode($general['aux']);
$general += $aux;
if(!key_exists('printValue', $general)){
$value = $general['value'];
if($typeValue == 'percent'){
$general['printValue'] = number_format($value*100, 2).'%';
}
else {
$general['printValue'] = number_format($value);
}
if (key_exists($general['owner'], $ownerNameList)) {
$general['ownerName'] = $ownerNameList[$general['owner']];
}
if (!key_exists('bgColor', $general)) {
if (!key_exists('color', $general)) {
$general['bgColor'] = GameConst::$basecolor4;
} else {
$general['bgColor'] = $general['color'];
}
}
if (!key_exists('fgColor', $general)) {
$general['fgColor'] = newColor($general['bgColor']);
}
if (key_exists('picture', $general)) {
$imageTemp = GetImageURL($general['imgsvr']);
$general['pictureFullPath'] = "$imageTemp/{$general['picture']}";
} else {
$general['pictureFullPath'] = GetImageURL(0) . "/default.jpg";
}
if (!key_exists('printValue', $general)) {
$value = $general['value'];
if ($typeValue == 'percent') {
$general['printValue'] = number_format($value * 100, 2) . '%';
} else {
$general['printValue'] = number_format($value);
}
}
return $general;
}, $hallResult);
echo $templates->render('hallOfFrame', [
'typeName' => $typeDescribe,
'generals' => $hallResult
]);
}
return $general;
}, $hallResult);
echo $templates->render('hallOfFrame', [
'typeName'=>$typeDescribe,
'generals'=>$hallResult
]);
}
?>
</div>
<table align=center width=1100 class='tb_layout bg0'>
<tr><td><?=closeButton()?></td></tr>
<tr><td><?=banner()?> </td></tr>
</table>
?>
</div>
<table align=center width=1100 class='tb_layout bg0'>
<tr>
<td><?= closeButton() ?></td>
</tr>
<tr>
<td><?= banner() ?> </td>
</tr>
</table>
</body>
</html>
</html>
+127 -115
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -14,15 +15,15 @@ $userID = Session::getUserID();
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
if(!$serverID){
if (!$serverID) {
$serverID = UniqueConst::$serverID;
}
if($serverID === UniqueConst::$serverID){
if ($serverID === UniqueConst::$serverID) {
increaseRefresh("연감", 1);
}
$admin = $gameStor->getValues(['startyear','year','month','map_theme']);
$admin = $gameStor->getValues(['startyear', 'year', 'month', 'map_theme']);
$me = $db->queryFirstRow('SELECT con, turntime FROM general WHERE owner = %i', $userID);
@@ -37,7 +38,7 @@ if ($con >= 2) {
[$s_year, $s_month] = $db->queryFirstList('SELECT year, month FROM ng_history WHERE server_id = %s ORDER BY year ASC, month ASC LIMIT 1', $serverID);
$s = $s_year * 12 + $s_month;
if($s_year === null){
if ($s_year === null) {
echo '인자 에러';
exit();
}
@@ -45,19 +46,17 @@ if($s_year === null){
[$e_year, $e_month] = $db->queryFirstList('SELECT year, month FROM ng_history WHERE server_id = %s ORDER BY year DESC, month DESC LIMIT 1', $serverID);
$e = $e_year * 12 + $e_month;
if($serverID !== UniqueConst::$serverID){
$mapTheme = $db->queryFirstField('SELECT map FROM ng_games WHERE server_id=%s', $serverID)?:'che';
}
else{
$mapTheme = $admin['map_theme']??'che';
if ($serverID !== UniqueConst::$serverID) {
$mapTheme = $db->queryFirstField('SELECT map FROM ng_games WHERE server_id=%s', $serverID) ?: 'che';
} else {
$mapTheme = $admin['map_theme'] ?? 'che';
}
//FIXME: $yearmonth가 올바르지 않을 경우에 처리가 필요.
if($serverID !== UniqueConst::$serverID && !$yearmonth){
if ($serverID !== UniqueConst::$serverID && !$yearmonth) {
$year = $s_year;
$month = $s_month;
}
else if (!$yearmonth) {
} else if (!$yearmonth) {
$year = $admin['year'];
$month = $admin['month'] - 1;
} else {
@@ -70,7 +69,7 @@ else if (!$yearmonth) {
$month += 1;
}
}
$now = ($year*12) + $month;
$now = ($year * 12) + $month;
if ($now < $s) {
$now = $s;
@@ -95,109 +94,122 @@ $nations = Json::decode($history['nations']);
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?=UniqueConst::$serverName?>: 연감</title>
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('../d_shared/common_path.js')?>
<?=WebUtil::printJS('js/common.js')?>
<?=WebUtil::printJS("js/map/theme_{$mapTheme}.js")?>
<?=WebUtil::printJS('js/map.js')?>
<?=WebUtil::printJS('js/history.js')?>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<?=WebUtil::printCSS('css/map.css')?>
<?=WebUtil::printCSS('css/history.css')?>
<script>
var startYear = <?=$s_year?>;
var startMonth = <?=$s_month?>;
var lastYear = <?=$e_year?>;
var lastMonth = <?=$e_month?>;
var selectYear = <?=$year?>;
var selectMonth = <?=$month?>;
var nations = <?=$nations?$history['nations']:'{}'?>;
</script>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?= UniqueConst::$serverName ?>: 연감</title>
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printJS("js/map/theme_{$mapTheme}.js") ?>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printCSS('css/map.css') ?>
<?= WebUtil::printCSS('css/history.css') ?>
<?= WebUtil::printDist('ts', ['common', 'history']) ?>
<script>
var startYear = <?= $s_year ?>;
var startMonth = <?= $s_month ?>;
var lastYear = <?= $e_year ?>;
var lastMonth = <?= $e_month ?>;
var selectYear = <?= $year ?>;
var selectMonth = <?= $month ?>;
var nations = <?= $nations ? $history['nations'] : '{}' ?>;
</script>
</head>
<body>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td>연 감<br><?=closeButton()?></td></tr>
<tr><td>
<form name=form1 method=post>
연월 선택 :
<input type=submit name=btn value="◀◀ 이전달">
<select id='yearmonth' name=yearmonth size=1>
<option selected='selected'><?=$year?>년 <?=$month?>월</option>
<option><?=$e_year?>년 12월</option>
</select>
<input type=submit name=btn value='조회하기'>
<input type=submit name=btn value="다음달 ▶▶">
</form>
</td></tr>
</table>
<table align=center width=1000 height=520 class='tb_layout bg0'>
<thead><tr><th colspan=5 align=center id=bg1>중 원 지 도</th></tr></thead>
<tbody>
<tr height=520>
<td width=698>
<?=getMapHtml($mapTheme)?>
</td>
<td id='nation_list_frame'>
<table id='nation_list'>
<thead>
<tr>
<th width=130>국명</th>
<th width=70>국력</th>
<th width=45>장수</th>
<th width=45>속령</th>
</tr>
</thead>
<tbody>
<?php foreach($nations as $nation): ?>
<tr>
<td><span style='color:<?=newColor($nation['color'])?>;background-color:<?=$nation['color']?>'><?=$nation['name']?></td>
<td style='text-align:right'><?=number_format($nation['power'])?></td>
<td style='text-align:right'><?=number_format($nation['gennum'])?></td>
<td style='text-align:right'><?=number_format(count($nation['cities']??[]))?></td>
</tr>
<?php endforeach; ?>
</tbody>
<tfoot></tfoot>
</table>
</td>
</tr>
<tr><th colspan=5 align=center id=bg1>중 원 정 세</th></tr>
<tr>
<td colspan=5 valign=top>
<?=formatHistoryToHTML(Json::decode($history['global_history']))?>
</td>
</tr>
<tr><th colspan=5 align=center id=bg1>장 수 동 향</th></tr>
<tr>
<td colspan=5 valign=top>
<?=formatHistoryToHTML(Json::decode($history['global_action']))?>
</td>
</tr>
</tbody>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td><?=closeButton()?></td></tr>
<tr><td><?=banner()?> </td></tr>
</table>
<script>
window.serverNick = '<?=DB::prefix()?>';
window.serverID = '<?=UniqueConst::$serverID?>';
reloadWorldMap({
targetJson:'j_map_history.php?year=<?=$year?>&month=<?=$month?>&serverID=<?=$serverID?>',
showMe:false,
neutralView:true,
useCachedMap:false,
year:<?=$year?>,
month:<?=$month?>,
});
</script>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td>연 감<br><?= closeButton() ?></td>
</tr>
<tr>
<td>
<form name=form1 method=post>
연월 선택 :
<input type=submit name=btn value="◀◀ 이전달">
<select id='yearmonth' name=yearmonth size=1>
<option selected='selected'><?= $year ?>년 <?= $month ?>월</option>
<option><?= $e_year ?>년 12월</option>
</select>
<input type=submit name=btn value='조회하기'>
<input type=submit name=btn value="다음달 ▶▶">
</form>
</td>
</tr>
</table>
<table align=center width=1000 height=520 class='tb_layout bg0'>
<thead>
<tr>
<th colspan=5 align=center class='bg1'>중 원 지 도</th>
</tr>
</thead>
<tbody>
<tr height=520>
<td width=698>
<?= getMapHtml($mapTheme) ?>
</td>
<td id='nation_list_frame'>
<table id='nation_list'>
<thead>
<tr>
<th width=130>국명</th>
<th width=70>국력</th>
<th width=45>장수</th>
<th width=45>속령</th>
</tr>
</thead>
<tbody>
<?php foreach ($nations as $nation) : ?>
<tr>
<td><span style='color:<?= newColor($nation['color']) ?>;background-color:<?= $nation['color'] ?>'><?= $nation['name'] ?></td>
<td style='text-align:right'><?= number_format($nation['power']) ?></td>
<td style='text-align:right'><?= number_format($nation['gennum']) ?></td>
<td style='text-align:right'><?= number_format(count($nation['cities'] ?? [])) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
<tfoot></tfoot>
</table>
</td>
</tr>
<tr>
<th colspan=5 align=center class='bg1'>중 원 정 세</th>
</tr>
<tr>
<td colspan=5 valign=top>
<?= formatHistoryToHTML(Json::decode($history['global_history'])) ?>
</td>
</tr>
<tr>
<th colspan=5 align=center class='bg1'>장 수 동 향</th>
</tr>
<tr>
<td colspan=5 valign=top>
<?= formatHistoryToHTML(Json::decode($history['global_action'])) ?>
</td>
</tr>
</tbody>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td><?= closeButton() ?></td>
</tr>
<tr>
<td><?= banner() ?> </td>
</tr>
</table>
<script>
window.serverNick = '<?= DB::prefix() ?>';
window.serverID = '<?= UniqueConst::$serverID ?>';
reloadWorldMap({
targetJson: 'j_map_history.php?year=<?= $year ?>&month=<?= $month ?>&serverID=<?= $serverID ?>',
showMe: false,
neutralView: true,
useCachedMap: false,
year: <?= $year ?>,
month: <?= $month ?>,
});
</script>
</body>
</html>
</html>
+136 -125
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -15,181 +16,191 @@ increaseRefresh("세력일람", 2);
$me = $db->queryFirstRow('SELECT con, turntime FROM general WHERE owner=%i', $userID);
$con = checkLimit($me['con']);
if($con >= 2) { printLimitMsg($me['turntime']); exit(); }
if ($con >= 2) {
printLimitMsg($me['turntime']);
exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?=UniqueConst::$serverName?>: 세력일람</title>
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('js/common.js')?>
<?=WebUtil::printJS('js/ext.kingdoms.js')?>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?= UniqueConst::$serverName ?>: 세력일람</title>
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printDist('ts', ['common', 'extKingdoms']) ?>
</head>
<body>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td>세 력 일 람<br><?=closeButton()?></td></tr>
</table>
<?php
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td>세 력 일 람<br><?= closeButton() ?></td>
</tr>
</table>
<?php
$nations = getAllNationStaticInfo();
uasort($nations, function($lhs, $rhs){return $rhs['power']<=>$lhs['power'];});
$nations = getAllNationStaticInfo();
uasort($nations, function ($lhs, $rhs) {
return $rhs['power'] <=> $lhs['power'];
});
$nations[0] = getNationStaticInfo(0);
$nations[0] = getNationStaticInfo(0);
foreach($db->query('SELECT npc,name,city,nation,officer_level,penalty,permission FROM general ORDER BY dedication DESC') as $general){
$nationID = $general['nation'];
if(!key_exists('generals', $nations[$nationID])){
$nations[$nationID]['generals'] = [];
}
$nations[$nationID]['generals'][] = $general;
}
foreach ($db->query('SELECT npc,name,city,nation,officer_level,penalty,permission FROM general ORDER BY dedication DESC') as $general) {
$nationID = $general['nation'];
foreach ($db->queryAllLists('SELECT city, name, nation FROM city') as [$cityID, $cityName, $nationID]) {
if(!key_exists('cities', $nations[$nationID])){
$nations[$nationID]['cities'] = [];
}
$nations[$nationID]['cities'][$cityID] = $cityName;
}
foreach ($nations as $nation) {
if ($nation['nation'] == 0) {
//재야 도시, 장수
continue;
}
$generals = $nation['generals'];
$chiefs = [];
$ambassadors = [];
$auditors = [];
foreach($generals as $general){
$officerLevel = $general['officer_level'];
if($officerLevel >= 5){
$chiefs[$officerLevel] = $general;
}
$generalPermission = checkSecretPermission($general, false);
if($generalPermission == 4){
$ambassadors[] = $general['name'];
}
else if($generalPermission == 3){
$auditors[] = $general['name'];
if (!key_exists('generals', $nations[$nationID])) {
$nations[$nationID]['generals'] = [];
}
$nations[$nationID]['generals'][] = $general;
}
echo "
<table align=center width=1000 class='tb_layout bg2'>
<tr>
<td colspan=8 align=center style=color:".newColor($nation['color'])."; bgcolor={$nation['color']}>【 {$nation['name']} 】</td>
</tr>
<tr>
<td width=80 align=center id=bg1>성 향</td>
<td width=170 align=center><font color=yellow>".getNationType($nation['type'])."</font></td>
<td width=80 align=center id=bg1>작 위</td>
<td width=170 align=center>".getNationLevel($nation['level'])."</td>
<td width=80 align=center id=bg1>국 력</td>
<td width=170 align=center>{$nation['power']}</td>
<td width=80 align=center id=bg1>장수 / 속령</td>
<td width=170 align=center>{$nation['gennum']} / ".count($nation['cities']??[])."</td>
";
for($chiefLevel = 12; $chiefLevel >= 5; $chiefLevel--){
if($chiefLevel % 4 == 0){
echo '</tr><tr>';
foreach ($db->queryAllLists('SELECT city, name, nation FROM city') as [$cityID, $cityName, $nationID]) {
if (!key_exists('cities', $nations[$nationID])) {
$nations[$nationID]['cities'] = [];
}
$chief = $chiefs[$chiefLevel]??['name'=>'-','npc'=>0];
$officerLevelText = getOfficerLevelText($chiefLevel, $nation['level']);
$chiefText = getColoredName($chief['name'], $chief['npc']);
echo "<td class='center bg1'>{$officerLevelText}</td>
<td class='center'>{$chiefText}</td>";
$nations[$nationID]['cities'][$cityID] = $cityName;
}
echo "</tr>
<tr>
<td align=center id=bg1>외교권자</td><td colspan=5>";
echo join(', ', $ambassadors);
echo "</td><td align=center id=bg1>조언자</td><td align=center >";
echo count($auditors).'명';
echo "</td></tr>
<tr>
<td colspan=8>";
if($nation['level'] > 0) {
echo "속령 일람 : ";
foreach($nation['cities'] as $cityID => $cityName) {
if($cityID == $nation['capital']) {
echo "<font color=cyan>[{$cityName}]</font>, ";
} else {
echo "{$cityName}, ";
foreach ($nations as $nation) {
if ($nation['nation'] == 0) {
//재야 도시, 장수
continue;
}
$generals = $nation['generals'];
$chiefs = [];
$ambassadors = [];
$auditors = [];
foreach ($generals as $general) {
$officerLevel = $general['officer_level'];
if ($officerLevel >= 5) {
$chiefs[$officerLevel] = $general;
}
$generalPermission = checkSecretPermission($general, false);
if ($generalPermission == 4) {
$ambassadors[] = $general['name'];
} else if ($generalPermission == 3) {
$auditors[] = $general['name'];
}
}
} else {
$cityName = CityConst::byID($chiefs[12]['city'])->name;
echo "현재 위치 : <font color=yellow>{$cityName}</font>";
}
echo"
echo "
<table align=center width=1000 class='tb_layout bg2'>
<tr>
<td colspan=8 align=center style=color:" . newColor($nation['color']) . "; bgcolor={$nation['color']}>【 {$nation['name']} 】</td>
</tr>
<tr>
<td width=80 align=center class='bg1'>성 향</td>
<td width=170 align=center><font color=yellow>" . getNationType($nation['type']) . "</font></td>
<td width=80 align=center class='bg1'>작 위</td>
<td width=170 align=center>" . getNationLevel($nation['level']) . "</td>
<td width=80 align=center class='bg1'>국 력</td>
<td width=170 align=center>{$nation['power']}</td>
<td width=80 align=center class='bg1'>장수 / 속령</td>
<td width=170 align=center>{$nation['gennum']} / " . count($nation['cities'] ?? []) . "</td>
";
for ($chiefLevel = 12; $chiefLevel >= 5; $chiefLevel--) {
if ($chiefLevel % 4 == 0) {
echo '</tr><tr>';
}
$chief = $chiefs[$chiefLevel] ?? ['name' => '-', 'npc' => 0];
$officerLevelText = getOfficerLevelText($chiefLevel, $nation['level']);
$chiefText = getColoredName($chief['name'], $chief['npc']);
echo "<td class='center bg1'>{$officerLevelText}</td>
<td class='center'>{$chiefText}</td>";
}
echo "</tr>
<tr>
<td align=center class='bg1'>외교권자</td><td colspan=5>";
echo join(', ', $ambassadors);
echo "</td><td align=center class='bg1'>조언자</td><td align=center >";
echo count($auditors) . '명';
echo "</td></tr>
<tr>
<td colspan=8>";
if ($nation['level'] > 0) {
echo "속령 일람 : ";
foreach ($nation['cities'] as $cityID => $cityName) {
if ($cityID == $nation['capital']) {
echo "<font color=cyan>[{$cityName}]</font>, ";
} else {
echo "{$cityName}, ";
}
}
} else {
$cityName = CityConst::byID($chiefs[12]['city'])->name;
echo "현재 위치 : <font color=yellow>{$cityName}</font>";
}
echo "
</td>
</tr>
<tr>
<td colspan=8> 장수 일람 : ";
foreach($generals as $general){
if($general['npc'] >= 2) { echo "<font color=cyan>{$general['name']}</font>, "; }
elseif($general['npc'] == 1) { echo "<font color=skyblue>{$general['name']}</font>, "; }
else { echo "{$general['name']}, "; }
}
echo"
foreach ($generals as $general) {
if ($general['npc'] >= 2) {
echo "<font color=cyan>{$general['name']}</font>, ";
} elseif ($general['npc'] == 1) {
echo "<font color=skyblue>{$general['name']}</font>, ";
} else {
echo "{$general['name']}, ";
}
}
echo "
</td>
</tr>
</table>
<br>";
}
}
//재야
echo "
//재야
echo "
<table align=center width=1000 class='tb_layout bg2'>
<tr>
<td colspan=5 align=center>【 재 야 】</td>
</tr>
<tr>
<td width=498 align=center>&nbsp;</td>
<td width=123 align=center id=bg1>장 수</td>
<td width=123 align=center class='bg1'>장 수</td>
<td width=123 align=center>{$nations[0]['gennum']}</td>
<td width=123 align=center id=bg1>속 령</td>
<td width=123 align=center>".count($nations[0]['cities']??[])."</td>
<td width=123 align=center class='bg1'>속 령</td>
<td width=123 align=center>" . count($nations[0]['cities'] ?? []) . "</td>
</tr>
<tr>
<td colspan=5> 속령 일람 : ";
foreach($nations[0]['cities']??[] as $cityName) {
echo "{$cityName}, ";
}
echo"
foreach ($nations[0]['cities'] ?? [] as $cityName) {
echo "{$cityName}, ";
}
echo "
</td>
</tr>
<tr>
<td colspan=5> 장수 일람 : ";
foreach($nations[0]['generals'] as $general) {
foreach ($nations[0]['generals'] as $general) {
$generalText = getColoredName($general['name'], $general['npc']);
echo "{$generalText}, ";
echo "{$generalText}, ";
}
echo"
echo "
</td>
</tr>
</table>";
?>
?>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td><?=closeButton()?></td></tr>
<tr><td><?=banner()?></td></tr>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td><?= closeButton() ?></td>
</tr>
<tr>
<td><?= banner() ?></td>
</tr>
</table>
</body>
</html>
</html>
+105 -98
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -6,7 +7,7 @@ include "func.php";
$type = Util::getReq('type', 'int', 1);
if($type <= 0 || $type > 8){
if ($type <= 0 || $type > 8) {
$type = 1;
}
@@ -22,111 +23,117 @@ $sel[$type] = "selected";
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?=UniqueConst::$serverName?>: 빙의일람</title>
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('js/common.js')?>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?= UniqueConst::$serverName ?>: 빙의일람</title>
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printDist('ts', ['common']) ?>
</head>
<body>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td>빙 의 일 람<br><?=closeButton()?></td></tr>
<tr><td><form name=form1 method=post>정렬순서 :
<select name=type size=1>
<option <?=$sel[1]??''?> value=1>이름</option>
<option <?=$sel[2]??''?> value=2>국가</option>
<option <?=$sel[3]??''?> value=3>종능</option>
<option <?=$sel[4]??''?> value=4>통솔</option>
<option <?=$sel[5]??''?> value=5>무력</option>
<option <?=$sel[6]??''?> value=6>지력</option>
<option <?=$sel[7]??''?> value=7>명성</option>
<option <?=$sel[8]??''?> value=8>계급</option>
</select>
<input type=submit value='정렬하기'></form>
</td></tr>
</table>
<?php
$nationName = [];
$nationName[0] = "-";
foreach (getAllNationStaticInfo() as $nation) {
$nationName[$nation['nation']] = $nation['name'];
}
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td>빙 의 일 람<br><?= closeButton() ?></td>
</tr>
<tr>
<td>
<form name=form1 method=post>정렬순서 :
<select name=type size=1>
<option <?= $sel[1] ?? '' ?> value=1>이름</option>
<option <?= $sel[2] ?? '' ?> value=2>국가</option>
<option <?= $sel[3] ?? '' ?> value=3>종능</option>
<option <?= $sel[4] ?? '' ?> value=4>통솔</option>
<option <?= $sel[5] ?? '' ?> value=5>무력</option>
<option <?= $sel[6] ?? '' ?> value=6>지력</option>
<option <?= $sel[7] ?? '' ?> value=7>명성</option>
<option <?= $sel[8] ?? '' ?> value=8>계급</option>
</select>
<input type=submit value='정렬하기'>
</form>
</td>
</tr>
</table>
<?php
$nationName = [];
$nationName[0] = "-";
foreach (getAllNationStaticInfo() as $nation) {
$nationName[$nation['nation']] = $nation['name'];
}
$generalList = $db->query('SELECT npc,nation,name,owner_name,special,special2,personal,leadership,strength,intel,leadership+strength+intel as sum,explevel,experience,dedication from general where npc=1');
$generalListFromPool = $db->query('SELECT npc,nation,name,owner_name,special,special2,personal,leadership,strength,intel,leadership+strength+intel as sum,explevel,experience,dedication from general JOIN select_pool on general.no = select_pool.general_id where npc=0');
$generalList = $db->query('SELECT npc,nation,name,owner_name,special,special2,personal,leadership,strength,intel,leadership+strength+intel as sum,explevel,experience,dedication from general where npc=1');
$generalListFromPool = $db->query('SELECT npc,nation,name,owner_name,special,special2,personal,leadership,strength,intel,leadership+strength+intel as sum,explevel,experience,dedication from general JOIN select_pool on general.no = select_pool.general_id where npc=0');
if($generalListFromPool){
$generalList = array_merge($generalListFromPool, $generalList);
}
if ($generalListFromPool) {
$generalList = array_merge($generalListFromPool, $generalList);
}
$sortType = [
1 => ['name', true],
2 => ['nation', true],
3 => ['sum', false],
4 => ['leadership', false],
5 => ['strength', false],
6 => ['intel', false],
7 => ['experience', false],
8 => ['dedication', false],
];
$sortType = [
1 => ['name', true],
2 => ['nation', true],
3 => ['sum', false],
4 => ['leadership', false],
5 => ['strength', false],
6 => ['intel', false],
7 => ['experience', false],
8 => ['dedication', false],
];
[$sortKey, $isAsc] = $sortType[$type];
[$sortKey, $isAsc] = $sortType[$type];
if($isAsc){
usort($generalList, function($lhs, $rhs)use($sortKey){
return $lhs[$sortKey] <=> $rhs[$sortKey];
});
}
else{
usort($generalList, function($lhs, $rhs)use($sortKey){
return $rhs[$sortKey] <=> $lhs[$sortKey];
});
}
if ($isAsc) {
usort($generalList, function ($lhs, $rhs) use ($sortKey) {
return $lhs[$sortKey] <=> $rhs[$sortKey];
});
} else {
usort($generalList, function ($lhs, $rhs) use ($sortKey) {
return $rhs[$sortKey] <=> $lhs[$sortKey];
});
}
?>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td width=102 align=center id=bg1>희생된 장수</td>
<td width=102 align=center id=bg1>악령 이름</td>
<td width=68 align=center id=bg1>레벨</td>
<td width=118 align=center id=bg1>국가</td>
<td width=68 align=center id=bg1>성격</td>
<td width=88 align=center id=bg1>특기</td>
<td width=68 align=center id=bg1>종능</td>
<td width=68 align=center id=bg1>통솔</td>
<td width=68 align=center id=bg1>무력</td>
<td width=68 align=center id=bg1>지력</td>
<td width=78 align=center id=bg1>명성</td>
<td width=78 align=center id=bg1>계급</td>
</tr>
<?php foreach($generalList as $general): ?>
<tr>
<td align=center><?=getColoredName($general['name'], $general['npc'])?></td>
<td align=center><?=$general['owner_name']?></td>
<td align=center>Lv <?=$general['explevel']?></td>
<td align=center><?=$nationName[$general['nation']]?></td>
<td align=center><?=displayCharInfo($general['personal'])?></td>
<td align=center><?=displaySpecialDomesticInfo($general['special'])?> / <?=displaySpecialWarInfo($general['special2'])?></td>
<td align=center><?=$general['sum']?></td>
<td align=center><?=$general['leadership']?></td>
<td align=center><?=$general['strength']?></td>
<td align=center><?=$general['intel']?></td>
<td align=center><?=$general['experience']?></td>
<td align=center><?=$general['dedication']?></td>
</tr>
<?php endforeach; ?>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td><?=closeButton()?></td></tr>
<tr><td><?=banner()?></td></tr>
</table>
?>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td width=102 align=center class='bg1'>희생된 장수</td>
<td width=102 align=center class='bg1'>악령 이름</td>
<td width=68 align=center class='bg1'>레벨</td>
<td width=118 align=center class='bg1'>국가</td>
<td width=68 align=center class='bg1'>성격</td>
<td width=88 align=center class='bg1'>특기</td>
<td width=68 align=center class='bg1'>종능</td>
<td width=68 align=center class='bg1'>통솔</td>
<td width=68 align=center class='bg1'>무력</td>
<td width=68 align=center class='bg1'>지력</td>
<td width=78 align=center class='bg1'>명성</td>
<td width=78 align=center class='bg1'>계급</td>
</tr>
<?php foreach ($generalList as $general) : ?>
<tr>
<td align=center><?= getColoredName($general['name'], $general['npc']) ?></td>
<td align=center><?= $general['owner_name'] ?></td>
<td align=center>Lv <?= $general['explevel'] ?></td>
<td align=center><?= $nationName[$general['nation']] ?></td>
<td align=center><?= displayCharInfo($general['personal']) ?></td>
<td align=center><?= displaySpecialDomesticInfo($general['special']) ?> / <?= displaySpecialWarInfo($general['special2']) ?></td>
<td align=center><?= $general['sum'] ?></td>
<td align=center><?= $general['leadership'] ?></td>
<td align=center><?= $general['strength'] ?></td>
<td align=center><?= $general['intel'] ?></td>
<td align=center><?= $general['experience'] ?></td>
<td align=center><?= $general['dedication'] ?></td>
</tr>
<?php endforeach; ?>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td><?= closeButton() ?></td>
</tr>
<tr>
<td><?= banner() ?></td>
</tr>
</table>
</body>
</html>
</html>
+58 -53
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -13,71 +14,75 @@ $gameStor = KVStorage::getStorage($db, 'game_env');
increaseRefresh("세력도", 2);
TurnExecutionHelper::executeAllCommand();
$mapTheme = $gameStor->map_theme??'che';
$mapTheme = $gameStor->map_theme ?? 'che';
$me = $db->queryFirstRow('SELECT con,turntime from general where owner=%i', $userID);
$con = checkLimit($me['con']);
if($con >= 2) { printLimitMsg($me['turntime']); exit(); }
if ($con >= 2) {
printLimitMsg($me['turntime']);
exit();
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?=UniqueConst::$serverName?>: 세력도</title>
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('../d_shared/common_path.js')?>
<?=WebUtil::printJS('js/common.js')?>
<?=WebUtil::printJS('d_shared/base_map.js')?>
<?=WebUtil::printJS('js/map.js')?>
<script>
window.serverNick = '<?=DB::prefix()?>';
window.serverID = '<?=UniqueConst::$serverID?>';
$(function(){
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?= UniqueConst::$serverName ?>: 세력도</title>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<?= WebUtil::printCSS('css/normalize.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printCSS('css/map.css') ?>
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printJS('d_shared/base_map.js') ?>
<?= WebUtil::printDist('ts', ['common', 'map']) ?>
<script>
window.serverNick = '<?= DB::prefix() ?>';
window.serverID = '<?= UniqueConst::$serverID ?>';
$(function() {
reloadWorldMap({
neutralView:true,
showMe:true,
useCachedMap:true
});
});
</script>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/normalize.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<?=WebUtil::printCSS('css/map.css')?>
reloadWorldMap({
neutralView: true,
showMe: true,
useCachedMap: true
});
});
</script>
</head>
<body>
<table align=center width=1200 class='tb_layout bg0'>
<tr><td>세 력 도<br><?=closeButton()?></td></tr>
</table>
<table align=center width=1200 height=520 class='tb_layout bg0'>
<tr height=520>
<td width=498 valign=top>
<?=formatHistoryToHTML(getGlobalActionLogRecent(34))?>
</td>
<td width=698>
<?=getMapHtml($mapTheme)?>
</td>
</tr>
<tr>
<td colspan=2 valign=top>
<?=formatHistoryToHTML(getGlobalHistoryLogRecent(34))?>
</td>
</tr>
</table>
<table align=center width=1200 class='tb_layout bg0'>
<tr><td><?=closeButton()?></td></tr>
<tr><td><?=banner()?> </td></tr>
</table>
<table align=center width=1200 class='tb_layout bg0'>
<tr>
<td>세 력 도<br><?= closeButton() ?></td>
</tr>
</table>
<table align=center width=1200 height=520 class='tb_layout bg0'>
<tr height=520>
<td width=498 valign=top>
<?= formatHistoryToHTML(getGlobalActionLogRecent(34)) ?>
</td>
<td width=698>
<?= getMapHtml($mapTheme) ?>
</td>
</tr>
<tr>
<td colspan=2 valign=top>
<?= formatHistoryToHTML(getGlobalHistoryLogRecent(34)) ?>
</td>
</tr>
</table>
<table align=center width=1200 class='tb_layout bg0'>
<tr>
<td><?= closeButton() ?></td>
</tr>
<tr>
<td><?= banner() ?> </td>
</tr>
</table>
</body>
</html>
</html>
+203 -148
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -9,9 +10,9 @@ $gameStor = KVStorage::getStorage($db, 'game_env');
increaseRefresh("갱신정보", 2);
$admin = $gameStor->getValues(['year','month','refresh','maxrefresh','maxonline']);
$admin = $gameStor->getValues(['year', 'month', 'refresh', 'maxrefresh', 'maxonline']);
$log = getRawFileLogRecent(__DIR__.'/logs/'.UniqueConst::$serverID.'/_traffic.txt', 11, 100);
$log = getRawFileLogRecent(__DIR__ . '/logs/' . UniqueConst::$serverID . '/_traffic.txt', 11, 100);
$date = [];
$year = [];
@@ -20,7 +21,7 @@ $refresh = [];
$online = [];
$curonline = getOnlineNum();
foreach($log as $i=>$value){
foreach ($log as $i => $value) {
$parse = Json::decode($value);
$date[$i] = $parse[0];
$year[$i] = $parse[1];
@@ -47,154 +48,180 @@ if ($admin['maxonline'] < $curonline) {
?>
<!DOCTYPE html>
<html>
<head>
<title><?=UniqueConst::$serverName?>: 트래픽정보</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('js/common.js')?>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<style>
.big_bar{
float:left;
position:relative;
height:30px;
}
.big_bar span{
float:right;
padding:0;
margin:0;
line-height:30px;
padding-right:1ch;
}
<title><?= UniqueConst::$serverName ?>: 트래픽정보</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<style>
.big_bar {
float: left;
position: relative;
height: 30px;
}
.little_bar{
float:left;
position:relative;
height:17px;
}
.big_bar span {
float: right;
padding: 0;
margin: 0;
line-height: 30px;
padding-right: 1ch;
}
span.out_bar{
line-height:30px;
margin-left:1ch;
}
</style>
.little_bar {
float: left;
position: relative;
height: 17px;
}
span.out_bar {
line-height: 30px;
margin-left: 1ch;
}
</style>
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printDist('ts', ['common']) ?>
</head>
<body>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td>트 래 픽 정 보<br><?=closeButton()?></td></tr>
</table>
<br>
<table align=center width=1016>
<tr><td align=left>
<table align=center class='tb_layout bg0'>
<tr><td colspan=4 align=center id=bg2><font size=5>접 속 량</font></td></tr>
<?php
$refresh[] = $admin['refresh'];
foreach($refresh as $i=>$value){
$w = round($value / $admin['maxrefresh'] * 100, 1);
$color = getTrafficColor($w);
$dt = substr($date[$i], 11, 5); ?>
<tr height=30>
<td width=100 align=center><?=$year[$i]?>년 <?=$month[$i]?>월</td>
<td width=60 align=center id=bg2><?=$dt?></td>
<td width=2 align=center id=bg1></td>
<td width=320>
<?php if($w == 0): ?>
<span class="out_bar"><?=$value?></span>
<?php elseif($w < 10): ?>
<div class='big_bar' style='width:<?=$w?>%;background-color:<?=$color?>;'></div><span class="out_bar"><?=$value?></span>
<?php else:?>
<div class='big_bar' style='width:<?=$w?>%;background-color:<?=$color?>;'><span><?=$value?></span></div>
<?php endif;?>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td>트 래 픽 정 보<br><?= closeButton() ?></td>
</tr>
</table>
<br>
<table align=center width=1016>
<tr>
<td align=left>
<table align=center class='tb_layout bg0'>
<tr>
<td colspan=4 align=center class='bg2'>
<font size=5>접 속 량</font>
</td>
</tr>
<?php
$refresh[] = $admin['refresh'];
foreach ($refresh as $i => $value) {
$w = round($value / $admin['maxrefresh'] * 100, 1);
$color = getTrafficColor($w);
$dt = substr($date[$i], 11, 5); ?>
<tr height=30>
<td width=100 align=center><?= $year[$i] ?>년 <?= $month[$i] ?></td>
<td width=60 align=center class='bg2'><?= $dt ?></td>
<td width=2 align=center class='bg1'></td>
<td width=320>
<?php if ($w == 0) : ?>
<span class="out_bar"><?= $value ?></span>
<?php elseif ($w < 10) : ?>
<div class='big_bar' style='width:<?= $w ?>%;background-color:<?= $color ?>;'></div><span class="out_bar"><?= $value ?></span>
<?php else : ?>
<div class='big_bar' style='width:<?= $w ?>%;background-color:<?= $color ?>;'><span><?= $value ?></span></div>
<?php endif; ?>
</td>
</tr>
<?php
}
?>
<tr>
<td colspan=4 height=5 align=center class='bg1'></td>
</tr>
<tr>
<td colspan=4 height=30 align=center class='bg0'>최고기록: <?= $admin['maxrefresh'] ?></td>
</tr>
</table>
</td>
<td align=right>
<table align=center class='tb_layout bg0'>
<tr>
<td colspan=4 align=center class='bg2'>
<font size=5>접 속 자</font>
</td>
</tr>
<?php
$online[] = $curonline;
foreach ($online as $i => $value) {
$w = round($value / $admin['maxonline'] * 100, 1);
$color = getTrafficColor($w);
$dt = substr($date[$i], 11, 5); ?>
<tr height=30>
<td width=100 align=center><?= $year[$i] ?>년 <?= $month[$i] ?>월</td>
<td width=60 align=center class='bg2'><?= $dt ?></td>
<td width=2 align=center class='bg1'></td>
<td width=320>
<?php if ($w == 0) : ?>
<span class="out_bar"><?= $value ?></span>
<?php elseif ($w < 10) : ?>
<div class='big_bar' style='width:<?= $w ?>%;background-color:<?= $color ?>;'></div><span class="out_bar"><?= $value ?></span>
<?php else : ?>
<div class='big_bar' style='width:<?= $w ?>%;background-color:<?= $color ?>;'><span><?= $value ?></span></div>
<?php endif; ?>
</td>
</tr>
<?php
}
?>
<tr>
<td colspan=4 height=5 align=center class='bg1'></td>
</tr>
<tr>
<td colspan=4 height=30 align=center class='bg0'>최고기록: <?= $admin['maxonline'] ?></td>
</tr>
</table>
</td>
</tr>
</table>
<br>
<table align=center class='tb_layout bg0'>
<tr>
<td colspan=3 align=center class='bg2'>
<font size=5>주 의 대 상 자 (순간과도갱신)</font>
</td>
</tr>
<?php
$max_refresh = $db->queryFirstRow('SELECT sum(refresh) as refresh, sum(`connect`) as `connect` from general');
$max_refresh['name'] = '접속자 총합';
$refresh_result = array_merge([$max_refresh], $db->query('SELECT `name`,refresh,`connect` FROM general ORDER BY refresh DESC LIMIT 5'));
foreach ($refresh_result as $i => $user) {
$w = round($user['refresh'] / max(1, $max_refresh['refresh']) * 100, 1);
$w2 = round(100 - $w, 1);
$color = getTrafficColor($w);
?>
<tr>
<td width=98 align=center><?= $user['name'] ?></td>
<td width=98 align=center><?= $user['connect'] ?>(<?= $user['refresh'] ?>)</td>
<td width=798>
<?php if ($w == 0) : ?>
<?php elseif ($w < 10) : ?>
<div class='little_bar' style='width:<?= $w ?>%;background-color:<?= $color ?>;'></div>
<?php else : ?>
<div class='little_bar' style='width:<?= $w ?>%;background-color:<?= $color ?>;'></div>
<?php endif; ?>
</td>
</tr>
<?php
}
?>
<tr><td colspan=4 height=5 align=center id=bg1></td></tr>
<tr>
<td colspan=4 height=30 align=center id=bg0>최고기록: <?=$admin['maxrefresh']?></td>
</tr>
</table>
</td>
<td align=right>
<table align=center class='tb_layout bg0'>
<tr><td colspan=4 align=center id=bg2><font size=5>접 속 자</font></td></tr>
<?php
$online[] = $curonline;
foreach($online as $i=>$value){
$w = round($value / $admin['maxonline'] * 100, 1);
$color = getTrafficColor($w);
$dt = substr($date[$i], 11, 5); ?>
<tr height=30>
<td width=100 align=center><?=$year[$i]?>년 <?=$month[$i]?>월</td>
<td width=60 align=center id=bg2><?=$dt?></td>
<td width=2 align=center id=bg1></td>
<td width=320>
<?php if($w == 0): ?>
<span class="out_bar"><?=$value?></span>
<?php elseif($w < 10): ?>
<div class='big_bar' style='width:<?=$w?>%;background-color:<?=$color?>;'></div><span class="out_bar"><?=$value?></span>
<?php else:?>
<div class='big_bar' style='width:<?=$w?>%;background-color:<?=$color?>;'><span><?=$value?></span></div>
<?php endif;?>
</td>
</tr>
<?php
}
?>
<tr><td colspan=4 height=5 align=center id=bg1></td></tr>
<tr>
<td colspan=4 height=30 align=center id=bg0>최고기록: <?=$admin['maxonline']?></td>
</tr>
</table>
</td></tr>
</table>
<br>
<table align=center class='tb_layout bg0'>
<tr><td colspan=3 align=center id=bg2><font size=5>주 의 대 상 자 (순간과도갱신)</font></td></tr>
<?php
$max_refresh = $db->queryFirstRow('SELECT sum(refresh) as refresh, sum(`connect`) as `connect` from general');
$max_refresh['name'] = '접속자 총합';
$refresh_result = array_merge([$max_refresh], $db->query('SELECT `name`,refresh,`connect` FROM general ORDER BY refresh DESC LIMIT 5'));
foreach ($refresh_result as $i=>$user) {
$w = round($user['refresh'] / max(1, $max_refresh['refresh']) * 100, 1);
$w2 = round(100 - $w, 1);
$color = getTrafficColor($w);
?>
<tr>
<td width=98 align=center><?=$user['name']?></td>
<td width=98 align=center><?=$user['connect']?>(<?=$user['refresh']?>)</td>
<td width=798>
<?php if($w == 0): ?>
<?php elseif($w < 10): ?>
<div class='little_bar' style='width:<?=$w?>%;background-color:<?=$color?>;'></div>
<?php else:?>
<div class='little_bar' style='width:<?=$w?>%;background-color:<?=$color?>;'></div>
<?php endif;?>
</td>
</tr>
<?php
}
?>
</table>
<br>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td><?=closeButton()?></td></tr>
<tr><td><?=banner()?> </td></tr>
</table>
<?php
}
?>
</table>
<br>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td><?= closeButton() ?></td>
</tr>
<tr>
<td><?= banner() ?> </td>
</tr>
</table>
</body>
</html>
<?php
@@ -203,7 +230,7 @@ function getTrafficColor($per)
$r = getHex($per);
$b = getHex(100 - $per);
$color = $r . "00" . $b;
return '#'.$color;
return '#' . $color;
}
function getHex($dec)
@@ -217,9 +244,37 @@ function getHex($dec)
function getHexCode($hex)
{
switch ($hex) {
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 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 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 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";
}
}
+272 -240
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -11,154 +12,160 @@ $gameStor = KVStorage::getStorage($db, 'game_env');
increaseRefresh("설문조사", 1);
$isVoteAdmin = in_array('vote', $session->acl[DB::prefix()]??[]);
$isVoteAdmin |= $session->userGrade >= 5;
$isVoteAdmin = in_array('vote', $session->acl[DB::prefix()] ?? []);
$isVoteAdmin = $isVoteAdmin || $session->userGrade >= 5;
$me = $db->queryFirstRow('SELECT no,vote from general where owner=%i', $userID);
$admin = $gameStor->getValues(['develcost','voteopen','vote_title','vote','votecomment']);
$vote_title = $admin['vote_title']??'-';
$vote = $admin['vote']?:['-'];
$admin = $gameStor->getValues(['develcost', 'voteopen', 'vote_title', 'vote', 'votecomment']);
$vote_title = $admin['vote_title'] ?? '-';
$vote = $admin['vote'] ?: ['-'];
?>
<!DOCTYPE html>
<html>
<head>
<title><?=UniqueConst::$serverName?>: 설문조사</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('js/common.js')?>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<style>
.little_bar{
float:left;
position:relative;
height:17px;
line-height:17px;
text-align:center;
}
</style>
<script type="text/javascript">
function captureKey(e) {
if(e.keyCode == 13 && e.srcElement.type == 'text') {
form1.btn.value = '댓글';
form1.btn.click();
return false;
}
}
</script>
<title><?= UniqueConst::$serverName ?>: 설문조사</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<style>
.little_bar {
float: left;
position: relative;
height: 17px;
line-height: 17px;
text-align: center;
}
</style>
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printDist('ts', ['common']) ?>
<script type="text/javascript">
function captureKey(e) {
if (e.keyCode == 13 && e.srcElement.type == 'text') {
form1.btn.value = '댓글';
form1.btn.click();
return false;
}
}
</script>
</head>
<body>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td>설 문 조 사<br><?=closeButton()?></td></tr>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<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>
<?php
if ($isVoteAdmin) {
echo "
<body>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td>설 문 조 사<br><?= closeButton() ?></td>
</tr>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<form name=form1 action=c_vote.php method=post>
<tr>
<td colspan=3 align=center class='bg2'>
<font size=5>설 문 조 사 (<?= $admin['develcost'] * 5 ?>금과 추첨으로 유니크템 증정!)</font>
</td>
</tr>
<?php
if ($isVoteAdmin) {
echo "
<tr>
<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=848 align=left><input type=text name=title style=width:848px;></td>
</tr>
";
}
}
$vote_title = Tag2Code($vote_title);
echo "
$vote_title = Tag2Code($vote_title);
echo "
<tr>
<td colspan=2 width=148 align=center id=bg1>제 목</td>
<td colspan=2 width=148 align=center class='bg1'>제 목</td>
<td width=848 align=left>&nbsp;{$vote_title}</td>
</tr>
";
$voteCount = $db->queryFirstField('SELECT count(no) FROM general WHERE vote>0 AND npc<2');
$allCount = $db->queryFirstField('SELECT count(no) FROM general WHERE npc<2');
$voteCount = $db->queryFirstField('SELECT count(no) FROM general WHERE vote>0 AND npc<2');
$allCount = $db->queryFirstField('SELECT count(no) FROM general WHERE npc<2');
$percentage = round($voteCount / $allCount * 100, 1);
$percentage = round($voteCount / $allCount * 100, 1);
$voteTypeCount = count($vote);
for ($i=1; $i < $voteTypeCount; $i++) {
echo "
$voteTypeCount = count($vote);
for ($i = 1; $i < $voteTypeCount; $i++) {
echo "
<tr>
<td width=48 align=center style=color:".getNewColor($i)."; bgcolor=".getVoteColor($i).">{$i}.</td>
<td width=48 align=center style=color:" . getNewColor($i) . "; bgcolor=" . getVoteColor($i) . ">{$i}.</td>
<td width=98 align=center>
";
if ($me['vote'] == 0 && $me['no'] > 0) {
echo "
if ($me['vote'] == 0 && $me['no'] > 0) {
echo "
<input type=radio name=sel value={$i}>
";
} elseif ($admin['voteopen'] >= 1 || $isVoteAdmin) {
$vCount = $db->queryFirstField('SELECT count(no) FROM general WHERE vote=%i', $i);
} elseif ($admin['voteopen'] >= 1 || $isVoteAdmin) {
$vCount = $db->queryFirstField('SELECT count(no) FROM general WHERE vote=%i', $i);
$per = @round($vCount / $voteCount * 100, 1);
echo "{$vCount} 표 ({$per}%)";
} else {
echo "추후공개";
}
$vote[$i] = Tag2Code($vote[$i]);
echo "
$per = @round($vCount / $voteCount * 100, 1);
echo "{$vCount} 표 ({$per}%)";
} else {
echo "추후공개";
}
$vote[$i] = Tag2Code($vote[$i]);
echo "
</td>
<td align=left>&nbsp;{$vote[$i]}</td>
</tr>
";
}
}
echo "
echo "
<tr>
";
if ($me['vote'] == 0 && $me['no'] > 0) {
echo "
if ($me['vote'] == 0 && $me['no'] > 0) {
echo "
<td align=center>투표</td>
<td align=center><input type=submit name=btn value='투표'></td>
";
} else {
echo "
} else {
echo "
<td colspan=2 align=center>결산</td>
";
}
echo "
}
echo "
<td align=left>&nbsp;투표율 : {$voteCount} / {$allCount} ({$percentage} %)</td>
</tr>
";
if ($isVoteAdmin) {
echo "
if ($isVoteAdmin) {
echo "
<tr>
<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:848px;></td>
</tr>
";
}
}
if ($admin['votecomment']) {
$comment = $admin['votecomment'];
$commentCount = count($comment);
} else {
$commentCount = 0;
}
echo "
if ($admin['votecomment']) {
$comment = $admin['votecomment'];
$commentCount = count($comment);
} else {
$commentCount = 0;
}
echo "
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td colspan=4 align=center id=bg1>댓 글</td>
<td colspan=4 align=center class='bg1'>댓 글</td>
</tr>
";
for ($i=0; $i < $commentCount; $i++) {
$cmt = $comment[$i];
$cmt[2] = Tag2Code($cmt[2]);
$j = $i+1;
echo "
for ($i = 0; $i < $commentCount; $i++) {
$cmt = $comment[$i];
$cmt[2] = Tag2Code($cmt[2]);
$j = $i + 1;
echo "
<tr>
<td width=28 align=center>{$j}.</td>
<td width=130 align=center>{$cmt[0]}</td>
@@ -166,202 +173,205 @@ for ($i=0; $i < $commentCount; $i++) {
<td width=712 align=left>&nbsp;{$cmt[2]}</td>
</tr>
";
}
if ($me['no'] > 0) {
echo "
}
if ($me['no'] > 0) {
echo "
<tr>
<td width=158 colspan=2 align=center>-</td>
<td width=130 align=center><input type=submit name=btn value='댓글'></td>
<td align=left><input type=text name=comment maxlength=60 style=width:700px; onkeydown='return captureKey(event)'></td>
</tr>
";
}
?>
</table>
<br>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td colspan=3 align=center id=bg2><font size=5>
전 체 통 계
<?php
if ($isVoteAdmin) {
echo "
}
?>
</table>
<br>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td colspan=3 align=center class='bg2'>
<font size=5>
전 체 통 계
<?php
if ($isVoteAdmin) {
echo "
<input type=submit name=btn value='숨김'>
<input type=submit name=btn value='전체통계만'>
<input type=submit name=btn value='전부'>";
}
echo "
}
echo "
</font></td></tr>";
if ($admin['voteopen'] >= 1 || $isVoteAdmin) {
echo "
if ($admin['voteopen'] >= 1 || $isVoteAdmin) {
echo "
<tr>
<td width=130 align=center>전 체</td>
<td width=128 align=center>{$voteCount} / {$allCount} ({$percentage} %)</td>
<td width=742>
";
$memCount = max(1, $db->queryFirstField('SELECT count(`no`) FROM general WHERE npc<2'));
$memCount = max(1, $db->queryFirstField('SELECT count(`no`) FROM general WHERE npc<2'));
$totalVote = [];
$nationVoteCount = [];
$nationVote = [];
$totalVote = [];
$nationVoteCount = [];
$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'];
$ownVote = $row['vote'];
$cnt = $row['cnt'];
foreach ($db->query("SELECT nation, vote, count(`no`) as cnt FROM general WHERE npc<2 GROUP BY nation, vote") as $row) {
$nation = $row['nation'];
$ownVote = $row['vote'];
$cnt = $row['cnt'];
if (!isset($totalVote[$ownVote])) {
$totalVote[$ownVote] = 0;
}
if (!isset($totalVote[$ownVote])) {
$totalVote[$ownVote] = 0;
}
if (!isset($nationVoteCount[$nation])) {
$nationVoteCount[$nation] = 0;
$nationVote[$nation] = [];
}
if (!isset($nationVoteCount[$nation])) {
$nationVoteCount[$nation] = 0;
$nationVote[$nation] = [];
}
if (!isset($nationVote[$nation][$ownVote])) {
$nationVote[$nation][$ownVote] = 0;
}
if (!isset($nationVote[$nation][$ownVote])) {
$nationVote[$nation][$ownVote] = 0;
}
$totalVote[$ownVote] += $cnt;
$nationVoteCount[$nation] += $cnt;
$nationVote[$nation][$ownVote] += $cnt;
}
$totalVote[$ownVote] += $cnt;
$nationVoteCount[$nation] += $cnt;
$nationVote[$nation][$ownVote] += $cnt;
}
$totalPer = 0;
for ($i=0; $i < $voteTypeCount; $i++) {
$per = round(($totalVote[$i]??0) * 100 / $memCount, 1);
if($i == $voteTypeCount-1){
$per = 100-$totalPer;
}
else{
$totalPer += $per;
}
// if($per < 5) { $vote['cnt'] = "&nbsp;"; }
?>
<?php if($per == 0): ?>
<?php elseif($per < 10): ?>
<div class='little_bar' style='width:<?=$per?>%;color:<?=getNewColor($i)?>;background-color:<?=getVoteColor($i)?>;'></div>
<?php else:?>
<div class='little_bar' style='width:<?=$per?>%;color:<?=getNewColor($i)?>;background-color:<?=getVoteColor($i)?>;'><?=$totalVote[$i]?></div>
<?php endif;?>
<?php
}
$totalPer = 0;
for ($i = 0; $i < $voteTypeCount; $i++) {
$per = round(($totalVote[$i] ?? 0) * 100 / $memCount, 1);
if ($i == $voteTypeCount - 1) {
$per = 100 - $totalPer;
} else {
$totalPer += $per;
}
echo "
// if($per < 5) { $vote['cnt'] = "&nbsp;"; }
?>
<?php if ($per == 0) : ?>
<?php elseif ($per < 10) : ?>
<div class='little_bar' style='width:<?= $per ?>%;color:<?= getNewColor($i) ?>;background-color:<?= getVoteColor($i) ?>;'></div>
<?php else : ?>
<div class='little_bar' style='width:<?= $per ?>%;color:<?= getNewColor($i) ?>;background-color:<?= getVoteColor($i) ?>;'><?= $totalVote[$i] ?></div>
<?php endif; ?>
<?php
}
echo "
</td>
</tr>
";
}
}
if ($admin['voteopen'] >= 2 || $isVoteAdmin) {
$memCount = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=0 AND npc <2');
if ($memCount == 0) {
$memCount = 1;
}
if ($admin['voteopen'] >= 2 || $isVoteAdmin) {
$memCount = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=0 AND npc <2');
if ($memCount == 0) {
$memCount = 1;
}
if (!isset($nationVoteCount[0])) {
$nationVoteCount[0] = 0;
}
$percentage = round($nationVoteCount[0] / $memCount * 100, 1);
if (!isset($nationVoteCount[0])) {
$nationVoteCount[0] = 0;
}
$percentage = round($nationVoteCount[0] / $memCount * 100, 1);
echo "
echo "
<tr>
<td align=center bgcolor=black>재 야</td>
<td align=center>{$nationVoteCount[0]} / {$memCount} ({$percentage} %)</td>
<td>
";
$totalPer = 0;
for ($i=0; $i < $voteTypeCount; $i++) {
$per = round(Util::array_get($nationVote[0][$i], 0) / $memCount * 100, 1);
if($i == $voteTypeCount-1){
$per = 100-$totalPer;
}
else{
$totalPer += $per;
}
// if($per < 5) { $vote['cnt'] = "&nbsp;"; }
?>
<?php if($per == 0): ?>
<?php elseif($per < 10): ?>
<div class='little_bar' style='width:<?=$per?>%;color:<?=getNewColor($i)?>;background-color:<?=getVoteColor($i)?>;'></div>
<?php else:?>
<div class='little_bar' style='width:<?=$per?>%;color:<?=getNewColor($i)?>;background-color:<?=getVoteColor($i)?>;'><?=$nationVote[0][$i]?></div>
<?php endif;?>
<?php
}
$totalPer = 0;
for ($i = 0; $i < $voteTypeCount; $i++) {
$per = round(Util::array_get($nationVote[0][$i], 0) / $memCount * 100, 1);
if ($i == $voteTypeCount - 1) {
$per = 100 - $totalPer;
} else {
$totalPer += $per;
}
// if($per < 5) { $vote['cnt'] = "&nbsp;"; }
?>
<?php if ($per == 0) : ?>
<?php elseif ($per < 10) : ?>
<div class='little_bar' style='width:<?= $per ?>%;color:<?= getNewColor($i) ?>;background-color:<?= getVoteColor($i) ?>;'></div>
<?php else : ?>
<div class='little_bar' style='width:<?= $per ?>%;color:<?= getNewColor($i) ?>;background-color:<?= getVoteColor($i) ?>;'><?= $nationVote[0][$i] ?></div>
<?php endif; ?>
<?php
}
echo "
echo "
</td>
</tr>
";
foreach($db->query('SELECT nation,color,name,gennum from nation order by gennum desc') as $i=>$nation){
$memCount = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND npc<2', $nation['nation']);
foreach ($db->query('SELECT nation,color,name,gennum from nation order by gennum desc') as $i => $nation) {
$memCount = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND npc<2', $nation['nation']);
$voteCount = $nationVoteCount[$nation['nation']] ?? 0;
if($memCount == 0){
$percentage = 100;
}
else{
$percentage = round($voteCount / $memCount * 100, 1);
}
echo "
$voteCount = $nationVoteCount[$nation['nation']] ?? 0;
if ($memCount == 0) {
$percentage = 100;
} else {
$percentage = round($voteCount / $memCount * 100, 1);
}
echo "
<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>{$voteCount} / {$memCount} ({$percentage} %)</td>
<td align=center>
";
$totalPer = 0;
for ($k=0; $k < $voteTypeCount; $k++) {
if($memCount == 0){
$per = 0;
continue;
}
$totalPer = 0;
for ($k = 0; $k < $voteTypeCount; $k++) {
if ($memCount == 0) {
$per = 0;
continue;
}
$per = round(($nationVote[$nation['nation']][$k]??0) / $memCount * 100, 1);
$per = round(($nationVote[$nation['nation']][$k] ?? 0) / $memCount * 100, 1);
if($i == $voteTypeCount-1){
$per = 100-$totalPer;
}
else{
$totalPer += $per;
}
// if($per < 5) { $vote['cnt'] = "&nbsp;"; }
?>
<?php if($per == 0): ?>
<?php elseif($per < 10): ?>
<div class='little_bar' style='width:<?=$per?>%;color:<?=getNewColor($k)?>;background-color:<?=getVoteColor($k)?>;'></div>
<?php else:?>
<div class='little_bar' style='width:<?=$per?>%;color:<?=getNewColor($k)?>;background-color:<?=getVoteColor($k)?>;'><?=$nationVote[$nation['nation']][$k]??0?></div>
<?php endif;?>
<?php
}
if ($i == $voteTypeCount - 1) {
$per = 100 - $totalPer;
} else {
$totalPer += $per;
}
echo "
// if($per < 5) { $vote['cnt'] = "&nbsp;"; }
?>
<?php if ($per == 0) : ?>
<?php elseif ($per < 10) : ?>
<div class='little_bar' style='width:<?= $per ?>%;color:<?= getNewColor($k) ?>;background-color:<?= getVoteColor($k) ?>;'></div>
<?php else : ?>
<div class='little_bar' style='width:<?= $per ?>%;color:<?= getNewColor($k) ?>;background-color:<?= getVoteColor($k) ?>;'><?= $nationVote[$nation['nation']][$k] ?? 0 ?></div>
<?php endif; ?>
<?php
}
echo "
</td>
</tr>
";
}
}
?>
</form>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td><?=closeButton()?></td></tr>
<tr><td><?=banner()?> </td></tr>
</table>
}
}
?>
</form>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td><?= closeButton() ?></td>
</tr>
<tr>
<td><?= banner() ?> </td>
</tr>
</table>
</body>
</html>
<?php
@@ -372,15 +382,31 @@ function getVoteColor($type)
}
switch ($type) {
default:
case 0: $color = "black"; break;
case 1: $color = "red"; break;
case 2: $color = "orange"; break;
case 3: $color = "yellow"; break;
case 4: $color = "green"; break;
case 5: $color = "blue"; break;
case 6: $color = "navy"; break;
case 7: $color = "purple"; break;
default:
case 0:
$color = "black";
break;
case 1:
$color = "red";
break;
case 2:
$color = "orange";
break;
case 3:
$color = "yellow";
break;
case 4:
$color = "green";
break;
case 5:
$color = "blue";
break;
case 6:
$color = "navy";
break;
case 7:
$color = "purple";
break;
}
return $color;
@@ -393,9 +419,15 @@ function getNewColor($type)
}
switch ($type) {
case 2: $color = "black"; break;
case 3: $color = "black"; break;
default:$color = "white"; break;
case 2:
$color = "black";
break;
case 3:
$color = "black";
break;
default:
$color = "white";
break;
}
return $color;
+8
View File
@@ -0,0 +1,8 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
APIHelper::launch(dirname(__FILE__));
+230 -198
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -44,63 +45,73 @@ if ($msg2 == "") {
?>
<!DOCTYPE html>
<html>
<head>
<title><?=UniqueConst::$serverName?>: 거래장</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('js/common.js')?>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
</head>
<body>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td>거 래 장<br><?=closeButton()?></td></tr>
<tr><td align=center id=bg2><font color=orange size=6><b>거 래 장</b></font><input type=button value='갱신' onclick="location.replace('b_auction.php')"></td></tr>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<form method=post action=c_auction.php>
<tr><td colspan=11 align=center bgcolor=orange><font size=5>팝 니 다</font></td></tr>
<tr align=center id=bg1>
<td width=68>거래번호</td>
<td width=48>선택</td>
<td width=98>판매자</td>
<td width=118>물품</td>
<td width=88>수량</td>
<td width=88>시작판매가</td>
<td width=88>현재판매가</td>
<td width=88>즉시판매가</td>
<td width=48>단가</td>
<td width=98>구매 예정자</td>
<td width=148>거래종료</td>
</tr>
<?php
$chk = 0;
foreach($db->query('SELECT * from auction where type=0 order by expire') as $auction){
$radio = "";
$alert = "";
$alert2 = "";
if ($auction['no1'] == $me['no']) {
$radio = " disabled";
} elseif ($auction['no2'] > 0 && $auction['amount'] * 2 <= $auction['value']) {
$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 = substr((string)$pv, 0, 4);
echo "
<head>
<title><?= UniqueConst::$serverName ?>: 거래장</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printDist('ts', ['common']) ?>
</head>
<body>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td>거 래 장<br><?= closeButton() ?></td>
</tr>
<tr>
<td align=center class='bg2'>
<font color=orange size=6><b>거 래 장</b></font><input type=button value='갱신' onclick="location.replace('b_auction.php')">
</td>
</tr>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<form method=post action=c_auction.php>
<tr>
<td colspan=11 align=center bgcolor=orange>
<font size=5>팝 니 다</font>
</td>
</tr>
<tr align=center class='bg1'>
<td width=68>거래번호</td>
<td width=48>선택</td>
<td width=98>판매자</td>
<td width=118>물품</td>
<td width=88>수량</td>
<td width=88>시작판매가</td>
<td width=88>현재판매가</td>
<td width=88>즉시판매가</td>
<td width=48>단가</td>
<td width=98>구매 예정자</td>
<td width=148>거래종료</td>
</tr>
<?php
$chk = 0;
foreach ($db->query('SELECT * from auction where type=0 order by expire') as $auction) {
$radio = "";
$alert = "";
$alert2 = "";
if ($auction['no1'] == $me['no']) {
$radio = " disabled";
} elseif ($auction['no2'] > 0 && $auction['amount'] * 2 <= $auction['value']) {
$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 = substr((string)$pv, 0, 4);
echo "
<tr align=center>
<td>{$auction['no']}</td>
<td><input type=radio name=sel value={$auction['no']}{$radio}></td>
@@ -115,79 +126,83 @@ foreach($db->query('SELECT * from auction where type=0 order by expire') as $auc
<td>{$auction['expire']}</td>
</tr>
";
}
?>
<tr height=25>
<td align=center id=bg1>등록결과</td>
<td colspan=10><?=ConvertLog($msg)?></td>
</tr>
<tr>
<td align=center id=bg1>입찰등록</td>
<td colspan=10>
 지불할 금액: <input type=text style=color:white;background-color:black; size=6 maxlength=6 name=value>
<input type=<?=$btn?> name=btn value='구매시도' onclick='return confirm("정말 입찰하시겠습니까?");'>
</td>
</tr>
<tr>
<td align=center id=bg1>거래등록</td>
<td colspan=10>
 종료: <input type=text style=color:white;background-color:black; size=2 maxlength=2 name=term value=12>턴 후
 물품: 쌀
 판매량: <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=topv value=2000>
<input type=<?=$btn?> name=btn value='판매' onclick='return confirm("정말 판매하시겠습니까?");'>
</td>
</tr>
<tr>
<td colspan=11>
ㆍ<font color=cyan>Hint</font>) 거래자가 판매(물품 판매, 금 수령), 입찰자가 구매(물품 구입, 금 지불).<br>
ㆍ<font color=cyan>Hint</font>) 단가가 1.00보다 높을수록 판매자 유리.<br>
ㆍ<font color=cyan>Hint</font>) 단가가 1.00보다 낮을수록 입찰자 유리.<br>
</td>
</tr>
</form>
</table>
<br>
<table align=center width=1000 class='tb_layout bg0'>
<form method=post action=c_auction.php>
<tr><td colspan=11 align=center bgcolor=skyblue><font size=5>삽 니 다</font></td></tr>
<tr align=center id=bg1>
<td width=68>거래번호</td>
<td width=48>선택</td>
<td width=98>구매자</td>
<td width=118>물품</td>
<td width=88>수량</td>
<td width=88>시작구매가</td>
<td width=88>현재구매</td>
<td width=88>즉시구매가</td>
<td width=48>단가</td>
<td width=98>판매 예정자</td>
<td width=148>거래종료</td>
</tr>
<?php
$chk = 0;
foreach($db->query('SELECT * from auction where type=1 order by expire') as $auction){
$radio = "";
$alert = "";
$alert2 = "";
if ($auction['no1'] == $me['no']) {
$radio = " disabled";
} elseif ($auction['no2'] > 0 && $auction['amount'] >= $auction['value'] * 2) {
$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 = substr((string)$pv, 0, 4);
echo "
}
?>
<tr height=25>
<td align=center class='bg1'>등록결과</td>
<td colspan=10><?= ConvertLog($msg) ?></td>
</tr>
<tr>
<td align=center class='bg1'>입찰등록</td>
<td colspan=10>
 지불할 금액: <input type=text style=color:white;background-color:black; size=6 maxlength=6 name=value>
<input type=<?= $btn ?> name=btn value='구매시도' onclick='return confirm("정말 입찰하시겠습니까?");'>
</td>
</tr>
<tr>
<td align=center class='bg1'>거래등록</td>
<td colspan=10>
 종료: <input type=text style=color:white;background-color:black; size=2 maxlength=2 name=term value=12>턴 후
 물품: 쌀
 판매량: <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=topv value=2000>
<input type=<?= $btn ?> name=btn value='판매' onclick='return confirm("정말 판매하시겠습니까?");'>
</td>
</tr>
<tr>
<td colspan=11>
ㆍ<font color=cyan>Hint</font>) 거래자가 판매(물품 판매, 금 수령), 입찰자가 구매(물품 구입, 금 지불).<br>
ㆍ<font color=cyan>Hint</font>) 단가가 1.00보다 높을수록 판매자 유리.<br>
ㆍ<font color=cyan>Hint</font>) 단가가 1.00보다 낮을수록 입찰자 유리.<br>
</td>
</tr>
</form>
</table>
<br>
<table align=center width=1000 class='tb_layout bg0'>
<form method=post action=c_auction.php>
<tr>
<td colspan=11 align=center bgcolor=skyblue>
<font size=5>삽 니 다</font>
</td>
</tr>
<tr align=center class='bg1'>
<td width=68>거래번호</td>
<td width=48>선택</td>
<td width=98>구매</td>
<td width=118>물품</td>
<td width=88>수량</td>
<td width=88>시작구매가</td>
<td width=88>현재구매가</td>
<td width=88>즉시구매가</td>
<td width=48>단가</td>
<td width=98>판매 예정자</td>
<td width=148>거래종료</td>
</tr>
<?php
$chk = 0;
foreach ($db->query('SELECT * from auction where type=1 order by expire') as $auction) {
$radio = "";
$alert = "";
$alert2 = "";
if ($auction['no1'] == $me['no']) {
$radio = " disabled";
} elseif ($auction['no2'] > 0 && $auction['amount'] >= $auction['value'] * 2) {
$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 = substr((string)$pv, 0, 4);
echo "
<tr align=center>
<td>{$auction['no']}</td>
<td><input type=radio name=sel value={$auction['no']}{$radio}></td>
@@ -202,73 +217,90 @@ foreach($db->query('SELECT * from auction where type=1 order by expire') as $auc
<td>{$auction['expire']}</td>
</tr>
";
}
?>
<tr height=25>
<td align=center id=bg1>등록결과</td>
<td colspan=10><?=ConvertLog($msg2)?></td>
</tr>
<tr>
<td align=center id=bg1>입찰등록</td>
<td colspan=10>
 수령할 금액: <input type=text style=color:white;background-color:black; size=6 maxlength=6 name=value>
<input type=<?=$btn?> name=btn value='판매시도' onclick='return confirm("정말 입찰하시겠습니까?");'>
</td>
</tr>
<tr>
<td align=center id=bg1>거래등록</td>
<td colspan=10>
 종료: <input type=text style=color:white;background-color:black; size=2 maxlength=2 name=term value=12>턴 후
 물품: 쌀
 구입량: <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=topv value=500>
<input type=<?=$btn?> name=btn value='구매' onclick='return confirm("정말 구매하시겠습니까?");'>
</td>
</tr>
<tr>
<td colspan=11>
ㆍ<font color=cyan>Hint</font>) 거래자가 구매(물품 구매, 금 지불), 입찰자가 판매(물품 판매, 금 수령).<br>
ㆍ<font color=cyan>Hint</font>) 단가가 1.00보다 낮을수록 구매자 유리.<br>
ㆍ<font color=cyan>Hint</font>) 단가가 1.00보다 높을수록 입찰자 유리.<br>
</td>
</tr>
</form>
</table>
<br>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td align=center id=bg2><font size=5>최 근 기 록</font></td></tr>
<tr><td>
<?=getAuctionLogRecent(20)?>
</td></tr>
<tr><td align=center id=bg2><font size=5>도 움 말</font></td></tr>
<tr><td>
<font color=white size=2>
ㆍ판매거래는 거래자가 판매할 물품을 거래하면, 구입을 희망하는 사람이 현재가보다 높게 입찰하여 구입하는 방식입니다.<br>
ㆍ<font color=cyan>Hint</font>) 쌀이 귀한 경우는 입찰자가 많아서 자연스레 단가가 오르게 됩니다. (해당 물품을 사려는 가격이 오름)<br>
ㆍ<font color=cyan>Hint</font>) 쌀이 흔한 경우는 초기 가격을 낮게 책정해야 판매가 가능할 겁니다.<br>
ㆍ구매거래는 거래자가 구입할 물품을 거래하면, 판매를 희망하는 사람이 현재가보다 낮게 입찰하여 판매하는 방식입니다.<br>
ㆍ<font color=cyan>Hint</font>) 쌀이 흔한 경우는 입찰자가 많아서 자연스레 단가가 내리게 됩니다. (해당 물품을 팔려는 가격이 내림)<br>
ㆍ<font color=cyan>Hint</font>) 쌀이 귀한 경우는 초기 가격을 높게 책정해야 구입이 가능할 겁니다.<br>
ㆍ마감임박때 입찰하는 경우 입찰후 1턴 후로 종료시간이 연장됩니다.<br>
ㆍ즉시구매가로 입찰하는 경우 입찰후 1턴 후로 종료시간이 결정됩니다.<br>
ㆍ악용 방지를 위해 50% ~ 200%의 가격에서 거래시작이 가능합니다.<br>
ㆍ악용 방지를 위해 즉시판매가는 110% 이상, 즉시구매가는 90% 이하의 시세로 가능합니다.<br>
ㆍ악용 방지를 위해 즉시판매가는 시작판매가의 110% 이상, 즉시구매가는 시작구매가의 90% 이하로 가능합니다.<br>
ㆍ1인당 도합 1건의 거래와 입찰이 가능합니다.<br>
ㆍ기본금쌀 1000은 거래에 사용되지 못합니다.<br>
ㆍ유찰될 때는 거래 과실자에게 거래금의 1%가 벌금으로 부과됩니다.<br>
ㆍ<font color=magenta>10단위로 거래가 가능합니다. 1자리는 반올림 처리 됩니다.</font><br>
ㆍ<font color=red>★ 최고가 거래 ★</font> 혹은 <font color=red>★ 최저가 거래 ★</font> 는 암거래 및 악용의 가능성이니 감시 부탁드립니다.<br>
ㆍ거래와 입찰은 취소가 불가능하니 주의하세요!<br>
ㆍ<font color=cyan>Hint</font>) 단가는 금/쌀로 쌀1을 거래하기 위한 금의 양입니다.<br>
ㆍ<font color=cyan>Hint</font>) 단가가 높으면(>1.00) 쌀이 비싸므로 판매가 이득입니다.<br>
ㆍ<font color=cyan>Hint</font>) 단가가 낮으면(<1.00) 금이 비싸므로 구매가 이득입니다.<br>
ㆍ즐거운 거래!
</font>
</td></tr>
<tr><td><?=closeButton()?></td></tr>
<tr><td><?=banner()?> </td></tr>
</table>
}
?>
<tr height=25>
<td align=center class='bg1'>등록결과</td>
<td colspan=10><?= ConvertLog($msg2) ?></td>
</tr>
<tr>
<td align=center class='bg1'>입찰등록</td>
<td colspan=10>
 수령할 금액: <input type=text style=color:white;background-color:black; size=6 maxlength=6 name=value>
<input type=<?= $btn ?> name=btn value='판매시도' onclick='return confirm("정말 입찰하시겠습니까?");'>
</td>
</tr>
<tr>
<td align=center class='bg1'>거래등록</td>
<td colspan=10>
 종료: <input type=text style=color:white;background-color:black; size=2 maxlength=2 name=term value=12>턴 후
 물품: 쌀
 구입량: <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=topv value=500>
<input type=<?= $btn ?> name=btn value='구매' onclick='return confirm("정말 구매하시겠습니까?");'>
</td>
</tr>
<tr>
<td colspan=11>
ㆍ<font color=cyan>Hint</font>) 거래자가 구매(물품 구매, 금 지불), 입찰자가 판매(물품 판매, 금 수령).<br>
ㆍ<font color=cyan>Hint</font>) 단가가 1.00보다 낮을수록 구매자 유리.<br>
ㆍ<font color=cyan>Hint</font>) 단가가 1.00보다 높을수록 입찰자 유리.<br>
</td>
</tr>
</form>
</table>
<br>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td align=center class='bg2'>
<font size=5>최 근 기 록</font>
</td>
</tr>
<tr>
<td>
<?= getAuctionLogRecent(20) ?>
</td>
</tr>
<tr>
<td align=center class='bg2'>
<font size=5>도 움 말</font>
</td>
</tr>
<tr>
<td>
<font color=white size=2>
ㆍ판매거래는 거래자가 판매할 물품을 거래하면, 구입을 희망하는 사람이 현재가보다 높게 입찰하여 구입하는 방식입니다.<br>
ㆍ<font color=cyan>Hint</font>) 쌀이 귀한 경우는 입찰자가 많아서 자연스레 단가가 오르게 됩니다. (해당 물품을 사려는 가격이 오름)<br>
ㆍ<font color=cyan>Hint</font>) 쌀이 흔한 경우는 초기 가격을 낮게 책정해야 판매가 가능할 겁니다.<br>
ㆍ구매거래는 거래자가 구입할 물품을 거래하면, 판매를 희망하는 사람이 현재가보다 낮게 입찰하여 판매하는 방식입니다.<br>
ㆍ<font color=cyan>Hint</font>) 쌀이 흔한 경우는 입찰자가 많아서 자연스레 단가가 내리게 됩니다. (해당 물품을 팔려는 가격이 내림)<br>
ㆍ<font color=cyan>Hint</font>) 쌀이 귀한 경우는 초기 가격을 높게 책정해야 구입이 가능할 겁니다.<br>
ㆍ마감임박때 입찰하는 경우 입찰후 1턴 후로 종료시간이 연장됩니다.<br>
ㆍ즉시구매가로 입찰하는 경우 입찰후 1턴 후로 종료시간이 결정됩니다.<br>
ㆍ악용 방지를 위해 50% ~ 200%의 가격에서 거래시작이 가능합니다.<br>
ㆍ악용 방지를 위해 즉시판매가는 110% 이상, 즉시구매가는 90% 이하의 시세로 가능합니다.<br>
ㆍ악용 방지를 위해 즉시판매가는 시작판매가의 110% 이상, 즉시구매가는 시작구매가의 90% 이하로 가능합니다.<br>
ㆍ1인당 도합 1건의 거래와 입찰이 가능합니다.<br>
ㆍ기본금쌀 1000은 거래에 사용되지 못합니다.<br>
ㆍ유찰될 때는 거래 과실자에게 거래금의 1%가 벌금으로 부과됩니다.<br>
ㆍ<font color=magenta>10단위로 거래가 가능합니다. 1자리는 반올림 처리 됩니다.</font><br>
ㆍ<font color=red>★ 최고가 거래 ★</font> 혹은 <font color=red>★ 최저가 거래 ★</font> 는 암거래 및 악용의 가능성이니 감시 부탁드립니다.<br>
ㆍ거래와 입찰은 취소가 불가능하니 주의하세요!<br>
ㆍ<font color=cyan>Hint</font>) 단가는 금/쌀로 쌀1을 거래하기 위한 금의 양입니다.<br>
ㆍ<font color=cyan>Hint</font>) 단가가 높으면(>1.00) 쌀이 비싸므로 판매가 이득입니다.<br>
ㆍ<font color=cyan>Hint</font>) 단가가 낮으면(<1.00) 금이 비싸므로 구매가 이득입니다.<br>
ㆍ즐거운 거래!
</font>
</td>
</tr>
<tr>
<td><?= closeButton() ?></td>
</tr>
<tr>
<td><?= banner() ?> </td>
</tr>
</table>
</body>
</html>
</html>
+125 -106
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -6,7 +7,7 @@ include "func.php";
$v = new Validator($_POST + $_GET);
$v->rule('required', 'gen')
->rule('integer', 'gen');
->rule('integer', 'gen');
$btn = Util::getReq('btn');
$gen = Util::getReq('gen', 'int', 0);
@@ -14,24 +15,24 @@ $reqQueryType = Util::getReq('query_type', 'string', null);
// $queryTypeText, $reqArgType(0=>None, 1=>AdditionalColumn, 2=>rankVal, 3=>aux), $comp
$queryMap = [
'turntime' => ['최근턴', 0, function($lhs, $rhs){
return -($lhs['turntime']<=>$rhs['turntime']);
'turntime' => ['최근턴', 0, function ($lhs, $rhs) {
return - ($lhs['turntime'] <=> $rhs['turntime']);
}],
'recent_war' => ['최근전투', 1, function($lhs, $rhs){
return -($lhs['recent_war']<=>$rhs['recent_war']);
'recent_war' => ['최근전투', 1, function ($lhs, $rhs) {
return - ($lhs['recent_war'] <=> $rhs['recent_war']);
}],
'name' => ['장수명', 0, function($lhs, $rhs){
if($lhs['npc'] !== $rhs['npc']){
return $lhs['npc']<=>$rhs['npc'];
'name' => ['장수명', 0, function ($lhs, $rhs) {
if ($lhs['npc'] !== $rhs['npc']) {
return $lhs['npc'] <=> $rhs['npc'];
}
return $lhs['name']<=>$rhs['name'];
return $lhs['name'] <=> $rhs['name'];
}],
'warnum' => ['전투수', 2, function($lhs, $rhs){
return -($lhs['warnum']<=>$rhs['warnum']);
'warnum' => ['전투수', 2, function ($lhs, $rhs) {
return - ($lhs['warnum'] <=> $rhs['warnum']);
}]
];
if($reqQueryType === null || !key_exists($reqQueryType, $queryMap)){
if ($reqQueryType === null || !key_exists($reqQueryType, $queryMap)) {
$reqQueryType = Util::array_first_key($queryMap);
}
@@ -60,11 +61,10 @@ if ($con >= 2) {
}
$permission = checkSecretPermission($me);
if($permission < 0){
if ($permission < 0) {
echo '국가에 소속되어있지 않습니다.';
die();
}
else if ($permission < 1) {
} else if ($permission < 1) {
echo "권한이 부족합니다. 수뇌부가 아니거나 사관년도가 부족합니다.";
die();
}
@@ -80,34 +80,33 @@ if ($btn == '정렬하기') {
[$queryTypeText, $reqArgType, $comp] = $queryMap[$reqQueryType];
if($reqArgType===0){
if ($reqArgType === 0) {
$generalBasicList = $db->query('SELECT no, name, npc, turntime, officer_level FROM general WHERE nation = %i', $nationID);
}
else if($reqArgType===1){
} else if ($reqArgType === 1) {
$generalBasicList = $db->query('SELECT no, name, npc, turntime, officer_level, %b FROM general WHERE nation = %i', $reqQueryType, $nationID);
}
else if($reqArgType===2){
$generalBasicList = $db->query('SELECT no, name, npc, turntime, officer_level, value as %b
FROM general LEFT JOIN rank_data
ON general.no = rank_data.general_id
WHERE rank_data.type = %s AND general.nation = %i',
$reqQueryType, $reqQueryType, $nationID
} else if ($reqArgType === 2) {
$generalBasicList = $db->query(
'SELECT no, name, npc, turntime, officer_level, value as %b
FROM general LEFT JOIN rank_data
ON general.no = rank_data.general_id
WHERE rank_data.type = %s AND general.nation = %i',
$reqQueryType,
$reqQueryType,
$nationID
);
}
else if($reqArgType===3){
$generalBasicList = array_map(function($arr){
} else if ($reqArgType === 3) {
$generalBasicList = array_map(function ($arr) {
$arr['aux'] = Json::decode($arr['aux']);
return $arr;
}, $db->query('SELECT no, name, npc, turntime, officer_level, aux FROM general WHERE nation = %i', $nationID));
}
else{
} else {
throw new \sammo\MustNotBeReachedException();
}
usort($generalBasicList, $comp);
if(!$gen){
if (!$gen) {
$gen = $generalBasicList[0]['no'];
}
$showGeneral = General::createGeneralObjFromDB($gen);
@@ -116,83 +115,103 @@ $showGeneral = General::createGeneralObjFromDB($gen);
<html>
<head>
<title><?=UniqueConst::$serverName?>: 감찰부</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('js/common.js')?>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<title><?= UniqueConst::$serverName ?>: 감찰부</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printDist('ts', ['common']) ?>
</head>
<body>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td>감 찰 부<br><?=closeButton()?></td></tr>
<tr><td>
<form name=form1 method=post>
정렬순서 :
<select name='query_type' size=1>
<?php foreach($queryMap as $queryType => [$queryTypeText,]): ?>
<option <?=$queryType==$reqQueryType?'selected':''?> value='<?=$queryType?>'><?=$queryTypeText?></option>
<?php endforeach; ?>
</select>
<input type=submit name=btn value='정렬하기'>
대상장수 :
<select name=gen size=1>
<?php foreach($generalBasicList as $general): ?>
<option <?=$gen==$general['no']?'selected':''?> value='<?=$general['no']?>'><?=$general['officer_level']>4?"*{$general['name']}*":$general['name']?> (<?=substr($general['turntime'], 14, 5)?>)</option>
<?php endforeach; ?>
</select>
<input type=submit name=btn value='조회하기'>
</form>
</td></tr>
</table>
<table width=1000 align=center class='tb_layout bg0'>
<tr>
<td width=50% align=center id=bg1><font color=skyblue size=3>장 수 정 보</font></td>
<td width=50% align=center id=bg1><font color=orange size=3>장 수 열 전</font></td>
</tr>
<tr>
<td valign=top>
<?php generalInfo($showGeneral); generalInfo2($showGeneral); ?>
</td>
<td valign=top>
<?=formatHistoryToHTML(getGeneralHistoryLogAll($gen))?>
</td>
</tr>
<tr>
<td align=center id=bg1><font color=orange size=3>전투 기록</font></td>
<td align=center id=bg1><font color=orange size=3>전투 결과</font></td>
</tr>
<tr>
<td valign=top>
<?=formatHistoryToHTML(getBattleDetailLogRecent($gen, 24))?>
</td>
<td valign=top>
<?=formatHistoryToHTML(getBattleResultRecent($gen, 24))?>
</td>
</tr>
<?php if($showGeneral->getNPCType() > 1 || $permission >= 2): ?>
<tr>
<td align=center id=bg1><font color=orange size=3>개인 기록</font></td>
<td align=center id=bg1><font color=orange size=3>&nbsp;</font></td>
</tr>
<tr>
<td valign=top>
<?=formatHistoryToHTML(getGeneralActionLogRecent($gen, 24))?>
</td>
<td valign=top>
</td>
</tr>
<?php endif; ?>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td><?=closeButton()?></td></tr>
<tr><td><?=banner()?> </td></tr>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td>감 찰 부<br><?= closeButton() ?></td>
</tr>
<tr>
<td>
<form name=form1 method=post>
정렬순서 :
<select name='query_type' size=1>
<?php foreach ($queryMap as $queryType => [$queryTypeText,]) : ?>
<option <?= $queryType == $reqQueryType ? 'selected' : '' ?> value='<?= $queryType ?>'><?= $queryTypeText ?></option>
<?php endforeach; ?>
</select>
<input type=submit name=btn value='정렬하기'>
대상장수 :
<select name=gen size=1>
<?php foreach ($generalBasicList as $general) : ?>
<option <?= $gen == $general['no'] ? 'selected' : '' ?> value='<?= $general['no'] ?>'><?= $general['officer_level'] > 4 ? "*{$general['name']}*" : $general['name'] ?> (<?= substr($general['turntime'], 14, 5) ?>)</option>
<?php endforeach; ?>
</select>
<input type=submit name=btn value='조회하기'>
</form>
</td>
</tr>
</table>
<table width=1000 align=center class='tb_layout bg0'>
<tr>
<td width=50% align=center class='bg1'>
<font color=skyblue size=3>장 수 정 보</font>
</td>
<td width=50% align=center class='bg1'>
<font color=orange size=3>장 수 열 전</font>
</td>
</tr>
<tr>
<td valign=top>
<?php generalInfo($showGeneral);
generalInfo2($showGeneral); ?>
</td>
<td valign=top>
<?= formatHistoryToHTML(getGeneralHistoryLogAll($gen)) ?>
</td>
</tr>
<tr>
<td align=center class='bg1'>
<font color=orange size=3>전투 기록</font>
</td>
<td align=center class='bg1'>
<font color=orange size=3>전투 결과</font>
</td>
</tr>
<tr>
<td valign=top>
<?= formatHistoryToHTML(getBattleDetailLogRecent($gen, 24)) ?>
</td>
<td valign=top>
<?= formatHistoryToHTML(getBattleResultRecent($gen, 24)) ?>
</td>
</tr>
<?php if ($showGeneral->getNPCType() > 1 || $permission >= 2) : ?>
<tr>
<td align=center class='bg1'>
<font color=orange size=3>개인 기록</font>
</td>
<td align=center class='bg1'>
<font color=orange size=3>&nbsp;</font>
</td>
</tr>
<tr>
<td valign=top>
<?= formatHistoryToHTML(getGeneralActionLogRecent($gen, 24)) ?>
</td>
<td valign=top>
</td>
</tr>
<?php endif; ?>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td><?= closeButton() ?></td>
</tr>
<tr>
<td><?= banner() ?> </td>
</tr>
</table>
</body>
</html>
</html>
+480 -380
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -26,7 +27,7 @@ $me = $db->queryFirstRow('SELECT no,tournament,con,turntime from general where o
$myBetTotal = array_sum($myBet);
$globalBetTotal = array_sum($globalBet);
$admin = $gameStor->getValues(['tournament','phase','tnmt_type','develcost']);
$admin = $gameStor->getValues(['tournament', 'phase', 'tnmt_type', 'develcost']);
$con = checkLimit($me['con']);
if ($con >= 2) {
@@ -35,21 +36,42 @@ if ($con >= 2) {
}
switch ($admin['tnmt_type']) {
default: throw new \RuntimeException('Invalid tnmt_type');
case 0: $tnmt_type = "<font color=cyan>전력전</font>"; $tp = "total"; $tp2 = "종합"; $tp3 = "total"; break;
case 1: $tnmt_type = "<font color=cyan>통솔전</font>"; $tp = "leadership"; $tp2 = "통솔"; $tp3 = "leadership"; break;
case 2: $tnmt_type = "<font color=cyan>일기토</font>"; $tp = "strength"; $tp2 = "무력"; $tp3 = "strength"; break;
case 3: $tnmt_type = "<font color=cyan>설전</font>"; $tp = "intel"; $tp2 = "지력"; $tp3 = "intel"; break;
default:
throw new \RuntimeException('Invalid tnmt_type');
case 0:
$tnmt_type = "<font color=cyan>전력전</font>";
$tp = "total";
$tp2 = "종합";
$tp3 = "total";
break;
case 1:
$tnmt_type = "<font color=cyan>통솔전</font>";
$tp = "leadership";
$tp2 = "통솔";
$tp3 = "leadership";
break;
case 2:
$tnmt_type = "<font color=cyan>일기토</font>";
$tp = "strength";
$tp2 = "무력";
$tp3 = "strength";
break;
case 3:
$tnmt_type = "<font color=cyan>설전</font>";
$tp = "intel";
$tp2 = "지력";
$tp3 = "intel";
break;
}
$str1 = getTournament($admin['tournament']);
$str2 = getTournamentTime();
if($str2){
$str2 = ', '.$str2;
if ($str2) {
$str2 = ', ' . $str2;
}
$str3 = getTournamentTerm();
if($str3){
$str3 = ', '.$str3;
if ($str3) {
$str3 = ', ' . $str3;
}
?>
@@ -58,306 +80,346 @@ if($str3){
<?php if ($con == 1) {
MessageBox("접속제한이 얼마 남지 않았습니다!");
} ?>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?=UniqueConst::$serverName?>: 베팅장</title>
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('js/common.js')?>
<?=WebUtil::printJS('js/betting.js')?>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?= UniqueConst::$serverName ?>: 베팅장</title>
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printDist('ts', ['common', 'betting']) ?>
</head>
<body>
<table align=center width=1120 class='tb_layout bg0'>
<tr><td>베 팅 장<br><?=closeButton()?></td></tr>
</table>
<table align=center width=1120 class='tb_layout bg0'>
<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 height=50 colspan=16 align=center id=bg2><font color=limegreen size=6>16강 상황</font><br><font color=orange size=3>(전체 금액 : <?=$globalBetTotal?> / 내 투자 금액 : <?=$myBetTotal?>)</font></td></tr>
</table>
<table align=center width=1120 class='mimic_flex bg0' style='border:solid 1px gray;font-size:10px;'>
<tr align=center><td height=10 colspan=16></td></tr>
<tr align=center>
<?php
$generalList = $db->query('SELECT npc,name,win from tournament where grp>=60 order by grp, grp_no LIMIT 1');
while(count($generalList) < 1){
$generalList[] = [
'name'=>'-',
'npc'=>0,
'win'=>0
];
}
foreach($generalList as $i=>$general){
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>";
}
<table align=center width=1120 class='tb_layout bg0'>
<tr>
<td>베 팅 장<br><?= closeButton() ?></td>
</tr>
</table>
<table align=center width=1120 class='tb_layout bg0'>
<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 height=50 colspan=16 align=center class='bg2'>
<font color=limegreen size=6>16강 상황</font><br>
<font color=orange size=3>(전체 금액 : <?= $globalBetTotal ?> / 내 투자 금액 : <?= $myBetTotal ?>)</font>
</td>
</tr>
</table>
<table align=center width=1120 class='mimic_flex bg0' style='border:solid 1px gray;font-size:10px;'>
<tr align=center>
<td height=10 colspan=16></td>
</tr>
<tr align=center>
<?php
$generalList = $db->query('SELECT npc,name,win from tournament where grp>=60 order by grp, grp_no LIMIT 1');
while (count($generalList) < 1) {
$generalList[] = [
'name' => '-',
'npc' => 0,
'win' => 0
];
}
foreach ($generalList as $i => $general) {
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 "
echo "
</tr>
<tr align=center>";
$cent = [];
$line = [];
$gen = [];
for ($i=0; $i < 1; $i++) {
$cent[$i] = "<font color=white>";
}
$generalList = $db->query('SELECT npc,name,win from tournament where grp>=50 order by grp, grp_no LIMIT 2');
while(count($generalList) < 2){
$generalList[] = [
'name'=>'-',
'npc'=>0,
'win'=>0
];
}
foreach($generalList as $i=>$general){
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'];
}
for ($i=0; $i < 1; $i++) {
$cent[$i] = $cent[$i]."┻"."</font>";
$line[$i*2] = $line[$i*2]."┏━━━━━━━━━━━━━━━━━━━━━━━━━━━"."</font>";
$line[$i*2+1] = $line[$i*2+1]."━━━━━━━━━━━━━━━━━━━━━━━━━━━┓"."</font>";
echo "<td colspan=16>{$line[$i*2]}{$cent[$i]}{$line[$i*2+1]}</td>";
}
echo "
$cent = [];
$line = [];
$gen = [];
for ($i = 0; $i < 1; $i++) {
$cent[$i] = "<font color=white>";
}
$generalList = $db->query('SELECT npc,name,win from tournament where grp>=50 order by grp, grp_no LIMIT 2');
while (count($generalList) < 2) {
$generalList[] = [
'name' => '-',
'npc' => 0,
'win' => 0
];
}
foreach ($generalList as $i => $general) {
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'];
}
for ($i = 0; $i < 1; $i++) {
$cent[$i] = $cent[$i] . "┻" . "</font>";
$line[$i * 2] = $line[$i * 2] . "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━" . "</font>";
$line[$i * 2 + 1] = $line[$i * 2 + 1] . "━━━━━━━━━━━━━━━━━━━━━━━━━━━┓" . "</font>";
echo "<td colspan=16>{$line[$i * 2]}{$cent[$i]}{$line[$i * 2 + 1]}</td>";
}
echo "
</tr>
<tr align=center>";
for ($i=0; $i < 2; $i++) {
echo "<td colspan=8>{$gen[$i]}</td>";
}
for ($i = 0; $i < 2; $i++) {
echo "<td colspan=8>{$gen[$i]}</td>";
}
echo "
echo "
</tr>
<tr align=center>";
for ($i=0; $i < 2; $i++) {
$cent[$i] = "<font color=white>";
}
$generalList = $db->query('SELECT npc,name,win from tournament where grp>=40 order by grp, grp_no LIMIT 4');
while(count($generalList) < 4){
$generalList[] = [
'name'=>'-',
'npc'=>0,
'win'=>0
];
}
foreach($generalList as $i=>$general){
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'];
}
for ($i=0; $i < 2; $i++) {
$cent[$i] = $cent[$i]."┻"."</font>";
$line[$i*2] = $line[$i*2]."┏━━━━━━━━━━━━━"."</font>";
$line[$i*2+1] = $line[$i*2+1]."━━━━━━━━━━━━━┓"."</font>";
echo "<td colspan=8>{$line[$i*2]}{$cent[$i]}{$line[$i*2+1]}</td>";
}
echo "
for ($i = 0; $i < 2; $i++) {
$cent[$i] = "<font color=white>";
}
$generalList = $db->query('SELECT npc,name,win from tournament where grp>=40 order by grp, grp_no LIMIT 4');
while (count($generalList) < 4) {
$generalList[] = [
'name' => '-',
'npc' => 0,
'win' => 0
];
}
foreach ($generalList as $i => $general) {
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'];
}
for ($i = 0; $i < 2; $i++) {
$cent[$i] = $cent[$i] . "┻" . "</font>";
$line[$i * 2] = $line[$i * 2] . "┏━━━━━━━━━━━━━" . "</font>";
$line[$i * 2 + 1] = $line[$i * 2 + 1] . "━━━━━━━━━━━━━┓" . "</font>";
echo "<td colspan=8>{$line[$i * 2]}{$cent[$i]}{$line[$i * 2 + 1]}</td>";
}
echo "
</tr>
<tr align=center>";
for ($i=0; $i < 4; $i++) {
echo "<td colspan=4>{$gen[$i]}</td>";
}
for ($i = 0; $i < 4; $i++) {
echo "<td colspan=4>{$gen[$i]}</td>";
}
echo "
echo "
</tr>
<tr align=center>";
for ($i=0; $i < 4; $i++) {
$cent[$i] = "<font color=white>";
}
$generalList = $db->query('SELECT npc,name,win from tournament where grp>=30 order by grp, grp_no LIMIT 8');
while(count($generalList) < 8){
$generalList[] = [
'name'=>'-',
'npc'=>0,
'win'=>0
];
}
foreach($generalList as $i=>$general){
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'];
}
for ($i=0; $i < 4; $i++) {
$cent[$i] = $cent[$i]."┻"."</font>";
$line[$i*2] = $line[$i*2]."┏━━━━━━"."</font>";
$line[$i*2+1] = $line[$i*2+1]."━━━━━━┓"."</font>";
echo "<td colspan=4>{$line[$i*2]}{$cent[$i]}{$line[$i*2+1]}</td>";
}
echo "
for ($i = 0; $i < 4; $i++) {
$cent[$i] = "<font color=white>";
}
$generalList = $db->query('SELECT npc,name,win from tournament where grp>=30 order by grp, grp_no LIMIT 8');
while (count($generalList) < 8) {
$generalList[] = [
'name' => '-',
'npc' => 0,
'win' => 0
];
}
foreach ($generalList as $i => $general) {
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'];
}
for ($i = 0; $i < 4; $i++) {
$cent[$i] = $cent[$i] . "┻" . "</font>";
$line[$i * 2] = $line[$i * 2] . "┏━━━━━━" . "</font>";
$line[$i * 2 + 1] = $line[$i * 2 + 1] . "━━━━━━┓" . "</font>";
echo "<td colspan=4>{$line[$i * 2]}{$cent[$i]}{$line[$i * 2 + 1]}</td>";
}
echo "
</tr>
<tr align=center>";
for ($i=0; $i < 8; $i++) {
echo "<td colspan=2>{$gen[$i]}</td>";
}
for ($i = 0; $i < 8; $i++) {
echo "<td colspan=2>{$gen[$i]}</td>";
}
echo "
echo "
</tr>
<tr align=center>";
for ($i=0; $i < 8; $i++) {
$cent[$i] = "<font color=white>";
}
$generalList = $db->query('SELECT npc,name,win from tournament where grp>=20 order by grp, grp_no LIMIT 16');
while(count($generalList) < 16){
$generalList[] = [
'name'=>'-',
'npc'=>0,
'win'=>0
];
}
foreach($generalList as $i=>$general){
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'];
}
for ($i=0; $i < 8; $i++) {
$cent[$i] = $cent[$i]."┻"."</font>";
$line[$i*2] = $line[$i*2]."┏━━"."</font>";
$line[$i*2+1] = $line[$i*2+1]."━━┓"."</font>";
echo "<td colspan=2>{$line[$i*2]}{$cent[$i]}{$line[$i*2+1]}</td>";
}
echo "
for ($i = 0; $i < 8; $i++) {
$cent[$i] = "<font color=white>";
}
$generalList = $db->query('SELECT npc,name,win from tournament where grp>=20 order by grp, grp_no LIMIT 16');
while (count($generalList) < 16) {
$generalList[] = [
'name' => '-',
'npc' => 0,
'win' => 0
];
}
foreach ($generalList as $i => $general) {
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'];
}
for ($i = 0; $i < 8; $i++) {
$cent[$i] = $cent[$i] . "┻" . "</font>";
$line[$i * 2] = $line[$i * 2] . "┏━━" . "</font>";
$line[$i * 2 + 1] = $line[$i * 2 + 1] . "━━┓" . "</font>";
echo "<td colspan=2>{$line[$i * 2]}{$cent[$i]}{$line[$i * 2 + 1]}</td>";
}
echo "
</tr>
<tr align=center>";
for ($i=0; $i < 16; $i++) {
echo "<td width=70>{$gen[$i]}</td>";
}
for ($i = 0; $i < 16; $i++) {
echo "<td width=70>{$gen[$i]}</td>";
}
$bet = [];
$gold = [];
$bet = [];
$gold = [];
for ($i=0; $i < 16; $i++) {
if($globalBet[$i] == 0){
$bet[$i] = "∞";
}
else{
$bet[$i] = round($globalBetTotal / $globalBet[$i], 2);
}
}
for ($i = 0; $i < 16; $i++) {
if ($globalBet[$i] == 0) {
$bet[$i] = "∞";
} else {
$bet[$i] = round($globalBetTotal / $globalBet[$i], 2);
}
}
for ($i=0; $i < 16; $i++) {
if(!is_numeric($bet[$i])){
$gold[$i] = 0;
}
else{
$gold[$i] = Util::round($myBet[$i] * $bet[$i]);
}
}
?>
</tr>
</table>
<table align=center width=1120 class='tb_layout bg0'>
<tr align=center><td height=10 colspan=16></td></tr>
<?php
echo "
for ($i = 0; $i < 16; $i++) {
if (!is_numeric($bet[$i])) {
$gold[$i] = 0;
} else {
$gold[$i] = Util::round($myBet[$i] * $bet[$i]);
}
}
?>
</tr>
</table>
<table align=center width=1120 class='tb_layout bg0'>
<tr align=center>
<td height=10 colspan=16></td>
</tr>
<?php
echo "
<tr align=center>";
for ($i=0; $i < 16; $i++) {
echo "<td width=70><font color=skyblue>{$bet[$i]}</font></td>";
}
?>
</tr>
<tr align=center>
<td>×</td><td>×</td><td>×</td><td>×</td><td>×</td><td>×</td><td>×</td><td>×</td>
<td>×</td><td>×</td><td>×</td><td>×</td><td>×</td><td>×</td><td>×</td><td>×</td>
</tr>
<tr align=center>
<?php
for ($i=0; $i < 16; $i++) {
echo "<td><font color=orange>{$myBet[$i]}</font></td>";
}
?>
</tr>
<tr align=center>
<td>∥</td><td>∥</td><td>∥</td><td>∥</td><td>∥</td><td>∥</td><td>∥</td><td>∥</td>
<td>∥</td><td>∥</td><td>∥</td><td>∥</td><td>∥</td><td>∥</td><td>∥</td><td>∥</td>
</tr>
<tr align=center>
<?php
for ($i=0; $i < 16; $i++) {
echo "<td><font color=cyan>{$gold[$i]}</font></td>";
}
for ($i = 0; $i < 16; $i++) {
echo "<td width=70><font color=skyblue>{$bet[$i]}</font></td>";
}
?>
</tr>
<tr align=center>
<td>×</td>
<td>×</td>
<td>×</td>
<td>×</td>
<td>×</td>
<td>×</td>
<td>×</td>
<td>×</td>
<td>×</td>
<td>×</td>
<td>×</td>
<td>×</td>
<td>×</td>
<td>×</td>
<td>×</td>
<td>×</td>
</tr>
<tr align=center>
<?php
for ($i = 0; $i < 16; $i++) {
echo "<td><font color=orange>{$myBet[$i]}</font></td>";
}
?>
</tr>
<tr align=center>
<td>∥</td>
<td>∥</td>
<td>∥</td>
<td>∥</td>
<td>∥</td>
<td>∥</td>
<td>∥</td>
<td>∥</td>
<td>∥</td>
<td>∥</td>
<td>∥</td>
<td>∥</td>
<td>∥</td>
<td>∥</td>
<td>∥</td>
<td>∥</td>
</tr>
<tr align=center>
<?php
for ($i = 0; $i < 16; $i++) {
echo "<td><font color=cyan>{$gold[$i]}</font></td>";
}
echo "
echo "
</tr>
<tr align=center><td height=10 colspan=16></td></tr>";
if ($admin['tournament'] == 6) {
echo "
if ($admin['tournament'] == 6) {
echo "
<tr align=center>";
for ($i=0; $i < 16; $i++) {
echo "
for ($i = 0; $i < 16; $i++) {
echo "
<td>
<select size=1 id='target_{$i}' style=color:white;background-color:black;>
<option style=color:white; value=10>금10</option>
@@ -369,127 +431,165 @@ if ($admin['tournament'] == 6) {
<option style=color:white; value=1000>최대</option>
</select>
</td>";
}
}
echo "
echo "
</tr>
<tr align=center>";
for ($i=0; $i < 16; $i++) {
echo "
for ($i = 0; $i < 16; $i++) {
echo "
<td><input type=button class='submitBtn' data-target='{$i}' value=베팅! style=width:100%;color:white;background-color:black;></td>";
}
}
echo "</tr>";
}
echo "</tr>";
}
?>
<tr align=center>
<td height=30 colspan=16>
<font color=skyblue size=4>배당률</font> × <font color=orange size=4>베팅금</font> = <font color=cyan size=4>적중시 환수금</font><br>
<font color=skyblue size=4>( 베팅후 500원 이하일땐 베팅이 불가능합니다. )</font>
</td>
</tr>
<tr align=center><td height=10 colspan=16></td></tr>
</table>
<table align=center width=1120 class='tb_layout bg0'>
<tr align=center><td height=50 colspan=4 id=bg2><font color=yellow size=6>토너먼트 랭킹</font></td></tr>
<tr align=center><td colspan=4 id=bg2><font color=skyblue size=3>순위 / 장수명 / 능력치 / 경기수 / 승리 / 무승부 / 패배 / 집계점수 / 우승횟수</font></td></tr>
<tr align=center>
<?php
?>
<tr align=center>
<td height=30 colspan=16>
<font color=skyblue size=4>배당률</font> × <font color=orange size=4>베팅금</font> = <font color=cyan size=4>적중시 환수금</font><br>
<font color=skyblue size=4>( 베팅후 500원 이하일땐 베팅이 불가능합니다. )</font>
</td>
</tr>
<tr align=center>
<td height=10 colspan=16></td>
</tr>
</table>
<table align=center width=1120 class='tb_layout bg0'>
<tr align=center>
<td height=50 colspan=4 class='bg2'>
<font color=yellow size=6>토너먼트 랭킹</font>
</td>
</tr>
<tr align=center>
<td colspan=4 class='bg2'>
<font color=skyblue size=3>순위 / 장수명 / 능력치 / 경기수 / 승리 / 무승부 / 패배 / 집계점수 / 우승횟수</font>
</td>
</tr>
<tr align=center>
<?php
$tournamentType = [
'전 력 전'=>[
'종합',
function(General $general){return $general->getVar('leadership')+$general->getVar('strength')+$general->getVar('intel');},
'tt',
],
'통 솔 전'=>[
'통솔',
function(General $general){return $general->getVar('leadership');},
'tl',
],
'일 기 토'=>[
'무력',
function(General $general){return $general->getVar('strength');},
'ts',
],
'설 전'=>[
'지력',
function(General $general){return $general->getVar('intel');},
'ti',
],
];
$tournamentType = [
'전 력 전' => [
'종합',
function (General $general) {
return $general->getVar('leadership') + $general->getVar('strength') + $general->getVar('intel');
},
'tt',
],
'통 솔 전' => [
'통솔',
function (General $general) {
return $general->getVar('leadership');
},
'tl',
],
'일 기 토' => [
'무력',
function (General $general) {
return $general->getVar('strength');
},
'ts',
],
'설 전' => [
'지력',
function (General $general) {
return $general->getVar('intel');
},
'ti',
],
];
$type1 = array("전 력 전", "통 솔 전", "일 기 토", "설 전");
$type2 = array("종합", "통솔", "무력", "지력");
$type3 = array("tt", "tl", "ts", "ti");
$type4 = array("total", "leadership", "strength", "intel");
$type1 = array("전 력 전", "통 솔 전", "일 기 토", "설 전");
$type2 = array("종합", "통솔", "무력", "지력");
$type3 = array("tt", "tl", "ts", "ti");
$type4 = array("total", "leadership", "strength", "intel");
foreach($tournamentType as $tournamentTypeText=>[$statTypeText,$statFunc,$rankColumn]): ?>
<td>
<table align=center width=280 class='tb_layout bg0'>
<tr><td colspan=9 align=center style=color:white;background-color:black;><font size=4><?=$tournamentTypeText?></font></td></tr>
<tr id=bg1><td align=center>순</td><td align=center>장수</td><td align=center><?=$statTypeText?></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>
<?php
$prizeColumn = "{$rankColumn}p";
$gameColumn = "{$rankColumn}g";
$winColumn = "{$rankColumn}w";
$drawColumn = "{$rankColumn}d";
$loseColumn = "{$rankColumn}l";
$tournamentRankerList = General::createGeneralObjListFromDB(
$db->queryFirstColumn('SELECT general_id FROM rank_data WHERE `type`= %s ORDER BY value DESC LIMIT 40', $gameColumn),
[$prizeColumn, $gameColumn, $winColumn, $drawColumn, $loseColumn,'leadership', 'strength', 'intel', 'no', 'npc', 'name'],
0
);
usort($tournamentRankerList, function(General $lhs, General $rhs) use($gameColumn, $winColumn, $drawColumn, $loseColumn){
$result = -($lhs->getRankVar($gameColumn) <=> $rhs->getRankVar($gameColumn));
if($result !== 0) return $result;
$result = -(
($lhs->getRankVar($winColumn)+$lhs->getRankVar($drawColumn)+$lhs->getRankVar($loseColumn))
<=>
($rhs->getRankVar($winColumn)+$rhs->getRankVar($drawColumn)+$rhs->getRankVar($loseColumn))
);
if($result !== 0) return $result;
$result = -($lhs->getRankVar($winColumn) <=> $rhs->getRankVar($winColumn));
if($result !== 0) return $result;
$result = -($lhs->getRankVar($drawColumn) <=> $rhs->getRankVar($drawColumn));
if($result !== 0) return $result;
return $lhs->getRankVar($loseColumn) <=> $rhs->getRankVar($loseColumn);
});
$tournamentRankerList = array_splice($tournamentRankerList, 0, 30);
foreach($tournamentRankerList as $rank=>$ranker){
printRow(
$rank,
$ranker->getNPCType(),
$ranker->getName(),
($statFunc)($ranker),
$ranker->getRankVar($winColumn)+$ranker->getRankVar($drawColumn)+$ranker->getRankVar($loseColumn),
$ranker->getRankVar($winColumn),
$ranker->getRankVar($drawColumn),
$ranker->getRankVar($loseColumn),
$ranker->getRankVar($gameColumn),
$ranker->getRankVar($prizeColumn),
0
);
}
?>
</table></td>
<?php endforeach; ?>
</tr>
<tr>
<td colspan=16>
ㆍ토너먼트의 16강 대진표가 완성되면, 베팅 기간이 주어집니다.<br>
ㆍ유저들의 베팅 상황에 따라 배당률이 실시간 결정되며, 자신의 베팅금에 따른 예상 환급금을 알 수 있습니다.<br>
ㆍ베팅은 16슬롯에 각각 베팅 가능하며, 도합 최대 금 1000씩 베팅 가능합니다.<br>
ㆍ소지금 500원 이하일땐 베팅이 불가능합니다.
ㆍ삼모와 더불어 토너먼트, 베팅기능으로 즐거운 삼모 되세요!<br>
</td>
</tr>
</table>
<table align=center width=1120 class='tb_layout bg0'>
<tr><td><?=closeButton()?></td></tr>
<tr><td><?=banner()?></td></tr>
</table>
foreach ($tournamentType as $tournamentTypeText => [$statTypeText, $statFunc, $rankColumn]) : ?>
<td>
<table align=center width=280 class='tb_layout bg0 f_tnum'>
<tr>
<td colspan=9 align=center style=color:white;background-color:black;>
<font size=4><?= $tournamentTypeText ?></font>
</td>
</tr>
<tr class='bg1'>
<td align=center>순</td>
<td align=center>장수</td>
<td align=center><?= $statTypeText ?></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>
<?php
$prizeColumn = "{$rankColumn}p";
$gameColumn = "{$rankColumn}g";
$winColumn = "{$rankColumn}w";
$drawColumn = "{$rankColumn}d";
$loseColumn = "{$rankColumn}l";
$tournamentRankerList = General::createGeneralObjListFromDB(
$db->queryFirstColumn('SELECT general_id FROM rank_data WHERE `type`= %s ORDER BY value DESC LIMIT 40', $gameColumn),
[$prizeColumn, $gameColumn, $winColumn, $drawColumn, $loseColumn, 'leadership', 'strength', 'intel', 'no', 'npc', 'name'],
0
);
usort($tournamentRankerList, function (General $lhs, General $rhs) use ($gameColumn, $winColumn, $drawColumn, $loseColumn) {
$result = - ($lhs->getRankVar($gameColumn) <=> $rhs->getRankVar($gameColumn));
if ($result !== 0) return $result;
$result = - (
($lhs->getRankVar($winColumn) + $lhs->getRankVar($drawColumn) + $lhs->getRankVar($loseColumn))
<=>
($rhs->getRankVar($winColumn) + $rhs->getRankVar($drawColumn) + $rhs->getRankVar($loseColumn))
);
if ($result !== 0) return $result;
$result = - ($lhs->getRankVar($winColumn) <=> $rhs->getRankVar($winColumn));
if ($result !== 0) return $result;
$result = - ($lhs->getRankVar($drawColumn) <=> $rhs->getRankVar($drawColumn));
if ($result !== 0) return $result;
return $lhs->getRankVar($loseColumn) <=> $rhs->getRankVar($loseColumn);
});
$tournamentRankerList = array_splice($tournamentRankerList, 0, 30);
foreach ($tournamentRankerList as $rank => $ranker) {
printRow(
$rank,
$ranker->getNPCType(),
$ranker->getName(),
($statFunc)($ranker),
$ranker->getRankVar($winColumn) + $ranker->getRankVar($drawColumn) + $ranker->getRankVar($loseColumn),
$ranker->getRankVar($winColumn),
$ranker->getRankVar($drawColumn),
$ranker->getRankVar($loseColumn),
$ranker->getRankVar($gameColumn),
$ranker->getRankVar($prizeColumn),
0
);
}
?>
</table>
</td>
<?php endforeach; ?>
</tr>
<tr>
<td colspan=16>
ㆍ토너먼트의 16강 대진표가 완성되면, 베팅 기간이 주어집니다.<br>
ㆍ유저들의 베팅 상황에 따라 배당률이 실시간 결정되며, 자신의 베팅금에 따른 예상 환급금을 알 수 있습니다.<br>
ㆍ베팅은 16슬롯에 각각 베팅 가능하며, 도합 최대 금 1000씩 베팅 가능합니다.<br>
ㆍ소지금 500원 이하일땐 베팅이 불가능합니다.
ㆍ삼모와 더불어 토너먼트, 베팅기능으로 즐거운 삼모 되세요!<br>
</td>
</tr>
</table>
<table align=center width=1120 class='tb_layout bg0'>
<tr>
<td><?= closeButton() ?></td>
</tr>
<tr>
<td><?= banner() ?></td>
</tr>
</table>
</body>
</html>
</html>
+66 -92
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -10,102 +11,75 @@ $generalObj = General::createGeneralObjFromDB($session->generalID);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?=UniqueConst::$serverName?>: 사령부</title>
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('../e_lib/jquery.redirect.js')?>
<?=WebUtil::printJS('../e_lib/moment.min.js')?>
<?=WebUtil::printJS('js/common.js')?>
<?=WebUtil::printJS('js/chiefCenter.js')?>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<?=WebUtil::printCSS('css/chiefCenter.css')?>
<script type="text/javascript">
var maxChiefTurn = <?=GameConst::$maxChiefTurn?>;
</script>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?= UniqueConst::$serverName ?>: 사령부</title>
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printCSS('css/chiefCenter.css') ?>
<script type="text/javascript">
var maxChiefTurn = <?= GameConst::$maxChiefTurn ?>;
</script>
<?= WebUtil::printDist('ts', ['common', 'chiefCenter']) ?>
</head>
<body>
<div id='container' class='tb_layout bg0' style='width:1000px;margin:auto;border:solid 1px #888888;'>
<div class='tb_layout bg0'>사 령 부<button type='button' id='reloadTable'>갱신</button><br>
<?=backButton()?></div>
<div style='background-color:skyblue;text-align:center;'>수뇌부 일정</div>
<div class="chiefSubTable" style='height:<?=22*(GameConst::$maxChiefTurn+1)?>px;'
><div class='chiefTurnIdxPanel'
><div class='bg1 chiefTurnIdx'>.</div
<?php foreach(Util::range(GameConst::$maxChiefTurn) as $idx):?>
><div class='bg0 chiefTurnIdx'><?=$idx+1?></div
<?php endforeach; ?>
></div
<?php foreach([12, 10, 8, 6] as $chiefIdx): ?>
><div class='bg2 chiefPlate' style='flex-grow:1;' id='chief_<?=$chiefIdx?>'
><div class='bg1 chiefNamePlate'><span class='chiefLevelText'>-</span> : <span class='chiefName'>&nbsp;</span></div
<?php foreach(Util::range(GameConst::$maxChiefTurn) as $turnIdx): ?>
><div class='chiefTurnBox turn<?=$turnIdx?>'
><div class='chiefTurnTime'>&nbsp;</div
><div class='chiefTurnPad'><span class='chiefTurnText'>&nbsp;</span></div
></div
<?php endforeach; ?>
></div
<?php endforeach; ?>
><div class='chiefTurnIdxPanel tail'
><div class='bg1 chiefTurnIdx'>.</div
<?php foreach(Util::range(GameConst::$maxChiefTurn) as $idx):?>
><div class='bg0 chiefTurnIdx'><?=$idx+1?></div
<?php endforeach; ?>
></div
></div
><div id='controlPlate' style='display:flex;flex-flow:row wrap;justify-content:center;'
><div style='width:400px;text-align:right;'
><?=chiefTurnTable()
?></div
><div style='width:400px;display: flex;justify-content: center;flex-direction: column;'
><div
><input type='button' id='turnPush' style='visibility:hidden;background-color:<?=GameConst::$basecolor2?>;color:white;font-size:13px;' value='미루기▼'
><input type='button' id='turnPull' style='visibility:hidden;background-color:<?=GameConst::$basecolor2?>;color:white;font-size:13px;' value='▲당기기'
></div
><div
><?=chiefCommandTable($generalObj)
?><br><input type='button' id='setCommand' style='visibility:hidden;background-color:<?=GameConst::$basecolor2?>;color:white;font-size:13px;' value='실 행'
></div
></div
></div
><div class="chiefSubTable" style='height:<?=22*(GameConst::$maxChiefTurn+1)?>px;'
><div class='chiefTurnIdxPanel'
><div class='bg1 chiefTurnIdx'>.</div
<?php foreach(Util::range(GameConst::$maxChiefTurn) as $idx):?>
><div class='bg0 chiefTurnIdx'><?=$idx+1?></div
<?php endforeach; ?>
></div
<?php foreach([11, 9, 7, 5] as $chiefIdx): ?>
><div class='bg2 chiefPlate' style='flex-grow:1;' id='chief_<?=$chiefIdx?>'
><div class='bg1 chiefNamePlate'><span class='chiefLevelText'>-</span> : <span class='chiefName'>&nbsp;</span></div
<?php foreach(Util::range(GameConst::$maxChiefTurn) as $turnIdx): ?>
><div class='chiefTurnBox turn<?=$turnIdx?>'
><div class='chiefTurnTime'>&nbsp;</div
><div class='chiefTurnPad'><span class='chiefTurnText'>&nbsp;</span></div
></div
<?php endforeach; ?>
></div
<?php endforeach; ?>
><div class='chiefTurnIdxPanel tail'
><div class='bg1 chiefTurnIdx'>.</div
<?php foreach(Util::range(GameConst::$maxChiefTurn) as $idx):?>
><div class='bg0 chiefTurnIdx'><?=$idx+1?></div
<?php endforeach; ?>
></div
></div
><div
><?=backButton()
?><?=banner()
?></div>
</div>
<div id='container' class='tb_layout bg0' style='width:1000px;margin:auto;border:solid 1px #888888;'>
<div class='tb_layout bg0'>사 령 부<button type='button' id='reloadTable'>갱신</button><br>
<?= backButton() ?></div>
<div style='background-color:skyblue;text-align:center;'>수뇌부 일정</div>
<div class="chiefSubTable" style='height:<?= 22 * (GameConst::$maxChiefTurn + 1) ?>px;'>
<div class='chiefTurnIdxPanel'>
<div class='bg1 chiefTurnIdx'>.</div <?php foreach (Util::range(GameConst::$maxChiefTurn) as $idx) : ?>>
<div class='bg0 chiefTurnIdx'><?= $idx + 1 ?></div <?php endforeach; ?>>
</div <?php foreach ([12, 10, 8, 6] as $chiefIdx) : ?>>
<div class='bg2 chiefPlate' style='flex-grow:1;' id='chief_<?= $chiefIdx ?>'>
<div class='bg1 chiefNamePlate'><span class='chiefLevelText'>-</span> : <span class='chiefName'>&nbsp;</span></div <?php foreach (Util::range(GameConst::$maxChiefTurn) as $turnIdx) : ?>>
<div class='chiefTurnBox turn<?= $turnIdx ?>'>
<div class='chiefTurnTime'>&nbsp;</div>
<div class='chiefTurnPad'><span class='chiefTurnText'>&nbsp;</span></div>
</div <?php endforeach; ?>>
</div <?php endforeach; ?>>
<div class='chiefTurnIdxPanel tail'>
<div class='bg1 chiefTurnIdx'>.</div <?php foreach (Util::range(GameConst::$maxChiefTurn) as $idx) : ?>>
<div class='bg0 chiefTurnIdx'><?= $idx + 1 ?></div <?php endforeach; ?>>
</div>
</div>
<div id='controlPlate' style='display:flex;flex-flow:row wrap;justify-content:center;'>
<div style='width:400px;text-align:right;'><?= chiefTurnTable()
?></div>
<div style='width:400px;display: flex;justify-content: center;flex-direction: column;'>
<div><input type='button' id='turnPush' style='visibility:hidden;background-color:<?= GameConst::$basecolor2 ?>;color:white;font-size:14px;' value='미루기▼'><input type='button' id='turnPull' style='visibility:hidden;background-color:<?= GameConst::$basecolor2 ?>;color:white;font-size:14px;' value='▲당기기'></div>
<div><?= chiefCommandTable($generalObj)
?><br><input type='button' id='setCommand' style='visibility:hidden;background-color:<?= GameConst::$basecolor2 ?>;color:white;font-size:14px;' value='실 행'></div>
</div>
</div>
<div class="chiefSubTable" style='height:<?= 22 * (GameConst::$maxChiefTurn + 1) ?>px;'>
<div class='chiefTurnIdxPanel'>
<div class='bg1 chiefTurnIdx'>.</div <?php foreach (Util::range(GameConst::$maxChiefTurn) as $idx) : ?>>
<div class='bg0 chiefTurnIdx'><?= $idx + 1 ?></div <?php endforeach; ?>>
</div <?php foreach ([11, 9, 7, 5] as $chiefIdx) : ?>>
<div class='bg2 chiefPlate' style='flex-grow:1;' id='chief_<?= $chiefIdx ?>'>
<div class='bg1 chiefNamePlate'><span class='chiefLevelText'>-</span> : <span class='chiefName'>&nbsp;</span></div <?php foreach (Util::range(GameConst::$maxChiefTurn) as $turnIdx) : ?>>
<div class='chiefTurnBox turn<?= $turnIdx ?>'>
<div class='chiefTurnTime'>&nbsp;</div>
<div class='chiefTurnPad'><span class='chiefTurnText'>&nbsp;</span></div>
</div <?php endforeach; ?>>
</div <?php endforeach; ?>>
<div class='chiefTurnIdxPanel tail'>
<div class='bg1 chiefTurnIdx'>.</div <?php foreach (Util::range(GameConst::$maxChiefTurn) as $idx) : ?>>
<div class='bg0 chiefTurnIdx'><?= $idx + 1 ?></div <?php endforeach; ?>>
</div>
</div>
<div><?= backButton()
?><?= banner()
?></div>
</div>
</body>
</html>
</html>
+444 -431
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -16,7 +17,11 @@ $db = DB::db();
increaseRefresh("현재도시", 1);
$me = $db->queryFirstRow('SELECT no,nation,officer_level,city from general where owner=%i', $userID);
$myNation = $db->queryFirstRow('SELECT nation,level,spy FROM nation WHERE nation=%i', $me['nation']);
$myNation = $db->queryFirstRow('SELECT nation,level,spy FROM nation WHERE nation=%i', $me['nation']) ?? [
'nation' => 0,
'level' => 0,
'spy' => ''
];
$templates = new \League\Plates\Engine('templates');
@@ -25,118 +30,126 @@ $templates = new \League\Plates\Engine('templates');
<html>
<head>
<title><?=UniqueConst::$serverName?>: 도시정보</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('../e_lib/select2/select2.full.min.js')?>
<?=WebUtil::printJS('js/common.js')?>
<?=WebUtil::printJS('js/currentCity.js')?>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../e_lib/select2/select2.min.css')?>
<?=WebUtil::printCSS('../e_lib/select2/select2-bootstrap4.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<style>
#general_list tr td{
text-align:center;
}
<title><?= UniqueConst::$serverName ?>: 도시정보</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printCSS('../e_lib/select2/select2.min.css') ?>
<?= WebUtil::printCSS('../e_lib/select2/select2-bootstrap4.css') ?>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<style>
#general_list tr td {
text-align: center;
}
#general_list tr td:last-child{
text-align:left;
padding-left:1em;
}
#general_list tr td:last-child {
text-align: left;
padding-left: 1em;
}
.general_turn_text{
font-size:x-small;
}
</style>
.general_turn_text {
font-size: x-small;
}
</style>
<?= WebUtil::printDist('ts', ['common', 'currentCity']) ?>
</head>
<body>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td>도 시 정 보<br><?=backButton()?></td></tr>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td>도 시 정 보<br><?= backButton() ?></td>
</tr>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td width=998>
<form name=cityselect method=get>
<div style='text-align:center;'>도시선택 :
<select id="citySelector" name=citylist size=1 style='display:inline-block;min-width:400px;'>
<?php
if(!$citylist){
$citylist = $me['city'];
}
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td width=998>
<form name=cityselect method=get>
<div style='text-align:center;'>도시선택 :
<select id="citySelector" name=citylist size=1 style='display:inline-block;min-width:400px;'>
<?php
if (!$citylist) {
$citylist = $me['city'];
}
// 재야일때는 현재 도시만
$valid = 0;
if($me['officer_level'] == 0) {
$city = $db->queryFirstRow('SELECT city,name,nation from city where city=%i', $me['city']);
echo "
// 재야일때는 현재 도시만
$valid = 0;
if ($me['officer_level'] == 0) {
$city = $db->queryFirstRow('SELECT city,name,nation from city where city=%i', $me['city']);
echo "
<option value={$city['city']}";
if($city['city'] == $citylist) { echo " selected"; $valid = 1; }
echo ">【".StringUtil::padString($city['name'], 4, '_')."】";
if($city['nation'] == 0) echo "공백지";
elseif($me['nation'] == $city['nation']) echo "본국";
else echo "타국";
echo "</option>";
} else {
// 아국 도시들 선택
foreach($db->query('SELECT city,name,nation from city where nation=%i', $me['nation']) as $city){
echo "
if ($city['city'] == $citylist) {
echo " selected";
$valid = 1;
}
echo ">【" . StringUtil::padString($city['name'], 4, '_') . "】";
if ($city['nation'] == 0) echo "공백지";
elseif ($me['nation'] == $city['nation']) echo "본국";
else echo "타국";
echo "</option>";
} else {
// 아국 도시들 선택
foreach ($db->query('SELECT city,name,nation from city where nation=%i', $me['nation']) as $city) {
echo "
<option value={$city['city']}";
if($city['city'] == $citylist) { echo " selected"; $valid = 1; }
echo ">【".StringUtil::padString($city['name'], 4, '_')."】";
if($city['nation'] == 0) echo "공백지";
elseif($me['nation'] == $city['nation']) echo "본국";
else echo "타국";
echo "</option>";
}
if ($city['city'] == $citylist) {
echo " selected";
$valid = 1;
}
echo ">【" . StringUtil::padString($city['name'], 4, '_') . "】";
if ($city['nation'] == 0) echo "공백지";
elseif ($me['nation'] == $city['nation']) echo "본국";
else echo "타국";
echo "</option>";
}
// 아국 장수가 있는 타국 도시들 선택
foreach ($db->query('SELECT distinct A.city,B.name,B.nation from general A,city B where A.city=B.city and A.nation=%i and B.nation!=%i', $me['nation'], $me['nation']) as $city){
echo "
// 아국 장수가 있는 타국 도시들 선택
foreach ($db->query('SELECT distinct A.city,B.name,B.nation from general A,city B where A.city=B.city and A.nation=%i and B.nation!=%i', $me['nation'], $me['nation']) as $city) {
echo "
<option value={$city['city']}";
if($city['city'] == $citylist) { echo " selected"; $valid = 1; }
echo ">【".StringUtil::padString($city['name'], 4, '_')."】";
if($city['nation'] == 0) echo "공백지";
elseif($me['nation'] == $city['nation']) echo "본국";
else echo "타국";
echo "</option>";
}
}
if ($city['city'] == $citylist) {
echo " selected";
$valid = 1;
}
echo ">【" . StringUtil::padString($city['name'], 4, '_') . "】";
if ($city['nation'] == 0) echo "공백지";
elseif ($me['nation'] == $city['nation']) echo "본국";
else echo "타국";
echo "</option>";
}
}
if($myNation['level'] > 0) {
// 첩보도시도 목록에 추가
if ($myNation['level'] > 0) {
// 첩보도시도 목록에 추가
$rawSpy = $myNation['spy'];
$rawSpy = $myNation['spy'];
if($rawSpy == ''){
$spyCities = [];
}
else{
$spyCities = array_keys(Json::decode($rawSpy));
}
if ($rawSpy == '') {
$spyCities = [];
} else {
$spyCities = array_keys(Json::decode($rawSpy));
}
if($spyCities){
foreach ($db->query('SELECT city,name,nation FROM city WHERE city in %li', $spyCities) as $city) {
echo "<option value={$city['city']}";
if($city['city'] == $citylist) { echo " selected"; $valid = 1; }
echo ">【".StringUtil::padString($city['name'], 4, '_')."】";
if($city['nation'] == 0) echo "공백지";
elseif($me['nation'] == $city['nation']) echo "본국";
else echo "타국";
echo "</option>";
}
}
if ($spyCities) {
foreach ($db->query('SELECT city,name,nation FROM city WHERE city in %li', $spyCities) as $city) {
echo "<option value={$city['city']}";
if ($city['city'] == $citylist) {
echo " selected";
$valid = 1;
}
echo ">【" . StringUtil::padString($city['name'], 4, '_') . "】";
if ($city['nation'] == 0) echo "공백지";
elseif ($me['nation'] == $city['nation']) echo "본국";
else echo "타국";
echo "</option>";
}
}
}
}
echo "
echo "
</select></div>
<p align=center>명령 화면에서 도시를 클릭하셔도 됩니다.</p>
</form>
@@ -145,379 +158,379 @@ echo "
</table>
<br>";
unset($city);
unset($city);
// 첩보된 도시까지만 허용
// 첩보된 도시까지만 허용
$showDetailedInfo = false;
if($valid){
$showDetailedInfo = true;
}
$showDetailedInfo = false;
if ($valid) {
$showDetailedInfo = true;
}
if(!key_exists($citylist, CityConst::all())){
$citylist = $me['city'];
$showDetailedInfo = true;
$valid = 1;
}
if (!key_exists($citylist, CityConst::all())) {
$citylist = $me['city'];
$showDetailedInfo = true;
$valid = 1;
}
if($userGrade >= 5){
$valid = true;
$showDetailedInfo = true;
}
if ($userGrade >= 5) {
$valid = true;
$showDetailedInfo = true;
}
if(!$valid) {
$ownCities = Util::convertArrayToSetLike($db->queryFirstColumn('SELECT city FROM city WHERE nation = %i AND nation != 0', $me['nation']));
foreach(array_keys(CityConst::byID($citylist)->path) as $pathID){
if(key_exists($pathID, $ownCities)){
$showDetailedInfo = true;
break;
}
}
}
if (!$valid) {
$ownCities = Util::convertArrayToSetLike($db->queryFirstColumn('SELECT city FROM city WHERE nation = %i AND nation != 0', $me['nation']));
foreach (array_keys(CityConst::byID($citylist)->path) as $pathID) {
if (key_exists($pathID, $ownCities)) {
$showDetailedInfo = true;
break;
}
}
}
$city = $db->queryFirstRow('SELECT * FROM city WHERE city=%i', $citylist);
$cityNation = getNationStaticInfo($city['nation']);
$city = $db->queryFirstRow('SELECT * FROM city WHERE city=%i', $citylist);
$cityNation = getNationStaticInfo($city['nation']);
//태수, 군사, 종사
$officer = [
4=>['name'=>'-', 'npc'=>0],
3=>['name'=>'-', 'npc'=>0],
2=>['name'=>'-', 'npc'=>0]
];
//태수, 군사, 종사
$officer = [
4 => ['name' => '-', 'npc' => 0],
3 => ['name' => '-', 'npc' => 0],
2 => ['name' => '-', 'npc' => 0]
];
foreach($db->query('SELECT `name`, npc, `officer_level` FROM general WHERE `officer_city` = %i', $city['city']) as $officerInfo){
$officer[$officerInfo['officer_level']] = $officerInfo;
}
foreach ($db->query('SELECT `name`, npc, `officer_level` FROM general WHERE `officer_city` = %i', $city['city']) as $officerInfo) {
$officer[$officerInfo['officer_level']] = $officerInfo;
}
if($city['trade'] === null) {
$city['trade'] = "- ";
}
if ($city['trade'] === null) {
$city['trade'] = "- ";
}
$dbColumns = General::mergeQueryColumn(['npc', 'defence_train', 'no', 'picture', 'imgsvr', 'name', 'injury', 'leadership', 'strength', 'intel', 'officer_level', 'nation', 'crewtype', 'crew', 'train', 'atmos'], 2)[0];
if($showDetailedInfo){
$generals = $db->query(
'SELECT %l from general where city=%i order by turntime',
Util::formatListOfBackticks($dbColumns),
$city['city']
);
}
else{
$generals = [];
}
$dbColumns = General::mergeQueryColumn(['npc', 'defence_train', 'no', 'picture', 'imgsvr', 'name', 'injury', 'leadership', 'strength', 'intel', 'officer_level', 'nation', 'crewtype', 'crew', 'train', 'atmos'], 2)[0];
if ($showDetailedInfo) {
$generals = $db->query(
'SELECT %l from general where city=%i order by turntime',
Util::formatListOfBackticks($dbColumns),
$city['city']
);
} else {
$generals = [];
}
if($valid){
$city['trustText'] = round($city['trust'], 1);
$city['popRateText'] = round($city['pop']/$city['pop_max']*100, 2);
}
else{
$city['agri'] = '?';
$city['comm'] = '?';
$city['pop'] = '?';
$city['secu'] = '?';
$city['trustText'] = '?';
$city['popRateText'] = '?';
if ($valid) {
$city['trustText'] = round($city['trust'], 1);
$city['popRateText'] = round($city['pop'] / $city['pop_max'] * 100, 2);
} else {
$city['agri'] = '?';
$city['comm'] = '?';
$city['pop'] = '?';
$city['secu'] = '?';
$city['trustText'] = '?';
$city['popRateText'] = '?';
if($city['nation'] != 0){
$city['def'] = '?';
$city['wall'] = '?';
}
}
if ($city['nation'] != 0) {
$city['def'] = '?';
$city['wall'] = '?';
}
}
$generalTurnList = [];
$generalTurnList = [];
if($generals){
foreach($db->queryAllLists(
'SELECT general_id, turn_idx, brief FROM general_turn WHERE general_id IN %li AND turn_idx < 5 ORDER BY general_id ASC, turn_idx ASC',
array_column($generals, 'no')
) as [$generalID, $turnIdx, $brief]
){
if(!key_exists($generalID, $generalTurnList)){
$generalTurnList[$generalID] = [];
}
$generalTurnList[$generalID][$turnIdx] = $brief;
}
}
if ($generals) {
foreach ($db->queryAllLists(
'SELECT general_id, turn_idx, brief FROM general_turn WHERE general_id IN %li AND turn_idx < 5 ORDER BY general_id ASC, turn_idx ASC',
array_column($generals, 'no')
) as [$generalID, $turnIdx, $brief]) {
if (!key_exists($generalID, $generalTurnList)) {
$generalTurnList[$generalID] = [];
}
$generalTurnList[$generalID][$turnIdx] = $brief;
}
}
$nationname = [];
$nationlevel = [];
foreach(getAllNationStaticInfo() as $nation){
$nationname[$nation['nation']] = $nation['name'];
$nationlevel[$nation['nation']] = $nation['level'];
}
$nationname = [];
$nationlevel = [];
foreach (getAllNationStaticInfo() as $nation) {
$nationname[$nation['nation']] = $nation['name'];
$nationlevel[$nation['nation']] = $nation['level'];
}
//도시명 오 적군 0/0(0) 병장(총) 0/0(4) 90병장 0/0 60병장 0/0 수비○ 0/0
$generalsFormat = [];
//도시명 오 적군 0/0(0) 병장(총) 0/0(4) 90병장 0/0 60병장 0/0 수비○ 0/0
$generalsFormat = [];
foreach($generals as $general){
$nationInfo = getNationStaticInfo($general['nation']);
foreach ($generals as $general) {
$nationInfo = getNationStaticInfo($general['nation']);
if($general['nation'] != 0 && $general['nation'] == $myNation['nation']){
$ourGeneral = true;
}
else{
$ourGeneral = false;
}
if ($general['nation'] != 0 && $general['nation'] == $myNation['nation']) {
$ourGeneral = true;
} else {
$ourGeneral = false;
}
if($userGrade == 6){
$ourGeneral = true;
}
if ($userGrade == 6) {
$ourGeneral = true;
}
$isNPC = $general['npc']>1;
$wounded = $general['injury'];
$name = $general['name'];
$nameText = formatName($name, $general['npc']);
$leadership = $general['leadership'];
$strength = $general['strength'];
$intel = $general['intel'];
$leadershipText = formatWounded($leadership, $general['injury']);
$strengthText = formatWounded($strength, $general['injury']);
$intelText = formatWounded($intel, $general['injury']);
$officerLevel = $general['officer_level'];
$officerLevelText = getOfficerLevelText($officerLevel);
$leadershipBonus = calcLeadershipBonus($officerLevel, $nationInfo['level']);
$leadershipBonusText = formatLeadershipBonus($leadershipBonus);
if($ourGeneral){
$defenceTrain = $general['defence_train'];
$defenceTrainText = formatDefenceTrain($defenceTrain);
$crewType = $general['crewtype'];
$crewTypeText = GameUnitConst::byId($crewType)->name;
$crew = $general['crew'];
$train = $general['train'];
$atmos = $general['atmos'];
}
else{
$defenceTrain = 0;
$defenceTrainText = '';
$crewType = 0;
$crewTypeText = '';
$crew = $general['crew'];
$train = -1;
$atmos = -1;
if(!$valid){
$crew = -1;
}
}
$nation = $general['nation'];
$nationName = $nationInfo['name'];
if($ourGeneral && !$isNPC){
$turnText = [];
$generalObj = new General($general, null, null, null, null, null, false);
foreach($generalTurnList[$generalObj->getID()] as $turnRawIdx=>$turn){
$turnIdx = $turnRawIdx+1;
$turnText[] = "{$turnIdx} : $turn";
}
$turnText = join('<br>', $turnText);
}
else{
$turnText = '';
}
$generalsFormat[] = [
'ourGeneral'=>$ourGeneral,
'iconPath'=>GetImageURL($general['imgsvr']).'/'.$general['picture'],
'isNPC'=>$isNPC,
'wounded'=>$wounded,
'name'=>$name,
'nameText'=>$nameText,
'leadership'=>$leadership,
'leadershipText'=>$leadershipText,
'leadershipBonus'=>$leadershipBonus,
'leadershipBonusText'=>$leadershipBonusText,
'officerLevel'=>$officerLevel,
'officerLevelText'=>$officerLevelText,
'strength'=>$strength,
'strengthText'=>$strengthText,
'intel'=>$intel,
'intelText'=>$intelText,
'defenceTrain'=>$defenceTrain,
'defenceTrainText'=>$defenceTrainText,
'crewType'=>$crewType,
'crewTypeText'=>$crewTypeText,
'crew'=>$crew,
'train'=>$train,
'atmos'=>$atmos,
'nation'=>$nation,
'nationName'=>$nationName,
'turnText'=>$turnText
];
}
$generalsName = array_map(function($gen){return getColoredName($gen['name'], $gen['npc']);}, $generals);
$enemyCrew = 0;
$enemyCnt = 0;
$enemyArmedCnt = 0;
$crew90 = 0;
$gen90 = 0;
$crew80 = 0;
$gen80 = 0;
$crew60 = 0;
$gen60 = 0;
$crewDef = 0;
$genDef = 0 ;
$crewTotal = 0;
$armedGenTotal = 0;
$genTotal = 0;
$isNPC = $general['npc'] > 1;
$wounded = $general['injury'];
foreach($generalsFormat as $general){
if($general['nation'] == 0){
continue;
}
if($general['nation'] != $myNation['nation']){
$enemyCnt += 1;
if($general['crew'] >= 0){
$enemyCrew += $general['crew'];
}
if($general['crew'] > 0){
$enemyArmedCnt += 1;
}
continue;
}
$name = $general['name'];
$nameText = formatName($name, $general['npc']);
$crewTotal += $general['crew'];
$genTotal += 1;
$leadership = $general['leadership'];
$strength = $general['strength'];
$intel = $general['intel'];
if($general['crew'] == 0){
continue;
}
$armedGenTotal += 1;
$leadershipText = formatWounded($leadership, $general['injury']);
$strengthText = formatWounded($strength, $general['injury']);
$intelText = formatWounded($intel, $general['injury']);
$minTrain = min($general['train'], $general['atmos']);
$officerLevel = $general['officer_level'];
$officerLevelText = getOfficerLevelText($officerLevel);
if($minTrain >= 90){
$crew90 += $general['crew'];
$gen90 += 1;
}
$leadershipBonus = calcLeadershipBonus($officerLevel, $nationInfo['level']);
$leadershipBonusText = formatLeadershipBonus($leadershipBonus);
$chkDef = false;
if($minTrain >= 80){
$crew80 += $general['crew'];
$gen80 += 1;
}
if ($ourGeneral) {
$defenceTrain = $general['defence_train'];
$defenceTrainText = formatDefenceTrain($defenceTrain);
$crewType = $general['crewtype'];
$crewTypeText = GameUnitConst::byId($crewType)->name;
$crew = $general['crew'];
$train = $general['train'];
$atmos = $general['atmos'];
} else {
$defenceTrain = 0;
$defenceTrainText = '';
$crewType = 0;
$crewTypeText = '';
$crew = $general['crew'];
$train = -1;
$atmos = -1;
if($minTrain >= 60){
$crew60 += $general['crew'];
$gen60 += 1;
}
if (!$valid) {
$crew = -1;
}
}
if($minTrain >= $general['defenceTrain']){
$crewDef += $general['crew'];
$genDef += 1;
$chkDef = true;
}
$nation = $general['nation'];
$nationName = $nationInfo['name'];
if ($ourGeneral && !$isNPC) {
$turnText = [];
$generalObj = new General($general, null, null, null, null, null, false);
foreach ($generalTurnList[$generalObj->getID()] as $turnRawIdx => $turn) {
$turnIdx = $turnRawIdx + 1;
$turnText[] = "{$turnIdx} : $turn";
}
$turnText = join('<br>', $turnText);
} else {
$turnText = '';
}
}
$generalsFormat[] = [
'ourGeneral' => $ourGeneral,
'iconPath' => GetImageURL($general['imgsvr']) . '/' . $general['picture'],
'isNPC' => $isNPC,
'wounded' => $wounded,
'name' => $name,
'nameText' => $nameText,
'leadership' => $leadership,
'leadershipText' => $leadershipText,
'leadershipBonus' => $leadershipBonus,
'leadershipBonusText' => $leadershipBonusText,
'officerLevel' => $officerLevel,
'officerLevelText' => $officerLevelText,
'strength' => $strength,
'strengthText' => $strengthText,
'intel' => $intel,
'intelText' => $intelText,
'defenceTrain' => $defenceTrain,
'defenceTrainText' => $defenceTrainText,
'crewType' => $crewType,
'crewTypeText' => $crewTypeText,
'crew' => $crew,
'train' => $train,
'atmos' => $atmos,
'nation' => $nation,
'nationName' => $nationName,
'turnText' => $turnText
];
}
?>
$generalsName = array_map(function ($gen) {
return getColoredName($gen['name'], $gen['npc']);
}, $generals);
<table align=center width=1000 class='tb_layout bg0'>
<tr><td><?=backButton()?></td></tr>
</table>
$enemyCrew = 0;
$enemyCnt = 0;
$enemyArmedCnt = 0;
$crew90 = 0;
$gen90 = 0;
$crew80 = 0;
$gen80 = 0;
$crew60 = 0;
$gen60 = 0;
<table align=center width=1000 class='tb_layout bg2'>
<tr>
<td colspan=11 align=center style='color:<?=newColor($cityNation['color'])?>; background:<?=$cityNation['color']?>'>【 <?=CityConst::$regionMap[$city['region']]?> | <?=CityConst::$levelMap[$city['level']]?> 】 <?=$city['name']?></td>
<td style='color:<?=newColor($cityNation['color'])?>; background:<?=$cityNation['color']?>' class='center'><?=date('m-d H:i:s')?></td>
</tr>
<tr>
<td align=center width=48 class=bg1>주민</td>
<td align=center width=112><?=$city['pop']?>/<?=$city['pop_max']?></td>
<td align=center width=48 class=bg1>농업</td>
<td align=center width=108><?=$city['agri']?>/<?=$city['agri_max']?></td>
<td align=center width=48 class=bg1>상업</td>
<td align=center width=108><?=$city['comm']?>/<?=$city['comm_max']?></td>
<td align=center width=48 class=bg1>치안</td>
<td align=center width=108><?=$city['secu']?>/<?=$city['secu_max']?></td>
<td align=center width=48 class=bg1>수비</td>
<td align=center width=108><?=$city['def']?>/<?=$city['def_max']?></td>
<td align=center width=48 class=bg1>성벽</td>
<td align=center width=108><?=$city['wall']?>/<?=$city['wall_max']?></td>
</tr>
<tr>
<td align=center class=bg1>민심</td>
<td align=center><?=$city['trustText']?></td>
<td align=center class=bg1>시세</td>
<td align=center><?=$city['trade']?>%</td>
<td align=center class=bg1>인구</td>
<td align=center><?=$city['popRateText']?>%</td>
<td align=center class=bg1>태수</td>
<td align=center><?=$officer[4]['name']?></td>
<td align=center class=bg1>군사</td>
<td align=center><?=$officer[3]['name']?></td>
<td align=center class=bg1>종사</td>
<td align=center><?=$officer[2]['name']?></td>
</tr>
<tr>
<td align=center class=bg1>도시명</td>
<td align=center><?=$city['name']?></td>
<td align=center class=bg1>적군</td>
<td align=center><?=number_format($enemyCrew)?>/<?=number_format($enemyArmedCnt)?>(<?=number_format($enemyCnt)?>)</td>
<td align=center class=bg1>병장(총)</td>
<td align=center><?=number_format($crewTotal)?>/<?=number_format($armedGenTotal)?>(<?=number_format($genTotal)?>)</td>
<td align=center class=bg1>90병장</td>
<td align=center><?=number_format($crew90)?>/<?=number_format($gen90)?></td>
<td align=center class=bg1>60병장</td>
<td align=center><?=number_format($crew60)?>/<?=number_format($gen60)?></td>
<td align=center class=bg1>수비○</td>
<td align=center><?=number_format($crewDef)?>/<?=number_format($genDef)?></td>
</tr>
<tr>
<td align=center class=bg1>장수</td>
<td colspan=11><?=$showDetailedInfo?join(', ', $generalsName):'<span style="color:gray">알 수 없음</span>'?></td>
</tr>
</table>
$crewDef = 0;
$genDef = 0;
<br>
<?php if($showDetailedInfo): ?>
<table align=center class='tb_layout bg0'>
<thead>
<tr>
<td width=64 align=center class=bg1>얼 굴</td>
<td width=128 align=center class=bg1>이 름</td>
<td width=48 align=center class=bg1>통솔</td>
<td width=48 align=center class=bg1>무력</td>
<td width=48 align=center class=bg1>지력</td>
<td width=78 align=center class=bg1>관 직</td>
<td width=28 align=center class=bg1>守</td>
<td width=78 align=center class=bg1>병 종</td>
<td width=78 align=center class=bg1>병 사</td>
<td width=48 align=center class=bg1>훈련</td>
<td width=48 align=center class=bg1>사기</td>
<td width=280 align=center class=bg1>명 령</td>
</tr></thead>
<tbody class='bg0' id='general_list'>
<?php
foreach($generalsFormat as $general){
echo $templates->render('cityGeneral', $general);
}
?>
</tbody>
</table>
<?php endif; ?>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td><?=backButton()?></td></tr>
<tr><td><?=banner()?> </td></tr>
</table>
$crewTotal = 0;
$armedGenTotal = 0;
$genTotal = 0;
foreach ($generalsFormat as $general) {
if (!$general['nation'] || !$myNation['nation']) {
continue;
}
if ($general['nation'] != $myNation['nation']) {
$enemyCnt += 1;
if ($general['crew'] >= 0) {
$enemyCrew += $general['crew'];
}
if ($general['crew'] > 0) {
$enemyArmedCnt += 1;
}
continue;
}
$crewTotal += $general['crew'];
$genTotal += 1;
if ($general['crew'] == 0) {
continue;
}
$armedGenTotal += 1;
$minTrain = min($general['train'], $general['atmos']);
if ($minTrain >= 90) {
$crew90 += $general['crew'];
$gen90 += 1;
}
$chkDef = false;
if ($minTrain >= 80) {
$crew80 += $general['crew'];
$gen80 += 1;
}
if ($minTrain >= 60) {
$crew60 += $general['crew'];
$gen60 += 1;
}
if ($minTrain >= $general['defenceTrain']) {
$crewDef += $general['crew'];
$genDef += 1;
$chkDef = true;
}
}
?>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td><?= backButton() ?></td>
</tr>
</table>
<table align=center width=1000 class='tb_layout bg2'>
<tr>
<td colspan=11 align=center style='color:<?= newColor($cityNation['color']) ?>; background:<?= $cityNation['color'] ?>'>【 <?= CityConst::$regionMap[$city['region']] ?> | <?= CityConst::$levelMap[$city['level']] ?> 】 <?= $city['name'] ?></td>
<td style='color:<?= newColor($cityNation['color']) ?>; background:<?= $cityNation['color'] ?>' class='center'><?= date('m-d H:i:s') ?></td>
</tr>
<tr>
<td align=center width=48 class=bg1>주민</td>
<td align=center width=112><?= $city['pop'] ?>/<?= $city['pop_max'] ?></td>
<td align=center width=48 class=bg1>농업</td>
<td align=center width=108><?= $city['agri'] ?>/<?= $city['agri_max'] ?></td>
<td align=center width=48 class=bg1>상업</td>
<td align=center width=108><?= $city['comm'] ?>/<?= $city['comm_max'] ?></td>
<td align=center width=48 class=bg1>치안</td>
<td align=center width=108><?= $city['secu'] ?>/<?= $city['secu_max'] ?></td>
<td align=center width=48 class=bg1>수비</td>
<td align=center width=108><?= $city['def'] ?>/<?= $city['def_max'] ?></td>
<td align=center width=48 class=bg1>성벽</td>
<td align=center width=108><?= $city['wall'] ?>/<?= $city['wall_max'] ?></td>
</tr>
<tr>
<td align=center class=bg1>민심</td>
<td align=center><?= $city['trustText'] ?></td>
<td align=center class=bg1>시세</td>
<td align=center><?= $city['trade'] ?>%</td>
<td align=center class=bg1>인구</td>
<td align=center><?= $city['popRateText'] ?>%</td>
<td align=center class=bg1>태수</td>
<td align=center><?= $officer[4]['name'] ?></td>
<td align=center class=bg1>군사</td>
<td align=center><?= $officer[3]['name'] ?></td>
<td align=center class=bg1>종사</td>
<td align=center><?= $officer[2]['name'] ?></td>
</tr>
<tr>
<td align=center class=bg1>도시명</td>
<td align=center><?= $city['name'] ?></td>
<td align=center class=bg1>적군</td>
<td align=center><?= number_format($enemyCrew) ?>/<?= number_format($enemyArmedCnt) ?>(<?= number_format($enemyCnt) ?>)</td>
<td align=center class=bg1>병장(총)</td>
<td align=center><?= number_format($crewTotal) ?>/<?= number_format($armedGenTotal) ?>(<?= number_format($genTotal) ?>)</td>
<td align=center class=bg1>90병장</td>
<td align=center><?= number_format($crew90) ?>/<?= number_format($gen90) ?></td>
<td align=center class=bg1>60병장</td>
<td align=center><?= number_format($crew60) ?>/<?= number_format($gen60) ?></td>
<td align=center class=bg1>수비○</td>
<td align=center><?= number_format($crewDef) ?>/<?= number_format($genDef) ?></td>
</tr>
<tr>
<td align=center class=bg1>장수</td>
<td colspan=11><?= $showDetailedInfo ? join(', ', $generalsName) : '<span style="color:gray">알 수 없음</span>' ?></td>
</tr>
</table>
<br>
<?php if ($showDetailedInfo) : ?>
<table align=center class='tb_layout bg0'>
<thead>
<tr>
<td width=64 align=center class=bg1>얼 굴</td>
<td width=128 align=center class=bg1>이 름</td>
<td width=48 align=center class=bg1>통솔</td>
<td width=48 align=center class=bg1>무력</td>
<td width=48 align=center class=bg1>지력</td>
<td width=78 align=center class=bg1>관 직</td>
<td width=28 align=center class=bg1>守</td>
<td width=78 align=center class=bg1>병 종</td>
<td width=78 align=center class=bg1>병 사</td>
<td width=48 align=center class=bg1>훈련</td>
<td width=48 align=center class=bg1>사기</td>
<td width=280 align=center class=bg1>명 령</td>
</tr>
</thead>
<tbody class='bg0' id='general_list'>
<?php
foreach ($generalsFormat as $general) {
echo $templates->render('cityGeneral', $general);
}
?>
</tbody>
</table>
<?php endif; ?>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td><?= backButton() ?></td>
</tr>
<tr>
<td><?= banner() ?> </td>
</tr>
</table>
</body>
</html>
</html>
+203 -225
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -26,11 +27,10 @@ if ($con >= 2) {
}
$permission = checkSecretPermission($me);
if($permission < 0){
if ($permission < 0) {
echo '국가에 소속되어있지 않습니다.';
die();
}
else if ($permission < 1) {
} else if ($permission < 1) {
echo "권한이 부족합니다. 수뇌부가 아니거나 사관년도가 부족합니다.";
die();
}
@@ -43,249 +43,227 @@ if ($me['officer_level'] >= 5) {
$read = "readonly";
}
$nationStor->cacheValues(['notice', 'scout_msg']);
$nationStor->cacheValues(['notice', 'scout_msg', 'available_war_setting_cnt']);
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?=UniqueConst::$serverName?>: 내무부</title>
<script>
var editable = <?=(($me['officer_level']>=5||$permission==4)?'true':'false')?>;
var nationMsg = <?=Json::encode($nationStor->notice??'')?>;
var scoutmsg = <?=Json::encode($nationStor->scout_msg??'')?>;
</script>
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('../e_lib/summernote/summernote-bs4.min.js')?>
<?=WebUtil::printJS('../e_lib/summernote/lang/summernote-ko-KR.js')?>
<?=WebUtil::printJS('../e_lib/summernote/plugin/image-sammo/summernote-image-flip.js')?>
<?=WebUtil::printJS('../d_shared/common_path.js')?>
<?=WebUtil::printJS('js/common.js')?>
<?=WebUtil::printJS('js/dipcenter.js')?>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../e_lib/summernote/summernote-bs4.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<?=WebUtil::printCSS('css/dipcenter.css')?>
<link href="https://fonts.googleapis.com/css?family=Nanum+Gothic|Nanum+Myeongjo|Nanum+Pen+Script" rel="stylesheet">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?= UniqueConst::$serverName ?>: 내무부</title>
<?= WebUtil::printStaticValues([
'editable' => ($me['officer_level'] >= 5 || $permission == 4),
'nationMsg' => $nationStor->notice ?? '',
'scoutMsg' => $nationStor->scout_msg ?? '',
]) ?>
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printDist('vue', 'v_dipcenter', true) ?>
</head>
<body>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td>내 무 부<br><?=backButton()?></td></tr>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td colspan=9 align=center bgcolor=blue>외 교 관 계</td></tr>
<tr>
<td width=130 align=center class=bg1>국 가 명</td>
<td width=50 align=center class=bg1>국력</td>
<td width=40 align=center class=bg1>장수</td>
<td width=40 align=center class=bg1>속령</td>
<td width=80 align=center class=bg1>상태</td>
<td width=60 align=center class=bg1>기간</td>
<td width=100 align=center class=bg1>종 료 시 점</td>
</tr>
<?php
$admin = $gameStor->getValues(['year','month']);
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td>내 무 부<br><?= backButton() ?></td>
</tr>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td colspan=9 align=center bgcolor=blue>외 교 관 계</td>
</tr>
<tr>
<td width=130 align=center class=bg1>국 가 명</td>
<td width=50 align=center class=bg1>국력</td>
<td width=40 align=center class=bg1>장수</td>
<td width=40 align=center class=bg1>속령</td>
<td width=80 align=center class=bg1>상태</td>
<td width=60 align=center class=bg1>기간</td>
<td width=100 align=center class=bg1>종 료 시 점</td>
</tr>
<?php
$admin = $gameStor->getValues(['year', 'month']);
$cityCntList = Util::convertPairArrayToDict($db->queryAllLists('SELECT nation, count(city) FROM city GROUP BY nation'));
$dipStateList = Util::convertArrayToDict($db->query('SELECT you,state,term FROM diplomacy WHERE me = %i', $nationID), 'you');
$cityCntList = Util::convertPairArrayToDict($db->queryAllLists('SELECT nation, count(city) FROM city GROUP BY nation'));
$dipStateList = Util::convertArrayToDict($db->query('SELECT you,state,term FROM diplomacy WHERE me = %i', $nationID), 'you');
$nationsList = getAllNationStaticInfo();
uasort($nationsList, function(array $lhs, array $rhs){
return -($lhs['power']<=>$rhs['power']);
});
$nationsList = getAllNationStaticInfo();
uasort($nationsList, function (array $lhs, array $rhs) {
return - ($lhs['power'] <=> $rhs['power']);
});
foreach($nationsList as $staticNation):
//속령수
$staticNationID = $staticNation['nation'];
$cityCnt = $cityCntList[$staticNation['nation']]??0;
foreach ($nationsList as $staticNation) :
//속령수
$staticNationID = $staticNation['nation'];
$cityCnt = $cityCntList[$staticNation['nation']] ?? 0;
$dipStateText = '-';
$dipTermText = '-';
$dipEndDateText = '-';
if($staticNationID !== $nationID){
$diplomacyState = $dipStateList[$staticNationID];
$dipStateText = '-';
$dipTermText = '-';
$dipEndDateText = '-';
if ($staticNationID !== $nationID) {
$diplomacyState = $dipStateList[$staticNationID];
$dipStateText = [
0 => "<font color=red>교 전</font>",
1 => "<font color=magenta>선포중</font>",
2 => "통 상",
7 => "<font color=green>불가침</font>",
][$diplomacyState['state']];
$dipStateText = [
0 => "<font color=red>교 전</font>",
1 => "<font color=magenta>선포중</font>",
2 => "통 상",
7 => "<font color=green>불가침</font>",
][$diplomacyState['state']];
if($diplomacyState['term']){
$dipEndMonth = $admin['month'] + $diplomacyState['term'] - 1;
$dipEndYear = $admin['year'] + intdiv($dipEndMonth, 12);
$dipEndMonth = $dipEndMonth % 12 + 1;
$dipTermText = $diplomacyState['term'].'개월';
$dipEndDateText = "{$dipEndYear}年 {$dipEndMonth}月";
}
if ($diplomacyState['term']) {
$dipEndMonth = $admin['month'] + $diplomacyState['term'] - 1;
$dipEndYear = $admin['year'] + intdiv($dipEndMonth, 12);
$dipEndMonth = $dipEndMonth % 12 + 1;
$dipTermText = $diplomacyState['term'] . '개월';
$dipEndDateText = "{$dipEndYear}年 {$dipEndMonth}月";
}
}
?>
<tr>
<td class='center' style='color:<?= newColor($staticNation['color']) ?>;background-color:<?= $staticNation['color'] ?>'><?= $staticNation['name'] ?></td>
<td class='center'><?= $staticNation['power'] ?></td>
<td class='center'><?= $staticNation['gennum'] ?></td>
<td class='center'><?= $cityCnt ?></td>
<td class='center'><?= $dipStateText ?></td>
<td class='center'><?= $dipTermText ?></td>
<td class='center'><?= $dipEndDateText ?></td>
</tr>
<?php endforeach; ?>
</table>
<?php
// 수입 연산
$cityList = $db->query('SELECT * FROM city WHERE nation=%i', $nationID);
$dedicationList = $db->query('SELECT dedication FROM general WHERE nation=%i AND npc!=5', $nationID);
$goldIncome = getGoldIncome($nation['nation'], $nation['level'], $nation['rate'], $nation['capital'], $nation['type'], $cityList);
$warIncome = getWarGoldIncome($nation['type'], $cityList);
$totalGoldIncome = $goldIncome + $warIncome;
$riceIncome = getRiceIncome($nation['nation'], $nation['level'], $nation['rate'], $nation['capital'], $nation['type'], $cityList);
$wallIncome = getWallIncome($nation['nation'], $nation['level'], $nation['rate'], $nation['capital'], $nation['type'], $cityList);
$totalRiceIncome = $riceIncome + $wallIncome;
$outcome = getOutcome($nation['bill'], $dedicationList);
$budgetgold = $nation['gold'] + $totalGoldIncome - $outcome;
$budgetrice = $nation['rice'] + $totalRiceIncome - $outcome;
$budgetgolddiff = $totalGoldIncome - $outcome;
$budgetricediff = $totalRiceIncome - $outcome;
if ($budgetgolddiff > 0) {
$budgetgolddiff = '+' . number_format($budgetgolddiff);
} else {
$budgetgolddiff = number_format($budgetgolddiff);
}
if ($budgetricediff > 0) {
$budgetricediff = '+' . number_format($budgetricediff);
} else {
$budgetricediff = number_format($budgetricediff);
}
?>
<tr>
<td class='center' style='color:<?=newColor($staticNation['color'])?>;background-color:<?=$staticNation['color']?>'><?=$staticNation['name']?></td>
<td class='center'><?=$staticNation['power']?></td>
<td class='center'><?=$staticNation['gennum']?></td>
<td class='center'><?=$cityCnt?></td>
<td class='center'><?=$dipStateText?></td>
<td class='center'><?=$dipTermText?></td>
<td class='center'><?=$dipEndDateText?></td>
</tr>
<?php endforeach; ?>
</table>
?>
<div class='tb_layout bg0' style='margin:auto;width: 1000px;' id="editorForm">
<?php
// 수입 연산
$cityList = $db->query('SELECT * FROM city WHERE nation=%i', $nationID);
$dedicationList = $db->query('SELECT dedication FROM general WHERE nation=%i AND npc!=5', $nationID);
</div>
<table class="tb_layout bg0" style="margin:auto;">
<form name=form1 method=post action=c_dipcenter.php>
$goldIncome = getGoldIncome($nation['nation'], $nation['level'], $nation['rate'], $nation['capital'], $nation['type'], $cityList);
$warIncome = getWarGoldIncome($nation['type'], $cityList);
$totalGoldIncome = $goldIncome + $warIncome;
$riceIncome = getRiceIncome($nation['nation'], $nation['level'], $nation['rate'], $nation['capital'], $nation['type'], $cityList);
$wallIncome = getWallIncome($nation['nation'], $nation['level'], $nation['rate'], $nation['capital'], $nation['type'], $cityList);
$totalRiceIncome = $riceIncome + $wallIncome;
$outcome = getOutcome($nation['bill'], $dedicationList);
$budgetgold = $nation['gold'] + $totalGoldIncome - $outcome;
$budgetrice = $nation['rice'] + $totalRiceIncome - $outcome;
$budgetgolddiff = $totalGoldIncome - $outcome;
$budgetricediff = $totalRiceIncome - $outcome;
if ($budgetgolddiff > 0) {
$budgetgolddiff = '+'.number_format($budgetgolddiff);
} else {
$budgetgolddiff = number_format($budgetgolddiff);
}
if ($budgetricediff > 0) {
$budgetricediff = '+'.number_format($budgetricediff);
} else {
$budgetricediff = number_format($budgetricediff);
}
?>
<table width=1000 class='tb_layout bg0' style='margin:auto;'>
<form name=form1 method=post action=c_dipcenter.php>
<tr><td colspan=2 height=10></td></tr>
<tr><td colspan=2 align=center bgcolor=orange>국 가 방 침 &amp; 임관 권유 메시지</td></tr>
<tr><td colspan='2'><div id='noticeForm'>
<div class='bg1' style="display: flex; justify-content: space-around">
<div style='flex: 1 1 auto;'>
국가 방침
</div>
<div>
<input type='submit' class='submit' name=btn value='국가방침 수정'><input type='button' class='cancel_edit' value='취소'>
</div>
</div>
<input type='hidden' class='input_form' name='msg' data-global='nationMsg'>
<div class='edit_form viewer'></div>
</div></td></tr>
<tr><td colspan='2'><div id='scoutMsgForm'>
<div class='bg1' style="display: flex; justify-content: space-around">
<div style='flex: 1 1 auto;'>
임관 권유
</div>
<div>
<input type='submit' class='submit' name=btn value='임관 권유문 수정'><input type='button' class='cancel_edit' value='취소'>
</div>
</div>
<div style='border-bottom:solid gray 0.5px;'>870px x 200px를 넘어서는 내용은 표시되지 않습니다.</div>
<input type='hidden' class='input_form' name='scoutmsg' data-global='scoutmsg'>
<div style="width:870px;margin-left:auto;">
<div class='edit_form viewer'></div>
</div>
</div>
</div></td></tr>
<tr><td colspan=2 align=center bgcolor=green>예 산 &amp; 정 책</td></tr>
<tr>
<td colspan=2>
<table width=998 class='tb_layout bg0'>
<tr>
<td colspan=2 align=center class=bg1>자금 예산</td>
<td colspan=2 align=center class=bg1>병량 예산</td>
</tr>
<tr>
<td width=248 align=right class=bg1>현 재&nbsp;&nbsp;&nbsp;</td>
<td width=248 align=center><?=number_format($nation['gold'])?></td>
<td width=248 align=right class=bg1>현 재&nbsp;&nbsp;&nbsp;</td>
<td width=248 align=center><?=number_format($nation['rice'])?></td>
</tr>
<tr>
<td align=right class=bg1>단기수입&nbsp;&nbsp;&nbsp;</td>
<td align=center>+<?=number_format($warIncome)?></td>
<td align=right class=bg1>둔전수입&nbsp;&nbsp;&nbsp;</td>
<td align=center>+<?=number_format($wallIncome)?></td>
</tr>
<tr>
<td align=right class=bg1>세 금&nbsp;&nbsp;&nbsp;</td>
<td align=center>+<?=number_format($goldIncome)?></td>
<td align=right class=bg1>세 곡&nbsp;&nbsp;&nbsp;</td>
<td align=center>+<?=number_format($riceIncome)?></td>
</tr>
<tr>
<td align=right class=bg1>수입 / 지출&nbsp;&nbsp;&nbsp;</td>
<td align=center>+<?=number_format($totalGoldIncome)?> / -<?=number_format($outcome)?></td>
<td align=right class=bg1>수입 / 지출&nbsp;&nbsp;&nbsp;</td>
<td align=center>+<?=number_format($totalRiceIncome)?> / -<?=number_format($outcome)?></td>
</tr>
<tr>
<td align=right class=bg1>국고 예산&nbsp;&nbsp;&nbsp;</td>
<td align=center><?=number_format($budgetgold)?> (<?=$budgetgolddiff?>)</td>
<td align=right class=bg1>병량 예산&nbsp;&nbsp;&nbsp;</td>
<td align=center><?=number_format($budgetrice)?> (<?=$budgetricediff?>)</td>
</tr>
<tr>
<td align=right class=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=right class=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>
</tr>
<tr>
<td align=right class=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=right class=bg1>임관&amp;전쟁 변경 가능</td>
<td align=center>무제한</td>
</tr>
<tr>
<td colspan=4 align=center>
<?php
if ($nation['scout'] == 0) {
echo "
<tr>
<td colspan=2 align=center bgcolor=green>예 산 &amp; 정 책</td>
</tr>
<tr>
<td colspan=2>
<table width=998 class='tb_layout bg0'>
<tr>
<td colspan=2 align=center class=bg1>자금 예산</td>
<td colspan=2 align=center class=bg1>병량 예산</td>
</tr>
<tr>
<td width=248 align=right class=bg1>현 재&nbsp;&nbsp;&nbsp;</td>
<td width=248 align=center><?= number_format($nation['gold']) ?></td>
<td width=248 align=right class=bg1>현 재&nbsp;&nbsp;&nbsp;</td>
<td width=248 align=center><?= number_format($nation['rice']) ?></td>
</tr>
<tr>
<td align=right class=bg1>단기수입&nbsp;&nbsp;&nbsp;</td>
<td align=center>+<?= number_format($warIncome) ?></td>
<td align=right class=bg1>둔전수입&nbsp;&nbsp;&nbsp;</td>
<td align=center>+<?= number_format($wallIncome) ?></td>
</tr>
<tr>
<td align=right class=bg1>세 금&nbsp;&nbsp;&nbsp;</td>
<td align=center>+<?= number_format($goldIncome) ?></td>
<td align=right class=bg1>세 곡&nbsp;&nbsp;&nbsp;</td>
<td align=center>+<?= number_format($riceIncome) ?></td>
</tr>
<tr>
<td align=right class=bg1>수입 / 지출&nbsp;&nbsp;&nbsp;</td>
<td align=center>+<?= number_format($totalGoldIncome) ?> / -<?= number_format($outcome) ?></td>
<td align=right class=bg1>수입 / 지출&nbsp;&nbsp;&nbsp;</td>
<td align=center>+<?= number_format($totalRiceIncome) ?> / -<?= number_format($outcome) ?></td>
</tr>
<tr>
<td align=right class=bg1>국고 예산&nbsp;&nbsp;&nbsp;</td>
<td align=center><?= number_format($budgetgold) ?> (<?= $budgetgolddiff ?>)</td>
<td align=right class=bg1>병량 예산&nbsp;&nbsp;&nbsp;</td>
<td align=center><?= number_format($budgetrice) ?> (<?= $budgetricediff ?>)</td>
</tr>
<tr>
<td align=right class=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=right class=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>
</tr>
<tr>
<td align=right class=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=right class=bg1>전쟁 허용/금지 변경 가능</td>
<td align=center><?= $nationStor->getValue('available_war_setting_cnt') ?>회(월 +<?= GameConst::$incAvailableWarSettingCnt ?>회, 최대<?= GameConst::$maxAvailableWarSettingCnt ?>회)</td>
</tr>
<tr>
<td colspan=4 align=center>
<?php
if ($nation['scout'] == 0) {
echo "
<input type=$btn name=btn value='임관 금지'>";
} else {
echo "
} else {
echo "
<input type=$btn name=btn value='임관 허가'>";
}
}
if ($nation['war'] == 0) {
echo "
if ($nation['war'] == 0) {
echo "
<input type=$btn name=btn value='전쟁 금지'>";
} else {
echo "
} else {
echo "
<input type=$btn name=btn value='전쟁 허가'>";
}
?>
</td>
</tr>
</table>
<tr><td colspan=2>기밀 권한이란, 암행부를 열람할 수 있는 일반 장수의 최소 사관 년수를 의미합니다.</td></tr>
<tr><td colspan=2 height=10></td></tr>
</form>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td><?=backButton()?></td></tr>
<tr><td><?=banner()?></td></tr>
</table>
}
?>
</td>
</tr>
</table>
<tr>
<td colspan=2>기밀 권한이란, 암행부를 열람할 수 있는 일반 장수의 최소 사관 년수를 의미합니다.</td>
</tr>
<tr>
<td colspan=2 height=10></td>
</tr>
</form>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td><?= backButton() ?></td>
</tr>
<tr>
<td><?= banner() ?></td>
</tr>
</table>
</body>
</html>
</html>
+158 -150
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -12,32 +13,31 @@ $gameStor = KVStorage::getStorage($db, 'game_env');
increaseRefresh("중원정보", 1);
$mapTheme = $gameStor->map_theme??'che';
$mapTheme = $gameStor->map_theme ?? 'che';
$me = $db->queryFirstRow('SELECT no,nation FROM general WHERE owner=%i', $userID);
$myNationID = $me['nation'];
$nations = array_filter(getAllNationStaticInfo(), function(array $nation){
$nations = array_filter(getAllNationStaticInfo(), function (array $nation) {
return $nation['level'];
});
uasort($nations, function(array $lhs, array $rhs){
return -($lhs['power']<=>$rhs['power']);
uasort($nations, function (array $lhs, array $rhs) {
return - ($lhs['power'] <=> $rhs['power']);
});
$nationCnt = count($nations);
foreach($db->queryAllLists('SELECT nation, count(city) FROM city WHERE nation != 0 GROUP BY nation') as [$nationID, $cityCnt]){
foreach ($db->queryAllLists('SELECT nation, count(city) FROM city WHERE nation != 0 GROUP BY nation') as [$nationID, $cityCnt]) {
$nations[$nationID]['city_cnt'] = $cityCnt;
}
$realConflict = [];
foreach ($db->queryAllLists('SELECT city, `name`, conflict FROM city WHERE conflict!=%s', '{}') as [
$cityID,
$cityName,
$cityID,
$cityName,
$rawConflict
])
{
]) {
$rawConflict = Json::decode($rawConflict);
if (count($rawConflict)<2) {
if (count($rawConflict) < 2) {
continue;
}
@@ -45,12 +45,12 @@ foreach ($db->queryAllLists('SELECT city, `name`, conflict FROM city WHERE confl
$conflict = [];
foreach ($rawConflict as $nationID=>$killnum) {
foreach ($rawConflict as $nationID => $killnum) {
$conflict[$nationID] = [
'killnum'=>$killnum,
'percent'=>round(100*$killnum / $sum, 1),
'name'=>$nations[$nationID]['name'],
'color'=>$nations[$nationID]['color']
'killnum' => $killnum,
'percent' => round(100 * $killnum / $sum, 1),
'name' => $nations[$nationID]['name'],
'color' => $nations[$nationID]['color']
];
}
@@ -58,11 +58,11 @@ foreach ($db->queryAllLists('SELECT city, `name`, conflict FROM city WHERE confl
};
$diplomacyList = [];
foreach($db->queryAllLists('SELECT me, you, state FROM diplomacy') as [$me, $you, $state]){
if(!key_exists($me, $diplomacyList)){
foreach ($db->queryAllLists('SELECT me, you, state FROM diplomacy') as [$me, $you, $state]) {
if (!key_exists($me, $diplomacyList)) {
$diplomacyList[$me] = [];
}
$diplomacyList[$me][$you] = $state;
}
@@ -72,157 +72,165 @@ $cellWidth = intdiv(888, max(1, $nationCnt));
$defaultStateChar = '?';
$sameNationStateChar = '';
$infomativeStateCharMap = [
0=>'<span style="color:red;">★</span>',
1=>'<span style="color:magenta;">▲</span>',
2=>'ㆍ',
7=>'<span style="color:green;">@</span>'
0 => '<span style="color:red;">★</span>',
1 => '<span style="color:magenta;">▲</span>',
2 => 'ㆍ',
7 => '<span style="color:green;">@</span>'
];
$neutralStateCharMap = [
0=>'<span style="color:red;">★</span>',
1=>'<span style="color:magenta;">▲</span>'
0 => '<span style="color:red;">★</span>',
1 => '<span style="color:magenta;">▲</span>'
];
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?=UniqueConst::$serverName?>: 중원 정보</title>
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('../d_shared/common_path.js')?>
<?=WebUtil::printJS('js/common.js')?>
<?=WebUtil::printJS('d_shared/base_map.js')?>
<?=WebUtil::printJS('js/map.js')?>
<script>
window.serverNick = '<?=DB::prefix()?>';
window.serverID = '<?=UniqueConst::$serverID?>';
$(function(){
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?= UniqueConst::$serverName ?>: 중원 정보</title>
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printJS('d_shared/base_map.js') ?>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printCSS('css/map.css') ?>
<?= WebUtil::printCSS('css/history.css') ?>
<?= WebUtil::printDist('ts', ['common', 'map']) ?>
<script>
window.serverNick = '<?= DB::prefix() ?>';
window.serverID = '<?= UniqueConst::$serverID ?>';
$(function() {
reloadWorldMap({
neutralView:true,
showMe:true,
useCachedMap:true
});
});
</script>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<?=WebUtil::printCSS('css/map.css')?>
<?=WebUtil::printCSS('css/history.css')?>
reloadWorldMap({
neutralView: true,
showMe: true,
useCachedMap: true
});
});
</script>
</head>
<body>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td>중 원 정 보<br><?=backButton()?></td></tr>
</table>
<br>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td colspan=<?=$nationCnt+1?> align=center bgcolor=blue>외 교 현 황</td></tr>
<tr>
<td align=center width=130 style=background-color:<?=GameConst::$basecolor2?>;>&nbsp;</td>
<?php foreach($nations as $nation): ?>
<td align=center width=<?=$cellWidth?> style='background-color:<?=$nation['color']?>;color:<?=newColor($nation['color'])?>'><?=$nation['name']?></td>
<?php endforeach; ?>
</tr>
<?php foreach($nations as $me=>$meNation): ?>
<tr style='text-align:center;'>
<td align=center style='background-color:<?=$meNation['color']?>;color:<?=newColor($meNation['color'])?>'><?=$meNation['name']?></td>
<?php foreach(array_keys($nations) as $you): ?>
<td <?=($me==$myNationID||$you==$myNationID)?'style="background-color:'.GameConst::$basecolor3.'"':''?>><?php
if($me==$you){
echo $sameNationStateChar;
}
else if($me==$myNationID || $you==$myNationID || $session->userGrade >= 5){
echo $infomativeStateCharMap[$diplomacyList[$me][$you]]??$defaultStateChar;
}
else{
echo $neutralStateCharMap[$diplomacyList[$me][$you]]??$defaultStateChar;
}
?></td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
<tr><td colspan=<?=$nationCnt+1?> align=center>불가침 : <font color=limegreen>@</font>, 통상 : ㆍ, 선포 : <font color=magenta>▲</font>, 교전 : <font color=red>★</font></td></tr>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td>중 원 정 보<br><?= backButton() ?></td>
</tr>
</table>
<br>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td colspan=<?= $nationCnt + 1 ?> align=center bgcolor=blue>외 교 현 황</td>
</tr>
<tr>
<td align=center width=130 style=background-color:<?= GameConst::$basecolor2 ?>;>&nbsp;</td>
<?php foreach ($nations as $nation) : ?>
<td align=center width=<?= $cellWidth ?> style='background-color:<?= $nation['color'] ?>;color:<?= newColor($nation['color']) ?>'><?= $nation['name'] ?></td>
<?php endforeach; ?>
</tr>
<?php foreach ($nations as $me => $meNation) : ?>
<tr style='text-align:center;'>
<td align=center style='background-color:<?= $meNation['color'] ?>;color:<?= newColor($meNation['color']) ?>'><?= $meNation['name'] ?></td>
<?php foreach (array_keys($nations) as $you) : ?>
<td <?= ($me == $myNationID || $you == $myNationID) ? 'style="background-color:' . GameConst::$basecolor3 . '"' : '' ?>><?php
if ($me == $you) {
echo $sameNationStateChar;
} else if ($me == $myNationID || $you == $myNationID || $session->userGrade >= 5) {
echo $infomativeStateCharMap[$diplomacyList[$me][$you]] ?? $defaultStateChar;
} else {
echo $neutralStateCharMap[$diplomacyList[$me][$you]] ?? $defaultStateChar;
}
?></td>
<?php endforeach; ?>
</tr>
<?php endforeach; ?>
<tr>
<td colspan=<?= $nationCnt + 1 ?> align=center>불가침 : <font color=limegreen>@</font>, 통상 : ㆍ, 선포 : <font color=magenta>▲</font>, 교전 : <font color=red>★</font>
</td>
</tr>
</table>
<?php if ($realConflict) : ?>
<?php if ($realConflict) : ?>
<br>
<table align='center' width=1000 class='tb_layout bg0'>
<tr><td colspan=2 align=center bgcolor=magenta>분 쟁 현 황</td></tr>
<?php foreach($realConflict as list($cityID, $cityName, $conflict)): ?>
<tr>
<td align=center width=48><?=$cityName?></td>
<td style='width:948px;position:relative;'>
<table class='tb_layout bg0' style='width:100%;'>
<?php foreach($conflict as $item): ?>
<br>
<table align='center' width=1000 class='tb_layout bg0'>
<tr>
<td colspan=2 align=center bgcolor=magenta>분 쟁 현 황</td>
</tr>
<?php foreach ($realConflict as list($cityID, $cityName, $conflict)) : ?>
<tr>
<td
width=130
align=right
style='color:<?=newColor($item['color'])?>;background-color:<?=$item['color']?>;'
><?=$item['name']?>&nbsp;</td>
<td width=48 align=right><?=(float)$item['percent']?> %&nbsp;</td>
<td width=*><div
style='display:inline-block;width:<?=$item['percent']?>%;background-color:<?=$item['color']?>;'
>&nbsp;</div></td>
<td align=center width=48><?= $cityName ?></td>
<td style='width:948px;position:relative;'>
<table class='tb_layout bg0' style='width:100%;'>
<?php foreach ($conflict as $item) : ?>
<tr>
<td width=130 align=right style='color:<?= newColor($item['color']) ?>;background-color:<?= $item['color'] ?>;'><?= $item['name'] ?>&nbsp;</td>
<td width=48 align=right><?= (float)$item['percent'] ?> %&nbsp;</td>
<td width=*>
<div style='display:inline-block;width:<?= $item['percent'] ?>%;background-color:<?= $item['color'] ?>;'>&nbsp;</div>
</td>
</tr>
<?php endforeach; ?>
</table>
</td>
</tr>
<?php endforeach; ?>
</table>
</td>
</tr>
<?php endforeach; ?>
<tr><td colspan=2 height=5 id=bg1></td></tr>
</table>
<tr>
<td colspan=2 height=5 class='bg1'></td>
</tr>
</table>
<?php endif; ?>
<?php endif; ?>
<br>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td colspan=5 align=center bgcolor=green><font size=3>중 원 지 도</font></td>
</tr>
<tr>
<td width=698 height=420>
<?=getMapHtml($mapTheme)?>
</td>
<td id='nation_list_frame'>
<table id='nation_list'>
<thead>
<tr>
<th width=130>국명</th>
<th width=70>국력</th>
<th width=45>장수</th>
<th width=45>속령</th>
</tr>
</thead>
<tbody>
<?php foreach($nations as $nation): ?>
<tr>
<td><span style='color:<?=newColor($nation['color'])?>;background-color:<?=$nation['color']?>'><?=$nation['name']?></td>
<td style='text-align:right'><?=number_format($nation['power'])?></td>
<td style='text-align:right'><?=number_format($nation['gennum'])?></td>
<td style='text-align:right'><?=number_format($nation['city_cnt'])?></td>
</tr>
<?php endforeach; ?>
</tbody>
<tfoot></tfoot>
</table>
</td>
</tr>
</table>
<br>
<br>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td colspan=5 align=center bgcolor=green>
<font size=3>중 원 지 도</font>
</td>
</tr>
<tr>
<td width=698 height=420>
<?= getMapHtml($mapTheme) ?>
</td>
<td id='nation_list_frame'>
<table id='nation_list'>
<thead>
<tr>
<th width=130>국명</th>
<th width=70>국력</th>
<th width=45>장수</th>
<th width=45>속령</th>
</tr>
</thead>
<tbody>
<?php foreach ($nations as $nation) : ?>
<tr>
<td><span style='color:<?= newColor($nation['color']) ?>;background-color:<?= $nation['color'] ?>'><?= $nation['name'] ?></td>
<td style='text-align:right'><?= number_format($nation['power']) ?></td>
<td style='text-align:right'><?= number_format($nation['gennum']) ?></td>
<td style='text-align:right'><?= number_format($nation['city_cnt']) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
<tfoot></tfoot>
</table>
</td>
</tr>
</table>
<br>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td><?=backButton()?></td></tr>
<tr><td><?=banner()?></td></tr>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td><?= backButton() ?></td>
</tr>
<tr>
<td><?= banner() ?></td>
</tr>
</table>
</body>
</html>
</html>
+215 -178
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -29,11 +30,10 @@ if ($con >= 2) {
}
$permission = checkSecretPermission($me);
if($permission < 0){
if ($permission < 0) {
echo '국가에 소속되어있지 않습니다.';
die();
}
else if ($permission < 1) {
} else if ($permission < 1) {
echo "권한이 부족합니다. 수뇌부가 아니거나 사관년도가 부족합니다.";
die();
}
@@ -48,198 +48,235 @@ $templates = new \League\Plates\Engine('templates');
<?php if ($con == 1) {
MessageBox("접속제한이 얼마 남지 않았습니다!");
} ?>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?=UniqueConst::$serverName?>: 암행부</title>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('js/common.js')?>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?= UniqueConst::$serverName ?>: 암행부</title>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printDist('ts', ['common']) ?>
</head>
<body>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td>암 행 부<br><?=closeButton()?></td></tr>
<tr><td><form name=form1 method=get>정렬순서 :
<select name=type size=1>
<option <?=$sel[1]??''?> value=1>자금</option>
<option <?=$sel[2]??''?> value=2>군량</option>
<option <?=$sel[3]??''?> value=3>도시</option>
<option <?=$sel[4]??''?> value=4>병종</option>
<option <?=$sel[5]??''?> value=5>병사</option>
<option <?=$sel[6]??''?> value=6>삭제턴</option>
<option <?=$sel[7]??''?> value=7>턴</option>
<option <?=$sel[8]??''?> value=8>부대</option>
</select>
<input type=submit value='정렬하기'></form>
</td></tr>
</table>
<?php
$troopName = [];
foreach($db->queryAllLists('SELECT troop_leader, name FROM troop WHERE nation=%i', $me['nation']) as [$troopID, $tName]){
$troopName[$troopID] = $tName;
}
$orderSQL = '';
switch ($type) {
case 1: $orderSQL = "order by gold desc"; break;
case 2: $orderSQL = "order by rice desc"; break;
case 3: $orderSQL = "order by city"; break;
case 4: $orderSQL = "order by crewtype desc"; break;
case 5: $orderSQL = "order by crew desc"; break;
case 6: $orderSQL = "order by killturn"; break;
case 7: $orderSQL = "order by turntime"; break;
case 8: $orderSQL = "order by troop desc"; break;
}
$generals = $db->query(
'SELECT npc,defence_train,no,officer_level,troop,city,injury,leadership,strength,intel,experience,name,gold,rice,crewtype,crew,train,atmos,killturn,turntime,nation from general WHERE nation = %i %l',
$me['nation'],
$orderSQL
);
$generalTurnList = [];
foreach($db->queryAllLists(
'SELECT general_id, turn_idx, brief FROM general_turn WHERE general_id IN %li AND turn_idx < 5 ORDER BY general_id ASC, turn_idx ASC',
array_column($generals, 'no')
) as [$generalID, $turnIdx, $brief]
){
if(!key_exists($generalID, $generalTurnList)){
$generalTurnList[$generalID] = [];
}
$generalTurnList[$generalID][$turnIdx] = $brief;
}
$genCntEff = 0;
foreach ($generals as &$general) {
$general['cityText'] = CityConst::byID($general['city'])->name;
$general['troopText'] = $troopName[$general['troop']]??'-';
if($general['npc'] != 5){
$genCntEff += 1;
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td>암 행 부<br><?= closeButton() ?></td>
</tr>
<tr>
<td>
<form name=form1 method=get>정렬순서 :
<select name=type size=1>
<option <?= $sel[1] ?? '' ?> value=1>자금</option>
<option <?= $sel[2] ?? '' ?> value=2>군량</option>
<option <?= $sel[3] ?? '' ?> value=3>도시</option>
<option <?= $sel[4] ?? '' ?> value=4>병종</option>
<option <?= $sel[5] ?? '' ?> value=5>병사</option>
<option <?= $sel[6] ?? '' ?> value=6>삭제턴</option>
<option <?= $sel[7] ?? '' ?> value=7>턴</option>
<option <?= $sel[8] ?? '' ?> value=8>부대</option>
</select>
<input type=submit value='정렬하기'>
</form>
</td>
</tr>
</table>
<?php
$troopName = [];
foreach ($db->queryAllLists('SELECT troop_leader, name FROM troop WHERE nation=%i', $me['nation']) as [$troopID, $tName]) {
$troopName[$troopID] = $tName;
}
$lbonus = calcLeadershipBonus($general['officer_level'], $nationLevel);
if ($lbonus > 0) {
$lbonusText = "<font color=cyan>+{$lbonus}</font>";
} else {
$lbonusText = "";
}
$general['lbonus'] = $lbonus;
$general['lbonusText'] = $lbonusText;
if ($general['injury'] > 0) {
$leadership = intdiv($general['leadership'] * (100 - $general['injury']), 100);
$strength = intdiv($general['strength'] * (100 - $general['injury']), 100);
$intel = intdiv($general['intel'] * (100 - $general['injury']), 100);
$leadership = "<font color=red>{$leadership}</font>{$lbonusText}";
$strength = "<font color=red>{$strength}</font>";
$intel = "<font color=red>{$intel}</font>";
} else {
$leadership = "{$general['leadership']}{$lbonusText}";
$strength = "{$general['strength']}";
$intel = "{$general['intel']}";
$orderSQL = '';
switch ($type) {
case 1:
$orderSQL = "order by gold desc";
break;
case 2:
$orderSQL = "order by rice desc";
break;
case 3:
$orderSQL = "order by city";
break;
case 4:
$orderSQL = "order by crewtype desc";
break;
case 5:
$orderSQL = "order by crew desc";
break;
case 6:
$orderSQL = "order by killturn";
break;
case 7:
$orderSQL = "order by turntime";
break;
case 8:
$orderSQL = "order by troop desc";
break;
}
$general['leadershipText'] = $leadership;
$general['strengthText'] = $strength;
$general['intelText'] = $intel;
$generals = $db->query(
'SELECT npc,defence_train,no,officer_level,troop,city,injury,leadership,strength,intel,experience,name,gold,rice,crewtype,crew,train,atmos,killturn,turntime,nation from general WHERE nation = %i %l',
$me['nation'],
$orderSQL
);
$general['expLevelText'] = getExpLevel($general['experience']);
$generalTurnList = [];
$general['nameText'] = getColoredName($general['name'], $general['npc']);
$general['modeText'] = formatDefenceTrain($general['defence_train']);
$general['crewtypeText'] = GameUnitConst::byId($general['crewtype'])->name??'-';
if ($general['npc'] < 2) {
$turntext = [];
foreach($generalTurnList[$general['no']] as $turnRawIdx=>$turn){
$turn = StringUtil::subStringForWidth($turn, 0, 41);
$turnIdx = $turnRawIdx+1;
$turntext[] = "&nbsp;$turnIdx : $turn";
foreach ($db->queryAllLists(
'SELECT general_id, turn_idx, brief FROM general_turn WHERE general_id IN %li AND turn_idx < 5 ORDER BY general_id ASC, turn_idx ASC',
array_column($generals, 'no')
) as [$generalID, $turnIdx, $brief]) {
if (!key_exists($generalID, $generalTurnList)) {
$generalTurnList[$generalID] = [];
}
$general['turntext'] = join("<br>\n", $turntext);
}
}
unset($general);
$genCnt = countPureGeneralFromRawList($generals);
$totalGold = 0;
$totalRice = 0;
$crew90 = 0;
$gen90 = 0;
$crew80 = 0;
$gen80 = 0;
$crew60 = 0;
$gen60 = 0;
$crewTotal = 0;
//$genTotal = 0;
foreach($generals as $general){
if($general['npc']==5){
continue;
}
$totalGold += $general['gold'];
$totalRice += $general['rice'];
$crewTotal += $general['crew'];
if($general['crew'] == 0){
continue;
}
if($general['train'] >= 90 && $general['atmos'] >= 90){
$crew90 += $general['crew'];
$gen90 += 1;
$generalTurnList[$generalID][$turnIdx] = $brief;
}
if($general['train'] >= 80 && $general['atmos'] >= 80){
$crew80 += $general['crew'];
$gen80 += 1;
$genCntEff = 0;
foreach ($generals as &$general) {
$general['cityText'] = CityConst::byID($general['city'])->name;
$general['troopText'] = $troopName[$general['troop']] ?? '-';
if ($general['npc'] != 5) {
$genCntEff += 1;
}
$lbonus = calcLeadershipBonus($general['officer_level'], $nationLevel);
if ($lbonus > 0) {
$lbonusText = "<font color=cyan>+{$lbonus}</font>";
} else {
$lbonusText = "";
}
$general['lbonus'] = $lbonus;
$general['lbonusText'] = $lbonusText;
if ($general['injury'] > 0) {
$leadership = intdiv($general['leadership'] * (100 - $general['injury']), 100);
$strength = intdiv($general['strength'] * (100 - $general['injury']), 100);
$intel = intdiv($general['intel'] * (100 - $general['injury']), 100);
$leadership = "<font color=red>{$leadership}</font>{$lbonusText}";
$strength = "<font color=red>{$strength}</font>";
$intel = "<font color=red>{$intel}</font>";
} else {
$leadership = "{$general['leadership']}{$lbonusText}";
$strength = "{$general['strength']}";
$intel = "{$general['intel']}";
}
$general['leadershipText'] = $leadership;
$general['strengthText'] = $strength;
$general['intelText'] = $intel;
$general['expLevelText'] = getExpLevel($general['experience']);
$general['nameText'] = getColoredName($general['name'], $general['npc']);
$general['modeText'] = formatDefenceTrain($general['defence_train']);
$general['crewtypeText'] = GameUnitConst::byId($general['crewtype'])->name ?? '-';
if ($general['npc'] < 2) {
$turntext = [];
foreach ($generalTurnList[$general['no']] as $turnRawIdx => $turn) {
$turn = StringUtil::subStringForWidth($turn, 0, 41);
$turnIdx = $turnRawIdx + 1;
$turntext[] = "&nbsp;$turnIdx : $turn";
}
$general['turntext'] = join("<br>\n", $turntext);
}
}
unset($general);
if($general['train'] >= 60 && $general['atmos'] >= 60){
$crew60 += $general['crew'];
$gen60 += 1;
$genCnt = countPureGeneralFromRawList($generals);
$totalGold = 0;
$totalRice = 0;
$crew90 = 0;
$gen90 = 0;
$crew80 = 0;
$gen80 = 0;
$crew60 = 0;
$gen60 = 0;
$crewTotal = 0;
//$genTotal = 0;
foreach ($generals as $general) {
if ($general['npc'] == 5) {
continue;
}
$totalGold += $general['gold'];
$totalRice += $general['rice'];
$crewTotal += $general['crew'];
if ($general['crew'] == 0) {
continue;
}
if ($general['train'] >= 90 && $general['atmos'] >= 90) {
$crew90 += $general['crew'];
$gen90 += 1;
}
if ($general['train'] >= 80 && $general['atmos'] >= 80) {
$crew80 += $general['crew'];
$gen80 += 1;
}
if ($general['train'] >= 60 && $general['atmos'] >= 60) {
$crew60 += $general['crew'];
$gen60 += 1;
}
}
}
?>
?>
<table style='width:1000px;margin:5px auto' class='tb_layout bg0'>
<thead>
<colgroup>
<col style="width:120px;"><col>
<col style="width:120px;"><col>
<col style="width:120px;"><col>
<col style="width:120px;"><col>
</colgroup>
</thead>
<tbody>
<tr>
<td class='bg1'>전체 금</td><td><?=number_format($totalGold)?></td>
<td class='bg1'>전체 쌀</td><td><?=number_format($totalRice)?></td>
<td class='bg1'>평균 금</td><td><?=number_format($totalGold/$genCntEff, 2)?></td>
<td class='bg1'>평균 쌀</td><td><?=number_format($totalRice/$genCntEff, 2)?></td>
</tr>
<tr>
<td class='bg1'>전체 병력/장수</td><td><?=number_format($crewTotal)?>/<?=number_format($genCntEff)?></td>
<td class='bg1'>훈사 90 병력/장수</td><td><?=number_format($crew90)?>/<?=number_format($gen90)?></td>
<td class='bg1'>훈사 80 병력/장수</td><td><?=number_format($crew80)?>/<?=number_format($gen80)?></td>
<td class='bg1'>훈사 60 병력/장수</td><td><?=number_format($crew60)?>/<?=number_format($gen60)?></td>
</tr>
</tbody>
</table>
<table style='width:1000px;margin:5px auto' class='tb_layout bg0'>
<thead>
<colgroup>
<col style="width:120px;">
<col>
<col style="width:120px;">
<col>
<col style="width:120px;">
<col>
<col style="width:120px;">
<col>
</colgroup>
</thead>
<tbody>
<tr>
<td class='bg1'>전체 금</td>
<td><?= number_format($totalGold) ?></td>
<td class='bg1'>전체 </td>
<td><?= number_format($totalRice) ?></td>
<td class='bg1'>평균 금</td>
<td><?= number_format($totalGold / $genCntEff, 2) ?></td>
<td class='bg1'>평균 쌀</td>
<td><?= number_format($totalRice / $genCntEff, 2) ?></td>
</tr>
<tr>
<td class='bg1'>전체 병력/장수</td>
<td><?= number_format($crewTotal) ?>/<?= number_format($genCntEff) ?></td>
<td class='bg1'>훈사 90 병력/장수</td>
<td><?= number_format($crew90) ?>/<?= number_format($gen90) ?></td>
<td class='bg1'>훈사 80 병력/장수</td>
<td><?= number_format($crew80) ?>/<?= number_format($gen80) ?></td>
<td class='bg1'>훈사 60 병력/장수</td>
<td><?= number_format($crew60) ?>/<?= number_format($gen60) ?></td>
</tr>
</tbody>
</table>
<?=$templates->render('generalList', ['generals'=>$generals])?>
<?= $templates->render('generalList', ['generals' => $generals]) ?>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td><?=closeButton()?></td></tr>
<tr><td><?=banner()?></td></tr>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td><?= closeButton() ?></td>
</tr>
<tr>
<td><?= banner() ?></td>
</tr>
</table>
</body>
</html>
</html>
+418 -378
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -17,7 +18,7 @@ $me = $db->queryFirstRow('SELECT no,nation,officer_level from general where owne
$nationID = $me['nation'];
$meLevel = $me['officer_level'];
if($meLevel == 0) {
if ($meLevel == 0) {
echo "재야입니다.";
exit();
}
@@ -29,182 +30,198 @@ $nation = $db->queryFirstRow('SELECT nation,name,level,color,chief_set from nati
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?=UniqueConst::$serverName?>: 인사부</title>
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('../e_lib/select2/select2.full.min.js')?>
<?=WebUtil::printJS('js/common.js')?>
<?=WebUtil::printJS('js/bossInfo.js')?>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../e_lib/select2/select2.min.css')?>
<?=WebUtil::printCSS('../e_lib/select2/select2-bootstrap4.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<script type="text/javascript">
var chiefStatMin = <?=GameConst::$chiefStatMin?>;
var myLevel = <?=$meLevel?>;
</script>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?= UniqueConst::$serverName ?>: 인사부</title>
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printCSS('../e_lib/select2/select2.min.css') ?>
<?= WebUtil::printCSS('../e_lib/select2/select2-bootstrap4.css') ?>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<script type="text/javascript">
var chiefStatMin = <?= GameConst::$chiefStatMin ?>;
var myLevel = <?= $meLevel ?>;
</script>
<?= WebUtil::printDist('ts', ['common', 'bossInfo']) ?>
<?php
<?php
$ambassadors = $db->query('SELECT no, name, officer_level, penalty, permission FROM general WHERE permission = \'ambassador\' AND nation = %i', $nationID);
$auditors = $db->query('SELECT no, name, officer_level, penalty, permission FROM general WHERE permission = \'auditor\' AND nation = %i', $nationID);
$candidateAmbassadors = [];
$candidateAuditors = [];
foreach($ambassadors as $ambassador){
$candidateAmbassadors[] = $ambassador;
}
foreach($auditors as $auditor){
$candidateAuditors[] = $auditor;
}
foreach($db->query('SELECT no, name, nation, officer_level, penalty, permission FROM general WHERE nation = %i AND permission = \'normal\' AND officer_level != 12', $nationID) as $candidate){
$maxPermission = checkSecretMaxPermission($candidate);
if($maxPermission == 4){
$candidateAmbassadors[] = $candidate;
$ambassadors = $db->query('SELECT no, name, officer_level, penalty, permission FROM general WHERE permission = \'ambassador\' AND nation = %i', $nationID);
$auditors = $db->query('SELECT no, name, officer_level, penalty, permission FROM general WHERE permission = \'auditor\' AND nation = %i', $nationID);
$candidateAmbassadors = [];
$candidateAuditors = [];
foreach ($ambassadors as $ambassador) {
$candidateAmbassadors[] = $ambassador;
}
if($maxPermission >= 3){
$candidateAuditors[] = $candidate;
foreach ($auditors as $auditor) {
$candidateAuditors[] = $auditor;
}
foreach ($db->query('SELECT no, name, nation, officer_level, penalty, permission FROM general WHERE nation = %i AND permission = \'normal\' AND officer_level != 12', $nationID) as $candidate) {
$maxPermission = checkSecretMaxPermission($candidate);
if ($maxPermission == 4) {
$candidateAmbassadors[] = $candidate;
}
if ($maxPermission >= 3) {
$candidateAuditors[] = $candidate;
}
}
}
?>
<script>
var candidateAmbassadors = <?=Json::encode(array_map(function($value){
return [
'id'=>$value['no'],
'text'=>$value['name'],
"selected"=>($value['permission']!='normal')
];
}, $candidateAmbassadors))?>;
?>
<script>
var candidateAmbassadors = <?= Json::encode(array_map(function ($value) {
return [
'id' => $value['no'],
'text' => $value['name'],
"selected" => ($value['permission'] != 'normal')
];
}, $candidateAmbassadors)) ?>;
var candidateAuditors = <?=Json::encode(array_map(function($value){
return [
'id'=>$value['no'],
'text'=>$value['name'],
"selected"=>($value['permission']!='normal')
];
}, $candidateAuditors))?>;
</script>
var candidateAuditors = <?= Json::encode(array_map(function ($value) {
return [
'id' => $value['no'],
'text' => $value['name'],
"selected" => ($value['permission'] != 'normal')
];
}, $candidateAuditors)) ?>;
</script>
</head>
<body>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td>인 사 부<br><?=backButton()?></td></tr>
</table>
<br>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td>인 사 부<br><?= backButton() ?></td>
</tr>
</table>
<br>
<?php
$lv = getNationChiefLevel($nation['level']);
if($meLevel >= 5) { $btn = "button"; }
else { $btn = "hidden"; }
$level = Util::convertArrayToDict(
$db->query(
'SELECT name,officer_level,city,picture,imgsvr,belong from general where nation=%i and officer_level>=%i order by officer_level desc',
$nationID, $lv
),
'officer_level'
);
$tigers = $db->query('SELECT value, name
FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no
WHERE rank_data.nation_id = %i AND rank_data.type = "killnum" AND value > 0 ORDER BY value DESC LIMIT 5',
$nationID
);// 오호장군
$tigerstr = join(', ', array_map(function($arr){
$number = number_format($arr['value']);
return "{$arr['name']}【{$number}】";
}, $tigers));
$eagles = $db->query('SELECT value, name
FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no
WHERE rank_data.nation_id = %i AND rank_data.type = "firenum" AND value > 0 ORDER BY value DESC LIMIT 7',
$nationID
);// 건안칠자
$eaglestr = join(', ', array_map(function($arr){
$number = number_format($arr['value']);
return "{$arr['name']}【{$number}】";
}, $eagles));
?>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td align=center style='color:<?=newColor($nation['color'])?>; background-color:<?=$nation['color']?>' colspan=6>
<font size=5>【 <?=$nation['name']?> 】</font>
</td>
</tr>
<?php
for($i=12; $i >= $lv; $i-=2) {
$i1 = $i; $i2 = $i - 1;
$imageTemp1 = GetImageURL($level[$i1]['imgsvr']??0);
$imageTemp2 = GetImageURL($level[$i2]['imgsvr']??0);
?>
<tr>
<td width=98 align=center id=bg1><font size=4><?=getOfficerLevelText($i1, $nation['level'])?></font></td>
<td width=64 class='generalIcon' height=64 style='background:no-repeat center url("<?=$imageTemp1?>/<?=$level[$i1]['picture']??'default.jpg'?>");background-size:64px;'></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><?=getOfficerLevelText($i2, $nation['level'])?></font></td>
<td width=64 class='generalIcon' height=64 style='background:no-repeat center url("<?=$imageTemp2?>/<?=$level[$i2]['picture']??'default.jpg'?>");background-size:64px;'></td>
<td width=332><font size=4><?=$level[$i2]['name']??'-'?>(<?=$level[$i2]['belong']??'-'?>년)</font></td>
</tr>
<?php
}
?>
<tr>
<td width=98 align=center id=bg1>오호장군【승전】</td>
<td colspan=5><?=$tigerstr?></td>
</tr>
<tr>
<td width=98 align=center id=bg1>건안칠자【계략】</td>
<td colspan=5><?=$eaglestr?></td>
</tr>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td colspan=6 height=5></td></tr>
<tr><td colspan=2 align=center bgcolor=red>추 방</td></tr>
<tr>
<td width=498 align=right id=bg1>대상 장수</td>
<td width=498>
<?php
if($meLevel >= 5){
$candidateStrength = $db->query('SELECT no,name,officer_level,city,npc from general where nation=%i and officer_level!=12 and strength>=%i order by npc,binary(name)', $nationID, GameConst::$chiefStatMin);
$candidateIntel = $db->query('SELECT no,name,officer_level,city,npc from general where nation=%i and officer_level!=12 and intel>=%i order by npc,binary(name)', $nationID, GameConst::$chiefStatMin);
$candidateAny = $db->query('SELECT no,name,officer_level,city,npc,leadership,strength,intel,killturn from general where nation=%i and officer_level!=12 order by npc,binary(name)', $nationID); //추방 때문에 조금 더 김
}
else{
$candidateStrength = [];
$candidateIntel = [];
$candidateAny = [];
}
if($meLevel >= 5 && !isOfficerSet($nation['chief_set'], $meLevel)) {
echo "
<select id='genlist_kick' size=1 style=color:white;background-color:black;>";
foreach($candidateAny as $general) {
if($general['no'] === $me['no']){
continue;
}
echo "
<option data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} <small>({$general['leadership']}/{$general['strength']}/{$general['intel']}, {$general['killturn']}턴)</small></option>";
$lv = getNationChiefLevel($nation['level']);
if ($meLevel >= 5) {
$btn = "button";
} else {
$btn = "hidden";
}
echo "
$level = Util::convertArrayToDict(
$db->query(
'SELECT name,officer_level,city,picture,imgsvr,belong from general where nation=%i and officer_level>=%i order by officer_level desc',
$nationID,
$lv
),
'officer_level'
);
$tigers = $db->query(
'SELECT value, name
FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no
WHERE rank_data.nation_id = %i AND rank_data.type = "killnum" AND value > 0 ORDER BY value DESC LIMIT 5',
$nationID
); // 오호장군
$tigerstr = join(', ', array_map(function ($arr) {
$number = number_format($arr['value']);
return "{$arr['name']}【{$number}】";
}, $tigers));
$eagles = $db->query(
'SELECT value, name
FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no
WHERE rank_data.nation_id = %i AND rank_data.type = "firenum" AND value > 0 ORDER BY value DESC LIMIT 7',
$nationID
); // 건안칠자
$eaglestr = join(', ', array_map(function ($arr) {
$number = number_format($arr['value']);
return "{$arr['name']}【{$number}】";
}, $eagles));
?>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td align=center style='color:<?= newColor($nation['color']) ?>; background-color:<?= $nation['color'] ?>' colspan=6>
<font size=5>【 <?= $nation['name'] ?> 】</font>
</td>
</tr>
<?php
for ($i = 12; $i >= $lv; $i -= 2) {
$i1 = $i;
$i2 = $i - 1;
$imageTemp1 = GetImageURL($level[$i1]['imgsvr'] ?? 0);
$imageTemp2 = GetImageURL($level[$i2]['imgsvr'] ?? 0);
?>
<tr>
<td width=98 align=center class='bg1'>
<font size=4><?= getOfficerLevelText($i1, $nation['level']) ?></font>
</td>
<td width=64 class='generalIcon' height=64 style='background:no-repeat center url("<?= $imageTemp1 ?>/<?= $level[$i1]['picture'] ?? 'default.jpg' ?>");background-size:64px;'></td>
<td width=332>
<font size=4><?= $level[$i1]['name'] ?? '-' ?>(<?= $level[$i1]['belong'] ?? '-' ?>년)</font>
</td>
<td width=98 align=center class='bg1'>
<font size=4><?= getOfficerLevelText($i2, $nation['level']) ?></font>
</td>
<td width=64 class='generalIcon' height=64 style='background:no-repeat center url("<?= $imageTemp2 ?>/<?= $level[$i2]['picture'] ?? 'default.jpg' ?>");background-size:64px;'></td>
<td width=332>
<font size=4><?= $level[$i2]['name'] ?? '-' ?>(<?= $level[$i2]['belong'] ?? '-' ?>년)</font>
</td>
</tr>
<?php
}
?>
<tr>
<td width=98 align=center class='bg1'>오호장군【승전】</td>
<td colspan=5><?= $tigerstr ?></td>
</tr>
<tr>
<td width=98 align=center class='bg1'>건안칠자【계략】</td>
<td colspan=5><?= $eaglestr ?></td>
</tr>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td colspan=6 height=5></td>
</tr>
<tr>
<td colspan=2 align=center bgcolor=red>추 방</td>
</tr>
<tr>
<td width=498 align=right class='bg1'>대상 장수</td>
<td width=498>
<?php
if ($meLevel >= 5) {
$candidateStrength = $db->query('SELECT no,name,officer_level,city,npc from general where nation=%i and officer_level!=12 and strength>=%i order by npc,binary(name)', $nationID, GameConst::$chiefStatMin);
$candidateIntel = $db->query('SELECT no,name,officer_level,city,npc from general where nation=%i and officer_level!=12 and intel>=%i order by npc,binary(name)', $nationID, GameConst::$chiefStatMin);
$candidateAny = $db->query('SELECT no,name,officer_level,city,npc,leadership,strength,intel,killturn from general where nation=%i and officer_level!=12 order by npc,binary(name)', $nationID); //추방 때문에 조금 더 김
} else {
$candidateStrength = [];
$candidateIntel = [];
$candidateAny = [];
}
if ($meLevel >= 5 && !isOfficerSet($nation['chief_set'], $meLevel)) {
echo "
<select id='genlist_kick' size=1 style=color:white;background-color:black;>";
foreach ($candidateAny as $general) {
if ($general['no'] === $me['no']) {
continue;
}
echo "
<option data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} <small>({$general['leadership']}/{$general['strength']}/{$general['intel']}, {$general['killturn']}턴)</small></option>";
}
echo "
</select>
<input type=$btn id='btn_kick' value=추방>";
}
}
$officerLevelText = getOfficerLevelText(11, $nation['level']);
echo "
$officerLevelText = getOfficerLevelText(11, $nation['level']);
echo "
</td>
</tr>
</table>
@@ -212,316 +229,339 @@ echo "
<tr><td colspan=4 height=5></td></tr>
<tr><td colspan=4 align=center bgcolor=blue>수 뇌 부 임 명</td></tr>
<tr>
<td width=98 align=right id=bg1>".getOfficerLevelText(12, $nation['level'])."</td>
<td width=398>{$level[12]['name']} 【".CityConst::byID($level[12]['city'])->name."】</td>
<td width=98 align=right id=bg1>{$officerLevelText}</td>
<td width=98 align=right class='bg1'>" . getOfficerLevelText(12, $nation['level']) . "</td>
<td width=398>{$level[12]['name']} 【" . CityConst::byID($level[12]['city'])->name . "】</td>
<td width=98 align=right class='bg1'>{$officerLevelText}</td>
<td width=398>
";
if($meLevel >= 5 && !isOfficerSet($nation['chief_set'], 11)) {
echo "
if ($meLevel >= 5 && !isOfficerSet($nation['chief_set'], 11)) {
echo "
<select id='genlist_11' size=1 maxlength=15 style=color:white;background-color:black;>
<option value=0 data-officer_level='0' data-name=''>____공석____</option>";
foreach($candidateAny as $general) {
if($general['officer_level'] == 11) {
echo "<option style=color:red; selected data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
} elseif($general['officer_level'] > 1) {
echo "<option style=color:orange; data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
} else {
echo "<option data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
}
}
foreach ($candidateAny as $general) {
if ($general['officer_level'] == 11) {
echo "<option style=color:red; selected data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【" . CityConst::byID($general['city'])->name . "】</option>";
} elseif ($general['officer_level'] > 1) {
echo "<option style=color:orange; data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【" . CityConst::byID($general['city'])->name . "】</option>";
} else {
echo "<option data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【" . CityConst::byID($general['city'])->name . "】</option>";
}
}
echo "
echo "
</select>
<input class='btn_appoint' type=$btn data-officer_level='11' data-officer_level_text='{$officerLevelText}' value=임명>";
} else {
if(key_exists(11, $level)){
echo "{$level[11]['name']} 【".CityConst::byID($level[11]['city'])->name."】";
}
}
echo "
} else {
if (key_exists(11, $level)) {
echo "{$level[11]['name']} 【" . CityConst::byID($level[11]['city'])->name . "】";
}
}
echo "
</td>
</tr>
";
for($i=10; $i >= $lv; $i--) {
if($i % 2 == 0) { echo "<tr>"; }
$officerLevelText = getOfficerLevelText($i, $nation['level']);
echo "
<td width=98 align=right id=bg1>{$officerLevelText}</td>
for ($i = 10; $i >= $lv; $i--) {
if ($i % 2 == 0) {
echo "<tr>";
}
$officerLevelText = getOfficerLevelText($i, $nation['level']);
echo "
<td width=98 align=right class='bg1'>{$officerLevelText}</td>
<td width=398>
";
if($meLevel >= 5 && !isOfficerSet($nation['chief_set'], $i)) {
echo "
if ($meLevel >= 5 && !isOfficerSet($nation['chief_set'], $i)) {
echo "
<select id='genlist_{$i}' size=1 style=color:white;background-color:black;>
<option value=0 data-officer_level='0' data-name=''>____공석____</option>";
foreach(($i%2==0?$candidateStrength:$candidateIntel) as $general) {
if($general['officer_level'] == $i) {
echo "<option style=color:red; selected data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
} elseif($general['officer_level'] > 1) {
echo "<option style=color:orange; data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
} else {
echo "<option data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
}
}
foreach (($i % 2 == 0 ? $candidateStrength : $candidateIntel) as $general) {
if ($general['officer_level'] == $i) {
echo "<option style=color:red; selected data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【" . CityConst::byID($general['city'])->name . "】</option>";
} elseif ($general['officer_level'] > 1) {
echo "<option style=color:orange; data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【" . CityConst::byID($general['city'])->name . "】</option>";
} else {
echo "<option data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【" . CityConst::byID($general['city'])->name . "】</option>";
}
}
echo "
echo "
</select>
<input class='btn_appoint' type=$btn data-officer_level='{$i}' data-officer_level_text='$officerLevelText' value=임명>";
} else {
$general = $level[$i]??null;
if($general){
echo "{$general['name']} 【".CityConst::byID($general['city'])->name."】";
}
}
echo "</td>";
if($i % 2 == 1) { echo "</tr>"; }
}
echo "
} else {
$general = $level[$i] ?? null;
if ($general) {
echo "{$general['name']} 【" . CityConst::byID($general['city'])->name . "】";
}
}
echo "</td>";
if ($i % 2 == 1) {
echo "</tr>";
}
}
echo "
<tr><td colspan=4>※ <font color=red>빨간색</font>은 현재 임명중인 장수, <font color=orange>노란색</font>은 다른 관직에 임명된 장수, 하얀색은 일반 장수를 뜻합니다.</td></tr>
</table>
";
if($meLevel == 12):
?>
<table align='center' width='1000' class='tb_layout bg0'>
<tr><td colspan='4' height='5'></td></tr>
<tr><td colspan='4' align='center' bgcolor='purple'>외 교 권 자 임 명</td></tr>
<tr>
<td width=98 align=right id=bg1>외교권자</td>
<td width=398>
<select id="selectAmbassador" multiple="multiple">
</select>
<button id='changeAmbassador' type='button'>임명</button>
</td>
<td width=98 align=right id=bg1>조언자</td>
<td width=398>
<select id="selectAuditor" multiple="multiple">
</select>
<button id='changeAuditor' type='button'>임명</button>
</td>
</tr>
</table>
<?php
endif;
?>
<table align=center width=1000 id='officer_list' class='tb_layout bg0'>
<tr><td colspan=5 height=5></td></tr>
<?php
if($meLevel >= 5) {
$officerLevelText = getOfficerLevelText(4, $nation['level']);
echo "
if ($meLevel == 12) :
?>
<table align='center' width='1000' class='tb_layout bg0'>
<tr>
<td colspan='4' height='5'></td>
</tr>
<tr>
<td colspan='4' align='center' bgcolor='purple'>외 교 권 자 임 명</td>
</tr>
<tr>
<td width=98 align=right class='bg1'>외교권자</td>
<td width=398>
<select id="selectAmbassador" multiple="multiple">
</select>
<button id='changeAmbassador' type='button'>임명</button>
</td>
<td width=98 align=right class='bg1'>조언자</td>
<td width=398>
<select id="selectAuditor" multiple="multiple">
</select>
<button id='changeAuditor' type='button'>임명</button>
</td>
</tr>
</table>
<?php
endif;
?>
<table align=center width=1000 id='officer_list' class='tb_layout bg0'>
<tr>
<td colspan=5 height=5></td>
</tr>
<?php
if ($meLevel >= 5) {
$officerLevelText = getOfficerLevelText(4, $nation['level']);
echo "
<tr><td colspan=5 align=center bgcolor=orange>도 시 관 직 임 명</td></tr>
<tr>
<td colspan=3 align=right id=bg2>{$officerLevelText} 임명</td>
<td colspan=3 align=right class='bg2'>{$officerLevelText} 임명</td>
<td colspan=2>
<select id='citylist_4' size=1 style=color:white;background-color:black;>
";
$cityList = $db->query('SELECT city,name,region,officer_set FROM city WHERE nation=%i ORDER BY region,level DESC,binary(name)', $nationID);
$region = 0;
foreach($cityList as $city){
if(isOfficerSet($city['officer_set'], 4)){
continue;
}
$cityList = $db->query('SELECT city,name,region,officer_set FROM city WHERE nation=%i ORDER BY region,level DESC,binary(name)', $nationID);
$region = 0;
foreach ($cityList as $city) {
if (isOfficerSet($city['officer_set'], 4)) {
continue;
}
if($region != $city['region']) {
if($region != 0) {
echo "</optgroup>";
}
echo "<optgroup label=' 【 ".CityConst::$regionMap[$city['region']]." 】 ' style=color:skyblue;>";
$region = $city['region'];
}
if ($region != $city['region']) {
if ($region != 0) {
echo "</optgroup>";
}
echo "<optgroup label=' 【 " . CityConst::$regionMap[$city['region']] . " 】 ' style=color:skyblue;>";
$region = $city['region'];
}
echo "<option value='{$city['city']}' style=color:white;><span class='name_field'>{$city['name']}</span></option>";
}
echo "</optgroup>";
echo "<option value='{$city['city']}' style=color:white;><span class='name_field'>{$city['name']}</span></option>";
}
echo "</optgroup>";
echo "
echo "
</select>
<select id='genlist_4' size=1 style=color:white;background-color:black;>
<option value=0 data-officer_level='0' data-name=''>____공석____</option>
";
foreach($candidateStrength as $general) {
if($general['officer_level'] == 4) {
echo "<option style=color:red; data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
} elseif($general['officer_level'] > 1) {
echo "<option style=color:orange; data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
} else {
echo "<option data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
}
}
foreach ($candidateStrength as $general) {
if ($general['officer_level'] == 4) {
echo "<option style=color:red; data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【" . CityConst::byID($general['city'])->name . "】</option>";
} elseif ($general['officer_level'] > 1) {
echo "<option style=color:orange; data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【" . CityConst::byID($general['city'])->name . "】</option>";
} else {
echo "<option data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【" . CityConst::byID($general['city'])->name . "】</option>";
}
}
echo "
echo "
</select>
<input class='btn_appoint' type=$btn data-officer_level='4' data-officer_level_text='{$officerLevelText}' value=임명>
</td>
</tr>";
$officerLevelText = getOfficerLevelText(3, $nation['level']);
echo "<tr>
<td colspan=3 align=right id=bg2>{$officerLevelText} 임명</td>
$officerLevelText = getOfficerLevelText(3, $nation['level']);
echo "<tr>
<td colspan=3 align=right class='bg2'>{$officerLevelText} 임명</td>
<td colspan=2>
<select id='citylist_3' size=1 style=color:white;background-color:black;>
";
$region = 0;
foreach($cityList as $city){
if(isOfficerSet($city['officer_set'], 3)){
continue;
}
$region = 0;
foreach ($cityList as $city) {
if (isOfficerSet($city['officer_set'], 3)) {
continue;
}
if($region != $city['region']) {
if($region != 0) {
echo "</optgroup>";
}
echo "<optgroup label=' 【 ".CityConst::$regionMap[$city['region']]." 】 ' style=color:skyblue;>";
$region = $city['region'];
}
if ($region != $city['region']) {
if ($region != 0) {
echo "</optgroup>";
}
echo "<optgroup label=' 【 " . CityConst::$regionMap[$city['region']] . " 】 ' style=color:skyblue;>";
$region = $city['region'];
}
echo "<option value='{$city['city']}' style=color:white;><span class='name_field'>{$city['name']}</span></option>";
}
echo "</optgroup>";
echo "<option value='{$city['city']}' style=color:white;><span class='name_field'>{$city['name']}</span></option>";
}
echo "</optgroup>";
echo "
echo "
</select>
<select id='genlist_3' size=1 style=color:white;background-color:black;>
<option value=0 data-officer_level='0' data-name=''>____공석____</option>
";
foreach($candidateIntel as $general) {
if($general['officer_level'] == 3) {
echo "<option style=color:red; data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
} elseif($general['officer_level'] > 1) {
echo "<option style=color:orange; data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
} else {
echo "<option data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
}
}
foreach ($candidateIntel as $general) {
if ($general['officer_level'] == 3) {
echo "<option style=color:red; data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【" . CityConst::byID($general['city'])->name . "】</option>";
} elseif ($general['officer_level'] > 1) {
echo "<option style=color:orange; data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【" . CityConst::byID($general['city'])->name . "】</option>";
} else {
echo "<option data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【" . CityConst::byID($general['city'])->name . "】</option>";
}
}
echo "
echo "
</select>
<input class='btn_appoint' type=$btn data-officer_level='3' data-officer_level_text='{$officerLevelText}' value=임명>
</td>
</tr>";
$officerLevelText = getOfficerLevelText(2, $nation['level']);
echo "<tr>
<td colspan=3 align=right id=bg2>{$officerLevelText} 임명</td>
$officerLevelText = getOfficerLevelText(2, $nation['level']);
echo "<tr>
<td colspan=3 align=right class='bg2'>{$officerLevelText} 임명</td>
<td colspan=2>
<select id='citylist_2' size=1 style=color:white;background-color:black;>
";
$region = 0;
foreach($cityList as $city){
if(isOfficerSet($city['officer_set'], 2)){
continue;
}
$region = 0;
foreach ($cityList as $city) {
if (isOfficerSet($city['officer_set'], 2)) {
continue;
}
if($region != $city['region']) {
if($region != 0) {
echo "</optgroup>";
}
echo "<optgroup label=' 【 ".CityConst::$regionMap[$city['region']]." 】 ' style=color:skyblue;>";
$region = $city['region'];
}
if ($region != $city['region']) {
if ($region != 0) {
echo "</optgroup>";
}
echo "<optgroup label=' 【 " . CityConst::$regionMap[$city['region']] . " 】 ' style=color:skyblue;>";
$region = $city['region'];
}
echo "<option value='{$city['city']}' style=color:white;><span class='name_field'>{$city['name']}</span></option>";
}
echo "</optgroup>";
echo "<option value='{$city['city']}' style=color:white;><span class='name_field'>{$city['name']}</span></option>";
}
echo "</optgroup>";
echo "
echo "
</select>
<select id='genlist_2' size=1 style=color:white;background-color:black;>
<option value=0>____<span class='name_field'>공석</span>____</option>
";
foreach ($candidateAny as $general) {
if($general['officer_level'] == 2) {
echo "<option style=color:red; data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
} elseif($general['officer_level'] > 1) {
echo "<option style=color:orange; data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
} else {
echo "<option data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【".CityConst::byID($general['city'])->name."】</option>";
}
}
foreach ($candidateAny as $general) {
if ($general['officer_level'] == 2) {
echo "<option style=color:red; data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【" . CityConst::byID($general['city'])->name . "】</option>";
} elseif ($general['officer_level'] > 1) {
echo "<option style=color:orange; data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【" . CityConst::byID($general['city'])->name . "】</option>";
} else {
echo "<option data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} 【" . CityConst::byID($general['city'])->name . "】</option>";
}
}
echo "
echo "
</select>
<input class='btn_appoint' type=$btn data-officer_level='2' data-officer_level_text='{$officerLevelText}' value=임명>
</td>
</tr>
<tr><td colspan=5>※ <font color=red>빨간색</font>은 현재 임명중인 장수, <font color=orange>노란색</font>은 다른 관직에 임명된 장수, 하얀색은 일반 장수를 뜻합니다.</td></tr>
";
}
echo "
}
echo "
<tr>
<td width=158 align=center id=bg1 colspan=2><font size=4>도 시</font></td>
<td width=278 align=center id=bg1><font size=4>태 수 (사관) 【현재도시】</font></td>
<td width=278 align=center id=bg1><font size=4>군 사 (사관) 【현재도시】</font></td>
<td width=278 align=center id=bg1><font size=4>종 사 (사관) 【현재도시】</font></td>
<td width=158 align=center class='bg1' colspan=2><font size=4>도 시</font></td>
<td width=278 align=center class='bg1'><font size=4>태 수 (사관) 【현재도시】</font></td>
<td width=278 align=center class='bg1'><font size=4>군 사 (사관) 【현재도시】</font></td>
<td width=278 align=center class='bg1'><font size=4>종 사 (사관) 【현재도시】</font></td>
</tr>
";
$citylevel = getCityLevelList();
$citylevel = getCityLevelList();
$officerList = [];
$officerList = [];
foreach($db->query('SELECT no,name,npc,city,officer_level,officer_city,belong FROM general WHERE nation = %i AND 2 <= officer_level AND officer_level <= 4', $nationID) as $officer){
$officerCityID = $officer['officer_city'];
if(!key_exists($officerCityID, $officerList)){
$officerList[$officerCityID] = [];
}
$officerList[$officerCityID][$officer['officer_level']] = $officer;
}
foreach ($db->query('SELECT no,name,npc,city,officer_level,officer_city,belong FROM general WHERE nation = %i AND 2 <= officer_level AND officer_level <= 4', $nationID) as $officer) {
$officerCityID = $officer['officer_city'];
if (!key_exists($officerCityID, $officerList)) {
$officerList[$officerCityID] = [];
}
$officerList[$officerCityID][$officer['officer_level']] = $officer;
}
$region = 0;
$dummyOfficer = [
'name'=>'-',
'belong'=>0,
];
$region = 0;
$dummyOfficer = [
'name' => '-',
'belong' => 0,
];
$textColor = newColor($nation['color']);
$nationColor = $nation['color'];
$textColor = newColor($nation['color']);
$nationColor = $nation['color'];
foreach($db->query('SELECT city,name,level,region,officer_set from city where nation=%i order by region,level desc,binary(name)', $nationID) as $city) {
$cityID = $city['city'];
$cityOfficerList = $officerList[$cityID]??[];
?>
<?php if($region != $city['region']): ?>
<tr><td colspan=5 height=3 id=bg1></td></tr>
<tr><td colspan=5 id=bg1><font size=4 color=skyblue> 【 <?=CityConst::$regionMap[$city['region']]?> 】 </font></td></tr>
<?php endif; $region = $city['region']; ?>
<tr>
<td width=78 align=center style='color:<?=$textColor?>;background-color:<?=$nationColor?>;font-size:1.2em;'>【<?=$citylevel[$city['level']]?>】</td>
<td width=78 align=right style='color:<?=$textColor?>;background-color:<?=$nationColor?>;font-size:1.2em;'><?=$city['name']?>&nbsp;&nbsp;</td>
foreach ($db->query('SELECT city,name,level,region,officer_set from city where nation=%i order by region,level desc,binary(name)', $nationID) as $city) {
$cityID = $city['city'];
$cityOfficerList = $officerList[$cityID] ?? [];
?>
<?php if ($region != $city['region']) : ?>
<tr>
<td colspan=5 height=3 class='bg1'></td>
</tr>
<tr>
<td colspan=5 class='bg1'>
<font size=4 color=skyblue> 【 <?= CityConst::$regionMap[$city['region']] ?> 】 </font>
</td>
</tr>
<?php endif;
$region = $city['region']; ?>
<tr>
<td width=78 align=center style='color:<?= $textColor ?>;background-color:<?= $nationColor ?>;font-size:1.2em;'>【<?= $citylevel[$city['level']] ?>】</td>
<td width=78 align=right style='color:<?= $textColor ?>;background-color:<?= $nationColor ?>;font-size:1.2em;'><?= $city['name'] ?>&nbsp;&nbsp;</td>
<?php foreach(Util::range(4, 1, -1) as $officerLevel): ?>
<?php if(key_exists($officerLevel, $cityOfficerList)):
$officer = $cityOfficerList[$officerLevel];
?>
<td style="color:<?=isOfficerSet($city['officer_set'], $officerLevel)?'orange':'white'?>;"><?=$officer['name']?>(<?=$officer['belong']?>년) 【<?=CityConst::byID($officer['city'])->name?>】</td>
<?php else: ?>
<td>-</td>
<?php endif; ?>
<?php endforeach; ?>
</tr>
<?php
<?php foreach (Util::range(4, 1, -1) as $officerLevel) : ?>
<?php if (key_exists($officerLevel, $cityOfficerList)) :
$officer = $cityOfficerList[$officerLevel];
?>
<td style="color:<?= isOfficerSet($city['officer_set'], $officerLevel) ? 'orange' : 'white' ?>;"><?= $officer['name'] ?>(<?= $officer['belong'] ?>년) 【<?= CityConst::byID($officer['city'])->name ?>】</td>
<?php else : ?>
<td>-</td>
<?php endif; ?>
<?php endforeach; ?>
</tr>
<?php
}
?>
<tr><td colspan=5>※ <font color=orange>노란색</font>은 변경 불가능, 하얀색은 변경 가능 관직입니다.</td></tr>
</table>
<br>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td><?=backButton()?></td></tr>
<tr><td><?=banner()?></td></tr>
</table>
}
?>
<tr>
<td colspan=5>※ <font color=orange>노란색</font>은 변경 불가능, 하얀색은 변경 가능 관직입니다.</td>
</tr>
</table>
<br>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td><?= backButton() ?></td>
</tr>
<tr>
<td><?= banner() ?></td>
</tr>
</table>
</body>
</html>
</html>
+186 -140
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -31,182 +32,227 @@ $sel = [$type => "selected"];
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?=UniqueConst::$serverName?>: 세력도시</title>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('../e_lib/jquery-ui.min.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('../e_lib/jquery-ui.min.js')?>
<?=WebUtil::printJS('js/common.js')?>
<?=WebUtil::printJS('js/ext.expand_city.js')?>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?= UniqueConst::$serverName ?>: 세력도시</title>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printDist('ts', ['common', 'extExpandCity']) ?>
</head>
<body>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td>세 력 도 시<br><?=backButton()?></td></tr>
<tr><td><form name=form1 method=post>정렬순서 :
<select name=type size=1>
<option <?=$sel[1]??''?> value=1>기본</option>
<option <?=$sel[2]??''?> value=2>인구</option>
<option <?=$sel[3]??''?> value=3>인구율</option>
<option <?=$sel[4]??''?> value=4>민심</option>
<option <?=$sel[5]??''?> value=5>농업</option>
<option <?=$sel[6]??''?> value=6>상업</option>
<option <?=$sel[7]??''?> value=7>치안</option>
<option <?=$sel[8]??''?> value=8>수비</option>
<option <?=$sel[9]??''?> value=9>성벽</option>
<option <?=$sel[10]??''?> value=10>시세</option>
<option <?=$sel[11]??''?> value=11>지역</option>
<option <?=$sel[12]??''?> value=12>규모</option>
</select>
<input type=submit value='정렬하기'></form>
</td></tr>
</table>
<?php
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td>세 력 도 시<br><?= backButton() ?></td>
</tr>
<tr>
<td>
<form name=form1 method=post>정렬순서 :
<select name=type size=1>
<option <?= $sel[1] ?? '' ?> value=1>기본</option>
<option <?= $sel[2] ?? '' ?> value=2>인구</option>
<option <?= $sel[3] ?? '' ?> value=3>인구율</option>
<option <?= $sel[4] ?? '' ?> value=4>민심</option>
<option <?= $sel[5] ?? '' ?> value=5>농업</option>
<option <?= $sel[6] ?? '' ?> value=6>상업</option>
<option <?= $sel[7] ?? '' ?> value=7>치안</option>
<option <?= $sel[8] ?? '' ?> value=8>수비</option>
<option <?= $sel[9] ?? '' ?> value=9>성벽</option>
<option <?= $sel[10] ?? '' ?> value=10>시세</option>
<option <?= $sel[11] ?? '' ?> value=11>지역</option>
<option <?= $sel[12] ?? '' ?> value=12>규모</option>
</select>
<input type=submit value='정렬하기'>
</form>
</td>
</tr>
</table>
<?php
$nation = getNationStaticInfo($me['nation']); //국가정보
$nation = getNationStaticInfo($me['nation']); //국가정보
$officerList = [];
foreach($db->query('SELECT no,name,npc,city,officer_level,officer_city,belong FROM general WHERE nation = %i AND 2 <= officer_level AND officer_level <= 4', $nationID) as $officer){
$officerCityID = $officer['officer_city'];
if(!key_exists($officerCityID, $officerList)){
$officerList[$officerCityID] = [];
}
$officerList[$officerCityID][$officer['officer_level']] = $officer;
}
$cityList = $db->query('SELECT *,pop/pop_max as poprate from city where nation=%i', $nationID);
switch ($type) {
case 1: break;
case 2: usort($cityList, function($lhs, $rhs){return $rhs['pop'] <=> $lhs['pop'];}); break;
case 3: usort($cityList, function($lhs, $rhs){return $rhs['poprate'] <=> $lhs['poprate'];}); break;
case 4: usort($cityList, function($lhs, $rhs){return $rhs['trust'] <=> $lhs['trust'];}); break;
case 5: usort($cityList, function($lhs, $rhs){return $rhs['agri'] <=> $lhs['agri'];}); break;
case 6: usort($cityList, function($lhs, $rhs){return $rhs['comm'] <=> $lhs['comm'];}); break;
case 7: usort($cityList, function($lhs, $rhs){return $rhs['secu'] <=> $lhs['secu'];}); break;
case 8: usort($cityList, function($lhs, $rhs){return $rhs['def'] <=> $lhs['def'];}); break;
case 9: usort($cityList, function($lhs, $rhs){return $rhs['wall'] <=> $lhs['wall'];}); break;
case 10: usort($cityList, function($lhs, $rhs){return $rhs['trade'] <=> $lhs['trade'];}); break;
case 11: usort($cityList, function($lhs, $rhs){
$cmpTrust = $lhs['region'] <=> $rhs['region'];
if($cmpTrust != 0){
return $cmpTrust;
$officerList = [];
foreach ($db->query('SELECT no,name,npc,city,officer_level,officer_city,belong FROM general WHERE nation = %i AND 2 <= officer_level AND officer_level <= 4', $nationID) as $officer) {
$officerCityID = $officer['officer_city'];
if (!key_exists($officerCityID, $officerList)) {
$officerList[$officerCityID] = [];
}
return $rhs['level']<=>$lhs['level'];
}); break;
case 12: usort($cityList, function($lhs, $rhs){
$cmpTrust = $rhs['level'] <=> $lhs['level'];
if($cmpTrust != 0){
return $cmpTrust;
$officerList[$officerCityID][$officer['officer_level']] = $officer;
}
$cityList = $db->query('SELECT *,pop/pop_max as poprate from city where nation=%i', $nationID);
switch ($type) {
case 1:
break;
case 2:
usort($cityList, function ($lhs, $rhs) {
return $rhs['pop'] <=> $lhs['pop'];
});
break;
case 3:
usort($cityList, function ($lhs, $rhs) {
return $rhs['poprate'] <=> $lhs['poprate'];
});
break;
case 4:
usort($cityList, function ($lhs, $rhs) {
return $rhs['trust'] <=> $lhs['trust'];
});
break;
case 5:
usort($cityList, function ($lhs, $rhs) {
return $rhs['agri'] <=> $lhs['agri'];
});
break;
case 6:
usort($cityList, function ($lhs, $rhs) {
return $rhs['comm'] <=> $lhs['comm'];
});
break;
case 7:
usort($cityList, function ($lhs, $rhs) {
return $rhs['secu'] <=> $lhs['secu'];
});
break;
case 8:
usort($cityList, function ($lhs, $rhs) {
return $rhs['def'] <=> $lhs['def'];
});
break;
case 9:
usort($cityList, function ($lhs, $rhs) {
return $rhs['wall'] <=> $lhs['wall'];
});
break;
case 10:
usort($cityList, function ($lhs, $rhs) {
return $rhs['trade'] <=> $lhs['trade'];
});
break;
case 11:
usort($cityList, function ($lhs, $rhs) {
$cmpTrust = $lhs['region'] <=> $rhs['region'];
if ($cmpTrust != 0) {
return $cmpTrust;
}
return $rhs['level'] <=> $lhs['level'];
});
break;
case 12:
usort($cityList, function ($lhs, $rhs) {
$cmpTrust = $rhs['level'] <=> $lhs['level'];
if ($cmpTrust != 0) {
return $cmpTrust;
}
return $lhs['region'] <=> $rhs['region'];
});
break;
}
$region = 0;
$level = 0;
foreach ($cityList as $city) {
$cityID = $city['city'];
if ($city['city'] == $nation['capital']) {
$city['name'] = "<font color=cyan>[{$city['name']}]</font>";
}
return $lhs['region']<=>$rhs['region'];
}); break;
}
$region = 0;
$level = 0;
$officerQuery = [];
$officerName = [
2 => '-',
3 => '-',
4 => '-'
];
foreach($cityList as $city){
$cityID = $city['city'];
if ($city['city'] == $nation['capital']) {
$city['name'] = "<font color=cyan>[{$city['name']}]</font>";
}
$cityOfficerList = $officerList[$cityID] ?? [];
foreach ($cityOfficerList as $cityOfficer) {
$officerName[$cityOfficer['officer_level']] = getColoredName($cityOfficer['name'], $cityOfficer['npc']);
}
$officerQuery = [];
$officerName = [
2=>'-',
3=>'-',
4=>'-'
];
if ($type == 10 && $city['region'] != $region) {
echo "<br>";
$region = $city['region'];
} elseif ($type == 11 && $city['level'] != $level) {
echo "<br>";
$level = $city['level'];
}
$cityOfficerList = $officerList[$cityID]??[];
foreach($cityOfficerList as $cityOfficer){
$officerName[$cityOfficer['officer_level']] = getColoredName($cityOfficer['name'], $cityOfficer['npc']);
}
if ($type == 10 && $city['region'] != $region) {
echo "<br>";
$region = $city['region'];
} elseif ($type == 11 && $city['level'] != $level) {
echo "<br>";
$level = $city['level'];
}
if ($city['trade'] === null) {
$city['trade'] = "- ";
}
if ($city['trade'] === null) {
$city['trade'] = "- ";
}
echo "
echo "
<table align=center width=1000 class='tb_layout bg2'>
<tr>
<td colspan=12 style=color:".newColor($nation['color'])."; bgcolor={$nation['color']}><font size=2>【 ".CityConst::$regionMap[$city['region']]." | ".CityConst::$levelMap[$city['level']]." 】 {$city['name']}</font></td>
<td colspan=12 style=color:" . newColor($nation['color']) . "; bgcolor={$nation['color']}><font size=2>【 " . CityConst::$regionMap[$city['region']] . " | " . CityConst::$levelMap[$city['level']] . " 】 {$city['name']}</font></td>
</tr>
<tr>
<td align=center width=46 id=bg1>주민</td>
<td align=center width=46 class='bg1'>주민</td>
<td align=center width=140>{$city['pop']}/{$city['pop_max']}</td>
<td align=center width=46 id=bg1>농업</td>
<td align=center width=46 class='bg1'>농업</td>
<td align=center width=140>{$city['agri']}/{$city['agri_max']}</td>
<td align=center width=46 id=bg1>상업</td>
<td align=center width=46 class='bg1'>상업</td>
<td align=center width=140>{$city['comm']}/{$city['comm_max']}</td>
<td align=center width=46 id=bg1>치안</td>
<td align=center width=46 class='bg1'>치안</td>
<td align=center width=140>{$city['secu']}/{$city['secu_max']}</td>
<td align=center width=46 id=bg1>수비</td>
<td align=center width=46 class='bg1'>수비</td>
<td align=center width=140>{$city['def']}/{$city['def_max']}</td>
<td align=center width=46 id=bg1>성벽</td>
<td align=center width=46 class='bg1'>성벽</td>
<td align=center width=140>{$city['wall']}/{$city['wall_max']}</td>
</tr>
<tr>
<td align=center id=bg1>민심</td>
<td align=center>".round($city['trust'], 1)."</td>
<td align=center id=bg1>시세</td>
<td align=center class='bg1'>민심</td>
<td align=center>" . round($city['trust'], 1) . "</td>
<td align=center class='bg1'>시세</td>
<td align=center>{$city['trade']}%</td>
<td align=center id=bg1>인구</td>
<td align=center>".round($city['pop']/$city['pop_max']*100, 2)." %</td>
<td align=center id=bg1>태수</td>
<td align=center class='bg1'>인구</td>
<td align=center>" . round($city['pop'] / $city['pop_max'] * 100, 2) . " %</td>
<td align=center class='bg1'>태수</td>
<td align=center>";
echo $officerName[4];
echo "</td>
<td align=center id=bg1>군사</td>
echo $officerName[4];
echo "</td>
<td align=center class='bg1'>군사</td>
<td align=center>";
echo $officerName[3];
echo "</td>
<td align=center id=bg1>종사</td>
echo $officerName[3];
echo "</td>
<td align=center class='bg1'>종사</td>
<td align=center>";
echo $officerName[2];
echo "</td>
echo $officerName[2];
echo "</td>
</tr>
<tr>
<td align=center id=bg1>장수</td>
<td align=center class='bg1'>장수</td>
<td colspan=11>";
$generalList = $db->query('SELECT npc, name FROM general WHERE city = %i AND nation = %i', $city['city'], $me['nation']);
if (!$generalList) {
echo "-";
}
foreach($generalList as $general) {
echo getColoredName($general['name'], $general['npc']).', ';
}
echo "
$generalList = $db->query('SELECT npc, name FROM general WHERE city = %i AND nation = %i', $city['city'], $me['nation']);
if (!$generalList) {
echo "-";
}
foreach ($generalList as $general) {
echo getColoredName($general['name'], $general['npc']) . ', ';
}
echo "
</td>
</tr>
</table>
";
}
?>
}
?>
<table align=center width=1000 class='tb_layout bg0 anchor'>
<tr><td><?=backButton()?></td></tr>
<tr><td><?=banner()?></td></tr>
</table>
<table align=center width=1000 class='tb_layout bg0 anchor'>
<tr>
<td><?= backButton() ?></td>
</tr>
<tr>
<td><?= banner() ?></td>
</tr>
</table>
</body>
<div id="helper_genlist" style="display:none;"></div>
</html>
</html>
+130 -116
View File
@@ -1,11 +1,12 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
$type = Util::getReq('type', 'int', 1);
if($type <= 0 || $type > 15) {
if ($type <= 0 || $type > 15) {
$type = 1;
}
@@ -20,7 +21,7 @@ increaseRefresh("세력장수", 1);
$me = $db->queryFirstRow('SELECT no,nation,officer_level from general where owner=%i', $userID);
if($me['officer_level'] == 0) {
if ($me['officer_level'] == 0) {
echo "재야입니다.";
exit();
}
@@ -28,8 +29,8 @@ if($me['officer_level'] == 0) {
$sel = [$type => "selected"];
$ownerNameList = [];
if($gameStor->isunited){
foreach(RootDB::db()->queryAllLists('SELECT no, name FROM member') as [$ownerID, $ownerName]){
if ($gameStor->isunited) {
foreach (RootDB::db()->queryAllLists('SELECT no, name FROM member') as [$ownerID, $ownerName]) {
$ownerNameList[$ownerID] = $ownerName;
}
}
@@ -40,147 +41,160 @@ if($gameStor->isunited){
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?=UniqueConst::$serverName?>: 세력장수</title>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('js/common.js')?>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?= UniqueConst::$serverName ?>: 세력장수</title>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printDist('ts', ['common']) ?>
</head>
<body>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td>세 력 장 수<br><?=backButton()?></td></tr>
<tr><td><form name=form1 method=post>정렬순서 :
<select name=type size=1>
<option <?=$sel[1]??''?> value=1>관직</option>
<option <?=$sel[2]??''?> value=2>계급</option>
<option <?=$sel[3]??''?> value=3>명성</option>
<option <?=$sel[4]??''?> value=4>통솔</option>
<option <?=$sel[5]??''?> value=5>무력</option>
<option <?=$sel[6]??''?> value=6>지력</option>
<option <?=$sel[7]??''?> value=7>자금</option>
<option <?=$sel[8]??''?> value=8>군량</option>
<option <?=$sel[9]??''?> value=9>병사</option>
<option <?=$sel[10]??''?> value=10>벌점</option>
<option <?=$sel[11]??''?> value=11>성격</option>
<option <?=$sel[12]??''?> value=12>내특</option>
<option <?=$sel[13]??''?> value=13>전특</option>
<option <?=$sel[14]??''?> value=14>사관</option>
<option <?=$sel[15]??''?> value=15>NPC</option>
</select>
<input type=submit value='정렬하기'></form>
</td></tr>
</table>
<?php
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td>세 력 장 수<br><?= backButton() ?></td>
</tr>
<tr>
<td>
<form name=form1 method=post>정렬순서 :
<select name=type size=1>
<option <?= $sel[1] ?? '' ?> value=1>관직</option>
<option <?= $sel[2] ?? '' ?> value=2>계급</option>
<option <?= $sel[3] ?? '' ?> value=3>명성</option>
<option <?= $sel[4] ?? '' ?> value=4>통솔</option>
<option <?= $sel[5] ?? '' ?> value=5>무력</option>
<option <?= $sel[6] ?? '' ?> value=6>지력</option>
<option <?= $sel[7] ?? '' ?> value=7>자금</option>
<option <?= $sel[8] ?? '' ?> value=8>군량</option>
<option <?= $sel[9] ?? '' ?> value=9>병사</option>
<option <?= $sel[10] ?? '' ?> value=10>벌점</option>
<option <?= $sel[11] ?? '' ?> value=11>성격</option>
<option <?= $sel[12] ?? '' ?> value=12>내특</option>
<option <?= $sel[13] ?? '' ?> value=13>전특</option>
<option <?= $sel[14] ?? '' ?> value=14>사관</option>
<option <?= $sel[15] ?? '' ?> value=15>NPC</option>
</select>
<input type=submit value='정렬하기'>
</form>
</td>
</tr>
</table>
<?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']);
[$orderKey, $orderDesc] = [
1=>['officer_level', true],
2=>['dedication', true],
3=>['experience', true],
4=>['leadership', true],
5=>['strength', true],
6=>['intel', true],
7=>['gold', true],
8=>['rice', true],
9=>['crew', true],
10=>['connect', true],
11=>['personal', true],
12=>['special', true],
13=>['special2', true],
14=>['belong', true],
15=>['npc', true],
][$type];
[$orderKey, $orderDesc] = [
1 => ['officer_level', true],
2 => ['dedication', true],
3 => ['experience', true],
4 => ['leadership', true],
5 => ['strength', true],
6 => ['intel', true],
7 => ['gold', true],
8 => ['rice', true],
9 => ['crew', true],
10 => ['connect', true],
11 => ['personal', true],
12 => ['special', true],
13 => ['special2', true],
14 => ['belong', true],
15 => ['npc', true],
][$type];
$generalList = $db->query('SELECT owner,no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leadership,strength,intel,experience,dedication,officer_level,killturn,connect,gold,rice,crew,belong from general where nation = %i order by %b %l', $me['nation'], $orderKey, $orderDesc?'desc':'');
$generalList = $db->query('SELECT owner,no,picture,imgsvr,npc,age,nation,special,special2,personal,name,injury,leadership,strength,intel,experience,dedication,officer_level,killturn,connect,gold,rice,crew,belong from general where nation = %i order by %b %l', $me['nation'], $orderKey, $orderDesc ? 'desc' : '');
echo"
echo "
<table align=center class='tb_layout bg0'>
<tr>
<td width=64 align=center id=bg1>얼 굴</td>
<td width=98 align=center id=bg1>이 름</td>
<td width=78 align=center id=bg1>관 직</td>
<td width=68 align=center id=bg1>계 급</td>
<td width=68 align=center id=bg1>명 성</td>
<td width=68 align=center id=bg1>봉 록</td>
<td width=48 align=center id=bg1>통솔</td>
<td width=48 align=center id=bg1>무력</td>
<td width=48 align=center id=bg1>지력</td>
<td width=68 align=center id=bg1>자 금</td>
<td width=68 align=center id=bg1>군 량</td>
<td width=48 align=center id=bg1>성 격</td>
<td width=78 align=center id=bg1>특 기</td>
<td width=48 align=center id=bg1>사 관</td>
<td width=70 align=center id=bg1>벌점</td>
<td width=64 align=center class='bg1'>얼 굴</td>
<td width=98 align=center class='bg1'>이 름</td>
<td width=78 align=center class='bg1'>관 직</td>
<td width=68 align=center class='bg1'>계 급</td>
<td width=68 align=center class='bg1'>명 성</td>
<td width=68 align=center class='bg1'>봉 록</td>
<td width=48 align=center class='bg1'>통솔</td>
<td width=48 align=center class='bg1'>무력</td>
<td width=48 align=center class='bg1'>지력</td>
<td width=68 align=center class='bg1'>자 금</td>
<td width=68 align=center class='bg1'>군 량</td>
<td width=48 align=center class='bg1'>성 격</td>
<td width=78 align=center class='bg1'>특 기</td>
<td width=48 align=center class='bg1'>사 관</td>
<td width=70 align=center class='bg1'>벌점</td>
</tr>";
foreach($generalList as $general){
foreach ($generalList as $general) {
$lbonus = calcLeadershipBonus($general['officer_level'], $nationLevel);
if($lbonus > 0) {
$lbonus = "<font color=cyan>+{$lbonus}</font>";
} else {
$lbonus = "";
}
$lbonus = calcLeadershipBonus($general['officer_level'], $nationLevel);
if ($lbonus > 0) {
$lbonus = "<font color=cyan>+{$lbonus}</font>";
} else {
$lbonus = "";
}
if($general['injury'] > 0) {
$leadership = intdiv($general['leadership'] * (100 - $general['injury']), 100);
$strength = intdiv($general['strength'] * (100 - $general['injury']), 100);
$intel = intdiv($general['intel'] * (100 - $general['injury']), 100);
$leadership = "<font color=red>{$leadership}</font>{$lbonus}";
$strength = "<font color=red>{$strength}</font>";
$intel = "<font color=red>{$intel}</font>";
} else {
$leadership = "{$general['leadership']}{$lbonus}";
$strength = "{$general['strength']}";
$intel = "{$general['intel']}";
}
if ($general['injury'] > 0) {
$leadership = intdiv($general['leadership'] * (100 - $general['injury']), 100);
$strength = intdiv($general['strength'] * (100 - $general['injury']), 100);
$intel = intdiv($general['intel'] * (100 - $general['injury']), 100);
$leadership = "<font color=red>{$leadership}</font>{$lbonus}";
$strength = "<font color=red>{$strength}</font>";
$intel = "<font color=red>{$intel}</font>";
} else {
$leadership = "{$general['leadership']}{$lbonus}";
$strength = "{$general['strength']}";
$intel = "{$general['intel']}";
}
if($general['npc'] >= 2) { $name = "<font color=cyan>{$general['name']}</font>"; }
elseif($general['npc'] == 1) { $name = "<font color=skyblue>{$general['name']}</font>"; }
else { $name = "{$general['name']}"; }
if ($general['npc'] >= 2) {
$name = "<font color=cyan>{$general['name']}</font>";
} elseif ($general['npc'] == 1) {
$name = "<font color=skyblue>{$general['name']}</font>";
} else {
$name = "{$general['name']}";
}
if(key_exists($general['owner'], $ownerNameList)){
$name = $name.'<br><small>('.$ownerNameList[$general['owner']].')</small>';
}
if (key_exists($general['owner'], $ownerNameList)) {
$name = $name . '<br><small>(' . $ownerNameList[$general['owner']] . ')</small>';
}
$imageTemp = GetImageURL($general['imgsvr']);
echo "
$imageTemp = GetImageURL($general['imgsvr']);
echo "
<tr>
<td align=center class='generalIcon' style='background:no-repeat center url(\"{$imageTemp}/{$general['picture']}\");background-size:64px;' height=64></td>
<td align=center>$name</td>
<td align=center>"; echo getOfficerLevelText($general['officer_level'], $nationLevel); echo "</td>
<td align=center>".getDed($general['dedication'])."</td>
<td align=center>".getHonor($general['experience'])."</td>
<td align=center>".getBill($general['dedication'])."</td>
<td align=center>";
echo getOfficerLevelText($general['officer_level'], $nationLevel);
echo "</td>
<td align=center>" . getDed($general['dedication']) . "</td>
<td align=center>" . getHonor($general['experience']) . "</td>
<td align=center>" . getBill($general['dedication']) . "</td>
<td align=center>$leadership</td>
<td align=center>$strength</td>
<td align=center>$intel</td>
<td align=center>{$general['gold']}</td>
<td align=center>{$general['rice']}</td>
<td align=center>".displayCharInfo($general['personal'])."</td>
<td align=center>".displaySpecialDomesticInfo($general['special'])." / ".displaySpecialWarInfo($general['special2'])."</td>
<td align=center>" . displayCharInfo($general['personal']) . "</td>
<td align=center>" . displaySpecialDomesticInfo($general['special']) . " / " . displaySpecialWarInfo($general['special2']) . "</td>
<td align=center>{$general['belong']}</td>
<td align=center>{$general['connect']}"; echo "<br>(".getConnect($general['connect']).")</td>
<td align=center>{$general['connect']}";
echo "<br>(" . getConnect($general['connect']) . ")</td>
</tr>";
}
}
echo "
</table>
";
?>
?>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td><?=backButton()?></td></tr>
<tr><td><?=banner()?></td></tr>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td><?= backButton() ?></td>
</tr>
<tr>
<td><?= banner() ?></td>
</tr>
</table>
</body>
</html>
</html>
+127 -125
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -14,7 +15,7 @@ increaseRefresh("세력정보", 1);
$nationID = $db->queryFirstField('SELECT nation FROM general WHERE owner=%i', $userID);
if($nationID == 0) {
if ($nationID == 0) {
echo "재야입니다.";
exit();
}
@@ -23,139 +24,140 @@ if($nationID == 0) {
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?=UniqueConst::$serverName?>: 세력정보</title>
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('js/common.js')?>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?= UniqueConst::$serverName ?>: 세력정보</title>
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printDist('ts', ['common']) ?>
</head>
<body>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td>세 력 정 보<br><?=backButton()?></td></tr>
</table>
<br>
<?php
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td>세 력 정 보<br><?= backButton() ?></td>
</tr>
</table>
<br>
<?php
$nation = $db->queryFirstRow('SELECT nation,gennum,power,rate,bill,type,gold,rice,color,name,level,tech,capital FROM nation WHERE nation=%i', $nationID); //국가정보
$cityList = $db->query('SELECT * FROM city WHERE nation=%i', $nationID);
$nation = $db->queryFirstRow('SELECT nation,gennum,power,rate,bill,type,gold,rice,color,name,level,tech,capital FROM nation WHERE nation=%i', $nationID); //국가정보
$cityList = $db->query('SELECT * FROM city WHERE nation=%i', $nationID);
$currPop = 0;
$maxPop = 0;
$cityNames = [];
$currPop = 0;
$maxPop = 0;
$cityNames = [];
foreach($cityList as $city){
$currPop += $city['pop'];
$maxPop += $city['pop_max'];
if($city['city'] == $nation['capital']){
$cityNames[] = "<span style='color:cyan;'>{$city['name']}</span>";
foreach ($cityList as $city) {
$currPop += $city['pop'];
$maxPop += $city['pop_max'];
if ($city['city'] == $nation['capital']) {
$cityNames[] = "<span style='color:cyan;'>{$city['name']}</span>";
} else {
$cityNames[] = $city['name'];
}
}
else{
$cityNames[] = $city['name'];
[$currCrew, $maxCrew] = $db->queryFirstList('SELECT sum(crew), sum(leadership)*100 FROM general WHERE nation=%i AND npc != 5', $nation['nation']);
$dedicationList = $db->query('SELECT dedication FROM general WHERE nation=%i AND npc!=5', $nationID);
$goldIncome = getGoldIncome($nation['nation'], $nation['level'], $nation['rate'], $nation['capital'], $nation['type'], $cityList);
$warIncome = getWarGoldIncome($nation['type'], $cityList);
$totalGoldIncome = $goldIncome + $warIncome;
$riceIncome = getRiceIncome($nation['nation'], $nation['level'], $nation['rate'], $nation['capital'], $nation['type'], $cityList);
$wallIncome = getWallIncome($nation['nation'], $nation['level'], $nation['rate'], $nation['capital'], $nation['type'], $cityList);
$totalRiceIncome = $riceIncome + $wallIncome;
$outcome = getOutcome($nation['bill'], $dedicationList);
$budgetgold = $nation['gold'] + $totalGoldIncome - $outcome;
$budgetrice = $nation['rice'] + $totalRiceIncome - $outcome;
$budgetgolddiff = $totalGoldIncome - $outcome;
$budgetricediff = $totalRiceIncome - $outcome;
if ($budgetgolddiff > 0) {
$budgetgolddiff = '+' . number_format($budgetgolddiff);
} else {
$budgetgolddiff = number_format($budgetgolddiff);
}
if ($budgetricediff > 0) {
$budgetricediff = '+' . number_format($budgetricediff);
} else {
$budgetricediff = number_format($budgetricediff);
}
}
[$currCrew, $maxCrew] = $db->queryFirstList('SELECT sum(crew), sum(leadership)*100 FROM general WHERE nation=%i AND npc != 5', $nation['nation']);
$dedicationList = $db->query('SELECT dedication FROM general WHERE nation=%i AND npc!=5', $nationID);
?>
<table align=center width=1000 class='tb_layout bg2'>
<tr>
<td colspan=8 align=center style='color:<?= newColor($nation['color']) ?>;background-color:<?= $nation['color'] ?>'>【<?= $nation['name'] ?>】</td>
</tr>
<tr>
<td width=98 align=center class='bg1'>총주민</td>
<td width=198 align=center><?= number_format($currPop) ?>/<?= number_format($maxPop) ?></td>
<td width=98 align=center class='bg1'>총병사</td>
<td width=198 align=center><?= number_format($currCrew) ?>/<?= number_format($maxCrew) ?></td>
<td width=98 align=center class='bg1'>국 력</td>
<td width=298 align=center colspan=3><?= $nation['power'] ?></td>
</tr>
<tr>
<td align=center class='bg1'>국 고</td>
<td align=center><?= number_format($nation['gold']) ?></td>
<td align=center class='bg1'>병 량</td>
<td align=center><?= number_format($nation['rice']) ?></td>
<td align=center class='bg1'>세 율</td>
<td align=center colspan=3><?= $nation['rate'] ?> %</td>
</td>
</tr>
<tr>
<td align=center class='bg1'>세금/단기</td>
<td align=center>+<?= number_format($goldIncome) ?> / +<?= number_format($warIncome) ?></td>
<td align=center class='bg1'>세곡/둔전</td>
<td align=center>+<?= number_format($riceIncome) ?> / +<?= number_format($wallIncome) ?></td>
<td align=center class='bg1'>지급률</td>
<td align=center colspan=3><?= $nation['bill'] ?> %</td>
</tr>
<tr>
<td align=center class='bg1'>수입/지출</td>
<td align=center>+<?= number_format($totalGoldIncome) ?> / -<?= number_format($outcome) ?></td>
<td align=center class='bg1'>수입/지출</td>
<td align=center>+<?= number_format($totalRiceIncome) ?> / -<?= number_format($outcome) ?></td>
<td align=center class='bg1'>속 령</td>
<td width=98 align=center><?= count($cityList) ?></td>
<td width=98 align=center class='bg1'>장 수</td>
<td width=98 align=center><?= $nation['gennum'] ?></td>
</tr>
<tr>
<td align=center class='bg1'>국고 예산</td>
<td align=center><?= number_format($budgetgold) ?> (<?= $budgetgolddiff ?>)</td>
<td align=center class='bg1'>병량 예산</td>
<td align=center><?= number_format($budgetrice) ?> (<?= $budgetricediff ?>)</td>
<td align=center class='bg1'>기술력</td>
<td align=center><?= number_format(floor($nation['tech'])) ?></td>
<td align=center class='bg1'>작 위</td>
<td align=center><?= getNationLevel($nation['level']) ?></td>
</tr>
<tr>
<td align=center valign=top class='bg1'> 속령일람 :</td>
<td colspan=7><?= join(', ', $cityNames) ?></td>
</tr>
<tr>
<td align=center valign=top class='bg1'>국가열전</td>
<td colspan=7 class='bg0'><?= formatHistoryToHTML(getNationHistoryLogAll($nation['nation'])) ?></td>
</tr>
</table>
<br>
$goldIncome = getGoldIncome($nation['nation'], $nation['level'], $nation['rate'], $nation['capital'], $nation['type'], $cityList);
$warIncome = getWarGoldIncome($nation['type'], $cityList);
$totalGoldIncome = $goldIncome + $warIncome;
$riceIncome = getRiceIncome($nation['nation'], $nation['level'], $nation['rate'], $nation['capital'], $nation['type'], $cityList);
$wallIncome = getWallIncome($nation['nation'], $nation['level'], $nation['rate'], $nation['capital'], $nation['type'], $cityList);
$totalRiceIncome = $riceIncome + $wallIncome;
$outcome = getOutcome($nation['bill'], $dedicationList);
$budgetgold = $nation['gold'] + $totalGoldIncome - $outcome;
$budgetrice = $nation['rice'] + $totalRiceIncome - $outcome;
$budgetgolddiff = $totalGoldIncome - $outcome;
$budgetricediff = $totalRiceIncome - $outcome;
if ($budgetgolddiff > 0) {
$budgetgolddiff = '+'.number_format($budgetgolddiff);
} else {
$budgetgolddiff = number_format($budgetgolddiff);
}
if ($budgetricediff > 0) {
$budgetricediff = '+'.number_format($budgetricediff);
} else {
$budgetricediff = number_format($budgetricediff);
}
?>
<table align=center width=1000 class='tb_layout bg2'>
<tr>
<td colspan=8 align=center style='color:<?=newColor($nation['color'])?>;background-color:<?=$nation['color']?>'>【<?=$nation['name']?>】</td>
</tr>
<tr>
<td width=98 align=center id=bg1>총주민</td>
<td width=198 align=center><?=number_format($currPop)?>/<?=number_format($maxPop)?></td>
<td width=98 align=center id=bg1>총병사</td>
<td width=198 align=center><?=number_format($currCrew)?>/<?=number_format($maxCrew)?></td>
<td width=98 align=center id=bg1>국 력</td>
<td width=298 align=center colspan=3><?=$nation['power']?></td>
</tr>
<tr>
<td align=center id=bg1>국 고</td>
<td align=center><?=number_format($nation['gold'])?></td>
<td align=center id=bg1>병 량</td>
<td align=center><?=number_format($nation['rice'])?></td>
<td align=center id=bg1>세 율</td>
<td align=center colspan=3><?=$nation['rate']?> %</td>
</td>
</tr>
<tr>
<td align=center id=bg1>세금/단기</td>
<td align=center>+<?=number_format($goldIncome)?> / +<?=number_format($warIncome)?></td>
<td align=center id=bg1>세곡/둔전</td>
<td align=center>+<?=number_format($riceIncome)?> / +<?=number_format($wallIncome)?></td>
<td align=center id=bg1>지급률</td>
<td align=center colspan=3><?=$nation['bill']?> %</td>
</tr>
<tr>
<td align=center id=bg1>수입/지출</td>
<td align=center>+<?=number_format($totalGoldIncome)?> / -<?=number_format($outcome)?></td>
<td align=center id=bg1>수입/지출</td>
<td align=center>+<?=number_format($totalRiceIncome)?> / -<?=number_format($outcome)?></td>
<td align=center id=bg1>속 령</td>
<td width=98 align=center><?=count($cityList)?></td>
<td width=98 align=center id=bg1>장 수</td>
<td width=98 align=center><?=$nation['gennum']?></td>
</tr>
<tr>
<td align=center id=bg1>국고 예산</td>
<td align=center><?=number_format($budgetgold)?> (<?=$budgetgolddiff?>)</td>
<td align=center id=bg1>병량 예산</td>
<td align=center><?=number_format($budgetrice)?> (<?=$budgetricediff?>)</td>
<td align=center id=bg1>기술력</td>
<td align=center><?=number_format(floor($nation['tech']))?></td>
<td align=center id=bg1>작 위</td>
<td align=center><?=getNationLevel($nation['level'])?></td>
</tr>
<tr>
<td align=center valign=top id=bg1> 속령일람 :</td>
<td colspan=7><?=join(', ', $cityNames)?></td>
</tr>
<tr>
<td align=center valign=top id=bg1>국가열전</td>
<td colspan=7 id=bg0><?=formatHistoryToHTML(getNationHistoryLogAll($nation['nation']))?></td>
</tr>
</table>
<br>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td><?=backButton()?></td></tr>
<tr><td><?=banner()?></td></tr>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td><?= backButton() ?></td>
</tr>
<tr>
<td><?= banner() ?></td>
</tr>
</table>
</body>
</html>
</html>
+157 -116
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -28,138 +29,178 @@ if ($myset > 0) {
}
$targetTime = addTurn($me->getVar('lastrefresh'), $gameStor->turnterm, 2);
if($gameStor->turntime <= $gameStor->opentime){
if ($gameStor->turntime <= $gameStor->opentime) {
//서버 가오픈시 할 수 있는 행동
if($me->getNPCType() == 0){
if ($me->getNPCType() == 0) {
$showDieImmediatelyBtn = true;
if($targetTime <= TimeUtil::now()){
if ($targetTime <= TimeUtil::now()) {
$availableDieImmediately = true;
}
}
}
$use_treatment = $me->getAuxVar('use_treatment')??10;
$use_auto_nation_turn = $me->getAuxVar('use_auto_nation_turn')??1;
$use_treatment = $me->getAuxVar('use_treatment') ?? 10;
$use_auto_nation_turn = $me->getAuxVar('use_auto_nation_turn') ?? 1;
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?=UniqueConst::$serverName?>: 내정보</title>
<script>
var availableDieImmediately = <?=$availableDieImmediately?'true':'false'?>;
</script>
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('js/common.js')?>
<?=WebUtil::printJS('js/myPage.js')?>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=500" />
<title><?= UniqueConst::$serverName ?>: 내정보</title>
<script>
var availableDieImmediately = <?= $availableDieImmediately ? 'true' : 'false' ?>;
</script>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printDist('ts', ['myPage']) ?>
</head>
<body>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td>내 정 보<br><?=backButton()?></td></tr>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td width=50%>
<?php generalInfo($me); ?>
<?php generalInfo2($me); ?>
</td>
<td width=50% valign=top style="padding-left:4ch;">
토너먼트 【
<input type=radio class='tnmt' name=tnmt value=0 <?=$me->getVar('tnmt')==0?"checked":""; ?>>수동참여
<input type=radio class='tnmt' name=tnmt value=1 <?=$me->getVar('tnmt')==1?"checked":""; ?>>자동참여
】<br>
∞<span style='color:orange'>개막직전 남는자리가 있을경우 랜덤하게 참여합니다.</span><br><br>
환약 사용 【<select id='use_treatment' name='use_treatment'>
<option value=10 <?=($use_treatment==10)?"selected":""; ?>>경상</option>
<option value=21 <?=($use_treatment==21)?"selected":""; ?>>중상</option>
<option value=41 <?=($use_treatment==41)?"selected":""; ?>>심각</option>
<option value=61 <?=($use_treatment==61)?"selected":""; ?>>위독</option>
<option value=100 <?=($use_treatment==100)?"selected":""; ?>>사용안함</option>
</select>】<br>
∞<span style='color:orange'>부상을 입었을 때 환약을 사용하는 기준입니다.</span><br><br>
<?php if(($gameStor->autorun_user['options']['chief'])??false) : ?>
자동 사령턴 허용 【<select id='use_auto_nation_turn' name='use_auto_nation_turn'>
<option value=1 <?=$use_auto_nation_turn?"selected":""; ?>>허용</option>
<option value=0 <?=(!$use_auto_nation_turn)?"selected":""; ?>>허용 안함</option>
</select>】<br>
∞<span style='color:orange'>수뇌가 되었을 때 휴식 턴이어도 적당한 턴을 알아서 넣는 것을 허용합니다.</span><br><br>
<?php endif; ?>
수비 【<select id='defence_train' name='defence_train'>
<?php foreach([90, 80, 60, 40] as $targetDefenceTrain): ?>
<option value='<?=$targetDefenceTrain?>' <?=$me->getVar('defence_train')==$targetDefenceTrain?"selected":""; ?>><?=formatDefenceTrain($targetDefenceTrain)?>(훈사<?=$targetDefenceTrain?>)</option>
<?php endforeach; ?>
<option value=999 <?=$me->getVar('defence_train')==999?"selected":""; ?>><?=formatDefenceTrain(999)?>[훈련, 사기 -3]</option>
</select>
】<br><br>
<input type=<?=$submit?> id='set_my_setting' name=btn style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;height:30px;font-size:13px; value=설정저장><br>
∞<span style='color:orange'>설정저장은 이달중 <?=$myset?>회 남았습니다.</span><br><br>
<?php if(!($gameStor->autorun_user['limit_minutes']??false)): ?>
휴 가 신 청<br>
<button type="button" id='vacation' style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;height:30px;font-size:13px;>휴가 신청</button><br><br>
<?php endif; ?>
<!--빙의 해제용 삭턴 조절<br>
<a href="b_myPage.php?detachNPC=1"><button type="button" style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;height:30px;font-size:13px;>빙의 해체 요청</button></a>-->
<?php if($showDieImmediatelyBtn): ?>
가오픈 기간 내 장수 삭제 (<?=substr($targetTime, 0, 19)?> 부터)<br>
<a href="c_die_immediately.php" id='die_immediately'><button type="button" style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;height:30px;font-size:13px;>장수 삭제</button></a><br><br>
<?php endif; ?>
<?php if($gameStor->npcmode==2 && $me->getNPCType()==0): ?>
다른 장수 선택 (<?=substr($me->getAuxVar('next_change')??TimeUtil::now(), 0, 19)?> 부터)<br>
<a href="select_general_from_pool.php" id='select_general_from_pool'><button type="button" style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;height:30px;font-size:13px;>다른 장수 선택</button></a><br><br>
<?php endif; ?>
개인용 CSS<br>
<textarea id='custom_css' style='color:white;background-color:black;width:420px;height:150px;'></textarea>
</td>
</tr>
<tr>
<td align=center id=bg1><font color=skyblue size=3>개인 기록</font></td>
<td align=center id=bg1><font color=orange size=3>전투 기록</font></td>
</tr>
<tr>
<td valign=top>
<div id='generalActionPlate'>
<?=formatHistoryToHTML(getGeneralActionLogRecent($generalID, 24), 'generalAction')?>
<div id="container" class="bg0">
<div class="row gx-0">
<div class="col">내 정 보<br><?= backButton() ?></div>
</div>
<div class="row gx-0">
<div class="col col-12 col-md-6">
<div class="row">
<div class="col"><?php generalInfo($me); ?><?php generalInfo2($me); ?></div>
</div>
</div>
<button type="button" class="load_old_log btn btn-secondary btn-block" data-log_type="generalAction">이전 로그 불러오기</button>
</td>
<td valign=top>
<div id='battleDetailPlate'>
<?=formatHistoryToHTML(getBattleDetailLogRecent($generalID, 24), 'battleDetail')?>
<div class="col col-12 col-md-6">
<div class="row">
<div class="col" style='padding-left:4ch;'>
토너먼트 【
<input type=radio class='tnmt' name=tnmt value=0 <?= $me->getVar('tnmt') == 0 ? "checked" : ""; ?>>수동참여
<input type=radio class='tnmt' name=tnmt value=1 <?= $me->getVar('tnmt') == 1 ? "checked" : ""; ?>>자동참여
】<br>
∞<span style='color:orange'>개막직전 남는자리가 있을경우 랜덤하게 참여합니다.</span><br><br>
환약 사용 【<select id='use_treatment' name='use_treatment'>
<option value=10 <?= ($use_treatment == 10) ? "selected" : ""; ?>>경상</option>
<option value=21 <?= ($use_treatment == 21) ? "selected" : ""; ?>>중상</option>
<option value=41 <?= ($use_treatment == 41) ? "selected" : ""; ?>>심각</option>
<option value=61 <?= ($use_treatment == 61) ? "selected" : ""; ?>>위독</option>
<option value=100 <?= ($use_treatment == 100) ? "selected" : ""; ?>>사용안함</option>
</select>】<br>
∞<span style='color:orange'>부상을 입었을 때 환약을 사용하는 기준입니다.</span><br><br>
<?php if (($gameStor->autorun_user['options']['chief']) ?? false) : ?>
자동 사령턴 허용 【<select id='use_auto_nation_turn' name='use_auto_nation_turn'>
<option value=1 <?= $use_auto_nation_turn ? "selected" : ""; ?>>허용</option>
<option value=0 <?= (!$use_auto_nation_turn) ? "selected" : ""; ?>>허용 안함</option>
</select>】<br>
∞<span style='color:orange'>수뇌가 되었을 때 휴식 턴이어도 적당한 턴을 알아서 넣는 것을 허용합니다.</span><br><br>
<?php endif; ?>
수비 【<select id='defence_train' name='defence_train'>
<?php foreach ([90, 80, 60, 40] as $targetDefenceTrain) : ?>
<option value='<?= $targetDefenceTrain ?>' <?= $me->getVar('defence_train') == $targetDefenceTrain ? "selected" : ""; ?>><?= formatDefenceTrain($targetDefenceTrain) ?>(훈사<?= $targetDefenceTrain ?>)</option>
<?php endforeach; ?>
<option value=999 <?= $me->getVar('defence_train') == 999 ? "selected" : ""; ?>><?= formatDefenceTrain(999) ?>[훈련, 사기 -3]</option>
</select>
】<br><br>
<input type=<?= $submit ?> id='set_my_setting' name=btn style=background-color:<?= GameConst::$basecolor2 ?>;color:white;width:160px;height:30px;font-size:14px; value=설정저장><br>
∞<span style='color:orange'>설정저장은 이달중 <?= $myset ?>회 남았습니다.</span><br><br>
<?php if (!($gameStor->autorun_user['limit_minutes'] ?? false)) : ?>
휴 가 신 청<br>
<button type="button" id='vacation' style=background-color:<?= GameConst::$basecolor2 ?>;color:white;width:160px;height:30px;font-size:14px;>휴가 신청</button><br><br>
<?php endif; ?>
<!--빙의 해제용 삭턴 조절<br>
<a href="b_myPage.php?detachNPC=1"><button type="button" style=background-color:<?= GameConst::$basecolor2 ?>;color:white;width:160px;height:30px;font-size:14px;>빙의 해체 요청</button></a>-->
<?php if ($showDieImmediatelyBtn) : ?>
가오픈 기간 내 장수 삭제 (<?= substr($targetTime, 0, 19) ?> 부터)<br>
<a href="c_die_immediately.php" id='die_immediately'><button type="button" style=background-color:<?= GameConst::$basecolor2 ?>;color:white;width:160px;height:30px;font-size:14px;>장수 삭제</button></a><br><br>
<?php endif; ?>
<?php if ($gameStor->npcmode == 2 && $me->getNPCType() == 0) : ?>
다른 장수 선택 (<?= substr($me->getAuxVar('next_change') ?? TimeUtil::now(), 0, 19) ?> 부터)<br>
<a href="select_general_from_pool.php" id='select_general_from_pool'><button type="button" style=background-color:<?= GameConst::$basecolor2 ?>;color:white;width:160px;height:30px;font-size:14px;>다른 장수 선택</button></a><br><br>
<?php endif; ?>
<div class="row">
<div class="col-4 text-end">500px/1000px 모드<br>(모바일 전용, 즉시 설정)</div>
<div class="col-8">
<div class="btn-group" role="group" aria-label="500px/1000px 모드 설정">
<input type="radio" class="btn-check" name="screenMode" value="auto" id="screenMode_auto" autocomplete="off">
<label class="btn btn-primary" for="screenMode_auto">자동</label>
<input type="radio" class="btn-check" name="screenMode" value="500px" id="screenMode_500px" autocomplete="off">
<label class="btn btn-primary" for="screenMode_500px">500px</label>
<input type="radio" class="btn-check" name="screenMode" value="1000px" id="screenMode_1000px" autocomplete="off">
<label class="btn btn-primary" for="screenMode_1000px">1000px</label>
</div>
</div>
</div>
<br>
개인용 CSS<br>
<textarea id='custom_css' style='color:white;background-color:black;width:420px;height:150px;'></textarea>
</div>
</div>
</div>
<button type="button" class="load_old_log btn btn-secondary btn-block" data-log_type="battleDetail">이전 로그 불러오기</button>
</td>
</tr>
<tr>
<td align=center id=bg1><font color=skyblue size=3>장수 열전</font></td>
<td align=center id=bg1><font color=orange size=3>전투 결과</font></td>
</tr>
<tr>
<td valign=top>
<?=formatHistoryToHTML(getGeneralHistoryLogAll($generalID))?>
</td>
<td valign=top>
<div id='battleResultPlate'>
<?=formatHistoryToHTML(getBattleResultRecent($generalID, 24), 'battleResult')?>
<div class="col col-12 col-md-6">
<div class="row gx-0">
<div class="col bg1 text-center">
<h4 style='color:skyblue'>개인 기록</h4>
</div>
</div>
<div class="row gx-0">
<div id='generalActionPlate'>
<?= formatHistoryToHTML(getGeneralActionLogRecent($generalID, 24), 'generalAction') ?>
</div>
<button type="button" class="load_old_log btn btn-secondary" data-log_type="generalAction">이전 로그 불러오기</button>
</div>
</div>
<button type="button" class="load_old_log btn btn-secondary btn-block" data-log_type="battleResult">이전 로그 불러오기</button>
</td>
</tr>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td><?=backButton()?></td></tr>
<tr><td><?=banner()?></td></tr>
</table>
<div class="col col-12 col-md-6">
<div class="row gx-0">
<div class="col bg1 text-center">
<h4 style='color:orange'>전투 기록</h4>
</div>
</div>
<div class="row gx-0">
<div id='battleDetailPlate'>
<?= formatHistoryToHTML(getBattleDetailLogRecent($generalID, 24), 'battleDetail') ?>
</div>
<button type="button" class="load_old_log btn btn-secondary" data-log_type="battleDetail">이전 로그 불러오기</button>
</div>
</div>
<div class="col col-12 col-md-6">
<div class="row gx-0">
<div class="col bg1 text-center">
<h4 style='color:skyblue'>장수 열전</h4>
</div>
</div>
<div class="row gx-0">
<?= formatHistoryToHTML(getGeneralHistoryLogAll($generalID)) ?>
</div>
</div>
<div class="col col-12 col-md-6">
<div class="row gx-0">
<div class="col bg1 text-center">
<h4 style='color:orange'>전투 결과</h4>
</div>
</div>
<div class="row gx-0">
<div id='battleResultPlate'>
<?= formatHistoryToHTML(getBattleResultRecent($generalID, 24), 'battleResult') ?>
</div>
<button type="button" class="load_old_log btn btn-secondary" data-log_type="battleResult">이전 로그 불러오기</button>
</div>
</div>
</div>
<div class="row gx-0">
<div class="col "><?= backButton() ?></div>
</div>
<div class="row bg0 gx-0">
<div class="col bg0"><?= banner() ?></div>
</div>
</div>
</body>
</html>
</html>
-420
View File
@@ -1,420 +0,0 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
//로그인 검사
$session = Session::requireGameLogin()->setReadOnly();
$userID = Session::getUserID();
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$gameStor->cacheValues(['autorun_user', 'develcost']);
increaseRefresh("NPC 정책", 1);
$me = $db->queryFirstRow('SELECT no, npc, nation, city, officer_level, con, turntime, belong, permission, penalty FROM general WHERE owner=%i', $userID);
$nationID = $me['nation'];
$nation = $db->queryFirstRow('SELECT nation,level,name,color,type,gold,rice,bill,tech,rate,scout,war,secretlimit,capital FROM nation WHERE nation = %i', $nationID);
$con = checkLimit($me['con']);
if ($con >= 2) {
printLimitMsg($me['turntime']);
exit();
}
$permission = checkSecretPermission($me);
if ($permission < 0) {
echo '국가에 소속되어있지 않습니다.';
die();
} else if ($permission < 1) {
echo "권한이 부족합니다. 수뇌부가 아니거나 사관년도가 부족합니다.";
die();
}
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
$nationStor->cacheValues(['npc_nation_policy', 'npc_general_policy']);
$gameStor->cacheAll();
$general = new General($me, null, null, $nation, $gameStor->year, $gameStor->month, false);
$rawServerPolicy = $gameStor->getValue('npc_nation_policy') ?? [];
$rawNationPolicy = $nationStor->getValue('npc_nation_policy') ?? [];
$rawServerGeneralPolicy = $gameStor->getValue('npc_general_policy') ?? [];
$rawNationGeneralPolicy = $nationStor->getValue('npc_general_policy') ?? [];
$defaultNationPolicy = ($rawServerPolicy['values'] ?? []) + AutorunNationPolicy::$defaultPolicy;
$currentNationPolicy = ($rawNationPolicy['values'] ?? []) + $defaultNationPolicy;
$defaultNationPriority = $rawServerPolicy['priority'] ?? (AutorunNationPolicy::$defaultPriority);
$currentNationPriority = $rawNationPolicy['priority'] ?? $defaultNationPriority;
$defaultGeneralActionPriority = $rawServerGeneralPolicy['priority'] ?? (AutorunGeneralPolicy::$default_priority);
$currentGeneralActionPriority = $rawNationGeneralPolicy['priority'] ?? $defaultGeneralActionPriority;
$autoPolicyVariable = [];
if ($currentNationPolicy['reqHumanWarUrgentRice'] ?? 0) {
$autoPolicyVariable['reqHumanWarUrgentRice'] = $currentNationPolicy['reqHumanWarUrgentRice'];
}
if ($currentNationPolicy['reqHumanWarUrgentGold'] ?? 0) {
$autoPolicyVariable['reqHumanWarUrgentGold'] = $currentNationPolicy['reqHumanWarUrgentGold'];
}
$autoPolicy = new AutorunNationPolicy($general, ($gameStor->autorun_user)['options'], ['values' => $autoPolicyVariable], null, $nation, $gameStor->getAll(true));
$zeroPolicy = new AutorunNationPolicy($general, ($gameStor->autorun_user)['options'], null, null, $nation, $gameStor->getAll(true));
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?= UniqueConst::$serverName ?>: 임시 NPC 정책</title>
<script>
var nationID = <?= $nationID ?>;
var defaultNationPolicy = <?= Json::encode($defaultNationPolicy) ?>;
var currentNationPolicy = <?= Json::encode($currentNationPolicy) ?>;
var defaultNationPriority = <?= Json::encode($defaultNationPriority) ?>;
var currentNationPriority = <?= Json::encode($currentNationPriority) ?>;
var availableNationPriorityItems = <?= Json::encode(AutorunNationPolicy::$defaultPriority) ?>;
var defaultGeneralActionPriority = <?= Json::encode($defaultGeneralActionPriority) ?>;
var currentGeneralActionPriority = <?= Json::encode($currentGeneralActionPriority) ?>;
var availableGeneralActionPriorityItems = <?= Json::encode(AutorunGeneralPolicy::$default_priority) ?>;
var btnHelpMessage = {
'선전포고': '군주가 NPC이고, 전쟁중이 아닐 때,<br>주변국중 하나를 골라 선포합니다.<br><br>선포 시점은 다음을 참고합니다.<br>- 인구율<br>- 도시내정률<br>- NPC전투장권장 금 충족률<br>- NPC전투장권장 쌀 충족률<br><br>국력이 낮은 국가를 조금 더 선호합니다.',
'천도': '인구가 많은 곳을 찾아 천도를 시도합니다.<br>영토의 가운데를 선호합니다.<br><br>도시 인구가 충분하다면, 굳이 천도하지는 않습니다.',
'유저장긴급포상': '금/쌀이 부족한 유저전투장에게 긴급하게 포상합니다.<br>국고가 권장량보다 적어지더라도 시도합니다.',
'부대전방발령': '(작동하지 않음)<br>전투 부대를 접경으로 발령합니다.<br>수도->시작점->도착점 경로를 따릅니다.',
'유저장구출발령': '아군 영토에 있지 않은 유저장을 아군 영토로 발령합니다.<br>곧 집합하는 부대에 탑승한 경우는 제외합니다.',
'유저장후방발령': '유저전투장 중에<br>- 병력이 충분하지 않고,<br>- 도시의 인구가 제자리 징병할 수 있을 정도로 충분하지 않고,<br>- 부대에 탑승하지 않았다면,<br>인구가 충분한 후방도시로 발령합니다.',
'부대유저장후방발령': '접경에 위치한 부대에 탑승한 유저전투장 중에,<br>- 병력이 충분하지 않고,<br>- 첫 턴이 징병턴이며,<br>- 부대장 집합 턴 사이라면,<br>인구가 충분한 후방도시로 발령합니다.<br><br>부대장의 위치와 유저장의 위치가 다르다면 발령하지 않습니다.',
'유저장전방발령': '후방에 있는 유저장이<br>- 병력을 가지고 있으며,<br>- 곧 훈련/사기진작이 완료될 것 같으면,<br>전방으로 발령합니다.<br><br>도시 관직이 많이 임명된 도시를 선호합니다.',
'유저장포상': '금/쌀이 부족한 유저장에게 포상합니다.<br>유저전투장과 유저내정장은 각각 기준을 따릅니다.<br>국고 권장량을 가급적 지킵니다.',
'부대후방발령': '(작동하지 않음)<br>후방 부대가 위치한 도시의 인구가 충분하지 않을 경우,<br>인구가 충분한 도시로 발령합니다.',
'부대구출발령': '전투 부대, 후방 부대가 아닌 부대가 아군 영토에 있지 않을 때,<br>전방 도시 중 하나를 골라 발령합니다.',
'NPC긴급포상': '금/쌀이 부족한 NPC전투장에게 긴급하게 포상합니다.<br>국고가 권장량보다 \'약간\' 적어지더라도 시도합니다.',
'NPC구출발령': '아군 영토에 있지 않은 NPC장을 아군 영토로 발령합니다.',
'NPC후방발령': 'NPC전투장 중에<br>- 병력이 충분하지 않고,<br>- 도시의 인구가 제자리 징병할 수 있을 정도로 충분하지 않고,<br>- 부대에 탑승하지 않았다면,<br>인구가 충분한 후방도시로 발령합니다.',
'NPC포상': '금/쌀이 부족한 유저장에게 포상합니다.<br>NPC전투장과 NPC내정장은 각각 기준을 따릅니다.<br>국고 권장량을 가급적 지킵니다.',
'NPC전방발령': '후방에 있는 유저장이<br>- 병력을 가지고 있으며,<br>- 곧 훈련/사기진작이 완료될 것 같으면,<br>전방으로 발령합니다.<br><br>도시 관직이 많이 임명된 도시를 선호합니다.',
'유저장내정발령': '내정중인 유저장이 위치한 도시의 내정률이 95% 이상이면<br>개발되지 않은 도시로 발령합니다.',
'NPC내정발령': '내정중인 NPC장이 위치한 도시의 내정률이 95% 이상이면<br>개발되지 않은 도시로 발령합니다.',
'NPC몰수': '국고가 부족하다면 NPC에게서 몰수합니다. 내정NPC장은 국고가 부족하지 않아도 몰수합니다.',
'NPC사망대비': 'NPC의 사망까지 5턴 이내인 경우, 헌납합니다.<br>헌납할 금쌀이 없다면 물자조달을 수행합니다.',
'귀환': '아국 도시에 있지 않다면 귀환합니다.',
'금쌀구매': '전쟁 중에 금쌀의 비율이 크게 차이난다면 금쌀을 거래하여 비슷하게 맞춥니다.<br>금쌀 비율이 적절하는지 판단하는데 살상률을 포함합니다.<br>NPC는 상인이 없어도 금쌀을 구매할 수 있습니다.<br><br>또는 금쌀 한쪽이 지나치게 적은 경우에는 내정 중에도 금쌀을 거래합니다.',
'출병': '충분한 병력과 충분한 훈련/사기를 가지고 있는 경우 출병합니다.<br>접경이 여럿인 경우 무작위로 선택합니다.<br><br>타국과 전쟁중인 경우 공백지로는 출병하지 않습니다.',
'긴급내정': '전쟁중에 민심이 70 미만이거나,<br>인구가 제자리 징병이 가능하지 않을 정도로 적을 경우,<br>일정확률로 주민선정과 정착장려를 수행합니다.<br><br>통솔이 높을 수록 수행할 확률이 높습니다.',
'전투준비': '충분한 병력을 가지고 있지만 훈련과 사기가 부족한 경우 훈련과 사기진작을 수행합니다.',
'전방워프': '전투장이 충분한 병력을 가지고 있다면 전방으로 이동합니다.',
'NPC헌납': '국고가 부족한데 NPC전쟁장이 충분한 금쌀(권장량 대비 1.5배)을 가지고 있다면 일부를 헌납합니다. <br>NPC내정장은 국고가 넉넉하더라도 충분한 금쌀을 가지고 있다면 권장량만 유지하고 헌납합니다.',
'징병': '전쟁 중 병력을 소진하였다면 재 징병합니다.<br><br>기존에 사용한 병종군 중에서 사용가능한 병종을 랜덤하게 선택합니다.<br>고급 병종을 선택할 확률이 조금 더 높습니다.<br><br>NPC의 경우 도시의 인구가 충분하지 않다면 징병을 할 확률이 감소합니다.<br><br>유저장은 최대한 고급병종을 유지하며,<br>유저장 모병이 허용되는 경우 모병을 3회할 수 있다면 모병합니다.',
'후방워프': '전쟁 중 병력을 소진하였는데 도시의 인구가 충분하지 않다면,<br>인구가 많은 도시로 이동합니다.',
'전쟁내정': '전쟁 중 수행하는 내정입니다.<br>정착장려, 기술연구의 확률이 좀 더 높고,<br>치안강화, 농지개간, 상업투자의 확률이 낮습니다.<br><br>내정이 가능하다 하더라도 전시임을 고려해,<br>30% 확률로 다른 턴을 수행합니다.',
'소집해제': '전쟁 중이 아닌 데 병력이 남아있는 경우,<br>3/4 확률로 소집해제합니다.',
'일반내정': '도시에서 내정을 수행합니다. 낮은 내정일 수록 수행할 확률이 높습니다.<br>기술 연구는 1등급 이상 뒤쳐지지 않도록 노력합니다.',
'내정워프': '도시에서 더이상 내정을 수행할 수 없는 경우,<br>일정확률로 내정이 부족한 다른 도시로 이동합니다.',
};
</script>
<?= WebUtil::printJS('../e_lib/jquery-3.3.1.min.js') ?>
<?= WebUtil::printJS('../e_lib/Sortable.min.js') ?>
<?= WebUtil::printJS('../e_lib/jquery-sortable.js') ?>
<?= WebUtil::printJS('../e_lib/bootstrap.bundle.min.js') ?>
<?= WebUtil::printJS('../e_lib/jquery_toast/toast.js') ?>
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printJS('js/common.js') ?>
<?= WebUtil::printJS('js/npc_control.js') ?>
<?= WebUtil::printCSS('../e_lib/bootstrap.min.css') ?>
<?= WebUtil::printCSS('../e_lib/font_awesome/css/all.min.css') ?>
<?= WebUtil::printCSS('../e_lib/jquery_toast/toast.css') ?>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<?= WebUtil::printCSS('css/common.css') ?>
<?= WebUtil::printCSS('css/npc_control.css') ?>
</head>
<body>
<div id='container' class='tb_layout bg0' style='width:1000px;margin:auto;border:solid 1px #888888;'>
<div class='tb_layout bg0'>임시 NPC 정책<br>
<?= backButton() ?></div>
<div class='bg1 section_bar'>국가 정책</div>
<div class="text-right px-3"><small class="form-text text-muted">
최근 설정: <?= $rawNationPolicy['valueSetter'] ?? '-없음-' ?> (<?= $rawNationPolicy['valueSetTime'] ?? '설정 기록 없음' ?>)
</small></div>
<div class="form_list">
<div class="form-group row">
<div class="col-sm-6">
<div class="row">
<label for="reqNationGold" class="col-sm-6 col-form-label">국가 권장 금</label>
<div class="col-sm-6">
<input type="number" class="form-control" data-type="integer" id="reqNationGold" min="0" value="0">
</div>
</div>
<div style='text-align:right;'><small class="form-text text-muted">이보다 많으면 포상, 적으면 몰수/헌납합니다.(긴급포상 제외)</small></div>
</div>
<div class="col-sm-6">
<div class="row">
<label for="reqNationRice" class="col-sm-6 col-form-label">국가 권장 쌀</label>
<div class="col-sm-6">
<input type="number" class="form-control" data-type="integer" id="reqNationRice" min="0" value="0">
</div>
</div>
<div style='text-align:right;'><small class="form-text text-muted">이보다 많으면 포상, 적으면 몰수/헌납합니다.(긴급포상 제외)</small></div>
</div>
</div>
<div class="form-group row">
<div class="col-sm-6">
<div class="row">
<label for="reqHumanWarUrgentGold" class="col-sm-6 col-form-label">유저전투장 긴급포상 금</label>
<div class="col-sm-6">
<input type="number" class="form-control" data-type="integer" id="reqHumanWarUrgentGold" min="0" value="0">
</div>
</div>
<div style='text-align:right;'><small class="form-text text-muted">
유저장긴급포상시 이보다 금이 적은 장수에게 포상합니다.<br>
0이면 보병 6회 징병(<?= number_format(GameConst::$defaultStatMax * 100) ?> * 6) 가능한 금을 기준으로 하며, 그 수치는 현재 <?= number_format($zeroPolicy->reqHumanWarUrgentGold) ?>입니다.</small></div>
</div>
<div class="col-sm-6">
<div class="row">
<label for="reqHumanWarUrgentRice" class="col-sm-6 col-form-label">유저전투장 긴급포상 쌀</label>
<div class="col-sm-6">
<input type="number" class="form-control" data-type="integer" id="reqHumanWarUrgentRice" min="0" value="0">
</div>
</div>
<div style='text-align:right;'><small class="form-text text-muted">유저장긴급포상시 이보다 쌀이 적은 장수에게 포상합니다.<br>0이면 기본 병종으로 <?= number_format(GameConst::$defaultStatMax * 100 * 6) ?>명 사살 가능한 쌀을 기준으로 하며, 그 수치는 현재 <?= number_format($zeroPolicy->reqHumanWarUrgentRice) ?>입니다.</small></div>
</div>
</div>
<div class="form-group row">
<div class="col-sm-6">
<div class="row">
<label for="reqHumanWarRecommandGold" class="col-sm-6 col-form-label">유저전투장 권장 금</label>
<div class="col-sm-6">
<input type="number" class="form-control" data-type="integer" id="reqHumanWarRecommandGold" min="0" value="0">
</div>
</div>
<div style='text-align:right;'><small class="form-text text-muted">유저전투장에게 주는 금입니다. 이보다 적으면 포상합니다. <br>
0이면 유저전투장 긴급포상 금의 2배를 기준으로 하며, 그 수치는 현재 <?= number_format($autoPolicy->reqHumanWarRecommandGold) ?>입니다.</small></div>
</div>
<div class="col-sm-6">
<div class="row">
<label for="reqHumanWarRecommandRice" class="col-sm-6 col-form-label">유저전투장 권장 쌀</label>
<div class="col-sm-6">
<input type="number" class="form-control" data-type="integer" id="reqHumanWarRecommandRice" min="0" value="0">
</div>
</div>
<div style='text-align:right;'><small class="form-text text-muted">유저전투장에게 주는 쌀입니다. 이보다 적으면 포상합니다. <br>
0이면 유저전투장 긴급포상 쌀의 2배를 기준으로 하며, 그 수치는 현재 <?= number_format($autoPolicy->reqHumanWarRecommandRice) ?>입니다.</small></div>
</div>
</div>
<div class="form-group row">
<div class="col-sm-6">
<div class="row">
<label for="reqHumanDevelGold" class="col-sm-6 col-form-label">유저내정장 권장 금</label>
<div class="col-sm-6">
<input type="number" class="form-control" data-type="integer" id="reqHumanDevelGold" min="0" value="0">
</div>
</div>
<div style='text-align:right;'><small class="form-text text-muted">유저내정장에게 주는 금입니다. 이보다 적으면 포상합니다.</small></div>
</div>
<div class="col-sm-6">
<div class="row">
<label for="reqHumanDevelRice" class="col-sm-6 col-form-label">유저내정장 권장 쌀</label>
<div class="col-sm-6">
<input type="number" class="form-control" data-type="integer" id="reqHumanDevelRice" min="0" value="0">
</div>
</div>
<div style='text-align:right;'><small class="form-text text-muted">유저내정장에게 주는 쌀입니다. 이보다 적으면 포상합니다.</small></div>
</div>
</div>
<div class="form-group row">
<div class="col-sm-6">
<div class="row">
<label for="reqNPCWarGold" class="col-sm-6 col-form-label">NPC전투장 권장 금</label>
<div class="col-sm-6">
<input type="number" class="form-control" data-type="integer" id="reqNPCWarGold" min="0" value="0">
</div>
</div>
<div style='text-align:right;'><small class="form-text text-muted">NPC전투장에게 주는 금입니다. 이보다 적으면 포상합니다. <br>
0이면 기본 병종 4회(<?= number_format(GameConst::$defaultStatNPCMax * 100) ?> * 4) 징병비를 기준으로 하며, 그 수치는 현재 <?= number_format($autoPolicy->reqNPCWarGold) ?>입니다.</small></div>
</div>
<div class="col-sm-6">
<div class="row">
<label for="reqNPCWarRice" class="col-sm-6 col-form-label">NPC전투장 권장 쌀</label>
<div class="col-sm-6">
<input type="number" class="form-control" data-type="integer" id="reqNPCWarRice" min="0" value="0">
</div>
</div>
<div style='text-align:right;'><small class="form-text text-muted">NPC전투장에게 주는 쌀입니다. 이보다 적으면 포상합니다. <br>
0이면 기본 병종으로 <?= number_format(GameConst::$defaultStatNPCMax * 100 * 4) ?>명 사살 가능한 쌀을 기준으로 하며, 그 수치는 현재 <?= number_format($autoPolicy->reqNPCWarRice) ?>입니다.</small></div>
</div>
</div>
<div class="form-group row">
<div class="col-sm-6">
<div class="row">
<label for="reqNPCDevelGold" class="col-sm-6 col-form-label">NPC내정장 권장 금</label>
<div class="col-sm-6">
<input type="number" class="form-control" data-type="integer" id="reqNPCDevelGold" min="0" value="0">
</div>
</div>
<div style='text-align:right;'><small class="form-text text-muted">NPC내정장에게 주는 금입니다. 이보다 5배 더 많다면 헌납합니다.<br>0이면 30턴 내정 가능한 금을 기준으로 하며, 그 수치는 현재 <?= number_format($autoPolicy->reqNPCDevelGold) ?>입니다.</small></div>
</div>
<div class="col-sm-6">
<div class="row">
<label for="reqNPCDevelRice" class="col-sm-6 col-form-label">NPC내정장 권장 쌀</label>
<div class="col-sm-6">
<input type="number" class="form-control" data-type="integer" id="reqNPCDevelRice" min="0" value="0">
</div>
</div>
<div style='text-align:right;'><small class="form-text text-muted">NPC내정장에게 주는 쌀입니다. 이보다 5배 더 많다면 헌납합니다.</small></div>
</div>
</div>
<div class="form-group row">
<div class="col-sm-6">
<div class="row">
<label for="minimumResourceActionAmount" class="col-sm-6 col-form-label">포상/몰수/헌납/삼/팜 최소 단위</label>
<div class="col-sm-6">
<input type="number" class="form-control" data-type="integer" id="minimumResourceActionAmount" min="0" value="0">
</div>
</div>
<div style='text-align:right;'><small class="form-text text-muted">연산결과가 이 단위보다 적다면 수행하지 않습니다.</small></div>
</div>
<div class="col-sm-6">
<div class="row">
<label for="minWarCrew" class="col-sm-6 col-form-label">최소 전투 가능 병력 수</label>
<div class="col-sm-6">
<input type="number" class="form-control" data-type="integer" id="minWarCrew" min="0" value="0">
</div>
</div>
<div style='text-align:right;'><small class="form-text text-muted">이보다 적을 때에는 징병을 시도합니다.</small></div>
</div>
</div>
<div class="form-group row">
<div class="col-sm-6">
<div class="row">
<label for="minNPCRecruitCityPopulation" class="col-sm-6 col-form-label">NPC 최소 징병 가능 인구 수</label>
<div class="col-sm-6">
<input type="number" class="form-control" data-type="integer" id="minNPCRecruitCityPopulation" min="0" value="0">
</div>
</div>
<div style='text-align:right;'><small class="form-text text-muted">이보다 낮으면 NPC는 도시에서 징병하지 않고 후방 워프합니다.</small></div>
</div>
<div class="col-sm-6">
<div class="row">
<label for="safeRecruitCityPopulationRatio" class="col-sm-6 col-form-label">제자리 징병 허용 인구율(%)</label>
<div class="col-sm-6">
<input type="number" class="form-control" data-type="percent" id="safeRecruitCityPopulationRatio" min="0" max="100" value="0">
</div>
</div>
<div style='text-align:right;'><small class="form-text text-muted">전쟁 시 후방 발령, 후방 워프의 기준 인구입니다. 이보다 많다면 '충분하다'고 판단합니다.</small></div>
</div>
</div>
<div class="form-group row">
<div class="col-sm-6">
<div class="row">
<label for="minNPCWarLeadership" class="col-sm-6 col-form-label">NPC 전투 참여 통솔 기준</label>
<div class="col-sm-6">
<input type="number" class="form-control" data-type="integer" id="minNPCWarLeadership" min="0" value="0">
</div>
</div>
<div style='text-align:right;'><small class="form-text text-muted">이 수치보다 같거나 높으면 NPC전투장으로 분류됩니다.</small></div>
</div>
<div class="col-sm-6">
<div class="row">
<label for="properWarTrainAtmos" class="col-sm-6 col-form-label">훈련/사기진작 목표치</label>
<div class="col-sm-6">
<input type="number" class="form-control" data-type="integer" id="properWarTrainAtmos" min="0" max="100" value="0">
</div>
</div>
<div style='text-align:right;'><small class="form-text text-muted">훈련/사기진작 기준치입니다. 이보다 같거나 높으면 출병합니다.</small></div>
</div>
</div>
<div class="alert alert-secondary">
전투 부대는 작업중입니다(json양식: {부대번호:[시작도시번호(아국),도착도시번호(적군)],...})<br>
후방 징병 부대는 작업중입니다(json양식: [부대번호,...])<br>
내정 부대는 작업중입니다(json양식: [부대번호,...])
<input type="hidden" value="{}" data-type="json" id="CombatForce">
<input type="hidden" value="[]" data-type="json" id="SupportForce">
<input type="hidden" value="[]" data-type="json" id="DevelopForce">
<input type="hidden" value="true" data-type="json" id="allowNpcAttackCity">
<!--allowNpcAttackCity는 현재 게임 내 비활성-->
</div>
<div class='control_bar' data-type="nationPolicy">
<div class="btn-group" role="group">
<button type="button" class="btn btn-dark reset_btn">초기값으로</button>
<button type="button" class="btn btn-secondary revert_btn">이전값으로</button>
</div><button type="button" class="btn btn-primary submit_btn">설정</button>
</div>
</div>
<div class="row">
<div class="col-sm-6 half_section_left">
<div class='bg1 section_bar'>NPC 사령턴 우선순위</div>
<div class="float-right px-3"><small class="form-text text-muted">
최근 설정: <?= $rawNationPolicy['prioritySetter'] ?? '-없음-' ?> (<?= $rawNationPolicy['prioritySetTime'] ?? '설정 기록 없음' ?>)
</small></div>
<div class='text-left px-2'><small class="text-muted">예턴이 없거나, 지정되어 있더라도 실패할경우<br>아래 순위에 따라 사령턴을 시도합니다.</small></div>
<div class="form_list">
<div class="row">
<div class="col-sm-6">
<div class="bg2 sub_bar">비활성</div>
<div id="nationPriorityDisabled" class="list-group col" data-type="list">
</div>
</div>
<div class="col-sm-6">
<div class="bg2 sub_bar">활성</div>
<div id="nationPriority" class="list-group col" data-type="list">
</div>
</div>
</div>
<div class='control_bar' data-type="nationPriority">
<div class="btn-group" role="group">
<button type="button" class="btn btn-dark reset_btn">초기값으로</button>
<button type="button" class="btn btn-secondary revert_btn">이전값으로</button>
</div><button type="button" class="btn btn-primary submit_btn">설정</button>
</div>
</div>
</div>
<div class="col-sm-6 half_section_right">
<div class='bg1 section_bar'>NPC 일반턴 우선순위</div>
<div class="float-right px-3"><small class="form-text text-muted">
최근 설정: <?= $rawNationGeneralPolicy['prioritySetter'] ?? '-없음-' ?> (<?= $rawNationGeneralPolicy['prioritySetTime'] ?? '설정 기록 없음' ?>)
</small></div>
<div class='text-left px-2'><small class="text-muted">순위가 높은 것부터 시도합니다. <br>아무것도 실행할 수 없으면 물자조달이나 인재탐색을 합니다.</small></div>
<div class="form_list">
<div class="row">
<div class="col-sm-6">
<div class="bg2 sub_bar">비활성</div>
<div id="generalPriorityDisabled" class="list-group col" data-type="list">
</div>
</div>
<div class="col-sm-6">
<div class="bg2 sub_bar">활성</div>
<div id="generalPriority" class="list-group col" data-type="list">
</div>
</div>
</div>
<div class='control_bar' data-type="generalPriority">
<div class="btn-group" role="group">
<button type="button" class="btn btn-dark reset_btn">초기값으로</button>
<button type="button" class="btn btn-secondary revert_btn">이전값으로</button>
</div><button type="button" class="btn btn-primary submit_btn">설정</button>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
+65 -65
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -12,19 +13,18 @@ $isChiefTurn = Util::getReq('is_chief', 'bool', false);
function die_redirect()
{
global $isChiefTurn;
if(!$isChiefTurn){
if (!$isChiefTurn) {
header('location:index.php', true, 303);
}
else{
} else {
header('location:b_chiefcenter.php', true, 303);
}
die();
}
if(!$turnList || !$commandType){
if (!$turnList || !$commandType) {
die_redirect();
}
if(!is_array($turnList)){
if (!is_array($turnList)) {
die_redirect();
}
@@ -32,11 +32,11 @@ $session = Session::requireGameLogin()->setReadOnly();
$db = DB::db();
if(!$isChiefTurn && !in_array($commandType, Util::array_flatten(GameConst::$availableGeneralCommand))){
if (!$isChiefTurn && !in_array($commandType, Util::array_flatten(GameConst::$availableGeneralCommand))) {
die_redirect();
}
if($isChiefTurn && !in_array($commandType, Util::array_flatten(GameConst::$availableChiefCommand))){
if ($isChiefTurn && !in_array($commandType, Util::array_flatten(GameConst::$availableChiefCommand))) {
die_redirect();
}
@@ -44,88 +44,88 @@ $gameStor = KVStorage::getStorage($db, 'game_env')->turnOnCache();
$env = $gameStor->getAll();
$general = General::createGeneralObjFromDB($session->generalID);
if(!$isChiefTurn){
if (!$isChiefTurn) {
$commandObj = buildGeneralCommandClass($commandType, $general, $env);
}
else{
if($general->getVar('officer_level') < 5){
} else {
if ($general->getVar('officer_level') < 5) {
die_redirect();
}
$commandObj = buildNationCommandClass($commandType, $general, $env, new LastTurn());
}
if($commandObj->isArgValid()){
if ($commandObj->isArgValid()) {
//인자가 필요없는 타입의 경우 processing에서 '전혀' 처리하지 않음!
die_redirect();
}
if(!$commandObj->hasPermissionToReserve()){
if (!$commandObj->hasPermissionToReserve()) {
die_redirect();
}
$jsList = $commandObj->getJSFiles();
$jsList = $commandObj->getJSPlugins();
$cssList = $commandObj->getCSSFiles();
?>
<!DOCTYPE html>
<html>
<head>
<title><?=$commandObj->getName()?></title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('../e_lib/select2/select2.full.min.js')?>
<?=WebUtil::printJS('../d_shared/common_path.js')?>
<?=WebUtil::printJS('js/common.js')?>
<?=WebUtil::printJS('d_shared/base_map.js')?>
<?=WebUtil::printJS('js/map.js')?>
<?=WebUtil::printJS('js/processing.js')?>
<script>
window.serverNick = '<?=DB::prefix()?>';
window.serverID = '<?=UniqueConst::$serverID?>';
window.command = '<?=$commandType?>';
window.turnList = [<?=join(', ',$turnList)?>];
window.isChiefTurn = <?=$isChiefTurn?'true':'false'?>;
</script>
<?php
foreach($jsList as $js){
print(WebUtil::printJS($js));
}
?>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../e_lib/select2/select2.min.css')?>
<?=WebUtil::printCSS('../e_lib/select2/select2-bootstrap4.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<?=WebUtil::printCSS('css/main.css')?>
<?=WebUtil::printCSS('css/map.css')?>
<?=WebUtil::printCSS('css/processing.css')?>
<?php
foreach($cssList as $css){
print(WebUtil::printCSS($css));
}
?>
<title><?= $commandObj->getName() ?></title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printJS('d_shared/base_map.js') ?>
<script>
window.serverNick = '<?= DB::prefix() ?>';
window.serverID = '<?= UniqueConst::$serverID ?>';
window.command = '<?= $commandType ?>';
window.turnList = [<?= join(', ', $turnList) ?>];
window.isChiefTurn = <?= $isChiefTurn ? 'true' : 'false' ?>;
var jsPlugins = <?= Json::encode($jsList) ?>;
</script>
<?= WebUtil::printCSS('../e_lib/select2/select2.min.css') ?>
<?= WebUtil::printCSS('../e_lib/select2/select2-bootstrap4.css') ?>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printCSS('css/main.css') ?>
<?= WebUtil::printCSS('css/map.css') ?>
<?= WebUtil::printCSS('css/processing.css') ?>
<?php
foreach ($cssList as $css) {
print(WebUtil::printCSS($css));
}
?>
<?= WebUtil::printDist('ts', ['common', 'processing']) ?>
</head>
<body class="img_back">
<table class="tb_layout bg0" style="width:1000px;margin:auto;">
<tr><td class="bg1" style='text-align:center;'><?=$commandObj->getName()?></td></tr>
<tr><td>
<input type=button value='돌아가기' onclick="history.back();"><br>
</td></tr></table>
<table class="tb_layout bg0" style="width:1000px;margin:auto;">
<tr>
<td class="bg1" style='text-align:center;'><?= $commandObj->getName() ?></td>
</tr>
<tr>
<td>
<input type=button value='돌아가기' onclick="history.back();"><br>
</td>
</tr>
</table>
<div class="tb_layout bg0" style="width:1000px;margin:auto;padding-bottom:2em;border:solid 1px gray;">
<?=$commandObj->getForm()?>
</div>
<div class="tb_layout bg0" style="width:1000px;margin:auto;padding-bottom:2em;border:solid 1px gray;">
<?= $commandObj->getForm() ?>
</div>
<table class="tb_layout bg0" style="width:1000px;margin:auto;">
<tr><td>
<input type=button value='돌아가기' onclick="history.back();"><br>
<?=banner()?>
</td></tr></table>
<table class="tb_layout bg0" style="width:1000px;margin:auto;">
<tr>
<td>
<input type=button value='돌아가기' onclick="history.back();"><br>
<?= banner() ?>
</td>
</tr>
</table>
</body>
</html>
</html>
+440 -360
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -15,7 +16,7 @@ TurnExecutionHelper::executeAllCommand();
$me = $db->queryFirstRow('select no,tournament,con,turntime from general where owner=%i', $userID);
$admin = $gameStor->getValues(['tournament','phase','tnmt_msg','tnmt_type','develcost','tnmt_trig']);
$admin = $gameStor->getValues(['tournament', 'phase', 'tnmt_msg', 'tnmt_type', 'develcost', 'tnmt_trig']);
$con = checkLimit($me['con']);
if ($con >= 2) {
@@ -24,11 +25,32 @@ if ($con >= 2) {
}
switch ($admin['tnmt_type']) {
default: throw new \RuntimeException('invalid tnmt_type');
case 0: $tnmt_type = "<font color=cyan>전력전</font>"; $tp = "total"; $tp2 = "종합"; $tp3 = "total"; break;
case 1: $tnmt_type = "<font color=cyan>통솔전</font>"; $tp = "leadership"; $tp2 = "통솔"; $tp3 = "leadership"; break;
case 2: $tnmt_type = "<font color=cyan>일기토</font>"; $tp = "strength"; $tp2 = "무력"; $tp3 = "strength"; break;
case 3: $tnmt_type = "<font color=cyan>설전</font>"; $tp = "intel"; $tp2 = "지력"; $tp3 = "intel"; break;
default:
throw new \RuntimeException('invalid tnmt_type');
case 0:
$tnmt_type = "<font color=cyan>전력전</font>";
$tp = "total";
$tp2 = "종합";
$tp3 = "total";
break;
case 1:
$tnmt_type = "<font color=cyan>통솔전</font>";
$tp = "leadership";
$tp2 = "통솔";
$tp3 = "leadership";
break;
case 2:
$tnmt_type = "<font color=cyan>일기토</font>";
$tp = "strength";
$tp2 = "무력";
$tp3 = "strength";
break;
case 3:
$tnmt_type = "<font color=cyan>설전</font>";
$tp = "intel";
$tp2 = "지력";
$tp3 = "intel";
break;
}
?>
@@ -37,355 +59,406 @@ case 3: $tnmt_type = "<font color=cyan>설전</font>"; $tp = "intel"; $tp2 = "
<?php if ($con == 1) {
MessageBox("접속제한이 얼마 남지 않았습니다! 제한량이 모자라다면 참여를 해보세요^^");
} ?>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?=UniqueConst::$serverName?>: 토너먼트</title>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?= UniqueConst::$serverName ?>: 토너먼트</title>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<?= WebUtil::printDist('ts', 'common', true) ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
</head>
<body>
<table align=center width=2000 class='tb_layout bg0'>
<tr><td>삼모전 토너먼트<br><?=closeButton()?></td></tr>
</table>
<table align=center class='tb_layout bg0'>
<?php
if ($session->userGrade >= 5) {
$sel = [];
echo "
<table align=center width=2000 class='tb_layout bg0'>
<tr>
<td>삼모전 토너먼트<br><?= closeButton() ?></td>
</tr>
</table>
<table align=center class='tb_layout bg0'>
<?php
if ($session->userGrade >= 5) {
$sel = [];
echo "
<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=button value='갱신' onclick='location.reload()'>";
switch ($admin['tnmt_trig']) {
case 0: $sel[0] = "selected"; break;
case 1: $sel[1] = "selected"; break;
case 2: $sel[2] = "selected"; break;
case 3: $sel[3] = "selected"; break;
case 4: $sel[4] = "selected"; break;
case 5: $sel[5] = "selected"; break;
case 6: $sel[6] = "selected"; break;
case 7: $sel[7] = "selected"; break;
}
switch ($admin['tnmt_trig']) {
case 0:
$sel[0] = "selected";
break;
case 1:
$sel[1] = "selected";
break;
case 2:
$sel[2] = "selected";
break;
case 3:
$sel[3] = "selected";
break;
case 4:
$sel[4] = "selected";
break;
case 5:
$sel[5] = "selected";
break;
case 6:
$sel[6] = "selected";
break;
case 7:
$sel[7] = "selected";
break;
}
if ($admin['tournament'] == 0) {
if ($admin['tournament'] == 0) {
?>
<select name=auto size=1 style=color:white;background-color:black;>
<option style=color:white; value=0>수동진행</option>
<option style=color:white; value=1>12분 05일</option>
<option style=color:white; value=2>07분 10시</option>
<option style=color:white; value=3>03분 04시</option>
<option style=color:white; value=4>01분 82분</option>
<option style=color:white; value=5>30초 41분</option>
<option style=color:white; value=6>15초 21분</option>
<option style=color:white; value=7>05초 07분</option>
</select>
<select name=type size=1 style=color:white;background-color:black;>
<option style=color:white; value=0>전력전</option>
<option style=color:white; value=1>통솔전</option>
<option style=color:white; value=2>일기토</option>
<option style=color:white; value=3>설전</option>
</select>
<input type=submit name=btn value='개최'>
<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=1 <?=$sel[1]??''?>>12분 05일</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=4 <?=$sel[4]??''?>>01분 82분</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=7 <?=$sel[7]??''?>>05초 07분</option>
</select>
<input type=submit name=btn value='자동개최설정'>
<input type=submit name=btn value='포상'>
<input type=submit name=btn value='회수'>
<select name=auto size=1 style=color:white;background-color:black;>
<option style=color:white; value=0>수동진행</option>
<option style=color:white; value=1>12분 05일</option>
<option style=color:white; value=2>07분 10시</option>
<option style=color:white; value=3>03분 04시</option>
<option style=color:white; value=4>01분 82분</option>
<option style=color:white; value=5>30초 41분</option>
<option style=color:white; value=6>15초 21분</option>
<option style=color:white; value=7>05초 07분</option>
</select>
<select name=type size=1 style=color:white;background-color:black;>
<option style=color:white; value=0>전력전</option>
<option style=color:white; value=1>통솔전</option>
<option style=color:white; value=2>일기토</option>
<option style=color:white; value=3>설전</option>
</select>
<input type=submit name=btn value='개최'>
<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=1 <?= $sel[1] ?? '' ?>>12분 05일</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=4 <?= $sel[4] ?? '' ?>>01분 82분</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=7 <?= $sel[7] ?? '' ?>>05초 07분</option>
</select>
<input type=submit name=btn value='자동개최설정'>
<input type=submit name=btn value='포상'>
<input type=submit name=btn value='회수'>
<?php
} else {
echo "<input type=submit name=btn value='중단' onclick='return confirm(\"진짜 중단하시겠습니까?\")'>";
}
} else {
echo "<input type=submit name=btn value='중단' onclick='return confirm(\"진짜 중단하시겠습니까?\")'>";
}
switch ($admin['tournament']) {
case 1:
echo "<input type=submit name=btn value='랜덤투입'>";
echo "<input type=submit name=btn value='랜덤전부투입'>";
break;
case 2: echo "<input type=submit name=btn value='예선'><input type=submit name=btn value='예선전부'>"; break;
case 3: echo "<input type=submit name=btn value='추첨'><input type=submit name=btn value='추첨전부'>"; break;
case 4: echo "<input type=submit name=btn value='본선'><input type=submit name=btn value='본선전부'>"; break;
case 5: echo "<input type=submit name=btn value='배정'>"; break;
case 6: echo "<input type=submit name=btn value='베팅마감'>"; break;
case 7: echo "<input type=submit name=btn value='16강'>"; break;
case 8: echo "<input type=submit name=btn value='8강'>"; break;
case 9: echo "<input type=submit name=btn value='4강'>"; break;
case 10: echo "<input type=submit name=btn value='결승'>"; break;
}
switch ($admin['tournament']) {
case 1:
echo "<input type=submit name=btn value='랜덤투입'>";
echo "<input type=submit name=btn value='랜덤전부투입'>";
break;
case 2:
echo "<input type=submit name=btn value='예선'><input type=submit name=btn value='예선전부'>";
break;
case 3:
echo "<input type=submit name=btn value='추첨'><input type=submit name=btn value='추첨전부'>";
break;
case 4:
echo "<input type=submit name=btn value='본선'><input type=submit name=btn value='본선전부'>";
break;
case 5:
echo "<input type=submit name=btn value='배정'>";
break;
case 6:
echo "<input type=submit name=btn value='베팅마감'>";
break;
case 7:
echo "<input type=submit name=btn value='16강'>";
break;
case 8:
echo "<input type=submit name=btn value='8강'>";
break;
case 9:
echo "<input type=submit name=btn value='4강'>";
break;
case 10:
echo "<input type=submit name=btn value='결승'>";
break;
}
echo "
echo "
</td></tr>
</form>";
} 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>";
} else {
echo "<tr><td colspan=8><input type=button value='갱신' onclick='location.reload()'></td></tr>";
}
} 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>";
} else {
echo "<tr><td colspan=8><input type=button value='갱신' onclick='location.reload()'></td></tr>";
}
$str1 = getTournament($admin['tournament']);
$str2 = getTournamentTime();
if($str2){
$str2 = ', '.$str2;
}
$str3 = getTournamentTerm();
if($str3){
$str3 = ', '.$str3;
}
?>
<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 id=bg2><font color=magenta size=5>16강 승자전</font></td></tr>
<tr><td height=10 colspan=8 align=center></td></tr>
<?php
$str1 = getTournament($admin['tournament']);
$str2 = getTournamentTime();
if ($str2) {
$str2 = ', ' . $str2;
}
$str3 = getTournamentTerm();
if ($str3) {
$str3 = ', ' . $str3;
}
?>
<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 class='bg2'>
<font color=magenta size=5>16강 승자전</font>
</td>
</tr>
<tr>
<td height=10 colspan=8 align=center></td>
</tr>
<?php
echo "
echo "
<tr>
<td colspan=8>
<table align=center width=2000 class='bg0 mimic_flex'>
<tr align=center>";
$generalList = $db->query('SELECT npc,name,win from tournament where grp>=60 order by grp, grp_no LIMIT 1');
while(count($generalList) < 1){
$generalList[] = [
'name'=>'-',
'npc'=>0,
'win'=>0
];
}
foreach($generalList as $i=>$general){
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>";
}
$generalList = $db->query('SELECT npc,name,win from tournament where grp>=60 order by grp, grp_no LIMIT 1');
while (count($generalList) < 1) {
$generalList[] = [
'name' => '-',
'npc' => 0,
'win' => 0
];
}
foreach ($generalList as $i => $general) {
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 "
echo "
</tr>
<tr align=center>";
$cent = [];
for ($i=0; $i < 1; $i++) {
$cent[$i] = "<font color=white>";
}
$line = [];
$gen = [];
$generalList = $db->query('SELECT npc,name,win from tournament where grp>=50 order by grp, grp_no LIMIT 2');
while(count($generalList) < 2){
$generalList[] = [
'name'=>'-',
'npc'=>0,
'win'=>0
];
}
foreach($generalList as $i=>$general){
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'];
}
for ($i=0; $i < 1; $i++) {
$cent[$i] = $cent[$i]."┻"."</font>";
$line[$i*2] = $line[$i*2]."┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━"."</font>";
$line[$i*2+1] = $line[$i*2+1]."━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓"."</font>";
echo "<td colspan=16>{$line[$i*2]}{$cent[$i]}{$line[$i*2+1]}</td>";
}
echo "
$cent = [];
for ($i = 0; $i < 1; $i++) {
$cent[$i] = "<font color=white>";
}
$line = [];
$gen = [];
$generalList = $db->query('SELECT npc,name,win from tournament where grp>=50 order by grp, grp_no LIMIT 2');
while (count($generalList) < 2) {
$generalList[] = [
'name' => '-',
'npc' => 0,
'win' => 0
];
}
foreach ($generalList as $i => $general) {
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'];
}
for ($i = 0; $i < 1; $i++) {
$cent[$i] = $cent[$i] . "┻" . "</font>";
$line[$i * 2] = $line[$i * 2] . "┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" . "</font>";
$line[$i * 2 + 1] = $line[$i * 2 + 1] . "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓" . "</font>";
echo "<td colspan=16>{$line[$i * 2]}{$cent[$i]}{$line[$i * 2 + 1]}</td>";
}
echo "
</tr>
<tr align=center>";
for ($i=0; $i < 2; $i++) {
echo "<td colspan=8>{$gen[$i]}</td>";
}
for ($i = 0; $i < 2; $i++) {
echo "<td colspan=8>{$gen[$i]}</td>";
}
echo "
echo "
</tr>
<tr align=center>";
for ($i=0; $i < 2; $i++) {
$cent[$i] = "<font color=white>";
}
for ($i = 0; $i < 2; $i++) {
$cent[$i] = "<font color=white>";
}
$generalList = $db->query('SELECT npc,name,win from tournament where grp>=40 order by grp, grp_no LIMIT 4');
while(count($generalList) < 4){
$generalList[] = [
'name'=>'-',
'npc'=>0,
'win'=>0
];
}
foreach($generalList as $i=>$general){
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'];
}
for ($i=0; $i < 2; $i++) {
$cent[$i] = $cent[$i]."┻"."</font>";
$line[$i*2] = $line[$i*2]."┏━━━━━━━━━━━━━━━━━━"."</font>";
$line[$i*2+1] = $line[$i*2+1]."━━━━━━━━━━━━━━━━━━┓"."</font>";
echo "<td colspan=8>{$line[$i*2]}{$cent[$i]}{$line[$i*2+1]}</td>";
}
echo "
$generalList = $db->query('SELECT npc,name,win from tournament where grp>=40 order by grp, grp_no LIMIT 4');
while (count($generalList) < 4) {
$generalList[] = [
'name' => '-',
'npc' => 0,
'win' => 0
];
}
foreach ($generalList as $i => $general) {
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'];
}
for ($i = 0; $i < 2; $i++) {
$cent[$i] = $cent[$i] . "┻" . "</font>";
$line[$i * 2] = $line[$i * 2] . "┏━━━━━━━━━━━━━━━━━━" . "</font>";
$line[$i * 2 + 1] = $line[$i * 2 + 1] . "━━━━━━━━━━━━━━━━━━┓" . "</font>";
echo "<td colspan=8>{$line[$i * 2]}{$cent[$i]}{$line[$i * 2 + 1]}</td>";
}
echo "
</tr>
<tr align=center>";
for ($i=0; $i < 4; $i++) {
echo "<td colspan=4>{$gen[$i]}</td>";
}
for ($i = 0; $i < 4; $i++) {
echo "<td colspan=4>{$gen[$i]}</td>";
}
echo "
echo "
</tr>
<tr align=center>";
for ($i=0; $i < 4; $i++) {
$cent[$i] = "<font color=white>";
}
for ($i = 0; $i < 4; $i++) {
$cent[$i] = "<font color=white>";
}
$generalList = $db->query('SELECT npc,name,win from tournament where grp>=30 order by grp, grp_no LIMIT 8');
while(count($generalList) < 8){
$generalList[] = [
'name'=>'-',
'npc'=>0,
'win'=>0
];
}
foreach($generalList as $i=>$general){
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'];
}
for ($i=0; $i < 4; $i++) {
$cent[$i] = $cent[$i]."┻"."</font>";
$line[$i*2] = $line[$i*2]."┏━━━━━━━━━"."</font>";
$line[$i*2+1] = $line[$i*2+1]."━━━━━━━━━┓"."</font>";
echo "<td colspan=4>{$line[$i*2]}{$cent[$i]}{$line[$i*2+1]}</td>";
}
echo "
$generalList = $db->query('SELECT npc,name,win from tournament where grp>=30 order by grp, grp_no LIMIT 8');
while (count($generalList) < 8) {
$generalList[] = [
'name' => '-',
'npc' => 0,
'win' => 0
];
}
foreach ($generalList as $i => $general) {
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'];
}
for ($i = 0; $i < 4; $i++) {
$cent[$i] = $cent[$i] . "┻" . "</font>";
$line[$i * 2] = $line[$i * 2] . "┏━━━━━━━━━" . "</font>";
$line[$i * 2 + 1] = $line[$i * 2 + 1] . "━━━━━━━━━┓" . "</font>";
echo "<td colspan=4>{$line[$i * 2]}{$cent[$i]}{$line[$i * 2 + 1]}</td>";
}
echo "
</tr>
<tr align=center>";
for ($i=0; $i < 8; $i++) {
echo "<td colspan=2>{$gen[$i]}</td>";
}
for ($i = 0; $i < 8; $i++) {
echo "<td colspan=2>{$gen[$i]}</td>";
}
echo "
echo "
</tr>
<tr align=center>";
for ($i=0; $i < 8; $i++) {
$cent[$i] = "<font color=white>";
}
$generalList = $db->query('SELECT npc,name,win from tournament where grp>=20 order by grp, grp_no LIMIT 16');
while(count($generalList) < 16){
$generalList[] = [
'name'=>'-',
'npc'=>0,
'win'=>0
];
}
foreach($generalList as $i=>$general){
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'];
}
for ($i=0; $i < 8; $i++) {
$cent[$i] = $cent[$i]."┻"."</font>";
$line[$i*2] = $line[$i*2]."┏━━━━"."</font>";
$line[$i*2+1] = $line[$i*2+1]."━━━━┓"."</font>";
echo "<td colspan=2>{$line[$i*2]}{$cent[$i]}{$line[$i*2+1]}</td>";
}
echo "
for ($i = 0; $i < 8; $i++) {
$cent[$i] = "<font color=white>";
}
$generalList = $db->query('SELECT npc,name,win from tournament where grp>=20 order by grp, grp_no LIMIT 16');
while (count($generalList) < 16) {
$generalList[] = [
'name' => '-',
'npc' => 0,
'win' => 0
];
}
foreach ($generalList as $i => $general) {
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'];
}
for ($i = 0; $i < 8; $i++) {
$cent[$i] = $cent[$i] . "┻" . "</font>";
$line[$i * 2] = $line[$i * 2] . "┏━━━━" . "</font>";
$line[$i * 2 + 1] = $line[$i * 2 + 1] . "━━━━┓" . "</font>";
echo "<td colspan=2>{$line[$i * 2]}{$cent[$i]}{$line[$i * 2 + 1]}</td>";
}
echo "
</tr>
<tr align=center>";
for ($i=0; $i < 16; $i++) {
echo "<td width=125>{$gen[$i]}</td>";
}
for ($i = 0; $i < 16; $i++) {
echo "<td width=125>{$gen[$i]}</td>";
}
echo"
echo "
</tr>";
$globalBet = $db->queryFirstList('SELECT * FROM betting WHERE general_id = 0')??[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, ];
$globalBet = array_splice($globalBet, -16);
$globalBetTotal = array_sum($globalBet);
$admin = $gameStor->getValues(['tournament', 'phase']);
$bet = [];
for ($i=0; $i < 16; $i++) {
if($globalBet[$i] == 0){
$bet[$i] = '∞';
continue;
}
$bet[$i] = round($globalBetTotal / $globalBet[$i], 2);
}
$globalBet = $db->queryFirstList('SELECT * FROM betting WHERE general_id = 0') ?? [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,];
$globalBet = array_splice($globalBet, -16);
$globalBetTotal = array_sum($globalBet);
$admin = $gameStor->getValues(['tournament', 'phase']);
$bet = [];
for ($i = 0; $i < 16; $i++) {
if ($globalBet[$i] == 0) {
$bet[$i] = '∞';
continue;
}
$bet[$i] = round($globalBetTotal / $globalBet[$i], 2);
}
echo "
echo "
<tr align=center>";
for ($i=0; $i < 16; $i++) {
echo "<td><font color=skyblue>{$bet[$i]}</font></td>";
}
for ($i = 0; $i < 16; $i++) {
echo "<td><font color=skyblue>{$bet[$i]}</font></td>";
}
echo "
echo "
</tr>
<tr align=center><td height=10 colspan=16></td></tr>
<tr align=center><td colspan=16><font color=skyblue size=4>배당률이 낮을수록 베팅된 금액이 많고 유저들이 우승후보로 많이 선택한 장수입니다.</font></td></tr>
@@ -393,87 +466,94 @@ echo "
</td>
</tr>";
if ($admin['tournament'] >= 7 || $admin['tournament'] == 0) {
printFighting($admin['tournament'], $admin['phase']);
}
echo "
if ($admin['tournament'] >= 7 || $admin['tournament'] == 0) {
printFighting($admin['tournament'], $admin['phase']);
}
echo "
<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 class='bg2'><font color=orange size=5>조별 본선 순위</font></td></tr>
<tr>";
$num = array("一", "二", "三", "四", "五", "六", "七", "八");
$num = array("一", "二", "三", "四", "五", "六", "七", "八");
for ($i=0; $i < 8; $i++) {
$grp = $i + 10;
echo "
for ($i = 0; $i < 8; $i++) {
$grp = $i + 10;
echo "
<td>
<table align=center width=250 class='tb_layout bg0'>
<tr><td colspan=9 style=background-color:black;>{$num[$i]}조</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>";
<tr class='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>";
$generalList = $db->query('SELECT npc,name,leadership,strength,intel,leadership+strength+intel as total,prmt,win+draw+lose as game,win,draw,lose,gl,win*3+draw as gd from tournament where grp=%i order by gd desc, gl desc, seq',$grp);
foreach($generalList as $k=>$general) {
printRow($k, $general['npc'], $general['name'], $general[$tp], $general['game'], $general['win'], $general['draw'], $general['lose'], $general['gd'], $general['gl'], $general['prmt']);
}
foreach(Util::range(count($generalList), 4) as $idx){
printRow($idx, '', '', '', '', '', '', '', '', '', '');
}
echo "
$generalList = $db->query('SELECT npc,name,leadership,strength,intel,leadership+strength+intel as total,prmt,win+draw+lose as game,win,draw,lose,gl,win*3+draw as gd from tournament where grp=%i order by gd desc, gl desc, seq', $grp);
foreach ($generalList as $k => $general) {
printRow($k, $general['npc'], $general['name'], $general[$tp], $general['game'], $general['win'], $general['draw'], $general['lose'], $general['gd'], $general['gl'], $general['prmt']);
}
foreach (Util::range(count($generalList), 4) as $idx) {
printRow($idx, '', '', '', '', '', '', '', '', '', '');
}
echo "
</table>
</td>";
}
echo "</tr>";
if ($admin['tournament'] == 4 || $admin['tournament'] == 5) {
printFighting($admin['tournament'], $admin['phase']);
}
echo "
<tr><td colspan=8 align=center id=bg2><font color=yellow size=5>조별 예선 순위</font></td></tr>
}
echo "</tr>";
if ($admin['tournament'] == 4 || $admin['tournament'] == 5) {
printFighting($admin['tournament'], $admin['phase']);
}
echo "
<tr><td colspan=8 align=center class='bg2'><font color=yellow size=5>조별 예선 순위</font></td></tr>
<tr>";
for ($i=0; $i < 8; $i++) {
$grp = $i;
echo "
for ($i = 0; $i < 8; $i++) {
$grp = $i;
echo "
<td>
<table align=center width=250 class='tb_layout bg0'>
<tr><td colspan=9 style=background-color:black;>{$num[$i]}조</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>";
<tr class='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>";
$generalList = $db->query('SELECT npc,name,leadership,strength,intel,leadership+strength+intel as total,prmt,win+draw+lose as game,win,draw,lose,gl,win*3+draw as gd from tournament where grp=%i order by gd desc, gl desc, seq',$grp);
foreach($generalList as $k=>$general) {
printRow($k, $general['npc'], $general['name'], $general[$tp], $general['game'], $general['win'], $general['draw'], $general['lose'], $general['gd'], $general['gl'], $general['prmt']);
}
foreach(Util::range(count($generalList), 8) as $idx){
printRow($idx, '', '', '', '', '', '', '', '', '', '');
}
echo "
$generalList = $db->query('SELECT npc,name,leadership,strength,intel,leadership+strength+intel as total,prmt,win+draw+lose as game,win,draw,lose,gl,win*3+draw as gd from tournament where grp=%i order by gd desc, gl desc, seq', $grp);
foreach ($generalList as $k => $general) {
printRow($k, $general['npc'], $general['name'], $general[$tp], $general['game'], $general['win'], $general['draw'], $general['lose'], $general['gd'], $general['gl'], $general['prmt']);
}
foreach (Util::range(count($generalList), 8) as $idx) {
printRow($idx, '', '', '', '', '', '', '', '', '', '');
}
echo "
</table>
</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><td colspan=8>
<font color=white size=2>
ㆍ예선은 홈&amp;어웨이 풀리그로 진행됩니다. (총 14경기)<br>
ㆍ상위 4명이 본선에 진출하게 되며 조추첨을 통해 조가 배정됩니다.<br>
ㆍ각 조1위가 시드1로 랜덤하게 조에 배정되며, 역시 각 조2위가 시드2로 랜덤하게 조에 배정됩니다.<br>
ㆍ그후 남은 3, 4위는 완전 랜덤하게 모든 조에 랜덤하게 배정됩니다.<br>
ㆍ본선은 개인당 3경기를 치르게 되며 승점(승3, 무1, 패0), 득실, 참가순서(시드)에 따라 순위를 매깁니다.<br>
ㆍ각 조 1, 2위는 16강에 지정된 위치에 배정됩니다.<br>
ㆍ16강부터는 1경기 토너먼트로 진행됩니다.<br>
ㆍ참가비는 금20~140이며, 성적에 따라 금과 약간의 명성이 포상으로 주어집니다.<br>
ㆍ16강자 100, 8강자 300, 4강자 600, 준우승자 1200, 우승자 2000 (220년 기준)<br>
ㆍ즐거운 삼토!
</font>
</td></tr>
</table>
<table align=center width=2000 class='tb_layout bg0'>
<tr><td><?=closeButton()?></td></tr>
<tr><td><?=banner()?> </td></tr>
</table>
?>
</tr>
<tr>
<td colspan=8>
<font color=white size=2>
ㆍ예선은 홈&amp;어웨이 풀리그로 진행됩니다. (총 14경기)<br>
ㆍ상위 4명이 본선에 진출하게 되며 조추첨을 통해 조가 배정됩니다.<br>
ㆍ각 조1위가 시드1로 랜덤하게 조에 배정되며, 역시 각 조2위가 시드2로 랜덤하게 조에 배정됩니다.<br>
ㆍ그후 남은 3, 4위는 완전 랜덤하게 모든 조에 랜덤하게 배정됩니다.<br>
ㆍ본선은 개인당 3경기를 치르게 되며 승점(승3, 무1, 패0), 득실, 참가순서(시드)에 따라 순위를 매깁니다.<br>
ㆍ각 조 1, 2위는 16강에 지정된 위치에 배정됩니다.<br>
ㆍ16강부터는 1경기 토너먼트로 진행됩니다.<br>
ㆍ참가비는 금20~140이며, 성적에 따라 금과 약간의 명성이 포상으로 주어집니다.<br>
ㆍ16강자 100, 8강자 300, 4강자 600, 준우승자 1200, 우승자 2000 (220년 기준)<br>
ㆍ즐거운 삼토!
</font>
</td>
</tr>
</table>
<table align=center width=2000 class='tb_layout bg0'>
<tr>
<td><?= closeButton() ?></td>
</tr>
<tr>
<td><?= banner() ?> </td>
</tr>
</table>
</body>
</html>
</html>
+153 -138
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -14,19 +15,18 @@ increaseRefresh("부대편성", 1);
$me = $db->queryFirstRow('SELECT no,nation,troop FROM general WHERE owner=%i', $userID);
$troops = [];
foreach($db->query('SELECT troop_leader,name FROM troop WHERE nation = %i', $me['nation']) as $rawTroop){
foreach ($db->query('SELECT troop_leader,name FROM troop WHERE nation = %i', $me['nation']) as $rawTroop) {
$troops[$rawTroop['troop_leader']] = [
'name'=>$rawTroop['name'],
'users'=>[]
'name' => $rawTroop['name'],
'users' => []
];
}
foreach($db->query(
foreach ($db->query(
'SELECT no,name,turntime,troop,city FROM general WHERE troop!=0 AND nation = %i ORDER BY turntime ASC',
$me['nation']
) as $general
){
if(!key_exists($general['troop'], $troops)){
) as $general) {
if (!key_exists($general['troop'], $troops)) {
trigger_error("올바르지 않은 부대 소속 {$general['no']}, {$general['name']} : {$general['troop']}");
continue;
}
@@ -36,33 +36,32 @@ foreach($db->query(
$troops[$general['troop']]['users'][] = $general;
}
if($troops){
if ($troops) {
$troopLeaders = $db->query(
'SELECT no,name,picture,imgsvr,turntime,city,troop FROM general WHERE no IN %li',
array_keys($troops)
);
$generalTurnList = [];
foreach($db->queryAllLists(
'SELECT general_id, turn_idx, brief FROM general_turn WHERE general_id IN %li AND turn_idx < 5 ORDER BY general_id ASC, turn_idx ASC',
foreach ($db->queryAllLists(
'SELECT general_id, turn_idx, brief FROM general_turn WHERE general_id IN %li AND turn_idx < 5 ORDER BY general_id ASC, turn_idx ASC',
array_column($troopLeaders, 'no')
) as [$generalID, $turnIdx, $brief]
){
if(!key_exists($generalID, $generalTurnList)){
) as [$generalID, $turnIdx, $brief]) {
if (!key_exists($generalID, $generalTurnList)) {
$generalTurnList[$generalID] = [];
}
$generalTurnList[$generalID][$turnIdx] = $brief;
}
foreach($troopLeaders as $troopLeader){
foreach ($troopLeaders as $troopLeader) {
$imageTemp = GetImageURL($troopLeader['imgsvr']);
$troopLeader['pictureFullPath'] = "$imageTemp/{$troopLeader['picture']}";
$troopLeader['cityText'] = CityConst::byID($troopLeader['city'])->name;
$turnText = [];
foreach($generalTurnList[$troopLeader['no']] as $rawTurnIdx => $brief){
if($brief != '집합'){
foreach ($generalTurnList[$troopLeader['no']] as $rawTurnIdx => $brief) {
if ($brief != '집합') {
$brief = '~';
}
$turnIdx = $rawTurnIdx + 1;
@@ -73,143 +72,159 @@ if($troops){
}
}
uasort($troops, function($lhs, $rhs){
return $lhs['leader']['turntime']<=>$rhs['leader']['turntime'];
uasort($troops, function ($lhs, $rhs) {
return $lhs['leader']['turntime'] <=> $rhs['leader']['turntime'];
})
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?=UniqueConst::$serverName?>: 부대편성</title>
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('js/common.js')?>
<?=WebUtil::printJS('js/troop.js')?>
<?=WebUtil::printJS('js/ext.plugin_troop.js')?>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<?=WebUtil::printCSS('css/troops.css')?>
<script>
</script>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?= UniqueConst::$serverName ?>: 부대편성</title>
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printDist('ts', ['common', 'troop'], true) ?>
</head>
<body>
<div style="width:1000px;margin:auto;">
<table width=1000 class='tb_layout bg0'>
<tr><td>부 대 편 성<br><?=backButton()?></td></tr>
</table>
<table id="troop_list" class='tb_layout bg0'>
<thead>
<tr>
<td width=64 class='bg1 center'>선 택</td>
<td width=130 class='bg1 center'>부 대 정 보</td>
<td width=100 class='bg1 center'>부 대 장</td>
<td width=576 class='bg1 center' style=table-layout:fixed;word-break:break-all;>장 수</td>
<td width=130 class='bg1 center' style=table-layout:fixed;word-break:break-all;>부대장행동</td>
</tr>
</thead>
<tfoot><tr><td colspan='5'>
<?php if(!$troops): ?>
<?php elseif($me['troop'] == 0): ?>
<input type=button id='btnJoinTroop' value='부 대 가 입'>
<?php else: ?>
<input type=button id="btnLeaveTroop" value='부 대 탈 퇴'>
<?php endif;?>
</td></tr></tfoot>
<tbody>
<?php
foreach ($troops as $troopNo=>$troop) {
$troopLeader = $troop['leader'];
$genlistText = [];
$cityText = $troopLeader['cityText'];
$cityID = $troopLeader['city'];
$leaderID = $troopLeader['no'];
<div style="width:1000px;margin:auto;">
<table width=1000 class='tb_layout bg0'>
<tr>
<td>부 대 편 성<br><?= backButton() ?></td>
</tr>
</table>
<table id="troop_list" class='tb_layout bg0'>
<thead>
<tr>
<td width=64 class='bg1 center'>선 택</td>
<td width=130 class='bg1 center'>부 대 정 보</td>
<td width=100 class='bg1 center'>부 대 장</td>
<td width=576 class='bg1 center' style=table-layout:fixed;word-break:break-all;>장 수</td>
<td width=130 class='bg1 center' style=table-layout:fixed;word-break:break-all;>부대장행동</td>
</tr>
</thead>
<tfoot>
<tr>
<td colspan='5'>
<?php if (!$troops) : ?>
<?php elseif ($me['troop'] == 0) : ?>
<input type=button id='btnJoinTroop' value='부 대 가 입'>
<?php else : ?>
<input type=button id="btnLeaveTroop" value='부 대 탈 퇴'>
<?php endif; ?>
</td>
</tr>
</tfoot>
<tbody>
<?php
foreach ($troops as $troopNo => $troop) {
$troopLeader = $troop['leader'];
$genlistText = [];
$cityText = $troopLeader['cityText'];
$cityID = $troopLeader['city'];
$leaderID = $troopLeader['no'];
foreach ($troop['users'] as $troopUser) {
$spanClass = 'troopUser';
if ($troopUser['city'] !== $cityID) {
$spanClass.= ' diffCity';
}
if ($troopUser['no'] == $leaderID) {
$spanClass.= ' leader';
}
$genlistText[] = "<span class='$spanClass' data-general-id='{$troopUser['no']}'
foreach ($troop['users'] as $troopUser) {
$spanClass = 'troopUser';
if ($troopUser['city'] !== $cityID) {
$spanClass .= ' diffCity';
}
if ($troopUser['no'] == $leaderID) {
$spanClass .= ' leader';
}
$genlistText[] = "<span class='$spanClass' data-general-id='{$troopUser['no']}'
><span class='generalName'>{$troopUser['name']}</span><span class='cityText'>【{$troopUser['cityText']}】</span
></span>";
}
}
$genlistText = sprintf('%s (%d명)', join(', ', $genlistText), count($genlistText)); ?>
$genlistText = sprintf('%s (%d명)', join(', ', $genlistText), count($genlistText)); ?>
<?php if ($me['troop'] == 0): ?>
<tr>
<td align=center rowspan=2><input type='radio' class='troopId' name='troop' value='<?=$troopNo?>'></td>
<td align=center><?=$troop['name']?><br>【 <?=$cityText?> 】</td>
<td height=64 class='generalIcon' style='background:no-repeat center url("<?=$troopLeader['pictureFullPath']?>");background-size:64px;'>&nbsp;</td>
<td rowspan=2 width=62><?=$genlistText?></td>
<td rowspan=2><?=$troopLeader['turnText']?></td>
</tr>
<tr>
<td align=center><font size=2>【턴】 <?=substr($troopLeader['turntime'], 14, 5)?></font></td>
<td align=center><font size=1><?=$troopLeader['name']?></font></td></tr>
<tr><td colspan=5>
<?php if ($me['troop'] == 0) : ?>
<tr>
<td align=center rowspan=2><input type='radio' class='troopId' name='troop' value='<?= $troopNo ?>'></td>
<td align=center><?= $troop['name'] ?><br>【 <?= $cityText ?> 】</td>
<td height=64 class='generalIcon' style='background:no-repeat center url("<?= $troopLeader['pictureFullPath'] ?>");background-size:64px;'>&nbsp;</td>
<td rowspan=2 width=62><?= $genlistText ?></td>
<td rowspan=2><?= $troopLeader['turnText'] ?></td>
</tr>
<tr>
<td align=center>
<font size=2>【턴】 <?= substr($troopLeader['turntime'], 14, 5) ?></font>
</td>
<td align=center>
<font size=1><?= $troopLeader['name'] ?></font>
</td>
</tr>
<tr>
<td colspan=5>
<?php else: ?>
<tr>
<td align=center rowspan=2>&nbsp;</td>
<td align=center ><?=$troop['name']?><br>【 <?=$cityText?> 】</td>
<td height=64 class='generalIcon' style='background:no-repeat center url("<?=$troopLeader['pictureFullPath']?>");background-size:64px;'>&nbsp;</td>
<td rowspan=2 width=62><?=$genlistText?></td>
<td rowspan=2>
<?php if ($me['no'] == $troopLeader['no']): ?>
<select id='genNo' name=gen size=3 style=color:white;background-color:black;font-size:13px;width:128px;>";
<?php foreach ($troop['users'] as $troopUser): ?>
<?php if ($troopUser['no'] == $me['no']) {
continue;
} ?>
<option value='<?=$troopUser['no']?>'><?=$troopUser['name']?></option>
<?php endforeach; ?>
</select><br>
<input type=button id='btnKickTroop' value='부 대 추 방' style=width:130px;height:25px;>
<?php else: ?>
<?=$troopLeader['turnText']?>
<?php endif; ?>
</td>
</tr>
<tr><td align=center><font size=2>【턴】 <?=substr($troopLeader['turntime'], 14, 5)?></font></td>
<td align=center><font size=1><?=$troopLeader['name']?></font></td></tr>
<tr><td colspan=5></td></tr>
<?php endif;
<?php else : ?>
<tr>
<td align=center rowspan=2>&nbsp;</td>
<td align=center><?= $troop['name'] ?><br>【 <?= $cityText ?> 】</td>
<td height=64 class='generalIcon' style='background:no-repeat center url("<?= $troopLeader['pictureFullPath'] ?>");background-size:64px;'>&nbsp;</td>
<td rowspan=2 width=62><?= $genlistText ?></td>
<td rowspan=2>
<?php if ($me['no'] == $troopLeader['no']) : ?>
<select id='genNo' name=gen size=3 style=color:white;background-color:black;font-size:14px;width:128px;>";
<?php foreach ($troop['users'] as $troopUser) : ?>
<?php if ($troopUser['no'] == $me['no']) {
continue;
} ?>
<option value='<?= $troopUser['no'] ?>'><?= $troopUser['name'] ?></option>
<?php endforeach; ?>
</select><br>
<input type=button id='btnKickTroop' value='부 대 추 방' style=width:130px;height:25px;>
<?php else : ?>
<?= $troopLeader['turnText'] ?>
<?php endif; ?>
</td>
</tr>
<tr>
<td align=center>
<font size=2>【턴】 <?= substr($troopLeader['turntime'], 14, 5) ?></font>
</td>
<td align=center>
<font size=1><?= $troopLeader['name'] ?></font>
</td>
</tr>
<tr>
<td colspan=5></td>
</tr>
<?php endif;
} //foreach ($troops as $troopNo=>$troop) {
?>
} //foreach ($troops as $troopNo=>$troop) {
?>
</tbody>
</tbody>
</table>
<br>
<table width=1000 class='tb_layout bg0'>
<tr>
<td width=80 class='bg1'>부 대 명</td>
<td width=130><input type=text style=color:white;background-color:black; size=18 maxlength=18 id='nameplate'></td>
<?php if ($me['troop'] == 0) : ?>
<td><input type=button id='btnCreateTroop' value='부 대 창 설'></td>
<?php else : ?>
<td><input type=button id='btnChangeTroopName' value='부 대 변 경'></td>
<?php endif; ?>
</tr>
</table>
</table>
<br>
<table width=1000 class='tb_layout bg0'>
<tr>
<td width=80 id=bg1>부 대 명</td>
<td width=130><input type=text style=color:white;background-color:black; size=18 maxlength=18 id='nameplate'></td>
<?php if($me['troop'] == 0): ?>
<td><input type=button id='btnCreateTroop' value='부 대 창 설'></td>
<?php else: ?>
<td><input type=button id='btnChangeTroopName' value='부 대 변 경'></td>
<?php endif; ?>
</tr>
</table>
<table width=1000 class='tb_layout bg0'>
<tr><td><?=backButton()?></td></tr>
<tr><td><?=banner()?> </td></tr>
</table>
</div>
<table width=1000 class='tb_layout bg0'>
<tr>
<td><?= backButton() ?></td>
</tr>
<tr>
<td><?= banner() ?> </td>
</tr>
</table>
</div>
</body>
</html>
</html>
+467 -495
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -14,539 +15,510 @@ $year = $gameStor->year;
$me = $db->queryFirstRow('SELECT no, nation, city FROM general WHERE owner =%i', Session::getUserID());
if($me){
if ($me) {
$generalID = $me['no'];
$nationID = $me['nation'];
$city = $db->queryFirstRow('SELECT city, level, def, wall FROM city WHERE city = %i', $me['city']);
}
else{
} else {
$generalID = 0;
$nationID = 0;
$city = [
'city'=>0,
'level'=>5,
'def'=>1000,
'wall'=>1000,
'city' => 0,
'level' => 5,
'def' => 1000,
'wall' => 1000,
];
}
if($nationID){
if ($nationID) {
$nation = $db->queryFirstRow('SELECT level, type, tech, capital FROM nation WHERE nation = %i', $nationID);
}
else{
} else {
$nation = null;
}
?>
<!DOCTYPE html>
<html>
<head>
<title><?=UniqueConst::$serverName?>: 전투 시뮬레이터</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1100" />
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<?=WebUtil::printCSS('css/battle_simulator.css')?>
<?=WebUtil::printJS('../d_shared/common_path.js')?>
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/moment.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('../e_lib/download2.js')?>
<?=WebUtil::printJS('js/common.js')?>
<script>
var defaultSpecialDomestic = '<?=GameConst::$defaultSpecialDomestic?>';
var city = <?=Json::encode($city)?>;
var nation = <?=Json::encode($nation)?>;
</script>
<?=WebUtil::printJS('js/battle_simulator.js')?>
<title><?= UniqueConst::$serverName ?>: 전투 시뮬레이터</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1100" />
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printCSS('css/battle_simulator.css') ?>
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<script>
var defaultSpecialDomestic = '<?= GameConst::$defaultSpecialDomestic ?>';
var city = <?= Json::encode($city) ?>;
var nation = <?= Json::encode($nation) ?>;
</script>
<?= WebUtil::printDist('ts', ['common', 'battle_simulator']) ?>
</head>
<body>
<div id="container">
<div class="card mb-3">
<div class="card-header">
전역 설정
</div>
<div class="card-body dragpad_battle">
<div class="row">
<div class="col-sm-6">
<div class="input-group">
<input type="number" class="form-control" aria-describedby="text_year" value="<?=$startYear?>" disabled>
<div class="input-group-append">
<span class="input-group-text">년 시작</span>
</div>
<input type="number" class="form-control" id="year" value="<?=$year?>" min="<?=$startYear?>">
<div class="input-group-append">
<span class="input-group-text">년</span>
</div>
<input type="number" class="form-control" id="month" value="1" min="1" max="12">
<div class="input-group-append">
<span class="input-group-text">월</span>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="btn-toolbar" role="toolbar">
<div class="input-group mr-2" role="group">
<div class="input-group-prepend">
<span class="input-group-text">반복 횟수</span>
</div>
<select class="custom-select" id="repeat_cnt">
<option value="1">1회 (로그 표기)</option>
<option value="1000">1000회 (요약 표기)</option>
</select>
</div>
<div class="btn-group mr-2" role="group">
<button type="button" class="btn btn-danger btn-begin_battle">전투</button>
</div>
<div class="btn-group mr-2" role="group">
<button type="button" class="btn btn-info btn-battle-save">모두 저장</button>
<input type="file" class="form_load_battle_file" accept=".json" style="display: none;" />
<button type="button" class="btn btn-primary btn-battle-load">모두 불러오기</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm">
<div class="card mb-2 attacker_nation">
<div id="container">
<div class="card mb-3">
<div class="card-header">
출병국 설정
</div>
<div class="card-body nation_detail dragpad_battle">
<div class="input-group mb-1">
<div class="input-group-prepend">
<span class="input-group-text">국가 성향</span>
</div>
<select class="custom-select form_nation_type" style="width:25ch;">
<?php foreach(GameConst::$availableNationType as $typeID): ?>
<?php $nationTypeClass = buildNationTypeClass($typeID) ?>
<option value="<?=$typeID?>"><?=$nationTypeClass->getName()?> (<?=$nationTypeClass::$pros?>, <?=$nationTypeClass::$cons?>)</option>
<?php endforeach; ?>
</select>
<div class="input-group-prepend">
<span class="input-group-text">기술</span>
</div>
<input type="number" class="form-control form_tech" value="1" min="0" max="12">
<div class="input-group-append">
<span class="input-group-text">등급</span>
</div>
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">국가 규모</span>
</div>
<select class="custom-select form_nation_level">
<?php foreach(getNationLevelList() as $nationLevel => [$name,$chiefCnt,$cityCnt]): ?>
<option value="<?=$nationLevel?>"><?=$name?></option>
<?php endforeach; ?>
</select>
<div class="input-group-prepend">
<span class="input-group-text">도시 규모</span>
</div>
<select class="custom-select form_city_level">
<?php foreach(getCityLevelList() as $levelID => $name): ?>
<option value="<?=$levelID?>"><?=$name?></option>
<?php endforeach; ?>
</select>
<div class="input-group-prepend">
<span class="input-group-text">수도</span>
</div>
<div class="input-group-append btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-secondary">
<input type="radio" name="is_attacker_capital" class="form_is_capital" value="1" autocomplete="off">Y
</label>
<label class="btn btn-secondary active">
<input type="radio" name="is_attacker_capital" class="form_is_capital" value="0" autocomplete="off">N
</label>
</div>
</div>
<div class="input-group mb-1">
</div>
</div>
</div>
<div class="card mb-2 attacker_form general_form" data-general_no='1'>
<div class="card-header">
<div class="float-sm-left" style="line-height:25px;">출병자 설정</div>
<div class="float-sm-right btn-toolbar" role="toolbar">
<div class="btn-group btn-group-sm mr-2" role="group">
<button type="button" class="btn btn-success btn-general-import-server">서버에서 가져오기</button>
</div>
<div class="btn-group btn-group-sm mr-2" role="group">
<button type="button" class="btn btn-info btn-general-save">저장</button>
<input type="file" class="form_load_general_file" accept=".json" style="display: none;" />
<button type="button" class="btn btn-primary btn-general-load">불러오기</button>
</div>
</div>
</div>
</div>
</div><!-- <div class="col-sm"> -->
<div class="col-sm defender-column">
<div class="card mb-2 defender_nation">
<div class="card-header">
수비국 설정
전역 설정
</div>
<div class="card-body dragpad_battle">
<div class="input-group mb-1">
<div class="input-group-prepend">
<span class="input-group-text">국가 성향</span>
<div class="row">
<div class="col-sm-6">
<div class="input-group">
<input type="number" class="form-control" aria-describedby="text_year" value="<?= $startYear ?>" disabled>
<div class="input-group-text"> 년 시작 </div>
<input type="number" class="form-control" id="year" value="<?= $year ?>" min="<?= $startYear ?>">
<div class="input-group-text"> 년 </div>
<input type="number" class="form-control" id="month" value="1" min="1" max="12">
<div class="input-group-text"> 월 </div>
</div>
</div>
<select class="custom-select form_nation_type" style="width:25ch;">
<?php foreach(GameConst::$availableNationType as $typeID): ?>
<?php $nationTypeObj = buildNationTypeClass($typeID) ?>
<option value="<?=$typeID?>"><?=$nationTypeObj->getName()?> (<?=$nationTypeObj::$pros?>, <?=$nationTypeObj::$cons?>)</option>
<?php endforeach; ?>
</select>
<div class="input-group-prepend">
<span class="input-group-text">기술</span>
</div>
<input type="number" class="form-control form_tech" value="1" min="0" max="12">
<div class="input-group-append">
<span class="input-group-text">등급</span>
</div>
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">국가 규모</span>
</div>
<select class="custom-select form_nation_level">
<?php foreach(getNationLevelList() as $nationLevel => [$name,$chiefCnt,$cityCnt]): ?>
<option value="<?=$nationLevel?>"><?=$name?></option>
<?php endforeach; ?>
</select>
<div class="input-group-prepend">
<span class="input-group-text">도시 규모</span>
</div>
<select class="custom-select form_city_level">
<?php foreach(getCityLevelList() as $levelID => $name): ?>
<option value="<?=$levelID?>"><?=$name?></option>
<?php endforeach; ?>
</select>
<div class="input-group-prepend">
<span class="input-group-text">수도</span>
</div>
<div class="input-group-append btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-secondary">
<input type="radio" name="is_defender_capital" class="form_is_capital" value="1" autocomplete="off">Y
</label>
<label class="btn btn-secondary active">
<input type="radio" name="is_defender_capital" class="form_is_capital" value="0" autocomplete="off">N
</label>
</div>
</div>
<div class="input-group mb-1">
<div class="input-group-prepend">
<span class="input-group-text">수비</span>
</div>
<input type="number" class="form-control form_def" id="city_def" value="1000" min="10" step="10">
<div class="input-group-prepend">
<span class="input-group-text">성벽</span>
</div>
<input type="number" class="form-control form_wall" id="city_wall" value="1000" min="0" step="10">
</div>
</div>
</div>
<div class="card mb-2 defender_add_form">
<div class="card-header">
<div class="float-sm-left" style="line-height:25px;">수비자 설정</div>
<div class="float-sm-right btn-toolbar" role="toolbar">
<div class="btn-group btn-group-sm mr-2" role="group">
<button type="button" class="btn btn-dark btn-reorder_defender">수비 순서대로 정렬</button>
</div>
<div class="btn-group btn-group-sm" role="group">
<button type="button" class="btn btn-success add-defender">추가</button>
<div class="col-sm-6">
<div class="btn-toolbar" role="toolbar">
<div class="input-group me-2" role="group">
<div class="input-group-text">
반복 횟수
</div>
<select class="form-select" id="repeat_cnt">
<option value="1">1회 (로그 표기)</option>
<option value="1000">1000회 (요약 표기)</option>
</select>
</div>
<div class="btn-group me-2" role="group">
<button type="button" class="btn btn-danger btn-begin_battle">전투</button>
</div>
<div class="btn-group me-2" role="group">
<button type="button" class="btn btn-info btn-battle-save">모두 저장</button>
<input type="file" class="form_load_battle_file" accept=".json" style="display: none;" />
<button type="button" class="btn btn-primary btn-battle-load">모두 불러오기</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="card mb-2 form_sample">
<div class="card-header">
<div class="float-sm-left" style="line-height:25px;">수비자 설정</div>
<div class="float-sm-right btn-toolbar" role="toolbar">
<div class="btn-group btn-group-sm mr-2" role="group">
<button type="button" class="btn btn-success btn-general-import-server">서버에서 가져오기</button>
<div class="row">
<div class="col-sm">
<div class="card mb-2 attacker_nation">
<div class="card-header">
출병국 설정
</div>
<div class="btn-group btn-group-sm mr-2" role="group">
<button type="button" class="btn btn-info btn-general-save">저장</button>
<input type="file" class="form_load_general_file" accept=".json" style="display: none;" />
<button type="button" class="btn btn-primary btn-general-load">불러오기</button>
</div>
<div class="btn-group btn-group-sm" role="group">
<button type="button" class="btn btn-warning copy-defender">복제</button>
<button type="button" class="btn btn-danger delete-defender">제거</button>
</div>
</div>
</div>
<div class="card-body general_detail">
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">이름</span>
</div>
<input type="text" class="form-control form_general_name" value="무명" style="width:15ch;">
<div class="input-group-prepend">
<span class="input-group-text">직위</span>
</div>
<select class="custom-select form_officer_level" style="width:8ch;">
<option value="1">일반</option>
<option value="4">태수</option>
<option value="3">군사</option>
<option value="2">종사</option>
<option value="10">무장 수뇌</option>
<option value="9">지장 수뇌</option>
<option value="11">참모</option>
<option value="12">군주</option>
</select>
<div class="input-group-prepend">
<span class="input-group-text">Level</span>
</div>
<input type="number" class="form-control form_exp_level" value="20" min="0" max="300" step="1">
</div>
<div class="input-group mb-1">
<div class="input-group-prepend">
<span class="input-group-text">통솔</span>
</div>
<input type="number" class="form-control form_leadership" value="50" min="1" max="300" step="1">
<div class="input-group-prepend">
<span class="input-group-text">무력</span>
</div>
<input type="number" class="form-control form_strength" value="50" min="1" max="300" step="1">
<div class="input-group-prepend">
<span class="input-group-text">지력</span>
</div>
<input type="number" class="form-control form_intel" value="50" min="1" max="300" step="1">
</div>
<div class="input-group mb-1">
<div class="input-group-prepend">
<span class="input-group-text">명마</span>
</div>
<select class="custom-select form_general_horse">
<option value='None'>-</option>
<?php foreach(GameConst::$allItems['horse'] as $horseID=>$cnt): ?>
<option value="<?=$horseID?>"><?=getItemName($horseID)?></option>
<?php endforeach; ?>
</select>
<div class="input-group-prepend">
<span class="input-group-text">무기</span>
</div>
<select class="custom-select form_general_weap">
<option value='None'>-</option>
<?php foreach(GameConst::$allItems['weapon'] as $weaponID=>$cnt): ?>
<option value="<?=$weaponID?>"><?=getItemName($weaponID)?></option>
<?php endforeach; ?>
</select>
<div class="input-group-prepend">
<span class="input-group-text">서적</span>
</div>
<select class="custom-select form_general_book">
<option value='None'>-</option>
<?php foreach(GameConst::$allItems['book'] as $bookID=>$cnt): ?>
<option value="<?=$bookID?>"><?=getItemName($bookID)?></option>
<?php endforeach; ?>
</select>
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">부상</span>
</div>
<input type="number" class="form-control form_injury" value="0" min="0" max="80" step="1">
<div class="input-group-append">
<span class="input-group-text">%(<span class="injury_helptext">건강</span>)</span>
</div>
<div class="input-group-prepend">
<span class="input-group-text">군량</span>
</div>
<input type="number" class="form-control form_rice" value="5000" min="50" max="40000" step="50">
<div class="input-group-prepend">
<span class="input-group-text">도구</span>
</div>
<select class="custom-select form_general_item">
<option value='None'>-</option>
<?php foreach(GameConst::$allItems['item'] as $itemID=>$cnt): ?>
<option value="<?=$itemID?>"><?=getItemName($itemID)?></option>
<?php endforeach; ?>
</select>
</div>
<div class="input-group mb-1">
<div class="input-group-prepend">
<span class="input-group-text">병종</span>
</div>
<select class="custom-select form_crewtype">
<?php foreach(GameUnitConst::all() as $crewTypeID => $crewType): ?>
<?php if($crewType->armType === GameUnitConst::T_CASTLE){ continue; } ?>
<option value="<?=$crewTypeID?>"><?=$crewType->name?></option>
<?php endforeach; ?>
</select>
<div class="input-group-prepend">
<span class="input-group-text">병사</span>
</div>
<input type="number" class="form-control form_crew" value="7000" min="100" step="100">
<div class="input-group-prepend">
<span class="input-group-text">성격</span>
</div>
<select class="custom-select form_general_character">
<?php foreach(getCharacterList(false) as $characterID => [$name,$info]): ?>
<option value="<?=$characterID?>"><?=$name?></option>
<?php endforeach; ?>
</select>
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">훈련</span>
</div>
<input type="number" class="form-control form_train" value="100" min="40" max="<?=GameConst::$maxTrainByWar?>" step="1">
<div class="input-group-prepend">
<span class="input-group-text">사기</span>
</div>
<input type="number" class="form-control form_atmos" value="100" min="40" max="<?=GameConst::$maxAtmosByWar?>" step="1">
<div class="input-group-prepend">
<span class="input-group-text">전특</span>
</div>
<select class="custom-select form_general_special_war">
<?php foreach(SpecialityHelper::getSpecialWarList(false) as $specialWarID =>$specialObj): ?>
<option value="<?=$specialWarID?>"><?=$specialObj->getName()?></option>
<?php endforeach; ?>
</select>
</div>
<div class="input-group mb-1">
<div class="input-group-prepend">
<span class="input-group-text">보병숙련</span>
</div>
<select class="custom-select form_dex1">
<?php foreach(getDexLevelList() as $dexLevel => [$dexAmount, $color, $name]): ?>
<option value="<?=$dexAmount?>"><?="{$name} (".number_format($dexAmount).")"?></option>
<?php endforeach; ?>
</select>
<div class="input-group-prepend">
<span class="input-group-text">궁병숙련</span>
</div>
<select class="custom-select form_dex2">
<?php foreach(getDexLevelList() as $dexLevel => [$dexAmount, $color, $name]): ?>
<option value="<?=$dexAmount?>"><?="{$name} (".number_format($dexAmount).")"?></option>
<?php endforeach; ?>
</select>
<div class="input-group-prepend">
<span class="input-group-text">기병숙련</span>
</div>
<select class="custom-select form_dex3">
<?php foreach(getDexLevelList() as $dexLevel => [$dexAmount, $color, $name]): ?>
<option value="<?=$dexAmount?>"><?="{$name} (".number_format($dexAmount).")"?></option>
<?php endforeach; ?>
</select>
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text">귀병숙련</span>
</div>
<select class="custom-select form_dex4">
<?php foreach(getDexLevelList() as $dexLevel => [$dexAmount, $color, $name]): ?>
<option value="<?=$dexAmount?>"><?="{$name} (".number_format($dexAmount).")"?></option>
<?php endforeach; ?>
</select>
<div class="input-group-prepend">
<span class="input-group-text">차병숙련</span>
</div>
<select class="custom-select form_dex5">
<?php foreach(getDexLevelList() as $dexLevel => [$dexAmount, $color, $name]): ?>
<option value="<?=$dexAmount?>"><?="{$name} (".number_format($dexAmount).")"?></option>
<?php endforeach; ?>
</select>
<div class="input-group-prepend only_defender">
<span class="input-group-text">수비여부</span>
</div>
<select class="custom-select form_defence_train only_defender">
<option value="90">훈사 90</option>
<option value="80">훈사 80</option>
<option value="60">훈사 60</option>
<option value="40">훈사 40</option>
<option value="999">안함</option>
</select>
</div>
<div class="input-group mb-1">
<div class="input-group-prepend">
<span class="input-group-text">전투 수</span>
</div>
<input type="number" class="form-control form_warnum" value="0" step="1">
<div class="input-group-prepend">
<span class="input-group-text">승리 수</span>
</div>
<input type="number" class="form-control form_killnum" value="0" step="1">
<div class="input-group-prepend">
<span class="input-group-text">사살 수</span>
</div>
<input type="number" class="form-control form_killcrew" value="0" step="1">
</div>
</div>
</div>
<div class="card-body nation_detail dragpad_battle">
<div class="input-group mb-1">
<div class="input-group-text">국가 성향
</div>
<select class="form-select form_nation_type" style="width:25ch;">
<?php foreach (GameConst::$availableNationType as $typeID) : ?>
<?php $nationTypeClass = buildNationTypeClass($typeID) ?>
<option value="<?= $typeID ?>"><?= $nationTypeClass->getName() ?> (<?= $nationTypeClass::$pros ?>, <?= $nationTypeClass::$cons ?>)</option>
<?php endforeach; ?>
</select>
<div class="input-group-text">기술 </div>
<input type="number" class="form-control form_tech" value="1" min="0" max="12">
<div class="input-group-text">등급 </div>
</div>
<div class="input-group mb-3">
<div class="input-group-text">국가 규모 </div>
<select class="form-select form_nation_level">
<?php foreach (getNationLevelList() as $nationLevel => [$name, $chiefCnt, $cityCnt]) : ?>
<option value="<?= $nationLevel ?>"><?= $name ?></option>
<?php endforeach; ?>
</select>
<div class="input-group-text">도시 규모
</div>
<select class="form-select form_city_level">
<?php foreach (getCityLevelList() as $levelID => $name) : ?>
<option value="<?= $levelID ?>"><?= $name ?></option>
<?php endforeach; ?>
</select>
<div class="input-group-text">수도
</div>
<div class="btn-group" role="group" aria-label="수도">
<input type="radio" class="btn-check" name="is_attacker_capital" value="1" id="is_attacker_capital_1" autocomplete="off">
<label class="btn btn-secondary" for="is_attacker_capital_1">Y</label>
</div><!-- <div class="col-sm"> -->
</div>
<div class="card mb-3">
<div class="card-header">
전투 요약
</div>
<table class="table">
<tbody id="battle_result_summary">
<tr><th style='width:18ch;'>전투 일시</th><td id='result_datetime'></td></tr>
<tr><th>전투 횟수</th><td id='result_warcnt'></td></tr>
<tr><th>전투 페이즈</th><td id='result_phase'></td></tr>
<tr><th>준 피해</th><td><span id='result_killed'>0</span><span id='result_varKilled'> (<span id='result_minKilled'>0</span> ~ <span id='result_maxKilled'>0</span>)</span></td></tr>
<tr><th>받은 피해</th><td><span id='result_dead'>0</span><span id='result_varDead'> (<span id='result_minDead'>0</span> ~ <span id='result_maxDead'>0</span>)</span></td></tr>
<tr><th>출병자 군량 소모</th><td id='result_attackerRice'></td></tr>
<tr><th>수비자 군량 소모</th><td id='result_defenderRice'></td></tr>
<tr><th>공격자 스킬</th><td id='result_attackerSkills'></td></tr>
<tr class='result_defenderSkills'><th>수비자1 스킬</th><td></td></tr>
</tbody>
</table>
</div>
<div class="row">
<div class="col-sm">
<input type="radio" class="btn-check" name="is_attacker_capital" value="0" id="is_attacker_capital_0" autocomplete="off" checked>
<label class="btn btn-secondary" for="is_attacker_capital_0">N</label>
</div>
</div>
<div class="input-group mb-1">
</div>
</div>
</div>
<div class="card mb-2 attacker_form general_form" data-general_no='1'>
<div class="card-header">
<div class="float-sm-start" style="line-height:25px;">출병자 설정</div>
<div class="float-sm-end btn-toolbar" role="toolbar">
<div class="btn-group btn-group-sm me-2" role="group">
<button type="button" class="btn btn-success btn-general-import-server">서버에서 가져오기</button>
</div>
<div class="btn-group btn-group-sm me-2" role="group">
<button type="button" class="btn btn-info btn-general-save">저장</button>
<input type="file" class="form_load_general_file" accept=".json" style="display: none;" />
<button type="button" class="btn btn-primary btn-general-load">불러오기</button>
</div>
</div>
</div>
</div>
</div><!-- <div class="col-sm"> -->
<div class="col-sm defender-column">
<div class="card mb-2 defender_nation">
<div class="card-header">
수비국 설정
</div>
<div class="card-body dragpad_battle">
<div class="input-group mb-1">
<div class="input-group-text">국가 성향
</div>
<select class="form-select form_nation_type" style="width:25ch;">
<?php foreach (GameConst::$availableNationType as $typeID) : ?>
<?php $nationTypeObj = buildNationTypeClass($typeID) ?>
<option value="<?= $typeID ?>"><?= $nationTypeObj->getName() ?> (<?= $nationTypeObj::$pros ?>, <?= $nationTypeObj::$cons ?>)</option>
<?php endforeach; ?>
</select>
<div class="input-group-text">기술
</div>
<input type="number" class="form-control form_tech" value="1" min="0" max="12">
<div class="input-group-text">등급
</div>
</div>
<div class="input-group mb-3">
<div class="input-group-text">국가 규모
</div>
<select class="form-select form_nation_level">
<?php foreach (getNationLevelList() as $nationLevel => [$name, $chiefCnt, $cityCnt]) : ?>
<option value="<?= $nationLevel ?>"><?= $name ?></option>
<?php endforeach; ?>
</select>
<div class="input-group-text">도시 규모
</div>
<select class="form-select form_city_level">
<?php foreach (getCityLevelList() as $levelID => $name) : ?>
<option value="<?= $levelID ?>"><?= $name ?></option>
<?php endforeach; ?>
</select>
<div class="input-group-text">수도
</div>
<div class="btn-group" role="group" aria-label="수도">
<input type="radio" class="btn-check" name="is_defender_capital" value="1" id="is_defender_capital_1" autocomplete="off">
<label class="btn btn-secondary" for="is_defender_capital_1">Y</label>
<input type="radio" class="btn-check" name="is_defender_capital" value="0" id="is_defender_capital_0" autocomplete="off" checked>
<label class="btn btn-secondary" for="is_defender_capital_0">N</label>
</div>
</div>
<div class="input-group mb-1">
<div class="input-group-text">수비
</div>
<input type="number" class="form-control form_def" id="city_def" value="1000" min="10" step="10">
<div class="input-group-text">성벽
</div>
<input type="number" class="form-control form_wall" id="city_wall" value="1000" min="0" step="10">
</div>
</div>
</div>
<div class="card mb-2 defender_add_form">
<div class="card-header">
<div class="float-sm-start" style="line-height:25px;">수비자 설정</div>
<div class="float-sm-end btn-toolbar" role="toolbar">
<div class="btn-group btn-group-sm me-2" role="group">
<button type="button" class="btn btn-dark btn-reorder_defender">수비 순서대로 정렬</button>
</div>
<div class="btn-group btn-group-sm" role="group">
<button type="button" class="btn btn-success add-defender">추가</button>
</div>
</div>
</div>
</div>
<div class="card mb-2 form_sample">
<div class="card-header">
<div class="float-sm-start" style="line-height:25px;">수비자 설정</div>
<div class="float-sm-end btn-toolbar" role="toolbar">
<div class="btn-group btn-group-sm me-2" role="group">
<button type="button" class="btn btn-success btn-general-import-server">서버에서 가져오기</button>
</div>
<div class="btn-group btn-group-sm me-2" role="group">
<button type="button" class="btn btn-info btn-general-save">저장</button>
<input type="file" class="form_load_general_file" accept=".json" style="display: none;" />
<button type="button" class="btn btn-primary btn-general-load">불러오기</button>
</div>
<div class="btn-group btn-group-sm" role="group">
<button type="button" class="btn btn-warning copy-defender">복제</button>
<button type="button" class="btn btn-danger delete-defender">제거</button>
</div>
</div>
</div>
<div class="card-body general_detail">
<div class="input-group mb-3">
<div class="input-group-text">이름
</div>
<input type="text" class="form-control form_general_name" value="무명" style="width:15ch;">
<div class="input-group-text">직위
</div>
<select class="form-select form_officer_level" style="width:8ch;">
<option value="1">일반</option>
<option value="4">태수</option>
<option value="3">군사</option>
<option value="2">종사</option>
<option value="10">무장 수뇌</option>
<option value="9">지장 수뇌</option>
<option value="11">참모</option>
<option value="12">군주</option>
</select>
<div class="input-group-text">Level
</div>
<input type="number" class="form-control form_exp_level" value="20" min="0" max="300" step="1">
</div>
<div class="input-group mb-1">
<div class="input-group-text">통솔
</div>
<input type="number" class="form-control form_leadership" value="50" min="1" max="300" step="1">
<div class="input-group-text">무력
</div>
<input type="number" class="form-control form_strength" value="50" min="1" max="300" step="1">
<div class="input-group-text">지력
</div>
<input type="number" class="form-control form_intel" value="50" min="1" max="300" step="1">
</div>
<div class="input-group mb-1">
<div class="input-group-text">명마
</div>
<select class="form-select form_general_horse">
<option value='None'>-</option>
<?php foreach (GameConst::$allItems['horse'] as $horseID => $cnt) : ?>
<option value="<?= $horseID ?>"><?= getItemName($horseID) ?></option>
<?php endforeach; ?>
</select>
<div class="input-group-text">무기
</div>
<select class="form-select form_general_weap">
<option value='None'>-</option>
<?php foreach (GameConst::$allItems['weapon'] as $weaponID => $cnt) : ?>
<option value="<?= $weaponID ?>"><?= getItemName($weaponID) ?></option>
<?php endforeach; ?>
</select>
<div class="input-group-text">서적
</div>
<select class="form-select form_general_book">
<option value='None'>-</option>
<?php foreach (GameConst::$allItems['book'] as $bookID => $cnt) : ?>
<option value="<?= $bookID ?>"><?= getItemName($bookID) ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="input-group mb-3">
<div class="input-group-text">부상
</div>
<input type="number" class="form-control form_injury" value="0" min="0" max="80" step="1">
<div class="input-group-text">%(<span class="injury_helptext">건강</span>)
</div>
<div class="input-group-text">군량
</div>
<input type="number" class="form-control form_rice" value="5000" min="50" max="40000" step="50">
<div class="input-group-text">도구
</div>
<select class="form-select form_general_item">
<option value='None'>-</option>
<?php foreach (GameConst::$allItems['item'] as $itemID => $cnt) : ?>
<option value="<?= $itemID ?>"><?= getItemName($itemID) ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="input-group mb-1">
<div class="input-group-text">병종
</div>
<select class="form-select form_crewtype">
<?php foreach (GameUnitConst::all() as $crewTypeID => $crewType) : ?>
<?php if ($crewType->armType === GameUnitConst::T_CASTLE) {
continue;
} ?>
<option value="<?= $crewTypeID ?>"><?= $crewType->name ?></option>
<?php endforeach; ?>
</select>
<div class="input-group-text">병사
</div>
<input type="number" class="form-control form_crew" value="7000" min="100" step="100">
<div class="input-group-text">성격
</div>
<select class="form-select form_general_character">
<?php foreach (getCharacterList(false) as $characterID => [$name, $info]) : ?>
<option value="<?= $characterID ?>"><?= $name ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="input-group mb-3">
<div class="input-group-text">훈련
</div>
<input type="number" class="form-control form_train" value="100" min="40" max="<?= GameConst::$maxTrainByWar ?>" step="1">
<div class="input-group-text">사기
</div>
<input type="number" class="form-control form_atmos" value="100" min="40" max="<?= GameConst::$maxAtmosByWar ?>" step="1">
<div class="input-group-text">전특
</div>
<select class="form-select form_general_special_war">
<?php foreach (SpecialityHelper::getSpecialWarList(false) as $specialWarID => $specialObj) : ?>
<option value="<?= $specialWarID ?>"><?= $specialObj->getName() ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="input-group mb-1">
<div class="input-group-text">보병숙련
</div>
<select class="form-select form_dex1">
<?php foreach (getDexLevelList() as $dexLevel => [$dexAmount, $color, $name]) : ?>
<option value="<?= $dexAmount ?>"><?= "{$name} (" . number_format($dexAmount) . ")" ?></option>
<?php endforeach; ?>
</select>
<div class="input-group-text">궁병숙련
</div>
<select class="form-select form_dex2">
<?php foreach (getDexLevelList() as $dexLevel => [$dexAmount, $color, $name]) : ?>
<option value="<?= $dexAmount ?>"><?= "{$name} (" . number_format($dexAmount) . ")" ?></option>
<?php endforeach; ?>
</select>
<div class="input-group-text">기병숙련
</div>
<select class="form-select form_dex3">
<?php foreach (getDexLevelList() as $dexLevel => [$dexAmount, $color, $name]) : ?>
<option value="<?= $dexAmount ?>"><?= "{$name} (" . number_format($dexAmount) . ")" ?></option>
<?php endforeach; ?>
</select>
</div>
<div class="input-group mb-3">
<div class="input-group-text">귀병숙련
</div>
<select class="form-select form_dex4">
<?php foreach (getDexLevelList() as $dexLevel => [$dexAmount, $color, $name]) : ?>
<option value="<?= $dexAmount ?>"><?= "{$name} (" . number_format($dexAmount) . ")" ?></option>
<?php endforeach; ?>
</select>
<div class="input-group-text">차병숙련
</div>
<select class="form-select form_dex5">
<?php foreach (getDexLevelList() as $dexLevel => [$dexAmount, $color, $name]) : ?>
<option value="<?= $dexAmount ?>"><?= "{$name} (" . number_format($dexAmount) . ")" ?></option>
<?php endforeach; ?>
</select>
<div class="input-group-text only_defender">수비여부
</div>
<select class="form-select form_defence_train only_defender">
<option value="90">훈사 90</option>
<option value="80">훈사 80</option>
<option value="60">훈사 60</option>
<option value="40">훈사 40</option>
<option value="999">안함</option>
</select>
</div>
<div class="input-group mb-1">
<div class="input-group-text">전투 수
</div>
<input type="number" class="form-control form_warnum" value="0" step="1">
<div class="input-group-text">승리 수
</div>
<input type="number" class="form-control form_killnum" value="0" step="1">
<div class="input-group-text">사살 수
</div>
<input type="number" class="form-control form_killcrew" value="0" step="1">
</div>
</div>
</div>
</div><!-- <div class="col-sm"> -->
</div>
<div class="card mb-3">
<div class="card-header">
마지막 전투 로그
전투 요약
</div>
<div class="card-body" id="generalBattleResultLog">
<table class="table">
<tbody id="battle_result_summary">
<tr>
<th style='width:18ch;'>전투 일시</th>
<td id='result_datetime'></td>
</tr>
<tr>
<th>전투 횟수</th>
<td id='result_warcnt'></td>
</tr>
<tr>
<th>전투 페이즈</th>
<td id='result_phase'></td>
</tr>
<tr>
<th>준 피해</th>
<td><span id='result_killed'>0</span><span id='result_varKilled'> (<span id='result_minKilled'>0</span> ~ <span id='result_maxKilled'>0</span>)</span></td>
</tr>
<tr>
<th>받은 피해</th>
<td><span id='result_dead'>0</span><span id='result_varDead'> (<span id='result_minDead'>0</span> ~ <span id='result_maxDead'>0</span>)</span></td>
</tr>
<tr>
<th>출병자 군량 소모</th>
<td id='result_attackerRice'></td>
</tr>
<tr>
<th>수비자 군량 소모</th>
<td id='result_defenderRice'></td>
</tr>
<tr>
<th>공격자 스킬</th>
<td id='result_attackerSkills'></td>
</tr>
<tr class='result_defenderSkills'>
<th>수비자1 스킬</th>
<td></td>
</tr>
</tbody>
</table>
</div>
<div class="row">
<div class="col-sm">
<div class="card mb-3">
<div class="card-header">
마지막 전투 로그
</div>
<div class="card-body" id="generalBattleResultLog">
</div>
</div>
</div>
<div class="col-sm">
<div class="card mb-3">
<div class="card-header">
마지막 전투 상세 로그
</div>
<div class="card-body" id="generalBattleDetailLog">
</div>
</div>
</div>
</div>
</div>
<div class="col-sm">
<div class="card mb-3">
<div class="card-header">
마지막 전투 상세 로그
</div>
<div class="card-body" id="generalBattleDetailLog">
<div id="importModal" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">장수 목록</h5>
<button type="button" class="close" data-bs-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<select id="modalSelector"></select>
<p>타국 장수를 선택한 경우 숙련과 아이템은 0으로 초기화됩니다.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" id='importFromDB'>가져오기</button>
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="importModal" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">장수 목록</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<select id="modalSelector"></select>
<p>타국 장수를 선택한 경우 숙련과 아이템은 0으로 초기화됩니다.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" id='importFromDB'>가져오기</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">닫기</button>
</div>
</div>
</div>
</div>
</body>
</html>
+37 -30
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -6,8 +7,8 @@ include "func.php";
// $btn, $msg, $scoutmsg, $rate, $bill, $secretlimit
$btn = Util::getPost('btn');
$msg = Util::getPost('msg');
$scoutmsg = Util::getPost('scoutmsg');
//$msg = Util::getPost('msg');
//$scoutmsg = Util::getPost('scoutMsg');
$rate = Util::getPost('rate', 'int');
$bill = Util::getPost('bill', 'int');
$secretlimit = Util::getPost('secretlimit', 'int');
@@ -22,11 +23,10 @@ $me = $db->queryFirstRow('SELECT `no`,nation,`officer_level`,permission,penalty
//내가 수뇌부이어야함
$permission = checkSecretPermission($me);
if($permission < 0){
if ($permission < 0) {
header('location:b_myBossInfo.php', true, 303);
exit();
}
else if ($me['officer_level'] < 5 && $permission != 4) {
} else if ($me['officer_level'] < 5 && $permission != 4) {
header('location:b_myBossInfo.php', true, 303);
exit();
}
@@ -34,45 +34,52 @@ else if ($me['officer_level'] < 5 && $permission != 4) {
$nationID = $me['nation'];
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
if($btn == "국가방침 수정") {
/*if ($btn == "국가방침 수정") {
$msg = mb_substr($msg, 0, 16384);
//$msg = StringUtil::
$nationStor->notice = WebUtil::htmlPurify($msg);
} elseif($btn == "임관 권유문 수정") {
} elseif ($btn == "임관 권유문 수정") {
$scoutmsg = mb_substr($scoutmsg, 0, 1000);
$nationStor->scout_msg = WebUtil::htmlPurify($scoutmsg);
} elseif($btn == "세율") {
} else*/if ($btn == "세율") {
$rate = Util::valueFit($rate, 5, 30);
$db->update('nation', [
'rate'=>$rate,
'rate' => $rate,
], 'nation=%i', $nationID);
} elseif($btn == "지급률") {
} elseif ($btn == "지급률") {
$bill = Util::valueFit($bill, 20, 200);
$db->update('nation', [
'bill'=>$bill
], 'nation=%i',$nationID);
} elseif($btn == "기밀권한") {
'bill' => $bill
], 'nation=%i', $nationID);
} elseif ($btn == "기밀권한") {
$secretlimit = Util::valueFit($secretlimit, 1, 99);
$db->update('nation', [
'secretlimit'=>$secretlimit
], 'nation=%i',$nationID);
} elseif($btn == "임관 금지") {
'secretlimit' => $secretlimit
], 'nation=%i', $nationID);
} elseif ($btn == "임관 금지") {
$db->update('nation', [
'scout'=>1
], 'nation=%i',$nationID);
} elseif($btn == "임관 허가") {
'scout' => 1
], 'nation=%i', $nationID);
} elseif ($btn == "임관 허가") {
$db->update('nation', [
'scout'=>0
], 'nation=%i',$nationID);
} elseif($btn == "전쟁 금지") {
$db->update('nation', [
'war'=>1
], 'nation=%i',$nationID);
} elseif($btn == "전쟁 허가") {
$db->update('nation', [
'war'=>0
], 'nation=%i',$nationID);
'scout' => 0
], 'nation=%i', $nationID);
} elseif ($btn == "전쟁 금지") {
$avilableCnt = $nationStor->getValue('available_war_setting_cnt') ?? 0;
if ($avilableCnt > 0) {
$db->update('nation', [
'war' => 1
], 'nation=%i', $nationID);
$nationStor->setValue('available_war_setting_cnt', $avilableCnt - 1);
}
} elseif ($btn == "전쟁 허가") {
$avilableCnt = $nationStor->getValue('available_war_setting_cnt') ?? 0;
if ($avilableCnt > 0) {
$db->update('nation', [
'war' => 0
], 'nation=%i', $nationID);
$nationStor->setValue('available_war_setting_cnt', $avilableCnt - 1);
}
}
header('location:b_dipcenter.php');
+24 -24
View File
@@ -36,15 +36,15 @@ if($btn == '참가') {
if($db->queryFirstField('SELECT `no` FROM tournament WHERE `no`=%i', $me['no'])){
header('location:b_tournament.php');
exit(1);
exit(1);
}
$general = $db->queryFirstRow('SELECT no,name,npc,leadership,strength,intel,explevel,gold,horse,weapon,book FROM general WHERE `no`=%i', $me['no']);
//{$admin['develcost']}원 참가비
if($general['gold'] < $admin['develcost']) {
if($general['gold'] < $admin['develcost']) {
header('location:b_tournament.php');
exit(1);
exit(1);
}
$general['gold'] -= $admin['develcost'];
@@ -66,7 +66,7 @@ if($btn == '참가') {
}
$fullGrpCnt = 8 - count($freeSlot);
if($freeSlot) {
$grp = Util::choiceRandom(array_keys($freeSlot));
$grpMemberCount = $db->queryFirstField('SELECT count(*) FROM tournament WHERE grp=%i', $grp);
@@ -96,12 +96,12 @@ if($btn == '참가') {
$gameStor->phase = 0;
}
header('location:b_tournament.php');
die();
die();
}
if($session->userGrade < 5) {
if($session->userGrade < 5) {
header('location:b_tournament.php');
exit();
exit();
}
if($btn == "자동개최설정") {
@@ -157,10 +157,10 @@ if($btn == "자동개최설정") {
} elseif($btn == "랜덤전부투입") {
$grpIn = [];
foreach($db->queryAllLists('SELECT grp, count(*) FROM tournament WHERE 0 <= grp AND grp < 8 GROUP BY grp') as [$grpIdx, $cnt]){
$grpIn[$grpIdx] = $cnt;
}
$code = [];
foreach(Util::range(8) as $grpIdx){
@@ -201,38 +201,38 @@ if($btn == "자동개최설정") {
$gameStor->tournament = 2;
$gameStor->phase = 0;
} elseif($btn == "무명전부투입") {
fillLowGenAll();
} elseif($btn == "예선") {
} elseif($btn == "무명전부투입") {
fillLowGenAll($admin['tnmt_type']);
} elseif($btn == "예선") {
qualify($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
} elseif($btn == "예선전부") {
} elseif($btn == "예선전부") {
qualifyAll($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
} elseif($btn == "추첨") {
} elseif($btn == "추첨") {
selection($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
} elseif($btn == "추첨전부") {
} elseif($btn == "추첨전부") {
selectionAll($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
} elseif($btn == "본선") {
} elseif($btn == "본선") {
finallySingle($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
} elseif($btn == "본선전부") {
} elseif($btn == "본선전부") {
finallyAll($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
} elseif($btn == "배정") {
} elseif($btn == "배정") {
final16set();
} elseif($btn == "베팅마감") {
$dt = date("Y-m-d H:i:s", time() + 60);
$gameStor->tournament=7;
$gameStor->phase=0;
$gameStor->tnmt_time = $dt;
} elseif($btn == "16강") {
} elseif($btn == "16강") {
finalFight($admin['tnmt_type'], $admin['tournament'], $admin['phase'], 16);
} elseif($btn == "8강") {
} elseif($btn == "8강") {
finalFight($admin['tnmt_type'], $admin['tournament'], $admin['phase'], 8);
} elseif($btn == "4강") {
} elseif($btn == "4강") {
finalFight($admin['tnmt_type'], $admin['tournament'], $admin['phase'], 4);
} elseif($btn == "결승") {
} elseif($btn == "결승") {
finalFight($admin['tnmt_type'], $admin['tournament'], $admin['phase'], 2);
} elseif($btn == "포상") {
} elseif($btn == "포상") {
setGift($admin['tnmt_type'], $admin['tournament'], $admin['phase']);
} elseif($btn == "회수") {
} elseif($btn == "회수") {
setRefund();
} elseif($btn == "메시지") {
$gameStor->tnmt_msg = $msg;
+2 -2
View File
@@ -15,7 +15,7 @@ $session = Session::requireGameLogin()->setReadOnly();
$userID = Session::getUserID();
$isVoteAdmin = in_array('vote', $session->acl[DB::prefix()]??[]);
$isVoteAdmin |= $session->userGrade >= 5;
$isVoteAdmin = $isVoteAdmin || $session->userGrade >= 5;
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
@@ -24,7 +24,7 @@ $admin = $gameStor->getValues(['develcost', 'cost', 'vote_title', 'vote', 'votec
$generalID = Session::getGeneralID();
$general = General::createGeneralObjFromDB($generalID, ['vote','horse','weapon','book','item','npc'], 2);
$general = General::createGeneralObjFromDB($generalID, ['vote','horse','weapon','book','item','npc','imgsvr','picture','aux'], 2);
if($btn == "투표" && $general->getVar('vote') == 0 && $sel > 0) {
$develcost = $admin['develcost'] * 5;
+2 -2
View File
@@ -6,12 +6,12 @@
}
.defender_add_form .general_detail{
display:none;
display:none !important;
}
.form_sample{
display:none;
display:none !important;
}
input[type=number]{
-56
View File
@@ -1,56 +0,0 @@
#newArticle{
width:1000px;
margin: 0 auto;
}
.titleInput{
width:100%;
color:white;
background-color:transparent;
border:none;
margin:1px 5px;
}
.contentInput{
width:100%;
min-height:3em;
color:white;
background-color:transparent;
border:none;
padding:1px 5px;
}
.articleFrame{
width:1000px;
margin: 20px auto;
}
.commentText{
width:100%;
}
.authorName, .comment .author{
width:110px;
font-size:85%;
}
.date{
width:125px;
font-size:85%;
}
.text{
text-align:left;
padding:1px 5px;
}
.submitComment{
width:100%;
}
.commentText{
color:white;
background-color:transparent;
border:none;
padding:1px 5px;
}
+5 -5
View File
@@ -11,7 +11,7 @@
width:50px;
color:white;
background-color:black;
font-size:13px;
font-size:14px;
}
.chiefTurnIdx{
@@ -42,20 +42,20 @@
}
.chiefTurnBox .turnHeader{
font-weight: bold;
font-weight: 500;
text-align: center;
}
.chiefNamePlate{
border-top:solid 0.67px #888888;
font-weight: bold;
font-weight: 500;
text-align: center;
flex-grow: 1;
line-height:21px;
}
.turnIdxHeader{
font-weight: bold;
font-weight: 500;
text-align: center;
width:20px;
}
@@ -63,7 +63,7 @@
.chiefTurnTime{
border-top:solid 0.67px #888888;
border-right:solid 0.67px #888888;
font-weight: bold;
font-weight: 500;
background: black;
text-align: center;
width:44px;
+5 -36
View File
@@ -1,36 +1,18 @@
@charset "UTF-8";
/* font-boostring Block */
html * {
max-height: 1000000px;
}
html,
body {
font-family: 'Pretendard', 'Apple SD Gothic Neo', 'Noto Sans KR', 'Malgun Gothic';
background-color: black;
color: white;
line-height: 1.3;
font-family: '맑은 고딕';
font-size: 13px;
}
table {
font-family: '맑은 고딕';
}
font {
font-family: '맑은 고딕';
font-size: 14px;
}
input {
font-family: '맑은 고딕';
font-size: 13px;
}
select {
font-family: '굴림';
line-height: 100%;
font-size: 14px;
}
.center {
@@ -53,9 +35,8 @@ table.mimic_flex {
table.tb_layout {
border-collapse: collapse;
padding: 0px;
font-size: 13px;
font-size: 14px;
word-break: break-all;
font-family: '맑은 고딕';
}
.tb_layout td,
@@ -63,8 +44,6 @@ table.tb_layout {
border: solid 1px gray;
padding: 0px;
word-break: break-all;
font-family: '맑은 고딕';
;
}
div.bar_out {
@@ -206,8 +185,7 @@ div.bar_out div.bar_in {
}
.tooltip {
font-size: 12px;
font-family: '맑은 고딕';
font-size: 12.5px;
}
.tooltip_copyable_info .tooltiptext {
@@ -249,11 +227,6 @@ div.bar_out div.bar_in {
padding: 0;
}
.commandBasic {
background-color: black;
color: white;
}
.compensatePositive {
color: skyblue;
}
@@ -262,10 +235,6 @@ div.bar_out div.bar_in {
color: orange;
}
.compensateNeutral {
color: white;
}
.commandBasic.commandImpossible {
background-color: red;
color: white;
+1 -1
View File
@@ -4,7 +4,7 @@
width:1100px;
margin:auto;
position:relative;
font-size:13px;
font-size:14px;
}
.rankView h3{
+3 -1
View File
@@ -1,2 +1,4 @@
@charset "UTF-8";
.form-group{
margin-bottom: 1em;
}
-100
View File
@@ -1,100 +0,0 @@
@charset "UTF-8";
body {
color:white;
background-color:black;
border-width:1px;
border-color:gray; background-position:center; background-repeat:repeat-y;
}
#container {
width:1000px;
margin: 0 auto;
}
.buttonPlate{
width:1000px;
height:60px;
}
.toolbarButton {
float:left;
background-color:#225500;
color:white;
width:125px;
height:30px;
font-weight:bold;
font-size:13px;
margin:0;
display:block;
}
.commandButton {
float:left;
width:100px;
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 {
float:left;
background-color:#225500;
color:magenta;
width:125px;
height:30px;
font-weight:bold;
font-size:13px;
margin:0;
display:block;
}
.nation_info td{
height:18px;
}
#generalTurnSelector{
width:50px;
color:white;
background-color:black;
font-size:13px;
}
#sidebar{
position:fixed;
right:0;
top: 50%;
transform: translateY(-50%);
}
#sidebar button{
/*width:100px;*/
}
.turn_pad{
white-space:nowrap;
font-weight:lighter;
max-width: 162px;
width: 162px;
}
.turn_pad .turn_text{
display:inline-block;
}
+11 -4
View File
@@ -3,8 +3,9 @@
.world_map{
width:700px;
background:black;
font-size:13px;
font-size:14px;
color:white;
position: relative;
}
.map_title{
@@ -25,7 +26,7 @@
width:160px;
display:block;
line-height:20px;
font-size:13px;
font-size:14px;
font-weight:bold;
}
@@ -33,6 +34,7 @@
width:700px;
height:500px;
position:relative;
overflow: hidden;
}
.map_body .map_bglayer1{
@@ -88,7 +90,7 @@
.world_map .city_tooltip{
position: absolute;
z-index:6;
z-index:16;
display:none;
min-width:120px;
border: 0.02em gray solid;
@@ -99,7 +101,7 @@
z-index: 6;
line-height:15px;
height:15px;
}
.world_map .nation_name{
background-color: rgb(30, 164, 255);
@@ -491,4 +493,9 @@
.map_basic .city_base .city_state.city_state_good{
background-color:blue;
}
.btn.btn-minimum{
padding-top: 1px;
padding-bottom: 1px;
}
-202
View File
@@ -1,202 +0,0 @@
@charset "UTF-8";
/*임시용 */
#container{
width:1000px;
margin:auto;
font-size:13px;
}
/*임시용 끝*/
#message_board{
height:1370px;
position:relative;
}
#message_board section{
overflow-y:auto;
overflow-x:hidden;
}
.msg_plate{
width:100%;
outline-style:solid;
outline-width:1px;
outline-color: gray;
min-height:64px;
font-size:12px;
word-break:break-all;
color:white;
}
.msg_plate_private{
background-color:#5d1e1a;
}
.msg_plate_private.msg_plate_dest{
background-color:#5d461a;
}
.msg_plate_public{
background-color:#141c65;
}
.msg_plate_national, .msg_plate_diplomacy{
background-color:#00582c;
}
.msg_plate_national.msg_plate_dest, .msg_plate_diplomacy.msg_plate_dest {
background-color:#704615;
}
.msg_plate_national.msg_plate_src, .msg_plate_diplomacy.msg_plate_src {
background-color:#70153b;
}
.public_message{
height:667px;
}
.diplomacy_message{
flex: 1;
}
.national_message{
height:667px;
}
.private_message{
flex: 1;
}
.msg_icon{
float:left;
width:64px;
height:64px;
border-right:solid 1px gray;
}
.msg_time{
font-size:0.75em;
font-weight:normal;
}
.msg_header{
font-weight: bold;
margin-bottom:3px;
color:white;
position: relative;
}
.message_input_form{
position:relative;
}
#msg_input{
color:white;
background-color:black;
font-size:12px;
width:715px;
margin:0 2px;
height:20px;
border:solid 1px gray;
}
#msg_submit{
position:absolute;
right:0;
margin-right:2px;
}
#mailbox_list{
float:left;
color:white;
background-color:black;
font-size:12px;
width:160px;
height:20px;
}
.board_header{
color:white;
outline-style:solid;
outline-width:1px;
outline-color: gray;
}
.board_side{
position:absolute;
height:1370px;
width:50%;
overflow-y: hidden;
outline-style:solid;
outline-width:1px;
outline-color: gray;
display: flex;
flex-wrap: wrap;
flex-direction: column;
}
.board_side > div{
height: 1.2em;
}
.msg_invalid{
color:rgba(255,255,255,0.5);
}
.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;
}
.btn-delete-msg{
position: absolute;
right: 0;
top: 0;
margin:2px 2px 0 2px;
font-size:8px;
}
/*
.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;
overflow:hidden;
}
.msg_prompt{
text-align:right;
margin-top:5px;
margin-right:5px;
}
#mailbox_list option{
color:white;
background-color:black;
}
-49
View File
@@ -1,49 +0,0 @@
.section_bar{
text-align:center;
border:0.5px solid #aaa;
padding-right:0;
padding-left:0;
}
.sub_bar{
text-align:center;
border:0.5px solid #aaa;
margin-left:-5px;
margin-right:-5px;
}
.reset_btn{
width:15ch;
}
.submit_btn{
margin-left:1em;
width:15ch;
}
.control_bar{
margin-top:8pt;
text-align:right;
}
.col-form-label{
text-align:right;
padding-right:2ch;
}
.form_list{
padding:8pt;
}
.half_section_left{
padding-right:0;
border-right:0.5px solid #aaa;
}
.half_section_right{
padding-left:0;
}
.popover{
max-width:100%;
}
+42 -7
View File
@@ -1,8 +1,16 @@
<?php
namespace sammo;
class DB{
//https://hub.packtpub.com/eloquent-without-laravel/
use Illuminate\Database\Capsule\Manager as Capsule;
use Illuminate\Events\Dispatcher;
use Illuminate\Container\Container;
class DB
{
private static $uDB = null;
private static ?Capsule $uIlluminate = null;
private static $host = '_tK_host_';
private static $user = '_tK_user_';
@@ -10,11 +18,36 @@ class DB{
private static $dbName = '_tK_dbName_';
private static $port = _tK_port_;
private static $encoding = 'utf8mb4';
private static $collation = 'utf8mb4_general_ci';
private static $prefix = '_tK_prefix_';
private function __construct(){
private function __construct()
{
}
public static function illuminate(): Capsule
{
if(self::$uIlluminate !== null){
return self::$uIlluminate;
}
$capsule = new Capsule;
$capsule->addConnection([
'driver' => 'mysql',
'host' => self::$host,
'database' => self::$dbName,
'username' => self::$user,
'password' => self::$password,
'charset' => self::$encoding,
'collation' => self::$collation,
]);
$capsule->setEventDispatcher(new Dispatcher(new Container));
$capsule->setAsGlobal();
$capsule->bootEloquent();
self::$uIlluminate = $capsule;
return $capsule;
}
/**
@@ -23,12 +56,14 @@ class DB{
* @return \MeekroDB
* @suppress PhanTypeMismatchProperty
*/
public static function db(){
if(self::$uDB === null){
self::$uDB = new \MeekroDB(self::$host,self::$user,self::$password,self::$dbName,self::$port,self::$encoding);
public static function db()
{
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->error_handler= function(){};
self::$uDB->error_handler = function () {
};
self::$uDB->throw_exception_on_error = true;
self::$uDB->throw_exception_on_nonsql_error = true;
}
@@ -39,4 +74,4 @@ class DB{
{
return self::$prefix;
}
}
}
@@ -0,0 +1,6 @@
<?php
namespace sammo;
class VersionGit extends VersionGitDynamic {
}
//{"version":"dynamic","hash":"dynamic"}
+9 -2
View File
@@ -2,8 +2,15 @@
namespace sammo;
class VersionGit{
public static $version = '_tK_verionGit_';
static function getVersion()
{
return '_tK_verionGit_';
}
static function getHash(){
return '_tK_hash_';
}
private function __construct(){}
}
//{"version":"_tK_verionGit_"}
//{"version":"_tK_verionGit_","hash":"_tK_hash_"}
+17 -21
View File
@@ -1,22 +1,18 @@
<div class="buttonPlate bg1">
<div>
<a href="a_status.php" target="_blank"><button class="toolbarButton">세력</button></a>
<a href="a_kingdomList.php" target="_blank"><button class="toolbarButton">세력일람</button></a>
<a href="a_genList.php" target="_blank"><button class="toolbarButton">장일람</button></a>
<a href="a_bestGeneral.php" target="_blank"><button class="toolbarButton">명장일람</button></a>
<a href="a_history.php" target="_blank"><button class="toolbarButton">연감</button></a>
<a href="a_hallOfFame.php" target="_blank"><button class="toolbarButton">명예의전당</button></a>
<a href="a_emperior.php" target="_blank"><button class="toolbarButton">왕조일람</button></a>
<a href="a_traffic.php" target="_blank"><button class="toolbarButton">접속량정보</button></a>
</div>
<div>
<a href="/bbs/board" target="_blank"><button class="toolbarButton2">삼모게시판</button></a>
<a href="/bbs/tip" target="_blank"><button class="toolbarButton">팁/강좌</button></a>
<a href="/bbs/news" target="_blank"><button class="toolbarButton">삼국 일보</button></a>
<a href="/bbs/history2" target="_blank"><button class="toolbarButton">개인 열전</button></a>
<a href="/bbs/history3" target="_blank"><button class="toolbarButton">국가 열전</button></a>
<a href="/bbs/patch" target="_blank"><button class="toolbarButton">패치 내역</button></a>
<a href="../i_other/help.php" target="_blank"><button class="toolbarButton">튜토리얼</button></a>
<a href="<?=$site?>" target="_blank"><button class="toolbarButton"><?=$call?></button></a>
</div>
<div class="buttonPlate">
<a href="a_status.php" target="_blank" class="open-window"><button type="button" class="toolbarButton">세력도</button></a>
<a href="a_kingdomList.php" target="_blank" class="open-window"><button type="button" class="toolbarButton">세력일람</button></a>
<a href="a_genList.php" target="_blank" class="open-window"><button type="button" class="toolbarButton">장수일람</button></a>
<a href="a_bestGeneral.php" target="_blank" class="open-window"><button type="button" class="toolbarButton">장일람</button></a>
<a href="a_history.php" target="_blank" class="open-window"><button type="button" class="toolbarButton">연감</button></a>
<a href="a_hallOfFame.php" target="_blank" class="open-window"><button type="button" class="toolbarButton">명예의전당</button></a>
<a href="a_emperior.php" target="_blank" class="open-window"><button type="button" class="toolbarButton">왕조일람</button></a>
<a href="a_traffic.php" target="_blank" class="open-window"><button type="button" class="toolbarButton">접속량정보</button></a>
<a href="/bbs/board" target="_blank"><button type="button" class="toolbarButton2">삼모게시판</button></a>
<a href="/bbs/tip" target="_blank"><button type="button" class="toolbarButton">팁/강좌</button></a>
<a href="/bbs/news" target="_blank"><button type="button" class="toolbarButton">삼국 일보</button></a>
<a href="/bbs/history2" target="_blank"><button type="button" class="toolbarButton">개인 열전</button></a>
<a href="/bbs/history3" target="_blank"><button type="button" class="toolbarButton">국가 열전</button></a>
<a href="/bbs/patch" target="_blank"><button type="button" class="toolbarButton">패치 내역</button></a>
<a href="battle_simulator.php" target="_blank"><button type="button" class="toolbarButton">전투 시뮬레이터</button></a>
<a href="<?=$site?>" target="_blank" class="open-window"><button type="button" class="toolbarButton"><?=$call?></button></a>
</div>
+409 -85
View File
@@ -2,6 +2,7 @@
namespace sammo;
use DateTime;
use sammo\Event\Action;
require_once 'process_war.php';
@@ -21,10 +22,10 @@ require_once('func_command.php');
/**
* nationID를 이용하여 국가의 '어지간해선' 변경되지 않는 정보(이름, 색, 성향, 규모, 수도)를 반환해줌
*
*
* @param int|null $nationID 국가 코드, -1인 경우 전체, null인 경우 수행하지 않음. 0인 경우에는 재야임
* @param bool $forceRefresh 강제 갱신 여부
*
*
* @return array|null nationID에 해당하는 국가가 있을 경우 array 반환. 그외의 경우 null
*/
function getNationStaticInfo($nationID, $forceRefresh = false)
@@ -189,7 +190,7 @@ function myNationInfo(General $generalObj)
$templates = new \League\Plates\Engine(__DIR__ . '/templates');
$nationID = $generalObj->getNationID();
$nation = $db->queryFirstRow('SELECT * FROM nation WHERE nation = %i', $nationID)??getNationStaticInfo(0);
$nation = $db->queryFirstRow('SELECT * FROM nation WHERE nation = %i', $nationID) ?? getNationStaticInfo(0);
$city = $db->queryFirstRow(
'SELECT COUNT(*) as cnt, SUM(pop) as totpop, SUM(pop_max) as maxpop from city where nation=%i',
$nationID
@@ -198,16 +199,16 @@ function myNationInfo(General $generalObj)
$topChiefs = Util::convertArrayToDict($db->query('SELECT officer_level, no, name, npc FROM general WHERE nation = %i AND officer_level >= 11', $nationID), 'officer_level');
$level12Name = key_exists(12, $topChiefs)?getColoredName($topChiefs[12]['name'], $topChiefs[12]['npc']):'-';
$level11Name = key_exists(11, $topChiefs)?getColoredName($topChiefs[11]['name'], $topChiefs[11]['npc']):'-';
$level12Name = key_exists(12, $topChiefs) ? getColoredName($topChiefs[12]['name'], $topChiefs[12]['npc']) : '-';
$level11Name = key_exists(11, $topChiefs) ? getColoredName($topChiefs[11]['name'], $topChiefs[11]['npc']) : '-';
$impossibleStrategicCommandLists = [];
$strategicCommandLists = GameConst::$availableChiefCommand['전략'];
$yearMonth = Util::joinYearMonth($admin['year'], $admin['month']);
foreach($strategicCommandLists as $command){
foreach ($strategicCommandLists as $command) {
$cmd = buildNationCommandClass($command, $generalObj, $admin, new LastTurn());
$nextAvailableTurn = $cmd->getNextAvailableTurn();
if($nextAvailableTurn > $yearMonth){
if ($nextAvailableTurn > $yearMonth) {
$impossibleStrategicCommandLists[] = [$cmd->getName(), $nextAvailableTurn - $yearMonth];
}
}
@@ -217,9 +218,9 @@ function myNationInfo(General $generalObj)
<td colspan=4 ";
if (!$nationID) {
echo "style='color:white;background-color:000000;font-weight:bold;font-size:13px;text-align:center;'>【재 야】";
echo "style='color:white;background-color:000000;font-weight:bold;font-size:14px;text-align:center;'>【재 야】";
} else {
echo "style='color:" . newColor($nation['color']) . ";background-color:{$nation['color']};font-weight:bold;font-size:13px;text-align:center'>국가【 {$nation['name']}";
echo "style='color:" . newColor($nation['color']) . ";background-color:{$nation['color']};font-weight:bold;font-size:14px;text-align:center'>국가【 {$nation['name']}";
}
echo "
@@ -239,28 +240,28 @@ function myNationInfo(General $generalObj)
<tr>
<td class='bg1 center'><b>총주민</b></td>
<td class='center'>";
echo $nationID===0 ? "해당 없음" : "{$city['totpop']}/{$city['maxpop']}";
echo $nationID === 0 ? "해당 없음" : "{$city['totpop']}/{$city['maxpop']}";
echo "</td>
<td class='bg1 center'><b>총병사</b></td>
<td class='center'>";
echo $nationID===0 ? "해당 없음" : "{$general['totcrew']}/{$general['maxcrew']}";
echo $nationID === 0 ? "해당 없음" : "{$general['totcrew']}/{$general['maxcrew']}";
echo "</td>
</td>
</tr>
<tr>
<td class='bg1 center'><b>국 고</b></td>
<td class='center'>";
echo $nationID===0 ? "해당 없음" : "{$nation['gold']}";
echo $nationID === 0 ? "해당 없음" : "{$nation['gold']}";
echo "</td>
<td class='bg1 center'><b>병 량</b></td>
<td class='center'>";
echo $nationID===0 ? "해당 없음" : "{$nation['rice']}";
echo $nationID === 0 ? "해당 없음" : "{$nation['rice']}";
echo "</td>
</tr>
<tr>
<td class='bg1 center'><b>지급률</b></td>
<td class='center'>";
if ($nationID===0) {
if ($nationID === 0) {
echo "해당 없음";
} else {
echo $nation['bill'] == 0 ? "0 %" : "{$nation['bill']} %";
@@ -269,7 +270,7 @@ function myNationInfo(General $generalObj)
</td>
<td class='bg1 center'><b>세 율</b></td>
<td class='center'>";
if ($nationID===0) {
if ($nationID === 0) {
echo "해당 없음";
} else {
echo $nation['rate'] == 0 ? "0 %" : "{$nation['rate']} %";
@@ -285,7 +286,7 @@ function myNationInfo(General $generalObj)
$nation['tech'] = "$techCall / {$nation['tech']}";
if ($nationID===0) {
if ($nationID === 0) {
$nation['strategic_cmd_limit'] = "<font color=white>해당 없음</font>";
$nation['surlimit'] = "<font color=white>해당 없음</font>";
$nation['scout'] = "<font color=white>해당 없음</font>";
@@ -294,20 +295,20 @@ function myNationInfo(General $generalObj)
} else {
if ($nation['strategic_cmd_limit'] != 0) {
$nation['strategic_cmd_limit'] = "<font color=red>{$nation['strategic_cmd_limit']}턴</font>";
} else if($impossibleStrategicCommandLists) {
} else if ($impossibleStrategicCommandLists) {
$nation['strategic_cmd_limit'] = "<font color=yellow>가 능</font>";
} else{
} else {
$nation['strategic_cmd_limit'] = "<font color=limegreen>가 능</font>";
}
if($impossibleStrategicCommandLists){
if ($impossibleStrategicCommandLists) {
$text = [];
foreach($impossibleStrategicCommandLists as [$cmdName, $remainTurn]){
foreach ($impossibleStrategicCommandLists as [$cmdName, $remainTurn]) {
$text[] = "{$cmdName}: {$remainTurn}턴 뒤";
}
$nation['strategic_cmd_limit'] = $templates->render('tooltip', [
'text'=>'<span style="text-decoration:underline dashed;">'.$nation['strategic_cmd_limit'].'</span>',
'info'=>'<span class="text-left d-inline-block">'.join('<br>', $text).'</span>',
'text' => '<span style="text-decoration:underline dashed;">' . $nation['strategic_cmd_limit'] . '</span>',
'info' => '<span class="text-left d-inline-block">' . join('<br>', $text) . '</span>',
]);
}
@@ -336,11 +337,11 @@ function myNationInfo(General $generalObj)
<tr>
<td style='text-align:center;' class='bg1'><b>속 령</b></td>
<td style='text-align:center;'>";
echo $nationID===0 ? "-" : "{$city['cnt']}";
echo $nationID === 0 ? "-" : "{$city['cnt']}";
echo "</td>
<td style='text-align:center;' class='bg1'><b>장 수</b></td>
<td style='text-align:center;'>";
echo $nationID===0 ? "-" : "{$general['cnt']}";
echo $nationID === 0 ? "-" : "{$general['cnt']}";
echo "</td>
</tr>
<tr>
@@ -348,7 +349,7 @@ function myNationInfo(General $generalObj)
<td style='text-align:center;'>{$nation['power']}</td>
<td style='text-align:center;' class='bg1'><b>기술력</b></td>
<td style='text-align:center;'>";
echo $nationID===0 ? "-" : "{$nation['tech']}";
echo $nationID === 0 ? "-" : "{$nation['tech']}";
echo "</td>
</tr>
<tr>
@@ -460,6 +461,40 @@ function commandGroup($typename, $type = 0)
}
}
function getCommandTable(General $general)
{
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$gameStor->turnOnCache();
$env = $gameStor->getAll();
$result = [];
foreach (GameConst::$availableGeneralCommand as $commandCategory => $commandList) {
$subList = [];
foreach ($commandList as $commandClassName) {
$commandObj = buildGeneralCommandClass($commandClassName, $general, $env);
if (!$commandObj->canDisplay()) {
continue;
}
$subList[] = [
'value' => Util::getClassNameFromObj($commandObj),
'compensation' => $commandObj->getCompensationStyle(),
'possible' => $commandObj->hasMinConditionMet(),
'title' => $commandObj->getCommandDetailTitle(),
'simpleName' => $commandObj->getName(),
'reqArg' => $commandObj::$reqArg,
];
}
$result[] = [
'category' => $commandCategory,
'values' => $subList
];
}
return $result;
}
function printCommandTable(General $generalObj)
{
$db = DB::db();
@@ -518,7 +553,7 @@ function chiefCommandTable(General $generalObj)
$env = $gameStor->getAll();
?>
<select id='chiefCommandList' name='commandtype' size=1 style='height:20px;color:white;background-color:black;font-size:13px;display:inline-block;'>";
<select id='chiefCommandList' name='commandtype' size=1 style='height:20px;color:white;background-color:black;font-size:14px;display:inline-block;'>";
<?php
//보정(Pros,Cons) 여부.
@@ -685,7 +720,7 @@ function generalInfo(General $generalObj)
echo "<table width=498 class='tb_layout bg2'>
<tr>
<td width=64 height=64 rowspan=3 class='generalIcon' style='text-align:center;background:no-repeat center url(\"{$imagePath}\");background-size:64px;'>&nbsp;</td>
<td colspan=9 height=16 style=text-align:center;color:" . newColor($nation['color']) . ";background-color:{$nation['color']};font-weight:bold;font-size:13px;>{$generalObj->getName()} 【 {$officerLevelText} | {$call} | {$color}{$injury}</span> 】 " . $generalObj->getTurnTime($generalObj::TURNTIME_HMS) . "</td>
<td colspan=9 height=16 style=text-align:center;color:" . newColor($nation['color']) . ";background-color:{$nation['color']};font-weight:bold;font-size:14px;>{$generalObj->getName()} 【 {$officerLevelText} | {$call} | {$color}{$injury}</span> 】 " . $generalObj->getTurnTime($generalObj::TURNTIME_HMS) . "</td>
</tr>
<tr height=16>
<td style='text-align:center;' class='bg1'><b>통솔</b></td>
@@ -847,7 +882,7 @@ function generalInfo2(General $generalObj)
<td style='text-align:center;'>{$generalObj->getRankVar('deathcrew')}</td>
</tr>
</table>
<table width=498 class='tb_layout bg2'>
<table width=498 class='tb_layout bg2 f_tnum'>
<tr><td style='text-align:center;' colspan=4 class='bg1'><b>숙 련 도</b></td></tr>
<tr height=16>
<td width=64 style='text-align:center;' class='bg1'><b>보병</b></td>
@@ -903,17 +938,16 @@ function nationMsg(General $general)
$db = DB::db();
$nationID = $general->getNationID();
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
return $nationStor->notice??'';
return $nationStor->notice ?? '';
}
function banner()
{
return sprintf(
'<font size=2>%s %s / %s</font>',
GameConst::$title,
VersionGit::$version,
VersionGit::getVersion(),
GameConst::$banner
);
}
@@ -1006,7 +1040,7 @@ function increaseRefresh($type = "", $cnt = 1)
$isunited = $gameStor->isunited;
$opentime = $gameStor->opentime;
if ($isunited != 2 && $generalID && $userGrade < 6 && $opentime <= TimeUtil::DatetimeNow()) {
if ($isunited != 2 && $generalID && $userGrade < 6 && $opentime <= TimeUtil::now()) {
$db->update('general', [
'lastrefresh' => $date,
'con' => $db->sqleval('con + %i', $cnt),
@@ -1227,14 +1261,14 @@ function updateOnline()
$onlineUser = $db->query('SELECT no,name,nation FROM general WHERE lastrefresh > %s AND npc < 2', $before5Min);
$onlineNum = count($onlineUser);
$onlineNationUsers = Util::arrayGroupBy($onlineUser, 'nation');
uasort($onlineNationUsers, function(array $lhs, array $rhs){
return -(count($lhs)<=>count($rhs));
uasort($onlineNationUsers, function (array $lhs, array $rhs) {
return - (count($lhs) <=> count($rhs));
});
$onlineNation = [];
$onlineNation = [];
foreach($onlineNationUsers as $nationID=>$rawOnlineUser){
foreach ($onlineNationUsers as $nationID => $rawOnlineUser) {
$nationName = getNationStaticInfo($nationID)['name'];
$onlineNation[] = "【{$nationName}】";
$userList = join(', ', Util::squeezeFromArray($rawOnlineUser, 'name'));
@@ -1256,9 +1290,12 @@ function addAge()
//나이와 호봉 증가
$db->update('general', [
'age' => $db->sqleval('age+1'),
'belong' => $db->sqleval('belong+1')
], true);
$db->update('general', [
'belong' => $db->sqleval('belong+1')
], 'nation != 0');
[$startYear, $year, $month] = $gameStor->getValuesAsArray(['startyear', 'year', 'month']);
if ($year >= $startYear + 3) {
@@ -1266,7 +1303,7 @@ function addAge()
$generalID = $general['no'];
$special = SpecialityHelper::pickSpecialDomestic(
$general,
(Json::decode($general['aux'])['prev_types_special'])??[]
(Json::decode($general['aux'])['prev_types_special']) ?? []
);
$specialClass = buildGeneralSpecialDomesticClass($special);
$specialText = $specialClass->getName();
@@ -1283,16 +1320,25 @@ function addAge()
foreach ($db->query('SELECT no,name,nation,leadership,strength,intel,npc,dex1,dex2,dex3,dex4,dex5,aux from general where specage2<=age and special2=%s', GameConst::$defaultSpecialWar) as $general) {
$generalID = $general['no'];
$special2 = SpecialityHelper::pickSpecialWar(
$general,
(Json::decode($general['aux'])['prev_types_special2'])??[]
);
$generalAux = Json::decode($general['aux']);
$updateVars = [];
if (key_exists('inheritSpecificSpecialWar', $generalAux)) {
$special2 = $generalAux['inheritSpecificSpecialWar'];
unset($generalAux['inheritSpecificSpecialWar']);
$updateVars['aux'] = Json::encode($generalAux);
} else {
$special2 = SpecialityHelper::pickSpecialWar(
$general,
($generalAux['prev_types_special2']) ?? []
);
}
$specialClass = buildGeneralSpecialWarClass($special2);
$specialText = $specialClass->getName();
$db->update('general', [
'special2' => $special2
], 'no=%i', $general['no']);
$updateVars['special2'] = $special2;
$db->update('general', $updateVars, 'no=%i', $general['no']);
$logger = new ActionLogger($generalID, $general['nation'], $year, $month);
@@ -1336,17 +1382,29 @@ function triggerTournament()
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$admin = $gameStor->getValues(['tournament', 'tnmt_trig']);
[$tournament, $tnmt_trig, $tnmt_pattern] = $gameStor->getValuesAsArray(['tournament', 'tnmt_trig', 'tnmt_pattern']);
//현재 토너먼트 없고, 자동개시 걸려있을때, 40%확률
if ($admin['tournament'] == 0 && $admin['tnmt_trig'] > 0 && rand() % 100 < 40) {
$type = rand() % 5; // 0 : 전력전, 1 : 통솔전, 2 : 일기토, 3 : 설전
//전력전 40%, 통, 일, 설 각 20%
if ($type > 3) {
$type = 0;
}
startTournament($admin['tnmt_trig'], $type);
if ($tournament != 0) {
return;
}
if ($tnmt_trig == 0) {
return;
}
if (!Util::randBool(0.4)) {
return;
}
if (!$tnmt_pattern) {
// 0 : 전력전, 1 : 통솔전, 2 : 일기토, 3 : 설전
//전력전 40%, 통, 일, 설 각 20%
$tnmt_pattern = [0, 0, 1, 2, 3];
shuffle($tnmt_pattern);
}
$tnmt_type = array_pop($tnmt_pattern);
$gameStor->setValue('tnmt_pattern', $tnmt_pattern);
startTournament($tnmt_trig, $tnmt_type);
}
function CheckHall($no)
@@ -1538,15 +1596,15 @@ function giveRandomUniqueItem(General $general, string $acquireType): bool
$occupiedUnique = [];
$invalidItemType = [];
foreach(array_keys(GameConst::$allItems) as $itemType){
$ownItem = $general->getItems()[$itemType]??null;
if($ownItem !== null && !$ownItem->isBuyable()){
foreach (array_keys(GameConst::$allItems) as $itemType) {
$ownItem = $general->getItems()[$itemType] ?? null;
if ($ownItem !== null && !$ownItem->isBuyable()) {
$invalidItemType[$itemType] = true;
}
}
foreach (array_keys(GameConst::$allItems) as $itemType) {
if(key_exists($itemType, $invalidItemType)){
if (key_exists($itemType, $invalidItemType)) {
continue;
}
foreach ($db->queryAllLists('SELECT %b, count(*) as cnt FROM general GROUP BY %b', $itemType, $itemType) as [$itemCode, $cnt]) {
@@ -1562,10 +1620,13 @@ function giveRandomUniqueItem(General $general, string $acquireType): bool
}
foreach (GameConst::$allItems as $itemType => $itemCategories) {
if(key_exists($itemType, $invalidItemType)){
if (key_exists($itemType, $invalidItemType)) {
continue;
}
foreach ($itemCategories as $itemCode => $cnt) {
if ($cnt == 0) {
continue;
}
if (!key_exists($itemCode, $occupiedUnique)) {
$availableUnique[] = [[$itemType, $itemCode], $cnt];
continue;
@@ -1579,9 +1640,29 @@ function giveRandomUniqueItem(General $general, string $acquireType): bool
}
if (!$availableUnique) {
if ($general->getAuxVar('inheritRandomUnique')) {
$general->setAuxVar('inheritRandomUnique', null);
$general->increaseInheritancePoint('previous', GameConst::$inheritItemRandomPoint);
$userLogger = new UserLogger($general->getVar('owner'));
$userLogger->push(sprintf("얻을 유니크가 없어 %d 포인트 반환", GameConst::$inheritItemRandomPoint), "inheritPoint");
}
return false;
}
if ($general->getAuxVar('inheritRandomUnique')) {
$gameStor = KVStorage::getStorage($db, 'game_env');
[$year, $month, $initYear, $initMonth] = $gameStor->getValuesAsArray(['year', 'month', 'init_year', 'init_month']);
$relMonthByInit = Util::joinYearMonth($year, $month) - Util::joinYearMonth($initYear, $initMonth);
$availableBuyUnique = $relMonthByInit >= GameConst::$minMonthToAllowInheritItem;
if($availableBuyUnique){
$general->setAuxVar('inheritRandomUnique', null);
}
}
[$itemType, $itemCode] = Util::choiceRandomUsingWeightPair($availableUnique);
$nationName = $general->getStaticNation()['name'];
@@ -1605,6 +1686,207 @@ function giveRandomUniqueItem(General $general, string $acquireType): bool
return true;
}
function rollbackInheritUniqueTrial(General $general, string $itemKey, string $reason)
{
$ownerID = $general->getVar('owner');
$db = DB::db();
$itemTrials = $general->getAuxVar('inheritUniqueTrial');
LogText("선택유니크 롤백:{$ownerID}", [$itemKey, $itemTrials]);
unset($itemTrials[$itemKey]);
if (count($itemTrials) == 0) {
$itemTrials = null;
}
$general->setAuxVar('inheritUniqueTrial', $itemTrials);
$trialStor = KVStorage::getStorage($db, "ut_{$itemKey}");
$ownTrial = $trialStor->getValue("u{$ownerID}");
$itemObj = buildItemClass($itemKey);
$itemName = $itemObj->getName();
if ($ownTrial) {
//두 값이 general, KVStorage 둘다 있고, 이중에선 KVStorage 값을 기준으로 하자 따르자
[,, $amount] = $ownTrial;
$trialStor->deleteValue("u{$ownerID}");
$general->increaseInheritancePoint('previous', $amount);
LogText("선택유니크 롤백포인트:{$ownerID}", $amount);
$userLogger = new UserLogger($ownerID);
$userLogger->push("{$itemName} 입찰에 사용한 {$amount} 포인트 반환", "inheritPoint");
}
//메시지
$staticNation = $general->getStaticNation();
$unlimited = new \DateTime('9999-12-31');
$src = new MessageTarget(0, '', 0, 'System', '#000000');
$dest = new MessageTarget($general->getID(), $general->getName(), $general->getNationID(), $staticNation['name'], $staticNation['color'], GetImageURL($general->getVar('imgsvr'), $general->getVar('picture')));
$josaUl = JosaUtil::pick($itemName, '을');
$msg = new Message(
Message::MSGTYPE_PRIVATE,
$src,
$dest,
"{$itemName}{$josaUl} 얻지 못했습니다. {$reason}",
new DateTime(),
$unlimited,
[]
);
$general->applyDB($db);
$msg->send(true);
}
function tryRollbackInheritUniqueItem(General $general): void
{
tryInheritUniqueItem($general, 'Rollback', true);
}
function tryInheritUniqueItem(General $general, string $acquireType = '아이템', bool $justRollback = false): bool
{
$ownerID = $general->getVar('owner');
if (!$ownerID) {
LogText("선택유니크 실패???: {$ownerID}", $general->getName());
return false;
}
$itemTrials = $general->getAuxVar('inheritUniqueTrial') ?? [];
arsort($itemTrials);
LogText("선택유니크항목: {$ownerID}", $itemTrials);
$db = DB::db();
$ownTarget = null;
$ownType = null;
foreach ($itemTrials as $itemKey => $amount) {
$availableItemTypes = [];
$reasons = [];
foreach (GameConst::$allItems as $itemType => $itemList) {
//아직은 그런 경우는 없지만 동일 유니크를 여러 부위에 장착할 수 있을지도 모름
if (!key_exists($itemKey, $itemList)) {
continue;
}
$ownItem = $general->getItem($itemType);
if ($ownItem->getRawClassName() == $itemKey) {
$reasons[] = '이미 그 유니크를 가지고 있습니다.';
continue;
}
/*
if (!$ownItem->isBuyable()) {
$reasons[] = '이미 다른 유니크를 가지고 있습니다.';
continue;
}
*/
$availableCnt = $itemList[$itemKey];
$occupiedCnt = $db->queryFirstField('SELECT count(*) FROM general WHERE %b = %s', $itemType, $itemKey);
if ($occupiedCnt >= $availableCnt) {
$reasons[] = '그 유니크는 모두 점유되었습니다.';
continue;
}
$availableItemTypes[] = $itemType;
}
if (!$availableItemTypes) {
rollbackInheritUniqueTrial($general, $itemKey, join(' ', $reasons));
continue;
}
$reasons = [];
$itemType = Util::choiceRandom($availableItemTypes);
$trialStor = KVStorage::getStorage($db, "ut_{$itemKey}"); //혹시 itemKey의 크기가 37이 넘을 수 있을까?
$anyTrials = $trialStor->getAll();
if (!$anyTrials) {
//순서가 꼬였던 모양, 실제 값은 storage를 우선시하자
rollbackInheritUniqueTrial($general, $itemKey, '절차상의 오류입니다.');
continue;
}
//XXX: 정렬할 필요 없지 않나?
usort($anyTrials, function ($lhsTrial, $rhsTrial) {
[,, $lhsAmount] = $lhsTrial;
[,, $rhsAmount] = $rhsTrial;
return $rhsAmount <=> $lhsAmount; //큰 값이 앞에 오도록
});
LogText("선택유니크상태 {$ownerID} {$itemKey}", $anyTrials);
//공동 1등인데 본인이 있을 수도 있다.
[,, $topAmount] = $anyTrials[0];
if ($amount < $topAmount) {
$compAmount = $topAmount / $amount;
if ($compAmount > 2.0) {
$compText = '엄청난 차이로 ';
} else if ($compAmount > 1.2) {
$compText = '큰 차이로 ';
} else if ($compAmount > 1.05) {
$compText = '';
} else {
$compText = '아슬아슬한 차이로 ';
}
rollbackInheritUniqueTrial($general, $itemKey, "{$compText}상위 입찰한 장수가 있습니다.");
continue;
}
//내가 1위다
if ($ownTarget !== null) {
//이미 다른 아이템을 얻기로 되어있다.
continue;
}
$ownTarget = $itemKey;
$ownType = $itemType;
}
unset($itemKey);
unset($itemType);
if ($ownTarget === null) {
return false;
}
if ($justRollback) {
return false;
}
LogText("선택유니크획득{$ownerID}", $ownTarget);
$trialStor = KVStorage::getStorage($db, "ut_{$ownTarget}");
$trialStor->deleteValue("u{$ownerID}");
//rollbackInheritUniqueTrial 과정 때문에 새로 받아와야함
$itemTrials = $general->getAuxVar('inheritUniqueTrial');
unset($itemTrials[$ownTarget]);
$general->setAuxVar('inheritUniqueTrial', $itemTrials);
$nationName = $general->getStaticNation()['name'];
$generalName = $general->getName();
$josaYi = JosaUtil::pick($generalName, '이');
$itemObj = buildItemClass($ownTarget);
$itemName = $itemObj->getName();
$itemRawName = $itemObj->getRawName();
$josaUl = JosaUtil::pick($itemRawName, '을');
$general->setVar($ownType, $ownTarget);
$logger = $general->getLogger();
$logger->pushGeneralActionLog("<C>{$itemName}</>{$josaUl} 습득했습니다!");
$logger->pushGeneralHistoryLog("<C>{$itemName}</>{$josaUl} 습득");
$logger->pushGlobalActionLog("<Y>{$generalName}</>{$josaYi} <C>{$itemName}</>{$josaUl} 습득했습니다!");
$logger->pushGlobalHistoryLog("<C><b>【{$acquireType}】</b></><D><b>{$nationName}</b></>의 <Y>{$generalName}</>{$josaYi} <C>{$itemName}</>{$josaUl} 습득했습니다!");
$general->applyDB($db);
return true;
}
function tryUniqueItemLottery(General $general, string $acquireType = '아이템'): bool
{
$db = DB::db();
@@ -1614,25 +1896,52 @@ function tryUniqueItemLottery(General $general, string $acquireType = '아이템
return false;
}
if ($general->getNPCType() > 6) {
return false;
$itemTypeCnt = count(GameConst::$allItems);
[$startYear, $year, $month, $initYear, $initMonth] = $gameStor->getValuesAsArray(['startyear', 'year', 'month', 'init_year', 'init_month']);
$relYear = $year - $startYear;
$maxTrialCountByYear = 1;
foreach (GameConst::$maxUniqueItemLimit as $tmpVals) {
[$targetYear, $targetTrialCnt] = $tmpVals;
if ($relYear < $targetYear) {
break;
}
$maxTrialCountByYear = $targetTrialCnt;
}
$itemTypeCnt = count(GameConst::$allItems);
$trialCnt = $itemTypeCnt;
$trialCnt = Util::valueFit($itemTypeCnt, null, $maxTrialCountByYear);
$maxCnt = $itemTypeCnt;
$relMonthByInit = Util::joinYearMonth($year, $month) - Util::joinYearMonth($initYear, $initMonth);
$availableBuyUnique = $relMonthByInit >= GameConst::$minMonthToAllowInheritItem;
foreach ($general->getItems() as $item) {
if (!$item->isBuyable()) {
$trialCnt -= 1;
$maxCnt -= 1;
}
}
if($trialCnt <= 0){
if ($trialCnt <= 0) {
LogText("{$general->getName()}, {$general->getID()} 모든 아이템", $trialCnt);
if ($general->getAuxVar('inheritRandomUnique')) {
$general->setAuxVar('inheritRandomUnique', null);
$general->increaseInheritancePoint('previous', GameConst::$inheritItemRandomPoint);
$userLogger = new UserLogger($general->getVar('owner'));
$userLogger->push(sprintf("유니크를 얻을 공간이 없어 %d 포인트 반환", GameConst::$inheritItemRandomPoint), "inheritPoint");
}
tryRollbackInheritUniqueItem($general);
return false;
}
$inheritUnique = $general->getAuxVar('inheritUniqueTrial');
if ($acquireType != '설문조사' && $inheritUnique && count($inheritUnique) && $availableBuyUnique) {
$trialResult = tryInheritUniqueItem($general, $acquireType);
if ($trialResult) {
return true;
}
}
$scenario = $gameStor->scenario;
$genCount = $db->queryFirstField('SELECT count(*) FROM general WHERE npc<2');
@@ -1651,23 +1960,30 @@ function tryUniqueItemLottery(General $general, string $acquireType = '아이템
$prob = 1 / ($genCount * $itemTypeCnt / 10 / 4); // 건국시 4개(20%) 등장(200명시 20국 정도 됨)
}
$prob = Util::valueFit($prob, null, 1 / 4);//최대치 감소
$prob = Util::valueFit($prob, null, 1 / 4); //최대치 감소
$result = false;
$prob /= sqrt(2);
$moreProb = pow(2, 1 / 4);
if ($general->getAuxVar('inheritRandomUnique') && $availableBuyUnique) {
//포인트로 랜덤 유니크 획득
$prob = 1;
}
foreach(Util::range($trialCnt) as $_idx){
foreach (Util::range($maxCnt) as $_idx) {
if (Util::randBool($prob)) {
$result = true;
break;
}
$prob *= $moreProb;
}
if(!$result){
LogText("{$general->getName()}, {$general->getID()} 유니크 실패 {$trialCnt}", $prob);
if (!$result) {
LogText("{$general->getName()}, {$general->getID()} 유니크 실패 {$maxCnt}", $prob);
return false;
}
LogText("{$general->getName()}, {$general->getID()} 유니크 성공 {$trialCnt}", $prob);
LogText("{$general->getName()}, {$general->getID()} 유니크 성공 {$maxCnt}", $prob);
return giveRandomUniqueItem($general, $acquireType);
}
@@ -1679,7 +1995,7 @@ function getAdmin()
}
/** @return General[] */
function deleteNation(General $lord, bool $applyDB):array
function deleteNation(General $lord, bool $applyDB): array
{
$lordID = $lord->getID();
$nationID = $lord->getNationID();
@@ -1688,7 +2004,7 @@ function deleteNation(General $lord, bool $applyDB):array
$db = DB::db();
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
$nation = $db->queryFirstRow('SELECT * FROM nation WHERE nation=%i', $nationID);
$nationName = $nation['name'];
@@ -1697,17 +2013,18 @@ function deleteNation(General $lord, bool $applyDB):array
$josaUn = JosaUtil::pick($nationName, '은');
$logger->pushGlobalHistoryLog("<R><b>【멸망】</b></><D><b>{$nationName}</b></>{$josaUn} <R>멸망</>했습니다.");
$nationGeneralList = General::createGeneralObjListFromDB(
$db->queryFirstColumn(
'SELECT `no` FROM general WHERE nation=%i AND no != %i',
$nationID,
$lordID
),
['npc', 'gold', 'rice', 'experience', 'explevel', 'dedication', 'dedlevel', 'aux'], 1
),
['npc', 'gold', 'rice', 'experience', 'explevel', 'dedication', 'dedlevel', 'belong', 'aux'],
1
);
$nationGeneralList[$lordID] = $lord;
$nation['generals'] = array_keys($nationGeneralList);
$nation['aux'] = Json::decode($nation['aux']);
$nation['msg'] = $nationStor->notice;
@@ -1720,7 +2037,14 @@ function deleteNation(General $lord, bool $applyDB):array
$destroyHistoryLog = "<D><b>{$nationName}</b></>{$josaYi} <R>멸망</>";
// 전 장수 재야로
foreach($nationGeneralList as $general){
foreach ($nationGeneralList as $general) {
$general->setAuxVar(
'max_belong',
max(
$general->getVar('belong'),
$general->getAuxVar('max_belong') ?? 0
)
);
$general->setVar('belong', 0);
$general->setVar('troop', 0);
$general->setVar('officer_level', 0);
@@ -1731,7 +2055,7 @@ function deleteNation(General $lord, bool $applyDB):array
$logger->pushGeneralActionLog($destroyLog, ActionLogger::PLAIN);
$logger->pushGeneralHistoryLog($destroyHistoryLog);
if($applyDB){
if ($applyDB) {
$general->applyDB($db);
}
}
@@ -1879,7 +2203,7 @@ function searchDistance(int $from, int $maxDist = 99, bool $distForm = false)
* @param $from 기준 도시 코드
* @param $to 대상 도시 코드
* @param array|null $linkNationList 경로에 해당하는 국가 리스트, null인 경우 제한 없음
* @return null|int 거리.
* @return null|int 거리.
*/
function calcCityDistance(int $from, int $to, ?array $linkNationList): ?int
{
@@ -1893,7 +2217,7 @@ function calcCityDistance(int $from, int $to, ?array $linkNationList): ?int
if ($linkNationList !== null) {
$db = DB::db();
//TODO: 도시-국가 캐싱이 있으면 쓸모 있지 않을까
//TODO: 도시-국가 캐싱이 있으면 쓸모 있지 않을까
$allowedCityList = [];
foreach ($db->queryFirstColumn(
'SELECT city FROM city WHERE nation IN %li',
@@ -1956,7 +2280,7 @@ function searchDistanceListToDest(int $from, int $to, array $linkNationList)
$db = DB::db();
//TODO: 도시-국가 캐싱이 있으면 쓸모 있지 않을까
//TODO: 도시-국가 캐싱이 있으면 쓸모 있지 않을까
$allowedCityList = [];
foreach ($db->queryAllLists(
'SELECT city, nation FROM city WHERE nation IN %li',
@@ -2150,7 +2474,7 @@ function getRandTurn($term, ?\DateTimeInterface $baseDateTime = null)
$randSecond = Util::randRangeInt(0, 60 * $term - 1);
$randFraction = Util::randRangeInt(0, 999999) / 1000000; //6자리 소수
return $baseDateTime->add(TimeUtil::secondsToDateInterval($randSecond + $randFraction))->format('Y-m-d H:i:s');
return TimeUtil::format($baseDateTime->add(TimeUtil::secondsToDateInterval($randSecond + $randFraction)), true);
}
function getRandTurn2($term, ?\DateTimeInterface $baseDateTime = null)
@@ -2165,5 +2489,5 @@ function getRandTurn2($term, ?\DateTimeInterface $baseDateTime = null)
$randSecond = Util::randRangeInt(0, 60 * $term - 1);
$randFraction = Util::randRangeInt(0, 999999) / 1000000; //6자리 소수
return $baseDateTime->sub(TimeUtil::secondsToDateInterval($randSecond + $randFraction))->format('Y-m-d H:i:s');
return $baseDateTime->sub(TimeUtil::secondsToDateInterval($randSecond + $randFraction))->format('Y-m-d H:i:s.u');
}
+5 -5
View File
@@ -63,7 +63,7 @@ function pullGeneralCommand(int $generalID, int $turnCnt=1){
if($turnCnt >= GameConst::$maxTurn){
return;
}
$db = DB::db();
$db->update('general_turn', [
@@ -96,7 +96,7 @@ function repeatGeneralCommand(int $generalId, int $turnCnt){
foreach($turnList as $turnItem){
$turnIdx = $turnItem['turn_idx'];
$turnTarget = iterator_to_array(Util::range($turnIdx+$turnCnt, GameConst::$maxTurn, $turnCnt));
$db->update('general_turn', [
'action'=>$turnItem['action'],
'arg'=>$turnItem['arg'],
@@ -116,7 +116,7 @@ function pushNationCommand(int $nationID, int $officerLevel, int $turnCnt=1){
return;
}
if($turnCnt < 0){
pullNationCommand($nationID, $officerLevel, -$turnCnt);
pullNationCommand($nationID, $officerLevel, -$turnCnt);
return;
}
if($turnCnt >= GameConst::$maxChiefTurn){
@@ -153,7 +153,7 @@ function pullNationCommand(int $nationID, int $officerLevel, int $turnCnt=1){
if($turnCnt >= GameConst::$maxChiefTurn){
return;
}
$db = DB::db();
$db->update('nation_turn', [
@@ -269,7 +269,7 @@ function checkCommandArg(?array $arg):?string{
}
function setGeneralCommand(int $generalID, array $rawTurnList, string $command, ?array $arg = null):array{
$turnList = [];
foreach($rawTurnList as $turnIdx){
if(!is_int($turnIdx) || $turnIdx < -3 || $turnIdx >= GameConst::$maxTurn){
+12 -12
View File
@@ -1,4 +1,4 @@
<?php
<?php
namespace sammo;
@@ -6,7 +6,7 @@ use sammo\Command\BaseCommand;
/**
* Value Converter
*
*
* Side effect 없이 값의 변환만을 수행하는 함수들의 모음.
* (단, autoload, 정적 변수 초기화는 허용)
*/
@@ -175,7 +175,7 @@ function buildNationTypeClass(?string $type):BaseNation{
return $cache[$type];
}
$class = getNationTypeClass($type);
$obj = new $class();
$cache[$type]= $obj;
return $obj;
@@ -241,7 +241,7 @@ function buildItemClass(?string $type):BaseItem{
return $cache[$type];
}
$class = getItemClass($type);
$obj = new $class();
$cache[$type]= $obj;
return $obj;
@@ -276,7 +276,7 @@ function buildGeneralSpecialDomesticClass(?string $type):BaseSpecial{
return $cache[$type];
}
$class = getGeneralSpecialDomesticClass($type);
$obj = new $class();
$cache[$type]= $obj;
return $obj;
@@ -311,7 +311,7 @@ function buildGeneralSpecialWarClass(?string $type):BaseSpecial{
return $cache[$type];
}
$class = getGeneralSpecialWarClass($type);
$obj = new $class();
$cache[$type]= $obj;
return $obj;
@@ -391,8 +391,8 @@ function getGeneralPoolClass(string $type){
/**
* @param \MeekroDB $db
* @param int $owner
* @param int $pickCnt
* @param int $owner
* @param int $pickCnt
* @param null|string $prefix
* @return AbsGeneralPool[]
*/
@@ -538,8 +538,8 @@ function getExpLevel($experience) {
function getDedLevel($dedication) {
$level = Util::valueFit(
ceil(sqrt($dedication) / 10),
0,
ceil(sqrt($dedication) / 10),
0,
GameConst::$maxDedLevel
);
@@ -572,7 +572,7 @@ function getCost(int $armtype) : int {
function getTechLevel($tech):int{
return Util::valueFit(
floor($tech / 1000),
0,
0,
GameConst::$maxTechLevel
);
}
@@ -583,7 +583,7 @@ function TechLimit($startYear, $year, $tech) : bool {
$relMaxTech = Util::valueFit(
floor($relYear / 5) + 1,
1,
1,
GameConst::$maxTechLevel
);
+142 -38
View File
@@ -167,14 +167,15 @@ function checkSupply()
}
}
function updateGeneralNumber(){
function updateGeneralNumber()
{
$db = DB::db();
foreach($db->queryAllLists('SELECT nation, count(*) FROM general WHERE npc != 5 GROUP BY nation') as [$nationID, $gennum]){
if($nationID === 0){
foreach ($db->queryAllLists('SELECT nation, count(*) FROM general WHERE npc != 5 GROUP BY nation') as [$nationID, $gennum]) {
if ($nationID === 0) {
continue;
}
$db->update('nation', [
'gennum'=>$gennum
'gennum' => $gennum
], 'nation=%i', $nationID);
}
refreshNationStaticInfo();
@@ -370,7 +371,11 @@ function postUpdateMonthly()
sum(pop)*sum(pop+agri+comm+secu+wall+def)/sum(pop_max+agri_max+comm_max+secu_max+wall_max+def_max)/100
) from city where nation=A.nation and supply=1
))
+(select sum(leadership+strength+intel) from general where nation=A.nation)
+(select SUM((ra.value + 1000)/(rb.value + 1000)*(CASE WHEN g.`leadership` >= 40 THEN g.`leadership` ELSE 0 END)*2 + (SQRT(g.intel * g.strength) * 2 + g.leadership / 2)/2)
FROM general AS g
LEFT JOIN `rank_data` AS ra ON g.`no` = ra.general_id AND ra.`type` = \'killcrew_person\'
LEFT JOIN `rank_data` AS rb ON g.`no` = rb.general_id AND rb.`type` = \'deathcrew_person\'
WHERE g.nation = A.nation)
+(select round(sum(dex1+dex2+dex3+dex4+dex5)/1000) from general where nation=A.nation)
+(select round(sum(experience+dedication)/100) from general where nation=A.nation)
+(select round(avg(connect)) from general where nation=A.nation)
@@ -386,7 +391,7 @@ function postUpdateMonthly()
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
$genNum[$nationID] = $nation['gennum'];
$powerValues = $maxPowerValues[$nationID]??[];
$powerValues = $maxPowerValues[$nationID] ?? [];
//약간의 랜덤치 부여 (95% ~ 105%)
@@ -405,7 +410,7 @@ function postUpdateMonthly()
}
// 전쟁기한 세팅
foreach($db->query('SELECT me, you, dead, term FROM diplomacy WHERE state = 0') as $dip) {
foreach ($db->query('SELECT me, you, dead, term FROM diplomacy WHERE state = 0') as $dip) {
$genCount = $genNum[$dip['me']];
// 25% 참여율일때 두당 10턴에 4000명 소모한다고 계산
// 4000 / 10 * 0.25 = 100
@@ -420,7 +425,7 @@ function postUpdateMonthly()
}
//개전국 로그
foreach($db->query('SELECT me, you FROM diplomacy WHERE state = 1 AND term <= 1 AND me < you') as $dip){
foreach ($db->query('SELECT me, you FROM diplomacy WHERE state = 1 AND term <= 1 AND me < you') as $dip) {
$nation1 = getNationStaticInfo($dip['me']);
$name1 = $nation1['name'];
$nation2 = getNationStaticInfo($dip['you']);
@@ -432,14 +437,13 @@ function postUpdateMonthly()
}
//휴전국 로그
$stopWarList = [];
foreach($db->queryAllLists('SELECT me,you FROM diplomacy WHERE state=0 AND term <= 1 ORDER BY me desc, you desc') as [$me, $you]){
if($me < $you){
foreach ($db->queryAllLists('SELECT me,you FROM diplomacy WHERE state=0 AND term <= 1 ORDER BY me desc, you desc') as [$me, $you]) {
if ($me < $you) {
$key = "{$me}_{$you}";
}
else{
} else {
$key = "{$you}_{$me}";
}
if(!key_exists($key, $stopWarList)){
if (!key_exists($key, $stopWarList)) {
$stopWarList[$key] = true;
continue;
}
@@ -455,8 +459,8 @@ function postUpdateMonthly()
$globalLogger->pushGlobalHistoryLog("<R><b>【휴전】</b></><D><b>$name1</b></>{$josaWa} <D><b>$name2</b></>{$josaYi} <S>휴전</>합니다.");
$db->update('diplomacy', [
'state'=>2,
'term'=>0,
'state' => 2,
'term' => 0,
], '(me=%i AND you=%i) OR (you=%i AND me=%i)', $me, $you, $me, $you);
}
@@ -464,19 +468,34 @@ function postUpdateMonthly()
//사상자 초기화, 외교 기한-1
$db->update('diplomacy', [
'dead'=>$db->sqleval('if(state!=0, 0, dead)'),
'term'=>$db->sqleval('greatest(0, term-1)'),
'dead' => $db->sqleval('if(state!=0, 0, dead)'),
'term' => $db->sqleval('greatest(0, term-1)'),
], true);
//불가침 끝나면 통상으로
$db->update('diplomacy', [
'state'=>2,
'state' => 2,
], 'state = 7 AND term = 0');
//선포 끝나면 교전으로
$db->update('diplomacy', [
'state'=>0,
'term'=>6,
'state' => 0,
'term' => 6,
], 'state = 1 AND term = 0');
$availableWarSettingCnt = KVStorage::getValuesFromInterNamespace($db, 'nation_env', 'available_war_setting_cnt');
foreach ($nations as $nation) {
$nationID = $nation['nation'];
if(!key_exists($nationID, $availableWarSettingCnt)){
$availableWarSettingCnt[$nationID] = 0;
}
}
foreach($availableWarSettingCnt as $nationID=>$cnt){
if($cnt >= GameConst::$maxAvailableWarSettingCnt){
continue;
}
$cnt = Util::valueFit($cnt + GameConst::$incAvailableWarSettingCnt, 0, GameConst::$maxAvailableWarSettingCnt);
(KVStorage::getStorage($db, $nationID, 'nation_env'))->setValue('available_war_setting_cnt', $cnt);
}
//초반이후 방랑군 자동 해체
if ($admin['year'] >= $admin['startyear'] + 2) {
checkWander();
@@ -567,8 +586,8 @@ function updateNationState()
$updateVals = [
'level' => $nationlevel,
'gold'=>$db->sqleval('gold + %i', $nationlevel*1000),
'rice'=>$db->sqleval('rice + %i', $nationlevel*1000),
'gold' => $db->sqleval('gold + %i', $nationlevel * 1000),
'rice' => $db->sqleval('rice + %i', $nationlevel * 1000),
];
switch ($nationlevel) {
@@ -623,11 +642,26 @@ function updateNationState()
$nation['nation'],
$targetKillTurn
);
$nationGenList = General::createGeneralObjListFromDB($nationGenIDList, ['belong'], 2);
$nationGenList = General::createGeneralObjListFromDB($nationGenIDList, ['belong', 'npc', 'aux'], 2);
$chiefID = null;
$uniqueLotteryWeightList = [];
[$startYear, $year] = $gameStor->getValuesAsArray(['startyear', 'year']);
$relYear = $year - $startYear;
$maxTrialCountByYear = 1;
foreach (GameConst::$maxUniqueItemLimit as $tmpVals) {
[$targetYear, $targetTrialCnt] = $tmpVals;
if ($relYear < $targetYear) {
break;
}
$maxTrialCountByYear = $targetTrialCnt;
}
foreach ($nationGenList as $nationGen) {
$trialCnt = count(GameConst::$allItems);
if ($nationGen->getVar('officer_level') == 12) {
$chiefID = $nationGen->getID();
}
$trialCnt = min($maxTrialCountByYear, count(GameConst::$allItems));
foreach ($nationGen->getItems() as $item) {
if (!$item->isBuyable()) {
@@ -642,15 +676,15 @@ function updateNationState()
$score = $nationGen->getVar('belong') + 5;
if ($nationGen->getVar('officer_level') == 12) {
$score += 200; //NOTE: 꼬우면 군주하세요.
$score += 100; //NOTE: 꼬우면 군주하세요.
} else if ($nationGen->getVar('officer_level') == 11) {
$score += 70;
$score += 50;
} else if ($nationGen->getVar('officer_level') > 4) {
$score += 35;
}
$score *= $trialCnt;
$uniqueLotteryWeightList[$nationGen->getID()] = [$nationGen, $score];
}
@@ -665,6 +699,12 @@ function updateNationState()
giveRandomUniqueItem($winnerObj, '작위보상');
$winnerObj->applyDB($db);
}
if ($chiefID) {
$chiefObj = General::createGeneralObjFromDB($chiefID, ['belong', 'npc', 'aux'], 2);
$chiefObj->increaseInheritancePoint('unifier', 250 * $levelDiff);
$chiefObj->applyDB($db);
}
}
}
@@ -686,14 +726,14 @@ function updateNationState()
$lastAssemblerID += 1;
$npcObj = new Scenario\GeneralBuilder(
sprintf('부대장%4d', $lastAssemblerID),
0,
false,
null,
$nation['nation']
);
$npcObj->setAffinity(999)->setStat(10, 10, 10)
->setSpecialSingle('척사')->setEgo('che_은둔')
->setKillturn(70)->setGoldRice(0, 0)
->setNPCType(5)->fillRemainSpecAsZero($admin);
->setSpecialSingle('척사')->setEgo('che_은둔')
->setKillturn(70)->setGoldRice(0, 0)
->setNPCType(5)->fillRemainSpecAsZero($admin);
$npcObj->build($admin);
$npcID = $npcObj->getGeneralID();
@@ -737,7 +777,7 @@ function checkStatistic()
];
$avgGeneral = $db->queryFirstRow(
'SELECT avg(gold) as avggold, avg(rice) as avgrice, avg(dex1+dex2+dex3+dex4) as avgdex,
'SELECT avg(gold) as avggold, avg(rice) as avgrice, avg(dex1+dex2+dex3+dex4) as avgdex,
max(dex1+dex2+dex3+dex4) as maxdex, avg(experience+dedication) as avgexpded, max(experience+dedication) as maxexpded
FROM general'
);
@@ -982,6 +1022,17 @@ function checkEmperior()
$nationLogger = new ActionLogger(0, $nationID, $admin['year'], $admin['month']);
$nationLogger->pushNationalHistoryLog("<D><b>{$nationName}</b></>{$josaYi} 전토를 통일");
foreach (General::createGeneralObjListFromDB($db->queryFirstColumn('SELECT `no` FROM general WHERE npc < 2')) as $genObj) {
if ($genObj->getNationID() == $nationID) {
if ($genObj->getVar('officer_level') > 4) {
$genObj->increaseInheritancePoint('unifier', 2000);
};
}
$genObj->mergeTotalInheritancePoint(true);
applyInheritanceUser($genObj->getVar('owner'));
$genObj->clearInheritancePoint();
}
$gameStor->isunited = 2;
$gameStor->conlimit = $gameStor->conlimit * 100;
@@ -991,7 +1042,7 @@ function checkEmperior()
[$totalPop, $totalMaxPop] = $db->queryFirstList('SELECT SUM(pop), SUM(pop_max) FROM city');
$pop = "{$totalPop} / {$totalMaxPop}";
$poprate = round($totalPop / $totalMaxPop * 100, 2). " %";
$poprate = round($totalPop / $totalMaxPop * 100, 2) . " %";
$chiefs = Util::convertArrayToDict(
$db->query(
@@ -1005,8 +1056,8 @@ function checkEmperior()
$nation['generals'] = $nationGenerals;
$tigers = $db->query(
'SELECT value, name
FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no
'SELECT value, name
FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no
WHERE rank_data.nation_id = %i AND rank_data.type = "killnum" AND value > 0 ORDER BY value DESC LIMIT 5',
$nationID
); // 오호장군
@@ -1017,8 +1068,8 @@ function checkEmperior()
}, $tigers));
$eagles = $db->query(
'SELECT value, name
FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no
'SELECT value, name
FROM rank_data LEFT JOIN general ON rank_data.general_id = general.no
WHERE rank_data.nation_id = %i AND rank_data.type = "firenum" AND value > 0 ORDER BY value DESC LIMIT 7',
$nationID
); // 건안칠자
@@ -1035,7 +1086,7 @@ function checkEmperior()
$generalLogger->flush();
}
$gen = join(', ', array_column($rawGeneral, 'name'));
$gen = join(', ', array_column($rawGeneralList, 'name'));
$stat = $db->queryFirstRow('SELECT max(nation_count) as nc, max(gen_count) as gc FROM statistic');
$genCnt = $db->queryFirstField('SELECT count(*) FROM general');
@@ -1132,3 +1183,56 @@ function checkEmperior()
//연감 월결산
LogHistory();
}
function applyInheritanceUser(int $userID, bool $isRebirth = false): float
{
//FIXME: 은퇴, 사망, 천통 시점에 바로 반영한다면 여기가 아니라 general class로 이동하는 것이 옳음
//또한 굳이 merge, apply, clean 3단계를 거쳐야 할 이유도 없음
$rebirthDegraded = [
'dex' => 0.5,
];
$inheritStor = KVStorage::getStorage(DB::db(), "inheritance_{$userID}");
$totalPoint = 0;
$allPoints = $inheritStor->getAll();
if (!$allPoints || count($allPoints) == 0) {
//비었으므로 리셋 안함
return 0;
}
if (count($allPoints) == 1 && key_exists('previous', $allPoints)) {
//이미 리셋되었으므로 리셋 안함
return $allPoints['previous'][0];
}
$userLogger = new UserLogger($userID);
$previousPoint = ($allPoints['previous'] ?? [0, 0])[0];
foreach ($allPoints as $key => [$value,]) {
if ($isRebirth && key_exists($key, $rebirthDegraded)) {
$value *= $rebirthDegraded[$key];
}
$keyText = General::INHERITANCE_KEY[$key][2];
$userLogger->push("{$keyText} 포인트 {$value} 증가", "inheritPoint");
$totalPoint += $value;
}
$totalPoint = Util::toInt($totalPoint);
$userLogger->push("포인트 {$previousPoint} => {$totalPoint}", "inheritPoint");
$userLogger->flush();
$inheritStor->resetValues();
$inheritStor->setValue('previous', [$totalPoint, null]);
return $totalPoint;
}
function updateMaxDomesticCritical(General $general, $score)
{
$maxDomesticCritical = $general->getAuxVar('max_domestic_critical') ?? 0;
$maxDomesticCritical += $score / 2;
$general->setAuxVar('max_domestic_critical', $maxDomesticCritical);
$oldMaxDomesticCritical = $general->getInheritancePoint('max_domestic_critical');
if ($maxDomesticCritical > $oldMaxDomesticCritical) {
$general->setInheritancePoint('max_domestic_critical', $maxDomesticCritical);
}
}
+14 -25
View File
@@ -77,12 +77,6 @@ function pushProcessLog($log) {
pushRawFileLog(__DIR__."/logs/".UniqueConst::$serverID."/_{$date}_processlog.txt", $log);
}
function pushStepLog($log) {
$date = date('Y_m_d');
pushRawFileLog(__DIR__."/logs/".UniqueConst::$serverID."/_{$date}_steplog.txt", $log);
}
function pushLockLog($log) {
$date = date('Y_m_d');
pushRawFileLog(__DIR__."/logs/".UniqueConst::$serverID."/_{$date}_locklog.txt", $log);
@@ -105,15 +99,15 @@ function formatHistoryToHTML(array $history, ?string $type=null):string{
$result = [];
if($type){
foreach($history as $seq=>$item){
$result[] = "<div class='log_{$type}' id='log_{$type}_{$seq}' data-seq='{$seq}'>".ConvertLog($item).'</div>';
$result[] = "<div class='log_{$type}' id='log_{$type}_{$seq}' data-seq='{$seq}'>".ConvertLog($item).'</div>';
}
}
else{
foreach($history as $seq=>$item){
$result[] = '<div>'.ConvertLog($item).'</div>';
$result[] = '<div>'.ConvertLog($item).'</div>';
}
}
return join('', $result);
}
@@ -242,7 +236,7 @@ function pushGeneralHistoryLog(int $generalID, ?array $history, $year=null, $mon
return;
}
$db = DB::db();
if($year === null || $month === null){
$gameStor = KVStorage::getStorage($db, 'game_env');
list($year, $month) = $gameStor->getValuesAsArray(['year', 'month']);
@@ -278,7 +272,7 @@ function pushNationHistoryLog(int $nationID, ?array $history, ?int $year=null, ?
return;
}
$db = DB::db();
if($year === null || $month === null){
$gameStor = KVStorage::getStorage($db, 'game_env');
list($year, $month) = $gameStor->getValuesAsArray(['year', 'month']);
@@ -304,7 +298,7 @@ function pushGlobalHistoryLog(?array $history, $year=null, $month=null) {
return;
}
$db = DB::db();
if($year === null || $month === null){
$gameStor = KVStorage::getStorage($db, 'game_env');
list($year, $month) = $gameStor->getValuesAsArray(['year', 'month']);
@@ -325,8 +319,8 @@ function getGlobalHistoryLogWithDate(int $year, int $month):array {
$db = DB::db();
$texts = $db->queryFirstColumn(
'SELECT `text` from world_history where nation_id = 0 AND year = %i and month = %i order by id desc',
$year,
'SELECT `text` from world_history where nation_id = 0 AND year = %i and month = %i order by id desc',
$year,
$month
);
@@ -342,7 +336,7 @@ function pushGlobalActionLog(?array $history, ?int $year=null, ?int $month=null)
return;
}
$db = DB::db();
if($year === null || $month === null){
$gameStor = KVStorage::getStorage($db, 'game_env');
list($year, $month) = $gameStor->getValuesAsArray(['year', 'month']);
@@ -366,8 +360,8 @@ function getGlobalActionLogWithDate(int $year, int $month):array {
$db = DB::db();
$texts = $db->queryFirstColumn(
'SELECT `text` from general_record where general_id = 0 AND log_type = "history" AND year = %i and month = %i order by id desc',
$year,
'SELECT `text` from general_record where general_id = 0 AND log_type = "history" AND year = %i and month = %i order by id desc',
$year,
$month
);
@@ -378,8 +372,6 @@ function getGlobalActionLogWithDate(int $year, int $month):array {
}
function LogHistory($isFirst=0) {
if(STEP_LOG) pushStepLog(TimeUtil::now().', LogHistory Start');
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$obj = $gameStor->getValues(['startyear', 'year', 'month']);
@@ -401,16 +393,16 @@ function LogHistory($isFirst=0) {
if($map['month'] == 0){
$map['month'] = 12;
$map['year'] -= 1;
}
}
}
$year = $map['year'];
$month = $map['month'];
$globalHistory = getGlobalHistoryLogWithDate($year, $month);
$globalAction = getGlobalActionLogWithDate($year, $month);
$nations = getAllNationStaticInfo();
$nations[0] = getNationStaticInfo(0);
@@ -426,8 +418,6 @@ function LogHistory($isFirst=0) {
return -($lhs['power']<=>$rhs['power']);
});
if(STEP_LOG) pushStepLog(TimeUtil::now().', contents collected');
$db->insert('ng_history', [
'server_id' => UniqueConst::$serverID,
'year' => $year,
@@ -438,6 +428,5 @@ function LogHistory($isFirst=0) {
'nations' => Json::encode($nations),
]);
if(STEP_LOG) pushStepLog(TimeUtil::now().', LogHistory Finish');
return true;
}
+87 -64
View File
@@ -1,67 +1,83 @@
<?php
namespace sammo;
function printLimitMsg($turntime) {
function printLimitMsg($turntime)
{
//FIXME: template로 이동.
?>
<!DOCTYPE html>
<html>
<head>
<title>접속제한</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
</head>
<body>
<font size=4><b>
접속 제한중입니다. 1턴 이내에 너무 많은 갱신을 하셨습니다. (다음 접속 가능 시각 : <?=$turntime?>)<br>
(자신의 턴이 되면 다시 접속 가능합니다. 당신의 건강을 위해 잠시 쉬어보시는 것은 어떨까요? ^^)<br>
</b></font>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<title>접속제한</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<?= WebUtil::printDist('ts', 'common', true) ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
</head>
<body>
<font size=4><b>
접속 제한중입니다. 1턴 이내에 너무 많은 갱신을 하셨습니다. (다음 접속 가능 시각 : <?= $turntime ?>)<br>
(자신의 턴이 되면 다시 접속 가능합니다. 당신의 건강을 위해 잠시 쉬어보시는 것은 어떨까요? ^^)<br>
</b></font>
</body>
</html>
<?php
}
function bar($per, $h=7) {
if($h == 7) { $bd = 0; $h = 7; $h2 = 5; }
else { $bd = 1; $h = 12; $h2 = 8; }
function bar($per, $h = 7)
{
if ($h == 7) {
$bd = 0;
$h = 7;
$h2 = 5;
} else {
$bd = 1;
$h = 12;
$h2 = 8;
}
$per = round($per, 1);
$str = "<div class='bar_out' style='height:{$h}px;'>
<div class='bar_in' style='background:url(".ServConfig::$gameImagePath."/pr{$h2}.gif)'></div>
<div style='width:{$per}%;background:url(".ServConfig::$gameImagePath."/pb{$h2}.gif)'></div>
<div class='bar_in' style='background:url(" . ServConfig::$gameImagePath . "/pr{$h2}.gif)'></div>
<div style='width:{$per}%;background:url(" . ServConfig::$gameImagePath . "/pb{$h2}.gif)'></div>
</div>";
return $str;
}
function optionsForCities(callable $infoCall=null) {
function optionsForCities(callable $infoCall = null)
{
if(!$infoCall){
return join('', array_map(function($city){
if (!$infoCall) {
return join('', array_map(function ($city) {
return "<option value='{$city->id}'>{$city->name}</option>";
}, CityConst::all()));
}
$infoList = [];
$noInfoList = [];
foreach(CityConst::all() as $city){
foreach (CityConst::all() as $city) {
$info = $infoCall($city);
if(!$info){
if (!$info) {
$noInfoList[] = "<option value='{$city->id}'>{$city->name}</option>";
continue;
}
$infoList[] = "<option value='{$city->id}'>{$city->name} ({$info})</option>";
}
return join('', array_merge($infoList, $noInfoList));
return join('', array_merge($infoList, $noInfoList));
}
function Submit($url, $msg="", $msg2="") {
function Submit($url, $msg = "", $msg2 = "")
{
echo "a"; // 파폭 버그 때문
echo "
<form method=post name=f1 action='{$url}'>
@@ -73,49 +89,56 @@ function Submit($url, $msg="", $msg2="") {
}
function GetNationColors() {
$colors = array("#FF0000", "#800000", "#A0522D", "#FF6347", "#FFA500", "#FFDAB9", "#FFD700", "#FFFF00",
function GetNationColors()
{
$colors = array(
"#FF0000", "#800000", "#A0522D", "#FF6347", "#FFA500", "#FFDAB9", "#FFD700", "#FFFF00",
"#7CFC00", "#00FF00", "#808000", "#008000", "#2E8B57", "#008080", "#20B2AA", "#6495ED", "#7FFFD4",
"#AFEEEE", "#87CEEB", "#00FFFF", "#00BFFF", "#0000FF", "#000080", "#483D8B", "#7B68EE", "#BA55D3",
"#800080", "#FF00FF", "#FFC0CB", "#F5F5DC", "#E0FFFF", "#FFFFFF", "#A9A9A9");
"#800080", "#FF00FF", "#FFC0CB", "#F5F5DC", "#E0FFFF", "#FFFFFF", "#A9A9A9"
);
return $colors;
}
function backButton() {
return "
<input type=button value='돌아가기' onclick=location.replace('./')><br>
";
function backButton()
{
return "<button type='button' class='btn btn-primary back_btn' onclick=location.replace('./')>돌아가기</button><br>";
}
function CoreBackButton() {
return "
<input type=button value='돌아가기' onclick=location.replace('b_chiefcenter.php')><br>
";
function CoreBackButton()
{
return "<button type='button' class='btn btn-primary back_btn' onclick=location.replace('b_chiefcenter.php')>돌아가기</button><br>";
}
function closeButton() {
return "
<input type=button value='창 닫기' onclick=window.close()><br>
";
function closeButton()
{
return "<button type='button' class='btn btn-primary back_btn' onclick=window.close()>창 닫기</button><br>";
}
function printCitiesBasedOnDistance(int $cityNo, int $maxDistance=1):string {
function printCitiesBasedOnDistance(int $cityNo, int $maxDistance = 1): string
{
$distanceList = searchDistance($cityNo, $maxDistance, true);
$result = [];
for($dist = 1; $dist <= $maxDistance; $dist++){
$cityList = array_map(function($cityID){
for ($dist = 1; $dist <= $maxDistance; $dist++) {
$cityList = array_map(function ($cityID) {
return CityConst::byID($cityID)->name;
}, Util::array_get($distanceList[$dist], []));
$cityStr = join(', ', $cityList);
switch($dist) {
case 1: $color = "magenta"; break;
case 2: $color = "orange"; break;
default: $color = "yellow"; break;
switch ($dist) {
case 1:
$color = "magenta";
break;
case 2:
$color = "orange";
break;
default:
$color = "yellow";
break;
}
$result[] = "{$dist}칸 떨어진 도시 : <span style='color:{$color};font-weight:bold;'>{$cityStr}</span>";
@@ -124,7 +147,8 @@ function printCitiesBasedOnDistance(int $cityNo, int $maxDistance=1):string {
}
function info($type=0) {
function info($type = 0)
{
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
@@ -135,15 +159,14 @@ function info($type=0) {
$gencount = $db->queryFirstField('SELECT count(no) FROM general WHERE npc < 2');
$npccount = $db->queryFirstField('SELECT count(no) FROM general WHERE npc >= 2');
switch($type) {
case 0:
return "현재 : {$admin['year']}年 {$admin['month']}月 (<font color=cyan>$termtype</font> 서버)<br> 등록 장수 : 유저 {$gencount} / {$admin['maxgeneral']} 명 + <font color=cyan>NPC {$npccount} 명</font>";
case 1:
return "현재 : {$admin['year']}年 {$admin['month']}月 (<font color=cyan>$termtype</font> 서버)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 등록 장수 : 유저 {$gencount} / {$admin['maxgeneral']} 명 + <font color=cyan>NPC {$npccount} 명</font>";
case 2:
return "현재 : {$admin['year']}年 {$admin['month']}月 (<font color=cyan>$termtype</font> 서버)";
case 3:
return "등록 장수 : 유저 {$gencount} / {$admin['maxgeneral']} 명 + <font color=cyan>NPC {$npccount} 명</font>";
switch ($type) {
case 0:
return "현재 : {$admin['year']}年 {$admin['month']}月 (<font color=cyan>$termtype</font> 서버)<br> 등록 장수 : 유저 {$gencount} / {$admin['maxgeneral']} 명 + <font color=cyan>NPC {$npccount} 명</font>";
case 1:
return "현재 : {$admin['year']}年 {$admin['month']}月 (<font color=cyan>$termtype</font> 서버)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 등록 장수 : 유저 {$gencount} / {$admin['maxgeneral']} 명 + <font color=cyan>NPC {$npccount} 명</font>";
case 2:
return "현재 : {$admin['year']}年 {$admin['month']}月 (<font color=cyan>$termtype</font> 서버)";
case 3:
return "등록 장수 : 유저 {$gencount} / {$admin['maxgeneral']} 명 + <font color=cyan>NPC {$npccount} 명</font>";
}
}
+63 -36
View File
@@ -5,16 +5,16 @@ namespace sammo;
/**
* 템플릿 생성과 관련된 함수들을 모아두는 파일
*
*
* NOTE: 아직 converter와 명확한 구분이 되어있지 않음.
* TODO: legacy template들을 전부 template 폴더로 모아둘 필요 있음
* TODO: side effect를 제거
*/
/**
* 관리자 권한이 필요함을 출력.
* @return void
*/
/**
* 관리자 권한이 필요함을 출력.
* @return void
*/
function requireAdminPermissionHTML()
{
ob_start();
@@ -28,7 +28,8 @@ function requireAdminPermissionHTML()
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<?= WebUtil::printCSS('css/common.css') ?>
<?= WebUtil::printDist('ts', 'common', true) ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
</head>
<body>
@@ -41,28 +42,6 @@ function requireAdminPermissionHTML()
return ob_get_clean();
}
function turnTable()
{
$turnList = [];
$turnList[] = "<option selected value='0'>1턴</option>";
foreach (Util::range(1, GameConst::$maxTurn) as $turnIdx) {
$turnText = $turnIdx + 1;
$turnList[] = "<option value='{$turnIdx}'>{$turnText}턴</option>";
}
$turnText = join("\n", $turnList);
return "
<select id='generalTurnSelector' name=turn[] size=11 multiple>
<option value='-3'>전체</option>
<option value='-1'>홀턴</option>
<option value='-2'>짝턴</option>
{$turnText}
</select>
";
}
function chiefTurnTable()
{
$turnList = [];
@@ -140,7 +119,7 @@ function displaySpecialDomesticInfo(?string $type): string
]);
}
function allButton(bool $seizeNPCMode)
function allButton(bool $seizeNPCMode, array $opts = [])
{
if ($seizeNPCMode) {
$site = "a_npcList.php";
@@ -157,14 +136,14 @@ function allButton(bool $seizeNPCMode)
}
return $templates->render('allButton', [
return $templates->render('allButton', array_merge([
'call' => $call,
'site' => $site
]);
], $opts));
}
function commandButton()
function commandButton(array $opts = [])
{
$session = Session::getInstance();
$userID = Session::getUserID();
@@ -194,14 +173,14 @@ function commandButton()
$showSecret = false;
}
return $templates->render('commandButton', [
return $templates->render('commandButton', array_merge([
'bgColor' => $bgColor,
'fgColor' => $fgColor,
'meLevel' => $me['officer_level'],
'nationLevel' => $nation['level'],
'showSecret' => $showSecret,
'permission' => $permission,
]);
], $opts));
}
function formatWounded(int $value, int $wound): string
@@ -217,13 +196,13 @@ function formatDefenceTrain(int $value): string
{
if ($value === 999) {
return "×";
} else if ($value >= 90){
} else if ($value >= 90) {
return "☆";
} else if ($value >= 80) {
return "◎";
} else if ($value >= 60) {
return "○";
} else{
} else {
return "△";
}
}
@@ -272,3 +251,51 @@ function getInvitationList(array $nationList)
'nationList' => $nationList
]);
}
function getAutorunInfo($autorunOption)
{
$templates = new \League\Plates\Engine(__DIR__ . '/templates');
$auto_info = [];
foreach ($autorunOption['options'] as $auto_option => $value) {
assert($value);
switch ($auto_option) {
case 'develop':
$auto_info['내정'] = '내정';
break;
case 'warp':
$auto_info['순간이동'] = '순간이동';
break;
case 'recruit':
$auto_info['징병'] = $auto_info['징병'] ?? '징병';
break;
case 'recruit_high':
$auto_info['징병'] = '모병';
break;
case 'train':
$auto_info['훈사'] = '훈련/사기진작';
break;
case 'battle':
$auto_info['출병'] = '출병';
break;
case 'chief':
$auto_info['사령턴'] = '사령턴';
break;
}
}
$limit = Util::toInt($autorunOption['limit_minutes']);
if ($limit >= 43200) {
$auto_info['제한'] = '항상 유효';
} else if ($limit % 60 == 0) {
$auto_info['제한'] = ($limit / 60) . '시간 유효';
} else {
$auto_info['제한'] = ($limit) . '분 유효';
}
$auto_info = join(', ', array_values($auto_info));
return $templates->render('tooltip', [
'text' => '자율행동',
'info' => $auto_info,
'style' => 'text-decoration:underline',
'copyable_info' => true
]);
}
+1216 -552
View File
@@ -1,252 +1,363 @@
<?php
namespace sammo;
function processTournament() {
function processTournament()
{
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$admin = $gameStor->getValues(['tournament', 'phase', 'tnmt_type', 'tnmt_auto', 'tnmt_time']);
$now = new \DateTime();
$admin['now'] = $now->format('Y-m-d H:i:s');
$admin['offset'] = $now->getTimestamp() - (new \DateTime($admin['tnmt_time']))->getTimestamp();
$offset = $now->getTimestamp() - (new \DateTime($admin['tnmt_time']))->getTimestamp();
//수동일땐 무시
if($admin['tnmt_auto'] == 0) { return; }
if ($admin['tnmt_auto'] == 0) {
return;
}
$type = $admin['tnmt_type'];
$tnmt = $admin['tournament'];
$phase = $admin['phase'];
if ($offset < 0) {
return;
}
//현시간이 스탬프 지나친경우
if($admin['offset'] >= 0) {
switch($admin['tnmt_auto']) {
case 1: $unit = 720; break;
case 2: $unit = 420; break;
case 3: $unit = 180; break;
case 4: $unit = 60; break;
case 5: $unit = 30; break;
case 6: $unit = 15; break;
case 7: $unit = 5; break;
default: throw new MustNotBeReachedException();
}
switch ($admin['tnmt_auto']) {
case 1:
$unit = 720;
break;
case 2:
$unit = 420;
break;
case 3:
$unit = 180;
break;
case 4:
$unit = 60;
break;
case 5:
$unit = 30;
break;
case 6:
$unit = 15;
break;
case 7:
$unit = 5;
break;
default:
throw new MustNotBeReachedException();
}
//업데이트 횟수
$iter = intdiv($admin['offset'], $unit) + 1;
//업데이트 횟수
$iter = intdiv($offset, $unit) + 1;
for($i=0; $i < $iter; $i++) {
switch($tnmt) {
for ($i = 0; $i < $iter; $i++) {
switch ($tnmt) {
case 1: //신청 마감
fillLowGenAll();
$tnmt = 2; $phase = 0;
fillLowGenAll($type);
$tnmt = 2;
$phase = 0;
break;
case 2: //예선중
qualify($type, $tnmt, $phase); $phase++;
if($phase >= 56) { $tnmt = 3; $phase = 0; }
qualify($type, $tnmt, $phase);
$phase++;
if ($phase >= 56) {
$tnmt = 3;
$phase = 0;
}
break;
case 3: //추첨중
selectionAll($type, $tnmt, $phase); $phase+=8;
if($phase >= 32) { $tnmt = 4; $phase = 0; }
selectionAll($type, $tnmt, $phase);
$phase += 8;
if ($phase >= 32) {
$tnmt = 4;
$phase = 0;
}
break;
case 4: //본선중
finallySingle($type, $tnmt, $phase); $phase++;
if($phase >= 6) { $tnmt = 5; $phase = 0; }
finallySingle($type, $tnmt, $phase);
$phase++;
if ($phase >= 6) {
$tnmt = 5;
$phase = 0;
}
break;
case 5: //배정중
final16set();
$tnmt = 6; $phase = 0;
$tnmt = 6;
$phase = 0;
startBetting();
break;
case 6: //베팅중
$tnmt = 7; $phase = 0;
$tnmt = 7;
$phase = 0;
break;
case 7: //16강중
finalFight($type, $tnmt, $phase, 16); $phase++;
if($phase >= 8) { $tnmt = 8; $phase = 0; }
finalFight($type, $tnmt, $phase, 16);
$phase++;
if ($phase >= 8) {
$tnmt = 8;
$phase = 0;
}
break;
case 8: //8강중
finalFight($type, $tnmt, $phase, 8); $phase++;
if($phase >= 4) { $tnmt = 9; $phase = 0; }
finalFight($type, $tnmt, $phase, 8);
$phase++;
if ($phase >= 4) {
$tnmt = 9;
$phase = 0;
}
break;
case 9: //4강중
finalFight($type, $tnmt, $phase, 4); $phase++;
if($phase >= 2) { $tnmt = 10; $phase = 0; }
finalFight($type, $tnmt, $phase, 4);
$phase++;
if ($phase >= 2) {
$tnmt = 10;
$phase = 0;
}
break;
case 10: //결승중
finalFight($type, $tnmt, $phase, 2);
$tnmt = 0; $phase = 0;
$tnmt = 0;
$phase = 0;
setGift($type, $tnmt, $phase);
$i = $iter;
break;
}
}
//베팅은 무조건 60페이즈후 진행(최대 1시간)
if($tnmt == 6) {
$betTerm = $unit * 60;
if($betTerm > 3600) { $betTerm = 3600; }
//처리 초 더한 날짜
$dt = date("Y-m-d H:i:s", strtotime($admin['tnmt_time']) + $unit * $i + $betTerm);
//베팅은 무조건 60페이즈후 진행(최대 1시간)
if ($tnmt == 6) {
$betTerm = $unit * 60;
if ($betTerm > 3600) {
$betTerm = 3600;
}
//처리 초 더한 날짜
$dt = date("Y-m-d H:i:s", strtotime($admin['tnmt_time']) + $unit * $i + $betTerm);
$gameStor->tournament = $tnmt;
$gameStor->phase = $phase;
$gameStor->tnmt_time = $dt;
return;
}
if ($admin['tnmt_auto'] == 1) {
//처리 초 더한 날짜
$dt = date("Y-m-d H:i:s", strtotime($admin['tnmt_time']) + $unit * $i);
$hr = substr($dt, 11, 2);
//지정시간대 넘어가면 중단 20~24시
if ($hr < 20) {
$dt = substr($dt, 0, 11) . "20:00:00";
$gameStor->tournament = $tnmt;
$gameStor->phase = $phase;
$gameStor->tnmt_time = $dt;
return;
}
if($admin['tnmt_auto'] == 1) {
//처리 초 더한 날짜
$dt = date("Y-m-d H:i:s", strtotime($admin['tnmt_time']) + $unit * $i);
$hr = substr($dt, 11, 2);
//지정시간대 넘어가면 중단 20~24시
if($hr < 20) {
$dt = substr($dt, 0, 11)."20:00:00";
$gameStor->tournament = $tnmt;
$gameStor->phase = $phase;
$gameStor->tnmt_time = $dt;
return;
}
}
}
$second = $unit * $iter;
$gameStor->tournament = $tnmt;
$gameStor->phase = $phase;
$gameStor->tnmt_time = (new \DateTimeImmutable($admin['tnmt_time']))->add(new \DateInterval("PT{$second}S"))->format('Y-m-d H:i:s');
}
$second = $unit * $iter;
$gameStor->tournament = $tnmt;
$gameStor->phase = $phase;
$gameStor->tnmt_time = (new \DateTimeImmutable($admin['tnmt_time']))->add(new \DateInterval("PT{$second}S"))->format('Y-m-d H:i:s');
}
function getTournamentTerm() {
function getTournamentTerm()
{
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$tnmt_auto = $gameStor->tnmt_auto;
switch($tnmt_auto) {
case 0: $str = ''; break;
case 1: $str = "경기당 12분"; break;
case 2: $str = "경기당 7분"; break;
case 3: $str = "경기당 3분"; break;
case 4: $str = "경기당 1분"; break;
case 5: $str = "경기당 30초"; break;
case 6: $str = "경기당 15초"; break;
case 7: $str = "경기당 5초"; break;
switch ($tnmt_auto) {
case 0:
$str = '';
break;
case 1:
$str = "경기당 12";
break;
case 2:
$str = "경기당 7분";
break;
case 3:
$str = "경기당 3분";
break;
case 4:
$str = "경기당 1분";
break;
case 5:
$str = "경기당 30초";
break;
case 6:
$str = "경기당 15초";
break;
case 7:
$str = "경기당 5초";
break;
}
return $str;
}
function getTournamentTime() {
function getTournamentTime()
{
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
list($tnmt, $tnmt_time) = $gameStor->getValuesAsArray(['tournament', 'tnmt_time']);
$dt = substr($tnmt_time, 11, 5);
switch($tnmt) {
case 1: $tnmt = "개막시간 {$dt}"; break;
case 2: $tnmt = "다음경기 {$dt}"; break;
case 3: $tnmt = "다음추첨 {$dt}"; break;
case 4: $tnmt = "다음경기 {$dt}"; break;
case 5: $tnmt = "16강배정 {$dt}"; break;
case 6: $tnmt = "베팅마감 {$dt}"; break;
case 7: case 8: case 9: case 10:
$tnmt = "다음경기 {$dt}"; break;
default: $tnmt = ""; break;
switch ($tnmt) {
case 1:
$tnmt = "개막시간 {$dt}";
break;
case 2:
$tnmt = "다음경기 {$dt}";
break;
case 3:
$tnmt = "다음추첨 {$dt}";
break;
case 4:
$tnmt = "다음경기 {$dt}";
break;
case 5:
$tnmt = "16강배정 {$dt}";
break;
case 6:
$tnmt = "베팅마감 {$dt}";
break;
case 7:
case 8:
case 9:
case 10:
$tnmt = "다음경기 {$dt}";
break;
default:
$tnmt = "";
break;
}
return $tnmt;
}
function getTournament(int $tnmt) {
function getTournament(int $tnmt)
{
return [
"<font color=magenta>경기 없음</font>",
"<font color=orange>참가 모집중</font>",
"<font color=orange>예선 진행중</font>",
"<font color=orange>본선 추첨중</font>",
"<font color=orange>본선 진행중</font>",
"<font color=orange>16강 배정중</font>",
"<font color=orange>베팅 진행중</font>",
"<font color=orange>16강 진행중</font>",
"<font color=orange>8강 진행중</font>",
"<font color=orange>4강 진행중</font>",
"<font color=orange>결승 진행중</font>",
][$tnmt]??"TOURNAMENT_TYPE_ERR_{$tnmt}";
"<span style='color:magenta;'>경기 없음</span>",
"<span style='color:orange;'>참가 모집중</span>",
"<span style='color:orange;'>예선 진행중</span>",
"<span style='color:orange;'>본선 추첨중</span>",
"<span style='color:orange;'>본선 진행중</span>",
"<span style='color:orange;'>16강 배정중</span>",
"<span style='color:orange;'>베팅 진행중</span>",
"<span style='color:orange;'>16강 진행중</span>",
"<span style='color:orange;'>8강 진행중</span>",
"<span style='color:orange;'>4강 진행중</span>",
"<span style='color:orange;'>결승 진행중</span>",
][$tnmt] ?? "TOURNAMENT_TYPE_ERR_{$tnmt}";
}
function printRow($k, $npc, $name, $abil, $tgame, $win, $draw, $lose, $gd, $gl, $prmt) {
function printRow($k, $npc, $name, $abil, $tgame, $win, $draw, $lose, $gd, $gl, $prmt)
{
$k += 1;
if($prmt > 0) { $name = "<font color=orange>".$name."</font>"; }
elseif($npc >= 2) { $name = "<font color=cyan>".$name."</font>"; }
elseif($npc == 1) { $name = "<font color=skyblue>".$name."</font>"; }
echo "<tr align=center><td id=bg2>$k</td><td style='font-size:80%;'>$name</td><td>$abil</td><td>$tgame</td><td>$win</td><td>$draw</td><td>$lose</td><td>$gd</td><td>$gl</td></tr>";
if ($prmt > 0) {
$name = "<font color=orange>" . $name . "</font>";
} elseif ($npc >= 2) {
$name = "<font color=cyan>" . $name . "</font>";
} elseif ($npc == 1) {
$name = "<font color=skyblue>" . $name . "</font>";
}
echo "<tr align=center><td class='bg2'>$k</td><td style='font-size:80%;'>$name</td><td>$abil</td><td>$tgame</td><td>$win</td><td>$draw</td><td>$lose</td><td>$gd</td><td>$gl</td></tr>";
}
function printFighting($tournament, $phase) {
function printFighting($tournament, $phase)
{
$code = $tournament * 100 + $phase;
if($code == 0) {
if ($code == 0) {
echo "<tr valign=top>";
echo "<td>&nbsp;</td>";
echo "<td>&nbsp;</td>";
echo "<td>&nbsp;</td>";
echo "<td>".getTnmtFightLogAll(50)."</td>";
echo "<td>" . getTnmtFightLogAll(50) . "</td>";
echo "<td>&nbsp;</td>";
echo "<td>&nbsp;</td>";
echo "<td>&nbsp;</td>";
echo "<td>&nbsp;</td>";
echo "</tr>";
} elseif($code <= 300) {
} elseif ($code <= 300) {
echo "<tr valign=top>";
for($i=0; $i < 8; $i++) {
echo "<td>".getTnmtFightLogAll($i)."</td>";
for ($i = 0; $i < 8; $i++) {
echo "<td>" . getTnmtFightLogAll($i) . "</td>";
}
echo "</tr>";
} elseif($code < 400) {
} elseif($code <= 500) {
} elseif ($code < 400) {
} elseif ($code <= 500) {
echo "<tr valign=top>";
for($i=10; $i < 18; $i++) {
echo "<td>".getTnmtFightLogAll($i)."</td>";
for ($i = 10; $i < 18; $i++) {
echo "<td>" . getTnmtFightLogAll($i) . "</td>";
}
echo "</tr>";
} elseif($code < 700) {
} elseif($code <= 800) {
} elseif ($code < 700) {
} elseif ($code <= 800) {
echo "<tr valign=top>";
for($i=20; $i < 28; $i++) {
echo "<td>".getTnmtFightLogAll($i)."</td>";
for ($i = 20; $i < 28; $i++) {
echo "<td>" . getTnmtFightLogAll($i) . "</td>";
}
echo "</tr>";
} elseif($code <= 900) {
} elseif ($code <= 900) {
echo "<tr valign=top>";
for($i=30; $i < 34; $i++) {
for ($i = 30; $i < 34; $i++) {
echo "<td>&nbsp;</td>";
echo "<td>".getTnmtFightLogAll($i)."</td>";
echo "<td>" . getTnmtFightLogAll($i) . "</td>";
}
echo "</tr>";
} elseif($code <= 1000) {
} elseif ($code <= 1000) {
echo "<tr valign=top>";
for($i=40; $i < 42; $i++) {
for ($i = 40; $i < 42; $i++) {
echo "<td>&nbsp;</td>";
echo "<td>&nbsp;</td>";
echo "<td>".getTnmtFightLogAll($i)."</td>";
echo "<td>" . getTnmtFightLogAll($i) . "</td>";
echo "<td>&nbsp;</td>";
}
echo "</tr>";
}
}
function startTournament($auto, $type) {
function startTournament($auto, $type)
{
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
eraseTnmtFightLogAll();
switch($auto) {
case 1: $unit = 60; break;
case 2: $unit = 60; break;
case 3: $unit = 60; break;
case 4: $unit = 60; break;
case 5: $unit = 30; break;
case 6: $unit = 15; break;
case 7: $unit = 5; break;
default:$unit = 60; break;
switch ($auto) {
case 1:
$unit = 60;
break;
case 2:
$unit = 60;
break;
case 3:
$unit = 60;
break;
case 4:
$unit = 60;
break;
case 5:
$unit = 30;
break;
case 6:
$unit = 15;
break;
case 7:
$unit = 5;
break;
default:
$unit = 60;
break;
}
$admin = $gameStor->getValues(['year', 'month']);
$gameStor->tnmt_auto = $auto;
$gameStor->tnmt_time = (new \DateTimeImmutable())->add(new \DateInterval("PT{$unit}M"))->format('Y-m-d H:i:s');
$gameStor->tournament = 1;
@@ -254,87 +365,118 @@ function startTournament($auto, $type) {
$gameStor->phase = 0;
$db->update('general', [
'tournament'=>0,
'tournament' => 0,
], true);
$db->update('betting', [
'bet0'=>0,
'bet1'=>0,
'bet2'=>0,
'bet3'=>0,
'bet4'=>0,
'bet5'=>0,
'bet6'=>0,
'bet7'=>0,
'bet8'=>0,
'bet9'=>0,
'bet10'=>0,
'bet11'=>0,
'bet12'=>0,
'bet13'=>0,
'bet14'=>0,
'bet15'=>0
'bet0' => 0,
'bet1' => 0,
'bet2' => 0,
'bet3' => 0,
'bet4' => 0,
'bet5' => 0,
'bet6' => 0,
'bet7' => 0,
'bet8' => 0,
'bet9' => 0,
'bet10' => 0,
'bet11' => 0,
'bet12' => 0,
'bet13' => 0,
'bet14' => 0,
'bet15' => 0
], true);
$db->query('TRUNCATE TABLE tournament');
$opener = $db->queryFirstField('SELECT `general`.`name` FROM `general` JOIN `nation` ON `general`.`nation` = `nation`.`nation` WHERE `general`.`officer_level` = 12 AND `nation`.`level` = 7 ORDER BY rand() LIMIT 1');
if(!$opener){
if (!$opener) {
$opener = $gameStor->prev_winner;
}
if($opener){
if ($opener) {
$openerText = "황제 <Y>{$opener}</>의 명으로 ";
}
else{
} else {
$openerText = '';
}
$history = [];
[$typeText, $genTypeText] = [
['전력전','영웅'],
['통솔전','명사'],
['일기토','용사'],
['설전','책사'],
['전력전', '영웅'],
['통솔전', '명사'],
['일기토', '용사'],
['설전', '책사'],
][$type];
$history[] = "<S>◆</>{$admin['year']}{$admin['month']}월:{$openerText}<C>{$typeText}</> 대회가 개최됩니다! 천하의 <span class='ev_highlight'>{$genTypeText}</span>들을 모집하고 있습니다!";
$history[] = "<S>◆</>{$admin['year']}{$admin['month']}월:<B><b>【대회】</b></>{$openerText}<C>{$typeText}</> 대회가 개최됩니다! 천하의 <span class='ev_highlight'>{$genTypeText}</span>들을 모집하고 있습니다!";
pushGlobalHistoryLog($history, $admin['year'], $admin['month']);
}
function fillLowGenAll() {
function startBetting()
{
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
[$year, $month, $startyear] = $gameStor->getValuesAsArray(['year', 'month', 'startyear']);
pushGlobalHistoryLog([
"<S>◆</>{$year}{$month}월:<B><b>【대회】</b></>우승자를 예상하는 <C>내기</>가 진행중입니다! 호사가의 참여를 기다립니다!"
], $year, $month);
$betGold = Util::valueFit(floor((3 + $year - $startyear) * 0.334) * 10, 10);
$npcList = $db->queryFirstColumn('SELECT no FROM general WHERE npc >= 2 AND gold >= (500 + %i)', $betGold);
$npcBet = [];
$betSum = [
0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0,
];
foreach ($npcList as $npcID) {
$target = Util::randRangeInt(0, 15);
$betSum[$target] += $betGold;
$npcBet[] = [$npcID, $target];
}
$db->update('general', [
'gold' => $db->sqleval('gold - %i', $betGold),
], 'no IN %li', $npcList);
foreach ($npcBet as [$npcID, $betTarget]) {
$targetKey = "bet{$betTarget}";
$db->update('betting', [
"bet{$betTarget}" => $db->sqleval('%b + %i', $targetKey, $betGold),
], 'general_id = %i', $npcID);
}
foreach ($betSum as $betTarget => $betSumGold) {
$targetKey = "bet{$betTarget}";
$db->update('betting', [
"bet{$betTarget}" => $db->sqleval('%b + %i', $targetKey, $betSumGold),
], 'general_id = 0');
}
}
function fillLowGenAll($tnmt_type)
{
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$grpCount = [];
$dummyGeneral = [
'no'=>0,
'npc'=>2,
'name'=>'무명장수',
'leadership'=>10,
'strength'=>10,
'intel'=>10,
'explevel'=>10
'no' => 0,
'npc' => 2,
'name' => '무명장수',
'leadership' => 10,
'strength' => 10,
'intel' => 10,
'lvl' => 10,
'h' => 'None',
'w' => 'None',
'b' => 'None'
];
$dummyGeneral = [
'no'=>0,
'npc'=>2,
'name'=>'무명장수',
'leadership'=>10,
'strength'=>10,
'intel'=>10,
'lvl'=>0,
'h'=>'None',
'w'=>'None',
'b'=>'None'
];
for($i=0;$i<8;$i++){
for ($i = 0; $i < 8; $i++) {
$grpCount[$i] = 0;
}
foreach($db->queryAllLists('SELECT grp, count(grp) FROM tournament GROUP BY grp') as [$grpIdx, $grpCnt]){
foreach ($db->queryAllLists('SELECT grp, count(grp) FROM tournament GROUP BY grp') as [$grpIdx, $grpCnt]) {
$grpCount[$grpIdx] = $grpCnt;
}
@@ -342,45 +484,72 @@ function fillLowGenAll() {
$gameStor->phase = 0;
$currentJoinerCnt = array_sum($grpCount);
if($currentJoinerCnt == 64){
if ($currentJoinerCnt == 64) {
return;
}
$toBeFilledCnt = 8*8-$currentJoinerCnt;
$toBeFilledCnt = 8 * 8 - $currentJoinerCnt;
$scoringCandFunction = match ($tnmt_type) {
0 => function ($gen) {
return $gen['leadership'] + $gen['strength'] + $gen['intel'];
}, //전력전
1 => function ($gen) {
return $gen['leadership'];
}, //통솔전
2 => function ($gen) {
return $gen['strength'];
}, //통솔전
3 => function ($gen) {
return $gen['intel'];
}, //통솔전
default => throw new \ValueError('invalid tnmt_type' . $tnmt_type)
};
//자동신청하고, 돈 있고, 아직 참가 안한 장수
$freeJoiners = $db->query(
'SELECT no,npc,name,leadership,strength,intel,explevel,horse,weapon,book from general where tnmt=1 and tournament=0 order by rand() limit %d',
$toBeFilledCnt
);
$freeJoinerCandidate = [];
foreach($db->query(
'SELECT no,npc,name,leadership,strength,intel,explevel,horse,weapon,book from general where tnmt=1 and tournament=0',
) as $gen){
$score = $scoringCandFunction($gen);
$freeJoinerCandidate[$gen['no']] = [$gen, $score**2];
}
$joinersValues = [];
$joinersIdx = [];
foreach($freeJoiners as $general){
foreach(Util::range($toBeFilledCnt) as $_){
if(!$freeJoinerCandidate){
break;
}
$general = Util::choiceRandomUsingWeightPair($freeJoinerCandidate);
unset($freeJoinerCandidate[$general['no']]);
$grpIdx = array_keys($grpCount, min($grpCount))[0];
$grpCnt = $grpCount[$grpIdx];
$joinersValues[] = [
'no'=>$general['no'],
'npc'=>$general['npc'],
'name'=>$general['name'],
'leadership'=>$general['leadership'],
'strength'=>$general['strength'],
'intel'=>$general['intel'],
'lvl'=>$general['explevel'],
'grp'=>$grpIdx,
'grp_no'=>$grpCnt,
'h'=>$general['horse'],
'w'=>$general['weapon'],
'b'=>$general['book']
'no' => $general['no'],
'npc' => $general['npc'],
'name' => $general['name'],
'leadership' => $general['leadership'],
'strength' => $general['strength'],
'intel' => $general['intel'],
'lvl' => $general['explevel'],
'grp' => $grpIdx,
'grp_no' => $grpCnt,
'h' => $general['horse'],
'w' => $general['weapon'],
'b' => $general['book']
];
$joinersIdx[] = $general['no'];
$grpCount[$grpIdx] += 1;
}
foreach($grpCount as $grpIdx=>$grpCnt){
while($grpCnt < 8){
foreach ($grpCount as $grpIdx => $grpCnt) {
while ($grpCnt < 8) {
$dummyCopy = $dummyGeneral;
$dummyCopy['grp'] = $grpIdx;
$dummyCopy['grp_no'] = $grpCnt;
@@ -390,7 +559,7 @@ function fillLowGenAll() {
}
$db->update('general', [
'tournament'=>1
'tournament' => 1
], 'no IN %li', $joinersIdx);
$db->insert('tournament', $joinersValues);
@@ -407,252 +576,409 @@ function fillLowGenAll() {
//7 8강
//8 4강
//9 결승
function getTwo($tournament, $phase) {
function getTwo($tournament, $phase)
{
$cand = [];
switch($tournament) {
case 2:
//예선
switch($phase%28) {
case 0: $cand[0] = 0; $cand[1] = 1; break; case 1: $cand[0] = 2; $cand[1] = 3; break; case 2: $cand[0] = 4; $cand[1] = 5; break; case 3: $cand[0] = 6; $cand[1] = 7; break;
case 4: $cand[0] = 0; $cand[1] = 2; break; case 5: $cand[0] = 1; $cand[1] = 3; break; case 6: $cand[0] = 4; $cand[1] = 6; break; case 7: $cand[0] = 5; $cand[1] = 7; break;
case 8: $cand[0] = 0; $cand[1] = 3; break; case 9: $cand[0] = 1; $cand[1] = 6; break; case 10: $cand[0] = 2; $cand[1] = 5; break; case 11: $cand[0] = 4; $cand[1] = 7; break;
case 12: $cand[0] = 0; $cand[1] = 4; break; case 13: $cand[0] = 1; $cand[1] = 5; break; case 14: $cand[0] = 2; $cand[1] = 6; break; case 15: $cand[0] = 3; $cand[1] = 7; break;
case 16: $cand[0] = 0; $cand[1] = 5; break; case 17: $cand[0] = 1; $cand[1] = 4; break; case 18: $cand[0] = 2; $cand[1] = 7; break; case 19: $cand[0] = 3; $cand[1] = 6; break;
case 20: $cand[0] = 0; $cand[1] = 6; break; case 21: $cand[0] = 1; $cand[1] = 7; break; case 22: $cand[0] = 2; $cand[1] = 4; break; case 23: $cand[0] = 3; $cand[1] = 5; break;
case 24: $cand[0] = 0; $cand[1] = 7; break; case 25: $cand[0] = 1; $cand[1] = 2; break; case 26: $cand[0] = 3; $cand[1] = 4; break; case 27: $cand[0] = 5; $cand[1] = 6; break;
}
if($phase >= 28) {
$temp = $cand[0];
$cand[0] = $cand[1];
$cand[1] = $temp;
}
break;
case 4:
//본선
switch($phase%6) {
case 0: $cand[0] = 0; $cand[1] = 1; break; case 1: $cand[0] = 2; $cand[1] = 3; break;
case 2: $cand[0] = 0; $cand[1] = 2; break; case 3: $cand[0] = 1; $cand[1] = 3; break;
case 4: $cand[0] = 0; $cand[1] = 3; break; case 5: $cand[0] = 1; $cand[1] = 2; break;
}
break;
switch ($tournament) {
case 2:
//예선
switch ($phase % 28) {
case 0:
$cand[0] = 0;
$cand[1] = 1;
break;
case 1:
$cand[0] = 2;
$cand[1] = 3;
break;
case 2:
$cand[0] = 4;
$cand[1] = 5;
break;
case 3:
$cand[0] = 6;
$cand[1] = 7;
break;
case 4:
$cand[0] = 0;
$cand[1] = 2;
break;
case 5:
$cand[0] = 1;
$cand[1] = 3;
break;
case 6:
$cand[0] = 4;
$cand[1] = 6;
break;
case 7:
$cand[0] = 5;
$cand[1] = 7;
break;
case 8:
$cand[0] = 0;
$cand[1] = 3;
break;
case 9:
$cand[0] = 1;
$cand[1] = 6;
break;
case 10:
$cand[0] = 2;
$cand[1] = 5;
break;
case 11:
$cand[0] = 4;
$cand[1] = 7;
break;
case 12:
$cand[0] = 0;
$cand[1] = 4;
break;
case 13:
$cand[0] = 1;
$cand[1] = 5;
break;
case 14:
$cand[0] = 2;
$cand[1] = 6;
break;
case 15:
$cand[0] = 3;
$cand[1] = 7;
break;
case 16:
$cand[0] = 0;
$cand[1] = 5;
break;
case 17:
$cand[0] = 1;
$cand[1] = 4;
break;
case 18:
$cand[0] = 2;
$cand[1] = 7;
break;
case 19:
$cand[0] = 3;
$cand[1] = 6;
break;
case 20:
$cand[0] = 0;
$cand[1] = 6;
break;
case 21:
$cand[0] = 1;
$cand[1] = 7;
break;
case 22:
$cand[0] = 2;
$cand[1] = 4;
break;
case 23:
$cand[0] = 3;
$cand[1] = 5;
break;
case 24:
$cand[0] = 0;
$cand[1] = 7;
break;
case 25:
$cand[0] = 1;
$cand[1] = 2;
break;
case 26:
$cand[0] = 3;
$cand[1] = 4;
break;
case 27:
$cand[0] = 5;
$cand[1] = 6;
break;
}
if ($phase >= 28) {
$temp = $cand[0];
$cand[0] = $cand[1];
$cand[1] = $temp;
}
break;
case 4:
//본선
switch ($phase % 6) {
case 0:
$cand[0] = 0;
$cand[1] = 1;
break;
case 1:
$cand[0] = 2;
$cand[1] = 3;
break;
case 2:
$cand[0] = 0;
$cand[1] = 2;
break;
case 3:
$cand[0] = 1;
$cand[1] = 3;
break;
case 4:
$cand[0] = 0;
$cand[1] = 3;
break;
case 5:
$cand[0] = 1;
$cand[1] = 2;
break;
}
break;
}
return $cand;
}
function qualify($tnmt_type, $tnmt, $phase) {
function qualify($tnmt_type, $tnmt, $phase)
{
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$cand = getTwo($tnmt, $phase);
//각 그룹 페이즈 실행
for($i=0; $i < 8; $i++) {
for ($i = 0; $i < 8; $i++) {
fight($tnmt_type, $tnmt, $phase, $i, $cand[0], $cand[1], 0);
}
if($phase < 55) {
$gameStor->phase+=1;
if ($phase < 55) {
$gameStor->phase += 1;
} else {
$gameStor->phase=0;
$gameStor->tournament=3;
$gameStor->phase = 0;
$gameStor->tournament = 3;
foreach(Util::range(8) as $grpIdx){
foreach (Util::range(8) as $grpIdx) {
$promoters = $db->query(
'SELECT grp,grp_no,win+draw+lose as game,win,draw,lose,gl,win*3+draw as gd from tournament where grp=%i order by gd desc, gl desc, seq limit 0,4',
$grpIdx
);
foreach($promoters as $grpRank=>$grpGen){
foreach ($promoters as $grpRank => $grpGen) {
$db->update('tournament', [
'prmt'=>$grpRank+1,
'prmt' => $grpRank + 1,
], 'grp=%i AND grp_no=%i', $grpIdx, $grpGen['grp_no']);
}
}
}
}
function qualifyAll($tnmt_type, $tnmt, $phase) {
function qualifyAll($tnmt_type, $tnmt, $phase)
{
$db = DB::db();
$start = $phase;
$end = $phase - ($phase % 4) + 4;
for($i=$start; $i < $end; $i++) {
for ($i = $start; $i < $end; $i++) {
qualify($tnmt_type, $tnmt, $i);
}
}
function selection($tnmt_type, $tnmt, $phase) {
function selection($tnmt_type, $tnmt, $phase)
{
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
//시드1 배정
if($phase < 8) {
$grp = $phase + 10; $grp_no = 0;
if ($phase < 8) {
$grp = $phase + 10;
$grp_no = 0;
$general = $db->queryFirstRow('SELECT * FROM tournament WHERE prmt=1 ORDER BY rand() LIMIT 1');
//시드2 배정
} elseif($phase < 16) {
$grp = $phase - 8 + 10; $grp_no = 1;
//시드2 배정
} elseif ($phase < 16) {
$grp = $phase - 8 + 10;
$grp_no = 1;
$general = $db->queryFirstRow('SELECT * FROM tournament WHERE prmt=2 ORDER BY rand() LIMIT 1');
} elseif($phase < 24) {
$grp = $phase - 16 + 10; $grp_no = 2;
} elseif ($phase < 24) {
$grp = $phase - 16 + 10;
$grp_no = 2;
$general = $db->queryFirstRow('SELECT * FROM tournament WHERE prmt>2 ORDER BY rand() LIMIT 1');
} else {
$grp = $phase - 24 + 10; $grp_no = 3;
$grp = $phase - 24 + 10;
$grp_no = 3;
$general = $db->queryFirstRow('SELECT * FROM tournament WHERE prmt>2 ORDER BY rand() LIMIT 1');
}
//해당 시드에서 랜덤 선택
//본선에 추가
$db->insert('tournament', [
'no'=>$general['no'],
'npc'=>$general['npc'],
'name'=>$general['name'],
'leadership'=>$general['leadership'],
'strength'=>$general['strength'],
'intel'=>$general['intel'],
'lvl'=>$general['lvl'],
'grp'=>$grp,
'grp_no'=>$grp_no,
'h'=>$general['h'],
'w'=>$general['w'],
'b'=>$general['b']
'no' => $general['no'],
'npc' => $general['npc'],
'name' => $general['name'],
'leadership' => $general['leadership'],
'strength' => $general['strength'],
'intel' => $general['intel'],
'lvl' => $general['lvl'],
'grp' => $grp,
'grp_no' => $grp_no,
'h' => $general['h'],
'w' => $general['w'],
'b' => $general['b']
]);
//시드 삭제
$db->update('tournament', [
'prmt'=>0
'prmt' => 0
], 'grp=%i AND grp_no=%i', $general['grp'], $general['grp_no']);
if($phase < 31) {
$gameStor->phase+=1;
if ($phase < 31) {
$gameStor->phase += 1;
} else {
$gameStor->tournament = 4;
$gameStor->phase=0;
$gameStor->phase = 0;
}
}
function selectionAll($tnmt_type, $tnmt, $phase) {
function selectionAll($tnmt_type, $tnmt, $phase)
{
$start = $phase;
$end = $phase - ($phase % 8) + 8;
for($i=$start; $i < $end; $i++) {
for ($i = $start; $i < $end; $i++) {
selection($tnmt_type, $tnmt, $i);
}
}
function finallySingle($tnmt_type, $tnmt, $phase) {
function finallySingle($tnmt_type, $tnmt, $phase)
{
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$cand = getTwo($tnmt, $phase);
//각 그룹 페이즈 실행
for($i=10; $i < 18; $i++) {
for ($i = 10; $i < 18; $i++) {
fight($tnmt_type, $tnmt, $phase, $i, $cand[0], $cand[1], 0);
}
if($phase < 5) {
$gameStor->phase+=1;
if ($phase < 5) {
$gameStor->phase += 1;
} else {
$gameStor->tournament=5;
$gameStor->phase=0;
$gameStor->tournament = 5;
$gameStor->phase = 0;
foreach(Util::range(10, 18) as $grpIdx){
foreach (Util::range(10, 18) as $grpIdx) {
$promoters = $db->query(
'SELECT grp,grp_no,win+draw+lose as game,win,draw,lose,gl,win*3+draw as gd from tournament where grp=%i order by gd desc, gl desc, seq limit 0,2',
$grpIdx
);
foreach($promoters as $grpRank=>$grpGen){
foreach ($promoters as $grpRank => $grpGen) {
$db->update('tournament', [
'prmt'=>$grpRank+1,
'prmt' => $grpRank + 1,
], 'grp=%i AND grp_no=%i', $grpIdx, $grpGen['grp_no']);
}
}
}
}
function finallyAll($tnmt_type, $tnmt, $phase) {
function finallyAll($tnmt_type, $tnmt, $phase)
{
$start = $phase;
$end = $phase - ($phase % 2) + 2;
for($i=$start; $i < $end; $i++) {
for ($i = $start; $i < $end; $i++) {
finallySingle($tnmt_type, $tnmt, $i);
}
}
function final16set() {
function final16set()
{
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
//1조1-5조2, 2조1-6조2, 3조1-7조2, 4조1-8조2, 5조1-1조2, 6조1-2조2, 7조1-3조2, 8조1-4조2
$grp = Array(10, 14, 11, 15, 12, 16, 13, 17, 14, 10, 15, 11, 16, 12, 17, 13);
$prmt = Array( 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2);
for($i=0; $i < 16; $i++) {
$grp = array(10, 14, 11, 15, 12, 16, 13, 17, 14, 10, 15, 11, 16, 12, 17, 13);
$prmt = array(1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2);
for ($i = 0; $i < 16; $i++) {
$general = $db->queryFirstRow('SELECT * FROM tournament WHERE grp=%i AND prmt=%i LIMIT 1', $grp[$i], $prmt[$i]);
//16강에 추가
$newGrp = 20 + intdiv($i, 2);
$newGrp_no = $i % 2;
$db->insert('tournament', [
'no'=>$general['no'],
'npc'=>$general['npc'],
'name'=>$general['name'],
'leadership'=>$general['leadership'],
'strength'=>$general['strength'],
'intel'=>$general['intel'],
'lvl'=>$general['lvl'],
'grp'=>$newGrp,
'grp_no'=>$newGrp_no,
'h'=>$general['h'],
'w'=>$general['w'],
'b'=>$general['b']
'no' => $general['no'],
'npc' => $general['npc'],
'name' => $general['name'],
'leadership' => $general['leadership'],
'strength' => $general['strength'],
'intel' => $general['intel'],
'lvl' => $general['lvl'],
'grp' => $newGrp,
'grp_no' => $newGrp_no,
'h' => $general['h'],
'w' => $general['w'],
'b' => $general['b']
]);
}
$db->update('tournament', [
'prmt'=>0
'prmt' => 0
], true);
$gameStor->tournament=6;
$gameStor->phase=0;
$gameStor->tournament = 6;
$gameStor->phase = 0;
}
function finalFight($tnmt_type, $tnmt, $phase, $type) {
function finalFight($tnmt_type, $tnmt, $phase, $type)
{
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
switch($type) {
case 16: $offset = 20; $turn = 7; $next = 7; break;
case 8: $offset = 30; $turn = 3; $next = 8; break;
case 4: $offset = 40; $turn = 1; $next = 9; break;
case 2: $offset = 50; $turn = 0; $next = 0; break;
default: throw new MustNotBeReachedException();
switch ($type) {
case 16:
$offset = 20;
$turn = 7;
$next = 7;
break;
case 8:
$offset = 30;
$turn = 3;
$next = 8;
break;
case 4:
$offset = 40;
$turn = 1;
$next = 9;
break;
case 2:
$offset = 50;
$turn = 0;
$next = 0;
break;
default:
throw new MustNotBeReachedException();
}
$grp = $phase + $offset;
fight($tnmt_type, $tnmt, $phase, $grp, 0, 1, 1);
$gameStor->phase+=1;
$gameStor->phase += 1;
$general = $db->queryFirstRow('SELECT * FROM tournament WHERE grp=%i AND win>0 AND (grp_no=0 OR grp_no=1) LIMIT 1', $grp);
//x강에 추가
$newGrp = intdiv($phase, 2) + $offset + 10;
$newGrp_no = $phase % 2;
$db->insert('tournament', [
'no'=>$general['no'],
'npc'=>$general['npc'],
'name'=>$general['name'],
'leadership'=>$general['leadership'],
'strength'=>$general['strength'],
'intel'=>$general['intel'],
'lvl'=>$general['lvl'],
'grp'=>$newGrp,
'grp_no'=>$newGrp_no,
'h'=>$general['h'],
'w'=>$general['w'],
'b'=>$general['b']
'no' => $general['no'],
'npc' => $general['npc'],
'name' => $general['name'],
'leadership' => $general['leadership'],
'strength' => $general['strength'],
'intel' => $general['intel'],
'lvl' => $general['lvl'],
'grp' => $newGrp,
'grp_no' => $newGrp_no,
'h' => $general['h'],
'w' => $general['w'],
'b' => $general['b']
]);
if($phase >= $turn) {
if ($phase >= $turn) {
$gameStor->tournament = $next;
$gameStor->phase = 0;
}
}
function setGift($tnmt_type, $tnmt, $phase) {
function setGift($tnmt_type, $tnmt, $phase)
{
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
@@ -660,22 +986,35 @@ function setGift($tnmt_type, $tnmt, $phase) {
$resultHelper = [];
switch($tnmt_type) {
case 0: $tp = "전력전"; $tp2 = "tt"; break;
case 1: $tp = "통솔전"; $tp2 = "tl"; break;
case 2: $tp = "일기토"; $tp2 = "ts"; break;
case 3: $tp = "설전"; $tp2 = "ti"; break;
default: throw new MustNotBeReachedException();
switch ($tnmt_type) {
case 0:
$tp = "전력전";
$tp2 = "tt";
break;
case 1:
$tp = "통솔전";
$tp2 = "tl";
break;
case 2:
$tp = "일기토";
$tp2 = "ts";
break;
case 3:
$tp = "설전";
$tp2 = "ti";
break;
default:
throw new MustNotBeReachedException();
}
//16강자 명성 돈
$cost = $admin['develcost'];
//experience를 General로
foreach($db->query('SELECT no, name, grp, grp_no FROM tournament WHERE grp>=20 AND grp<30 AND no > 0') as $general){
foreach ($db->query('SELECT no, name, grp, grp_no FROM tournament WHERE grp>=20 AND grp<30 AND no > 0') as $general) {
$generalID = $general['no'];
$db->update('general', [
'experience'=>$db->sqleval('experience + 25'),
'gold'=>$db->sqleval('gold + %i', $cost)
'experience' => $db->sqleval('experience + 25'),
'gold' => $db->sqleval('gold + %i', $cost)
], 'no=%i', $general['no']);
$db->update('rank_data', [
'value' => $db->sqleval('value + 1')
@@ -684,21 +1023,22 @@ function setGift($tnmt_type, $tnmt, $phase) {
$logger = new ActionLogger($generalID, 0, $admin['year'], $admin['month']);
$resultHelper[$generalID] = [
'id'=>$generalID,
'grp'=>$general['grp'],
'grp_no'=>$general['grp_no'],
'reward'=>$cost,
'msg'=>"<span class='ev_highlight'>16강 진출</span>",
'logger'=>$logger
'id' => $generalID,
'grp' => $general['grp'],
'grp_no' => $general['grp_no'],
'reward' => $cost,
'msg' => "<span class='ev_highlight'>16강 진출</span>",
'logger' => $logger,
'inheritance_point' => 10,
];
}
//8강자 명성 돈
$cost = $admin['develcost'] * 2;
foreach($db->query('SELECT no, name FROM tournament WHERE grp>=30 AND grp<40 AND no > 0') as $general){
foreach ($db->query('SELECT no, name FROM tournament WHERE grp>=30 AND grp<40 AND no > 0') as $general) {
$generalID = $general['no'];
$db->update('general', [
'experience'=>$db->sqleval('experience + 50'),
'gold'=>$db->sqleval('gold + %i', $cost)
'experience' => $db->sqleval('experience + 50'),
'gold' => $db->sqleval('gold + %i', $cost)
], 'no=%i', $general['no']);
$db->update('rank_data', [
'value' => $db->sqleval('value + 1')
@@ -710,11 +1050,11 @@ function setGift($tnmt_type, $tnmt, $phase) {
}
//4강자 명성 돈
$cost = $admin['develcost'] * 3;
foreach($db->query('SELECT no, name FROM tournament WHERE grp>=40 AND grp<50 AND no > 0') as $general){
foreach ($db->query('SELECT no, name FROM tournament WHERE grp>=40 AND grp<50 AND no > 0') as $general) {
$generalID = $general['no'];
$db->update('general', [
'experience'=>$db->sqleval('experience + 50'),
'gold'=>$db->sqleval('gold + %i', $cost)
'experience' => $db->sqleval('experience + 50'),
'gold' => $db->sqleval('gold + %i', $cost)
], 'no=%i', $general['no']);
$db->update('rank_data', [
'value' => $db->sqleval('value + 2')
@@ -723,14 +1063,15 @@ function setGift($tnmt_type, $tnmt, $phase) {
//포상 장수 이름, 금액
$resultHelper[$generalID]['reward'] += $cost;
$resultHelper[$generalID]['msg'] = "<span class='ev_highlight'>4강 진출</span>";
General::createGeneralObjFromDB($generalID)->increaseInheritancePoint('tournament', 10);
}
//결승자 명성 돈
$cost = $admin['develcost'] * 6;
foreach($db->query('SELECT no, name, lose FROM tournament WHERE grp>=50 AND grp<60 AND no > 0') as $general){
foreach ($db->query('SELECT no, name, lose FROM tournament WHERE grp>=50 AND grp<60 AND no > 0') as $general) {
$generalID = $general['no'];
$db->update('general', [
'experience'=>$db->sqleval('experience + 100'),
'gold'=>$db->sqleval('gold + %i', $cost)
'experience' => $db->sqleval('experience + 100'),
'gold' => $db->sqleval('gold + %i', $cost)
], 'no=%i', $general['no']);
$db->update('rank_data', [
'value' => $db->sqleval('value + 2')
@@ -739,17 +1080,18 @@ function setGift($tnmt_type, $tnmt, $phase) {
//포상 장수 이름, 금액
$resultHelper[$generalID]['reward'] += $cost;
$resultHelper[$generalID]['msg'] = "<span class='ev_highlight'>준우승</span>으";
if($general['lose'] > 0){
$resultHelper[$generalID]['inheritance_point'] = 50;
if ($general['lose'] > 0) {
$runnerUp = $general;
}
}
//우승자 명성 돈
$cost = $admin['develcost'] * 8;
foreach($db->query('SELECT no, name FROM tournament WHERE grp>=60 AND no > 0') as $general){
foreach ($db->query('SELECT no, name FROM tournament WHERE grp>=60 AND no > 0') as $general) {
$generalID = $general['no'];
$db->update('general', [
'experience'=>$db->sqleval('experience + 200'),
'gold'=>$db->sqleval('gold + %i', $cost)
'experience' => $db->sqleval('experience + 200'),
'gold' => $db->sqleval('gold + %i', $cost)
], 'no=%i', $general['no']);
$db->update('rank_data', [
'value' => $db->sqleval('value + 2')
@@ -761,6 +1103,7 @@ function setGift($tnmt_type, $tnmt, $phase) {
//포상 장수 이름, 금액
$resultHelper[$generalID]['reward'] += $cost;
$resultHelper[$generalID]['msg'] = "<span class='ev_highlight'>우승</span>으";
$resultHelper[$generalID]['inheritance_point'] = 100;
$winner = $general;
}
@@ -775,23 +1118,24 @@ function setGift($tnmt_type, $tnmt, $phase) {
$runnerUpLogger = $resultHelper[$runnerUp['no']]['logger'];
$runnerUpLogger->pushGeneralHistoryLog("<C>{$tp}</> 대회에서 준우승");
$winnerRewardText = number_format($resultHelper[$winner['no']]['reward']);
$runnerUpRewardText = number_format($resultHelper[$runnerUp['no']]['reward']);
$josaYiWinner = JosaUtil::pick($winner['name'], '이');
$josaYiRunnerUp = JosaUtil::pick($runnerUp['name'], '이');
$winnerLogger->pushGlobalHistoryLog("<C>{$tp}</> 대회에서 <Y>{$winner['name']}</>{$josaYiWinner} <C>우승</>, <Y>{$runnerUp['name']}</>{$josaYiRunnerUp} <C>준우승</>을 차지하여 천하에 이름을 떨칩니다!", ActionLogger::EVENT_YEAR_MONTH);
$winnerLogger->pushGlobalHistoryLog("<C>{$tp}</> 대회의 <S>우승자</>에게는 <C>{$winnerRewardText}</>, <S>준우승자</>에겐 <C>{$runnerUpRewardText}</>의 <S>상금</>과 약간의 <S>명성</>이 주어집니다!", ActionLogger::EVENT_YEAR_MONTH);
foreach($resultHelper as $general){
$winnerLogger->pushGlobalHistoryLog("<B><b>【대회】</b></><C>{$tp}</> 대회에서 <Y>{$winner['name']}</>{$josaYiWinner} <C>우승</>, <Y>{$runnerUp['name']}</>{$josaYiRunnerUp} <C>준우승</>을 차지하여 천하에 이름을 떨칩니다!", ActionLogger::EVENT_YEAR_MONTH);
$winnerLogger->pushGlobalHistoryLog("<B><b>【대회】</b></><C>{$tp}</> 대회의 <S>우승자</>에게는 <C>{$winnerRewardText}</>, <S>준우승자</>에겐 <C>{$runnerUpRewardText}</>의 <S>상금</>과 약간의 <S>명성</>이 주어집니다!", ActionLogger::EVENT_YEAR_MONTH);
$generalObjList = General::createGeneralObjListFromDB(array_keys($resultHelper));
foreach ($resultHelper as $generalID => $general) {
$rewardText = number_format($general['reward']);
/** @var ActionLogger */
$logger = $general['logger'];
$logger->pushGeneralActionLog("<C>{$tp}</> 대회의 {$general['msg']}로 <C>{$rewardText}</>의 <S>상금</>, 약간의 <S>명성</> 획득!", ActionLogger::EVENT_PLAIN);
//TODO: 토너먼트의 다른 값이 모두 sql에 직접 입력하므로 기반을 바꿔야함.
$generalObjList[$generalID]->increaseInheritancePoint('tournament', $general['inheritance_point']);
}
//우승자 번호
@@ -806,20 +1150,23 @@ function setGift($tnmt_type, $tnmt, $phase) {
$rewardRate = round($globalBetTotal / max($globalBet[$winnerSlot], 1), 2);
$betKey = "bet{$winnerSlot}";
$gambleResult = Util::convertArrayToDict($db->query('SELECT general_id, %b as bet FROM betting WHERE %b > 0', $betKey, $betKey), 'general_id');
$gambleResult = Util::convertArrayToDict($db->query('SELECT general_id, %b as bet FROM betting WHERE %b > 0 AND general_id > 0', $betKey, $betKey), 'general_id');
foreach(General::createGeneralObjListFromDB(Util::squeezeFromArray($gambleResult, 'general_id'), ['gold'], 1) as $gambler){
foreach (General::createGeneralObjListFromDB(Util::squeezeFromArray($gambleResult, 'general_id'), ['gold', 'npc'], 1) as $gambler) {
$reward = Util::round($gambleResult[$gambler->getID()]['bet'] * $rewardRate);
$gambler->increaseVar('gold', $reward);
$gambler->increaseRankVar('betwingold', $reward);
$gambler->increaseRankVar('betwin', 1);
if (($gambler->getNPCType() == 0) || ($gambler->getNPCType() == 1 && $gambler->getRankVar('betgold') > 0)) {
$gambler->increaseRankVar('betwingold', $reward);
$gambler->increaseRankVar('betwin', 1);
}
$rewardText = number_format($reward);
$gambler->getLogger()->pushGeneralActionLog("<C>{$tp}</> 대회의 베팅 당첨으로 <C>{$rewardText}</>의 <S>금</> 획득!", ActionLogger::EVENT_PLAIN);
$gambler->applyDB($db);
}
}
function setRefund() {
function setRefund()
{
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
@@ -827,12 +1174,12 @@ function setRefund() {
$cost = $gameStor->develcost;
$generalIDList = $db->queryFirstColumn('SELECT no FROM tournament WHERE grp<10 AND no > 0');
$db->update('general', [
'gold'=>$db->sqleval('gold + %i', $cost)
'gold' => $db->sqleval('gold + %i', $cost)
], 'no IN %li', $generalIDList);
//베팅금 환수
$db->update(['general', [
'gold'=>$db->sqleval('gold + (SELECT bet0+bet1+bet2+bet3+bet4+bet5+bet6+bet7+bet8+bet9+bet10+bet11+bet12+bet13+bet14+bet15 FROM betting WHERE general_id = general.no)')
'gold' => $db->sqleval('gold + (SELECT bet0+bet1+bet2+bet3+bet4+bet5+bet6+bet7+bet8+bet9+bet10+bet11+bet12+bet13+bet14+bet15 FROM betting WHERE general_id = general.no)')
]], true);
//자동진행 끝
@@ -840,17 +1187,19 @@ function setRefund() {
}
//10차이 1.1, 50 차이 1.17, 100차이 1.2
function getLog($lvl1, $lvl2) {
if($lvl1 >= $lvl2) {
$ratio = 1 + log(1+$lvl1-$lvl2, 10) / 10;
function getLog($lvl1, $lvl2)
{
if ($lvl1 >= $lvl2) {
$ratio = 1 + log(1 + $lvl1 - $lvl2, 10) / 10;
} else {
$ratio = 1 - log(1+$lvl2-$lvl1, 10) / 10;
$ratio = 1 - log(1 + $lvl2 - $lvl1, 10) / 10;
}
return $ratio;
}
//0 : 승무패, 1 : 승패
function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) {
function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type)
{
$log = [];
$db = DB::db();
@@ -859,157 +1208,428 @@ function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) {
$gen1 = $db->queryFirstRow('SELECT *,(leadership+strength+intel)*7/15 as total,h,w,b from tournament where grp=%i AND grp_no=%i', $group, $g1);
$gen2 = $db->queryFirstRow('SELECT *,(leadership+strength+intel)*7/15 as total,h,w,b from tournament where grp=%i AND grp_no=%i', $group, $g2);
if($type == 0) { $turn = 10; }
else { $turn = 100; }
if ($type == 0) {
$turn = 10;
} else {
$turn = 100;
}
if($tnmt_type == 1) { $tp = "leadership"; $tp2 = "tl"; }
elseif($tnmt_type == 2) { $tp = "strength"; $tp2 = "ts"; }
elseif($tnmt_type == 3) { $tp = "intel"; $tp2 = "ti"; }
else /*$tnmt_type == 0*/{ $tp = "total"; $tp2 = "tt"; }
if ($tnmt_type == 1) {
$tp = "leadership";
$tp2 = "tl";
} elseif ($tnmt_type == 2) {
$tp = "strength";
$tp2 = "ts";
} elseif ($tnmt_type == 3) {
$tp = "intel";
$tp2 = "ti";
} else /*$tnmt_type == 0*/ {
$tp = "total";
$tp2 = "tt";
}
$e1 = $energy1 = Util::round($gen1[$tp] * getLog($gen1['lvl'], $gen2['lvl']) * 10);
$e2 = $energy2 = Util::round($gen2[$tp] * getLog($gen1['lvl'], $gen2['lvl']) * 10);
foreach([$gen1, $gen2] as $gen){
foreach ([$gen1, $gen2] as $gen) {
$horse = buildItemClass($gen['h']);
$weapon = buildItemClass($gen['w']);
$book = buildItemClass($gen['b']);
//아이템 로그
if(!$horse->isBuyable() && ($tnmt_type == 0 || $tnmt_type == 1)) {
if (!$horse->isBuyable() && ($tnmt_type == 0 || $tnmt_type == 1)) {
$itemName = $horse->getName();
$itemRawName = $horse->getRawName();
switch(rand()%4) {
case 0:
$josaYi = JosaUtil::pick($itemRawName, '이');
$log[] = "<S>●</> <Y>{$gen['name']}</>의 <S>{$itemName}</>{$josaYi} 포효합니다!"; break;
case 1:
$josaYi = JosaUtil::pick($itemRawName, '이');
$log[] = "<S>●</> <Y>{$gen['name']}</>의 <S>{$itemName}</>{$josaYi} 그 위용을 뽐냅니다!"; break;
case 2:
$josaYi = JosaUtil::pick($gen['name'], '이');
$josaUl = JosaUtil::pick($itemRawName, '을');
$log[] = "<S>●</> <Y>{$gen['name']}</>{$josaYi} <S>{$itemName}</>{$josaUl} 타고 있습니다!"; break;
case 3:
$josaYi = JosaUtil::pick($itemRawName, '이');
$log[] = "<S>●</> <Y>{$gen['name']}</>의 <S>{$itemName}</>{$josaYi} 갈기를 휘날립니다!"; break;
switch (rand() % 4) {
case 0:
$josaYi = JosaUtil::pick($itemRawName, '이');
$log[] = "<S>●</> <Y>{$gen['name']}</>의 <S>{$itemName}</>{$josaYi} 포효합니다!";
break;
case 1:
$josaYi = JosaUtil::pick($itemRawName, '이');
$log[] = "<S>●</> <Y>{$gen['name']}</>의 <S>{$itemName}</>{$josaYi} 그 위용을 뽐냅니다!";
break;
case 2:
$josaYi = JosaUtil::pick($gen['name'], '이');
$josaUl = JosaUtil::pick($itemRawName, '을');
$log[] = "<S>●</> <Y>{$gen['name']}</>{$josaYi} <S>{$itemName}</>{$josaUl} 타고 있습니다!";
break;
case 3:
$josaYi = JosaUtil::pick($itemRawName, '이');
$log[] = "<S>●</> <Y>{$gen['name']}</>의 <S>{$itemName}</>{$josaYi} 갈기를 휘날립니다!";
break;
}
}
if(!$weapon->isBuyable() && ($tnmt_type == 0 || $tnmt_type == 2)) {
if (!$weapon->isBuyable() && ($tnmt_type == 0 || $tnmt_type == 2)) {
$itemName = $weapon->getName();
$itemRawName = $weapon->getRawName();
switch(rand()%4) {
case 0:
$josaYi = JosaUtil::pick($itemRawName, '이');
$log[] = "<S>●</> <Y>{$gen['name']}</>의 <S>{$itemName}</>{$josaYi} 번뜩입니다!"; break;
case 1:
$josaYi = JosaUtil::pick($itemRawName, '이');
$log[] = "<S>●</> <Y>{$gen['name']}</>의 <S>{$itemName}</>{$josaYi} 푸르게 빛납니다!"; break;
case 2:
$log[] = "<S>●</> <Y>{$gen['name']}</>의 <S>{$itemName}</>에서 살기가 느껴집니다!"; break;
case 3:
$josaYi = JosaUtil::pick($itemRawName, '이');
$log[] = "<S>●</> <Y>{$gen['name']}</>의 손에는 <S>{$itemName}</>{$josaYi} 쥐어져 있습니다!"; break;
switch (rand() % 4) {
case 0:
$josaYi = JosaUtil::pick($itemRawName, '이');
$log[] = "<S>●</> <Y>{$gen['name']}</>의 <S>{$itemName}</>{$josaYi} 번뜩입니다!";
break;
case 1:
$josaYi = JosaUtil::pick($itemRawName, '이');
$log[] = "<S>●</> <Y>{$gen['name']}</>의 <S>{$itemName}</>{$josaYi} 푸르게 빛납니다!";
break;
case 2:
$log[] = "<S>●</> <Y>{$gen['name']}</>의 <S>{$itemName}</>에서 살기가 느껴집니다!";
break;
case 3:
$josaYi = JosaUtil::pick($itemRawName, '이');
$log[] = "<S>●</> <Y>{$gen['name']}</>의 손에는 <S>{$itemName}</>{$josaYi} 쥐어져 있습니다!";
break;
}
}
if(!$book->isBuyable() && ($tnmt_type == 0 || $tnmt_type == 3)) {
if (!$book->isBuyable() && ($tnmt_type == 0 || $tnmt_type == 3)) {
$itemName = $book->getName();
$itemRawName = $book->getRawName();
switch(rand()%4) {
case 0:
$josaYi = JosaUtil::pick($gen['name'], '이');
$josaUl = JosaUtil::pick($itemRawName, '을');
$log[] = "<S>●</> <Y>{$gen['name']}</>{$josaYi} <S>{$itemName}</>{$josaUl} 펼쳐듭니다!"; break;
case 1:
$josaYi = JosaUtil::pick($gen['name'], '이');
$josaUl = JosaUtil::pick($itemRawName, '');
$log[] = "<S>●</> <Y>{$gen['name']}</>{$josaYi} <S>{$itemName}</>{$josaUl} 품에서 꺼냅니다!"; break;
case 2:
$josaYi = JosaUtil::pick($gen['name'], '이');
$josaUl = JosaUtil::pick($itemRawName, '을');
$log[] = "<S>●</> <Y>{$gen['name']}</>{$josaYi} <S>{$itemName}</>{$josaUl} 들고 있습니다!"; break;
case 3:
$josaYi = JosaUtil::pick($itemRawName, '이');
$log[] = "<S>●</> <Y>{$gen['name']}</>의 손에는 <S>{$itemName}</>{$josaYi} 쥐어져 있습니다!"; break;
switch (rand() % 4) {
case 0:
$josaYi = JosaUtil::pick($gen['name'], '이');
$josaUl = JosaUtil::pick($itemRawName, '을');
$log[] = "<S>●</> <Y>{$gen['name']}</>{$josaYi} <S>{$itemName}</>{$josaUl} 펼쳐듭니다!";
break;
case 1:
$josaYi = JosaUtil::pick($gen['name'], '');
$josaUl = JosaUtil::pick($itemRawName, '을');
$log[] = "<S>●</> <Y>{$gen['name']}</>{$josaYi} <S>{$itemName}</>{$josaUl} 품에서 꺼냅니다!";
break;
case 2:
$josaYi = JosaUtil::pick($gen['name'], '이');
$josaUl = JosaUtil::pick($itemRawName, '을');
$log[] = "<S>●</> <Y>{$gen['name']}</>{$josaYi} <S>{$itemName}</>{$josaUl} 들고 있습니다!";
break;
case 3:
$josaYi = JosaUtil::pick($itemRawName, '이');
$log[] = "<S>●</> <Y>{$gen['name']}</>의 손에는 <S>{$itemName}</>{$josaYi} 쥐어져 있습니다!";
break;
}
}
}
$log[] = "<S>●</> <Y>{$gen1['name']}</> <C>({$energy1})</> vs <C>({$energy2})</> <Y>{$gen2['name']}</>";
$gd1 = 0; $gd2 = 0;
$phase = 0; $sel = 2;
while($phase < $turn) {
$gd1 = 0;
$gd2 = 0;
$phase = 0;
$sel = 2;
while ($phase < $turn) {
$phase++;
//평타
$damage1 = Util::round($gen2[$tp] * (rand() % 21 + 90) / 130); // 90~110%
$damage2 = Util::round($gen1[$tp] * (rand() % 21 + 90) / 130); // 90~110%
//보너스타
$ratio = rand() % 100;
if($gen1[$tp] >= $ratio) { $damage2 += Util::round($gen1[$tp] * (rand() % 41 + 10) / 130); } // 10~50
if ($gen1[$tp] >= $ratio) {
$damage2 += Util::round($gen1[$tp] * (rand() % 41 + 10) / 130);
} // 10~50
$ratio = rand() % 100;
if($gen2[$tp] >= $ratio) { $damage1 += Util::round($gen2[$tp] * (rand() % 41 + 10) / 130); } // 10~50
$critical1 = 0; $critical2 = 0;
if ($gen2[$tp] >= $ratio) {
$damage1 += Util::round($gen2[$tp] * (rand() % 41 + 10) / 130);
} // 10~50
$critical1 = 0;
$critical2 = 0;
//막판 분노
$ratio = rand() % 300;
if($e1 / 5 > $energy1 && $damage1 > $damage2 && $gen1[$tp] >= $ratio) {
if ($e1 / 5 > $energy1 && $damage1 > $damage2 && $gen1[$tp] >= $ratio) {
$damage2 *= Util::round((rand() % 301 + 200) / 100); // 200 ~ 500%
$critical1 = 1;
if ($tnmt_type == 0) { switch(rand()%2) { case 0: $str = "전력"; break; case 1: $str = "집중"; break; } }
elseif($tnmt_type == 1) { switch(rand()%2) { case 0: $str = "봉시진"; break; case 1: $str = "어린진"; break; } }
elseif($tnmt_type == 2) { switch(rand()%2) { case 0: $str = "삼단"; break; case 1: $str = "나선"; break; } }
elseif($tnmt_type == 3) { switch(rand()%2) { case 0: $str = "독설"; break; case 1: $str = "논파"; break; } }
if ($tnmt_type == 0) {
switch (rand() % 2) {
case 0:
$str = "전력";
break;
case 1:
$str = "집중";
break;
}
} elseif ($tnmt_type == 1) {
switch (rand() % 2) {
case 0:
$str = "봉시진";
break;
case 1:
$str = "어린진";
break;
}
} elseif ($tnmt_type == 2) {
switch (rand() % 2) {
case 0:
$str = "삼단";
break;
case 1:
$str = "나선";
break;
}
} elseif ($tnmt_type == 3) {
switch (rand() % 2) {
case 0:
$str = "독설";
break;
case 1:
$str = "논파";
break;
}
}
$log[] = "<S>●</> <Y>{$gen1['name']}</>의 분노의 <M>{$str}</> 공격!";
}
$ratio = rand() % 300;
if($e2 / 5 > $energy2 && $damage2 > $damage1 && $gen2[$tp] >= $ratio) {
if ($e2 / 5 > $energy2 && $damage2 > $damage1 && $gen2[$tp] >= $ratio) {
$damage1 *= Util::round((rand() % 301 + 200) / 100); // 200 ~ 500%
$critical2 = 1;
if($tnmt_type == 0) { switch(rand()%2) { case 0: $str = "전력"; break; case 1: $str = "집중"; break; } }
elseif($tnmt_type == 1) { switch(rand()%2) { case 0: $str = "봉시진"; break; case 1: $str = "어린진"; break; } }
elseif($tnmt_type == 2) { switch(rand()%2) { case 0: $str = "삼단"; break; case 1: $str = "나선"; break; } }
elseif($tnmt_type == 3) { switch(rand()%2) { case 0: $str = "독설"; break; case 1: $str = "논파"; break; } }
if ($tnmt_type == 0) {
switch (rand() % 2) {
case 0:
$str = "전력";
break;
case 1:
$str = "집중";
break;
}
} elseif ($tnmt_type == 1) {
switch (rand() % 2) {
case 0:
$str = "봉시진";
break;
case 1:
$str = "어린진";
break;
}
} elseif ($tnmt_type == 2) {
switch (rand() % 2) {
case 0:
$str = "삼단";
break;
case 1:
$str = "나선";
break;
}
} elseif ($tnmt_type == 3) {
switch (rand() % 2) {
case 0:
$str = "독설";
break;
case 1:
$str = "논파";
break;
}
}
$log[] = "<S>●</> <Y>{$gen2['name']}</>의 분노의 <M>{$str}</> 공격!";
}
//1합 승부
if($phase == 1) {
if ($phase == 1) {
$ratio = rand() % 400;
if($gen1[$tp]*0.9 > $gen2[$tp] && $gen1[$tp] >= $ratio) {
$damage1 = 0; $damage2 = $e2;
if ($tnmt_type == 0) { $log[] = "<S>●</> <Y>{$gen1['name']}</>의 <M>압도</>!"; }
elseif($tnmt_type == 1) { $log[] = "<S>●</> <Y>{$gen1['name']}</>의 <M>팔문금쇄진</>!"; }
elseif($tnmt_type == 2) { $log[] = "<S>●</> <Y>{$gen1['name']}</>의 <M>일격 필살</>!"; }
elseif($tnmt_type == 3) { $log[] = "<S>●</> <Y>{$gen1['name']}</>의 <M>모독 욕설</>!"; }
if ($gen1[$tp] * 0.9 > $gen2[$tp] && $gen1[$tp] >= $ratio) {
$damage1 = 0;
$damage2 = $e2;
if ($tnmt_type == 0) {
$log[] = "<S>●</> <Y>{$gen1['name']}</>의 <M>압도</>!";
} elseif ($tnmt_type == 1) {
$log[] = "<S>●</> <Y>{$gen1['name']}</>의 <M>팔문금쇄진</>!";
} elseif ($tnmt_type == 2) {
$log[] = "<S>●</> <Y>{$gen1['name']}</>의 <M>일격 필살</>!";
} elseif ($tnmt_type == 3) {
$log[] = "<S>●</> <Y>{$gen1['name']}</>의 <M>모독 욕설</>!";
}
}
if($gen2[$tp]*0.9 > $gen1[$tp] && $gen2[$tp] >= $ratio) {
$damage2 = 0; $damage1 = $e1;
if ($tnmt_type == 0) { $log[] = "<S>●</> <Y>{$gen2['name']}</>의 <M>압도</>!"; }
elseif($tnmt_type == 1) { $log[] = "<S>●</> <Y>{$gen2['name']}</>의 <M>팔문금쇄진</>!"; }
elseif($tnmt_type == 2) { $log[] = "<S>●</> <Y>{$gen2['name']}</>의 <M>일격 필살</>!"; }
elseif($tnmt_type == 3) { $log[] = "<S>●</> <Y>{$gen2['name']}</>의 <M>모독 욕설</>!"; }
if ($gen2[$tp] * 0.9 > $gen1[$tp] && $gen2[$tp] >= $ratio) {
$damage2 = 0;
$damage1 = $e1;
if ($tnmt_type == 0) {
$log[] = "<S>●</> <Y>{$gen2['name']}</>의 <M>압도</>!";
} elseif ($tnmt_type == 1) {
$log[] = "<S>●</> <Y>{$gen2['name']}</>의 <M>팔문금쇄진</>!";
} elseif ($tnmt_type == 2) {
$log[] = "<S>●</> <Y>{$gen2['name']}</>의 <M>일격 필살</>!";
} elseif ($tnmt_type == 3) {
$log[] = "<S>●</> <Y>{$gen2['name']}</>의 <M>모독 욕설</>!";
}
}
} else {
$ratio = rand() % 1000;
if($critical1 == 0 && $gen1[$tp] >= $ratio) {
if ($critical1 == 0 && $gen1[$tp] >= $ratio) {
$damage2 *= Util::randRangeInt(150, 300) / 100; // 150 ~ 300%
$critical1 = 1;
if ($tnmt_type == 0) { switch(rand()%6) { case 0: $str = "참격"; break; case 1: $str = "집중"; break; case 2: $str = "역공"; break; case 3: $str = "반격"; break; case 4: $str = "선제"; break; case 5: $str = "도발"; break; } }
elseif($tnmt_type == 1) { switch(rand()%6) { case 0: $str = "추행진"; break; case 1: $str = "학익진"; break; case 2: $str = "장사진"; break; case 3: $str = "형액진"; break; case 4: $str = "기형진"; break; case 5: $str = "구행진"; break; } }
elseif($tnmt_type == 2) { switch(rand()%6) { case 0: $str = "기합"; break; case 1: $str = "기염"; break; case 2: $str = "반격"; break; case 3: $str = "역공"; break; case 4: $str = "삼단"; break; case 5: $str = "나선"; break; } }
elseif($tnmt_type == 3) { switch(rand()%6) { case 0: $str = "논파"; break; case 1: $str = "항변"; break; case 2: $str = "반론"; break; case 3: $str = "반박"; break; case 4: $str = "도발"; break; case 5: $str = "면박"; break; } }
if ($tnmt_type == 0) {
switch (rand() % 6) {
case 0:
$str = "참격";
break;
case 1:
$str = "집중";
break;
case 2:
$str = "역공";
break;
case 3:
$str = "반격";
break;
case 4:
$str = "선제";
break;
case 5:
$str = "도발";
break;
}
} elseif ($tnmt_type == 1) {
switch (rand() % 6) {
case 0:
$str = "추행진";
break;
case 1:
$str = "학익진";
break;
case 2:
$str = "장사진";
break;
case 3:
$str = "형액진";
break;
case 4:
$str = "기형진";
break;
case 5:
$str = "구행진";
break;
}
} elseif ($tnmt_type == 2) {
switch (rand() % 6) {
case 0:
$str = "기합";
break;
case 1:
$str = "기염";
break;
case 2:
$str = "반격";
break;
case 3:
$str = "역공";
break;
case 4:
$str = "삼단";
break;
case 5:
$str = "나선";
break;
}
} elseif ($tnmt_type == 3) {
switch (rand() % 6) {
case 0:
$str = "논파";
break;
case 1:
$str = "항변";
break;
case 2:
$str = "반론";
break;
case 3:
$str = "반박";
break;
case 4:
$str = "도발";
break;
case 5:
$str = "면박";
break;
}
}
$log[] = "<S>●</> <Y>{$gen1['name']}</>의 <M>{$str}</>!";
}
$ratio = rand() % 1000;
if($critical2 == 0 && $gen2[$tp] >= $ratio) {
if ($critical2 == 0 && $gen2[$tp] >= $ratio) {
$damage1 *= Util::randRangeInt(150, 300) / 100; // 150 ~ 300%
$critical2 = 1;
if ($tnmt_type == 0) { switch(rand()%6) { case 0: $str = "참격"; break; case 1: $str = "집중"; break; case 2: $str = "역공"; break; case 3: $str = "반격"; break; case 4: $str = "선제"; break; case 5: $str = "도발"; break; } }
elseif($tnmt_type == 1) { switch(rand()%6) { case 0: $str = "추행진"; break; case 1: $str = "학익진"; break; case 2: $str = "장사진"; break; case 3: $str = "형액진"; break; case 4: $str = "기형진"; break; case 5: $str = "구행진"; break; } }
elseif($tnmt_type == 2) { switch(rand()%6) { case 0: $str = "기합"; break; case 1: $str = "기염"; break; case 2: $str = "반격"; break; case 3: $str = "역공"; break; case 4: $str = "삼단"; break; case 5: $str = "나선"; break; } }
elseif($tnmt_type == 3) { switch(rand()%6) { case 0: $str = "논파"; break; case 1: $str = "항변"; break; case 2: $str = "반론"; break; case 3: $str = "반박"; break; case 4: $str = "도발"; break; case 5: $str = "면박"; break; } }
if ($tnmt_type == 0) {
switch (rand() % 6) {
case 0:
$str = "참격";
break;
case 1:
$str = "집중";
break;
case 2:
$str = "역공";
break;
case 3:
$str = "반격";
break;
case 4:
$str = "선제";
break;
case 5:
$str = "도발";
break;
}
} elseif ($tnmt_type == 1) {
switch (rand() % 6) {
case 0:
$str = "추행진";
break;
case 1:
$str = "학익진";
break;
case 2:
$str = "장사진";
break;
case 3:
$str = "형액진";
break;
case 4:
$str = "기형진";
break;
case 5:
$str = "구행진";
break;
}
} elseif ($tnmt_type == 2) {
switch (rand() % 6) {
case 0:
$str = "기합";
break;
case 1:
$str = "기염";
break;
case 2:
$str = "반격";
break;
case 3:
$str = "역공";
break;
case 4:
$str = "삼단";
break;
case 5:
$str = "나선";
break;
}
} elseif ($tnmt_type == 3) {
switch (rand() % 6) {
case 0:
$str = "논파";
break;
case 1:
$str = "항변";
break;
case 2:
$str = "반론";
break;
case 3:
$str = "반박";
break;
case 4:
$str = "도발";
break;
case 5:
$str = "면박";
break;
}
}
$log[] = "<S>●</> <Y>{$gen2['name']}</>의 <M>{$str}</>!";
}
}
@@ -1019,135 +1639,179 @@ function fight($tnmt_type, $tnmt, $phs, $group, $g1, $g2, $type) {
$energy1 -= $damage1;
$energy2 -= $damage2;
$tDamage1 = $damage1; $tDamage2 = $damage2;
$tEnergy1 = $energy1; $tEnergy2 = $energy2;
if($energy1 <= 0 && $energy2 <= 0) {
$tDamage1 = $damage1;
$tDamage2 = $damage2;
$tEnergy1 = $energy1;
$tEnergy2 = $energy2;
if ($energy1 <= 0 && $energy2 <= 0) {
$r1 = $tEnergy1 / Util::valueFit($tDamage1, 1);
$r2 = $tEnergy2 / Util::valueFit($tDamage2, 1);
if($r1 > $r2) {
$offset = Util::round($tEnergy2*$tDamage1/Util::valueFit($tDamage2,1));
$damage1 += $offset; $energy1 -= $offset;
$damage2 += $tEnergy2; $energy2 = 0;
if ($r1 > $r2) {
$offset = Util::round($tEnergy2 * $tDamage1 / Util::valueFit($tDamage2, 1));
$damage1 += $offset;
$energy1 -= $offset;
$damage2 += $tEnergy2;
$energy2 = 0;
} else {
$offset = Util::round($tEnergy1*$tDamage2/Util::valueFit($tDamage1,1));
$damage2 += $offset; $energy2 -= $offset;
$damage1 += $tEnergy1; $energy1 = 0;
$offset = Util::round($tEnergy1 * $tDamage2 / Util::valueFit($tDamage1, 1));
$damage2 += $offset;
$energy2 -= $offset;
$damage1 += $tEnergy1;
$energy1 = 0;
}
} elseif($energy1 * $energy2 <= 0) {
if($energy2 < 0) {
$offset = Util::round($tEnergy2*$tDamage1/Util::valueFit($tDamage2,1));
$damage1 += $offset; $energy1 -= $offset;
$damage2 += $tEnergy2; $energy2 = 0;
} elseif ($energy1 * $energy2 <= 0) {
if ($energy2 < 0) {
$offset = Util::round($tEnergy2 * $tDamage1 / Util::valueFit($tDamage2, 1));
$damage1 += $offset;
$energy1 -= $offset;
$damage2 += $tEnergy2;
$energy2 = 0;
}
if($energy1 < 0) {
$offset = Util::round($tEnergy1*$tDamage2/Util::valueFit($tDamage1,1));
$damage2 += $offset; $energy2 -= $offset;
$damage1 += $tEnergy1; $energy1 = 0;
if ($energy1 < 0) {
$offset = Util::round($tEnergy1 * $tDamage2 / Util::valueFit($tDamage1, 1));
$damage2 += $offset;
$energy2 -= $offset;
$damage1 += $tEnergy1;
$energy1 = 0;
}
}
$gd1 += $damage1; $gd2 += $damage2;
$energy1 = Util::round($energy1); $energy2 = Util::round($energy2);
$damage1 = Util::round($damage1); $damage2 = Util::round($damage2);
$gd1 += $damage1;
$gd2 += $damage2;
$energy1 = Util::round($energy1);
$energy2 = Util::round($energy2);
$damage1 = Util::round($damage1);
$damage2 = Util::round($damage2);
$log[] = '<S>●</> '
.StringUtil::padStringAlignRight((string)$phase, 2, "0").'合 : '
.'<C>'.StringUtil::padStringAlignRight((string)$energy1, 3, "0").'</>'
.'<span class="ev_highlight">(-'.StringUtil::padStringAlignRight((string)$damage1, 3, "0").')</span>'
.' vs '
.'<span class="ev_highlight">(-'.StringUtil::padStringAlignRight((string)$damage2, 3, "0").')</span>'
.'<C>'.StringUtil::padStringAlignRight((string)$energy2, 3, "0").'</>';
. StringUtil::padStringAlignRight((string)$phase, 2, "0") . '合 : '
. '<C>' . StringUtil::padStringAlignRight((string)$energy1, 3, "0") . '</>'
. '<span class="ev_highlight">(-' . StringUtil::padStringAlignRight((string)$damage1, 3, "0") . ')</span>'
. ' vs '
. '<span class="ev_highlight">(-' . StringUtil::padStringAlignRight((string)$damage2, 3, "0") . ')</span>'
. '<C>' . StringUtil::padStringAlignRight((string)$energy2, 3, "0") . '</>';
if($energy1 <= 0 && $energy2 <= 0) {
if($type == 0) { $sel = 2; break; }
else {
$energy1 = Util::round($e1 / 2); $energy2 = Util::round($e2 / 2);
if ($energy1 <= 0 && $energy2 <= 0) {
if ($type == 0) {
$sel = 2;
break;
} else {
$energy1 = Util::round($e1 / 2);
$energy2 = Util::round($e2 / 2);
$log[] = "<S>●</> <span class='ev_highlight'>재대결</span>!";
}
}
if($energy1 <= 0) { $sel = 1; break; }
if($energy2 <= 0) { $sel = 0; break; }
if ($energy1 <= 0) {
$sel = 1;
break;
}
if ($energy2 <= 0) {
$sel = 0;
break;
}
}
$general1 = $db->queryFirstRow('SELECT value as gl FROM rank_data WHERE general_id = %i AND type = %s', $gen1['no'], $tp2.'g');
$general2 = $db->queryFirstRow('SELECT value as gl FROM rank_data WHERE general_id = %i AND type = %s', $gen2['no'], $tp2.'g');
$gen1gl = $db->queryFirstField('SELECT value as gl FROM rank_data WHERE general_id = %i AND type = %s', $gen1['no'], $tp2 . 'g') ?? 0;
$gen2gl = $db->queryFirstField('SELECT value as gl FROM rank_data WHERE general_id = %i AND type = %s', $gen2['no'], $tp2 . 'g') ?? 0;
switch($sel) {
case 0:
$log[] = "<S>●</> <Y>{$gen1['name']}</> <S>승리</>!";
switch ($sel) {
case 0:
$log[] = "<S>●</> <Y>{$gen1['name']}</> <S>승리</>!";
$gl = Util::round(($gd2 - $gd1) / 50);
$db->update('tournament', [
'win'=>$db->sqleval('win+1'),
'gl'=>$db->sqleval('gl+%i', $gl)
], 'grp=%i AND grp_no=%i', $group, $g1);
$db->update('tournament', [
'lose'=>$db->sqleval('lose+1'),
'gl'=>$db->sqleval('gl-%i', $gl)
], 'grp=%i AND grp_no=%i', $group, $g2);
if($general1['gl'] > $general2['gl']) { $gl1 = 1; $gl2 = 0; }
elseif($general1['gl'] == $general2['gl']) { $gl1 = 2; $gl2 = -1; }
else { $gl1 = 3; $gl2 = -2; }
$gl = Util::round(($gd2 - $gd1) / 50);
$db->update('tournament', [
'win' => $db->sqleval('win+1'),
'gl' => $db->sqleval('gl+%i', $gl)
], 'grp=%i AND grp_no=%i', $group, $g1);
$db->update('tournament', [
'lose' => $db->sqleval('lose+1'),
'gl' => $db->sqleval('gl-%i', $gl)
], 'grp=%i AND grp_no=%i', $group, $g2);
$gen1resKey = 'w';
$gen2resKey = 'l';
break;
case 1:
$log[] = "<S>●</> <Y>{$gen2['name']}</> <S>승리</>!";
if ($gen1gl > $gen2gl) {
$gl1 = 1;
$gl2 = 0;
} elseif ($gen1gl == $gen2gl) {
$gl1 = 2;
$gl2 = -1;
} else {
$gl1 = 3;
$gl2 = -2;
}
$gl = Util::round(($gd1 - $gd2) / 50);
$db->update('tournament', [
'lose'=>$db->sqleval('lose+1'),
'gl'=>$db->sqleval('gl-%i', $gl)
], 'grp=%i AND grp_no=%i', $group, $g1);
$db->update('tournament', [
'win'=>$db->sqleval('win+1'),
'gl'=>$db->sqleval('gl+%i', $gl)
], 'grp=%i AND grp_no=%i', $group, $g2);
$gen1resKey = 'w';
$gen2resKey = 'l';
break;
case 1:
$log[] = "<S>●</> <Y>{$gen2['name']}</> <S>승리</>!";
if($general2['gl'] > $general1['gl']) { $gl2 = 1; $gl1 = 0; }
elseif($general2['gl'] == $general1['gl']) { $gl2 = 2; $gl1 = -1; }
else { $gl2 = 3; $gl1 = -2; }
$gl = Util::round(($gd1 - $gd2) / 50);
$db->update('tournament', [
'lose' => $db->sqleval('lose+1'),
'gl' => $db->sqleval('gl-%i', $gl)
], 'grp=%i AND grp_no=%i', $group, $g1);
$db->update('tournament', [
'win' => $db->sqleval('win+1'),
'gl' => $db->sqleval('gl+%i', $gl)
], 'grp=%i AND grp_no=%i', $group, $g2);
$gen1resKey = 'l';
$gen2resKey = 'w';
break;
case 2:
$log[] = "<S>●</> 무승부!";
if ($gen2gl > $gen1gl) {
$gl2 = 1;
$gl1 = 0;
} elseif ($gen2gl == $gen1gl) {
$gl2 = 2;
$gl1 = -1;
} else {
$gl2 = 3;
$gl1 = -2;
}
$db->update('tournament', [
'draw'=>$db->sqleval('draw+1')
], 'grp=%i AND (grp_no=%i OR grp_no=%i)', $group, $g1, $g2);
$gen1resKey = 'l';
$gen2resKey = 'w';
break;
case 2:
$log[] = "<S>●</> 무승부!";
if($general1['gl'] > $general2['gl']) { $gl2 = -1; $gl1 = 1; }
elseif($general1['gl'] == $general2['gl']) { $gl2 = 0; $gl1 = 0; }
else { $gl2 = +1; $gl1 = -1; }
$db->update('tournament', [
'draw' => $db->sqleval('draw+1')
], 'grp=%i AND (grp_no=%i OR grp_no=%i)', $group, $g1, $g2);
$gen1resKey = 'd';
$gen2resKey = 'd';
break;
default: new MustNotBeReachedException();
if ($gen1gl > $gen2gl) {
$gl2 = -1;
$gl1 = 1;
} elseif ($gen1gl == $gen2gl) {
$gl2 = 0;
$gl1 = 0;
} else {
$gl2 = +1;
$gl1 = -1;
}
$gen1resKey = 'd';
$gen2resKey = 'd';
break;
default:
throw new MustNotBeReachedException();
}
$db->update('rank_data', [
'value' => $db->sqleval('value + 1')
], 'general_id=%i AND type = %s',$gen1['no'], "{$tp2}{$gen1resKey}");
], 'general_id=%i AND type = %s', $gen1['no'], "{$tp2}{$gen1resKey}");
$db->update('rank_data', [
'value' => $db->sqleval('value + %i', $gl1),
], 'general_id=%i AND type = %s',$gen1['no'], "{$tp2}g");
], 'general_id=%i AND type = %s', $gen1['no'], "{$tp2}g");
$db->update('rank_data', [
'value' => $db->sqleval('value + 1'),
], 'general_id=%i AND type = %s',$gen2['no'], "{$tp2}{$gen2resKey}");
], 'general_id=%i AND type = %s', $gen2['no'], "{$tp2}{$gen2resKey}");
$db->update('rank_data', [
'value' => $db->sqleval('value + %i', $gl2)
], 'general_id=%i AND type = %s',$gen2['no'], "{$tp2}g");
], 'general_id=%i AND type = %s', $gen2['no'], "{$tp2}g");
if(($tnmt == 2 && $phs < 55) || ($tnmt == 4 && $phs < 5)) {
$cand = getTwo($tnmt, $phs+1);
if (($tnmt == 2 && $phs < 55) || ($tnmt == 4 && $phs < 5)) {
$cand = getTwo($tnmt, $phs + 1);
$gen1Name = $db->queryFirstField('SELECT name FROM tournament where grp=%i and grp_no=%i', $group, $cand[0]);
$gen2Name = $db->queryFirstField('SELECT name FROM tournament where grp=%i and grp_no=%i', $group, $cand[1]);
+305 -287
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -20,7 +21,7 @@ if (!$userID) {
//턴 실행.
TurnExecutionHelper::executeAllCommand();
if(!$session->isGameLoggedIn()){
if (!$session->isGameLoggedIn()) {
header('Location:..');
die();
}
@@ -41,8 +42,8 @@ $gameStor->cacheAll(true);
if ($me['newmsg'] == 1 || $me['newvote'] == 1) {
$db->update('general', [
'newmsg'=>0,
'newvote'=>0
'newmsg' => 0,
'newvote' => 0
], 'owner=%i', $userID);
}
@@ -59,29 +60,25 @@ $generalObj->setRawCity($db->queryFirstRow('SELECT * FROM city WHERE city = %i',
$scenario = $gameStor->scenario_text;
$nationID = $generalObj->getNationID();
if($nationID){
if ($nationID) {
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
$nationStor->cacheAll();
}
$valid = 0;
if ($gameStor->extended_general == 0) {
$extend = "표준";
} else {
$extend = "확장";
$valid = 1;
}
if ($gameStor->fiction == 0) {
$fiction = "사실";
} else {
$fiction = "가상";
$valid = 1;
}
if ($gameStor->npcmode == 0) {
$npcmode = "불가능";
} else if($gameStor->npcmode == 1){
} else if ($gameStor->npcmode == 1) {
$npcmode = "가능";
$valid = 1;
} else {
$npcmode = "선택 생성";
}
@@ -89,293 +86,314 @@ $color = "cyan";
$mapTheme = $gameStor->map_theme;
$serverName = UniqueConst::$serverName;
$serverCnt = $gameStor->server_cnt;
$auctionCount = $db->queryFirstField('SELECT count(`no`) FROM auction');
$myNationStatic = getNationStaticInfo($generalObj->getNationID());
$nationColorType = substr($myNationStatic['color'] ?? '#000000', 1);
$autorunUser = ($gameStor->autorun_user) ?? [];
$otherTextInfo = [];
if ($gameStor->join_mode == 'onlyRandom') {
$otherTextInfo[] = '랜덤 임관 전용';
}
if ($autorunUser['limit_minutes'] ?? false) {
$otherTextInfo[] = getAutorunInfo($autorunUser);
}
if (!$otherTextInfo) {
$otherTextInfo = '표준';
} else {
$otherTextInfo = join(', ', $otherTextInfo);
}
?>
<!DOCTYPE html>
<html>
<head>
<title><?=$serverName?>: 메인</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/jquery.redirect.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('../e_lib/moment.min.js')?>
<?=WebUtil::printJS('../e_lib/linkify/linkify.min.js')?>
<?=WebUtil::printJS('../e_lib/linkify/linkify-string.min.js')?>
<?=WebUtil::printJS('../d_shared/common_path.js')?>
<?=WebUtil::printJS('js/common.js')?>
<?=WebUtil::printJS('js/main.js')?>
<?=WebUtil::printJS('d_shared/base_map.js')?>
<?=WebUtil::printJS('js/map.js')?>
<?=WebUtil::printJS('js/msg.js')?>
<script>
window.serverNick = '<?=DB::prefix()?>';
window.serverID = '<?=UniqueConst::$serverID?>';
$(function(){
reloadWorldMap({
hrefTemplate:'b_currentCity.php?citylist={0}',
useCachedMap:true
});
setInterval(function(){
refreshMsg();
}, 5000);
});
</script>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('../d_shared/common.css')?>
<?=WebUtil::printCSS('css/common.css')?>
<?=WebUtil::printCSS('css/main.css')?>
<?=WebUtil::printCSS('css/map.css')?>
<?=WebUtil::printCSS('css/msg.css')?>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Nanum+Gothic|Nanum+Myeongjo|Nanum+Pen+Script" rel="stylesheet">
<title><?= $serverName ?>: 메인</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=500" />
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printJS('d_shared/base_map.js') ?>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<?= WebUtil::printDist('vue', 'v_main', true) ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printCSS('css/map.css') ?>
<?= WebUtil::printStaticValues([
'serverNick' => DB::prefix(),
'serverID' => UniqueConst::$serverID,
'maxTurn' => GameConst::$maxTurn,
'maxPushTurn' => 12,
'commandList' => getCommandTable($generalObj),
'serverNow' => TimeUtil::now(false),
'baseColor2' => GameConst::$basecolor2,
]) ?>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
</head>
<body class="img_back">
<div id="container">
<div><?=allButton($gameStor->npcmode==1)?></div>
<table class="tb_layout bg0" style="width:1000px;">
<tr height=50>
<td colspan=5 id="server_title" align=center><font size=4>삼국지 모의전투 HiDCHe <?=$serverName.$serverCnt?>기 (<font color=cyan><?=$scenario?></font>)</font></td>
</tr>
<?php if ($valid == 1): ?>
<tr height=30>
<td width=398 colspan=2 align=center><font color=<?=$color?>><?=$scenario?></font></td>
<td width=198 align=center><font color=<?=$color?>>NPC수 : <?=$extend?></font></td>
<td width=198 align=center><font color=<?=$color?>>NPC상성 : <?=$fiction?></font></td>
<td width=198 align=center><font color=<?=$color?>>NPC선택 : <?=$npcmode?></font></td>
</tr>
<?php endif; ?>
<tr height=30>
<td width=198><?=info(2)?></td>
<td width=198>전체 접속자 수 : <?=$gameStor->online_user_cnt?> 명</td>
<td width=198>턴당 갱신횟수 : <?=$gameStor->conlimit?>회</td>
<td width=398 colspan=2><?=info(3)?></td>
</tr>
<tr height=30>
<td style='text-align:center;'>
<?php
if (!$plock) {
echo "<span style='color:cyan;'>동작 시각: ".substr($gameStor->turntime, 5, 14)."</span>";
} else {
echo "<span style='color:magenta;'>동작 시각: ".substr($gameStor->turntime, 5, 14)."</span>";
}
echo "
</td>
<td align=center>
";
if ($gameStor->tournament == 0) {
echo "<font color=magenta>현재 토너먼트 경기 없음</font>";
} else {
switch ($gameStor->tnmt_type) {
case 0: $str = "전력전"; break;
case 1: $str = "통솔전"; break;
case 2: $str = "일기토"; break;
case 3: $str = "설전"; break;
}
$str2 = getTournament($gameStor->tournament);
$str3 = getTournamentTime();
echo "<marquee scrollamount=2>↑<font color=cyan>{$str}</font> {$str2} {$str3}↑</marquee>";
}
echo "
</td>
<td align=center>
";
$auctionCount = $db->queryFirstField('SELECT count(`no`) FROM auction');
if ($auctionCount > 0) {
echo "<marquee scrollamount=2><font color=cyan>{$auctionCount}건</font> 거래 진행중</marquee>";
} else {
echo "<font color=magenta>진행중 거래 없음</font>";
}
echo "
</td>
<td colspan=2 align=center>
";
$vote = $gameStor->vote?:[''];
$vote_title = Tag2Code($gameStor->vote_title??'-');
if ($vote[0] == "") {
echo "<font color=magenta>진행중 설문 없음</font>";
} else {
echo "<marquee scrollamount=3><font color=cyan>설문 진행중</font> : $vote_title</marquee>";
}
echo "
</td>
</tr>";
?>
<tr><td colspan=5 style="text-align:left;">접속중인 국가: <?=$gameStor->online_nation?></td></tr>
<tr><td colspan=5 style="text-align:left;">운영자 메세지 : <span style='color:yellow;'><?=$gameStor->msg?></span></td></tr>
<tr><td colspan=5 style="text-align:left;"><div>【 국가방침 】</div><div><?=nationMsg($generalObj)?></div></td></tr>
<tr><td colspan=5 style="text-align:left;">【 접속자 】<?=onlinegen($generalObj)?></td></tr>
<?php
if ($session->userGrade >= 5) {
?>
<tr><td colspan=5>
<a href='_admin1.php' target='_blank'><button type='button'>게임관리</button></a>
<a href='_admin2.php' target='_blank'><button type='button'>회원관리</button></a>
<a href='_admin4.php' target='_blank'><button type='button'>멀티관리</button></a>
<a href='_admin5.php' target='_blank'><button type='button'>일제정보</button></a>
<a href='_admin7.php' target='_blank'><button type='button'>로그정보</button></a>
<a href='_admin8.php' target='_blank'><button type='button'>외교정보</button></a>
<a href='_119.php' target='_blank'><button type='button'>119</button></a>
</td></tr>
<?php
}
else if($session->userGrade == 4){
?>
<tr><td colspan=5>
<a href='_119.php' target='_blank'><button type='button'>119</button></a>
</td></tr>
<?php
}
?>
</table>
<table class="tb_layout bg0" style="width:1000px;" id='map_position'>
<tr>
<td style='width:700px;height:520px;' colspan=2>
<?=getMapHtml($mapTheme)?>
</td>
<td style='width:300px;vertical-align:top;' rowspan=4>
<div id="reservedCommandList" style='overflow-y:scroll;height:700px;'>
<table width="300" class="tb_layout b2">
<thead>
<tr height="24"><td colspan="4" class="center bg0"
><strong>- 명령 목록 - </strong><input value="<?=TimeUtil::now(false)?>" type="text" id="clock" size="19" style="background-color:black;color:white;border-style:none;"
></td></tr>
</thead>
<tbody class="center" style="font-weight:bold">
<?php for($turnIdx = 0; $turnIdx < GameConst::$maxTurn; $turnIdx++): ?>
<tr height='28' id="command_<?=$turnIdx?>"
><td width="24" class='idx_pad center bg0'><?=$turnIdx+1?></td
><td height='24' class='month_pad center bg1' style='min-width:70px;white-space:nowrap;overflow:hidden;'></td
><td width='42' class='time_pad center' style='background-color:black;white-space:nowrap;overflow:hidden;'></td
><td width='165' class='turn_pad center bg2'><span class='turn_text'></span></td
></tr>
<?php endfor; ?>
</tbody>
</table>
<body class="img_back sam-color-<?= $nationColorType ?>">
<div id="container" class="bg0">
<div class="row toolbars gx-0">
<div class="buttonPlate"><?= allButton($gameStor->npcmode == 1) ?></button></div>
</div>
<div class="tb_layout row gx-0">
<div id="server_title" class="row py-2 center">
<h3>삼국지 모의전투 HiDCHe <?= $serverName . $serverCnt ?>기 <span class="avoid-wrap">(<font color=cyan><?= $scenario ?></font>)</span></h3>
</div>
</td>
</tr>
<tr>
<td rowspan=3 width=50 valign=top><?=turnTable()?></td>
<td style="width:650px;border:none;text-align:center;"><?=cityInfo($generalObj)?></td>
</tr>
<tr>
<td style='width:650px;' align=right>
<font color=cyan><b>←</b> Ctrl, Shift, 드래그로 복수선택 가능  반복&amp;수정<b>→</b></font>
<select id='repeatAmount' name=sel size=1 style=color:white;background-color:black;font-size:13px;>
<option value=1>1턴</option>
<option value=2>2턴</option>
<option value=3>3턴</option>
<option value=4>4턴</option>
<option value=5>5턴</option>
<option value=6>6턴</option>
<option value=7>7턴</option>
<option value=8>8턴</option>
<option value=9>9턴</option>
<option value=10>10턴</option>
<option value=11>11턴</option>
<option value=12>12턴</option>
</select
><input type=button value='반복' id='repeatTurn'
style='background-color:<?=GameConst::$basecolor2?>;color:white;width:70px;font-size:13px;margin-left:1ch;margin-right:2ch;'
><input type=button value='▼미루기' id='pushTurn'
style='background-color:<?=GameConst::$basecolor2?>;color:white;width:80px;font-size:13px;'
><input type=button value='▲당기기' id='pullTurn'
style='background-color:<?=GameConst::$basecolor2?>;color:white;width:80px;font-size:13px;'
></td>
</tr>
<tr>
<td align=right style="width:650px;border:none;"><br>
<?php printCommandTable($generalObj)?>
<input type=button value='실 행' id="reserveTurn"
style='background-color:<?=GameConst::$basecolor2?>;color:white;width:110px;font-size:13px;'
><input type=button value='갱 신' id='refreshPage'
style='background-color:<?=GameConst::$basecolor2?>;color:white;width:110px;font-size:13px;'
><input type=button value='로비로' onclick="location.replace('../')"
style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;font-size:13px;
>
</td>
</tr>
</table>
<table class="tb_layout bg0" style="width:1000px;">
<tr>
<td width=498 style="border:none;"><?php myNationInfo($generalObj); ?></td>
<td width=498 style="border:none;"><?php generalInfo($generalObj); ?></td>
</tr>
<tr><td colspan=2><?=commandButton()?></td></tr>
</table>
<table class="tb_layout bg0" id='history_position'>
<tr>
<td width=498 class='bg1 center'><b>장수 동향</b></td>
<td width=498 class='bg1 center'><b>개인 기록</b></td>
</tr>
<tr>
<td width=498 id="general_public_record" style="text-align:left;"><?=formatHistoryToHTML(getGlobalActionLogRecent(15))?></td>
<td width=498 id="general_log" style="text-align:left;"><?=formatHistoryToHTML(getGeneralActionLogRecent($me['no'], 15))?></td>
</tr>
<tr><td width=998 colspan=2 class='bg1 center'><b>중원 정세</b></td></tr>
<tr><td width=998 id="world_history" colspan=2 style="text-align:left;"><?=formatHistoryToHTML(getGlobalHistoryLogRecent(15))?></td></tr>
</table>
<div class="message_input_form bg0">
<select id="mailbox_list" size="1">
<select name="genlist" size="1" style="color:white;background-color:black;font-size:13px">
<div class="row center gx-0">
<div class="s-border-t col py-2 col-8 col-md-4" style="color:<?= $color ?>;">
<?= $scenario ?>
</div>
<div class="s-border-t col py-2 col-4 col-md-2" style="color:<?= $color ?>;">
NPC수 : <?= $extend ?>
</div>
<div class="s-border-t col py-2 col-4 col-md-2" style="color:<?= $color ?>;">
NPC상성 : <?= $fiction ?>
</div>
<div class="s-border-t col py-2 col-4 col-md-2" style="color:<?= $color ?>;">
NPC선택 : <?= $npcmode ?>
</div>
<div class="s-border-t col py-2 col-4 col-md-2" style="color:<?= $color ?>;">
기타 설정: <?= $otherTextInfo ?>
</div>
<div class="s-border-t col py-2 col-8 col-md-4"><?= info(2) ?></div>
<div class="s-border-t col py-2 col-4 col-md-2">전체 접속자 수 : <?= $gameStor->online_user_cnt ?> 명</div>
<div class="s-border-t col py-2 col-4 col-md-2">턴당 갱신횟수 : <?= $gameStor->conlimit ?>회</div>
<div class="s-border-t col py-2 col-8 col-md-4"><?= info(3) ?></div>
<div class="s-border-t py-2 col col-6 col-md-4"><?php if ($gameStor->tournament == 0) : ?>
<span style='color:magenta'>현재 토너먼트 경기 없음</span>
<?php else : ?>
↑<span style='color:cyan'><?=
([
'전력전', '통솔전', '일기토', '설전',
])[$gameStor->tnmt_type] ?? '' ?> <?= getTournament($gameStor->tournament) ?> <?= getTournamentTime() ?></span>↑
<?php endif; ?>
</div>
<div class="s-border-t py-2 col col-6 col-md-2">
<div style="display:inline-block;"><?= !$plock ? ("<span style='color:cyan;'>동작 시각: " . substr($gameStor->turntime, 5, 14) . "</span>") : ("<span style='color:magenta;'>동작 시각: " . substr($gameStor->turntime, 5, 14) . "</span>") ?></div>
</div>
<div class="s-border-t py-2 col col-6 col-md-2">
<?php if ($auctionCount > 0) : ?>
<span style='color:cyan'><?= $auctionCount ?>건</span> 거래 진행중
<?php else : ?>
<span style='color:magenta'>진행중 거래 없음</span>
<?php endif; ?>
</div>
<div class="s-border-t py-2 col col-6 col-md-4 vote-cell">
<?php
$vote = $gameStor->vote ?: [''];
$vote_title = Tag2Code($gameStor->vote_title ?? '-');
?>
<?php if ($vote[0] == "") : ?>
<span style='color:magenta'>진행중 설문 없음</span>
<?php else : ?>
<span style='color:cyan'>설문 진행중</span> : <span><?= $vote_title ?></span>
<?php endif; ?>
</div>
</div>
<div class="row gx-0">
<div class="col s-border-t px-2 py-2">접속중인 국가: <?= $gameStor->online_nation ?></div>
</div>
<div class="row gx-0">
<div class="col s-border-t px-2 py-2">운영자 메세지 : <span style='color:yellow;'><?= $gameStor->msg ?></span></div>
</div>
<div class="row gx-0">
<div class="col s-border-t py-2" id="nation-msg-position">
<div class="px-2">【 국가방침 】</div>
<div id='nation-msg-box'>
<div id='nation-msg'><?= nationMsg($generalObj) ?></div>
</div>
</div>
</div>
<div class="row gx-0">
<div class="col s-border-t px-2 py-2">
【 접속자 】<?= onlinegen($generalObj) ?>
</div>
</div>
<?php if ($session->userGrade >= 5) : ?>
<div class="row">
<div class="col">
<a href='_admin1.php' target='_blank'><button type='button'>게임관리</button></a>
<a href='_admin2.php' target='_blank'><button type='button'>회원관리</button></a>
<a href='_admin4.php' target='_blank'><button type='button'>멀티관리</button></a>
<a href='_admin5.php' target='_blank'><button type='button'>일제정보</button></a>
<a href='_admin7.php' target='_blank'><button type='button'>로그정보</button></a>
<a href='_admin8.php' target='_blank'><button type='button'>외교정보</button></a>
<a href='_119.php' target='_blank'><button type='button'>119</button></a>
</div>
</div>
<?php elseif ($session->userGrade == 4) : ?>
<div class="row">
<div class="col">
<a href='_119.php' target='_blank'><button type='button'>119</button></a>
</div>
</div>
<?php endif; ?>
<div id="map_view" class="gx-0">
<div id="mapZone" class="view-item"><?= getMapHtml($mapTheme) ?></div>
<div class="view-item" id="reservedCommandZone">
<div id="reservedCommandList"></div>
<div id="actionMiniPlate" class="gx-0 row">
<div class="col">
<div class="gx-1 row">
<div class="col-8 d-grid"><button type='button' class='btn btn-sammo-base2 refreshPage'>갱 신</button></div>
<div class="col-4 d-grid"><button type='button' class='btn btn-sammo-base2' onclick="location.replace('../')">로비로</button></div>
</div>
</div>
</div>
</div>
<div id="cityInfo" class="view-item" style="border:none;text-align:center;"><?= cityInfo($generalObj) ?></div>
<div id="nation-position"><?php myNationInfo($generalObj); ?></div>
<div id="general-position"><?php generalInfo($generalObj); ?></div>
<div id="generalCommandButton" class="row gx-0">
<div class="buttonPlate bg2"><?= commandButton(['btnClass' => 'btn btn-sammo-nation']) ?></div>
</div>
</div>
</div>
<div id="actionMiniPlateSub" class="gx-0 row">
<div class="col">
<div class="gx-1 row">
<div class="col-3 d-grid"><button type='button' class="btn btn-dark" onclick="scrollHardTo('reservedCommandList')">명령으로</button></div>
<div class="col-5 d-grid"><button type='button' class='btn btn-sammo-base2 refreshPage'>갱 신</button></div>
<div class="col-4 d-grid"><button type='button' class='btn btn-sammo-base2' onclick="location.replace('../')">로비로</button></div>
</div>
</div>
</div>
<div class="row gx-0">
<div class="col-md-6" id="general_public_record-position">
<div class="bg1 center s-border-tb"><b>장수 동향</b></div>
<div id="general_public_record" style="text-align:left;"><?= formatHistoryToHTML(getGlobalActionLogRecent(15)) ?></div>
</div>
<div class="col-md-6" id="general_log-position">
<div class="bg1 center s-border-tb"><b>개인 기록</b></div>
<div id="general_log" style="text-align:left;"><?= formatHistoryToHTML(getGeneralActionLogRecent($me['no'], 15)) ?></div>
</div>
<div class="col-12" id="world_history-position">
<div class="bg1 center s-border-tb"><b>중원 정세</b></div>
<div id="world_history" colspan=2 style="text-align:left;"><?= formatHistoryToHTML(getGlobalHistoryLogRecent(15)) ?></div>
</div>
</div>
<div class="row toolbars gx-0">
<div class="buttonPlate"><?= allButton($gameStor->npcmode == 1) ?></div>
</select>
<input type="textarea" id="msg_input" maxlength="99">
<button id="msg_submit">서신전달&amp;갱신</button><br>
내용 없이 '서신전달&amp;갱신'을 누르면 메세지창이 갱신됩니다.
</div>
<div><?=allButton($gameStor->npcmode==1)?></div>
<div id="message_board"><div style="left:0;" class="board_side bg0">
<div class="board_header bg0" id='public_talk_position'>전체 메시지(최고99자)</div>
<section class="public_message">
<button type="button" class="load_old_message btn btn-secondary btn-block" data-msg_type="public">이전 메시지 불러오기</button>
</section>
<div class="board_header bg0" id='secret_talk_position'>개인 메시지(최고99자)</div>
<section class="private_message">
<button type="button" class="load_old_message btn btn-secondary btn-block" data-msg_type="private">이전 메시지 불러오기</button>
</section>
</div><div style="right:0;" class="board_side bg0">
<div class="board_header bg0">국가 메시지(최고99자)</div>
<section class="national_message">
<button type="button" class="load_old_message btn btn-secondary btn-block" data-msg_type="national">이전 메시지 불러오기</button>
</section>
<div class="board_header bg0">외교 메시지(최고99자)</div>
<section class="diplomacy_message">
<button type="button" class="load_old_message btn btn-secondary btn-block" data-msg_type="diplomacy">이전 메시지 불러오기</button>
</section>
</div></div>
<div style="clear:left;"><?=allButton($gameStor->npcmode==1)?><?=banner()?></div>
</div>
<?php
if ($con == 1) {
MessageBox("접속제한이 얼마 남지 않았습니다!");
}
if ($me['newmsg'] == 1) {
MessageBox("새로운 서신이 도착했습니다!");
}
if ($me['newvote'] == 1) {
$develcost = $gameStor->develcost*5;
MessageBox("설문조사에 참여하시면 금{$develcost}과 유니크템을 드립니다! (우측 상단 설문조사 메뉴)");
}
?>
<div id="message_board" class="row gx-0">
<div class="message_input_form bg0 gx-0 row">
<div id="mailbox_list-col" class="col-6 col-md-2 d-grid">
<select id="mailbox_list" size="1" class="form-control bg-dark text-white">
</select>
</div>
<div id="msg_input-col" class="col-12 col-md-8 d-grid">
<input type="text" id="msg_input" maxlength="99" class="form-control">
</div>
<div id="msg_submit-col" class="col-6 col-md-2 d-grid"><button id="msg_submit" class="btn btn-primary">서신전달&amp;갱신</button></div>
</div>
<div class="col-md-6 board_side bg0"><a id="public_talk_position"></a>
<div class="board_header bg0">전체 메시지(최고99자)</div>
<section class="public_message">
<div class="d-grid"><button type="button" class="load_old_message btn btn-secondary" data-msg_type="public">이전 메시지 불러오기</button></div>
</section>
</div>
<div class="col-md-6 board_side bg0"><a id="national_talk_position"></a>
<div class="board_header bg0">국가 메시지(최고99자)</div>
<section class="national_message">
<div class="d-grid"><button type="button" class="load_old_message btn btn-secondary" data-msg_type="national">이전 메시지 불러오기</button></div>
</section>
</div>
<div class="col-md-6 board_side bg0"><a id="private_talk_position"></a>
<div class="board_header bg0">개인 메시지(최고99자)</div>
<section class="private_message">
<div class="d-grid"><button type="button" class="load_old_message btn btn-secondary" data-msg_type="private">이전 메시지 불러오기</button></div>
</section>
</div>
<div class="col-md-6 board_side bg0"><a id="diplomacy_talk_position"></a>
<div class="board_header bg0">외교 메시지(최고99자)</div>
<section class="diplomacy_message">
<div class="d-grid"><button type="button" class="load_old_message btn btn-secondary" data-msg_type="diplomacy">이전 메시지 불러오기</button></div>
</section>
</div>
</div>
<div class="row toolbars gx-0">
<div class="buttonPlate"><?= allButton($gameStor->npcmode == 1) ?></div><?= banner() ?>
</div>
</div>
<?php
if ($con == 1) {
MessageBox("접속제한이 얼마 남지 않았습니다!");
}
if ($me['newmsg'] == 1) {
MessageBox("새로운 서신이 도착했습니다!");
}
if ($me['newvote'] == 1) {
$develcost = $gameStor->develcost * 5;
MessageBox("설문조사에 참여하시면 금{$develcost}과 유니크템을 드립니다! (우측 상단 설문조사 메뉴)");
}
?>
</div>
<nav class="navbar navbar-expand fixed-bottom navbar-dark bg-dark d-sm-block d-md-none p-0" id="navbar500">
<div class="container-fluid">
<div class="collapse navbar-collapse">
<ul class="navbar-nav me-auto mx-auto">
<li class="nav-item dropup">
<div class="dropdown-toggle text-white btn btn-sammo-base2" id="navbarGlobal" role="button" data-bs-toggle="dropdown" aria-expanded="false">
외부 메뉴
</div>
<ul class="dropdown-menu dropdown-menu-start" aria-labelledby="navbarGlobal" id="navbarGlobalItems">
<?= allButton($gameStor->npcmode == 1, ['btnBegin' => '<li>', 'btnEnd' => '</li>', 'btnClass' => 'dropdown-item']) ?>
</ul>
</li>
<li class="nav-item dropup">
<div class="dropdown-toggle btn btn-sammo-nation" id="navbarNation" role="button" data-bs-toggle="dropdown" aria-expanded="false">
국가 메뉴
</div>
<ul class="dropdown-menu" aria-labelledby="navbarNation" id="navbarNationItems">
<?= commandButton(['btnBegin' => '<li>', 'btnEnd' => '</li>', 'btnClass' => 'dropdown-item']) ?>
</ul>
</li>
<li class="nav-item dropup">
<div class="dropdown-toggle text-white btn btn-dark" id="navbarQuick" role="button" data-bs-toggle="dropdown" aria-expanded="false">
빠른 이동
</div>
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown" id="navbarQuickItems">
<li><a class="dropdown-item disabled">국가 정보</a></button></li>
<hr class="dropdown-divider">
</hr>
<li><button type="button" onclick="scrollHardTo('nation-msg-position')" class="dropdown-item">방침</button></li>
<li><button type="button" onclick="scrollHardTo('reservedCommandList')" class="dropdown-item">명령</button></li>
<li><button type="button" onclick="scrollHardTo('nation-position')" class="dropdown-item">국가</button></li>
<li><button type="button" onclick="scrollHardTo('general-position')" class="dropdown-item">장수</button></li>
<li><button type="button" onclick="scrollHardTo('cityInfo')" class="dropdown-item">도시</button></li>
<li><a class="dropdown-item disabled">동향 정보</a></button></li>
<hr class="dropdown-divider">
</hr>
<li><button type="button" onclick="scrollHardTo('mapZone')" class="dropdown-item">지도</button></li>
<li><button type="button" onclick="scrollHardTo('general_public_record-position')" class="dropdown-item">동향</button></li>
<li><button type="button" onclick="scrollHardTo('general_log-position')" class="dropdown-item">개인</button></li>
<li><button type="button" onclick="scrollHardTo('world_history-position')" class="dropdown-item">정세</button></li>
<li><span>&nbsp;</span></li>
<li><a class="dropdown-item disabled">메시지</a></button></li>
<hr class="dropdown-divider">
</hr>
<li><button type="button" onclick="scrollHardTo('public_talk_position')" class="dropdown-item">전체</button></li>
<li><button type="button" onclick="scrollHardTo('national_talk_position')" class="dropdown-item">국가</button></li>
<li><button type="button" onclick="scrollHardTo('private_talk_position')" class="dropdown-item">개인</button></li>
<li><button type="button" onclick="scrollHardTo('diplomacy_talk_position')" class="dropdown-item">외교</button></li>
<li><button type='button' class='btn btn-sammo-base2' onclick="location.replace('../')">로비로</button></li>
</ul>
</li>
<li class="nav-item">
<a class="refreshPage btn btn-sammo-base2 text-white" role="button">갱신</a>
</li>
</ul>
</div>
</div>
</nav>
</body>
</html>
</html>
+228 -333
View File
@@ -1,381 +1,276 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
if(!class_exists('\sammo\DB')){
if (!class_exists('\sammo\DB')) {
header('Location:install_db.php');
}
$session = Session::requireLogin();
$serverName = DB::prefix();
$serverAcl = $session->acl[$serverName]??[];
$serverAcl = $session->acl[$serverName] ?? [];
$allowReset = in_array('reset', $serverAcl);
$allowFullReset = in_array('fullReset',$serverAcl);
$allowReset |= $allowFullReset;
$allowFullReset = in_array('fullReset', $serverAcl);
$allowReset = $allowReset || $allowFullReset;
if($session->userGrade < 5 && !$allowReset){
if ($session->userGrade < 5 && !$allowReset) {
die('관리자 아님');
}
?>
<!DOCTYPE html>
<html>
<head>
<title>설치</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('../e_lib/jquery.validate.min.js')?>
<?=WebUtil::printJS('js/common.js')?>
<?=WebUtil::printJS('js/install.js')?>
<?=WebUtil::printCSS('css/normalize.css')?>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('css/install.css')?>
<title>설치</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printCSS('css/install.css') ?>
<?= WebUtil::printDist('ts', ['common', 'install']) ?>
</head>
<body>
<div class="container" style="min-width:720px;">
<div class="container">
<h1 class="row justify-content-md-center">삼국지 모의전투 HiDCHe 리셋</h1>
<div class="row justify-content-md-center">
<div class="col col-lg-8" >
<div class="card" id="game_form_card">
<h3 class="card-header">
설치(환경 설정)
<!--턴시간, 시간동기화, 시나리오, 상성, 확장장수, NPC유저, 이미지설정-->
</h3>
<div class="card-body">
<form id="game_form" method="post" action="#">
<div class="form-group row">
<label for="turnterm" class="col-sm-3 col-form-label">턴 시간(분)</label>
<div class="col-sm-9">
<div id="turnterm" class="btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-secondary">
<input type="radio" name="turnterm" value="120">120
</label>
<label class="btn btn-secondary active">
<input type="radio" name="turnterm" value="60" checked>60
</label>
<label class="btn btn-secondary">
<input type="radio" name="turnterm" value="30">30
</label>
<label class="btn btn-secondary">
<input type="radio" name="turnterm" value="20">20
</label>
<label class="btn btn-secondary">
<input type="radio" name="turnterm" value="10">10
</label>
<label class="btn btn-secondary">
<input type="radio" name="turnterm" value="5">5
</label>
<label class="btn btn-secondary">
<input type="radio" name="turnterm" value="2">2
</label>
<label class="btn btn-secondary">
<input type="radio" name="turnterm" value="1">1
</label>
</div>
</div>
</div>
<div class="form-group row">
<label for="sync" class="col-sm-3 col-form-label">시간 동기화</label>
<div class="col-sm-9" style="display: inline-flex;">
<div id="sync" class="btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-secondary active">
<input type="radio" name="sync" value="1" checked>Y
</label>
<label class="btn btn-secondary">
<input type="radio" name="sync" value="0">N
</label>
</div>
<small class="text-muted">
시간 단위에 맞게 년/월이 설정됩니다. <br>예: 120분(오전1시=1월), 60분(오전/오후 1시=1월)
</small>
</div>
</div>
<div class="form-group row">
<label for="scenario_sel" class="col-sm-3 col-form-label">시나리오 선택</label>
<div class="col-sm-9">
<select class="form-control" name="scenario" size="1" id="scenario_sel">
</select>
</div>
</div>
<div class="form-group row">
<label for="fiction" class="col-sm-3 col-form-label">NPC 상성</label>
<div class="col-sm-9">
<div id="fiction" class="btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-secondary active">
<input type="radio" name="fiction" value="0" checked>연의
</label>
<label class="btn btn-secondary">
<input type="radio" name="fiction" value="1">가상
</label>
</div>
</div>
</div>
<div class="form-group row">
<label for="extend" class="col-sm-3 col-form-label">확장 NPC</label>
<div class="col-sm-9">
<div id="extend" class="btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-secondary active">
<input type="radio" name="extend" value="1" checked>포함
</label>
<label class="btn btn-secondary">
<input type="radio" name="extend" value="0">미포함
</label>
</div>
</div>
</div>
<div class="form-group row">
<label for="block_general_create" class="col-sm-3 col-form-label">장수 임의 생성</label>
<div class="col-sm-9">
<div id="block_general_create" class="btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-secondary">
<input type="radio" name="block_general_create" value="0" checked>가능
</label>
<label class="btn btn-secondary active">
<input type="radio" name="block_general_create" value="1">불가
</label>
</div>
</div>
</div>
<div class="form-group row">
<label for="npcmode" class="col-sm-3 col-form-label">NPC 빙의</label>
<div class="col-sm-9">
<div id="npcmode" class="btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-secondary">
<input type="radio" name="npcmode" value="1">가능
</label>
<label class="btn btn-secondary active">
<input type="radio" name="npcmode" value="0" checked>불가
</label>
<label class="btn btn-secondary">
<input type="radio" name="npcmode" value="2">선택 생성 가능
</label>
</div>
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 col-form-label">휴식 턴 시 장수 턴</label>
<div class="col-sm-9">
<div class="input-group">
<div class="input-group-prepend btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-secondary">
<input type="checkbox" class="autorun_user_chk" data-key="develop" name="autorun_develop" id="autorun_develop">내정
</label>
<label class="btn btn-secondary">
<input type="checkbox" class="autorun_user_chk" data-key="warp" name="autorun_warp" id="autorun_warp">순간이동
</label>
<label class="btn btn-secondary">
<input type="checkbox" class="autorun_user_chk" data-key="recruit" name="autorun_recruit" id="autorun_recruit">징병
</label>
<label class="btn btn-secondary">
<input type="checkbox" class="autorun_user_chk" data-key="recruit_high" name="autorun_recruit_high" id="autorun_recruit_high">모병
</label>
<label class="btn btn-secondary">
<input type="checkbox" class="autorun_user_chk" data-key="train" name="autorun_train" id="autorun_train">훈사
</label>
<label class="btn btn-secondary">
<input type="checkbox" class="autorun_user_chk" data-key="battle" name="autorun_battle" id="autorun_battle">출병
</label>
<label class="btn btn-secondary">
<input type="checkbox" class="autorun_user_chk" data-key="chief" name="autorun_chief" id="autorun_chief">기본 사령턴
</label>
<div class="col col-lg-8">
<div class="card" id="game_form_card">
<h3 class="card-header">
설치(환경 설정)
<!--턴시간, 시간동기화, 시나리오, 상성, 확장장수, NPC유저, 이미지설정-->
</h3>
<div class="card-body">
<form id="game_form" method="post" action="#">
<div class="form-group row">
<label for="turnterm" class="col-sm-3 col-form-label">턴 시간(분)</label>
<div class="col-sm-9">
<div id="turnterm" class="btn-group btn-group-toggle" data-bs-toggle="buttons">
<input type="radio" class="btn-check" name="turnterm" id="turnterm_120" value="120"><label for="turnterm_120" class="btn btn-secondary">120</label>
<input type="radio" class="btn-check" name="turnterm" id="turnterm_60" value="60" checked><label for="turnterm_60" class="btn btn-secondary">60</label>
<input type="radio" class="btn-check" name="turnterm" id="turnterm_30" value="30"><label for="turnterm_30" class="btn btn-secondary">30</label>
<input type="radio" class="btn-check" name="turnterm" id="turnterm_20" value="20"><label for="turnterm_20" class="btn btn-secondary">20</label>
<input type="radio" class="btn-check" name="turnterm" id="turnterm_10" value="10"><label for="turnterm_10" class="btn btn-secondary">10</label>
<input type="radio" class="btn-check" name="turnterm" id="turnterm_5" value="5"><label for="turnterm_5" class="btn btn-secondary">5</label>
<input type="radio" class="btn-check" name="turnterm" id="turnterm_2" value="2"><label for="turnterm_2" class="btn btn-secondary">2</label>
<input type="radio" class="btn-check" name="turnterm" id="turnterm_1" value="1"><label for="turnterm_1" class="btn btn-secondary">1</label>
</div>
</div>
<div class="input-group-append">
<span class="input-group-text">유효 시간</span>
</div>
<div class="form-group row">
<label for="sync" class="col-sm-3 col-form-label">시간 동기화</label>
<div class="col-sm-9" style="display: inline-flex;">
<div id="sync" class="btn-group btn-group-toggle" data-bs-toggle="buttons">
<input class="btn-check" id="sync_1" type="radio" name="sync" value="1" checked><label class="btn btn-secondary" for="sync_1">Y</label>
<input class="btn-check" id="sync_0" type="radio" name="sync" value="0"><label class="btn btn-secondary" for="sync_0">N</label>
</div>
<small class="text-muted">
시간 단위에 맞게 년/월이 설정됩니다.<br>예: 120분(오전1시=1월), 60분(오전/오후 1시=1월)
</small>
</div>
<select class="custom-select" name="autorun_user_minutes" id="autorun_user_minutes">
<option value="0" selected>꺼짐</option>
<option value="43200">항상</option>
<option value="10">10분</option>
<option value="20">20분</option>
<option value="30">30분</option>
<option value="60">1시간</option>
<option value="120">2시간</option>
<option value="180">3시간</option>
<option value="240">4시간</option>
<option value="360">6시간</option>
<option value="480">8시간</option>
<option value="600">10시간</option>
<option value="720">12시간</option>
<option value="1440">24시간</option>
<option value="2160">36시간</option>
<option value="2880">48시간</option>
<option value="3600">60시간</option>
<option value="4320">72시간</option>
</select>
</div>
</div>
</div>
<!--
<div class="form-group row">
<label class="col-sm-3 col-form-label">휴식 턴 시 사령 턴</label>
<div class="col-sm-9">
<div class="input-group">
<div class="input-group-prepend btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-secondary">
<input type="radio" name="autorun_chief_reward" id="autorun_chief_reward">포상/몰수
</label>
<label class="btn btn-secondary">
<input type="radio" name="autorun_chief_warp" id="autorun_chief_warp">발령
</label>
<label class="btn btn-secondary">
<input type="radio" name="autorun_chief_declaration" id="autorun_chief_declaration">선포
</label>
<div class="form-group row">
<label for="scenario_sel" class="col-sm-3 col-form-label">시나리오 선택</label>
<div class="col-sm-9">
<select class="form-control" name="scenario" size="1" id="scenario_sel">
</select>
</div>
<div class="input-group-append">
<span class="input-group-text">유효 시간</span>
</div>
<div class="form-group row">
<label for="fiction" class="col-sm-3 col-form-label">NPC 상성</label>
<div class="col-sm-9">
<div id="fiction" class="btn-group btn-group-toggle" data-bs-toggle="buttons">
<input type="radio" id="fiction_0" class="btn-check" name="fiction" value="0" checked><label for="fiction_0" class="btn btn-secondary"> 연의 </label>
<input type="radio" id="fiction_1" class="btn-check" name="fiction" value="1"><label for="fiction_1" class="btn btn-secondary"> 가상 </label>
</div>
</div>
<select class="custom-select" name="autorun_chief_minutes" id="autorun_chief_minutes">
<option value="0" selected>꺼짐</option>
<option value="43200">항상</option>
<option value="10">10분</option>
<option value="20">20분</option>
<option value="30">30분</option>
<option value="60">1시간</option>
<option value="120">2시간</option>
<option value="180">3시간</option>
<option value="240">4시간</option>
<option value="360">6시간</option>
<option value="480">8시간</option>
<option value="600">10시간</option>
<option value="720">12시간</option>
<option value="1440">24시간</option>
<option value="2160">36시간</option>
<option value="2880">48시간</option>
<option value="3600">60시간</option>
<option value="4320">72시간</option>
</select>
</div>
</div>
</div>
-->
<div class="form-group row">
<label for="join_mode" class="col-sm-3 col-form-label">임관 모드</label>
<div class="col-sm-9">
<div id="join_mode" class="btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-secondary active">
<input type="radio" name="join_mode" value="full" checked>일반
</label>
<label class="btn btn-secondary">
<input type="radio" name="join_mode" value="onlyRandom">랜덤 임관
</label>
<div class="form-group row">
<label for="extend" class="col-sm-3 col-form-label">확장 NPC</label>
<div class="col-sm-9">
<div id="extend" class="btn-group btn-group-toggle" data-bs-toggle="buttons">
<input type="radio" id="extend_1" class="btn-check" name="extend" value="1" checked><label for="extend_1" class="btn btn-secondary">포함</label>
<input type="radio" id="extend_0" class="btn-check" name="extend" value="0"><label for="extend_0" class="btn btn-secondary">미포함</label>
</div>
</div>
</div>
</div>
</div>
<div class="form-group row">
<label for="show_img_level" class="col-sm-3 col-form-label">이미지 표기</label>
<div class="col-sm-9">
<div id="show_img_level" class="btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-secondary">
<input type="radio" name="show_img_level" value="0">안함
</label>
<label class="btn btn-secondary">
<input type="radio" name="show_img_level" value="1">전콘
</label>
<label class="btn btn-secondary">
<input type="radio" name="show_img_level" value="2">전콘, 병종
</label>
<label class="btn btn-secondary active">
<input type="radio" name="show_img_level" value="3" checked>전콘, 병종, NPC
</label>
<div class="form-group row">
<label for="block_general_create" class="col-sm-3 col-form-label">장수 임의 생성</label>
<div class="col-sm-9">
<div id="block_general_create" class="btn-group btn-group-toggle" data-bs-toggle="buttons">
<input type="radio" class="btn-check" id="block_general_create_0" name="block_general_create" value="0" checked><label for="block_general_create_0" class="btn btn-secondary">가능</label>
<input type="radio" class="btn-check" id="block_general_create_1" name="block_general_create" value="1"><label for="block_general_create_1" class="btn btn-secondary">불가</label>
</div>
</div>
</div>
</div>
</div>
<div class="form-group row">
<label for="tournament_trig" class="col-sm-3 col-form-label">토너먼트 자동 시작<br>경기 단위</label>
<div class="col-sm-9" id="tournament_trig">
<div id="tournament_trig" class="btn-group-toggle btn-group flex-wrap" data-toggle="buttons">
<label class="btn btn-secondary w-25">
<input type="radio" name="tournament_trig" value="0">안함
</label>
<label class="btn btn-secondary w-25">
<input type="radio" name="tournament_trig" value="1">12분(총 5일)
</label>
<label class="btn btn-secondary w-25">
<input type="radio" name="tournament_trig" value="2">7분(총 10시간)
</label>
<label class="btn btn-secondary w-25">
<input type="radio" name="tournament_trig" value="3">3분(총 4시간)
</label>
<label class="btn btn-secondary w-25 active">
<input type="radio" name="tournament_trig" value="4" checked>1분(총 82분)
</label>
<label class="btn btn-secondary w-25">
<input type="radio" name="tournament_trig" value="5">30초(총 41분)
</label>
<label class="btn btn-secondary w-25">
<input type="radio" name="tournament_trig" value="6">15초(총 21분)
</label>
<label class="btn btn-secondary w-25">
<input type="radio" name="tournament_trig" value="7">5초(총 7분)
</label>
<div class="form-group row">
<label for="npcmode" class="col-sm-3 col-form-label">NPC 빙의</label>
<div class="col-sm-9">
<div id="npcmode" class="btn-group btn-group-toggle" data-bs-toggle="buttons">
<input type="radio" id="npcmode_1" class="btn-check" name="npcmode" value="1"><label for="npcmode_1" class="btn btn-secondary"> 가능 </label>
<input type="radio" id="npcmode_0" class="btn-check" name="npcmode" value="0" checked><label for="npcmode_0" class="btn btn-secondary"> 불가 </label>
<input type="radio" id="npcmode_2" class="btn-check" name="npcmode" value="2"><label for="npcmode_2" class="btn btn-secondary"> 선택 생성 가능 </label>
</div>
</div>
</div>
</div>
</div>
<div class="form-group row">
<label for="reserve_open" class="col-sm-3 col-form-label">오픈 예약</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="reserve_open" id="reserve_open" placeholder="YYYY-MM-DD hh:mm" value="" />
</div>
</div>
<div class="form-group row">
<label class="col-sm-3 col-form-label" id="autorun_set_label">휴식 턴 시 장수 턴</label>
<div class="col-sm-9">
<div class="input-group">
<div class="btn-group btn-group-toggle" data-bs-toggle="buttons">
<input type="checkbox" id="autorun_develop" class="autorun_user_chk btn-check" data-key="develop" name="autorun_user[]" value="develop"><label class="btn btn-secondary" for="autorun_develop">내정</label>
<input type="checkbox" id="autorun_warp" class="autorun_user_chk btn-check" data-key="warp" name="autorun_user[]" value="warp"><label class="btn btn-secondary" for="autorun_warp">순간이동</label>
<input type="checkbox" id="autorun_recruit" class="autorun_user_chk btn-check" data-key="recruit" name="autorun_user[]" value="recruit"><label class="btn btn-secondary" for="autorun_recruit">징병</label>
<input type="checkbox" id="autorun_recruit_high" class="autorun_user_chk btn-check" data-key="recruit_high" name="autorun_user[]" value="recruit_high"><label class="btn btn-secondary" for="autorun_recruit_high">모병</label>
<input type="checkbox" id="autorun_train" class="autorun_user_chk btn-check" data-key="train" name="autorun_user[]" value="train"><label class="btn btn-secondary" for="autorun_train">훈사</label>
<input type="checkbox" id="autorun_battle" class="autorun_user_chk btn-check" data-key="battle" name="autorun_user[]" value="battle"><label class="btn btn-secondary" for="autorun_battle">출병</label>
<input type="checkbox" id="autorun_chief" class="autorun_user_chk btn-check" data-key="chief" name="autorun_user[]" value="chief"><label class="btn btn-secondary" for="autorun_chief">기본 사령턴</label>
</div>
</div>
</div>
<div class="col-sm-6 offset-sm-3">
<div class="input-group">
<div class="input-group-text">유효 시간
</div>
<select class="custom-select" name="autorun_user_minutes" id="autorun_user_minutes">
<option value="0" selected>꺼짐</option>
<option value="43200">항상</option>
<option value="10">10분</option>
<option value="20">20분</option>
<option value="30">30분</option>
<option value="60">1시간</option>
<option value="120">2시간</option>
<option value="180">3시간</option>
<option value="240">4시간</option>
<option value="360">6시간</option>
<option value="480">8시간</option>
<option value="600">10시간</option>
<option value="720">12시간</option>
<option value="1440">24시간</option>
<option value="2160">36시간</option>
<option value="2880">48시간</option>
<option value="3600">60시간</option>
<option value="4320">72시간</option>
</select>
</div>
</div>
</div>
<div class="form-group row">
<label for="join_mode" class="col-sm-3 col-form-label">임관 모드</label>
<div class="col-sm-9">
<div id="join_mode" class="btn-group btn-group-toggle" data-bs-toggle="buttons">
<input class="btn-check" id="join_mode_full" type="radio" name="join_mode" value="full" checked><label class="btn btn-secondary" for="join_mode_full">일반</label>
<input class="btn-check" id="join_mode_onlyRandom" type="radio" name="join_mode" value="onlyRandom"><label class="btn btn-secondary" for="join_mode_onlyRandom">랜덤 임관</label>
</div>
</div>
</div>
<div class="form-group row">
<label for="pre_reserve_open" class="col-sm-3 col-form-label">가오픈 예약</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="pre_reserve_open" id="pre_reserve_open" placeholder="YYYY-MM-DD hh:mm" value="" />
</div>
</div>
<div class="form-group row">
<label for="show_img_level" class="col-sm-3 col-form-label">이미지 표기</label>
<div class="col-sm-9">
<div id="show_img_level" class="btn-group btn-group-toggle" data-bs-toggle="buttons">
<input type="radio" id="show_img_level_0" class="btn-check" name="show_img_level" value="0"><label for="show_img_level_0" class="btn btn-secondary">안함</label>
<input type="radio" id="show_img_level_1" class="btn-check" name="show_img_level" value="1"><label for="show_img_level_1" class="btn btn-secondary">전콘</label>
<input type="radio" id="show_img_level_2" class="btn-check" name="show_img_level" value="2"><label for="show_img_level_2" class="btn btn-secondary">전콘, 병종</label>
<input type="radio" id="show_img_level_3" class="btn-check" name="show_img_level" value="3" checked><label for="show_img_level_3" class="btn btn-secondary">전콘, 병종, NPC</label>
</div>
</div>
</div>
<div class="form-group row">
<div class="col-sm-3"></div>
<div class="col-sm-9">
<input type="submit" class="btn btn-primary btn-lg btn-block login-button" value="리셋 개시">
</div>
<div class="form-group row">
<label for="tournament_trig" class="col-sm-3 col-form-label"><span class="text-nowrap">토너먼트 자동 시작</span> <span class="text-nowrap">경기 단위</span></label>
<div class="col-sm-9" id="tournament_trig">
<div id="tournament_trig" class="btn-group-toggle btn-group flex-wrap" data-bs-toggle="buttons">
<input type="radio" class="btn-check" id="tournament_trig_0" name="tournament_trig" value="0"><label for="tournament_trig_0" class="btn btn-secondary w-25">안함</label>
<input type="radio" class="btn-check" id="tournament_trig_1" name="tournament_trig" value="1"><label for="tournament_trig_1" class="btn btn-secondary w-25">12분(총 5일)</label>
<input type="radio" class="btn-check" id="tournament_trig_2" name="tournament_trig" value="2"><label for="tournament_trig_2" class="btn btn-secondary w-25">7분(총 10시간)</label>
<input type="radio" class="btn-check" id="tournament_trig_3" name="tournament_trig" value="3"><label for="tournament_trig_3" class="btn btn-secondary w-25">3분(총 4시간)</label>
<input type="radio" class="btn-check" id="tournament_trig_4" name="tournament_trig" value="4" checked><label for="tournament_trig_4" class="btn btn-secondary w-25">1분(총 82분)</label>
<input type="radio" class="btn-check" id="tournament_trig_5" name="tournament_trig" value="5"><label for="tournament_trig_5" class="btn btn-secondary w-25">30초(총 41분)</label>
<input type="radio" class="btn-check" id="tournament_trig_6" name="tournament_trig" value="6"><label for="tournament_trig_6" class="btn btn-secondary w-25">15초(총 21분)</label>
<input type="radio" class="btn-check" id="tournament_trig_7" name="tournament_trig" value="7"><label for="tournament_trig_7" class="btn btn-secondary w-25">5초(총 7분)</label>
</div>
</div>
</div>
<div class="form-group row">
<label for="reserve_open" class="col-sm-3 col-form-label">오픈 예약</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="reserve_open" id="reserve_open" placeholder="YYYY-MM-DD hh:mm" value="" />
</div>
</div>
<div class="form-group row">
<label for="pre_reserve_open" class="col-sm-3 col-form-label">가오픈 예약</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="pre_reserve_open" id="pre_reserve_open" placeholder="YYYY-MM-DD hh:mm" value="" />
</div>
</div>
<div class="form-group row">
<div class="col-sm-3"></div>
<div class="col-sm-9 d-grid">
<input type="submit" class="btn btn-primary btn-lg btn-block login-button" value="리셋 개시">
</div>
</div>
</form>
</div>
</form>
<h4 class="card-header">시나리오 정보</h4>
<table class="table table-striped">
<colgroup>
<col style="width:100px;">
<col>
</colgroup>
<thead>
<tr>
<th>설정</th>
<th>값</th>
</thead>
<tbody>
<tr>
<th>시작 연도</th>
<td><span id="scenario_begin">180년</span><small id="scenario_begin_with_sync"></small>
</td>
</tr>
<tr>
<th>NPC 수</th>
<td><span id="scenario_npc"></span><span id="scenario_npc_extend"></span></td>
</tr>
<tr>
<th>국가</th>
<td><span id="scenario_nation"></span></td>
</tr>
</tbody>
<tfoot>
<tr>
<td colspan="2">
</td>
</tr>
</tfoot>
</table>
</div>
<!--GAME 폼 끝-->
</div>
<h4 class="card-header">시나리오 정보</h4>
<table class="table table-striped">
<colgroup><col style="width:100px;"><col></colgroup>
<thead>
<tr><th>설정</th><th>값</th>
</thead>
<tbody>
<tr><th>시작 연도</th><td ><span id="scenario_begin">180년</span><small id="scenario_begin_with_sync"></small></td></tr>
<tr><th>NPC 수</th><td><span id="scenario_npc"></span><span id="scenario_npc_extend"></span></td></tr>
<tr><th>국가</th><td><span id="scenario_nation"></span></td></tr>
</tbody>
<tfoot>
<tr><td colspan="2">
</td></tr>
</tfoot>
</table>
</div><!--GAME 폼 끝-->
</div>
</div>
</div>
</body>
</html>
+82 -81
View File
@@ -1,4 +1,5 @@
<?php
namespace sammo;
include "lib.php";
@@ -6,110 +7,110 @@ include "func.php";
$session = Session::requireLogin();
if($session->userGrade < 5){
if ($session->userGrade < 5) {
die('관리자 아님');
}
if($session->userGrade == 5){
if ($session->userGrade == 5) {
die('DB 리셋 권한을 가지고 있지 않습니다.');
}
?>
<!DOCTYPE html>
<html>
<head>
<title>설치</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
<?=WebUtil::printJS('../e_lib/jquery.validate.min.js')?>
<?=WebUtil::printJS('js/common.js')?>
<?=WebUtil::printJS('js/install_db.js')?>
<?=WebUtil::printCSS('css/normalize.css')?>
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
<?=WebUtil::printCSS('css/install.css')?>
<title>설치</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printCSS('css/normalize.css') ?>
<?= WebUtil::printCSS('css/install.css') ?>
<?= WebUtil::printDist('ts', ['common', 'install_db']) ?>
</head>
<body>
<div class="container" style="min-width:720px;">
<h1 class="row justify-content-md-center">삼국지 모의전투 HiDCHe 리셋</h1>
<div class="row justify-content-md-center">
<div class="col col-lg-8" >
<div class="card" id="db_form_card">
<h3 class="card-header">
설치(DB 설정)
</h3>
<div class="card-body">
<form id="db_form" method="post" action="#">
<?php if(class_exists('\\sammo\\DB')): ?>
<div class="form-group row">
<label for="full_reset" class="col-sm-3 col-form-label">이전 DB 초기화</label>
<div class="col-sm-9" style="display: inline-flex;">
<div id="full_reset" class="btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-secondary">
<input type="radio" name="full_reset" value="1">Y
</label>
<label class="btn btn-secondary active">
<input type="radio" name="full_reset" value="0" checked>N
</label>
<div class="col col-lg-8">
<div class="card" id="db_form_card">
<h3 class="card-header">
설치(DB 설정)
</h3>
<div class="card-body">
<form id="db_form" method="post" action="#">
<?php if (class_exists('\\sammo\\DB')) : ?>
<div class="form-group row">
<label for="full_reset" class="col-sm-3 col-form-label">이전 DB 초기화</label>
<div class="col-sm-9" style="display: inline-flex;">
<div id="full_reset" class="btn-group btn-group-toggle" data-bs-toggle="buttons">
<label class="btn btn-secondary">
<input type="radio" name="full_reset" value="1">Y
</label>
<label class="btn btn-secondary active">
<input type="radio" name="full_reset" value="0" checked>N
</label>
</div>
</div>
</div>
<?php else : ?>
<input type="hidden" name="full_reset" value="0">
<?php endif; ?>
<div class="form-group row">
<label for="db_host" class="col-sm-3 col-form-label">DB호스트</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="db_host" id="db_host" placeholder="호스트" value="localhost" />
</div>
</div>
</div>
</div>
<?php else: ?>
<input type="hidden" name="full_reset" value="0">
<?php endif; ?>
<div class="form-group row">
<label for="db_host" class="col-sm-3 col-form-label">DB호스트</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="db_host" id="db_host" placeholder="호스트" value="localhost" />
</div>
</div>
<div class="form-group row">
<label for="db_port" class="col-sm-3 col-form-label">DB포트</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="db_port" id="db_port" placeholder="접속 포트" value="3306" />
</div>
</div>
<div class="form-group row">
<label for="db_id" class="col-sm-3 col-form-label">DB계정</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="db_id" id="db_id" placeholder="DB계정"/>
<small>관리 DB의 계정과는 다른 계정을 권장합니다.</small>
</div>
</div>
<div class="form-group row">
<label for="db_port" class="col-sm-3 col-form-label">DB포트</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="db_port" id="db_port" placeholder="접속 포트" value="3306" />
</div>
</div>
<div class="form-group row">
<label for="db_pw" class="col-sm-3 col-form-label">DB비밀번호</label>
<div class="col-sm-9">
<input type="password" class="form-control" name="db_pw" id="db_pw" placeholder="DB비밀번호"/>
</div>
</div>
<div class="form-group row">
<label for="db_id" class="col-sm-3 col-form-label">DB계정</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="db_id" id="db_id" placeholder="DB계정" />
<small>관리 DB의 계정과는 다른 계정을 권장합니다.</small>
</div>
</div>
<div class="form-group row">
<label for="db_name" class="col-sm-3 col-form-label">DB명</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="db_name" id="db_name" placeholder="DB명(예:sammo_che)"/>
<small>관리 DB와는 다른 DB를 사용해야합니다.</small>
</div>
</div>
<div class="form-group row">
<div class="col-sm-3"></div>
<div class="col-sm-9">
<button type="submit" class="btn btn-primary btn-lg btn-block login-button">설정 파일 생성</button>
</div>
<div class="form-group row">
<label for="db_pw" class="col-sm-3 col-form-label">DB비밀번호</label>
<div class="col-sm-9">
<input type="password" class="form-control" name="db_pw" id="db_pw" placeholder="DB비밀번호" />
</div>
</div>
<div class="form-group row">
<label for="db_name" class="col-sm-3 col-form-label">DB명</label>
<div class="col-sm-9">
<input type="text" class="form-control" name="db_name" id="db_name" placeholder="DB명(예:sammo_che)" />
<small>관리 DB와는 다른 DB를 사용해야합니다.</small>
</div>
</div>
<div class="form-group row">
<div class="col-sm-3"></div>
<div class="col-sm-9">
<button type="submit" class="btn btn-primary btn-lg btn-block login-button">설정 파일 생성</button>
</div>
</div>
</form>
</div>
</form>
</div>
<!--DB 폼 끝-->
</div>
</div><!--DB 폼 끝-->
</div>
</div>
</div>
</body>
</html>
+5 -3
View File
@@ -5,9 +5,11 @@ include('lib.php');
include 'func.php';
$result = [
"generalID"=>null,
"myNationID"=>null,
"isChief"=>false
"generalID"=>0,
"myNationID"=>0,
"isChief"=>false,
"officerLevel"=>0,
"permission"=>0,
];
$session = Session::requireGameLogin([])->setReadOnly();
$userID = Session::getUserID();
-42
View File
@@ -1,42 +0,0 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
WebUtil::requireAJAX();
$session = Session::requireGameLogin([])->setReadOnly();
$generalID = $session->generalID;
$turnAmount = Util::getPost('amount', 'int');
$isRepeat = Util::getPost('is_repeat', 'bool', false);
if($turnAmount == null){
Json::die([
'result'=>false,
'reason'=>'턴이 입력되지 않았습니다.',
]);
}
if(abs($turnAmount) >= GameConst::$maxTurn){
Json::die([
'result'=>false,
'reason'=>'턴 숫자가 올바르지 않습니다.',
]);
}
if($isRepeat){
repeatGeneralCommand($generalID, $turnAmount);
}
else{
pushGeneralCommand($generalID, $turnAmount);
}
Json::die([
'result'=>true,
'reason'=>'success',
]);
+1
View File
@@ -157,6 +157,7 @@ foreach ($customViewColumns as $column => $reqPermission) {
$resultColumns[] = $column;
}
$generalList = [];
foreach ($rawGeneralList as $rawGeneral) {
//General 생성?
-46
View File
@@ -1,46 +0,0 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
$session = Session::requireGameLogin([])->setReadOnly();
$db = DB::db();
$commandList = [];
$gameStor = KVStorage::getStorage($db, 'game_env');
$generalID = $session->generalID;
$rawTurn = $db->queryAllLists('SELECT turn_idx, action, arg, brief FROM general_turn WHERE general_id = %i ORDER BY turn_idx ASC', $generalID);
foreach($rawTurn as [$turn_idx, $action, $arg, $brief]){
$commandList[$turn_idx] = [
'action'=>$action,
'brief'=>$brief,
'arg'=>Json::decode($arg)
];
}
[$turnTerm, $year, $month, $lastExecute] = $gameStor->getValuesAsArray(['turnterm', 'year', 'month', 'turntime']);
$turnTime = $db->queryFirstField('SELECT turntime FROM general WHERE no=%i', $generalID);
if(cutTurn($turnTime, $turnTerm) > cutTurn($lastExecute, $turnTerm)){
//이미 이번달에 실행된 턴이다.
$month++;
if($month >= 13){
$month -= 12;
$year += 1;
}
}
Json::die([
'result'=>true,
'turnTime'=>$turnTime,
'turnTerm'=>$turnTerm,
'year'=>$year,
'month'=>$month,
'date'=>TimeUtil::now(true),
'turn'=>$commandList
]);
-111
View File
@@ -1,111 +0,0 @@
<?php
namespace sammo;
include 'lib.php';
include 'func.php';
WebUtil::requireAJAX();
$session = Session::requireGameLogin([])->setReadOnly();
$userID = $session::getUserID();
$serverID = UniqueConst::$serverID;
$image = $_FILES['img'];
switch ($image['error']) {
case UPLOAD_ERR_OK:
break;
case UPLOAD_ERR_NO_FILE:
Json::die([
'result'=>false,
'reason'=>'파일이 없습니다.'
]);
case UPLOAD_ERR_INI_SIZE:
case UPLOAD_ERR_FORM_SIZE:
Json::die([
'result'=>false,
'reason'=>'업로드된 파일이 지나치게 큽니다.'
]);
default:
Json::die([
'result'=>false,
'reason'=>'업로드되지 않았습니다.'
]);
}
if(!is_uploaded_file($image['tmp_name'])) {
Json::die([
'result'=>false,
'reason'=>'제대로 파일이 업로드되지 않았습니다.'
]);
}
if($image['size'] > 1048576) {
//파일크기 검사
Json::die([
'result'=>false,
'reason'=>'1MB 이하로 올려주세요!'
]);
}
$size = getImageSize($image['tmp_name']);
$imageType = $size[2];
$availableImageType = array('.jpg'=>IMAGETYPE_JPEG, '.png'=>IMAGETYPE_PNG, '.gif'=>IMAGETYPE_GIF);
$newExt = array_search($imageType, $availableImageType, true);
if(!$newExt) {
Json::die([
'result'=>false,
'reason'=>'jpg, gif, png 파일이 아닙니다!'
]);
}
$db = RootDB::db();
$imgStor = KVStorage::getStorage($db, 'img_storage');
$picName = hash_file('md5', $image['tmp_name']);
$newPicName = "$picName$newExt";
$destDir = AppConf::getUserIconPathFS().'/uploaded_image';
$dest = $destDir.'/'.$newPicName;
if(!file_exists($dest)){
if (!file_exists($destDir)) {
mkdir($destDir);
}
if(!is_dir($destDir)) {
Json::die([
'result'=>false,
'reason'=>'버그! 업로드 경로 확인!'
]);
}
if(!is_writable($destDir)){
Json::die([
'result'=>false,
'reason'=>'버그! 업로드 권한 확인!'
]);
}
$dest = $destDir.'/'.$newPicName;
if(!move_uploaded_file($image['tmp_name'], $dest)) {
Json::die([
'result'=>false,
'reason'=>'업로드에 실패했습니다!'
]);
}
}
$storedStatus = $imgStor->$newPicName??[];
$imgKey = "$serverID:$userID";
if(!key_exists($imgKey, $storedStatus)){
$storedStatus[$imgKey] = TimeUtil::now();
}
$imgStor->$newPicName = $storedStatus;
Json::die([
'result'=>true,
'reason'=>'성공',
'path'=>AppConf::getUserIconPathWeb().'/uploaded_image/'.$newPicName
]);
+1 -1
View File
@@ -19,7 +19,7 @@ $serverName = DB::prefix();
$serverAcl = $session->acl[$serverName]??[];
$allowReset = in_array('reset', $serverAcl);
$allowFullReset = in_array('fullReset',$serverAcl);
$allowReset |= $allowFullReset;
$allowReset = $allowReset || $allowFullReset;
$reserve_open = Util::getPost('reserve_open');
if($reserve_open && $reserve_open < date('Y-m-d H:i')){
+1 -1
View File
@@ -9,7 +9,7 @@ $serverName = DB::prefix();
$serverAcl = $session->acl[$serverName]??[];
$allowReset = in_array('reset', $serverAcl);
$allowFullReset = in_array('fullReset',$serverAcl);
$allowReset |= $allowFullReset;
$allowReset = $allowReset || $allowFullReset;
if($session->userGrade < 5 && !$allowReset){
Json::die([
+3 -1
View File
@@ -47,6 +47,8 @@ if($msg === null){
]);
}
$reason = 'success';
$gameStor = KVStorage::getStorage(DB::db(), 'game_env');
$gameStor->cacheAll();
if($msgResponse){
$result = $msg->agreeMessage($general['no'], $reason);
}
@@ -56,6 +58,6 @@ else{
Json::die([
'result' => $result===DiplomaticMessage::ACCEPTED,
'result' => $result!==DiplomaticMessage::INVALID,
'reason' => $reason
]);
+5 -5
View File
@@ -40,7 +40,7 @@ if(count($lastMsgGet) >= 10){
}
catch(\Exception $e){
$lastMsgGet = [];
}
}
}
$lastMsgGet[] = $now;
$session->lastMsgGet = Json::encode($lastMsgGet);
@@ -83,7 +83,7 @@ if($reqType == 'private'){
$nextSequence = $msg->id;
}
return $msg->toArray();
}, Message::getMessagesFromMailBoxOld($generalID, Message::MSGTYPE_PRIVATE, $reqTo, 20));
}, Message::getMessagesFromMailBoxOld($generalID, Message::MSGTYPE_PRIVATE, $reqTo, 15));
}
else if($reqType == 'public'){
$result['public'] = array_map(function(Message $msg)use (&$nextSequence){
@@ -91,7 +91,7 @@ else if($reqType == 'public'){
$nextSequence = $msg->id;
}
return $msg->toArray();
}, Message::getMessagesFromMailBoxOld(Message::MAILBOX_PUBLIC, Message::MSGTYPE_PUBLIC, $reqTo, 20));
}, Message::getMessagesFromMailBoxOld(Message::MAILBOX_PUBLIC, Message::MSGTYPE_PUBLIC, $reqTo, 15));
}
else if($reqType == 'national'){
$result['national'] = array_map(function(Message $msg)use (&$nextSequence){
@@ -99,7 +99,7 @@ else if($reqType == 'national'){
$nextSequence = $msg->id;
}
return $msg->toArray();
}, Message::getMessagesFromMailBoxOld(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_NATIONAL, $reqTo, 20));
}, Message::getMessagesFromMailBoxOld(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_NATIONAL, $reqTo, 15));
}
else{
$result['diplomacy'] = array_map(function(Message $msg)use (&$nextSequence, $permission){
@@ -112,7 +112,7 @@ else{
$values['option']['invalid'] = true;
}
return $values;
}, Message::getMessagesFromMailBoxOld(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_DIPLOMACY, $reqTo, 20));
}, Message::getMessagesFromMailBoxOld(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_DIPLOMACY, $reqTo, 15));
}
Json::die($result);
+6 -6
View File
@@ -26,13 +26,13 @@ if(count($lastMsgGet) >= 10){
}
catch(\Exception $e){
$lastMsgGet = [];
}
}
}
$lastMsgGet[] = TimeUtil::now();
$session->lastMsgGet = Json::encode($lastMsgGet);
if($delayTime){
sleep(0.2);
usleep(200);
}
$session->setReadOnly();
@@ -66,7 +66,7 @@ $result['private'] = array_map(function(Message $msg) use (&$nextSequence, &$min
$lastType = 'private';
}
return $msg->toArray();
}, Message::getMessagesFromMailBox($generalID, Message::MSGTYPE_PRIVATE, 20, $reqSequence));
}, Message::getMessagesFromMailBox($generalID, Message::MSGTYPE_PRIVATE, 15, $reqSequence));
$result['public'] = array_map(function(Message $msg)use (&$nextSequence, &$minSequence, &$lastType){
if($msg->id > $nextSequence){
@@ -77,7 +77,7 @@ $result['public'] = array_map(function(Message $msg)use (&$nextSequence, &$minSe
$lastType = 'public';
}
return $msg->toArray();
}, Message::getMessagesFromMailBox(Message::MAILBOX_PUBLIC, Message::MSGTYPE_PUBLIC, 20, $reqSequence));
}, Message::getMessagesFromMailBox(Message::MAILBOX_PUBLIC, Message::MSGTYPE_PUBLIC, 15, $reqSequence));
$result['national'] = array_map(function(Message $msg)use (&$nextSequence, &$minSequence, &$lastType){
if($msg->id > $nextSequence){
@@ -88,7 +88,7 @@ $result['national'] = array_map(function(Message $msg)use (&$nextSequence, &$min
$lastType = 'national';
}
return $msg->toArray();
}, Message::getMessagesFromMailBox(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_NATIONAL, 20, $reqSequence));
}, Message::getMessagesFromMailBox(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_NATIONAL, 15, $reqSequence));
$result['diplomacy']= array_map(function(Message $msg)use (&$nextSequence, &$minSequence, &$lastType, $permission){
if($msg->id > $nextSequence){
@@ -104,7 +104,7 @@ $result['diplomacy']= array_map(function(Message $msg)use (&$nextSequence, &$min
$values['option']['invalid'] = true;
}
return $values;
}, Message::getMessagesFromMailBox(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_DIPLOMACY, 20, $reqSequence));
}, Message::getMessagesFromMailBox(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_DIPLOMACY, 15, $reqSequence));
if($lastType !== null){
array_pop($result[$lastType]);
+5 -5
View File
@@ -47,7 +47,7 @@ else{
'name', 'leadership', 'strength', 'intel', 'gold','rice',
'troop','officer_level','npc','picture','imgsvr',
'permission','penalty','belong', 'crewtype',
'experience', 'dedication', 'betray', 'dedlevel', 'explevel', 'makelimit',
'experience', 'dedication', 'betray', 'dedlevel', 'explevel', 'makelimit', 'aux',
], 1);
if($general instanceof DummyGeneral){
@@ -104,7 +104,7 @@ function do수뇌임명(General $general, int $targetOfficerLevel):?string{
if($general->getVar('strength') < GameConst::$chiefStatMin){
return '무력이 부족합니다.';
}
}
else{
if($general->getVar('intel') < GameConst::$chiefStatMin){
@@ -175,7 +175,7 @@ function do추방(General $general, int $myOfficerLevel):?string{
$generalName = $general->getVar('name');
$nationID = $general->getNationID();
//추방할사람이 외교권자이면 불가
$permission = checkSecretPermission($general->getRaw());
@@ -252,7 +252,7 @@ function do추방(General $general, int $myOfficerLevel):?string{
]);
$src = new MessageTarget(
$generalID,
$generalID,
$generalName,
$nationID,
$nation['name'],
@@ -260,7 +260,7 @@ function do추방(General $general, int $myOfficerLevel):?string{
GetImageURL($general->getVar('imgsvr'), $general->getVar('picture'))
);
$msg = new Message(
Message::MSGTYPE_PUBLIC,
Message::MSGTYPE_PUBLIC,
$src,
$src,
$str,
+3
View File
@@ -73,6 +73,8 @@ if ($gencount >= $maxgeneral) {
]);
}
$genAux = Json::decode($db->queryFirstField('SELECT aux FROM general WHERE no = %i', $pick)??'{}');
$genAux['pickYearMonth'] = Util::joinYearMonth($year, $month);
//등록 시작
$db->update('general', [
'owner_name'=>$userNick,
@@ -81,6 +83,7 @@ $db->update('general', [
'defence_train'=>80,
'permission'=>'normal',
'owner'=>$userID,
'aux'=>Json::encode($genAux)
], 'owner <= 0 AND npc = 2 AND no = %i', $pick);
if(!$db->affectedRows()){
+1 -36
View File
@@ -2,42 +2,7 @@
namespace sammo;
include "lib.php";
$templates = new \League\Plates\Engine(__DIR__.'/templates');
function getAutorunInfo($autorunOption){
global $templates;
$auto_info = [];
foreach($autorunOption['options'] as $auto_option => $value){
assert($value);
switch($auto_option){
case 'develop': $auto_info['내정'] = '내정'; break;
case 'warp': $auto_info['순간이동'] = '순간이동'; break;
case 'recruit': $auto_info['징병'] = $auto_info['징병']??'징병'; break;
case 'recruit_high': $auto_info['징병'] = '모병'; break;
case 'train': $auto_info['훈사'] = '훈련/사기진작'; break;
case 'battle': $auto_info['출병'] = '출병'; break;
case 'chief': $auto_info['사령턴'] = '사령턴'; break;
}
}
$limit = Util::toInt($autorunOption['limit_minutes']);
if($limit >= 43200){
$auto_info['제한'] = '항상 유효';
}
else if($limit % 60 == 0){
$auto_info['제한'] = ($limit/60).'시간 유효';
}
else{
$auto_info['제한'] = ($limit).'분 유효';
}
$auto_info = join(', ', array_values($auto_info));
return $templates->render('tooltip', [
'text'=>'자율행동',
'info'=>$auto_info,
'style'=>'text-decoration:underline',
'copyable_info'=>true
]);
}
include "func_template.php";
$session = Session::requireLogin([
'game'=>null,

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