Compare commits

...
120 Commits
Author SHA1 Message Date
Hide_D 2c016621b6 game: 군주, 수뇌, 관직 전투력 상향 2022-04-14 01:28:44 +09:00
Hide_D f2a2b338cd fix: 전투 결과가 중복 기록되는 버그 수정 2022-04-13 03:05:23 +09:00
Hide_D 715a66fd35 fix: APIPathGen에서 NumVar, StrVar 동작 오류 2022-04-13 02:49:11 +09:00
Hide_D cc73f8c5d6 game: 베팅 포인트 수령 기준 변경
- 각 단계마다 총 수령액의 1/2씩, 잔여금은 1등상에게로
- 1등이 없는 경우 2등이 1등상+2등상 배분하여 수령
- 4개 선택시 각각, 56.25%, 25%, 12.5%, 6.25%를 나눠가짐
- 정답자가 전혀 없으면 포인트 환불
2022-04-13 02:33:58 +09:00
Hide_D 9b54b2b57d fix: 국가 베팅장에서 화면 이동 시에도 예전 기록이 남는 버그 수정 2022-04-13 02:04:00 +09:00
Hide_D fe4d095f21 game: 수뇌/관직 전투력 보정을 조정
- 수비시, 공격시가 아니라 항시 작동
- 군주: 공격 5%, 피해 -5%
- 참모: 공격 3%, 피해 -3%
- 무장 수뇌: 공격 3%
- 지장 수뇌: 피해 -3%
- 도시 관직: 공격 1.5%, 피해 -1.5%
2022-04-13 01:53:14 +09:00
Hide_D f67fa5c764 misc: JSON.parse 중 any인 것에 type 지정 2022-04-12 22:45:22 +09:00
Hide_D 06249f29cf game: 기병이 돌격 시 궁병 선제에 멈추도록 수정 2022-04-12 22:36:34 +09:00
Hide_D 242efc9ae7 fix: 궁병 수비시 선제로 인해 전투 로그가 두번 출력되는 버그 2022-04-12 22:27:48 +09:00
Hide_D c86572e6f3 game: 궁병에 회피 -5%p 2022-04-12 21:46:57 +09:00
Hide_D 03b458c1b2 game: 궁병에 '선제 사격' 추가
- 공격 시, 상대의 공격력을 1/2로 약화
- 수비 시, '선제 공격' 수행
   - 필살, 계략이 없는 일반 평타 공격
   - 공격자의 총 페이즈는 유지
2022-04-12 21:42:54 +09:00
Hide_D aa2e50366b feat: '선제 페이즈' 도입
- 일종의 '음수' 페이즈
   - 先 표기
   - 수비자 기준
- 내부의 currPhase가 변할 수 있도록 로직 변경
2022-04-12 21:40:49 +09:00
sarsandHide_D 657a47c9ad tournament (#214)
베팅창 QoL 개선

Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/214
Co-authored-by: sars <sarsntony@gmail.com>
Co-committed-by: sars <sarsntony@gmail.com>
2022-04-10 17:46:28 +09:00
Hide_D 5d718bf4ea fix: 약탈발동에 저격특 효과 일부 코드가 남아 있던 버그 수정 2022-04-10 01:52:52 +09:00
Hide_D 082f847b1f game: 과실주(상성)를 대등한 병종에도 발동 2022-04-10 01:17:41 +09:00
Hide_D 54e4d74d0a fix: 장수 생성 페이지 너비 수정 2022-04-08 19:18:51 +09:00
Hide_D 1437d190e5 fix: 세력장수 이름 순에 NPC 정보 반영 2022-04-08 17:21:40 +09:00
Hide_D a95b26551c feat: 통합 세력 장수/암행부 페이지 (#213)
- ag-grid 기반
- 컬럼 사용자 정의 기능 제공
  - 컬럼 재정렬, 고정, 정렬 기능
  - 컬럼 상태 저장, 불러오기
  - 마지막 컬럼 재 사용
- 아이콘, 장수명 클릭 시 특수 기능 제공
  - 기본 세력 장수/암행부에서는 '감찰부'
- 추가 컬럼
  - 최근 전투
  - 전투 수
  - 승리 수
  - 살상률
- API/Nation/GeneralList 추가

Co-authored-by: hide_d <hided62@gmail.com>
Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/213
2022-04-08 02:28:58 +09:00
Hide_D c96f6d9381 fix: 초성 오토마타에서 head가 제때 정리되지 않는 버그 2022-04-06 02:41:24 +09:00
Hide_D c7df50d899 fix: vue-tsc 에러 반영 2022-04-05 23:06:58 +09:00
sars 29619ada08 유산 소모에 (필요 포인트가 피보나치식으로 증가합니다) 메세지 추가 2022-04-04 09:51:37 -07:00
Hide_D 222c8a25a4 fix: 최근 실행 턴이 '선택 해제된 턴'을 따르지 않는 버그 수정 2022-04-04 21:40:54 +09:00
sars eac9b7c2e2 오타 수정 (@/SammoAPI에서 ./SammoAPI)로 2022-04-04 00:19:32 -07:00
Hide_D 31d6349d71 fix,refac: ETag 오기록 수정, Cache 설정을 WebUtil로 2022-04-04 01:44:35 +09:00
Hide_D b67f4daf3a refac: 장수 생성페이지 GetConst 활용 2022-04-03 23:14:19 +09:00
Hide_D 81b81d9036 feat: Global/GetConst API의 Store파트 2022-04-03 23:13:31 +09:00
Hide_D 2d06f368f8 refac: APICall에 타입 지정
- 비 undefined 타입에서 ?타입 호출 제거
- API 소속 type들을 defs/API/ 로 이동
- 모든 SammoAPI, SammoRootAPI 지정
2022-04-03 18:16:53 +09:00
Hide_D d0dc0f2bd1 fix: SammoAPICall에서 arg가 지정되어도 undefined가 가능한 버그 2022-04-03 17:15:36 +09:00
Hide_D e301c0fd3e refac: SammoAPI에 타입 지정 2022-04-03 02:17:14 +09:00
Hide_D 5879661267 refac, feat: API 호출 구조 재작성
- api.php에서 param path 강제
- api.php에서 GET param 허용
- SammoAPI 호출자를 axios에서 fetch 기반(ky)로 변경
- SammoAPI에서 단순 POST대신 REST에 따라 지정 가능하도록 재구성
- SammoAPI에서 NumVar, StrVar를 PathParam으로 변경하도록 변경
- API CallType들을 def/API로 분리 시작
  - 일부 API를 시험삼아 변경(login)
2022-04-02 23:31:05 +09:00
Hide_D ad1f070557 feat: 정적 변수를 반환하는 API 추가 Global/GetConst 2022-04-02 18:42:13 +09:00
Hide_D c20986b7b7 misc: BaseNation에서도 getInfo fallback 추가 2022-04-02 18:40:58 +09:00
Hide_D 153f425c99 refac: APIHelper 반환 값 정리 2022-04-02 18:39:47 +09:00
Hide_D 6eb202d4b2 misc: api cache max-age 단축
- 실제 캐시는 etag와 last-modified의 304 반환 활용
- http 2.0을 목표로하므로 큰 문제는 없을 것
2022-04-02 03:12:38 +09:00
Hide_D f7e46e16a3 fix: cache control에서 expires가 남는 문제 수정 2022-04-02 01:17:08 +09:00
Hide_D 36d7e22040 fix: api.php 설정이 전혀 동작하지 않던 문제 수정 2022-04-02 01:14:46 +09:00
Hide_D b24c4806f5 fix: APIHelper에서 tryCache가 잘못된 타입 지정인 버그 2022-04-01 23:27:04 +09:00
Hide_D 8ab79ad9f4 fix: 악질유저무쌍(비급) 시나리오 누락 2022-03-31 19:57:49 +09:00
Hide_D 4f4533e533 refac: linter 관련 설정 변경 및 적용, map_theme 변수 제거
- eslint에 prettier 조합
- prettierrc에 width 120, tabWidth 2
- gameStor->map_theme 제거
- map_theme, mapTheme를 GameConst::$mapName으로 대체
- eslint에서 vue/vue3-essential 대신 vue3-recommended 적용
  - vue/max-attributes-per-line 완화
  - vue/v-on-event-hyphenation 해제
  - vue/attribute-hyphenation 해제
- 일부 tsc import type warning 해결
- 일부 vue template type warning 해결
- 일부 vue SFC를 script setup으로 변경
  - TipTap
  - TopBackBar
  - BottomBackBar
  - BoardArticle
  - ProcessCity
2022-03-29 02:06:47 +09:00
Hide_D e569ffe8f4 build: eslint에서 vue/setup-compiler-macros 활성화
- 필요없어진 import 제거
2022-03-28 22:31:10 +09:00
Hide_D e09709651c fix: 지급률 계산식에서 부대장이 포함되는 버그 수정 2022-03-28 01:15:20 +09:00
Hide_D 39d7b6d55c fix: 1인국 n장 군주일때 발생하는 버그 수정
- 12월, 6월 지급률 계산 시
2022-03-28 01:11:05 +09:00
Hide_D 2b2a328062 game: 계략 성공률 한도를 50%로 제한 2022-03-27 16:55:47 +09:00
Hide_D 65e1495b44 fix: 베팅 대상에 들어가지 않은 국가가 성공 대상인 경우 버그
- purifyBettingKey에서 '해당 국가 없음' 에러를 내지 않도록 변경
2022-03-27 13:11:08 +09:00
Hide_D 3400f5843e game: 도기 판매시 국고와 개인 재산으로 반반씩 2022-03-27 03:54:37 +09:00
Hide_D e580691c1d fix: 백성동원 전략 사용시 국가 열전에 잘못된 양식으로 기록되는 버그 수정 2022-03-27 03:21:55 +09:00
Hide_D bb0e817943 game: 누락된 NPC 비중 수식 반영 2022-03-27 02:49:37 +09:00
Hide_D b7e4db6acd game: 랜임시 유저장 비중 보정
- NPC가 많은 국가가 기존보다 살짝 더 강해짐
- 여전히 유저 위주국가보다 불리
2022-03-27 00:50:03 +09:00
Hide_D 366fe5d613 refac: 시계부분을 분리하여 vue render 최적화 2022-03-27 00:06:40 +09:00
Hide_D 428f2706c3 feat: 최근 실행턴의 중복 관리를 개선 2022-03-26 23:44:01 +09:00
Hide_D 7f2b4596f7 fix: 사령부에서 최근 턴 저장 안되는 버그 수정 2022-03-26 23:30:20 +09:00
Hide_D ab9bdf3822 feat: 사령부의 턴 선택기에 고급 모드 적용 (#212)
- 사령부 턴 페이지를 vue3 setup 형태로 변경
- 턴 조작기 함수 중 공용 함수 분리
- 사령부 턴 조작기 코드 범위를 다시 조정
- 사령부 일반 모드, 고급 모드 이원화
- 사령부에서 다른 수뇌의 턴 '복사하기' 제공

Co-authored-by: Hide_D <hided62@gmail.com>
Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/212
Co-authored-by: hide_d <hided62@gmail.com>
Co-committed-by: hide_d <hided62@gmail.com>
2022-03-26 23:11:58 +09:00
Hide_D 585667dfe8 fix: 토너먼트 참가시 한쪽 슬롯이 가득 차면 입장이 닫히는 버그 2022-03-26 17:01:59 +09:00
Hide_D 151e6ed1f3 fix: 세력일람 확장에서 NPC 색상이 고정되는 버그 수정 2022-03-26 02:36:39 +09:00
Hide_D 0685d1caac fix: APIPathGen에서 Var 모드 사용시 에러 2022-03-26 00:04:18 +09:00
Hide_D f50ba83d31 fix: APIPathGen 호출 시 중간 경로 캐싱시 버그 수정 2022-03-25 23:50:41 +09:00
Hide_D 24c043386d refac: SammoAPI Path 정의에 NumVar, StrVar 추가 2022-03-25 23:29:10 +09:00
Hide_D 9d868cb2f4 refac: SammoAPI에서 인자, 반환 타입을 사전 지정 가능 2022-03-25 22:48:34 +09:00
Hide_D be308fdb4a fix: 불가침제의를 원래 의도대로 6개월로 변경 2022-03-24 10:59:04 +09:00
Hide_D 73a5f5287b fix: 중원 정보 표기 에러 수정 시도 2022-03-24 10:37:25 +09:00
Hide_D acafb15215 feat: 여러턴 예약을 ReserveBulkdCommand로 대체 2022-03-24 00:34:05 +09:00
Hide_D 79b9e1b22a fix: 연감 staticValues 중복 2022-03-23 23:51:29 +09:00
Hide_D 7ebdef3116 fix: 연감 표기를 staticValues export에 따라 수정 2022-03-23 23:45:29 +09:00
Hide_D a3fbaa0038 fix: 에러 로그에 따라 수정
- 임관, 하야 등에서 탑승 부대 해제
- 외교 서신 회수시 warning
- DummyGeneral에서 능력치 참조 시.
2022-03-23 23:40:50 +09:00
Hide_D fea2163a01 fix: 세력도시 style 문법 오류 2022-03-23 23:18:00 +09:00
Hide_D d55443968f fix: 세력도시 style 문법 오류 2022-03-23 23:15:11 +09:00
Hide_D b08a2681a2 feat: 세력도시에서 수입 정보 표기, NPC 색 누락분 수정 2022-03-23 23:13:28 +09:00
Hide_D 48af7e5e76 fix: 커맨드 선택시 '간이 복사' 기능이 남아있던 버그 2022-03-23 22:07:59 +09:00
Hide_D 98f48441c9 game: 내정 1% 감소 후, 세율 반영하도록 변경 2022-03-23 20:26:07 +09:00
Hide_D 65f2836379 game: 악질유저무쌍! 시나리오 추가 2022-03-23 20:20:48 +09:00
Hide_D 3548d4e939 feat: 턴 선택기를 재 작성 (#211)
- select form에서 유사 dialog 버튼 방식으로 변경
  - 카테고리마다 페이지 이동
- 일반 모드 / 고급 모드 분리
- 일반 모드에서는 턴별 즉시 설정
- 고급 모드에서는 드래그를 포함한 각종 기능 제공
  - 최근 실행 턴
  - 잘라내기, 복사하기, 붙여넣기
  - 반복하기
  - 비우기
  - 지우고 당기기, 뒤로 밀기
  - 보관하기, 보관한 턴 사용하기

Co-authored-by: Hide_D <hided62@gmail.com>
Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/211
Co-authored-by: hide_d <hided62@gmail.com>
Co-committed-by: hide_d <hided62@gmail.com>
2022-03-23 20:13:27 +09:00
Hide_D eb03f34a7e fix: 이미지 안올라가는 버그 수정 2022-03-23 01:01:47 +09:00
Hide_D 40b1a9fbdf build: bootstrap-vue-3
- tiptap/CustomImage 정의 문제 수정
- useToast() 관련 문제 수정
2022-03-20 18:37:38 +09:00
Hide_D 76a31acadc build: tsconfig 변경
- 반영된 룰에 맞게 import type 적용
2022-03-20 12:45:05 +09:00
Hide_D 0f71d786f7 fix: 빙의에서 장수 목록 보기를 사용할 수 없음 2022-03-20 12:14:20 +09:00
sars fec2508091 토너먼트 하이라이트와 토너먼트 액티브를 따로 변수로 저장 2022-03-16 23:10:54 -07:00
sars 4f087754e2 참가중일때만 토너먼트 액티브 설정 2022-03-16 20:24:12 -07:00
sars 520dbb23f2 Merge branch 'devel' of ssh://storage.hided.net:2525/devsam/core into devel 2022-03-16 12:12:46 -07:00
sars e8f2538510 토너먼트와 베팅장 하이라이트하기. (모바일에서 dropdown-item에서는 아직 적용 못함) 2022-03-16 12:09:29 -07:00
Hide_D fa6b271994 refac: schema.sql COLLATE, json_valid 지정 2022-03-16 23:44:12 +09:00
Hide_D c4aa6b4ffc game: 조기 은퇴 커맨드 추가 2022-03-16 01:30:47 +09:00
Hide_D 4bb1bac5d1 game: 유저장 자동 금쌀매매 기준 추가 변경 2022-03-16 00:38:18 +09:00
Hide_D 79815f99fc game: 유저장 자동 금쌀매매 기준 변경
- 3번 전멸하는 동안 필요한 금쌀을 모두 가지고 있을 경우 군량매매하지 않음
2022-03-16 00:02:38 +09:00
Hide_D 1342fb5cc1 game: 천통국 결정 시 자동으로 임관 금지 설정 2022-03-15 23:43:43 +09:00
Hide_D eae488b44f feat: BlockScoutAction Action 추가
- 모든 국가의 임관 설정을 임의 설정하는 이벤트 액션
2022-03-15 23:20:28 +09:00
sars 72200683fe serverNameWithCount를 serverName과 serverCnt로 나눔 2022-03-14 19:39:35 -07:00
sars c506d608c2 Merge branch 'devel' of ssh://storage.hided.net:2525/devsam/core into devel 2022-03-14 14:07:01 -07:00
sars 69348680d5 서버 이름과 횟수를 printStaticValue에 추가 2022-03-14 14:06:08 -07:00
Hide_D f6b359955d game,fix: 백이병 vs 정란, 벽력거 공격 상성 관련 문제 수정 2022-03-14 22:27:13 +09:00
Hide_D 0d4a68daea misc: gitignore update 2022-03-14 22:13:06 +09:00
sars dfff94f319 동결상태를 isLocked로 printStaticValue에 추가 2022-03-14 03:42:04 -07:00
sars 8cff55b5ed lastExecuted를 printStaticValues에 추가 2022-03-14 03:07:16 -07:00
Hide_D d61143c2ad misc: README 변경 2022-03-13 21:40:53 +09:00
Hide_D 1afe999beb Merge pull request 'feat: php vendor를 동적으로 구성하도록 변경' (#209) from no_php_vendor_code into devel
Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/209
2022-03-13 21:15:42 +09:00
Hide_D 0dd3def0d5 fix: composer 준비 전에도 j_install_status가 응답해야함 2022-03-13 21:03:39 +09:00
Hide_D 0a1d81be76 fix: Web UI로 초기 install이 불가능한 버그 수정 2022-03-13 20:16:54 +09:00
Hide_D 91ea0d1c2a build: 빌드 환경 재 설정
- lock에 따라 npm ci로 변경
- webpack build를 서버 내에서 하므로 dev dependency가 거의 없음
- webpack build에서 gateway build를 별도로 작성
2022-03-13 19:47:24 +09:00
Hide_D 5fe9136aa1 fix: 초기 index.php에서 vendor/autoload.php 검사 2022-03-13 19:06:31 +09:00
Hide_D 3ef91d3617 feat: install에서 composer update도 수행. update 기준 변경
- lock file을 git에 추가하였으므로, 이에 따름
2022-03-13 18:56:29 +09:00
Hide_D 0aa73c2f62 dep: vendor directory 제거 2022-03-13 18:33:09 +09:00
Hide_D d8ad26f83c dep: composer update 2022-03-13 16:55:04 +09:00
Hide_D 85a9f127bd fix: oauth_kakao에서 누락된 userID 반영 2022-03-13 13:46:13 +09:00
Hide_D edd5248d50 fix: COMPRESSED 타입 table 제거 2022-03-13 13:42:40 +09:00
Hide_D 892d13212d dep: npm package update. package-lock.json 해제 2022-03-13 01:59:55 +09:00
Hide_D 0ab485f122 feat: 해시 기반 간이 DRBG, 그에 기반한 RandUtil (#208)
기존의 Util 내의 함수는 mt_rand에 기반하고 있어서 일반적으론 충분하지만,
게임 내부에서 랜덤 값을 정교하게 제어하고 싶은 경우에는 적절하지 않았음.

따라서 직접 seed를 제어할 수 있는 난수생성기를 추가.
SHA512(seed || blockIdx) 의 형태로 동작하는 DRBG이며, FIPS 표준을 따르는 RNG는 아니지만 암호학적으로 안전한 형태로 구현함.

PHP, TS 두가지 형태로 구현.

Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/208
Co-authored-by: hide_d <hided62@gmail.com>
Co-committed-by: hide_d <hided62@gmail.com>
2022-03-12 23:53:16 +09:00
Hide_D c220b3d511 game: 정란 상성 공격력 상향, 차병 비용 절감 2022-03-12 20:11:36 +09:00
Hide_D 57bb22497e game: 이세계무쌍- 유저무쌍 멀티 유니버스 수정 2022-03-10 23:12:47 +09:00
Hide_D 1ae95ba4bc feat: NPC 추방,몰수, 고유메시지 빈도를 GameConst에서 조절 2022-03-10 23:11:56 +09:00
Hide_D 90b3684cdb game: 이세계무쌍 비급 시나리오 추가 2022-03-08 22:07:19 +09:00
Hide_D 15d6c427eb game: 이세계무쌍 시나리오 등록 2022-03-08 21:58:23 +09:00
Hide_D c68a428bf5 feat: 유닛테스트 준비 2022-03-03 00:16:01 +09:00
Hide_D a289b192e4 dep: typescript test 기반 추가 2022-03-02 23:31:32 +09:00
Hide_D 356f3af919 dep: phpunit 추가 2022-03-02 23:29:09 +09:00
Hide_D a660ec4cca fix: 커맨드 실행 조건 강제 탈출 조건을 잘못 작성하는 버그 수정 2022-03-01 12:29:21 +09:00
sars 4c9ddcb272 $general->getVar('nation')로 수정 2022-02-25 20:19:56 -08:00
sars 5131a36e20 general -> $general, 오타수정 2022-02-25 20:16:48 -08:00
sars 87c055563d 급하게 도기 코드 수정, 냐섭에서 테스트할 예정 2022-02-25 20:09:03 -08:00
sars 124c27cf17 동결풀기위해 도기템을 임시로 일단 주석처리함 2022-02-25 19:41:10 -08:00
Hide_D 4f0dbf0f92 feat: api.php 호출에서 path를 경로로 지정하는 방식 추가 2022-02-25 01:54:22 +09:00
Hide_D 6e24ca230d fix: 연감 static var 출력 버그 수정 2022-02-25 01:24:02 +09:00
4137 changed files with 39017 additions and 568648 deletions
+16 -4
View File
@@ -3,20 +3,23 @@ module.exports = {
parser: "vue-eslint-parser",
"env": {
"browser": true,
"es2021": true
"es2021": true,
'vue/setup-compiler-macros': true
},
ignorePatterns: ['*.test.ts', '.eslintrc.cjs', 'postcss.config.cjs', 'webpack.config.cjs', '*.js'],
overrides: [{
files: ['*.ts', '*.tsx', "*.vue"],
}],
plugins: [
"@typescript-eslint"
"@typescript-eslint",
"prettier"
],
extends: [
"eslint:recommended",
"plugin:vue/vue3-essential",
"plugin:@typescript-eslint/recommended"
"plugin:vue/vue3-recommended",
"plugin:@typescript-eslint/recommended",
"prettier",
],
parserOptions: {
"sourceType": "module",
@@ -27,6 +30,15 @@ module.exports = {
},
rules: {
'@typescript-eslint/no-floating-promises': 'error',
'vue/script-setup-uses-vars': 'error',
'vue/max-attributes-per-line': [
'warn',
{
singleline: 4, //prettier와 싸우지 말자
},
],
'vue/v-on-event-hyphenation': 'off', //vue3에선 필요없다고 생각
'vue/attribute-hyphenation': 'off', //vue3에선 필요없다고 생각
},
settings: {
'import/resolver': {
+6 -9
View File
@@ -5,8 +5,6 @@
!.vscode/extensions.json
/node_modules
package-lock.json
# 체섭 ignore
*.log
@@ -19,10 +17,7 @@ sess_*
*/logs/*/*.txt
*/logs/preserved
err.txt
che/.htaccess
kwe/.htaccess
pwe/.htaccess
twe/.htaccess
hwe/.htaccess
d_shared
@@ -47,7 +42,7 @@ d_setting/*.php
*/d_setting/templates/*.php
!*.orig.php
*/data/file_cache
**/data/file_cache
**/old/*
test.*
@@ -59,11 +54,13 @@ test.*
/pya
/twe
/hwe/data
/vendor
phpinfo.php
vendor/ezyang/htmlpurifier/library/HTMLPurifier/DefinitionCache/*
*.sqlite3
ingame/js/*
ingame/css/*
gateway/js/*
gateway/css/*
gateway/css/*
+12
View File
@@ -0,0 +1,12 @@
{
"extension": ["ts"],
"spec": "hwe/test-ts/**/*.test.ts",
"require": [
"ts-node/register",
"tsconfig-paths/register"
],
"node-option": [
"experimental-specifier-resolution=node",
"loader=ts-node/esm"
]
}
+1 -2
View File
@@ -101,8 +101,7 @@ return [
'hwe/j_general_set_permission.php',
'hwe/j_get_basic_general_list.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',
+5
View File
@@ -0,0 +1,5 @@
{
"tabWidth": 2,
"useTabs": false,
"printWidth": 120
}
+2 -1
View File
@@ -13,7 +13,7 @@
"/nya":true,
"/pya":true,
"/twe":true,
},
"search.exclude": {
"e_lib/*":true,
@@ -29,4 +29,5 @@
"josa",
"sammo"
],
"editor.tabSize": 2
}
+4 -4
View File
@@ -26,20 +26,20 @@ Docker를 이용한 설치도 제공하고 있습니다.
## Docker를 이용한 설치
https://storage.hided.net/gogs/devsam/docker 를 참고해 주세요.
https://storage.hided.net/gitea/devsam/docker 를 참고해 주세요.
## 수동 설치
본 게임은 <code>git</code>을 이용한 업그레이드 시스템을 구현하였으므로, <code>git</code>이 필요합니다.
또한 웹 서비스 데몬을 운영중인 사용자(일반적으로 <code>www-data</code>, <code>apache</code>)에게 디렉토리 권한이 주어져야합니다.
또한 웹 서비스 데몬을 운영중인 사용자(일반적으로 <code>www-data</code>)에게 디렉토리 권한이 주어져야합니다.
### 다운로드
웹 데몬 user가 <code>www-data</code>인 경우 다음과 같이 입력하여 최신 배포버전과 이미지 파일을 얻을 수 있습니다.
```
sudo -u www-data git clone https://storage.hided.net/gogs/devsam/core.git
sudo -u www-data git clone https://storage.hided.net/gogs/devsam/image.git
sudo -u www-data git clone https://storage.hided.net/gitea/devsam/core.git
sudo -u www-data git clone https://storage.hided.net/gitea/devsam/image.git
```
> 이미지는 hook/git_hook.php을 통해 동기화되며, 서버 설치 과정에 이미지 갱신 키를 지정하는 것으로 '훼' 서버 업데이트 시 동기화됩니다. 이미지 서버가 게임 서버와 별개여도 동작하나, php와 git을 지원해야합니다.
+5 -1
View File
@@ -8,5 +8,9 @@ require(__DIR__ . '/vendor/autoload.php');
if (!class_exists('\\sammo\\RootDB')) {
Json::dieWithReason('No DB');
}
$eParams = $_GET;
if(key_exists('path', $eParams)){
unset($eParams['path']);
}
APIHelper::launch(dirname(__FILE__));
APIHelper::launch(dirname(__FILE__), $_GET['path']??'', $eParams, true);
+5 -4
View File
@@ -35,21 +35,22 @@
"autoload": {
"psr-4": {
"sammo\\": [
"d_setting",
"src/sammo"
],
"kakao\\": [
"d_setting",
"src/kakao"
]
},
"classmap": [
"d_setting/"
],
"exclude-from-classmap": [
"**/*.orig.php"
],
"files":[
"f_config/config.php"
]
},
"require-dev": {
"phpunit/phpunit": "^9.5"
}
}
Generated
+1799 -2
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "1983b89436fd8017db508592ddf542e4",
"content-hash": "2b7ec5f1a1a908310f3d032f294eacec",
"packages": [
{
"name": "brandonwamboldt/utilphp",
@@ -4228,7 +4228,1804 @@
"time": "2019-08-07T17:19:21+00:00"
}
],
"packages-dev": [],
"packages-dev": [
{
"name": "doctrine/instantiator",
"version": "1.4.0",
"source": {
"type": "git",
"url": "https://github.com/doctrine/instantiator.git",
"reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/instantiator/zipball/d56bf6102915de5702778fe20f2de3b2fe570b5b",
"reference": "d56bf6102915de5702778fe20f2de3b2fe570b5b",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"require-dev": {
"doctrine/coding-standard": "^8.0",
"ext-pdo": "*",
"ext-phar": "*",
"phpbench/phpbench": "^0.13 || 1.0.0-alpha2",
"phpstan/phpstan": "^0.12",
"phpstan/phpstan-phpunit": "^0.12",
"phpunit/phpunit": "^7.0 || ^8.0 || ^9.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Doctrine\\Instantiator\\": "src/Doctrine/Instantiator/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Marco Pivetta",
"email": "ocramius@gmail.com",
"homepage": "https://ocramius.github.io/"
}
],
"description": "A small, lightweight utility to instantiate objects in PHP without invoking their constructors",
"homepage": "https://www.doctrine-project.org/projects/instantiator.html",
"keywords": [
"constructor",
"instantiate"
],
"support": {
"issues": "https://github.com/doctrine/instantiator/issues",
"source": "https://github.com/doctrine/instantiator/tree/1.4.0"
},
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
"type": "custom"
},
{
"url": "https://www.patreon.com/phpdoctrine",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Finstantiator",
"type": "tidelift"
}
],
"time": "2020-11-10T18:47:58+00:00"
},
{
"name": "myclabs/deep-copy",
"version": "1.10.2",
"source": {
"type": "git",
"url": "https://github.com/myclabs/DeepCopy.git",
"reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/776f831124e9c62e1a2c601ecc52e776d8bb7220",
"reference": "776f831124e9c62e1a2c601ecc52e776d8bb7220",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"replace": {
"myclabs/deep-copy": "self.version"
},
"require-dev": {
"doctrine/collections": "^1.0",
"doctrine/common": "^2.6",
"phpunit/phpunit": "^7.1"
},
"type": "library",
"autoload": {
"files": [
"src/DeepCopy/deep_copy.php"
],
"psr-4": {
"DeepCopy\\": "src/DeepCopy/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"description": "Create deep copies (clones) of your objects",
"keywords": [
"clone",
"copy",
"duplicate",
"object",
"object graph"
],
"support": {
"issues": "https://github.com/myclabs/DeepCopy/issues",
"source": "https://github.com/myclabs/DeepCopy/tree/1.10.2"
},
"funding": [
{
"url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy",
"type": "tidelift"
}
],
"time": "2020-11-13T09:40:50+00:00"
},
{
"name": "nikic/php-parser",
"version": "v4.13.2",
"source": {
"type": "git",
"url": "https://github.com/nikic/PHP-Parser.git",
"reference": "210577fe3cf7badcc5814d99455df46564f3c077"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/210577fe3cf7badcc5814d99455df46564f3c077",
"reference": "210577fe3cf7badcc5814d99455df46564f3c077",
"shasum": ""
},
"require": {
"ext-tokenizer": "*",
"php": ">=7.0"
},
"require-dev": {
"ircmaxell/php-yacc": "^0.0.7",
"phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0"
},
"bin": [
"bin/php-parse"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.9-dev"
}
},
"autoload": {
"psr-4": {
"PhpParser\\": "lib/PhpParser"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Nikita Popov"
}
],
"description": "A PHP parser written in PHP",
"keywords": [
"parser",
"php"
],
"support": {
"issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v4.13.2"
},
"time": "2021-11-30T19:35:32+00:00"
},
{
"name": "phar-io/manifest",
"version": "2.0.3",
"source": {
"type": "git",
"url": "https://github.com/phar-io/manifest.git",
"reference": "97803eca37d319dfa7826cc2437fc020857acb53"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phar-io/manifest/zipball/97803eca37d319dfa7826cc2437fc020857acb53",
"reference": "97803eca37d319dfa7826cc2437fc020857acb53",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-phar": "*",
"ext-xmlwriter": "*",
"phar-io/version": "^3.0.1",
"php": "^7.2 || ^8.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Arne Blankerts",
"email": "arne@blankerts.de",
"role": "Developer"
},
{
"name": "Sebastian Heuer",
"email": "sebastian@phpeople.de",
"role": "Developer"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "Developer"
}
],
"description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)",
"support": {
"issues": "https://github.com/phar-io/manifest/issues",
"source": "https://github.com/phar-io/manifest/tree/2.0.3"
},
"time": "2021-07-20T11:28:43+00:00"
},
{
"name": "phar-io/version",
"version": "3.2.1",
"source": {
"type": "git",
"url": "https://github.com/phar-io/version.git",
"reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74",
"reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74",
"shasum": ""
},
"require": {
"php": "^7.2 || ^8.0"
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Arne Blankerts",
"email": "arne@blankerts.de",
"role": "Developer"
},
{
"name": "Sebastian Heuer",
"email": "sebastian@phpeople.de",
"role": "Developer"
},
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "Developer"
}
],
"description": "Library for handling version information and constraints",
"support": {
"issues": "https://github.com/phar-io/version/issues",
"source": "https://github.com/phar-io/version/tree/3.2.1"
},
"time": "2022-02-21T01:04:05+00:00"
},
{
"name": "phpspec/prophecy",
"version": "v1.15.0",
"source": {
"type": "git",
"url": "https://github.com/phpspec/prophecy.git",
"reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/phpspec/prophecy/zipball/bbcd7380b0ebf3961ee21409db7b38bc31d69a13",
"reference": "bbcd7380b0ebf3961ee21409db7b38bc31d69a13",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.2",
"php": "^7.2 || ~8.0, <8.2",
"phpdocumentor/reflection-docblock": "^5.2",
"sebastian/comparator": "^3.0 || ^4.0",
"sebastian/recursion-context": "^3.0 || ^4.0"
},
"require-dev": {
"phpspec/phpspec": "^6.0 || ^7.0",
"phpunit/phpunit": "^8.0 || ^9.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.x-dev"
}
},
"autoload": {
"psr-4": {
"Prophecy\\": "src/Prophecy"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Konstantin Kudryashov",
"email": "ever.zet@gmail.com",
"homepage": "http://everzet.com"
},
{
"name": "Marcello Duarte",
"email": "marcello.duarte@gmail.com"
}
],
"description": "Highly opinionated mocking framework for PHP 5.3+",
"homepage": "https://github.com/phpspec/prophecy",
"keywords": [
"Double",
"Dummy",
"fake",
"mock",
"spy",
"stub"
],
"support": {
"issues": "https://github.com/phpspec/prophecy/issues",
"source": "https://github.com/phpspec/prophecy/tree/v1.15.0"
},
"time": "2021-12-08T12:19:24+00:00"
},
{
"name": "phpunit/php-code-coverage",
"version": "9.2.14",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "9f4d60b6afe5546421462b76cd4e633ebc364ab4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/9f4d60b6afe5546421462b76cd4e633ebc364ab4",
"reference": "9f4d60b6afe5546421462b76cd4e633ebc364ab4",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-libxml": "*",
"ext-xmlwriter": "*",
"nikic/php-parser": "^4.13.0",
"php": ">=7.3",
"phpunit/php-file-iterator": "^3.0.3",
"phpunit/php-text-template": "^2.0.2",
"sebastian/code-unit-reverse-lookup": "^2.0.2",
"sebastian/complexity": "^2.0",
"sebastian/environment": "^5.1.2",
"sebastian/lines-of-code": "^1.0.3",
"sebastian/version": "^3.0.1",
"theseer/tokenizer": "^1.2.0"
},
"require-dev": {
"phpunit/phpunit": "^9.3"
},
"suggest": {
"ext-pcov": "*",
"ext-xdebug": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "9.2-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
"homepage": "https://github.com/sebastianbergmann/php-code-coverage",
"keywords": [
"coverage",
"testing",
"xunit"
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.14"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2022-02-28T12:38:02+00:00"
},
{
"name": "phpunit/php-file-iterator",
"version": "3.0.6",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-file-iterator.git",
"reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf",
"reference": "cf1c2e7c203ac650e352f4cc675a7021e7d1b3cf",
"shasum": ""
},
"require": {
"php": ">=7.3"
},
"require-dev": {
"phpunit/phpunit": "^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "FilterIterator implementation that filters files based on a list of suffixes.",
"homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
"keywords": [
"filesystem",
"iterator"
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-file-iterator/issues",
"source": "https://github.com/sebastianbergmann/php-file-iterator/tree/3.0.6"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2021-12-02T12:48:52+00:00"
},
{
"name": "phpunit/php-invoker",
"version": "3.1.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-invoker.git",
"reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/5a10147d0aaf65b58940a0b72f71c9ac0423cc67",
"reference": "5a10147d0aaf65b58940a0b72f71c9ac0423cc67",
"shasum": ""
},
"require": {
"php": ">=7.3"
},
"require-dev": {
"ext-pcntl": "*",
"phpunit/phpunit": "^9.3"
},
"suggest": {
"ext-pcntl": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.1-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Invoke callables with a timeout",
"homepage": "https://github.com/sebastianbergmann/php-invoker/",
"keywords": [
"process"
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-invoker/issues",
"source": "https://github.com/sebastianbergmann/php-invoker/tree/3.1.1"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2020-09-28T05:58:55+00:00"
},
{
"name": "phpunit/php-text-template",
"version": "2.0.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-text-template.git",
"reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28",
"reference": "5da5f67fc95621df9ff4c4e5a84d6a8a2acf7c28",
"shasum": ""
},
"require": {
"php": ">=7.3"
},
"require-dev": {
"phpunit/phpunit": "^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Simple template engine.",
"homepage": "https://github.com/sebastianbergmann/php-text-template/",
"keywords": [
"template"
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-text-template/issues",
"source": "https://github.com/sebastianbergmann/php-text-template/tree/2.0.4"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2020-10-26T05:33:50+00:00"
},
{
"name": "phpunit/php-timer",
"version": "5.0.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-timer.git",
"reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2",
"reference": "5a63ce20ed1b5bf577850e2c4e87f4aa902afbd2",
"shasum": ""
},
"require": {
"php": ">=7.3"
},
"require-dev": {
"phpunit/phpunit": "^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Utility class for timing",
"homepage": "https://github.com/sebastianbergmann/php-timer/",
"keywords": [
"timer"
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-timer/issues",
"source": "https://github.com/sebastianbergmann/php-timer/tree/5.0.3"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2020-10-26T13:16:10+00:00"
},
{
"name": "phpunit/phpunit",
"version": "9.5.16",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "5ff8c545a50226c569310a35f4fa89d79f1ddfdc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/5ff8c545a50226c569310a35f4fa89d79f1ddfdc",
"reference": "5ff8c545a50226c569310a35f4fa89d79f1ddfdc",
"shasum": ""
},
"require": {
"doctrine/instantiator": "^1.3.1",
"ext-dom": "*",
"ext-json": "*",
"ext-libxml": "*",
"ext-mbstring": "*",
"ext-xml": "*",
"ext-xmlwriter": "*",
"myclabs/deep-copy": "^1.10.1",
"phar-io/manifest": "^2.0.3",
"phar-io/version": "^3.0.2",
"php": ">=7.3",
"phpspec/prophecy": "^1.12.1",
"phpunit/php-code-coverage": "^9.2.13",
"phpunit/php-file-iterator": "^3.0.5",
"phpunit/php-invoker": "^3.1.1",
"phpunit/php-text-template": "^2.0.3",
"phpunit/php-timer": "^5.0.2",
"sebastian/cli-parser": "^1.0.1",
"sebastian/code-unit": "^1.0.6",
"sebastian/comparator": "^4.0.5",
"sebastian/diff": "^4.0.3",
"sebastian/environment": "^5.1.3",
"sebastian/exporter": "^4.0.3",
"sebastian/global-state": "^5.0.1",
"sebastian/object-enumerator": "^4.0.3",
"sebastian/resource-operations": "^3.0.3",
"sebastian/type": "^2.3.4",
"sebastian/version": "^3.0.2"
},
"require-dev": {
"ext-pdo": "*",
"phpspec/prophecy-phpunit": "^2.0.1"
},
"suggest": {
"ext-soap": "*",
"ext-xdebug": "*"
},
"bin": [
"phpunit"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "9.5-dev"
}
},
"autoload": {
"files": [
"src/Framework/Assert/Functions.php"
],
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "The PHP Unit Testing framework.",
"homepage": "https://phpunit.de/",
"keywords": [
"phpunit",
"testing",
"xunit"
],
"support": {
"issues": "https://github.com/sebastianbergmann/phpunit/issues",
"source": "https://github.com/sebastianbergmann/phpunit/tree/9.5.16"
},
"funding": [
{
"url": "https://phpunit.de/sponsors.html",
"type": "custom"
},
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2022-02-23T17:10:58+00:00"
},
{
"name": "sebastian/cli-parser",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/cli-parser.git",
"reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/442e7c7e687e42adc03470c7b668bc4b2402c0b2",
"reference": "442e7c7e687e42adc03470c7b668bc4b2402c0b2",
"shasum": ""
},
"require": {
"php": ">=7.3"
},
"require-dev": {
"phpunit/phpunit": "^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Library for parsing CLI options",
"homepage": "https://github.com/sebastianbergmann/cli-parser",
"support": {
"issues": "https://github.com/sebastianbergmann/cli-parser/issues",
"source": "https://github.com/sebastianbergmann/cli-parser/tree/1.0.1"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2020-09-28T06:08:49+00:00"
},
{
"name": "sebastian/code-unit",
"version": "1.0.8",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/code-unit.git",
"reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/1fc9f64c0927627ef78ba436c9b17d967e68e120",
"reference": "1fc9f64c0927627ef78ba436c9b17d967e68e120",
"shasum": ""
},
"require": {
"php": ">=7.3"
},
"require-dev": {
"phpunit/phpunit": "^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Collection of value objects that represent the PHP code units",
"homepage": "https://github.com/sebastianbergmann/code-unit",
"support": {
"issues": "https://github.com/sebastianbergmann/code-unit/issues",
"source": "https://github.com/sebastianbergmann/code-unit/tree/1.0.8"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2020-10-26T13:08:54+00:00"
},
{
"name": "sebastian/code-unit-reverse-lookup",
"version": "2.0.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git",
"reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5",
"reference": "ac91f01ccec49fb77bdc6fd1e548bc70f7faa3e5",
"shasum": ""
},
"require": {
"php": ">=7.3"
},
"require-dev": {
"phpunit/phpunit": "^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Looks up which function or method a line of code belongs to",
"homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
"support": {
"issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues",
"source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/2.0.3"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2020-09-28T05:30:19+00:00"
},
{
"name": "sebastian/comparator",
"version": "4.0.6",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/comparator.git",
"reference": "55f4261989e546dc112258c7a75935a81a7ce382"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55f4261989e546dc112258c7a75935a81a7ce382",
"reference": "55f4261989e546dc112258c7a75935a81a7ce382",
"shasum": ""
},
"require": {
"php": ">=7.3",
"sebastian/diff": "^4.0",
"sebastian/exporter": "^4.0"
},
"require-dev": {
"phpunit/phpunit": "^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Volker Dusch",
"email": "github@wallbash.com"
},
{
"name": "Bernhard Schussek",
"email": "bschussek@2bepublished.at"
}
],
"description": "Provides the functionality to compare PHP values for equality",
"homepage": "https://github.com/sebastianbergmann/comparator",
"keywords": [
"comparator",
"compare",
"equality"
],
"support": {
"issues": "https://github.com/sebastianbergmann/comparator/issues",
"source": "https://github.com/sebastianbergmann/comparator/tree/4.0.6"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2020-10-26T15:49:45+00:00"
},
{
"name": "sebastian/complexity",
"version": "2.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/complexity.git",
"reference": "739b35e53379900cc9ac327b2147867b8b6efd88"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/739b35e53379900cc9ac327b2147867b8b6efd88",
"reference": "739b35e53379900cc9ac327b2147867b8b6efd88",
"shasum": ""
},
"require": {
"nikic/php-parser": "^4.7",
"php": ">=7.3"
},
"require-dev": {
"phpunit/phpunit": "^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Library for calculating the complexity of PHP code units",
"homepage": "https://github.com/sebastianbergmann/complexity",
"support": {
"issues": "https://github.com/sebastianbergmann/complexity/issues",
"source": "https://github.com/sebastianbergmann/complexity/tree/2.0.2"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2020-10-26T15:52:27+00:00"
},
{
"name": "sebastian/diff",
"version": "4.0.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/diff.git",
"reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d",
"reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d",
"shasum": ""
},
"require": {
"php": ">=7.3"
},
"require-dev": {
"phpunit/phpunit": "^9.3",
"symfony/process": "^4.2 || ^5"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "Kore Nordmann",
"email": "mail@kore-nordmann.de"
}
],
"description": "Diff implementation",
"homepage": "https://github.com/sebastianbergmann/diff",
"keywords": [
"diff",
"udiff",
"unidiff",
"unified diff"
],
"support": {
"issues": "https://github.com/sebastianbergmann/diff/issues",
"source": "https://github.com/sebastianbergmann/diff/tree/4.0.4"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2020-10-26T13:10:38+00:00"
},
{
"name": "sebastian/environment",
"version": "5.1.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
"reference": "388b6ced16caa751030f6a69e588299fa09200ac"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/388b6ced16caa751030f6a69e588299fa09200ac",
"reference": "388b6ced16caa751030f6a69e588299fa09200ac",
"shasum": ""
},
"require": {
"php": ">=7.3"
},
"require-dev": {
"phpunit/phpunit": "^9.3"
},
"suggest": {
"ext-posix": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.1-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Provides functionality to handle HHVM/PHP environments",
"homepage": "http://www.github.com/sebastianbergmann/environment",
"keywords": [
"Xdebug",
"environment",
"hhvm"
],
"support": {
"issues": "https://github.com/sebastianbergmann/environment/issues",
"source": "https://github.com/sebastianbergmann/environment/tree/5.1.3"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2020-09-28T05:52:38+00:00"
},
{
"name": "sebastian/exporter",
"version": "4.0.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/exporter.git",
"reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/65e8b7db476c5dd267e65eea9cab77584d3cfff9",
"reference": "65e8b7db476c5dd267e65eea9cab77584d3cfff9",
"shasum": ""
},
"require": {
"php": ">=7.3",
"sebastian/recursion-context": "^4.0"
},
"require-dev": {
"ext-mbstring": "*",
"phpunit/phpunit": "^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Volker Dusch",
"email": "github@wallbash.com"
},
{
"name": "Adam Harvey",
"email": "aharvey@php.net"
},
{
"name": "Bernhard Schussek",
"email": "bschussek@gmail.com"
}
],
"description": "Provides the functionality to export PHP variables for visualization",
"homepage": "https://www.github.com/sebastianbergmann/exporter",
"keywords": [
"export",
"exporter"
],
"support": {
"issues": "https://github.com/sebastianbergmann/exporter/issues",
"source": "https://github.com/sebastianbergmann/exporter/tree/4.0.4"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2021-11-11T14:18:36+00:00"
},
{
"name": "sebastian/global-state",
"version": "5.0.5",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/global-state.git",
"reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/0ca8db5a5fc9c8646244e629625ac486fa286bf2",
"reference": "0ca8db5a5fc9c8646244e629625ac486fa286bf2",
"shasum": ""
},
"require": {
"php": ">=7.3",
"sebastian/object-reflector": "^2.0",
"sebastian/recursion-context": "^4.0"
},
"require-dev": {
"ext-dom": "*",
"phpunit/phpunit": "^9.3"
},
"suggest": {
"ext-uopz": "*"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "5.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Snapshotting of global state",
"homepage": "http://www.github.com/sebastianbergmann/global-state",
"keywords": [
"global state"
],
"support": {
"issues": "https://github.com/sebastianbergmann/global-state/issues",
"source": "https://github.com/sebastianbergmann/global-state/tree/5.0.5"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2022-02-14T08:28:10+00:00"
},
{
"name": "sebastian/lines-of-code",
"version": "1.0.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/lines-of-code.git",
"reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/c1c2e997aa3146983ed888ad08b15470a2e22ecc",
"reference": "c1c2e997aa3146983ed888ad08b15470a2e22ecc",
"shasum": ""
},
"require": {
"nikic/php-parser": "^4.6",
"php": ">=7.3"
},
"require-dev": {
"phpunit/phpunit": "^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Library for counting the lines of code in PHP source code",
"homepage": "https://github.com/sebastianbergmann/lines-of-code",
"support": {
"issues": "https://github.com/sebastianbergmann/lines-of-code/issues",
"source": "https://github.com/sebastianbergmann/lines-of-code/tree/1.0.3"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2020-11-28T06:42:11+00:00"
},
{
"name": "sebastian/object-enumerator",
"version": "4.0.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/object-enumerator.git",
"reference": "5c9eeac41b290a3712d88851518825ad78f45c71"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/5c9eeac41b290a3712d88851518825ad78f45c71",
"reference": "5c9eeac41b290a3712d88851518825ad78f45c71",
"shasum": ""
},
"require": {
"php": ">=7.3",
"sebastian/object-reflector": "^2.0",
"sebastian/recursion-context": "^4.0"
},
"require-dev": {
"phpunit/phpunit": "^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Traverses array structures and object graphs to enumerate all referenced objects",
"homepage": "https://github.com/sebastianbergmann/object-enumerator/",
"support": {
"issues": "https://github.com/sebastianbergmann/object-enumerator/issues",
"source": "https://github.com/sebastianbergmann/object-enumerator/tree/4.0.4"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2020-10-26T13:12:34+00:00"
},
{
"name": "sebastian/object-reflector",
"version": "2.0.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/object-reflector.git",
"reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/b4f479ebdbf63ac605d183ece17d8d7fe49c15c7",
"reference": "b4f479ebdbf63ac605d183ece17d8d7fe49c15c7",
"shasum": ""
},
"require": {
"php": ">=7.3"
},
"require-dev": {
"phpunit/phpunit": "^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Allows reflection of object attributes, including inherited and non-public ones",
"homepage": "https://github.com/sebastianbergmann/object-reflector/",
"support": {
"issues": "https://github.com/sebastianbergmann/object-reflector/issues",
"source": "https://github.com/sebastianbergmann/object-reflector/tree/2.0.4"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2020-10-26T13:14:26+00:00"
},
{
"name": "sebastian/recursion-context",
"version": "4.0.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/recursion-context.git",
"reference": "cd9d8cf3c5804de4341c283ed787f099f5506172"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/cd9d8cf3c5804de4341c283ed787f099f5506172",
"reference": "cd9d8cf3c5804de4341c283ed787f099f5506172",
"shasum": ""
},
"require": {
"php": ">=7.3"
},
"require-dev": {
"phpunit/phpunit": "^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
},
{
"name": "Jeff Welch",
"email": "whatthejeff@gmail.com"
},
{
"name": "Adam Harvey",
"email": "aharvey@php.net"
}
],
"description": "Provides functionality to recursively process PHP variables",
"homepage": "http://www.github.com/sebastianbergmann/recursion-context",
"support": {
"issues": "https://github.com/sebastianbergmann/recursion-context/issues",
"source": "https://github.com/sebastianbergmann/recursion-context/tree/4.0.4"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2020-10-26T13:17:30+00:00"
},
{
"name": "sebastian/resource-operations",
"version": "3.0.3",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/resource-operations.git",
"reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/resource-operations/zipball/0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8",
"reference": "0f4443cb3a1d92ce809899753bc0d5d5a8dd19a8",
"shasum": ""
},
"require": {
"php": ">=7.3"
},
"require-dev": {
"phpunit/phpunit": "^9.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de"
}
],
"description": "Provides a list of PHP built-in functions that operate on resources",
"homepage": "https://www.github.com/sebastianbergmann/resource-operations",
"support": {
"issues": "https://github.com/sebastianbergmann/resource-operations/issues",
"source": "https://github.com/sebastianbergmann/resource-operations/tree/3.0.3"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2020-09-28T06:45:17+00:00"
},
{
"name": "sebastian/type",
"version": "2.3.4",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/type.git",
"reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/type/zipball/b8cd8a1c753c90bc1a0f5372170e3e489136f914",
"reference": "b8cd8a1c753c90bc1a0f5372170e3e489136f914",
"shasum": ""
},
"require": {
"php": ">=7.3"
},
"require-dev": {
"phpunit/phpunit": "^9.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.3-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Collection of value objects that represent the types of the PHP type system",
"homepage": "https://github.com/sebastianbergmann/type",
"support": {
"issues": "https://github.com/sebastianbergmann/type/issues",
"source": "https://github.com/sebastianbergmann/type/tree/2.3.4"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2021-06-15T12:49:02+00:00"
},
{
"name": "sebastian/version",
"version": "3.0.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/version.git",
"reference": "c6c1022351a901512170118436c764e473f6de8c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c6c1022351a901512170118436c764e473f6de8c",
"reference": "c6c1022351a901512170118436c764e473f6de8c",
"shasum": ""
},
"require": {
"php": ">=7.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Sebastian Bergmann",
"email": "sebastian@phpunit.de",
"role": "lead"
}
],
"description": "Library that helps with managing the version number of Git-hosted PHP projects",
"homepage": "https://github.com/sebastianbergmann/version",
"support": {
"issues": "https://github.com/sebastianbergmann/version/issues",
"source": "https://github.com/sebastianbergmann/version/tree/3.0.2"
},
"funding": [
{
"url": "https://github.com/sebastianbergmann",
"type": "github"
}
],
"time": "2020-09-28T06:39:44+00:00"
},
{
"name": "theseer/tokenizer",
"version": "1.2.1",
"source": {
"type": "git",
"url": "https://github.com/theseer/tokenizer.git",
"reference": "34a41e998c2183e22995f158c581e7b5e755ab9e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/theseer/tokenizer/zipball/34a41e998c2183e22995f158c581e7b5e755ab9e",
"reference": "34a41e998c2183e22995f158c581e7b5e755ab9e",
"shasum": ""
},
"require": {
"ext-dom": "*",
"ext-tokenizer": "*",
"ext-xmlwriter": "*",
"php": "^7.2 || ^8.0"
},
"type": "library",
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause"
],
"authors": [
{
"name": "Arne Blankerts",
"email": "arne@blankerts.de",
"role": "Developer"
}
],
"description": "A small library for converting tokenized PHP source code into XML and potentially other formats",
"support": {
"issues": "https://github.com/theseer/tokenizer/issues",
"source": "https://github.com/theseer/tokenizer/tree/1.2.1"
},
"funding": [
{
"url": "https://github.com/theseer",
"type": "github"
}
],
"time": "2021-07-28T10:34:58+00:00"
}
],
"aliases": [],
"minimum-stability": "stable",
"stability-flags": [],
Executable → Regular
BIN
View File
Binary file not shown.
+5
View File
@@ -2,6 +2,11 @@
namespace sammo;
if(!file_exists(__DIR__ . '/../vendor/autoload.php')){
http_response_code(503);
die('not_ready');
}
require(__DIR__ . '/../vendor/autoload.php');
if (!class_exists('\\sammo\\RootDB')) {
+16 -11
View File
@@ -31,8 +31,8 @@ CREATE TABLE `member` (
`NAME` VARCHAR(64) NOT NULL,
`PICTURE` VARCHAR(64) NULL DEFAULT 'default.jpg',
`IMGSVR` INT(1) NULL DEFAULT '0',
`acl` TEXT NOT NULL DEFAULT '{}' COMMENT 'json',
`penalty` TEXT NOT NULL DEFAULT '{}' COMMENT 'json',
`acl` TEXT NOT NULL DEFAULT '{}' COLLATE 'utf8mb4_bin',
`penalty` TEXT NOT NULL DEFAULT '{}' COLLATE 'utf8mb4_bin',
`GRADE` INT(1) NULL DEFAULT '1',
`REG_NUM` INT(3) NULL DEFAULT '0',
`REG_DATE` DATETIME NOT NULL,
@@ -43,9 +43,12 @@ CREATE TABLE `member` (
UNIQUE INDEX `ID` (`ID`),
UNIQUE INDEX `EMAIL` (`EMAIL`),
UNIQUE INDEX `kauth_id` (`oauth_id`),
INDEX `delete_after` (`delete_after`)
INDEX `delete_after` (`delete_after`),
CONSTRAINT `json1` CHECK (json_valid(`acl`)),
CONSTRAINT `json2` CHECK (json_valid(`penalty`))
)
ENGINE=Aria DEFAULT CHARSET=utf8mb4;
COLLATE='utf8mb4_general_ci'
ENGINE=Aria;
-- 로그인 로그 테이블
CREATE TABLE `member_log` (
@@ -53,12 +56,14 @@ CREATE TABLE `member_log` (
`member_no` INT(11) NOT NULL,
`date` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
`action_type` ENUM('reg','try_login','login','logout','oauth','change_pw','make_general','access_server','delete') NOT NULL,
`action` TEXT NULL DEFAULT NULL COMMENT 'JSON',
`action` TEXT NULL DEFAULT NULL COLLATE 'utf8mb4_bin',
PRIMARY KEY (`id`),
INDEX `action` (`member_no`, `action_type`, `date`),
INDEX `member` (`member_no`, `date`)
INDEX `member` (`member_no`, `date`),
CONSTRAINT `json` CHECK (json_valid(`action`))
)
ENGINE=Aria DEFAULT CHARSET=utf8mb4;
COLLATE='utf8mb4_general_ci'
ENGINE=Aria;
###################
# KV storage
@@ -69,9 +74,10 @@ CREATE TABLE if not exists `storage` (
`key` VARCHAR(40) NOT NULL,
`value` TEXT NOT NULL,
PRIMARY KEY (`id`),
UNIQUE INDEX `key` (`namespace`, `key`)
UNIQUE INDEX `key` (`namespace`, `key`),
CONSTRAINT `json` CHECK (json_valid(`value`))
)
COLLATE='utf8mb4_general_ci'
COLLATE='utf8mb4_bin'
ENGINE=Aria;
CREATE TABLE `login_token` (
@@ -86,5 +92,4 @@ CREATE TABLE `login_token` (
INDEX `by_date` (`user_id`, `expire_date`)
)
COLLATE='utf8mb4_general_ci'
ENGINE=Aria
;
ENGINE=Aria;
+1
View File
@@ -172,6 +172,7 @@ if ($gameStor->isunited) {
data-general-strength='{$general['strength']}'
data-general-intel='{$general['intel']}'
data-is-npc='" . ($general['npc'] >= 2 ? 'true' : 'false') . "'
data-npc-type='{$general['npc']}'
>
<td align=center><img class='generalIcon' width='64' height='64' src='{$imageTemp}/{$general['picture']}'></img></td>
<td align=center>$name</td>
+18 -16
View File
@@ -23,7 +23,7 @@ if ($serverID === UniqueConst::$serverID) {
increaseRefresh("연감", 1);
}
$admin = $gameStor->getValues(['startyear', 'year', 'month', 'map_theme']);
$admin = $gameStor->getValues(['startyear', 'year', 'month']);
$me = $db->queryFirstRow('SELECT con, turntime FROM general WHERE owner = %i', $userID);
@@ -47,9 +47,9 @@ if ($s_year === null) {
$e = Util::joinYearMonth($e_year, $e_month);
if ($serverID !== UniqueConst::$serverID) {
$mapTheme = $db->queryFirstField('SELECT map FROM ng_games WHERE server_id=%s', $serverID) ?: 'che';
$mapName = $db->queryFirstField('SELECT map FROM ng_games WHERE server_id=%s', $serverID) ?: 'che';
} else {
$mapTheme = $admin['map_theme'] ?? 'che';
$mapName = GameConst::$mapName;
}
//FIXME: $yearmonth가 올바르지 않을 경우에 처리가 필요.
@@ -104,22 +104,26 @@ $nations = $history['nations'];
<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::printJS("js/map/theme_{$mapName}.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::printStaticValues([
'staticValues' => [
'startYear' => $s_year,
'startMonth' => $s_month,
'lastYear' => $e_year,
'lastMonth' => $e_month,
'selectYear' => $year,
'selectMonth' => $month,
'nations' => $nations ? $history['nations'] : [],
'serverNick' => DB::prefix(),
'serverID' => UniqueConst::$serverID,
]
])?>
<?= 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>
@@ -151,7 +155,7 @@ $nations = $history['nations'];
<tbody>
<tr height=520>
<td width=698>
<?= getMapHtml($mapTheme) ?>
<?= getMapHtml($mapName) ?>
</td>
<td id='nation_list_frame'>
<table id='nation_list'>
@@ -204,8 +208,6 @@ $nations = $history['nations'];
</tr>
</table>
<script>
window.serverNick = '<?= DB::prefix() ?>';
window.serverID = '<?= UniqueConst::$serverID ?>';
<?php if($isCurrent): ?>
reloadWorldMap({
showMe: false,
+2 -2
View File
@@ -111,7 +111,7 @@ if ($con >= 2) {
}
$chief = $chiefs[$chiefLevel] ?? ['name' => '-', 'npc' => 0];
$officerLevelText = getOfficerLevelText($chiefLevel, $nation['level']);
$chiefText = getColoredName($chief['name'], $chief['npc']);
$chiefText = formatName($chief['name'], $chief['npc']);
echo "<td class='center bg1'>{$officerLevelText}</td>
<td class='center'>{$chiefText}</td>";
}
@@ -178,7 +178,7 @@ if ($con >= 2) {
<tr>
<td colspan=5> 장수 일람 : ";
foreach ($nations[0]['generals'] as $general) {
$generalText = getColoredName($general['name'], $general['npc']);
$generalText = formatName($general['name'], $general['npc']);
echo "{$generalText}, ";
}
echo "
+1 -1
View File
@@ -111,7 +111,7 @@ $sel[$type] = "selected";
</tr>
<?php foreach ($generalList as $general) : ?>
<tr>
<td align=center><?= getColoredName($general['name'], $general['npc']) ?></td>
<td align=center><?= formatName($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>
+6 -1
View File
@@ -5,4 +5,9 @@ namespace sammo;
include "lib.php";
include "func.php";
APIHelper::launch(dirname(__FILE__));
$eParams = $_GET;
if(key_exists('path', $eParams)){
unset($eParams['path']);
}
APIHelper::launch(dirname(__FILE__), $_GET['path']??'', $eParams, true);
+1 -1
View File
@@ -133,7 +133,7 @@ $showGeneral = General::createGeneralObjFromDB($gen);
</tr>
<tr>
<td>
<form name=form1 method=post>
<form name=form1 method=get>
정렬순서 :
<select name='query_type' size=1>
<?php foreach ($queryMap as $queryType => [$queryTypeText,]) : ?>
+37 -33
View File
@@ -38,25 +38,25 @@ if ($con >= 2) {
switch ($admin['tnmt_type']) {
default:
throw new \RuntimeException('Invalid tnmt_type');
case 0:
case convertTournamentType('전력전'):
$tnmt_type = "<font color=cyan>전력전</font>";
$tp = "total";
$tp2 = "종합";
$tp3 = "total";
break;
case 1:
case convertTournamentType('통솔전'):
$tnmt_type = "<font color=cyan>통솔전</font>";
$tp = "leadership";
$tp2 = "통솔";
$tp3 = "leadership";
break;
case 2:
case convertTournamentType('일기토'):
$tnmt_type = "<font color=cyan>일기토</font>";
$tp = "strength";
$tp2 = "무력";
$tp3 = "strength";
break;
case 3:
case convertTournamentType('설전'):
$tnmt_type = "<font color=cyan>설전</font>";
$tp = "intel";
$tp2 = "지력";
@@ -273,7 +273,7 @@ if ($str3) {
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');
$generalList = $db->query('SELECT npc,name,win,leadership,strength,intel,leadership+strength+intel as total from tournament where grp>=20 order by grp, grp_no LIMIT 16');
while (count($generalList) < 16) {
$generalList[] = [
'name' => '-',
@@ -293,6 +293,7 @@ if ($str3) {
$line[$i] = "<font color=white>";
}
$gen[$i] = $general['name'];
$stat[$i] = $general[$tp];
}
for ($i = 0; $i < 8; $i++) {
$cent[$i] = $cent[$i] . "┻" . "</font>";
@@ -300,40 +301,43 @@ if ($str3) {
$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>";
}
$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 (!is_numeric($bet[$i])) {
$gold[$i] = 0;
} else {
$gold[$i] = Util::round($myBet[$i] * $bet[$i]);
}
}
?>
</tr>
</tr>
<tr align=center>
<?php for ($i = 0; $i < 16; $i++) { ?>
<td width=70><?=$gen[$i]?></td>
<?php } ?>
</tr>
<tr align=center>
<?php for ($i = 0; $i < 16; $i++) { ?>
<td width=70 style="font-size: 14px"><?=$stat[$i]?></td>
<?php } ?>
</tr>
</table>
<table align=center width=1120 class='tb_layout bg0'>
<table align=center width=1120 style="table-layout: fixed" class='tb_layout bg0'>
<tr align=center>
<td height=10 colspan=16></td>
</tr>
<?php
$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 (!is_numeric($bet[$i])) {
$gold[$i] = 0;
} else {
$gold[$i] = Util::round($myBet[$i] * $bet[$i]);
}
}
echo "
<tr align=center>";
+2 -1
View File
@@ -337,6 +337,7 @@ $templates = new \League\Plates\Engine('templates');
'ourGeneral' => $ourGeneral,
'iconPath' => GetImageURL($general['imgsvr']) . '/' . $general['picture'],
'isNPC' => $isNPC,
'npc' => $general['npc'],
'wounded' => $wounded,
'name' => $name,
'nameText' => $nameText,
@@ -364,7 +365,7 @@ $templates = new \League\Plates\Engine('templates');
}
$generalsName = array_map(function ($gen) {
return getColoredName($gen['name'], $gen['npc']);
return formatName($gen['name'], $gen['npc']);
}, $generals);
$enemyCrew = 0;
+16 -16
View File
@@ -13,8 +13,6 @@ $gameStor = KVStorage::getStorage($db, 'game_env');
increaseRefresh("중원정보", 1);
$mapTheme = $gameStor->map_theme ?? 'che';
$me = $db->queryFirstRow('SELECT no,nation FROM general WHERE owner=%i', $userID);
$myNationID = $me['nation'];
@@ -97,20 +95,15 @@ $neutralStateCharMap = [
<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::printStaticValues([
'staticValues' => [
'serverNick' => DB::prefix(),
'serverID' => UniqueConst::$serverID,
'unitSet' => GameConst::$unitSet,
'mapName' => GameConst::$mapName,
],
]) ?>
<?= WebUtil::printDist('ts', ['common', 'map']) ?>
<script>
window.serverNick = '<?= DB::prefix() ?>';
window.serverID = '<?= UniqueConst::$serverID ?>';
$(function() {
reloadWorldMap({
neutralView: true,
showMe: true,
useCachedMap: true
});
});
</script>
</head>
<body>
@@ -194,7 +187,7 @@ $neutralStateCharMap = [
</tr>
<tr>
<td width=698 height=420>
<?= getMapHtml($mapTheme) ?>
<?= getMapHtml() ?>
</td>
<td id='nation_list_frame'>
<table id='nation_list'>
@@ -231,6 +224,13 @@ $neutralStateCharMap = [
<td><?= banner() ?></td>
</tr>
</table>
<script>
reloadWorldMap({
neutralView: true,
showMe: true,
useCachedMap: true
});
</script>
</body>
</html>
+1 -1
View File
@@ -172,7 +172,7 @@ $templates = new \League\Plates\Engine('templates');
$general['expLevelText'] = getExpLevel($general['experience']);
$general['nameText'] = getColoredName($general['name'], $general['npc']);
$general['nameText'] = formatName($general['name'], $general['npc']);
$general['modeText'] = formatDefenceTrain($general['defence_train']);
$general['crewtypeText'] = GameUnitConst::byId($general['crewtype'])->name ?? '-';
+72 -58
View File
@@ -71,7 +71,8 @@ $sel = [$type => "selected"];
</table>
<?php
$nation = getNationStaticInfo($me['nation']); //국가정보
$nation = $db->queryFirstRow('SELECT nation, name, color, type, level, capital, gennum, `power`, `rate` from nation WHERE nation = %i', $nationID); //국가정보
$nationTypeObj = buildNationTypeClass($nation['type']);
$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) {
@@ -82,6 +83,17 @@ $sel = [$type => "selected"];
$officerList[$officerCityID][$officer['officer_level']] = $officer;
}
$generalList = $db->query('SELECT npc, name, city FROM general WHERE nation = %i', $me['nation']);
$cityGeneralList = [];
foreach ($generalList as $general) {
$cityID = $general['city'];
if (!key_exists($cityID, $cityGeneralList)) {
$cityGeneralList[$cityID] = [];
}
$cityGeneralList[$cityID][] = formatName($general['name'], $general['npc']);
}
$cityList = $db->query('SELECT *,pop/pop_max as poprate from city where nation=%i', $nationID);
@@ -171,8 +183,12 @@ $sel = [$type => "selected"];
];
$cityOfficerList = $officerList[$cityID] ?? [];
$effectiveOfficerCnt = 0;
foreach ($cityOfficerList as $cityOfficer) {
$officerName[$cityOfficer['officer_level']] = getColoredName($cityOfficer['name'], $cityOfficer['npc']);
if ($cityOfficer['city'] == $cityID) {
$effectiveOfficerCnt += 1;
}
$officerName[$cityOfficer['officer_level']] = formatName($cityOfficer['name'], $cityOfficer['npc']);
}
if ($type == 10 && $city['region'] != $region) {
@@ -187,62 +203,60 @@ $sel = [$type => "selected"];
$city['trade'] = "- ";
}
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>
</tr>
<tr>
<td align=center width=46 class='bg1'>주민</td>
<td align=center width=140>{$city['pop']}/{$city['pop_max']}</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 class='bg1'>상업</td>
<td align=center width=140>{$city['comm']}/{$city['comm_max']}</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 class='bg1'>수비</td>
<td align=center width=140>{$city['def']}/{$city['def_max']}</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 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 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 class='bg1'>군사</td>
<td align=center>";
echo $officerName[3];
echo "</td>
<td align=center class='bg1'>종사</td>
<td align=center>";
echo $officerName[2];
echo "</td>
</tr>
<tr>
<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 "
</td>
</tr>
</table>
";
}
$cityGoldIncome = $nation['rate'] / 20 * calcCityGoldIncome($city, $effectiveOfficerCnt, $nation['capital'] == $cityID, $nation['level'], $nationTypeObj);
$cityRiceIncome = $nation['rate'] / 20 * calcCityRiceIncome($city, $effectiveOfficerCnt, $nation['capital'] == $cityID, $nation['level'], $nationTypeObj);
$cityWallIncome = $nation['rate'] / 20 * calcCityWallRiceIncome($city, $effectiveOfficerCnt, $nation['capital'] == $cityID, $nation['level'], $nationTypeObj);
?>
<table align=center width=1000 class='tb_layout bg2'>
<tr>
<td colspan=10 style="color:<?= newColor($nation['color']) ?>; background-color:<?= $nation['color'] ?>;">
<font size=2>【 <?= CityConst::$regionMap[$city['region']] ?> | <?= CityConst::$levelMap[$city['level']] ?> 】 <?= $city['name'] ?></font>
</td>
</tr>
<tr style='text-align:center;'>
<td width=60 class='bg1'>주민</td>
<td width=140 class='pop-value'><?= $city['pop'] ?>/<?= $city['pop_max'] ?></td>
<td width=60 class='bg1'>인구율</td>
<td width=140 class='pop-prop-value'><?= round($city['pop'] / $city['pop_max'] * 100, 2) ?>%</td>
<td width=60 class='bg1'>자금 수입</td>
<td width=140 class='gold-income'><?= number_format($cityGoldIncome) ?></td>
<td width=60 class='bg1'>군량 수입</td>
<td width=140 class='rice-income'><?= number_format($cityRiceIncome) ?></td>
<td width=60 class='bg1'>둔전 수입</td>
<td width=140 class='wall-income'><?= number_format($cityWallIncome) ?></td>
</tr>
<tr style='text-align:center;'>
<td class='bg1'>농업</td>
<td class='agri-value'><?= $city['agri'] ?>/<?= $city['agri_max'] ?></td>
<td class='bg1'>상업</td>
<td class='comm-value'><?= $city['comm'] ?>/<?= $city['comm_max'] ?></td>
<td class='bg1'>치안</td>
<td class='secu-value'><?= $city['secu'] ?>/<?= $city['secu_max'] ?></td>
<td class='bg1'>수비</td>
<td class='def-value'><?= $city['def'] ?>/<?= $city['def_max'] ?></td>
<td class='bg1'>성벽</td>
<td class='wall-value'><?= $city['wall'] ?>/<?= $city['wall_max'] ?></td>
</tr>
<tr style='text-align:center;'>
<td class='bg1'>민심</td>
<td class='trust-value'><?= round($city['trust'], 1) ?></td>
<td class='bg1'>시세</td>
<td class='trade-value'><?= $city['trade'] ?>%</td>
<td class='bg1'>태수</td>
<td class='officer-4-value'><?= $officerName[4] ?></td>
<td class='bg1'>군사</td>
<td class='officer-3-value'><?= $officerName[3] ?></td>
<td class='bg1'>종사</td>
<td class='officer-2-value'><?= $officerName[2] ?></td>
</tr>
<tr>
<td style='text-align:center;' class='bg1'>장수</td>
<td colspan=9 class='city-generals'><?= key_exists($cityID, $cityGeneralList) ? join(', ', $cityGeneralList[$cityID]) : '-' ?></td>
</tr>
</table>
<?php } ?>
<table align=center width=1000 class='tb_layout bg0 anchor'>
<tr>
@@ -252,7 +266,7 @@ $sel = [$type => "selected"];
<td><?= banner() ?></td>
</tr>
</table>
<div id="helper_genlist" style="display:none;"></div>
</body>
<div id="helper_genlist" style="display:none;"></div>
</html>
+2 -2
View File
@@ -98,8 +98,8 @@ if($btn == '참가') {
], 'no=%i', $general['no']);
}
$grpCount = $db->queryFirstField('SELECT count(*) FROM tournament where grp<10 GROUP BY grp HAVING count(*)=8');
if($grpCount >= 8) {
$grpCount = $db->queryFirstColumn('SELECT count(grp) FROM tournament where grp<10 GROUP BY grp;');
if(min($grpCount) >= 8) {
$gameStor->tournament = 2;
$gameStor->phase = 0;
}
+3 -3
View File
@@ -171,7 +171,7 @@ function cityInfo(General $generalObj)
];
foreach ($db->query('SELECT `officer_level`, `name`, npc, no FROM general WHERE officer_city = %i', $cityID) as $officer) {
$officerName[$officer['officer_level']] = getColoredName($officer['name'], $officer['npc']);
$officerName[$officer['officer_level']] = formatName($officer['name'], $officer['npc']);
}
$city['officerName'] = $officerName;
@@ -199,8 +199,8 @@ 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) ? formatName($topChiefs[12]['name'], $topChiefs[12]['npc']) : '-';
$level11Name = key_exists(11, $topChiefs) ? formatName($topChiefs[11]['name'], $topChiefs[11]['npc']) : '-';
$impossibleStrategicCommandLists = [];
$strategicCommandLists = GameConst::$availableChiefCommand['전략'];
+2
View File
@@ -393,6 +393,7 @@ function setGeneralCommand(int $generalID, array $rawTurnList, string $command,
_setGeneralCommand($commandObj, $turnList);
return [
'result'=>true,
'brief'=>$commandObj->getBrief(),
'reason'=>'success'
];
}
@@ -474,6 +475,7 @@ function setNationCommand(int $generalID, array $turnList, string $command, ?arr
_setNationCommand($commandObj, $turnList);
return [
'result'=>true,
'brief'=>$commandObj->getBrief(),
'arg_test'=>true,
'reason'=>'success'
];
+31 -8
View File
@@ -64,6 +64,15 @@ function getNationLevel(int $level) {
][$level];
}
function convertTournamentType(string $type){
return[
'전력전'=>0,
'통솔전'=>1,
'일기토'=>2,
'설전'=>3,
][$type]??-1;
}
function getGenChar(?string $type) {
if($type === null){
return '-';
@@ -692,21 +701,35 @@ function isConsumable(?string $item) : bool{
return $itemClass->isConsumable();
}
function getNameColor(int $npcType):?string{
if($npcType >= 2){
return 'cyan';
}
if($npcType == 1){
function getNPCColor(int $npc): ?string{
if ($npc == 1) {
return 'skyblue';
}
if ($npc == 4){
return 'deepskyblue';
}
if ($npc == 5){
return 'darkcyan';
}
if ($npc == 6){
return 'mediumaquamarine';
}
if ($npc > 1) {
return 'cyan';
}
return null;
}
function getColoredName(string $name, int $npcType):string{
$color = getNameColor($npcType);
function formatName(string $name, int $npc): string
{
$color = getNPCColor($npc);
if($color === null){
return $name;
}
return "<span style='color:{$color}'>{$name}</span>";
return "<span style='color:{$color}'>$name</span>";
}
function ConvertLog(?string $str, $type=1) : string {
+1 -1
View File
@@ -371,7 +371,7 @@ 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((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)
+(select SUM((ra.value + 1000)/(rb.value + 1000)*(CASE WHEN g.`npc` < 2 THEN 1.2 ELSE 1 END)*(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\'
+21 -39
View File
@@ -167,6 +167,20 @@ function commandButton(array $opts = [])
$templates = new \League\Plates\Engine(__DIR__ . '/templates');
$showSecret = false;
$permission = checkSecretPermission($me);
$btnClassForTournament = $opts['btnClass'];
if ($opts['isTournamentApplicationOpen']) {
if ($btnClassForTournament != 'dropdown-item') {
$btnClassForTournament = 'toolbarButton2';
}
}
$btnClassForBetting = $opts['btnClass'];
if ($opts['isBettingActive']) {
if ($btnClassForTournament != 'dropdown-item') {
$btnClassForBetting = 'toolbarButton2';
}
}
if ($permission >= 1) {
$showSecret = true;
} else if ($me['officer_level'] == 0) {
@@ -180,6 +194,8 @@ function commandButton(array $opts = [])
'nationLevel' => $nation['level'],
'showSecret' => $showSecret,
'permission' => $permission,
'btnClassForTournament' => $btnClassForTournament,
'btnClassForBetting' => $btnClassForBetting,
], $opts));
}
@@ -215,57 +231,23 @@ function formatLeadershipBonus(int $value): string
return "<font color=cyan>+{$value}</font>";
}
function getNPCColor(int $npc): ?string{
if ($npc == 1) {
return 'skyblue';
}
if ($npc == 4){
return 'deepskyblue';
}
if ($npc == 5){
return 'darkcyan';
}
if ($npc == 6){
return 'mediumaquamarine';
}
if ($npc > 1) {
return 'cyan';
}
return null;
}
function formatName(string $name, int $npc): string
{
$color = getNPCColor($npc);
if($color === null){
return $name;
}
return "<span style='color:{$color}'>$name</span>";
}
function getMapTheme(): string
{
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$mapTheme = $gameStor->map_theme ?? 'che';
return $mapTheme;
return GameConst::$mapName;
}
function getMapHtml(?string $mapTheme = null)
function getMapHtml(?string $mapName = null)
{
$templates = new \League\Plates\Engine(__DIR__ . '/templates');
if ($mapTheme === null) {
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$mapTheme = $gameStor->map_theme ?? 'che';
if($mapName === null){
$mapName = GameConst::$mapName;
}
return $templates->render('map', [
'mapTheme' => $mapTheme
'mapName' => $mapName
]);
}
+19 -19
View File
@@ -4,14 +4,12 @@ namespace sammo;
* 시간 단위로 일어나는 이벤트들에 대한 함수 모음
*/
//1월마다 실행
function processSpring() {
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
//인구 증가
popIncrease();
// 1월엔 무조건 내정 1% 감소
$db->update('city',[
'dead'=>0,
@@ -22,6 +20,9 @@ function processSpring() {
'wall'=>$db->sqleval('wall * 0.99'),
],true);
//인구 증가
popIncrease();
// > 10000 유지비 3%, > 1000 유지비 1%
// 유지비 1%
$db->update('general', [
@@ -100,7 +101,7 @@ function processGoldIncome() {
$generalObj = new General($rawGeneral, null, null, null, $year, $month, false);
$gold = Util::round(getBill($generalObj->getVar('dedication'))*$ratio);
$generalObj->increaseVar('gold', $gold);
$logger = $generalObj->getLogger();
if($generalObj->getVar('officer_level') > 4){
$logger->pushGeneralActionLog($incomeLog, $logger::PLAIN);
@@ -121,9 +122,9 @@ function processGoldIncome() {
function popIncrease() {
$db = DB::db();
$nationList = $db->queryAllLists('SELECT nation,rate_tmp,type FROM nation');
// 인구 및 민심
$db->update('city', [
@@ -138,7 +139,7 @@ function popIncrease() {
foreach($nationList as [$nationID, $taxRate, $nationType]){
$nationTypeObj = buildNationTypeClass($nationType);
$popRatio = (30 - $taxRate)/200; // 20일때 5% 5일때 12.5% 50일때 -10%
$popRatio = $nationTypeObj->onCalcNationalIncome('pop', $popRatio);
@@ -246,7 +247,7 @@ function getGoldIncome(int $nationID, int $nationLevel, float $taxRate, int $cap
}
$cityIncome *= ($taxRate / 20);
return $cityIncome;
}
@@ -290,9 +291,6 @@ function getWarGoldIncome(string $nationType, array $cityList){
function processFall() {
$db = DB::db();
//인구 증가
popIncrease();
// 7월엔 무조건 내정 1% 감소
$db->update('city',[
'dead'=>0,
@@ -303,6 +301,8 @@ function processFall() {
'wall'=>$db->sqleval('wall * 0.99'),
],true);
//인구 증가
popIncrease();
// > 10000 유지비 3%, > 1000 유지비 1%
// 유지비 1%
@@ -378,7 +378,7 @@ function processRiceIncome() {
$generalObj = new General($rawGeneral, null, null, null, $year, $month, false);
$rice = Util::round(getBill($generalObj->getVar('dedication'))*$ratio);
$generalObj->increaseVar('rice', $rice);
$logger = $generalObj->getLogger();
if($generalObj->getVar('officer_level') > 4){
$logger->pushGeneralActionLog($incomeLog, $logger::PLAIN);
@@ -418,7 +418,7 @@ function getRiceIncome(int $nationID, int $nationLevel, float $taxRate, int $cap
}
$cityIncome *= ($taxRate / 20);
return $cityIncome;
}
@@ -439,12 +439,12 @@ function getWallIncome(int $nationID, int $nationLevel, float $taxRate, int $cap
$cityIncome = 0;
foreach($cityList as $rawCity){
$cityID = $rawCity['city'];
$cityIncome += calcCityWallRiceIncome($rawCity, $officersCnt[$cityID]??0, $capitalID == $cityID, $nationLevel, $nationTypeObj);
}
$cityIncome *= ($taxRate / 20);
return $cityIncome;
}
@@ -520,7 +520,7 @@ function disaster() {
}
else {
$raiseProp = 0.06 - ($city['secu'] / $city['secu_max']) * 0.05; // 1 ~ 6%
}
}
if(Util::randBool($raiseProp)) {
$targetCityList[] = $city;
@@ -592,11 +592,11 @@ function disaster() {
'def'=>$db->sqleval('def * %d', $affectRatio),
'wall'=>$db->sqleval('wall * %d', $affectRatio),
], 'city = %i', $city['city']);
$generalList = array_map(
function($rawGeneral) use ($city, $year, $month){
return new General($rawGeneral, null, $city, null, $year, $month, false);
},
},
$generalListByCity[$city['city']]??[]
);
@@ -619,7 +619,7 @@ function disaster() {
'wall'=>$db->sqleval('least(wall * %d, wall_max)', $affectRatio),
], 'city = %i', $city['city']);
}
}
+37 -18
View File
@@ -47,7 +47,7 @@ if ($me['newmsg'] == 1 || $me['newvote'] == 1) {
], 'owner=%i', $userID);
}
$plock = $db->queryFirstField('SELECT plock FROM plock LIMIT 1');
$plock = boolval($db->queryFirstField('SELECT plock FROM plock LIMIT 1'));
$con = checkLimit($me['con']);
if ($con >= 2) {
@@ -83,11 +83,13 @@ if ($gameStor->npcmode == 0) {
$npcmode = "선택 생성";
}
$color = "cyan";
$mapTheme = $gameStor->map_theme;
$serverName = UniqueConst::$serverName;
$serverCnt = $gameStor->server_cnt;
$auctionCount = $db->queryFirstField('SELECT count(`no`) FROM auction');
$isTournamentActive = $gameStor->tournament > 0;
$isTournamentApplicationOpen = $gameStor->tournament == 1;
$isBettingActive = $gameStor->tournament == 6;
$myNationStatic = getNationStaticInfo($generalObj->getNationID());
$nationColorType = substr($myNationStatic['color'] ?? '#000000', 1);
@@ -123,13 +125,34 @@ if (!$otherTextInfo) {
<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([
//deprecated, staticValues를 이용할 것
'serverName' => $serverName,
'serverCnt' => $serverCnt,
'serverNick' => DB::prefix(),
'serverID' => UniqueConst::$serverID,
'maxTurn' => GameConst::$maxTurn,
'maxPushTurn' => 12,
'commandList' => getCommandTable($generalObj),
'serverNow' => TimeUtil::now(false),
'baseColor2' => GameConst::$basecolor2,
'lastExecuted' => $gameStor->turntime,
'isLocked' => $plock,
'isTournamentActive' => $isTournamentActive,
'isBettingActive' => $isBettingActive,
'staticValues' => [
'serverName' => $serverName,
'serverCnt' => $serverCnt,
'serverNick' => DB::prefix(),
'serverID' => UniqueConst::$serverID,
'maxTurn' => GameConst::$maxTurn,
'maxPushTurn' => 12,
'commandList' => getCommandTable($generalObj),
'serverNow' => TimeUtil::now(false),
'lastExecuted' => $gameStor->turntime,
'isLocked' => $plock,
'isTournamentActive' => $isTournamentActive,
'isBettingActive' => $isBettingActive,
'mapName' => GameConst::$mapName,
'unitSet' => GameConst::$unitSet,
]
]) ?>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.1/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
</head>
@@ -165,19 +188,15 @@ if (!$otherTextInfo) {
<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 class="s-border-t py-2 col col-6 col-md-4">
<?php if ($isTournamentActive) : ?>
↑<span style='color:cyan'><?=(['전력전', '통솔전', '일기토', '설전',])[$gameStor->tnmt_type] ?? '' ?> <?= getTournament($gameStor->tournament) ?> <?= getTournamentTime() ?></span>↑
<?php else : ?>
<span style='color:magenta'>현재 토너먼트 경기 없음</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 style="display:inline-block;"><?= $plock ? ("<span style='color:magenta;'>동작 시각: " . substr($gameStor->turntime, 5, 14) . "</span>") : ("<span style='color:cyan;'>동작 시각: " . 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) : ?>
@@ -237,7 +256,7 @@ if (!$otherTextInfo) {
</div>
<?php endif; ?>
<div id="map_view" class="gx-0">
<div id="mapZone" class="view-item"><?= getMapHtml($mapTheme) ?></div>
<div id="mapZone" class="view-item"><?= getMapHtml() ?></div>
<div class="view-item" id="reservedCommandZone">
<div id="reservedCommandList"></div>
<div id="actionMiniPlate" class="gx-0 row">
@@ -253,7 +272,7 @@ if (!$otherTextInfo) {
<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 class="buttonPlate bg2"><?= commandButton(['btnClass' => 'btn btn-sammo-nation', 'isTournamentApplicationOpen' => $isTournamentApplicationOpen, 'isBettingActive' => $isBettingActive]) ?></div>
</div>
</div>
</div>
@@ -353,7 +372,7 @@ if (!$otherTextInfo) {
국가 메뉴
</div>
<ul class="dropdown-menu" aria-labelledby="navbarNation" id="navbarNationItems">
<?= commandButton(['btnBegin' => '<li>', 'btnEnd' => '</li>', 'btnClass' => 'dropdown-item']) ?>
<?= commandButton(['btnBegin' => '<li>', 'btnEnd' => '</li>', 'btnClass' => 'dropdown-item', 'isTournamentApplicationOpen' => $isTournamentApplicationOpen, 'isBettingActive' => $isBettingActive]) ?>
</ul>
</li>
<li class="nav-item dropup">
+1 -3
View File
@@ -41,8 +41,6 @@ if ($permission < 4) {
]);
}
$reason = trim($reason);
$letter = $db->queryFirstRow('SELECT * FROM ng_diplomacy WHERE no=%i AND src_nation_id = %i AND state = \'proposed\'', $letterNo, $me['nation']);
if(!$letter){
Json::die([
@@ -66,7 +64,7 @@ $unlimited = new \DateTime('9999-12-31');
$aux['reason'] = [
'who'=>$me['no'],
'action'=>'cancelled',
'reason'=>$reason
'reason'=>'회수',
];
$db->update('ng_diplomacy', [
'state'=>'cancelled',
-109
View File
@@ -1,109 +0,0 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
//로그인 검사
$session = Session::requireLogin([]);
$userID = Session::getUserID();
$db = DB::db();
$withToken = Util::getPost('with_token', 'bool', false);
$gameStor = KVStorage::getStorage($db, 'game_env');
if($session->isGameLoggedIn()){
increaseRefresh("장수일람", 2);
$me = $db->queryFirstRow('SELECT con, turntime FROM general WHERE owner=%i', $userID);
$con = checkLimit($me['con']);
if ($con >= 2) {
Json::die([
'result'=>false,
'reason'=>'접속 제한중입니다. 1턴 이내에 너무 많은 갱신을 하셨습니다.'
]);
}
}
else{
$availableNextCall = $session->availableNextCallGetGeneralList??'2000-01-01 00:00:00';
$now = new \DateTimeImmutable();
if($now <= new \DateTimeImmutable($availableNextCall) && $session->userGrade < 5){
Json::die([
'result'=>false,
'reason'=>"장수 리스트는 10초에 한번 갱신 가능합니다.\n다음 시간 : ".$availableNextCall
]);
}
$availableNextCall = $now->add(new \DateInterval('PT10S'))->format('Y-m-d H:i:s');
$session->availableNextCallGetGeneralList = $availableNextCall;
}
$session->setReadOnly();
$rawGeneralList = $db->queryAllLists('SELECT owner,no,picture,imgsvr,npc,age,nation,special,special2,personal,name,owner_name as ownerName,injury,leadership,strength,intel,experience,dedication,officer_level,killturn,connect from general');
$ownerNameList = [];
if($gameStor->isunited){
foreach(RootDB::db()->queryAllLists('SELECT no, name FROM member') as [$ownerID, $ownerName]){
$ownerNameList[$ownerID] = $ownerName;
}
}
$generalList = [];
foreach($rawGeneralList as $rawGeneral){
[$owner,$no,$picture,$imgsvr,$npc,$age,$nation,$special,$special2,$personal,$name,$ownerName,$injury,$leadership,$strength,$intel,$experience,$dedication,$officerLevel,$killturn,$connectCnt] = $rawGeneral;
if(key_exists($owner, $ownerNameList)){
$ownerName = $ownerNameList[$owner];
}
$nationArr = getNationStaticInfo($nation);
$lbonus = calcLeadershipBonus($officerLevel, $nationArr['level']);
$generalList[] = [
$no,
$picture,
$imgsvr,
$npc,
$age,
$nationArr['name'],
getGeneralSpecialDomesticName($special),
getGeneralSpecialWarName($special2),
getGenChar($personal),
$name,
$npc==1?$ownerName:null,
$injury,
$leadership,
$lbonus,
$strength,
$intel,
getExpLevel($experience),
getHonor($experience),
getDed($dedication),
getOfficerLevelText($officerLevel, $nationArr['level']),
$killturn,
$connectCnt
];
}
$result = [
'result'=>'true',
'list'=>$generalList,
];
if($withToken){
$now = (new \DateTimeImmutable())->format('Y-m-d H:i:s');
$tokens = [];
foreach($db->query('SELECT * FROM select_npc_token WHERE `valid_until`>=%s', $now) as $token){
$validUntil = $token['valid_until'];
foreach(Json::decode($token['pick_result']) as $pickResult){
$tokens[$pickResult['no']]=$pickResult['keepCnt'];
}
}
$result['token'] = $tokens;
}
Json::die($result);
-184
View File
@@ -1,184 +0,0 @@
<?php
namespace sammo;
//통합 세력장수&암행부 viewer
include "lib.php";
include "func.php";
//로그인 검사
$session = Session::requireGameLogin([])->setReadOnly();
$userID = Session::getUserID();
$db = DB::db();
$reqType = Util::getReq('req', 'int', 1);
$reqForce = Util::getReq('force', 'bool', false);
$gameStor = KVStorage::getStorage($db, 'game_env');
increaseRefresh("세력장수", 1);
$me = $db->queryFirstRow('SELECT con, turntime, belong, nation, officer_level, permission, penalty FROM general WHERE owner=%i', $userID);
$con = checkLimit($me['con']);
if ($con >= 2) {
Json::die([
'result' => false,
'reason' => '접속 제한중입니다. 1턴 이내에 너무 많은 갱신을 하셨습니다.'
]);
}
$nationID = $me['nation'];
$permission = checkSecretPermission($me, true);
if ($reqForce && $reqType > $permission) {
Json::die([
'result' => false,
'reason' => '권한이 부족합니다.'
]);
}
$permission = min($reqType, $permission);
$nationArr = getNationStaticInfo($nationID);
$viewColumns = [
'no' => 0,
'name' => 0,
'owner_name' => 9,
'nation' => 0,
'city' => 1,
'officer_level' => 2,
'officer_city' => 2,
'npc' => 0,
'defence_train' => 2,
'troop' => 2,
'injury' => 0,
'leadership' => 0,
'strength' => 0,
'intel' => 0,
'experience' => 1,
'explevel' => 0,
'dedication' => 1,
'dedlevel' => 0,
'gold' => 0,
'rice' => 0,
'crewtype' => 2,
'crew' => 2,
'train' => 2,
'atmos' => 2,
'killturn' => 0,
'turntime' => 2,
'picture' => 0,
'imgsvr' => 0,
'age' => 0,
'special' => 0,
'special2' => 0,
'personal' => 0,
'belong' => 0,
'horse' => 2,
'weapon' => 2,
'book' => 2,
'item' => 2,
'connect' => 0
];
$customViewColumns = [
'officerLevel' => 0,
'officerLevelText' => 0,
'lbonus' => 0,
'ownerName' => 0,
'honorText' => 0
];
function getOfficerLevel($rawGeneral)
{
global $permission;
$level = $rawGeneral['officer_level'];
if ($level >= 5) {
return $level;
}
if ($permission > 1) {
return $level;
}
return 1;
}
$specialViewFilter = [
'officerLevel' => function ($rawGeneral){
return getOfficerLevel($rawGeneral);
},
'special' => function ($rawGeneral) {
return getGeneralSpecialDomesticName($rawGeneral['special']);
},
'special2' => function ($rawGeneral) {
return getGeneralSpecialWarName($rawGeneral['special2']);
},
'personal' => function ($rawGeneral) {
return getGenChar($rawGeneral['personal']);
},
'lbonus' => function ($rawGeneral) use ($nationArr) {
return calcLeadershipBonus($rawGeneral['officer_level'], $nationArr['level']);
},
'ownerName' => function ($rawGeneral) {
if ($rawGeneral['npc'] != 1) {
return null;
}
return $rawGeneral['owner_name'];
},
'officerLevelText' => function ($rawGeneral) use ($nationArr) {
$level = getOfficerLevel($rawGeneral);
return getOfficerLevelText($level, $nationArr['level']);
},
'honorText' => function ($rawGeneral) {
return getHonor($rawGeneral['experience']);
},
'dedLevelText' => function ($rawGeneral) {
return getDedLevelText($rawGeneral['dedLevel']);
},
'turntime' => function ($rawGeneral) {
//'0000-00-00 11:23';
return substr($rawGeneral['turntime'], 11, 5);
}
];
[$queryColumns, $rankColumns] = General::mergeQueryColumn(array_keys($viewColumns), 1);
$rawGeneralList = Util::convertArrayToDict($db->query('SELECT %l from general WHERE nation = %i', Util::formatListOfBackticks($queryColumns), $nationID), 'no');
$resultColumns = [];
foreach ($viewColumns as $column => $reqPermission) {
if ($reqPermission > $permission) {
continue;
}
$resultColumns[] = $column;
}
foreach ($customViewColumns as $column => $reqPermission) {
if ($reqPermission > $permission) {
continue;
}
$resultColumns[] = $column;
}
$generalList = [];
foreach ($rawGeneralList as $rawGeneral) {
//General 생성?
$item = [];
foreach ($resultColumns as $column) {
if (key_exists($column, $specialViewFilter)) {
$value = $specialViewFilter[$column]($rawGeneral);
}
else{
$value = $rawGeneral[$column];
}
$item[] = $value;
}
$generalList[] = $item;
}
$result = [
'result' => true,
'column' => $resultColumns,
'list' => $generalList,
];
Json::die($result);
+8 -15
View File
@@ -31,17 +31,12 @@ $now = time();
if($mapInfo && ($now - $mapInfo['timestamp'] < 600)){
$mapEtag = $mapInfo['etag'];
$mapModified = $mapInfo['timestamp'];
header("Last-Modified: ".gmdate("D, d M Y H:i:s", $mapModified)." GMT");
header("Etag: $mapEtag");
if (
strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']??'2000-01-01') === $mapModified ||
trim($_SERVER['HTTP_IF_NONE_MATCH']??'') === $mapEtag
) {
header("HTTP/1.1 304 Not Modified");
die();
}
WebUtil::setCacheHeader(new APICacheResult(TimeUtil::secondsToDateTime($mapModified), $mapEtag));
$reqMapEtag = WebUtil::parseETag();
$reqModifiedSince = WebUtil::parseLastModified();
if($mapEtag === $reqMapEtag || $mapModified === $reqModifiedSince){
WebUtil::dieWithNotModified();
}
Json::die($mapInfo['data'], 0);
}
@@ -65,10 +60,9 @@ $rawMap = getWorldMap([
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$mapTheme = $gameStor->map_theme ?? 'che';
$rawMap['history'] = $history;
$rawMap['theme'] = $mapTheme;
$rawMap['theme'] = GameConst::$mapName;
$etag = hash('sha256', $serverID.$now);
$map = [
@@ -77,7 +71,6 @@ $map = [
'data'=>$rawMap,
];
$cache->save("recent_map", $map);
header("Last-Modified: ".gmdate("D, d M Y H:i:s", $now)." GMT");
header("Etag: $etag");
WebUtil::setCacheHeader(new APICacheResult(TimeUtil::secondsToDateTime($now), $etag));
Json::die($map['data'], 0);
+1 -1
View File
@@ -241,7 +241,7 @@ function do추방(General $general, int $myOfficerLevel):?string{
}
$general->setVar('troop', 0);
if($general->getNPCType() >= 2 && ($env['scenario'] < 100 || Util::randBool(0.01))) {
if($general->getNPCType() >= 2 && Util::randBool(GameConst::$npcBanMessageProb)) {
$str = Util::choiceRandom([
'날 버리다니... 곧 전장에서 복수해주겠다...',
+21 -8
View File
@@ -231,7 +231,10 @@ function processWar_NG(
$logger->pushGlobalActionLog("<D><b>{$attacker->getNationVar('name')}</b></>의 <Y>{$attacker->getName()}</>{$josaYi} <G><b>{$city->getName()}</b></>{$josaRo} 진격합니다.");
$logger->pushGeneralActionLog("<G><b>{$city->getName()}</b></>{$josaRo} <M>진격</>합니다. <1>$date</>");
for ($currPhase = 0; $currPhase < $attacker->getMaxPhase(); $currPhase += 1) {
$logWritten = false;
while($attacker->getPhase() < $attacker->getMaxPhase()){
$logWritten = false;
if ($defender === null) {
$defender = $city;
@@ -256,8 +259,8 @@ function processWar_NG(
}
}
if ($defender->getPhase() == 0) {
$defender->setPrePhase($currPhase);
if ($defender->getPhase() == 0 && $defender->getOppose() == null) {
$defender->setPrePhase($attacker->getPhase());
$attacker->addTrain(1);
$defender->addTrain(1);
@@ -347,15 +350,22 @@ function processWar_NG(
$attacker->increaseKilled($deadDefender);
$defender->increaseKilled($deadAttacker);
$phaseNickname = $currPhase + 1;
if($defender->getPhase() < 0){
$phaseNickname = '先';
}
else{
$currPhase = $attacker->getPhase() + 1;
$phaseNickname = "{$currPhase} ";
}
if ($deadAttacker > 0 || $deadDefender > 0) {
$attacker->getLogger()->pushGeneralBattleDetailLog(
"$phaseNickname : <Y1>【{$attacker->getName()}】</> <C>{$attacker->getHP()} (-$deadAttacker)</> VS <C>{$defender->getHP()} (-$deadDefender)</> <Y1>【{$defender->getName()}】</>"
"$phaseNickname: <Y1>【{$attacker->getName()}】</> <C>{$attacker->getHP()} (-$deadAttacker)</> VS <C>{$defender->getHP()} (-$deadDefender)</> <Y1>【{$defender->getName()}】</>"
);
$defender->getLogger()->pushGeneralBattleDetailLog(
"$phaseNickname : <Y1>【{$defender->getName()}】</> <C>{$defender->getHP()} (-$deadDefender)</> VS <C>{$attacker->getHP()} (-$deadAttacker)</> <Y1>【{$attacker->getName()}】</>"
"$phaseNickname: <Y1>【{$defender->getName()}】</> <C>{$defender->getHP()} (-$deadDefender)</> VS <C>{$attacker->getHP()} (-$deadAttacker)</> <Y1>【{$attacker->getName()}】</>"
);
}
@@ -364,6 +374,8 @@ function processWar_NG(
$defender->addPhase();
if (!$attacker->continueWar($noRice)) {
$logWritten = true;
$attacker->logBattleResult();
$defender->logBattleResult();
@@ -386,6 +398,7 @@ function processWar_NG(
}
if (!$defender->continueWar($noRice)) {
$logWritten = true;
$attacker->logBattleResult();
$defender->logBattleResult();
@@ -414,7 +427,7 @@ function processWar_NG(
$defender->getLogger()->pushGeneralActionLog("전멸했습니다.", ActionLogger::PLAIN);
}
if ($currPhase + 1 == $attacker->getMaxPhase()) {
if ($attacker->getPhase() >= $attacker->getMaxPhase()) {
break;
}
@@ -427,7 +440,7 @@ function processWar_NG(
}
}
if ($currPhase == $attacker->getMaxPhase()) {
if (!$logWritten) {
//마지막 페이즈의 전투 마무리
$attacker->logBattleResult();
$defender->logBattleResult();
+4 -2
View File
@@ -16,8 +16,10 @@ include "func.php";
<title>최근 지도</title>
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printStaticValues([
'serverNick' => DB::prefix(),
'serverID' => UniqueConst::$serverID
'staticValues' => [
'serverNick' => DB::prefix(),
'serverID' => UniqueConst::$serverID
],
]) ?>
<?= WebUtil::printJS('d_shared/base_map.js') ?>
@@ -0,0 +1,76 @@
<?php
namespace sammo\API\Command;
use sammo\Session;
use DateTimeInterface;
use sammo\GameConst;
use sammo\Util;
use sammo\Validator;
use function sammo\setGeneralCommand;
class ReserveBulkCommand extends \sammo\BaseAPI
{
public function validateArgs(): ?string
{
foreach ($this->args as $idx => $turn) {
$v = new Validator($turn);
$v->rule('required', [
'action',
'turnList'
])
->rule('lengthMin', 'action', 1)
->rule('integerArray', 'turnList');
if (!$v->validate()) {
return "{$idx}:{$v->errorStr()}";
}
}
return null;
}
public function getRequiredSessionMode(): int
{
return static::REQ_GAME_LOGIN | static::REQ_READ_ONLY;
}
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
{
$briefList = [];
foreach ($this->args as $idx => $turn) {
$action = $turn['action'];
$turnList = $turn['turnList'];
$arg = $turn['arg'] ?? [];
if (!$turnList) {
return "{$idx}: 턴이 입력되지 않았습니다";
}
if (!in_array($action, Util::array_flatten(GameConst::$availableGeneralCommand))) {
return "{$idx}: 사용할 수 없는 커맨드입니다.";
}
if (!is_array($arg)) {
return "{$idx}: 올바른 arg 형태가 아닙니다.";
}
$partialResult = setGeneralCommand($session->generalID, $turnList, $action, $arg);
if(!$partialResult['result']){
return [
'result' => false,
'briefList' => $briefList,
'errorIdx' => $idx,
'reason' => $partialResult['reason']
];
}
$briefList[$idx] = $partialResult['brief'];
}
return [
'result' => true,
'briefList' => $briefList,
'reason' => 'success'
];
}
}
+165
View File
@@ -0,0 +1,165 @@
<?php
namespace sammo\API\List\Nation;
use sammo\DB;
use sammo\General;
use sammo\Json;
use sammo\KVStorage;
use sammo\RootDB;
use sammo\Session;
use sammo\Util;
use sammo\Validator;
use function sammo\calcLeadershipBonus;
use function sammo\checkLimit;
use function sammo\checkSecretPermission;
use function sammo\getDed;
use function sammo\getDedLevelText;
use function sammo\getExpLevel;
use function sammo\getGenChar;
use function sammo\getGeneralSpecialDomesticName;
use function sammo\getGeneralSpecialWarName;
use function sammo\getHonor;
use function sammo\getNationStaticInfo;
use function sammo\getOfficerLevelText;
use function sammo\increaseRefresh;
class GeneralList extends \sammo\BaseAPI
{
public function validateArgs(): ?string
{
$v = new Validator($this->args);
$v
->rule('boolean', 'with_token');
if (!$v->validate()) {
return $v->errorStr();
}
return null;
}
public function getRequiredSessionMode(): int
{
return static::REQ_LOGIN;
}
public function launch(Session $session, ?\DateTimeInterface $modifiedSince, ?string $reqEtag)
{
$db = DB::db();
$withToken = $this->args['with_token']??false;
$gameStor = KVStorage::getStorage($db, 'game_env');
$userID = $session->userID;
if ($session->isGameLoggedIn()) {
increaseRefresh("장수일람", 2);
$me = $db->queryFirstRow('SELECT con, turntime FROM general WHERE owner=%i', $userID);
$con = checkLimit($me['con']);
if ($con >= 2) {
return '접속 제한중입니다. 1턴 이내에 너무 많은 갱신을 하셨습니다.';
}
} else {
$availableNextCall = $session->availableNextCallGetGeneralList ?? '2000-01-01 00:00:00';
$now = new \DateTimeImmutable();
if ($now <= new \DateTimeImmutable($availableNextCall) && $session->userGrade < 5) {
return "장수 리스트는 10초에 한번 갱신 가능합니다.\n다음 시간 : " . $availableNextCall;
}
$availableNextCall = $now->add(new \DateInterval('PT10S'))->format('Y-m-d H:i:s');
$session->availableNextCallGetGeneralList = $availableNextCall;
}
$session->setReadOnly();
$rawGeneralList = $db->queryAllLists('SELECT owner,no,picture,imgsvr,npc,age,nation,special,special2,personal,name,owner_name as ownerName,injury,leadership,strength,intel,experience,dedication,officer_level,killturn,connect from general');
$ownerNameList = [];
if ($gameStor->isunited) {
foreach (RootDB::db()->queryAllLists('SELECT no, name FROM member') as [$ownerID, $ownerName]) {
$ownerNameList[$ownerID] = $ownerName;
}
}
$generalList = [];
foreach ($rawGeneralList as $rawGeneral) {
[$owner, $no, $picture, $imgsvr, $npc, $age, $nation, $special, $special2, $personal, $name, $ownerName, $injury, $leadership, $strength, $intel, $experience, $dedication, $officerLevel, $killturn, $connectCnt] = $rawGeneral;
if (key_exists($owner, $ownerNameList)) {
$ownerName = $ownerNameList[$owner];
}
$nationArr = getNationStaticInfo($nation);
$lbonus = calcLeadershipBonus($officerLevel, $nationArr['level']);
$generalList[] = [
$no,
$picture,
$imgsvr,
$npc,
$age,
$nationArr['name'],
getGeneralSpecialDomesticName($special),
getGeneralSpecialWarName($special2),
getGenChar($personal),
$name,
$npc == 1 ? $ownerName : null,
$injury,
$leadership,
$lbonus,
$strength,
$intel,
getExpLevel($experience),
getHonor($experience),
getDed($dedication),
getOfficerLevelText($officerLevel, $nationArr['level']),
$killturn,
$connectCnt
];
}
$resultColumns = [
'no',
'picture',
'imgsvr',
'npc',
'age',
'nationName',
'special',
'special2',
'personal',
'name',
'ownerName',
'injury',
'leadership',
'lbonus',
'strength',
'intel',
'explevel',
'honorText',
'dedLevelText',
'officerLevelText',
];
$result = [
'result' => 'true',
'column' => $resultColumns,
'list' => $generalList,
];
if ($withToken) {
$now = (new \DateTimeImmutable())->format('Y-m-d H:i:s');
$tokens = [];
foreach ($db->query('SELECT * FROM select_npc_token WHERE `valid_until`>=%s', $now) as $token) {
$validUntil = $token['valid_until'];
foreach (Json::decode($token['pick_result']) as $pickResult) {
$tokens[$pickResult['no']] = $pickResult['keepCnt'];
}
}
$result['token'] = $tokens;
}
return $result;
}
}
+325
View File
@@ -0,0 +1,325 @@
<?php
namespace sammo\API\Global;
use sammo\Session;
use DateTimeInterface;
use sammo\VersionGit;
use Nette\Caching\Cache;
use RuntimeException;
use sammo\APICacheResult;
use sammo\CityConst;
use sammo\GameConst;
use sammo\GameUnitConst;
use sammo\Json;
use sammo\TimeUtil;
use sammo\UniqueConst;
use function sammo\prepareDir;
class GetConst extends \sammo\BaseAPI
{
/** 반환하는 StaticValues 타입이 달라지면 +1 */
const CONST_API_VERSION = 2;
const CACHE_KEY = 'JSConst';
private ?string $cacheKey = null;
public function __construct(string $rootPath, array $args)
{
parent::__construct($rootPath, $args);
}
public function validateArgs(): ?string
{
return null;
}
public function getRequiredSessionMode(): int
{
return static::REQ_LOGIN;
}
public function findLastModified(): ?int
{
$rawResult = explode("\n", shell_exec('git status -u -s --no-rename'));
$files = [];
foreach ($rawResult as $rawLine) {
if (strlen($rawLine) < 3) {
continue;
}
$filePath = trim(substr($rawLine, 3));
if ($filePath[0] == '"') {
$filePath = substr($filePath, 1, strlen($filePath) - 2);
}
if (!file_exists($filePath)) {
continue;
}
$files[] = $filePath;
}
$lastModified = null;
foreach ($files as $filePath) {
$fileModified = filemtime($filePath);
if ($fileModified === false) {
continue;
}
if ($lastModified === null) {
$lastModified = $fileModified;
continue;
}
if ($lastModified > $fileModified) {
continue;
}
$lastModified = $fileModified;
}
if ($lastModified === null) {
return null;
}
return $lastModified;
}
public function getCacheKey(): string
{
if ($this->cacheKey !== null) {
return $this->cacheKey;
}
if (is_subclass_of('\\sammo\\VersionGit', '\\sammo\VersionGitDynamic')) {
$lastModified = $this->findLastModified();
if ($lastModified !== null) {
$versionHash = "lt{$lastModified}";
} else {
$versionHash = VersionGit::getHash();
}
} else {
$versionHash = VersionGit::getHash();
}
$apiVersion = static::CONST_API_VERSION;
$serverID = UniqueConst::$serverID;
$cacheKey = "{$apiVersion}_{$serverID}_{$versionHash}";
$this->cacheKey = $cacheKey;
return $cacheKey;
}
public function tryCache(): ?APICacheResult
{
if (is_subclass_of('\\sammo\\VersionGit', '\\sammo\VersionGitDynamic')) {
return new APICacheResult(TimeUtil::secondsToDateTime($this->findLastModified()??\time(), true, true));
}
return new APICacheResult(null, $this->getCacheKey());
}
public function readCache(Cache $cache): null|string|array|int|float|bool
{
$rawJSONCache = $cache->load(static::CACHE_KEY);
if ($rawJSONCache === null) {
return null;
}
$jsonCache = Json::decode($rawJSONCache);
if (!key_exists('cacheKey', $jsonCache)) {
return null;
}
$jsonCacheKey = $jsonCache['cacheKey'];
if ($jsonCacheKey !== $this->getCacheKey()) {
return null;
}
return $jsonCache['data'] ?? null;
}
public function extractObjClassInfo(string $objKey, callable $callerFunction): array
{
/** @var \sammo\iAction */
$target = $callerFunction($objKey);
if (!($target instanceof \sammo\iAction)) {
throw new \RuntimeException("{$objKey}의 대상이 iAction이 아님");
}
return [
'value' => $objKey,
'name' => $target->getName(),
'info' => $target->getInfo(),
];
}
public function extractObjClassInfoFromArray(array $constArray, callable $callerFunction): array
{
$result = [];
foreach ($constArray as $key => $target) {
if (is_string($target)) {
$actionInfo = $this->extractObjClassInfo($target, $callerFunction);
if (is_string($key)) {
$result[$key] = $actionInfo;
} else {
$result[$target] = $actionInfo;
}
continue;
}
if (is_array($target)) {
$result[$key] = $this->extractObjClassInfoFromArray($target, $callerFunction);
continue;
}
if(is_string($key) && is_int($target)){
//역전된 상황이다.
$result[$key] = $this->extractObjClassInfo($key, $callerFunction);
continue;
}
$result[$key] = $target;
}
return $result;
}
public function extractObjClassInfoFromGameConst(string $gameConstKey, callable $callerFunction): array
{
$gameConstKeyList = explode(".", $gameConstKey);
$target = (GameConst::${$gameConstKeyList[0]}) ?? [];
foreach(\array_slice($gameConstKeyList, 1) as $gameConstSubKey){
$target = $target[$gameConstSubKey] ?? [];
}
if (is_string($target)) {
return [$target => $this->extractObjClassInfo($target, $callerFunction)];
}
if (!is_array($target)) {
throw new \RuntimeException("GameConst::{$gameConstKey}의 값이 {$target}");
}
return $this->extractObjClassInfoFromArray($target, $callerFunction);
}
public function genConstData()
{
$gameConstKeys = [
'nationType' => [
'\sammo\buildNationTypeClass',
['availableNationType', 'neutralNationType']
],
'specialDomestic' => [
'\sammo\buildGeneralSpecialDomesticClass',
['defaultSpecialDomestic', 'availableSpecialDomestic', 'optionalSpecialDomestic']
],
'specialWar' => [
'\sammo\buildGeneralSpecialWarClass',
['defaultSpecialWar', 'availableSpecialWar', 'optionalSpecialWar']
],
'personality' => [
'\sammo\buildPersonalityClass',
['neutralPersonality', 'availablePersonality', 'optionalPersonality']
],
'item' => [
'\sammo\buildItemClass',
['allItems'],
1
],
];
//GameConst 중 BaseCommand는 시간 흐름, 장수에 따라 정보가 달라지므로 따로 처리해야함
$iActionInfo = [];
$iActionKeyMap = [];
foreach ($gameConstKeys as $mappedKey => $callerTarget) {
$flatLevel = 0;
if (is_array($callerTarget)) {
$callerFunction = $callerTarget[0];
$gameConstSubKey = $callerTarget[1];
if(count($callerTarget) > 2){
/** @var int */
$flatLevel = $callerTarget[2];
}
} else {
$gameConstSubKey = [$mappedKey];
$callerFunction = $callerTarget;
}
if (!is_callable($callerFunction)) {
throw new \RuntimeException("{$mappedKey} => {$callerFunction}이 callable이 아님");
}
$actionInfo = [];
foreach ($gameConstSubKey as $key) {
$appendInfo = $this->extractObjClassInfoFromGameConst($key, $callerFunction);
$actionInfo = array_merge($actionInfo, $appendInfo);
$iActionKeyMap[$key] = $mappedKey;
}
if($flatLevel > 0){
foreach(range(0, $flatLevel - 1) as $tryFlatLevel){
$actionInfo = array_merge(...array_values($actionInfo));
}
}
$iActionInfo[$mappedKey] = $actionInfo;
}
$crewtypeMap = [];
foreach(GameUnitConst::all() as $crewtypeObj){
$crewtypeMap[$crewtypeObj->id] = [
'value'=>(string)$crewtypeObj->id,
'name'=>$crewtypeObj->name,
'info'=>$crewtypeObj->getInfo(),
];
}
$iActionInfo['crewtype'] = $crewtypeMap;
return [
'gameConst' => get_class_vars('\sammo\GameConst'),
'gameUnitConst' => GameUnitConst::all(),
'cityConst' => CityConst::all(),
'cityConstMap' => [
'region' => CityConst::$regionMap,
'level' => CityConst::$levelMap,
],
'iActionInfo' => $iActionInfo,
'iActionKeyMap' => $iActionKeyMap,
];
}
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
{
$cacheDir = $this->rootPath . '/data/file_cache';
if (!prepareDir($cacheDir)) {
throw new RuntimeException('cache 폴더 없음');
}
$storage = new \Nette\Caching\Storages\FileStorage($cacheDir);
$cache = new Cache($storage);
$currentCacheKey = $this->tryCache();
if($modifiedSince !== null && $currentCacheKey->lastModified == $modifiedSince){
return null;
}
if($reqEtag !== null && $currentCacheKey->etag == $reqEtag){
return null;
}
$constCache = $this->readCache($cache);
if ($constCache !== null) {
return [
'result' => true,
'cacheKey' => $this->getCacheKey(),
'data' => $constCache,
];
}
$constCache = $this->genConstData();
$cache->save(static::CACHE_KEY, Json::encode([
'cacheKey' => $this->getCacheKey(),
'data' => $constCache
]));
return [
'result' => true,
'cacheKey' => $this->getCacheKey(),
'data' => $constCache,
];
}
}
+285
View File
@@ -0,0 +1,285 @@
<?php
namespace sammo\API\Nation;
use sammo\DB;
use sammo\General;
use sammo\Session;
use sammo\Util;
use sammo\Validator;
use function sammo\calcLeadershipBonus;
use function sammo\checkLimit;
use function sammo\checkSecretPermission;
use function sammo\getBillByLevel;
use function sammo\getDedLevelText;
use function sammo\getGenChar;
use function sammo\getGeneralSpecialDomesticName;
use function sammo\getGeneralSpecialWarName;
use function sammo\getHonor;
use function sammo\getNationStaticInfo;
use function sammo\getOfficerLevelText;
use function sammo\increaseRefresh;
class GeneralList extends \sammo\BaseAPI
{
private int $permission;
static $viewColumns = [
'no' => 0,
'name' => 0,
'nation' => 0,
'npc' => 0,
'injury' => 0,
'leadership' => 0,
'strength' => 0,
'intel' => 0,
'explevel' => 0,
'dedlevel' => 0,
'gold' => 0,
'rice' => 0,
'killturn' => 0,
'picture' => 0,
'imgsvr' => 0,
'age' => 0,
'special' => 0,
'special2' => 0,
'personal' => 0,
'belong' => 0,
'connect' => 0,
'city' => 1,
'experience' => 1,
'dedication' => 1,
'officer_level' => 2,
'officer_city' => 2,
'defence_train' => 2,
'troop' => 2,
'crewtype' => 2,
'crew' => 2,
'train' => 2,
'atmos' => 2,
'turntime' => 2,
'horse' => 2,
'weapon' => 2,
'book' => 2,
'item' => 2,
'recent_war' => 2,
'aux' => 2,
'owner_name' => 9,//안씀.
//RANK
'warnum' => 2,
'killnum' => 2,
'deathnum' => 2,
'killcrew' => 2,
'deathcrew' => 2,
'firenum' => 2,
];
static $columnRemap = [
'special' => 'specialDomestic',
'special2' => 'specialWar',
'aux' => null,
];
static $customViewColumns = [
'officerLevel' => 0,
'officerLevelText' => 0,
'lbonus' => 0,
'ownerName' => 0,
'honorText' => 0,
'dedLevelText' => 0,
'bill' => 0,
'reservedCommand' => 2,
'autorun_limit' => 2,
];
public function validateArgs(): ?string
{
//TODO: 장기적으로는 요청에 따라 반환해야...
return null;
}
public function getRequiredSessionMode(): int
{
return static::REQ_GAME_LOGIN | static::REQ_READ_ONLY;
}
private function getOfficerLevel($rawGeneral)
{
$level = $rawGeneral['officer_level'];
if ($level >= 5) {
return $level;
}
if ($this->permission > 1) {
return $level;
}
return 1;
}
public function launch(Session $session, ?\DateTimeInterface $modifiedSince, ?string $reqEtag)
{
increaseRefresh("세력장수", 1);
$db = DB::db();
$gameStor = \sammo\KVStorage::getStorage($db, 'game_env');
$env = $gameStor->getValues(['year', 'month', 'turntime', 'turnterm', 'autorun_user', 'killturn']);
$me = $db->queryFirstRow('SELECT con, turntime, belong, nation, officer_level, permission, penalty FROM general WHERE owner=%i', $session->getUserID());
$con = checkLimit($me['con']);
if ($con >= 2) {
return '접속 제한중입니다. 1턴 이내에 너무 많은 갱신을 하셨습니다.';
}
$nationID = $me['nation'];
$this->permission = checkSecretPermission($me, true);
$nationArr = getNationStaticInfo($nationID);
[$queryColumns, $rankColumns] = General::mergeQueryColumn(array_keys(static::$viewColumns), 1);
$rawGeneralList = Util::convertArrayToDict($db->query('SELECT %l from general WHERE nation = %i ORDER BY turntime ASC', Util::formatListOfBackticks($queryColumns), $nationID), 'no');
$reservedCommand = [];
if ($this->permission >= 2) {
$nonNPCGeneralIDList = [];
foreach ($rawGeneralList as $rawGeneral) {
if ($rawGeneral['npc'] < 2) {
$nonNPCGeneralIDList[] = $rawGeneral['no'];
}
}
$rawTurnList = $db->query(
'SELECT general_id, turn_idx, action, arg, brief FROM general_turn WHERE general_id IN %li AND turn_idx < 5 ORDER BY general_id asc, turn_idx asc',
$nonNPCGeneralIDList
);
foreach ($rawTurnList as $rawTurn) {
[
'general_id' => $generalID,
'action' => $action,
'arg' => $arg,
'brief' => $brief,
] = $rawTurn;
if (!key_exists($generalID, $reservedCommand)) {
$reservedCommand[$generalID] = [];
}
$reservedCommand[$generalID][] = [
'action' => $action,
'arg' => $arg,
'brief' => $brief
];
}
}
$rankList = [];
if ($rankColumns) {
$rawRankList = $db->query('SELECT general_id, `type`, `value` FROM rank_data WHERE nation_id = %i AND `type` IN %ls', $nationID, $rankColumns);
foreach ($rawRankList as $rawRank) {
[
'general_id' => $generalID,
'type' => $type,
'value' => $value
] = $rawRank;
if (!key_exists($generalID, $rankList)) {
$rankList[$generalID] = [];
}
$rankList[$generalID][$type] = $value;
}
}
$getRankVar = fn ($key) => (fn ($rawGeneral) => (($rankList[$rawGeneral['no']] ?? [])[$key] ?? 0));
$specialViewFilter = [
'officerLevel' => fn ($rawGeneral) => $this->getOfficerLevel($rawGeneral),
'officerLevelText' => fn ($rawGeneral) => getOfficerLevelText($this->getOfficerLevel($rawGeneral), $nationArr['level']),
'lbonus' => fn ($rawGeneral) => calcLeadershipBonus($rawGeneral['officer_level'], $nationArr['level']),
'ownerName' => fn ($rawGeneral) => ($rawGeneral['npc'] != 1) ? null : $rawGeneral['owner_name'],
'honorText' => fn ($rawGeneral) => getHonor($rawGeneral['experience']),
'dedLevelText' => fn ($rawGeneral) => getDedLevelText($rawGeneral['dedlevel']),
//'0000-00-00 11:23';
'turntime' => fn ($rawGeneral) => substr($rawGeneral['turntime'], 0, 19),
'recent_war' => fn ($rawGeneral) => substr($rawGeneral['recent_war'], 0, 19),
'bill' => fn ($rawGeneral) => getBillByLevel($rawGeneral['dedlevel']),
'reservedCommand' => fn ($rawGeneral) => $reservedCommand[$rawGeneral['no']] ?? null,
'autorun_limit' => fn ($rawGeneral) => ($rawGeneral['aux'] ?? [])['autorun_limit'] ?? 0,
];
foreach ($rankColumns as $rankKey) {
$specialViewFilter[$rankKey] = $getRankVar($rankKey);
}
$resultColumns = [];
foreach (static::$viewColumns as $column => $reqPermission) {
if ($reqPermission > $this->permission) {
continue;
}
if (key_exists($column, static::$columnRemap)) {
$newColumn = static::$columnRemap[$column];
if($newColumn !== null){
$resultColumns[$newColumn] = $column;
}
} else {
$resultColumns[$column] = $column;
}
}
foreach (static::$customViewColumns as $column => $reqPermission) {
if ($reqPermission > $this->permission) {
continue;
}
$resultColumns[$column] = $column;
}
$generalList = [];
foreach ($rawGeneralList as $rawGeneral) {
//General 생성?
if (key_exists('aux', $rawGeneral)) {
$rawGeneral['aux'] = \sammo\JSON::decode($rawGeneral['aux']);
}
$item = [];
foreach ($resultColumns as $column) {
if (key_exists($column, $specialViewFilter)) {
$value = $specialViewFilter[$column]($rawGeneral);
} else {
$value = $rawGeneral[$column];
}
$item[] = $value;
}
$generalList[] = $item;
}
if($this->permission >= 2){
$troops = $db->queryAllLists('SELECT troop_leader,name FROM troop WHERE nation = %i', $nationID);
}
else{
$troops = null;
}
$result = [
'result' => true,
'permission' => $this->permission,
'column' => array_keys($resultColumns),
'list' => $generalList,
'troops' => $troops,
'env' => $env,
];
return $result;
}
}
+5
View File
@@ -47,6 +47,11 @@ class SetBlockScout extends \sammo\BaseAPI
return "권한이 부족합니다.";
}
$gameStor = new KVStorage($db, 'game_env');
$blockChangeScout = $gameStor->getValue('block_change_scout')??false;
if ($blockChangeScout){
return "임관 설정을 바꿀 수 없도록 설정되어 있습니다.";
}
$nationID = $me['nation'];
@@ -117,6 +117,8 @@ class GetReservedCommand extends \sammo\BaseAPI
'autorun_limit' => $generalObj->getAuxVar('autorun_limit'),
'officerLevel' => $me['officer_level'],
'commandList' => getChiefCommandTable($generalObj),
'mapName' => GameConst::$mapName,
'unitSet' => GameConst::$unitSet,
];
}
}
@@ -0,0 +1,76 @@
<?php
namespace sammo\API\NationCommand;
use sammo\Session;
use DateTimeInterface;
use sammo\GameConst;
use sammo\Util;
use sammo\Validator;
use function sammo\setNationCommand;
class ReserveBulkCommand extends \sammo\BaseAPI
{
public function validateArgs(): ?string
{
foreach ($this->args as $idx => $turn) {
$v = new Validator($turn);
$v->rule('required', [
'action',
'turnList'
])
->rule('lengthMin', 'action', 1)
->rule('integerArray', 'turnList');
if (!$v->validate()) {
return "{$idx}:{$v->errorStr()}";
}
}
return null;
}
public function getRequiredSessionMode(): int
{
return static::REQ_GAME_LOGIN | static::REQ_READ_ONLY;
}
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
{
$briefList = [];
foreach ($this->args as $idx => $turn) {
$action = $turn['action'];
$turnList = $turn['turnList'];
$arg = $turn['arg'] ?? [];
if (!$turnList) {
return "{$idx}: 턴이 입력되지 않았습니다";
}
if (!in_array($action, Util::array_flatten(GameConst::$availableChiefCommand))) {
return "{$idx}: 사용할 수 없는 커맨드입니다.";
}
if (!is_array($arg)) {
return "{$idx}: 올바른 arg 형태가 아닙니다.";
}
$partialResult = setNationCommand($session->generalID, $turnList, $action, $arg);
if(!$partialResult['result']){
return [
'result' => false,
'briefList' => $briefList,
'errorIdx' => $idx,
'reason' => $partialResult['reason']
];
}
$briefList[$idx] = $partialResult['brief'];
}
return [
'result' => true,
'briefList' => $briefList,
'reason' => 'success'
];
}
}
+10 -5
View File
@@ -13,7 +13,7 @@ class che_보물_도기 extends \sammo\BaseItem
protected $rawName = '도기';
protected $name = '도기(보물)';
protected $info = '[개인] 판매 시 국고에 금, 쌀 중 하나를 추가 (+10,000, 5년마다 +10,000)';
protected $info = '[개인] 판매 시 장수 소지금과 국고에 금, 쌀 중 하나를 추가 (+10,000, 5년마다 +10,000)';
protected $cost = 200;
protected $consumable = false;
@@ -44,15 +44,20 @@ class che_보물_도기 extends \sammo\BaseItem
['쌀', 'rice']
]);
$db->update('nation', [
$resKey => $db->sqleval('%b + %i', $resKey, $score)
]);
$nationId = $general->getVar('nation');
if ($nationId != 0) {
$db->update('nation', [
$resKey => $db->sqleval('%b + %i', $resKey, Util::toInt($score / 2))
], 'nation=%i', $nationId);
}
$general->increaseVar($resKey, $score - Util::toInt($score / 2));
$score = Util::round($score);
$scoreText = number_format($score, 0);
$logger = $general->getLogger();
$logger->pushGeneralActionLog("국고에 {$resName} <C>{$scoreText}</>을 보충합니다.");
$logger->pushGeneralActionLog("재산과 국고에 {$resName} <C>{$scoreText}</>을 보충합니다.");
return $aux;
}
}
@@ -10,7 +10,7 @@ class che_상성보정_과실주 extends \sammo\BaseItem{
protected $rawName = '과실주';
protected $name = '과실주(상성)';
protected $info = '[전투] 유리한 병종 전투시 공격력 +10%, 피해 -10%';
protected $info = '[전투] 대등/유리한 병종 전투시 공격력 +10%, 피해 -10%';
protected $cost = 200;
protected $consumable = false;
@@ -18,7 +18,7 @@ class che_상성보정_과실주 extends \sammo\BaseItem{
{
$oppose = $unit->getOppose();
$attackCoef = $unit->getCrewType()->getAttackCoef($oppose->getCrewType());
if($attackCoef <= 1){
if($attackCoef < 1){
return null;
}
return new WarUnitTriggerCaller(
+6
View File
@@ -10,4 +10,10 @@ abstract class BaseNation implements iAction{
protected $info = '';
static $pros = '';
static $cons = '';
public function getInfo(): string{
$pros = static::$pros;
$cons = static::$cons;
return "{$pros} {$cons}";
}
}
+31 -10
View File
@@ -26,7 +26,7 @@ class Betting
return Json::encode($bettingType);
}
public function purifyBettingKey(array $bettingType): array
public function purifyBettingKey(array $bettingType, bool $ignoreOver = false): array
{
$selectCnt = $this->info->selectCnt;
sort($bettingType, SORT_NUMERIC);
@@ -39,7 +39,7 @@ class Betting
throw new \InvalidArgumentException('올바르지 않은 값이 있습니다.(0 미만)' . print_r($bettingType, true));
}
if (Util::array_last($bettingType) >= count($this->info->candidates)) {
if (!$ignoreOver && Util::array_last($bettingType) >= count($this->info->candidates)) {
throw new \InvalidArgumentException('올바르지 않은 값이 있습니다.(초과)' . print_r($bettingType, true));
}
@@ -155,6 +155,19 @@ class Betting
}
if ($subAmount == 0) {
$refundList = [];
//당첨자가 아무도 없다면 무효로 하자.
foreach ($db->queryAllLists(
'SELECT general_id, user_id, amount, betting_type FROM ng_betting WHERE betting_id = %i',
$this->bettingID
) as [$generalID, $userID, $amount, $bettingTypeKey]) {
$refundList[] = [
'generalID' => $generalID,
'userID' => $userID,
'amount' => $amount,
'matchPoint' => 0,
];
}
return [];
}
@@ -233,8 +246,12 @@ class Betting
}
$remainRewardAmount = $totalAmount;
$accumulatedRewardAmount = 0;
$givenRewardAmount = $totalAmount;
$rewardAmount = [];
foreach (Util::range($selectCnt, 0, -1) as $matchPoint) {
$givenRewardAmount /= 2;
$accumulatedRewardAmount += $givenRewardAmount;
if (count($subWinners[$matchPoint]) == 0) {
continue;
}
@@ -242,17 +259,21 @@ class Betting
continue;
}
$givenRewardAmount = $remainRewardAmount / 2;
$rewardAmount[$matchPoint] = $givenRewardAmount;
$remainRewardAmount -= $givenRewardAmount; // /2가 아니라 다른 값이 될 경우를 대비..
$rewardAmount[$matchPoint] = $accumulatedRewardAmount;
$remainRewardAmount -= $accumulatedRewardAmount;
$accumulatedRewardAmount = 0;
}
foreach (Util::range(1, $selectCnt + 1) as $matchPoint) {
if (!key_exists($matchPoint, $rewardAmount)) {
continue;
//남은 상금은 '당첨자'에게 몰아준다.
//당첨자가 아무도 없다면, 0개 맞춘 그룹에게 돌아간다.
if($rewardAmount){
foreach(Util::range($selectCnt, -1, -1) as $matchPoint){
if (!key_exists($matchPoint, $rewardAmount)) {
continue;
}
$rewardAmount[$matchPoint] += $rewardAmount;
break;
}
$rewardAmount[$matchPoint] += $remainRewardAmount;
break;
}
$result = [];
-1
View File
@@ -173,7 +173,6 @@ class che_강행 extends Command\GeneralCommand
public function exportJSVars(): array
{
return [
'mapTheme' => \sammo\getMapTheme(),
'procRes' => [
'cities' => \sammo\JSOptionsForCities(),
'distanceList' => \sammo\JSCitiesBasedOnDistance($this->generalObj->getCityID(), 3),
@@ -183,7 +183,7 @@ class che_랜덤임관 extends Command\GeneralCommand
if ($notIn) {
$rawGeneralsCnt = $db->query(
"SELECT g.`nation`, n.`gennum`, n.name, SUM((ra.value + 1000)/(rb.value + 1000)*(CASE WHEN g.`leadership` >= 40 THEN g.`leadership` ELSE 0 END)) AS warpower, SUM(SQRT(g.intel * g.strength) * 2 + g.leadership / 2)/5 AS develpower
"SELECT g.`nation`, n.`gennum`, n.name, SUM((ra.value + 1000)/(rb.value + 1000)*(CASE WHEN g.`npc` < 2 THEN 1.2 ELSE 1 END)*(CASE WHEN g.`leadership` >= 40 THEN g.`leadership` ELSE 0 END)) AS warpower, SUM(SQRT(g.intel * g.strength) * 2 + g.leadership / 2)/5 AS develpower
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'
@@ -195,7 +195,7 @@ class che_랜덤임관 extends Command\GeneralCommand
);
} else {
$rawGeneralsCnt = $db->query(
"SELECT g.`nation`, n.`gennum`, n.name, SUM((ra.value + 100)/(rb.value + 100)*(CASE WHEN g.`leadership` >= 40 THEN g.`leadership` ELSE 0 END)) AS warpower, SUM(SQRT(g.intel * g.strength) * 2 + g.leadership / 2)/5 AS develpower
"SELECT g.`nation`, n.`gennum`, n.name, SUM((ra.value + 100)/(rb.value + 100)*(CASE WHEN g.`npc` < 2 THEN 1.2 ELSE 1 END)*(CASE WHEN g.`leadership` >= 40 THEN g.`leadership` ELSE 0 END)) AS warpower, SUM(SQRT(g.intel * g.strength) * 2 + g.leadership / 2)/5 AS develpower
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'
+84
View File
@@ -0,0 +1,84 @@
<?php
namespace sammo\Command\General;
use \sammo\{
DB, Util, JosaUtil,
General,
ActionLogger,
GameConst, GameUnitConst,
LastTurn,
Command
};
use \sammo\Constraint\Constraint;
use \sammo\Constraint\ConstraintHelper;
use function sammo\tryRollbackInheritUniqueItem;
use function sammo\tryUniqueItemLottery;
class che_은퇴 extends Command\GeneralCommand{
static protected $actionName = '은퇴';
static protected $reqAge = 60;
protected function argTest():bool{
$this->arg = null;
return true;
}
protected function init(){
$general = $this->generalObj;
$this->setNation();
$reqAge = static::$reqAge;
$this->fullConditionConstraints=[
ConstraintHelper::ReqGeneralValue('age', '나이', '>=', $reqAge, "나이가 {$reqAge}세 이상이어야 합니다.")
];
}
public function getCommandDetailTitle(): string
{
$name = $this->getName();
$reqAge = static::$reqAge;
return "{$name}({$reqAge}세 이상, 2턴)";
}
public function getCost():array{
return [0, 0];
}
public function getPreReqTurn():int{
return 1;
}
public function getPostReqTurn():int{
return 0;
}
public function run():bool{
if(!$this->hasFullConditionMet()){
throw new \RuntimeException('불가능한 커맨드를 강제로 실행 시도');
}
$db = DB::db();
$general = $this->generalObj;
$date = $general->getTurnTime($general::TURNTIME_HM);
$logger = $general->getLogger();
$general->rebirth();
$logger->pushGeneralActionLog("은퇴하였습니다. <1>$date</>");
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
tryUniqueItemLottery($general);
$general->applyDB($db);
return true;
}
}
-1
View File
@@ -181,7 +181,6 @@ class che_이동 extends Command\GeneralCommand
public function exportJSVars(): array
{
return [
'mapTheme' => \sammo\getMapTheme(),
'procRes' => [
'cities' => \sammo\JSOptionsForCities(),
'distanceList' => \sammo\JSCitiesBasedOnDistance($this->generalObj->getCityID(), 1),
+2 -1
View File
@@ -162,6 +162,7 @@ class che_임관 extends Command\GeneralCommand
$general->setVar('officer_level', 1);
$general->setVar('officer_city', 0);
$general->setVar('belong', 1);
$general->setVar('troop', 0);
if ($this->destGeneralObj !== null) {
$general->setVar('city', $this->destGeneralObj->getCityID());
@@ -200,6 +201,7 @@ class che_임관 extends Command\GeneralCommand
$rawNationList = Util::convertArrayToDict($db->query('SELECT nation,`name`,color,gennum,`power` FROM nation'), 'nation');
$scoutMsgs = KVStorage::getValuesFromInterNamespace($db, 'nation_env', 'scout_msg');
$nationList = [];
foreach ($scoutMsgs as $destNationID => $scoutMsg) {
$rawNationList[$destNationID]['scoutmsg'] = $scoutMsg;
}
@@ -223,7 +225,6 @@ class che_임관 extends Command\GeneralCommand
$nationList[] = $nationTarget;
}
return [
'mapTheme' => \sammo\getMapTheme(),
'procRes' => [
'nationList' => $nationList,
'startYear' => $this->env['startyear'],
@@ -13,7 +13,7 @@ use \sammo\{
};
use function sammo\getAllNationStaticInfo;
use function \sammo\getColoredName;
use function \sammo\formatName;
use function \sammo\tryUniqueItemLottery;
use function \sammo\getInvitationList;
use function \sammo\getNationStaticInfo;
-1
View File
@@ -228,7 +228,6 @@ class che_첩보 extends Command\GeneralCommand
public function exportJSVars(): array
{
return [
'mapTheme' => \sammo\getMapTheme(),
'procRes' => [
'cities' => \sammo\JSOptionsForCities(),
'distanceList' => \sammo\JSCitiesBasedOnDistance($this->generalObj->getCityID(), 3),
-1
View File
@@ -244,7 +244,6 @@ class che_출병 extends Command\GeneralCommand
public function exportJSVars(): array
{
return [
'mapTheme' => \sammo\getMapTheme(),
'procRes' => [
'cities' => \sammo\JSOptionsForCities(),
'distanceList' => \sammo\JSCitiesBasedOnDistance($this->generalObj->getCityID(), 1),
+12
View File
@@ -62,6 +62,7 @@ class che_하야 extends Command\GeneralCommand{
$general = $this->generalObj;
$date = $general->getTurnTime($general::TURNTIME_HM);
$generalID = $general->getID();
$generalName = $general->getName();
$josaYi = JosaUtil::pick($generalName, '이');
@@ -101,6 +102,17 @@ class che_하야 extends Command\GeneralCommand{
$general->setVar('officer_city', 0);
$general->setVar('belong', 0);
$general->setVar('makelimit', 12);
//부대장일 경우
if($general->getVar('troop') == $generalID){
// 모두 탈퇴
$db->update('general', [
'troop'=>0,
], 'troop = %i', $generalID);
$db->delete('troop', 'troop_leader=%i', $generalID);
}
$general->setVar('troop', 0);
$general->increaseInheritancePoint('active_action', 1);
$this->setResultTurn(new LastTurn(static::getName(), $this->arg));
+1 -1
View File
@@ -281,6 +281,7 @@ class che_화계 extends Command\GeneralCommand
$prob = GameConst::$sabotageDefaultProb + $this->calcSabotageAttackProb() - $this->calcSabotageDefenceProb($destCityGeneralList);
$prob /= $dist;
$prob = Util::valueFit($prob, 0, 0.5);
if (!Util::randBool($prob)) {
$josaYi = JosaUtil::pick($commandName, '이');
@@ -341,7 +342,6 @@ class che_화계 extends Command\GeneralCommand
public function exportJSVars(): array
{
return [
'mapTheme' => \sammo\getMapTheme(),
'procRes' => [
'cities' => \sammo\JSOptionsForCities(),
'distanceList' => \sammo\JSCitiesBasedOnDistance($this->generalObj->getCityID(), 3),
-1
View File
@@ -221,7 +221,6 @@ class che_급습 extends Command\NationCommand
$nationList[] = $nationTarget;
}
return [
'mapTheme' => \sammo\getMapTheme(),
'procRes' => [
'nationList' => $nationList,
'startYear' => $this->env['startyear'],
+1 -1
View File
@@ -168,7 +168,7 @@ class che_몰수 extends Command\NationCommand
);
$amountText = number_format($amount, 0);
if ($destGeneral->getNPCType() >= 2 && Util::randBool(0.01)) {
if ($destGeneral->getNPCType() >= 2 && Util::randBool(GameConst::$npcSeizureMessageProb)) {
$npcTexts = [
'몰수를 하다니... 이것이 윗사람이 할 짓이란 말입니까...',
'사유재산까지 몰수해가면서 이 나라가 잘 될거라 믿습니까? 정말 이해할 수가 없군요...',
@@ -102,7 +102,7 @@ class che_물자원조 extends Command\NationCommand
$limit = $this->nation['level'] * GameConst::$coefAidAmount;
if ($goldAmount > $limit || $riceAmount > $limit) {
$this->fullConditionConstraints[ConstraintHelper::AlwaysFail('작위 제한량 이상은 보낼 수 없습니다.')];
$this->fullConditionConstraints = [ConstraintHelper::AlwaysFail('작위 제한량 이상은 보낼 수 없습니다.')];
return;
}
@@ -291,7 +291,6 @@ class che_물자원조 extends Command\NationCommand
}
return [
'mapTheme' => \sammo\getMapTheme(),
'procRes' => [
'nationList' => $nationList,
'currentNationLevel' => $currentNationLevel,
-1
View File
@@ -177,7 +177,6 @@ class che_발령 extends Command\NationCommand
$troops = Util::convertArrayToDict($db->query('SELECT * FROM troop WHERE nation=%i', $nationID), 'troop_leader');
$destRawGenerals = $db->queryAllLists('SELECT no,name,officer_level,npc,gold,rice,leadership,strength,intel,city,crew,train,atmos,troop FROM general WHERE nation = %i ORDER BY npc,binary(name)', $nationID);
return [
'mapTheme' => \sammo\getMapTheme(),
'procRes' => [
'distanceList' => \sammo\JSCitiesBasedOnDistance($this->generalObj->getCityID(), 1),
'cities' => \sammo\JSOptionsForCities(),
@@ -156,11 +156,8 @@ class che_백성동원 extends Command\NationCommand
'wall' => $db->sqleval('GREATEST(wall_max * 0.8, wall)'),
], 'city=%i', $destCityID);
$josaYiNation = JosaUtil::pick($nationName, '이');
$logger->pushGeneralHistoryLog('<M>백성동원</>을 발동');
$logger->pushNationalHistoryLog("<L><b>【전략】</b></><D><b>{$nationName}</b></>{$josaYiNation} <G><b>{$destCityName}</b></>에 <M>백성동원</>을 하였습니다.");
$logger->pushNationalHistoryLog("<Y>{$generalName}</>{$josaYi} <G><b>{$destCityName}</b></>에 <M>백성동원</>을 발동");
$db->update('nation', [
'strategic_cmd_limit' => $this->generalObj->onCalcStrategic($this->getName(), 'globalDelay', 9)
@@ -175,7 +172,6 @@ class che_백성동원 extends Command\NationCommand
public function exportJSVars(): array
{
return [
'mapTheme' => \sammo\getMapTheme(),
'procRes' => [
'cities' => \sammo\JSOptionsForCities(),
'distanceList' => new \stdClass(),
@@ -101,13 +101,13 @@ class che_불가침제의 extends Command\NationCommand
$nationID = $this->nation['nation'];
if ($reqMonth < $currentMonth + 12) {
if ($reqMonth < $currentMonth + 6) {
$this->permissionConstraints = [
ConstraintHelper::AlwaysFail('기한은 1년 이상이어야 합니다.')
ConstraintHelper::AlwaysFail('기한은 6개월 이상이어야 합니다.')
];
$this->fullConditionConstraints = [
ConstraintHelper::AlwaysFail('기한은 1년 이상이어야 합니다.')
ConstraintHelper::AlwaysFail('기한은 6개월 이상이어야 합니다.')
];
return;
}
@@ -255,7 +255,6 @@ class che_불가침제의 extends Command\NationCommand
$nationList[] = $nationTarget;
}
return [
'mapTheme' => \sammo\getMapTheme(),
'procRes' => [
'nationList' => $nationList,
'startYear' => $this->env['startyear'],
@@ -200,7 +200,6 @@ class che_불가침파기제의 extends Command\NationCommand{
$nationList[] = $nationTarget;
}
return [
'mapTheme' => \sammo\getMapTheme(),
'procRes' => [
'nationList' => $nationList,
'startYear' => $this->env['startyear'],
@@ -219,7 +219,6 @@ class che_선전포고 extends Command\NationCommand
$nationList[] = $nationTarget;
}
return [
'mapTheme' => \sammo\getMapTheme(),
'procRes' => [
'nationList' => $nationList,
'startYear' => $this->env['startyear'],
-1
View File
@@ -199,7 +199,6 @@ class che_수몰 extends Command\NationCommand
public function exportJSVars(): array
{
return [
'mapTheme' => \sammo\getMapTheme(),
'procRes' => [
'cities' => \sammo\JSOptionsForCities(),
'distanceList' => new \stdClass(),
@@ -224,7 +224,6 @@ class che_이호경식 extends Command\NationCommand
$nationList[] = $nationTarget;
}
return [
'mapTheme' => \sammo\getMapTheme(),
'procRes' => [
'nationList' => $nationList,
'startYear' => $this->env['startyear'],
@@ -193,7 +193,6 @@ class che_종전제의 extends Command\NationCommand{
$nationList[] = $nationTarget;
}
return [
'mapTheme' => \sammo\getMapTheme(),
'procRes' => [
'nationList' => $nationList,
'startYear' => $this->env['startyear'],
+1 -2
View File
@@ -69,7 +69,7 @@ class che_천도 extends Command\NationCommand
[$reqGold, $reqRice] = $this->getCost();
if ($this->getDistance() === null) {
$this->fullConditionConstraints[ConstraintHelper::AlwaysFail('천도 대상으로 도달할 방법이 없습니다.')];
$this->fullConditionConstraints = [ConstraintHelper::AlwaysFail('천도 대상으로 도달할 방법이 없습니다.')];
return;
}
@@ -233,7 +233,6 @@ class che_천도 extends Command\NationCommand
public function exportJSVars(): array
{
return [
'mapTheme' => \sammo\getMapTheme(),
'procRes' => [
'cities' => \sammo\JSOptionsForCities(),
'distanceList' => new \stdClass(),
@@ -199,7 +199,6 @@ class che_초토화 extends Command\NationCommand{
public function exportJSVars(): array
{
return [
'mapTheme' => \sammo\getMapTheme(),
'procRes' => [
'cities' => \sammo\JSOptionsForCities(),
'distanceList' => new \stdClass(),
@@ -280,7 +280,6 @@ class che_피장파장 extends Command\NationCommand
}
return [
'mapTheme' => \sammo\getMapTheme(),
'procRes' => [
'nationList' => $nationList,
'startYear' => $this->env['startyear'],
-1
View File
@@ -202,7 +202,6 @@ class che_허보 extends Command\NationCommand
public function exportJSVars(): array
{
return [
'mapTheme' => \sammo\getMapTheme(),
'procRes' => [
'cities' => \sammo\JSOptionsForCities(),
'distanceList' => new \stdClass(),
+3
View File
@@ -16,6 +16,9 @@ class DummyGeneral extends General{
'dedication'=>0,
'gold'=>0,
'rice'=>0,
'leadership'=>10,
'strength'=>10,
'intel'=>10,
];
$this->raw = $raw;
@@ -0,0 +1,25 @@
<?php
namespace sammo\Event\Action;
use sammo\Util;
use sammo\DB;
use sammo\KVStorage;
class BlockScoutAction extends \sammo\Event\Action{
public function __construct(private ?bool $blockChangeScout = null){
}
public function run(array $env){
$db = DB::db();
$db->update('nation', [
'scout'=>1
], true);
if($this->blockChangeScout !== null){
$gameStor = new KVStorage($db, 'game_env');
$gameStor->setValue('block_change_scout', $this->blockChangeScout);
}
return [__CLASS__, $db->affectedRows()];
}
}
+12 -2
View File
@@ -49,10 +49,20 @@ class FinishNationBetting extends \sammo\Event\Action
}
$winnerTypes = [];
$notInBettingWinner = 0;
foreach ($winnerNations as $winnerNationID) {
$winnerTypes[] = $nationIDMap[$winnerNationID];
if(key_exists($winnerNationID, $nationIDMap)){
$winnerTypes[] = $nationIDMap[$winnerNationID];
}
else{
//혹시라도 베팅 시점 이후에 생성된 국가라 없을 수 있다.
$winnerTypes[] = count($nationIDMap) + $notInBettingWinner;
$notInBettingWinner += 1;
}
}
$winnerTypes = $bettingHelper->purifyBettingKey($winnerTypes);
$winnerTypes = $bettingHelper->purifyBettingKey($winnerTypes, $notInBettingWinner > 0);
$bettingHelper->giveReward($winnerTypes);
$logger = new ActionLogger(0, 0, $env['year'], $env['month']);
+2
View File
@@ -252,6 +252,8 @@ class RaiseInvader extends \sammo\Event\Action
$logger->pushGlobalHistoryLog("<L><b>【이벤트】</b></>이민족의 기세는 그 누구도 막을 수 없을듯 합니다!");
$logger->flush();
$gameStor->setValue('block_change_scout', false);
$db->update('plock', [
'plock' => 0
], true);
@@ -0,0 +1,26 @@
<?php
namespace sammo\Event\Action;
use sammo\Util;
use sammo\DB;
use sammo\KVStorage;
class UnblockScoutAction extends \sammo\Event\Action{
public function __construct(private ?bool $blockChangeScout = null){
}
public function run(array $env){
$db = DB::db();
$db->update('nation', [
'scout'=>0
]);
if($this->blockChangeScout !== null){
$gameStor = new KVStorage($db, 'game_env');
$gameStor->setValue('block_change_scout', $this->blockChangeScout);
}
return [__CLASS__, $db->affectedRows()];
}
}
+21 -16
View File
@@ -275,9 +275,17 @@ class GameConstBase
/** @var array 선택 가능한 커맨드 */
public static $availableGeneralCommand = [
'' => [
'개인' => [
'휴식',
'che_요양'
'che_요양',
'che_단련',
'che_숙련전환',
'che_견문',
'che_은퇴',
'che_장비매매',
'che_군량매매',
'che_내정특기초기화',
'che_전투특기초기화',
],
'내정' => [
'che_농지개간',
@@ -291,39 +299,32 @@ class GameConstBase
'che_물자조달',
],
'군사' => [
'che_소집해제',
'che_첩보',
'che_징병',
'che_모병',
'che_훈련',
'che_사기진작',
'che_출병',
'che_집합',
'che_소집해제',
'che_첩보',
],
'인사' => [
'che_이동',
'che_강행',
'che_인재탐색',
'che_등용',
'che_집합',
'che_귀환',
'che_임관',
'che_랜덤임관',
'che_장수대상임관',
],
'계략' => [
'che_화계',
'che_파괴',
'che_탈취',
'che_선동',
'che_탈취',
'che_파괴',
'che_화계',
],
'개인' => [
'che_내정특기초기화',
'che_전투특기초기화',
'che_단련',
'che_숙련전환',
'che_견문',
'che_장비매매',
'che_군량매매',
'국가' => [
'che_증여',
'che_헌납',
'che_하야',
@@ -394,4 +395,8 @@ class GameConstBase
'임', '정', '제', '조', '주', '준', '지', '찬', '책', '충', '탁', '택', '통', '패', '평', '포', '합', '해',
'혁', '현', '화', '환', '회', '횡', '후', '훈', '휴', '흠', '흥'
];
public static $npcBanMessageProb = 0.01;
public static $npcSeizureMessageProb = 0.01;
public static $npcMessageFreqByDay = 4;
}
+18 -18
View File
@@ -110,48 +110,48 @@ class GameUnitConstBase{
[
1200, self::T_ARCHER, '궁병',
100, 100, 7, 15, 0, 10, 10,
100, 100, 7, 10, 0, 10, 10,
0, null, null, 0,
[self::T_CAVALRY=>1.2, self::T_FOOTMAN=>0.8, self::T_SIEGE=>1.2],
[self::T_CAVALRY=>0.8, self::T_FOOTMAN=>1.2, self::T_SIEGE=>0.8],
['표준적인 궁병입니다.','궁병은 회피특화입니다.'],
null, null
['표준적인 궁병입니다.','궁병은 선제사격을 하는 병종입니다.'],
null, ['che_궁병선제사격']
],
[
1201, self::T_ARCHER, '궁기병',
100, 100, 8, 25, 0, 11, 12,
100, 100, 8, 20, 0, 11, 12,
1000, null, ['동이'], 0,
[self::T_CAVALRY=>1.2, self::T_FOOTMAN=>0.8, self::T_SIEGE=>1.2],
[self::T_CAVALRY=>0.8, self::T_FOOTMAN=>1.2, self::T_SIEGE=>0.8],
['말을 타고 잘 피합니다.'],
null, null
null, ['che_궁병선제사격']
],
[
1202, self::T_ARCHER, '연노병',
150, 100, 8, 15, 0, 12, 11,
150, 100, 8, 10, 0, 12, 11,
1000, null, ['서촉'], 0,
[self::T_CAVALRY=>1.2, self::T_FOOTMAN=>0.8, self::T_SIEGE=>1.2],
[self::T_CAVALRY=>0.8, self::T_FOOTMAN=>1.2, self::T_SIEGE=>0.8],
['화살을 연사합니다.'],
null, null
null, ['che_궁병선제사격']
],
[
1203, self::T_ARCHER, '강궁병',
150, 150, 7, 15, 0, 13, 13,
150, 150, 7, 10, 0, 13, 13,
3000, ['양양'], null, 0,
[self::T_CAVALRY=>1.2, self::T_FOOTMAN=>0.8, self::T_SIEGE=>1.2],
[self::T_CAVALRY=>0.8, self::T_FOOTMAN=>1.2, self::T_SIEGE=>0.8],
['강건한 궁병입니다.'],
null, null
null, ['che_궁병선제사격']
],
[
1204, self::T_ARCHER, '석궁병',
200, 100, 7, 15, 0, 13, 13,
200, 100, 7, 10, 0, 13, 13,
3000, ['건업'], null, 0,
[self::T_CAVALRY=>1.2, self::T_FOOTMAN=>0.8, self::T_SIEGE=>1.2],
[self::T_CAVALRY=>0.8, self::T_FOOTMAN=>1.2, self::T_SIEGE=>0.8],
['강력한 화살을 쏩니다.'],
null, null
null, ['che_궁병선제사격']
],
[
@@ -311,16 +311,16 @@ class GameUnitConstBase{
[
1500, self::T_SIEGE, '정란',
100, 100, 6, 0, 0, 15, 5,
100, 100, 6, 0, 0, 14, 5,
0, null, null, 3,
[self::T_FOOTMAN=>0.8, self::T_ARCHER=>0.8, self::T_CAVALRY=>0.8, self::T_WIZARD=>0.8, self::T_CASTLE=>1.8],
[self::T_FOOTMAN=>1.25, self::T_ARCHER=>1.25, self::T_CAVALRY=>1.25, self::T_WIZARD=>1.25, self::T_CASTLE=>1.8, 1106=>1.112],
[self::T_FOOTMAN=>1.2, self::T_ARCHER=>1.2, self::T_CAVALRY=>1.2, self::T_WIZARD=>1.2],
['높은 구조물 위에서 공격합니다.'],
['che_성벽부상무효'], null
],
[
1501, self::T_SIEGE, '충차',
150, 100, 6, 0, 0, 20, 5,
150, 100, 6, 0, 0, 18, 5,
1000, null, null, 3,
[self::T_FOOTMAN=>0.8, self::T_ARCHER=>0.8, self::T_CAVALRY=>0.8, self::T_WIZARD=>0.8, self::T_CASTLE=>2.4],
[self::T_FOOTMAN=>1.2, self::T_ARCHER=>1.2, self::T_CAVALRY=>1.2, self::T_WIZARD=>1.2],
@@ -329,16 +329,16 @@ class GameUnitConstBase{
],
[
1502, self::T_SIEGE, '벽력거',
200, 100, 6, 10, 0, 25, 5,
200, 100, 6, 10, 0, 18, 5,
3000, ['업'], null, 0,
[self::T_FOOTMAN=>1.25, self::T_ARCHER=>1.25, self::T_CAVALRY=>1.25, self::T_WIZARD=>1.25, self::T_CASTLE=>1.8],
[self::T_FOOTMAN=>0.833, self::T_ARCHER=>0.833, self::T_CAVALRY=>0.833, self::T_WIZARD=>0.833],
[self::T_FOOTMAN=>1.25, self::T_ARCHER=>1.25, self::T_CAVALRY=>1.25, self::T_WIZARD=>1.25, self::T_CASTLE=>1.8, 1106=>1.112],
[self::T_FOOTMAN=>0.833, self::T_ARCHER=>0.833, self::T_CAVALRY=>0.833, self::T_WIZARD=>0.833, 1106=>0.909],
['상대에게 돌덩이를 날립니다.'],
['che_성벽부상무효'], null
],
[
1503, self::T_SIEGE, '목우',
50, 200, 5, 0, 0, 30, 5,
50, 200, 5, 0, 0, 18, 5,
3000, ['성도'], null, 0,
[self::T_FOOTMAN=>0.8, self::T_ARCHER=>0.8, self::T_CAVALRY=>0.8, self::T_WIZARD=>0.8],
[self::T_FOOTMAN=>1.2, self::T_ARCHER=>1.2, self::T_CAVALRY=>1.2, self::T_WIZARD=>1.2],
+15 -4
View File
@@ -2004,6 +2004,7 @@ class GeneralAI
//수도와 연결된 도시 탐색
while (!$queue->isEmpty()) {
/** @var int */
$cityID = $queue->dequeue();
foreach (array_keys(CityConst::byID($cityID)->path) as $nextCityID) {
@@ -2377,6 +2378,9 @@ class GeneralAI
}
$tryBuying = false;
if ($general->getNPCType() < 2 && $relGold >= $goldCost * 3 && $relRice >= $riceCost * 3){
return null;
}
if ($this->generalPolicy->can상인무시) {
if ($relRice * 1.5 < $relGold && $relRice < $riceCost * 2) {
$tryBuying = true;
@@ -3643,9 +3647,9 @@ class GeneralAI
$npcType = $general->getNPCType();
$nationID = $general->getNationID();
//특별 메세지 있는 경우 출력 하루 4번
//특별 메세지 있는 경우 출력
$term = $this->env['turnterm'];
if ($general->getVar('npcmsg') && Util::randBool($term / (6 * 60))) {
if ($general->getVar('npcmsg') && Util::randBool(GameConst::$npcMessageFreqByDay * $term / (60 * 24))) {
$src = new MessageTarget(
$general->getID(),
$general->getVar('name'),
@@ -4091,17 +4095,21 @@ class GeneralAI
return 20;
}
$nationGenerals = $this->nationGenerals;
$nationGenerals[] = $this->general;
$dedicationList = array_map(function (General $general) {
return $general->getRaw();
}, array_filter($this->nationGenerals, function (General $rawGeneral) {
return $rawGeneral->getVar('officer_level') != 5;
return $rawGeneral->getVar('npc') != 5;
}));
$goldIncome = getGoldIncome($nation['nation'], $nation['level'], $nation['rate'], $nation['capital'], $nation['type'], $cityList);
$warIncome = getWarGoldIncome($nation['type'], $cityList);
$income = $goldIncome + $warIncome;
$outcome = getOutcome(100, $dedicationList);
$outcome = Util::valueFit(getOutcome(100, $dedicationList), 1);
$bill = intval($income / $outcome * 90); // 수입의 90% 만 지급
if ($nation['gold'] + $income - $outcome > $this->nationPolicy->reqNationGold * 2) {
@@ -4134,6 +4142,9 @@ class GeneralAI
return 20;
}
$nationGenerals = $this->nationGenerals;
$nationGenerals[] = $this->general;
$dedicationList = array_map(function (General $general) {
return $general->getRaw();
}, array_filter($this->nationGenerals, function (General $rawGeneral) {
+1 -1
View File
@@ -250,7 +250,7 @@ class ResetHelper{
'month'=> $month,
'init_year'=> $year,
'init_month'=>$month,
'map_theme' => $scenarioObj->getMapTheme(),
'map_theme' => $scenarioObj->getMapTheme(), //@deprecated
'season'=>$seasonIdx,
'msg'=>'공지사항',//TODO:공지사항
'maxgeneral'=>GameConst::$defaultMaxGeneral,
+28 -2
View File
@@ -47,8 +47,8 @@ class TriggerOfficerLevel implements iAction{
}
}
}
return $value;
}
@@ -58,4 +58,30 @@ class TriggerOfficerLevel implements iAction{
}
return $value;
}
public function getWarPowerMultiplier(WarUnit $unit): array
{
$officerLevel = $this->officerLevel;
$warPowerMultiply = 1;
$opposeWarPowerMultiply = 1;
if ($officerLevel == 12) {
$warPowerMultiply = 1.07;
$opposeWarPowerMultiply = 0.93;
}
else if($officerLevel == 11){
$warPowerMultiply = 1.05;
$opposeWarPowerMultiply = 0.95;
}
else if(in_array($officerLevel, [10, 8, 6])){
$warPowerMultiply = 1.10;
}
else if(in_array($officerLevel, [9, 7, 5])){
$opposeWarPowerMultiply = 0.90;
}
else if(in_array($officerLevel, [4, 3, 2])){
$warPowerMultiply = 1.05;
$opposeWarPowerMultiply = 0.95;
}
return [$warPowerMultiply, $opposeWarPowerMultiply];
}
}
+157 -88
View File
@@ -1,7 +1,9 @@
<?php
namespace sammo;
class WarUnit{
class WarUnit
{
protected $general;
protected $rawNation;
@@ -31,32 +33,39 @@ class WarUnit{
protected $logActivatedSkill = [];
protected $isFinished = false;
private function __construct(General $general){
private function __construct(General $general)
{
$this->general = $general;
}
/* XXX:Dirty wrapper */
function getRaw():array{
function getRaw(): array
{
return $this->general->getRaw();
}
function getVar(string $key){
function getVar(string $key)
{
return $this->general->getVar($key);
}
function touchVar(string $key):bool{
function touchVar(string $key): bool
{
return $this->general->touchVar($key);
}
function setVar(string $key, $value){
function setVar(string $key, $value)
{
return $this->general->setVar($key, $value);
}
function updateVar(string $key, $value){
function updateVar(string $key, $value)
{
return $this->general->updateVar($key, $value);
}
function updateVarWithLimit(string $key, $value, $min = null, $max = null){
function updateVarWithLimit(string $key, $value, $min = null, $max = null)
{
return $this->general->updateVarWithLimit($key, $value, $min, $max);
}
@@ -65,7 +74,8 @@ class WarUnit{
return $this->general->increaseVar($key, $value);
}
function increaseVarWithLimit(string $key, $value, $min = null, $max = null){
function increaseVarWithLimit(string $key, $value, $min = null, $max = null)
{
return $this->general->increaseVarWithLimit($key, $value, $min, $max);
}
@@ -74,170 +84,203 @@ class WarUnit{
return $this->general->multiplyVar($key, $value);
}
function multiplyVarWithLimit(string $key, $value, $min = null, $max = null){
function multiplyVarWithLimit(string $key, $value, $min = null, $max = null)
{
return $this->general->multiplyVarWithLimit($key, $value, $min, $max);
}
function getUpdatedValues():array {
function getUpdatedValues(): array
{
return $this->general->getUpdatedValues();
}
function flushUpdateValues():void {
function flushUpdateValues(): void
{
$this->general->flushUpdateValues();
}
protected function clearActivatedSkill(){
foreach($this->activatedSkill as $skillName=>$state){
if(!$state){
protected function clearActivatedSkill()
{
foreach ($this->activatedSkill as $skillName => $state) {
if (!$state) {
continue;
}
if(!key_exists($skillName, $this->logActivatedSkill)){
if (!key_exists($skillName, $this->logActivatedSkill)) {
$this->logActivatedSkill[$skillName] = 1;
}
else{
} else {
$this->logActivatedSkill[$skillName] += 1;
}
}
$this->activatedSkill = [];
}
function getActivatedSkillLog():array{
function getActivatedSkillLog(): array
{
return $this->logActivatedSkill;
}
function getRawNation():array{
function getRawNation(): array
{
return $this->rawNation;
}
function getNationVar(string $key){
function getNationVar(string $key)
{
return $this->rawNation[$key];
}
function getPhase():int{
function getPhase(): int
{
return $this->currPhase;
}
function getRealPhase():int{
function getRealPhase(): int
{
return $this->prePhase + $this->currPhase;
}
function getName():string{
function getName(): string
{
return 'EMPTY';
}
function isAttacker():bool{
function isAttacker(): bool
{
return $this->isAttacker;
}
function getCrewType():GameUnitDetail{
function getCrewType(): GameUnitDetail
{
return $this->crewType;
}
function getCrewTypeName():string{
function getCrewTypeName(): string
{
return $this->getCrewType()->name;
}
function getCrewTypeShortName():string{
function getCrewTypeShortName(): string
{
return $this->getCrewType()->getShortName();
}
function getLogger():ActionLogger{
function getLogger(): ActionLogger
{
$logger = $this->getGeneral()->getLogger();
if($logger === null){
if ($logger === null) {
throw new \RuntimeException();
}
return $logger;
}
function getKilled():int{
function getKilled(): int
{
return $this->killed;
}
function getDead():int{
function getDead(): int
{
return $this->dead;
}
function getKilledCurrentBattle():int{
function getKilledCurrentBattle(): int
{
return $this->killedCurr;
}
function getDeadCurrentBattle():int{
function getDeadCurrentBattle(): int
{
return $this->deadCurr;
}
function getGeneral():General{
function getGeneral(): General
{
return $this->general;
}
function getMaxPhase():int{
function getMaxPhase(): int
{
$phase = $this->getCrewType()->speed;
return $phase + $this->bonusPhase;
}
function setPrePhase(int $phase){
function setPrePhase(int $phase)
{
$this->prePhase = $phase;
}
function addPhase(){
$this->currPhase += 1;
function addPhase(int $phase = 1)
{
$this->currPhase += $phase;
}
function addBonusPhase(int $cnt){
function addBonusPhase(int $cnt)
{
$this->bonusPhase += $cnt;
}
function setOppose(?WarUnit $oppose){
function setOppose(?WarUnit $oppose)
{
$this->oppose = $oppose;
$this->killedCurr = 0;
$this->deadCurr = 0;
$this->clearActivatedSkill();
}
function getOppose():?WarUnit{
function getOppose(): ?WarUnit
{
return $this->oppose;
}
function getWarPower(){
function getWarPower()
{
return $this->warPower * $this->warPowerMultiply;
}
function getRawWarPower(){
function getRawWarPower()
{
return $this->warPower;
}
function getWarPowerMultiply(){
function getWarPowerMultiply()
{
return $this->warPowerMultiply;
}
function setWarPowerMultiply($multiply = 1.0){
function setWarPowerMultiply($multiply = 1.0)
{
$this->warPowerMultiply = $multiply;
}
function multiplyWarPowerMultiply($multiply){
function multiplyWarPowerMultiply($multiply)
{
$this->warPowerMultiply *= $multiply;
}
function getComputedAttack(){
function getComputedAttack()
{
return $this->getCrewType()->getComputedAttack($this->general, $this->getNationVar('tech'));
}
function getComputedDefence(){
function getComputedDefence()
{
return $this->getCrewType()->getComputedDefence($this->general, $this->getNationVar('tech'));
}
function computeWarPower(){
function computeWarPower()
{
$oppose = $this->getOppose();
$general = $this->general;
$opposeGeneral = $oppose->getGeneral();
$myAtt = $this->getComputedAttack();
$opDef = $oppose->getComputedDefence();
// 감소할 병사
// 감소할 병사
$warPower = GameConst::$armperphase + $myAtt - $opDef;
$opposeWarPowerMultiply = 1.0;
if($warPower < 100){
if ($warPower < 100) {
//최소 전투력 50 보장
$warPower = max(0, $warPower);
$warPower = ($warPower + 100) / 2;
@@ -248,11 +291,11 @@ class WarUnit{
$warPower /= $oppose->getComputedTrain();
$genDexAtt = $this->getDex($this->getCrewType(), true);
$oppDexDef = $oppose->getDex($this->getCrewType(), false);
$warPower *= getDexLog($genDexAtt, $oppDexDef);
$warPower *= $this->getCrewType()->getAttackCoef($oppose->getCrewType());
$opposeWarPowerMultiply *= $this->getCrewType()->getDefenceCoef($oppose->getCrewType());
@@ -262,117 +305,143 @@ class WarUnit{
return [$warPower, $opposeWarPowerMultiply];
}
function addTrain(int $train){
function addTrain(int $train)
{
return;
}
function addAtmos(int $atmos){
function addAtmos(int $atmos)
{
return;
}
function addTrainBonus(int $trainBonus){
function addTrainBonus(int $trainBonus)
{
$this->trainBonus += $trainBonus;
}
function addAtmosBonus(int $atmosBonus){
function addAtmosBonus(int $atmosBonus)
{
$this->atmosBonus += $atmosBonus;
}
function getComputedTrain(){
function getComputedTrain()
{
return GameConst::$maxTrainByCommand;
}
function getComputedAtmos(){
function getComputedAtmos()
{
return GameConst::$maxAtmosByCommand;
}
function getComputedCriticalRatio():float{
function getComputedCriticalRatio(): float
{
return $this->getCrewType()->getCriticalRatio($this->general);
}
function getComputedAvoidRatio():float{
function getComputedAvoidRatio(): float
{
return $this->getCrewType()->avoid / 100;
}
function addWin(){
function addWin()
{
}
function addLose(){
function addLose()
{
}
function getDex(GameUnitDetail $crewType){
function getDex(GameUnitDetail $crewType)
{
throw new NotInheritedMethodException();
}
function finishBattle(){
function finishBattle()
{
throw new NotInheritedMethodException();
}
function beginPhase():void{
function beginPhase(): void
{
$this->clearActivatedSkill();
$this->computeWarPower();
}
function hasActivatedSkill(string $skillName):bool{
return $this->activatedSkill[$skillName]??false;
function hasActivatedSkill(string $skillName): bool
{
return $this->activatedSkill[$skillName] ?? false;
}
function hasActivatedSkillOnLog(string $skillName):int{
return ($this->logActivatedSkill[$skillName]??0)+($this->hasActivatedSkill($skillName)?1:0);
function hasActivatedSkillOnLog(string $skillName): int
{
return ($this->logActivatedSkill[$skillName] ?? 0) + ($this->hasActivatedSkill($skillName) ? 1 : 0);
}
function activateSkill(... $skillNames){
foreach($skillNames as $skillName){
function activateSkill(...$skillNames)
{
foreach ($skillNames as $skillName) {
$this->activatedSkill[$skillName] = true;
}
}
function deactivateSkill(... $skillNames){
foreach($skillNames as $skillName){
function deactivateSkill(...$skillNames)
{
foreach ($skillNames as $skillName) {
$this->activatedSkill[$skillName] = false;
}
}
function getHP():int{
function getHP(): int
{
throw new NotInheritedMethodException();
}
function decreaseHP(int $damage):int{
function decreaseHP(int $damage): int
{
$this->dead += $damage;
throw new NotInheritedMethodException();
}
function increaseKilled(int $damage):int{
function increaseKilled(int $damage): int
{
$this->killed += $damage;
throw new NotInheritedMethodException();
}
function calcDamage():int{
function calcDamage(): int
{
$warPower = $this->getWarPower();
$warPower *= Util::randRange(0.9, 1.1);
return Util::round($warPower);
}
function tryWound():bool{
function tryWound(): bool
{
return false;
}
function continueWar(&$noRice):bool{
function continueWar(&$noRice): bool
{
//전투가 가능하면 true
$noRice = false;
return false;
}
function logBattleResult(){
function logBattleResult()
{
$this->getLogger()->pushBattleResultTemplate($this, $this->getOppose());
}
function criticalDamage():float{
function criticalDamage(): float
{
//전특, 병종에 따라 필살 데미지가 달라질지도 모르므로 static 함수는 아닌 것으로
return Util::randRange(1.3, 2.0);
}
function applyDB(\MeekroDB $db):bool{
function applyDB(\MeekroDB $db): bool
{
throw new MustNotBeReachedException('Must be WarUnitCity or WarUnitGeneral');
}
}
}
-20
View File
@@ -209,25 +209,6 @@ class WarUnitGeneral extends WarUnit
[$warPower, $opposeWarPowerMultiply] = parent::computeWarPower();
$general = $this->general;
$cityID = $general->getCityID();
$officerLevel = $general->getVar('officer_level');
$officerCity = $general->getVar('officer_city');
if ($this->isAttacker) {
if ($officerLevel == 12) {
$warPower *= 1.10;
} else if ($officerLevel == 11 || $officerLevel == 10 || $officerLevel == 8 || $officerLevel == 6) {
$warPower *= 1.05;
}
} else {
if ($officerLevel == 12) {
$opposeWarPowerMultiply *= 0.90;
} else if ($officerLevel == 11 || $officerLevel == 9 || $officerLevel == 7 || $officerLevel == 5) {
$opposeWarPowerMultiply *= 0.95;
} else if (2 <= $officerLevel && $officerLevel <= 4 && $officerCity == $cityID) {
$opposeWarPowerMultiply *= 0.95;
}
}
$expLevel = $general->getVar('explevel');
@@ -238,7 +219,6 @@ class WarUnitGeneral extends WarUnit
$opposeWarPowerMultiply *= max(0.01, 1 - $expLevel / 300);
}
[$specialMyWarPowerMultiply, $specialOpposeWarPowerMultiply] = $this->general->getWarPowerMultiplier($this);
$warPower *= $specialMyWarPowerMultiply;
$opposeWarPowerMultiply *= $specialOpposeWarPowerMultiply;
@@ -0,0 +1,52 @@
<?php
namespace sammo\WarUnitTrigger;
use sammo\ActionLogger;
use sammo\BaseWarUnitTrigger;
use sammo\GameUnitConst;
use sammo\WarUnitGeneral;
use sammo\WarUnitCity;
use sammo\WarUnit;
use sammo\GameUnitDetail;
use sammo\Util;
use sammo\ObjectTrigger;
class che_궁병선제사격 extends BaseWarUnitTrigger
{
protected $priority = ObjectTrigger::PRIORITY_BEGIN;
protected function actionWar(WarUnit $self, WarUnit $oppose, array &$selfEnv, array &$opposeEnv): bool
{
assert($self instanceof WarUnitGeneral, 'General만 발동 가능');
if ($self->getPhase() !== 0 && $oppose->getPhase() !== 0) {
return true;
}
if ($self->hasActivatedSkill('선제')) {
return true;
}
if ($self->hasActivatedSkillOnLog('선제')) {
return true;
}
$self->activateSkill('특수', '선제');
if (!$self->isAttacker()) {
$self->addPhase(-1);
$oppose->addPhase(-1);
if ($oppose->getCrewType()->armType == GameUnitConst::T_ARCHER) {
$oppose->multiplyWarPowerMultiply(0.5);
} else {
$oppose->multiplyWarPowerMultiply(0);
$self->activateSkill('회피불가', '필살불가', '계략불가');
$oppose->activateSkill('회피불가', '계략불가');
}
} else {
$oppose->multiplyWarPowerMultiply(0.5);
}
$oppose->getLogger()->pushGeneralBattleDetailLog('상대에게 <R>선제 사격</>을 받았다!</>', ActionLogger::PLAIN);
$self->getLogger()->pushGeneralBattleDetailLog('상대에게 <C>선제 사격</>을 했다!</>', ActionLogger::PLAIN);
return true;
}
}
@@ -20,11 +20,14 @@ class che_돌격지속 extends BaseWarUnitTrigger{
if(!$self->isAttacker()){
return true;
}
if($self->getPhase() < $self->getMaxPhase() - 1){
return true;
}
$attackCoef = $self->getCrewType()->getAttackCoef($oppose->getCrewType());
if($attackCoef < 1){
if($oppose->hasActivatedSkill('선제') && $self->getPhase() >= $self->getMaxPhase() - 2){
$self->addBonusPhase(-1);
}
return true;
}
if($self->getPhase() < $self->getMaxPhase() - 1){
return true;
}
$self->addBonusPhase(1);
@@ -33,9 +33,6 @@ class che_약탈발동 extends BaseWarUnitTrigger
return true;
}
$general->increaseVarWithLimit('atmos', $selfEnv['addAtmos'], 0, GameConst::$maxAtmosByWar);
$opposeGeneral = $oppose->getGeneral();
$theftGold = $opposeGeneral->getVar('gold') * $selfEnv['theftRatio'];
+11 -1
View File
@@ -4,7 +4,8 @@
"history":[
],
"const": {
"joinRuinedNPCProp":0
"joinRuinedNPCProp":0,
"npcBanMessageProb":1
},
"events":[
[
@@ -34,6 +35,15 @@
],
["OpenNationBetting", 1, 1000],
["DeleteEvent"]
],
[
"destroy_nation", 1000,
["and",
["Date", ">=", 183, 1],
["RemainNation", "==", 1]
],
["BlockScoutAction"],
["DeleteEvent"]
]
]
}
+11 -1
View File
@@ -7,7 +7,8 @@
"history":[
],
"const": {
"joinRuinedNPCProp":0
"joinRuinedNPCProp":0,
"npcBanMessageProb":1
},
"events":[
[
@@ -37,6 +38,15 @@
],
["OpenNationBetting", 1, 1000],
["DeleteEvent"]
],
[
"destroy_nation", 1000,
["and",
["Date", ">=", 183, 1],
["RemainNation", "==", 1]
],
["BlockScoutAction"],
["DeleteEvent"]
]
]
}
+9 -1
View File
@@ -727,6 +727,14 @@
]
],
"events":[
[
"destroy_nation", 1000,
["and",
["Date", ">=", 183, 1],
["RemainNation", "==", 1]
],
["BlockScoutAction"],
["DeleteEvent"]
]
]
}
+9 -1
View File
@@ -873,6 +873,14 @@
]
],
"events":[
[
"destroy_nation", 1000,
["and",
["Date", ">=", 183, 1],
["RemainNation", "==", 1]
],
["BlockScoutAction"],
["DeleteEvent"]
]
]
}
+9 -1
View File
@@ -798,6 +798,14 @@
]
],
"events":[
[
"destroy_nation", 1000,
["and",
["Date", ">=", 183, 1],
["RemainNation", "==", 1]
],
["BlockScoutAction"],
["DeleteEvent"]
]
]
}
+9 -1
View File
@@ -775,6 +775,14 @@
]
],
"events":[
[
"destroy_nation", 1000,
["and",
["Date", ">=", 183, 1],
["RemainNation", "==", 1]
],
["BlockScoutAction"],
["DeleteEvent"]
]
]
}
+9
View File
@@ -750,6 +750,15 @@
]
],
"events":[
[
"destroy_nation", 1000,
["and",
["Date", ">=", 183, 1],
["RemainNation", "==", 1]
],
["BlockScoutAction"],
["DeleteEvent"]
]
]
}
+9
View File
@@ -756,6 +756,15 @@
]
],
"events":[
[
"destroy_nation", 1000,
["and",
["Date", ">=", 183, 1],
["RemainNation", "==", 1]
],
["BlockScoutAction"],
["DeleteEvent"]
]
]
}
+9
View File
@@ -763,6 +763,15 @@
]
],
"events":[
[
"destroy_nation", 1000,
["and",
["Date", ">=", 183, 1],
["RemainNation", "==", 1]
],
["BlockScoutAction"],
["DeleteEvent"]
]
]
}
+11 -2
View File
@@ -8,8 +8,8 @@
},
"nation":[
["조조", "#000080", 10000, 10000, "강남 정벌에 실패한 뒤 한중을 노리는 조조", 1000, "병가", 6, [
"허창", "역경", "계교", "관도", "정도", "서주", "호관", "호로", "사곡", "함곡", "사수", "계",
"북평", "진양", "남피", "평원", "하내", "업", "북해", "복양", "안정", "장안", "홍농", "낙양",
"허창", "역경", "계교", "관도", "정도", "서주", "호관", "호로", "사곡", "함곡", "사수", "계",
"북평", "진양", "남피", "평원", "하내", "업", "북해", "복양", "안정", "장안", "홍농", "낙양",
"진류", "패", "초", "하비", "완", "여남", "수춘", "신야", "양양"
]],
["손권", "#FF0000", 10000, 10000, "적벽대전을 대승으로 이끈 뒤 세력을 재정비하는 손권", 1000, "덕가", 4, [
@@ -749,6 +749,15 @@
]
],
"events":[
[
"destroy_nation", 1000,
["and",
["Date", ">=", 183, 1],
["RemainNation", "==", 1]
],
["BlockScoutAction"],
["DeleteEvent"]
]
]
}

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