Compare commits

..
266 Commits
Author SHA1 Message Date
Hide_D 7a3642296a feat: 전투 시뮬레이터에 히든 버프 반영 가능 2023-02-24 00:25:29 +09:00
Hide_D 87e57aea0e feat: 전투 시뮬레이터에 시드 값 입력 가능
- 시드 값 입력시 반복 횟수는 1회로 고정
- 스킬 성공 여부는 동일하나, 실제 수치가 조금 다른 경우가 관측 이유는 추후 확인
- 히든 버프는 아직 미 반영
2023-02-23 23:48:09 +09:00
Hide_D ea256790ec game: 계략에서 도시 인구별 방어 계산식을 제곱근에서 로그로 변경
- (log(장수수 + 1, 2) - 1.25) * 0.04
- 8명까지는 기존 계산식과 큰 차이 없음
2023-02-23 22:59:10 +09:00
Hide_D 4cbd824ee0 fix: 초기 갱신 없이 국가 삭제시 버그 수정 2023-02-23 00:30:42 +09:00
Hide_D 4db1a4b32e fix: 접속자, 접속량 계산에 문제가 있던 부분 수정 2023-02-23 00:25:44 +09:00
Hide_D c060e05553 refac: 메시지 전달 j_ 코드를 API로 변경
- 메시지 전송
- 최근 메시지 수신
- 이전 메시지 수신
- 메시지 응답
- 연락처 수신
- 메시지 삭제
2023-02-22 01:29:00 +09:00
Hide_D 92cd195276 fix: 사령부 타 수뇌 텍스트 복사의 턴 순서도 수정 2023-02-21 02:32:18 +09:00
Hide_D f9b270fef3 fix: 텍스트 복사에서 턴 번호가 제대로 옮겨지지 않는 버그 수정 2023-02-21 02:29:23 +09:00
Hide_D 3f12dfd8ba feat: 턴 조작기에 '텍스트 복사' 추가 2023-02-21 02:26:52 +09:00
Hide_D d7e57f30eb fix: 사령부 복사하기 순서 지연 수정 시도 2023-02-21 02:04:03 +09:00
Hide_D ff822561cd game: 기병의 수비시 전투력 향상
- 기존 대비 전투력 5% 향상
2023-02-21 01:59:59 +09:00
Hide_D 273973f4b6 fix: Uri 기본 사용 방법 변경 2023-02-20 02:23:54 +09:00
Hide_D c648e2df85 fix: WebUtil Namespace 2023-02-20 01:27:52 +09:00
Hide_D 9b7e0ef169 fix, dep: 사용불가능한 phpuri를 league/uri로 대체
- 테스트 아직 없음
2023-02-20 01:02:18 +09:00
Hide_D 6eccd248ea dep: composer 2.5.4 2023-02-20 00:28:04 +09:00
Hide_D eaaa1c5da8 game: 초토화가 치안, 수비, 성벽도 낮추도록 변경 2023-02-05 15:59:33 +09:00
Hide_D 95776cda5c fix: 궁병이 아닌 경우에도 '맞 선제'가 정상 작동하도록 수정
- 궁병선제사격을 선제사격시도, 선제사격발동으로 분리
- 맞선제의 기준을 궁병이 아니라 '선제'의 활성화 여부로 구분
2023-01-28 03:09:44 +09:00
Hide_D 8ae0323dcc fix: 선제 사격에 저격을 쓰지 못하게 해야함 2023-01-28 02:56:35 +09:00
Hide_D f2d0020d92 fix: 피장파장은 피장파장을 대상으로 할 수 없음 2023-01-27 00:51:12 +09:00
Hide_D 67f3004eb0 fix: 이미 다른 부위에 입찰중인 경우 경매가 열리다 마는 버그 수정 2023-01-27 00:43:11 +09:00
Hide_D f933c0616b fix: 턴시간 고정이 0분만 가능한 버그 수정 2023-01-26 14:36:59 +09:00
Hide_D a240c6f901 game: 아시아 명장전(빙의전용) 생성 2023-01-02 20:05:07 +09:00
Hide_D e2c2ae0360 feat, refact: 메시지 응답 2022-12-05 01:55:38 +09:00
Hide_D bcd0117cdd misc: 메시지 삭제 API 정리 2022-12-05 01:42:54 +09:00
Hide_D 83f233cc99 feat, refac: 메시지 삭제 2022-12-05 01:40:12 +09:00
Hide_D 4f21eab7b1 feat, refact: 메시지 연락 리스트 수신 2022-12-05 01:10:41 +09:00
Hide_D 864ddf7efe feat, refac: 메시지 전송 2022-12-05 00:46:16 +09:00
Hide_D 9d3636cc49 misc: APIHelper에서 array가 반환된 경우 result: true 자동 삽입 2022-12-05 00:42:09 +09:00
Hide_D ce4f656030 fix: 정상 깃수 기준을 1 이상으로 변경 2022-12-02 00:43:43 +09:00
Hide_D a94f080cde fix: 미접속 유산 포인트 부여에서 '이벤트 깃수'를 카운트하는 버그 수정 2022-12-02 00:41:44 +09:00
Hide_D 71ca873c7a fix: msgOption은 null을 허용해야함. 2022-12-02 00:23:07 +09:00
Hide_D 6e0d13e1fb fix: 장수 생성시 보너스 스탯 표기 오류 2022-12-01 22:24:09 +09:00
Hide_D 059c4d999a game: 맞 선제시 이전 패치에서 변경된 전투력 반영 2022-12-01 01:13:43 +09:00
Hide_D f52e357e8a fix: 디버그용 코드 수정 2022-12-01 01:02:13 +09:00
Hide_D 761496be5c game: 정란, 벽력에 선제사격 추가, 벽력 공격력 약화
- 6페이즈 전투 기준으론 공격력 유지
- 벽력기준 돌격, 수비전 등에서 상대적 약화
2022-12-01 01:00:30 +09:00
Hide_D 551972d876 feat, refac: 오래된 메시지 불러오기 2022-11-30 01:32:17 +09:00
Hide_D 81c2fc4d43 game: 궁병의 선제 사격을 일반 공격력의 50%에서 2/3로 변경 2022-11-30 00:14:24 +09:00
Hide_D 3e542fcbfa game: 궁기병의 보병 상성 상향 수준 억제
- 공격력: 12.5% 향상
- 방어력: 9.1% 향상
2022-11-30 00:10:44 +09:00
Hide_D c9ab2c593d game: 궁기병의 보병 상대 전투력 향상
- 공격력 25% 향상 (20% 열세)
- 방어력 20% 향상 (25% 열세)
2022-11-30 00:07:46 +09:00
Hide_D 0c9e00e90a game: 목우의 수비 상성 약화
- 1.2(초기) -> 0.8(무상성) -> 1(현재)
- 25% 아군 피해 증가
2022-11-30 00:04:24 +09:00
Hide_D ea17972478 fix: 제거한 troop.ts 파일 빌드 수정 2022-11-29 02:13:43 +09:00
Hide_D 3d40df9755 feat, refac: 최근 메시지 API 2022-11-29 02:06:57 +09:00
Hide_D b4ac348645 Refac: 메시지 타입 지정으로 MessageType Enum 사용 2022-11-29 01:53:55 +09:00
Hide_D 374611f66c refac: MessageType enum 2022-11-29 01:49:19 +09:00
Hide_D 39b66fd626 misc: 사용되지 않는 구버전 부대편성 코드 제거 2022-11-28 23:51:21 +09:00
Hide_D 75dca322b4 fix: UserID가 null인 경우 대응 2022-11-10 17:14:21 +09:00
Hide_D cfdae1ddfa misc: 관리를 위해 mkdir에 group permission 부여 2022-11-05 15:17:57 +09:00
Hide_D 054a6c7073 feat: 모든 API를 기록하는 시스템
- sqlite3에 기록
- 느려지지 않기를...
2022-11-05 15:00:13 +09:00
Hide_D e93d9e6cf5 feat: API에서 민감한 argument 지정 2022-11-05 14:59:52 +09:00
Hide_D 30d99c6fc3 fix: DummySession에서 get이 잘못됨. 2022-11-05 14:58:22 +09:00
Hide_D 56c9b44c93 game: 이벤트 유니크 분실 메시지를 흥미롭게 변경 2022-11-02 21:17:04 +09:00
Hide_D 919ae5a863 game: 무작위 세계 이벤트 시나리오 가오픈 재생성 주기 단축 2022-11-01 23:00:59 +09:00
Hide_D 43b8e546f6 feat: 시나리오 별 사전 생성 시 재 생성 주기 결정 가능 2022-11-01 23:00:25 +09:00
Hide_D b90aef662b game: 무작위 세계 시나리오 초기 등록 2022-10-30 22:13:39 +09:00
Hide_D 1da47863ae feat: 전역 아이템 망실 이벤트 추가 2022-10-30 22:13:25 +09:00
Hide_D 81bd5c1914 feat: 무작위건국, 무작위수도이전 커맨드 추가 2022-10-30 21:47:24 +09:00
Hide_D b14f9a638f fix: 무작위장수명 모드에서 장수명이 제대로 지정되지 않음 2022-10-30 21:41:12 +09:00
Hide_D 8ff3a5a7a8 feat: GameConst에서 유니크 획득 확률 조정 가능 2022-10-30 21:29:48 +09:00
Hide_D 48c77bd6a2 feat: 장수명 무작위 생성 모드 가능 2022-10-30 15:16:40 +09:00
35a017c1dc fix: 천통 후 서버시드 출력 시 괄호를 열지 않고 닫았던 문제 수정 (#227)
Co-authored-by: Jinhyun Kim <lewha0@gmail.com>
Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/227
Reviewed-by: Hide_D <hided62@gmail.com>
Co-authored-by: lewha0 <lewha0@noreply.storage.hided.net>
Co-committed-by: lewha0 <lewha0@noreply.storage.hided.net>
2022-10-10 03:29:48 +09:00
Hide_D a3e8a10da9 game: 건국 시점 유산 포인트 베팅 제공량 상향 2022-10-10 01:39:42 +09:00
Hide_D 142b96836e refac: 신규/복귀 유저 유산 포인트 지급 로직을 조금더 최적화 2022-10-05 00:26:04 +09:00
Hide_D 9be0d2ec2d refac: storeOldGeneral을 General::kill로 이동 2022-10-04 20:38:18 +09:00
Hide_D fd817650e7 fix: 지급 버그 수정 2022-10-04 11:32:52 +09:00
Hide_D 3c6cb96a9b feat: 신규/복귀 유저에게 장수 생성 시 유산 포인트 제공
- 이벤트 깃수 제외 500포인트
- 8기까지 적립
2022-10-04 11:25:40 +09:00
Hide_D c4537454f9 fix: 최대 임관년도 수 계산 버그 재 수정 2022-10-04 10:02:39 +09:00
Hide_D 82cdaa433e fix: 최대 임관년도 수 계산 버그 2022-10-04 01:07:11 +09:00
Hide_D 32dd3ff43f misc: AI에서 삭턴NPC 구분 기준을 1턴 추가 2022-10-04 00:13:52 +09:00
Hide_D 6a5840faaa fix: AI 후방 발령 누락분 수정 2022-10-03 23:38:53 +09:00
Hide_D 5b0a3b064d fix: AI 후방 발령 로직 버그 수정
- 징병시 인구 소모가 없는 경우 후방 발령 제외
- NPC 수뇌일때와 유저 수뇌일 때 도시 인구 계산식 다른 버그 수정
2022-10-03 23:37:07 +09:00
Hide_D 14b8bb9790 fix: 2번 연속 멸망 시 유산 포인트 계산 오류 2022-10-03 11:32:22 +09:00
Hide_D 650f4a5903 fix: 구조상 베팅 당첨 포인트는 은퇴시 반영되어야 함 2022-10-03 00:37:18 +09:00
Hide_D c50410a6da game: 은퇴시 토너먼트 보정치를 100%로
- 실수였음!
2022-10-02 23:27:41 +09:00
Hide_D b2a676cd8b game: 옥란백용구 향상 최대 30% -> 50% 2022-10-02 23:25:00 +09:00
Hide_D 50a75e4543 refac, game: 은퇴 시 포인트 반영 방식 변경
- 반영하지 않고 은퇴 이후로 넘기는 포인트 추가
- 은퇴시 계수를 Obj로 이동
2022-10-02 19:41:38 +09:00
Hide_D 22172ac66f fix: null coalesing 수정 2022-10-02 19:39:35 +09:00
Hide_D 392aaa343d fix: calcGenType을 updateInstance()로 이동 2022-10-02 19:36:17 +09:00
Hide_D d924f47d58 fix: warning 발생 제거 2022-10-02 19:35:05 +09:00
Hide_D 3b70cbe724 fix: GeneralAI env 설정 관련 버그 수정 2022-10-02 17:46:20 +09:00
Hide_D 5c3233f883 misc: 서버 리셋 페이지에서 기본 설정값 변경
- 자율 행동 전부 선택
- 자율 행동 기본 시간 24시간
- 사실모드: 가상
2022-10-02 17:43:40 +09:00
Hide_D b570bfa9d4 fix: NPC선전포고, 긴급포상에서 내부 NPC 국가 상태를 업데이트하도록 수정 2022-10-02 17:37:40 +09:00
Hide_D 270cb25285 refac: GeneralAI에서 상태를 추가 업데이트할 수 있도록 구조 변경 2022-10-02 17:33:23 +09:00
Hide_D 7d3b0db924 game: 계략 성공률을 5%p 하향
- 계략 성공률에 인구수를 반영하기 이전과 비교하여 1명있을 때에는 동일
- 한명도 없을때는 5%p 상승
- 두명 이상일 때에는 이전 대비 성공률 하향
2022-10-02 15:59:30 +09:00
Hide_D 74d310e113 fix: 불가침에서 '까지'는 해당 월을 포함하여야 함 2022-10-02 15:55:31 +09:00
Hide_D 45afb1c090 fix: 수동 은퇴 시 명예의전당에 등록되지 않는 버그 2022-09-27 10:00:44 +09:00
Hide_D 40fc2f8bbf fix: NPC 순간이동이 보급이 끊긴 도시에도 갈 수 있는 버그 수정 2022-09-24 22:29:58 +09:00
Hide_D a9de5a92e1 build: pre-commit에 lint 제거 2022-09-24 20:58:56 +09:00
Hide_D c592b00c3f game: 피장파장에 추가되었던 글로벌 전략 1턴 제거 2022-09-24 20:57:44 +09:00
Hide_D 2c81be4d12 game: 계략 방어 확률에 도시 거주 장수 수 반영
- sqrt(장수 수) * 5%p
2022-09-23 21:59:51 +09:00
Hide_D f10289f7b6 game: 피장파장은 이제 전략
- 글로벌 쿨 1턴
- 피장파장 쿨 8턴
2022-09-23 21:56:15 +09:00
Hide_D c1f06b4ce5 fix: 최대 임관 년도 수 제어 규약 우회 2022-09-22 11:54:47 +09:00
Hide_D 9ad3dbba90 game: 배신 관련 최종 수정, 20%부터, +10%p씩
- 공지 추가
2022-09-21 23:25:20 +09:00
Hide_D 12c62f87f7 game: 초기 배신 수치 추가 보정
- 배신 수치를 '2'로 변경.
- 명성 패널티를 30%로 시작해서 45%, 60%
2022-09-21 23:16:29 +09:00
Hide_D 635f1ae077 feat, game: 초반 '배신 수치' 1 증가, 배신 패널티 증가
- 184년 1월부터 배신수치 1 증가.
- 배신 패널티 당 15%, 최대 6회
2022-09-21 23:12:56 +09:00
Hide_D c89bd2f63f fix: 하야, 망명 시 최대 임관 년수가 반영되지 않는 버그 수정 2022-09-21 22:48:55 +09:00
Hide_D 2f94a8a2ca fix: 가오픈 기간 중 사망 메시지에서 조사가 중복되어 나오던 문제 수정 (#226)
Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/226
Reviewed-by: Hide_D <hided62@gmail.com>
2022-09-14 12:07:08 +09:00
Jinhyun Kim 85b0d35af0 fix: 가오픈 기간 중 사망 메시지에서 조사가 중복되어 나오던 문제 수정 2022-09-14 11:42:19 +09:00
Hide_D b25acacb1e fix: 징병 특기에 '비용 감소' 제거 누락 2022-09-10 19:04:46 +09:00
Hide_D c05a43f3b1 fix(oauth): 이메일 변경 시 oauthID를 받아오지 못하는 분기 수정 2022-09-09 03:28:18 +09:00
Hide_D d99976daa9 fix(oauth): 카카오로그인에서 이메일만 바뀐 경우 이메일 갱신 2022-09-09 03:11:34 +09:00
Hide_D 62f53d09bf feat, game: 징병 전특 리밸런싱, 징병/소집해제시 인구 변동 트리거 설정 2022-09-06 19:48:52 +09:00
Hide_D 88c78ec892 game, misc: 작위 상승 메시지 변경 2022-09-01 02:49:20 +09:00
Hide_D 006ca76922 refac: ExecuteEngine 반환 타입 변경 2022-08-30 22:51:14 +09:00
Hide_D 8cb2e2a447 fix: OAuth Redirect UTI가 사전 값과 다른 경우 domain 보정 2022-08-28 18:00:53 +09:00
Hide_D 517c85d003 misc: oauth.php 에러 상세 표기 2022-08-28 17:37:55 +09:00
Hide_D 83556b710c fix, feat: HTTP_HOST가 다른 경우에도 oauth redirect 허용
- oauth 대상에서 redirect 허용 host를 설정해야함.
2022-08-28 17:24:25 +09:00
Hide_D a43b9091f8 feat: WebUtil::replaceDomain 2022-08-28 17:21:37 +09:00
Hide_D e83a1bef49 fix, misc: 사이시옷 수정 2022-08-28 15:45:44 +09:00
Hide_D 1147a8262c fix: 아이템 이름 오기 2022-08-28 15:41:50 +09:00
Hide_D 8a987cc55e fix: 조사 관련 문제 수정 2022-08-28 15:40:52 +09:00
Hide_D b28ca864f9 dep: package update 2022-08-28 15:30:35 +09:00
Hide_D 4bf77a5c55 game: 궁병 공격 시도, 추가페이즈 선제 공격
- 수비 선제와 구조적으로 동일
- 첫번째 상대에게 선제 사격
- 궁병과 궁병의 대결인 경우 항상 맞 선제 사격
2022-08-28 14:35:14 +09:00
Hide_D 4ebc20f182 game: 전투 첫 페이즈 계략시도 보정은 무장 제외 2022-08-28 14:17:09 +09:00
Hide_D 9eff1ccaed fix: 경매장 이름 풀 난수 생성기에 seed 초기화값 문제 수정 2022-08-27 12:15:12 +09:00
Hide_D 66170c98dd game: 수비 끔 시 사기 감소량 -3 => -6 2022-08-27 03:00:16 +09:00
Hide_D 397c054c66 game: 유니크 경매 제한 시간 감소
- 1분턴 마감시간 기준 1시간 -> 30분
2022-08-27 02:57:01 +09:00
Hide_D 0611551dc0 game: 의병모집 생성량 변경
- 3 + 연감 기준 평균 장수수 / 8 (반올림)
- 국가별 장수수가 평균 80명부터 역전
2022-08-27 02:46:44 +09:00
Hide_D 008f88d995 game: 전투시 얻는 기술량에서 공격자 상향
- 공격자 기술: 공격자가 입은 피해 * 0.012 (구 0.01)
- 수비자 기술: 수비자가 입은 피해 * 0.009 (구 0.01)
2022-08-27 02:39:47 +09:00
Hide_D 7fe450bc07 Revert "revert: LazyVarUpdater에 \BackedEnum 롤백"
This reverts commit a88ec71b44.
2022-08-26 22:16:06 +09:00
Hide_D a88ec71b44 revert: LazyVarUpdater에 \BackedEnum 롤백 2022-08-26 17:30:24 +09:00
Hide_D 8a5a3b67f7 refac: utilGame/getNPCColor 2022-08-26 01:06:43 +09:00
Hide_D 63771da876 misc: utilGame/index.ts 2022-08-26 00:34:56 +09:00
Hide_D 68891fafdb misc: CityColumn enum 2022-08-26 00:34:45 +09:00
Hide_D df31300a0b refac: GeneralBasicCard의 부대장 요구 정보를 간소화 2022-08-26 00:34:42 +09:00
Hide_D 16fb782bbf refac: LazyVarUpdater의 key로 BackedEnum 허용 2022-08-26 00:34:39 +09:00
Hide_D ed3e013a53 misc: GeneralColumn enum 추가 2022-08-26 00:34:32 +09:00
Hide_D 0bf568a655 feat: 국방 설정 시, 작성자와 작성 일시를 기록 2022-08-26 00:34:15 +09:00
Hide_D a5e481af96 fix: utilGame format에서 한단계 다르게 차이나는 버그 수정 2022-08-21 18:53:55 +09:00
Hide_D 78a9641c14 dep: lodash -> lodash-es 2022-08-21 18:14:36 +09:00
Hide_D b517000650 game: 성벽 공격 시 소모 쌀 20% 감소 2022-08-21 17:52:25 +09:00
Hide_D 1d20eb3c3e game: 초반 M장 생성 시 무지장 대량 생성 2022-08-21 17:42:33 +09:00
Hide_D 8248ccbcd5 game: 시간이 지남에 따라 성벽 강화
- 183년 기준 동일.
- 220년 기준 40% 전투력 상승
2022-08-20 15:03:58 +09:00
Hide_D b880b9bace game: NPC가 조금 더 상위병종을 시도할 확률을 높임 2022-08-20 14:39:51 +09:00
Hide_D 2da374410b game: 필살 계수 향상 방식 너프 2022-08-20 14:29:54 +09:00
Hide_D fff8f9493b game: 유니크 아이템 경매 시 현재가보다 1% 더 높아야 함 2022-08-20 14:15:49 +09:00
Hide_D 987baaa307 misc: 아시아 명장전 장수 구성 수정 2022-08-19 21:11:02 +09:00
Hide_D 9512ea9b52 feat: APICoveryType에 맞게 InvalidResponse 확장 2022-08-18 01:08:38 +09:00
Hide_D b0f3c1c97d feat: APIRecoveryType Enum 생성 2022-08-18 01:08:35 +09:00
Hide_D e823b97cf2 fix: 세션 관리 api 에러 2022-08-18 01:08:28 +09:00
Hide_D 203859ee5f dep: denque 추가 2022-08-16 23:58:21 +09:00
Hide_D 4870e2fa30 feat: GetRecentRecord 추가
- 메인페이지 최신 로그
2022-08-16 23:57:47 +09:00
Hide_D 970b702a2b fix: 빙의장은 제대로 유산을 받지 못하는 버그 수정 2022-08-13 03:18:31 +09:00
Hide_D 053288b227 fix: applyDB시 rankVarRead 처리 오류 (=은퇴 버그 수정)
- 은퇴는 applyDB 이후에 실행됨
- applyDB 코드 오류로 이후 key값 문제로 은퇴가 실행되지 않음
2022-08-13 03:12:09 +09:00
Hide_D e9b975bea7 fix: 의병모집에서 명성, 계급이 설정되지 않는 버그 수정 2022-08-12 02:25:12 +09:00
Hide_D 89fda44db8 game: 목우 상향, 무상성화 2022-08-10 23:53:19 +09:00
Hide_D fac8536095 fix: 도시 비중 계산식에서 '종사' 누락 2022-08-09 02:04:39 +09:00
Hide_D c79e65b6b7 misc: 아시아 명장전 유저장 스탯 수정 2022-08-08 21:38:02 +09:00
Hide_D 677e65ff6d dep: npm package update 2022-08-06 20:26:35 +09:00
Hide_D 0c7589d524 fix,misc: phan 검사 수준 복구 2022-08-05 23:45:31 +09:00
Hide_D da27ae2bad dep,refac: DTO를 composer 외부로 이동 2022-08-05 23:43:38 +09:00
Hide_D f8cd58bcb3 refac: conv_general_stat을 xlrd대신 opnepyxl로 변경
- 국가명 - 수뇌는 아직 테스트 안 해 보았음...
2022-08-03 00:53:41 +09:00
sarsandHide_D 3671a289b8 아시아 명장전 시나리오(비급) 추가 (#225)
Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/225
Reviewed-by: Hide_D <hided62@gmail.com>
Co-authored-by: sars <sarsntony@gmail.com>
Co-committed-by: sars <sarsntony@gmail.com>
2022-08-02 16:47:41 +09:00
Hide_D 48f4dbec50 misc: 부대편성 1000px 버튼의 위치를 명확히 2022-07-31 22:34:33 +09:00
Hide_D bdb29006e9 refac: 부대편성에서 1000px 모드 버튼을 좌하단으로 2022-07-31 22:20:29 +09:00
Hide_D 5ea324f103 fix: v-b-tooltip에서 undefined -> string type 초기화 생략 2022-07-31 20:34:18 +09:00
Hide_D 2f0cd32c18 fix: 부대 편성에서 부대장 집합 순서로 정렬 필요 2022-07-31 19:50:52 +09:00
Hide_D e8911d40df fix: 부대 편성에서 부대장과 다른 도시 표기가 안됨 2022-07-31 12:08:40 +09:00
Hide_D 89f173e7e3 fix: 베팅 최소 한도가 10이 아니라 1로 된 버그 수정 2022-07-30 21:13:00 +09:00
Hide_D b0ab3f6ace fix: css 누락, 로딩 누락 2022-07-30 20:48:31 +09:00
Hide_D 641af435d4 fix: 리셋 페이지 css 2022-07-30 20:45:27 +09:00
Hide_D 16a2f20af0 fix: 장수 카드에서 '남은 시간'이 제대로 표기 안됨 2022-07-30 20:16:08 +09:00
Hide_D 79734a6dcf fix: 부대명 변경이 아무에게나 보임 2022-07-30 19:44:30 +09:00
Hide_D 2e2ff1b150 feat: 감찰부에서 '이전', '다음' 버튼 2022-07-30 19:34:34 +09:00
Hide_D 5ce899ee6e fix: 장수 카드에 부상스탯 미반영 2022-07-30 14:25:23 +09:00
Hide_D e041080773 fix: 유산 포인트가 0이어도 동작 2022-07-30 12:15:07 +09:00
Hide_D f8448fbb51 fix: 자동 해산에 필요한 변수를 제공하지 않음 2022-07-30 10:34:40 +09:00
Hide_D 8defcd29a4 fix: 인자 오류 수정 2022-07-30 10:31:31 +09:00
Hide_D fba60df9d1 fix: binarysearch 상한 에러 2022-07-29 01:24:09 +09:00
Hide_D a4ff1f44ba build: source-map 활성화(디버그용) 2022-07-29 01:13:51 +09:00
Hide_D 7b75f4e01b misc: GeneralLiteCard grid 조정 2022-07-27 23:02:35 +09:00
Hide_D a9fc69e70f game: 벽력거 비용 약 상승, 목우 비용 하향 2022-07-27 22:52:02 +09:00
Hide_D a06c574327 fix: non vue page css 누락 2022-07-27 22:37:27 +09:00
Hide_D 420ae2f45b fix: 동일 부위 제한일 때, 무한히 알림오는 버그
- 의도대로라면 1턴마다 한번씩이어야함
2022-07-27 22:33:12 +09:00
Hide_D 850073a096 game: 유니크 낙찰 시 연장될 때 '상인' 전환
- 개최자와 낙찰자가 다를때에만
2022-07-27 22:30:22 +09:00
Hide_D e40aa88253 misc: 유니크 경매장에서 아이템 효과 툴팁 2022-07-27 22:21:25 +09:00
Hide_D ff92b0149a game: 벽력거 방어력 약 하향 2022-07-27 22:08:12 +09:00
Hide_D e6049a17a2 fix: 강행이 훈련,사기가 떨어지지 않는 문제 2022-07-27 21:59:29 +09:00
Hide_D 9bc1bc13f2 fix: 누락된 토너먼트 css 2022-07-27 21:57:58 +09:00
Hide_D b9cda08a4e fix: 천하통일 후에는 유산 포인트 사용 방지 2022-07-27 21:54:49 +09:00
Hide_D 4e2193fe6f fix: 불가침 파기시 header 수정 2022-07-27 21:49:45 +09:00
Hide_D 155af45378 refac: bootstrap.scss 분리 후 별도 빌드 2022-07-27 21:44:24 +09:00
Hide_D 66d6bbc772 feat: 경량 base.scss 2022-07-27 20:53:44 +09:00
Hide_D 066a6d4e6a build: bootstrap.scss 분리 2022-07-27 20:48:43 +09:00
Hide_D 94f5834b61 fix: 시나리오 생성시 성격에 class prefix 없음 2022-07-27 19:44:05 +09:00
Hide_D 947286bd09 game: npc 징병 쌀 기준 낮춤 2022-07-27 18:48:37 +09:00
Hide_D a0dee353b5 feat: 새 부대편성 페이지 (#223)
Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/223
2022-07-27 18:01:41 +09:00
Hide_D 308b1f2348 fix: 감찰부 장수 변경시 tooltip 빈칸 버그 2022-07-26 23:56:50 +09:00
Hide_D 897780cf1c dep: package update 2022-07-26 23:32:43 +09:00
Hide_D 0f8a8011be fix: 중복되는 WarUnitTrigger의 priority 정정 2022-07-25 00:29:20 +09:00
Hide_D 7ebfd960b1 fix: 도시 관직 수치 조회 권한이 잘못됨 2022-07-24 17:23:20 +09:00
Hide_D 7b3d64996d fix: 감찰부 도시 관직명 누락 2022-07-24 17:15:06 +09:00
Hide_D e578a2f310 fix: 아이템 경매 버그 수정 2022-07-19 21:24:55 +09:00
Hide_D eecb4f699b game: 이미 같은 부위에 다른 유니크가 있는 경우, 경매 진행 방지 2022-07-17 22:34:05 +09:00
Hide_D 9f4f7a759e fix: 원조를 같은 국가로 지정할 수 있는 버그 수정 2022-07-17 16:40:40 +09:00
Hide_D 11a98eb184 fix: 장수 카드 부대 집합지가 항상 주황색 2022-07-17 16:40:35 +09:00
Hide_D ed0bc5e19f fix,refac: Nation/GetGeneralList에서 부대정보는 공개되어야 함 2022-07-17 01:37:07 +09:00
Hide_D 020a2d2668 fix: 감찰부 표기(*), 이름순 정렬 2022-07-16 16:39:12 +09:00
Hide_D 27cdd3ee4b misc: 구 감찰부 제거 2022-07-16 15:56:39 +09:00
Hide_D 43a95979e1 refac: 감찰부 vue3 재 작성 (#222)
- 장수 정보, 추가 정보 vue3 component
- b_battleCenter -> v_battleCenter

Reviewed-on: https://storage.hided.net/gitea/devsam/core/pulls/222
2022-07-16 15:49:23 +09:00
Hide_D 800106f9cb fix: 등용 버그 수정 시도 2022-07-14 11:40:30 +09:00
Hide_D e5c50e48d3 refac: defineComponent => vue3 setup 2022-07-13 22:37:37 +09:00
Hide_D 08e43bed71 fix: 서버 오픈 첫 턴에는 해산 불가 2022-07-13 22:07:25 +09:00
Hide_D 6773b8cddb fix: dependency 변경에 따른 오류 수정 2022-07-13 01:17:46 +09:00
Hide_D 23c030fd00 dep: package update 2022-07-12 21:47:01 +09:00
Hide_D d5e67bb16d refac: defineComponent => vue3 setup 2022-07-12 01:48:59 +09:00
Hide_D 188e3a0fa6 refac: defindComponent => vue3 setup 2022-07-12 01:26:33 +09:00
Hide_D b31ee022af refac: defineComponent => vue3 setup 2022-07-12 00:28:08 +09:00
Hide_D 87e063e03e fix,refac: 회의실에서 줄 바꿈이 표기 안되는 버그 수정 2022-07-12 00:09:58 +09:00
Hide_D 48fe26e4b1 refac: 숫자 입력기 재작성
- 입력마다 min, max clamp 작업 취소
2022-07-11 21:55:26 +09:00
Hide_D 88fcc64537 game: NPC 요양 기준 설정 가능 2022-07-11 20:23:55 +09:00
Hide_D d9beabbbbc feat: 발령시 장수 목록에 부대장 추가 표기 2022-07-10 21:58:30 +09:00
Hide_D 3da0a7d950 feat: 부대장인 경우 부대이름으로 검색 가능 2022-07-10 21:52:54 +09:00
Hide_D 50b1db75f0 fix: 본인이 아닌 수뇌자리에도 부대장 발령 표기 2022-07-10 21:27:34 +09:00
Hide_D 94bb96d208 feat: 부대장 발령 시 부대장 대신 부대 이름 표기 2022-07-10 20:50:33 +09:00
Hide_D 93490276fd misc: 집합에서 불필요한 조사 제거 2022-07-10 17:12:12 +09:00
Hide_D 73a7bf5a61 fix: 내정 도구 유니크가 동작하지 않는 버그 수정 2022-07-09 23:09:09 +09:00
Hide_D 8a1f8f8e2c fix: JsonString이 string->int auto casting하는 버그 수정 2022-07-09 13:02:13 +09:00
Hide_D 39c88c11c4 misc: 에러 확인을 위해 추가 메시지 2022-07-09 12:26:50 +09:00
Hide_D c2e956a639 misc: DTO 에러에서 name을 포함하여 알림 2022-07-09 12:13:15 +09:00
Hide_D 368f31d1fa fix: 유니크 옥션 인자 빠짐 수정 2022-07-09 12:12:15 +09:00
Hide_D d3390dc490 fix: 상인 등록 경매에서 warning 수정 2022-07-09 12:00:00 +09:00
Hide_D eb36b6a52f fix: vue script ts error 2022-07-08 21:47:13 +09:00
Hide_D be882000ad fix: 183년 이전 선포된 경우 공백지 출병을 시도하는 버그 수정 2022-07-08 15:53:37 +09:00
Hide_D 266c1c6a5b fix: 깃수 종료 시 열린 경매 자동 닫기 2022-07-07 22:00:12 +09:00
Hide_D 7864fe1e0f misc: 토너먼트, 베팅장 버튼을 약간 더 크게 2022-07-06 23:09:37 +09:00
Hide_D fe08fe0e2e fix: 누락된 스탯 유니크 설명 수정 2022-07-06 22:57:15 +09:00
Hide_D 87775a9471 game: 회피 발동시 피해 감소량을 1/5에서 1/6으로 버프 2022-07-06 22:52:20 +09:00
Hide_D 8089457aa8 game: 도구 유니크 밸런스 수정 2022-07-06 22:50:54 +09:00
Hide_D e443f92ddb fix: 초반 내정 기간에 NPC가 다중 선포가 가능한 버그 수정 2022-07-06 22:45:18 +09:00
Hide_D cb65666600 misc: 메인페이지 하단 바 높이를 약간 높임 2022-07-06 22:40:16 +09:00
Hide_D 6ed174e5dc game: 모반시도 삭제 2022-07-05 23:13:25 +09:00
Hide_D dd7f0ef3bf fix: 거병 커맨드가 막힌 없는 경우 사전 거병도 불가 2022-07-05 23:12:49 +09:00
Hide_D ec8e43a2a9 fix: 서버 목록에서 목록이 긴 경우에도 아이콘이 하나만 2022-07-05 23:05:11 +09:00
Hide_D a83b6b55cd feat: 천통국 내기 오픈시 메시지로 알림 2022-07-05 23:02:54 +09:00
Hide_D d43f15e096 fix: 빙의장도 사전 거병이 가능해야함 2022-07-05 22:39:40 +09:00
Hide_D e09fdefa68 feat,game: 사전 거병 기능 추가
- 건국은 게임 개시 2턴째부터 가능
2022-07-05 22:23:23 +09:00
Hide_D 2b483749bc game: 유산 포인트로 도시와 턴 시간을 동시에 설정할 수 없도록 변경 2022-07-05 20:18:02 +09:00
Hide_D 048d71920c fix: 변수명 수정 2022-07-05 19:29:58 +09:00
Hide_D 47366086d5 feat: 군주/외교권자에게 부대명 변경 기능 부여 2022-07-05 00:46:45 +09:00
Hide_D f9a73be82b game,refac: 토너먼트 진행 시간을 턴 시간에 맞춤(최소 5초) 2022-07-04 23:59:04 +09:00
Hide_D e7918469e5 refac: Util::valueFit을 Util::clamp로 2022-07-04 23:25:44 +09:00
Hide_D 687559a1a3 refac: 장수 삭제를 api로 이동 2022-07-02 02:43:10 +09:00
Hide_D 398c11e607 misc: 금액 선택에서 '+만' 활성화 2022-06-25 13:09:57 +09:00
Hide_D 191544d28b game: 삼모시네마틱유니버스 시나리오 업데이트 2022-06-25 13:06:25 +09:00
Hide_D 647c2439e3 feat: 유산 목록에서 로그를 더 가져올 수 있음 2022-06-25 12:22:25 +09:00
Hide_D da2a6f347a game: 도시 정보의 장수 순서를 실제 서버 실행 시간으로 변경 2022-06-24 21:49:02 +09:00
Hide_D dca341f35e fix: 연산단위 최소값 지정 2022-06-15 23:11:07 +09:00
Hide_D d38ddcd79e fix: 피장파장에서 모든 국가에(불가)가 나타나는 버그 2022-06-15 22:34:32 +09:00
Hide_D 03675349d8 fix: 사기진작 커맨드가 금소모를 하지 않음 2022-06-15 00:35:40 +09:00
Hide_D 72768ba7b5 fix: 경매 로그 마저 수정 2022-06-14 22:31:01 +09:00
Hide_D a5477db6b6 fix: 거래 완료시 메시지가 반대로 뜨는 버그 수정 2022-06-14 22:19:23 +09:00
Hide_D c146e8587b feat: 명장일람에 진행중인 유니크 경매 표시 2022-06-12 17:52:02 +09:00
Hide_D 24b65b0395 fix: 금쌀 경매장에 최근 로그 없음 2022-06-12 01:50:33 +09:00
Hide_D 2f42691d2b fix: 연감에 전투 시드가 겉으로 드러남 2022-06-11 15:09:35 +09:00
Hide_D ea619bd693 misc: 인사부에서 추방을 가장 아래로 2022-06-11 14:39:57 +09:00
Hide_D 35a56e74bb refac: 금쌀 경매장 UI 2022-06-11 03:53:30 +09:00
Hide_D 6fb2358161 refac: 유니크 경매 UI 수정 2022-06-10 02:07:05 +09:00
Hide_D a039fb871b fix: CreateManyNPC에서 모든 m장 사망년도가 같은 버그 수정 2022-06-10 00:49:47 +09:00
Hide_D a19da6cda5 fix: 경매장 갱신 버튼 2022-06-10 00:43:47 +09:00
Hide_D e5ba980865 fix: 종료된 유니크 경매 입찰시 버그 2022-06-10 00:38:34 +09:00
Hide_D f95ee8fab8 fix: 경매에서 이미 소지 수가 찬 유니크 획득 가능한 문제 수정 2022-06-09 22:28:51 +09:00
Hide_D 120706ef3f misc: 경매장 진입로를 금/쌀, 유니크로 2원화 2022-06-09 16:16:58 +09:00
Hide_D 58da20f276 fix: 동일 부위 유니크 소유시, '1턴' 연장하도록 수정 2022-06-09 15:49:13 +09:00
Hide_D 64af68e2d6 fix: 유니크 경매 시 종류 제한 계산 버그 2022-06-09 02:03:38 +09:00
Hide_D 76a8740644 fix: 유니크 경매시 10포인트 더 높아야 함 2022-06-09 01:53:19 +09:00
Hide_D 0863fafec0 fix: 경매가 시작후 3개월이 아니라 4개월로 설정됨 2022-06-09 01:49:22 +09:00
383 changed files with 18171 additions and 11433 deletions
+2
View File
@@ -10,8 +10,10 @@
*.log
logs/*.txt
api_log.db
d_log/*.txt
d_log/*.zip
d_log/*.db
sess_*
*/logs/*.txt
*/logs/*/*.txt
-10
View File
@@ -45,7 +45,6 @@ return [
'hwe/api.php',
'hwe/a_traffic.php',
'hwe/battle_simulator.php',
'hwe/b_battleCenter.php',
'hwe/b_betting.php',
'hwe/v_chiefCenter.php',
'hwe/b_currentCity.php',
@@ -58,7 +57,6 @@ return [
'hwe/b_myPage.php',
'hwe/v_processing.php',
'hwe/b_tournament.php',
'hwe/b_troop.php',
'hwe/c_tournament.php',
'hwe/func_auction.php',
'hwe/func_command.php',
@@ -83,7 +81,6 @@ return [
'hwe/j_board_article_add.php',
'hwe/j_board_comment_add.php',
'hwe/j_board_get_articles.php',
'hwe/j_die_immediately.php',
'hwe/j_diplomacy_destroy_letter.php',
'hwe/j_diplomacy_get_letter.php',
'hwe/j_diplomacy_respond_letter.php',
@@ -101,12 +98,6 @@ return [
'hwe/j_load_scenarios.php',
'hwe/j_map.php',
'hwe/j_map_recent.php',
'hwe/j_msg_contact_list.php',
'hwe/j_msg_decide_opt.php',
'hwe/j_msg_delete.php',
'hwe/j_msg_get_old.php',
'hwe/j_msg_get_recent.php',
'hwe/j_msg_submit.php',
'hwe/j_myBossInfo.php',
'hwe/j_raise_event.php',
'hwe/j_select_npc.php',
@@ -115,7 +106,6 @@ return [
'hwe/j_set_my_setting.php',
'hwe/j_set_npc_control.php',
'hwe/j_simulate_battle.php',
'hwe/j_troop.php',
'hwe/j_update_picked_general.php',
'hwe/j_vacation.php',
'hwe/lib.php',
+3 -3
View File
@@ -17,7 +17,6 @@
"league/plates": "^3.3",
"vlucas/valitron": "^1.4",
"php-extended/php-tail": "^2.1",
"pguardiario/phpuri": "^1.0",
"symfony/lock": "^6.0",
"ezyang/htmlpurifier": "^4.10",
"xemlock/htmlpurifier-html5": "^0.1.7",
@@ -26,8 +25,9 @@
"nette/caching": "^3.0",
"illuminate/database": "^9.12",
"illuminate/events": "^9.12",
"spatie/data-transfer-object": "^3.7",
"php-ds/php-ds": "^1.4"
"php-ds/php-ds": "^1.4",
"hided62/ldto": "^1.0",
"league/uri": "^6.8"
},
"autoload": {
"psr-4": {
Generated
+280 -93
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": "908099160e2765c04448fef3f35794c4",
"content-hash": "d7acaa437c3c6f48c9a643c9dc4ef421",
"packages": [
{
"name": "brandonwamboldt/utilphp",
@@ -537,6 +537,60 @@
},
"time": "2021-06-11T22:34:44+00:00"
},
{
"name": "hided62/ldto",
"version": "v1.0.0",
"source": {
"type": "git",
"url": "https://github.com/hided62/ldto.git",
"reference": "4c05401406f8afc1636a90763c13884f8fff0d14"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/hided62/ldto/zipball/4c05401406f8afc1636a90763c13884f8fff0d14",
"reference": "4c05401406f8afc1636a90763c13884f8fff0d14",
"shasum": ""
},
"require": {
"php": ">=8.1"
},
"require-dev": {
"phan/phan": "^5.3",
"phpunit/phpunit": "^9.5"
},
"type": "library",
"autoload": {
"psr-4": {
"LDTO\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Hide_D",
"email": "hided62@gmail.com",
"homepage": "https://hided.net",
"role": "Developer"
}
],
"description": "php lightweight dto library",
"homepage": "https://github.com/hided62/ldto",
"keywords": [
"data-transfer-object",
"dto",
"hided62",
"lightweight",
"serialize"
],
"support": {
"issues": "https://github.com/hided62/ldto/issues",
"source": "https://github.com/hided62/ldto/tree/v1.0.0"
},
"time": "2022-08-05T14:30:13+00:00"
},
{
"name": "illuminate/bus",
"version": "v9.12.2",
@@ -1140,6 +1194,177 @@
},
"time": "2020-12-25T05:00:37+00:00"
},
{
"name": "league/uri",
"version": "6.8.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/uri.git",
"reference": "a700b4656e4c54371b799ac61e300ab25a2d1d39"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/uri/zipball/a700b4656e4c54371b799ac61e300ab25a2d1d39",
"reference": "a700b4656e4c54371b799ac61e300ab25a2d1d39",
"shasum": ""
},
"require": {
"ext-json": "*",
"league/uri-interfaces": "^2.3",
"php": "^8.1",
"psr/http-message": "^1.0.1"
},
"conflict": {
"league/uri-schemes": "^1.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^v3.9.5",
"nyholm/psr7": "^1.5.1",
"php-http/psr7-integration-tests": "^1.1.1",
"phpbench/phpbench": "^1.2.6",
"phpstan/phpstan": "^1.8.5",
"phpstan/phpstan-deprecation-rules": "^1.0",
"phpstan/phpstan-phpunit": "^1.1.1",
"phpstan/phpstan-strict-rules": "^1.4.3",
"phpunit/phpunit": "^9.5.24",
"psr/http-factory": "^1.0.1"
},
"suggest": {
"ext-fileinfo": "Needed to create Data URI from a filepath",
"ext-intl": "Needed to improve host validation",
"league/uri-components": "Needed to easily manipulate URI objects",
"psr/http-factory": "Needed to use the URI factory"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "6.x-dev"
}
},
"autoload": {
"psr-4": {
"League\\Uri\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ignace Nyamagana Butera",
"email": "nyamsprod@gmail.com",
"homepage": "https://nyamsprod.com"
}
],
"description": "URI manipulation library",
"homepage": "https://uri.thephpleague.com",
"keywords": [
"data-uri",
"file-uri",
"ftp",
"hostname",
"http",
"https",
"middleware",
"parse_str",
"parse_url",
"psr-7",
"query-string",
"querystring",
"rfc3986",
"rfc3987",
"rfc6570",
"uri",
"uri-template",
"url",
"ws"
],
"support": {
"docs": "https://uri.thephpleague.com",
"forum": "https://thephpleague.slack.com",
"issues": "https://github.com/thephpleague/uri/issues",
"source": "https://github.com/thephpleague/uri/tree/6.8.0"
},
"funding": [
{
"url": "https://github.com/sponsors/nyamsprod",
"type": "github"
}
],
"time": "2022-09-13T19:58:47+00:00"
},
{
"name": "league/uri-interfaces",
"version": "2.3.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/uri-interfaces.git",
"reference": "00e7e2943f76d8cb50c7dfdc2f6dee356e15e383"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/00e7e2943f76d8cb50c7dfdc2f6dee356e15e383",
"reference": "00e7e2943f76d8cb50c7dfdc2f6dee356e15e383",
"shasum": ""
},
"require": {
"ext-json": "*",
"php": "^7.2 || ^8.0"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.19",
"phpstan/phpstan": "^0.12.90",
"phpstan/phpstan-phpunit": "^0.12.19",
"phpstan/phpstan-strict-rules": "^0.12.9",
"phpunit/phpunit": "^8.5.15 || ^9.5"
},
"suggest": {
"ext-intl": "to use the IDNA feature",
"symfony/intl": "to use the IDNA feature via Symfony Polyfill"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.x-dev"
}
},
"autoload": {
"psr-4": {
"League\\Uri\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Ignace Nyamagana Butera",
"email": "nyamsprod@gmail.com",
"homepage": "https://nyamsprod.com"
}
],
"description": "Common interface for URI representation",
"homepage": "http://github.com/thephpleague/uri-interfaces",
"keywords": [
"rfc3986",
"rfc3987",
"uri",
"url"
],
"support": {
"issues": "https://github.com/thephpleague/uri-interfaces/issues",
"source": "https://github.com/thephpleague/uri-interfaces/tree/2.3.0"
},
"funding": [
{
"url": "https://github.com/sponsors/nyamsprod",
"type": "github"
}
],
"time": "2021-06-28T04:27:21+00:00"
},
{
"name": "microsoft/tolerant-php-parser",
"version": "v0.1.1",
@@ -1556,34 +1781,6 @@
},
"time": "2022-01-24T11:29:14+00:00"
},
{
"name": "pguardiario/phpuri",
"version": "1.0",
"source": {
"type": "git",
"url": "https://github.com/monkeysuffrage/phpuri.git",
"reference": "ad0a5ec033fe616cfef55578b9c7f2458be8fbfc"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/monkeysuffrage/phpuri/zipball/ad0a5ec033fe616cfef55578b9c7f2458be8fbfc",
"reference": "ad0a5ec033fe616cfef55578b9c7f2458be8fbfc",
"shasum": ""
},
"type": "project",
"autoload": {
"files": [
"phpuri.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"description": "A php library for converting relative urls to absolute.",
"support": {
"issues": "https://github.com/monkeysuffrage/phpuri/issues",
"source": "https://github.com/monkeysuffrage/phpuri/tree/1.0.0"
},
"time": "2015-05-24T09:13:17+00:00"
},
{
"name": "phan/phan",
"version": "5.3.2",
@@ -2023,6 +2220,59 @@
},
"time": "2021-11-05T16:47:00+00:00"
},
{
"name": "psr/http-message",
"version": "1.0.1",
"source": {
"type": "git",
"url": "https://github.com/php-fig/http-message.git",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/php-fig/http-message/zipball/f6561bf28d520154e4b0ec72be95418abe6d9363",
"reference": "f6561bf28d520154e4b0ec72be95418abe6d9363",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Psr\\Http\\Message\\": "src/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "PHP-FIG",
"homepage": "http://www.php-fig.org/"
}
],
"description": "Common interface for HTTP messages",
"homepage": "https://github.com/php-fig/http-message",
"keywords": [
"http",
"http-message",
"psr",
"psr-7",
"request",
"response"
],
"support": {
"source": "https://github.com/php-fig/http-message/tree/master"
},
"time": "2016-08-06T14:39:51+00:00"
},
{
"name": "psr/log",
"version": "3.0.0",
@@ -2238,69 +2488,6 @@
},
"time": "2021-06-29T04:31:23+00:00"
},
{
"name": "spatie/data-transfer-object",
"version": "3.7.3",
"source": {
"type": "git",
"url": "https://github.com/spatie/data-transfer-object.git",
"reference": "341f72c77e0fce40ea2e0dcb212cb54dc27bbe72"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/spatie/data-transfer-object/zipball/341f72c77e0fce40ea2e0dcb212cb54dc27bbe72",
"reference": "341f72c77e0fce40ea2e0dcb212cb54dc27bbe72",
"shasum": ""
},
"require": {
"php": "^8.0"
},
"require-dev": {
"illuminate/collections": "^8.36",
"jetbrains/phpstorm-attributes": "^1.0",
"larapack/dd": "^1.1",
"phpunit/phpunit": "^9.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Spatie\\DataTransferObject\\": "src"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Brent Roose",
"email": "brent@spatie.be",
"homepage": "https://spatie.be",
"role": "Developer"
}
],
"description": "Data transfer objects with batteries included",
"homepage": "https://github.com/spatie/data-transfer-object",
"keywords": [
"data-transfer-object",
"spatie"
],
"support": {
"issues": "https://github.com/spatie/data-transfer-object/issues",
"source": "https://github.com/spatie/data-transfer-object/tree/3.7.3"
},
"funding": [
{
"url": "https://spatie.be/open-source/support-us",
"type": "custom"
},
{
"url": "https://github.com/spatie",
"type": "github"
}
],
"time": "2021-12-30T20:31:10+00:00"
},
{
"name": "symfony/console",
"version": "v6.0.8",
@@ -5337,5 +5524,5 @@
"platform-overrides": {
"php": "8.1"
},
"plugin-api-version": "2.2.0"
"plugin-api-version": "2.3.0"
}
BIN
View File
Binary file not shown.
+4 -4
View File
@@ -90,19 +90,19 @@ if (
//기본 파일 생성
if (!file_exists(AppConf::getUserIconPathFS())) {
mkdir(AppConf::getUserIconPathFS());
mkdir(AppConf::getUserIconPathFS(), 0775);
}
if (!file_exists(ROOT . '/d_log')) {
mkdir(ROOT . '/d_log');
mkdir(ROOT . '/d_log', 0775);
}
if (!file_exists(ROOT . '/d_setting')) {
mkdir(ROOT . '/d_setting');
mkdir(ROOT . '/d_setting', 0775);
}
if (!file_exists(ROOT . '/d_shared')) {
mkdir(ROOT . '/d_shared');
mkdir(ROOT . '/d_shared', 0775);
}
}
+17
View File
@@ -0,0 +1,17 @@
CREATE TABLE IF NOT EXISTS "api_log" (
"id" INTEGER NOT NULL,
"user_id" INTEGER NOT NULL,
"ip" TEXT NOT NULL,
"date" TEXT NOT NULL,
"path" TEXT NOT NULL,
"arg" TEXT,
"aux" TEXT,
PRIMARY KEY("id" AUTOINCREMENT)
);
CREATE INDEX IF NOT EXISTS "by_date" ON "api_log" (
"date" DESC
);
CREATE INDEX IF NOT EXISTS "by_user" ON "api_log" (
"user_id" ASC,
"date" DESC
);
-2
View File
@@ -40,8 +40,6 @@ $admin = getAdmin();
<tr>
<td width=110 align=right>시작시간변경</td>
<td width=285><input type=text size=20 maxlength=20 style=color:white;background-color:black;text-align:right; name=starttime value='<?=substr($admin['starttime'], 0, 19)?>'><input type=submit name=btn value=변경1></td>
<td width=110 align=right>현재도시훈사</td>
<td width=285><?=$admin['city_rate']?></td>
</tr>
<tr>
<td width=110 align=right>최대 장수</td>
+10 -8
View File
@@ -2,6 +2,8 @@
namespace sammo;
use sammo\Enums\MessageType;
include "lib.php";
include "func.php";
@@ -111,7 +113,7 @@ switch ($btn) {
case "경험치1000":
$text = $btn . " 지급!";
foreach ($genlist as $generalID) {
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new \DateTime(), new \DateTime('9999-12-31'), []);
$msg = new Message(MessageType::private, $src, MessageTarget::buildQuick($generalID), $text, new \DateTime(), new \DateTime('9999-12-31'), []);
$msg->send(true);
}
$db->update('general', [
@@ -122,7 +124,7 @@ switch ($btn) {
case "공헌치1000":
$text = $btn . " 지급!";
foreach ($genlist as $generalID) {
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new \DateTime(), new \DateTime('9999-12-31'), []);
$msg = new Message(MessageType::private, $src, MessageTarget::buildQuick($generalID), $text, new \DateTime(), new \DateTime('9999-12-31'), []);
$msg->send(true);
}
$db->update('general', [
@@ -133,7 +135,7 @@ switch ($btn) {
case "보숙10000":
$text = "보병숙련도+10000 지급!";
foreach ($genlist as $generalID) {
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new \DateTime(), new \DateTime('9999-12-31'), []);
$msg = new Message(MessageType::private, $src, MessageTarget::buildQuick($generalID), $text, new \DateTime(), new \DateTime('9999-12-31'), []);
$msg->send(true);
}
$db->update('general', [
@@ -143,7 +145,7 @@ switch ($btn) {
case "궁숙10000":
$text = "궁병숙련도+10000 지급!";
foreach ($genlist as $generalID) {
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new \DateTime(), new \DateTime('9999-12-31'), []);
$msg = new Message(MessageType::private, $src, MessageTarget::buildQuick($generalID), $text, new \DateTime(), new \DateTime('9999-12-31'), []);
$msg->send(true);
}
$db->update('general', [
@@ -154,7 +156,7 @@ switch ($btn) {
$src = MessageTarget::buildQuick($session->generalID);
$text = "기병숙련도+10000 지급!";
foreach ($genlist as $generalID) {
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new \DateTime(), new \DateTime('9999-12-31'), []);
$msg = new Message(MessageType::private, $src, MessageTarget::buildQuick($generalID), $text, new \DateTime(), new \DateTime('9999-12-31'), []);
$msg->send(true);
}
$db->update('general', [
@@ -165,7 +167,7 @@ switch ($btn) {
$src = MessageTarget::buildQuick($session->generalID);
$text = "귀병숙련도+10000 지급!";
foreach ($genlist as $generalID) {
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new \DateTime(), new \DateTime('9999-12-31'), []);
$msg = new Message(MessageType::private, $src, MessageTarget::buildQuick($generalID), $text, new \DateTime(), new \DateTime('9999-12-31'), []);
$msg->send(true);
}
$db->update('general', [
@@ -176,7 +178,7 @@ switch ($btn) {
$src = MessageTarget::buildQuick($session->generalID);
$text = "차병숙련도+10000 지급!";
foreach ($genlist as $generalID) {
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new \DateTime(), new \DateTime('9999-12-31'), []);
$msg = new Message(MessageType::private, $src, MessageTarget::buildQuick($generalID), $text, new \DateTime(), new \DateTime('9999-12-31'), []);
$msg->send(true);
}
$db->update('general', [
@@ -196,7 +198,7 @@ switch ($btn) {
case "메세지 전달":
$text = $msg ?? '';
foreach ($genlist as $generalID) {
$msg = new Message(Message::MSGTYPE_PRIVATE, $src, MessageTarget::buildQuick($generalID), $text, new \DateTime(), new \DateTime('9999-12-31'), []);
$msg = new Message(MessageType::private, $src, MessageTarget::buildQuick($generalID), $text, new \DateTime(), new \DateTime('9999-12-31'), []);
$msg->send(true);
}
break;
+4 -2
View File
@@ -2,6 +2,8 @@
namespace sammo;
use sammo\Enums\MessageType;
include "lib.php";
include "func.php";
//로그인 검사
@@ -18,7 +20,7 @@ $msg = Util::getPost('msg', 'string', '메시지');
$db = DB::db();
//NOTE: 왜 기능이 admin2와 admin4가 같이 있는가?
//NOTE: 왜 기능이 admin2와 admin4가 같이 있는가?
//NOTE: 왜 블럭 시 admin4에선 금쌀을 없애지 않는가?
switch ($btn) {
case "블럭 해제":
@@ -66,7 +68,7 @@ switch ($btn) {
$src = MessageTarget::buildQuick($session->generalID);
foreach($genlist as $generalID){
$msgObj = new Message(
Message::MSGTYPE_PRIVATE,
MessageType::private,
$src,
MessageTarget::buildQuick($generalID),
$msg,
+1 -2
View File
@@ -27,7 +27,6 @@ foreach ($db->queryFirstColumn(
$inheritPointManager = InheritancePointManager::getInstance();
foreach(General::createGeneralObjListFromDB($db->queryFirstColumn('SELECT `no` FROM general WHERE npc = 0')) as $genObj){
$inheritPointManager->mergeTotalInheritancePoint($genObj, true);
$inheritPointManager->mergeTotalInheritancePoint($genObj);
$inheritPointManager->applyInheritanceUser($genObj->getVar('owner'));
$inheritPointManager->clearInheritancePoint($genObj);
}
+30
View File
@@ -2,7 +2,9 @@
namespace sammo;
use Ds\Set;
use sammo\Enums\RankColumn;
use sammo\Enums\AuctionType;
include "lib.php";
include "func.php";
@@ -19,6 +21,7 @@ $gameStor = KVStorage::getStorage($db, 'game_env');
increaseRefresh("명장일람", 1);
$templates = new \League\Plates\Engine(__DIR__ . '/templates');
?>
<!DOCTYPE html>
<html>
@@ -31,6 +34,7 @@ $templates = new \League\Plates\Engine(__DIR__ . '/templates');
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printDist('vue', [], true) ?>
<?= WebUtil::printDist('ts', ['common', 'bestGeneral']) ?>
</head>
@@ -326,6 +330,32 @@ $templates = new \League\Plates\Engine(__DIR__ . '/templates');
}
}
$dummyAuctionGeneral = [
'nation' => 0,
'no' => 0,
'ownerName' => '',
'pictureFullPath' => GetImageURL(0) . "/default.jpg",
'name' => '경매중',
'bgColor' => '#00582c',
'fgColor' => 'white',
'nationName' => '-',
];
foreach ($db->queryFirstColumn(
'SELECT `target` FROM ng_auction WHERE `finished` = 0 AND `type` = %s',
AuctionType::UniqueItem->value
) as $itemClassName) {
if(key_exists($itemClassName, $itemOwners)) {
$itemOwners[$itemClassName][] = $dummyAuctionGeneral;
}
else{
$itemOwners[$itemClassName] = [$dummyAuctionGeneral];
}
}
foreach (GameConst::$allItems as $itemType => $itemList) {
$itemNameType = $itemTypes[$itemType];
$itemList = array_reverse($itemList, true);
+1
View File
@@ -20,6 +20,7 @@ increaseRefresh("왕조일람", 1);
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printDist('vue', [], true) ?>
<?= WebUtil::printDist('ts', 'common') ?>
</head>
+1
View File
@@ -28,6 +28,7 @@ $serverID = $emperior['server_id'] ?? ($emperior['serverID'] ?? null);
<meta name="viewport" content="width=1024" />
<title><?= UniqueConst::$serverName ?>: 왕조일람</title>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<?= WebUtil::printDist('vue', [], true) ?>
<?= WebUtil::printDist('ts', 'common', true) ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
+1
View File
@@ -47,6 +47,7 @@ if ($gameStor->isunited) {
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printDist('vue', [], true) ?>
<?= WebUtil::printDist('ts', 'common') ?>
</head>
+1
View File
@@ -49,6 +49,7 @@ if ($scenarioIdx && key_exists($scenarioIdx, $scenarioList[$seasonIdx] ?? [])) {
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printDist('vue', [], true) ?>
<?= WebUtil::printDist('ts', ['common', 'hallOfFame']) ?>
</head>
+1
View File
@@ -32,6 +32,7 @@ if ($con >= 2) {
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printDist('vue', [], true) ?>
<?= WebUtil::printDist('ts', ['common', 'extKingdoms']) ?>
<?= WebUtil::printStaticValues($gameStor->getValues(['killturn', 'autorun_user', 'turnterm'])) ?>
</head>
+1
View File
@@ -30,6 +30,7 @@ $sel[$type] = "selected";
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printDist('vue', [], true) ?>
<?= WebUtil::printDist('ts', ['common']) ?>
</head>
+2 -1
View File
@@ -8,7 +8,7 @@ include "func.php";
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
increaseRefresh("갱신정보", 2);
increaseRefresh("갱신정보", 1);
$admin = $gameStor->getValues(['year', 'month', 'refresh', 'maxrefresh', 'maxonline']);
@@ -83,6 +83,7 @@ if ($admin['maxonline'] < $curonline) {
}
</style>
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printDist('vue', [], true) ?>
<?= WebUtil::printDist('ts', ['common']) ?>
</head>
-208
View File
@@ -1,208 +0,0 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
$v = new Validator($_POST + $_GET);
$v->rule('required', 'gen')
->rule('integer', 'gen');
$btn = Util::getReq('btn');
$gen = Util::getReq('gen', 'int', 0);
$reqQueryType = Util::getReq('query_type', 'string', null);
// $queryTypeText, $reqArgType(0=>None, 1=>AdditionalColumn, 2=>rankVal, 3=>aux), $comp
$queryMap = [
'turntime' => ['최근턴', 0, function ($lhs, $rhs) {
return - ($lhs['turntime'] <=> $rhs['turntime']);
}],
'recent_war' => ['최근전투', 1, function ($lhs, $rhs) {
return - ($lhs['recent_war'] <=> $rhs['recent_war']);
}],
'name' => ['장수명', 0, function ($lhs, $rhs) {
if ($lhs['npc'] !== $rhs['npc']) {
return $lhs['npc'] <=> $rhs['npc'];
}
return $lhs['name'] <=> $rhs['name'];
}],
'warnum' => ['전투수', 2, function ($lhs, $rhs) {
return - ($lhs['warnum'] <=> $rhs['warnum']);
}]
];
if ($reqQueryType === null || !key_exists($reqQueryType, $queryMap)) {
$reqQueryType = Util::array_first_key($queryMap);
}
//로그인 검사
$session = Session::requireGameLogin()->setReadOnly();
$userID = Session::getUserID();
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
increaseRefresh("감찰부", 2);
//전투 추진을 위해 갱신
TurnExecutionHelper::executeAllCommand();
$gameStor->resetCache();
$testGeneralNationID = $db->queryFirstField('SELECT nation FROM general WHERE no = %i', $gen);
$me = $db->queryFirstRow('SELECT no,nation,officer_level,con,turntime,belong,permission,penalty from general where owner=%i', $userID);
$nationID = $me['nation'];
$con = checkLimit($me['con']);
if ($con >= 2) {
printLimitMsg($me['turntime']);
exit();
}
$permission = checkSecretPermission($me);
if ($permission < 0) {
echo '국가에 소속되어있지 않습니다.';
die();
} else if ($permission < 1) {
echo "권한이 부족합니다. 수뇌부가 아니거나 사관년도가 부족합니다.";
die();
}
//잘못된 접근
if ($testGeneralNationID != $nationID) {
$gen = 0;
}
if ($btn == '정렬') {
$gen = 0;
}
[$queryTypeText, $reqArgType, $comp] = $queryMap[$reqQueryType];
if ($reqArgType === 0) {
$generalBasicList = $db->query('SELECT no, name, npc, turntime, officer_level FROM general WHERE nation = %i', $nationID);
} else if ($reqArgType === 1) {
$generalBasicList = $db->query('SELECT no, name, npc, turntime, officer_level, %b FROM general WHERE nation = %i', $reqQueryType, $nationID);
} else if ($reqArgType === 2) {
$generalBasicList = $db->query(
'SELECT no, name, npc, turntime, officer_level, value as %b
FROM general LEFT JOIN rank_data
ON general.no = rank_data.general_id
WHERE rank_data.type = %s AND general.nation = %i',
$reqQueryType,
$reqQueryType,
$nationID
);
} else if ($reqArgType === 3) {
$generalBasicList = array_map(function ($arr) {
$arr['aux'] = Json::decode($arr['aux']);
return $arr;
}, $db->query('SELECT no, name, npc, turntime, officer_level, aux FROM general WHERE nation = %i', $nationID));
} else {
throw new \sammo\MustNotBeReachedException();
}
usort($generalBasicList, $comp);
if (!$gen) {
$gen = $generalBasicList[0]['no'];
}
$showGeneral = General::createGeneralObjFromDB($gen);
?>
<!DOCTYPE html>
<html>
<head>
<title><?= UniqueConst::$serverName ?>: 감찰부</title>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=500" />
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printDist('ts', ['common', 'battleCenter']) ?>
</head>
<body>
<div id="container" class="bg0">
<div class="row gx-0">
<div class="col">감 찰 부<br><?= closeButton() ?></div>
</div>
<div class="row gx-0">
<div class="col-12" style="border-left: solid 1px gray; border-right:solid 1px gray;">
<form name=form1 method=get>
정렬순서 :
<select name='query_type' size=1>
<?php foreach ($queryMap as $queryType => [$queryTypeText,]) : ?>
<option <?= $queryType == $reqQueryType ? 'selected' : '' ?> value='<?= $queryType ?>'><?= $queryTypeText ?></option>
<?php endforeach; ?>
</select>
<input type=submit name=btn value='정렬'>
대상장수 :
<select name=gen size=1>
<?php foreach ($generalBasicList as $general) : ?>
<option <?= $gen == $general['no'] ? 'selected' : '' ?> value='<?= $general['no'] ?>'><?= $general['officer_level'] > 4 ? "*{$general['name']}*" : $general['name'] ?> (<?= substr($general['turntime'], 14, 5) ?>)</option>
<?php endforeach; ?>
</select>
<input type=submit name=btn value='조회'>
</form>
</div>
<div class="col col-12 col-md-6">
<div class="row mx-0">
<div class="col bg1 header-cell" style="color:skyblue">장수 정보</div>
</div>
<div class="row">
<div class="col"><?php generalInfo($showGeneral); ?><?php generalInfo2($showGeneral); ?></div>
</div>
</div>
<div class="col col-12 col-md-6">
<div class="row mx-0">
<div class="col bg1 header-cell">장수 열전</div>
</div>
<div class="row">
<div class="col"><?= formatHistoryToHTML(getGeneralHistoryLogAll($gen)) ?></div>
</div>
</div>
<div class="col col-12 col-md-6">
<div class="row mx-0">
<div class="col bg1 header-cell">전투 기록</div>
</div>
<div class="row">
<div class="col"><?= formatHistoryToHTML(getBattleDetailLogRecent($gen, 24)) ?></div>
</div>
</div>
<div class="col col-12 col-md-6">
<div class="row mx-0">
<div class="col bg1 header-cell">전투 결과</div>
</div>
<div class="row">
<div class="col"><?= formatHistoryToHTML(getBattleResultRecent($gen, 24)) ?></div>
</div>
</div>
<?php if ($showGeneral->getNPCType() > 1 || $permission >= 2) : ?>
<div class="col col-12 col-md-6">
<div class="row mx-0">
<div class="col bg1 header-cell">개인 기록</div>
</div>
<div class="row">
<div class="col"><?= formatHistoryToHTML(getGeneralActionLogRecent($gen, 24)) ?></div>
</div>
</div>
<?php endif; ?>
</div>
<div class="row gx-0">
<div class="col "><?= closeButton() ?></div>
</div>
<div class="row bg0 gx-0">
<div class="col bg0"><?= banner() ?></div>
</div>
</div>
</body>
</html>
+9 -8
View File
@@ -23,8 +23,8 @@ $generalID = $session->generalID;
$me = $db->queryFirstRow('SELECT no,tournament,con,turntime from general where owner=%i', $userID);
$admin = $gameStor->getValues(['tournament', 'phase', 'tnmt_type', 'develcost']);
$admin = $gameStor->getValues(['tournament', 'phase', 'tnmt_type', 'turnterm', 'develcost']);
$turnTerm = $admin['turnterm'];
$con = checkLimit($me['con']);
if ($con >= 2) {
printLimitMsg($me['turntime']);
@@ -99,7 +99,7 @@ $str2 = getTournamentTime();
if ($str2) {
$str2 = ', ' . $str2;
}
$str3 = getTournamentTermText();
$str3 = getTournamentTermText($turnTerm);
if ($str3) {
$str3 = ', ' . $str3;
}
@@ -119,6 +119,7 @@ if ($str3) {
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printDist('vue', [], true) ?>
<?= WebUtil::printDist('ts', ['common', 'betting']) ?>
<?= WebUtil::printStaticValues([
'staticValues'=>[
@@ -135,7 +136,7 @@ if ($str3) {
</table>
<table align=center width=1120 class='tb_layout bg0'>
<tr>
<td colspan=16><input type=button value='갱신' onclick='location.reload()'></td>
<td colspan=16><button type="button" class="btn btn-secondary" onclick='location.reload()'>갱신</button></td>
</tr>
<tr>
<td colspan=16 align=center>
@@ -441,13 +442,13 @@ if ($str3) {
if ($admin['tournament'] == 6) {
echo "
<tr align=center>";
<tr align=center style='height:2.5em;'>";
foreach (range(0, 15) as $i) {
$key = $keyMap[$i] ?? -1;
echo "
<td>
<select size=1 id='target_{$key}' style=color:white;background-color:black;>
<select size=1 id='target_{$key}' style='color:white;background-color:black;padding:0.2rem 0.1rem;'>
<option style=color:white; value=10>금10</option>
<option style=color:white; value=20>금20</option>
<option style=color:white; value=50>금50</option>
@@ -461,12 +462,12 @@ if ($str3) {
echo "
</tr>
<tr align=center>";
<tr align=center style='height:2.2em;'>";
foreach (range(0, 15) as $i) {
$key = $keyMap[$i] ?? -1;
echo "
<td><input type=button class='submitBtn' data-target='{$key}' value=베팅! style=width:100%;color:white;background-color:black;></td>";
<td><input type=button class='submitBtn' data-target='{$key}' value=베팅! style='width:100%;color:white;padding:0.2rem 0.1rem;background-color:black;'></td>";
}
echo "</tr>";
+5 -2
View File
@@ -13,9 +13,11 @@ $userID = Session::getUserID();
$userGrade = Session::getUserGrade();
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
increaseRefresh("현재도시", 1);
$lastExecute = substr($gameStor->turntime, 5, 14);
$me = $db->queryFirstRow('SELECT no,nation,officer_level,city from general where owner=%i', $userID);
$myNation = $db->queryFirstRow('SELECT nation,level,spy FROM nation WHERE nation=%i', $me['nation']) ?? [
'nation' => 0,
@@ -53,6 +55,7 @@ $templates = new \League\Plates\Engine('templates');
font-size: x-small;
}
</style>
<?= WebUtil::printDist('vue', [], true) ?>
<?= WebUtil::printDist('ts', ['common', 'currentCity']) ?>
</head>
@@ -446,7 +449,7 @@ $templates = new \League\Plates\Engine('templates');
<table align=center width=1000 class='tb_layout bg2'>
<tr>
<td colspan=11 align=center style='color:<?= newColor($cityNation['color']) ?>; background:<?= $cityNation['color'] ?>'>【 <?= CityConst::$regionMap[$city['region']] ?> | <?= CityConst::$levelMap[$city['level']] ?> 】 <?= $city['name'] ?></td>
<td style='color:<?= newColor($cityNation['color']) ?>; background:<?= $cityNation['color'] ?>' class='center'><?= date('m-d H:i:s') ?></td>
<td style='color:<?= newColor($cityNation['color']) ?>; background:<?= $cityNation['color'] ?>' class='center'><?= $lastExecute ?></td>
</tr>
<tr>
<td align=center width=48 class=bg1>주민</td>
+1
View File
@@ -57,6 +57,7 @@ $templates = new \League\Plates\Engine('templates');
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printDist('vue', [], true) ?>
<?= WebUtil::printDist('ts', ['common']) ?>
</head>
+48 -48
View File
@@ -25,6 +25,17 @@ if ($meLevel == 0) {
$nation = $db->queryFirstRow('SELECT nation,name,level,color,chief_set from nation where nation=%i', $nationID); //국가정보
if ($meLevel >= 5) {
$candidateStrength = $db->query('SELECT no,name,officer_level,city,npc from general where nation=%i and officer_level!=12 and strength>=%i order by npc,binary(name)', $nationID, GameConst::$chiefStatMin);
$candidateIntel = $db->query('SELECT no,name,officer_level,city,npc from general where nation=%i and officer_level!=12 and intel>=%i order by npc,binary(name)', $nationID, GameConst::$chiefStatMin);
$candidateAny = $db->query('SELECT no,name,officer_level,city,npc,leadership,strength,intel,killturn from general where nation=%i and officer_level!=12 order by npc,binary(name)', $nationID); //추방 때문에 조금 더 김
} else {
$candidateStrength = [];
$candidateIntel = [];
$candidateAny = [];
}
?>
<!DOCTYPE html>
<html>
@@ -43,6 +54,7 @@ $nation = $db->queryFirstRow('SELECT nation,name,level,color,chief_set from nati
var chiefStatMin = <?= GameConst::$chiefStatMin ?>;
var myLevel = <?= $meLevel ?>;
</script>
<?= WebUtil::printDist('vue', [], true) ?>
<?= WebUtil::printDist('ts', ['common', 'bossInfo']) ?>
<?php
@@ -180,61 +192,21 @@ $nation = $db->queryFirstRow('SELECT nation,name,level,color,chief_set from nati
<td colspan=5><?= $eaglestr ?></td>
</tr>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td colspan=6 height=5></td>
<td colspan=4 height=5></td>
</tr>
<tr>
<td colspan=2 align=center bgcolor=red>추 방</td>
<td colspan=4 align=center bgcolor=blue>수 뇌 부 임 명</td>
</tr>
<tr>
<td width=498 align=right class='bg1'>대상 장수</td>
<td width=498>
<?php $officerLevelText = getOfficerLevelText(11, $nation['level']); ?>
<td width=98 align=right class='bg1'><?= getOfficerLevelText(12, $nation['level']) ?></td>
<td width=398><?= $level[12]['name'] ?> 【<?= CityConst::byID($level[12]['city'])->name ?>】</td>
<td width=98 align=right class='bg1'><?= $officerLevelText ?></td>
<td width=398>
<?php
if ($meLevel >= 5) {
$candidateStrength = $db->query('SELECT no,name,officer_level,city,npc from general where nation=%i and officer_level!=12 and strength>=%i order by npc,binary(name)', $nationID, GameConst::$chiefStatMin);
$candidateIntel = $db->query('SELECT no,name,officer_level,city,npc from general where nation=%i and officer_level!=12 and intel>=%i order by npc,binary(name)', $nationID, GameConst::$chiefStatMin);
$candidateAny = $db->query('SELECT no,name,officer_level,city,npc,leadership,strength,intel,killturn from general where nation=%i and officer_level!=12 order by npc,binary(name)', $nationID); //추방 때문에 조금 더 김
} else {
$candidateStrength = [];
$candidateIntel = [];
$candidateAny = [];
}
if ($meLevel >= 5 && !isOfficerSet($nation['chief_set'], $meLevel)) {
echo "
<select id='genlist_kick' size=1 style=color:white;background-color:black;>";
foreach ($candidateAny as $general) {
if ($general['no'] === $me['no']) {
continue;
}
echo "
<option data-officer_level='{$general['officer_level']}' data-name='{$general['name']}' value={$general['no']}>{$general['name']} <small>({$general['leadership']}/{$general['strength']}/{$general['intel']}, {$general['killturn']}턴)</small></option>";
}
echo "
</select>
<input type=$btn id='btn_kick' value=추방>";
}
$officerLevelText = getOfficerLevelText(11, $nation['level']);
echo "
</td>
</tr>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr><td colspan=4 height=5></td></tr>
<tr><td colspan=4 align=center bgcolor=blue>수 뇌 부 임 명</td></tr>
<tr>
<td width=98 align=right class='bg1'>" . getOfficerLevelText(12, $nation['level']) . "</td>
<td width=398>{$level[12]['name']} 【" . CityConst::byID($level[12]['city'])->name . "】</td>
<td width=98 align=right class='bg1'>{$officerLevelText}</td>
<td width=398>
";
if ($meLevel >= 5 && !isOfficerSet($nation['chief_set'], 11)) {
echo "
<select id='genlist_11' size=1 maxlength=15 style=color:white;background-color:black;>
@@ -553,6 +525,34 @@ $nation = $db->queryFirstRow('SELECT nation,name,level,color,chief_set from nati
<td colspan=5>※ <font color=orange>노란색</font>은 변경 불가능, 하얀색은 변경 가능 관직입니다.</td>
</tr>
</table>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
<td colspan=6 height=5></td>
</tr>
<tr>
<td colspan=2 align=center bgcolor=red>추 방</td>
</tr>
<tr>
<td width=498 align=right class='bg1'>대상 장수</td>
<td width=498>
<?php
if ($meLevel >= 5 && !isOfficerSet($nation['chief_set'], $meLevel)) : ?>
<select id='genlist_kick' size=1 style=color:white;background-color:black;>";
<?php foreach ($candidateAny as $general) : ?>
<?php if ($general['no'] === $me['no']) {
continue;
}
?>
<option data-officer_level='<?= $general['officer_level'] ?>' data-name='<?= $general['name'] ?>' value='<?= $general['no'] ?>'><?= $general['name'] ?> <small>(<?= $general['leadership'] ?>/<?= $general['strength'] ?>/<?= $general['intel'] ?>, <?= $general['killturn'] ?>턴)</small></option>
<?php endforeach; ?>
</select>
<input type=<?= $btn ?> id='btn_kick' value=추방>
<?php endif; ?>
</td>
</tr>
</table>
<br>
<table align=center width=1000 class='tb_layout bg0'>
<tr>
+1
View File
@@ -39,6 +39,7 @@ $sel = [$type => "selected"];
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printDist('vue', [], true) ?>
<?= WebUtil::printDist('ts', ['common', 'extExpandCity']) ?>
</head>
+1
View File
@@ -48,6 +48,7 @@ if ($gameStor->isunited) {
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printDist('vue', [], true) ?>
<?= WebUtil::printDist('ts', ['common']) ?>
</head>
+1
View File
@@ -31,6 +31,7 @@ if ($nationID == 0) {
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printDist('vue', [], true) ?>
<?= WebUtil::printDist('ts', ['common']) ?>
</head>
+21 -10
View File
@@ -5,8 +5,9 @@ namespace sammo;
include "lib.php";
include "func.php";
$showDieImmediatelyBtn = false;
$availableDieImmediately = false;
$showDieOnPrestartBtn = false;
$showBuildNationCandidateBtn = false;
$availableDieOnPrestart = false;
//로그인 검사
$session = Session::requireGameLogin()->setReadOnly();
@@ -28,15 +29,19 @@ if ($myset > 0) {
$submit = 'hidden';
}
$targetTime = addTurn($me->getVar('lastrefresh'), $gameStor->turnterm, 2);
$targetTime = addTurn($me->getVar('lastrefresh'), $gameStor->turnterm, GameConst::$minTurnDieOnPrestart);
if ($gameStor->turntime <= $gameStor->opentime) {
//서버 가오픈시 할 수 있는 행동
if ($me->getNPCType() == 0) {
$showDieImmediatelyBtn = true;
if ($me->getNPCType() == 0 && $me->getNationID() == 0) {
$showDieOnPrestartBtn = true;
if ($targetTime <= TimeUtil::now()) {
$availableDieImmediately = true;
$availableDieOnPrestart = true;
}
}
if($me->getNationID() == 0){
$showBuildNationCandidateBtn = true;
}
}
$use_treatment = $me->getAuxVar('use_treatment') ?? 10;
@@ -51,7 +56,7 @@ $use_auto_nation_turn = $me->getAuxVar('use_auto_nation_turn') ?? 1;
<meta name="viewport" content="width=500" />
<title><?= UniqueConst::$serverName ?>: 내정보</title>
<?= WebUtil::printStaticValues([
'availableDieImmediately' => $availableDieImmediately,
'availableDieOnPrestart' => $availableDieOnPrestart,
'staticValues' => [
'items' => Util::mapWithKey(fn (string $key, BaseItem $item) => [
'name' => $item->getName(),
@@ -65,6 +70,7 @@ $use_auto_nation_turn = $me->getAuxVar('use_auto_nation_turn') ?? 1;
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printDist('vue', [], true) ?>
<?= WebUtil::printDist('ts', ['myPage']) ?>
</head>
@@ -110,7 +116,7 @@ $use_auto_nation_turn = $me->getAuxVar('use_auto_nation_turn') ?? 1;
<?php foreach ([90, 80, 60, 40] as $targetDefenceTrain) : ?>
<option value='<?= $targetDefenceTrain ?>' <?= $me->getVar('defence_train') == $targetDefenceTrain ? "selected" : ""; ?>><?= formatDefenceTrain($targetDefenceTrain) ?>(훈사<?= $targetDefenceTrain ?>)</option>
<?php endforeach; ?>
<option value=999 <?= $me->getVar('defence_train') == 999 ? "selected" : ""; ?>><?= formatDefenceTrain(999) ?>[훈련, 사기 -3]</option>
<option value=999 <?= $me->getVar('defence_train') == 999 ? "selected" : ""; ?>><?= formatDefenceTrain(999) ?>[훈련 -3, 사기 -6]</option>
</select>
】<br><br>
<input type=<?= $submit ?> id='set_my_setting' name=btn style=background-color:<?= GameConst::$basecolor2 ?>;color:white;width:160px;height:30px;font-size:14px; value=설정저장><br>
@@ -122,9 +128,14 @@ $use_auto_nation_turn = $me->getAuxVar('use_auto_nation_turn') ?? 1;
<!--빙의 해제용 삭턴 조절<br>
<a href="b_myPage.php?detachNPC=1"><button type="button" style=background-color:<?= GameConst::$basecolor2 ?>;color:white;width:160px;height:30px;font-size:14px;>빙의 해체 요청</button></a>-->
<?php if ($showDieImmediatelyBtn) : ?>
<?php if ($showDieOnPrestartBtn) : ?>
가오픈 기간 내 장수 삭제 (<?= substr($targetTime, 0, 19) ?> 부터)<br>
<a href="c_die_immediately.php" id='die_immediately'><button type="button" style=background-color:<?= GameConst::$basecolor2 ?>;color:white;width:160px;height:30px;font-size:14px;>장수 삭제</button></a><br><br>
<button type="button" id='dieOnPrestart' style=background-color:<?= GameConst::$basecolor2 ?>;color:white;width:160px;height:30px;font-size:14px;>장수 삭제</button><br><br>
<?php endif; ?>
<?php if ($showBuildNationCandidateBtn) : ?>
서버 개시 이전 거병(2턴부터 건국 가능)<br>
<button type="button" id='buildNationCandidate' style=background-color:<?= GameConst::$basecolor2 ?>;color:white;width:160px;height:30px;font-size:14px;>사전 거병</button><br><br>
<?php endif; ?>
<?php if ($gameStor->npcmode == 2 && $me->getNPCType() == 0) : ?>
+68 -114
View File
@@ -17,7 +17,8 @@ TurnExecutionHelper::executeAllCommand();
$me = $db->queryFirstRow('select no,tournament,con,turntime from general where owner=%i', $userID);
$generalID = $session->generalID;
$admin = $gameStor->getValues(['tournament', 'phase', 'tnmt_msg', 'tnmt_type', 'develcost', 'tnmt_trig']);
$admin = $gameStor->getValues(['tournament', 'phase', 'turnterm', 'tnmt_msg', 'tnmt_type', 'develcost', 'tnmt_trig']);
$turnTerm = $admin['turnterm'];
$con = checkLimit($me['con']);
if ($con >= 2) {
@@ -109,6 +110,7 @@ $globalBetTotal = array_sum($globalBet);
<meta name="viewport" content="width=1024" />
<title><?= UniqueConst::$serverName ?>: 토너먼트</title>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<?= WebUtil::printDist('vue', [], true) ?>
<?= WebUtil::printDist('ts', 'common', true) ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
</head>
@@ -120,128 +122,80 @@ $globalBetTotal = array_sum($globalBet);
</tr>
</table>
<table align=center class='tb_layout bg0'>
<?php
if ($session->userGrade >= 5) {
$sel = [];
echo "
<form method=post action=c_tournament.php>
<tr><td colspan=8><input type=textarea size=150 style=color:white;background-color:black; name=msg><input type=submit name=btn value='메시지'></td></tr>
<tr><td colspan=8>
<input type=button value='갱신' onclick='location.reload()'>";
<?php if ($session->userGrade >= 5) : ?>
<form method=post action=c_tournament.php>
<tr>
<td colspan=8><input type=textarea size=150 style=color:white;background-color:black; name=msg><input type=submit name=btn value='메시지'></td>
</tr>
<tr>
<td colspan=8>
<button type="button" class="btn btn-secondary" onclick='location.reload()'>갱신</button>
<?php if ($admin['tournament'] == 0) : ?>
<select name=auto size=1 style=color:white;background-color:black;>
<option style=color:white; value=0 <?= !$admin['tnmt_trig'] ? 'selected' : '' ?>>수동진행</option>
<option style=color:white; value=1 <?= $admin['tnmt_trig'] ? 'selected' : '' ?>>자동진행</option>
</select>
<input type=submit name=btn value='자동개최설정'>
<?php else : ?>
<input type=submit name=btn value='중단' onclick='return confirm("진짜 중단하시겠습니까?")'>
<?php endif; ?>
switch ($admin['tnmt_trig']) {
case 0:
$sel[0] = "selected";
break;
case 1:
$sel[1] = "selected";
break;
case 2:
$sel[2] = "selected";
break;
case 3:
$sel[3] = "selected";
break;
case 4:
$sel[4] = "selected";
break;
case 5:
$sel[5] = "selected";
break;
case 6:
$sel[6] = "selected";
break;
case 7:
$sel[7] = "selected";
break;
}
if ($admin['tournament'] == 0) {
?>
<select name=auto size=1 style=color:white;background-color:black;>
<option style=color:white; value=0>수동진행</option>
<option style=color:white; value=1>12분 05일</option>
<option style=color:white; value=2>07분 10시</option>
<option style=color:white; value=3>03분 04시</option>
<option style=color:white; value=4>01분 82분</option>
<option style=color:white; value=5>30초 41분</option>
<option style=color:white; value=6>15초 21분</option>
<option style=color:white; value=7>05초 07분</option>
</select>
<select name=type size=1 style=color:white;background-color:black;>
<option style=color:white; value=0>전력전</option>
<option style=color:white; value=1>통솔전</option>
<option style=color:white; value=2>일기토</option>
<option style=color:white; value=3>설전</option>
</select>
<input type=submit name=btn value='개최'>
<select name=trig size=1 style=color:white;background-color:black;>
<option style=color:white; value=0 <?= $sel[0] ?? '' ?>>수동진행</option>
<option style=color:white; value=1 <?= $sel[1] ?? '' ?>>12분 05일</option>
<option style=color:white; value=2 <?= $sel[2] ?? '' ?>>07분 10시</option>
<option style=color:white; value=3 <?= $sel[3] ?? '' ?>>03분 04시</option>
<option style=color:white; value=4 <?= $sel[4] ?? '' ?>>01분 82분</option>
<option style=color:white; value=5 <?= $sel[5] ?? '' ?>>30초 41분</option>
<option style=color:white; value=6 <?= $sel[6] ?? '' ?>>15초 21분</option>
<option style=color:white; value=7 <?= $sel[7] ?? '' ?>>05초 07분</option>
</select>
<input type=submit name=btn value='자동개최설정'>
<input type=submit name=btn value='포상'>
<input type=submit name=btn value='회수'>
<?php
} else {
echo "<input type=submit name=btn value='중단' onclick='return confirm(\"진짜 중단하시겠습니까?\")'>";
}
<?php switch ($admin['tournament']) {
case 1:
echo "<input type=submit name=btn value='랜덤투입'>";
echo "<input type=submit name=btn value='랜덤전부투입'>";
break;
case 2:
echo "<input type=submit name=btn value='예선'><input type=submit name=btn value='예선전부'>";
break;
case 3:
echo "<input type=submit name=btn value='추첨'><input type=submit name=btn value='추첨전부'>";
break;
case 4:
echo "<input type=submit name=btn value='본선'><input type=submit name=btn value='본선전부'>";
break;
case 5:
echo "<input type=submit name=btn value='배정'>";
break;
case 6:
echo "<input type=submit name=btn value='베팅마감'>";
break;
case 7:
echo "<input type=submit name=btn value='16강'>";
break;
case 8:
echo "<input type=submit name=btn value='8강'>";
break;
case 9:
echo "<input type=submit name=btn value='4강'>";
break;
case 10:
echo "<input type=submit name=btn value='결승'>";
break;
} ?>
switch ($admin['tournament']) {
case 1:
echo "<input type=submit name=btn value='랜덤투입'>";
echo "<input type=submit name=btn value='랜덤전부투입'>";
break;
case 2:
echo "<input type=submit name=btn value='예선'><input type=submit name=btn value='예선전부'>";
break;
case 3:
echo "<input type=submit name=btn value='추첨'><input type=submit name=btn value='추첨전부'>";
break;
case 4:
echo "<input type=submit name=btn value='본선'><input type=submit name=btn value='본선전부'>";
break;
case 5:
echo "<input type=submit name=btn value='배정'>";
break;
case 6:
echo "<input type=submit name=btn value='베팅마감'>";
break;
case 7:
echo "<input type=submit name=btn value='16강'>";
break;
case 8:
echo "<input type=submit name=btn value='8강'>";
break;
case 9:
echo "<input type=submit name=btn value='4강'>";
break;
case 10:
echo "<input type=submit name=btn value='결승'>";
break;
}
echo "
</td></tr>
</form>";
} elseif ($me['no'] > 0 && $me['tournament'] == 0 && $admin['tournament'] == 1) {
echo "<form method=post action=c_tournament.php><tr><td colspan=8><input type=button value='갱신' onclick='location.reload()'><input type=submit name=btn value='참가' onclick='return confirm(\"참가비 금{$admin['develcost']}이 필요합니다. 참가하시겠습니까?\")'></td></tr></form>";
} else {
echo "<tr><td colspan=8><input type=button value='갱신' onclick='location.reload()'></td></tr>";
}
</td>
</tr>
</form>
<?php elseif ($me['no'] > 0 && $me['tournament'] == 0 && $admin['tournament'] == 1) : ?>
<form method=post action=c_tournament.php>
<tr>
<td colspan=8><button type="button" class="btn btn-secondary" onclick='location.reload()'>갱신</button><button type="submit" class="btn btn-sammo-base2" onclick='return confirm("참가비 금<?= $admin['develcost'] ?>이 필요합니다. 참가하시겠습니까?")'>참가</button><input type='hidden' name='btn' value='참가'/></td>
</tr>
</form>
<?php else : ?>
<tr>
<td colspan=8><button type="button" class="btn btn-secondary" onclick='location.reload()'>갱신</button></td>
</tr>
<?php endif;
$str1 = getTournament($admin['tournament']);
$str2 = getTournamentTime();
if ($str2) {
$str2 = ', ' . $str2;
}
$str3 = getTournamentTermText();
$str3 = getTournamentTermText($turnTerm);
if ($str3) {
$str3 = ', ' . $str3;
}
-230
View File
@@ -1,230 +0,0 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
//로그인 검사
$session = Session::requireGameLogin()->setReadOnly();
$userID = Session::getUserID();
$db = DB::db();
increaseRefresh("부대편성", 1);
$me = $db->queryFirstRow('SELECT no,nation,troop FROM general WHERE owner=%i', $userID);
$troops = [];
foreach ($db->query('SELECT troop_leader,name FROM troop WHERE nation = %i', $me['nation']) as $rawTroop) {
$troops[$rawTroop['troop_leader']] = [
'name' => $rawTroop['name'],
'users' => []
];
}
foreach ($db->query(
'SELECT no,name,turntime,troop,city FROM general WHERE troop!=0 AND nation = %i ORDER BY turntime ASC',
$me['nation']
) as $general) {
if (!key_exists($general['troop'], $troops)) {
trigger_error("올바르지 않은 부대 소속 {$general['no']}, {$general['name']} : {$general['troop']}");
continue;
}
$general['cityText'] = CityConst::byID($general['city'])->name;
$troops[$general['troop']]['users'][] = $general;
}
if ($troops) {
$troopLeaders = $db->query(
'SELECT no,name,picture,imgsvr,turntime,city,troop FROM general WHERE no IN %li',
array_keys($troops)
);
$generalTurnList = [];
foreach ($db->queryAllLists(
'SELECT general_id, turn_idx, brief FROM general_turn WHERE general_id IN %li AND turn_idx < 5 ORDER BY general_id ASC, turn_idx ASC',
array_column($troopLeaders, 'no')
) as [$generalID, $turnIdx, $brief]) {
if (!key_exists($generalID, $generalTurnList)) {
$generalTurnList[$generalID] = [];
}
$generalTurnList[$generalID][$turnIdx] = $brief;
}
foreach ($troopLeaders as $troopLeader) {
$imageTemp = GetImageURL($troopLeader['imgsvr']);
$troopLeader['pictureFullPath'] = "$imageTemp/{$troopLeader['picture']}";
$troopLeader['cityText'] = CityConst::byID($troopLeader['city'])->name;
$turnText = [];
foreach ($generalTurnList[$troopLeader['no']] as $rawTurnIdx => $brief) {
if ($brief != '집합') {
$brief = '~';
}
$turnIdx = $rawTurnIdx + 1;
$turnText[] = "{$turnIdx} : {$brief}";
}
$troopLeader['turnText'] = join('<br>', $turnText);
$troops[$troopLeader['troop']]['leader'] = $troopLeader;
}
}
uasort($troops, function ($lhs, $rhs) {
return $lhs['leader']['turntime'] <=> $rhs['leader']['turntime'];
})
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=1024" />
<title><?= UniqueConst::$serverName ?>: 부대편성</title>
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printCSS('../d_shared/common.css') ?>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css" />
<?= WebUtil::printDist('ts', ['common', 'troop'], true) ?>
</head>
<body>
<div style="width:1000px;margin:auto;">
<table width=1000 class='tb_layout bg0'>
<tr>
<td>부 대 편 성<br><?= backButton() ?></td>
</tr>
</table>
<table id="troop_list" class='tb_layout bg0'>
<thead>
<tr>
<td width=64 class='bg1 center'>선 택</td>
<td width=130 class='bg1 center'>부 대 정 보</td>
<td width=100 class='bg1 center'>부 대 장</td>
<td width=576 class='bg1 center' style=table-layout:fixed;word-break:break-all;>장 수</td>
<td width=130 class='bg1 center' style=table-layout:fixed;word-break:break-all;>부대장행동</td>
</tr>
</thead>
<tfoot>
<tr>
<td colspan='5'>
<?php if (!$troops) : ?>
<?php elseif ($me['troop'] == 0) : ?>
<input type=button id='btnJoinTroop' value='부 대 가 입'>
<?php else : ?>
<input type=button id="btnLeaveTroop" value='부 대 탈 퇴'>
<?php endif; ?>
</td>
</tr>
</tfoot>
<tbody>
<?php
foreach ($troops as $troopNo => $troop) {
$troopLeader = $troop['leader'];
$genlistText = [];
$cityText = $troopLeader['cityText'];
$cityID = $troopLeader['city'];
$leaderID = $troopLeader['no'];
foreach ($troop['users'] as $troopUser) {
$spanClass = 'troopUser';
if ($troopUser['city'] !== $cityID) {
$spanClass .= ' diffCity';
}
if ($troopUser['no'] == $leaderID) {
$spanClass .= ' leader';
}
$genlistText[] = "<span class='$spanClass' data-general-id='{$troopUser['no']}'
><span class='generalName'>{$troopUser['name']}</span><span class='cityText'>【{$troopUser['cityText']}】</span
></span>";
}
$genlistText = sprintf('%s (%d명)', join(', ', $genlistText), count($genlistText)); ?>
<?php if ($me['troop'] == 0) : ?>
<tr>
<td align=center rowspan=2><input type='radio' class='troopId' name='troop' value='<?= $troopNo ?>'></td>
<td align=center><?= $troop['name'] ?><br>【 <?= $cityText ?> 】</td>
<td height=64 class='generalIcon' style='background:no-repeat center url("<?= $troopLeader['pictureFullPath'] ?>");background-size:64px;'>&nbsp;</td>
<td rowspan=2 width=62><?= $genlistText ?></td>
<td rowspan=2><?= $troopLeader['turnText'] ?></td>
</tr>
<tr>
<td align=center>
<font size=2>【턴】 <?= substr($troopLeader['turntime'], 14, 5) ?></font>
</td>
<td align=center>
<font size=1><?= $troopLeader['name'] ?></font>
</td>
</tr>
<tr>
<td colspan=5>
<?php else : ?>
<tr>
<td align=center rowspan=2>&nbsp;</td>
<td align=center><?= $troop['name'] ?><br>【 <?= $cityText ?> 】</td>
<td height=64 class='generalIcon' style='background:no-repeat center url("<?= $troopLeader['pictureFullPath'] ?>");background-size:64px;'>&nbsp;</td>
<td rowspan=2 width=62><?= $genlistText ?></td>
<td rowspan=2>
<?php if ($me['no'] == $troopLeader['no']) : ?>
<select id='genNo' name=gen size=3 style=color:white;background-color:black;font-size:14px;width:128px;>";
<?php foreach ($troop['users'] as $troopUser) : ?>
<?php if ($troopUser['no'] == $me['no']) {
continue;
} ?>
<option value='<?= $troopUser['no'] ?>'><?= $troopUser['name'] ?></option>
<?php endforeach; ?>
</select><br>
<input type=button id='btnKickTroop' value='부 대 추 방' style=width:130px;height:25px;>
<?php else : ?>
<?= $troopLeader['turnText'] ?>
<?php endif; ?>
</td>
</tr>
<tr>
<td align=center>
<font size=2>【턴】 <?= substr($troopLeader['turntime'], 14, 5) ?></font>
</td>
<td align=center>
<font size=1><?= $troopLeader['name'] ?></font>
</td>
</tr>
<tr>
<td colspan=5></td>
</tr>
<?php endif;
} //foreach ($troops as $troopNo=>$troop) {
?>
</tbody>
</table>
<br>
<table width=1000 class='tb_layout bg0'>
<tr>
<td width=80 class='bg1'>부 대 명</td>
<td width=130><input type=text style=color:white;background-color:black; size=18 maxlength=18 id='nameplate'></td>
<?php if ($me['troop'] == 0) : ?>
<td><input type=button id='btnCreateTroop' value='부 대 창 설'></td>
<?php else : ?>
<td><input type=button id='btnChangeTroopName' value='부 대 변 경'></td>
<?php endif; ?>
</tr>
</table>
<table width=1000 class='tb_layout bg0'>
<tr>
<td><?= backButton() ?></td>
</tr>
<tr>
<td><?= banner() ?> </td>
</tr>
</table>
</div>
</body>
</html>
+31 -3
View File
@@ -54,6 +54,7 @@ if ($nationID) {
var city = <?= Json::encode($city) ?>;
var nation = <?= Json::encode($nation) ?>;
</script>
<?= WebUtil::printDist('vue', [], true) ?>
<?= WebUtil::printDist('ts', ['common', 'battle_simulator']) ?>
</head>
@@ -64,8 +65,8 @@ if ($nationID) {
전역 설정
</div>
<div class="card-body dragpad_battle">
<div class="row">
<div class="col-sm-6">
<div class="row gx-0">
<div class="col-sm-4">
<div class="input-group">
<input type="number" class="form-control" aria-describedby="text_year" value="<?= $startYear ?>" disabled>
<div class="input-group-text"> 년 시작 </div>
@@ -75,9 +76,13 @@ if ($nationID) {
<div class="input-group-text"> 월 </div>
</div>
</div>
<div class="col-sm-6">
<div class="col-sm-5 px-2">
<div class="btn-toolbar" role="toolbar">
<div class="input-group me-2" role="group">
<div class="input-group-text">
시드
</div>
<input type="text" class="form-control" id="seed" aria-describedby="text_seed">
<div class="input-group-text">
반복 횟수
</div>
@@ -86,6 +91,10 @@ if ($nationID) {
<option value="1000">1000회 (요약 표기)</option>
</select>
</div>
</div>
</div>
<div class="col-sm-3">
<div class="btn-toolbar" role="toolbar">
<div class="btn-group me-2" role="group">
<button type="button" class="btn btn-danger btn-begin_battle">전투</button>
</div>
@@ -425,6 +434,25 @@ if ($nationID) {
</div>
<input type="number" class="form-control form_killcrew" value="0" step="1">
</div>
<div class="input-group mb-0">
<div class="input-group-text">자신</div>
<div class="input-group-text">회피 확률</div>
<input type="number" class="form-control form_war_avoid_ratio" value="0" step="1" min="0" max="5">
<div class="input-group-text">필살 확률</div>
<input type="number" class="form-control form_war_critical_ratio" value="0" step="1" min="0" max="5">
<div class="input-group-text">계략 시도 확률</div>
<input type="number" class="form-control form_war_magic_trial_prob" value="0" step="1" min="0" max="5">
</div>
<div class="input-group mb-1">
<div class="input-group-text">상대</div>
<div class="input-group-text">회피 확률</div>
<input type="number" class="form-control form_oppose_war_avoid_ratio" value="0" step="1" min="0" max="5">
<div class="input-group-text">필살 확률</div>
<input type="number" class="form-control form_oppose_war_critical_ratio" value="0" step="1" min="0" max="5">
<div class="input-group-text">계략 시도 확률</div>
<input type="number" class="form-control form_oppose_war_magic_trial_prob" value="0" step="1" min="0" max="5">
</div>
</div>
</div>
+2 -2
View File
@@ -113,11 +113,11 @@ if($session->userGrade < 5) {
}
if($btn == "자동개최설정") {
$gameStor->tnmt_trig = $trig;
$gameStor->tnmt_trig = !!$trig;
} elseif($btn == "개최") {
startTournament($auto, $type);
} elseif($btn == "중단") {
$gameStor->tnmt_auto = 0;
$gameStor->tnmt_auto = false;
$gameStor->tournament = 0;
$gameStor->phase = 0;
} elseif($btn == "랜덤투입") {
+42 -63
View File
@@ -886,7 +886,7 @@ function generalInfo2(General $generalObj)
function getOnlineNum(): int
{
return KVStorage::getStorage(DB::db(), 'game_env')->getValue('online') ?? 0;
return KVStorage::getStorage(DB::db(), 'game_env')->getValue('online_user_cnt') ?? 0;
}
function onlinegen(General $general)
@@ -906,7 +906,7 @@ function nationMsg(General $general)
$nationID = $general->getNationID();
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
return $nationStor->notice ?? '';
return $nationStor->nationNotice['msg'] ?? '';
}
function banner()
@@ -1003,19 +1003,31 @@ function increaseRefresh($type = "", $cnt = 1)
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$gameStor->refresh = $gameStor->refresh + $cnt; //TODO: +로 증가하는 값은 별도로 분리
$isunited = $gameStor->isunited;
$opentime = $gameStor->opentime;
if ($isunited != 2 && $generalID && $userGrade < 6 && $opentime <= TimeUtil::now()) {
$db->update('general', [
'lastrefresh' => $date,
'con' => $db->sqleval('con + %i', $cnt),
'connect' => $db->sqleval('connect + %i', $cnt),
'refcnt' => $db->sqleval('refcnt + %i', $cnt),
'refresh' => $db->sqleval('refresh + %i', $cnt)
], 'owner=%i', $userID);
if($userGrade == 6){
return;
}
if($isunited == 2){
return;
}
if(!$generalID){
return;
}
if($opentime > $date){
return;
}
$gameStor->refresh = $gameStor->refresh + $cnt; //TODO: +로 증가하는 값은 별도로 분리
$db->update('general', [
'lastrefresh' => $date,
'con' => $db->sqleval('con + %i', $cnt),
'connect' => $db->sqleval('connect + %i', $cnt),
'refcnt' => $db->sqleval('refcnt + %i', $cnt),
'refresh' => $db->sqleval('refresh + %i', $cnt)
], 'owner=%i', $userID);
$date = date('Y_m_d H:i:s');
$date2 = substr($date, 0, 10);
@@ -1033,42 +1045,6 @@ function increaseRefresh($type = "", $cnt = 1)
),
FILE_APPEND
);
$proxy_headers = array(
'HTTP_VIA',
'HTTP_X_FORWARDED_FOR',
'HTTP_FORWARDED_FOR',
'HTTP_X_FORWARDED',
'HTTP_FORWARDED',
'HTTP_CLIENT_IP',
'HTTP_FORWARDED_FOR_IP',
'VIA',
'X_FORWARDED_FOR',
'FORWARDED_FOR',
'X_FORWARDED',
'FORWARDED',
'CLIENT_IP',
'FORWARDED_FOR_IP',
'HTTP_PROXY_CONNECTION'
);
$str = "";
foreach ($proxy_headers as $x) {
if (isset($_SERVER[$x])) $str .= "//{$x}:{$_SERVER[$x]}";
}
if ($str != "") {
file_put_contents(
__DIR__ . "/logs/" . UniqueConst::$serverID . "/_{$date2}_ipcheck.txt",
sprintf(
"%s, %s, %s%s\n",
$session->userName,
$session->generalName,
$_SERVER['REMOTE_ADDR'],
$str
),
FILE_APPEND
);
}
}
function updateTraffic()
@@ -1223,10 +1199,9 @@ function updateOnline()
$nationname[$nation['nation']] = $nation['name'];
}
//동접수
$before5Min = TimeUtil::nowAddMinutes(-5);
$onlineUser = $db->query('SELECT no,name,nation FROM general WHERE lastrefresh > %s AND npc < 2', $before5Min);
$startTurn = cutTurn($gameStor->turntime, $gameStor->turnterm, false);
$onlineUser = $db->query('SELECT no,name,nation FROM general WHERE lastrefresh >= %s AND npc < 2', $startTurn);
$onlineNum = count($onlineUser);
$onlineNationUsers = Util::arrayGroupBy($onlineUser, 'nation');
@@ -1358,7 +1333,7 @@ function triggerTournament(RandUtil $rng)
if ($tournament != 0) {
return;
}
if ($tnmt_trig == 0) {
if (!$tnmt_trig) {
return;
}
if (!$rng->nextBool(0.4)) {
@@ -1374,7 +1349,7 @@ function triggerTournament(RandUtil $rng)
$tnmt_type = array_pop($tnmt_pattern);
$gameStor->setValue('tnmt_pattern', $tnmt_pattern);
startTournament($tnmt_trig, $tnmt_type);
startTournament($tnmt_type);
}
function CheckHall($no)
@@ -1745,7 +1720,8 @@ function tryUniqueItemLottery(RandUtil $rng, General $general, string $acquireTy
$prob = 1 / ($genCount * $itemTypeCnt / 10 / 4); // 건국시 4개(20%) 등장(200명시 20국 정도 됨)
}
$prob = Util::valueFit($prob, null, 1 / 4); //최대치 감소
$prob *= GameConst::$uniqueTrialCoef;
$prob = Util::valueFit($prob, null, GameConst::$maxUniqueTrialProb); //최대치 감소
$result = false;
$prob /= sqrt(7);
@@ -1805,16 +1781,16 @@ function deleteNation(General $lord, bool $applyDB): array
$nationID,
$lordID
),
['npc', 'gold', 'rice', 'experience', 'explevel', 'dedication', 'dedlevel', 'belong', 'aux'],
['npc', 'owner', 'gold', 'rice', 'experience', 'explevel', 'dedication', 'dedlevel', 'belong', 'aux'],
1
);
$nationGeneralList[$lordID] = $lord;
$nation['generals'] = array_keys($nationGeneralList);
$nation['aux'] = Json::decode($nation['aux']);
$nation['msg'] = $nationStor->notice;
$nation['msg'] = $nationStor->nationNotice['msg'] ?? '';
$nation['scout_msg'] = $nationStor->scout_msg;
$nation['aux'] += $nationStor->max_power;
$nation['aux'] += $nationStor->max_power ?? [];
$nation['history'] = getNationHistoryLogAll($nationID);
$josaYi = JosaUtil::pick($nationName, '이');
@@ -1823,13 +1799,16 @@ function deleteNation(General $lord, bool $applyDB): array
// 전 장수 재야로
foreach ($nationGeneralList as $general) {
$general->setAuxVar(
InheritanceKey::max_belong->value,
max(
$general->getVar('belong'),
$general->getAuxVar(InheritanceKey::max_belong->value) ?? 0
)
);
if($general->getNPCType() < 2){
$general->setAuxVar(
InheritanceKey::max_belong->value,
max(
$general->getVar('belong'),
$general->getAuxVar(InheritanceKey::max_belong->value) ?? 0
)
);
}
$general->setVar('belong', 0);
$general->setVar('troop', 0);
$general->setVar('officer_level', 0);
+2 -2
View File
@@ -18,7 +18,7 @@ function registerAuction(RandUtil $rng)
[AuctionType::BuyRice->value, AuctionType::SellRice->value],
));
$neutralbuyRiceCnt = $neutralAuctionCnt[AuctionType::BuyRice->value];
$neutralbuyRiceCnt = $neutralAuctionCnt[AuctionType::BuyRice->value] ?? 0;
// 판매건 등록
if ($rng->nextBool(1 / ($neutralbuyRiceCnt + 5))) {
@@ -38,7 +38,7 @@ function registerAuction(RandUtil $rng)
AuctionBuyRice::openResourceAuction($dummyGeneral, $amount, $term, $cost, $topv);
}
$neutralSellRiceCnt = $neutralAuctionCnt[AuctionType::SellRice->value];
$neutralSellRiceCnt = $neutralAuctionCnt[AuctionType::SellRice->value] ?? 0;
// 구매건 등록
if ($rng->nextBool(1 / ($neutralSellRiceCnt + 5))) {
//평균 쌀의 5% ~ 25%
+71 -44
View File
@@ -2,6 +2,8 @@
namespace sammo;
use sammo\DTO\AuctionInfo;
use sammo\Enums\AuctionType;
use sammo\Enums\InheritanceKey;
use sammo\Enums\RankColumn;
@@ -283,13 +285,8 @@ function preUpdateMonthly()
'rate_tmp' => $db->sqleval('rate')
], true);
//도시훈사 180년 60, 220년 87, 240년 100
$rate = Util::round(($admin['year'] - $admin['startyear']) / 1.5) + 60;
if ($rate > 100) $rate = 100;
// 20 ~ 140원
$develcost = ($admin['year'] - $admin['startyear'] + 10) * 2;
$gameStor->city_rate = $rate;
$gameStor->develcost = $develcost;
//매달 사망자 수입 결산
@@ -526,7 +523,7 @@ function checkWander(RandUtil $rng)
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$admin = $gameStor->getValues(['year', 'month']);
$admin = $gameStor->getValues(['year', 'month', 'init_year', 'init_month']);
$wanderers = $db->queryFirstColumn('SELECT general.`no` FROM general LEFT JOIN nation ON general.nation = nation.nation WHERE nation.`level` = 0 AND general.`officer_level` = 12');
@@ -557,32 +554,39 @@ function updateNationState()
$startYear = $admin['startyear'];
$assemblerCnts = [];
$nationCityCounts = [];
foreach($db->queryAllLists('SELECT nation, count(*) FROM city WHERE LEVEL>=4 GROUP BY nation') as [$nationID, $cityCnt]){
$nationCityCounts[$nationID] = $cityCnt;
}
foreach ($db->queryAllLists('SELECT nation,count(no) FROM general WHERE npc = 5 GROUP BY nation') as [$nationID, $assemblerCnt]) {
$assemblerCnts[$nationID] = $assemblerCnt;
};
$nationLevelByCityCnt = [
0, //방랑군
1, //호족
2, //군벌
5, //주자사
8, //주목
11, //공
16, //왕
21, //황제
];
foreach ($db->query('SELECT nation,name,level,tech,aux FROM nation') as $nation) {
//TODO: level이 진관수이소중대특 체계를 벗어날 수 있음
$nationID = $nation['nation'];
$citycount = $db->queryFirstField('SELECT count(*) FROM city WHERE nation=%i AND level>=4', $nationID);
$cityCnt = $nationCityCounts[$nationID] ?? 0;
if ($citycount == 0) {
$nationlevel = 0; // 방랑군
} elseif ($citycount == 1) {
$nationlevel = 1; // 호족
} elseif ($citycount <= 4) {
$nationlevel = 2; // 군벌
} elseif ($citycount <= 7) {
$nationlevel = 3; // 주자사
} elseif ($citycount <= 10) {
$nationlevel = 4; // 주목
} elseif ($citycount <= 15) {
$nationlevel = 5; // 공
} elseif ($citycount <= 20) {
$nationlevel = 6; // 왕
} else {
$nationlevel = 7; // 황제
/** @var int */
$nationlevel = 0;
foreach($nationLevelByCityCnt as $cmpNationLevel => $cmpCityCnt){
if($cityCnt < $cmpCityCnt){
break;
}
$nationlevel = $cmpNationLevel;
}
if ($nationlevel > $nation['level']) {
@@ -596,33 +600,47 @@ function updateNationState()
'rice' => $db->sqleval('rice + %i', $nationlevel * 1000),
];
$nationName = $nation['name'];
$lordName = $db->queryFirstField('SELECT name FROM general WHERE nation = %i AND officer_level = 12', $nationID);
$oldNationLevelText = getNationLevel($oldLevel);
$nationLevelText = getNationLevel($nationlevel);
$logger = new ActionLogger(0, $nationID, $year, $month, false);
$josaYi = JosaUtil::pick($lordName, '이');
switch ($nationlevel) {
case 7:
$josaUl = JosaUtil::pick(getNationLevel($nationlevel), '');
$history[] = "<C>●</>{$year}{$month}월:<Y><b>【작위】</b></><D><b>{$nation['name']}</b></>의 군주가 <Y>" . getNationLevel($nationlevel) . "</>{$josaUl} 자칭하였습니다.";
pushNationHistoryLog($nation['nation'], ["<C>●</>{$year}{$month}월:<D><b>{$nation['name']}</b></>의 군주가 <Y>" . getNationLevel($nationlevel) . "</>{$josaUl} 자칭"]);
case 7: //황제
$josaRo = JosaUtil::pick($nationLevelText, '');
$logger->pushGlobalHistoryLog("<Y><b>【작위】</b></><D><b>{$nationName}</b></> {$oldNationLevelText} <Y>{$lordName}</>{$josaYi} <C>{$nationLevelText}</>{$josaRo} 옹립되었습니다.");
$logger->pushNationalHistoryLog("<D><b>{$nationName}</b></> {$oldNationLevelText} <Y>{$lordName}</>{$josaYi} <C>{$nationLevelText}</>{$josaRo} 옹립");
$auxVal = Json::decode($nation['aux']);
$auxVal['can_국기변경'] = 1;
$auxVal['can_국호변경'] = 1;
$updateVals['aux'] = Json::encode($auxVal);
break;
case 6:
$history[] = "<C>●</>{$year}{$month}월:<Y><b>【작위】</b></><D><b>{$nation['name']}</b></>의 군주가 <Y>" . getNationLevel($nationlevel) . "</>에 등극하였습니다.";
pushNationHistoryLog($nation['nation'], ["<C>●</>{$year}{$month}월:<D><b>{$nation['name']}</b></>의 군주가 <Y>" . getNationLevel($nationlevel) . "</>에 등극"]);
case 6: //왕
$josaRo = JosaUtil::pick($nationLevelText, '로');
$logger->pushGlobalHistoryLog("<Y><b>【작위】</b></><D><b>{$nationName}</b></>의 <Y>{$lordName}</>{$josaYi} <C>$nationLevelText</>{$josaRo} 책봉되었습니다.");
$logger->pushNationalHistoryLog("<D><b>{$nationName}</b></>의 <Y>{$lordName}</>{$josaYi} <C>$nationLevelText</>{$josaRo} 책봉");
break;
case 5:
case 4:
case 3:
$history[] = "<C>●</>{$year}{$month}월:<Y><b>【작위】</b></><D><b>{$nation['name']}</b></>의 군주가 <Y>" . getNationLevel($nationlevel) . "</>에 임명되었습니다.";
pushNationHistoryLog($nation['nation'], ["<C>●</>{$year}{$month}월:<D><b>{$nation['name']}</b></>의 군주가 <Y>" . getNationLevel($nationlevel) . "</>에 임명됨"]);
case 5: //공
case 4: //주목
case 3: //주자사
$josaRo = JosaUtil::pick($nationLevelText, '로');
$logger->pushGlobalHistoryLog("<Y><b>【작위】</b></><D><b>{$nationName}</b></>의 <Y>{$lordName}</>{$josaYi} <C>$nationLevelText</>{$josaRo} 임명되었습니다.");
$logger->pushNationalHistoryLog("<D><b>{$nationName}</b></>의 <Y>{$lordName}</>{$josaYi} <C>$nationLevelText</>{$josaRo} 임명됨");
break;
case 2:
$history[] = "<C>●</>{$year}{$month}월:<Y><b>【작위】</b></><D><b>{$nation['name']}</b></>의 군주가 독립하여 <Y>" . getNationLevel($nationlevel) . "</>로 나섰습니다.";
pushNationHistoryLog($nation['nation'], ["<C>●</>{$year}{$month}월:<D><b>{$nation['name']}</b></>의 군주가 <Y>" . getNationLevel($nationlevel) . "</>로 나서다"]);
case 2: //군벌
$josaRa = JosaUtil::pick($nationName, '라');
$josaRo = JosaUtil::pick($nationLevelText, '로');
$logger->pushGlobalHistoryLog("<Y><b>【작위】</b></><Y>{$lordName}</>{$josaYi} 독립하여 <D><b>{$nationName}</b></>{$josaRa}는 <C>$nationLevelText</>{$josaRo} 나섰습니다.");
$logger->pushNationalHistoryLog("<Y>{$lordName}</>{$josaYi} 독립하여 <D><b>{$nationName}</b></>{$josaRa}는 <C>$nationLevelText</>{$josaRo} 나서다");
break;
}
$db->update('nation', $updateVals, 'nation=%i', $nation['nation']);
$logger->flush();
$turnRows = [];
foreach (Util::range(getNationChiefLevel($nation['level']), 12) as $chiefLevel) {
@@ -1053,6 +1071,16 @@ function checkEmperior()
$nationLogger = new ActionLogger(0, $nationID, $admin['year'], $admin['month']);
$nationLogger->pushNationalHistoryLog("<D><b>{$nationName}</b></>{$josaYi} 전토를 통일");
/** @var int[] */
$auctionList = $db->queryFirstColumn(
'SELECT `id` FROM `ng_auction` WHERE `type` = %s AND `finished` = 0 ORDER BY `close_date` ASC',
AuctionType::UniqueItem->value
);
foreach($auctionList as $auctionID){
$auction = new AuctionUniqueItem($auctionID, new DummyGeneral(true));
$auction->closeAuction(true);
}
$inheritPointManager = InheritancePointManager::getInstance();
$allUserGenerals = General::createGeneralObjListFromDB($db->queryFirstColumn('SELECT `no` FROM general WHERE npc < 2'));
foreach ($allUserGenerals as $genObj) {
@@ -1064,9 +1092,8 @@ function checkEmperior()
}
processSumInheritPointRank();
foreach ($allUserGenerals as $genObj) {
$inheritPointManager->mergeTotalInheritancePoint($genObj, true);
$inheritPointManager->mergeTotalInheritancePoint($genObj);
$inheritPointManager->applyInheritanceUser($genObj->getVar('owner'));
$inheritPointManager->clearInheritancePoint($genObj);
}
$gameStor->isunited = 2;
@@ -1135,9 +1162,9 @@ function checkEmperior()
$nation = $nation;
$nation['generals'] = $db->queryFirstColumn('SELECT `no` FROM general WHERE nation=%i', $nation['nation']);
$nation['aux'] = Json::decode($nation['aux']);
$nation['msg'] = $nationStor->notice;
$nation['msg'] = $nationStor->nationNotice['msg'] ?? '';;
$nation['scout_msg'] = $nationStor->scout_msg;
$nation['aux'] += $nationStor->max_power;
$nation['aux'] += $nationStor->max_power ?? [];
$nation['history'] = getNationHistoryLogAll($nation['nation']);
storeOldGenerals(0, $admin['year'], $admin['month']);
@@ -1214,7 +1241,7 @@ function checkEmperior()
]);
$hiddenSeed = UniqueConst::$hiddenSeed;
$history = ["<C>●</>{$admin['year']}{$admin['month']}월:<Y><b>【통일】</b></><D><b>{$nation['name']}</b></>{$josaYi} 전토를 통일하였습니다. <span class='hidden_but_copyable'>(서버시드: $hiddenSeed})</span>"];
$history = ["<C>●</>{$admin['year']}{$admin['month']}월:<Y><b>【통일】</b></><D><b>{$nation['name']}</b></>{$josaYi} 전토를 통일하였습니다. <span class='hidden_but_copyable'>(서버시드: {$hiddenSeed})</span>"];
pushGlobalHistoryLog($history, $admin['year'], $admin['month']);
//연감 월결산
+10
View File
@@ -254,6 +254,7 @@ function pushGeneralHistoryLog(int $generalID, ?array $history, $year=null, $mon
}
/** @deprecated */
function getGeneralHistoryLogAll(int $generalID):array {
$db = DB::db();
@@ -263,6 +264,15 @@ function getGeneralHistoryLogAll(int $generalID):array {
);
}
function getGeneralHistoryLogWithLogID(int $generalID):array {
$db = DB::db();
return Util::convertPairArrayToDict($db->queryAllLists(
'SELECT `id`, `text` from general_record WHERE general_id = %i AND log_type = "history" order by id desc',
$generalID
));
}
function pushNationHistoryLog(int $nationID, ?array $history, ?int $year=null, ?int $month=null) {
if(!$history){
+22 -77
View File
@@ -5,17 +5,25 @@ namespace sammo;
use sammo\DTO\BettingInfo;
use sammo\Enums\InheritanceKey;
/**
* @param int $turnTerm 서버 턴 단위
* @return int 토너먼트 초 단위
*/
function calcTournamentTerm(int $turnTerm): int{
return Util::valueFit($turnTerm, 5, 120);
}
function processTournament()
{
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$admin = $gameStor->getValues(['tournament', 'phase', 'tnmt_type', 'tnmt_auto', 'tnmt_time', 'last_tournament_betting_id']);
$admin = $gameStor->getValues(['tournament', 'phase', 'tnmt_type', 'tnmt_auto', 'tnmt_time', 'turnterm', 'last_tournament_betting_id']);
$now = new \DateTime();
$offset = $now->getTimestamp() - (new \DateTime($admin['tnmt_time']))->getTimestamp();
//수동일땐 무시
if ($admin['tnmt_auto'] == 0) {
if (!$admin['tnmt_auto']) {
return;
}
@@ -28,18 +36,7 @@ function processTournament()
}
//현시간이 스탬프 지나친경우
$unit = [
1 => 720,
2 => 420,
3 => 180,
4 => 60,
5 => 30,
6 => 15,
7 => 5,
][$admin['tnmt_auto']] ?? null;
if($unit === null){
throw new MustNotBeReachedException();
}
$unit = calcTournamentTerm($admin['turnterm']);
//업데이트 횟수
$iter = intdiv($offset, $unit) + 1;
@@ -123,10 +120,7 @@ function processTournament()
//베팅은 무조건 60페이즈후 진행(최대 1시간)
if ($tnmt == 6) {
$betTerm = $unit * 60;
if ($betTerm > 3600) {
$betTerm = 3600;
}
$betTerm = Util::valueFit($unit * 60, null, 3600);
//처리 초 더한 날짜
$dt = date("Y-m-d H:i:s", strtotime($admin['tnmt_time']) + $unit * $i + $betTerm);
$gameStor->tournament = $tnmt;
@@ -134,20 +128,6 @@ function processTournament()
$gameStor->tnmt_time = $dt;
return;
}
if ($admin['tnmt_auto'] == 1) {
//처리 초 더한 날짜
$dt = date("Y-m-d H:i:s", strtotime($admin['tnmt_time']) + $unit * $i);
$hr = substr($dt, 11, 2);
//지정시간대 넘어가면 중단 20~24시
if ($hr < 20) {
$dt = substr($dt, 0, 11) . "20:00:00";
$gameStor->tournament = $tnmt;
$gameStor->phase = $phase;
$gameStor->tnmt_time = $dt;
return;
}
}
}
$second = $unit * $iter;
@@ -156,35 +136,9 @@ function processTournament()
$gameStor->tnmt_time = (new \DateTimeImmutable($admin['tnmt_time']))->add(new \DateInterval("PT{$second}S"))->format('Y-m-d H:i:s');
}
function getTournamentTerm(): ?int
function getTournamentTermText(int $turnTerm)
{
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$tnmt_auto = $gameStor->tnmt_auto;
if ($tnmt_auto === null) {
$tnmt_auto = $gameStor->tnmt_trig;
}
return [
0 => null,
1 => 12 * 60,
2 => 7 * 60,
3 => 3 * 60,
4 => 1 * 60,
5 => 30,
6 => 15,
7 => 5,
][$tnmt_auto] ?? null;
}
function getTournamentTermText()
{
$term = getTournamentTerm();
if ($term === null) {
return '수동';
}
$term = calcTournamentTerm($turnTerm);
if ($term % 60 === 0) {
$termMin = intdiv($term, 60);
@@ -320,26 +274,18 @@ function printFighting($tournament, $phase)
}
}
function startTournament($auto, $type)
function startTournament($type)
{
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
eraseTnmtFightLogAll();
$unit = [
1 => 60,
2 => 60,
3 => 60,
4 => 60,
5 => 30,
6 => 15,
7 => 5,
][$auto] ?? 60;
$admin = $gameStor->getValues(['year', 'month', 'turnterm']);
$turnTerm = $admin['turnterm'];
$unit = calcTournamentTerm($turnTerm);
$admin = $gameStor->getValues(['year', 'month']);
$gameStor->tnmt_auto = $auto;
$gameStor->tnmt_auto = true;
$gameStor->tnmt_time = (new \DateTimeImmutable())->add(new \DateInterval("PT{$unit}M"))->format('Y-m-d H:i:s');
$gameStor->tournament = 1;
$gameStor->tnmt_type = $type;
@@ -392,7 +338,7 @@ function getDummyBettingInfo(string $tnmt_type): BettingInfo
);
}
function startBetting($type, $unit)
function startBetting($type)
{
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
@@ -431,7 +377,6 @@ function startBetting($type, $unit)
aux: $general
);
}
$candidateCnt = count($candidates);
Betting::openBetting(new BettingInfo(
id: $bettingID,
@@ -982,7 +927,7 @@ function setGift($tnmt_type, $tnmt, $phase)
}
//자동진행 끝
$gameStor->tnmt_auto = 0;
$gameStor->tnmt_auto = false;
//장수열전 기록
/** @var ActionLogger */
@@ -1041,7 +986,7 @@ function setRefund()
}
//자동진행 끝
$gameStor->tnmt_auto = 0;
$gameStor->tnmt_auto = false;
}
//10차이 1.1, 50 차이 1.17, 100차이 1.2
+30 -5
View File
@@ -114,10 +114,10 @@ if (!$otherTextInfo) {
$lastVoteID = $gameStor->lastVote;
$lastVote = null;
if($lastVoteID){
if ($lastVoteID) {
$voteStor = KVStorage::getStorage($db, 'vote');
$lastVote = VoteInfo::fromArray($voteStor->getValue("vote_{$lastVoteID}"));
if($lastVote->endDate && $lastVote->endDate < TimeUtil::now()){
if ($lastVote->endDate && $lastVote->endDate < TimeUtil::now()) {
$lastVote = null;
}
}
@@ -190,7 +190,7 @@ if($lastVoteID){
NPC선택 : <?= $npcmode ?>
</div>
<div class="s-border-t col py-2 col-4 col-md-2" style="color:<?= $color ?>;">
토너먼트 : <?= getTournamentTermText() ?>
토너먼트 : <?= getTournamentTermText($gameStor->turnterm) ?>
</div>
<div class="s-border-t col py-2 col-4 col-md-2" style="color:<?= $color ?>;">
기타 설정: <?= $otherTextInfo ?>
@@ -282,7 +282,21 @@ if($lastVoteID){
<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', 'isTournamentApplicationOpen' => $isTournamentApplicationOpen, 'isBettingActive' => $isBettingActive]) ?></div>
<div class="buttonPlate bg2">
<?= commandButton([
'splitBtnBegin' => '<div class="btn-group">',
'splitBtnEnd' => '</div>',
'splitZoneSign' => '<button type="button" class="btn btn-sammo-nation dropdown-toggle dropdown-toggle-split" data-bs-toggle="dropdown" aria-expanded="false"><span class="visually-hidden">Toggle Dropdown</span></button>',
'splitZoneBegin' => '<ul class="dropdown-menu dropdown-menu-end">',
'splitZoneEnd' => '</ul>',
'splitSubBtnBegin' => '<li>',
'splitSubBtnEnd' => '</li>',
'btnClass' => 'btn btn-sammo-nation',
'btnSplitClass' => 'dropdown-item',
'isTournamentApplicationOpen' => $isTournamentApplicationOpen,
'isBettingActive' => $isBettingActive
])
?></div>
</div>
</div>
</div>
@@ -382,7 +396,18 @@ if($lastVoteID){
국가 메뉴
</div>
<ul class="dropdown-menu" aria-labelledby="navbarNation" id="navbarNationItems">
<?= commandButton(['btnBegin' => '<li>', 'btnEnd' => '</li>', 'btnClass' => 'dropdown-item', 'isTournamentApplicationOpen' => $isTournamentApplicationOpen, 'isBettingActive' => $isBettingActive]) ?>
<?= commandButton([
'btnBegin' => '<li>',
'btnEnd' => '</li>',
'splitMainBegin' => '<div class="d-none">',
'splitMainEnd' => '</div>',
'splitSubBtnBegin' => '<li>',
'splitSubBtnEnd' => '</li>',
'btnClass' => 'dropdown-item',
'btnSplitClass' => 'dropdown-item',
'isTournamentApplicationOpen' => $isTournamentApplicationOpen,
'isBettingActive' => $isBettingActive
]) ?>
</ul>
</li>
<li class="nav-item dropup">
+15 -19
View File
@@ -32,6 +32,7 @@ if ($session->userGrade < 5 && !$allowReset) {
<meta name="viewport" content="width=device-width, initial-scale=1" />
<?= WebUtil::printJS('../d_shared/common_path.js') ?>
<?= WebUtil::printCSS('css/install.css') ?>
<?= WebUtil::printDist('vue', [], true) ?>
<?= WebUtil::printDist('ts', ['common', 'install']) ?>
</head>
@@ -92,8 +93,8 @@ if ($session->userGrade < 5 && !$allowReset) {
<label for="fiction" class="col-sm-3 col-form-label">NPC 상성</label>
<div class="col-sm-9">
<div id="fiction" class="btn-group btn-group-toggle" data-bs-toggle="buttons">
<input type="radio" id="fiction_0" class="btn-check" name="fiction" value="0" checked><label for="fiction_0" class="btn btn-secondary"> 연의 </label>
<input type="radio" id="fiction_1" class="btn-check" name="fiction" value="1"><label for="fiction_1" class="btn btn-secondary"> 가상 </label>
<input type="radio" id="fiction_0" class="btn-check" name="fiction" value="0"><label for="fiction_0" class="btn btn-secondary"> 연의 </label>
<input type="radio" id="fiction_1" class="btn-check" name="fiction" value="1" checked><label for="fiction_1" class="btn btn-secondary"> 가상 </label>
</div>
</div>
</div>
@@ -113,6 +114,7 @@ if ($session->userGrade < 5 && !$allowReset) {
<div class="col-sm-9">
<div id="block_general_create" class="btn-group btn-group-toggle" data-bs-toggle="buttons">
<input type="radio" class="btn-check" id="block_general_create_0" name="block_general_create" value="0" checked><label for="block_general_create_0" class="btn btn-secondary">가능</label>
<input type="radio" class="btn-check" id="block_general_create_2" name="block_general_create" value="2"><label for="block_general_create_2" class="btn btn-secondary">장수명무작위</label>
<input type="radio" class="btn-check" id="block_general_create_1" name="block_general_create" value="1"><label for="block_general_create_1" class="btn btn-secondary">불가</label>
</div>
</div>
@@ -134,13 +136,13 @@ if ($session->userGrade < 5 && !$allowReset) {
<div class="col-sm-9">
<div class="input-group">
<div class="btn-group btn-group-toggle" data-bs-toggle="buttons">
<input type="checkbox" id="autorun_develop" class="autorun_user_chk btn-check" data-key="develop" name="autorun_user[]" value="develop"><label class="btn btn-secondary" for="autorun_develop">내정</label>
<input type="checkbox" id="autorun_warp" class="autorun_user_chk btn-check" data-key="warp" name="autorun_user[]" value="warp"><label class="btn btn-secondary" for="autorun_warp">순간이동</label>
<input type="checkbox" id="autorun_recruit" class="autorun_user_chk btn-check" data-key="recruit" name="autorun_user[]" value="recruit"><label class="btn btn-secondary" for="autorun_recruit">징병</label>
<input type="checkbox" id="autorun_recruit_high" class="autorun_user_chk btn-check" data-key="recruit_high" name="autorun_user[]" value="recruit_high"><label class="btn btn-secondary" for="autorun_recruit_high">모병</label>
<input type="checkbox" id="autorun_train" class="autorun_user_chk btn-check" data-key="train" name="autorun_user[]" value="train"><label class="btn btn-secondary" for="autorun_train">훈사</label>
<input type="checkbox" id="autorun_battle" class="autorun_user_chk btn-check" data-key="battle" name="autorun_user[]" value="battle"><label class="btn btn-secondary" for="autorun_battle">출병</label>
<input type="checkbox" id="autorun_chief" class="autorun_user_chk btn-check" data-key="chief" name="autorun_user[]" value="chief"><label class="btn btn-secondary" for="autorun_chief">기본 사령턴</label>
<input type="checkbox" id="autorun_develop" class="autorun_user_chk btn-check" data-key="develop" name="autorun_user[]" value="develop" checked><label class="btn btn-secondary" for="autorun_develop">내정</label>
<input type="checkbox" id="autorun_warp" class="autorun_user_chk btn-check" data-key="warp" name="autorun_user[]" value="warp" checked><label class="btn btn-secondary" for="autorun_warp">순간이동</label>
<input type="checkbox" id="autorun_recruit" class="autorun_user_chk btn-check" data-key="recruit" name="autorun_user[]" value="recruit" checked><label class="btn btn-secondary" for="autorun_recruit">징병</label>
<input type="checkbox" id="autorun_recruit_high" class="autorun_user_chk btn-check" data-key="recruit_high" name="autorun_user[]" value="recruit_high" checked><label class="btn btn-secondary" for="autorun_recruit_high">모병</label>
<input type="checkbox" id="autorun_train" class="autorun_user_chk btn-check" data-key="train" name="autorun_user[]" value="train" checked><label class="btn btn-secondary" for="autorun_train">훈사</label>
<input type="checkbox" id="autorun_battle" class="autorun_user_chk btn-check" data-key="battle" name="autorun_user[]" value="battle" checked><label class="btn btn-secondary" for="autorun_battle">출병</label>
<input type="checkbox" id="autorun_chief" class="autorun_user_chk btn-check" data-key="chief" name="autorun_user[]" value="chief" checked><label class="btn btn-secondary" for="autorun_chief">기본 사령턴</label>
</div>
</div>
</div>
@@ -162,7 +164,7 @@ if ($session->userGrade < 5 && !$allowReset) {
<option value="480">8시간</option>
<option value="600">10시간</option>
<option value="720">12시간</option>
<option value="1440">24시간</option>
<option value="1440" selected>24시간</option>
<option value="2160">36시간</option>
<option value="2880">48시간</option>
<option value="3600">60시간</option>
@@ -194,17 +196,11 @@ if ($session->userGrade < 5 && !$allowReset) {
</div>
<div class="form-group row">
<label for="tournament_trig" class="col-sm-3 col-form-label"><span class="text-nowrap">토너먼트 자동 시작</span> <span class="text-nowrap">경기 단위</span></label>
<label for="tournament_trig" class="col-sm-3 col-form-label"><span class="text-nowrap">토너먼트 자동 시작</span></label>
<div class="col-sm-9" id="tournament_trig">
<div id="tournament_trig" class="btn-group-toggle btn-group flex-wrap" data-bs-toggle="buttons">
<input type="radio" class="btn-check" id="tournament_trig_0" name="tournament_trig" value="0"><label for="tournament_trig_0" class="btn btn-secondary w-25">안함</label>
<input type="radio" class="btn-check" id="tournament_trig_1" name="tournament_trig" value="1"><label for="tournament_trig_1" class="btn btn-secondary w-25">12분(총 5일)</label>
<input type="radio" class="btn-check" id="tournament_trig_2" name="tournament_trig" value="2"><label for="tournament_trig_2" class="btn btn-secondary w-25">7분(총 10시간)</label>
<input type="radio" class="btn-check" id="tournament_trig_3" name="tournament_trig" value="3"><label for="tournament_trig_3" class="btn btn-secondary w-25">3분(총 4시간)</label>
<input type="radio" class="btn-check" id="tournament_trig_4" name="tournament_trig" value="4" checked><label for="tournament_trig_4" class="btn btn-secondary w-25">1분(총 82분)</label>
<input type="radio" class="btn-check" id="tournament_trig_5" name="tournament_trig" value="5"><label for="tournament_trig_5" class="btn btn-secondary w-25">30초(총 41분)</label>
<input type="radio" class="btn-check" id="tournament_trig_6" name="tournament_trig" value="6"><label for="tournament_trig_6" class="btn btn-secondary w-25">15초(총 21분)</label>
<input type="radio" class="btn-check" id="tournament_trig_7" name="tournament_trig" value="7"><label for="tournament_trig_7" class="btn btn-secondary w-25">5초(총 7분)</label>
<input type="radio" class="btn-check" id="tournament_trig_0" name="tournament_trig" value="0"><label for="tournament_trig_0" class="btn btn-secondary w-25">수동</label>
<input type="radio" class="btn-check" id="tournament_trig_1" name="tournament_trig" checked value="1"><label for="tournament_trig_1" class="btn btn-secondary w-25">자동</label>
</div>
</div>
</div>
+2 -2
View File
@@ -56,7 +56,7 @@ else if(
$status = 'closed';
}
else if(
$isUnited > 0 &&
$isUnited > 0 &&
$now->getTimestamp() - $lastTurn->getTimestamp() > ($reservedDate->getTimestamp() - $now->getTimestamp()) * 2
){
//천통 & 비정지 상태 & 2/3 넘음
@@ -88,7 +88,7 @@ $result = ResetHelper::buildScenario(
$options['block_general_create'],
$options['npcmode'],
$options['show_img_level'],
$options['tournament_trig'],
!!$options['tournament_trig'],
$options['join_mode'],
$options['starttime'],
$options['autorun_user']?:null
-61
View File
@@ -1,61 +0,0 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
WebUtil::requireAJAX();
$availableDieImmediately = false;
//로그인 검사
$session = Session::requireGameLogin();
$userID = Session::getUserID();
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$general = $db->queryFirstRow('SELECT no,name,owner_name,npc,lastrefresh FROM general WHERE owner=%i AND npc = 0', $userID);
if(!$general){
Json::die([
'result'=>false,
'reason'=>'장수가 없습니다.'
]);
}
increaseRefresh("장수 삭제", 1);
$gameStor->cacheValues(['turnterm', 'opentime', 'turntime', 'year', 'month']);
if($gameStor->turntime > $gameStor->opentime){
Json::die([
'result'=>false,
'reason'=>'이미 서버가 시작되었습니다.'
]);
}
$targetTime = addTurn($general['lastrefresh'], $gameStor->turnterm, 2);
if($targetTime > TimeUtil::now()){
$targetTimeShort = substr($targetTime, 0, 19);
Json::die([
'result'=>false,
'reason'=>"아직 삭제할 수 없습니다. {$targetTimeShort} 부터 가능합니다."
]);
}
$generalObj = General::createGeneralObjFromDB($general['no']);
if($generalObj instanceof DummyGeneral){
trigger_error("올바르지 않은 삭제 프로세스 $userID", E_USER_WARNING);
}
$generalName = $generalObj->getName();
$josaYi = JosaUtil::pick($generalName, '이');
$generalObj->kill($db, true, "<Y>{$generalName}</>{$josaYi} 이 홀연히 모습을 <R>감추었습니다</>");
$session->logoutGame();
Json::die([
'result'=>true,
'reason'=>'success'
]);
+5 -3
View File
@@ -1,6 +1,8 @@
<?php
namespace sammo;
use sammo\Enums\MessageType;
include "lib.php";
include "func.php";
@@ -100,7 +102,7 @@ if(in_array($stateOpt, ['try_destroy_src', 'try_destroy_dest'])){
'reason'=>'파기'
];
}
$msgText = "외교 서신 #{$letterNo} 파기했습니다.";
$msgText = "외교 서신(#{$letterNo})을 파기했습니다.";
$lastState = 'cancelled';
}
else{
@@ -114,12 +116,12 @@ else{
'aux'=>Json::encode($aux)
], 'no=%i', $letterNo);
$msgText = "외교 서신 #{$letterNo} 파기 요청합니다.";
$msgText = "외교 서신(#{$letterNo})을 파기 요청합니다.";
$lastState = 'activated';
}
$msg = new Message(
Message::MSGTYPE_DIPLOMACY,
MessageType::diplomacy,
$src,
$dest,
$msgText,
+6 -4
View File
@@ -1,6 +1,8 @@
<?php
namespace sammo;
use sammo\Enums\MessageType;
include "lib.php";
include "func.php";
@@ -85,7 +87,7 @@ if($isAgree){
], 'no=%i', $prevLetterNo);
$prevLetterNo = $db->queryFirstField('SELECT prev_no FROM ng_diplomacy WHERE state != \'cancelled\' AND no = %i', $prevLetterNo);
}
$msgText = "외교 서신 #{$letterNo} 승인되었습니다.";
$msgText = "외교 서신( #{$letterNo})이 승인되었습니다.";
}
else{
$aux['reason'] = [
@@ -97,14 +99,14 @@ else{
'state'=>'cancelled',
'aux'=>Json::encode($aux)
], 'no=%i', $letterNo);
$msgText = "외교 서신 #{$letterNo} 거부되었습니다.";
$msgText = "외교 서신(#{$letterNo})이 거부되었습니다.";
if($reason){
$msgText .= ' 이유 : '.$reason;
}
}
$msg = new Message(
Message::MSGTYPE_DIPLOMACY,
MessageType::diplomacy,
$src,
$dest,
$msgText,
@@ -115,7 +117,7 @@ $msg = new Message(
$msgID = $msg->send();
$msg = new Message(
Message::MSGTYPE_NATIONAL,
MessageType::national,
$src,
$dest,
$msgText,
+4 -2
View File
@@ -1,6 +1,8 @@
<?php
namespace sammo;
use sammo\Enums\MessageType;
include "lib.php";
include "func.php";
@@ -70,10 +72,10 @@ $db->update('ng_diplomacy', [
'state'=>'cancelled',
'aux'=>Json::encode($aux)
], 'no=%i', $letterNo);
$msgText = "외교 서신 #{$letterNo} 회수되었습니다.";
$msgText = "외교 서신(#{$letterNo})이 회수되었습니다.";
$msg = new Message(
Message::MSGTYPE_DIPLOMACY,
MessageType::diplomacy,
$src,
$dest,
$msgText,
+3 -1
View File
@@ -1,6 +1,8 @@
<?php
namespace sammo;
use sammo\Enums\MessageType;
include "lib.php";
include "func.php";
@@ -176,7 +178,7 @@ else{
$msg = new Message(
Message::MSGTYPE_DIPLOMACY,
MessageType::diplomacy,
$src,
$dest,
$msgText,
+3 -3
View File
@@ -109,9 +109,9 @@ $scenario = (int)$_POST['scenario'];
$fiction = (int)$_POST['fiction'];
$extend = (int)$_POST['extend'];
$npcmode = (int)$_POST['npcmode'];
$block_general_create = (bool)$_POST['block_general_create'];
$block_general_create = (int)$_POST['block_general_create'];
$show_img_level = (int)$_POST['show_img_level'];
$tournament_trig = (int)$_POST['tournament_trig'];
$tournament_trig = !!(int)$_POST['tournament_trig'];
$join_mode = $_POST['join_mode'];
$autorun_user_minutes = (int)$_POST['autorun_user_minutes'];
$autorun_user_options = [];
@@ -208,7 +208,7 @@ Json::die(ResetHelper::buildScenario(
$block_general_create,
$npcmode,
$show_img_level,
$tournament_trig,
!!$tournament_trig,
$join_mode,
TimeUtil::now(),
$autorun_user
-19
View File
@@ -1,19 +0,0 @@
<?php
namespace sammo;
include('lib.php');
include('func.php');
$session = Session::requireGameLogin([])->setReadOnly();
if(!Session::getInstance()->generalID){
Json::die([
"nation"=>[]
]);
}
//NOTE: 모든 국가, 모든 장수에 대해서 같은 결과라면 캐싱 가능하지 않을까?
Json::die([
"nation"=>getMailboxList()
]);
-63
View File
@@ -1,63 +0,0 @@
<?php
namespace sammo;
include 'lib.php';
include 'func.php';
WebUtil::requireAJAX();
//{msgID: 1206, response: true}
$session = Session::requireGameLogin([])->setReadOnly();
$generalID = Session::getInstance()->generalID;
if (!$generalID) {
Json::die([
'result'=>false,
'reason'=>'로그인하지 않음'
]);
}
$jsonPost = Json::decode(Util::getPost('data', 'string', '{}'));
$msgID = Util::toInt($jsonPost['msgID']??null);
$msgResponse = $jsonPost['response']??null;
if ($msgID === null || !is_bool($msgResponse)) {
Json::die([
'result'=>false,
'reason'=>'올바르지 않은 인자'
]);
}
$general = DB::db()->queryFirstRow('SELECT `no`, `name`, `nation`, `officer_level`, `npc`, `gold`, `rice`, `troop`, `aux` from `general` where `no` = %i', $generalID);
if(!$general){
Json::die([
'result'=>false,
'reason'=>'존재하지 않는 장수'
]);
}
$msg = Message::getMessageByID($msgID);
if($msg === null){
Json::die([
'result'=>false,
'reason'=>'올바르지 않은 메시지'
]);
}
$reason = 'success';
$gameStor = KVStorage::getStorage(DB::db(), 'game_env');
$gameStor->cacheAll();
if($msgResponse){
$result = $msg->agreeMessage($general['no'], $reason);
}
else{
$result = $msg->declineMessage($general['no'], $reason);
}
Json::die([
'result' => $result!==DiplomaticMessage::INVALID,
'reason' => $reason
]);
-74
View File
@@ -1,74 +0,0 @@
<?php
namespace sammo;
include('lib.php');
include('func.php');
WebUtil::requireAJAX();
$session = Session::requireGameLogin([]);
$userID = Session::getUserID();
$msgID = Util::getPost('msgID', 'int');
if($msgID === null){
Json::die([
'result'=>false,
'reason'=>'올바르지 않은 범위 입니다.'
]);
}
$lastMsgGet = Json::decode($session->lastMsgGet)??[];
$now = new \DateTime();
$delayTime = false;
if(count($lastMsgGet) >= 10){
try{
if($lastMsgGet[0] !== 'string'){
throw new \Exception('Why not string?');
}
$first = new \DateTime($lastMsgGet[0]);
$diff = $first->diff($now);
if($diff->days == 0 && $diff->h > 0 && $diff->i == 0 && $diff->s <= 5){
$delayTime = true;
}
array_shift($lastMsgGet);
}
catch(\Exception $e){
$lastMsgGet = [];
}
}
$lastMsgGet[] = $now;
$session->lastMsgGet = Json::encode($lastMsgGet);
if($delayTime){
sleep(1);
}
$session->setReadOnly();
list($generalID, $nationID, $generalName) = DB::db()->queryFirstList(
'select `no`, `nation`, `name` from `general` where owner = %i',
$userID
);
if($nationID === null){
Json::die([
'result'=>false,
'reason'=>'장수가 사망했습니다.'
]);
}
$reason = Message::deleteMsg($msgID, $generalID);
if($reason === null){
$result = [
'result'=>true,
'reason'=>'success'
];
}
else{
$result = [
'result'=>false,
'reason'=>$reason
];
}
Json::die($result);
-118
View File
@@ -1,118 +0,0 @@
<?php
namespace sammo;
include('lib.php');
include('func.php');
$session = Session::requireGameLogin([]);
$userID = Session::getUserID();
$reqTo = Util::getPost('to', 'int');
$reqType = Util::getPost('type', 'string');
if($reqTo === null){
Json::die([
'result'=>false,
'reason'=>'올바르지 않은 범위 입니다.'
]);
}
if($reqType === null || !in_array($reqType, ['private', 'public', 'national', 'diplomacy'])){
Json::die([
'result'=>false,
'reason'=>'올바르지 않은 타입입니다.'
]);
}
$lastMsgGet = Json::decode($session->lastMsgGet)??[];
$now = new \DateTime();
$delayTime = false;
if(count($lastMsgGet) >= 10){
try{
if($lastMsgGet[0] !== 'string'){
throw new \Exception('Why not string?');
}
$first = new \DateTime($lastMsgGet[0]);
$diff = $first->diff($now);
if($diff->days == 0 && $diff->h > 0 && $diff->i == 0 && $diff->s <= 1){
$delayTime = true;
}
array_shift($lastMsgGet);
}
catch(\Exception $e){
$lastMsgGet = [];
}
}
$lastMsgGet[] = $now;
$session->lastMsgGet = Json::encode($lastMsgGet);
if($delayTime){
sleep(1);
}
$session->setReadOnly();
$me = DB::db()->queryFirstRow('SELECT `no`,`name`,`nation`,`officer_level`,`con`,`picture`,`imgsvr`,penalty,permission FROM general WHERE `owner`=%i', $userID);
if($me === null){
Json::die([
'result'=>false,
'reason'=>'장수가 사망했습니다.'
]);
}
[$generalID, $nationID, $generalName] = [$me['no'], $me['nation'], $me['name']];
$permission = checkSecretPermission($me, false);
$result = [
'private'=>[],
'public'=>[],
'national'=>[],
'diplomacy'=>[],
'result'=>true,
'keepRecent'=>true,
'sequence'=>0,
'nationID'=>$nationID,
'generalName'=>$generalName,
];
$result['result'] = true;
$nextSequence = $reqTo;
if($reqType == 'private'){
$result['private'] = array_map(function(Message $msg) use (&$nextSequence){
if($msg->id > $nextSequence){
$nextSequence = $msg->id;
}
return $msg->toArray();
}, Message::getMessagesFromMailBoxOld($generalID, Message::MSGTYPE_PRIVATE, $reqTo, 15));
}
else if($reqType == 'public'){
$result['public'] = array_map(function(Message $msg)use (&$nextSequence){
if($msg->id > $nextSequence){
$nextSequence = $msg->id;
}
return $msg->toArray();
}, Message::getMessagesFromMailBoxOld(Message::MAILBOX_PUBLIC, Message::MSGTYPE_PUBLIC, $reqTo, 15));
}
else if($reqType == 'national'){
$result['national'] = array_map(function(Message $msg)use (&$nextSequence){
if($msg->id > $nextSequence){
$nextSequence = $msg->id;
}
return $msg->toArray();
}, Message::getMessagesFromMailBoxOld(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_NATIONAL, $reqTo, 15));
}
else{
$result['diplomacy'] = array_map(function(Message $msg)use (&$nextSequence, $permission){
if($msg->id > $nextSequence){
$nextSequence = $msg->id;
}
$values = $msg->toArray();
if($msg->dest->nationID != 0 && $permission < 3){
$values['text'] = '(외교 메시지입니다)';//TODO: 외교서신이라 읽을 수 없음을 보여줘야함
$values['option']['invalid'] = true;
}
return $values;
}, Message::getMessagesFromMailBoxOld(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_DIPLOMACY, $reqTo, 15));
}
Json::die($result);
-120
View File
@@ -1,120 +0,0 @@
<?php
namespace sammo;
include('lib.php');
include('func.php');
$session = Session::requireGameLogin([]);
$userID = Session::getUserID();
$reqSequence = Util::getPost('sequence', 'int', -1);
$lastMsgGet = Json::decode($session->lastMsgGet)??[];
$now = new \DateTime();
$delayTime = false;
if(count($lastMsgGet) >= 10){
try{
if(!is_string($lastMsgGet[0])){
throw new \Exception('Why not string?');
}
$first = new \DateTime($lastMsgGet[0]);
$diff = $first->diff($now);
if($diff->days == 0 && $diff->h > 0 && $diff->i == 0 && $diff->s <= 1){
$delayTime = true;
}
array_shift($lastMsgGet);
}
catch(\Exception $e){
$lastMsgGet = [];
}
}
$lastMsgGet[] = TimeUtil::now();
$session->lastMsgGet = Json::encode($lastMsgGet);
if($delayTime){
usleep(200);
}
$session->setReadOnly();
$db = DB::db();
$me = $db->queryFirstRow('SELECT `no`,`name`,`nation`,`officer_level`,`con`,`picture`,`imgsvr`,penalty,permission FROM general WHERE `owner`=%i', $userID);
if($me === null){
Json::die([
'result'=>false,
'reason'=>'장수가 사망했습니다.'
]);
}
[$generalID, $nationID, $generalName] = [$me['no'], $me['nation'], $me['name']];
$permission = checkSecretPermission($me, false);
$result = [];
$result['result'] = true;
$result['keepRecent'] = false;
$nextSequence = $reqSequence;
$minSequence = $reqSequence;
$lastType = null;
$result['private'] = array_map(function(Message $msg) use (&$nextSequence, &$minSequence, &$lastType){
if($msg->id > $nextSequence){
$nextSequence = $msg->id;
}
if($msg->id <= $minSequence){
$minSequence = $msg->id;
$lastType = 'private';
}
return $msg->toArray();
}, Message::getMessagesFromMailBox($generalID, Message::MSGTYPE_PRIVATE, 15, $reqSequence));
$result['public'] = array_map(function(Message $msg)use (&$nextSequence, &$minSequence, &$lastType){
if($msg->id > $nextSequence){
$nextSequence = $msg->id;
}
if($msg->id <= $minSequence){
$minSequence = $msg->id;
$lastType = 'public';
}
return $msg->toArray();
}, Message::getMessagesFromMailBox(Message::MAILBOX_PUBLIC, Message::MSGTYPE_PUBLIC, 15, $reqSequence));
$result['national'] = array_map(function(Message $msg)use (&$nextSequence, &$minSequence, &$lastType){
if($msg->id > $nextSequence){
$nextSequence = $msg->id;
}
if($msg->id <= $minSequence){
$minSequence = $msg->id;
$lastType = 'national';
}
return $msg->toArray();
}, Message::getMessagesFromMailBox(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_NATIONAL, 15, $reqSequence));
$result['diplomacy']= array_map(function(Message $msg)use (&$nextSequence, &$minSequence, &$lastType, $permission){
if($msg->id > $nextSequence){
$nextSequence = $msg->id;
}
if($msg->id <= $minSequence){
$minSequence = $msg->id;
$lastType = 'diplomacy';
}
$values = $msg->toArray();
if($msg->dest->nationID != 0 && $permission < 3){
$values['text'] = '(외교 메시지입니다)';//TODO: 외교서신이라 읽을 수 없음을 보여줘야함
$values['option']['invalid'] = true;
}
return $values;
}, Message::getMessagesFromMailBox(Message::MAILBOX_NATIONAL + $nationID, Message::MSGTYPE_DIPLOMACY, 15, $reqSequence));
if($lastType !== null){
array_pop($result[$lastType]);
$result['keepRecent'] = true;
}
else if($reqSequence <= 0){
$result['keepRecent'] = true;
}
$result['sequence'] = $nextSequence;
$result['nationID'] = $nationID;
$result['generalName'] = $generalName;
Json::die($result);
-206
View File
@@ -1,206 +0,0 @@
<?php
namespace sammo;
include 'lib.php';
include 'func.php';
WebUtil::requireAJAX();
$post = Json::decode(Util::getPost('data', 'string', '{}'));
'@phan-var mixed[] $post';
$v = new Validator($post);
$v->rule('required', ['mailbox','text']);
$v->rule('integer', 'mailbox');
$v->rule('lengthMin', 'text', 1);
if(!$v->validate()){
Json::die([
'result'=>false,
'reason'=>$v->errorStr(),
'msgID'=>null
]);
}
$mailbox = (int)$post['mailbox'];
$text = trim(StringUtil::cutStringForWidth($post['text'], 199, ''));
$session = Session::requireGameLogin([
'msgID'=>null
]);
$userID = Session::getUserID();
//NOTE: 전송 메시지 시간 계산을 위해 Session을 쓰기 가능 상태로 열어둠.
increaseRefresh('서신전달', 1);
if(getBlockLevel() == 1 || getBlockLevel() == 3) {
Json::die([
'result' => false,
'reason' => '차단되었습니다.',
'msgID'=>null
]);
}
/**
* 메시지 전송 코드.
*
* TODO: 장기적으로 ajax는 한곳에 모을 필요가 있을 듯.
*/
$now = new \DateTime();
$unlimited = new \DateTime('9999-12-31');
$db = DB::db();
$me = $db->queryFirstRow('SELECT `no`,`name`,`nation`,`officer_level`,`con`,`picture`,`imgsvr`,penalty,permission,belong FROM general WHERE `owner`=%i', $userID);
if(!$me){
$session->logoutGame();
Json::die([
'result' => false,
'reason' => '로그인되지 않았습니다.',
'msgID' => null
]);
}
$con = checkLimit($me['con']);
if($con >= 2) {
Json::die([
'result' => false,
'reason' => '접속 제한입니다.',
'msgID' => null
]);
}
$me['icon'] = GetImageURL($me['imgsvr'], $me['picture']);
$permission = checkSecretPermission($me);
$srcNation = getNationStaticInfo($me['nation']);
$src = new MessageTarget($me['no'], $me['name'], $srcNation['nation'], $srcNation['name'], $srcNation['color'], $me['icon']);
// 전체 메세지
if($mailbox == Message::MAILBOX_PUBLIC) {
$msg = new Message(
Message::MSGTYPE_PUBLIC,
$src,
$src,
$text,
$now,
$unlimited,
[]
);
$msgID = $msg->send();
Json::die([
'result' => true,
'reason' => 'SUCCESS',
'msgID' => $msgID
]);
}
// 국가 메세지
if($mailbox >= Message::MAILBOX_NATIONAL) {
if($permission < 4){
$destNationID = $me['nation'];
}
else{
$destNationID = $mailbox - Message::MAILBOX_NATIONAL;
}
if($destNationID == $me['nation']){
$msgType = Message::MSGTYPE_NATIONAL;
}
else{
$msgType = Message::MSGTYPE_DIPLOMACY;
}
$destNation = getNationStaticInfo($destNationID);
$dest = new MessageTarget(0, '', $destNation['nation'], $destNation['name'], $destNation['color']);
$msg = new Message(
$msgType,
$src,
$dest,
$text,
$now,
$unlimited,
[]
);
$msgID = $msg->send();
Json::die([
'result' => true,
'reason' => 'SUCCESS',
'msgID' => $msgID
]);
}
// 개인 메세지
if($mailbox > 0) {
$lastMsg = new \DateTime($session->lastMsg??'0000-00-00');
$msg_interval = $now->getTimestamp() - $lastMsg->getTimestamp();
//NOTE: 여기서 유저 레벨을 구별할 코드가 필요할까?
if($msg_interval < 2){
Json::die([
'result' => false,
'reason' => '개인메세지는 2초당 1건만 보낼 수 있습니다!',
'msgID' => null
]);
}
$session->lastMsg = $now->format('Y-m-d H:i:s');
$destUser = $db->queryFirstRow('SELECT `no`,`name`,`nation`,`officer_level`,`con`,`picture`,`imgsvr`,permission,penalty FROM general WHERE `no`=%i',$mailbox);
if(!$destUser){
Json::die([
'result' => false,
'reason' => '존재하지 않는 유저입니다.',
'msgID' => null
]);
}
$destPermission = checkSecretPermission($destUser, false);
if($permission == 4 && $destPermission == 4 && $destUser['nation'] != $me['nation']){
Json::die([
'result' => false,
'reason' => '외교권자끼리는 메시지를 보낼 수 없습니다.',
'msgID' => null
]);
}
$destNation = getNationStaticInfo($destUser['nation']);
$dest = new MessageTarget(
$destUser['no'],
$destUser['name'],
$destNation['nation'],
$destNation['name'],
$destNation['color'],
GetImageURL($destUser['imgsvr'], $destUser['picture'])
);
$msg = new Message(
Message::MSGTYPE_PRIVATE,
$src,
$dest,
$text,
$now,
$unlimited,
[]
);
$msgID = $msg->send();
Json::die([
'result' => true,
'reason' => 'SUCCESS',
'msgID' => $msgID
]);
}
Json::die([
'result' => false,
'reason' => '알 수 없는 에러',
'msgID' => null
]);
+5 -3
View File
@@ -1,6 +1,8 @@
<?php
namespace sammo;
use sammo\Enums\MessageType;
include "lib.php";
include "func.php";
@@ -226,8 +228,8 @@ function do추방(General $general, int $myOfficerLevel):?string{
}
else{
$betrayCnt = $general->getVar('betray');
$general->addExperience(-$general->getVar('experience')*0.1*$betrayCnt);
$general->addDedication(-$general->getVar('dedication')*0.1*$betrayCnt);
$general->addExperience(-$general->getVar('experience')*0.15*$betrayCnt);
$general->addDedication(-$general->getVar('dedication')*0.15*$betrayCnt);
$general->increaseVarWithLimit('betray', 1, null, GameConst::$maxBetrayCnt);
}
@@ -268,7 +270,7 @@ function do추방(General $general, int $myOfficerLevel):?string{
GetImageURL($general->getVar('imgsvr'), $general->getVar('picture'))
);
$msg = new Message(
Message::MSGTYPE_PUBLIC,
MessageType::public,
$src,
$src,
$str,
+2 -2
View File
@@ -56,7 +56,7 @@ if(file_exists(__DIR__.'/.htaccess')){
'scenarioName'=>$options['scenarioName'],
'turnterm'=>$options['turnterm'],
'fictionMode'=>($options['fiction']?'가상':'사실'),
'block_general_create'=>(!!$options['block_general_create']),
'block_general_create'=>Util::toInt($options['block_general_create']),
'npcMode'=>([0=>'불가',1=>'가능',2=>'선택 생성'][$options['npcmode']]),
'openDatetime'=>$reserved['date'],
'starttime'=>$options['starttime'],
@@ -90,7 +90,7 @@ $admin['scenario'] = $admin['scenario_text'];
$admin['userCnt'] = $genCnt;
$admin['npcCnt'] = $npcCnt;
$admin['nationCnt'] = $nationCnt;
$admin['block_general_create'] = !!$admin['block_general_create'];
$admin['block_general_create'] = $admin['block_general_create'];
$admin['npcMode'] = [0=>'불가',1=>'가능',2=>'선택 생성'][$admin['npcMode']];
$admin['fictionMode'] = $admin['fiction']?'가상':'사실';
+1 -1
View File
@@ -44,7 +44,7 @@ if($defence_train !== $me->getVar('defence_train')){
$me->increaseVar('myset', -1);
$me->setVar('defence_train', $defence_train);
$me->increaseVarWithLimit('train', -3, 20);
$me->increaseVarWithLimit('atmos', -3, 20);
$me->increaseVarWithLimit('atmos', -6, 20);
}
else{
$me->increaseVar('myset', -1);
+1 -1
View File
@@ -82,7 +82,7 @@ function applyNationPolicy($policy, $nationID, $generalName): ?string
return "{$troopID}는 국가의 부대가 아닙니다.";
}
if ($troopCache[$troopID] != 'Neutral') {
return "부대({$troopID}는 하나의 역할만 지정할 수 있습니다.";
return "부대({$troopID})는 하나의 역할만 지정할 수 있습니다.";
}
if (!is_array($troopTarget) || count($troopTarget) != 2) {
return "{$troopID}의 입력양식이 올바르지 않습니다.";
+53 -6
View File
@@ -84,6 +84,7 @@ $rawDefenderList = $query['defenderGenerals'];
$rawDefenderCity = $query['defenderCity'];
$rawDefenderNation = $query['defenderNation'];
$warSeed = $query['seed'] ?? '';
$generalCheck = [
'required'=>[
@@ -132,6 +133,19 @@ $generalCheck = [
['weapon', array_merge(array_keys(GameConst::$allItems['weapon']), ['None'])],
['book', array_merge(array_keys(GameConst::$allItems['book']), ['None'])],
['item', array_merge(array_keys(GameConst::$allItems['item']), ['None'])],
],
'array'=>['inheritBuff'],
];
$inheritBuffCheck = [
'between'=>[
[TriggerInheritBuff::WAR_AVOID_RATIO, [0, 5]],
[TriggerInheritBuff::WAR_CRITICAL_RATIO, [0, 5]],
[TriggerInheritBuff::WAR_MAGIC_TRIAL_PROB, [0, 5]],
[TriggerInheritBuff::OPPOSE_WAR_AVOID_RATIO, [0, 5]],
[TriggerInheritBuff::OPPOSE_WAR_CRITICAL_RATIO, [0, 5]],
[TriggerInheritBuff::OPPOSE_WAR_MAGIC_TRIAL_PROB, [0, 5]],
]
];
@@ -143,6 +157,19 @@ if(!$v->validate()){
'reason'=>'[출병자]'.$v->errorStr()
]);
}
$rawAttacker['aux'] = [];
if(key_exists('inheritBuff', $rawAttacker)){
$v = new Validator($rawAttacker['inheritBuff']);
$v->rules($inheritBuffCheck);
if(!$v->validate()){
Json::die([
'result'=>false,
'reason'=>'[출병자]'.$v->errorStr()
]);
}
$rawAttacker['aux']['inheritBuff'] = $rawAttacker['inheritBuff'];
}
$rawAttacker['aux'] = Json::encode($rawAttacker['aux']);
$rawAttacker['owner'] = 0;
$defenderList = [];
@@ -156,6 +183,20 @@ foreach($rawDefenderList as $idx=>$rawDefenderGeneral){
'reason'=>"[수비자{$idx}]".$v->errorStr()
]);
}
$rawDefenderGeneral['aux'] = [];
if(key_exists('inheritBuff', $rawDefenderGeneral)){
$v = new Validator($rawDefenderGeneral['inheritBuff']);
$v->rules($inheritBuffCheck);
if(!$v->validate()){
$idx+=1;
Json::die([
'result'=>false,
'reason'=>"[수비자{$idx}]".$v->errorStr()
]);
}
$rawDefenderGeneral['aux']['inheritBuff'] = $rawDefenderGeneral['inheritBuff'];
}
$rawDefenderGeneral['aux'] = Json::encode($rawDefenderGeneral['aux']);
$rawDefenderGeneral['owner'] = 0;
$defenderList[] = new General($rawDefenderGeneral, extractRankVar($rawDefenderGeneral), $rawDefenderCity, $rawAttackerNation, $year, $month, true);
@@ -281,7 +322,6 @@ unset($defenderList);
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$startYear = $gameStor->startyear;
$cityRate = Util::round(($year - $startYear) / 1.5) + 60;
function extractRankVar(array $rawVal):Map{
$rankVars = new Map;
@@ -298,10 +338,13 @@ function extractRankVar(array $rawVal):Map{
function simulateBattle(
$rawAttacker, $rawAttackerCity, $rawAttackerNation,
$rawDefenderList, $rawDefenderCity, $rawDefenderNation,
$startYear, $year, $month, $cityRate
$startYear, $year, $month, $warSeed
){
$warSeed = bin2hex(random_bytes(16));
if(!$warSeed){
$warSeed = bin2hex(random_bytes(16));
}
$warRng = new RandUtil(new LiteHashDRBG($warSeed));
$attacker = new WarUnitGeneral(
@@ -310,7 +353,7 @@ function simulateBattle(
$rawAttackerNation,
true
);
$city = new WarUnitCity($warRng, $rawDefenderCity, $rawDefenderNation, $year, $month, $cityRate);
$city = new WarUnitCity($warRng, $rawDefenderCity, $rawDefenderNation, $year, $month, $startYear);
$iterDefender = new \ArrayIterator($rawDefenderList);
$iterDefender->rewind();
@@ -367,7 +410,7 @@ function simulateBattle(
$rice = $city->getKilled() / 100 * 0.8;
$rice *= $city->getCrewType()->rice;
$rice *= getTechCost($rawDefenderNation['tech']);
$rice *= $cityRate / 100 - 0.2;
$rice *= $city->getCityTrainAtmos() / 100 - 0.2;
Util::setRound($rice);
$defenderRice += $rice;
@@ -401,12 +444,16 @@ $avgWar = 0;
$attackerActivatedSkills = [];
$defendersActivatedSkills = [];
if($warSeed){
$repeatCnt = 1;
}
foreach(Util::range($repeatCnt) as $repeatIdx){
/** @var WarUnit $attacker */
[$attacker, $city, $battleResult, $conquerCity, $attackerRice, $defenderRice] = simulateBattle(
$rawAttacker, $rawAttackerCity, $rawAttackerNation,
$rawDefenderList, $rawDefenderCity, $rawDefenderNation,
$startYear, $year, $month, $cityRate
$startYear, $year, $month, $warSeed
);
$lastWarLog = Util::mapWithKey(function($key, $values){
return ConvertLog(join('<br>', $values));
-172
View File
@@ -1,172 +0,0 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
WebUtil::requireAJAX();
// $btn, $name, $troop
$action = Util::getPost('action');
$name = Util::getPost('name');
$gen = Util::getPost('gen', 'int');
$troop = Util::getPost('troop', 'int');
//로그인 검사
$session = Session::requireGameLogin([])->setReadOnly();
$userID = $session::getUserID();
increaseRefresh("부대명령", 0);
$db = DB::db();
$me = $db->queryFirstRow('SELECT `no`, name, nation, troop FROM general WHERE `owner`=%i', $userID);
$generalID = $me['no'];
$nationID = $me['nation'];
if($action == '부대창설'){
$name = StringUtil::neutralize($name);
if(!$name){
Json::die([
'result'=>false,
'reason'=>'부대 이름이 없습니다.'
]);
}
if($me['troop'] != 0){
Json::die([
'result'=>false,
'reason'=>'이미 부대에 가입해있습니다.'
]);
}
$db->insert('troop',[
'troop_leader'=>$generalID,
'name'=>$name,
'nation'=>$nationID,
]);
$db->update('general', [
'troop'=>$generalID,
], 'no=%i',$generalID);
Json::die([
'result'=>true,
'reason'=>'success'
]);
}
if($action == '부대변경'){
$name = StringUtil::neutralize($name);
if(!$name){
Json::die([
'result'=>false,
'reason'=>'부대 이름이 없습니다.'
]);
}
$db->update('troop', [
'name'=>$name
], 'troop_leader=%i',$generalID);
if($db->affectedRows() == 0){
Json::die([
'result'=>false,
'reason'=>'부대장이 아닙니다.'
]);
}
Json::die([
'result'=>true,
'reason'=>'success'
]);
}
if($action == '부대추방'){
if (!$gen){
Json::die([
'result'=>false,
'reason'=>'장수를 지정해야 합니다.'
]);
}
$db->update('general', [
'troop'=>0
], 'no=%i AND troop = %i', $gen, $generalID);
if($db->affectedRows() == 0){
Json::die([
'result'=>false,
'reason'=>'부대장이 아니거나, 장수를 잘못 지정했습니다.'
]);
}
Json::die([
'result'=>true,
'reason'=>'success'
]);
}
if ($action == '부대가입') {
if(!$troop){
Json::die([
'result'=>false,
'reason'=>'부대를 지정해야 합니다.'
]);
}
if($me['troop'] === $generalID){
Json::die([
'result'=>false,
'reason'=>'부대장입니다.'
]);
}
$troopExists = $db->queryFirstField('SELECT `troop_leader` FROM `troop` WHERE `troop_leader` = %i AND `nation` = %i', $troop, $nationID);
if (!$troopExists) {
Json::die([
'result'=>false,
'reason'=>'올바른 부대장이 아닙니다.'
]);
}
$db->update('general', [
'troop'=>$troop
], 'no=%i', $generalID);
Json::die([
'result'=>true,
'reason'=>'success'
]);
}
if($action == "부대탈퇴") {
if($me['troop'] == 0){
Json::die([
'result'=>false,
'reason'=>'부대에 속해있지 않습니다.'
]);
}
//부대장일 경우
if($me['troop'] === $generalID){
$db->update('general', [
'troop'=>0
], 'troop=%i',$generalID);
$db->delete('troop', 'troop_leader=%i', $generalID);
}
else{
$db->update('general', [
'troop'=>0
], 'no=%i', $generalID);
}
Json::die([
'result'=>true,
'reason'=>'success'
]);
}
Json::die([
'result'=>false,
'reason'=>'올바르지 않은 명령입니다.'
]);
+2 -2
View File
@@ -63,8 +63,8 @@ function prepareDir(string $dirPath, bool $forceCreate=true):bool{
if(!unlink($dirPath)){
return false;
}
return mkdir($dirPath);
return mkdir($dirPath, 0775);
}
return mkdir($dirPath, 0777, true);
return mkdir($dirPath, 0775, true);
}
+5 -6
View File
@@ -29,11 +29,11 @@ function processWar(string $warSeed, General $attackerGeneral, array $rawAttacke
}
$gameStor = KVStorage::getStorage($db, 'game_env');
[$startYear, $year, $month, $cityRate, $joinMode] = $gameStor->getValuesAsArray(['startyear', 'year', 'month', 'city_rate', 'join_mode']);
[$startYear, $year, $month, $joinMode] = $gameStor->getValuesAsArray(['startyear', 'year', 'month', 'join_mode']);
$attacker = new WarUnitGeneral($rng, $attackerGeneral,$rawAttackerNation, true);
$city = new WarUnitCity($rng, $rawDefenderCity, $rawDefenderNation, $year, $month, $cityRate);
$city = new WarUnitCity($rng, $rawDefenderCity, $rawDefenderNation, $year, $month, $startYear);
$defenderIDList = $db->queryFirstColumn('SELECT no FROM general WHERE nation=%i AND city=%i AND nation!=0 and crew > 0 and rice>(crew/100) and train>=defence_train and atmos>=defence_train', $city->getVar('nation'), $city->getVar('city'));
$defenderList = General::createGeneralObjListFromDB($defenderIDList, null, 2);
@@ -90,7 +90,7 @@ function processWar(string $warSeed, General $attackerGeneral, array $rawAttacke
$rice = $city->getKilled() / 100 * 0.8;
$rice *= $city->getCrewType()->rice;
$rice *= getTechCost($rawDefenderNation['tech']);
$rice *= $cityRate / 100 - 0.2;
$rice *= $city->getCityTrainAtmos() / 100 - 0.2;
Util::setRound($rice);
$updateDefenderNation['rice'] = max(0, $rawDefenderNation['rice'] - $rice);
@@ -113,8 +113,8 @@ function processWar(string $warSeed, General $attackerGeneral, array $rawAttacke
'dead' => $db->sqleval('dead + %i', $totalDead * 0.6)
], 'city=%i', $rawDefenderCity['city']);
$attackerIncTech = buildNationTypeClass($rawAttackerNation['type'])->onCalcDomestic('기술', 'score', $attacker->getDead() * 0.01);
$defenderIncTech = buildNationTypeClass($rawDefenderNation['type'])->onCalcDomestic('기술', 'score', $attacker->getKilled() * 0.01);
$attackerIncTech = buildNationTypeClass($rawAttackerNation['type'])->onCalcDomestic('기술', 'score', $attacker->getDead() * 0.012);
$defenderIncTech = buildNationTypeClass($rawDefenderNation['type'])->onCalcDomestic('기술', 'score', $attacker->getKilled() * 0.009);
$attackerGenCnt = $rawAttackerNation['gennum'];
$defenderGenCnt = $rawDefenderNation['gennum'];
@@ -175,7 +175,6 @@ function processWar(string $warSeed, General $attackerGeneral, array $rawAttacke
'startyear' => $startYear,
'year' => $year,
'month' => $month,
'city_rate' => $cityRate,
'join_mode' => $joinMode,
], $attacker->getGeneral(), $city->getRaw());
}
+1
View File
@@ -27,6 +27,7 @@ include "func.php";
<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::printDist('ts', ['common', 'recent_map'], true) ?>
<?= WebUtil::printDist('vue', [], true) ?>
<style>
html {
width: 700px;
+1 -1
View File
@@ -37,7 +37,7 @@ class BidUniqueAuction extends \sammo\BaseAPI
{
$auctionID = $this->args['auctionID'];
$amount = $this->args['amount'];
$tryExtendCloseDate = $this->arg['extendCloseDate'] ?? false;
$tryExtendCloseDate = $this->args['extendCloseDate'] ?? false;
$generalID = $session->generalID;
$general = General::createGeneralObjFromDB($generalID);
@@ -9,8 +9,11 @@ use sammo\DB;
use sammo\DTO\AuctionBidItem;
use sammo\DTO\AuctionInfo;
use sammo\Enums\AuctionType;
use sammo\Enums\InheritanceKey;
use sammo\InheritancePointManager;
use sammo\TimeUtil;
use sammo\Validator;
use sammo\General;
class GetUniqueItemAuctionDetail extends \sammo\BaseAPI
{
@@ -69,6 +72,13 @@ class GetUniqueItemAuctionDetail extends \sammo\BaseAPI
];
}
$inheritMgr = InheritancePointManager::getInstance();
//preveious라서 column을 최대한 비울 수 있다.
$remainPoint = $inheritMgr->getInheritancePoint(
General::createGeneralObjFromDB($generalID, ['owner'], 0),
InheritanceKey::previous
);
$obfuscatedName = AuctionUniqueItem::genObfuscatedName($generalID);
return [
@@ -86,6 +96,7 @@ class GetUniqueItemAuctionDetail extends \sammo\BaseAPI
],
'bidList' => $responseBid,
'obfuscatedName' => $obfuscatedName,
'remainPoint' => $remainPoint,
];
}
}
+1 -1
View File
@@ -73,7 +73,7 @@ class OpenBuyRiceAuction extends \sammo\BaseAPI
$initYearMonth = Util::joinYearMonth($initYear, $initMonth);
$yearMonth = Util::joinYearMonth($year, $month);
if($yearMonth <= $initYearMonth + 3){
if($yearMonth < $initYearMonth + 3){
return '시작 후 3개월이 지나야 경매를 열 수 있습니다.';
}
@@ -73,7 +73,7 @@ class OpenSellRiceAuction extends \sammo\BaseAPI
$initYearMonth = Util::joinYearMonth($initYear, $initMonth);
$yearMonth = Util::joinYearMonth($year, $month);
if($yearMonth <= $initYearMonth + 3){
if($yearMonth < $initYearMonth + 3){
return '시작 후 3개월이 지나야 경매를 열 수 있습니다.';
}
+1 -1
View File
@@ -64,7 +64,7 @@ class OpenUniqueAuction extends \sammo\BaseAPI
$initYearMonth = Util::joinYearMonth($initYear, $initMonth);
$yearMonth = Util::joinYearMonth($year, $month);
if($yearMonth <= $initYearMonth + 3){
if($yearMonth < $initYearMonth + 3){
return '시작 후 3개월이 지나야 경매를 열 수 있습니다.';
}
+1 -1
View File
@@ -26,7 +26,7 @@ class Bet extends \sammo\BaseAPI
->rule('int', 'bettingID')
->rule('integerArray', 'bettingType')
->rule('int', 'amount')
->rule('min', 'amount', 1);
->rule('min', 'amount', 10);
if (!$v->validate()) {
return $v->errorStr();
@@ -0,0 +1,94 @@
<?php
namespace sammo\API\General;
use sammo\Command\General\che_거병;
use sammo\DB;
use sammo\Validator;
use sammo\Session;
use sammo\GameConst;
use sammo\General;
use sammo\JosaUtil;
use sammo\KVStorage;
use sammo\LiteHashDRBG;
use sammo\RandUtil;
use sammo\UniqueConst;
use sammo\Util;
use function sammo\increaseRefresh;
class BuildNationCandidate extends \sammo\BaseAPI
{
public function validateArgs(): ?string
{
return null;
}
public function getRequiredSessionMode(): int
{
return static::REQ_GAME_LOGIN;
}
public function launch(Session $session, ?\DateTimeInterface $modifiedSince, ?string $reqEtag)
{
$userID = $session->userID;
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$gameStor->cacheValues(['opentime', 'turntime']);
$general = $db->queryFirstRow('SELECT no,name,nation,owner_name,npc,lastrefresh FROM general WHERE owner=%i', $userID);
if (!$general) {
return '장수가 없습니다';
}
$generalID = $general['no'];
increaseRefresh("사전 거병", 1);
if ($gameStor->turntime > $gameStor->opentime) {
return '게임이 시작되었습니다.';
}
if ($general['nation'] != 0) {
return '이미 국가에 소속되어있습니다.';
}
$env = $gameStor->getAll();
$generalObj = General::createGeneralObjFromDB($general['no']);
$validCmd = false;
foreach(GameConst::$availableGeneralCommand as $cmdList){
if(in_array('che_거병', $cmdList)){
$validCmd = true;
break;
}
}
if(!$validCmd){
return '거병할 수 없는 모드입니다.';
}
$cmd = new che_거병($generalObj, $env);
$failReason = $cmd->testFullConditionMet();
if ($failReason !== null) {
return $failReason;
}
$rng = new RandUtil(new LiteHashDRBG(Util::simpleSerialize(
UniqueConst::$hiddenSeed,
'BuildNationCandidate',
$generalID,
)));
$result = $cmd->run($rng);
if(!$result){
return '거병을 실패했습니다.';
}
return null;
}
}
+75
View File
@@ -0,0 +1,75 @@
<?php
namespace sammo\API\General;
use sammo\DB;
use sammo\DummyGeneral;
use sammo\GameConst;
use sammo\Session;
use sammo\General;
use sammo\JosaUtil;
use sammo\KVStorage;
use sammo\TimeUtil;
use function sammo\addTurn;
use function sammo\increaseRefresh;
class DieOnPrestart extends \sammo\BaseAPI
{
public function validateArgs(): ?string
{
return null;
}
public function getRequiredSessionMode(): int
{
return static::REQ_GAME_LOGIN;
}
public function launch(Session $session, ?\DateTimeInterface $modifiedSince, ?string $reqEtag)
{
//로그인 검사
$userID = $session->userID;
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$gameStor->cacheValues(['turnterm', 'opentime', 'turntime', 'year', 'month']);
$general = $db->queryFirstRow('SELECT no,name,nation,owner_name,npc,lastrefresh FROM general WHERE owner=%i AND npc = 0', $userID);
if (!$general) {
return '장수가 없습니다';
}
increaseRefresh("장수 삭제", 1);
if ($gameStor->turntime > $gameStor->opentime) {
return '게임이 시작되었습니다.';
}
if ($general['nation'] != 0){
return '이미 국가에 소속되어있습니다.';
}
//서버 가오픈시 할 수 있는 행동
$targetTime = addTurn($general['lastrefresh'], $gameStor->turnterm, GameConst::$minTurnDieOnPrestart);
if ($targetTime > TimeUtil::now()) {
$targetTimeShort = substr($targetTime, 0, 19);
return "아직 삭제할 수 없습니다. {$targetTimeShort} 부터 가능합니다.";
}
$generalObj = General::createGeneralObjFromDB($general['no']);
if ($generalObj instanceof DummyGeneral) {
trigger_error("올바르지 않은 삭제 프로세스 $userID", E_USER_WARNING);
}
$generalName = $generalObj->getName();
$josaYi = JosaUtil::pick($generalName, '이');
$generalObj->kill($db, true, "<Y>{$generalName}</>{$josaYi} 홀연히 모습을 <R>감추었습니다</>");
$session->logoutGame();
return null;
}
}
+2 -2
View File
@@ -18,12 +18,12 @@ class GetGeneralLog extends GetNationGeneralLog
$v = new Validator($this->args);
$v
->rule('required', [
'type',
'reqType',
])
->rule('int', [
'reqTo',
])
->rule('in', 'type', [
->rule('in', 'reqType', [
self::GENERAL_HISTORY,
self::GENERAL_ACTION,
self::BATTLE_RESULT,
+82 -9
View File
@@ -2,7 +2,9 @@
namespace sammo\API\General;
use Ds\Set;
use sammo\ActionLogger;
use sammo\Auction;
use sammo\CityConst;
use sammo\DB;
use sammo\Enums\RankColumn;
@@ -75,6 +77,7 @@ class Join extends \sammo\BaseAPI
if (!$v->validate()) {
return $v->errorStr();
}
return null;
}
@@ -83,6 +86,40 @@ class Join extends \sammo\BaseAPI
return static::REQ_LOGIN | static::REQ_READ_ONLY;
}
public function calcRestInheritPoint(int $userID): int
{
$db = DB::db();
if (Util::toInt(UniqueConst::$seasonIdx) < 1) {
//이벤트 시즌은 카운트하지 않음
return 0;
}
$gameID = UniqueConst::$serverID;
$alreadyJoined = $db->queryFirstField('SELECT count(*) FROM `storage` WHERE `namespace` = %s AND `key` LIKE %s', 'inheritance_result', "{$gameID}_{$userID}_%");
if ($alreadyJoined) {
//이미 받았음
return 0;
}
$targetBonusPointCnt = 0;
//정상적으로 끝난 깃수만 제공
$oldGames = $db->queryFirstColumn('SELECT server_id FROM ng_games WHERE `winner_nation` IS NOT NULL AND `season` >= 1 AND `server_id` != %s ORDER BY `date` DESC LIMIT 8', $gameID);
if(!$oldGames){
return 0;
}
//이전에 장수를 생성한 적이 있는지
$oldGamesCnt = new Set($db->queryFirstColumn('SELECT `server_id` FROM ng_old_generals WHERE server_id IN %ls AND `owner` = %i GROUP BY `server_id`', $oldGames, $userID));
foreach ($oldGames as $oldGameID) {
if($oldGamesCnt->contains($oldGameID)) {
break;
}
$targetBonusPointCnt += 1;
}
return $targetBonusPointCnt;
}
public function launch(Session $session, ?\DateTimeInterface $modifiedSince, ?string $reqEtag)
{
$userID = $session->userID;
@@ -104,6 +141,10 @@ class Join extends \sammo\BaseAPI
$inheritCity = $this->args['inheritCity'] ?? null;
$inheritBonusStat = $this->args['inheritBonusStat'] ?? null;
if ($inheritTurntime !== null && $inheritCity !== null) {
return '턴과 도시를 동시에 지정할 수 없습니다.';
}
$rootDB = RootDB::db();
//회원 테이블에서 정보확인
$member = $rootDB->queryFirstRow('SELECT `no`, id, picture, grade, `name`, imgsvr FROM member WHERE no=%i', $userID);
@@ -114,9 +155,16 @@ class Join extends \sammo\BaseAPI
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$gameStor->cacheValues(['year', 'month', 'maxgeneral', 'scenario', 'show_img_level', 'turnterm', 'turntime', 'genius', 'npcmode']);
$gameStor->cacheValues(['year', 'month', 'maxgeneral', 'scenario', 'show_img_level', 'block_general_create', 'turnterm', 'turntime', 'genius', 'npcmode']);
########## 동일 정보 존재여부 확인. ##########
$block_general_create = $gameStor->getValue('block_general_create');
if($block_general_create & 1){
return '장수 직접 생성이 불가능한 모드입니다.';
}
$blockCustomGeneralName = $gameStor->getValue('block_general_create') & 2;
$gencount = $db->queryFirstField('SELECT count(`no`) FROM general WHERE npc<2');
$oldGeneral = $db->queryFirstField('SELECT `no` FROM general WHERE `owner`=%i', $userID);
$oldName = $db->queryFirstField('SELECT `no` FROM general WHERE `name`=%s', $name);
@@ -300,7 +348,7 @@ class Join extends \sammo\BaseAPI
if ($inheritTurntime !== null) {
$inheritTurntime = $inheritTurntime % ($admin['turnterm'] * 60);
$userLogger->push(sprintf("턴 시간 %02d:%02d 로 지정", intdiv($inheritTurntime, 60), $inheritTurntime%60), "inheritPoint");
$userLogger->push(sprintf("턴 시간 %02d:%02d 로 지정", intdiv($inheritTurntime, 60), $inheritTurntime % 60), "inheritPoint");
$inheritTurntime += $rng->nextRangeInt(0, 999999) / 1000000;
$turntime = new \DateTimeImmutable(cutTurn($admin['turntime'], $admin['turnterm']));
@@ -332,6 +380,15 @@ class Join extends \sammo\BaseAPI
//상성 랜덤
$affinity = $rng->nextRangeInt(1, 150);
$betray = 0;
if ($relYear >= 4) {
$betray += 2;
}
if($blockCustomGeneralName){
$name = bin2hex(random_bytes(5));
}
########## 회원정보 테이블에 입력값을 등록한다. ##########
$db->insert('general', [
'owner' => $userID,
@@ -360,6 +417,7 @@ class Join extends \sammo\BaseAPI
'lastrefresh' => $now,
'crewtype' => GameUnitConst::DEFAULT_CREWTYPE,
'makelimit' => 0,
'betray' => $betray,
'age' => $age,
'startage' => $age,
'personal' => $character,
@@ -369,6 +427,15 @@ class Join extends \sammo\BaseAPI
'special2' => $special2
]);
$generalID = $db->insertId();
if($blockCustomGeneralName){
//XXX: 클래스가 이게 맞나?
$name = Auction::genObfuscatedName($generalID);
$db->update('general', [
'name' => $name
], 'no=%i', $generalID);
}
$turnRows = [];
foreach (Util::range(GameConst::$maxTurn) as $turnIdx) {
$turnRows[] = [
@@ -397,19 +464,25 @@ class Join extends \sammo\BaseAPI
if ($inheritRequiredPoint > 0) {
$userLogger->push("장수 생성으로 포인트 {$inheritRequiredPoint} 소모", "inheritPoint");
$inheritStor = KVStorage::getStorage(DB::db(), "inheritance_{$userID}");
$inheritStor->setValue('previous', [$inheritTotalPoint - $inheritRequiredPoint, null]);
$inheritTotalPoint -= $inheritRequiredPoint;
$inheritStor->setValue('previous', [$inheritTotalPoint, null]);
$userLogger->flush();
$db->update('rank_data', [
'value'=>$db->sqleval('value + %i', $inheritRequiredPoint)
'value' => $db->sqleval('value + %i', $inheritRequiredPoint)
], 'general_id = %i AND type = %s', $generalID, RankColumn::inherit_point_spent_dynamic->value);
}
$me = [
'no' => $generalID
];
$log = [];
$mylog = [];
$restInheritPoint = $this->calcRestInheritPoint($userID) * 500;
if($restInheritPoint > 0){
$userLogger->push("신규/복귀 생성으로 포인트 {$restInheritPoint} 지급", "inheritPoint");
$inheritStor = KVStorage::getStorage(DB::db(), "inheritance_{$userID}");
$inheritTotalPoint += $restInheritPoint;
$inheritStor->setValue('previous', [$inheritTotalPoint, null]);
$userLogger->flush();
}
$logger = new ActionLogger($generalID, 0, $gameStor->year, $gameStor->month);
+16 -1
View File
@@ -3,8 +3,10 @@
namespace sammo\API\Global;
use sammo\Session;
use sammo\DB;
use DateTimeInterface;
use sammo\TurnExecutionHelper;
use sammo\UniqueConst;
class ExecuteEngine extends \sammo\BaseAPI
{
@@ -20,10 +22,23 @@ class ExecuteEngine extends \sammo\BaseAPI
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
{
$updated = TurnExecutionHelper::executeAllCommand();
$reqServerID = $this->args['serverID'] ?? null;
if($reqServerID && $reqServerID !== UniqueConst::$serverID){
return [
'result' => false,
'reason' => '서버 아이디가 다릅니다',
'reqRefresh' => true,
];
}
$updated = false;
$locked = false;
$lastExecuted = TurnExecutionHelper::executeAllCommand($updated, $locked);
return [
'result' => true,
'updated' => $updated,
'locked' => $locked,
'lastExecuted' => $lastExecuted,
];
}
}
+128
View File
@@ -0,0 +1,128 @@
<?php
namespace sammo\API\Global;
use sammo\Session;
use DateTimeInterface;
use sammo\DB;
use sammo\Util;
use sammo\Validator;
class GetRecentRecord extends \sammo\BaseAPI
{
const ROW_LIMIT = 15;
public function validateArgs(): ?string
{
$v = new Validator($this->args);
$v->rule('int', 'lastGeneralRecordID')
->rule('int', 'lastWorldHistoryID');
if (!$v->validate()) {
return $v->errorStr();
}
$this->args['lastGeneralRecordID'] = (int)($this->args['lastGeneralRecordID']??0);
$this->args['lastWorldHistoryID'] = (int)($this->args['lastWorldHistoryID']??0);
return null;
}
public function getRequiredSessionMode(): int
{
return static::REQ_GAME_LOGIN | static::REQ_READ_ONLY;
}
private function getGlobalRecord(int $lastRecordID): array
{
$db = DB::db();
$globalRecord = $db->queryAllLists(
'SELECT id, `text` FROM general_record WHERE `general_id` = 0 AND log_type = %s AND id >= %i ORDER BY `id` DESC LIMIT %i',
'history',
$lastRecordID,
static::ROW_LIMIT + 1,
);
return $globalRecord;
}
private function getGeneralRecord(int $generalID, int $lastRecordID): array
{
$db = DB::db();
$generalRecord = $db->queryAllLists(
'SELECT id, `text` FROM general_record WHERE `general_id` = %i AND log_type = %s AND id >= %i ORDER BY `id` DESC LIMIT %i',
$generalID,
'action',
$lastRecordID,
static::ROW_LIMIT + 1,
);
return $generalRecord;
}
private function getHistory(int $lastHistoryID): array
{
$db = DB::db();
$history = $db->queryAllLists(
'SELECT id, `text` FROM world_history WHERE nation_id = 0 AND id >= %i ORDER BY `id` DESC LIMIT %i',
$lastHistoryID,
static::ROW_LIMIT + 1,
);
return $history;
}
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
{
$db = DB::db();
$lastHistoryID = $this->args['lastWorldHistoryID'];
$lastRecordID = $this->args['lastGeneralRecordID'];
$history = $this->getHistory($lastHistoryID);
$globalRecord = $this->getGlobalRecord($lastRecordID);
$generalRecord = $this->getGeneralRecord($session->generalID, $lastRecordID);
$flushHistory = true;
$flushGlobalRecord = true;
$flushGeneralRecord = true;
if($history){
if(Util::array_last($history)[0] == $lastHistoryID){
$flushHistory = false;
array_pop($history);
}
else if(count($history) > static::ROW_LIMIT){
array_pop($history);
}
}
if($globalRecord){
if(Util::array_last($globalRecord)[0] == $lastRecordID){
$flushGlobalRecord = false;
array_pop($globalRecord);
}
else if(count($globalRecord) > static::ROW_LIMIT){
array_pop($globalRecord);
}
}
if($generalRecord){
if(Util::array_last($generalRecord)[0] == $lastRecordID){
$flushGeneralRecord = false;
array_pop($generalRecord);
}
else if(count($generalRecord) > static::ROW_LIMIT){
array_pop($generalRecord);
}
}
return [
'result' => true,
'history' => $history,
'global' => $globalRecord,
'general' => $generalRecord,
'flushHistory' => $flushHistory?1:0,
'flushGlobal' => $flushGlobalRecord?1:0,
'flushGeneral' => $flushGeneralRecord?1:0,
];
}
}
@@ -67,6 +67,10 @@ class BuyHiddenBuff extends \sammo\BaseAPI
$reqAmount = GameConst::$inheritBuffPoints[$level] - GameConst::$inheritBuffPoints[$prevLevel];
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
if($gameStor->isunited){
return '이미 천하가 통일되었습니다.';
}
$inheritStor = KVStorage::getStorage($db, "inheritance_{$userID}");
$previousPoint = ($inheritStor->getValue('previous') ?? [0,0])[0];
if ($previousPoint < $reqAmount) {
@@ -40,6 +40,10 @@ class BuyRandomUnique extends \sammo\BaseAPI
}
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
if($gameStor->isunited){
return '이미 천하가 통일되었습니다.';
}
$inheritStor = KVStorage::getStorage($db, "inheritance_{$userID}");
$previousPoint = ($inheritStor->getValue('previous')??[0, 0])[0];
$reqAmount = GameConst::$inheritItemRandomPoint;
@@ -0,0 +1,40 @@
<?php
namespace sammo\API\InheritAction;
use DateTimeInterface;
use sammo\DB;
use sammo\Session;
use sammo\Validator;
use sammo\Util;
class GetMoreLog extends \sammo\BaseAPI
{
public function validateArgs(): ?string
{
$v = new Validator($this->args);
$v->rule('integer', 'lastID');
if (!$v->validate()) {
return $v->errorStr();
}
$this->args['lastID'] = Util::toInt($this->args['lastID']);
return null;
}
function getRequiredSessionMode(): int
{
return static::REQ_GAME_LOGIN | static::REQ_READ_ONLY;
}
function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
{
$userID = $session->userID;
$lastID = $this->args['lastID'];
$db = DB::db();
$lastInheritPointLogs = $db->query('SELECT id, server_id, year, month, date, text FROM user_record WHERE log_type = %s AND `user_id` = %i AND id < %i ORDER BY id desc LIMIT 30', "inheritPoint", $userID, $lastID);
return [
'result'=> true,
'log' => $lastInheritPointLogs,
];
}
}
@@ -51,6 +51,11 @@ class ResetSpecialWar extends \sammo\BaseAPI
$reqPoint = GameConst::$inheritResetAttrPointBase[$nextLevel];
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
if($gameStor->isunited){
return '이미 천하가 통일되었습니다.';
}
$inheritStor = KVStorage::getStorage($db, "inheritance_{$userID}");
$previousPoint = ($inheritStor->getValue('previous') ?? [0, 0])[0];
if ($previousPoint < $reqPoint) {
@@ -50,6 +50,10 @@ class ResetTurnTime extends \sammo\BaseAPI
$reqPoint = GameConst::$inheritResetAttrPointBase[$nextLevel];
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
if($gameStor->isunited){
return '이미 천하가 통일되었습니다.';
}
$inheritStor = KVStorage::getStorage($db, "inheritance_{$userID}");
$previousPoint = ($inheritStor->getValue('previous') ?? [0, 0])[0];
if ($previousPoint < $reqPoint) {
@@ -65,6 +65,10 @@ class SetNextSpecialWar extends \sammo\BaseAPI
$reqAmount = GameConst::$inheritSpecificSpecialPoint;
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
if($gameStor->isunited){
return '이미 천하가 통일되었습니다.';
}
$inheritStor = KVStorage::getStorage($db, "inheritance_{$userID}");
$previousPoint = ($inheritStor->getValue('previous') ?? [0, 0])[0];
if ($previousPoint < $reqAmount) {
@@ -0,0 +1,61 @@
<?php
namespace sammo\API\Message;
use sammo\Session;
use DateTimeInterface;
use sammo\DB;
use sammo\DiplomaticMessage;
use sammo\KVStorage;
use sammo\Message;
use sammo\Validator;
class DecideMessageResponse extends \sammo\BaseAPI
{
public function validateArgs(): ?string
{
$v = new Validator($this->args);
$v->rule('required', ['msgID', 'response']);
$v->rule('integer', 'msgID')
->rule('boolean', 'response');
if (!$v->validate()) {
return $v->errorStr();
}
$this->args['msgID'] = (int)($this->args['msgID'] ?? -1);
return null;
}
public function getRequiredSessionMode(): int
{
return static::REQ_GAME_LOGIN;
}
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
{
$msgID = $this->args['msgID'];
$msgResponse = $this->args['response'];
$generalID = $session->generalID;
$msg = Message::getMessageByID($msgID);
if ($msg === null) {
return '존재하지 않는 메시지입니다.';
}
$reason = 'success';
$gameStor = KVStorage::getStorage(DB::db(), 'game_env');
$gameStor->cacheAll();
if ($msgResponse) {
$result = $msg->agreeMessage($generalID, $reason);
} else {
$result = $msg->declineMessage($generalID, $reason);
}
return [
'result' => $result !== DiplomaticMessage::INVALID,
'reason' => $reason
];
}
}
+37
View File
@@ -0,0 +1,37 @@
<?php
namespace sammo\API\Message;
use sammo\Session;
use DateTimeInterface;
use sammo\Message;
use sammo\Validator;
class DeleteMessage extends \sammo\BaseAPI
{
public function validateArgs(): ?string
{
$v = new Validator($this->args);
$v->rule('required', ['msgID']);
$v->rule('integer', 'msgID');
if (!$v->validate()) {
return $v->errorStr();
}
$this->args['msgID'] = (int)($this->args['msgID'] ?? -1);
return null;
}
public function getRequiredSessionMode(): int
{
return static::REQ_GAME_LOGIN;
}
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
{
$msgID = $this->args['msgID'];
$generalID = $session->generalID;
return Message::deleteMsg($msgID, $generalID);
}
}
+35
View File
@@ -0,0 +1,35 @@
<?php
namespace sammo\API\Message;
use sammo\Session;
use DateTimeInterface;
use function sammo\getMailboxList;
class GetContactList extends \sammo\BaseAPI{
public function validateArgs(): ?string
{
return null;
}
public function getRequiredSessionMode(): int
{
return static::REQ_GAME_LOGIN | static::REQ_READ_ONLY;
}
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
{
if(!$session->generalID){
return [
"nation"=>[]
];
}
//NOTE: 모든 국가, 모든 장수에 대해서 같은 결과라면 캐싱 가능하지 않을까?
return [
"nation"=>getMailboxList()
];
}
}
+143
View File
@@ -0,0 +1,143 @@
<?php
namespace sammo\API\Message;
use sammo\Session;
use DateTimeInterface;
use sammo\DB;
use sammo\Enums\MessageType;
use sammo\Json;
use sammo\Message;
use sammo\TimeUtil;
use sammo\Util;
use sammo\Validator;
use function sammo\checkSecretPermission;
class GetOldMessage extends \sammo\BaseAPI
{
public function validateArgs(): ?string
{
$v = new Validator($this->args);
$v->rule('required', [
'to',
'type',
])->rule('integer', 'to')
->rule('in', 'type', ['private', 'public', 'national', 'diplomacy']);
if (!$v->validate()) {
return $v->errorStr();
}
$this->args['to'] = (int)($this->args['to'] ?? 0);
return null;
}
public function getRequiredSessionMode(): int
{
return static::REQ_GAME_LOGIN;
}
private function delayFrequentCall(Session $session): void
{
$lastMsgGet = Json::decode($session->lastMsgGet) ?? [];
$now = new \DateTimeImmutable();
$delayTime = false;
if (count($lastMsgGet) >= 10) {
try {
if (!is_string($lastMsgGet[0])) {
throw new \Exception('Why not string?');
}
$first = new \DateTimeImmutable($lastMsgGet[0]);
$diffSec = TimeUtil::DateIntervalToSeconds($first->diff($now));
if ($diffSec < 1) {
$delayTime = true;
}
array_shift($lastMsgGet);
} catch (\Exception $e) {
$lastMsgGet = [];
}
}
$lastMsgGet[] = TimeUtil::format($now, true);
$session->lastMsgGet = Json::encode($lastMsgGet);
if ($delayTime) {
usleep(200);
}
}
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
{
$this->delayFrequentCall($session);
$session->setReadOnly();
$userID = $session->getUserID();
$db = DB::db();
$me = $db->queryFirstRow('SELECT `no`,`name`,`nation`,`officer_level`,`con`,`picture`,`imgsvr`,penalty,permission FROM general WHERE `owner`=%i', $userID);
if ($me === null) {
return '장수가 사망했습니다.';
}
[$generalID, $nationID, $generalName] = [$me['no'], $me['nation'], $me['name']];
$permission = checkSecretPermission($me, false);
$reqTo = $this->args['to'];
$result = [
MessageType::private->value => [],
MessageType::public->value => [],
MessageType::national->value => [],
MessageType::diplomacy->value => [],
'result' => true,
'keepRecent' => true,
'sequence' => 0,
'nationID' => $nationID,
'generalName' => $generalName,
];
$result['result'] = true;
$nextSequence = $reqTo;
$reqType = MessageType::tryFrom($this->args['type']);
if ($reqType === null) {
return '잘못된 요청입니다.';
}
if ($reqType === MessageType::private) {
$result[MessageType::private->value] = array_map(function (Message $msg) use (&$nextSequence) {
if ($msg->id > $nextSequence) {
$nextSequence = $msg->id;
}
return $msg->toArray();
}, Message::getMessagesFromMailBoxOld($generalID, MessageType::private, $reqTo, 15));
} else if ($reqType === MessageType::public) {
$result[MessageType::public->value] = array_map(function (Message $msg) use (&$nextSequence) {
if ($msg->id > $nextSequence) {
$nextSequence = $msg->id;
}
return $msg->toArray();
}, Message::getMessagesFromMailBoxOld(Message::MAILBOX_PUBLIC, MessageType::public, $reqTo, 15));
} else if ($reqType === MessageType::national) {
$result[MessageType::national->value] = array_map(function (Message $msg) use (&$nextSequence) {
if ($msg->id > $nextSequence) {
$nextSequence = $msg->id;
}
return $msg->toArray();
}, Message::getMessagesFromMailBoxOld(Message::MAILBOX_NATIONAL + $nationID, MessageType::national, $reqTo, 15));
} else {
$result[MessageType::diplomacy->value] = array_map(function (Message $msg) use (&$nextSequence, $permission) {
if ($msg->id > $nextSequence) {
$nextSequence = $msg->id;
}
$values = $msg->toArray();
if ($msg->dest->nationID != 0 && $permission < 3) {
$values['text'] = '(외교 메시지입니다)'; //TODO: 외교서신이라 읽을 수 없음을 보여줘야함
$values['option']['invalid'] = true;
}
return $values;
}, Message::getMessagesFromMailBoxOld(Message::MAILBOX_NATIONAL + $nationID, MessageType::diplomacy, $reqTo, 15));
}
return $result;
}
}
+152
View File
@@ -0,0 +1,152 @@
<?php
namespace sammo\API\Message;
use sammo\Session;
use DateTimeInterface;
use sammo\DB;
use sammo\Enums\MessageType;
use sammo\Json;
use sammo\Message;
use sammo\TimeUtil;
use sammo\Util;
use sammo\Validator;
use function sammo\checkSecretPermission;
class GetRecentMessage extends \sammo\BaseAPI
{
public function validateArgs(): ?string
{
$v = new Validator($this->args);
$v->rule('integer', 'sequence');
if (!$v->validate()) {
return $v->errorStr();
}
$this->args['sequence'] = (int)($this->args['sequence'] ?? -1);
return null;
}
public function getRequiredSessionMode(): int
{
return static::REQ_GAME_LOGIN;
}
private function delayFrequentCall(Session $session): void
{
$lastMsgGet = Json::decode($session->lastMsgGet) ?? [];
$now = new \DateTimeImmutable();
$delayTime = false;
if (count($lastMsgGet) >= 10) {
try {
if (!is_string($lastMsgGet[0])) {
throw new \Exception('Why not string?');
}
$first = new \DateTimeImmutable($lastMsgGet[0]);
$diffSec = TimeUtil::DateIntervalToSeconds($first->diff($now));
if ($diffSec < 1) {
$delayTime = true;
}
array_shift($lastMsgGet);
} catch (\Exception $e) {
$lastMsgGet = [];
}
}
$lastMsgGet[] = TimeUtil::format($now, true);
$session->lastMsgGet = Json::encode($lastMsgGet);
if ($delayTime) {
usleep(200);
}
}
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
{
$this->delayFrequentCall($session);
$session->setReadOnly();
$userID = $session->getUserID();
$db = DB::db();
$me = $db->queryFirstRow('SELECT `no`,`name`,`nation`,`officer_level`,`con`,`picture`,`imgsvr`,penalty,permission FROM general WHERE `owner`=%i', $userID);
if ($me === null) {
return '장수가 사망했습니다.';
}
[$generalID, $nationID, $generalName] = [$me['no'], $me['nation'], $me['name']];
$permission = checkSecretPermission($me, false);
$reqSequence = $this->args['sequence'];
$result = [];
$result['result'] = true;
$result['keepRecent'] = false;
$nextSequence = $reqSequence;
$minSequence = $reqSequence;
$lastType = null;
$result['private'] = array_map(function (Message $msg) use (&$nextSequence, &$minSequence, &$lastType) {
if ($msg->id > $nextSequence) {
$nextSequence = $msg->id;
}
if ($msg->id <= $minSequence) {
$minSequence = $msg->id;
$lastType = 'private';
}
return $msg->toArray();
}, Message::getMessagesFromMailBox($generalID, MessageType::private, 15, $reqSequence));
$result['public'] = array_map(function (Message $msg) use (&$nextSequence, &$minSequence, &$lastType) {
if ($msg->id > $nextSequence) {
$nextSequence = $msg->id;
}
if ($msg->id <= $minSequence) {
$minSequence = $msg->id;
$lastType = 'public';
}
return $msg->toArray();
}, Message::getMessagesFromMailBox(Message::MAILBOX_PUBLIC, MessageType::public, 15, $reqSequence));
$result['national'] = array_map(function (Message $msg) use (&$nextSequence, &$minSequence, &$lastType) {
if ($msg->id > $nextSequence) {
$nextSequence = $msg->id;
}
if ($msg->id <= $minSequence) {
$minSequence = $msg->id;
$lastType = 'national';
}
return $msg->toArray();
}, Message::getMessagesFromMailBox(Message::MAILBOX_NATIONAL + $nationID, MessageType::national, 15, $reqSequence));
$result['diplomacy'] = array_map(function (Message $msg) use (&$nextSequence, &$minSequence, &$lastType, $permission) {
if ($msg->id > $nextSequence) {
$nextSequence = $msg->id;
}
if ($msg->id <= $minSequence) {
$minSequence = $msg->id;
$lastType = 'diplomacy';
}
$values = $msg->toArray();
if ($msg->dest->nationID != 0 && $permission < 3) {
$values['text'] = '(외교 메시지입니다)'; //TODO: 외교서신이라 읽을 수 없음을 보여줘야함
$values['option']['invalid'] = true;
}
return $values;
}, Message::getMessagesFromMailBox(Message::MAILBOX_NATIONAL + $nationID, MessageType::diplomacy, 15, $reqSequence));
if ($lastType !== null) {
array_pop($result[$lastType]);
$result['keepRecent'] = true;
} else if ($reqSequence <= 0) {
$result['keepRecent'] = true;
}
$result['sequence'] = $nextSequence;
$result['nationID'] = $nationID;
$result['generalName'] = $generalName;
return $result;
}
}
+240
View File
@@ -0,0 +1,240 @@
<?php
namespace sammo\API\Message;
use sammo\Session;
use DateTimeInterface;
use sammo\DB;
use sammo\Enums\MessageType;
use sammo\Message;
use sammo\MessageTarget;
use sammo\Validator;
use function sammo\checkLimit;
use function sammo\checkSecretPermission;
use function sammo\getBlockLevel;
use function sammo\GetImageURL;
use function sammo\getNationStaticInfo;
use function sammo\increaseRefresh;
class SendMessage extends \sammo\BaseAPI
{
public function validateArgs(): ?string
{
$v = new Validator($this->args);
$v->rule('required', ['mailbox', 'text']);
$v->rule('integer', 'mailbox');
$v->rule('lengthMin', 'text', 1);
if (!$v->validate()) {
return $v->errorStr();
}
$this->args['mailbox'] = (int)($this->args['mailbox'] ?? Message::MAILBOX_PUBLIC);
return null;
}
public function getRequiredSessionMode(): int
{
return static::REQ_GAME_LOGIN;
}
private function genPublicMessage(MessageTarget $src, string $text): Message
{
$now = new \DateTime();
$unlimited = new \DateTime('9999-12-31');
$msg = new Message(
MessageType::public,
$src,
$src,
$text,
$now,
$unlimited,
[]
);
return $msg;
}
private function genNationalMessage(MessageTarget $src, string $text): Message
{
$now = new \DateTime();
$unlimited = new \DateTime('9999-12-31');
$dest = new MessageTarget(0, '', $src->nationID, $src->nationName, $src->color);
$msg = new Message(
MessageType::national,
$src,
$dest,
$text,
$now,
$unlimited,
[]
);
return $msg;
}
private function genDiplomacyMessage(MessageTarget $src, int $destNationID, string $text): Message|string
{
$now = new \DateTime();
$unlimited = new \DateTime('9999-12-31');
$destNation = getNationStaticInfo($destNationID);
if ($destNation === null) {
return '존재하지 않는 국가입니다.';
}
$dest = new MessageTarget(0, '', $destNation['nation'], $destNation['name'], $destNation['color']);
$msg = new Message(
MessageType::diplomacy,
$src,
$dest,
$text,
$now,
$unlimited,
[]
);
return $msg;
}
private function genPrivateMessage(MessageTarget $src, int $destGeneralID, int $permission, string $text): Message|string
{
$now = new \DateTime();
$unlimited = new \DateTime('9999-12-31');
$db = DB::db();
$destUser = $db->queryFirstRow('SELECT `no`,`name`,`nation`,`officer_level`,`con`,`picture`,`imgsvr`,permission,penalty FROM general WHERE `no`=%i', $destGeneralID);
if (!$destUser) {
return '존재하지 않는 유저입니다.';
}
$destPermission = checkSecretPermission($destUser, false);
if ($permission == 4 && $destPermission == 4 && $destUser['nation'] != $src->nationID) {
return '외교권자끼리는 메시지를 보낼 수 없습니다.';
}
$destNation = getNationStaticInfo($destUser['nation']);
if ($destNation === null) {
$destNation = getNationStaticInfo(0);
}
$dest = new MessageTarget(
$destUser['no'],
$destUser['name'],
$destNation['nation'],
$destNation['name'],
$destNation['color'],
GetImageURL($destUser['imgsvr'], $destUser['picture'])
);
$msg = new Message(
MessageType::private,
$src,
$dest,
$text,
$now,
$unlimited,
[]
);
return $msg;
}
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
{
$userID = $session->userID;
$mailbox = $this->args['mailbox'];
$text = $this->args['text'];
increaseRefresh('서신전달', 1);
$blockLevel = getBlockLevel();
if ($blockLevel == 1 || $blockLevel == 3) {
return '차단되었습니다.';
}
$db = DB::db();
$me = $db->queryFirstRow('SELECT `no`,`name`,`nation`,`officer_level`,`con`,`picture`,`imgsvr`,penalty,permission,belong FROM general WHERE `owner`=%i', $userID);
if (!$me) {
$session->logoutGame();
return '장수가 없습니다.';
}
$con = checkLimit($me['con']);
if ($con >= 2) {
return '접속 제한입니다.';
}
$nationID = $me['nation'];
$iconPath = GetImageURL($me['imgsvr'], $me['picture']);
$srcNation = getNationStaticInfo($me['nation']);
if ($srcNation === null) {
return '존재하지 않는 국가입니다.';
}
$src = new MessageTarget($me['no'], $me['name'], $srcNation['nation'], $srcNation['name'], $srcNation['color'], $iconPath);
// 전체 메세지
if ($mailbox === Message::MAILBOX_PUBLIC) {
$msgID = $this->genPublicMessage($src, $text)->send();
return [
'msgID' => $msgID
];
}
$permission = checkSecretPermission($me);
if ($mailbox >= Message::MAILBOX_NATIONAL) {
if ($permission < 4) {
$destNationID = $nationID;
} else {
$destNationID = $mailbox - Message::MAILBOX_NATIONAL;
}
if ($destNationID === $nationID) {
$msgID = $this->genNationalMessage($src, $text)->send();
return [
'msgID' => $msgID
];
}
$msgObjOrError = $this->genDiplomacyMessage($src, $destNationID, $text);
if(is_string($msgObjOrError)) {
return $msgObjOrError;
}
$msgID = $msgObjOrError->send();
return [
'msgID' => $msgID
];
}
if ($mailbox > 0) {
$now = new \DateTime();
$lastMsg = new \DateTime($session->lastMsg ?? '0000-00-00');
$msg_interval = $now->getTimestamp() - $lastMsg->getTimestamp();
if ($msg_interval < 2) {
return '개인메세지는 2초당 1건만 보낼 수 있습니다!';
}
$session->lastMsg = $now->format('Y-m-d H:i:s');
$msgObjOrError = $this->genPrivateMessage($src, $mailbox, $permission, $text);
if(is_string($msgObjOrError)) {
return $msgObjOrError;
}
$msgID = $msgObjOrError->send();
return [
'msgID' => $msgID
];
}
return '알 수 없는 에러입니다.';
}
}
+68 -37
View File
@@ -2,6 +2,7 @@
namespace sammo\API\Nation;
use ArrayObject;
use sammo\DB;
use sammo\General;
use sammo\Session;
@@ -44,9 +45,12 @@ class GeneralList extends \sammo\BaseAPI
'belong' => 0,
'connect' => 0,
'troop' => 0,
'city' => 0,
'con' => 1,
'specage' => 1,
'specage2' => 1,
'specage' => 0,
'specage2' => 0,
'leadership_exp' => 1,
'strength_exp' => 1,
'intel_exp' => 1,
@@ -56,14 +60,12 @@ class GeneralList extends \sammo\BaseAPI
'dex4' => 1,
'dex5' => 1,
'city' => 1,
'experience' => 1,
'dedication' => 1,
'officer_level' => 1,
'officer_city' => 1,
'defence_train' => 1,
'troop' => 1,
'crewtype' => 1,
'crew' => 1,
'train' => 1,
@@ -125,7 +127,7 @@ class GeneralList extends \sammo\BaseAPI
if ($level >= 5) {
return $level;
}
if ($this->permission > 1) {
if ($this->permission >= 1) {
return $level;
}
return 1;
@@ -157,35 +159,59 @@ class GeneralList extends \sammo\BaseAPI
$rawGeneralList = Util::convertArrayToDict($db->query('SELECT %l from general WHERE nation = %i ORDER BY turntime ASC', Util::formatListOfBackticks($queryColumns), $nationID), 'no');
/** @var ArrayObject[] */
$troops = [];
foreach ($db->queryAllLists('SELECT troop_leader,name FROM troop WHERE nation = %i', $nationID) as [$troopLeaderID, $troopName]) {
if (!key_exists($troopLeaderID, $rawGeneralList)) {
continue;
}
$troopTurnTime = $rawGeneralList[$troopLeaderID]['turntime'];
$troops[$troopLeaderID] = new ArrayObject([
'id' => $troopLeaderID,
'name' => $troopName,
'turntime' => $troopTurnTime,
'reservedCommand' => [],
]);
}
$reservedCommand = [];
if ($this->permission >= 1) {
$nonNPCGeneralIDList = [];
foreach ($rawGeneralList as $rawGeneral) {
if ($rawGeneral['npc'] < 2) {
$nonNPCGeneralIDList[] = $rawGeneral['no'];
if ($this->permission >= 1 || count($troops)) {
$reservedCommandTargetGeneralIDList = [];
if($this->permission >= 1){
foreach ($rawGeneralList as $rawGeneral) {
if ($rawGeneral['npc'] < 2) {
$reservedCommandTargetGeneralIDList[$rawGeneral['no']] = $rawGeneral['no'];
}
}
}
foreach($troops as $troop){
$reservedCommandTargetGeneralIDList[$troop['id']] = $troop['id'];
}
$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] = [];
if($reservedCommandTargetGeneralIDList){
$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',
array_values($reservedCommandTargetGeneralIDList)
);
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
];
}
$reservedCommand[$generalID][] = [
'action' => $action,
'arg' => $arg,
'brief' => $brief
];
}
}
@@ -251,6 +277,17 @@ class GeneralList extends \sammo\BaseAPI
$resultColumns[$column] = $column;
}
foreach ($troops as $troop){
$troopLeaderID = $troop['id'];
$troop['reservedCommand'] = array_map(function($turnObj){
$brief = $turnObj['brief'];
if($brief == '집합'){
return $brief;
}
return '-';
}, $specialViewFilter['reservedCommand']($rawGeneralList[$troopLeaderID]));
}
$generalList = [];
foreach ($rawGeneralList as $rawGeneral) {
//General 생성?
@@ -271,20 +308,14 @@ class GeneralList extends \sammo\BaseAPI
$generalList[] = $item;
}
if ($this->permission >= 1) {
$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,
'troops' => array_values($troops),
'env' => $env,
'myGeneralID' => $session->generalID,
];
return $result;
+9 -8
View File
@@ -9,11 +9,12 @@ use sammo\Validator;
use function sammo\checkLimit;
use function sammo\checkSecretPermission;
use function sammo\getBattleDetailLogMore;
use function sammo\getBattleDetailLogRecent;
use function sammo\getBattleResultMore;
use function sammo\getBattleResultRecent;
use function sammo\getGeneralActionLogMore;
use function sammo\getGeneralActionLogRecent;
use function sammo\getGeneralHistoryLogAll;
use function sammo\getGeneralHistoryLogWithLogID;
class GetGeneralLog extends \sammo\BaseAPI
{
@@ -28,13 +29,13 @@ class GetGeneralLog extends \sammo\BaseAPI
$v
->rule('required', [
'generalID',
'type',
'reqType',
])
->rule('integer', [
'generalID',
'reqTo',
])
->rule('in', 'type', [
->rule('in', 'reqType', [
self::GENERAL_HISTORY,
self::GENERAL_ACTION,
self::BATTLE_RESULT,
@@ -76,11 +77,11 @@ class GetGeneralLog extends \sammo\BaseAPI
return '같은 나라의 장수가 아닙니다.';
}
$reqType = $this->args['type'];
$reqType = $this->args['reqType'];
if (
$reqType === self::GENERAL_ACTION &&
$testGeneralNPCType < 2 &&
$generalID !== $me['generalID'] &&
$generalID !== $me['no'] &&
$permission < 2
) {
return '권한이 부족합니다. 유저 장수의 개인 기록은 수뇌만 열람 가능합니다.';
@@ -103,7 +104,7 @@ class GetGeneralLog extends \sammo\BaseAPI
$userID = $session->userID;
$targetGeneralID = $this->getTargetGeneralID($session);
$reqType = $this->args['type'];
$reqType = $this->args['reqType'];
$reqTo = $this->args['reqTo'] ?? null;
$db = DB::db();
@@ -124,7 +125,7 @@ class GetGeneralLog extends \sammo\BaseAPI
'result' => true,
'reqType' => $reqType,
'generalID' => $targetGeneralID,
'log' => getGeneralHistoryLogAll($targetGeneralID)
'log' => getGeneralHistoryLogWithLogID($targetGeneralID)
];
}
@@ -156,7 +157,7 @@ class GetGeneralLog extends \sammo\BaseAPI
'reqType' => $reqType,
'generalID' => $targetGeneralID,
'log' => $reqTo === null
? getBattleResultRecent($targetGeneralID, 30)
? getBattleDetailLogRecent($targetGeneralID, 30)
: getBattleDetailLogMore($targetGeneralID, $reqTo, 30)
];
}
+104
View File
@@ -0,0 +1,104 @@
<?php
namespace sammo\API\Nation;
use sammo\DB;
use sammo\GameConst;
use sammo\General;
use sammo\KVStorage;
use sammo\LastTurn;
use sammo\Session;
use sammo\Util;
use sammo\Validator;
use function sammo\buildNationCommandClass;
use function sammo\checkLimit;
use function sammo\checkSecretPermission;
use function sammo\getBattleDetailLogMore;
use function sammo\getBattleResultMore;
use function sammo\getBattleResultRecent;
use function sammo\getGeneralActionLogMore;
use function sammo\getGeneralActionLogRecent;
use function sammo\getGeneralHistoryLogAll;
use function sammo\getNationStaticInfo;
class GetNationInfo extends \sammo\BaseAPI
{
public function validateArgs(): ?string
{
$v = new Validator($this->args);
$v->rule('boolean', 'full');
if (!$v->validate()) {
return $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)
{
$userID = $session->userID;
$db = DB::db();
$nationID = $db->queryFirstField('SELECT nation FROM general WHERE `owner` = %i', $userID);
if (!$nationID) {
return [
'result' => true,
'nation' => getNationStaticInfo(0)
];
}
$isFull = $this->args['full'] ?? false;
if(!$isFull){
$nation = getNationStaticInfo($nationID);
return [
'result' => true,
'nation' => $nation,
];
}
$generalObj = General::createGeneralObjFromDB($session->generalID, null, 1);
$gameStor = KVStorage::getStorage($db, 'game_env');
$gameEnv = $gameStor->getValues(['year', 'month', 'startyear']);
$nation = $db->queryFirstRow(
'SELECT nation, `name`, color, capital, gennum, gold, rice, bill, rate, secretlimit, chief_set, scout, war, strategic_cmd_limit, surlimit, tech, `power`, `level`, `type` FROM nation WHERE id = %i',
$nationID
);
$nationStor = \sammo\KVStorage::getStorage($db, $nationID, 'nation_env');
$nationStor->cacheAll();
//전략 정보를 매번 읽어와야하나?
$impossibleStrategicCommandLists = [];
$strategicCommandLists = GameConst::$availableChiefCommand['전략'];
$yearMonth = Util::joinYearMonth($gameEnv['year'], $gameEnv['month']);
foreach ($strategicCommandLists as $command) {
$cmd = buildNationCommandClass($command, $generalObj, $gameEnv, new LastTurn());
$nextAvailableTurn = $cmd->getNextAvailableTurn();
if ($nextAvailableTurn > $yearMonth) {
$impossibleStrategicCommandLists[] = [$cmd->getName(), $nextAvailableTurn - $yearMonth];
}
}
$troopName = [];
foreach ($db->queryAllLists('SELECT troop_leader, name FROM troop WHERE nation=%i', $nationID) as [$troopID, $tName]) {
$troopName[$troopID] = $tName;
}
return [
'result' => true,
'nation' => $nation,
'impossibleStrategicCommandLists' => $impossibleStrategicCommandLists,
'troops' => $troopName,
];
}
}
+8 -2
View File
@@ -6,6 +6,7 @@ use sammo\Session;
use DateTimeInterface;
use sammo\DB;
use sammo\KVStorage;
use sammo\TimeUtil;
use sammo\Validator;
use sammo\WebUtil;
@@ -36,7 +37,7 @@ class SetNotice extends \sammo\BaseAPI
$msg = $this->args['msg'];
$userID = $session->userID;
$db = DB::db();
$me = $db->queryFirstRow('SELECT `no`,nation,`officer_level`,permission,penalty FROM general WHERE `owner`=%i', $userID);
$me = $db->queryFirstRow('SELECT `no`,`name`,nation,`officer_level`,permission,penalty FROM general WHERE `owner`=%i', $userID);
$permission = checkSecretPermission($me, false);
if($permission < 0){
@@ -49,7 +50,12 @@ class SetNotice extends \sammo\BaseAPI
$nationID = $me['nation'];
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
$nationStor->notice = WebUtil::htmlPurify($msg);
$nationStor->nationNotice = [
'date'=>TimeUtil::now(),
'msg'=>WebUtil::htmlPurify($msg),
'author'=>$me['name'],
'authorID'=>$me['no'],
];
return [
'result' => true
+66
View File
@@ -0,0 +1,66 @@
<?php
namespace sammo\API\Nation;
use sammo\Session;
use DateTimeInterface;
use sammo\DB;
use sammo\StringUtil;
use sammo\Validator;
use function sammo\checkSecretPermission;
/** @deprecated */
class SetTroopName extends \sammo\BaseAPI
{
public function validateArgs(): ?string
{
$v = new Validator($this->args);
$v->rule('required', [
'troopID',
'troopName',
])
->rule('stringWidthBetween', 'troopName', 1, 18)
->rule('integer', 'troopID');
if (!$v->validate()) {
return $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)
{
$userID = $session->userID;
$db = DB::db();
$me = $db->queryFirstRow('SELECT `no`,nation,`officer_level`,permission,penalty FROM general WHERE `owner`=%i', $userID);
$permission = checkSecretPermission($me, false);
$troopID = $this->args['troopID'];
$generalID = $me['no'];
if($generalID != $troopID && $permission < 4){
return "권한이 부족합니다.";
}
$troopName = StringUtil::neutralize($this->args['troopName']);
if(!$troopName){
return '부대 이름이 없습니다.';
}
$nationID = $me['nation'];
$db->update('troop', [
'name'=>$troopName
], 'troop_leader=%i AND `nation`=%i',$troopID, $nationID);
if($db->affectedRows() == 0){
return '부대가 없습니다.';
}
return null;
}
}
@@ -63,9 +63,9 @@ class GetReservedCommand extends \sammo\BaseAPI
$nationTurnList = [];
foreach ($db->queryAllLists(
'SELECT officer_level, turn_idx, action, arg, brief FROM nation_turn WHERE nation_id = %i ORDER BY officer_level DESC, turn_idx ASC',
$me['nation']
) as [$officer_level, $turn_idx, $action, $arg, $brief]) {
'SELECT officer_level, turn_idx, action, arg, brief FROM nation_turn WHERE nation_id = %i ORDER BY officer_level DESC, turn_idx ASC',
$me['nation']
) as [$officer_level, $turn_idx, $action, $arg, $brief]) {
if (!key_exists($officer_level, $nationTurnList)) {
$nationTurnList[$officer_level] = [];
}
@@ -76,6 +76,14 @@ class GetReservedCommand extends \sammo\BaseAPI
];
}
$troopList = [];
foreach ($db->queryAllLists(
'SELECT troop_leader, `name` FROM troop WHERE `nation` = %i',
$nationID
) as [$troopID, $troopName]) {
$troopList[$troopID] = $troopName;
}
$nationChiefList = [];
foreach ($nationTurnList as $officer_level => $turnBrief) {
@@ -111,7 +119,8 @@ class GetReservedCommand extends \sammo\BaseAPI
'turnTerm' => $turnTerm,
'date' => TimeUtil::now(true),
'chiefList' => $nationChiefList,
'isChief'=>($me['officer_level'] > 4),
'troopList' => $troopList,
'isChief' => ($me['officer_level'] > 4),
'autorun_limit' => $generalObj->getAuxVar('autorun_limit'),
'officerLevel' => $me['officer_level'],
'commandList' => getChiefCommandTable($generalObj),
+46
View File
@@ -0,0 +1,46 @@
<?php
namespace sammo\API\Troop;
use sammo\Session;
use DateTimeInterface;
use sammo\DB;
class ExitTroop extends \sammo\BaseAPI
{
public function validateArgs(): ?string
{
return null;
}
public function getRequiredSessionMode(): int
{
return static::REQ_GAME_LOGIN;
}
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
{
$generalID = $session->generalID;
$db = DB::db();
$troopID = $db->queryFirstField('SELECT troop FROM general WHERE no = %i', $generalID);
if($troopID == 0){
return '부대에 소속되어 있지 않습니다.';
}
if($generalID != $troopID){
$db->update('general', [
'troop' => 0,
], '`no` = %i', $generalID);
return null;
}
//부대장이다.
$db->update('general', [
'troop' => 0,
], '`troop` = %i', $troopID);
$db->delete('troop', 'troop_leader = %i', $troopID);
return null;
}
}
+59
View File
@@ -0,0 +1,59 @@
<?php
namespace sammo\API\Troop;
use sammo\Session;
use DateTimeInterface;
use sammo\DB;
use sammo\StringUtil;
use sammo\Validator;
class JoinTroop extends \sammo\BaseAPI
{
public function validateArgs(): ?string
{
$v = new Validator($this->args);
$v->rule('required', [
'troopID',
])
->rule('integer', 'troopID');
if (!$v->validate()) {
return $v->errorStr();
}
return null;
}
public function getRequiredSessionMode(): int
{
return static::REQ_GAME_LOGIN;
}
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
{
$userID = $session->userID;
$troopID = $this->args['troopID'];
$db = DB::db();
$me = $db->queryFirstRow('SELECT `no`,nation,`troop`,`officer_level`,permission,penalty FROM general WHERE `owner`=%i', $userID);
if ($me['troop'] != 0) {
return '이미 부대에 소속되어 있습니다.';
}
$nationID = $me['nation'];
if ($nationID == 0) {
return '국가에 소속되어 있지 않습니다.';
}
$troopExists = $db->queryFirstField('SELECT `troop_leader` FROM `troop` WHERE `troop_leader` = %i AND `nation` = %i', $troopID, $nationID);
if (!$troopExists) {
return '부대가 올바르지 않습니다.';
}
$generalID = $me['no'];
$db->update('general', [
'troop' => $troopID,
], '`no` = %i AND `troop` = %i', $generalID, 0);
return null;
}
}
+57
View File
@@ -0,0 +1,57 @@
<?php
namespace sammo\API\Troop;
use sammo\Session;
use DateTimeInterface;
use sammo\DB;
use sammo\Validator;
class KickFromTroop extends \sammo\BaseAPI
{
public function validateArgs(): ?string
{
$v = new Validator($this->args);
$v->rule('required', [
'troopID',
'generalID',
])
->rule('integer', 'troopID')
->rule('integer', 'generalID');
if (!$v->validate()) {
return $v->errorStr();
}
return null;
}
public function getRequiredSessionMode(): int
{
return static::REQ_GAME_LOGIN;
}
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
{
$generalID = $this->args['generalID'];
$db = DB::db();
$troopID = $db->queryFirstField('SELECT troop FROM general WHERE no = %i', $generalID);
if($troopID == 0){
return '부대에 소속되어 있지 않습니다.';
}
if($troopID != $this->args['troopID']){
return '다른 부대에 소속되어 있습니다.';
}
if($troopID == $generalID){
return '부대장을 추방할 수 없습니다.';
}
$db->update('general', [
'troop' => 0,
], '`no` = %i AND `troop` = %i', $generalID, $troopID);
return null;
}
}
+68
View File
@@ -0,0 +1,68 @@
<?php
namespace sammo\API\Troop;
use sammo\Session;
use DateTimeInterface;
use sammo\DB;
use sammo\StringUtil;
use sammo\Validator;
class NewTroop extends \sammo\BaseAPI
{
public function validateArgs(): ?string
{
$v = new Validator($this->args);
$v->rule('required', [
'troopName',
])
->rule('stringWidthBetween', 'troopName', 1, 18);
if (!$v->validate()) {
return $v->errorStr();
}
return null;
}
public function getRequiredSessionMode(): int
{
return static::REQ_GAME_LOGIN;
}
public function launch(Session $session, ?DateTimeInterface $modifiedSince, ?string $reqEtag)
{
$userID = $session->userID;
$troopName = StringUtil::neutralize($this->args['troopName']);
if(!$troopName){
return '부대 이름이 없습니다.';
}
$db = DB::db();
$me = $db->queryFirstRow('SELECT `no`,nation,`troop`,`officer_level`,permission,penalty FROM general WHERE `owner`=%i', $userID);
if($me['troop'] != 0){
return '이미 부대에 소속되어 있습니다.';
}
$nationID = $me['nation'];
if($nationID == 0){
return '국가에 소속되어 있지 않습니다.';
}
$generalID = $me['no'];
$db->insert('troop', [
'name'=>$troopName,
'troop_leader'=>$generalID,
'nation'=>$nationID,
]);
if($db->affectedRows() == 0){
return '부대가 생성되지 않았습니다. 버그일 수 있습니다.';
}
$db->update('general', [
'troop'=>$generalID
], '`no` = %i', $generalID);
return null;
}
}
+65
View File
@@ -0,0 +1,65 @@
<?php
namespace sammo\API\Troop;
use sammo\Session;
use DateTimeInterface;
use sammo\DB;
use sammo\StringUtil;
use sammo\Validator;
use function sammo\checkSecretPermission;
class SetTroopName extends \sammo\BaseAPI
{
public function validateArgs(): ?string
{
$v = new Validator($this->args);
$v->rule('required', [
'troopID',
'troopName',
])
->rule('stringWidthBetween', 'troopName', 1, 18)
->rule('integer', 'troopID');
if (!$v->validate()) {
return $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)
{
$userID = $session->userID;
$db = DB::db();
$me = $db->queryFirstRow('SELECT `no`,nation,`officer_level`,permission,penalty FROM general WHERE `owner`=%i', $userID);
$permission = checkSecretPermission($me, false);
$troopID = $this->args['troopID'];
$generalID = $me['no'];
if($generalID != $troopID && $permission < 4){
return "권한이 부족합니다.";
}
$troopName = StringUtil::neutralize($this->args['troopName']);
if(!$troopName){
return '부대 이름이 없습니다.';
}
$nationID = $me['nation'];
$db->update('troop', [
'name'=>$troopName
], 'troop_leader=%i AND `nation`=%i',$troopID, $nationID);
if($db->affectedRows() == 0){
return '부대가 없습니다.';
}
return null;
}
}
@@ -7,13 +7,13 @@ class che_간파_노군입산부 extends \sammo\BaseItem{
protected $rawName = '노군입산부';
protected $name = '노군입산부(간파)';
protected $info = '[전투] 상대 회피 확률 -30%p, 상대 필살 확률 -10%p';
protected $info = '[전투] 상대 회피 확률 -25%p, 상대 필살 확률 -10%p';
protected $cost = 200;
protected $consumable = false;
public function onCalcOpposeStat(General $general, string $statName, $value, $aux=null){
if($statName === 'warAvoidRatio'){
return $value - 0.30;
return $value - 0.25;
}
if($statName === 'warCriticalRatio'){
return $value - 0.10;
@@ -12,10 +12,15 @@ class che_격노_구정신단경 extends \sammo\BaseItem{
protected $rawName = '구정신단경';
protected $name = '구정신단경(격노)';
protected $info = '[전투] 상대방 필살 시 격노(필살) 발동, 회피 시도시 25% 확률로 격노 발동, 공격 시 일정 확률로 진노(1페이즈 추가)';
protected $info = '[전투] 상대방 필살 시 격노(필살) 발동, 회피 시도시 25% 확률로 격노 발동, 공격 시 일정 확률로 진노(1페이즈 추가), 격노마다 대미지 5% 추가 중첩';
protected $cost = 200;
protected $consumable = false;
public function getWarPowerMultiplier(WarUnit $unit):array{
$activatedCnt = $unit->hasActivatedSkillOnLog('격노');
return [1 + 0.05*$activatedCnt, 1];
}
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller(
new che_격노시도($unit, che_격노시도::TYPE_ITEM),
+2 -2
View File
@@ -5,8 +5,8 @@ use \sammo\General;
class che_계략_향낭 extends \sammo\BaseItem{
protected $rawName = '항냥';
protected $name = '항냥(계략)';
protected $rawName = '향낭';
protected $name = '향낭(계략)';
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +50%p';
protected $cost = 3000;
protected $consumable = true;
@@ -8,13 +8,13 @@ class che_내정_납금박산로 extends \sammo\BaseItem{
protected $rawName = '납금박산로';
protected $name = '납금박산로(내정)';
protected $info = '[내정] 내정 성공률 +20%p';
protected $info = '[내정] 내정 성공률 +15%p';
protected $cost = 200;
protected $consumable = false;
public function onCalcStrategic(string $turnType, string $varType, $value){
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null): float{
if(in_array($turnType, ['상업', '농업', '기술', '성벽', '수비', '치안', '민심', '인구'])){
if($varType == 'success') return $value + 0.2;
if($varType == 'success') return $value + 0.15;
}
return $value;
}

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