Compare commits

..
90 Commits
Author SHA1 Message Date
Hide_D f33e645113 초반 m장 스탯 관련 문제 해결, 장수 선택 term 해결 2021-01-01 21:09:43 +09:00
Hide_D 528d30c317 의병모집 버그 수정 2021-01-01 19:56:29 +09:00
Hide_D 7f0a3d320c 버그 수정
- 의병 모집
- 장수 변경 시 생성 폼 남음
2021-01-01 19:54:28 +09:00
Hide_D 8e940aeb65 버그 수정. 시간 변경 2020-12-31 16:21:57 +09:00
Hide_D a77ee60809 버그.. 2020-12-31 13:34:37 +09:00
Hide_D 83383c29cd 버그 수정2 2020-12-31 13:33:45 +09:00
Hide_D b6393141e8 버그 수정 2020-12-31 13:29:57 +09:00
Hide_D 10ce1827d8 버그 수정 2020-12-31 13:27:11 +09:00
Hide_D 605f3a12ff select pool 수 증가 2020-12-31 13:24:33 +09:00
Hide_D a33539e75f 턴 변경을 합리적으로 변경 2020-12-31 08:09:23 +09:00
Hide_D b2cca3687a 버그 수정 2020-12-31 07:49:33 +09:00
Hide_D 628c54044f general_pool 에서 장수 선택 기능 추가 2020-12-31 07:43:56 +09:00
Hide_D c0e7a3eece readme 수정 2020-12-27 19:49:39 +09:00
Hide_D c7c13c19c1 일부 수정
composer update, README.md 업데이트
2020-12-27 02:11:53 +09:00
Hide_D d5f71b5878 DummySession 준비 2020-12-26 15:48:05 +09:00
Hide_D cb589e9e26 종전수락 버그 수정 2020-12-13 22:05:07 +09:00
Hide_D eaeed47297 도시 정보 출력 순서 변경 2020-11-11 23:34:53 +09:00
Hide_D e00e5c5cd7 이벤트 빼빼로 추가 2020-11-11 23:04:08 +09:00
Hide_D b3719f7166 수극 연속 사용 버그 수정 2020-09-09 14:20:15 +09:00
Hide_D 337896974b 피장파장 로그 버그 수정 2020-09-09 14:20:15 +09:00
Hide_D bb7d1fc9ab 수몰을 아무 국가에나 쓸 수 있는 버그 수정 2020-09-09 14:20:15 +09:00
Hide_D 07765c8d44 훈사 제한 버그 2020-08-17 09:21:37 +09:00
Hide_D 85cb91071e 기본 도시 정보 데이터 대폭 추가 2020-08-15 03:46:43 +09:00
Hide_D d41839845a 귀병 첫 페이즈 매우 높은 확률로 계략 시도 2020-08-11 22:43:45 +09:00
Hide_D c3d12aa55f 전쟁/선포 중인 국가에 선포 확률 대폭 감소 2020-08-11 22:36:26 +09:00
Hide_D a781e4b84c 인탐 성공 시 확률따라 추가 보정, 인탐/의병 지장 버그 수정 2020-08-11 22:33:50 +09:00
Hide_D 1fc0989fd2 계략 강화, 탈취량 시간에 따라 증가 2020-08-11 22:33:00 +09:00
Hide_D 14752260d3 회피 필살 중첩 가능 2020-07-24 14:19:05 +09:00
Hide_D 84675c874f 이호경식 버그 수정 2020-07-21 22:38:53 +09:00
Hide_D f30e6057be 버그 테스트 2020-07-21 22:34:10 +09:00
Hide_D ba8b629f0e 격노비급 버그 수정 2020-07-21 03:41:27 +09:00
Hide_D a0a45ff2aa 격노 비급 버그 수정 2020-07-21 03:32:37 +09:00
Hide_D 325f890a0b 방랑시 버그 수정 2020-07-20 23:24:15 +09:00
Hide_D 923cac5408 전략 턴 버그 수정. 글로벌 쿨 9턴으로 변경 2020-07-17 00:16:48 +09:00
Hide_D 23505326c7 격노 추가 향상 2020-07-16 02:57:37 +09:00
Hide_D 5f1a48f523 아이템 짝 안맞는 것 수정 2020-07-16 02:38:40 +09:00
Hide_D a607d39030 아이템 수정 2020-07-16 02:31:18 +09:00
Hide_D 96d108729e 위압 사기버그 수정 2020-07-15 11:55:35 +09:00
Hide_D ef15adaaf8 저격 약간 더 강화 2020-07-15 02:56:31 +09:00
Hide_D f190b74a7e 필살 조금 더 강화 2020-07-15 02:52:14 +09:00
Hide_D edbc2b88b6 버그 수정 2020-07-15 02:43:00 +09:00
Hide_D dc000cecf1 전특 대 개편 2020-07-15 02:33:21 +09:00
Hide_D 7c95a483df 기본 스탯 향상 2020-07-13 23:25:33 +09:00
Hide_D 27e5d73da1 전략별 쿨타임 적용 2020-07-13 23:21:21 +09:00
Hide_D 6306dae92d 전략 사용 방식 변경 2020-07-13 21:54:32 +09:00
Hide_D a427ddff83 수동 토너먼트 버그 수정 2020-07-07 15:24:48 +09:00
Hide_D b62ee6e820 버그 수정 2020-06-26 23:33:39 +09:00
Hide_D 3c18666080 로그인 form draw 예시 2020-06-26 23:31:45 +09:00
Hide_D 40968b301a file_cache_준비 2020-06-26 21:24:24 +09:00
Hide_D 05904d31fd webp 지원 2020-06-26 02:43:46 +09:00
Hide_D 75aeaf4ee7 후방워프 버그 수정 2020-06-26 02:30:35 +09:00
Hide_D ff4e67a9f6 중립턴, 내정워프 수정 2020-06-26 02:26:59 +09:00
Hide_D 5f672d5bd1 몰수 기준 완화 2020-06-26 00:16:56 +09:00
Hide_D 5cb39eba8b 전특 초기화에서 '쿨'을 감안함 2020-06-25 23:45:09 +09:00
Hide_D 4d8c3c75d6 새 금쌀 구매 로직 2020-06-25 23:43:35 +09:00
Hide_D 8bdd19fc06 버그 수정 2020-06-21 17:07:03 +09:00
Hide_D 0ec99d8ba1 서버 커스터마이징 가능 2020-06-21 17:03:32 +09:00
Hide_D 929d2db5a5 유저장 구출 버그 수정 예상 2020-06-20 21:43:28 +09:00
Hide_D a7ad77f433 최근 전투 페이즈 계산 버그 수정 2020-06-20 15:09:35 +09:00
Hide_D 9cd47d5deb recent_war 표기 방식 변경경 2020-06-19 20:24:50 +09:00
Hide_D 3cb5691aae 수비 기호 표시 추가 2020-06-18 01:05:34 +09:00
Hide_D dce63919fa 부대유저장발령 코드 일부 수정 2020-06-17 03:39:22 +09:00
Hide_D 1cdbedcb96 도시 치료 결과가 이상하게 뜨는 버그 수정 2020-06-16 00:26:45 +09:00
Hide_D 1586712ce5 버그 수정 2020-06-12 22:11:19 +09:00
Hide_D f059186494 구출 발령 활성화 안된 버그 수정 2020-06-12 22:08:56 +09:00
Hide_D 0af0be57b0 전방 발령 버그 수정 2020-06-12 21:16:37 +09:00
Hide_D dad2b03212 ExistsDestNation 버그 수정 2020-06-12 20:39:31 +09:00
Hide_D b6e307660f warning 수정 2020-06-12 20:28:50 +09:00
Hide_D c21c14825a 오타 수정 2020-06-11 03:28:10 +09:00
Hide_D 39f9c986e9 버그 수정 2020-06-11 03:21:26 +09:00
Hide_D 393683aebc 버그 수정 2020-06-11 03:14:12 +09:00
Hide_D a87fcb44a6 전투 시뮬레이터 장수 불러오기 완성 2020-06-11 03:13:02 +09:00
Hide_D 0a6496ddfb 관직 비우기 안되는 것 수정 2020-06-11 00:29:36 +09:00
Hide_D fa2841fac6 원조 버그 수정 2020-06-11 00:20:08 +09:00
Hide_D 861e45419b 포상 검사 로직 빠진 부분 수정 2020-06-09 20:50:57 +09:00
Hide_D 15fd943456 전쟁장 판단 기준 임시 수정, 사망 대비 장수에겐 포상안함 2020-06-09 20:32:49 +09:00
Hide_D b538bfc27e Merge branch 'devel' of ssh://storage.hided.net:2525/devsam/core into devel 2020-06-09 20:30:41 +09:00
Hide_D e0f32eddc4 전쟁장 판별 코드 임시 수정 2020-06-09 20:30:34 +09:00
Hide_D 75a704c196 저격시 아이템이 무조건 소모되는 버그 수정 2020-06-09 01:45:52 +09:00
Hide_D 6565fdbe7e 무장 신산 가능 2020-06-09 01:25:35 +09:00
Hide_D 6248d72852 홀짝 버그 수정 2020-06-09 01:10:21 +09:00
Hide_D 00d1797b96 내특 동작 안하는 버그 수정 2020-06-09 01:03:58 +09:00
Hide_D 911194eba8 찐유저무쌍 비급판 2020-06-07 16:08:04 +09:00
Hide_D 0fad3ae31d 유지비를 깎고 세수를 계산하도록 수정 2020-06-06 19:21:51 +09:00
Hide_D b6988d866a 선포 동안에는 초토화 가능하도록 수정 2020-06-06 15:43:29 +09:00
Hide_D e30959a656 숙련전환 효율 향상 2020-06-06 14:33:21 +09:00
Hide_D 52eeff3466 환약 사용 여부가 안보이는 버그 수정 2020-06-06 13:45:31 +09:00
Hide_D a06ded552d 유저장은 자동 사령턴 켬끔 가능 2020-06-06 13:20:01 +09:00
Hide_D e9b8a84243 전방 발령에 공백지 배제 2020-06-06 12:55:34 +09:00
Hide_D 1fc3cfd1f2 중립 인탐 확률 감소 2020-06-06 03:07:00 +09:00
259 changed files with 35185 additions and 20052 deletions
+3
View File
@@ -29,12 +29,15 @@ d_shared
d_pic/*.jpg d_pic/*.jpg
d_pic/*.gif d_pic/*.gif
d_pic/*.png d_pic/*.png
d_pic/*.webp
d_pic/uploaded_image d_pic/uploaded_image
d_setting/*.php d_setting/*.php
*/d_setting/*.php */d_setting/*.php
*/d_setting/templates/*.php */d_setting/templates/*.php
*/data/file_cache
**/old/* **/old/*
test.php test.php
+5 -5
View File
@@ -9,18 +9,18 @@
* <code>mpm_event</code> 권장 * <code>mpm_event</code> 권장
* PHP 7.3 이상 * PHP 7.3 이상
* <code>php-fpm</code> 권장 * <code>php-fpm</code> 권장
* php에서 curl, pdo-sqlite을 실행가능해야 합니다. (기본값: 지원) * php에서 curl, pdo-sqlite을 실행가능해야 합니다.
* mysqlnd가 지원되어야합니다. (기본값: 지원) * mysqli, mysqlnd
* mysqli
* gd * gd
* mbstring
* MariaDB 10.2.1 이상 * MariaDB 10.2.1 이상
* 현재 MySQL은 지원하지 않습니다. * 현재 MySQL은 지원하지 않습니다.
* <code>git</code> * <code>git</code>
* <code>curl</code> * <code>curl</code>
Linux는 Ubuntu 16.04, 18.04, Windows는 Windows 10에서 XAMPP를 사용한 환경에서 테스트되었습니다. Linux는 Ubuntu 18.04, 20.04, Windows는 Windows 10에서 XAMPP, WSL2를 사용한 환경에서 테스트되었습니다.
Docker를 이용한 설치는 계획중입니다. Docker를 이용한 설치는 테스트버전만 제공됩니다.
## Docker를 이용한 설치 ## Docker를 이용한 설치
+2 -1
View File
@@ -27,7 +27,8 @@
"xemlock/htmlpurifier-html5": "^0.1.7", "xemlock/htmlpurifier-html5": "^0.1.7",
"catfan/medoo": "^1.5", "catfan/medoo": "^1.5",
"phan/phan": "^2.7", "phan/phan": "^2.7",
"erusev/parsedown-extra": "^0.8.1" "erusev/parsedown-extra": "^0.8.1",
"nette/caching": "^3.0"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
Generated
+208 -1
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "1c2e0182ebdf9bfe795e52a5d7fc6abd", "content-hash": "ab1175c8592ba7f7756d5f02a3aa051c",
"packages": [ "packages": [
{ {
"name": "brandonwamboldt/utilphp", "name": "brandonwamboldt/utilphp",
@@ -843,6 +843,213 @@
"description": "Map nested JSON structures onto PHP classes", "description": "Map nested JSON structures onto PHP classes",
"time": "2020-04-16T18:48:43+00:00" "time": "2020-04-16T18:48:43+00:00"
}, },
{
"name": "nette/caching",
"version": "v3.0.1",
"source": {
"type": "git",
"url": "https://github.com/nette/caching.git",
"reference": "b9ecbf920f240bd1ab14900d9a77876924ad7fb4"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/caching/zipball/b9ecbf920f240bd1ab14900d9a77876924ad7fb4",
"reference": "b9ecbf920f240bd1ab14900d9a77876924ad7fb4",
"shasum": ""
},
"require": {
"nette/finder": "^2.4 || ^3.0",
"nette/utils": "^2.4 || ^3.0",
"php": ">=7.1"
},
"require-dev": {
"latte/latte": "^2.4",
"nette/di": "^v3.0",
"nette/tester": "^2.0",
"tracy/tracy": "^2.4"
},
"suggest": {
"ext-pdo_sqlite": "to use SQLiteStorage or SQLiteJournal"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.0-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause",
"GPL-2.0",
"GPL-3.0"
],
"authors": [
{
"name": "David Grudl",
"homepage": "https://davidgrudl.com"
},
{
"name": "Nette Community",
"homepage": "https://nette.org/contributors"
}
],
"description": "⏱ Nette Caching: library with easy-to-use API and many cache backends.",
"homepage": "https://nette.org",
"keywords": [
"cache",
"journal",
"memcached",
"nette",
"sqlite"
],
"time": "2019-11-19T18:41:40+00:00"
},
{
"name": "nette/finder",
"version": "v2.5.2",
"source": {
"type": "git",
"url": "https://github.com/nette/finder.git",
"reference": "4ad2c298eb8c687dd0e74ae84206a4186eeaed50"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/finder/zipball/4ad2c298eb8c687dd0e74ae84206a4186eeaed50",
"reference": "4ad2c298eb8c687dd0e74ae84206a4186eeaed50",
"shasum": ""
},
"require": {
"nette/utils": "^2.4 || ^3.0",
"php": ">=7.1"
},
"conflict": {
"nette/nette": "<2.2"
},
"require-dev": {
"nette/tester": "^2.0",
"phpstan/phpstan": "^0.12",
"tracy/tracy": "^2.3"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.5-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause",
"GPL-2.0",
"GPL-3.0"
],
"authors": [
{
"name": "David Grudl",
"homepage": "https://davidgrudl.com"
},
{
"name": "Nette Community",
"homepage": "https://nette.org/contributors"
}
],
"description": "🔍 Nette Finder: find files and directories with an intuitive API.",
"homepage": "https://nette.org",
"keywords": [
"filesystem",
"glob",
"iterator",
"nette"
],
"time": "2020-01-03T20:35:40+00:00"
},
{
"name": "nette/utils",
"version": "v3.1.2",
"source": {
"type": "git",
"url": "https://github.com/nette/utils.git",
"reference": "488f58378bba71767e7831c83f9e0fa808bf83b9"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/utils/zipball/488f58378bba71767e7831c83f9e0fa808bf83b9",
"reference": "488f58378bba71767e7831c83f9e0fa808bf83b9",
"shasum": ""
},
"require": {
"php": ">=7.1"
},
"require-dev": {
"nette/tester": "~2.0",
"phpstan/phpstan": "^0.12",
"tracy/tracy": "^2.3"
},
"suggest": {
"ext-gd": "to use Image",
"ext-iconv": "to use Strings::webalize(), toAscii(), chr() and reverse()",
"ext-intl": "to use Strings::webalize(), toAscii(), normalize() and compare()",
"ext-json": "to use Nette\\Utils\\Json",
"ext-mbstring": "to use Strings::lower() etc...",
"ext-tokenizer": "to use Nette\\Utils\\Reflection::getUseStatements()",
"ext-xml": "to use Strings::length() etc. when mbstring is not available"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "3.1-dev"
}
},
"autoload": {
"classmap": [
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"BSD-3-Clause",
"GPL-2.0-only",
"GPL-3.0-only"
],
"authors": [
{
"name": "David Grudl",
"homepage": "https://davidgrudl.com"
},
{
"name": "Nette Community",
"homepage": "https://nette.org/contributors"
}
],
"description": "🛠 Nette Utils: lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.",
"homepage": "https://nette.org",
"keywords": [
"array",
"core",
"datetime",
"images",
"json",
"nette",
"paginator",
"password",
"slugify",
"string",
"unicode",
"utf-8",
"utility",
"validation"
],
"time": "2020-05-27T09:58:51+00:00"
},
{ {
"name": "pguardiario/phpuri", "name": "pguardiario/phpuri",
"version": "1.0", "version": "1.0",
Regular → Executable
BIN
View File
Binary file not shown.
+77 -18
View File
@@ -1,19 +1,34 @@
@charset "utf-8"; @charset "utf-8";
body { body {
color:white; background-color:black; font-family: '맑은 고딕'; color: white;
background-color: black;
font-family: '맑은 고딕';
} }
table { table {
border: solid 1px; border-spacing: 0px; border-collapse: separate; border-top-color: gray; border-left-color: gray; border-right-color: black; border-bottom-color: black; border: solid 1px;
border-spacing: 0px;
border-collapse: separate;
border-top-color: gray;
border-left-color: gray;
border-right-color: black;
border-bottom-color: black;
padding: 0px; padding: 0px;
font-size: 13px; font-size: 13px;
word-break: break-all; word-break: break-all;
text-align: center; text-align: center;
font-family: '맑은 고딕'; font-family: '맑은 고딕';
} }
th, td {
border: solid 1px; border-spacing: 0px; border-collapse: separate; border-top-color: gray; border-left-color: gray; border-right-color: black; border-bottom-color: black; th,
td {
border: solid 1px;
border-spacing: 0px;
border-collapse: separate;
border-top-color: gray;
border-left-color: gray;
border-right-color: black;
border-bottom-color: black;
padding: 0px; padding: 0px;
font-size: 13px; font-size: 13px;
word-break: break-all; word-break: break-all;
@@ -39,19 +54,27 @@ a.just_link {
.section_title { .section_title {
height: 50px; height: 50px;
line-height: 50px; line-height: 50px;
font-size: 30px; font-weight: bold; font-size: 30px;
font-weight: bold;
text-align: center; text-align: center;
color: white; color: white;
padding: 0; padding: 0;
} }
.legacy_layout div { .legacy_layout div {
border: solid 1px; border-spacing: 0px; border-collapse: separate; border-top-color: gray; border-left-color: gray; border-right-color: black; border-bottom-color: black; border: solid 1px;
border-spacing: 0px;
border-collapse: separate;
border-top-color: gray;
border-left-color: gray;
border-right-color: black;
border-bottom-color: black;
padding: 0px; padding: 0px;
font-size: 13px; font-size: 13px;
word-break: break-all; word-break: break-all;
text-align: center; text-align: center;
font-family: '맑은 고딕';; font-family: '맑은 고딕';
;
} }
.obj_fill { .obj_fill {
@@ -62,7 +85,8 @@ a.just_link {
button.with_skin { button.with_skin {
padding: 0 4px; padding: 0 4px;
background-color: black; color: white; background-color: black;
color: white;
font-family: '맑은 고딕'; font-family: '맑은 고딕';
font-size: 13px; font-size: 13px;
} }
@@ -72,7 +96,8 @@ button.with_skin:disabled {
} }
input.with_skin { input.with_skin {
background-color: black; color: white; background-color: black;
color: white;
font-family: '맑은 고딕'; font-family: '맑은 고딕';
font-size: 13px; font-size: 13px;
} }
@@ -81,18 +106,34 @@ input.with_skin:disabled {
background-color: #333333; background-color: #333333;
} }
.font0 { font-size: 10px; } .font0 {
.font1 { font-size: 13px; } font-size: 10px;
.font2 { font-size: 15px; } }
.font3 { font-size: 20px; }
.font4 { font-size: 30px; } .font1 {
.font5 { font-size: 50px; } font-size: 13px;
}
.font2 {
font-size: 15px;
}
.font3 {
font-size: 20px;
}
.font4 {
font-size: 30px;
}
.font5 {
font-size: 50px;
}
caption.section_title { caption.section_title {
caption-side: top; caption-side: top;
} }
.samButton { .samButton {
float: left; float: left;
display: block; display: block;
@@ -123,7 +164,6 @@ a.samButton.disabled {
border: inset 2px white; border: inset 2px white;
} }
.samButtonInner { .samButtonInner {
display: table-cell; display: table-cell;
vertical-align: middle; vertical-align: middle;
@@ -180,3 +220,22 @@ a.samButton.disabled {
color: rgba(0, 0, 0, 0); color: rgba(0, 0, 0, 0);
font-size: 0; font-size: 0;
} }
.vertical_flex {
height: 100%;
display: flex;
align-content: center;
flex-direction: column;
align-items: stretch;
}
.vertical_flex .item {
display: block;
flex-grow: 1;
}
.fill_box {
display: block;
width: 100%;
height: 100%;
}
+48 -33
View File
@@ -1,5 +1,4 @@
@charset "utf-8"; @charset "utf-8";
body { body {
line-height: 1.3; line-height: 1.3;
} }
@@ -25,18 +24,6 @@ body{
height: 66px; height: 66px;
} }
#server_list .server_create_and_select .general_create,
#server_list .server_create_and_select .general_select {
width: 120px; height: 33px;
float: left;
}
#server_list .general_create,
#server_list .general_login {
width: 120px; height: 66px;
float: left;
}
.ignore_border { .ignore_border {
border: 0; border: 0;
margin: 0; margin: 0;
@@ -45,10 +32,10 @@ body{
#user_info { #user_info {
margin-top: 20px; margin-top: 20px;
width: 800px; height: 130px; width: 800px;
height: 130px;
} }
#user_info button { #user_info button {
width: 200px; width: 200px;
height: 50px; height: 50px;
@@ -60,82 +47,110 @@ body{
} }
.Entrance_ServerList { .Entrance_ServerList {
width: 800px; height: 64px; width: 800px;
height: 64px;
border: none; border: none;
float: left; float: left;
} }
.Entrance_ServerListServer { .Entrance_ServerListServer {
width: 98px; height: 64px; width: 98px;
height: 64px;
float: left; float: left;
} }
.Entrance_ServerListDown { .Entrance_ServerListDown {
width: 698px; height: 64px; width: 698px;
height: 64px;
float: left; float: left;
} }
.Entrance_ServerListInfo { .Entrance_ServerListInfo {
width: 398px; height: 64px; width: 398px;
height: 64px;
float: left; float: left;
} }
.Entrance_ServerListBlock { .Entrance_ServerListBlock {
width: 298px; height: 64px; width: 298px;
height: 64px;
float: left; float: left;
line-height: 64px; line-height: 64px;
} }
.Entrance_ServerListCharacter { .Entrance_ServerListCharacter {
width: 64px; height: 64px; width: 64px;
height: 64px;
float: left; float: left;
} }
.Entrance_ServerListName { .Entrance_ServerListName {
width: 112px; height: 64px; width: 112px;
height: 64px;
float: left; float: left;
line-height: 64px; line-height: 64px;
} }
.Entrance_ServerListSelect { .Entrance_ServerListSelect {
width: 120px; height: 32px; width: 120px;
height: 32px;
float: left; float: left;
} }
#Entrance_000003 { #Entrance_000003 {
width: 798px; height: 155px; width: 798px;
height: 155px;
text-align: left; text-align: left;
} }
.Entrance_Alert { .Entrance_Alert {
color: red; font-size: 15px; font-weight: bold; color: red;
font-size: 15px;
font-weight: bold;
} }
.Entrance_Che { .Entrance_Che {
color: white; font-size: 15px; font-weight: bold; color: white;
font-size: 15px;
font-weight: bold;
} }
.Entrance_Kwe { .Entrance_Kwe {
color: yellow; font-size: 15px; font-weight: bold; color: yellow;
font-size: 15px;
font-weight: bold;
} }
.Entrance_Pwe { .Entrance_Pwe {
color: orange; font-size: 15px; font-weight: bold; color: orange;
font-size: 15px;
font-weight: bold;
} }
.Entrance_Twe { .Entrance_Twe {
color: magenta; font-size: 15px; font-weight: bold; color: magenta;
font-size: 15px;
font-weight: bold;
} }
.Entrance_Nya { .Entrance_Nya {
color: #e67e22; font-size: 15px; font-weight: bold; color: #e67e22;
font-size: 15px;
font-weight: bold;
} }
.Entrance_Pya { .Entrance_Pya {
color: #9b59b6; font-size: 15px; font-weight: bold; color: #9b59b6;
font-size: 15px;
font-weight: bold;
} }
.Entrance_Hwe { .Entrance_Hwe {
color: red; font-size: 15px; font-weight: bold; color: red;
font-size: 15px;
font-weight: bold;
}
.BtnPlate {
height: inherit;
} }
+32 -31
View File
@@ -1,4 +1,5 @@
body, html{ body,
html {
height: 100%; height: 100%;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
@@ -41,7 +42,6 @@ input::-webkit-input-placeholder {
-moz-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3); -moz-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
-webkit-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3); -webkit-box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3); box-shadow: 0px 2px 2px rgba(0, 0, 0, 0.3);
} }
.main-center { .main-center {
@@ -49,7 +49,6 @@ input::-webkit-input-placeholder {
margin: 0 auto; margin: 0 auto;
max-width: 330px; max-width: 330px;
padding: 40px 40px; padding: 40px 40px;
} }
.login_btn_group { .login_btn_group {
@@ -61,43 +60,38 @@ input::-webkit-input-placeholder {
text-align: center; text-align: center;
} }
.col-form-label { .col-form-label {
text-align: center; text-align: center;
} }
.terms { .terms {
max-height: 200px; overflow-y: auto; max-height: 200px;
overflow-y: auto;
} }
.terms pre { .terms pre {
width: 100%; width: 100%;
white-space: pre-wrap; /* Since CSS 2.1 */ white-space: pre-wrap;
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ /* Since CSS 2.1 */
white-space: -pre-wrap; /* Opera 4-6 */ white-space: -moz-pre-wrap;
white-space: -o-pre-wrap; /* Opera 7 */ /* Mozilla, since 1999 */
word-wrap: break-word; /* Internet Explorer 5.5+ */ white-space: -pre-wrap;
/* Opera 4-6 */
white-space: -o-pre-wrap;
/* Opera 7 */
word-wrap: break-word;
/* Internet Explorer 5.5+ */
} }
.vertical-center { .vertical-center {
min-height: 100%; /* Fallback for browsers do NOT support vh unit */ min-height: 100%;
min-height: 100vh; /* These two lines are counted as one :-) */ /* Fallback for browsers do NOT support vh unit */
min-height: 100vh;
/* These two lines are counted as one :-) */
display: flex; display: flex;
align-items: center; align-items: center;
} }
.full-content {
position:fixed;
left:0;
top:0;
width:100%;
height:100%;
margin:0;
padding:0;
z-index:800;
}
#login_card { #login_card {
z-index: 801; z-index: 801;
} }
@@ -109,7 +103,8 @@ input::-webkit-input-placeholder {
background-color: transparent; background-color: transparent;
color: transparent; color: transparent;
border: 0; border: 0;
background-size: 100%; /* To fill the dimensions of container (button), or */ background-size: 100%;
/* To fill the dimensions of container (button), or */
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: bottom center; background-position: bottom center;
margin-top: 5px; margin-top: 5px;
@@ -120,12 +115,18 @@ input::-webkit-input-placeholder {
background-image: url('../oauth_kakao/kakao_login_join_ov.png'); background-image: url('../oauth_kakao/kakao_login_join_ov.png');
} }
#bottom_box{
position:fixed;
bottom:0;
width:100%;
left:0;
}
#bottom_box .container { #bottom_box .container {
text-align: center; text-align: center;
} }
.btn-group-xs>.btn,
.btn-xs {
padding: .25rem .4rem;
font-size: .875rem;
line-height: .5;
border-radius: .2rem;
}
#running_map {
margin-top: 20px;
}
+9 -1
View File
@@ -204,7 +204,15 @@ $result = Util::generateFileUsingSimpleTemplate(
'sharedIconPath' => $sharedIconPath, 'sharedIconPath' => $sharedIconPath,
'gameImagePath' => $gameImagePath, 'gameImagePath' => $gameImagePath,
'imageRequestPath' => $imageRequestPath, 'imageRequestPath' => $imageRequestPath,
'imageRequestKey' => $imageRequestKey 'imageRequestKey' => $imageRequestKey,
'serverList' => [
['che', '체', 'white'],
['kwe', '퀘', 'yellow'],
['pwe', '풰', 'orange'],
['twe', '퉤', 'magenta'],
['nya', '냐', '#e67e22'],
['pya', '퍄', '#9b59b6']
]
], ],
true true
); );
+19
View File
@@ -13,6 +13,7 @@ class ServConfig
public static $gameImagePath = "_tK_gameImagePath_"; public static $gameImagePath = "_tK_gameImagePath_";
public static $imageRequestPath = "_tK_imageRequestPath_"; public static $imageRequestPath = "_tK_imageRequestPath_";
public static $imageRequestKey = '_tK_imageRequestKey_'; public static $imageRequestKey = '_tK_imageRequestKey_';
private static $serverList = null;
public static function getSharedIconPath(string $filepath = ''): string public static function getSharedIconPath(string $filepath = ''): string
{ {
@@ -42,6 +43,24 @@ class ServConfig
return static::$imageRequestPath . "?req={$req_hash}&time={$now}"; return static::$imageRequestPath . "?req={$req_hash}&time={$now}";
} }
/**
* 서버 설정 반환
*
* @return \sammo\Setting[]
*/
public static function getServerList(): array{
$servKeyList = [/*_tK_serverList_*/];
$servKeyList[] = ['hwe', '훼', 'red'];
if (self::$serverList === null) {
self::$serverList = [];
foreach($servKeyList as [$servKey, $servNick, $servColor]){
self::$serverList[$servKey] = new Setting(ROOT.'/'.$servKey, $servNick, $servColor);
}
}
return self::$serverList;
}
/** /**
* 서버 주소 반환. 서버의 경로가 하부 디렉토리인 경우에 하부 디렉토리까지 포함 * 서버 주소 반환. 서버의 경로가 하부 디렉토리인 경우에 하부 디렉토리까지 포함
+59 -6
View File
@@ -148,8 +148,30 @@ echo "
unset($city); unset($city);
// 첩보된 도시까지만 허용 // 첩보된 도시까지만 허용
if($valid == 0 && $userGrade < 5) {
$showDetailedInfo = false;
if($valid){
$showDetailedInfo = true;
}
if(!key_exists($citylist, CityConst::all())){
$citylist = $me['city']; $citylist = $me['city'];
$showDetailedInfo = true;
$valid = 1;
}
if($userGrade >= 5){
$valid = true;
}
if(!$valid) {
$ownCities = Util::convertArrayToSetLike($db->queryFirstColumn('SELECT city FROM city WHERE nation = %i AND nation != 0', $me['nation']));
foreach(array_keys(CityConst::byID($citylist)->path) as $pathID){
if(key_exists($pathID, $ownCities)){
$showDetailedInfo = true;
break;
}
}
} }
@@ -172,11 +194,35 @@ if($city['trade'] === null) {
} }
$dbColumns = General::mergeQueryColumn(['npc', 'defence_train', 'no', 'picture', 'imgsvr', 'name', 'injury', 'leadership', 'strength', 'intel', 'officer_level', 'nation', 'crewtype', 'crew', 'train', 'atmos'], 2)[0]; $dbColumns = General::mergeQueryColumn(['npc', 'defence_train', 'no', 'picture', 'imgsvr', 'name', 'injury', 'leadership', 'strength', 'intel', 'officer_level', 'nation', 'crewtype', 'crew', 'train', 'atmos'], 2)[0];
if($showDetailedInfo){
$generals = $db->query( $generals = $db->query(
'SELECT %l from general where city=%i order by name', 'SELECT %l from general where city=%i order by turntime',
Util::formatListOfBackticks($dbColumns), Util::formatListOfBackticks($dbColumns),
$city['city'] $city['city']
); );
}
else{
$generals = [];
}
if($valid){
$city['trustText'] = round($city['trust'], 1);
$city['popRateText'] = round($city['pop']/$city['pop_max']*100, 2);
}
else{
$city['agri'] = '?';
$city['comm'] = '?';
$city['pop'] = '?';
$city['secu'] = '?';
$city['trustText'] = '?';
$city['popRateText'] = '?';
if($city['nation'] != 0){
$city['def'] = '?';
$city['wall'] = '?';
}
}
$generalTurnList = []; $generalTurnList = [];
@@ -257,6 +303,10 @@ foreach($generals as $general){
$crew = $general['crew']; $crew = $general['crew'];
$train = -1; $train = -1;
$atmos = -1; $atmos = -1;
if(!$valid){
$crew = -1;
}
} }
$nation = $general['nation']; $nation = $general['nation'];
@@ -331,7 +381,9 @@ foreach($generalsFormat as $general){
} }
if($general['nation'] != $myNation['nation']){ if($general['nation'] != $myNation['nation']){
$enemyCnt += 1; $enemyCnt += 1;
if($general['crew'] >= 0){
$enemyCrew += $general['crew']; $enemyCrew += $general['crew'];
}
if($general['crew'] > 0){ if($general['crew'] > 0){
$enemyArmedCnt += 1; $enemyArmedCnt += 1;
} }
@@ -402,11 +454,11 @@ foreach($generalsFormat as $general){
</tr> </tr>
<tr> <tr>
<td align=center class=bg1>민심</td> <td align=center class=bg1>민심</td>
<td align=center><?=round($city['trust'], 1)?></td> <td align=center><?=$city['trustText']?></td>
<td align=center class=bg1>시세</td> <td align=center class=bg1>시세</td>
<td align=center><?=$city['trade']?>%</td> <td align=center><?=$city['trade']?>%</td>
<td align=center class=bg1>인구</td> <td align=center class=bg1>인구</td>
<td align=center><?=round($city['pop']/$city['pop_max']*100, 2)?>%</td> <td align=center><?=$city['popRateText']?>%</td>
<td align=center class=bg1>태수</td> <td align=center class=bg1>태수</td>
<td align=center><?=$officer[4]['name']?></td> <td align=center><?=$officer[4]['name']?></td>
<td align=center class=bg1>군사</td> <td align=center class=bg1>군사</td>
@@ -430,11 +482,12 @@ foreach($generalsFormat as $general){
</tr> </tr>
<tr> <tr>
<td align=center class=bg1>장수</td> <td align=center class=bg1>장수</td>
<td colspan=11><?=join(', ', $generalsName)?></td> <td colspan=11><?=$showDetailedInfo?join(', ', $generalsName):'<span style="color:gray">알 수 없음</span>'?></td>
</tr> </tr>
</table> </table>
<br> <br>
<?php if($showDetailedInfo): ?>
<table align=center class='tb_layout bg0'> <table align=center class='tb_layout bg0'>
<thead> <thead>
<tr> <tr>
@@ -459,7 +512,7 @@ foreach($generalsFormat as $general){
?> ?>
</tbody> </tbody>
</table> </table>
<?php endif; ?>
<table align=center width=1000 class='tb_layout bg0'> <table align=center width=1000 class='tb_layout bg0'>
<tr><td><?=backButton()?></td></tr> <tr><td><?=backButton()?></td></tr>
<tr><td><?=banner()?> </td></tr> <tr><td><?=banner()?> </td></tr>
+23 -12
View File
@@ -14,6 +14,7 @@ $generalID = $session->generalID;
$db = DB::db(); $db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env'); $gameStor = KVStorage::getStorage($db, 'game_env');
$gameStor->cacheValues(['turntime', 'opentime', 'autorun_user', 'npcmode']);
increaseRefresh("내정보", 1); increaseRefresh("내정보", 1);
@@ -38,7 +39,7 @@ if($gameStor->turntime <= $gameStor->opentime){
} }
$use_treatment = $me->getAuxVar('use_treatment')??10; $use_treatment = $me->getAuxVar('use_treatment')??10;
$use_auto_nation_turn = $me->getAuxVar('use_auto_nation_turn')??1;
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
@@ -77,20 +78,25 @@ var availableDieImmediately = <?=$availableDieImmediately?'true':'false'?>;
∞<span style='color:orange'>개막직전 남는자리가 있을경우 랜덤하게 참여합니다.</span><br><br> ∞<span style='color:orange'>개막직전 남는자리가 있을경우 랜덤하게 참여합니다.</span><br><br>
환약 사용 【<select id='use_treatment' name='use_treatment'> 환약 사용 【<select id='use_treatment' name='use_treatment'>
<option value=10 <?=$use_treatment==10?"selected":""; ?>>경상</option> <option value=10 <?=($use_treatment==10)?"selected":""; ?>>경상</option>
<option value=20 <?=$use_treatment==21?"selected":""; ?>>중상</option> <option value=21 <?=($use_treatment==21)?"selected":""; ?>>중상</option>
<option value=40 <?=$use_treatment==41?"selected":""; ?>>심각</option> <option value=41 <?=($use_treatment==41)?"selected":""; ?>>심각</option>
<option value=60 <?=$use_treatment==61?"selected":""; ?>>위독</option> <option value=61 <?=($use_treatment==61)?"selected":""; ?>>위독</option>
<option value=100 <?=$use_treatment==100?"selected":""; ?>>사용안함</option> <option value=100 <?=($use_treatment==100)?"selected":""; ?>>사용안함</option>
</select>】<br> </select>】<br>
∞<span style='color:orange'>부상을 입었을 때 환약을 사용하는 기준입니다.</span><br><br> ∞<span style='color:orange'>부상을 입었을 때 환약을 사용하는 기준입니다.</span><br><br>
<?php if(($gameStor->autorun_user['options']['chief'])??false) : ?>
자동 사령턴 허용 【<select id='use_auto_nation_turn' name='use_auto_nation_turn'>
<option value=1 <?=$use_auto_nation_turn?"selected":""; ?>>허용</option>
<option value=0 <?=(!$use_auto_nation_turn)?"selected":""; ?>>허용 안함</option>
</select>】<br>
∞<span style='color:orange'>수뇌가 되었을 때 휴식 턴이어도 적당한 턴을 알아서 넣는 것을 허용합니다.</span><br><br>
<?php endif; ?>
수비 【<select id='defence_train' name='defence_train'> 수비 【<select id='defence_train' name='defence_train'>
<option value=90 <?=$me->getVar('defence_train')==90?"selected":""; ?>>☆(훈사90)</option> <?php foreach([90, 80, 60, 40] as $targetDefenceTrain): ?>
<option value=80 <?=$me->getVar('defence_train')==80?"selected":""; ?>>◎(훈사80)</option> <option value='<?=$targetDefenceTrain?>' <?=$me->getVar('defence_train')==$targetDefenceTrain?"selected":""; ?>><?=formatDefenceTrain($targetDefenceTrain)?>(훈사<?=$targetDefenceTrain?>)</option>
<option value=60 <?=$me->getVar('defence_train')==60?"selected":""; ?>>○(훈사60)</option> <?php endforeach; ?>
<option value=40 <?=$me->getVar('defence_train')==40?"selected":""; ?>>△(훈사40)</option> <option value=999 <?=$me->getVar('defence_train')==999?"selected":""; ?>><?=formatDefenceTrain(999)?>[훈련, 사기 -3]</option>
<option value=999 <?=$me->getVar('defence_train')==999?"selected":""; ?>>×[훈련, 사기 -3]</option>
</select> </select>
】<br><br> 】<br><br>
<input type=<?=$submit?> id='set_my_setting' name=btn style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;height:30px;font-size:13px; value=설정저장><br> <input type=<?=$submit?> id='set_my_setting' name=btn style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;height:30px;font-size:13px; value=설정저장><br>
@@ -107,6 +113,11 @@ var availableDieImmediately = <?=$availableDieImmediately?'true':'false'?>;
<a href="c_die_immediately.php" id='die_immediately'><button type="button" style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;height:30px;font-size:13px;>장수 삭제</button></a><br><br> <a href="c_die_immediately.php" id='die_immediately'><button type="button" style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;height:30px;font-size:13px;>장수 삭제</button></a><br><br>
<?php endif; ?> <?php endif; ?>
<?php if($gameStor->npcmode==2 && $me->getNPCType()==0): ?>
다른 장수 선택 (<?=substr($me->getAuxVar('next_change')??TimeUtil::now(), 0, 19)?> 부터)<br>
<a href="select_general_from_pool.php" id='select_general_from_pool'><button type="button" style=background-color:<?=GameConst::$basecolor2?>;color:white;width:160px;height:30px;font-size:13px;>다른 장수 선택</button></a><br><br>
<?php endif; ?>
개인용 CSS<br> 개인용 CSS<br>
<textarea id='custom_css' style='color:white;background-color:black;width:420px;height:150px;'></textarea> <textarea id='custom_css' style='color:white;background-color:black;width:420px;height:150px;'></textarea>
</td> </td>
+76 -5
View File
@@ -8,7 +8,34 @@ $session = Session::requireLogin()->setReadOnly();
$db = DB::db(); $db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env'); $gameStor = KVStorage::getStorage($db, 'game_env');
$startYear = $gameStor->getValue('startyear'); $gameStor->cacheValues(['startyear', 'year']);
$startYear = $gameStor->startyear;
$year = $gameStor->year;
$me = $db->queryFirstRow('SELECT no, nation, city FROM general WHERE owner =%i', Session::getUserID());
if($me){
$generalID = $me['no'];
$nationID = $me['nation'];
$city = $db->queryFirstRow('SELECT city, level, def, wall FROM city WHERE city = %i', $me['city']);
}
else{
$generalID = 0;
$nationID = 0;
$city = [
'city'=>0,
'level'=>5,
'def'=>1000,
'wall'=>1000,
];
}
if($nationID){
$nation = $db->queryFirstRow('SELECT level, type, tech, capital FROM nation WHERE nation = %i', $nationID);
}
else{
$nation = null;
}
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
@@ -30,6 +57,8 @@ $startYear = $gameStor->getValue('startyear');
<?=WebUtil::printJS('js/common.js')?> <?=WebUtil::printJS('js/common.js')?>
<script> <script>
var defaultSpecialDomestic = '<?=GameConst::$defaultSpecialDomestic?>'; var defaultSpecialDomestic = '<?=GameConst::$defaultSpecialDomestic?>';
var city = <?=Json::encode($city)?>;
var nation = <?=Json::encode($nation)?>;
</script> </script>
<?=WebUtil::printJS('js/battle_simulator.js')?> <?=WebUtil::printJS('js/battle_simulator.js')?>
</head> </head>
@@ -47,7 +76,7 @@ var defaultSpecialDomestic = '<?=GameConst::$defaultSpecialDomestic?>';
<div class="input-group-append"> <div class="input-group-append">
<span class="input-group-text">년 시작</span> <span class="input-group-text">년 시작</span>
</div> </div>
<input type="number" class="form-control" id="year" value="<?=$startYear+3?>" min="<?=$startYear?>"> <input type="number" class="form-control" id="year" value="<?=$year?>" min="<?=$startYear?>">
<div class="input-group-append"> <div class="input-group-append">
<span class="input-group-text">년</span> <span class="input-group-text">년</span>
</div> </div>
@@ -131,7 +160,7 @@ var defaultSpecialDomestic = '<?=GameConst::$defaultSpecialDomestic?>';
<input type="radio" name="is_attacker_capital" class="form_is_capital" value="1" autocomplete="off">Y <input type="radio" name="is_attacker_capital" class="form_is_capital" value="1" autocomplete="off">Y
</label> </label>
<label class="btn btn-secondary active"> <label class="btn btn-secondary active">
<input type="radio" name="is_attacker_capital" class="form_is_capital" value="2" autocomplete="off" checked>N <input type="radio" name="is_attacker_capital" class="form_is_capital" value="0" autocomplete="off">N
</label> </label>
</div> </div>
@@ -145,6 +174,9 @@ var defaultSpecialDomestic = '<?=GameConst::$defaultSpecialDomestic?>';
<div class="card-header"> <div class="card-header">
<div class="float-sm-left" style="line-height:25px;">출병자 설정</div> <div class="float-sm-left" style="line-height:25px;">출병자 설정</div>
<div class="float-sm-right btn-toolbar" role="toolbar"> <div class="float-sm-right btn-toolbar" role="toolbar">
<div class="btn-group btn-group-sm mr-2" role="group">
<button type="button" class="btn btn-success btn-general-import-server">서버에서 가져오기</button>
</div>
<div class="btn-group btn-group-sm mr-2" role="group"> <div class="btn-group btn-group-sm mr-2" role="group">
<button type="button" class="btn btn-info btn-general-save">저장</button> <button type="button" class="btn btn-info btn-general-save">저장</button>
<input type="file" class="form_load_general_file" accept=".json" style="display: none;" /> <input type="file" class="form_load_general_file" accept=".json" style="display: none;" />
@@ -203,7 +235,7 @@ var defaultSpecialDomestic = '<?=GameConst::$defaultSpecialDomestic?>';
<input type="radio" name="is_defender_capital" class="form_is_capital" value="1" autocomplete="off">Y <input type="radio" name="is_defender_capital" class="form_is_capital" value="1" autocomplete="off">Y
</label> </label>
<label class="btn btn-secondary active"> <label class="btn btn-secondary active">
<input type="radio" name="is_defender_capital" class="form_is_capital" value="0" autocomplete="off" checked>N <input type="radio" name="is_defender_capital" class="form_is_capital" value="0" autocomplete="off">N
</label> </label>
</div> </div>
</div> </div>
@@ -236,6 +268,9 @@ var defaultSpecialDomestic = '<?=GameConst::$defaultSpecialDomestic?>';
<div class="card-header"> <div class="card-header">
<div class="float-sm-left" style="line-height:25px;">수비자 설정</div> <div class="float-sm-left" style="line-height:25px;">수비자 설정</div>
<div class="float-sm-right btn-toolbar" role="toolbar"> <div class="float-sm-right btn-toolbar" role="toolbar">
<div class="btn-group btn-group-sm mr-2" role="group">
<button type="button" class="btn btn-success btn-general-import-server">서버에서 가져오기</button>
</div>
<div class="btn-group btn-group-sm mr-2" role="group"> <div class="btn-group btn-group-sm mr-2" role="group">
<button type="button" class="btn btn-info btn-general-save">저장</button> <button type="button" class="btn btn-info btn-general-save">저장</button>
<input type="file" class="form_load_general_file" accept=".json" style="display: none;" /> <input type="file" class="form_load_general_file" accept=".json" style="display: none;" />
@@ -404,7 +439,7 @@ var defaultSpecialDomestic = '<?=GameConst::$defaultSpecialDomestic?>';
<?php endforeach; ?> <?php endforeach; ?>
</select> </select>
</div> </div>
<div class="input-group mb-1"> <div class="input-group mb-3">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text">귀병숙련</span> <span class="input-group-text">귀병숙련</span>
</div> </div>
@@ -425,11 +460,27 @@ var defaultSpecialDomestic = '<?=GameConst::$defaultSpecialDomestic?>';
<span class="input-group-text">수비여부</span> <span class="input-group-text">수비여부</span>
</div> </div>
<select class="custom-select form_defence_train only_defender"> <select class="custom-select form_defence_train only_defender">
<option value="90">훈사 90</option>
<option value="80">훈사 80</option> <option value="80">훈사 80</option>
<option value="60">훈사 60</option> <option value="60">훈사 60</option>
<option value="40">훈사 40</option>
<option value="999">안함</option> <option value="999">안함</option>
</select> </select>
</div> </div>
<div class="input-group mb-1">
<div class="input-group-prepend">
<span class="input-group-text">전투 수</span>
</div>
<input type="number" class="form-control form_warnum" value="0" step="1">
<div class="input-group-prepend">
<span class="input-group-text">승리 수</span>
</div>
<input type="number" class="form-control form_killnum" value="0" step="1">
<div class="input-group-prepend">
<span class="input-group-text">사살 수</span>
</div>
<input type="number" class="form-control form_killcrew" value="0" step="1">
</div>
</div> </div>
</div> </div>
@@ -477,5 +528,25 @@ var defaultSpecialDomestic = '<?=GameConst::$defaultSpecialDomestic?>';
</div> </div>
</div> </div>
</div> </div>
<div id="importModal" class="modal" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">장수 목록</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
<div class="modal-body">
<select id="modalSelector"></select>
<p>타국 장수를 선택한 경우 숙련과 아이템은 0으로 초기화됩니다.</p>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-primary" id='importFromDB'>가져오기</button>
<button type="button" class="btn btn-secondary" data-dismiss="modal">닫기</button>
</div>
</div>
</div>
</div>
</body> </body>
</html> </html>
+33 -13
View File
@@ -1,10 +1,13 @@
@charset "UTF-8"; @charset "UTF-8";
/* font-boostring Block */ /* font-boostring Block */
html * {max-height:1000000px;}
html * {
max-height: 1000000px;
}
html, body{ html,
body {
background-color: black; background-color: black;
color: white; color: white;
line-height: 1.3; line-height: 1.3;
@@ -12,10 +15,23 @@ html, body{
font-size: 13px; font-size: 13px;
} }
table { font-family:'맑은 고딕'; } table {
font { font-family:'맑은 고딕'; } font-family: '맑은 고딕';
input { font-family:'맑은 고딕'; font-size:13px; } }
select { font-family:'굴림'; line-height:100%; }
font {
font-family: '맑은 고딕';
}
input {
font-family: '맑은 고딕';
font-size: 13px;
}
select {
font-family: '굴림';
line-height: 100%;
}
.center { .center {
text-align: center; text-align: center;
@@ -27,13 +43,13 @@ table.mimic_flex{
padding: 0; padding: 0;
} }
.mimic_flex td, .mimic_flex th { .mimic_flex td,
.mimic_flex th {
border: none !important; border: none !important;
padding: 0px; padding: 0px;
word-break: break-all; word-break: break-all;
} }
table.tb_layout { table.tb_layout {
border-collapse: collapse; border-collapse: collapse;
padding: 0px; padding: 0px;
@@ -42,11 +58,13 @@ table.tb_layout {
font-family: '맑은 고딕'; font-family: '맑은 고딕';
} }
.tb_layout td, .tb_layout th { .tb_layout td,
.tb_layout th {
border: solid 1px gray; border: solid 1px gray;
padding: 0px; padding: 0px;
word-break: break-all; word-break: break-all;
font-family: '맑은 고딕';; font-family: '맑은 고딕';
;
} }
div.bar_out { div.bar_out {
@@ -70,6 +88,7 @@ div.bar_out div.bar_in{
width: 100%; width: 100%;
} }
/* */ /* */
.ev_warning { .ev_warning {
@@ -96,6 +115,7 @@ div.bar_out div.bar_in{
color: orangered; color: orangered;
} }
/* TODO: 색상값이 아니라 의미에 따라 클래스 지정 */ /* TODO: 색상값이 아니라 의미에 따라 클래스 지정 */
.o_bullet::before { .o_bullet::before {
@@ -124,8 +144,6 @@ div.bar_out div.bar_in{
color: white; color: white;
} }
.small_war_log .name_plate { .small_war_log .name_plate {
font-size: 0.75em; font-size: 0.75em;
} }
@@ -207,7 +225,8 @@ div.bar_out div.bar_in{
font-size: 0; font-size: 0;
} }
.btn-group-xs > .btn, .btn-xs { .btn-group-xs>.btn,
.btn-xs {
padding: .25rem .4rem; padding: .25rem .4rem;
font-size: .875rem; font-size: .875rem;
line-height: .5; line-height: .5;
@@ -251,6 +270,7 @@ div.bar_out div.bar_in{
background-color: red; background-color: red;
color: white; color: white;
} }
.select2-selection--single.simple-select2-align-center .select2-selection__rendered { .select2-selection--single.simple-select2-align-center .select2-selection__rendered {
text-align: center; text-align: center;
} }
+64
View File
@@ -0,0 +1,64 @@
@charset "UTF-8";
.container {
width: 1000px;
margin: 0 auto;
}
.card_holder {
text-align: center;
}
.general_card {
width: 125px;
display: inline-block;
}
.general_card h4 {
margin: 0;
}
.general_card p {
margin: 0;
}
.general_card .select_btn {
width: 100%;
}
.general_card label {
display: block;
padding-left: 15px;
text-indent: -15px;
}
.general_card input {
width: 13px;
height: 13px;
padding: 0;
margin: 0;
vertical-align: bottom;
position: relative;
top: -1px;
*overflow: hidden;
}
#outdate_token {
color: red;
display: none;
}
#left_pad button {
display: none;
}
.custom_picture {
display: none;
}
.custom_personality {
display: none;
}
.custom_stat {
display: none;
}
+26 -1
View File
@@ -185,7 +185,8 @@ function myNationInfo(General $generalObj)
$db = DB::db(); $db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env'); $gameStor = KVStorage::getStorage($db, 'game_env');
$admin = $gameStor->getValues(['startyear', 'year']); $admin = $gameStor->getValues(['startyear', 'year', 'month']);
$templates = new \League\Plates\Engine(__DIR__ . '/templates');
$nationID = $generalObj->getNationID(); $nationID = $generalObj->getNationID();
$nation = $db->queryFirstRow('SELECT * FROM nation WHERE nation = %i', $nationID)??getNationStaticInfo(0); $nation = $db->queryFirstRow('SELECT * FROM nation WHERE nation = %i', $nationID)??getNationStaticInfo(0);
@@ -200,6 +201,17 @@ function myNationInfo(General $generalObj)
$level12Name = key_exists(12, $topChiefs)?getColoredName($topChiefs[12]['name'], $topChiefs[12]['npc']):'-'; $level12Name = key_exists(12, $topChiefs)?getColoredName($topChiefs[12]['name'], $topChiefs[12]['npc']):'-';
$level11Name = key_exists(11, $topChiefs)?getColoredName($topChiefs[11]['name'], $topChiefs[11]['npc']):'-'; $level11Name = key_exists(11, $topChiefs)?getColoredName($topChiefs[11]['name'], $topChiefs[11]['npc']):'-';
$impossibleStrategicCommandLists = [];
$strategicCommandLists = GameConst::$availableChiefCommand['전략'];
$yearMonth = Util::joinYearMonth($admin['year'], $admin['month']);
foreach($strategicCommandLists as $command){
$cmd = buildNationCommandClass($command, $generalObj, $admin, new LastTurn());
$nextAvailableTurn = $cmd->getNextAvailableTurn();
if($nextAvailableTurn > $yearMonth){
$impossibleStrategicCommandLists[] = [$cmd->getName(), $nextAvailableTurn - $yearMonth];
}
}
echo "<table width=498 class='tb_layout bg2 nation_info'> echo "<table width=498 class='tb_layout bg2 nation_info'>
<tr> <tr>
<td colspan=4 "; <td colspan=4 ";
@@ -282,10 +294,23 @@ function myNationInfo(General $generalObj)
} else { } else {
if ($nation['strategic_cmd_limit'] != 0) { if ($nation['strategic_cmd_limit'] != 0) {
$nation['strategic_cmd_limit'] = "<font color=red>{$nation['strategic_cmd_limit']}턴</font>"; $nation['strategic_cmd_limit'] = "<font color=red>{$nation['strategic_cmd_limit']}턴</font>";
} else if($impossibleStrategicCommandLists) {
$nation['strategic_cmd_limit'] = "<font color=yellow>가 능</font>";
} else{ } else{
$nation['strategic_cmd_limit'] = "<font color=limegreen>가 능</font>"; $nation['strategic_cmd_limit'] = "<font color=limegreen>가 능</font>";
} }
if($impossibleStrategicCommandLists){
$text = [];
foreach($impossibleStrategicCommandLists as [$cmdName, $remainTurn]){
$text[] = "{$cmdName}: {$remainTurn}턴 뒤";
}
$nation['strategic_cmd_limit'] = $templates->render('tooltip', [
'text'=>'<span style="text-decoration:underline dashed;">'.$nation['strategic_cmd_limit'].'</span>',
'info'=>'<span class="text-left d-inline-block">'.join('<br>', $text).'</span>',
]);
}
if ($nation['surlimit'] != 0) { if ($nation['surlimit'] != 0) {
$nation['surlimit'] = "<font color=red>{$nation['surlimit']}턴</font>"; $nation['surlimit'] = "<font color=red>{$nation['surlimit']}턴</font>";
} else { } else {
+5 -5
View File
@@ -232,7 +232,7 @@ function checkCommandArg(?array $arg):?string{
} }
$defaultCheck = [ $defaultCheck = [
/*'string'=>[ /*'string'=>[
'nationName', 'optionText', 'itemType', 'nationType' 'nationName', 'optionText', 'itemType', 'nationType', 'commandType',
],*/ ],*/
'integer'=>[ 'integer'=>[
'crewType', 'destGeneralID', 'destCityID', 'destNationID', 'crewType', 'destGeneralID', 'destCityID', 'destNationID',
@@ -284,14 +284,14 @@ function setGeneralCommand(int $generalID, array $rawTurnList, string $command,
$turnList[$turnIdx] = true; $turnList[$turnIdx] = true;
} }
else if($turnIdx == -1){ else if($turnIdx == -1){
//홀수 //홀수, 0부터 맞다.
foreach(Util::range(1, GameConst::$maxTurn, 2) as $subIdx){ foreach(Util::range(0, GameConst::$maxTurn, 2) as $subIdx){
$turnList[$subIdx] = true; $turnList[$subIdx] = true;
} }
} }
else if($turnIdx == -2){ else if($turnIdx == -2){
//짝수 //짝수, 1부터 맞다.
foreach(Util::range(0, GameConst::$maxTurn, 2) as $subIdx){ foreach(Util::range(1, GameConst::$maxTurn, 2) as $subIdx){
$turnList[$subIdx] = true; $turnList[$subIdx] = true;
} }
} }
+24
View File
@@ -378,6 +378,30 @@ function buildWarUnitTriggerClass(?string $type, WarUnit $unit, ?array $args = n
return $class->newInstanceArgs(array_merge([$unit], $args)); return $class->newInstanceArgs(array_merge([$unit], $args));
} }
function getGeneralPoolClass(string $type){
static $basePath = __NAMESPACE__.'\\GeneralPool\\';
$classPath = ($basePath.$type);
if(class_exists($classPath)){
return $classPath;
}
throw new \InvalidArgumentException("{$type}은 GeneralPool이 아님");
}
/**
* @param \MeekroDB $db
* @param int $owner
* @param int $pickCnt
* @param null|string $prefix
* @return AbsGeneralPool[]
*/
function pickGeneralFromPool(\MeekroDB $db, int $owner, int $pickCnt, ?string $prefix=null):array{
/** @var AbsGeneralPool */
$class = getGeneralPoolClass(GameConst::$targetGeneralPool);
return $class::pickGeneralFromPool($db, $owner, $pickCnt, $prefix);
}
function countPureGeneralFromRawList(?array $rawGeneralList=null):int{ function countPureGeneralFromRawList(?array $rawGeneralList=null):int{
if(!$rawGeneralList){ if(!$rawGeneralList){
return 0; return 0;
+10 -18
View File
@@ -516,6 +516,7 @@ function checkWander()
$logger = $wanderer->getLogger(); $logger = $wanderer->getLogger();
$logger->pushGeneralActionLog('초반 제한후 방랑군은 자동 해산됩니다.', ActionLogger::PLAIN); $logger->pushGeneralActionLog('초반 제한후 방랑군은 자동 해산됩니다.', ActionLogger::PLAIN);
$wanderCmd->run(); $wanderCmd->run();
$wanderCmd->setNextAvailable();
} }
} }
@@ -679,31 +680,22 @@ function updateNationState()
while ($assemblerCnt < $maxAssemblerCnt) { while ($assemblerCnt < $maxAssemblerCnt) {
$lastAssemblerID += 1; $lastAssemblerID += 1;
$npcObj = new Scenario\NPC( $npcObj = new Scenario\GeneralBuilder(
999,
sprintf('부대장%4d', $lastAssemblerID), sprintf('부대장%4d', $lastAssemblerID),
0,
null, null,
$nation['nation'], $nation['nation']
null,
10,
10,
10,
1,
$admin['year'] - 15,
$admin['year'] + 15,
'은둔',
'척사'
); );
$npcObj->killturn = 70; $npcObj->setAffinity(999)->setStat(10, 10, 10)
$npcObj->gold = 0; ->setSpecialSingle('척사')->setEgo('che_은둔')
$npcObj->rice = 0; ->setKillturn(70)->setGoldRice(0, 0)
$npcObj->npc = 5; ->setNPCType(5)->fillRemainSpecAsZero($admin);
$npcObj->build($admin); $npcObj->build($admin);
$npcID = $npcObj->generalID; $npcID = $npcObj->getGeneralID();
$db->insert('troop', [ $db->insert('troop', [
'troop_leader' => $npcID, 'troop_leader' => $npcID,
'name' => $npcObj->realName, 'name' => $npcObj->getGeneralName(),
'nation' => $nation['nation'], 'nation' => $nation['nation'],
]); ]);
$db->update('general', [ $db->update('general', [
+5 -1
View File
@@ -217,10 +217,14 @@ function formatDefenceTrain(int $value): string
{ {
if ($value === 999) { if ($value === 999) {
return "×"; return "×";
} else if ($value >= 90){
return "☆";
} else if ($value >= 80) { } else if ($value >= 80) {
return "◎"; return "◎";
} else { } else if ($value >= 60) {
return "○"; return "○";
} else{
return "△";
} }
} }
+1 -1
View File
@@ -523,7 +523,7 @@ function selection($tnmt_type, $tnmt, $phase) {
if($phase < 31) { if($phase < 31) {
$gameStor->phase+=1; $gameStor->phase+=1;
} else { } else {
$gameStor->tournamemt = 4; $gameStor->tournament = 4;
$gameStor->phase=0; $gameStor->phase=0;
} }
} }
+7 -5
View File
@@ -61,7 +61,7 @@ $scenario = $gameStor->scenario_text;
$nationID = $generalObj->getNationID(); $nationID = $generalObj->getNationID();
if($nationID){ if($nationID){
$nationStor = KVStorage::getStorage($db, $nationID, 'nation_env'); $nationStor = KVStorage::getStorage($db, $nationID, 'nation_env');
$nationStor->cacheValues(['notice', 'online_genenerals']); $nationStor->cacheAll();
} }
$valid = 0; $valid = 0;
@@ -79,9 +79,11 @@ if ($gameStor->fiction == 0) {
} }
if ($gameStor->npcmode == 0) { if ($gameStor->npcmode == 0) {
$npcmode = "불가능"; $npcmode = "불가능";
} else { } else if($gameStor->npcmode == 1){
$npcmode = "가능"; $npcmode = "가능";
$valid = 1; $valid = 1;
} else {
$npcmode = "선택 생성";
} }
$color = "cyan"; $color = "cyan";
$mapTheme = $gameStor->map_theme; $mapTheme = $gameStor->map_theme;
@@ -134,7 +136,7 @@ $(function(){
<body class="img_back"> <body class="img_back">
<div id="container"> <div id="container">
<div><?=allButton($gameStor->npcmode!=0)?></div> <div><?=allButton($gameStor->npcmode==1)?></div>
<table class="tb_layout bg0" style="width:1000px;"> <table class="tb_layout bg0" style="width:1000px;">
<tr height=50> <tr height=50>
<td colspan=5 id="server_title" align=center><font size=4>삼국지 모의전투 HiDCHe <?=$serverName.$serverCnt?>기 (<font color=cyan><?=$scenario?></font>)</font></td> <td colspan=5 id="server_title" align=center><font size=4>삼국지 모의전투 HiDCHe <?=$serverName.$serverCnt?>기 (<font color=cyan><?=$scenario?></font>)</font></td>
@@ -341,7 +343,7 @@ else if($session->userGrade == 4){
<button id="msg_submit">서신전달&amp;갱신</button><br> <button id="msg_submit">서신전달&amp;갱신</button><br>
내용 없이 '서신전달&amp;갱신'을 누르면 메세지창이 갱신됩니다. 내용 없이 '서신전달&amp;갱신'을 누르면 메세지창이 갱신됩니다.
</div> </div>
<div><?=allButton($gameStor->npcmode!=0)?></div> <div><?=allButton($gameStor->npcmode==1)?></div>
<div id="message_board"><div style="left:0;" class="board_side bg0"> <div id="message_board"><div style="left:0;" class="board_side bg0">
<div class="board_header bg0" id='public_talk_position'>전체 메시지(최고99자)</div> <div class="board_header bg0" id='public_talk_position'>전체 메시지(최고99자)</div>
<section class="public_message"> <section class="public_message">
@@ -361,7 +363,7 @@ else if($session->userGrade == 4){
<button type="button" class="load_old_message btn btn-secondary btn-block" data-msg_type="diplomacy">이전 메시지 불러오기</button> <button type="button" class="load_old_message btn btn-secondary btn-block" data-msg_type="diplomacy">이전 메시지 불러오기</button>
</section> </section>
</div></div> </div></div>
<div style="clear:left;"><?=allButton($gameStor->npcmode!=0)?><?=banner()?></div> <div style="clear:left;"><?=allButton($gameStor->npcmode==1)?><?=banner()?></div>
</div> </div>
<?php <?php
if ($con == 1) { if ($con == 1) {
+18 -1
View File
@@ -102,7 +102,7 @@ if($session->userGrade < 5 && !$allowReset){
</div> </div>
<div class="form-group row"> <div class="form-group row">
<label for="confirm_password" class="col-sm-3 col-form-label">시나리오 선택</label> <label for="scenario_sel" class="col-sm-3 col-form-label">시나리오 선택</label>
<div class="col-sm-9"> <div class="col-sm-9">
<select class="form-control" name="scenario" size="1" id="scenario_sel"> <select class="form-control" name="scenario" size="1" id="scenario_sel">
</select> </select>
@@ -138,6 +138,20 @@ if($session->userGrade < 5 && !$allowReset){
</div> </div>
</div> </div>
<div class="form-group row">
<label for="block_general_create" class="col-sm-3 col-form-label">장수 임의 생성</label>
<div class="col-sm-9">
<div id="block_general_create" class="btn-group btn-group-toggle" data-toggle="buttons">
<label class="btn btn-secondary">
<input type="radio" name="block_general_create" value="0" checked>가능
</label>
<label class="btn btn-secondary active">
<input type="radio" name="block_general_create" value="1">불가
</label>
</div>
</div>
</div>
<div class="form-group row"> <div class="form-group row">
<label for="npcmode" class="col-sm-3 col-form-label">NPC 빙의</label> <label for="npcmode" class="col-sm-3 col-form-label">NPC 빙의</label>
<div class="col-sm-9"> <div class="col-sm-9">
@@ -148,6 +162,9 @@ if($session->userGrade < 5 && !$allowReset){
<label class="btn btn-secondary active"> <label class="btn btn-secondary active">
<input type="radio" name="npcmode" value="0" checked>불가 <input type="radio" name="npcmode" value="0" checked>불가
</label> </label>
<label class="btn btn-secondary">
<input type="radio" name="npcmode" value="2">선택 생성 가능
</label>
</div> </div>
</div> </div>
</div> </div>
+5 -4
View File
@@ -52,7 +52,7 @@ else if(
$now->getTimestamp() - $lastTurn->getTimestamp() > $reservedDate->getTimestamp() - $now->getTimestamp() $now->getTimestamp() - $lastTurn->getTimestamp() > $reservedDate->getTimestamp() - $now->getTimestamp()
){ ){
//정지 상태 & 중간 넘음 //정지 상태 & 중간 넘음
AppConf::getList()[DB::prefix()]->closeServer(); ServConfig::getServerList()[DB::prefix()]->closeServer();
$status = 'closed'; $status = 'closed';
} }
else if( else if(
@@ -60,12 +60,12 @@ else if(
$now->getTimestamp() - $lastTurn->getTimestamp() > ($reservedDate->getTimestamp() - $now->getTimestamp()) * 2 $now->getTimestamp() - $lastTurn->getTimestamp() > ($reservedDate->getTimestamp() - $now->getTimestamp()) * 2
){ ){
//천통 & 비정지 상태 & 2/3 넘음 //천통 & 비정지 상태 & 2/3 넘음
AppConf::getList()[DB::prefix()]->closeServer(); ServConfig::getServerList()[DB::prefix()]->closeServer();
$status = 'closed'; $status = 'closed';
} }
else if($reservedDate->getTimestamp() - $now->getTimestamp() <= 60*10){ else if($reservedDate->getTimestamp() - $now->getTimestamp() <= 60*10){
//어쨌든 간에 10분 남았다면. //어쨌든 간에 10분 남았다면.
AppConf::getList()[DB::prefix()]->closeServer(); ServConfig::getServerList()[DB::prefix()]->closeServer();
$status = 'closed'; $status = 'closed';
} }
@@ -85,6 +85,7 @@ $result = ResetHelper::buildScenario(
$options['scenario'], $options['scenario'],
$options['fiction'], $options['fiction'],
$options['extend'], $options['extend'],
$options['block_general_create'],
$options['npcmode'], $options['npcmode'],
$options['show_img_level'], $options['show_img_level'],
$options['tournament_trig'], $options['tournament_trig'],
@@ -96,6 +97,6 @@ $result = ResetHelper::buildScenario(
$result['affected']=1; $result['affected']=1;
$prefix = DB::prefix(); $prefix = DB::prefix();
AppConf::getList()[$prefix]->openServer(); ServConfig::getServerList()[$prefix]->openServer();
Json::die($result); Json::die($result);
+87
View File
@@ -0,0 +1,87 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
WebUtil::requireAJAX();
$destGeneralID = Util::getPost('destGeneralID', 'int', 0);
if(!$destGeneralID || $destGeneralID <= 0){
Json::die([
'result'=>false,
'reason'=>'올바르지 않은 장수 코드입니다'
]);
}
$session = Session::requireGameLogin([])->setReadOnly();
$db = DB::db();
increaseRefresh("시뮬레이터 추출", 1);
$userID = Session::getUserID();
$me = $db->queryFirstRow('SELECT no,nation from general where owner=%i', $userID);
$nationID = $me['nation'];
$reqColumns = [
'nation',
'name', 'officer_level', 'explevel', 'injury',
'leadership', 'horse', 'strength', 'weapon', 'intel', 'book', 'item',
'rice', 'personal', 'special2',
'crew', 'crewtype',
'atmos', 'train', 'dex1', 'dex2', 'dex3', 'dex4', 'dex5', 'defence_train',
];
$reqRankColumns = [
'warnum', 'killnum', 'killcrew'
];
$dummyItems = [
'officer_level'=>1,
'horse'=>'None',
'weapon'=>'None',
'book'=>'None',
'item'=>'None',
'crew'=>0,
'crewtype'=>GameUnitConst::DEFAULT_CREWTYPE,
'rice'=>10000,
'train'=>GameConst::$maxTrainByCommand,
'atmos'=>GameConst::$maxTrainByCommand,
'dex1'=>0,
'dex2'=>0,
'dex3'=>0,
'dex4'=>0,
'dex5'=>0,
'defence_train'=>80,
'warnum'=>0,
'killnum'=>0,
'killcrew'=>0,
];
$rawDestGeneral = $db->queryFirstRow('SELECT %l FROM general WHERE no=%i', Util::formatListOfBackticks($reqColumns), $destGeneralID);
if($nationID == 0 || $rawDestGeneral['nation'] != $nationID){
foreach($dummyItems as $key=>$val){
$rawDestGeneral[$key] = $val;
}
}
else{
$rawRankValue = $db->queryAllLists('SELECT `type`, `value` FROM rank_data WHERE general_id = %i AND `type` IN %ls', $destGeneralID, $reqRankColumns);
foreach($rawRankValue as [$rankType, $rankValue]){
$rawDestGeneral[$rankType] = $rankValue;
}
}
foreach(['dex1', 'dex2', 'dex3', 'dex4', 'dex5'] as $dexKey){
$dex = $rawDestGeneral[$dexKey];
$rawDestGeneral[$dexKey] = getDexLevelList()[getDexLevel($dex)][0];
}
Json::die([
'result'=>true,
'reason'=>'success',
'general'=>$rawDestGeneral,
]);
+36
View File
@@ -0,0 +1,36 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
//로그인 검사
$session = Session::requireGameLogin([]);
$generalID = Session::getGeneralID();
$db = DB::db();
$rawList = Util::convertArrayToDict($db->query('SELECT no, name, npc, nation FROM general'), 'no');
$nationID = $rawList[$generalID]['nation'];
$result = [
'result'=>true,
'reason'=>'success',
'nationID'=>$nationID,
'generalID'=>$generalID,
'column'=>['no', 'name', 'npc']
];
$resultItem = [];
foreach(Util::arrayGroupBy($rawList, 'nation') as $subNationID=>$generals){
$subNation = [];
foreach($generals as $general){
$subNation[] = [$general['no'], $general['name'], $general['npc']];
}
$resultItem[$subNationID] = $subNation;
}
$result['list'] = $resultItem;
$result['nation'] = Util::convertArrayToDict($db->query('SELECT nation, name, color FROM nation'), 'nation');
Json::die($result);
+1 -1
View File
@@ -6,7 +6,7 @@ include "func.php";
//로그인 검사 //로그인 검사
$session = Session::requireLogin(); $session = Session::requireLogin([]);
$userID = Session::getUserID(); $userID = Session::getUserID();
$db = DB::db(); $db = DB::db();
+1 -1
View File
@@ -37,7 +37,7 @@ list(
$npcmode $npcmode
) = $gameStor->getValuesAsArray(['maxgeneral', 'turnterm', 'npcmode']); ) = $gameStor->getValuesAsArray(['maxgeneral', 'turnterm', 'npcmode']);
if(!$npcmode){ if($npcmode!=1){
Json::die([ Json::die([
'result'=>false, 'result'=>false,
'reason'=>'빙의 가능한 서버가 아닙니다' 'reason'=>'빙의 가능한 서버가 아닙니다'
+90
View File
@@ -0,0 +1,90 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
function sortTokens(&$tokens){
usort($tokens, function($lhs, $rhs){
return array_sum($lhs['dex'])<=>array_sum($rhs['dex']);
});
}
function putInfoText(&$info){
if(key_exists('specialDomestic', $info)){
$class = buildGeneralSpecialDomesticClass($info['specialDomestic']);
$info['specialDomesticName'] = $class->getName();
$info['specialDomesticInfo'] = $class->getInfo();
}
if(key_exists('specialWar', $info)){
$class = buildGeneralSpecialDomesticClass($info['specialWar']);
$info['specialWarName'] = $class->getName();
$info['specialWarInfo'] = $class->getInfo();
}
}
$session = Session::requireLogin([])->setReadOnly();
$userID = Session::getUserID();
$oNow = new \DateTimeImmutable();
$now = $oNow->format('Y-m-d H:i:s');
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$npcmode = $gameStor->getValue('npcmode');
if($npcmode!=2){
Json::die([
'result'=>false,
'reason'=>'선택 가능한 서버가 아닙니다'
]);
}
$rawGeneral = $db->queryFirstRow('SELECT no, aux FROM general WHERE `owner` = %i', $userID);
if($rawGeneral){
$generalAux = Json::decode($rawGeneral['aux']);
if(key_exists('next_change', $generalAux)&& $generalAux['next_change'] > $now){
Json::die([
'result'=>false,
'reason'=>'아직 다시 고를 수 없습니다'
]);
}
}
$tokens = $db->query('SELECT unique_name, reserved_until, info FROM `select_pool` WHERE `owner`=%i AND `reserved_until`>=%s', $userID, $now);
if($tokens){
$pick = [];
$valid_until = null;
$specialInfo = [];
foreach($tokens as $token){
$valid_until = $token['reserved_until'];
$info = Json::decode($token['info']);
putInfoText($info);
$info['uniqueName'] = $token['unique_name'];
$pick[] = $info;
}
sortTokens($pick);//좀 무식하지만..
Json::die([
'result'=>true,
'pick'=>$pick,
'validUntil'=>$valid_until
]);
}
$pick = [];
$valid_until = null;
foreach(pickGeneralFromPool($db, $userID, 14) as $pickObj){
$valid_until = $pickObj->getValidUntil();
$info = $pickObj->getInfo();
putInfoText($info);
$pick[] = $info;
}
sortTokens($pick);//좀 무식하지만..
Json::die([
'result'=>true,
'pick'=>$pick,
'validUntil'=>$valid_until
]);
+7 -1
View File
@@ -57,6 +57,7 @@ $v->rule('required', [
'scenario', 'scenario',
'fiction', 'fiction',
'extend', 'extend',
'block_general_create',
'join_mode', 'join_mode',
'npcmode', 'npcmode',
'show_img_level', 'show_img_level',
@@ -67,6 +68,7 @@ $v->rule('required', [
'scenario', 'scenario',
'fiction', 'fiction',
'extend', 'extend',
'block_general_create',
'npcmode', 'npcmode',
'show_img_level', 'show_img_level',
'tournament_trig', 'tournament_trig',
@@ -109,11 +111,13 @@ $scenario = (int)$_POST['scenario'];
$fiction = (int)$_POST['fiction']; $fiction = (int)$_POST['fiction'];
$extend = (int)$_POST['extend']; $extend = (int)$_POST['extend'];
$npcmode = (int)$_POST['npcmode']; $npcmode = (int)$_POST['npcmode'];
$block_general_create = (bool)$_POST['block_general_create'];
$show_img_level = (int)$_POST['show_img_level']; $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']; $join_mode = $_POST['join_mode'];
$autorun_user_minutes = (int)$_POST['autorun_user_minutes']; $autorun_user_minutes = (int)$_POST['autorun_user_minutes'];
$autorun_user_options = []; $autorun_user_options = [];
foreach(Util::getPost('autorun_user', 'array_string', []) as $autorun_option){ foreach(Util::getPost('autorun_user', 'array_string', []) as $autorun_option){
$autorun_user_options[$autorun_option] = 1; $autorun_user_options[$autorun_option] = 1;
} }
@@ -165,6 +169,7 @@ if($reserve_open){
'scenarioName'=>$scenarioObj->getTitle(), 'scenarioName'=>$scenarioObj->getTitle(),
'fiction'=>$fiction, 'fiction'=>$fiction,
'extend'=>$extend, 'extend'=>$extend,
'block_general_create'=>$block_general_create,
'npcmode'=>$npcmode, 'npcmode'=>$npcmode,
'show_img_level'=>$show_img_level, 'show_img_level'=>$show_img_level,
'tournament_trig'=>$tournament_trig, 'tournament_trig'=>$tournament_trig,
@@ -187,7 +192,7 @@ if($reserve_open){
'options'=>Json::encode($reserveInfo), 'options'=>Json::encode($reserveInfo),
'date'=>$open_date 'date'=>$open_date
]); ]);
AppConf::getList()[DB::prefix()]->closeServer(); ServConfig::getServerList()[DB::prefix()]->closeServer();
Json::die([ Json::die([
'result'=>true, 'result'=>true,
'reason'=>'예약' 'reason'=>'예약'
@@ -200,6 +205,7 @@ Json::die(ResetHelper::buildScenario(
$scenario, $scenario,
$fiction, $fiction,
$extend, $extend,
$block_general_create,
$npcmode, $npcmode,
$show_img_level, $show_img_level,
$tournament_trig, $tournament_trig,
+1 -1
View File
@@ -95,7 +95,7 @@ if($result !== true){
ResetHelper::clearDB(); ResetHelper::clearDB();
AppConf::getList()[$prefix]->closeServer(); ServConfig::getServerList()[$prefix]->closeServer();
Json::die([ Json::die([
'result'=>true, 'result'=>true,
+83
View File
@@ -0,0 +1,83 @@
<?php
namespace sammo;
use Nette\Caching\Cache;
include "lib.php";
include "func.php";
if(!class_exists('\\sammo\\UniqueConst')){
Json::die([
'result'=>false,
'reason'=>'서버 초기화되지 않음'
]);
}
if(!prepareDir('data/file_cache')){
Json::die([
'result'=>false,
'reason'=>'cache 불가'
]);
}
$storage = new \Nette\Caching\Storages\FileStorage('data/file_cache');
$cache = new Cache($storage);
$serverID = UniqueConst::$serverID;
$mapInfo = $cache->load("recent_map");
//로그인 검사
$now = time();
if($mapInfo && ($now - $mapInfo['timestamp'] < 600)){
$mapEtag = $mapInfo['etag'];
$mapModified = $mapInfo['timestamp'];
header("Last-Modified: ".gmdate("D, d M Y H:i:s", $mapModified)." GMT");
header("Etag: $mapEtag");
if (
strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']??'2000-01-01') === $mapModified ||
trim($_SERVER['HTTP_IF_NONE_MATCH']??'') === $mapEtag
) {
header("HTTP/1.1 304 Not Modified");
die();
}
Json::die($mapInfo['data'], 0);
}
$defaultPost = [
'year' => null,
'month' => null,
'aux' => null,
'neutralView' => true,
'showMe' => false,
];
$history = formatHistoryToHTML(getGlobalHistoryLogRecent(10));
$rawMap = getWorldMap([
'year' => null,
'month' => null,
'aux' => null,
'neutralView' => true,
'showMe' => false,
]);
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$mapTheme = $gameStor->map_theme ?? 'che';
$rawMap['history'] = $history;
$rawMap['theme'] = $mapTheme;
$etag = hash('sha256', $serverID.$now);
$map = [
'etag'=>$etag,
'timestamp'=>$now,
'data'=>$rawMap,
];
$cache->save("recent_map", $map);
header("Last-Modified: ".gmdate("D, d M Y H:i:s", $now)." GMT");
header("Etag: $etag");
Json::die($map['data'], 0);
+1
View File
@@ -40,6 +40,7 @@ if($action === '추방' && $destGeneralID==0){
if($destGeneralID==0){ if($destGeneralID==0){
$general = new DummyGeneral(true); $general = new DummyGeneral(true);
$general->setVar('nation', $nationID);
} }
else{ else{
$general = General::createGeneralObjFromDB($destGeneralID, [ $general = General::createGeneralObjFromDB($destGeneralID, [
+1 -1
View File
@@ -59,7 +59,7 @@ list(
$npcmode $npcmode
) = $gameStor->getValuesAsArray(['year', 'month', 'maxgeneral', 'npcmode']); ) = $gameStor->getValuesAsArray(['year', 'month', 'maxgeneral', 'npcmode']);
if(!$npcmode){ if($npcmode!=1){
Json::die([ Json::die([
'result'=>false, 'result'=>false,
'reason'=>'빙의 가능한 서버가 아닙니다' 'reason'=>'빙의 가능한 서버가 아닙니다'
+167
View File
@@ -0,0 +1,167 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
WebUtil::requireAJAX();
$pick = Util::getPost('pick');
$leadership = Util::getPost('leadership', 'int', GameConst::$defaultStatMin);
$strength = Util::getPost('leadership', 'int', GameConst::$defaultStatMin);
$intel = Util::getPost('leadership', 'int', GameConst::$defaultStatMin);
$personal = Util::getPost('personal', 'string', null);
$use_own_picture = Util::getPost('use_own_picture', 'bool', false);
if(!$pick){
Json::die([
'result'=>false,
'reason'=>'장수를 선택하지 않았습니다'
]);
}
$session = Session::requireLogin([])->setReadOnly();
$userID = Session::getUserID();
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$rootDB = RootDB::db();
$oNow = new \DateTimeImmutable();
$now = $oNow->format('Y-m-d H:i:s');
$hasGeneralID = $db->queryFirstField('SELECT no FROM general WHERE owner = %i', $userID);
if($hasGeneralID){
Json::die([
'result'=>false,
'reason'=>'이미 장수를 생성했습니다.'
]);
}
$env = $gameStor->getValues(['startyear', 'year', 'month', 'maxgeneral', 'npcmode', 'show_img_level', 'icon_path', 'turnterm', 'turntime']);
$env['fiction'] = false;
$npcmode = $env['npcmode'];
$maxgeneral = $env['maxgeneral'];
if($npcmode!=2){
Json::die([
'result'=>false,
'reason'=>'선택 가능한 서버가 아닙니다'
]);
}
$selectInfo = $db->queryFirstField('SELECT info FROM select_pool WHERE `owner` = %i AND `reserved_until`>=%s AND `unique_name`=%s', $userID, $now, $pick);
if(!$selectInfo){
Json::die([
'result'=>false,
'reason'=>'유효한 장수 목록이 없습니다.'
]);
}
$selectInfo = Json::decode($selectInfo);
$ownerInfo = RootDB::db()->queryFirstRow('SELECT `name`,`picture`,`imgsvr` FROM member WHERE `NO`=%i',$userID);
if(!$ownerInfo){
Json::die([
'result'=>false,
'reason'=>'멤버 정보를 가져오지 못했습니다.'
]);
}
$gencount = $db->queryFirstField('SELECT count(`no`) FROM general WHERE npc<2');
if ($gencount >= $maxgeneral) {
Json::die([
'result'=>false,
'reason'=>'더 이상 등록 할 수 없습니다.'
]);
}
$poolClass = getGeneralPoolClass(GameConst::$targetGeneralPool);
/** @var AbsGeneralPool */
$pickedGeneral = new $poolClass($db, $selectInfo, $now);
$builder = $pickedGeneral->getGeneralBuilder();
foreach(GameConst::$generalPoolAllowOption as $allowOption){
if($allowOption == 'stat'){
$leadership = Util::valueFit($leadership, GameConst::$defaultStatMin, GameConst::$defaultStatMax);
$strength = Util::valueFit($strength, GameConst::$defaultStatMin, GameConst::$defaultStatMax);
$intel = Util::valueFit($intel, GameConst::$defaultStatMin, GameConst::$defaultStatMax);
if($leadership + $strength + $intel > GameConst::$defaultStatTotal){
Json::die([
'result'=>false,
'reason'=>'스탯의 총 합이 올바르지 않습니다.'
]);
}
$builder->setStat($leadership, $strength, $intel);
}
else if($allowOption == 'picture' && $use_own_picture){
$builder->setPicture($ownerInfo['imgsvr'], $ownerInfo['picture']);
}
else if($allowOption == 'ego'){
if(!$personal || $personal == 'Random'){
$personal = Util::choiceRandom(GameConst::$availablePersonality);
}
if(!array_search($personal, GameConst::$availablePersonality)){
Json::die([
'result'=>false,
'reason'=>'올바르지 않은 성격입니다.'
]);
}
$builder->setEgo($personal);
}
}
$builder->setOwner($userID);
$builder->setKillturn(5);
$builder->setNPCType(0);
$builder->setAuxVar('next_change', TimeUtil::nowAddMinutes(12 * $env['turnterm']));
$builder->fillRemainSpecAsZero($env);
$builder->build($env);
$generalID = $builder->getGeneralID();
if(!$generalID){
Json::die([
'result'=>false,
'reason'=>'장수 등록에 실패했습니다.'
]);
}
$pickedGeneral->occupyGeneralName();
$db->update('select_pool',[
'owner'=>null,
'reserved_until'=>null,
], '(owner=%i or reserved_until < %s) AND general_id is NULL', $userID, $now);
$userNick = $ownerInfo['name'];
$josaYi = JosaUtil::pick($userNick, '이');
$generalName = $builder->getGeneralName();
$josaRo = JosaUtil::pick($generalName, '로');
$cityName = CityConst::byID($builder->getCityID())->name;
$logger = new ActionLogger($generalID, 0, $env['year'], $env['month']);
$logger->pushGeneralHistoryLog("<Y>{$generalName}</>, <G>{$cityName}</>에서 등장");
$logger->pushGlobalActionLog("<G><b>{$cityName}</b></>에서 <Y>{$userNick}</>{$josaYi} <Y>{$generalName}</>{$josaRo} 등장합니다.");
$logger->flush();
pushAdminLog(["가입 : {$userID} // {$session->userName} // {$pick} // ".getenv("REMOTE_ADDR")]);
$rootDB->insert('member_log', [
'member_no' => $userID,
'date'=>TimeUtil::now(),
'action_type'=>'make_general',
'action'=>Json::encode([
'server'=>DB::prefix(),
'type'=>'select',
'generalID'=>$generalID,
'generalName'=>$generalName
])
]);
Json::die([
'result'=>true,
'reason'=>'success'
]);
+6 -5
View File
@@ -43,7 +43,7 @@ $session = Session::requireLogin([
'game'=>null, 'game'=>null,
'me'=>null 'me'=>null
])->setReadOnly(); ])->setReadOnly();
$userID = Session::getUserID(); $userID = $session->userID;
if(!class_exists('\\sammo\\DB')){ if(!class_exists('\\sammo\\DB')){
Json::die([ Json::die([
@@ -91,7 +91,8 @@ if(file_exists(__DIR__.'/.htaccess')){
'scenarioName'=>$options['scenarioName'], 'scenarioName'=>$options['scenarioName'],
'turnterm'=>$options['turnterm'], 'turnterm'=>$options['turnterm'],
'fictionMode'=>($options['fiction']?'가상':'사실'), 'fictionMode'=>($options['fiction']?'가상':'사실'),
'npcMode'=>($options['npcmode']?'가능':'불가'), 'block_general_create'=>(!!$options['block_general_create']),
'npcMode'=>([0=>'불가',1=>'가능',2=>'선택 생성'][$options['npcmode']]),
'openDatetime'=>$reserved['date'], 'openDatetime'=>$reserved['date'],
'starttime'=>$options['starttime'], 'starttime'=>$options['starttime'],
'gameConf'=>$options['gameConf'], 'gameConf'=>$options['gameConf'],
@@ -104,7 +105,7 @@ if(file_exists(__DIR__.'/.htaccess')){
//TODO: 천통시에도 예약 오픈 알림이 필요..? //TODO: 천통시에도 예약 오픈 알림이 필요..?
$admin = $gameStor->getValues(['isunited', 'npcmode', 'year', 'month', 'scenario', 'scenario_text', 'maxgeneral', 'turnterm', 'opentime', 'turntime', 'join_mode', 'fiction', 'autorun_user']); $admin = $gameStor->getValues(['isunited', 'npcmode', 'year', 'month', 'scenario', 'scenario_text', 'maxgeneral', 'turnterm', 'opentime', 'turntime', 'join_mode', 'fiction', 'block_general_create', 'autorun_user']);
$admin['maxUserCnt'] = $admin['maxgeneral']; $admin['maxUserCnt'] = $admin['maxgeneral'];
$admin['npcMode'] = $admin['npcmode']; $admin['npcMode'] = $admin['npcmode'];
$admin['turnTerm'] = $admin['turnterm']; $admin['turnTerm'] = $admin['turnterm'];
@@ -124,8 +125,8 @@ $admin['scenario'] = $admin['scenario_text'];
$admin['userCnt'] = $genCnt; $admin['userCnt'] = $genCnt;
$admin['npcCnt'] = $npcCnt; $admin['npcCnt'] = $npcCnt;
$admin['nationCnt'] = $nationCnt; $admin['nationCnt'] = $nationCnt;
$admin['block_general_create'] = !!$admin['block_general_create'];
$admin['npcMode'] = $admin['npcMode']?'가능':'불가'; $admin['npcMode'] = [0=>'불가',1=>'가능',2=>'선택 생성'][$admin['npcMode']];
$admin['fictionMode'] = $admin['fiction']?'가상':'사실'; $admin['fictionMode'] = $admin['fiction']?'가상':'사실';
$otherTextInfo = []; $otherTextInfo = [];
+7 -2
View File
@@ -16,6 +16,7 @@ $action = Util::getPost('action');
$tnmt = Util::getPost('tnmt', 'int', 1); $tnmt = Util::getPost('tnmt', 'int', 1);
$defence_train = Util::getPost('defence_train', 'int', 80); $defence_train = Util::getPost('defence_train', 'int', 80);
$use_treatment = Util::getPost('use_treatment', 'int', 10); $use_treatment = Util::getPost('use_treatment', 'int', 10);
$use_auto_nation_turn = Util::getPost('use_auto_nation_turn', 'int', 1);
//$detachNPC = Util::getPost('detachNPC', 'bool'); //$detachNPC = Util::getPost('detachNPC', 'bool');
$detachNPC = false; $detachNPC = false;
@@ -42,8 +43,8 @@ if($defence_train != $me->getVar('defence_train')){
if($defence_train == 999){ if($defence_train == 999){
$me->increaseVar('myset', -1); $me->increaseVar('myset', -1);
$me->setVar('defence_train', $defence_train); $me->setVar('defence_train', $defence_train);
$me->increaseVar('train', -3); $me->increaseVarWithLimit('train', -3, 20);
$me->increaseVar('atmos', -3); $me->increaseVarWithLimit('atmos', -3, 20);
} }
else{ else{
$me->increaseVar('myset', -1); $me->increaseVar('myset', -1);
@@ -53,6 +54,10 @@ if($defence_train != $me->getVar('defence_train')){
$me->setAuxVar('use_treatment', Util::valueFit($use_treatment, 10, 100)); $me->setAuxVar('use_treatment', Util::valueFit($use_treatment, 10, 100));
if($use_auto_nation_turn != $me->getAuxVar('use_auto_nation_turn')){
$me->setAuxVar('use_auto_nation_turn', $use_auto_nation_turn);
}
if($me->getVar('tnmt') != $tnmt){ if($me->getVar('tnmt') != $tnmt){
$me->setVar('tnmt', $tnmt); $me->setVar('tnmt', $tnmt);
} }
+18 -4
View File
@@ -87,12 +87,13 @@ $generalCheck = [
'no', 'name', 'nation', 'turntime', 'personal', 'special2', 'crew', 'crewtype', 'atmos', 'train', 'no', 'name', 'nation', 'turntime', 'personal', 'special2', 'crew', 'crewtype', 'atmos', 'train',
'intel', 'intel_exp', 'book', 'strength', 'strength_exp', 'weapon', 'injury', 'leadership', 'leadership_exp', 'horse', 'item', 'intel', 'intel_exp', 'book', 'strength', 'strength_exp', 'weapon', 'injury', 'leadership', 'leadership_exp', 'horse', 'item',
'explevel', 'experience', 'dedication', 'officer_level', 'officer_city', 'gold', 'rice', 'dex1', 'dex2', 'dex3', 'dex4', 'dex5', 'explevel', 'experience', 'dedication', 'officer_level', 'officer_city', 'gold', 'rice', 'dex1', 'dex2', 'dex3', 'dex4', 'dex5',
'recent_war' 'recent_war', 'warnum', 'killnum', 'killcrew',
], ],
'integer'=>[ 'integer'=>[
'no', 'nation', 'crew', 'crewtype', 'atmos', 'train', 'no', 'nation', 'crew', 'crewtype', 'atmos', 'train',
'intel', 'intel_exp', 'strength', 'strength_exp', 'injury', 'leadership', 'leadership_exp', 'intel', 'intel_exp', 'strength', 'strength_exp', 'injury', 'leadership', 'leadership_exp',
'explevel', 'experience', 'dedication', 'officer_level', 'officer_city', 'gold', 'rice', 'dex1', 'dex2', 'dex3', 'dex4', 'dex5', 'explevel', 'experience', 'dedication', 'officer_level', 'officer_city', 'gold', 'rice', 'dex1', 'dex2', 'dex3', 'dex4', 'dex5',
'warnum', 'killnum', 'killcrew',
], ],
'min'=>[ 'min'=>[
['no', 1], ['no', 1],
@@ -109,6 +110,9 @@ $generalCheck = [
['dex3', 0], ['dex3', 0],
['dex4', 0], ['dex4', 0],
['dex5', 0], ['dex5', 0],
['warnum', 0],
['killnum', 0],
['killcrew', 0],
], ],
'between'=>[ 'between'=>[
['train', [40, GameConst::$maxTrainByWar]], ['train', [40, GameConst::$maxTrainByWar]],
@@ -148,7 +152,8 @@ foreach($rawDefenderList as $idx=>$rawDefenderGeneral){
'reason'=>"[수비자{$idx}]".$v->errorStr() 'reason'=>"[수비자{$idx}]".$v->errorStr()
]); ]);
} }
$defenderList[] = new General($rawDefenderGeneral, null, $rawDefenderCity, $rawAttackerNation, $year, $month, true);
$defenderList[] = new General($rawDefenderGeneral, extractRankVar($rawDefenderGeneral), $rawDefenderCity, $rawAttackerNation, $year, $month, true);
} }
@@ -273,6 +278,15 @@ $gameStor = KVStorage::getStorage($db, 'game_env');
$startYear = $gameStor->startyear; $startYear = $gameStor->startyear;
$cityRate = Util::round(($year - $startYear) / 1.5) + 60; $cityRate = Util::round(($year - $startYear) / 1.5) + 60;
function extractRankVar(array $rawVal):array{
$rankVars = [];
foreach($rawVal as $rawKey=>$rawVal){
if(key_exists($rawKey, General::RANK_COLUMN)){
$rankVars[$rawKey] = $rawVal;
}
}
return $rankVars;
}
function simulateBattle( function simulateBattle(
$rawAttacker, $rawAttackerCity, $rawAttackerNation, $rawAttacker, $rawAttackerCity, $rawAttackerNation,
@@ -280,7 +294,7 @@ function simulateBattle(
$startYear, $year, $month, $cityRate $startYear, $year, $month, $cityRate
){ ){
$attacker = new WarUnitGeneral( $attacker = new WarUnitGeneral(
new General($rawAttacker, null, $rawAttackerCity, $rawAttackerNation, $year, $month), new General($rawAttacker, extractRankVar($rawAttacker), $rawAttackerCity, $rawAttackerNation, $year, $month),
$rawAttackerNation, $rawAttackerNation,
true true
); );
@@ -312,7 +326,7 @@ function simulateBattle(
return null; return null;
} }
$defenderObj = new General($iterDefender->current(), null, $rawDefenderCity, $rawDefenderNation, $year, $month); $defenderObj = new General($iterDefender->current(), extractRankVar($iterDefender->current()), $rawDefenderCity, $rawDefenderNation, $year, $month);
if(extractBattleOrder($defenderObj) <= 0){ if(extractBattleOrder($defenderObj) <= 0){
return null; return null;
} }
+150
View File
@@ -0,0 +1,150 @@
<?php
namespace sammo;
include "lib.php";
include "func.php";
WebUtil::requireAJAX();
$pick = Util::getPost('pick');
if(!$pick){
Json::die([
'result'=>false,
'reason'=>'장수를 선택하지 않았습니다'
]);
}
$session = Session::requireLogin([])->setReadOnly();
$userID = Session::getUserID();
$db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env');
$rootDB = RootDB::db();
$oNow = new \DateTimeImmutable();
$now = $oNow->format('Y-m-d H:i:s');
$generalID = $db->queryFirstField('SELECT no FROM general WHERE owner = %i', $userID);
if(!$generalID){
Json::die([
'result'=>false,
'reason'=>'장수가 생성하지 않았습니다. 이미 사망하지 않았는지 확인해보세요.'
]);
}
list(
$year,
$month,
$maxgeneral,
$npcmode,
$turnterm
) = $gameStor->getValuesAsArray(['year', 'month', 'maxgeneral', 'npcmode', 'turnterm']);
if($npcmode!=2){
Json::die([
'result'=>false,
'reason'=>'선택 가능한 서버가 아닙니다'
]);
}
$info = $db->queryFirstField('SELECT info FROM select_pool WHERE `owner` = %i AND `reserved_until`>=%s AND `unique_name`=%s', $userID, $now, $pick);
if(!$info){
Json::die([
'result'=>false,
'reason'=>'유효한 장수 목록이 없습니다.'
]);
}
$ownerInfo = RootDB::db()->queryFirstRow('SELECT `name`,`picture`,`imgsvr` FROM member WHERE `NO`=%i',$userID);
if(!$ownerInfo){
Json::die([
'result'=>false,
'reason'=>'멤버 정보를 가져오지 못했습니다.'
]);
}
$info = Json::decode($info);
$generalObj = General::createGeneralObjFromDB($generalID);
$oldGeneralName = $generalObj->getName();
$db->update('select_pool', [
'general_id'=>-$generalID,
'owner'=>null,
'reserved_until'=>null
], 'unique_name=%s AND `reserved_until` IS NOT NULL AND owner = %i', $info['uniqueName'], $userID);
if($db->affectedRows()==0){
Json::die([
'result'=>false,
'reason'=>'동시성 제어에 문제가 발생했습니다. 버그 제보를 부탁드립니다.'
]);
}
$db->update('select_pool', [
'general_id'=>null,
'owner'=>null,
'reserved_until'=>null,
], 'unique_name != %s AND general_id = %i', $info['uniqueName'], $generalID);
$db->update('select_pool', [
'general_id'=>$generalID,
], 'general_id=%i', -$generalID);
if($db->affectedRows()==0){
Json::die([
'result'=>false,
'reason'=>'장수 선택 과정에 문제가 발생했습니다.. 버그 제보를 부탁드립니다.'
]);
}
$db->update('select_pool',[
'owner'=>null,
'reserved_until'=>null,
], '(owner=%i or reserved_until < %s) AND general_id is NULL', $userID, $now);
if(key_exists('leadership', $info)){
$generalObj->updateVar('leadership', $info['leadership']);
$generalObj->updateVar('strength', $info['strength']);
$generalObj->updateVar('intel', $info['intel']);
}
if(key_exists('picture', $info)){
$generalObj->updateVar('imgsvr', $info['imgsvr']);
$generalObj->updateVar('picture', $info['picture']);
}
if(key_exists('generalName', $info)){
$generalObj->updateVar('name', $info['generalName']);
}
if(key_exists('dex', $info)){
$generalObj->updateVar('dex1', $info['dex'][0]);
$generalObj->updateVar('dex2', $info['dex'][1]);
$generalObj->updateVar('dex3', $info['dex'][2]);
$generalObj->updateVar('dex4', $info['dex'][3]);
$generalObj->updateVar('dex5', $info['dex'][4]);
}
if(key_exists('ego', $info)){
$generalObj->updateVar('personal', $info['ego']);
}
if(key_exists('specialDomestic', $info)){
$generalObj->updateVar('special', $info['specialDomestic']);
}
if(key_exists('specialWar', $info)){
$generalObj->updateVar('special2', $info['specialWar']);
}
$generalObj->setAuxVar('next_change', TimeUtil::nowAddMinutes(12 * $turnterm));
$userNick = $ownerInfo['name'];
$josaYi = JosaUtil::pick($userNick, '이');
$generalName = $info['generalName'];
$josaRo = JosaUtil::pick($generalName, '로');
$logger = $generalObj->getLogger();
$logger->pushGeneralHistoryLog("장수를 <Y>{$oldGeneralName}</>에서 <Y>{$generalName}</>{$josaRo} 변경");
$logger->pushGlobalActionLog("<Y>{$userNick}</>{$josaYi} 장수를 <Y>{$oldGeneralName}</>에서 <Y>{$generalName}</>{$josaRo} 변경합니다.");
$generalObj->applyDB($db);
Json::die([
'result'=>true,
'reason'=>'success'
]);
+6 -2
View File
@@ -24,7 +24,12 @@ if (!$member) {
$db = DB::db(); $db = DB::db();
$gameStor = KVStorage::getStorage($db, 'game_env'); $gameStor = KVStorage::getStorage($db, 'game_env');
$admin = $gameStor->getValues(['block_general_create','show_img_level','maxgeneral']);
if($admin['block_general_create']){
MessageBox("잘못된 접근입니다!!!");
echo "<script>history.go(-1);</script>";
exit(1);
}
?> ?>
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
@@ -66,7 +71,6 @@ echo Json::encode((object)$charInfoText);
<tr><td align=center><?=info(0)?></td></tr> <tr><td align=center><?=info(0)?></td></tr>
</table> </table>
<?php <?php
$admin = $gameStor->getValues(['show_img_level','maxgeneral']);
$gencount = $db->queryFirstField('SELECT count(no) FROM general WHERE npc<2'); $gencount = $db->queryFirstField('SELECT count(no) FROM general WHERE npc<2');
+161 -29
View File
@@ -11,6 +11,25 @@ jQuery(function($){
var initBasicEvent = function() { var initBasicEvent = function() {
if (window.nation) {
$('.form_city_level').val(window.city.level);
$('.form_def').val(parseInt(window.city.def));
$('.form_wall').val(parseInt(window.city.wall));
$('.form_nation_type').val(window.nation.type);
$('.form_nation_level').val(window.nation.level);
$('.form_tech').val(parseInt(window.nation.tech / 1000));
if (window.nation.capital == window.city.city) {
$('.attacker_nation .form_is_capital:first').click();
$('.defender_nation .form_is_capital:first').click();
} else {
$('.attacker_nation .form_is_capital:last').click();
$('.defender_nation .form_is_capital:last').click();
}
} else {
$('.attacker_nation .form_is_capital:last').click();
$('.defender_nation .form_is_capital:last').click();
}
$('.form_injury').change(function() { $('.form_injury').change(function() {
var $this = $(this); var $this = $(this);
var $general = getGeneralDetail($this); var $general = getGeneralDetail($this);
@@ -23,16 +42,13 @@ jQuery(function($){
if (injury > 60) { if (injury > 60) {
text = '위독'; text = '위독';
color = 'red'; color = 'red';
} } else if (injury > 40) {
else if(injury > 40){
text = '심각'; text = '심각';
color = 'magenta'; color = 'magenta';
} } else if (injury > 20) {
else if(injury > 20){
text = '중상'; text = '중상';
color = 'orange'; color = 'orange';
} } else if (injury > 0) {
else if(injury > 0){
text = '경상'; text = '경상';
color = 'yellow'; color = 'yellow';
} }
@@ -75,6 +91,15 @@ jQuery(function($){
return false; return false;
}); });
$('.btn-general-import-server').click(function() {
var $this = $(this);
var $card = getGeneralFrame($this);
var $modal = $('#importModal');
$modal.data('target', $card);
$modal.modal('show');
});
$('.btn-general-save').click(function() { $('.btn-general-save').click(function() {
var $this = $(this); var $this = $(this);
var $general = getGeneralDetail($this); var $general = getGeneralDetail($this);
@@ -154,7 +179,6 @@ jQuery(function($){
setVal('.form_officer_level', data.officer_level); setVal('.form_officer_level', data.officer_level);
setVal('.form_exp_level', data.explevel); setVal('.form_exp_level', data.explevel);
setVal('.form_injury', data.injury);
setVal('.form_leadership', data.leadership); setVal('.form_leadership', data.leadership);
setVal('.form_general_horse', data.horse); setVal('.form_general_horse', data.horse);
@@ -183,6 +207,10 @@ jQuery(function($){
setVal('.form_dex5', data.dex5); setVal('.form_dex5', data.dex5);
setVal('.form_defence_train', data.defence_train); setVal('.form_defence_train', data.defence_train);
setVal('.form_warnum', data.warnum);
setVal('.form_killnum', data.killnum);
setVal('.form_killcrew', data.killcrew);
if (!setGeneralNo($general, data.no)) { if (!setGeneralNo($general, data.no)) {
setGeneralNo($general, generateNewGeneralNo()); setGeneralNo($general, generateNewGeneralNo());
} }
@@ -228,7 +256,13 @@ jQuery(function($){
dex3: getInt('.form_dex3'), dex3: getInt('.form_dex3'),
dex4: getInt('.form_dex4'), dex4: getInt('.form_dex4'),
dex5: getInt('.form_dex5'), dex5: getInt('.form_dex5'),
defence_train: getInt('.form_defence_train'), defence_train: getInt('.form_defence_train'),
warnum: getInt('.form_warnum'),
killnum: getInt('.form_killnum'),
killcrew: getInt('.form_killcrew'),
}; };
} }
@@ -281,8 +315,7 @@ jQuery(function($){
try { try {
reader.readAsText(file); reader.readAsText(file);
} } catch (e) {
catch(e) {
alert('파일을 읽는데 실패했습니다.'); alert('파일을 읽는데 실패했습니다.');
return false; return false;
} }
@@ -349,8 +382,7 @@ jQuery(function($){
try { try {
reader.readAsText(file); reader.readAsText(file);
} } catch (e) {
catch(e) {
alert('파일을 읽는데 실패했습니다.'); alert('파일을 읽는데 실패했습니다.');
return false; return false;
} }
@@ -431,8 +463,7 @@ jQuery(function($){
if ($cardAfter === undefined) { if ($cardAfter === undefined) {
$defenderColumn.append($newCard); $defenderColumn.append($newCard);
} } else {
else{
$cardAfter.after($newCard); $cardAfter.after($newCard);
} }
@@ -485,8 +516,7 @@ jQuery(function($){
$attackerNation.find('.form_nation_level').val(attackerNation.level); $attackerNation.find('.form_nation_level').val(attackerNation.level);
if (attackerNation.capital == 1) { if (attackerNation.capital == 1) {
$attackerNation.find('.form_is_capital:first').click(); $attackerNation.find('.form_is_capital:first').click();
} } else {
else{
$attackerNation.find('.form_is_capital:last').click(); $attackerNation.find('.form_is_capital:last').click();
} }
$attackerNation.find('.form_city_level').val(attackerCity.level); $attackerNation.find('.form_city_level').val(attackerCity.level);
@@ -498,8 +528,7 @@ jQuery(function($){
$defenderNation.find('.form_nation_level').val(defenderNation.level); $defenderNation.find('.form_nation_level').val(defenderNation.level);
if (defenderNation.capital == 1) { if (defenderNation.capital == 1) {
$defenderNation.find('.form_is_capital:first').click(); $defenderNation.find('.form_is_capital:first').click();
} } else {
else{
$defenderNation.find('.form_is_capital:last').click(); $defenderNation.find('.form_is_capital:last').click();
} }
$defenderNation.find('.form_city_level').val(defenderCity.level); $defenderNation.find('.form_city_level').val(defenderCity.level);
@@ -617,8 +646,7 @@ jQuery(function($){
var attackerGeneral = extendGeneralInfoForDB(allData.attackerGeneral); var attackerGeneral = extendGeneralInfoForDB(allData.attackerGeneral);
if (2 <= attackerGeneral.officer_level && attackerGeneral.officer_level <= 4) { if (2 <= attackerGeneral.officer_level && attackerGeneral.officer_level <= 4) {
attackerGeneral.officer_city = 1; attackerGeneral.officer_city = 1;
} } else {
else{
attackerGeneral.officer_city = 0; attackerGeneral.officer_city = 0;
} }
@@ -629,16 +657,15 @@ jQuery(function($){
var defenderCity = $.extend({}, defaultCity, allData.defenderCity); var defenderCity = $.extend({}, defaultCity, allData.defenderCity);
defenderCity.nation = 2; defenderCity.nation = 2;
defenderCity.city = 3; defenderCity.city = 3;
defenderCity.wall_max = defenderCity.wall/5*6; defenderCity.wall_max = parseInt(defenderCity.wall / 5 * 6);
defenderCity.def_max = defenderCity.def/5*6; defenderCity.def_max = parseInt(defenderCity.def / 5 * 6);
var defenderGenerals = []; var defenderGenerals = [];
$.each(allData.defenderGenerals, function() { $.each(allData.defenderGenerals, function() {
var defenderGeneral = extendGeneralInfoForDB(this); var defenderGeneral = extendGeneralInfoForDB(this);
if (2 <= defenderGeneral.officer_level && defenderGeneral.officer_level <= 4) { if (2 <= defenderGeneral.officer_level && defenderGeneral.officer_level <= 4) {
defenderGeneral.officer_city = 3; defenderGeneral.officer_city = 3;
} } else {
else{
defenderGeneral.officer_city = 0; defenderGeneral.officer_city = 0;
} }
@@ -672,8 +699,7 @@ jQuery(function($){
var toPretty = function(number) { var toPretty = function(number) {
if (isInt(number)) { if (isInt(number)) {
number = parseInt(number); number = parseInt(number);
} } else {
else{
number = parseFloat(number).toFixed(2); number = parseFloat(number).toFixed(2);
} }
return numberWithCommas(number); return numberWithCommas(number);
@@ -688,8 +714,7 @@ jQuery(function($){
$('#result_maxKilled').html(toPretty(result.maxKilled)); $('#result_maxKilled').html(toPretty(result.maxKilled));
$('#result_minKilled').html(toPretty(result.minKilled)); $('#result_minKilled').html(toPretty(result.minKilled));
$('#result_varKilled').show(); $('#result_varKilled').show();
} } else {
else{
$('#result_varKilled').hide(); $('#result_varKilled').hide();
} }
$('#result_dead').html(toPretty(result.dead)); $('#result_dead').html(toPretty(result.dead));
@@ -697,8 +722,7 @@ jQuery(function($){
$('#result_maxDead').html(toPretty(result.maxDead)); $('#result_maxDead').html(toPretty(result.maxDead));
$('#result_minDead').html(toPretty(result.minDead)); $('#result_minDead').html(toPretty(result.minDead));
$('#result_varDead').show(); $('#result_varDead').show();
} } else {
else{
$('#result_varDead').hide(); $('#result_varDead').hide();
} }
@@ -786,6 +810,114 @@ jQuery(function($){
}); });
} }
var initGeneralList = false;
$('#importFromDB').click(function() {
var generalID = $('#modalSelector').val();
console.log(generalID);
$.post({
url: 'j_export_simulator_object.php',
dataType: 'json',
data: {
destGeneralID: generalID
}
}).then(function(data) {
if (!data.result) {
alert(data.reason);
return false;
}
var $modal = $('#importModal');
var $card = $modal.data('target');
importGeneralInfo($card, data.general);
$modal.modal('hide');
}, errUnknown);
});
$('#importModal').on('show.bs.modal', function(e) {
if (!initGeneralList) {
var $list = $('#modalSelector');
var addNation = function(generalList, nationName, color) {
generalList.sort(function(lhs, rhs) {
if (lhs.npc != rhs.npc) {
return lhs.npc - rhs.npc;
}
if (lhs.name < rhs.name) {
return -1;
}
if (lhs.name > rhs.name) {
return 1;
}
return 0;
})
var $optGroup = $('<optgroup label="{0}"></optgroup>'.format(nationName));
$optGroup.css('background-color', color);
$optGroup.css('color', isBrightColor(color) ? 'black' : 'white');
$.each(generalList, function(idx, general) {
$item = $('<option value="{0}">{1}</option>'.format(general.no, general.name));
if (general.npc) {
$item.css('color', getNpcColor(general.npc));
} else {
$item.css('color', 'white');
}
$item.css('background-color', 'black');
$optGroup.append($item);
});
$list.append($optGroup);
}
$.post({
url: 'j_get_basic_general_list.php',
dataType: 'json',
data: {
req: 2,
}
}).then(function(data) {
if (!data.result) {
alert(data.reason);
$('#importModal').modal('hide');
return false;
}
var nations = data.nation;
var myNationID = data.nationID;
$list.empty();
//자국 먼저
if (0 in data.list) {
nations[0] = {
nation: 0,
name: '재야',
color: '#000000'
};
}
addNation(combineArray(data.list[myNationID], data.column), nations[myNationID].name, nations[myNationID].color);
for (var nationID in data.list) {
if (nationID == myNationID) {
continue;
}
addNation(combineArray(data.list[nationID], data.column), nations[nationID].name, nations[nationID].color);
}
initGeneralList = true;
}, errUnknown);
}
});
initBasicEvent(); initBasicEvent();
$attackerCard.append($generalForm.clone(true, true)); $attackerCard.append($generalForm.clone(true, true));
addDefender(); addDefender();
+7 -13
View File
@@ -121,7 +121,7 @@ $(function(){
var $generalSelect = $('#genlist_{0} option:selected'.format(officerLevel)); var $generalSelect = $('#genlist_{0} option:selected'.format(officerLevel));
var $citySelect = $('#citylist_{0} option:selected'.format(officerLevel)); var $citySelect = $('#citylist_{0} option:selected'.format(officerLevel));
var generalID = $generalSelect.val(); var generalID = parseInt($generalSelect.val());
var generalName = $generalSelect.data('name'); var generalName = $generalSelect.data('name');
var generalOfficerLevel = $generalSelect.data('officer_level'); var generalOfficerLevel = $generalSelect.data('officer_level');
@@ -131,19 +131,16 @@ $(function(){
if (!confirm('{0}직을 비우시겠습니까?'.format(officerLevelText))) { if (!confirm('{0}직을 비우시겠습니까?'.format(officerLevelText))) {
return false; return false;
} }
} } else if (generalOfficerLevel >= 5) {
else if(generalOfficerLevel >= 5){
if (!confirm('이미 수뇌인 {0}을(를) {1}직에 임명하시겠습니까?'.format(generalName, officerLevelText))) { if (!confirm('이미 수뇌인 {0}을(를) {1}직에 임명하시겠습니까?'.format(generalName, officerLevelText))) {
return false; return false;
} }
} } else {
else{
if (!confirm('{0}을(를) {1}직에 임명하시겠습니까?'.format(generalName, officerLevelText))) { if (!confirm('{0}을(를) {1}직에 임명하시겠습니까?'.format(generalName, officerLevelText))) {
return false; return false;
} }
} }
} } else {
else{
cityID = $citySelect.val(); cityID = $citySelect.val();
if (!cityID) { if (!cityID) {
alert('도시를 선택해주세요'); alert('도시를 선택해주세요');
@@ -155,13 +152,11 @@ $(function(){
if (!confirm('{0} {1}직을 비우시겠습니까?'.format(cityName, officerLevelText))) { if (!confirm('{0} {1}직을 비우시겠습니까?'.format(cityName, officerLevelText))) {
return false; return false;
} }
} } else if (generalOfficerLevel >= 5) {
else if(generalOfficerLevel >= 5){
if (!confirm('수뇌인 {0}을(를) {1} {2}직에 임명하시겠습니까?'.format(generalName, cityName, officerLevelText))) { if (!confirm('수뇌인 {0}을(를) {1} {2}직에 임명하시겠습니까?'.format(generalName, cityName, officerLevelText))) {
return false; return false;
} }
} } else {
else{
if (!confirm('{0}을(를) {1} {2}직에 임명하시겠습니까?'.format(generalName, cityName, officerLevelText))) { if (!confirm('{0}을(를) {1} {2}직에 임명하시겠습니까?'.format(generalName, cityName, officerLevelText))) {
return false; return false;
} }
@@ -189,8 +184,7 @@ $(function(){
if (generalID) { if (generalID) {
alert('{0}을(를) 임명했습니다.'.format(generalName)); alert('{0}을(를) 임명했습니다.'.format(generalName));
} } else {
else{
alert('관직을 비웠습니다.'); alert('관직을 비웠습니다.');
} }
+80 -12
View File
@@ -32,7 +32,8 @@ function isInt(n) {
return +n === n && !(n % 1); return +n === n && !(n % 1);
} }
;(function(ns){ ;
(function(ns) {
//https://gist.github.com/demouth/3217440 //https://gist.github.com/demouth/3217440
/** /**
* mb_strwidth * mb_strwidth
@@ -41,7 +42,10 @@ function isInt(n) {
* @see http://php.net/manual/ja/function.mb-strwidth.php * @see http://php.net/manual/ja/function.mb-strwidth.php
*/ */
var mb_strwidth = function(str) { var mb_strwidth = function(str) {
var i=0,l=str.length,c='',length=0; var i = 0,
l = str.length,
c = '',
length = 0;
for (; i < l; i++) { for (; i < l; i++) {
c = str.charCodeAt(i); c = str.charCodeAt(i);
if (0x0000 <= c && c <= 0x0019) { if (0x0000 <= c && c <= 0x0019) {
@@ -70,9 +74,17 @@ function isInt(n) {
*/ */
var mb_strimwidth = function(str, start, width, trimmarker) { var mb_strimwidth = function(str, start, width, trimmarker) {
if (typeof trimmarker === 'undefined') trimmarker = ''; if (typeof trimmarker === 'undefined') trimmarker = '';
var trimmakerWidth = mb_strwidth(trimmarker),i=start,l=str.length,trimmedLength=0,trimmedStr=''; var trimmakerWidth = mb_strwidth(trimmarker),
i = start,
l = str.length,
trimmedLength = 0,
trimmedStr = '';
for (; i < l; i++) { for (; i < l; i++) {
var charCode=str.charCodeAt(i),c=str.charAt(i),charWidth=mb_strwidth(c),next=str.charAt(i+1),nextWidth=mb_strwidth(next); var charCode = str.charCodeAt(i),
c = str.charAt(i),
charWidth = mb_strwidth(c),
next = str.charAt(i + 1),
nextWidth = mb_strwidth(next);
trimmedLength += charWidth; trimmedLength += charWidth;
trimmedStr += c; trimmedStr += c;
if (trimmedLength + trimmakerWidth + nextWidth > width) { if (trimmedLength + trimmakerWidth + nextWidth > width) {
@@ -138,8 +150,7 @@ function isBrightColor(color){
color = hexToRgb(color); color = hexToRgb(color);
if ((color.r * 0.299 + color.g * 0.587 + color.b * 0.114) > 140) { if ((color.r * 0.299 + color.g * 0.587 + color.b * 0.114) > 140) {
return true; return true;
} } else {
else{
return false; return false;
} }
} }
@@ -208,8 +219,7 @@ var TemplateEngine = function (html, options) {
} }
add(html.substr(cursor, html.length - cursor)); add(html.substr(cursor, html.length - cursor));
code = (code + 'return r.join(""); }').replace(/[\r\t\n]/g, ' '); code = (code + 'return r.join(""); }').replace(/[\r\t\n]/g, ' ');
try { result = new Function('obj', code).apply(options, [options]); } try { result = new Function('obj', code).apply(options, [options]); } catch (err) { console.error("'" + err.message + "'", " in \n\nCode:\n", code, "\n"); }
catch (err) { console.error("'" + err.message + "'", " in \n\nCode:\n", code, "\n"); }
return result; return result;
} }
@@ -217,8 +227,7 @@ function getIconPath(imgsvr, picture){
// ../d_shared/common_path.js 필요 // ../d_shared/common_path.js 필요
if (!imgsvr) { if (!imgsvr) {
return pathConfig.sharedIcon + '/' + picture; return pathConfig.sharedIcon + '/' + picture;
} } else {
else{
return pathConfig.root + '/d_pic/' + picture; return pathConfig.root + '/d_pic/' + picture;
} }
} }
@@ -227,8 +236,7 @@ function activeFlip($obj){
var $result; var $result;
if ($obj === undefined) { if ($obj === undefined) {
$result = $('img[data-flip]'); $result = $('img[data-flip]');
} } else {
else{
$result = $obj.find('img[data-flip]'); $result = $obj.find('img[data-flip]');
} }
@@ -238,6 +246,24 @@ function activeFlip($obj){
} }
function combineObject(item, columnList) {
var newItem = {};
for (var columnIdx in columnList) {
var columnName = columnList[columnIdx];
newItem[columnName] = item[columnIdx];
}
return newItem;
}
function combineArray(array, columnList) {
var result = [];
for (var key in array) {
var item = array[key];
result[key] = combineObject(item, columnList);
}
return result;
}
function activeFlipItem($img) { function activeFlipItem($img) {
var imageList = []; var imageList = [];
imageList.push($img.attr('src')); imageList.push($img.attr('src'));
@@ -347,3 +373,45 @@ function getNpcColor(npcType){
} }
return null; return null;
} }
function initTooltip($obj) {
if ($obj === undefined) {
$obj = $('.obj_tooltip');
} else if (!$obj.hasClass('obj_tooltip')) {
$obj = $obj.find('.obj_tooltip');
}
console.log($obj);
$obj.each(function() {
$target = $(this);
if ($target.data('installHandler')) {
return true;
}
$target.data('installHandler', true);
$target.mouseover(function() {
var $objTooltip = $(this);
if ($objTooltip.data('setObjTooltip')) {
return true;
}
var tooltipClassText = $objTooltip.data('tooltip-class');
if (!tooltipClassText) {
tooltipClassText = '';
}
var template = '<div class="tooltip {0}" role="tooltip"><div class="arrow"></div><div class="tooltip-inner"></div></div>'
.format(tooltipClassText);
$objTooltip.tooltip({
title: function() {
return $.trim($(this).find('.tooltiptext').html());
},
template: template,
html: true
}).tooltip('show');
$objTooltip.data('setObjTooltip', true);
});
});
}
+3 -5
View File
@@ -1,4 +1,3 @@
/* /*
function showCityGeneral(cityIdx){ function showCityGeneral(cityIdx){
@@ -91,8 +90,7 @@ function scenarioPreview(){
$npc.html('{0}명'.format(scenario.npc_cnt)); $npc.html('{0}명'.format(scenario.npc_cnt));
if (scenario.npcEx_cnt == 0) { if (scenario.npcEx_cnt == 0) {
$npcEx.html(''); $npcEx.html('');
} } else {
else{
$npcEx.html('+{0}명'.format(scenario.npcEx_cnt)); $npcEx.html('+{0}명'.format(scenario.npcEx_cnt));
} }
@@ -177,6 +175,7 @@ function formSetup(){
scenario: $('#scenario_sel').val(), scenario: $('#scenario_sel').val(),
fiction: $('#fiction input:radio:checked').val(), fiction: $('#fiction input:radio:checked').val(),
extend: $('#extend input:radio:checked').val(), extend: $('#extend input:radio:checked').val(),
block_general_create: $('#block_general_create input:radio:checked').val(),
npcmode: $('#npcmode input:radio:checked').val(), npcmode: $('#npcmode input:radio:checked').val(),
show_img_level: $('#show_img_level input:radio:checked').val(), show_img_level: $('#show_img_level input:radio:checked').val(),
tournament_trig: $('#tournament_trig input:radio:checked').val(), tournament_trig: $('#tournament_trig input:radio:checked').val(),
@@ -192,8 +191,7 @@ function formSetup(){
if (!result.result) { if (!result.result) {
alert(result.reason); alert(result.reason);
deferred.reject('fail'); deferred.reject('fail');
} } else {
else{
alert('게임이 리셋되었습니다.'); alert('게임이 리셋되었습니다.');
deferred.resolve(); deferred.resolve();
} }
+91 -59
View File
@@ -1,4 +1,3 @@
function is_touch_device() { function is_touch_device() {
var prefixes = ' -webkit- -moz- -o- -ms- '.split(' '); var prefixes = ' -webkit- -moz- -o- -ms- '.split(' ');
var mq = function(query) { var mq = function(query) {
@@ -16,8 +15,11 @@ function is_touch_device() {
return mq(query); return mq(query);
} }
function reloadWorldMap(option){ function reloadWorldMap(option, drawTarget) {
var $world_map = $('.world_map'); if (drawTarget === undefined || drawTarget === null) {
drawTarget = '.world_map'
}
var $world_map = $(drawTarget);
if ($world_map.length == 0) { if ($world_map.length == 0) {
return; return;
@@ -36,7 +38,11 @@ function reloadWorldMap(option){
aux: null, //기타 넣고 싶은 값을 입력 aux: null, //기타 넣고 싶은 값을 입력
neutralView: false, //clickable, 소속 국가, 첩보 여부 등을 반환여부를 설정 neutralView: false, //clickable, 소속 국가, 첩보 여부 등을 반환여부를 설정
showMe: true, //반환 값에 본인이 위치한 도시 값을 반환하도록 설정. neutralView와 별개 showMe: true, //반환 값에 본인이 위치한 도시 값을 반환하도록 설정. neutralView와 별개
targetJson: 'j_map.php', targetJson: 'j_map.php',
reqType: 'post',
dynamicMapTheme: false,
callback: null,
//기타 보조 값 //기타 보조 값
startYear: null, startYear: null,
@@ -63,9 +69,9 @@ function reloadWorldMap(option){
return obj.promise(); return obj.promise();
} }
if(!$.isNumeric(obj.startYear) if (!$.isNumeric(obj.startYear) ||
||!$.isNumeric(obj.year) !$.isNumeric(obj.year) ||
||!$.isNumeric(obj.month) !$.isNumeric(obj.month)
) { ) {
var obj = $.Deferred(); var obj = $.Deferred();
obj.reject('fail'); obj.reject('fail');
@@ -82,26 +88,40 @@ function reloadWorldMap(option){
return obj; return obj;
} }
function setMapBackground(obj) { function setMapBackground(obj) {
function setTheme() {
var oldTheme = $world_map.data('currentTheme');
var newTheme = obj.theme;
if (oldTheme === newTheme) {
return;
}
if (oldTheme) {
$world_map.removeClass('map_theme_' + oldTheme);
}
$world_map.addClass('map_theme_' + newTheme);
$world_map.data('currentTheme', newTheme);
}
if (option.dynamicMapTheme) {
setTheme();
}
var startYear = obj.startYear; var startYear = obj.startYear;
var year = obj.year; var year = obj.year;
var month = obj.month; var month = obj.month;
if (isDetailMap) { if (isDetailMap) {
$world_map.addClass('map_detail').removeClass('map_basic'); $world_map.addClass('map_detail').removeClass('map_basic');
} } else {
else{
$world_map.addClass('map_basic').removeClass('map_detail'); $world_map.addClass('map_basic').removeClass('map_detail');
} }
var $map_title = $('.map_title_text'); var $map_title = $('.map_title_text');
if (year < startYear + 1) { if (year < startYear + 1) {
$map_title.css('color', 'magenta'); $map_title.css('color', 'magenta');
} } else if (year < startYear + 2) {
else if(year < startYear + 2){
$map_title.css('color', 'orange'); $map_title.css('color', 'orange');
} } else if (year < startYear + 3) {
else if(year < startYear + 3){
$map_title.css('color', 'yellow'); $map_title.css('color', 'yellow');
} }
@@ -135,14 +155,11 @@ function reloadWorldMap(option){
$world_map.removeClass('map_string map_summer map_fall map_winter'); $world_map.removeClass('map_string map_summer map_fall map_winter');
if (month <= 3) { if (month <= 3) {
$world_map.addClass('map_spring'); $world_map.addClass('map_spring');
} } else if (month <= 6) {
else if(month <= 6){
$world_map.addClass('map_summer'); $world_map.addClass('map_summer');
} } else if (month <= 9) {
else if(month <= 9){
$world_map.addClass('map_fall'); $world_map.addClass('map_fall');
} } else {
else{
$world_map.addClass('map_winter'); $world_map.addClass('map_winter');
} }
@@ -218,10 +235,10 @@ function reloadWorldMap(option){
} }
function mergeClickable(city) { function mergeClickable(city) {
//clickable = (remainSpy << 3) | (ourCity << 2) | (shownByGeneral << 1) | clickableAll //clickable = (defaultCity << 4 ) | (remainSpy << 3) | (ourCity << 2) | (shownByGeneral << 1) | clickableAll
var id = city.id; var id = city.id;
var nationId = city.nationId; var nationId = city.nationId;
var clickable = 0; var clickable = 16;
if (id in spyList) { if (id in spyList) {
clickable |= spyList[id] << 3; clickable |= spyList[id] << 3;
} }
@@ -257,7 +274,7 @@ function reloadWorldMap(option){
function drawDetailWorldMap(obj) { function drawDetailWorldMap(obj) {
var $map_body = $('.world_map .map_body'); var $map_body = $(drawTarget + ' .map_body');
var cityList = obj.cityList; var cityList = obj.cityList;
var myCity = obj.myCity; var myCity = obj.myCity;
@@ -317,7 +334,7 @@ function reloadWorldMap(option){
function drawBasicWorldMap(obj) { function drawBasicWorldMap(obj) {
var $map_body = $('.world_map .map_body'); var $map_body = $(drawTarget + ' .map_body');
var cityList = obj.cityList; var cityList = obj.cityList;
var myCity = obj.myCity; var myCity = obj.myCity;
@@ -345,11 +362,9 @@ function reloadWorldMap(option){
var state_text = 'wrong'; var state_text = 'wrong';
if (city.state < 10) { if (city.state < 10) {
state_text = 'good'; state_text = 'good';
} } else if (city.state < 40) {
else if(city.state < 40){
state_text = 'bad'; state_text = 'bad';
} } else if (city.state < 50) {
else if(city.state < 50){
state_text = 'war'; state_text = 'war';
} }
@@ -375,13 +390,13 @@ function reloadWorldMap(option){
} }
function setMouseWork(obj) { function setMouseWork(obj) {
var $tooltip = $('.world_map .city_tooltip'); var $tooltip = $(drawTarget + ' .city_tooltip');
var $tooltip_city = $tooltip.find('.city_name'); var $tooltip_city = $tooltip.find('.city_name');
var $tooltip_nation = $tooltip.find('.nation_name'); var $tooltip_nation = $tooltip.find('.nation_name');
var $objs = $('.world_map .city_link'); var $objs = $(drawTarget + ' .city_link');
var $map_body = $('.world_map .map_body'); var $map_body = $(drawTarget + ' .map_body');
//터치스크린 탭 //터치스크린 탭
@@ -395,11 +410,9 @@ function reloadWorldMap(option){
var touchMode = $this.data('touchMode'); var touchMode = $this.data('touchMode');
if ($tooltip_city.data('target') != $this.data('id')) { if ($tooltip_city.data('target') != $this.data('id')) {
$this.data('touchMode', 1); $this.data('touchMode', 1);
} } else if (touchMode === undefined) {
else if(touchMode === undefined){
$this.data('touchMode', 1); $this.data('touchMode', 1);
} } else {
else{
$this.data('touchMode', touchMode + 1); $this.data('touchMode', touchMode + 1);
} }
$map_body.data('touchMode', 1); $map_body.data('touchMode', 1);
@@ -420,12 +433,20 @@ function reloadWorldMap(option){
var nation_text = $this.data('nation'); var nation_text = $this.data('nation');
if (nation_text) { if (nation_text) {
$tooltip_nation.html(nation_text).show(); $tooltip_nation.html(nation_text).show();
} } else {
else{
$tooltip_nation.html('').hide(); $tooltip_nation.html('').hide();
} }
$tooltip.css({'top': position.top + 25, 'left': position.left + 35}).show(); var left = position.left;
var top = position.top;
var scale = $map_body.data('scale');
if (scale) {
left /= scale;
top /= scale;
}
$tooltip.css({ 'top': top + 25, 'left': left + 35 }).show();
var touchMode = $this.data('touchMode'); var touchMode = $this.data('touchMode');
if (touchMode <= 1) { if (touchMode <= 1) {
@@ -453,11 +474,17 @@ function reloadWorldMap(option){
return true; return true;
} }
var parentOffset = $map_body.offset(); var rect = this.getBoundingClientRect();
var relX = e.pageX - parentOffset.left; var left = (e.clientX - rect.left - this.clientLeft + this.scrollLeft);
var relY = e.pageY - parentOffset.top; var top = (e.clientY - rect.top - this.clientTop + this.scrollTop);
$tooltip.css({'top': relY + 10, 'left': relX + 10}); var scale = $map_body.data('scale');
if (scale) {
left /= scale;
top /= scale;
}
$tooltip.css({ 'top': top + 10, 'left': left + 10 });
}); });
$objs.on('mouseenter', function(e) { $objs.on('mouseenter', function(e) {
@@ -472,8 +499,7 @@ function reloadWorldMap(option){
var nation_text = $this.data('nation'); var nation_text = $this.data('nation');
if (nation_text) { if (nation_text) {
$tooltip_nation.html(nation_text).show(); $tooltip_nation.html(nation_text).show();
} } else {
else{
$tooltip_nation.html('').hide(); $tooltip_nation.html('').hide();
} }
@@ -536,8 +562,7 @@ function reloadWorldMap(option){
if (state) { if (state) {
$world_map.addClass('hide_cityname'); $world_map.addClass('hide_cityname');
localStorage.setItem('sam.hideMapCityName', 'yes'); localStorage.setItem('sam.hideMapCityName', 'yes');
} } else {
else{
$world_map.removeClass('hide_cityname'); $world_map.removeClass('hide_cityname');
localStorage.setItem('sam.hideMapCityName', 'no'); localStorage.setItem('sam.hideMapCityName', 'no');
} }
@@ -547,12 +572,11 @@ function reloadWorldMap(option){
if (localStorage.getItem('sam.toggleSingleTap') == 'yes') { if (localStorage.getItem('sam.toggleSingleTap') == 'yes') {
window.sam_toggleSingleTap = true; window.sam_toggleSingleTap = true;
$toggleSingleTapBtn.addClass('active').attr('aria-pressed', 'true'); $toggleSingleTapBtn.addClass('active').attr('aria-pressed', 'true');
} } else {
else{
window.sam_toggleSingleTap = false; window.sam_toggleSingleTap = false;
} }
var $map_body = $('.world_map .map_body'); var $map_body = $(drawTarget + ' .map_body');
$toggleSingleTapBtn.click(function() { $toggleSingleTapBtn.click(function() {
//이전 상태 확인 //이전 상태 확인
@@ -561,8 +585,7 @@ function reloadWorldMap(option){
$map_body.removeData('touchMode'); $map_body.removeData('touchMode');
localStorage.setItem('sam.toggleSingleTap', 'yes'); localStorage.setItem('sam.toggleSingleTap', 'yes');
window.sam_toggleSingleTap = true; window.sam_toggleSingleTap = true;
} } else {
else{
localStorage.setItem('sam.toggleSingleTap', 'no'); localStorage.setItem('sam.toggleSingleTap', 'no');
window.sam_toggleSingleTap = false; window.sam_toggleSingleTap = false;
} }
@@ -570,16 +593,16 @@ function reloadWorldMap(option){
if (isDetailMap) { if (isDetailMap) {
$world_map.addClass('map_detail'); $world_map.addClass('map_detail');
} } else {
else{
$world_map.removeClass('map_datail'); $world_map.removeClass('map_datail');
} }
//deferred mode of jQuery. != promise-then. //deferred mode of jQuery. != promise-then.
var deferred = $.ajax({ var deferred = $.ajax({
url: option.targetJson, url: option.targetJson,
type: 'post', type: option.reqType,
dataType: 'json', dataType: 'json',
ifModified: true,
data: { data: {
data: JSON.stringify({ data: JSON.stringify({
neutralView: option.neutralView, neutralView: option.neutralView,
@@ -591,14 +614,26 @@ function reloadWorldMap(option){
} }
}); });
var rawObject = null;
deferred deferred
.then(function(data) {
rawObject = data;
return data;
})
.then(checkReturnObject) .then(checkReturnObject)
.then(setMapBackground) .then(setMapBackground)
.then(convertCityObjs) .then(convertCityObjs)
.then(isDetailMap ? drawDetailWorldMap : drawBasicWorldMap) .then(isDetailMap ? drawDetailWorldMap : drawBasicWorldMap)
.then(setMouseWork) .then(setMouseWork)
.then(setCityClickable) .then(setCityClickable)
.then(saveCityInfo); .then(saveCityInfo)
.then(function(data) {
if (option.callback) {
option.callback(data, rawObject);
}
});
if ($world_map.hasClass('draw_required')) { if ($world_map.hasClass('draw_required')) {
if (useCachedMap) { if (useCachedMap) {
@@ -619,21 +654,18 @@ function reloadWorldMap(option){
storedMap = convertCityObjs(storedMap); storedMap = convertCityObjs(storedMap);
if (isDetailMap) { if (isDetailMap) {
storedMap = drawDetailWorldMap(storedMap); storedMap = drawDetailWorldMap(storedMap);
} } else {
else{
storedMap = drawBasicWorldMap(storedMap); storedMap = drawBasicWorldMap(storedMap);
} }
storedMap = setMouseWork(storedMap); storedMap = setMouseWork(storedMap);
storedMap = setCityClickable(storedMap); storedMap = setCityClickable(storedMap);
storedMap = saveCityInfo(storedMap); storedMap = saveCityInfo(storedMap);
} while (false); } while (false);
} } else if (option.year && option.month) {
else if(option.year && option.month){
var startYear = localStorage.getItem(storedStartYear); var startYear = localStorage.getItem(storedStartYear);
if (startYear) { if (startYear) {
startYear = JSON.parse(startYear); startYear = JSON.parse(startYear);
} } else {
else{
startYear = option.year; startYear = option.year;
} }
var tmp = { var tmp = {
+1
View File
@@ -144,6 +144,7 @@ jQuery(function($){
tnmt: $('.tnmt:checked').val(), tnmt: $('.tnmt:checked').val(),
defence_train: $('#defence_train').val(), defence_train: $('#defence_train').val(),
use_treatment: $('#use_treatment').val(), use_treatment: $('#use_treatment').val(),
use_auto_nation_turn: $('#use_auto_nation_turn').val(),
} }
}).then(function(data) { }).then(function(data) {
if (!data) { if (!data) {
+5 -3
View File
@@ -35,7 +35,7 @@ jQuery(function($) {
//checkCommandArg 참고 //checkCommandArg 참고
var availableArgumentList = { var availableArgumentList = {
'string': [ 'string': [
'nationName', 'optionText', 'itemType', 'nationType', 'itemCode', 'nationName', 'optionText', 'itemType', 'nationType', 'itemCode', 'commandType',
], ],
'int': [ 'int': [
'crewType', 'destGeneralID', 'destCityID', 'destNationID', 'crewType', 'destGeneralID', 'destCityID', 'destNationID',
@@ -73,9 +73,11 @@ jQuery(function($) {
} }
}, },
'integerArray': function($obj) { 'integerArray': function($obj) {
return $obj.map(function() { var result = [];
return parseInt($(this).val()); $obj.each(function() {
result.push(parseInt($(this).val()));
}); });
return result;
} }
} }
+210
View File
@@ -0,0 +1,210 @@
var templateGeneralCard = '<div class="general_card">\
<h4 class="bg1 with_border"><%generalName%></h4>\
<h4><img src="<%iconPath%>" height=64 width=64></h4><p>\
<%if(leadership){%>\
<%leadership%> / <%strength%> / <%intel%><br>\
<%}%>\
<%if(personalText){%><%personalText%><br><%}%>\
<%if(specialDomesticText||specialWarText){%>\
<%specialDomesticText%> / <%specialWarText%><br>\
<%}%>\
<%if(dex){%><br>\
보병: <%parseInt(dex[0]/1000)%>K<br>\
궁병: <%parseInt(dex[1]/1000)%>K<br>\
기병: <%parseInt(dex[2]/1000)%>K<br>\
귀병: <%parseInt(dex[3]/1000)%>K<br>\
차병: <%parseInt(dex[4]/1000)%>K<br>\
<%}%>\
</p>\
<button type="subject" class="with_skin with_border select_btn" data-name="<%generalName%>" value="<%uniqueName%>" name="pick">선택하기</button>\
</div>';
var templateSpecial =
'<span class="obj_tooltip" data-toggle="tooltip" data-placement="top"><%text%>\
<span class="tooltiptext">\
<%info%>\
</span>\
</span>\
';
function pickGeneral() {
$btn = $(this);
if (hasGeneralID) {
if (!confirm('이 장수를 선택할까요? : {0}'.format($btn.data('name')))) {
return false;
}
$.post({
url: 'j_update_picked_general.php',
dataType: 'json',
data: {
pick: $btn.val()
}
}).then(function(result) {
if (!result.result) {
alert(result.reason);
location.refresh();
}
alert('선택한 장수로 변경했습니다.');
location.href = './';
});
return false;
}
currentGeneralInfo = cards[$btn.val()];
var $card = $btn.closest('.general_card');
var $leftPad = $('#left_pad');
$leftPad.empty();
$card.clone().appendTo($leftPad);
initTooltip($leftPad);
return false;
}
function buildGeneral() {
if (!currentGeneralInfo) {
alert('장수를 선택해주세요!');
return false;
}
if (!confirm('이 장수로 생성할까요?')) {
return false;
}
$.post({
url: 'j_select_picked_general.php',
dataType: 'json',
data: {
pick: currentGeneralInfo.uniqueName,
use_own_picture: $('#use_own_picture').is(':checked'),
leadership: parseInt($('#leadership').val()),
strength: parseInt($('#leadership').val()),
intel: parseInt($('#leadership').val()),
personal: $('#selChar').val()
}
}).then(function(result) {
if (!result.result) {
alert(result.reason);
location.refresh();
}
alert('선택한 장수로 생성했습니다.');
location.href = './';
});
return false;
}
function updateOutdateTimer() {
var $validUntilText = $('#valid_until_text');
var now = Date.now();
var validUntil = $validUntilText.data('until');
if (validUntil <= 0) {
return;
} else if (validUntil < now) {
$validUntilText.data('until', 0);
$('#valid_until').hide();
$('#outdate_token').show();
return;
} else if (validUntil - now <= 30000) {
$validUntilText.css('color', "rgb(255, {0}, {0})".format(255 * (validUntil - now) / 30000));
}
setTimeout(updateOutdateTimer, 1000);
}
function printGenerals(value) {
$('.card_holder').empty();
$('#valid_until').show();
$('#valid_until_text').html(value.validUntil).data('until', (new Date(value.validUntil)).getTime()).css('color', 'white');
$('#outdate_token').hide();
var pick = $.map(value.pick, function(value, key) {
return value;
});
var emptyCard = {
'leadership': null,
'strength': null,
'intel': null,
'personalText': null,
'specialDomesticText': null,
'specialWarText': null,
'dex': null
};
$.each(pick, function(idx, cardData) {
cardData.iconPath = getIconPath(cardData.imgsvr, cardData.picture);
if (cardData.specialDomestic !== undefined) {
cardData.specialDomesticText = TemplateEngine(templateSpecial, {
text: cardData.specialDomesticName,
info: cardData.specialDomesticInfo
});
cardData.specialWarText = '-';
}
if (cardData.specialWar !== undefined) {
cardData.specialWarText = TemplateEngine(templateSpecial, {
text: cardData.specialWarName,
info: cardData.specialWarInfo
});
if (cardData.specialDomesticText === undefined) {
cardData.specialDomesticText = '-';
}
}
//FIXME: ego로 적었던것 같음!
if (cardData.personal in characterInfo) {
cardData.personalText = TemplateEngine(templateSpecial, {
text: characterInfo[cardData.personal].name,
info: characterInfo[cardData.personal].info
});
} else {
cardData.personalText = cardData.personal;
}
cards[cardData.uniqueName] = cardData;
var $card = $(TemplateEngine(templateGeneralCard, $.extend({}, emptyCard, cardData)));
$('.card_holder').append($card);
$card.find('.select_btn').click(pickGeneral);
$card.find('.obj_tooltip').tooltip({
title: function() {
return $.trim($(this).find('.tooltiptext').html());
},
html: true
});
});
updateOutdateTimer();
}
$(function($) {
$.post('j_get_select_pool.php').then(function(value) {
if (!value.result) {
alert(value.reason);
return;
}
console.log(value);
printGenerals(value);
});
if (hasGeneralID) {
$('#create_plate').hide();
}
$('#build_general').on('click', buildGeneral);
$.each(validCustomOption, function(idx, value) {
if (value == 'picture') {
$('.custom_picture').show();
} else if (value == 'ego') {
$('.custom_personality').show();
} else if (value == 'stat') {
$('.custom_stat').show();
}
});
});
+7 -14
View File
@@ -68,14 +68,12 @@ function updateOutdateTimer(){
var validUntil = $validUntilText.data('until'); var validUntil = $validUntilText.data('until');
if (validUntil <= 0) { if (validUntil <= 0) {
return; return;
} } else if (validUntil < now) {
else if(validUntil < now){
$validUntilText.data('until', 0); $validUntilText.data('until', 0);
$('#valid_until').hide(); $('#valid_until').hide();
$('#outdate_token').show(); $('#outdate_token').show();
return; return;
} } else if (validUntil - now <= 30000) {
else if(validUntil - now <= 30000){
$validUntilText.css('color', "rgb(255, {0}, {0})".format(255 * (validUntil - now) / 30000)); $validUntilText.css('color', "rgb(255, {0}, {0})".format(255 * (validUntil - now) / 30000));
} }
@@ -123,8 +121,7 @@ function printGenerals(value){
text: cardData.special, text: cardData.special,
info: specialInfo[cardData.special] info: specialInfo[cardData.special]
}); });
} } else {
else{
cardData.specialText = cardData.special; cardData.specialText = cardData.special;
} }
@@ -133,8 +130,7 @@ function printGenerals(value){
text: cardData.special2, text: cardData.special2,
info: specialInfo[cardData.special2] info: specialInfo[cardData.special2]
}); });
} } else {
else{
cardData.special2Text = cardData.special2; cardData.special2Text = cardData.special2;
} }
@@ -143,8 +139,7 @@ function printGenerals(value){
text: cardData.personal, text: cardData.personal,
info: characterInfo[cardData.personal] info: characterInfo[cardData.personal]
}); });
} } else {
else{
cardData.personalText = cardData.personal; cardData.personalText = cardData.personal;
} }
@@ -205,11 +200,9 @@ function printGeneralList(value){
if (general.reserved == 1) { if (general.reserved == 1) {
general.userCSS = 'color:violet'; general.userCSS = 'color:violet';
} } else if (general.npc >= 2) {
else if(general.npc >= 2){
general.userCSS = 'color:cyan'; general.userCSS = 'color:cyan';
} } else if (general.npc == 1) {
else if(general.npc == 1){
general.userCSS = 'color:skyblue'; general.userCSS = 'color:skyblue';
} }
+17
View File
@@ -55,3 +55,20 @@ function LogText($prefix, $variable)
$text = sprintf('%s : %s'."\r\n", $prefix, TVarDumper::dump($variable)); $text = sprintf('%s : %s'."\r\n", $prefix, TVarDumper::dump($variable));
file_put_contents(ROOT.'/d_log/'.UniqueConst::$serverName.'_dbg_logs.txt', $text, FILE_APPEND); file_put_contents(ROOT.'/d_log/'.UniqueConst::$serverName.'_dbg_logs.txt', $text, FILE_APPEND);
} }
function prepareDir(string $dirPath, bool $forceCreate=true):bool{
if(file_exists($dirPath)){
if(is_dir($dirPath)){
return true;
}
if(!$forceCreate){
throw new \RuntimeException('이미 파일이 있습니다');
}
if(!unlink($dirPath)){
return false;
}
return mkdir($dirPath);
}
return mkdir($dirPath, 0777, true);
}
+72
View File
@@ -0,0 +1,72 @@
<?php
namespace sammo;
use sammo\AbsGeneralPool;
use sammo\GameConst;
use sammo\Json;
use sammo\Util;
abstract class AbsFromUserPool extends AbsGeneralPool{
public function occupyGeneralName(): bool
{
$generalID = $this->getGeneralBuilder()->getGeneralID();
if($generalID === null){
throw new \RuntimeException('build되지 않음');
}
$db= $this->db;
$db->update('select_pool', [
'general_id'=>$generalID,
'owner'=>null,
'reserved_until'=>null,
], 'unique_name = %s AND owner IS NOT NULL', $this->uniqueName);
return $db->affectedRows()!=0;
}
static public function pickGeneralFromPool(\MeekroDB $db, int $owner, int $pickCnt, ?string $prefix=null):array{
$oNow = new \DateTimeImmutable();
$now = $oNow->format('Y-m-d H:i:s');
$db->update('select_pool', [
'reserved_until'=>null,
'owner'=>null,
],'reserved_until < %s AND general_id IS NULL', $now);
$pool = [];
foreach($db->query('SELECT id, unique_name, info FROM select_pool WHERE reserved_until IS NULL AND general_id IS NULL', $pickCnt) as $cand){
$cand['info'] = Json::decode($cand['info']);
$dexTotal = array_sum($cand['info']['dex']);
$pool[] = [$cand, $dexTotal];
}
if(count($pool) < $pickCnt){
throw new \RuntimeException('pool 부족');
}
$gameStor = KVStorage::getStorage($db, 'game_env');
$result = [];
$validUntil = TimeUtil::nowAddMinutes(2 * $gameStor->turnterm);
while(count($result) < $pickCnt){
$cand = Util::choiceRandomUsingWeightPair($pool);
$poolID = $cand['id'];
if(key_exists($poolID, $result)){
continue;
}
$candInfo = $cand['info'];
$candInfo['uniqueName'] = $cand['unique_name'];
//하나씩 한다.
$db->update('select_pool', [
'owner'=>$owner,
'reserved_until'=>$validUntil,
], 'id = %i AND reserved_until IS NULL AND owner IS NULL and general_id IS NULL', $poolID);
if($db->affectedRows()==0){
continue;
}
$result[$poolID] = new static($db, $candInfo, $validUntil);
}
return array_values($result);
}
}
+111
View File
@@ -0,0 +1,111 @@
<?php
namespace sammo;
use MeekroDB;
use sammo\GameConst;
use sammo\Scenario\GeneralBuilder;
use sammo\Util;
abstract class AbsGeneralPool{
protected $builder;
protected $info;
protected $db=null;
protected $uniqueName;
protected $generalName;
protected $validUntil;
/*
* info = [
* uniqueName
* generalName
* imgsvr
* picture
*
* leadership
* strength
* intel
*
* experience
* dedication
*
* dex[5]
*
* specialDomestic
* specialWar
*/
public function __construct(\MeekroDB $db, array $info, string $validUntil)
{
$this->db = $db;
$this->info = $info;
$this->uniqueName = $info['uniqueName'];
$this->generalName = $info['generalName'];
$this->builder = new GeneralBuilder(
$info['generalName'],
$info['imgsvr'],
$info['picture'],
0
);
$this->validUntil = $validUntil;
$builder = $this->builder;
if(key_exists('leadership', $info)){
$builder->setStat($info['leadership'], $info['strength'], $info['intel']);
}
if(key_exists('experience', $info)){
$builder->setExpDed($info['experience'], $info['dedication']);
}
if(key_exists('dex', $info)){
$builder->setDex($info['dex'][0], $info['dex'][1], $info['dex'][2], $info['dex'][3], $info['dex'][4]);
}
if(key_exists('specialDomestic', $info) || key_exists('specialWar', $info)){
$builder->setSpecial($info['specialDomestic']??GameConst::$defaultSpecialDomestic, $info['specialWar']??GameConst::$defaultSpecialWar);
}
}
public function getUniqueName():string{
return $this->uniqueName;
}
public function getInfo():array{
return $this->info;
}
static protected function checkDuplicatedCnt(\MeekroDB $db, string $name):int{
$duplicateCnt = 0;
foreach(GeneralBuilder::$prefixList as $npcPrefix){
$testName = "{$npcPrefix}{$name}";
$duplicateCnt += $db->queryFirstField('SELECT count(no) FROM general WHERE name LIKE %s', $testName.'%');
}
return $duplicateCnt;
}
public function getGeneralBuilder():GeneralBuilder{
if(!$this->generalName){
throw new \RuntimeException('generalName not picked');
}
return $this->builder;
}
public function getValidUntil():string{
return $this->validUntil;
}
/**
* @param \MeekroDB $db
* @param int $owner
* @param int $pickCnt
* @param null|string $prefix
* @return AbsGeneralPool[]
*/
static abstract public function pickGeneralFromPool(\MeekroDB $db, int $owner, int $pickCnt, ?string $prefix=null):array;
abstract public function occupyGeneralName():bool;
abstract public static function getPoolName():string;
abstract public static function initPool(\MeekroDB $db);
}
+11 -1
View File
@@ -8,7 +8,7 @@ class che_계략_삼략 extends \sammo\BaseItem{
protected $id = 22; protected $id = 22;
protected $rawName = '삼략'; protected $rawName = '삼략';
protected $name = '삼략(계략)'; protected $name = '삼략(계략)';
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p'; protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p<br>[전투] 계략 시도 확률 +10%p, 계략 성공 확률 +10%p';
protected $cost = 200; protected $cost = 200;
protected $consumable = false; protected $consumable = false;
@@ -19,4 +19,14 @@ class che_계략_삼략 extends \sammo\BaseItem{
return $value; return $value;
} }
public function onCalcStat(General $general, string $statName, $value, $aux=null){
if($statName === 'warMagicTrialProb'){
return $value + 0.1;
}
if($statName === 'warMagicSuccessProb'){
return $value + 0.1;
}
return $value;
}
} }
+11 -1
View File
@@ -8,7 +8,7 @@ class che_계략_육도 extends \sammo\BaseItem{
protected $id = 21; protected $id = 21;
protected $rawName = '육도'; protected $rawName = '육도';
protected $name = '육도(계략)'; protected $name = '육도(계략)';
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p'; protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p<br>[전투] 계략 시도 확률 +10%p, 계략 성공 확률 +10%p';
protected $cost = 200; protected $cost = 200;
protected $consumable = false; protected $consumable = false;
@@ -19,4 +19,14 @@ class che_계략_육도 extends \sammo\BaseItem{
return $value; return $value;
} }
public function onCalcStat(General $general, string $statName, $value, $aux=null){
if($statName === 'warMagicTrialProb'){
return $value + 0.1;
}
if($statName === 'warMagicSuccessProb'){
return $value + 0.1;
}
return $value;
}
} }
+2 -2
View File
@@ -8,7 +8,7 @@ class che_계략_이추 extends \sammo\BaseItem{
protected $id = 5; protected $id = 5;
protected $rawName = '이추'; protected $rawName = '이추';
protected $name = '이추(계략)'; protected $name = '이추(계략)';
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +10%p'; protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p';
protected $cost = 1000; protected $cost = 1000;
protected $consumable = true; protected $consumable = true;
protected $buyable = true; protected $buyable = true;
@@ -16,7 +16,7 @@ class che_계략_이추 extends \sammo\BaseItem{
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{ public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
if($turnType == '계략'){ if($turnType == '계략'){
if($varType == 'success') return $value + 0.1; if($varType == 'success') return $value + 0.2;
} }
return $value; return $value;
+2 -2
View File
@@ -8,7 +8,7 @@ class che_계략_향낭 extends \sammo\BaseItem{
protected $id = 5; protected $id = 5;
protected $rawName = '항냥'; protected $rawName = '항냥';
protected $name = '항냥(계략)'; protected $name = '항냥(계략)';
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +20%p'; protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +50%p';
protected $cost = 3000; protected $cost = 3000;
protected $consumable = true; protected $consumable = true;
protected $buyable = true; protected $buyable = true;
@@ -16,7 +16,7 @@ class che_계략_향낭 extends \sammo\BaseItem{
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{ public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
if($turnType == '계략'){ if($turnType == '계략'){
if($varType == 'success') return $value + 0.2; if($varType == 'success') return $value + 0.5;
} }
return $value; return $value;
@@ -0,0 +1,29 @@
<?php
namespace sammo\ActionItem;
use \sammo\iAction;
use \sammo\General;
use \sammo\SpecialityHelper;
use \sammo\WarUnit;
use sammo\WarUnitTriggerCaller;
use \sammo\BaseWarUnitTrigger;
use \sammo\WarUnitTrigger\WarActivateSkills;
use \sammo\WarUnitTrigger\che_반계시도;
use \sammo\WarUnitTrigger\che_반계발동;
class che_반계_백우선 extends \sammo\BaseItem{
protected $id = 45;
protected $rawName = '백우선';
protected $name = '백우선(반계)';
protected $info = '[전투] 상대의 계략 성공 확률 -10%p, 상대의 계략을 40% 확률로 되돌림';
protected $cost = 200;
protected $consumable = false;
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller(
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '계략약화'),
new che_반계시도($unit),
new che_반계발동($unit)
);
}
}
@@ -0,0 +1,29 @@
<?php
namespace sammo\ActionItem;
use \sammo\iAction;
use \sammo\General;
use \sammo\SpecialityHelper;
use \sammo\WarUnit;
use sammo\WarUnitTriggerCaller;
use \sammo\BaseWarUnitTrigger;
use \sammo\WarUnitTrigger\WarActivateSkills;
use \sammo\WarUnitTrigger\che_반계시도;
use \sammo\WarUnitTrigger\che_반계발동;
class che_반계_파초선 extends \sammo\BaseItem{
protected $id = 45;
protected $rawName = '파초선';
protected $name = '파초선(반계)';
protected $info = '[전투] 상대의 계략 성공 확률 -10%p, 상대의 계략을 40% 확률로 되돌림';
protected $cost = 200;
protected $consumable = false;
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller(
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '계략약화'),
new che_반계시도($unit),
new che_반계발동($unit)
);
}
}
@@ -0,0 +1,34 @@
<?php
namespace sammo\ActionItem;
use \sammo\iAction;
use \sammo\General;
use \sammo\GeneralTrigger;
use \sammo\GeneralTriggerCaller;
use \sammo\WarUnit;
use sammo\WarUnitTriggerCaller;
use sammo\BaseWarUnitTrigger;
use sammo\WarUnitTrigger\che_부상무효;
use sammo\WarUnitTrigger\WarActivateSkills;
class che_부적_태현청생부 extends \sammo\BaseItem{
protected $id = 9;
protected $rawName = '태현청생부';
protected $name = '태현청생부(부적)';
protected $info = '[전투] 저격 불가, 부상 없음';
protected $cost = 200;
protected $consumable = false;
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller(
new che_부상무효($unit, BaseWarUnitTrigger::TYPE_NONE),
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '저격불가')
);
}
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller(
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '저격불가')
);
}
}
@@ -0,0 +1,35 @@
<?php
namespace sammo\ActionItem;
use \sammo\iAction;
use \sammo\General;
use \sammo\GeneralTrigger;
use \sammo\GeneralTriggerCaller;
use \sammo\BaseWarUnitTrigger;
use \sammo\WarUnitTriggerCaller;
use sammo\WarUnitTrigger\che_전투치료발동;
use sammo\WarUnitTrigger\che_전투치료시도;
class che_의술_상한잡병론 extends \sammo\BaseItem{
protected $id = 24;
protected $rawName = '상한잡병론';
protected $name = '상한잡병론(의술)';
protected $info = '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 40% 확률로 치료 발동(아군 피해 1/3 감소, 부상 회복)';
protected $cost = 200;
protected $consumable = false;
public function getPreTurnExecuteTriggerList(General $general):?GeneralTriggerCaller{
return new GeneralTriggerCaller(
new GeneralTrigger\che_도시치료($general)
);
}
public function getBattlePhaseSkillTriggerList(\sammo\WarUnit $unit): ?WarUnitTriggerCaller
{
return new WarUnitTriggerCaller(
new che_전투치료시도($unit, BaseWarUnitTrigger::TYPE_ITEM),
new che_전투치료발동($unit, BaseWarUnitTrigger::TYPE_ITEM)
);
}
}
@@ -14,7 +14,7 @@ class che_의술_청낭서 extends \sammo\BaseItem{
protected $id = 23; protected $id = 23;
protected $rawName = '청낭서'; protected $rawName = '청낭서';
protected $name = '청낭서(의술)'; protected $name = '청낭서(의술)';
protected $info = '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 20% 확률로 치료 발동(아군 피해 1/3 감소)'; protected $info = '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 40% 확률로 치료 발동(아군 피해 1/3 감소, 부상 회복)';
protected $cost = 200; protected $cost = 200;
protected $consumable = false; protected $consumable = false;
@@ -14,7 +14,7 @@ class che_의술_태평청령 extends \sammo\BaseItem{
protected $id = 24; protected $id = 24;
protected $rawName = '태평청령'; protected $rawName = '태평청령';
protected $name = '태평청령(의술)'; protected $name = '태평청령(의술)';
protected $info = '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 20% 확률로 치료 발동(아군 피해 1/3 감소)'; protected $info = '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 40% 확률로 치료 발동(아군 피해 1/3 감소, 부상 회복)';
protected $cost = 200; protected $cost = 200;
protected $consumable = false; protected $consumable = false;
@@ -0,0 +1,26 @@
<?php
namespace sammo\ActionItem;
use \sammo\iAction;
use \sammo\General;
use \sammo\SpecialityHelper;
use \sammo\WarUnit;
use sammo\WarUnitTriggerCaller;
use \sammo\WarUnitTrigger\che_저격시도;
use \sammo\WarUnitTrigger\che_저격발동;
class che_저격_매화수전 extends \sammo\BaseItem{
protected $id = 70;
protected $rawName = '매화수전';
protected $name = '매화수전(저격)';
protected $info = '[전투] 새로운 상대와 전투 시 50% 확률로 저격 발동, 성공 시 사기+10';
protected $cost = 200;
protected $consumable = false;
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller(
new che_저격시도($unit, che_저격시도::TYPE_ITEM, 0.5, 20, 40),
new che_저격발동($unit, che_저격발동::TYPE_ITEM)
);
}
}
@@ -0,0 +1,26 @@
<?php
namespace sammo\ActionItem;
use \sammo\iAction;
use \sammo\General;
use \sammo\SpecialityHelper;
use \sammo\WarUnit;
use sammo\WarUnitTriggerCaller;
use \sammo\WarUnitTrigger\che_저격시도;
use \sammo\WarUnitTrigger\che_저격발동;
class che_저격_비도 extends \sammo\BaseItem{
protected $id = 70;
protected $rawName = '비도';
protected $name = '비도(저격)';
protected $info = '[전투] 새로운 상대와 전투 시 50% 확률로 저격 발동, 성공 시 사기+10';
protected $cost = 200;
protected $consumable = false;
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller(
new che_저격시도($unit, che_저격시도::TYPE_ITEM, 0.5, 20, 40),
new che_저격발동($unit, che_저격발동::TYPE_ITEM)
);
}
}
+10 -3
View File
@@ -13,7 +13,7 @@ class che_저격_수극 extends \sammo\BaseItem{
protected $id = 2; protected $id = 2;
protected $rawName = '수극'; protected $rawName = '수극';
protected $name = '수극(저격)'; protected $name = '수극(저격)';
protected $info = '[전투] 전투 개시 전 20% 확률로 저격 시도. 1회용'; protected $info = '[전투] 전투 개시 전 50% 확률로 저격 시도. 1회용';
protected $cost = 1000; protected $cost = 1000;
protected $consumable = true; protected $consumable = true;
protected $buyable = true; protected $buyable = true;
@@ -21,8 +21,15 @@ class che_저격_수극 extends \sammo\BaseItem{
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{ public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller( return new WarUnitTriggerCaller(
new che_저격시도($unit, BaseWarUnitTrigger::TYPE_CONSUMABLE_ITEM, 0.2, 20, 40), new che_저격시도($unit, BaseWarUnitTrigger::TYPE_CONSUMABLE_ITEM, 0.5, 20, 40),
new che_저격발동($unit) new che_저격발동($unit, BaseWarUnitTrigger::TYPE_CONSUMABLE_ITEM)
); );
} }
function isConsumableNow(string $actionType, string $command):bool{
if($actionType == 'GeneralTrigger' && $command == 'che_아이템치료'){
return true;
}
return false;
}
} }
@@ -0,0 +1,21 @@
<?php
namespace sammo\ActionItem;
use \sammo\iAction;
use \sammo\General;
class che_행동_서촉지형도 extends \sammo\BaseItem{
protected $id = 22;
protected $rawName = '서촉지형도';
protected $name = '서촉지형도(행동)';
protected $info = '[전투] 공격 시 페이즈 + 2';
protected $cost = 200;
protected $consumable = false;
public function onCalcStat(General $general, string $statName, $value, $aux=null){
if($statName === 'initWarPhase'){
return $value + 2;
}
return $value;
}
}
+29
View File
@@ -0,0 +1,29 @@
<?php
namespace sammo\ActionItem;
use \sammo\iAction;
use \sammo\General;
use \sammo\SpecialityHelper;
use \sammo\WarUnit;
use sammo\WarUnitTriggerCaller;
use sammo\WarUnitTrigger\che_격노시도;
use sammo\WarUnitTrigger\che_격노발동;
class event_빼빼로 extends \sammo\BaseItem{
protected $id = 75;
protected $rawName = '빼빼로';
protected $name = '빼빼로';
protected $info = '1의 상징입니다.<br>통솔 +1, 무력 +1, 지력 +1';
protected $cost = 1500;
protected $buyable = true;
protected $consumable = false;
protected $reqSecu = 12000;
public function onCalcStat(General $general, string $statName, $value, $aux=null){
if(in_array($statName, ['leadership', 'strength', 'intel'] )){
return $value + 1;
}
return $value;
}
}
@@ -13,17 +13,21 @@ class event_전투특기_격노 extends \sammo\BaseItem{
protected $id = 74; protected $id = 74;
protected $rawName = '비급'; protected $rawName = '비급';
protected $name = '비급(격노)'; protected $name = '비급(격노)';
protected $info = '[전투] 상대방 필살 회피 시도시 일정 확률로 격노(필살) 발동, 공격 시 일정 확률로 진노(1페이즈 추가)'; protected $info = '[전투] 상대방 필살 시 격노(필살) 발동, 회피 시도시 25% 확률로 격노 발동, 공격 시 일정 확률로 진노(1페이즈 추가)';
protected $cost = 100; protected $cost = 100;
protected $buyable = true; protected $buyable = true;
protected $consumable = false; protected $consumable = false;
protected $reqSecu = 3000; protected $reqSecu = 3000;
public function getWarPowerMultiplier(WarUnit $unit):array{
$activatedCnt = $unit->hasActivatedSkillOnLog('격노');
return [1 + 0.2*$activatedCnt, 1];
}
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{ public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller( return new WarUnitTriggerCaller(
new che_격노시도($unit), new che_격노시도($unit, che_격노시도::TYPE_ITEM),
new che_격노발동($unit) new che_격노발동($unit, che_격노발동::TYPE_ITEM)
); );
} }
} }
@@ -12,7 +12,7 @@ class event_전투특기_공성 extends \sammo\BaseItem{
protected $id = 53; protected $id = 53;
protected $rawName = '비급'; protected $rawName = '비급';
protected $name = '비급(공성)'; protected $name = '비급(공성)';
protected $info = '[군사] 차병 계통 징·모병비 -10%<br>[전투] 성벽 공격 시 대미지 +100%'; protected $info = '[군사] 차병 계통 징·모병비 -10%<br>[전투] 성벽 공격 시 대미지 +100%,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 차병 숙련을 가산';
protected $cost = 100; protected $cost = 100;
protected $buyable = true; protected $buyable = true;
protected $consumable = false; protected $consumable = false;
@@ -32,4 +32,18 @@ class event_전투특기_공성 extends \sammo\BaseItem{
} }
return [1, 1]; return [1, 1];
} }
public function onCalcStat(General $general, string $statName, $value, $aux=null){
if(\sammo\Util::starts_with($statName, 'dex')){
$myArmType = 'dex'.GameUnitConst::T_SIEGE;
$opposeArmType = 'dex'.$aux['opposeType']->armType;;
if($aux['isAttacker'] && $opposeArmType === $statName){
return $value + $general->getVar($myArmType);
}
if(!$aux['isAttacker'] && $myArmType === $statName){
return $value + $general->getVar($myArmType);
}
}
return $value;
}
} }
@@ -11,7 +11,7 @@ class event_전투특기_궁병 extends \sammo\BaseItem{
protected $id = 51; protected $id = 51;
protected $rawName = '비급'; protected $rawName = '비급';
protected $name = '비급(궁병)'; protected $name = '비급(궁병)';
protected $info = '[군사] 궁병 계통 징·모병비 -10%<br>[전투] 회피 확률 +20%p'; protected $info = '[군사] 궁병 계통 징·모병비 -10%<br>[전투] 회피 확률 +20%p,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 궁병 숙련을 가산';
protected $cost = 100; protected $cost = 100;
protected $buyable = true; protected $buyable = true;
protected $consumable = false; protected $consumable = false;
@@ -29,6 +29,16 @@ class event_전투특기_궁병 extends \sammo\BaseItem{
if($statName === 'warAvoidRatio'){ if($statName === 'warAvoidRatio'){
return $value + 0.2; return $value + 0.2;
} }
if(\sammo\Util::starts_with($statName, 'dex')){
$myArmType = 'dex'.GameUnitConst::T_ARCHER;
$opposeArmType = 'dex'.$aux['opposeType']->armType;;
if($aux['isAttacker'] && $opposeArmType === $statName){
return $value + $general->getVar($myArmType);
}
if(!$aux['isAttacker'] && $myArmType === $statName){
return $value + $general->getVar($myArmType);
}
}
return $value; return $value;
} }
} }
@@ -11,7 +11,7 @@ class event_전투특기_귀병 extends \sammo\BaseItem{
protected $id = 40; protected $id = 40;
protected $rawName = '비급'; protected $rawName = '비급';
protected $name = '비급(귀병)'; protected $name = '비급(귀병)';
protected $info = '[군사] 귀병 계통 징·모병비 -10%<br>[전투] 계략 성공 확률 +20%p'; protected $info = '[군사] 귀병 계통 징·모병비 -10%<br>[전투] 계략 성공 확률 +20%p,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 귀병 숙련을 가산';
protected $cost = 100; protected $cost = 100;
protected $buyable = true; protected $buyable = true;
protected $consumable = false; protected $consumable = false;
@@ -29,6 +29,16 @@ class event_전투특기_귀병 extends \sammo\BaseItem{
if($statName === 'warMagicSuccessProb'){ if($statName === 'warMagicSuccessProb'){
return $value + 0.2; return $value + 0.2;
} }
if(\sammo\Util::starts_with($statName, 'dex')){
$myArmType = 'dex'.GameUnitConst::T_WIZARD;
$opposeArmType = 'dex'.$aux['opposeType']->armType;;
if($aux['isAttacker'] && $opposeArmType === $statName){
return $value + $general->getVar($myArmType);
}
if(!$aux['isAttacker'] && $myArmType === $statName){
return $value + $general->getVar($myArmType);
}
}
return $value; return $value;
} }
} }
@@ -11,7 +11,7 @@ class event_전투특기_기병 extends \sammo\BaseItem{
protected $id = 52; protected $id = 52;
protected $rawName = '비급'; protected $rawName = '비급';
protected $name = '비급(기병)'; protected $name = '비급(기병)';
protected $info = '[군사] 기병 계통 징·모병비 -10%<br>[전투] 수비 시 대미지 +10%, 공격 시 대미지 +20%'; protected $info = '[군사] 기병 계통 징·모병비 -10%<br>[전투] 수비 시 대미지 +10%, 공격 시 대미지 +20%,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 기병 숙련을 가산';
protected $cost = 100; protected $cost = 100;
protected $buyable = true; protected $buyable = true;
protected $consumable = false; protected $consumable = false;
@@ -31,4 +31,18 @@ class event_전투특기_기병 extends \sammo\BaseItem{
} }
return [1.1, 1]; return [1.1, 1];
} }
public function onCalcStat(General $general, string $statName, $value, $aux=null){
if(\sammo\Util::starts_with($statName, 'dex')){
$myArmType = 'dex'.GameUnitConst::T_CAVALRY;
$opposeArmType = 'dex'.$aux['opposeType']->armType;;
if($aux['isAttacker'] && $opposeArmType === $statName){
return $value + $general->getVar($myArmType);
}
if(!$aux['isAttacker'] && $myArmType === $statName){
return $value + $general->getVar($myArmType);
}
}
return $value;
}
} }
@@ -7,13 +7,14 @@ use \sammo\WarUnit;
use \sammo\BaseWarUnitTrigger; use \sammo\BaseWarUnitTrigger;
use \sammo\WarUnitTriggerCaller; use \sammo\WarUnitTriggerCaller;
use sammo\WarUnitTrigger\WarActivateSkills; use sammo\WarUnitTrigger\WarActivateSkills;
use \sammo\WarUnitTrigger\che_돌격지속;
class event_전투특기_돌격 extends \sammo\BaseItem{ class event_전투특기_돌격 extends \sammo\BaseItem{
protected $id = 60; protected $id = 60;
protected $rawName = '비급'; protected $rawName = '비급';
protected $name = '비급(돌격)'; protected $name = '비급(돌격)';
protected $info = '[전투] 상대 회피 불가, 공격 시 전투 페이즈 +1, 공격 시 대미지 +10%'; protected $info = '[전투] 공격 시 대등/유리한 병종에게는 퇴각 전까지 전투, 공격 시 페이즈 + 2, 공격 시 대미지 +5%';
protected $cost = 100; protected $cost = 100;
protected $buyable = true; protected $buyable = true;
protected $consumable = false; protected $consumable = false;
@@ -21,21 +22,20 @@ class event_전투특기_돌격 extends \sammo\BaseItem{
public function onCalcStat(General $general, string $statName, $value, $aux=null){ public function onCalcStat(General $general, string $statName, $value, $aux=null){
if($statName === 'initWarPhase'){ if($statName === 'initWarPhase'){
return $value + 1; return $value + 2;
} }
return $value; return $value;
} }
public function getWarPowerMultiplier(WarUnit $unit):array{ public function getWarPowerMultiplier(WarUnit $unit):array{
if($unit->isAttacker()){ if($unit->isAttacker()){
return [1.1, 1]; return [1.05, 1];
} }
return [1, 1]; return [1, 1];
} }
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{ public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller( return new WarUnitTriggerCaller(
(new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '회피불가'))->setPriority(BaseWarUnitTrigger::PRIORITY_BEGIN + 200) new che_돌격지속($unit)
); );
} }
} }
@@ -4,13 +4,14 @@ use \sammo\iAction;
use \sammo\General; use \sammo\General;
use \sammo\SpecialityHelper; use \sammo\SpecialityHelper;
use \sammo\WarUnit; use \sammo\WarUnit;
use \sammo\Util;
class event_전투특기_무쌍 extends \sammo\BaseItem{ class event_전투특기_무쌍 extends \sammo\BaseItem{
protected $id = 61; protected $id = 61;
protected $rawName = '비급'; protected $rawName = '비급';
protected $name = '비급(무쌍)'; protected $name = '비급(무쌍)';
protected $info = '[전투] 대미지 +10%, 공격 시 필살 확률 +10%p'; protected $info = '[전투] 대미지 +10%, 공격 시 필살 확률 +10%p, <br>승리 수만큼 대미지 0.20%씩 추가 상승(최대40%)<br>승리 수만큼 피해 0.05%씩 감소(최대50%)';
protected $cost = 100; protected $cost = 100;
protected $buyable = true; protected $buyable = true;
protected $consumable = false; protected $consumable = false;
@@ -24,6 +25,11 @@ class event_전투특기_무쌍 extends \sammo\BaseItem{
} }
public function getWarPowerMultiplier(WarUnit $unit):array{ public function getWarPowerMultiplier(WarUnit $unit):array{
return [1.1, 1]; $attackMultiplier = 1.1;
$defenceMultiplier = 1;
$killnum = $unit->getGeneral()->getRankVar('killnum');
$attackMultiplier += Util::valueFit($killnum * 0.01 * 0.2, null, 0.4);
$defenceMultiplier -= Util::valueFit($killnum * 0.01 * 0.05, null, 0.5);
return [$attackMultiplier, $defenceMultiplier];
} }
} }
@@ -15,7 +15,7 @@ class event_전투특기_반계 extends \sammo\BaseItem{
protected $id = 45; protected $id = 45;
protected $rawName = '비급'; protected $rawName = '비급';
protected $name = '비급(반계)'; protected $name = '비급(반계)';
protected $info = '[전투] 상대의 계략 성공 확률 -10%p, 상대의 계략을 40% 확률로 되돌림, 반목 성공시 대미지 추가(+60% → +100%)'; protected $info = '[전투] 상대의 계략 성공 확률 -10%p, 상대의 계략을 40% 확률로 되돌림, 반목 성공시 대미지 추가(+60% → +150%)';
protected $cost = 100; protected $cost = 100;
protected $buyable = true; protected $buyable = true;
protected $consumable = false; protected $consumable = false;
@@ -23,15 +23,15 @@ class event_전투특기_반계 extends \sammo\BaseItem{
public function onCalcStat(General $general, string $statName, $value, $aux=null){ public function onCalcStat(General $general, string $statName, $value, $aux=null){
if($statName === 'warMagicSuccessDamage' && $aux === '반목'){ if($statName === 'warMagicSuccessDamage' && $aux === '반목'){
return $value + 0.4; return $value + 0.9;
} }
return $value; return $value;
} }
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{ public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller( return new WarUnitTriggerCaller(
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_ITEM, false, '계략약화'), new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '계략약화'),
new che_반계시도($unit, che_반계시도::TYPE_ITEM), new che_반계시도($unit),
new che_반계발동($unit) new che_반계발동($unit)
); );
} }
@@ -11,7 +11,7 @@ class event_전투특기_보병 extends \sammo\BaseItem{
protected $id = 50; protected $id = 50;
protected $rawName = '비급'; protected $rawName = '비급';
protected $name = '비급(보병)'; protected $name = '비급(보병)';
protected $info = '[군사] 보병 계통 징·모병비 -10%<br>[전투] 공격 시 아군 피해 -10%, 수비 시 아군 피해 -20%'; protected $info = '[군사] 보병 계통 징·모병비 -10%<br>[전투] 공격 시 아군 피해 -10%, 수비 시 아군 피해 -20%,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 보병 숙련을 가산';
protected $cost = 100; protected $cost = 100;
protected $buyable = true; protected $buyable = true;
protected $consumable = false; protected $consumable = false;
@@ -32,4 +32,18 @@ class event_전투특기_보병 extends \sammo\BaseItem{
} }
return [1, 0.8]; return [1, 0.8];
} }
public function onCalcStat(General $general, string $statName, $value, $aux=null){
if(\sammo\Util::starts_with($statName, 'dex')){
$myArmType = 'dex'.GameUnitConst::T_FOOTMAN;
$opposeArmType = 'dex'.$aux['opposeType']->armType;;
if($aux['isAttacker'] && $opposeArmType === $statName){
return $value + $general->getVar($myArmType);
}
if(!$aux['isAttacker'] && $myArmType === $statName){
return $value + $general->getVar($myArmType);
}
}
return $value;
}
} }
@@ -13,7 +13,7 @@ class event_전투특기_위압 extends \sammo\BaseItem{
protected $id = 63; protected $id = 63;
protected $rawName = '비급'; protected $rawName = '비급';
protected $name = '비급(위압)'; protected $name = '비급(위압)';
protected $info = '[전투] 훈련/사기≥90, 병력≥1,000 일 때 첫 페이즈 위압 발동(적 공격 불가)'; protected $info = '[전투] 첫 페이즈 위압 발동(적 공격, 회피 불가, 사기 5 감소)';
protected $cost = 100; protected $cost = 100;
protected $buyable = true; protected $buyable = true;
protected $consumable = false; protected $consumable = false;
@@ -16,7 +16,7 @@ class event_전투특기_의술 extends \sammo\BaseItem{
protected $id = 73; protected $id = 73;
protected $rawName = '비급'; protected $rawName = '비급';
protected $name = '비급(의술)'; protected $name = '비급(의술)';
protected $info = '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 20% 확률로 치료 발동(아군 피해 1/3 감소)'; protected $info = '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 40% 확률로 치료 발동(아군 피해 1/3 감소, 부상 회복)';
protected $cost = 100; protected $cost = 100;
protected $buyable = true; protected $buyable = true;
protected $consumable = false; protected $consumable = false;
@@ -13,7 +13,7 @@ class event_전투특기_저격 extends \sammo\BaseItem{
protected $id = 70; protected $id = 70;
protected $rawName = '비급'; protected $rawName = '비급';
protected $name = '비급(저격)'; protected $name = '비급(저격)';
protected $info = '[전투] 새로운 상대와 전투 시 1/3 확률로 저격 발동, 성공 시 사기+10'; protected $info = '[전투] 새로운 상대와 전투 시 50% 확률로 저격 발동, 성공 시 사기+10';
protected $cost = 100; protected $cost = 100;
protected $buyable = true; protected $buyable = true;
protected $consumable = false; protected $consumable = false;
@@ -21,7 +21,7 @@ class event_전투특기_저격 extends \sammo\BaseItem{
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{ public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller( return new WarUnitTriggerCaller(
new che_저격시도($unit, che_저격시도::TYPE_ITEM, 1/3, 20, 60), new che_저격시도($unit, che_저격시도::TYPE_ITEM, 0.5, 20, 40),
new che_저격발동($unit, che_저격발동::TYPE_ITEM) new che_저격발동($unit, che_저격발동::TYPE_ITEM)
); );
} }
@@ -12,7 +12,7 @@ class event_전투특기_필살 extends \sammo\BaseItem{
protected $id = 71; protected $id = 71;
protected $rawName = '비급'; protected $rawName = '비급';
protected $name = '비급(필살)'; protected $name = '비급(필살)';
protected $info = '[전투] 필살 확률 +20%p, 필살 발동시 대상 회피 불가'; protected $info = '[전투] 필살 확률 +30%p, 필살 발동시 대상 회피 불가';
protected $cost = 100; protected $cost = 100;
protected $buyable = true; protected $buyable = true;
protected $consumable = false; protected $consumable = false;
@@ -20,7 +20,7 @@ class event_전투특기_필살 extends \sammo\BaseItem{
public function onCalcStat(General $general, string $statName, $value, $aux=null){ public function onCalcStat(General $general, string $statName, $value, $aux=null){
if($statName === 'warCriticalRatio'){ if($statName === 'warCriticalRatio'){
return $value + 0.2; return $value + 0.3;
} }
return $value; return $value;
} }
@@ -37,6 +37,9 @@ class che_종횡가 extends \sammo\BaseNation{
if($varType == 'delay'){ if($varType == 'delay'){
return Util::round($value / 2); return Util::round($value / 2);
} }
if($varType == 'globalDelay'){
return Util::round($value / 2);
}
return $value; return $value;
} }
} }
@@ -0,0 +1,34 @@
<?php
namespace sammo\ActionSpecialDomestic;
use \sammo\iAction;
use \sammo\General;
use \sammo\SpecialityHelper;
use \sammo\WarUnit;
use sammo\WarUnitTriggerCaller;
use sammo\WarUnitTrigger\che_격노시도;
use sammo\WarUnitTrigger\che_격노발동;
class che_event_격노 extends \sammo\BaseSpecial{
protected $id = 74;
protected $name = '격노';
protected $info = '[전투] 상대방 필살 시 격노(필살) 발동, 회피 시도시 25% 확률로 격노 발동, 공격 시 일정 확률로 진노(1페이즈 추가), 격노마다 대미지 20% 추가 중첩';
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
SpecialityHelper::STAT_STRENGTH,
];
public function getWarPowerMultiplier(WarUnit $unit):array{
$activatedCnt = $unit->hasActivatedSkillOnLog('격노');
return [1 + 0.2*$activatedCnt, 1];
}
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller(
new che_격노시도($unit),
new che_격노발동($unit)
);
}
}
@@ -0,0 +1,40 @@
<?php
namespace sammo\ActionSpecialDomestic;
use \sammo\iAction;
use \sammo\General;
use \sammo\SpecialityHelper;
use \sammo\WarUnit;
use sammo\WarUnitTriggerCaller;
use sammo\BaseWarUnitTrigger;
use sammo\WarUnitTrigger\che_부상무효;
use sammo\WarUnitTrigger\WarActivateSkills;
class che_event_견고 extends \sammo\BaseSpecial{
protected $id = 62;
protected $name = '견고';
protected $info = '[전투] 상대 필살, 저격 불가, 상대 계략 시도시 성공 확률 -10%p, 부상 없음, 아군 피해 -10%';
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
SpecialityHelper::STAT_STRENGTH
];
public function getBattleInitSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller(
new che_부상무효($unit, BaseWarUnitTrigger::TYPE_NONE),
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '저격불가')
);
}
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller(
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '필살불가', '계략약화', '저격불가')
);
}
public function getWarPowerMultiplier(WarUnit $unit):array{
return [1, 0.9];
}
}
@@ -0,0 +1,50 @@
<?php
namespace sammo\ActionSpecialDomestic;
use \sammo\iAction;
use \sammo\General;
use \sammo\SpecialityHelper;
use \sammo\GameUnitConst;
use \sammo\WarUnit;
use \sammo\WarUnitCity;
class che_event_공성 extends \sammo\BaseSpecial{
protected $id = 53;
protected $name = '공성';
protected $info = '[군사] 차병 계통 징·모병비 -10%<br>[전투] 성벽 공격 시 대미지 +100%,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 차병 숙련을 가산';
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
SpecialityHelper::STAT_LEADERSHIP | SpecialityHelper::REQ_DEXTERITY | SpecialityHelper::ARMY_SIEGE,
];
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
if(in_array($turnType, ['징병', '모병'])){
if($varType == 'cost' && $aux['armType'] == GameUnitConst::T_SIEGE) return $value * 0.9;
}
return $value;
}
public function getWarPowerMultiplier(WarUnit $unit):array{
if($unit->getOppose() instanceof WarUnitCity){
return [2, 1];
}
return [1, 1];
}
public function onCalcStat(General $general, string $statName, $value, $aux=null){
if(\sammo\Util::starts_with($statName, 'dex')){
$myArmType = 'dex'.GameUnitConst::T_SIEGE;
$opposeArmType = 'dex'.$aux['opposeType']->armType;;
if($aux['isAttacker'] && $opposeArmType === $statName){
return $value + $general->getVar($myArmType);
}
if(!$aux['isAttacker'] && $myArmType === $statName){
return $value + $general->getVar($myArmType);
}
}
return $value;
}
}
@@ -0,0 +1,46 @@
<?php
namespace sammo\ActionSpecialDomestic;
use \sammo\iAction;
use \sammo\General;
use \sammo\SpecialityHelper;
use \sammo\GameUnitConst;
class che_event_궁병 extends \sammo\BaseSpecial{
protected $id = 51;
protected $name = '궁병';
protected $info = '[군사] 궁병 계통 징·모병비 -10%<br>[전투] 회피 확률 +20%p,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 궁병 숙련을 가산';
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
SpecialityHelper::STAT_LEADERSHIP | SpecialityHelper::REQ_DEXTERITY | SpecialityHelper::ARMY_ARCHER | SpecialityHelper::STAT_NOT_INTEL,
SpecialityHelper::STAT_STRENGTH | SpecialityHelper::REQ_DEXTERITY | SpecialityHelper::ARMY_ARCHER
];
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
if(in_array($turnType, ['징병', '모병'])){
if($varType == 'cost' && $aux['armType'] == GameUnitConst::T_ARCHER) return $value * 0.9;
}
return $value;
}
public function onCalcStat(General $general, string $statName, $value, $aux=null){
if($statName === 'warAvoidRatio'){
return $value + 0.2;
}
if(\sammo\Util::starts_with($statName, 'dex')){
$myArmType = 'dex'.GameUnitConst::T_ARCHER;
$opposeArmType = 'dex'.$aux['opposeType']->armType;;
if($aux['isAttacker'] && $opposeArmType === $statName){
return $value + $general->getVar($myArmType);
}
if(!$aux['isAttacker'] && $myArmType === $statName){
return $value + $general->getVar($myArmType);
}
}
return $value;
}
}
@@ -0,0 +1,45 @@
<?php
namespace sammo\ActionSpecialDomestic;
use \sammo\iAction;
use \sammo\General;
use \sammo\SpecialityHelper;
use \sammo\GameUnitConst;
use \sammo\WarUnit;
class che_event_귀병 extends \sammo\BaseSpecial{
protected $id = 40;
protected $name = '귀병';
protected $info = '[군사] 귀병 계통 징·모병비 -10%<br>[전투] 계략 성공 확률 +20%p,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 귀병 숙련을 가산';
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
SpecialityHelper::STAT_INTEL | SpecialityHelper::ARMY_WIZARD | SpecialityHelper::REQ_DEXTERITY | SpecialityHelper::STAT_NOT_STRENGTH
];
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
if(in_array($turnType, ['징병', '모병'])){
if($varType == 'cost' && $aux['armType'] == GameUnitConst::T_WIZARD) return $value * 0.9;
}
return $value;
}
public function onCalcStat(General $general, string $statName, $value, $aux=null){
if($statName === 'warMagicSuccessProb'){
return $value + 0.2;
}
if(\sammo\Util::starts_with($statName, 'dex')){
$myArmType = 'dex'.GameUnitConst::T_WIZARD;
$opposeArmType = 'dex'.$aux['opposeType']->armType;;
if($aux['isAttacker'] && $opposeArmType === $statName){
return $value + $general->getVar($myArmType);
}
if(!$aux['isAttacker'] && $myArmType === $statName){
return $value + $general->getVar($myArmType);
}
}
return $value;
}
}
@@ -0,0 +1,50 @@
<?php
namespace sammo\ActionSpecialDomestic;
use \sammo\iAction;
use \sammo\General;
use \sammo\SpecialityHelper;
use \sammo\GameUnitConst;
use \sammo\WarUnit;
class che_event_기병 extends \sammo\BaseSpecial{
protected $id = 52;
protected $name = '기병';
protected $info = '[군사] 기병 계통 징·모병비 -10%<br>[전투] 수비 시 대미지 +10%, 공격 시 대미지 +20%,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 기병 숙련을 가산';
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
SpecialityHelper::STAT_LEADERSHIP | SpecialityHelper::REQ_DEXTERITY | SpecialityHelper::ARMY_CAVALRY | SpecialityHelper::STAT_NOT_INTEL,
SpecialityHelper::STAT_STRENGTH | SpecialityHelper::REQ_DEXTERITY | SpecialityHelper::ARMY_CAVALRY
];
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
if(in_array($turnType, ['징병', '모병'])){
if($varType == 'cost' && $aux['armType'] == GameUnitConst::T_CAVALRY) return $value * 0.9;
}
return $value;
}
public function getWarPowerMultiplier(WarUnit $unit):array{
if($unit->isAttacker()){
return [1.2, 1];
}
return [1.1, 1];
}
public function onCalcStat(General $general, string $statName, $value, $aux=null){
if(\sammo\Util::starts_with($statName, 'dex')){
$myArmType = 'dex'.GameUnitConst::T_CAVALRY;
$opposeArmType = 'dex'.$aux['opposeType']->armType;;
if($aux['isAttacker'] && $opposeArmType === $statName){
return $value + $general->getVar($myArmType);
}
if(!$aux['isAttacker'] && $myArmType === $statName){
return $value + $general->getVar($myArmType);
}
}
return $value;
}
}
@@ -0,0 +1,42 @@
<?php
namespace sammo\ActionSpecialDomestic;
use \sammo\iAction;
use \sammo\General;
use \sammo\SpecialityHelper;
use \sammo\WarUnit;
use \sammo\BaseWarUnitTrigger;
use \sammo\WarUnitTriggerCaller;
use sammo\WarUnitTrigger\WarActivateSkills;
use \sammo\WarUnitTrigger\che_돌격지속;
class che_event_돌격 extends \sammo\BaseSpecial{
protected $id = 60;
protected $name = '돌격';
protected $info = '[전투] 공격 시 대등/유리한 병종에게는 퇴각 전까지 전투, 공격 시 페이즈 + 2, 공격 시 대미지 +5%';
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
SpecialityHelper::STAT_STRENGTH
];
public function onCalcStat(General $general, string $statName, $value, $aux=null){
if($statName === 'initWarPhase'){
return $value + 2;
}
return $value;
}
public function getWarPowerMultiplier(WarUnit $unit):array{
if($unit->isAttacker()){
return [1.05, 1];
}
return [1, 1];
}
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller(
new che_돌격지속($unit)
);
}
}
@@ -0,0 +1,36 @@
<?php
namespace sammo\ActionSpecialDomestic;
use \sammo\iAction;
use \sammo\General;
use \sammo\SpecialityHelper;
use \sammo\WarUnit;
use \sammo\Util;
class che_event_무쌍 extends \sammo\BaseSpecial{
protected $id = 61;
protected $name = '무쌍';
protected $info = '[전투] 대미지 +10%, 공격 시 필살 확률 +10%p, <br>승리 수만큼 대미지 0.20%씩 추가 상승(최대40%)<br>승리 수만큼 피해 0.05%씩 감소(최대50%)';
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
SpecialityHelper::STAT_STRENGTH
];
public function onCalcStat(General $general, string $statName, $value, $aux=null){
if($statName === 'warCriticalRatio' && $aux['isAttacker']??false){
return $value += 0.1;
}
return $value;
}
public function getWarPowerMultiplier(WarUnit $unit):array{
$attackMultiplier = 1.1;
$defenceMultiplier = 1;
$killnum = $unit->getGeneral()->getRankVar('killnum');
$attackMultiplier += Util::valueFit($killnum * 0.01 * 0.2, null, 0.4);
$defenceMultiplier -= Util::valueFit($killnum * 0.01 * 0.05, null, 0.5);
return [$attackMultiplier, $defenceMultiplier];
}
}
@@ -0,0 +1,39 @@
<?php
namespace sammo\ActionSpecialDomestic;
use \sammo\iAction;
use \sammo\General;
use \sammo\SpecialityHelper;
use \sammo\WarUnit;
use sammo\WarUnitTriggerCaller;
use \sammo\BaseWarUnitTrigger;
use \sammo\WarUnitTrigger\WarActivateSkills;
use \sammo\WarUnitTrigger\che_반계시도;
use \sammo\WarUnitTrigger\che_반계발동;
class che_event_반계 extends \sammo\BaseSpecial{
protected $id = 45;
protected $name = '반계';
protected $info = '[전투] 상대의 계략 성공 확률 -10%p, 상대의 계략을 40% 확률로 되돌림, 반목 성공시 대미지 추가(+60% → +150%)';
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
SpecialityHelper::STAT_INTEL,
];
public function onCalcStat(General $general, string $statName, $value, $aux=null){
if($statName === 'warMagicSuccessDamage' && $aux === '반목'){
return $value + 0.9;
}
return $value;
}
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller(
new WarActivateSkills($unit, BaseWarUnitTrigger::TYPE_NONE, false, '계략약화'),
new che_반계시도($unit),
new che_반계발동($unit)
);
}
}
@@ -0,0 +1,50 @@
<?php
namespace sammo\ActionSpecialDomestic;
use \sammo\iAction;
use \sammo\General;
use \sammo\SpecialityHelper;
use \sammo\GameUnitConst;
use \sammo\WarUnit;
class che_event_보병 extends \sammo\BaseSpecial{
protected $id = 50;
protected $name = '보병';
protected $info = '[군사] 보병 계통 징·모병비 -10%<br>[전투] 공격 시 아군 피해 -10%, 수비 시 아군 피해 -20%,<br>공격시 상대 병종에/수비시 자신 병종 숙련에 보병 숙련을 가산';
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
SpecialityHelper::STAT_LEADERSHIP | SpecialityHelper::REQ_DEXTERITY | SpecialityHelper::ARMY_FOOTMAN | SpecialityHelper::STAT_NOT_INTEL,
SpecialityHelper::STAT_STRENGTH | SpecialityHelper::REQ_DEXTERITY | SpecialityHelper::ARMY_FOOTMAN
];
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
if(in_array($turnType, ['징병', '모병'])){
if($varType == 'cost' && $aux['armType'] == GameUnitConst::T_FOOTMAN) return $value * 0.9;
}
return $value;
}
public function getWarPowerMultiplier(WarUnit $unit):array{
if($unit->isAttacker()){
return [1, 0.9];
}
return [1, 0.8];
}
public function onCalcStat(General $general, string $statName, $value, $aux=null){
if(\sammo\Util::starts_with($statName, 'dex')){
$myArmType = 'dex'.GameUnitConst::T_FOOTMAN;
$opposeArmType = 'dex'.$aux['opposeType']->armType;;
if($aux['isAttacker'] && $opposeArmType === $statName){
return $value + $general->getVar($myArmType);
}
if(!$aux['isAttacker'] && $myArmType === $statName){
return $value + $general->getVar($myArmType);
}
}
return $value;
}
}
@@ -0,0 +1,37 @@
<?php
namespace sammo\ActionSpecialDomestic;
use \sammo\iAction;
use \sammo\General;
use \sammo\SpecialityHelper;
use \sammo\WarUnit;
class che_event_신산 extends \sammo\BaseSpecial{
protected $id = 41;
protected $name = '신산';
protected $info = '[계략] 화계·탈취·파괴·선동 : 성공률 +10%p<br>[전투] 계략 시도 확률 +20%p, 계략 성공 확률 +20%p';
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
SpecialityHelper::STAT_INTEL,
];
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
if($turnType == '계략'){
if($varType == 'success') return $value + 0.1;
}
return $value;
}
public function onCalcStat(General $general, string $statName, $value, $aux=null){
if($statName === 'warMagicTrialProb'){
return $value + 0.2;
}
if($statName === 'warMagicSuccessProb'){
return $value + 0.2;
}
return $value;
}
}
@@ -0,0 +1,26 @@
<?php
namespace sammo\ActionSpecialDomestic;
use \sammo\iAction;
use \sammo\General;
use \sammo\SpecialityHelper;
use \sammo\WarUnit;
class che_event_신중 extends \sammo\BaseSpecial{
protected $id = 44;
protected $name = '신중';
protected $info = '[전투] 계략 성공 확률 100%';
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
SpecialityHelper::STAT_INTEL,
];
public function onCalcStat(General $general, string $statName, $value, $aux=null){
if($statName === 'warMagicSuccessProb'){
return $value + 1;
}
return $value;
}
}
@@ -0,0 +1,29 @@
<?php
namespace sammo\ActionSpecialDomestic;
use \sammo\iAction;
use \sammo\General;
use \sammo\SpecialityHelper;
use \sammo\WarUnit;
use sammo\WarUnitTriggerCaller;
use \sammo\WarUnitTrigger\che_위압시도;
use \sammo\WarUnitTrigger\che_위압발동;
class che_event_위압 extends \sammo\BaseSpecial{
protected $id = 63;
protected $name = '위압';
protected $info = '[전투] 첫 페이즈 위압 발동(적 공격, 회피 불가, 사기 5 감소)';
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
SpecialityHelper::STAT_STRENGTH
];
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller(
new che_위압시도($unit),
new che_위압발동($unit)
);
}
}
@@ -0,0 +1,41 @@
<?php
namespace sammo\ActionSpecialDomestic;
use \sammo\iAction;
use sammo\BaseGeneralTrigger;
use sammo\SpecialityHelper;
use \sammo\General;
use \sammo\GeneralTrigger;
use \sammo\GeneralTriggerCaller;
use \sammo\WarUnit;
use sammo\WarUnitTrigger\che_전투치료발동;
use sammo\WarUnitTrigger\che_전투치료시도;
use sammo\WarUnitTriggerCaller;
class che_event_의술 extends \sammo\BaseSpecial{
protected $id = 73;
protected $name = '의술';
protected $info = '[군사] 매 턴마다 자신(100%)과 소속 도시 장수(적 포함 50%) 부상 회복<br>[전투] 페이즈마다 40% 확률로 치료 발동(아군 피해 1/3 감소, 부상 회복)';
static $selectWeightType = SpecialityHelper::WEIGHT_PERCENT;
static $selectWeight = 2;
static $type = [
SpecialityHelper::STAT_LEADERSHIP,
SpecialityHelper::STAT_STRENGTH,
SpecialityHelper::STAT_INTEL
];
public function getPreTurnExecuteTriggerList(General $general):?GeneralTriggerCaller{
return new GeneralTriggerCaller(
new GeneralTrigger\che_도시치료($general)
);
}
public function getBattlePhaseSkillTriggerList(\sammo\WarUnit $unit): ?WarUnitTriggerCaller
{
return new WarUnitTriggerCaller(
new che_전투치료시도($unit),
new che_전투치료발동($unit)
);
}
}
@@ -0,0 +1,31 @@
<?php
namespace sammo\ActionSpecialDomestic;
use \sammo\iAction;
use \sammo\General;
use \sammo\SpecialityHelper;
use \sammo\WarUnit;
use sammo\WarUnitTriggerCaller;
use \sammo\WarUnitTrigger\che_저격시도;
use \sammo\WarUnitTrigger\che_저격발동;
class che_event_저격 extends \sammo\BaseSpecial{
protected $id = 70;
protected $name = '저격';
protected $info = '[전투] 새로운 상대와 전투 시 50% 확률로 저격 발동, 성공 시 사기+10';
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
SpecialityHelper::STAT_LEADERSHIP,
SpecialityHelper::STAT_STRENGTH,
SpecialityHelper::STAT_INTEL
];
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller(
new che_저격시도($unit, che_저격시도::TYPE_NONE, 0.5, 20, 40),
new che_저격발동($unit)
);
}
}
@@ -0,0 +1,26 @@
<?php
namespace sammo\ActionSpecialDomestic;
use \sammo\iAction;
use \sammo\General;
use \sammo\SpecialityHelper;
use \sammo\WarUnit;
class che_event_집중 extends \sammo\BaseSpecial{
protected $id = 43;
protected $name = '집중';
protected $info = '[전투] 계략 성공 시 대미지 +50%';
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
SpecialityHelper::STAT_INTEL,
];
public function onCalcStat(General $general, string $statName, $value, $aux=null){
if($statName === 'warMagicSuccessDamage'){
return $value * 1.5;
}
return $value;
}
}
@@ -0,0 +1,36 @@
<?php
namespace sammo\ActionSpecialDomestic;
use \sammo\iAction;
use \sammo\General;
use \sammo\SpecialityHelper;
use \sammo\WarUnit;
class che_event_징병 extends \sammo\BaseSpecial{
protected $id = 72;
protected $name = '징병';
protected $info = '[군사] 징·모병비 -50%, 통솔 순수 능력치 보정 +25%';
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
SpecialityHelper::STAT_LEADERSHIP,
SpecialityHelper::STAT_STRENGTH,
SpecialityHelper::STAT_INTEL
];
public function onCalcDomestic(string $turnType, string $varType, float $value, $aux=null):float{
if(in_array($turnType, ['징병', '모병'])){
if($varType == 'cost') return $value * 0.5;
}
return $value;
}
public function onCalcStat(General $general, string $statName, $value, $aux=null){
if($statName === 'leadership'){
return $value + $general->getVar('leadership') * 0.25;
}
return $value;
}
}
@@ -0,0 +1,29 @@
<?php
namespace sammo\ActionSpecialDomestic;
use \sammo\iAction;
use \sammo\General;
use \sammo\SpecialityHelper;
use \sammo\WarUnit;
class che_event_척사 extends \sammo\BaseSpecial{
protected $id = 75;
protected $name = '척사';
protected $info = '[전투] 지역·도시 병종 상대로 대미지 +15%, 아군 피해 -15%';
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
SpecialityHelper::STAT_LEADERSHIP,
SpecialityHelper::STAT_STRENGTH,
SpecialityHelper::STAT_INTEL
];
public function getWarPowerMultiplier(WarUnit $unit):array{
$opposeCrewType = $unit->getOppose()->getCrewType();
if($opposeCrewType->reqCities || $opposeCrewType->reqRegions){
return [1.15, 0.85];
}
return [1, 1];
}
}
@@ -0,0 +1,36 @@
<?php
namespace sammo\ActionSpecialDomestic;
use \sammo\iAction;
use \sammo\General;
use \sammo\SpecialityHelper;
use \sammo\WarUnit;
use sammo\WarUnitTriggerCaller;
use sammo\WarUnitTrigger\che_필살강화_회피불가;
class che_event_필살 extends \sammo\BaseSpecial{
protected $id = 71;
protected $name = '필살';
protected $info = '[전투] 필살 확률 +30%p, 필살 발동시 대상 회피 불가';
static $selectWeightType = SpecialityHelper::WEIGHT_NORM;
static $selectWeight = 1;
static $type = [
SpecialityHelper::STAT_LEADERSHIP,
SpecialityHelper::STAT_STRENGTH,
SpecialityHelper::STAT_INTEL
];
public function onCalcStat(General $general, string $statName, $value, $aux=null){
if($statName === 'warCriticalRatio'){
return $value + 0.30;
}
return $value;
}
public function getBattlePhaseSkillTriggerList(WarUnit $unit):?WarUnitTriggerCaller{
return new WarUnitTriggerCaller(
new che_필살강화_회피불가($unit)
);
}
}

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