forked from devsam/core
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aeb8e82cbd | ||
|
|
5cb2ed3ccd | ||
|
|
93b1864d1b | ||
|
|
a6efffda45 | ||
|
|
c89d6f1a58 | ||
|
|
d4f16abfac | ||
|
|
8529f3f355 | ||
|
|
2eb136827d | ||
|
|
9594e6eb32 | ||
|
|
9e8111994a | ||
|
|
af0c2b7129 | ||
|
|
96b73a0cef | ||
|
|
6c290ee2d3 | ||
|
|
ca53e3de3a | ||
|
|
6ea3ec700a | ||
|
|
fe3355e08e | ||
|
|
43da95b4a5 | ||
|
|
3d93a63caa | ||
|
|
9550607da3 | ||
|
|
d5d9798913 | ||
|
|
6cfe08235f | ||
|
|
49eb850ff1 | ||
|
|
5a558583d2 | ||
|
|
1e5f0d0555 | ||
|
|
c58caeda4c | ||
|
|
26fc56f2b8 | ||
|
|
6a9e7aa89d | ||
|
|
b6c3b0cdc3 | ||
|
|
5ae91ac620 | ||
|
|
70265c55ef | ||
|
|
7c3b5fc31e | ||
|
|
a9a830caa2 | ||
|
|
b49ff3d4ed | ||
|
|
42310fa170 | ||
|
|
bfff1d9e2f | ||
|
|
2c98777b9f | ||
|
|
4a91260a31 | ||
|
|
076971bcae | ||
|
|
01fcc9bcab | ||
|
|
348877c7cd | ||
|
|
478f26e75a | ||
|
|
57cc558b9b | ||
|
|
20b1f8eff8 | ||
|
|
f0a7990404 | ||
|
|
27f53ff4a6 | ||
|
|
9ec5dfc8b1 | ||
|
|
e4c1e414c8 | ||
|
|
a391650472 | ||
|
|
3cfde2b40d | ||
|
|
8bf1ed33dc | ||
|
|
422b3be0c5 | ||
|
|
c34e44c4ec | ||
|
|
a2b20eca67 | ||
|
|
d41c316bfb | ||
|
|
ca1d8aab84 | ||
|
|
32e3dcff7c | ||
|
|
9a23470622 | ||
|
|
c37a186802 | ||
|
|
84c17e3b22 | ||
|
|
64e0fca124 | ||
|
|
5c6537fd7a | ||
|
|
764a82df00 | ||
|
|
e904911fd9 | ||
|
|
a7494f72f6 | ||
|
|
b6b53b028d | ||
|
|
1743ce714a | ||
|
|
656f0c5d11 | ||
|
|
d80aebe1f4 | ||
|
|
ad48bc1962 | ||
|
|
d72fbb7098 | ||
|
|
95d5eaa09b | ||
|
|
b997a6159e | ||
|
|
1cd8b7a450 | ||
|
|
c5a8eb4261 | ||
|
|
8891c29cbd | ||
|
|
2facdfa1dd | ||
|
|
65c9fa0c21 | ||
|
|
e53c85dbaf | ||
|
|
3a231e8e61 | ||
|
|
4dc7776387 | ||
|
|
5ca043e0f1 | ||
|
|
9ef052c814 | ||
|
|
6d1690beaa | ||
|
|
171656e5be | ||
|
|
385e7f4871 | ||
|
|
89c5485784 | ||
|
|
02d191ec28 | ||
|
|
47c3090f3a | ||
|
|
476dac1ac1 | ||
|
|
8ca0d0ced4 | ||
|
|
ab197489d7 | ||
|
|
99736d187b | ||
|
|
197c09bd0d | ||
|
|
6cc634ba1f | ||
|
|
4c89ad91d2 | ||
|
|
d66233bce0 | ||
|
|
b485e6927e | ||
|
|
74b9e8bd7b | ||
|
|
545742ecc0 | ||
|
|
d9f1f65352 | ||
|
|
0904d17a5f | ||
|
|
87171b4246 | ||
|
|
78f8b56203 | ||
|
|
c160c5a555 | ||
|
|
31c7bf5348 | ||
|
|
6eadf718fc | ||
|
|
effced24d1 | ||
|
|
09f399db9a | ||
|
|
2b73f6faea | ||
|
|
943662605e | ||
|
|
9a04962bd6 | ||
|
|
c371f6bbb5 | ||
|
|
8324e2e454 | ||
|
|
30307c1b56 | ||
|
|
f139d0d2a8 | ||
|
|
33843764a7 | ||
|
|
aca7d7c571 | ||
|
|
bff72f609c | ||
|
|
adb03b7420 | ||
|
|
2094e18b60 | ||
|
|
541d8ddd40 | ||
|
|
f996172218 | ||
|
|
f9ffc1c1f3 | ||
|
|
05085ad504 | ||
|
|
64aecaf28b | ||
|
|
7b3ef45300 | ||
|
|
bd25de930b | ||
|
|
15d43c9653 | ||
|
|
5b7eba61cc |
@@ -16,6 +16,7 @@ d_log/*.zip
|
||||
sess_*
|
||||
*/logs/*.txt
|
||||
*/logs/*/*.txt
|
||||
*/logs/preserved
|
||||
err.txt
|
||||
che/.htaccess
|
||||
kwe/.htaccess
|
||||
@@ -28,6 +29,7 @@ d_shared
|
||||
d_pic/*.jpg
|
||||
d_pic/*.gif
|
||||
d_pic/*.png
|
||||
d_pic/uploaded_image
|
||||
|
||||
d_setting/*.php
|
||||
*/d_setting/*.php
|
||||
|
||||
@@ -9,8 +9,10 @@
|
||||
* <code>mpm_event</code> 권장
|
||||
* PHP 7.2 이상
|
||||
* <code>php-fpm</code> 권장
|
||||
* php에서 curl을 실행가능해야 합니다.
|
||||
* MySQL 5.6 이상, 또는 MariaDB 10.0 이상
|
||||
* php에서 curl, pdo-sqlite을 실행가능해야 합니다. (기본값: 지원)
|
||||
* mysqlnd가 지원되어야합니다. (기본값: 지원)
|
||||
* MariaDB 10.2.1 이상
|
||||
* MySQL 5.6 이상도 가능하도록 할 예정입니다.
|
||||
* <code>git</code>
|
||||
* <code>curl</code>
|
||||
|
||||
@@ -47,7 +49,7 @@ Database 수는 로그인 관리 서버 1개, 내부 서버 7개로, 총 8개의
|
||||
|
||||
현재 카카오로그인 API KEY를 입력하는 작업이 설치과정에 추가되어있지 않습니다.
|
||||
|
||||
<code>f_install/templates/KakaoKey.orig.php</code> 를 <code>d_setting/KakaoKey.php</code>로 복사한 후 API 키를 입력하여야 합니다.
|
||||
설치 후 <code>d_setting/KakaoKey.php</code>에서 API키를 입력해야 합니다.
|
||||
|
||||
|
||||
## 라이선스
|
||||
|
||||
+6
-2
@@ -52,8 +52,8 @@ input::-webkit-input-placeholder {
|
||||
|
||||
}
|
||||
|
||||
.login-button{
|
||||
margin-top: 5px;
|
||||
.login_btn_group{
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
.login-register{
|
||||
@@ -98,6 +98,10 @@ input::-webkit-input-placeholder {
|
||||
z-index:800;
|
||||
}
|
||||
|
||||
#login_card{
|
||||
z-index:801;
|
||||
}
|
||||
|
||||
#btn_kakao_login{
|
||||
cursor: pointer;
|
||||
height:46px;
|
||||
|
||||
Vendored
+2
-2
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Vendored
+3
-3
File diff suppressed because one or more lines are too long
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
/*! Select2 4.0.5 | https://github.com/select2/select2/blob/master/LICENSE.md */
|
||||
|
||||
(function(){if(jQuery&&jQuery.fn&&jQuery.fn.select2&&jQuery.fn.select2.amd)var e=jQuery.fn.select2.amd;return e.define("select2/i18n/ko",[],function(){return{errorLoading:function(){return"결과를 불러올 수 없습니다."},inputTooLong:function(e){var t=e.input.length-e.maximum,n="너무 깁니다. "+t+" 글자 지워주세요.";return n},inputTooShort:function(e){var t=e.minimum-e.input.length,n="너무 짧습니다. "+t+" 글자 더 입력해주세요.";return n},loadingMore:function(){return"불러오는 중…"},maximumSelected:function(e){var t="최대 "+e.maximum+"개까지만 선택 가능합니다.";return t},noResults:function(){return"결과가 없습니다."},searching:function(){return"검색 중…"}}}),{define:e.define,require:e.require}})();
|
||||
Vendored
+188
@@ -0,0 +1,188 @@
|
||||
/* select2-bootstrap4 with Darkly */
|
||||
.select2-container--bootstrap4 { color: black; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection { background-color: #fff; border: 1px solid #ced4da; border-radius: 0.25rem; color: #495057; font-size: 1rem; outline: 0; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection.form-control { border-radius: 0.25rem; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-search--dropdown .select2-search__field { background-color: #fff; border: 1px solid #ced4da; border-radius: 0.25rem; color: #495057; font-size: 1rem; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-search__field { outline: 0; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-search__field::-webkit-input-placeholder { color: #6c757d; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-search__field:-moz-placeholder { color: #6c757d; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-search__field::-moz-placeholder { color: #6c757d; opacity: 1; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-search__field:-ms-input-placeholder { color: #6c757d; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-results__option { padding: 0.75rem 0.375rem; font-size: 1rem; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-results__option[role=group] { padding: 0; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-results__option[aria-disabled=true] { color: #6c757d; cursor: not-allowed; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-results__option[aria-selected=true] { background-color: #f8f9fa; color: #16181b; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-results__option--highlighted[aria-selected] { background-color: #007bff; color: #fff; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-results__option .select2-results__option { padding: 0.75rem 0.375rem; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-results__option .select2-results__option .select2-results__group { padding-left: 0; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-results__option .select2-results__option .select2-results__option { margin-left: -0.375rem; padding-left: 0.75rem; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-results__option .select2-results__option .select2-results__option .select2-results__option { margin-left: -0.75rem; padding-left: 1.125rem; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option { margin-left: -1.125rem; padding-left: 1.5rem; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option { margin-left: -1.5rem; padding-left: 1.875rem; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option { margin-left: -1.875rem; padding-left: 2.25rem; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-results__group { color: #6c757d; display: block; padding: 0.75rem 0.375rem; font-size: 75%; line-height: 1; white-space: nowrap; }
|
||||
|
||||
.select2-container--bootstrap4.select2-container--focus .select2-selection, .select2-container--bootstrap4.select2-container--open .select2-selection { transition: border-color ease-in-out 0.15s, box-shadow ease-in-out 0.15s; border-color: #80bdff; }
|
||||
|
||||
@media screen and (prefers-reduced-motion: reduce) { .select2-container--bootstrap4.select2-container--focus .select2-selection, .select2-container--bootstrap4.select2-container--open .select2-selection { transition: none; } }
|
||||
|
||||
.select2-container--bootstrap4.select2-container--open .select2-selection .select2-selection__arrow b { border-color: transparent transparent #6c757d transparent; border-width: 0 0.25rem 0.25rem 0.25rem; }
|
||||
|
||||
.select2-container--bootstrap4.select2-container--open.select2-container--below .select2-selection { border-bottom-right-radius: 0; border-bottom-left-radius: 0; border-bottom-color: transparent; }
|
||||
|
||||
.select2-container--bootstrap4.select2-container--open.select2-container--above .select2-selection { border-top-left-radius: 0; border-top-right-radius: 0; border-top-color: transparent; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection__clear { color: #6c757d; cursor: pointer; float: right; font-weight: bold; margin-right: 10px; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection__clear:hover { color: #343a40; }
|
||||
|
||||
.select2-container--bootstrap4.select2-container--disabled .select2-selection { border-color: #ced4da; }
|
||||
|
||||
.select2-container--bootstrap4.select2-container--disabled .select2-selection, .select2-container--bootstrap4.select2-container--disabled .select2-search__field { cursor: not-allowed; }
|
||||
|
||||
.select2-container--bootstrap4.select2-container--disabled .select2-selection, .select2-container--bootstrap4.select2-container--disabled .select2-selection--multiple .select2-selection__choice { background-color: #e9ecef; }
|
||||
|
||||
.select2-container--bootstrap4.select2-container--disabled .select2-selection__clear, .select2-container--bootstrap4.select2-container--disabled .select2-selection--multiple .select2-selection__choice__remove { display: none; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-dropdown { border-color: #80bdff; border-width: 1px; overflow-x: hidden; margin-top: -1px; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-dropdown--above { margin-top: 1px; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-results > .select2-results__options { max-height: 200px; overflow-y: auto; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--single { height: calc(2.25rem + 2px); line-height: 1; padding: 0.75rem 1.125rem 0.75rem 0.375rem; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow { position: absolute; bottom: 0; right: 0.375rem; top: 0; width: 0.25rem; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow b { border-color: #6c757d transparent transparent transparent; border-style: solid; border-width: 0.25rem 0.25rem 0 0.25rem; height: 0; left: 0; margin-left: -0.25rem; margin-top: -0.125rem; position: absolute; top: 50%; width: 0; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--single .select2-selection__rendered { color: #495057; padding: 0; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--single .select2-selection__placeholder { color: #6c757d; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--multiple { min-height: calc(2.25rem + 2px); padding: 0; height: auto; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__rendered { box-sizing: border-box; display: block; line-height: 1; list-style: none; margin: 0; overflow: hidden; padding: 0.75rem 0.375rem 0 0.75rem; width: 100%; text-overflow: ellipsis; white-space: nowrap; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__placeholder { color: #6c757d; float: left; margin-top: 5px; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice { color: #495057; background: transparent; border: 1px solid #343a40; border-radius: 0.25rem; cursor: default; float: left; margin: -0.25rem 0 0 0.1875rem; padding: 0 0.75rem; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--multiple .select2-search--inline .select2-search__field { background: transparent; padding: 0 0.375rem; height: calc(2.25rem + 2px)-2; line-height: 1; margin-top: 0; min-width: 5em; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice__remove { color: #6c757d; cursor: pointer; display: inline-block; font-weight: bold; margin-right: 0.375rem; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice__remove:hover { color: #343a40; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--multiple .select2-selection__clear { margin-top: 0.75rem; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--single.input-sm, .input-group-sm .select2-container--bootstrap4 .select2-selection--single, .form-group-sm .select2-container--bootstrap4 .select2-selection--single { border-radius: 0.2rem; font-size: 75%; height: calc(1.8125rem + 2px); line-height: 1; padding: 0.5rem 1rem 0.5rem 0.25rem; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--single.input-sm .select2-selection__arrow b, .input-group-sm .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow b, .form-group-sm .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow b { margin-left: -0.5rem; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--multiple.input-sm, .input-group-sm .select2-container--bootstrap4 .select2-selection--multiple, .form-group-sm .select2-container--bootstrap4 .select2-selection--multiple { min-height: calc(1.8125rem + 2px); border-radius: 0.2rem; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--multiple.input-sm .select2-selection__rendered, .input-group-sm .select2-container--bootstrap4 .select2-selection--multiple .select2-selection__rendered, .form-group-sm .select2-container--bootstrap4 .select2-selection--multiple .select2-selection__rendered { padding: 0.5rem 0.25rem 0 0.5rem; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--multiple.input-sm .select2-selection__choice, .input-group-sm .select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice, .form-group-sm .select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice { font-size: 75%; line-height: 1; margin: 0 0 0 0.125rem; padding: 0 0.5rem; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--multiple.input-sm .select2-search--inline .select2-search__field, .input-group-sm .select2-container--bootstrap4 .select2-selection--multiple .select2-search--inline .select2-search__field, .form-group-sm .select2-container--bootstrap4 .select2-selection--multiple .select2-search--inline .select2-search__field { padding: 0 0.25rem; font-size: 75%; height: calc(1.8125rem + 2px)-2; line-height: 1; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--multiple.input-sm .select2-selection__clear, .input-group-sm .select2-container--bootstrap4 .select2-selection--multiple .select2-selection__clear, .form-group-sm .select2-container--bootstrap4 .select2-selection--multiple .select2-selection__clear { margin-top: 0.5rem; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--single.input-lg, .input-group-lg .select2-container--bootstrap4 .select2-selection--single, .form-group-lg .select2-container--bootstrap4 .select2-selection--single { border-radius: 0.3rem; font-size: 1.25rem; height: calc(2.875rem + 2px); line-height: 1; padding: 1rem 1.4375rem 1rem 0.5rem; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--single.input-lg .select2-selection__arrow, .input-group-lg .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow, .form-group-lg .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow { width: 0.3125rem; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--single.input-lg .select2-selection__arrow b, .input-group-lg .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow b, .form-group-lg .select2-container--bootstrap4 .select2-selection--single .select2-selection__arrow b { border-width: 0.3125rem 0.3125rem 0 0.3125rem; margin-left: -0.3125rem; margin-left: -1rem; margin-top: -0.15625rem; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--multiple.input-lg, .input-group-lg .select2-container--bootstrap4 .select2-selection--multiple, .form-group-lg .select2-container--bootstrap4 .select2-selection--multiple { min-height: calc(2.875rem + 2px); border-radius: 0.3rem; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--multiple.input-lg .select2-selection__choice, .input-group-lg .select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice, .form-group-lg .select2-container--bootstrap4 .select2-selection--multiple .select2-selection__choice { font-size: 1.25rem; line-height: 1; border-radius: 0.25rem; margin: 0rem 0 0 0.25rem; padding: 0 1rem; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--multiple.input-lg .select2-search--inline .select2-search__field, .input-group-lg .select2-container--bootstrap4 .select2-selection--multiple .select2-search--inline .select2-search__field, .form-group-lg .select2-container--bootstrap4 .select2-selection--multiple .select2-search--inline .select2-search__field { padding: 0 0.5rem; font-size: 1.25rem; height: calc(2.875rem + 2px)-2; line-height: 1; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--multiple.input-lg .select2-selection__clear, .input-group-lg .select2-container--bootstrap4 .select2-selection--multiple .select2-selection__clear, .form-group-lg .select2-container--bootstrap4 .select2-selection--multiple .select2-selection__clear { margin-top: 1rem; }
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection.input-lg.select2-container--open .select2-selection--single .select2-selection__arrow b { border-color: transparent transparent #6c757d transparent; border-width: 0 0.3125rem 0.3125rem 0.3125rem; }
|
||||
|
||||
.input-group-lg .select2-container--bootstrap4 .select2-selection.select2-container--open .select2-selection--single .select2-selection__arrow b { border-color: transparent transparent #6c757d transparent; border-width: 0 0.3125rem 0.3125rem 0.3125rem; }
|
||||
|
||||
.select2-container--bootstrap4[dir="rtl"] .select2-selection--single { padding-left: 1.125rem; padding-right: 0.375rem; }
|
||||
|
||||
.select2-container--bootstrap4[dir="rtl"] .select2-selection--single .select2-selection__rendered { padding-right: 0; padding-left: 0; text-align: right; }
|
||||
|
||||
.select2-container--bootstrap4[dir="rtl"] .select2-selection--single .select2-selection__clear { float: left; }
|
||||
|
||||
.select2-container--bootstrap4[dir="rtl"] .select2-selection--single .select2-selection__arrow { left: 0.375rem; right: auto; }
|
||||
|
||||
.select2-container--bootstrap4[dir="rtl"] .select2-selection--single .select2-selection__arrow b { margin-left: 0; }
|
||||
|
||||
.select2-container--bootstrap4[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--bootstrap4[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder, .select2-container--bootstrap4[dir="rtl"] .select2-selection--multiple .select2-search--inline { float: right; }
|
||||
|
||||
.select2-container--bootstrap4[dir="rtl"] .select2-selection--multiple .select2-selection__choice { margin-left: 0; margin-right: 0.1875rem; }
|
||||
|
||||
.select2-container--bootstrap4[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove { margin-left: 2px; margin-right: auto; }
|
||||
|
||||
.has-warning .select2-dropdown, .has-warning .select2-selection { border-color: #ffc107; }
|
||||
|
||||
.has-warning .select2-container--focus .select2-selection, .has-warning .select2-container--open .select2-selection { border-color: #d39e00; }
|
||||
|
||||
.has-warning.select2-drop-active { border-color: #d39e00; }
|
||||
|
||||
.has-warning.select2-drop-active.select2-drop.select2-drop-above { border-top-color: #d39e00; }
|
||||
|
||||
.has-error .select2-dropdown, .has-error .select2-selection { border-color: #dc3545; }
|
||||
|
||||
.has-error .select2-container--focus .select2-selection, .has-error .select2-container--open .select2-selection { border-color: #bd2130; }
|
||||
|
||||
.has-error.select2-drop-active { border-color: #bd2130; }
|
||||
|
||||
.has-error.select2-drop-active.select2-drop.select2-drop-above { border-top-color: #bd2130; }
|
||||
|
||||
.has-success .select2-dropdown, .has-success .select2-selection { border-color: #28a745; }
|
||||
|
||||
.has-success .select2-container--focus .select2-selection, .has-success .select2-container--open .select2-selection { border-color: #1e7e34; }
|
||||
|
||||
.has-success.select2-drop-active { border-color: #1e7e34; }
|
||||
|
||||
.has-success.select2-drop-active.select2-drop.select2-drop-above { border-top-color: #1e7e34; }
|
||||
|
||||
.input-group > .select2-hidden-accessible:first-child + .select2-container--bootstrap4 > .selection > .select2-selection, .input-group > .select2-hidden-accessible:first-child + .select2-container--bootstrap4 > .selection > .select2-selection.form-control { border-top-right-radius: 0; border-bottom-right-radius: 0; }
|
||||
|
||||
.input-group > .select2-hidden-accessible:not(:first-child) + .select2-container--bootstrap4:not(:last-child) > .selection > .select2-selection, .input-group > .select2-hidden-accessible:not(:first-child) + .select2-container--bootstrap4:not(:last-child) > .selection > .select2-selection.form-control { border-radius: 0; }
|
||||
|
||||
.input-group > .select2-hidden-accessible:not(:first-child):not(:last-child) + .select2-container--bootstrap4:last-child > .selection > .select2-selection, .input-group > .select2-hidden-accessible:not(:first-child):not(:last-child) + .select2-container--bootstrap4:last-child > .selection > .select2-selection.form-control { border-top-left-radius: 0; border-bottom-left-radius: 0; }
|
||||
|
||||
.input-group > .select2-container--bootstrap4 { display: table; table-layout: fixed; position: relative; z-index: 2; width: 100%; margin-bottom: 0; }
|
||||
|
||||
.input-group > .select2-container--bootstrap4 > .selection > .select2-selection.form-control { float: none; }
|
||||
|
||||
.input-group > .select2-container--bootstrap4.select2-container--open, .input-group > .select2-container--bootstrap4.select2-container--focus { z-index: 3; }
|
||||
|
||||
.input-group > .select2-container--bootstrap4, .input-group > .select2-container--bootstrap4 .input-group-btn, .input-group > .select2-container--bootstrap4 .input-group-btn .btn { vertical-align: top; }
|
||||
|
||||
.form-control.select2-hidden-accessible { position: absolute !important; width: 1px !important; }
|
||||
|
||||
@media (min-width: 576px) { .form-inline .select2-container--bootstrap4 { display: inline-block; } }
|
||||
Vendored
+484
@@ -0,0 +1,484 @@
|
||||
.select2-container {
|
||||
box-sizing: border-box;
|
||||
display: inline-block;
|
||||
margin: 0;
|
||||
position: relative;
|
||||
vertical-align: middle; }
|
||||
.select2-container .select2-selection--single {
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
height: 28px;
|
||||
user-select: none;
|
||||
-webkit-user-select: none; }
|
||||
.select2-container .select2-selection--single .select2-selection__rendered {
|
||||
display: block;
|
||||
padding-left: 8px;
|
||||
padding-right: 20px;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap; }
|
||||
.select2-container .select2-selection--single .select2-selection__clear {
|
||||
position: relative; }
|
||||
.select2-container[dir="rtl"] .select2-selection--single .select2-selection__rendered {
|
||||
padding-right: 8px;
|
||||
padding-left: 20px; }
|
||||
.select2-container .select2-selection--multiple {
|
||||
box-sizing: border-box;
|
||||
cursor: pointer;
|
||||
display: block;
|
||||
min-height: 32px;
|
||||
user-select: none;
|
||||
-webkit-user-select: none; }
|
||||
.select2-container .select2-selection--multiple .select2-selection__rendered {
|
||||
display: inline-block;
|
||||
overflow: hidden;
|
||||
padding-left: 8px;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap; }
|
||||
.select2-container .select2-search--inline {
|
||||
float: left; }
|
||||
.select2-container .select2-search--inline .select2-search__field {
|
||||
box-sizing: border-box;
|
||||
border: none;
|
||||
font-size: 100%;
|
||||
margin-top: 5px;
|
||||
padding: 0; }
|
||||
.select2-container .select2-search--inline .select2-search__field::-webkit-search-cancel-button {
|
||||
-webkit-appearance: none; }
|
||||
|
||||
.select2-dropdown {
|
||||
background-color: white;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
position: absolute;
|
||||
left: -100000px;
|
||||
width: 100%;
|
||||
z-index: 1051; }
|
||||
|
||||
.select2-results {
|
||||
display: block; }
|
||||
|
||||
.select2-results__options {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0; }
|
||||
|
||||
.select2-results__option {
|
||||
padding: 6px;
|
||||
user-select: none;
|
||||
-webkit-user-select: none; }
|
||||
.select2-results__option[aria-selected] {
|
||||
cursor: pointer; }
|
||||
|
||||
.select2-container--open .select2-dropdown {
|
||||
left: 0; }
|
||||
|
||||
.select2-container--open .select2-dropdown--above {
|
||||
border-bottom: none;
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0; }
|
||||
|
||||
.select2-container--open .select2-dropdown--below {
|
||||
border-top: none;
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0; }
|
||||
|
||||
.select2-search--dropdown {
|
||||
display: block;
|
||||
padding: 4px; }
|
||||
.select2-search--dropdown .select2-search__field {
|
||||
padding: 4px;
|
||||
width: 100%;
|
||||
box-sizing: border-box; }
|
||||
.select2-search--dropdown .select2-search__field::-webkit-search-cancel-button {
|
||||
-webkit-appearance: none; }
|
||||
.select2-search--dropdown.select2-search--hide {
|
||||
display: none; }
|
||||
|
||||
.select2-close-mask {
|
||||
border: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
display: block;
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
min-height: 100%;
|
||||
min-width: 100%;
|
||||
height: auto;
|
||||
width: auto;
|
||||
opacity: 0;
|
||||
z-index: 99;
|
||||
background-color: #fff;
|
||||
filter: alpha(opacity=0); }
|
||||
|
||||
.select2-hidden-accessible {
|
||||
border: 0 !important;
|
||||
clip: rect(0 0 0 0) !important;
|
||||
height: 1px !important;
|
||||
margin: -1px !important;
|
||||
overflow: hidden !important;
|
||||
padding: 0 !important;
|
||||
position: absolute !important;
|
||||
width: 1px !important; }
|
||||
|
||||
.select2-container--default .select2-selection--single {
|
||||
background-color: #fff;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px; }
|
||||
.select2-container--default .select2-selection--single .select2-selection__rendered {
|
||||
color: #444;
|
||||
line-height: 28px; }
|
||||
.select2-container--default .select2-selection--single .select2-selection__clear {
|
||||
cursor: pointer;
|
||||
float: right;
|
||||
font-weight: bold; }
|
||||
.select2-container--default .select2-selection--single .select2-selection__placeholder {
|
||||
color: #999; }
|
||||
.select2-container--default .select2-selection--single .select2-selection__arrow {
|
||||
height: 26px;
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
right: 1px;
|
||||
width: 20px; }
|
||||
.select2-container--default .select2-selection--single .select2-selection__arrow b {
|
||||
border-color: #888 transparent transparent transparent;
|
||||
border-style: solid;
|
||||
border-width: 5px 4px 0 4px;
|
||||
height: 0;
|
||||
left: 50%;
|
||||
margin-left: -4px;
|
||||
margin-top: -2px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
width: 0; }
|
||||
|
||||
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__clear {
|
||||
float: left; }
|
||||
|
||||
.select2-container--default[dir="rtl"] .select2-selection--single .select2-selection__arrow {
|
||||
left: 1px;
|
||||
right: auto; }
|
||||
|
||||
.select2-container--default.select2-container--disabled .select2-selection--single {
|
||||
background-color: #eee;
|
||||
cursor: default; }
|
||||
.select2-container--default.select2-container--disabled .select2-selection--single .select2-selection__clear {
|
||||
display: none; }
|
||||
|
||||
.select2-container--default.select2-container--open .select2-selection--single .select2-selection__arrow b {
|
||||
border-color: transparent transparent #888 transparent;
|
||||
border-width: 0 4px 5px 4px; }
|
||||
|
||||
.select2-container--default .select2-selection--multiple {
|
||||
background-color: white;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px;
|
||||
cursor: text; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__rendered {
|
||||
box-sizing: border-box;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0 5px;
|
||||
width: 100%; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__rendered li {
|
||||
list-style: none; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__placeholder {
|
||||
color: #999;
|
||||
margin-top: 5px;
|
||||
float: left; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__clear {
|
||||
cursor: pointer;
|
||||
float: right;
|
||||
font-weight: bold;
|
||||
margin-top: 5px;
|
||||
margin-right: 10px; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__choice {
|
||||
background-color: #e4e4e4;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px;
|
||||
cursor: default;
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
margin-top: 5px;
|
||||
padding: 0 5px; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
|
||||
color: #999;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
font-weight: bold;
|
||||
margin-right: 2px; }
|
||||
.select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover {
|
||||
color: #333; }
|
||||
|
||||
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__placeholder, .select2-container--default[dir="rtl"] .select2-selection--multiple .select2-search--inline {
|
||||
float: right; }
|
||||
|
||||
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
|
||||
margin-left: 5px;
|
||||
margin-right: auto; }
|
||||
|
||||
.select2-container--default[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
|
||||
margin-left: 2px;
|
||||
margin-right: auto; }
|
||||
|
||||
.select2-container--default.select2-container--focus .select2-selection--multiple {
|
||||
border: solid black 1px;
|
||||
outline: 0; }
|
||||
|
||||
.select2-container--default.select2-container--disabled .select2-selection--multiple {
|
||||
background-color: #eee;
|
||||
cursor: default; }
|
||||
|
||||
.select2-container--default.select2-container--disabled .select2-selection__choice__remove {
|
||||
display: none; }
|
||||
|
||||
.select2-container--default.select2-container--open.select2-container--above .select2-selection--single, .select2-container--default.select2-container--open.select2-container--above .select2-selection--multiple {
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0; }
|
||||
|
||||
.select2-container--default.select2-container--open.select2-container--below .select2-selection--single, .select2-container--default.select2-container--open.select2-container--below .select2-selection--multiple {
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0; }
|
||||
|
||||
.select2-container--default .select2-search--dropdown .select2-search__field {
|
||||
border: 1px solid #aaa; }
|
||||
|
||||
.select2-container--default .select2-search--inline .select2-search__field {
|
||||
background: transparent;
|
||||
border: none;
|
||||
outline: 0;
|
||||
box-shadow: none;
|
||||
-webkit-appearance: textfield; }
|
||||
|
||||
.select2-container--default .select2-results > .select2-results__options {
|
||||
max-height: 200px;
|
||||
overflow-y: auto; }
|
||||
|
||||
.select2-container--default .select2-results__option[role=group] {
|
||||
padding: 0; }
|
||||
|
||||
.select2-container--default .select2-results__option[aria-disabled=true] {
|
||||
color: #999; }
|
||||
|
||||
.select2-container--default .select2-results__option[aria-selected=true] {
|
||||
background-color: #ddd; }
|
||||
|
||||
.select2-container--default .select2-results__option .select2-results__option {
|
||||
padding-left: 1em; }
|
||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__group {
|
||||
padding-left: 0; }
|
||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__option {
|
||||
margin-left: -1em;
|
||||
padding-left: 2em; }
|
||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
||||
margin-left: -2em;
|
||||
padding-left: 3em; }
|
||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
||||
margin-left: -3em;
|
||||
padding-left: 4em; }
|
||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
||||
margin-left: -4em;
|
||||
padding-left: 5em; }
|
||||
.select2-container--default .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option .select2-results__option {
|
||||
margin-left: -5em;
|
||||
padding-left: 6em; }
|
||||
|
||||
.select2-container--default .select2-results__option--highlighted[aria-selected] {
|
||||
background-color: #5897fb;
|
||||
color: white; }
|
||||
|
||||
.select2-container--default .select2-results__group {
|
||||
cursor: default;
|
||||
display: block;
|
||||
padding: 6px; }
|
||||
|
||||
.select2-container--classic .select2-selection--single {
|
||||
background-color: #f7f7f7;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px;
|
||||
outline: 0;
|
||||
background-image: -webkit-linear-gradient(top, white 50%, #eeeeee 100%);
|
||||
background-image: -o-linear-gradient(top, white 50%, #eeeeee 100%);
|
||||
background-image: linear-gradient(to bottom, white 50%, #eeeeee 100%);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
|
||||
.select2-container--classic .select2-selection--single:focus {
|
||||
border: 1px solid #5897fb; }
|
||||
.select2-container--classic .select2-selection--single .select2-selection__rendered {
|
||||
color: #444;
|
||||
line-height: 28px; }
|
||||
.select2-container--classic .select2-selection--single .select2-selection__clear {
|
||||
cursor: pointer;
|
||||
float: right;
|
||||
font-weight: bold;
|
||||
margin-right: 10px; }
|
||||
.select2-container--classic .select2-selection--single .select2-selection__placeholder {
|
||||
color: #999; }
|
||||
.select2-container--classic .select2-selection--single .select2-selection__arrow {
|
||||
background-color: #ddd;
|
||||
border: none;
|
||||
border-left: 1px solid #aaa;
|
||||
border-top-right-radius: 4px;
|
||||
border-bottom-right-radius: 4px;
|
||||
height: 26px;
|
||||
position: absolute;
|
||||
top: 1px;
|
||||
right: 1px;
|
||||
width: 20px;
|
||||
background-image: -webkit-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
|
||||
background-image: -o-linear-gradient(top, #eeeeee 50%, #cccccc 100%);
|
||||
background-image: linear-gradient(to bottom, #eeeeee 50%, #cccccc 100%);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFCCCCCC', GradientType=0); }
|
||||
.select2-container--classic .select2-selection--single .select2-selection__arrow b {
|
||||
border-color: #888 transparent transparent transparent;
|
||||
border-style: solid;
|
||||
border-width: 5px 4px 0 4px;
|
||||
height: 0;
|
||||
left: 50%;
|
||||
margin-left: -4px;
|
||||
margin-top: -2px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
width: 0; }
|
||||
|
||||
.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__clear {
|
||||
float: left; }
|
||||
|
||||
.select2-container--classic[dir="rtl"] .select2-selection--single .select2-selection__arrow {
|
||||
border: none;
|
||||
border-right: 1px solid #aaa;
|
||||
border-radius: 0;
|
||||
border-top-left-radius: 4px;
|
||||
border-bottom-left-radius: 4px;
|
||||
left: 1px;
|
||||
right: auto; }
|
||||
|
||||
.select2-container--classic.select2-container--open .select2-selection--single {
|
||||
border: 1px solid #5897fb; }
|
||||
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow {
|
||||
background: transparent;
|
||||
border: none; }
|
||||
.select2-container--classic.select2-container--open .select2-selection--single .select2-selection__arrow b {
|
||||
border-color: transparent transparent #888 transparent;
|
||||
border-width: 0 4px 5px 4px; }
|
||||
|
||||
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--single {
|
||||
border-top: none;
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0;
|
||||
background-image: -webkit-linear-gradient(top, white 0%, #eeeeee 50%);
|
||||
background-image: -o-linear-gradient(top, white 0%, #eeeeee 50%);
|
||||
background-image: linear-gradient(to bottom, white 0%, #eeeeee 50%);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFFFFFFF', endColorstr='#FFEEEEEE', GradientType=0); }
|
||||
|
||||
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--single {
|
||||
border-bottom: none;
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0;
|
||||
background-image: -webkit-linear-gradient(top, #eeeeee 50%, white 100%);
|
||||
background-image: -o-linear-gradient(top, #eeeeee 50%, white 100%);
|
||||
background-image: linear-gradient(to bottom, #eeeeee 50%, white 100%);
|
||||
background-repeat: repeat-x;
|
||||
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#FFEEEEEE', endColorstr='#FFFFFFFF', GradientType=0); }
|
||||
|
||||
.select2-container--classic .select2-selection--multiple {
|
||||
background-color: white;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px;
|
||||
cursor: text;
|
||||
outline: 0; }
|
||||
.select2-container--classic .select2-selection--multiple:focus {
|
||||
border: 1px solid #5897fb; }
|
||||
.select2-container--classic .select2-selection--multiple .select2-selection__rendered {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0 5px; }
|
||||
.select2-container--classic .select2-selection--multiple .select2-selection__clear {
|
||||
display: none; }
|
||||
.select2-container--classic .select2-selection--multiple .select2-selection__choice {
|
||||
background-color: #e4e4e4;
|
||||
border: 1px solid #aaa;
|
||||
border-radius: 4px;
|
||||
cursor: default;
|
||||
float: left;
|
||||
margin-right: 5px;
|
||||
margin-top: 5px;
|
||||
padding: 0 5px; }
|
||||
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove {
|
||||
color: #888;
|
||||
cursor: pointer;
|
||||
display: inline-block;
|
||||
font-weight: bold;
|
||||
margin-right: 2px; }
|
||||
.select2-container--classic .select2-selection--multiple .select2-selection__choice__remove:hover {
|
||||
color: #555; }
|
||||
|
||||
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
|
||||
float: right; }
|
||||
|
||||
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice {
|
||||
margin-left: 5px;
|
||||
margin-right: auto; }
|
||||
|
||||
.select2-container--classic[dir="rtl"] .select2-selection--multiple .select2-selection__choice__remove {
|
||||
margin-left: 2px;
|
||||
margin-right: auto; }
|
||||
|
||||
.select2-container--classic.select2-container--open .select2-selection--multiple {
|
||||
border: 1px solid #5897fb; }
|
||||
|
||||
.select2-container--classic.select2-container--open.select2-container--above .select2-selection--multiple {
|
||||
border-top: none;
|
||||
border-top-left-radius: 0;
|
||||
border-top-right-radius: 0; }
|
||||
|
||||
.select2-container--classic.select2-container--open.select2-container--below .select2-selection--multiple {
|
||||
border-bottom: none;
|
||||
border-bottom-left-radius: 0;
|
||||
border-bottom-right-radius: 0; }
|
||||
|
||||
.select2-container--classic .select2-search--dropdown .select2-search__field {
|
||||
border: 1px solid #aaa;
|
||||
outline: 0; }
|
||||
|
||||
.select2-container--classic .select2-search--inline .select2-search__field {
|
||||
outline: 0;
|
||||
box-shadow: none; }
|
||||
|
||||
.select2-container--classic .select2-dropdown {
|
||||
background-color: white;
|
||||
border: 1px solid transparent; }
|
||||
|
||||
.select2-container--classic .select2-dropdown--above {
|
||||
border-bottom: none; }
|
||||
|
||||
.select2-container--classic .select2-dropdown--below {
|
||||
border-top: none; }
|
||||
|
||||
.select2-container--classic .select2-results > .select2-results__options {
|
||||
max-height: 200px;
|
||||
overflow-y: auto; }
|
||||
|
||||
.select2-container--classic .select2-results__option[role=group] {
|
||||
padding: 0; }
|
||||
|
||||
.select2-container--classic .select2-results__option[aria-disabled=true] {
|
||||
color: grey; }
|
||||
|
||||
.select2-container--classic .select2-results__option--highlighted[aria-selected] {
|
||||
background-color: #3875d7;
|
||||
color: white; }
|
||||
|
||||
.select2-container--classic .select2-results__group {
|
||||
cursor: default;
|
||||
display: block;
|
||||
padding: 6px; }
|
||||
|
||||
.select2-container--classic.select2-container--open .select2-dropdown {
|
||||
border-color: #5897fb; }
|
||||
Vendored
+6457
File diff suppressed because it is too large
Load Diff
Vendored
+1
File diff suppressed because one or more lines are too long
Vendored
+5746
File diff suppressed because it is too large
Load Diff
Vendored
+1
File diff suppressed because one or more lines are too long
Vendored
+1
File diff suppressed because one or more lines are too long
@@ -0,0 +1,153 @@
|
||||
/* Forked from https://github.com/asiffermann/summernote-image-title */
|
||||
|
||||
(function (factory) {
|
||||
/* Global define */
|
||||
if (typeof define === 'function' && define.amd) {
|
||||
// AMD. Register as an anonymous module.
|
||||
define(['jquery'], factory);
|
||||
} else if (typeof module === 'object' && module.exports) {
|
||||
// Node/CommonJS
|
||||
module.exports = factory(require('jquery'));
|
||||
} else {
|
||||
// Browser globals
|
||||
factory(window.jQuery);
|
||||
}
|
||||
}(function ($) {
|
||||
$.extend(true, $.summernote.lang, {
|
||||
'en-US': {
|
||||
imageFlip: {
|
||||
edit: 'Flip image',
|
||||
flipLabel: 'Alternative Image'
|
||||
}
|
||||
},
|
||||
'ko-KR': {
|
||||
imageFlip: {
|
||||
edit: '이미지 전환',
|
||||
flipLabel: '대체 이미지( , 로 구분)'
|
||||
}
|
||||
},
|
||||
});
|
||||
$.extend($.summernote.options, {
|
||||
imageFlip: {
|
||||
icon: '<i class="note-icon-pencil"/>',
|
||||
tooltip: 'Image Flip'
|
||||
}
|
||||
});
|
||||
$.extend($.summernote.plugins, {
|
||||
'imageFlip': function (context) {
|
||||
var self = this;
|
||||
|
||||
var ui = $.summernote.ui;
|
||||
var $note = context.layoutInfo.note;
|
||||
var $editor = context.layoutInfo.editor;
|
||||
var $editable = context.layoutInfo.editable;
|
||||
var $toolbar = context.layoutInfo.toolbar;
|
||||
|
||||
if (typeof context.options.imageFlip === 'undefined') {
|
||||
context.options.imageFlip = {};
|
||||
}
|
||||
|
||||
var options = context.options;
|
||||
var lang = options.langInfo;
|
||||
|
||||
context.memo('button.imageFlip', function () {
|
||||
var button = ui.button({
|
||||
contents: ui.icon(options.icons.pencil),
|
||||
container: false,
|
||||
tooltip: lang.imageFlip.edit,
|
||||
click: function (e) {
|
||||
context.invoke('imageFlip.show');
|
||||
}
|
||||
});
|
||||
|
||||
return button.render();
|
||||
});
|
||||
|
||||
this.initialize = function () {
|
||||
var $container = options.dialogsInBody ? $(document.body) : $editor;
|
||||
|
||||
var body = '<div class="form-group">' +
|
||||
'<label>' + lang.imageFlip.flipLabel + '</label>' +
|
||||
'<input class="note-image-flip-text form-control" type="text" />' +
|
||||
'</div>';
|
||||
|
||||
var footer = '<button href="#" class="btn btn-primary note-image-flip-btn">' + lang.imageFlip.edit + '</button>';
|
||||
|
||||
this.$dialog = ui.dialog({
|
||||
title: lang.imageFlip.edit,
|
||||
body: body,
|
||||
footer: footer
|
||||
}).render().appendTo($container);
|
||||
};
|
||||
|
||||
this.destroy = function () {
|
||||
ui.hideDialog(this.$dialog);
|
||||
this.$dialog.remove();
|
||||
};
|
||||
|
||||
this.bindEnterKey = function ($input, $btn) {
|
||||
$input.on('keypress', function (event) {
|
||||
if (event.keyCode === 13) {
|
||||
$btn.trigger('click');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
this.show = function () {
|
||||
var $img = $($editable.data('target'));
|
||||
|
||||
var imgInfo = {
|
||||
imgDom: $img,
|
||||
flip: $img.data('flip'),
|
||||
};
|
||||
this.showLinkDialog(imgInfo).then(function (imgInfo) {
|
||||
ui.hideDialog(self.$dialog);
|
||||
var $img = imgInfo.imgDom;
|
||||
|
||||
if (imgInfo.flip) {
|
||||
$img.attr('data-flip', imgInfo.flip);
|
||||
}
|
||||
else {
|
||||
$img.removeData('flip');
|
||||
}
|
||||
|
||||
$note.val(context.invoke('code'));
|
||||
$note.change();
|
||||
});
|
||||
};
|
||||
|
||||
this.showLinkDialog = function (imgInfo) {
|
||||
return $.Deferred(function (deferred) {
|
||||
var $imageFlip = self.$dialog.find('.note-image-flip-text');
|
||||
var $editBtn = self.$dialog.find('.note-image-flip-btn');
|
||||
|
||||
ui.onDialogShown(self.$dialog, function () {
|
||||
context.triggerEvent('dialog.shown');
|
||||
|
||||
$editBtn.click(function (event) {
|
||||
event.preventDefault();
|
||||
deferred.resolve({
|
||||
imgDom: imgInfo.imgDom,
|
||||
flip: $imageFlip.val(),
|
||||
});
|
||||
});
|
||||
|
||||
$imageFlip.val(imgInfo.flip).trigger('focus');
|
||||
self.bindEnterKey($imageFlip, $editBtn);
|
||||
|
||||
});
|
||||
|
||||
ui.onDialogHidden(self.$dialog, function () {
|
||||
$editBtn.off('click');
|
||||
|
||||
if (deferred.state() === 'pending') {
|
||||
deferred.reject();
|
||||
}
|
||||
});
|
||||
|
||||
ui.showDialog(self.$dialog);
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
}));
|
||||
@@ -52,6 +52,7 @@ $rootDB->insert('member',[
|
||||
'oauth_type' => 'NONE',
|
||||
'id' => $username,
|
||||
'email' => null,
|
||||
'token_valid_until'=>'2999-01-01 00:00:00',
|
||||
'pw' => $finalPassword,
|
||||
'salt' => $userSalt,
|
||||
'grade'=> 6,
|
||||
|
||||
@@ -217,8 +217,8 @@ $result = Util::generateFileUsingSimpleTemplate(
|
||||
);
|
||||
|
||||
$result = Util::generateFileUsingSimpleTemplate(
|
||||
__dir__.'/templates/menu.orig.js',
|
||||
ROOT.'/d_shared/menu.js',
|
||||
__dir__.'/templates/menu.orig.json',
|
||||
ROOT.'/d_shared/menu.json',
|
||||
[],
|
||||
true
|
||||
);
|
||||
@@ -263,6 +263,14 @@ $result = Util::generateFileUsingSimpleTemplate(
|
||||
]
|
||||
);
|
||||
|
||||
Util::generateFileUsingSimpleTemplate(
|
||||
__dir__.'/templates/KakaoKey.orig.php',
|
||||
ROOT.'/d_setting/KakaoKey.php',
|
||||
[
|
||||
],
|
||||
true
|
||||
);
|
||||
|
||||
if ($result !== true) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
|
||||
@@ -20,16 +20,18 @@ ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||
CREATE TABLE `member` (
|
||||
`NO` INT(11) NOT NULL AUTO_INCREMENT,
|
||||
`oauth_id` BIGINT(20) NULL DEFAULT NULL,
|
||||
`oauth_type` ENUM('NONE','KAKAO') NOT NULL,
|
||||
`ID` VARCHAR(64) NOT NULL,
|
||||
`EMAIL` VARCHAR(64) NULL DEFAULT NULL,
|
||||
`oauth_type` ENUM('NONE','KAKAO') NOT NULL,
|
||||
`oauth_info` TEXT NOT NULL DEFAULT '{}',
|
||||
`token_valid_until` DATETIME NULL DEFAULT NULL,
|
||||
`PW` CHAR(128) NOT NULL,
|
||||
`salt` CHAR(16) NOT NULL,
|
||||
`third_use` INT(1) NOT NULL DEFAULT '0',
|
||||
`NAME` VARCHAR(64) NOT NULL,
|
||||
`PICTURE` VARCHAR(64) NULL DEFAULT 'default.jpg',
|
||||
`IMGSVR` INT(1) NULL DEFAULT '0',
|
||||
`acl` text NOT NULL DEFAULT '{}' COMMENT 'json',
|
||||
`acl` TEXT NOT NULL DEFAULT '{}' COMMENT 'json',
|
||||
`GRADE` INT(1) NULL DEFAULT '1',
|
||||
`REG_NUM` INT(3) NULL DEFAULT '0',
|
||||
`REG_DATE` DATETIME NOT NULL,
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
window.sammo_menu = [
|
||||
['/bbs/board', '삼모게시판', '_blank'],
|
||||
['/bbs/tip', '팁/강좌', '_blank'],
|
||||
['/bbs/news', '삼국 일보', '_blank'],
|
||||
['/bbs/history2', '개인 열전', '_blank'],
|
||||
['/bbs/history3', '국가 열전', '_blank'],
|
||||
['/bbs/patch', '패치 내역', '_blank']
|
||||
];
|
||||
@@ -0,0 +1,8 @@
|
||||
[
|
||||
["/bbs/board", "삼모게시판", "_blank"],
|
||||
["/bbs/tip", "팁/강좌", "_blank"],
|
||||
["/bbs/news", "삼국 일보", "_blank"],
|
||||
["/bbs/history2", "개인 열전", "_blank"],
|
||||
["/bbs/history3", "국가 열전", "_blank"],
|
||||
["/bbs/patch", "패치 내역", "_blank"]
|
||||
]
|
||||
@@ -6,8 +6,6 @@ include "func.php";
|
||||
|
||||
$btn = Util::getReq('btn');
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
@@ -6,8 +6,6 @@ include "func.php";
|
||||
|
||||
$select = Util::getReq('select', 'int', 0);
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ if($showServers){
|
||||
if($nation['generals']){
|
||||
$generals = $db->query('SELECT `general_no`, `name`, `last_yearmonth` FROM ng_old_generals WHERE server_id=%s AND general_no IN %li', $serverID, $nation['generals']);
|
||||
|
||||
if(count($generals) != $nation['generals'] && $serverID == UniqueConst::$serverID){
|
||||
if(count($generals) != count($nation['generals']) && $serverID == UniqueConst::$serverID){
|
||||
$liveGenerals = $nation['generals'];
|
||||
foreach($generals as $general){
|
||||
if(in_array($general['general_no'], $nation['generals'])){
|
||||
|
||||
@@ -6,8 +6,6 @@ include "func.php";
|
||||
|
||||
$type = Util::getReq('type', 'int', 9);
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
@@ -7,8 +7,6 @@ $btn = Util::getReq('btn');
|
||||
$yearmonth = Util::getReq('yearmonth', 'int');
|
||||
$serverID = Util::getReq('serverID', 'string', null);
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
@@ -6,8 +6,6 @@ include "func.php";
|
||||
|
||||
$type = Util::getReq('type', 'int', 1);
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
if($type <= 0 || $type > 8){
|
||||
$type = 1;
|
||||
}
|
||||
|
||||
+1
-1
@@ -170,7 +170,7 @@ $max_refresh['name'] = '접속자 총합';
|
||||
$refresh_result = array_merge([$max_refresh], $db->query('SELECT `name`,refresh,`connect` FROM general ORDER BY refresh DESC LIMIT 5'));
|
||||
|
||||
foreach ($refresh_result as $i=>$user) {
|
||||
$w = round($user['refresh'] / $max_refresh['refresh'] * 100, 1);
|
||||
$w = round($user['refresh'] / max(1, $max_refresh['refresh']) * 100, 1);
|
||||
$w2 = round(100 - $w, 1);
|
||||
$color = getTrafficColor($w);
|
||||
?>
|
||||
|
||||
@@ -7,8 +7,6 @@ include "func.php";
|
||||
$msg = Util::getReq('msg');
|
||||
$msg2 = Util::getReq('msg2');
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
@@ -16,8 +16,6 @@ if ($type < 0 || $type > 3) {
|
||||
$type = 0;
|
||||
}
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
+24
-22
@@ -6,8 +6,6 @@ include "func.php";
|
||||
|
||||
$citylist = Util::getReq('citylist', 'int');
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
@@ -37,8 +35,12 @@ $templates = new \League\Plates\Engine('templates');
|
||||
<meta name="viewport" content="width=1024" />
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/select2/select2.full.min.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('js/currentCity.js')?>
|
||||
<?=WebUtil::printCSS('../e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('../e_lib/select2/select2.min.css')?>
|
||||
<?=WebUtil::printCSS('../e_lib/select2/select2-bootstrap4.css')?>
|
||||
<?=WebUtil::printCSS('../d_shared/common.css')?>
|
||||
<?=WebUtil::printCSS('css/common.css')?>
|
||||
<style>
|
||||
@@ -65,8 +67,9 @@ $templates = new \League\Plates\Engine('templates');
|
||||
<table align=center width=1000 class='tb_layout bg0'>
|
||||
<tr>
|
||||
<td width=998>
|
||||
<form name=cityselect method=get>도시선택 :
|
||||
<select name=citylist size=1 style=color:white;background-color:black;width:798px;>
|
||||
<form name=cityselect method=get>
|
||||
<div style='text-align:center;'>도시선택 :
|
||||
<select id="citySelector" name=citylist size=1 style='display:inline-block;min-width:400px;'>
|
||||
<?php
|
||||
if(!$citylist){
|
||||
$citylist = $me['city'];
|
||||
@@ -81,11 +84,11 @@ if($me['level'] == 0) {
|
||||
echo "
|
||||
<option value={$city['city']}";
|
||||
if($city['city'] == $citylist) { echo " selected"; $valid = 1; }
|
||||
echo ">==================================================【".StringUtil::padString($city['name'], 4, '_')."】";
|
||||
echo ">【".StringUtil::padString($city['name'], 4, '_')."】";
|
||||
if($city['nation'] == 0) echo "공백지";
|
||||
elseif($me['nation'] == $city['nation']) echo "본국==";
|
||||
else echo "타국==";
|
||||
echo "============================================</option>";
|
||||
elseif($me['nation'] == $city['nation']) echo "본국";
|
||||
else echo "타국";
|
||||
echo "</option>";
|
||||
} else {
|
||||
// 아국 도시들 선택
|
||||
$query = "select city,name,nation from city where nation='{$me['nation']}'";
|
||||
@@ -97,11 +100,11 @@ if($me['level'] == 0) {
|
||||
echo "
|
||||
<option value={$city['city']}";
|
||||
if($city['city'] == $citylist) { echo " selected"; $valid = 1; }
|
||||
echo ">==================================================【".StringUtil::padString($city['name'], 4, '_')."】";
|
||||
echo ">【".StringUtil::padString($city['name'], 4, '_')."】";
|
||||
if($city['nation'] == 0) echo "공백지";
|
||||
elseif($me['nation'] == $city['nation']) echo "본국==";
|
||||
else echo "타국==";
|
||||
echo "============================================</option>";
|
||||
elseif($me['nation'] == $city['nation']) echo "본국";
|
||||
else echo "타국";
|
||||
echo "</option>";
|
||||
}
|
||||
|
||||
// 아국 장수가 있는 타국 도시들 선택
|
||||
@@ -114,11 +117,11 @@ if($me['level'] == 0) {
|
||||
echo "
|
||||
<option value={$city['city']}";
|
||||
if($city['city'] == $citylist) { echo " selected"; $valid = 1; }
|
||||
echo ">==================================================【".StringUtil::padString($city['name'], 4, '_')."】";
|
||||
echo ">【".StringUtil::padString($city['name'], 4, '_')."】";
|
||||
if($city['nation'] == 0) echo "공백지";
|
||||
elseif($me['nation'] == $city['nation']) echo "본국==";
|
||||
else echo "타국==";
|
||||
echo "============================================</option>";
|
||||
elseif($me['nation'] == $city['nation']) echo "본국";
|
||||
else echo "타국";
|
||||
echo "</option>";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -146,19 +149,18 @@ if($myNation['level'] > 0) {
|
||||
foreach ($db->query('SELECT city,name,nation FROM city WHERE city in %li', $spyCities) as $city) {
|
||||
echo "<option value={$city['city']}";
|
||||
if($city['city'] == $citylist) { echo " selected"; $valid = 1; }
|
||||
echo ">==================================================【".StringUtil::padString($city['name'], 4, '_')."】";
|
||||
echo ">【".StringUtil::padString($city['name'], 4, '_')."】";
|
||||
if($city['nation'] == 0) echo "공백지";
|
||||
elseif($me['nation'] == $city['nation']) echo "본국==";
|
||||
else echo "타국==";
|
||||
echo "============================================</option>";
|
||||
elseif($me['nation'] == $city['nation']) echo "본국";
|
||||
else echo "타국";
|
||||
echo "</option>";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
echo "
|
||||
</select>
|
||||
<input type=submit value='도 시 선 택'>
|
||||
</select></div>
|
||||
<p align=center>명령 화면에서 도시를 클릭하셔도 됩니다.</p>
|
||||
</form>
|
||||
</td>
|
||||
|
||||
+8
-9
@@ -13,13 +13,9 @@ $connect=$db->get();
|
||||
|
||||
increaseRefresh("내무부", 1);
|
||||
|
||||
$query = "select no,nation,level,con,turntime,belong from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$me = MYDB_fetch_array($result);
|
||||
$me = $db->queryFirstRow('SELECT no, nation, level, con, turntime, belong FROM general WHERE owner=%i', $userID);
|
||||
|
||||
$query = "select secretlimit from nation where nation='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
$nation = $db->queryFirstRow('SELECT secretlimit, msg, scoutmsg FROM nation WHERE nation = %i', $me['nation']);
|
||||
|
||||
$con = checkLimit($me['con']);
|
||||
if ($con >= 2) {
|
||||
@@ -50,11 +46,14 @@ if ($me['level'] >= 5) {
|
||||
<title><?=UniqueConst::$serverName?>: 내무부</title>
|
||||
<script>
|
||||
var editable = <?=($me['level']>=5?'true':'false')?>;
|
||||
var nationMsg = <?=Json::encode($nation['msg']??'')?>;
|
||||
var scoutmsg = <?=Json::encode($nation['scoutmsg']??'')?>;
|
||||
</script>
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/summernote/summernote-bs4.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/summernote/lang/summernote-ko-KR.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/summernote/plugin/image-sammo/summernote-image-flip.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/common_path.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('js/dipcenter.js')?>
|
||||
@@ -197,7 +196,7 @@ echo "
|
||||
</table>
|
||||
";
|
||||
|
||||
$query = "select nation,name,color,type,msg,gold,rice,bill,rate,scout,war,scoutmsg,secretlimit from nation where nation='{$me['nation']}'";
|
||||
$query = "select nation,name,color,type,gold,rice,bill,rate,scout,war,secretlimit from nation where nation='{$me['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect), "");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
@@ -242,7 +241,7 @@ if ($budgetricediff > 0) {
|
||||
<input type='submit' class='submit' name=btn value='국가방침 수정'><input type='button' class='cancel_edit' value='취소'>
|
||||
</div>
|
||||
</div>
|
||||
<textarea type=hidden class='input_form' style='display:none;' name=msg><?=$nation['msg']?></textarea>
|
||||
<input type='hidden' class='input_form' name='msg' data-global='nationMsg'>
|
||||
<div class='edit_form viewer'></div>
|
||||
</div></td></tr>
|
||||
<tr><td colspan='2'><div id='scoutMsgForm'>
|
||||
@@ -255,7 +254,7 @@ if ($budgetricediff > 0) {
|
||||
</div>
|
||||
</div>
|
||||
<div style='border-bottom:solid gray 0.5px;'>870px x 200px를 넘어서는 내용은 표시되지 않습니다.</div>
|
||||
<textarea type=hidden class='input_form' style='display:none;' name=scoutmsg><?=$nation['scoutmsg']?></textarea>
|
||||
<input type='hidden' class='input_form' name='scoutmsg' data-global='scoutmsg'>
|
||||
<div style="width:870px;margin-left:auto;">
|
||||
<div class='edit_form viewer'></div>
|
||||
</div>
|
||||
|
||||
+1
-1
@@ -177,7 +177,7 @@ for($i=0; $i < $nationcount; $i++) {
|
||||
";
|
||||
}
|
||||
?>
|
||||
<tr><td colspan=<?=$nationcount+1?> align=center>불가침 : <font color=limegreen>@</font>, 통합 : <font color=cyan>○</font>, 합병 : <font color=skyblue>◎</font>, 통상 : ㆍ, 선포 : <font color=magenta>▲</font>, 교전 : <font color=red>★</font></td></tr>
|
||||
<tr><td colspan=<?=$nationcount+1?> align=center>불가침 : <font color=limegreen>@</font>, <!--통합 : <font color=cyan>○</font>, -->합병 : <font color=skyblue>◎</font>, 통상 : ㆍ, 선포 : <font color=magenta>▲</font>, 교전 : <font color=red>★</font></td></tr>
|
||||
</table>
|
||||
|
||||
<?php if ($realConflict) : ?>
|
||||
|
||||
+8
-3
@@ -99,10 +99,15 @@ switch ($type) {
|
||||
|
||||
$generals = $db->query('SELECT npc,mode,no,level,troop,city,injury,leader,power,intel,experience,name,gold,rice,crewtype,crew,train,atmos,killturn,turntime,term,turn0,turn1,turn2,turn3,turn4 from general WHERE nation = %i %l', $me['nation'], $orderSQL);
|
||||
|
||||
$genCntEff = 0;
|
||||
foreach ($generals as &$general) {
|
||||
$general['cityText'] = CityConst::byID($general['city'])->name;
|
||||
$general['troopText'] = $troopName[$general['troop']]??'-';
|
||||
|
||||
if($general['npc'] != 5){
|
||||
$genCntEff += 1;
|
||||
}
|
||||
|
||||
if ($general['level'] == 12) {
|
||||
$lbonus = $nation['level'] * 2;
|
||||
} elseif ($general['level'] >= 5) {
|
||||
@@ -220,11 +225,11 @@ foreach($generals as $general){
|
||||
<tr>
|
||||
<td class='bg1'>전체 금</td><td><?=number_format($totalGold)?></td>
|
||||
<td class='bg1'>전체 쌀</td><td><?=number_format($totalRice)?></td>
|
||||
<td class='bg1'>평균 금</td><td><?=number_format($totalGold/$genCnt, 2)?></td>
|
||||
<td class='bg1'>평균 쌀</td><td><?=number_format($totalRice/$genCnt, 2)?></td>
|
||||
<td class='bg1'>평균 금</td><td><?=number_format($totalGold/$genCntEff, 2)?></td>
|
||||
<td class='bg1'>평균 쌀</td><td><?=number_format($totalRice/$genCntEff, 2)?></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='bg1'>전체 병력/장수</td><td><?=number_format($crewTotal)?>/<?=number_format($genCnt)?></td>
|
||||
<td class='bg1'>전체 병력/장수</td><td><?=number_format($crewTotal)?>/<?=number_format($genCntEff)?></td>
|
||||
<td class='bg1'>훈사 90 병력/장수</td><td><?=number_format($crew90)?>/<?=number_format($gen90)?></td>
|
||||
<td class='bg1'>훈사 80 병력/장수</td><td><?=number_format($crew80)?>/<?=number_format($gen80)?></td>
|
||||
<td class='bg1'>훈사 60 병력/장수</td><td><?=number_format($crew60)?>/<?=number_format($gen60)?></td>
|
||||
|
||||
@@ -150,12 +150,15 @@ if($meLevel >= 5 && $nation["l{$meLevel}set"] == 0) {
|
||||
echo "
|
||||
<select name=outlist size=1 style=color:white;background-color:black;>";
|
||||
|
||||
$query = "select no,name,level,leader,power,intel,killturn from general where nation='{$me['nation']}' and level!='12' and no!='{$me['no']}' order by npc,binary(name)";
|
||||
$query = "select no,npc,name,level,leader,power,intel,killturn from general where nation='{$me['nation']}' and level!='12' and no!='{$me['no']}' order by npc,binary(name)";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($result);
|
||||
|
||||
for($i=0; $i < $gencount; $i++) {
|
||||
$general = MYDB_fetch_array($result);
|
||||
if($general['npc'] == 5){
|
||||
continue;
|
||||
}
|
||||
echo "
|
||||
<option value={$general['no']}>{$general['name']} <small>({$general['leader']}/{$general['power']}/{$general['intel']}, {$general['killturn']}턴)</small></option>";
|
||||
}
|
||||
|
||||
@@ -9,8 +9,6 @@ if ($type <= 0 || $type > 12) {
|
||||
$type = 10;
|
||||
}
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
@@ -9,8 +9,6 @@ if($type <= 0 || $type > 15) {
|
||||
$type = 1;
|
||||
}
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
@@ -10,8 +10,6 @@ $tnmt = Util::getReq('tnmt', 'int', 1);
|
||||
//$detachNPC = Util::getReq('detachNPC', 'bool');
|
||||
$detachNPC = false;
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
if($mode < 0 || $mode > 2){
|
||||
$mode = 2;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@ $sel = Util::getReq('sel', 'int');
|
||||
$msg = '';
|
||||
$msg2 = '';
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
|
||||
@@ -10,8 +10,6 @@ $num = Util::getReq('num', 'int');
|
||||
$reply = Util::getReq('reply');
|
||||
// $title, $msg, $num
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
@@ -12,8 +12,6 @@ $rate = Util::getReq('rate', 'int');
|
||||
$bill = Util::getReq('bill', 'int');
|
||||
$secretlimit = Util::getReq('secretlimit', 'int');
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
@@ -11,8 +11,6 @@ $genlist = Util::getReq('genlist', 'int');
|
||||
$outlist = Util::getReq('outlist', 'int');
|
||||
$citylist = Util::getReq('citylist', 'int');
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
@@ -75,6 +73,12 @@ if($btn == "임명") {
|
||||
header('location:b_myBossInfo.php');
|
||||
exit();
|
||||
}
|
||||
|
||||
//NPC 부대장 추방 불가
|
||||
if($general['npc'] == 5){
|
||||
header('location:b_myBossInfo.php');
|
||||
exit();
|
||||
}
|
||||
}
|
||||
|
||||
//나와 대상 장수는 국가가 같아야 함
|
||||
@@ -146,11 +150,12 @@ if($btn == "추방") {
|
||||
'level'=>0,
|
||||
'nation'=>0,
|
||||
'belong'=>0,
|
||||
'betray'=>$db->sqleval('betray + 1'),
|
||||
'makelimit'=>12,
|
||||
'gold'=>$general['gold'],
|
||||
'rice'=>$general['rice'],
|
||||
'experience'=>$db->sqleval('experience * (1 - 0.1*betray)'),
|
||||
'dedication'=>$db->sqleval('dedication * (1 - 0.1*betray)'),
|
||||
'betray'=>$db->sqleval('betray + 1'),
|
||||
], 'no=%i', $general['no']);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,6 @@ $msg = Util::getReq('msg');
|
||||
$num = Util::getReq('num', 'int');
|
||||
$reply = Util::getReq('reply');
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
@@ -6,8 +6,6 @@ include "func.php";
|
||||
// $msg
|
||||
$msg = Util::getReq('msg');
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
@@ -14,8 +14,6 @@ $gen = Util::getReq('gen', 'int');
|
||||
$sel = Util::getReq('sel', 'int');
|
||||
$trig = Util::getReq('trig', 'int');
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
@@ -9,8 +9,6 @@ $name = Util::getReq('name');
|
||||
$gen = Util::getReq('gen', 'int');
|
||||
$troop = Util::getReq('troop', 'int');
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = $session::getUserID();
|
||||
|
||||
@@ -10,8 +10,6 @@ $comment = Util::getReq('comment');
|
||||
$title = Util::getReq('title');
|
||||
$str = Util::getReq('str');
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
//로그인 검사
|
||||
$session = Session::requireGameLogin()->setReadOnly();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
@@ -218,3 +218,19 @@ div.bar_out div.bar_in{
|
||||
margin:0;
|
||||
padding:0;
|
||||
}
|
||||
|
||||
.select2-selection--single.simple-select2-align-center .select2-selection__rendered {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.select2-dropdown.simple-select2-align-center li.select2-results__option{
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.select2-container--bootstrap4 .select2-selection--single.text-secondary .select2-selection__rendered{
|
||||
color:white;
|
||||
}
|
||||
|
||||
.select2-container--bootstrap4 .text-secondary .select2-results__option[aria-selected=false]{
|
||||
color:white;
|
||||
}
|
||||
@@ -11,6 +11,12 @@
|
||||
text-align:center;
|
||||
}
|
||||
|
||||
.map_title_tooltiptext .tooltip-inner{
|
||||
max-width:220px;
|
||||
width:220px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.map_title_text{
|
||||
margin:auto;
|
||||
text-align:center;
|
||||
|
||||
@@ -164,6 +164,7 @@
|
||||
.msg_content{
|
||||
margin-left:10px;
|
||||
margin-right:5px;
|
||||
overflow:hidden;
|
||||
}
|
||||
|
||||
.msg_prompt{
|
||||
|
||||
+13
-9
@@ -437,7 +437,7 @@ function commandTable() {
|
||||
$connect=$db->get();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$admin = $gameStor->getValues(['startyear', 'year', 'month', 'develcost', 'scenario']);
|
||||
$admin = $gameStor->getValues(['startyear', 'year', 'month', 'develcost', 'scenario', 'join_mode']);
|
||||
|
||||
$query = "select no,npc,troop,city,nation,level,crew,makelimit,special from general where owner='{$userID}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -493,7 +493,7 @@ function commandTable() {
|
||||
<select name=commandtype size=1 style='height:20px;width:260px;color:white;background-color:black;font-size:12px;'>";
|
||||
addCommand("휴 식", 0);
|
||||
addCommand("요 양", 50);
|
||||
commandGroup("========= 내 정 ==========");
|
||||
commandGroup("======= 내 정 ========");
|
||||
if($me['level'] >= 1 && ($citycount != 0 || $admin['year'] >= $admin['startyear']+3) && $city['supply'] != 0) {
|
||||
addCommand("농지개간(지력경험, 자금$develcostA)", 1, 1, $colorA);
|
||||
addCommand("상업투자(지력경험, 자금$develcostA)", 2, 1, $colorA);
|
||||
@@ -519,7 +519,7 @@ function commandTable() {
|
||||
addCommand("물자조달(랜덤경험)", 9, 0);
|
||||
}
|
||||
commandGroup("", 1);
|
||||
commandGroup("========= 군 사 ==========");
|
||||
commandGroup("======= 군 사 ========");
|
||||
if($me['level'] >= 1 && $citycount > 0) {
|
||||
addCommand("첩보(통솔경험, 자금$develcost3, 군량$develcost3)", 31);
|
||||
addCommand("징병(통솔경험)", 11);
|
||||
@@ -544,7 +544,7 @@ function commandTable() {
|
||||
}
|
||||
|
||||
commandGroup("", 1);
|
||||
commandGroup("========= 인 사 ==========");
|
||||
commandGroup("======= 인 사 ========");
|
||||
addCommand("이동(통솔경험, 자금$develcost, 사기↓)", 21);
|
||||
addCommand("강행(통솔경험, 자금$develcost5, 병력/사기/훈련↓)", 30);
|
||||
|
||||
@@ -554,7 +554,10 @@ function commandTable() {
|
||||
addCommand("인재탐색(랜덤경험, 자금$develcost)", 29, 0);
|
||||
}
|
||||
|
||||
if($me['level'] >= 1 && $city['supply'] != 0) {
|
||||
if($admin['join_mode'] == 'onlyRandom'){
|
||||
//do Nothing
|
||||
}
|
||||
else if($me['level'] >= 1 && $city['supply'] != 0) {
|
||||
addCommand("등용(자금{$develcost5}+장수가치)", 22);
|
||||
} else {
|
||||
addCommand("등용(자금{$develcost5}+장수가치)", 22, 0);
|
||||
@@ -576,7 +579,7 @@ function commandTable() {
|
||||
addCommand("임관", 25, 0);
|
||||
}
|
||||
commandGroup("", 1);
|
||||
commandGroup("========= 계 략 ==========");
|
||||
commandGroup("======= 계 략 ========");
|
||||
if($me['level'] >= 1 && (($nation['level'] > 0 && $city['nation'] == $me['nation'] && $city['supply'] != 0) || $nation['level'] == 0)) {
|
||||
addCommand("화계(지력경험, 자금$develcost5, 군량$develcost5)", 32);
|
||||
addCommand("탈취(무력경험, 자금$develcost5, 군량$develcost5)", 33);
|
||||
@@ -589,7 +592,7 @@ function commandTable() {
|
||||
addCommand("선동(통솔경험, 자금$develcost5, 군량$develcost5)", 35, 0);
|
||||
}
|
||||
commandGroup("", 1);
|
||||
commandGroup("========= 개 인 ==========");
|
||||
commandGroup("======= 개 인 ========");
|
||||
if($me['level'] >= 1) {
|
||||
addCommand("단련(자금$develcost, 군량$develcost)", 41);
|
||||
} else {
|
||||
@@ -709,7 +712,7 @@ function CoreCommandTable() {
|
||||
addCommand("몰수", 24, $valid);
|
||||
commandGroup("", 1);
|
||||
commandGroup("====== 외 교 ======");
|
||||
addCommand("통합 제의", 53, $valid);
|
||||
//addCommand("통합 제의", 53, $valid);
|
||||
|
||||
addCommand("항복 권고", 51, $valid);
|
||||
if($nation['level'] >= 2) {
|
||||
@@ -1252,8 +1255,9 @@ function increaseRefresh($type="", $cnt=1) {
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$gameStor->refresh = $gameStor->refresh+$cnt; //TODO: +로 증가하는 값은 별도로 분리
|
||||
$isunited = $gameStor->isunited;
|
||||
|
||||
if($generalID && $userGrade < 6) {
|
||||
if($isunited != 2 && $generalID && $userGrade < 6) {
|
||||
$db->update('general', [
|
||||
'lastrefresh'=>$date,
|
||||
'con'=>$db->sqleval('con + %i', $cnt),
|
||||
|
||||
+13
-6
@@ -105,12 +105,19 @@ function getTurn(array $general, $type, $font=1) {
|
||||
case 25: //임관
|
||||
$double = $command[1];
|
||||
|
||||
$nation = getNationStaticInfo($double);
|
||||
if($double == 98){
|
||||
$nationName = '건국된 임의 국가';
|
||||
}
|
||||
else if($double == 99){
|
||||
$nationName = '임의의 국가';
|
||||
}
|
||||
else{
|
||||
$nationName = getNationStaticInfo($double)['name']??'?!?!';
|
||||
}
|
||||
|
||||
|
||||
if(!$nation['name']) { $nation['name'] = '????'; }
|
||||
|
||||
$josaRo = JosaUtil::pick($nation['name'], '로');
|
||||
$str[$i] = "【{$nation['name']}】{$josaRo} 임관";
|
||||
$josaRo = JosaUtil::pick($nationName, '로');
|
||||
$str[$i] = "【{$nationName}】{$josaRo} 임관";
|
||||
break;
|
||||
case 26: //집합
|
||||
$str[$i] = "집합";
|
||||
@@ -511,7 +518,7 @@ function processCommand($no) {
|
||||
case 27: process_27($general); break; //발령
|
||||
case 51: process_51($general); break; //항복권고
|
||||
case 52: process_52($general); break; //원조
|
||||
case 53: process_53($general); break; //통합제의
|
||||
//case 53: process_53($general); break; //통합제의
|
||||
case 61: process_61($general); break; //불가침제의
|
||||
case 62: process_62($general); break; //선전 포고
|
||||
case 63: process_63($general); break; //종전 제의
|
||||
|
||||
@@ -200,7 +200,7 @@ function getSpecialInfo(?int $type):?string{
|
||||
42 => ['환술', '[전투] 계략 성공 확률 +10%p, 계략 성공 시 대미지 +30%'],
|
||||
43 => ['집중', '[전투] 계략 성공 시 대미지 +50%'],
|
||||
44 => ['신중', '[전투] 계략 성공 확률 100%'],
|
||||
45 => ['반계', '[전투] 상대의 계략을 30% 확률로 되돌림, 반목 성공시 대미지 추가(+60% → +100%)'],
|
||||
45 => ['반계', '[전투] 상대의 계략 성공 확률 -10%p, 상대의 계략을 40% 확률로 되돌림, 반목 성공시 대미지 추가(+60% → +100%)'],
|
||||
|
||||
50 => ['보병', '[군사] 보병 계통 징·모병비 -10%<br>[전투] 공격 시 아군 피해 -10%, 수비 시 아군 피해 -20%'],
|
||||
51 => ['궁병', '[군사] 궁병 계통 징·모병비 -10%<br>[전투] 회피 확률 +20%p'],
|
||||
@@ -209,7 +209,7 @@ function getSpecialInfo(?int $type):?string{
|
||||
|
||||
60 => ['돌격', '[전투] 상대 회피 불가, 공격 시 전투 페이즈 +1, 공격 시 대미지 +10%'],
|
||||
61 => ['무쌍', '[전투] 대미지 +10%, 공격 시 필살 확률 +10%p'],
|
||||
62 => ['견고', '[전투] 상대 필살 불가, 상대 계략 시도시 성공 확률 -10%p'],
|
||||
62 => ['견고', '[전투] 상대 필살, 격노, 위압, 저격 불가, 상대 계략 시도시 성공 확률 -10%p, 부상 없음, 아군 피해 -5%'],
|
||||
63 => ['위압', '[전투] 훈련/사기≥90, 병력≥1,000 일 때 첫 페이즈 위압 발동(적 공격 불가)'],
|
||||
|
||||
70 => ['저격', '[전투] 전투 개시 시 1/3 확률로 저격 발동'],
|
||||
|
||||
+68
-14
@@ -229,7 +229,7 @@ function SetNationFront($nationNo) {
|
||||
|
||||
if($adj){
|
||||
$db->update('city', [
|
||||
'front'=>1
|
||||
'front'=>($enemyCities?1:2),
|
||||
], 'nation=%i and city in %li', $nationNo, array_keys($adj));
|
||||
}
|
||||
}
|
||||
@@ -562,11 +562,14 @@ function postUpdateMonthly() {
|
||||
$genCount = $genNum[$dip['me']];
|
||||
// 25% 참여율일때 두당 10턴에 4000명 소모한다고 계산
|
||||
// 4000 / 10 * 0.25 = 100
|
||||
$term = Util::round($dip['dead'] / 100 / $genCount) + 1;
|
||||
if($dip['term'] > $term) { $term = $dip['term']; }
|
||||
if($term > 13) { $term = 13; }
|
||||
$query = "update diplomacy set term='{$term}' where (me='{$dip['me']}' and you='{$dip['you']}')";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$term = floor($dip['dead'] / 100 / $genCount);
|
||||
$dip['dead'] -= $term * 100 * $genCount;
|
||||
$term = Util::valueFit($dip['term'] + $term, 0, 13);
|
||||
|
||||
$db->update('diplomacy', [
|
||||
'term' => $term,
|
||||
'dead'=> $dip['dead'],
|
||||
], 'me = %i AND you = %i', $dip['me'], $dip['you']);
|
||||
}
|
||||
|
||||
//개전국 로그
|
||||
@@ -609,7 +612,7 @@ function postUpdateMonthly() {
|
||||
}
|
||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
//사상자 초기화
|
||||
$query = "update diplomacy set dead=0";
|
||||
$query = "update diplomacy set dead=0 WHERE state != 0";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
//외교 기한-1
|
||||
$query = "update diplomacy set term=term-1 where term!=0";
|
||||
@@ -771,6 +774,10 @@ function checkMerge() {
|
||||
'data'=>Json::encode($oldNation)
|
||||
]);
|
||||
|
||||
$db->update('general', [
|
||||
'nation'=>0,
|
||||
], 'nation=%i AND npc = 5', $me['nation']);
|
||||
|
||||
$query = "delete from nation where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 아국 모든 도시들 상대국 소속으로
|
||||
@@ -913,6 +920,10 @@ function checkSurrender() {
|
||||
'data'=>Json::encode($oldNation)
|
||||
]);
|
||||
|
||||
$db->update('general', [
|
||||
'nation'=>0,
|
||||
], 'nation=%i AND npc = 5', $me['nation']);
|
||||
|
||||
$query = "delete from nation where nation='{$me['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 군주가 있는 위치 구함
|
||||
@@ -960,9 +971,9 @@ function updateNationState() {
|
||||
$connect=$db->get();
|
||||
|
||||
$history = array();
|
||||
$admin = $gameStor->getValues(['year', 'month']);
|
||||
$admin = $gameStor->getValues(['year', 'month', 'fiction', 'startyear', 'show_img_level', 'turnterm']);
|
||||
|
||||
$query = "select nation,name,level from nation";
|
||||
$query = "select nation,name,level,gennum,tech from nation";
|
||||
$nationresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nationcount = MYDB_num_rows($nationresult);
|
||||
|
||||
@@ -973,10 +984,6 @@ function updateNationState() {
|
||||
$cityresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$citycount = MYDB_num_rows($cityresult);
|
||||
|
||||
$query = "select no from general where nation='{$nation['nation']}'";
|
||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($genresult);
|
||||
|
||||
if($citycount == 0) {
|
||||
$nationlevel = 0; // 방랑군
|
||||
} elseif($citycount == 1) {
|
||||
@@ -996,6 +1003,7 @@ function updateNationState() {
|
||||
}
|
||||
|
||||
if($nationlevel > $nation['level']) {
|
||||
$oldLevel = $nation['level'];
|
||||
$nation['level'] = $nationlevel;
|
||||
|
||||
switch($nationlevel) {
|
||||
@@ -1020,16 +1028,62 @@ function updateNationState() {
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$lastAssemblerID = $gameStor->assembler_id??0;
|
||||
for($levelGen = max(1, $oldLevel) + 1; $levelGen <= $nationlevel; $levelGen+=1){
|
||||
if(in_array($levelGen, [3, 5, 7])){
|
||||
$genStep = 2;
|
||||
}
|
||||
else{
|
||||
$genStep = 1;
|
||||
}
|
||||
|
||||
while($genStep > 0){
|
||||
$lastAssemblerID += 1;
|
||||
$npcObj = new Scenario\NPC(
|
||||
999, '부대장'.$lastAssemblerID, null, $nation['nation'], null,
|
||||
10, 10, 10, 1, $admin['year'] - 15, $admin['year'] + 15, '은둔', '척사'
|
||||
);
|
||||
$npcObj->npc = 5;
|
||||
$npcObj->build($admin);
|
||||
$npcID = $npcObj->generalID;
|
||||
|
||||
$db->insert('troop', [
|
||||
'name'=>$npcObj->realName,
|
||||
'nation'=>$nation['nation'],
|
||||
'no'=>$npcID
|
||||
]);
|
||||
$troopID = $db->insertId();
|
||||
|
||||
$command = EncodeCommand(0, 0, 0, 26); //집합
|
||||
$db->update('general', [
|
||||
'troop'=>$troopID,
|
||||
'turn0'=>$command,
|
||||
'turn1'=>$command,
|
||||
'turn2'=>$command,
|
||||
'turn3'=>$command,
|
||||
'turn4'=>$command,
|
||||
'turn5'=>$command,
|
||||
'killturn'=>80
|
||||
], 'no=%i', $npcID);
|
||||
$genStep -= 1;
|
||||
}
|
||||
}
|
||||
$gameStor->assembler_id = $lastAssemblerID;
|
||||
|
||||
//작위 상승
|
||||
$query = "update nation set level='{$nation['level']}' where nation='{$nation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
refreshNationStaticInfo();
|
||||
}
|
||||
|
||||
$gencount = $db->queryFirstField('SELECT count(*) FROM general WHERE nation=%i', $nation['nation']);
|
||||
|
||||
$gennum = $gencount;
|
||||
if($gencount < GameConst::$initialNationGenLimit) $gencount = GameConst::$initialNationGenLimit;
|
||||
//기술 및 변경횟수 업데이트
|
||||
$query = "update nation set tech=totaltech/'$gencount',gennum='$gennum' where nation='{$nation['nation']}'";
|
||||
$query = "update nation set totaltech=tech*'$gencount',gennum='$gennum' where nation='{$nation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
pushWorldHistory($history, $admin['year'], $admin['month']);
|
||||
|
||||
+54
-10
@@ -192,10 +192,34 @@ function processAI($no) {
|
||||
$isStart = 0;
|
||||
}
|
||||
|
||||
$query = "select no,turn0,npcid,name,nation,nations,city,level,npcmsg,personal,leader,intel,power,gold,rice,crew,train,atmos,npc,affinity,mode,injury,picture,imgsvr,killturn,makelimit,dex0,dex10,dex20,dex30,dex40 from general where no='$no'";
|
||||
$query = "select no,turn0,npcid,name,nation,nations,city,level,npcmsg,personal,leader,intel,power,gold,rice,crew,train,atmos,troop,npc,affinity,mode,injury,picture,imgsvr,killturn,makelimit,dex0,dex10,dex20,dex30,dex40 from general where no='$no'";
|
||||
$result = MYDB_query($query, $connect) or Error("processAI01 ".MYDB_error($connect),"");
|
||||
$general = MYDB_fetch_array($result);
|
||||
|
||||
if($general['npc'] == 5){
|
||||
if($general['nation'] == 0 && $general['killturn'] > 1){
|
||||
$command = EncodeCommand(0, 0, 0, 0); //휴식
|
||||
$db->update('general', [
|
||||
'turn0'=>$command,
|
||||
'killturn'=>1
|
||||
], 'no=%i', $general['no']);
|
||||
}
|
||||
else{
|
||||
$command = EncodeCommand(0, 0, 0, 26); //집합
|
||||
$db->update('general', [
|
||||
'turn0'=>$command,
|
||||
'turn1'=>$command,
|
||||
'turn2'=>$command,
|
||||
'turn3'=>$command,
|
||||
'turn4'=>$command,
|
||||
'turn5'=>$command,
|
||||
'killturn'=>rand(70,75),
|
||||
], 'no=%i', $general['no']);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
// 입력된 턴이 있으면 그것 실행
|
||||
if(DecodeCommand($general['turn0'])[0] != 0) {
|
||||
return;
|
||||
@@ -224,7 +248,7 @@ function processAI($no) {
|
||||
$coreCommand = MYDB_fetch_array($result);
|
||||
}
|
||||
|
||||
$cityCount = $db->queryFirstField('SELECT count(city) FROM city WHERE nation=%i AND supply=1 AND front=1', $general['nation']);
|
||||
$cityCount = $db->queryFirstField('SELECT count(city) FROM city WHERE nation=%i AND supply=1 AND front>0', $general['nation']);
|
||||
// 공격가능도시 있으면 1
|
||||
$attackable = $cityCount > 0;
|
||||
|
||||
@@ -467,7 +491,7 @@ function processAI($no) {
|
||||
|
||||
SetNationFront($nation['nation']);
|
||||
|
||||
$frontCount = $db->queryFirstField('SELECT count(city) FROM city WHERE nation=%i AND front=1', $general['nation']);
|
||||
$frontCount = $db->queryFirstField('SELECT count(city) FROM city WHERE nation=%i AND front>0', $general['nation']);
|
||||
if($frontCount > 0){
|
||||
break;
|
||||
}
|
||||
@@ -721,7 +745,7 @@ function processAI($no) {
|
||||
//전시일때
|
||||
if($general['gold'] + $general['rice'] < $resrc*2) { $command = EncodeCommand(0, 0, 0, 9); } //금쌀없으면 조달
|
||||
elseif($general['rice'] > $resrc && $city['rate'] < 95 && $city['front'] == 0) { $command = EncodeCommand(0, 0, 0, 4); } // 우선 선정
|
||||
elseif($general['rice'] > $resrc && $city['rate'] < 50 && $city['front'] == 1) { $command = EncodeCommand(0, 0, 0, 4); } // 우선 선정
|
||||
elseif($general['rice'] > $resrc && $city['rate'] < 50 && $city['front'] > 0) { $command = EncodeCommand(0, 0, 0, 4); } // 우선 선정
|
||||
elseif($general['gold'] < $resrc || ($general['gold'] < $resrc *2 && $general['rice'] > $resrc * 6)) { // 금없으면 쌀팜
|
||||
$amount = intdiv(($general['rice'] - $general['gold'])/2, 100); // 100단위
|
||||
if($amount > 0) { $command = EncodeCommand(0, 1, $amount, 49); }// 팜
|
||||
@@ -803,9 +827,9 @@ function processAI($no) {
|
||||
if(count($target) == 0) {
|
||||
//전방 도시 선택, 30% 확률로 태수 있는 전방으로 워프
|
||||
if(rand()%100 < 30) {
|
||||
$query = "select city from city where nation='{$general['nation']}' and supply='1' and front=1 order by gen1 desc,rand() limit 0,1";
|
||||
$query = "select city from city where nation='{$general['nation']}' and supply='1' and front>0 order by gen1 desc,rand() limit 0,1";
|
||||
} else {
|
||||
$query = "select city from city where nation='{$general['nation']}' and supply='1' and front=1 order by rand() limit 0,1";
|
||||
$query = "select city from city where nation='{$general['nation']}' and supply='1' and front>0 order by rand() limit 0,1";
|
||||
}
|
||||
$result = MYDB_query($query, $connect) or Error("processAI10 ".MYDB_error($connect),"");
|
||||
$cityCount = MYDB_num_rows($result);
|
||||
@@ -913,7 +937,7 @@ function NPCStaffWork($general, $nation, $dipState){
|
||||
|
||||
$commandList = [];
|
||||
|
||||
foreach($db->query('SELECT `no`, nation, city, npc, `gold`, `rice`, leader, `power`, intel, killturn, crew, train, atmos, `level` FROM general WHERE nation = %i', $general['nation']) as $nationGeneral) {
|
||||
foreach($db->query('SELECT `no`, nation, city, npc, `gold`, `rice`, leader, `power`, intel, killturn, crew, train, atmos, `level`, troop FROM general WHERE nation = %i', $general['nation']) as $nationGeneral) {
|
||||
$cityID = $nationGeneral['city'];
|
||||
$generalID = $nationGeneral['no'];
|
||||
|
||||
@@ -1082,7 +1106,15 @@ function NPCStaffWork($general, $nation, $dipState){
|
||||
}
|
||||
} else{ // 포상
|
||||
$compNpcWar = $npcWarGeneralsID?$nationGenerals[$npcWarGeneralsID[0]]:null;
|
||||
$compNpcCivil = $npcCivilGeneralsID?$nationGenerals[$npcCivilGeneralsID[0]]:null;
|
||||
$compNpcCivil = null;
|
||||
foreach($npcCivilGeneralsID??[] as $npcCivilID){
|
||||
$npcCivil = $nationGenerals[$npcCivilID];
|
||||
if($npcCivil['npc'] == 5){
|
||||
continue;
|
||||
}
|
||||
$compNpcCivil = $npcCivil;
|
||||
break;
|
||||
}
|
||||
|
||||
if($compNpcWar && $compNpcWar[$resName] < 21000){
|
||||
$amount = min(100, intdiv(($nation[$resName]-($resName=='rice'?(GameConst::$baserice):(GameConst::$basegold))), 5000)*10 + 10);
|
||||
@@ -1171,13 +1203,18 @@ function NPCStaffWork($general, $nation, $dipState){
|
||||
|
||||
if($maxDevCity['dev'] >= 95 && $targetCity['city'] != $maxDevCity['city'] && $targetCity['dev'] <= 70){
|
||||
$targetGeneral = $nationGenerals[Util::choiceRandom($maxDevCity['generals'])];
|
||||
$commandList[EncodeCommand(0, $targetGeneral['no'], $targetCity['city'], 27)] = 2;
|
||||
if($targetGeneral['troop'] != 0){
|
||||
$commandList[EncodeCommand(0, $targetGeneral['no'], $targetCity['city'], 27)] = 2;
|
||||
}
|
||||
}
|
||||
|
||||
if(count($targetCity['generals']) < count($maxCity['generals']) - 2){
|
||||
//세명 이상 차이나야 함
|
||||
$targetGeneral = $nationGenerals[Util::choiceRandom($maxCity['generals'])];
|
||||
if($targetGeneral['npc']>=2 || $maxCity['dev'] >= 95){
|
||||
if($targetGeneral['npc']==5){
|
||||
|
||||
}
|
||||
else if($targetGeneral['npc']>=2 || $maxCity['dev'] >= 95 && $targetGeneral['troop'] == 0){
|
||||
//유저장은 의도가 있을 것이므로 삽나지 않는 이상 발령 안함!
|
||||
$commandList[EncodeCommand(0, $targetGeneral['no'], $targetCity['city'], 27)] = 5;
|
||||
}
|
||||
@@ -1205,6 +1242,10 @@ function NPCStaffWork($general, $nation, $dipState){
|
||||
if($nationGeneral['train'] * $nationGeneral['atmos'] < 75 * 75){
|
||||
continue;
|
||||
}
|
||||
|
||||
if($nationGeneral['troop'] != 0){
|
||||
continue;
|
||||
}
|
||||
|
||||
$score = 5;
|
||||
if($nationGeneral['npc']<2){
|
||||
@@ -1255,6 +1296,9 @@ function NPCStaffWork($general, $nation, $dipState){
|
||||
if($generalCity['pop'] - 33000 > $nationGeneral['leader']){
|
||||
continue;
|
||||
}
|
||||
if($nationGeneral['troop'] != 0){
|
||||
continue;
|
||||
}
|
||||
|
||||
$score = 5;
|
||||
if($nationGeneral['npc']<2){
|
||||
|
||||
+38
-21
@@ -273,6 +273,10 @@ function process_1(&$general, $type) {
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
|
||||
if($city['front'] == 1 && $city['city'] != $nation['capital']){
|
||||
$score *= 0.5;
|
||||
}
|
||||
|
||||
$score += $city["$stype"];
|
||||
if($score > $city["{$stype}2"]) { $score = $city["{$stype}2"]; }
|
||||
// 내정 상승
|
||||
@@ -365,17 +369,26 @@ function process_3(&$general) {
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
|
||||
// 부드러운 기술 제한
|
||||
if(TechLimit($admin['startyear'], $admin['year'], $nation['tech'])) { $score = intdiv($score, 4); }
|
||||
|
||||
//장수수 구함
|
||||
$query = "select no from general where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($result);
|
||||
if($gencount < GameConst::$initialNationGenLimit) $gencount = GameConst::$initialNationGenLimit;
|
||||
$gencount = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i', $general['nation']);
|
||||
$gencnt_eff = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND npc != 5', $general['nation']);
|
||||
if ($gencnt_eff < GameConst::$initialNationGenLimit) {
|
||||
$gencount = GameConst::$initialNationGenLimit;
|
||||
$gencnt_eff = GameConst::$initialNationGenLimit;
|
||||
}
|
||||
|
||||
if($gencount != $gencnt_eff){
|
||||
$score *= $gencount / $gencnt_eff;
|
||||
}
|
||||
|
||||
// 부드러운 기술 제한
|
||||
if(TechLimit($admin['startyear'], $admin['year'], $nation['tech'])) { $score /= 4; }
|
||||
|
||||
// 내정 상승
|
||||
$query = "update nation set totaltech=totaltech+'$score',tech=totaltech/'$gencount' where nation='{$general['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$db->update('nation', [
|
||||
'totaltech'=>$db->sqleval('totaltech + %i', Util::round($score)),
|
||||
'tech'=>$db->sqleval('totaltech / %i', $gencount)
|
||||
], 'nation=%i', $general['nation']);
|
||||
// 자금 하락, 경험치 상승 // 공헌도, 명성 상승 = $score * 10
|
||||
$general['gold'] -= $admin['develcost'];
|
||||
|
||||
@@ -558,6 +571,16 @@ function process_5(&$general, $type) {
|
||||
$exp = $score * 0.7;
|
||||
$ded = $score * 1.0;
|
||||
|
||||
if($city['front'] == 1 && $city['city'] != $nation['capital']){
|
||||
if($stype == 'def'){
|
||||
$score *= 0.5;
|
||||
}
|
||||
else{
|
||||
$score *= 0.25;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 성격 보정
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
$ded = CharDedication($ded, $general['personal']);
|
||||
@@ -1896,8 +1919,7 @@ function process_42(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:호랑이에게 물려 다쳤습니다. <1>$date</>";
|
||||
// 경험치 하락 // 명성 상승
|
||||
$injury = rand() % 10 + 10;
|
||||
$general['power2']--;
|
||||
$query = "update general set resturn='SUCCESS',injury=injury+'$injury',power2='{$general['power2']}',experience=experience+'$exp' where no='{$general['no']}'";
|
||||
$query = "update general set resturn='SUCCESS',injury=injury+'$injury',experience=experience+'$exp' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
break;
|
||||
case 11:
|
||||
@@ -1911,8 +1933,7 @@ function process_42(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:곰에게 할퀴어 다쳤습니다. <1>$date</>";
|
||||
// 경험치 하락 // 명성 상승
|
||||
$injury = rand() % 10 + 10;
|
||||
$general['power2']--;
|
||||
$query = "update general set resturn='SUCCESS',injury=injury+'$injury',power2='{$general['power2']}',experience=experience+'$exp' where no='{$general['no']}'";
|
||||
$query = "update general set resturn='SUCCESS',injury=injury+'$injury',experience=experience+'$exp' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
break;
|
||||
case 13:
|
||||
@@ -1931,8 +1952,7 @@ function process_42(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:위기에 빠진 사람을 구해주다가 다쳤습니다. <1>$date</>";
|
||||
// 경험치 하락 // 명성 상승
|
||||
$injury = rand() % 10 + 10;
|
||||
$general['power2']--;
|
||||
$query = "update general set resturn='SUCCESS',injury=injury+'$injury',power2='{$general['power2']}',experience=experience+'$exp2' where no='{$general['no']}'";
|
||||
$query = "update general set resturn='SUCCESS',injury=injury+'$injury',experience=experience+'$exp2' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
break;
|
||||
case 16:
|
||||
@@ -1997,24 +2017,21 @@ function process_42(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:호랑이에게 물려 크게 다쳤습니다. <1>$date</>";
|
||||
// 경험치 하락 // 명성 상승
|
||||
$injury = rand() % 30 + 20;
|
||||
$general['power2']--;
|
||||
$query = "update general set resturn='SUCCESS',injury=injury+'$injury',power2='{$general['power2']}',experience=experience+'$exp' where no='{$general['no']}'";
|
||||
$query = "update general set resturn='SUCCESS',injury=injury+'$injury',experience=experience+'$exp' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
break;
|
||||
case 25:
|
||||
$log[] = "<C>●</>{$admin['month']}월:곰에게 할퀴어 크게 다쳤습니다. <1>$date</>";
|
||||
// 경험치 하락 // 명성 상승
|
||||
$injury = rand() % 30 + 20;
|
||||
$general['power2']--;
|
||||
$query = "update general set resturn='SUCCESS',injury=injury+'$injury',power2='{$general['power2']}',experience=experience+'$exp' where no='{$general['no']}'";
|
||||
$query = "update general set resturn='SUCCESS',injury=injury+'$injury',experience=experience+'$exp' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
break;
|
||||
case 26:
|
||||
$log[] = "<C>●</>{$admin['month']}월:위기에 빠진 사람을 구하다가 죽을뻔 했습니다. <1>$date</>";
|
||||
// 경험치 하락 // 명성 상승
|
||||
$injury = rand() % 50 + 30;
|
||||
$general['power2']--;
|
||||
$query = "update general set resturn='SUCCESS',injury=injury+'$injury',power2='{$general['power2']}',experience=experience+'$exp2' where no='{$general['no']}'";
|
||||
$query = "update general set resturn='SUCCESS',injury=injury+'$injury',experience=experience+'$exp2' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -11,7 +11,7 @@ function process_22(&$general) {
|
||||
$history = [];
|
||||
$date = substr($general['turntime'],11,5);
|
||||
|
||||
$admin = $gameStor->getValues(['startyear','year','month','develcost']);
|
||||
$admin = $gameStor->getValues(['startyear','year','month','develcost','join_mode']);
|
||||
|
||||
$query = "select nation,supply from city where city='{$general['city']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -26,7 +26,10 @@ function process_22(&$general) {
|
||||
|
||||
$cost = Util::round($admin['develcost'] + ($you['experience'] + $you['dedication'])/1000) * 10;
|
||||
|
||||
if(!$you) {
|
||||
if($admin['join_mode'] == 'onlyRandom'){
|
||||
$log[] = "<C>●</>{$admin['month']}월:랜덤 임관만 가능합니다. 등용 실패. <1>$date</>";
|
||||
}
|
||||
else if(!$you) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:없는 장수입니다. 등용 실패. <1>$date</>";
|
||||
} elseif($admin['year'] < $admin['startyear']+3) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:초반 제한중입니다. 등용 실패. <1>$date</>";
|
||||
@@ -70,7 +73,7 @@ function process_25(&$general) {
|
||||
$history = [];
|
||||
$date = substr($general['turntime'],11,5);
|
||||
|
||||
$admin = $gameStor->getValues(['startyear', 'year', 'month', 'scenario', 'fiction']);
|
||||
$admin = $gameStor->getValues(['startyear', 'year', 'month', 'scenario', 'fiction', 'join_mode', 'init_year', 'init_month']);
|
||||
|
||||
$query = "select nation from city where city='{$general['city']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -79,12 +82,16 @@ function process_25(&$general) {
|
||||
$command = DecodeCommand($general['turn0']);
|
||||
$where = $command[1];
|
||||
|
||||
if($admin['join_mode'] == 'onlyRandom' && $where < 98){
|
||||
$where = 99;
|
||||
}
|
||||
|
||||
$nation = null;
|
||||
|
||||
$joinedNations = Json::decode($general['nations']);
|
||||
|
||||
// 랜덤임관인 경우
|
||||
if($general['npc'] > 2 && $where >= 98 && ($admin['scenario'] < 100 || $admin['scenario'] >= 2000 || !$admin['fiction'])){
|
||||
if($general['npc'] >= 2 && $where >= 98 && !$admin['fiction'] && 1000 <= $admin['scenario'] && $admin['scenario'] < 2000){
|
||||
//'사실' 모드에서는 '성향'에 우선을 두되, 장수수, 랜덤에 비중을 둠
|
||||
$nations = $db->query(
|
||||
'SELECT nation.`name` as `name`,nation.nation as nation,scout,nation.`level` as `level`,gennum,`affinity` FROM nation join general on general.nation = nation.nation and general.level = 12 WHERE nation.nation not in %li and gennum < %i and scout = 0',
|
||||
@@ -126,10 +133,18 @@ function process_25(&$general) {
|
||||
|
||||
$allGen = array_sum($generals);
|
||||
|
||||
$genLimit = GameConst::$defaultMaxGeneral;
|
||||
if($admin['join_mode'] == 'onlyRandom' && TimeUtil::IsRangeMonth($admin['init_year'], $admin['init_month'], 1, $admin['year'], $admin['month'])){
|
||||
$genLimit = GameConst::$initialNationGenLimitForRandInit;
|
||||
}
|
||||
else if($admin['year'] < $admin['startyear'] + 3){
|
||||
$genLimit = GameConst::$initialNationGenLimit;
|
||||
}
|
||||
|
||||
$nations = $db->query(
|
||||
'SELECT nation.`name` as `name`,nation.nation as nation,scout,nation.`level` as `level`,gennum,`injury` FROM nation join general on general.nation = nation.nation and general.level = 12 WHERE nation.nation not in %li and gennum < %i and scout = 0',
|
||||
$joinedNations,
|
||||
($admin['year'] < $admin['startyear']+3)?GameConst::$initialNationGenLimit:GameConst::$defaultMaxGeneral
|
||||
$genLimit
|
||||
);
|
||||
shuffle($nations);
|
||||
|
||||
@@ -141,17 +156,20 @@ function process_25(&$general) {
|
||||
}
|
||||
|
||||
$score = 1;
|
||||
if($admin['startyear']+3 > $admin['year'] && $general['npc'] > 2){
|
||||
if($admin['startyear']+3 > $admin['year'] && $general['npc'] == 2){
|
||||
$score *= sqrt((100-max(30, $testNation['injury']))/100);
|
||||
}
|
||||
|
||||
$score *= sqrt($allGen/$generals[$testNation['nation']]);
|
||||
$score *= $allGen/$generals[$testNation['nation']];
|
||||
$randVals[$idx] = $score;
|
||||
}
|
||||
|
||||
if($randVals){
|
||||
$nation = $nations[Util::choiceRandomUsingWeight($randVals)];
|
||||
}
|
||||
else{
|
||||
$nation = null;
|
||||
}
|
||||
|
||||
} else {
|
||||
$nation = $db->queryFirstRow('SELECT `name`,nation,scout,`level` FROM nation WHERE nation=%i', $where);
|
||||
@@ -164,6 +182,15 @@ function process_25(&$general) {
|
||||
|
||||
if(!$nation) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:임관할 국가가 없습니다. 임관 실패. <1>$date</>";
|
||||
if($where >= 98 && $genLimit == GameConst::$initialNationGenLimitForRandInit){
|
||||
//랜덤 모드, 초기화시에는 랜덤 임관을 대신 한턴 더 넣어준다.
|
||||
$db->update('general', [
|
||||
'turn1'=>EncodeCommand(0, 0, $where, 25),
|
||||
], '`no` = %i', $general['no']);
|
||||
pushGenLog($general, $log);
|
||||
process_42($general);
|
||||
return;
|
||||
}
|
||||
} elseif($general['nation'] != 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:재야가 아닙니다. 임관 실패. <1>$date</>";
|
||||
} elseif($nation['nation'] == 0) {
|
||||
@@ -568,7 +595,7 @@ function process_45(&$general) {
|
||||
pushGeneralHistory($general, "<C>●</>{$admin['year']}년 {$admin['month']}월:<D><b>{$nation['name']}</b></>에서 하야");
|
||||
|
||||
// 국적 바꾸고 등급 재야로 // 명성/공헌 N*10% 감소
|
||||
$query = "update general set resturn='SUCCESS',belong=0,betray=betray+1,nation=0,level=0,experience=experience*(1-0.1*betray),dedication=dedication*(1-0.1*betray),makelimit='12',gold='{$general['gold']}',rice='{$general['rice']}' where no='{$general['no']}'";
|
||||
$query = "update general set resturn='SUCCESS',belong=0,nation=0,level=0,experience=experience*(1-0.1*betray),dedication=dedication*(1-0.1*betray),makelimit='12',gold='{$general['gold']}',rice='{$general['rice']}',betray=betray+1 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
|
||||
@@ -637,6 +664,8 @@ function process_46(&$general) {
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nationcount = MYDB_num_rows($result);
|
||||
|
||||
$currNationLevel = $db->queryFirstField('SELECT level FROM nation WHERE nation=%i', $general['nation']);
|
||||
|
||||
$command = DecodeCommand($general['turn0']);
|
||||
$color = $command[1];
|
||||
$type = $command[2]; // 1 ~ 13
|
||||
@@ -654,6 +683,8 @@ function process_46(&$general) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:건국 기간이 지났습니다. 건국 실패. <1>$date</>";
|
||||
} elseif($city['nation'] != 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:공백지가 아닙니다. 건국 실패. <1>$date</>";
|
||||
} elseif($currNationLevel != 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:방랑군이 아닙니다. 건국 실패. <1>$date</>";
|
||||
} elseif($nationcount > 0) {
|
||||
$log[] = "<C>●</>{$admin['month']}월:존재하는 국가명입니다. 건국 실패. <1>$date</>";
|
||||
} elseif($general['makelimit'] > 0) {
|
||||
|
||||
@@ -101,7 +101,7 @@ function processGoldIncome() {
|
||||
$query = "update nation set gold='{$nation['gold']}' where nation='{$nation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$query = "select no,name,nation,dedication,gold from general where nation='{$nation['nation']}'";
|
||||
$query = "select no,name,nation,dedication,gold from general where nation='{$nation['nation']}' AND npc != 5";
|
||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($genresult);
|
||||
|
||||
@@ -317,7 +317,7 @@ function getGoldOutcome($nation, $bill) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$query = "select dedication from general where nation='$nation'"; // 장수 목록
|
||||
$query = "select dedication from general where nation='$nation' AND npc != 5"; // 장수 목록
|
||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($genresult);
|
||||
|
||||
@@ -424,7 +424,7 @@ function processRiceIncome() {
|
||||
$query = "update nation set rice='{$nation['rice']}' where nation='{$nation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$query = "select no,name,nation,dedication,rice from general where nation='{$nation['nation']}'";
|
||||
$query = "select no,name,nation,dedication,rice from general where nation='{$nation['nation']}' AND npc != 5";
|
||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($genresult);
|
||||
|
||||
@@ -517,7 +517,7 @@ function getRiceOutcome($nation, $bill) {
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$query = "select dedication from general where nation='$nation'"; // 장수 목록
|
||||
$query = "select dedication from general where nation='$nation' AND npc != 5"; // 장수 목록
|
||||
$genresult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($genresult);
|
||||
|
||||
@@ -594,14 +594,14 @@ function disaster() {
|
||||
|
||||
for($i=0; $i < $citycount; $i++) {
|
||||
$city = MYDB_fetch_array($cityresult);
|
||||
//호황 발생 도시 선택 ( 기본 3% 이므로 약 3개 도시 )
|
||||
//재해 발생 도시 선택 ( 기본 6% 이므로 약 6개 도시 )
|
||||
if($isgood == 1) { $ratio = 3 + Util::round(1.0*$city['secu']/$city['secu2']*3); } // 3 ~ 6%
|
||||
else { $ratio = 6 - Util::round(1.0*$city['secu']/$city['secu2']*3); } // 3 ~ 6%
|
||||
//호황 발생 도시 선택 ( 기본 2% )
|
||||
//재해 발생 도시 선택 ( 기본 6% )
|
||||
if($isgood == 1) { $ratio = 2 + Util::round($city['secu']/$city['secu2']*5); } // 2 ~ 7%
|
||||
else { $ratio = 6 - Util::round($city['secu']/$city['secu2']*5); } // 1 ~ 6%
|
||||
|
||||
if(rand()%100+1 < $ratio) {
|
||||
$disastercity[] = $city['city'];
|
||||
$disasterratio[] = 1.0 * $city['secu'] / $city['secu2'];
|
||||
$disasterratio[] = Util::valueFit($city['secu'] / 0.8 / $city['secu2'], 0, 1);
|
||||
$disastername[] = $city['name'];
|
||||
}
|
||||
}
|
||||
|
||||
+3
-3
@@ -282,11 +282,11 @@ else if($session->userGrade == 4){
|
||||
<td width=498 class='bg1 center'><b>개인 기록</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td width=498 style="text-align:left;"><?=getGeneralPublicRecordRecent(15)?></td>
|
||||
<td width=498 style="text-align:left;"><?=getGenLogRecent($me['no'], 15)?></td>
|
||||
<td width=498 id="general_public_record" style="text-align:left;"><?=getGeneralPublicRecordRecent(15)?></td>
|
||||
<td width=498 id="general_log" style="text-align:left;"><?=getGenLogRecent($me['no'], 15)?></td>
|
||||
</tr>
|
||||
<tr><td width=998 colspan=2 class='bg1 center'><b>중원 정세</b></td></tr>
|
||||
<tr><td width=998 colspan=2 style="text-align:left;"><?=getWorldHistoryRecent(15)?></td></tr>
|
||||
<tr><td width=998 id="world_history" colspan=2 style="text-align:left;"><?=getWorldHistoryRecent(15)?></td></tr>
|
||||
</table>
|
||||
<div class="message_input_form bg0">
|
||||
<select id="mailbox_list" size="1">
|
||||
|
||||
@@ -152,6 +152,20 @@ if($session->userGrade < 5 && !$allowReset){
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="join_mode" class="col-sm-3 col-form-label">임관 모드</label>
|
||||
<div class="col-sm-9">
|
||||
<div id="join_mode" class="btn-group btn-group-toggle" data-toggle="buttons">
|
||||
<label class="btn btn-secondary active">
|
||||
<input type="radio" name="join_mode" value="full" checked>일반
|
||||
</label>
|
||||
<label class="btn btn-secondary">
|
||||
<input type="radio" name="join_mode" value="onlyRandom">랜덤 임관
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group row">
|
||||
<label for="show_img_level" class="col-sm-3 col-form-label">이미지 표기</label>
|
||||
<div class="col-sm-9">
|
||||
|
||||
+2
-1
@@ -87,7 +87,8 @@ $result = ResetHelper::buildScenario(
|
||||
$options['extend'],
|
||||
$options['npcmode'],
|
||||
$options['show_img_level'],
|
||||
$options['tournament_trig']
|
||||
$options['tournament_trig'],
|
||||
$options['join_mode']
|
||||
);
|
||||
|
||||
$result['affected']=1;
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
include 'lib.php';
|
||||
include 'func.php';
|
||||
|
||||
$session = Session::requireGameLogin([])->setReadOnly();
|
||||
$userID = $session::getUserID();
|
||||
$serverID = UniqueConst::$serverID;
|
||||
|
||||
$image = $_FILES['img'];
|
||||
switch ($image['error']) {
|
||||
case UPLOAD_ERR_OK:
|
||||
break;
|
||||
case UPLOAD_ERR_NO_FILE:
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'파일이 없습니다.'
|
||||
]);
|
||||
case UPLOAD_ERR_INI_SIZE:
|
||||
case UPLOAD_ERR_FORM_SIZE:
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'업로드된 파일이 지나치게 큽니다.'
|
||||
]);
|
||||
default:
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'업로드되지 않았습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
if(!is_uploaded_file($image['tmp_name'])) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'제대로 파일이 업로드되지 않았습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
if($image['size'] > 1048576) {
|
||||
//파일크기 검사
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'1MB 이하로 올려주세요!'
|
||||
]);
|
||||
}
|
||||
|
||||
$size = getImageSize($image['tmp_name']);
|
||||
|
||||
$imageType = $size[2];
|
||||
$availableImageType = array('.jpg'=>IMAGETYPE_JPEG, '.png'=>IMAGETYPE_PNG, '.gif'=>IMAGETYPE_GIF);
|
||||
$newExt = array_search($imageType, $availableImageType, true);
|
||||
|
||||
if(!$newExt) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'jpg, gif, png 파일이 아닙니다!'
|
||||
]);
|
||||
}
|
||||
|
||||
$db = RootDB::db();
|
||||
$imgStor = KVStorage::getStorage($db, 'img_storage');
|
||||
|
||||
$picName = hash_file('md5', $image['tmp_name']);
|
||||
$newPicName = "$picName$newExt";
|
||||
|
||||
$destDir = AppConf::getUserIconPathFS().'/uploaded_image';
|
||||
$dest = $destDir.'/'.$newPicName;
|
||||
|
||||
if(!file_exists($dest)){
|
||||
if (!file_exists($destDir)) {
|
||||
mkdir($destDir);
|
||||
}
|
||||
if(!is_dir($destDir)) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'버그! 업로드 경로 확인!'
|
||||
]);
|
||||
}
|
||||
if(!is_writable($destDir)){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'버그! 업로드 권한 확인!'
|
||||
]);
|
||||
}
|
||||
|
||||
$dest = $destDir.'/'.$newPicName;
|
||||
|
||||
if(!move_uploaded_file($image['tmp_name'], $dest)) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'업로드에 실패했습니다!'
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
$storedStatus = $imgStor->$newPicName??[];
|
||||
$imgKey = "$serverID:$userID";
|
||||
if(!key_exists($imgKey, $storedStatus)){
|
||||
$storedStatus[$imgKey] = TimeUtil::DatetimeNow();
|
||||
}
|
||||
|
||||
$imgStor->$newPicName = $storedStatus;
|
||||
|
||||
Json::die([
|
||||
'result'=>true,
|
||||
'reason'=>'성공',
|
||||
'path'=>AppConf::getUserIconPathWeb().'/uploaded_image/'.$newPicName
|
||||
]);
|
||||
+8
-4
@@ -41,6 +41,7 @@ $v->rule('required', [
|
||||
'scenario',
|
||||
'fiction',
|
||||
'extend',
|
||||
'join_mode',
|
||||
'npcmode',
|
||||
'show_img_level'
|
||||
])->rule('integer', [
|
||||
@@ -51,8 +52,8 @@ $v->rule('required', [
|
||||
'extend',
|
||||
'npcmode',
|
||||
'show_img_level',
|
||||
'tournament_trig'
|
||||
]);
|
||||
'tournament_trig',
|
||||
])->rule('in', 'join_mode', ['onlyRandom', 'full']);
|
||||
if(!$v->validate()){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
@@ -92,6 +93,7 @@ $extend = (int)$_POST['extend'];
|
||||
$npcmode = (int)$_POST['npcmode'];
|
||||
$show_img_level = (int)$_POST['show_img_level'];
|
||||
$tournament_trig = (int)$_POST['tournament_trig'];
|
||||
$join_mode = $_POST['join_mode'];
|
||||
|
||||
if($reserve_open){
|
||||
$reserve_open = new \DateTime($reserve_open);
|
||||
@@ -124,7 +126,8 @@ if($reserve_open){
|
||||
'npcmode'=>$npcmode,
|
||||
'show_img_level'=>$show_img_level,
|
||||
'tournament_trig'=>$tournament_trig,
|
||||
'gameConf'=>$scenarioObj->getGameConf()
|
||||
'gameConf'=>$scenarioObj->getGameConf(),
|
||||
'join_mode'=>$join_mode,
|
||||
]),
|
||||
'date'=>$reserve_open->format('Y-m-d H:i:s')
|
||||
]);
|
||||
@@ -143,5 +146,6 @@ Json::die(ResetHelper::buildScenario(
|
||||
$extend,
|
||||
$npcmode,
|
||||
$show_img_level,
|
||||
$tournament_trig
|
||||
$tournament_trig,
|
||||
$join_mode
|
||||
));
|
||||
@@ -32,6 +32,20 @@ if(file_exists(__dir__.'/.htaccess')){
|
||||
|
||||
$options = Json::decode($reserved['options']);
|
||||
|
||||
$otherTextInfo = [];
|
||||
|
||||
if($options['join_mode'] == 'onlyRandom'){
|
||||
$otherTextInfo[] = '랜덤 임관 전용';
|
||||
}
|
||||
|
||||
if(!$otherTextInfo){
|
||||
$otherTextInfo = '표준';
|
||||
}
|
||||
else{
|
||||
$otherTextInfo = join(', ', $otherTextInfo);
|
||||
}
|
||||
|
||||
|
||||
Json::die([
|
||||
'reserved'=>[
|
||||
'scenarioName'=>$options['scenarioName'],
|
||||
@@ -39,7 +53,8 @@ if(file_exists(__dir__.'/.htaccess')){
|
||||
'fictionMode'=>($options['fiction']?'가상':'사실'),
|
||||
'npcMode'=>($options['npcmode']?'가능':'불가'),
|
||||
'openDatetime'=>$reserved['date'],
|
||||
'gameConf'=>$options['gameConf']
|
||||
'gameConf'=>$options['gameConf'],
|
||||
'otherTextInfo'=>$otherTextInfo
|
||||
],
|
||||
'game'=>null,
|
||||
'me'=>null
|
||||
|
||||
+19
-7
@@ -56,8 +56,6 @@ $intel = Util::getReq('intel', 'int', 50);
|
||||
|
||||
$join = Util::getReq('join'); //쓸모 없음
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
$rootDB = RootDB::db();
|
||||
//회원 테이블에서 정보확인
|
||||
$member = $rootDB->queryFirstRow('SELECT `no`, id, picture, grade, `name`, imgsvr FROM member WHERE no=%i', $userID);
|
||||
@@ -155,26 +153,40 @@ $leader = $leader + $pleader;
|
||||
$power = $power + $ppower;
|
||||
$intel = $intel + $pintel;
|
||||
|
||||
$admin = $gameStor->getValues(['scenario', 'turnterm', 'show_img_level', 'startyear', 'year']);
|
||||
$relYear = Util::valueFit($admin['year'] - $admin['startyear'], 0);
|
||||
|
||||
$age = 20 + ($pleader + $ppower + $pintel) * 2 - (mt_rand(0, 1));
|
||||
// 아직 남았고 천재등록상태이면 특기 부여
|
||||
if ($genius) {
|
||||
$specage2 = $age;
|
||||
$special2 = getSpecial2($leader, $power, $intel);
|
||||
} else {
|
||||
$specage2 = Util::round((80 - $age)/3) + $age;
|
||||
$specage2 = Util::valueFit(Util::round((80 - $age)/4 - $relYear / 2), 3) + $age;
|
||||
$special2 = 0;
|
||||
}
|
||||
//내특
|
||||
$specage = Util::round((80 - $age)/12) + $age;
|
||||
$specage = Util::valueFit(Util::round((80 - $age)/12 - $relYear / 2), 3) + $age;
|
||||
$special = 0;
|
||||
|
||||
$admin = $gameStor->getValues(['scenario', 'turnterm', 'show_img_level']);
|
||||
|
||||
if ($admin['scenario'] >= 1000) {
|
||||
$specage2 = $age + 3;
|
||||
$specage = $age + 3;
|
||||
}
|
||||
|
||||
if($relYear < 3){
|
||||
$experience = 0;
|
||||
}
|
||||
else{
|
||||
$expGenCount = $db->queryFirstField('SELECT count(*) FROM general WHERE nation != 0 AND npc < 5');
|
||||
$targetGenOrder = Util::round($expGenCount * 0.2);
|
||||
$experience = $db->queryFirstField(
|
||||
'SELECT experience FROM general WHERE nation != 0 AND npc < 5 ORDER BY experience ASC LIMIT %i, 1',
|
||||
$targetGenOrder - 1
|
||||
);
|
||||
$experience *= 0.8;
|
||||
}
|
||||
|
||||
$turntime = getRandTurn($admin['turnterm']);
|
||||
|
||||
$lastconnect = date('Y-m-d H:i:s');
|
||||
@@ -211,7 +223,7 @@ $db->insert('general', [
|
||||
'leader' => $leader,
|
||||
'power' => $power,
|
||||
'intel' => $intel,
|
||||
'experience' => 0,
|
||||
'experience' => $experience,
|
||||
'dedication' => 0,
|
||||
'gold' => 1000,
|
||||
'rice' => 1000,
|
||||
|
||||
+64
-6
@@ -143,18 +143,76 @@ function getIconPath(imgsvr, picture){
|
||||
}
|
||||
}
|
||||
|
||||
jQuery(function($){
|
||||
$('.obj_tooltip').tooltip({
|
||||
title:function(){
|
||||
return $.trim($(this).find('.tooltiptext').html());
|
||||
},
|
||||
html:true
|
||||
function activeFlip($obj){
|
||||
var $result;
|
||||
if($obj === undefined){
|
||||
$result = $('img[data-flip]');
|
||||
}
|
||||
else{
|
||||
$result = $obj.find('img[data-flip]');
|
||||
}
|
||||
|
||||
$result.each(function(){
|
||||
activeFlipItem($(this));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function activeFlipItem($img){
|
||||
var imageList = [];
|
||||
imageList.push($img.attr('src'));
|
||||
$.each($img.data('flip').split(','), function(idx, value){
|
||||
var value = $.trim(value);
|
||||
if(!value){
|
||||
return true;
|
||||
}
|
||||
imageList.push(value);
|
||||
});
|
||||
if(imageList.length <= 1){
|
||||
return;
|
||||
}
|
||||
$img.data('computed_flip_array', imageList);
|
||||
$img.data('computed_flip_idx', 0);
|
||||
|
||||
$img.click(function(){
|
||||
var arr = $img.data('computed_flip_array');
|
||||
var idx = $img.data('computed_flip_idx');
|
||||
idx = (idx + 1)%(arr.length);
|
||||
$img.attr('src', arr[idx]);
|
||||
$img.data('computed_flip_idx', idx);
|
||||
});
|
||||
$img.css('cursor','pointer');
|
||||
}
|
||||
|
||||
jQuery(function($){
|
||||
$('.obj_tooltip').each(function(){
|
||||
var $objTooltip = $(this);
|
||||
var tooltipClassText = $objTooltip.data('tooltip-class');
|
||||
if(!tooltipClassText){
|
||||
tooltipClassText = '';
|
||||
}
|
||||
console.log($objTooltip.data('tooltip-class'));
|
||||
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
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
activeFlip();
|
||||
|
||||
var customCSS = localStorage.getItem('sam_customCSS');
|
||||
if(customCSS){
|
||||
var $style = $('<style type="text/css"></style>');
|
||||
$style.text(customCSS);
|
||||
$style.appendTo($('head'));
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
$(function() {
|
||||
$('#citySelector').select2({
|
||||
theme: 'bootstrap4',
|
||||
placeholder: "도시를 선택해 주세요.",
|
||||
allowClear: false,
|
||||
language: "ko",
|
||||
containerCss: {
|
||||
display: "inline-block !important",
|
||||
color: 'white !important'
|
||||
},
|
||||
containerCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||
dropdownCssClass: 'simple-select2-align-center bg-secondary text-secondary',
|
||||
});
|
||||
$('#citySelector').on('select2:select', function(e){
|
||||
var data = e.params.data;
|
||||
if(!data.selected || data.disabled){
|
||||
return;
|
||||
}
|
||||
var $obj = $('#citySelector').parents('form');
|
||||
$obj.submit();
|
||||
console.log($obj);
|
||||
});
|
||||
});
|
||||
+64
-4
@@ -7,6 +7,7 @@ jQuery(function($){
|
||||
function guiEditorInit($obj, editable){
|
||||
var $submitBtn = $obj.find('.submit');
|
||||
var $noticeInput = $obj.find('.input_form');
|
||||
var globalVariableName = $noticeInput.data('global');
|
||||
var $editForm = $obj.find('.edit_form');
|
||||
var $cancelEdit = $obj.find('.cancel_edit');
|
||||
|
||||
@@ -15,6 +16,12 @@ jQuery(function($){
|
||||
function enableEditor(){
|
||||
editMode = true;
|
||||
$cancelEdit.show();
|
||||
|
||||
var inputText = window[globalVariableName];
|
||||
if(!inputText || inputText == '<p></p>'){
|
||||
inputText = '<p><br></p>';
|
||||
}
|
||||
|
||||
$editForm.removeClass('viewer').summernote({
|
||||
minHeight:200,
|
||||
maxHeight:null,
|
||||
@@ -31,21 +38,72 @@ jQuery(function($){
|
||||
['para', ['ul', 'ol', 'paragraph']],
|
||||
['height', ['height', 'codeview']]
|
||||
],
|
||||
popover: {
|
||||
image: [
|
||||
['imagesize', ['imageSize100', 'imageSize50', 'imageSize25']],
|
||||
['float', ['floatLeft', 'floatRight', 'floatNone']],
|
||||
['remove', ['removeMedia']],
|
||||
['custom', ['imageFlip']],
|
||||
],
|
||||
},
|
||||
fontNames: ['맑은 고딕', 'Nanum Gothic', 'Nanum Myeongjo', 'Nanum Pen Script', '굴림', '굴림체', '바탕', '바탕체', '궁서', '궁서체'],
|
||||
fontSizes: ['8', '9', '10', '11', '12', '14', '16', '20', '24', '28', '32', '36', '40', '46', '52', '60'],
|
||||
callbacks: {
|
||||
onImageUpload: function(files) {
|
||||
$editForm.summernote('saveRange');
|
||||
if(files.length == 0){
|
||||
alert('업로드된 파일이 없습니다.');
|
||||
return false;
|
||||
}
|
||||
|
||||
}).summernote('code', $noticeInput.val());
|
||||
var formData = new FormData();
|
||||
formData.append('img', files[0]);
|
||||
$editForm.summernote("pasteHtml", '');
|
||||
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:'j_image_upload.php',
|
||||
dataType:'json',
|
||||
contentType: false,
|
||||
processData:false,
|
||||
data:formData
|
||||
}).then(function(result){
|
||||
if(!result.result){
|
||||
alert(result.reason);
|
||||
return;
|
||||
}
|
||||
|
||||
console.log($editForm.summernote('code'));
|
||||
if($editForm.summernote('isEmpty')){
|
||||
|
||||
console.log('haha?');
|
||||
var $img = $('<img>');
|
||||
$img.attr('src', result.path);
|
||||
$editForm.summernote('code', $img);
|
||||
return;
|
||||
}
|
||||
|
||||
$editForm.summernote("insertImage", result.path, result.path);
|
||||
|
||||
},function(){
|
||||
alert('알 수 없는 이유로 아이콘 업로드를 실패했습니다.');
|
||||
});
|
||||
}
|
||||
}
|
||||
}).summernote('code', inputText);
|
||||
}
|
||||
|
||||
function disableEditor(){
|
||||
editMode = false;
|
||||
$editForm.summernote('destroy');
|
||||
$cancelEdit.hide();
|
||||
$editForm.html($noticeInput.val()).addClass('viewer');
|
||||
$editForm.html(window[globalVariableName]).addClass('viewer');
|
||||
activeFlip($editForm);
|
||||
}
|
||||
|
||||
$cancelEdit.hide();
|
||||
$editForm.html($noticeInput.val());
|
||||
$editForm.html(window[globalVariableName]);
|
||||
activeFlip($editForm);
|
||||
if(editable){
|
||||
$submitBtn.prop('disabled', false);
|
||||
}
|
||||
@@ -59,7 +117,9 @@ jQuery(function($){
|
||||
enableEditor();
|
||||
return false;
|
||||
}
|
||||
$noticeInput.val($editForm.summernote('code'));
|
||||
var text = $editForm.summernote('code');
|
||||
window[globalVariableName] = text;
|
||||
$noticeInput.val(text);
|
||||
});
|
||||
|
||||
$cancelEdit.click(function(e){
|
||||
|
||||
+4
-2
@@ -114,7 +114,8 @@ function formSetup(){
|
||||
extend:"required",
|
||||
npcmode:"required",
|
||||
show_img_level:"required",
|
||||
tournament_trig:"required"
|
||||
tournament_trig:"required",
|
||||
join_mode:'required',
|
||||
},
|
||||
errorElement: "div",
|
||||
errorPlacement: function ( error, element ) {
|
||||
@@ -153,7 +154,8 @@ function formSetup(){
|
||||
npcmode:$('#npcmode input:radio:checked').val(),
|
||||
show_img_level:$('#show_img_level input:radio:checked').val(),
|
||||
tournament_trig:$('#tournament_trig input:radio:checked').val(),
|
||||
reserve_open:$('#reserve_open').val()
|
||||
reserve_open:$('#reserve_open').val(),
|
||||
join_mode:$('#join_mode input:radio:checked').val(),
|
||||
}
|
||||
}).then(function(result){
|
||||
var deferred = $.Deferred();
|
||||
|
||||
@@ -173,4 +173,16 @@ jQuery(function($){
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
var randomGenType = Math.floor(Math.random()*7);
|
||||
if(randomGenType < 3){
|
||||
abilityLeadpow();
|
||||
}
|
||||
else if(randomGenType < 6){
|
||||
abilityLeadint();
|
||||
}
|
||||
else{
|
||||
abilityPowint();
|
||||
}
|
||||
|
||||
});
|
||||
@@ -90,6 +90,32 @@ function reloadWorldMap(option){
|
||||
$map_title.css('color', 'yellow');
|
||||
}
|
||||
|
||||
$map_title_tooltip = $('.map_title .tooltiptext');
|
||||
$map_title_tooltip.empty();
|
||||
|
||||
var tooltipTexts = [];
|
||||
if(year < startYear + 3){
|
||||
var startYearText = [];
|
||||
var remainYear = startYear + 3 - year;
|
||||
var remainMonth = 12 - month + 1;
|
||||
if(remainMonth > 0){
|
||||
remainYear -= 1;
|
||||
}
|
||||
if(remainYear){
|
||||
startYearText.push('{0}년'.format(remainYear));
|
||||
}
|
||||
if(remainMonth){
|
||||
startYearText.push('{0}개월'.format(remainMonth));
|
||||
}
|
||||
|
||||
tooltipTexts.push('초반제한 기간 : {0} ({1}년)'.format(startYearText.join(' '), startYear + 3));
|
||||
}
|
||||
|
||||
var currentTechLimit = Math.floor(Math.max(0, year - startYear) / 5) + 1;
|
||||
var nextTechLimitYear = currentTechLimit * 5 + startYear;
|
||||
|
||||
tooltipTexts.push('기술등급 제한 : {0}등급 ({1}년 해제)'.format(currentTechLimit, nextTechLimitYear, currentTechLimit+1));
|
||||
$map_title_tooltip.html(tooltipTexts.join('<br>'));
|
||||
|
||||
$world_map.removeClass('map_string map_summer map_fall map_winter');
|
||||
if(month <= 3){
|
||||
|
||||
@@ -257,6 +257,16 @@ function refreshMailboxList(obj){
|
||||
$optgroup.css('color', 'white');
|
||||
}
|
||||
|
||||
nation.general.sort(function(lhs, rhs){
|
||||
if(lhs[1] < rhs[1]){
|
||||
return -1;
|
||||
}
|
||||
if(lhs[1] > rhs[1]){
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
});
|
||||
|
||||
$.each(nation.general, function(){
|
||||
var generalID = this[0];
|
||||
var generalName = this[1];
|
||||
|
||||
@@ -1,1877 +0,0 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
function processWar($general, $city) {
|
||||
'@phan-var array<string,int|string|null> $general';
|
||||
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
$connect=$db->get();
|
||||
|
||||
$templates = new \League\Plates\Engine(__dir__.'/templates');
|
||||
|
||||
$date = substr($general['turntime'],11,5);
|
||||
|
||||
$admin = $gameStor->getAll();
|
||||
|
||||
$year = $admin['year'];
|
||||
$month = $admin['month'];
|
||||
|
||||
$log = [];
|
||||
$batlog = [];
|
||||
$batres = [];
|
||||
|
||||
$opplog = [];
|
||||
$oppbatlog = [];
|
||||
$oppbatres = [];
|
||||
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
|
||||
$deadAmount = [
|
||||
'att'=>0,
|
||||
'def'=>0
|
||||
];
|
||||
|
||||
$generalCrewType = GameUnitConst::byID($general['crewtype']);
|
||||
$warphase = $generalCrewType->speed; //병종간 페이즈 수 얻기
|
||||
|
||||
// 특기보정 : 돌격
|
||||
if($general['special2'] == 60) { $warphase += 1; }
|
||||
|
||||
$genAtmos = 0;
|
||||
if($general['item'] == 3) {
|
||||
//탁주 사용
|
||||
$genAtmos += 3;
|
||||
$query = "update general set item=0 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$josaUl = JosaUtil::pick(getItemName($general['item']), '을');
|
||||
$log[] = "<C>●</><C>".getItemName($general['item'])."</>{$josaUl} 사용!";
|
||||
$general['item'] = 0;
|
||||
} elseif($general['item'] >= 14 && $general['item'] <= 16) {
|
||||
//의적주, 두강주, 보령압주 사용
|
||||
$genAtmos += 5;
|
||||
} elseif($general['item'] >= 19 && $general['item'] <= 20) {
|
||||
//춘화첩, 초선화 사용
|
||||
$genAtmos += 7;
|
||||
}
|
||||
$genTrain = 0;
|
||||
if($general['item'] == 4) {
|
||||
//청주 사용
|
||||
$genTrain += 3;
|
||||
$query = "update general set item=0 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$josaUl = JosaUtil::pick($general['item'], '을');
|
||||
$log[] = "<C>●</><C>".getItemName($general['item'])."</>{$josaUl} 사용!";
|
||||
$general['item'] = 0;
|
||||
} elseif($general['item'] >= 12 && $general['item'] <= 13) {
|
||||
//과실주, 이강주 사용
|
||||
$genTrain += 5;
|
||||
} elseif($general['item'] >= 17 && $general['item'] <= 18) {
|
||||
//철벽서, 단결도 사용
|
||||
$genTrain += 7;
|
||||
}
|
||||
|
||||
// 우선 스케일링
|
||||
$city['def'] *= 10;
|
||||
$city['wall'] *= 10;
|
||||
|
||||
$query = "select level from city where city='{$general['city']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$originCity = MYDB_fetch_array($result);
|
||||
|
||||
$query = "select nation,level,name,capital,tech,type from nation where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$nation = MYDB_fetch_array($result);
|
||||
|
||||
setLeadershipBonus($general, $nation['level']);
|
||||
|
||||
$query = "select nation,level,name,rice,capital,tech,type from nation where nation='{$city['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$destnation = MYDB_fetch_array($result) ?: [
|
||||
'nation'=>0,
|
||||
'capital'=>0,
|
||||
'level'=>0,
|
||||
'rice'=>2000,
|
||||
'type'=>0,
|
||||
'tech'=>0
|
||||
];
|
||||
|
||||
//장수수 구함
|
||||
$query = "select no from general where nation='{$general['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($result);
|
||||
if($gencount < GameConst::$initialNationGenLimit) $gencount = GameConst::$initialNationGenLimit;
|
||||
//장수수 구함
|
||||
$query = "select no from general where nation='{$destnation['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$destgencount = MYDB_num_rows($result);
|
||||
if($destgencount < GameConst::$initialNationGenLimit) $destgencount = GameConst::$initialNationGenLimit;
|
||||
|
||||
$genAtmosBonus = 0; $genTrainBonus = 0;
|
||||
$oppAtmosBonus = 0; $oppTrainBonus = 0;
|
||||
//공격자 수도보정
|
||||
if($nation['capital'] == $general['city']) { $genAtmosBonus += 5; }
|
||||
//방어자 수도보정
|
||||
//if($destnation['capital'] == $city['city']) { $oppTrainBonus += 5; }
|
||||
//관,진,수진 보정
|
||||
if($city['level'] == 1) { $oppTrainBonus += 5; } // 방어도시가 수진이면 방어자 방어보정
|
||||
if($originCity['level'] == 2) { $genAtmosBonus += 5; } // 출병도시가 진이면 공격자 공격보정
|
||||
if($city['level'] == 3) { $oppTrainBonus += 5; } // 방어도시가 관이면 방어자 방어보정
|
||||
|
||||
$josaRo = JosaUtil::pick($city['name'], '로');
|
||||
$josaYi = JosaUtil::pick($general['name'], '이');
|
||||
$alllog[] = "<C>●</>{$month}월:<D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>{$josaYi} <G><b>{$city['name']}</b></>{$josaRo} 진격합니다.";
|
||||
$log[] = "<C>●</>{$month}월:<G><b>{$city['name']}</b></>{$josaRo} <M>진격</>합니다. <1>$date</>";
|
||||
|
||||
// 목표 도시내에 목표 국가 소속 장수 중, 병사가 있는 능력치합+병사수 순으로 훈,사 60, 80 이상
|
||||
$query = "select no,name,turntime,personal,special2,crew,crewtype,atmos,train,intel,intel2,book,power,power2,weap,injury,leader,leader2,horse,item,explevel,level,rice,leader+power+intel+weap+horse+book+crew/100 as sum,dex0,dex10,dex20,dex30,dex40 from general where city='{$city['city']}' and nation='{$city['nation']}' and nation!=0 and crew>'0' and rice>round(crew/100) and ((train>=60 and atmos>=60 and mode=1) or (train>=80 and atmos>=80 and mode=2)) order by sum desc";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$opposecount = MYDB_num_rows($result);
|
||||
|
||||
$exp = 0; //병사 소진 시킨 만큼
|
||||
$opexp = 0;
|
||||
$exp2 = 1; //능력경험치
|
||||
$phase = 0;
|
||||
while($phase < $warphase) {
|
||||
// 장수가 없어서 도시 공격하려했으나 병량없을시
|
||||
if($opposecount == 0 && $destnation['nation'] > 0 && $destnation['rice'] <= 0 && $city['supply'] == 1) {
|
||||
$general['train'] += 1; //훈련 상승
|
||||
if($general['train'] > GameConst::$maxTrainByWar) { $general['train'] = GameConst::$maxTrainByWar; }
|
||||
$query = "update general set recwar='{$general['turntime']}',train='{$general['train']}',warnum=warnum+1 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$alllog[] = "<C>●</>{$month}월:병량 부족으로 <G><b>{$city['name']}</b></>의 수비병들이 <R>패퇴</>합니다.";
|
||||
$josaUl = JosaUtil::pick($city['name'], '을');
|
||||
$josaYi = JosaUtil::pick($general['name'], '이');
|
||||
$history[] = "<C>●</>{$year}년 {$month}월:<M><b>【패퇴】</b></><D><b>{$destnation['name']}</b></>{$josaYi} 병량 부족으로 <G><b>{$city['name']}</b></>{$josaUl} 뺏기고 말았습니다.";
|
||||
pushGenLog($general, $log);
|
||||
pushGeneralPublicRecord($alllog, $year, $month);
|
||||
pushWorldHistory($history);
|
||||
$log = [];
|
||||
$alllog = [];
|
||||
$history= [];
|
||||
|
||||
//패퇴시 병량보충
|
||||
$destnation['rice'] += 500;
|
||||
$query = "update nation set rice='{$destnation['rice']}' where nation='{$destnation['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
//내정 피폐
|
||||
$query = "update city set agri=agri*0.5,comm=comm*0.5,secu=secu*0.5 where city='{$city['city']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$city = addConflict($city, $general['nation'], 1);//NOTE: 이 경우 두 국가가 분쟁 중인 경우에는 병량패퇴의 이득이 없다.
|
||||
|
||||
ConquerCity($admin, $general, $city, $nation, $destnation);
|
||||
break;
|
||||
// 장수가 없어서 도시 공격
|
||||
} elseif($opposecount == 0) {
|
||||
$opposeCrewType = GameUnitConst::byId(GameUnitConst::T_CASTLE);
|
||||
$josaRo = JosaUtil::pick($generalCrewType->name, '로');
|
||||
$josaYi = JosaUtil::pick($general['name'], '이');
|
||||
$alllog[] = "<C>●</>{$month}월:<Y>{$general['name']}</>{$josaYi} {$generalCrewType->name}{$josaRo} 성벽을 공격합니다.";
|
||||
$log[] = "<C>●</>{$generalCrewType->name}{$josaRo} 성벽을 <M>공격</>합니다.";
|
||||
|
||||
$general['train'] += 1; //훈련 상승
|
||||
if($general['train'] > GameConst::$maxTrainByWar) { $general['train'] = GameConst::$maxTrainByWar; }
|
||||
$query = "update general set recwar='{$general['turntime']}',train='{$general['train']}',warnum=warnum+1 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$mykillnum = 0; $mydeathnum = 0;
|
||||
while($phase < $warphase) {
|
||||
$phase++;
|
||||
|
||||
$myAtt = $generalCrewType->getComputedAttack($general, $nation['tech']);
|
||||
$myDef = $generalCrewType->getComputedDefence($general, $nation['tech']);
|
||||
$cityAtt = $opposeCrewType->getComputedAttack($city, $destnation['tech']);
|
||||
$cityDef = $opposeCrewType->getComputedDefence($city, $destnation['tech']);
|
||||
|
||||
// 감소할 병사 수
|
||||
$cityCrew = GameConst::$armperphase + $myAtt - $cityDef;
|
||||
$myCrew = GameConst::$armperphase + $cityAtt - $myDef;
|
||||
if($cityCrew <= 0) { $cityCrew = rand() % 90 + 10; }
|
||||
if($myCrew <= 0) { $myCrew = rand() % 90 + 10; }
|
||||
|
||||
//훈련 사기따라
|
||||
$myCrew = getCrew($myCrew, $admin['city_rate']+$oppAtmosBonus, CharTrain($general['train']+$genTrain+$genTrainBonus, $general['personal']));
|
||||
$cityCrew = getCrew($cityCrew, CharAtmos($general['atmos']+$genAtmos+$genAtmosBonus, $general['personal']), $admin['city_rate']+$oppTrainBonus);
|
||||
//숙련도 따라
|
||||
$genDexAtt = getGenDex($general, $general['crewtype']);
|
||||
$genDexDef = getGenDex($general, GameUnitConst::T_CASTLE);
|
||||
$cityCrew *= getDexLog($genDexAtt, ($admin['city_rate']-60)*7200);
|
||||
$myCrew *= getDexLog(($admin['city_rate']-60)*7200, $genDexDef);
|
||||
|
||||
$cityCrew *= $generalCrewType->getAttackCoef($opposeCrewType);
|
||||
$myCrew *= $generalCrewType->getDefenceCoef($opposeCrewType);
|
||||
|
||||
$avoid = 1;
|
||||
// 병종간 특성
|
||||
if($generalCrewType->magicCoef) {
|
||||
$int = Util::round(getGeneralIntel($general, true, true, true, false));
|
||||
$ratio2 = $int / 100 * $generalCrewType->magicCoef;
|
||||
|
||||
// 특기보정 : 신산
|
||||
if($general['special2'] == 41) { $ratio2 += 0.2; }
|
||||
|
||||
if(Util::randBool($ratio2)) {
|
||||
$ratio = rand() % 100; // 0~99
|
||||
// 특기보정 : 귀병, 신산, 환술, 신중
|
||||
if($general['special2'] == 40) { $ratio += 20; }
|
||||
if($general['special2'] == 41) { $ratio += 20; }
|
||||
if($general['special2'] == 42) { $ratio += 10; }
|
||||
if($general['special2'] == 44) { $ratio += 100; }
|
||||
if($ratio >= 30) {
|
||||
// 특기보정 : 환술, 집중
|
||||
if($general['special2'] == 42) { $cityCrew *= 1.3; }
|
||||
if($general['special2'] == 43) { $cityCrew *= 1.5; }
|
||||
$type = rand() % 3;
|
||||
switch($type) {
|
||||
case 0:
|
||||
$batlog[] = "<C>●</><D>급습</>을 <C>성공</>했다!";
|
||||
$cityCrew *= 1.2;
|
||||
break;
|
||||
case 1:
|
||||
$batlog[] = "<C>●</><D>위보</>를 <C>성공</>했다!";
|
||||
$cityCrew *= 1.4;
|
||||
break;
|
||||
case 2:
|
||||
$batlog[] = "<C>●</><D>혼란</>을 <C>성공</>했다!";
|
||||
$cityCrew *= 1.6;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$type = rand() % 3;
|
||||
switch($type) {
|
||||
case 0:
|
||||
$batlog[] = "<C>●</><D>급습</>을 <R>실패</>했다!";
|
||||
$cityCrew /= 1.2; $myCrew *= 1.2;
|
||||
break;
|
||||
case 1:
|
||||
$batlog[] = "<C>●</><D>위보</>를 <R>실패</>했다!";
|
||||
$cityCrew /= 1.4; $myCrew *= 1.4;
|
||||
break;
|
||||
case 2:
|
||||
$batlog[] = "<C>●</><D>혼란</>을 <R>실패</>했다!";
|
||||
$cityCrew /= 1.6; $myCrew *= 1.6;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//군주 공격 보정 10%
|
||||
if($general['level'] == 12) {
|
||||
$cityCrew = $cityCrew * 1.10;
|
||||
//참모, 장군 공격 보정 5%
|
||||
} elseif($general['level'] == 11 || $general['level'] == 10 || $general['level'] == 8 || $general['level'] == 6) {
|
||||
$cityCrew = $cityCrew * 1.05;
|
||||
}
|
||||
//레벨 보정
|
||||
$cityCrew = $cityCrew * (100 + $general['explevel']/6)/100;
|
||||
|
||||
// 특기보정 : 공성, 기병, 돌격, 무쌍, 보병, 견고, 의술(청낭서,태평청령)
|
||||
if($general['special2'] == 53) { $cityCrew *= 2.00; }
|
||||
if($general['special2'] == 52) { $cityCrew *= 1.20; }
|
||||
if($general['special2'] == 60) { $cityCrew *= 1.10; }
|
||||
if($general['special2'] == 61) { $cityCrew *= 1.10; }
|
||||
if($general['special2'] == 50) { $myCrew *= 0.90; }
|
||||
if($general['special2'] == 62) { $myCrew *= 0.90; }
|
||||
$ratio = rand() % 100; // 0 ~ 99
|
||||
if(($general['special2'] == 73 || $general['item'] == 23 || $general['item'] == 24) && $ratio > 80 && $avoid == 1) {
|
||||
$batlog[] = "<C>●</><C>치료</>했다!</>";
|
||||
$myCrew /= 1.5; // 66%만 소모
|
||||
$avoid = 0;
|
||||
}
|
||||
|
||||
//크리
|
||||
$rd = rand() % 100; // 0 ~ 99
|
||||
$ratio = $generalCrewType->getCriticalRatio($general);
|
||||
// 특기보정 : 무쌍, 필살
|
||||
if($general['special2'] == 61) { $ratio += 10; }
|
||||
if($general['special2'] == 71) { $ratio += 20; }
|
||||
if($ratio >= $rd && $avoid == 1) {
|
||||
$batlog[] = "<C>●</><C>필살</>공격!</>";
|
||||
$cityCrew = CriticalScore2($cityCrew);
|
||||
$avoid = 0;
|
||||
}
|
||||
//회피
|
||||
$ratio = rand() % 100; // 0 ~ 99
|
||||
$ratio2 = $generalCrewType->avoid; //회피율
|
||||
$ratio2 = Util::round($ratio2 * $general['train'] / 100); //훈련 반영
|
||||
//특기보정 : 궁병
|
||||
if($general['special2'] == 51) { $ratio2 += 20; }
|
||||
//도구 보정 : 둔갑천서, 태평요술
|
||||
if($general['item'] == 26 || $general['item'] == 25) { $ratio2 += 20; }
|
||||
LogText('avoid0', [date("Ymd_His"), $generalCrewType->id, $general['train'], $ratio2]);
|
||||
if($ratio < $ratio2 && $avoid == 1) {
|
||||
LogText('avoid0', true);
|
||||
$batlog[] = "<C>●</><C>회피</>했다!</>";
|
||||
$myCrew /= 5; // 20%만 소모
|
||||
$avoid = 0;
|
||||
}
|
||||
|
||||
//랜타추가
|
||||
$cityCrew *= (rand() % 21 + 90)/100; // 90~110%
|
||||
$myCrew *= (rand() % 21 + 90)/100; // 90~110%
|
||||
|
||||
//특기보정 : 위압
|
||||
if($general['special2'] == 63 && $phase == 1 && $general['crew'] >= 1000 && $general['atmos'] >= 90 && $general['train'] >= 90) {
|
||||
$batlog[] = "<C>●</>상대에게 <C>위압</>을 줬다!</>";
|
||||
$myCrew = 0;
|
||||
}
|
||||
|
||||
$general['crew'] -= Util::round($myCrew);
|
||||
$city['def'] -= Util::round($cityCrew);
|
||||
$city['wall'] -= Util::round($cityCrew);
|
||||
|
||||
$tempMyCrew = $myCrew; $tempCityCrew = $cityCrew;
|
||||
$tempGeneralCrew = $general['crew']; $tempCityDef = $city['def'];
|
||||
|
||||
if($city['wall'] <= 0) { $city['wall'] = 0; }
|
||||
|
||||
if($general['crew'] <= 0 && $city['def'] <= 0) {
|
||||
$r1 = $tempGeneralCrew / $tempMyCrew;
|
||||
$r2 = $tempCityDef / $tempCityCrew;
|
||||
|
||||
if($r1 > $r2) {
|
||||
$offset = Util::round($tempCityDef*$tempMyCrew/$tempCityCrew);
|
||||
$myCrew += $offset;
|
||||
$general['crew'] -= $offset;
|
||||
$cityCrew += $tempCityDef;
|
||||
$city['def'] = 0;
|
||||
} else {
|
||||
$offset = Util::round($tempGeneralCrew*$tempCityCrew/$tempMyCrew);
|
||||
$cityCrew += $offset;
|
||||
$city['def'] -= $offset;
|
||||
$myCrew += $tempGeneralCrew;
|
||||
$general['crew'] = 0;
|
||||
}
|
||||
} elseif($general['crew'] * $city['def'] <= 0) {
|
||||
if($city['def'] < 0) {
|
||||
$offset = Util::round($tempCityDef*$tempMyCrew/$tempCityCrew);
|
||||
$myCrew += $offset;
|
||||
$general['crew'] -= $offset;
|
||||
$cityCrew += $tempCityDef;
|
||||
$city['def'] = 0;
|
||||
}
|
||||
if($general['crew'] < 0) {
|
||||
$offset = Util::round($tempGeneralCrew*$tempCityCrew/$tempMyCrew);
|
||||
$cityCrew += $offset;
|
||||
$city['def'] -= $offset;
|
||||
$myCrew += $tempGeneralCrew;
|
||||
$general['crew'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$exp += $cityCrew;
|
||||
$opexp += $myCrew;
|
||||
$general['crew'] = Util::round($general['crew']);
|
||||
$cityCrew = Util::round($cityCrew);
|
||||
$myCrew = Util::round($myCrew);
|
||||
$batlog[] = "<C>●</> $phase : <Y1>【{$general['name']}】</> <C>{$general['crew']} (-$myCrew)</> VS <C>{$city['def']} (-$cityCrew)</> <Y1>【{$city['name']}】</>";
|
||||
|
||||
$mykillnum += $cityCrew; $mydeathnum += $myCrew;
|
||||
|
||||
// 중간 쌀 체크
|
||||
$myRice = Util::round($exp / 50);
|
||||
// 성격 보정
|
||||
$myRice = CharExperience($myRice, $general['personal']);
|
||||
// 쌀 소모
|
||||
$myRice = ($myRice * 5 * getCrewtypeRice($generalCrewType, $nation['tech']));
|
||||
// 결과 쌀
|
||||
$myRice = $general['rice'] - $myRice;
|
||||
|
||||
if($myRice <= Util::round($general['crew']/100)) { break; }
|
||||
|
||||
if($city['def'] <= 0) { break; }
|
||||
if($general['crew'] <= 0) { break; }
|
||||
}
|
||||
|
||||
$render_attacker = [
|
||||
'crewtype' => mb_substr($generalCrewType->name, 0, 2),
|
||||
'name'=> $general['name'],
|
||||
'remain_crew' => $general['crew'],
|
||||
'killed_crew' => -$mydeathnum
|
||||
];
|
||||
$render_defender = [
|
||||
'crewtype' => '성벽',
|
||||
'name'=> $city['name'],
|
||||
'remain_crew' => $city['def'],
|
||||
'killed_crew' => -$mykillnum
|
||||
];
|
||||
|
||||
$res = str_replace(["\r\n", "\r", "\n"], '', $templates->render('small_war_log',[
|
||||
'year'=>$year,
|
||||
'month'=>$month,
|
||||
'war_type'=>'siege',
|
||||
'war_type_str'=>'→',
|
||||
'me' => $render_attacker,
|
||||
'you' => $render_defender,
|
||||
]));
|
||||
|
||||
$log[] = $res;//TODO: $log를 출력할 때 date에 대해선 숨겨야 함.
|
||||
$batlog[] = $res;
|
||||
$batres[] = $res;
|
||||
$deadAmount['att'] = $deadAmount['att'] + $mydeathnum;
|
||||
$deadAmount['def'] = $deadAmount['def'] + $mykillnum;
|
||||
|
||||
// 도시쌀 소모 계산
|
||||
$opexp = Util::round($opexp / 50 * 0.8);
|
||||
$rice = Util::round($opexp * 5 * getCrewtypeRice($opposeCrewType, 0) * ($admin['city_rate']/100 - 0.2));
|
||||
$destnation['rice'] -= $rice;
|
||||
if($destnation['rice'] < 0) { $destnation['rice'] = 0; }
|
||||
$query = "update nation set rice='{$destnation['rice']}' where nation='{$destnation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
pushAdminLog(["성벽 쌀 소모 : $rice"]);
|
||||
|
||||
//원래대로 스케일링
|
||||
$city['def'] = Util::round($city['def'] / 10);
|
||||
$city['wall'] = Util::round($city['wall'] / 10);
|
||||
//내정 감소
|
||||
$dec = Util::round($cityCrew / 10);
|
||||
$city['agri'] -= $dec;
|
||||
$city['comm'] -= $dec;
|
||||
$city['secu'] -= $dec;
|
||||
if($city['agri'] < 0) { $city['agri'] = 0; }
|
||||
if($city['comm'] < 0) { $city['comm'] = 0; }
|
||||
if($city['secu'] < 0) { $city['secu'] = 0; }
|
||||
// 병사수 변경
|
||||
$query = "update general set crew='{$general['crew']}',killcrew=killcrew+'$mykillnum',deathcrew=deathcrew+'$mydeathnum' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 숙련도 증가
|
||||
addGenDex($general['no'], $general['atmos'], $general['train'], $general['crewtype'], $mykillnum);
|
||||
addGenDex($general['no'], $general['atmos'], $general['train'], GameUnitConstBase::T_CASTLE, $mydeathnum);
|
||||
// 죽은수 기술로 누적
|
||||
$num = Util::round($mydeathnum * 0.01);
|
||||
// 국가보정
|
||||
if($nation['type'] == 3 || $nation['type'] == 13) { $num *= 1.1; }
|
||||
if($nation['type'] == 5 || $nation['type'] == 6 || $nation['type'] == 7 || $nation['type'] == 8 || $nation['type'] == 12) { $num *= 0.9; }
|
||||
// 부드러운 기술 제한
|
||||
if(TechLimit($admin['startyear'], $year, $nation['tech'])) { $num = intdiv($num, 4); }
|
||||
$query = "update nation set totaltech=totaltech+'$num',tech=totaltech/'$gencount' where nation='{$nation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 죽은수 기술로 누적
|
||||
$num = Util::round($mykillnum * 0.01);
|
||||
// 국가보정
|
||||
if($destnation['type'] == 3 || $destnation['type'] == 13){
|
||||
$num *= 1.1;
|
||||
}
|
||||
if($destnation['type'] == 5 || $destnation['type'] == 6 || $destnation['type'] == 7 || $destnation['type'] == 8 || $destnation['type'] == 12) {
|
||||
$num *= 0.9;
|
||||
}
|
||||
// 부드러운 기술 제한
|
||||
if(TechLimit($admin['startyear'], $year, $destnation['tech'])) { $num = intdiv($num, 4); }
|
||||
$query = "update nation set totaltech=totaltech+'$num',tech=totaltech/'$destgencount' where nation='{$destnation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
//양국 평균 기술가격
|
||||
//$techRatio = (getTechCost($nation['tech']) + getTechCost($destnation['tech'])) / 2;
|
||||
$techRatio = 1.0;
|
||||
// 죽은수 도시 재정으로 누적 60%
|
||||
$num = Util::round(($mykillnum+$mydeathnum) * 0.6 * $techRatio);
|
||||
// 국가보정
|
||||
if($destnation['type'] == 1) { $num *= 1.1; }
|
||||
if($destnation['type'] == 9 || $destnation['type'] == 10) { $num *= 0.9; }
|
||||
$query = "update city set dead=dead+'$num',def='{$city['def']}',wall='{$city['wall']}',agri='{$city['agri']}',comm='{$city['comm']}',secu='{$city['secu']}' where city='{$city['city']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 죽은수 도시 재정으로 누적 40%
|
||||
$num = Util::round(($mykillnum+$mydeathnum) * 0.4 * $techRatio);
|
||||
// 국가보정
|
||||
if($nation['type'] == 1) { $num *= 1.1; }
|
||||
if($nation['type'] == 9 || $nation['type'] == 10) { $num *= 0.9; }
|
||||
$query = "update city set dead=dead+'$num' where city='{$general['city']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
//분쟁현황에 추가
|
||||
$city = addConflict($city, $general['nation'], $mykillnum);
|
||||
|
||||
// 병사 소진시 성 함락
|
||||
if($city['def'] <= 0) {
|
||||
$exp += 1000;
|
||||
$exp2++;
|
||||
|
||||
pushGenLog($general, $log);
|
||||
pushBatLog($general, $batlog);
|
||||
pushBatRes($general, $batres);
|
||||
pushGeneralPublicRecord($alllog, $year, $month);
|
||||
pushWorldHistory($history, $year, $month);
|
||||
$log = [];
|
||||
$batlog = [];
|
||||
$batres = [];
|
||||
$alllog = [];
|
||||
$history = [];
|
||||
|
||||
ConquerCity($admin, $general, $city, $nation, $destnation);
|
||||
break;
|
||||
// 공격 장수 병사 소진시 실패 처리
|
||||
} elseif($general['crew'] <= 0) {
|
||||
$josaYi = JosaUtil::pick($generalCrewType->name, '이');
|
||||
$alllog[] = "<C>●</>{$month}월:<Y>{$general['name']}</>의 {$generalCrewType->name}{$josaYi} 퇴각했습니다.";
|
||||
$log[] = "<C>●</>퇴각했습니다.";
|
||||
|
||||
$query = "update general set deathnum=deathnum+1 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
break;
|
||||
} elseif($myRice <= Util::round($general['crew']/100)) {
|
||||
$josaYi = JosaUtil::pick($generalCrewType->name, '이');
|
||||
$alllog[] = "<C>●</>{$month}월:<Y>{$general['name']}</>의 {$generalCrewType->name}{$josaYi} 퇴각했습니다.";
|
||||
$log[] = "<C>●</>군량 부족으로 퇴각합니다.";
|
||||
|
||||
$query = "update general set deathnum=deathnum+1 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
break;
|
||||
}
|
||||
// 장수 대결
|
||||
} else {
|
||||
$oppose = MYDB_fetch_array($result);
|
||||
setLeadershipBonus($oppose, $destnation['level']);
|
||||
$opposeCrewType = GameUnitConst::byId($oppose['crewtype']);
|
||||
|
||||
$josaYi = JosaUtil::pick($opposeCrewType->name, '이');
|
||||
$josaWa = JosaUtil::pick($generalCrewType->name, '와');
|
||||
$alllog[] = "<C>●</>{$month}월:<Y>{$general['name']}</>의 ".$generalCrewType->name."{$josaWa} <Y>{$oppose['name']}</>의 ".$opposeCrewType->name."{$josaYi} 대결합니다.";
|
||||
$josaUl = JosaUtil::pick($opposeCrewType->name, '을');
|
||||
$josaRo = JosaUtil::pick($generalCrewType->name, '로');
|
||||
$log[] = "<C>●</>".$generalCrewType->name."{$josaRo} <Y>{$oppose['name']}</>의 ".$opposeCrewType->name."{$josaUl} <M>공격</>합니다.";
|
||||
$josaUl = JosaUtil::pick($generalCrewType->name, '을');
|
||||
$opplog[] = "<C>●</>".$opposeCrewType->name."{$josaRo} <Y>{$general['name']}</>의 ".$generalCrewType->name."{$josaUl} <M>수비</>합니다.";
|
||||
|
||||
$oppAtmos = 0;
|
||||
if($oppose['item'] == 3) {
|
||||
//탁주 사용
|
||||
$oppAtmos += 3;
|
||||
$query = "update general set item=0 where no='{$oppose['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$josaUl = JosaUtil::pick($oppose['item'], '을');
|
||||
$opplog[] = "<C>●</><C>".getItemName($oppose['item'])."</>{$josaUl} 사용!";
|
||||
$oppose['item'] = 0;
|
||||
} elseif($oppose['item'] >= 14 && $oppose['item'] <= 16) {
|
||||
//의적주, 두강주, 보령압주 사용
|
||||
$oppAtmos += 5;
|
||||
} elseif($oppose['item'] >= 19 && $oppose['item'] <= 20) {
|
||||
//춘화첩, 초선화 사용
|
||||
$oppAtmos += 7;
|
||||
}
|
||||
$oppTrain = 0;
|
||||
if($oppose['item'] == 4) {
|
||||
//청주 사용
|
||||
$oppTrain += 3;
|
||||
$query = "update general set item=0 where no='{$oppose['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$josaUl = JosaUtil::pick($oppose['item'], '을');
|
||||
$opplog[] = "<C>●</><C>".getItemName($oppose['item'])."</>{$josaUl} 사용!";
|
||||
$oppose['item'] = 0;
|
||||
} elseif($oppose['item'] >= 12 && $oppose['item'] <= 13) {
|
||||
//과실주, 이강주 사용
|
||||
$oppTrain += 5;
|
||||
} elseif($oppose['item'] >= 17 && $oppose['item'] <= 18) {
|
||||
//철벽서, 단결도 사용
|
||||
$oppTrain += 7;
|
||||
}
|
||||
|
||||
$general['train'] += 1; //훈련 상승
|
||||
if($general['train'] > GameConst::$maxTrainByWar) { $general['train'] = GameConst::$maxTrainByWar; }
|
||||
$oppose['train'] += 1; //훈련 상승
|
||||
if($oppose['train'] > GameConst::$maxTrainByWar) { $oppose['train'] = GameConst::$maxTrainByWar; }
|
||||
|
||||
$query = "update general set recwar='{$general['turntime']}',train='{$general['train']}',warnum=warnum+1 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update general set recwar='{$general['turntime']}',train='{$oppose['train']}',warnum=warnum+1 where no='{$oppose['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
//특기보정 : 저격(수극), 활무기저격
|
||||
$snipe = false;
|
||||
$snipeItem = false;
|
||||
if(!$snipe && $general['special2'] == 70 && Util::randBool(1/3)){
|
||||
$snipe = true;
|
||||
}
|
||||
if(!$snipe && in_array($general['weap'], [10, 14, 18, 22]) && Util::randBool(1/5)){
|
||||
$snipe = true;
|
||||
}
|
||||
if(!$snipe && $general['item'] == 2){
|
||||
if(Util::randBool(1/5)){
|
||||
$snipe = true;
|
||||
$snipeItem = true;
|
||||
}
|
||||
//수극을 사용했지만 저격 실패한 케이스도 '필요하면' 넣을 것.(밸런스)
|
||||
|
||||
}
|
||||
if($snipe) {
|
||||
//수극 사용
|
||||
if($snipeItem) {
|
||||
$josaUl = JosaUtil::pick($general['item'], '을');
|
||||
$log[] = "<C>●</><C>".getItemName($general['item'])."</>{$josaUl} 사용!";
|
||||
$general['item'] = 0;
|
||||
$db->update('general', ['item'=>0], 'no=%i', $general['no']);
|
||||
}
|
||||
$log[] = "<C>●</>상대를 <C>저격</>했다!";
|
||||
$batlog[] = "<C>●</>상대를 <C>저격</>했다!";
|
||||
$opplog[] = "<C>●</>상대에게 <R>저격</>당했다!";
|
||||
$oppbatlog[] = "<C>●</>상대에게 <R>저격</>당했다!";
|
||||
// 부상
|
||||
$oppose['injury'] += rand() % 41 + 20; // 20 ~ 60
|
||||
if($oppose['injury'] > 80) { $oppose['injury'] = 80; }
|
||||
}
|
||||
else if($snipeItem) {
|
||||
$db->update('general', ['item'=>0], 'no=%i', $general['no']);
|
||||
$josaYi = JosaUtil::pick($general['item'], '이');
|
||||
$batlog[] = "<C>●</><C>".getItemName($general['item'])."</>{$josaYi} 빗나갑니다!";
|
||||
$general['item'] = 0;
|
||||
}
|
||||
|
||||
//특기보정 : 저격(수극), 활무기저격
|
||||
$snipe = false;
|
||||
$snipeItem = false;
|
||||
if(!$snipe && $oppose['special2'] == 70 && Util::randBool(1/3)){
|
||||
$snipe = true;
|
||||
}
|
||||
if(!$snipe && in_array($oppose['weap'], [10, 14, 18, 22]) && Util::randBool(1/5)){
|
||||
$snipe = true;
|
||||
}
|
||||
if(!$snipe && $oppose['item'] == 2){
|
||||
if(Util::randBool(1/5)){
|
||||
$snipe = true;
|
||||
$snipeItem = true;
|
||||
}
|
||||
//수극을 사용했지만 저격 실패한 케이스도 '필요하면' 넣을 것.(밸런스)
|
||||
}
|
||||
if($snipe) {
|
||||
//수극 사용
|
||||
if($snipeItem) {
|
||||
$josaUl = JosaUtil::pick($oppose['item'], '을');
|
||||
$opplog[] = "<C>●</><C>".getItemName($oppose['item'])."</>{$josaUl} 사용!";
|
||||
$oppose['item'] = 0;
|
||||
$db->update('general', ['item'=>0], 'no=%i', $oppose['no']);
|
||||
}
|
||||
$oppbatlog[] = "<C>●</>상대를 <C>저격</>했다!";
|
||||
$opplog[] = "<C>●</>상대를 <C>저격</>했다!";
|
||||
$batlog[] = "<C>●</>상대에게 <R>저격</>당했다!";
|
||||
$log[] = "<C>●</>상대에게 <R>저격</>당했다!";
|
||||
// 부상
|
||||
$general['injury'] += rand() % 41 + 20; // 20 ~ 60
|
||||
if($general['injury'] > 80) { $general['injury'] = 80; }
|
||||
}
|
||||
else if($snipeItem) {
|
||||
$db->update('general', ['item'=>0], 'no=%i', $oppose['no']);
|
||||
$josaYi = JosaUtil::pick($oppose['item'], '이');
|
||||
$oppbatlog[] = "<C>●</><C>".getItemName($oppose['item'])."</>{$josaYi} 빗나갑니다!";
|
||||
$oppose['item'] = 0;
|
||||
}
|
||||
|
||||
$mykillnum = 0; $mydeathnum = 0;
|
||||
$opkillnum = 0; $opdeathnum = 0;
|
||||
while($phase < $warphase) {
|
||||
$phase++;
|
||||
|
||||
$myAtt = $generalCrewType->getComputedAttack($general, $nation['tech']);
|
||||
$myDef = $generalCrewType->getComputedDefence($general, $nation['tech']);
|
||||
|
||||
$opAtt = $opposeCrewType->getComputedAttack($oppose, $destnation['tech']);
|
||||
$opDef = $opposeCrewType->getComputedDefence($oppose, $destnation['tech']);
|
||||
// 감소할 병사 수
|
||||
$myCrew = GameConst::$armperphase + $opAtt - $myDef;
|
||||
$opCrew = GameConst::$armperphase + $myAtt - $opDef;
|
||||
if($myCrew <= 0) { $myCrew = rand() % 90 + 10; }
|
||||
if($opCrew <= 0) { $opCrew = rand() % 90 + 10; }
|
||||
//훈련 사기따라
|
||||
$myCrew = getCrew($myCrew, CharAtmos($oppose['atmos']+$oppAtmos+$oppAtmosBonus, $oppose['personal']), CharTrain($general['train']+$genTrain+$genTrainBonus, $general['personal']));
|
||||
$opCrew = getCrew($opCrew, CharAtmos($general['atmos']+$genAtmos+$genAtmosBonus, $general['personal']), CharTrain($oppose['train']+$oppTrain+$oppTrainBonus, $oppose['personal']));
|
||||
//숙련도 따라
|
||||
$genDexAtt = getGenDex($general, $general['crewtype']);
|
||||
$genDexDef = getGenDex($general, $oppose['crewtype']);
|
||||
$oppDexAtt = getGenDex($oppose, $oppose['crewtype']);
|
||||
$oppDexDef = getGenDex($oppose, $general['crewtype']);
|
||||
$opCrew *= getDexLog($genDexAtt, $oppDexDef);
|
||||
$myCrew *= getDexLog($oppDexAtt, $genDexDef);
|
||||
|
||||
$myAvoid = 1;
|
||||
$opAvoid = 1;
|
||||
// 병종간 특성
|
||||
if($generalCrewType->magicCoef) {
|
||||
$int = Util::round(getGeneralIntel($general, true, true, true, false));
|
||||
$ratio2 = $int / 100 * $generalCrewType->magicCoef;
|
||||
|
||||
// 특기보정 : 신산
|
||||
if($general['special2'] == 41) { $ratio2 += 0.2; }
|
||||
|
||||
if(Util::randBool($ratio2)) {
|
||||
$ratio = rand() % 100;
|
||||
// 특기보정 : 귀병, 신산, 환술, 신중
|
||||
if($general['special2'] == 40) { $ratio += 20; }
|
||||
if($general['special2'] == 41) { $ratio += 20; }
|
||||
if($general['special2'] == 42) { $ratio += 10; }
|
||||
if($general['special2'] == 44) { $ratio += 100; }
|
||||
if($ratio >= 30) {
|
||||
// 특기보정 : 환술, 집중
|
||||
if($general['special2'] == 42) { $opCrew *= 1.3; }
|
||||
if($general['special2'] == 43) { $opCrew *= 1.5; }
|
||||
$type = rand() % 5; // 0~4
|
||||
switch($type) {
|
||||
case 0:
|
||||
$ratio = rand() % 100;
|
||||
// 특기보정 : 반계
|
||||
if($oppose['special2'] == 45 && $ratio > 70) {
|
||||
$batlog[] = "<C>●</><D>위보</>를 <R>역으로</> 당했다!";
|
||||
$oppbatlog[] = "<C>●</><C>반계</>로 상대의 <D>위보</>를 되돌렸다!";
|
||||
$myCrew *= 1.2;
|
||||
} else {
|
||||
$batlog[] = "<C>●</><D>위보</>를 <C>성공</>했다!";
|
||||
$oppbatlog[] = "<C>●</><D>위보</>에 당했다!";
|
||||
$opCrew *= 1.2;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
$ratio = rand() % 100;
|
||||
// 특기보정 : 반계
|
||||
if($oppose['special2'] == 45 && $ratio > 70) {
|
||||
$batlog[] = "<C>●</><D>매복</>을 <R>역으로</> 당했다!";
|
||||
$oppbatlog[] = "<C>●</><C>반계</>로 상대의 <D>매복</>을 되돌렸다!";
|
||||
$myCrew *= 1.4;
|
||||
} else {
|
||||
$batlog[] = "<C>●</><D>매복</>을 <C>성공</>했다!";
|
||||
$oppbatlog[] = "<C>●</><D>매복</>에 당했다!";
|
||||
$opCrew *= 1.4;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
$ratio = rand() % 100;
|
||||
// 특기보정 : 반계
|
||||
if($oppose['special2'] == 45 && $ratio > 70) {
|
||||
$batlog[] = "<C>●</><D>반목</>을 <R>역으로</> 당했다!";
|
||||
$oppbatlog[] = "<C>●</><C>반계</>로 상대의 <D>반목</>을 되돌렸다!";
|
||||
$myCrew *= 1.6;
|
||||
} else {
|
||||
$batlog[] = "<C>●</><D>반목</>을 <C>성공</>했다!";
|
||||
$oppbatlog[] = "<C>●</><D>반목</>에 당했다!";
|
||||
$opCrew *= 1.6;
|
||||
// 특기보정 : 반계
|
||||
if($general['special2'] == 45) { $opCrew *= 2; }
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
$ratio = rand() % 100;
|
||||
// 특기보정 : 반계
|
||||
if($oppose['special2'] == 45 && $ratio > 70) {
|
||||
$batlog[] = "<C>●</><D>화계</>를 <R>역으로</> 당했다!";
|
||||
$oppbatlog[] = "<C>●</><C>반계</>로 상대의 <D>화계</>를 되돌렸다!";
|
||||
$myCrew *= 1.8;
|
||||
} else {
|
||||
$batlog[] = "<C>●</><D>화계</>를 <C>성공</>했다!";
|
||||
$oppbatlog[] = "<C>●</><D>화계</>에 당했다!";
|
||||
$opCrew *= 1.8;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
$ratio = rand() % 100;
|
||||
// 특기보정 : 반계
|
||||
if($oppose['special2'] == 45 && $ratio > 70) {
|
||||
$batlog[] = "<C>●</><D>혼란</>을 <R>역으로</> 당했다!";
|
||||
$oppbatlog[] = "<C>●</><C>반계</>로 상대의 <D>혼란</>을 되돌렸다!";
|
||||
$myCrew *= 2.0;
|
||||
} else {
|
||||
$batlog[] = "<C>●</><D>혼란</>을 <C>성공</>했다!";
|
||||
$oppbatlog[] = "<C>●</><D>혼란</>에 당했다!";
|
||||
$opCrew *= 2.0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$type = rand() % 5; // 0~4
|
||||
switch($type) {
|
||||
case 0:
|
||||
$batlog[] = "<C>●</><D>위보</>를 <R>실패</>했다!";
|
||||
$oppbatlog[] = "<C>●</><D>위보</>를 간파했다!";
|
||||
$opCrew /= 1.1; $myCrew *= 1.1;
|
||||
break;
|
||||
case 1:
|
||||
$batlog[] = "<C>●</><D>매복</>을 <R>실패</>했다!";
|
||||
$oppbatlog[] = "<C>●</><D>매복</>을 간파했다!";
|
||||
$opCrew /= 1.2; $myCrew *= 1.2;
|
||||
break;
|
||||
case 2:
|
||||
$batlog[] = "<C>●</><D>반목</>을 <R>실패</>했다!";
|
||||
$oppbatlog[] = "<C>●</><D>반목</>을 간파했다!";
|
||||
$opCrew /= 1.3; $myCrew *= 1.3;
|
||||
break;
|
||||
case 3:
|
||||
$batlog[] = "<C>●</><D>화계</>를 <R>실패</>했다!";
|
||||
$oppbatlog[] = "<C>●</><D>화계</>를 간파했다!";
|
||||
$opCrew /= 1.4; $myCrew *= 1.4;
|
||||
break;
|
||||
case 4:
|
||||
$batlog[] = "<C>●</><D>혼란</>을 <R>실패</>했다!";
|
||||
$oppbatlog[] = "<C>●</><D>혼란</>을 간파했다!";
|
||||
$opCrew /= 1.5; $myCrew *= 1.5;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 상대 장수 병종간 특성
|
||||
if($opposeCrewType->magicCoef) {
|
||||
$int = Util::round(getGeneralIntel($oppose, true, true, true, false));
|
||||
$ratio2 = $int / 100 * $opposeCrewType->magicCoef;
|
||||
|
||||
// 특기보정 : 신산
|
||||
if($oppose['special2'] == 41) { $ratio2 += 0.2; }
|
||||
|
||||
if(Util::randBool($ratio2)) {
|
||||
$ratio = rand() % 100;
|
||||
// 특기보정 : 귀병, 신산, 환술, 신중
|
||||
if($oppose['special2'] == 40) { $ratio += 20; }
|
||||
if($oppose['special2'] == 41) { $ratio += 20; }
|
||||
if($oppose['special2'] == 42) { $ratio += 10; }
|
||||
if($oppose['special2'] == 44) { $ratio += 100; }
|
||||
if($ratio >= 30) {
|
||||
// 특기보정 : 환술, 집중
|
||||
if($oppose['special2'] == 42) { $myCrew *= 1.3; }
|
||||
if($oppose['special2'] == 43) { $myCrew *= 1.5; }
|
||||
$type = rand() % 5; // 0~4
|
||||
switch($type) {
|
||||
case 0:
|
||||
$ratio = rand() % 100;
|
||||
// 특기보정 : 반계
|
||||
if($general['special2'] == 45 && $ratio > 70) {
|
||||
$oppbatlog[] = "<C>●</><D>위보</>를 <R>역으로</> 당했다!";
|
||||
$batlog[] = "<C>●</><C>반계</>로 상대의 <D>위보</>를 되돌렸다!";
|
||||
$opCrew *= 1.2;
|
||||
} else {
|
||||
$oppbatlog[] = "<C>●</><D>위보</>를 <C>성공</>했다!";
|
||||
$batlog[] = "<C>●</><D>위보</>에 당했다!";
|
||||
$myCrew *= 1.2;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
$ratio = rand() % 100;
|
||||
// 특기보정 : 반계
|
||||
if($general['special2'] == 45 && $ratio > 70) {
|
||||
$oppbatlog[] = "<C>●</><D>매복</>을 <R>역으로</> 당했다!";
|
||||
$batlog[] = "<C>●</><C>반계</>로 상대의 <D>매복</>을 되돌렸다!";
|
||||
$opCrew *= 1.4;
|
||||
} else {
|
||||
$oppbatlog[] = "<C>●</><D>매복</>을 <C>성공</>했다!";
|
||||
$batlog[] = "<C>●</><D>매복</>에 당했다!";
|
||||
$myCrew *= 1.4;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
$ratio = rand() % 100;
|
||||
// 특기보정 : 반계
|
||||
if($general['special2'] == 45 && $ratio > 70) {
|
||||
$oppbatlog[] = "<C>●</><D>반목</>을 <R>역으로</> 당했다!";
|
||||
$batlog[] = "<C>●</><C>반계</>로 상대의 <D>반목</>을 되돌렸다!";
|
||||
$opCrew *= 1.6;
|
||||
} else {
|
||||
$oppbatlog[] = "<C>●</><D>반목</>을 <C>성공</>했다!";
|
||||
$batlog[] = "<C>●</><D>반목</>에 당했다!";
|
||||
$myCrew *= 1.6;
|
||||
// 특기보정 : 반계
|
||||
if($oppose['special2'] == 45) { $myCrew *= 2; }
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
$ratio = rand() % 100;
|
||||
// 특기보정 : 반계
|
||||
if($general['special2'] == 45 && $ratio > 70) {
|
||||
$oppbatlog[] = "<C>●</><D>화계</>를 <R>역으로</> 당했다!";
|
||||
$batlog[] = "<C>●</><C>반계</>로 상대의 <D>화계</>을 되돌렸다!";
|
||||
$opCrew *= 1.8;
|
||||
} else {
|
||||
$oppbatlog[] = "<C>●</><D>화계</>를 <C>성공</>했다!";
|
||||
$batlog[] = "<C>●</><D>화계</>에 당했다!";
|
||||
$myCrew *= 1.8;
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
$ratio = rand() % 100;
|
||||
// 특기보정 : 반계
|
||||
if($general['special2'] == 45 && $ratio > 70) {
|
||||
$oppbatlog[] = "<C>●</><D>혼란</>을 <R>역으로</> 당했다!";
|
||||
$batlog[] = "<C>●</><C>반계</>로 상대의 <D>혼란</>을 되돌렸다!";
|
||||
$opCrew *= 2.0;
|
||||
} else {
|
||||
$oppbatlog[] = "<C>●</><D>혼란</>을 <C>성공</>했다!";
|
||||
$batlog[] = "<C>●</><D>혼란</>에 당했다!";
|
||||
$myCrew *= 2.0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
$type = rand() % 5; // 0~4
|
||||
switch($type) {
|
||||
case 0:
|
||||
$oppbatlog[] = "<C>●</><D>위보</>를 <R>실패</>했다!";
|
||||
$batlog[] = "<C>●</><D>위보</>를 간파했다!";
|
||||
$myCrew /= 1.1; $opCrew *= 1.1;
|
||||
break;
|
||||
case 1:
|
||||
$oppbatlog[] = "<C>●</><D>매복</>을 <R>실패</>했다!";
|
||||
$batlog[] = "<C>●</><D>매복</>을 간파했다!";
|
||||
$myCrew /= 1.2; $opCrew *= 1.2;
|
||||
break;
|
||||
case 2:
|
||||
$oppbatlog[] = "<C>●</><D>반목</>을 <R>실패</>했다!";
|
||||
$batlog[] = "<C>●</><D>반목</>을 간파했다!";
|
||||
$myCrew /= 1.3; $opCrew *= 1.3;
|
||||
break;
|
||||
case 3:
|
||||
$oppbatlog[] = "<C>●</><D>화계</>를 <R>실패</>했다!";
|
||||
$batlog[] = "<C>●</><D>화계</>를 간파했다!";
|
||||
$myCrew /= 1.4; $opCrew *= 1.4;
|
||||
break;
|
||||
case 4:
|
||||
$oppbatlog[] = "<C>●</><D>혼란</>을 <R>실패</>했다!";
|
||||
$batlog[] = "<C>●</><D>혼란</>을 간파했다!";
|
||||
$myCrew /= 1.5; $opCrew *= 1.5;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 특기보정: 돌격
|
||||
//XXX: 목우!!!!
|
||||
if($oppose['crewtype'] == 43 && $general['special2'] != 60) { // 목우
|
||||
$r = 0;
|
||||
$r += $oppose['atmos'] + $oppAtmos + $oppAtmosBonus;
|
||||
$r += $oppose['train'] + $oppTrain + $oppTrainBonus;
|
||||
$ratio = rand() % 400; // 최대 50% 저지
|
||||
if($ratio < $r && $opAvoid == 1) {
|
||||
$batlog[] = "<C>●</><R>저지</>당했다!</>";
|
||||
$oppbatlog[] = "<C>●</>상대를 <C>저지</>했다!</>";
|
||||
$opAvoid = 0;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$opCrew *= $generalCrewType->getAttackCoef($opposeCrewType);
|
||||
$myCrew *= $generalCrewType->getDefenceCoef($opposeCrewType);
|
||||
|
||||
//군주 공격 보정 10%
|
||||
if($general['level'] == 12) {
|
||||
$opCrew = $opCrew * 1.10;
|
||||
//참모, 장군 공격 보정 5%
|
||||
} elseif($general['level'] == 11 || $general['level'] == 10 || $general['level'] == 8 || $general['level'] == 6) {
|
||||
$opCrew = $opCrew * 1.05;
|
||||
}
|
||||
|
||||
//상대장수 관직 보정
|
||||
//군주 방어 보정 10%
|
||||
if($oppose['level'] == 12) {
|
||||
$opCrew = $opCrew * 0.90;
|
||||
//참모, 모사 방어 보정 5%
|
||||
} elseif($oppose['level'] == 11 || $oppose['level'] == 9 || $oppose['level'] == 7 || $oppose['level'] == 5) {
|
||||
$opCrew = $opCrew * 0.95;
|
||||
} elseif($oppose['level'] == 4 && $oppose['no'] == $city['gen1']) { // 태수 보정
|
||||
$opCrew = $opCrew * 0.95;
|
||||
} elseif($oppose['level'] == 3 && $oppose['no'] == $city['gen2']) { // 군사 보정
|
||||
$opCrew = $opCrew * 0.95;
|
||||
} elseif($oppose['level'] == 2 && $oppose['no'] == $city['gen3']) { // 시중 보정
|
||||
$opCrew = $opCrew * 0.95;
|
||||
}
|
||||
|
||||
//레벨 보정
|
||||
$myCrew = $myCrew * (max(1, 100 - $general['explevel']/3)/100);
|
||||
$opCrew = $opCrew / (max(1, 100 - $general['explevel']/3)/100);
|
||||
$myCrew = $myCrew / (max(1, 100 - $oppose['explevel']/3)/100);
|
||||
$opCrew = $opCrew * (max(1, 100 - $oppose['explevel']/3)/100);
|
||||
|
||||
// 특기보정 : 기병, 돌격, 무쌍, 보병, 견고, 척사, 의술(청낭서, 태평청령)
|
||||
if($general['special2'] == 52) { $opCrew *= 1.20; }
|
||||
if($general['special2'] == 60) { $opCrew *= 1.10; }
|
||||
if($general['special2'] == 61) { $opCrew *= 1.10; }
|
||||
if($general['special2'] == 50) { $myCrew *= 0.90; }
|
||||
if($general['special2'] == 62) { $myCrew *= 0.90; }
|
||||
if($general['special2'] == 75) {
|
||||
if($opposeCrewType->reqCities || $opposeCrewType->reqRegions)
|
||||
{
|
||||
$opCrew *= 1.1; $myCrew *= 0.9;
|
||||
}
|
||||
}
|
||||
$ratio = rand() % 100; // 0 ~ 99
|
||||
if(($general['special2'] == 73 || $general['item'] == 23 || $general['item'] == 24) && $ratio > 80 && $myAvoid == 1) {
|
||||
$batlog[] = "<C>●</><C>치료</>했다!</>";
|
||||
$myCrew /= 1.5; // 66%만 소모
|
||||
$myAvoid = 0;
|
||||
}
|
||||
|
||||
// 상대 특기보정 : 기병, 무쌍, 보병, 견고, 척사, 의술(청낭서, 태평청령)
|
||||
if($oppose['special2'] == 52) { $myCrew *= 1.10; }
|
||||
if($oppose['special2'] == 61) { $myCrew *= 1.10; }
|
||||
if($oppose['special2'] == 50) { $opCrew *= 0.80; }
|
||||
if($oppose['special2'] == 62) { $myCrew *= 1.10; }
|
||||
if($oppose['special2'] == 75) {
|
||||
if($generalCrewType->reqCities || $generalCrewType->reqRegions)
|
||||
{
|
||||
$myCrew *= 1.1; $opCrew *= 0.9;
|
||||
}
|
||||
}
|
||||
$ratio = rand() % 100; // 0 ~ 99
|
||||
if(($oppose['special2'] == 73 || $oppose['item'] == 23 || $oppose['item'] == 24) && $ratio > 80 && $opAvoid == 1) {
|
||||
$oppbatlog[] = "<C>●</><C>치료</>했다!</>";
|
||||
$opCrew /= 1.5; // 66%만 소모
|
||||
$opAvoid = 0;
|
||||
}
|
||||
|
||||
//크리
|
||||
$rd = rand() % 100; // 0 ~ 99
|
||||
$ratio = $generalCrewType->getCriticalRatio($general);
|
||||
// 특기보정 : 무쌍, 필살
|
||||
if($general['special2'] == 61) { $ratio += 10; }
|
||||
if($general['special2'] == 71) { $ratio += 20; }
|
||||
if($ratio >= $rd && $myAvoid == 1) {
|
||||
$batlog[] = "<C>●</><C>필살</>공격!</>";
|
||||
$oppbatlog[] = "<C>●</>상대의 <R>필살</>공격!</>";
|
||||
$opCrew = CriticalScore2($opCrew);
|
||||
$myAvoid = 0;
|
||||
|
||||
// 특기보정 : 격노
|
||||
if($oppose['special2'] == 74) {
|
||||
if(rand() % 100 < 50) {
|
||||
$batlog[] = "<C>●</>필살 공격에 상대가 <R>격노</>했다!</>";
|
||||
$oppbatlog[] = "<C>●</>상대의 필살 공격에 <C>격노</>했다!</>";
|
||||
$myCrew = CriticalScore2($myCrew);
|
||||
$opAvoid = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
//크리
|
||||
$rd = rand() % 100; // 0 ~ 99
|
||||
$ratio = $opposeCrewType->getCriticalRatio($oppose);
|
||||
// 특기보정 : 필살
|
||||
if($oppose['special2'] == 71) { $ratio += 20; }
|
||||
if($ratio >= $rd && $opAvoid == 1) {
|
||||
$oppbatlog[] = "<C>●</><C>필살</>공격!</>";
|
||||
$batlog[] = "<C>●</>상대의 <R>필살</>공격!</>";
|
||||
$myCrew = CriticalScore2($myCrew);
|
||||
$opAvoid = 0;
|
||||
|
||||
// 특기보정 : 격노
|
||||
if($general['special2'] == 74) {
|
||||
if(rand() % 100 < 33) {
|
||||
$oppbatlog[] = "<C>●</>필살 공격에 상대가 <R>진노</>했다!</>";
|
||||
$batlog[] = "<C>●</>상대의 필살 공격에 <C>진노</>했다!</>";
|
||||
$opCrew = CriticalScore2($opCrew);
|
||||
$myAvoid = 0;
|
||||
$warphase++;
|
||||
} elseif(rand() % 100 < 33) {
|
||||
$oppbatlog[] = "<C>●</>필살 공격에 상대가 <R>격노</>했다!</>";
|
||||
$batlog[] = "<C>●</>상대의 필살 공격에 <C>격노</>했다!</>";
|
||||
$opCrew = CriticalScore2($opCrew);
|
||||
$myAvoid = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//회피
|
||||
$ratio = rand() % 100; // 0 ~ 99
|
||||
$ratio2 = $generalCrewType->avoid; //회피율
|
||||
$ratio2 = Util::round($ratio2 * $general['train'] / 100); //훈련 반영
|
||||
//특기보정 : 돌격, 궁병
|
||||
if($oppose['special2'] == 60) { $ratio2 -= 100; }
|
||||
if($general['special2'] == 51) { $ratio2 += 20; }
|
||||
//도구 보정 : 둔갑천서, 태평요술
|
||||
if($general['item'] == 26 || $general['item'] == 25) { $ratio2 += 20; }
|
||||
LogText('avoid1', [date("Ymd_His"), $generalCrewType->id, $general['train'], $ratio2]);
|
||||
if($ratio < $ratio2 && $myAvoid == 1) {
|
||||
// 특기보정 : 격노
|
||||
if($oppose['special2'] == 74 && rand() % 100 < 50) {
|
||||
$batlog[] = "<C>●</>회피 시도에 상대가 <R>격노</>했다!</>";
|
||||
$oppbatlog[] = "<C>●</>상대의 회피 시도에 <C>격노</>했다!</>";
|
||||
$myCrew = CriticalScore2($myCrew);
|
||||
$opAvoid = 0;
|
||||
} else {
|
||||
LogText('avoid1', true);
|
||||
$batlog[] = "<C>●</><C>회피</>했다!</>";
|
||||
$oppbatlog[] = "<C>●</>상대가 <R>회피</>했다!</>";
|
||||
$myCrew /= 5; // 20%만 소모
|
||||
$myAvoid = 0;
|
||||
}
|
||||
}
|
||||
//회피
|
||||
$ratio = rand() % 100; // 0 ~ 99
|
||||
$ratio2 = $opposeCrewType->avoid; //회피율
|
||||
$ratio2 = Util::round($ratio2 * $oppose['train'] / 100); //훈련 반영
|
||||
// 특기보정 : 돌격, 궁병
|
||||
if($general['special2'] == 60) { $ratio2 -= 100; }
|
||||
if($oppose['special2'] == 51) { $ratio2 += 20; }
|
||||
//도구 보정 : 둔갑천서, 태평요술
|
||||
if($oppose['item'] == 26 || $oppose['item'] == 25) { $ratio2 += 20; }
|
||||
LogText('avoid2', [date("Ymd_His"), $opposeCrewType->id, $oppose['train'], $ratio2]);
|
||||
if($ratio < $ratio2 && $opAvoid == 1) {
|
||||
// 특기보정 : 격노
|
||||
if($general['special2'] == 74 && rand() % 100 < 33) {
|
||||
$oppbatlog[] = "<C>●</>회피 시도에 상대가 <R>진노</>했다!</>";
|
||||
$batlog[] = "<C>●</>상대의 회피 시도에 <C>진노</>했다!</>";
|
||||
$opCrew = CriticalScore2($opCrew);
|
||||
$myAvoid = 0;
|
||||
$warphase++;
|
||||
} elseif($general['special2'] == 74 && rand() % 100 < 33) {
|
||||
$oppbatlog[] = "<C>●</>회피 시도에 상대가 <R>격노</>했다!</>";
|
||||
$batlog[] = "<C>●</>상대의 회피 시도에 <C>격노</>했다!</>";
|
||||
$opCrew = CriticalScore2($opCrew);
|
||||
$myAvoid = 0;
|
||||
} else {
|
||||
LogText('avoid2', true);
|
||||
$oppbatlog[] = "<C>●</><C>회피</>했다!</>";
|
||||
$batlog[] = "<C>●</>상대가 <R>회피</>했다!</>";
|
||||
$opCrew /= 5; // 20%만 소모
|
||||
$opAvoid = 0;
|
||||
}
|
||||
}
|
||||
|
||||
//랜타추가
|
||||
$opCrew *= (rand() % 21 + 90)/100; // 90~110%
|
||||
$myCrew *= (rand() % 21 + 90)/100; // 90~110%
|
||||
|
||||
//특기보정 : 위압
|
||||
if($general['special2'] == 63 && $phase == 1 && $general['crew'] >= 1000 && $general['atmos'] >= 90 && $general['train'] >= 90) {
|
||||
$batlog[] = "<C>●</>상대에게 <C>위압</>을 줬다!</>";
|
||||
$oppbatlog[] = "<C>●</>상대에게 <R>위압</>받았다!</>";
|
||||
$myCrew = 0;
|
||||
}
|
||||
//특기보정: 위압
|
||||
if($oppose['special2'] == 63 && $phase == 1 && $oppose['crew'] >= 1000 && $oppose['atmos'] >= 90 && $oppose['train'] >= 90) {
|
||||
$batlog[] = "<C>●</>상대에게 <R>위압</>받았다!</>";
|
||||
$oppbatlog[] = "<C>●</>상대에게 <C>위압</>을 줬다!</>";
|
||||
$opCrew = 0;
|
||||
}
|
||||
|
||||
$general['crew'] -= Util::round($myCrew);
|
||||
$oppose['crew'] -= Util::round($opCrew);
|
||||
$tempMyCrew = $myCrew; $tempOpCrew = $opCrew;
|
||||
$tempGeneralCrew = $general['crew']; $tempOpposeCrew = $oppose['crew'];
|
||||
if($general['crew'] <= 0 && $oppose['crew'] <= 0) {
|
||||
$r1 = $tempGeneralCrew / $tempMyCrew;
|
||||
$r2 = $tempOpposeCrew / $tempOpCrew;
|
||||
|
||||
if($r1 > $r2) {
|
||||
$offset = Util::round($tempOpposeCrew*$tempMyCrew/$tempOpCrew);
|
||||
$myCrew += $offset;
|
||||
$general['crew'] -= $offset;
|
||||
$opCrew += $tempOpposeCrew;
|
||||
$oppose['crew'] = 0;
|
||||
} else {
|
||||
$offset = Util::round($tempGeneralCrew*$tempOpCrew/$tempMyCrew);
|
||||
$opCrew += $offset;
|
||||
$oppose['crew'] -= $offset;
|
||||
$myCrew += $tempGeneralCrew;
|
||||
$general['crew'] = 0;
|
||||
}
|
||||
} elseif($general['crew'] * $oppose['crew'] <= 0) {
|
||||
if($oppose['crew'] < 0) {
|
||||
$offset = Util::round($tempOpposeCrew*$tempMyCrew/$tempOpCrew);
|
||||
$myCrew += $offset;
|
||||
$general['crew'] -= $offset;
|
||||
$opCrew += $tempOpposeCrew;
|
||||
$oppose['crew'] = 0;
|
||||
}
|
||||
if($general['crew'] < 0) {
|
||||
$offset = Util::round($tempGeneralCrew*$tempOpCrew/$tempMyCrew);
|
||||
$opCrew += $offset;
|
||||
$oppose['crew'] -= $offset;
|
||||
$myCrew += $tempGeneralCrew;
|
||||
$general['crew'] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
$exp += $opCrew;
|
||||
$opexp += $myCrew;
|
||||
$general['crew'] = Util::round($general['crew']);
|
||||
$oppose['crew'] = Util::round($oppose['crew']);
|
||||
$myCrew = Util::round($myCrew);
|
||||
$opCrew = Util::round($opCrew);
|
||||
$batlog[] = "<C>●</> $phase : <Y1>【{$general['name']}】</> <C>{$general['crew']} (-$myCrew)</> VS <C>{$oppose['crew']} (-$opCrew)</> <Y1>【{$oppose['name']}】</>";
|
||||
$oppbatlog[] = "<C>●</> $phase : <Y1>【{$oppose['name']}】</> <C>{$oppose['crew']} (-$opCrew)</> VS <C>{$general['crew']} (-$myCrew)</> <Y1>【{$general['name']}】</>";
|
||||
|
||||
$mykillnum += $opCrew; $mydeathnum += $myCrew;
|
||||
$opkillnum += $myCrew; $opdeathnum += $opCrew;
|
||||
|
||||
// 중간 쌀 체크
|
||||
$myRice = Util::round($exp / 50);
|
||||
// 성격 보정
|
||||
$myRice = CharExperience($myRice, $general['personal']);
|
||||
// 쌀 소모
|
||||
$myRice = ($myRice * 5 * getCrewtypeRice($generalCrewType, $nation['tech']));
|
||||
// 결과 쌀
|
||||
$myRice = $general['rice'] - $myRice;
|
||||
|
||||
// 중간 쌀 체크
|
||||
$opRice = Util::round($opexp / 50 * 0.8);
|
||||
// 성격 보정
|
||||
$opRice = CharExperience($opRice, $oppose['personal']);
|
||||
// 쌀 소모
|
||||
$opRice = ($opRice * 5 * getCrewtypeRice($opposeCrewType, $destnation['tech']));
|
||||
// 결과 쌀
|
||||
$opRice = $oppose['rice'] - $opRice;
|
||||
|
||||
if($opRice <= Util::round($oppose['crew']/100)) { break; }
|
||||
if($myRice <= Util::round($general['crew']/100)) { break; }
|
||||
|
||||
if($oppose['crew'] <= 0) { break; }
|
||||
if($general['crew'] <= 0) { break; }
|
||||
}
|
||||
|
||||
$render_attacker = [
|
||||
'crewtype' => mb_substr($generalCrewType->name, 0, 2),
|
||||
'name'=> $general['name'],
|
||||
'remain_crew' => $general['crew'],
|
||||
'killed_crew' => -$mydeathnum
|
||||
];
|
||||
$render_defender = [
|
||||
'crewtype' => mb_substr($opposeCrewType->name, 0, 2),
|
||||
'name'=> $oppose['name'],
|
||||
'remain_crew' => $oppose['crew'],
|
||||
'killed_crew' => -$opdeathnum
|
||||
];
|
||||
|
||||
$res = str_replace(["\r\n", "\r", "\n"], '', $templates->render('small_war_log',[
|
||||
'year'=>$year,
|
||||
'month'=>$month,
|
||||
'war_type'=>'attack',
|
||||
'war_type_str'=>'→',
|
||||
'me' => $render_attacker,
|
||||
'you' => $render_defender,
|
||||
]));
|
||||
|
||||
$oppres = str_replace(["\r\n", "\r", "\n"], '', $templates->render('small_war_log',[
|
||||
'year'=>$year,
|
||||
'month'=>$month,
|
||||
'war_type'=>'defense',
|
||||
'war_type_str'=>'←',
|
||||
'me' => $render_defender,
|
||||
'you' => $render_attacker,
|
||||
]));
|
||||
|
||||
$log[] = $res;
|
||||
$batlog[] = $res;
|
||||
$batres[] = $res;
|
||||
$opplog[] = $oppres;
|
||||
$oppbatlog[] = $oppres;
|
||||
$oppbatres[] = $oppres;
|
||||
|
||||
$deadAmount['att'] = $deadAmount['att'] + $mydeathnum;
|
||||
$deadAmount['def'] = $deadAmount['def'] + $opdeathnum;
|
||||
|
||||
// 상대장수 부상
|
||||
$ratio = rand() % 100;
|
||||
if($ratio >= 95) {
|
||||
$opplog[] = "<C>●</>전투중 <R>부상</>당했다!";
|
||||
$oppose['injury'] += rand() % 71 + 10; // 10 ~ 80
|
||||
if($oppose['injury'] > 80) { $oppose['injury'] = 80; }
|
||||
}
|
||||
// 병사수 변경
|
||||
$query = "update general set injury='{$oppose['injury']}',crew='{$oppose['crew']}',killcrew=killcrew+'$opkillnum',deathcrew=deathcrew+'$opdeathnum' where no='{$oppose['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 숙련도 증가
|
||||
addGenDex($oppose['no'], $general['atmos'], $general['train'], $oppose['crewtype'], $opkillnum * 0.9);
|
||||
addGenDex($oppose['no'], $general['atmos'], $general['train'], $general['crewtype'], $opdeathnum * 0.9);
|
||||
// 죽은수 기술로 누적
|
||||
$num = Util::round($mydeathnum * 0.01);
|
||||
// 국가보정
|
||||
if($nation['type'] == 3 || $nation['type'] == 13) { $num *= 1.1; }
|
||||
if($nation['type'] == 5 || $nation['type'] == 6 || $nation['type'] == 7 || $nation['type'] == 8 || $nation['type'] == 12) { $num *= 0.9; }
|
||||
// 부드러운 기술 제한
|
||||
if(TechLimit($admin['startyear'], $year, $nation['tech'])) { $num = intdiv($num, 4); }
|
||||
$query = "update nation set totaltech=totaltech+'$num',tech=totaltech/'$gencount' where nation='{$nation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
// 장수 부상
|
||||
$ratio = rand() % 100;
|
||||
if($ratio >= 95) {
|
||||
$log[] = "<C>●</>전투중 <R>부상</>당했다!";
|
||||
$general['injury'] += rand() % 71 + 10; // 10 ~ 80
|
||||
if($general['injury'] > 80) { $general['injury'] = 80; }
|
||||
}
|
||||
// 병사수 변경
|
||||
$query = "update general set injury='{$general['injury']}',crew='{$general['crew']}',killcrew=killcrew+'$mykillnum',deathcrew=deathcrew+'$mydeathnum' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 숙련도 증가
|
||||
addGenDex($general['no'], $general['atmos'], $general['train'], $general['crewtype'], $mykillnum);
|
||||
addGenDex($general['no'], $general['atmos'], $general['train'], $oppose['crewtype'], $mydeathnum);
|
||||
// 죽은수 기술로 누적
|
||||
$num = Util::round($opdeathnum * 0.01);
|
||||
// 국가보정
|
||||
if($destnation['type'] == 3 || $destnation['type'] == 13) { $num *= 1.1; }
|
||||
if($destnation['type'] == 5 || $destnation['type'] == 6 || $destnation['type'] == 7 || $destnation['type'] == 8 || $destnation['type'] == 12) { $num *= 0.9; }
|
||||
// 부드러운 기술 제한
|
||||
if(TechLimit($admin['startyear'], $year, $destnation['tech'])) { $num = intdiv($num, 4); }
|
||||
$query = "update nation set totaltech=totaltech+'$num',tech=totaltech/'$destgencount' where nation='{$destnation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
//양국 평균 기술가격
|
||||
//$techRatio = (getTechCost($nation['tech']) + getTechCost($destnation['tech'])) / 2;
|
||||
$techRatio = 1.0;
|
||||
// 죽은수 도시 재정으로 누적 60%
|
||||
$num = Util::round(($mykillnum+$mydeathnum) * 0.6 * $techRatio);
|
||||
// 국가보정
|
||||
if($destnation['type'] == 1) { $num *= 1.1; }
|
||||
if($destnation['type'] == 9 || $destnation['type'] == 10) { $num *= 0.9; }
|
||||
$query = "update city set dead=dead+'$num' where city='{$city['city']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 죽은수 도시 재정으로 누적 40%
|
||||
$num = Util::round(($mykillnum+$mydeathnum) * 0.4 * $techRatio);
|
||||
// 국가보정
|
||||
if($nation['type'] == 1) { $num *= 1.1; }
|
||||
if($nation['type'] == 9 || $nation['type'] == 10) { $num *= 0.9; }
|
||||
$query = "update city set dead=dead+'$num' where city='{$general['city']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
// 상대 병사 소진이나 쌀 소진시 다음 장수
|
||||
if($oppose['crew'] <= 0 || ($opRice <= Util::round($oppose['crew']/100) && $general['crew'] > 0)) {
|
||||
if($opRice <= Util::round($oppose['crew']/100)) {
|
||||
$josaYi = JosaUtil::pick($opposeCrewType->name, '이');
|
||||
$alllog[] = "<C>●</>{$month}월:<Y>{$oppose['name']}</>의 {$opposeCrewType->name}{$josaYi} 패퇴했습니다.";
|
||||
$log[] = "<C>●</><Y>{$oppose['name']}</>의 {$opposeCrewType->name}{$josaYi} 패퇴했습니다.";
|
||||
$opplog[] = "<C>●</>군량 부족으로 패퇴합니다.";
|
||||
} else {
|
||||
$josaYi = JosaUtil::pick($opposeCrewType->name, '이');
|
||||
$alllog[] = "<C>●</>{$month}월:<Y>{$oppose['name']}</>의 {$opposeCrewType->name}{$josaYi} 전멸했습니다.";
|
||||
$log[] = "<C>●</><Y>{$oppose['name']}</>의 {$opposeCrewType->name}{$josaYi} 전멸했습니다.";
|
||||
$opplog[] = "<C>●</>전멸했습니다.";
|
||||
}
|
||||
$opposecount--;
|
||||
|
||||
$general['atmos'] *= 1.1; //사기 증가
|
||||
if($general['atmos'] > GameConst::$maxAtmosByWar) { $general['atmos'] = GameConst::$maxAtmosByWar; }
|
||||
|
||||
$query = "update general set atmos='{$general['atmos']}',killnum=killnum+1 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$exp2++;
|
||||
// 상대장수 경험 등등 증가
|
||||
$opexp = Util::round($opexp / 50 * 0.8);
|
||||
// 성격 보정
|
||||
$opexp = CharExperience($opexp, $oppose['personal']);
|
||||
// 쌀 소모
|
||||
$oppose['rice'] -= ($opexp * 5 * getCrewtypeRice($opposeCrewType, $destnation['tech']));
|
||||
if($oppose['rice'] < 0) { $oppose['rice'] = 0; }
|
||||
|
||||
$query = "update general set deathnum=deathnum+1,rice='{$oppose['rice']}',experience=experience+'$opexp',dedication=dedication+'$opexp' where no='{$oppose['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$opexp = 0;
|
||||
|
||||
pushGenLog($oppose, $opplog);
|
||||
pushBatLog($oppose, $oppbatlog);
|
||||
pushBatRes($oppose, $oppbatres);
|
||||
$oppose = null;
|
||||
$opplog = [];
|
||||
$oppbatlog = [];
|
||||
$oppbatres = [];
|
||||
// 공격 장수 병사 소진이나 쌀 소진시 실패 처리
|
||||
} elseif($general['crew'] <= 0 || $myRice <= Util::round($general['crew']/100)) {
|
||||
if($myRice <= Util::round($general['crew']/100)) {
|
||||
$josaYi = JosaUtil::pick($generalCrewType->name, '이');
|
||||
$alllog[] = "<C>●</>{$month}월:<Y>{$general['name']}</>의 {$generalCrewType->name}{$josaYi} 퇴각했습니다.";
|
||||
$log[] = "<C>●</>군량 부족으로 퇴각합니다.";
|
||||
$opplog[] = "<C>●</><Y>{$general['name']}</>의 {$generalCrewType->name}{$josaYi} 퇴각했습니다.";
|
||||
} else {
|
||||
$josaYi = JosaUtil::pick($generalCrewType->name, '이');
|
||||
$alllog[] = "<C>●</>{$month}월:<Y>{$general['name']}</>의 {$generalCrewType->name}{$josaYi} 퇴각했습니다.";
|
||||
$log[] = "<C>●</>퇴각했습니다.";
|
||||
$opplog[] = "<C>●</><Y>{$general['name']}</>의 {$generalCrewType->name}{$josaYi} 퇴각했습니다.";
|
||||
}
|
||||
|
||||
// 경험치 상승
|
||||
if($opposeCrewType->armType == GameUnitConst::T_WIZARD) { // 귀병
|
||||
$oppose['intel2']++;
|
||||
} elseif($opposeCrewType->armType == GameUnitConst::T_SIEGE) { // 차병
|
||||
$oppose['leader2']++;
|
||||
} else {
|
||||
$oppose['power2']++;
|
||||
}
|
||||
|
||||
$oppose['atmos'] *= 1.1; //사기 증가
|
||||
if($oppose['atmos'] > GameConst::$maxAtmosByWar) { $oppose['atmos'] = GameConst::$maxAtmosByWar; }
|
||||
|
||||
// 상대장수 경험 등등 증가
|
||||
$opexp = Util::round($opexp / 50 * 0.8);
|
||||
// 성격 보정
|
||||
$opexp = CharExperience($opexp, $oppose['personal']);
|
||||
// 쌀 소모
|
||||
$oppose['rice'] -= ($opexp * 5 * getCrewtypeRice($opposeCrewType, $destnation['tech']));
|
||||
if($oppose['rice'] < 0) { $oppose['rice'] = 0; }
|
||||
|
||||
$query = "update general set rice='{$oppose['rice']}',leader2='{$oppose['leader2']}',power2='{$oppose['power2']}',intel2='{$oppose['intel2']}',atmos='{$oppose['atmos']}',experience=experience+'$opexp',dedication=dedication+'$opexp',killnum=killnum+1 where no='{$oppose['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$query = "update general set deathnum=deathnum+1 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$opexp = 0;
|
||||
|
||||
$opplog = checkAbility($oppose, $opplog);
|
||||
pushGenLog($oppose, $opplog);
|
||||
pushBatLog($oppose, $oppbatlog);
|
||||
pushBatRes($oppose, $oppbatres);
|
||||
$opplog = [];
|
||||
$oppbatlog = [];
|
||||
$oppbatres = [];
|
||||
// $josaYi = JosaUtil::pick($general['name'], '이');
|
||||
// $alllog[] = "<C>●</>{$month}월:<Y>{$general['name']}</>{$josaYi} }<G>{$city['name']}</> 공략에 실패했습니다. <1>$date</>";
|
||||
// $log[] = "<C>●</> <G>{$city['name']}</> 공략에 실패했습니다. <1>$date</>";
|
||||
break;
|
||||
} else {
|
||||
// 무승부일때 로그 남김
|
||||
pushGenLog($oppose, $opplog);
|
||||
pushBatLog($oppose, $oppbatlog);
|
||||
pushBatRes($oppose, $oppbatres);
|
||||
$opplog = [];
|
||||
$oppbatlog = [];
|
||||
$oppbatres = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(isset($oppose)){
|
||||
//마지막 페이즈에 장수가 전멸하지 않은 경우. 쌀 소모 후속 처리
|
||||
|
||||
// 상대장수 경험 등등 증가(페이즈 초과시)
|
||||
$opexp = Util::round($opexp / 50 * 0.8);
|
||||
// 성격 보정
|
||||
$opexp = CharExperience($opexp, $oppose['personal']);
|
||||
// 쌀 소모
|
||||
$oppose['rice'] -= ($opexp * 5 * getCrewtypeRice($opposeCrewType, $destnation['tech']));
|
||||
if($oppose['rice'] < 0) { $oppose['rice'] = 0; }
|
||||
|
||||
$query = "update general set rice='{$oppose['rice']}',experience=experience+'$opexp',dedication=dedication+'$opexp' where no='{$oppose['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
|
||||
// 경험치 상승
|
||||
if($generalCrewType->armType == GameUnitConst::T_WIZARD) { // 귀병
|
||||
$general['intel2'] += $exp2;
|
||||
} elseif($generalCrewType->armType == GameUnitConst::T_SIEGE) { // 차병
|
||||
$general['leader2'] += $exp2;
|
||||
} else {
|
||||
$general['power2'] += $exp2;
|
||||
}
|
||||
$query = "update general set leader2='{$general['leader2']}',power2='{$general['power2']}',intel2='{$general['intel2']}' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
// 공헌, 명성 상승
|
||||
$exp = Util::round($exp / 50);
|
||||
// 성격 보정
|
||||
$exp = CharExperience($exp, $general['personal']);
|
||||
// 쌀 소모
|
||||
$general['rice'] -= ($exp * 5 * getCrewtypeRice($generalCrewType, $nation['tech']));
|
||||
if($general['rice'] < 0) { $general['rice'] = 0; }
|
||||
|
||||
$query = "update general set rice='{$general['rice']}',dedication=dedication+'$exp',experience=experience+'$exp' where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$log = checkAbility($general, $log);
|
||||
pushGenLog($general, $log);
|
||||
pushBatLog($general, $batlog);
|
||||
pushBatRes($general, $batres);
|
||||
pushGeneralPublicRecord($alllog, $year, $month);
|
||||
pushWorldHistory($history);
|
||||
|
||||
return $deadAmount;
|
||||
}
|
||||
|
||||
function CriticalScore2($score) {
|
||||
$score = Util::round($score * (rand()%8 + 13)/10); // 1.3~2.0
|
||||
return $score;
|
||||
}
|
||||
|
||||
//0 0 : 100 100 이면 최고 무한대 차이
|
||||
//30 30 : 100 100 이면 최고 3.3배 차이
|
||||
//60 60 : 100 100 이면 최고 1.6배 차이
|
||||
function getCrew($crew, $youatmos, $mytrain) {
|
||||
$ratio = $youatmos / $mytrain;
|
||||
$crew = $crew * $ratio;
|
||||
|
||||
return $crew;
|
||||
}
|
||||
|
||||
function getCrewtypeRice($crewtype, $tech) {
|
||||
$cost = $crewtype->rice / 10;
|
||||
return $cost * getTechCost($tech);
|
||||
}
|
||||
|
||||
//////////////////////////////////////////////////////////////
|
||||
// 표준 공 / 수 반환 수치는 약 0이 되게 (100~550)
|
||||
//////////////////////////////////////////////////////////////
|
||||
|
||||
function addConflict($city, $nationID, $mykillnum) {
|
||||
$db = DB::db();
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
|
||||
$nationlist = [];
|
||||
$killnum = [0];
|
||||
|
||||
list($year, $month) = $gameStor->getValuesAsArray(['year', 'month']);
|
||||
|
||||
$conflict = Json::decode($city['conflict']);
|
||||
|
||||
if(!$conflict || $city['def'] == 0){ // 선타, 막타 보너스
|
||||
$mykillnum *= 1.05;
|
||||
}
|
||||
|
||||
if (!$conflict) {
|
||||
$conflict[$nationID] = $mykillnum;
|
||||
}
|
||||
else if(key_exists($nationID, $conflict)){
|
||||
$conflict[$nationID] += $mykillnum;
|
||||
arsort($conflict);
|
||||
}
|
||||
else{
|
||||
$conflict[$nationID] = $mykillnum;
|
||||
arsort($conflict);
|
||||
|
||||
$nation = getNationStaticInfo($nationID);
|
||||
$josaYi = JosaUtil::pick($nation['name'], '이');
|
||||
pushWorldHistory(["<C>●</>{$year}년 {$month}월:<M><b>【분쟁】</b></><D><b>{$nation['name']}</b></>{$josaYi} <G><b>{$city['name']}</b></> 공략에 가담하여 분쟁이 발생하고 있습니다."]);
|
||||
}
|
||||
|
||||
$rawConflict = Json::encode($conflict);
|
||||
$city['conflict'] = $rawConflict;
|
||||
|
||||
$db->update('city', [
|
||||
'conflict'=>$rawConflict
|
||||
], 'city=%i',$city['city']);
|
||||
|
||||
return $city;
|
||||
}
|
||||
|
||||
function DeleteConflict($nation) {
|
||||
$db = DB::db();
|
||||
|
||||
foreach($db->queryAllLists('SELECT city, conflict FROM city WHERE conflict!=%s', '{}') as list($cityID, $rawConflict)){
|
||||
$conflict = Json::decode($rawConflict);
|
||||
|
||||
if(!$conflict || !is_array($conflict)){
|
||||
continue;
|
||||
}
|
||||
if(!key_exists($nation, $conflict)){
|
||||
continue;
|
||||
}
|
||||
|
||||
unset($conflict[$nation]);
|
||||
|
||||
$db->update('city', [
|
||||
'conflict'=>Json::encode($conflict)
|
||||
], 'city=%i', $cityID);
|
||||
}
|
||||
}
|
||||
|
||||
function getConquerNation($city) : int {
|
||||
$conflict = Json::decode($city['conflict']);
|
||||
return Util::array_first_key($conflict);
|
||||
}
|
||||
|
||||
function ConquerCity($admin, $general, $city, $nation, $destnation) {
|
||||
'@phan-var array<string,mixed> $city';
|
||||
$db = DB::db();
|
||||
$connect=$db->get();
|
||||
|
||||
$alllog = [];
|
||||
$log = [];
|
||||
$history = [];
|
||||
|
||||
if($destnation['nation'] > 0) {
|
||||
$destnationName = "<D><b>{$destnation['name']}</b></>의";
|
||||
} else {
|
||||
$destnationName = "공백지인";
|
||||
}
|
||||
|
||||
$year = $admin['year'];
|
||||
$month = $admin['month'];
|
||||
|
||||
$josaUl = JosaUtil::pick($city['name'], '을');
|
||||
$josaYiNation = JosaUtil::pick($nation['name'], '이');
|
||||
$josaYiGen = JosaUtil::pick($general['name'], '이');
|
||||
$josaYiCity = JosaUtil::pick($city['name'], '이');
|
||||
$alllog[] = "<C>●</>{$month}월:<Y>{$general['name']}</>{$josaYiGen} <G><b>{$city['name']}</b></> 공략에 <S>성공</>했습니다.";
|
||||
$log[] = "<C>●</><G><b>{$city['name']}</b></> 공략에 <S>성공</>했습니다.";
|
||||
$history[] = "<C>●</>{$year}년 {$month}월:<S><b>【지배】</b></><D><b>{$nation['name']}</b></>{$josaYiNation} <G><b>{$city['name']}</b></>{$josaUl} 지배했습니다.";
|
||||
pushGeneralHistory($general, "<C>●</>{$year}년 {$month}월:<G><b>{$city['name']}</b></>{$josaUl} <S>함락</>시킴");
|
||||
pushNationHistory($nation, "<C>●</>{$year}년 {$month}월:<Y>{$general['name']}</>{$josaYiGen} {$destnationName} <G><b>{$city['name']}</b></>{$josaUl} <S>점령</>");
|
||||
pushNationHistory($destnation, "<C>●</>{$year}년 {$month}월:<D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>에 의해 <G><b>{$city['name']}</b></>{$josaYiCity} <span class='ev_highlight'>함락</span>");
|
||||
|
||||
$query = "select city from city where nation='{$city['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$citycount = MYDB_num_rows($result);
|
||||
|
||||
// 국가 멸망시
|
||||
//TODO: 국가 멸망 코드를 별도로 작성
|
||||
if($citycount == 1 && $city['nation'] != 0) {
|
||||
$query = "select nation,name,gold,rice from nation where nation='{$city['nation']}'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$losenation = MYDB_fetch_array($result);
|
||||
|
||||
$josaYi = JosaUtil::pick($losenation['name'], '이');
|
||||
$josaUl = JosaUtil::pick($losenation['name'], '을');
|
||||
$history[] = "<C>●</>{$year}년 {$month}월:<R><b>【멸망】</b></><D><b>{$losenation['name']}</b></>{$josaYi} 멸망하였습니다.";
|
||||
pushNationHistory($nation, "<C>●</>{$year}년 {$month}월:<D><b>{$losenation['name']}</b></>{$josaUl} 정복");
|
||||
|
||||
$query = "select no, nation from general where nation='{$general['nation']}' and level='12'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$ruler = MYDB_fetch_array($result);
|
||||
|
||||
//다굴치는 나라들 전방설정을 위해 미리 얻어옴
|
||||
$query = "select you from diplomacy where me='{$losenation['nation']}' and state<2";
|
||||
$dipResult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$dipCount = MYDB_num_rows($dipResult);
|
||||
|
||||
$loseGeneralGold = 0;
|
||||
$loseGeneralRice = 0;
|
||||
//멸망국 장수들 역사 기록 및 로그 전달
|
||||
$josaYi = JosaUtil::pick($losenation['name'], '이');
|
||||
$genlog = ["<C>●</><D><b>{$losenation['name']}</b></>{$josaYi} <R>멸망</>했습니다."];
|
||||
|
||||
|
||||
// 국가 백업
|
||||
$oldNation = $db->queryFirstRow('SELECT * FROM nation WHERE nation=%i', $city['nation']);
|
||||
$oldNationGenerals = $db->query('SELECT * FROM general WHERE nation=%i', $city['nation']);
|
||||
$oldNation['generals'] = array_map(function($gen){
|
||||
//다른 코드와는 다르게 공용으로 쓰므로 남겨둠
|
||||
return $gen['no'];
|
||||
}, $oldNationGenerals);
|
||||
$oldNation['aux'] = Json::decode($oldNation['aux']);
|
||||
|
||||
foreach($oldNationGenerals as $gen){
|
||||
|
||||
$loseGold = intdiv($gen['gold'] * (rand()%30+20), 100);
|
||||
$loseRice = intdiv($gen['rice'] * (rand()%30+20), 100);
|
||||
$genlog[1] = "<C>●</>도주하며 금<C>$loseGold</> 쌀<C>$loseRice</>을 분실했습니다.";
|
||||
|
||||
$query = "update general set gold=gold-{$loseGold},rice=rice-{$loseRice} where no={$gen['no']}";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
pushGenLog($gen, $genlog);
|
||||
|
||||
pushGeneralHistory($gen, "<C>●</>{$year}년 {$month}월:<D><b>{$losenation['name']}</b></>{$josaYi} <R>멸망</>");
|
||||
pushOldNationStop($gen['no'], $city['nation']);
|
||||
|
||||
$loseGeneralGold += $loseGold;
|
||||
$loseGeneralRice += $loseRice;
|
||||
|
||||
//모두 등용장 발부
|
||||
if($nation['name'] == "강족" || $nation['name'] == "저족" || $nation['name'] == "흉노족"
|
||||
|| $nation['name'] == "남만족" || $nation['name'] == "산월족" || $nation['name'] == "오환족"
|
||||
|| $nation['name'] == "왜족") {
|
||||
//등용장 미발부
|
||||
} elseif(Util::randBool(0.5)) {
|
||||
$msg = ScoutMessage::buildScoutMessage($general['no'], $gen['no']);
|
||||
if($msg){
|
||||
$msg->send(true);
|
||||
}
|
||||
}
|
||||
|
||||
//NPC인 경우 10% 확률로 임관(엔장, 인재, 의병)
|
||||
if($gen['npc'] >= 2 && $gen['npc'] <= 8 && rand() % 100 < 10) {
|
||||
$commissionCommand = EncodeCommand(0, 0, $nation['nation'], 25); //임관
|
||||
$query = "update general set turn0='$commissionCommand' where no={$gen['no']}";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
}
|
||||
unset($genlog[1]);
|
||||
|
||||
// 승전국 보상
|
||||
$losenation['gold'] -= GameConst::$basegold;
|
||||
$losenation['rice'] -= GameConst::$baserice;
|
||||
if($losenation['gold'] < 0) { $losenation['gold'] = 0; }
|
||||
if($losenation['rice'] < 0) { $losenation['rice'] = 0; }
|
||||
|
||||
$losenation['gold'] += $loseGeneralGold;
|
||||
$losenation['rice'] += $loseGeneralRice;
|
||||
|
||||
$losenation['gold'] = intdiv($losenation['gold'], 2);
|
||||
$losenation['rice'] = intdiv($losenation['gold'], 2);
|
||||
|
||||
// 기본량 제외 금쌀50% + 장수들 분실 금쌀50% 흡수
|
||||
$query = "update nation set gold=gold+'{$losenation['gold']}',rice=rice+'{$losenation['rice']}' where nation='{$general['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
//아국 수뇌부에게 로그 전달
|
||||
$query = "select no,name,nation from general where nation='{$general['nation']}' and level>='9'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($result);
|
||||
$genlog[0] = "<C>●</><D><b>{$losenation['name']}</b></> 정복으로 금<C>{$losenation['gold']}</> 쌀<C>{$losenation['rice']}</>을 획득했습니다.";
|
||||
for($i=0; $i < $gencount; $i++) {
|
||||
$gen = MYDB_fetch_array($result);
|
||||
pushGenLog($gen, $genlog);
|
||||
}
|
||||
|
||||
|
||||
//분쟁기록 모두 지움
|
||||
DeleteConflict($city['nation']);
|
||||
// 전 장수 공헌 명성치 깎음
|
||||
$query = "update general set dedication=dedication*0.5,experience=experience*0.9 where nation='{$city['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 전 도시 공백지로
|
||||
$query = "update city set nation='0',gen1='0',gen2='0',gen3='0',conflict='{}',term=0 where nation='{$city['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 전 장수 소속 무소속으로, 재야로, 부대 탈퇴
|
||||
$query = "update general set nation='0',belong='0',level='0',troop='0' where nation='{$city['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 부대도 삭제
|
||||
$query = "delete from troop where nation='{$city['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 외교 삭제
|
||||
$query = "delete from diplomacy where me='{$city['nation']}' or you='{$city['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$db->insert('ng_old_nations', [
|
||||
'server_id'=>UniqueConst::$serverID,
|
||||
'nation'=>$city['nation'],
|
||||
'data'=>Json::encode($oldNation)
|
||||
]);
|
||||
// 국가 삭제
|
||||
$query = "delete from nation where nation='{$city['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 아까 얻어온 다굴국들 전방설정
|
||||
for($i=0; $i < $dipCount; $i++) {
|
||||
$dip = MYDB_fetch_array($dipResult);
|
||||
//전방설정
|
||||
SetNationFront($dip['you']);
|
||||
}
|
||||
// 멸망이 아니면
|
||||
} else {
|
||||
// 태수,군사,시중은 일반으로...
|
||||
$db->update('general',[
|
||||
'level'=>1
|
||||
], 'no IN %li',[$city['gen1'], $city['gen2'], $city['gen3']]);
|
||||
|
||||
//수도였으면 긴급 천도
|
||||
if(isset($destnation['capital']) && $destnation['capital'] == $city['city']) {
|
||||
$minCity = findNextCapital($city['city'], $destnation['nation']);
|
||||
|
||||
$minCityName = CityConst::byID($minCity)->name;
|
||||
|
||||
$josaYi = JosaUtil::pick($destnation['name'], '이');
|
||||
$history[] = "<C>●</>{$year}년 {$month}월:<M><b>【긴급천도】</b></><D><b>{$destnation['name']}</b></>{$josaYi} 수도가 함락되어 <G><b>$minCityName</b></>으로 긴급천도하였습니다.";
|
||||
|
||||
//아국 수뇌부에게 로그 전달
|
||||
$query = "select no,name,nation from general where nation='{$destnation['nation']}' and level>='5'";
|
||||
$result = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$gencount = MYDB_num_rows($result);
|
||||
$genlog = ["<C>●</>수도가 함락되어 <G><b>$minCityName</b></>으로 <M>긴급천도</>합니다."];
|
||||
for($i=0; $i < $gencount; $i++) {
|
||||
$gen = MYDB_fetch_array($result);
|
||||
pushGenLog($gen, $genlog);
|
||||
}
|
||||
//천도
|
||||
$query = "update nation set capital='$minCity',gold=gold*0.5,rice=rice*0.5 where nation='{$destnation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
//보급도시로 만듬
|
||||
$query = "update city set supply=1 where city='$minCity'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
//수뇌부 이동
|
||||
$query = "update general set city='$minCity' where nation='{$destnation['nation']}' and level>='5'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
//장수 사기 감소
|
||||
$query = "update general set atmos=atmos*0.8 where nation='{$destnation['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
refreshNationStaticInfo();
|
||||
}
|
||||
}
|
||||
|
||||
$general['atmos'] *= 1.1; //사기 증가
|
||||
if($general['atmos'] > GameConst::$maxAtmosByWar) { $general['atmos'] = GameConst::$maxAtmosByWar; }
|
||||
|
||||
$conquerNation = getConquerNation($city);
|
||||
|
||||
if($conquerNation == $general['nation']) {
|
||||
// 이동 및 사기 변경
|
||||
$query = "update general set city='{$city['city']}',atmos='{$general['atmos']}',killnum=killnum+1 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
if($city['level'] > 3) {
|
||||
// 도시 소속 변경, 태수,군사,시중 초기화
|
||||
$query = "update city set supply=1,conflict='{}',term=0,agri=agri*0.7,comm=comm*0.7,secu=secu*0.7,def=1000,wall=1000,nation='{$general['nation']}',gen1=0,gen2=0,gen3=0 where city='{$city['city']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
} else {
|
||||
// 도시 소속 변경, 태수,군사,시중 초기화
|
||||
$query = "update city set supply=1,conflict='{}',term=0,agri=agri*0.7,comm=comm*0.7,secu=secu*0.7,def=def2/2,wall=wall2/2,nation='{$general['nation']}',gen1=0,gen2=0,gen3=0 where city='{$city['city']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
}
|
||||
//전방설정
|
||||
SetNationFront($nation['nation']);
|
||||
SetNationFront($destnation['nation']);
|
||||
} else {
|
||||
$query = "select name,nation from nation where nation='$conquerNation'";
|
||||
$conquerResult = MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
$conquerNationArray = MYDB_fetch_array($conquerResult);
|
||||
|
||||
|
||||
|
||||
$josaUl = JosaUtil::pick($city['name'], '을');
|
||||
$josaYi = JosaUtil::pick($conquerNationArray['name'], '이');
|
||||
$history[] = "<C>●</>{$year}년 {$month}월:<Y><b>【분쟁협상】</b></><D><b>{$conquerNationArray['name']}</b></>{$josaYi} 영토분쟁에서 우위를 점하여 <G><b>{$city['name']}</b></>{$josaUl} 양도받았습니다.";
|
||||
pushNationHistory($nation, "<C>●</>{$year}년 {$month}월:<G><b>{$city['name']}</b></>{$josaUl} <D><b>{$conquerNationArray['name']}</b></>에 <Y>양도</>");
|
||||
pushNationHistory($conquerNationArray, "<C>●</>{$year}년 {$month}월:<D><b>{$nation['name']}</b></>에서 <G><b>{$city['name']}</b></>{$josaUl} <S>양도</> 받음");
|
||||
// 이동X 및 사기 변경
|
||||
$query = "update general set atmos='{$general['atmos']}',killnum=killnum+1 where no='{$general['no']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
|
||||
$query = [
|
||||
'supply'=>1,
|
||||
'term'=>0,
|
||||
'conflict'=>'{}',
|
||||
'agri'=>$db->sqleval('agri*0.7'),
|
||||
'comm'=>$db->sqleval('comm*0.7'),
|
||||
'secu'=>$db->sqleval('secu*0.7'),
|
||||
'nation'=>$conquerNation,
|
||||
'gen1'=>0,
|
||||
'gen2'=>0,
|
||||
'gen3'=>0
|
||||
];
|
||||
if($city['level'] > 3) {
|
||||
$query['def'] = 1000;
|
||||
$query['wall'] = 1000;
|
||||
} else {
|
||||
// 도시 소속 변경, 태수,군사,시중 초기화
|
||||
$query['def'] = $db->sqleval('def2/2');
|
||||
$query['wall'] = $db->sqleval('wall2/2');
|
||||
}
|
||||
$db->update('city', $query, 'city=%i', (int)$city['city']);
|
||||
//전방설정
|
||||
SetNationFront($destnation['nation']);
|
||||
SetNationFront($conquerNation);
|
||||
}
|
||||
|
||||
pushGenLog($general, $log);
|
||||
pushGeneralPublicRecord($alllog, $year, $month);
|
||||
pushWorldHistory($history);
|
||||
}
|
||||
|
||||
function findNextCapital(int $capitalID, int $nationID):int{
|
||||
$distList = searchDistance($capitalID, 99, true);
|
||||
|
||||
$cities = [];
|
||||
foreach(
|
||||
DB::db()->query(
|
||||
'SELECT city, pop FROM city WHERE nation=%i and city!=%i',
|
||||
$nationID,
|
||||
$capitalID
|
||||
) as $row
|
||||
){
|
||||
$cities[$row['city']] = $row['pop'];
|
||||
};
|
||||
|
||||
|
||||
|
||||
foreach($distList as $dist=>$distSubList){
|
||||
$maxCityPop = 0;
|
||||
$minCity = 0;
|
||||
|
||||
foreach($distSubList as $cityID){
|
||||
if(!key_exists($cityID, $cities)){
|
||||
continue;
|
||||
}
|
||||
$cityPop = $cities[$cityID];
|
||||
|
||||
if($cityPop < $maxCityPop){
|
||||
continue;
|
||||
}
|
||||
$minCity = $cityID;
|
||||
$maxCityPop = $cityPop;
|
||||
}
|
||||
|
||||
if($minCity){
|
||||
return $minCity;
|
||||
}
|
||||
}
|
||||
throw new \RuntimeException('도시가 남지 않았는데 긴천을 시도하고 있습니다');
|
||||
}
|
||||
+85
-35
@@ -31,7 +31,7 @@ function processWar(array $rawAttacker, array $rawDefenderCity){
|
||||
}
|
||||
|
||||
$gameStor = KVStorage::getStorage($db, 'game_env');
|
||||
[$startYear, $year, $month, $cityRate] = $gameStor->getValuesAsArray(['startyear', 'year', 'month', 'city_rate']);
|
||||
[$startYear, $year, $month, $cityRate, $joinMode] = $gameStor->getValuesAsArray(['startyear', 'year', 'month', 'city_rate', 'join_mode']);
|
||||
|
||||
$attacker = new WarUnitGeneral($rawAttacker, $rawAttackerCity, $rawAttackerNation, true, $year, $month);
|
||||
|
||||
@@ -111,6 +111,30 @@ function processWar(array $rawAttacker, array $rawDefenderCity){
|
||||
$attackerIncTech = $attacker->getDead() * 0.01 * getNationTechMultiplier($rawAttackerNation['type']);
|
||||
$defenderIncTech = $attacker->getKilled() * 0.01 * getNationTechMultiplier($rawDefenderNation['type']);
|
||||
|
||||
$attackerGenCnt = $rawAttackerNation['gennum'];
|
||||
$defenderGenCnt = $rawDefenderNation['gennum'];
|
||||
$attackerGenCnt_eff = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND npc != 5', $rawAttackerNation['nation']);
|
||||
$defenderGenCnt_eff = $db->queryFirstField('SELECT count(no) FROM general WHERE nation=%i AND npc != 5', $rawDefenderNation['nation']);
|
||||
|
||||
if($attackerGenCnt_eff < GameConst::$initialNationGenLimit){
|
||||
$attackerGenCnt = GameConst::$initialNationGenLimit;
|
||||
$attackerGenCnt_eff = GameConst::$initialNationGenLimit;
|
||||
}
|
||||
|
||||
if($defenderGenCnt_eff < GameConst::$initialNationGenLimit){
|
||||
$defenderGenCnt = GameConst::$initialNationGenLimit;
|
||||
$defenderGenCnt_eff = GameConst::$initialNationGenLimit;
|
||||
}
|
||||
|
||||
if($attackerGenCnt != $attackerGenCnt_eff){
|
||||
$attackerIncTech *= $attackerGenCnt / $attackerGenCnt_eff;
|
||||
}
|
||||
|
||||
if($defenderGenCnt != $defenderGenCnt_eff){
|
||||
$defenderIncTech *= $defenderGenCnt / $defenderGenCnt_eff;
|
||||
}
|
||||
|
||||
|
||||
if(TechLimit($startYear, $year, $rawAttackerNation['tech'])){
|
||||
$attackerIncTech /= 4;
|
||||
}
|
||||
@@ -124,8 +148,8 @@ function processWar(array $rawAttacker, array $rawDefenderCity){
|
||||
$updateAttackerNation['totaltech'] = Util::round($attackerTotalTech);
|
||||
$updateDefenderNation['totaltech'] = Util::round($defenderTotalTech);
|
||||
|
||||
$updateAttackerNation['tech'] = Util::round($attackerTotalTech / max(GameConst::$initialNationGenLimit, $rawAttackerNation['gennum']));
|
||||
$updateDefenderNation['tech'] = Util::round($defenderTotalTech / max(GameConst::$initialNationGenLimit, $rawDefenderNation['gennum']));
|
||||
$updateAttackerNation['tech'] = Util::round($attackerTotalTech / $attackerGenCnt);
|
||||
$updateDefenderNation['tech'] = Util::round($defenderTotalTech / $defenderGenCnt);
|
||||
|
||||
$db->update('nation', $updateAttackerNation, 'nation=%i', $attackerNationID);
|
||||
$db->update('nation', $updateDefenderNation, 'nation=%i', $defenderNationID);
|
||||
@@ -154,7 +178,8 @@ function processWar(array $rawAttacker, array $rawDefenderCity){
|
||||
'startyear'=>$startYear,
|
||||
'year'=>$year,
|
||||
'month'=>$month,
|
||||
'city_rate'=>$cityRate
|
||||
'city_rate'=>$cityRate,
|
||||
'join_mode'=>$joinMode,
|
||||
], $attacker->getRaw(), $city->getRaw(), $rawAttackerNation, $rawDefenderNation);
|
||||
}
|
||||
|
||||
@@ -179,15 +204,21 @@ function extractBattleOrder($general){
|
||||
return 0;
|
||||
}
|
||||
|
||||
return (
|
||||
$general['leader'] +
|
||||
$general['power'] +
|
||||
$general['intel'] +
|
||||
$general['weap'] +
|
||||
$general['horse'] +
|
||||
$general['book'] +
|
||||
$general['crew'] / 100
|
||||
);
|
||||
$staticNation = getNationStaticInfo($general['nation']);
|
||||
setLeadershipBonus($general, $staticNation['level']);
|
||||
|
||||
$realStat =
|
||||
getGeneralLeadership($general, true, true, true, true) +
|
||||
getGeneralPower($general, true, true, true, true) +
|
||||
getGeneralIntel($general, true, true, true, true);
|
||||
$fullStat =
|
||||
getGeneralLeadership($general, false, true, true, true) +
|
||||
getGeneralPower($general, false, true, true, true) +
|
||||
getGeneralIntel($general, false, true, true, true);
|
||||
$totalStat = ($realStat + $fullStat) / 2;
|
||||
|
||||
$totalCrew = $general['crew'] / 10000 * $general['train'] * $general['atmos'];
|
||||
return $totalStat + $totalCrew / 100;
|
||||
}
|
||||
|
||||
function processWar_NG(
|
||||
@@ -270,8 +301,12 @@ function processWar_NG(
|
||||
$attacker->setOppose($defender);
|
||||
$defender->setOppose($attacker);
|
||||
|
||||
$attacker->checkBattleBeginSkill();
|
||||
$defender->checkBattleBeginSkill();
|
||||
foreach(Util::zip(
|
||||
$attacker->checkBattleBeginSkill(),
|
||||
$defender->checkBattleBeginSkill()
|
||||
) as $b){
|
||||
//doNothing
|
||||
}
|
||||
|
||||
$attacker->checkBattleBeginItem();
|
||||
$defender->checkBattleBeginItem();
|
||||
@@ -283,21 +318,33 @@ function processWar_NG(
|
||||
$attacker->beginPhase();
|
||||
$defender->beginPhase();
|
||||
|
||||
$attacker->checkPreActiveSkill();
|
||||
$defender->checkPreActiveSkill();
|
||||
foreach(Util::zip(
|
||||
$attacker->checkPreActiveSkill(),
|
||||
$defender->checkPreActiveSkill()
|
||||
) as $b){
|
||||
//doNothing
|
||||
}
|
||||
|
||||
$attacker->checkActiveSkill();
|
||||
$defender->checkActiveSkill();
|
||||
foreach(Util::zip(
|
||||
$attacker->checkActiveSkill(),
|
||||
$defender->checkActiveSkill()
|
||||
) as $b){
|
||||
//doNothing
|
||||
}
|
||||
//NOTE: 마법은 checkActiveSkill, checkPostActiveSkill 내에서 반영
|
||||
|
||||
$attacker->checkPostActiveSkill();
|
||||
$defender->checkPostActiveSkill();
|
||||
foreach(Util::zip(
|
||||
$attacker->checkPostActiveSkill(),
|
||||
$defender->checkPostActiveSkill()
|
||||
) as $b){
|
||||
//doNothing
|
||||
}
|
||||
//NOTE: 반계류 등의 스킬을 post에서 반영
|
||||
|
||||
$activeSkillIterator = new \AppendIterator();
|
||||
$activeSkillIterator->append($attacker->applyActiveSkill());
|
||||
$activeSkillIterator->append($defender->applyActiveSkill());
|
||||
foreach($activeSkillIterator as $b){
|
||||
foreach(Util::zip(
|
||||
$attacker->applyActiveSkill(),
|
||||
$defender->applyActiveSkill()
|
||||
) as $b){
|
||||
//doNothing
|
||||
}
|
||||
|
||||
@@ -498,6 +545,7 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) {
|
||||
pushNationHistory($destnation, "<C>●</>{$year}년 {$month}월:<D><b>{$nation['name']}</b></>의 <Y>{$general['name']}</>에 의해 <G><b>{$city['name']}</b></>{$josaYiCity} <span class='ev_highlight'>함락</span>");
|
||||
|
||||
$citycount = $db->queryFirstField('SELECT count(city) FROM city WHERE nation = %i', $city['nation']);
|
||||
$renewFront = false;
|
||||
|
||||
// 국가 멸망시
|
||||
//TODO: 국가 멸망 코드를 별도로 작성
|
||||
@@ -509,9 +557,6 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) {
|
||||
$history[] = "<C>●</>{$year}년 {$month}월:<R><b>【멸망】</b></><D><b>{$losenation['name']}</b></>{$josaYi} 멸망하였습니다.";
|
||||
pushNationHistory($nation, "<C>●</>{$year}년 {$month}월:<D><b>{$losenation['name']}</b></>{$josaUl} 정복");
|
||||
|
||||
//다굴치는 나라들 전방설정을 위해 미리 얻어옴
|
||||
$dipNations = $db->queryFirstColumn('SELECT you FROM diplomacy WHERE me = %i', $losenation['nation']);
|
||||
|
||||
$loseGeneralGold = 0;
|
||||
$loseGeneralRice = 0;
|
||||
//멸망국 장수들 역사 기록 및 로그 전달
|
||||
@@ -546,7 +591,7 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) {
|
||||
$loseGeneralRice += $loseRice;
|
||||
|
||||
//모두 등용장 발부
|
||||
if(Util::randBool(0.5)) {
|
||||
if($admin['join_mode'] != 'onlyRandom' && Util::randBool(0.5)) {
|
||||
$msg = ScoutMessage::buildScoutMessage($general['no'], $gen['no']);
|
||||
if($msg){
|
||||
$msg->send(true);
|
||||
@@ -554,7 +599,7 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) {
|
||||
}
|
||||
|
||||
//NPC인 경우 10% 확률로 임관(엔장, 인재, 의병)
|
||||
if($gen['npc'] >= 2 && $gen['npc'] <= 8 && rand() % 100 < 10) {
|
||||
if($admin['join_mode'] != 'onlyRandom' && $gen['npc'] >= 2 && $gen['npc'] <= 8 && rand() % 100 < 10) {
|
||||
$commissionCommand = EncodeCommand(0, 0, $nation['nation'], 25); //임관
|
||||
$query = "update general set turn0='$commissionCommand' where no={$gen['no']}";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
@@ -615,11 +660,7 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) {
|
||||
// 국가 삭제
|
||||
$query = "delete from nation where nation='{$city['nation']}'";
|
||||
MYDB_query($query, $connect) or Error(__LINE__.MYDB_error($connect),"");
|
||||
// 아까 얻어온 다굴국들 전방설정
|
||||
foreach($dipNations as $dip){
|
||||
//전방설정
|
||||
SetNationFront($dip);
|
||||
}
|
||||
$renewFront = true;
|
||||
// 멸망이 아니면
|
||||
} else {
|
||||
// 태수,군사,시중은 일반으로...
|
||||
@@ -717,6 +758,15 @@ function ConquerCity($admin, $general, $city, $nation, $destnation) {
|
||||
SetNationFront($conquerNation);
|
||||
}
|
||||
|
||||
if($renewFront){
|
||||
foreach(getAllNationStaticInfo() as $nation){
|
||||
if($nation['level'] <= 0){
|
||||
continue;
|
||||
}
|
||||
SetNationFront($nation['nation']);
|
||||
}
|
||||
}
|
||||
|
||||
pushGenLog($general, $log);
|
||||
pushGeneralPublicRecord($alllog, $year, $month);
|
||||
pushWorldHistory($history);
|
||||
|
||||
+39
-29
@@ -686,6 +686,9 @@ function command_25($turn, $command) {
|
||||
$connect=$db->get();
|
||||
$userID = Session::getUserID();
|
||||
|
||||
$gameStor->cacheValues(['year','startyear','month','join_mode']);
|
||||
|
||||
$onlyRandom = $gameStor->join_mode == 'onlyRandom';
|
||||
starter("임관");
|
||||
|
||||
$query = "select no,nations from general where owner='{$userID}'";
|
||||
@@ -700,11 +703,31 @@ function command_25($turn, $command) {
|
||||
|
||||
$nationList = $db->query('SELECT nation,`name`,color,scout,scoutmsg,gennum FROM nation ORDER BY rand()');
|
||||
|
||||
echo "
|
||||
foreach($nationList as &$nation){
|
||||
if ($onlyRandom && TimeUtil::IsRangeMonth($gameStor->init_year, $gameStor->init_month, 1, $gameStor->year, $gameStor->month) && $nation['gennum'] >= GameConst::$initialNationGenLimitForRandInit) {
|
||||
$nation['availableJoin'] = false;
|
||||
}
|
||||
else if($gameStor->year < $gameStor->startyear+3 && $nation['gennum'] >= GameConst::$initialNationGenLimit){
|
||||
$nation['availableJoin'] = false;
|
||||
}
|
||||
else if($nation['scout'] == 1) {
|
||||
$nation['availableJoin'] = false;
|
||||
}
|
||||
else{
|
||||
$nation['availableJoin'] = true;
|
||||
}
|
||||
}
|
||||
unset($nation);
|
||||
?>
|
||||
|
||||
국가에 임관합니다.<br>
|
||||
이미 임관/등용되었던 국가는 다시 임관할 수 없습니다.<br>
|
||||
바로 군주의 위치로 이동합니다.<br>
|
||||
<?php if($onlyRandom): ?>
|
||||
랜덤 임관 대상 국가는 아래에서 확인할 수 있습니다.<br>
|
||||
<?php else: ?>
|
||||
임관할 국가를 목록에서 선택하세요.<br>
|
||||
<?php endif; ?>
|
||||
!!!는 방랑군을 포함한 랜덤임관입니다. 유니크를 기대하신다면!<br>
|
||||
???는 방랑군을 제외한 랜덤임관입니다. 유니크 혜택은 없습니다.<br>
|
||||
임관 금지이거나 초기 제한중인 국가는 붉은색 배경으로 표시됩니다.<br>
|
||||
@@ -712,37 +735,24 @@ function command_25($turn, $command) {
|
||||
<form name=form1 action=c_double.php method=post>
|
||||
<select name=double size=1 style=color:white;background-color:black>
|
||||
<option value=99 style=color:white;background-color:black;>!!!</option>
|
||||
<option value=98 style=color:white;background-color:black;>???</option>";
|
||||
<option value=98 style=color:white;background-color:black;>???</option>
|
||||
|
||||
$scoutStr = "";
|
||||
foreach($nationList as $nation){
|
||||
if($gameStor->year < $gameStor->startyear+3 && $nation['gennum'] >= GameConst::$initialNationGenLimit) {
|
||||
echo "
|
||||
<option value={$nation['nation']} style=color:{$nation['color']};background-color:red;>【 {$nation['name']} 】</option>";
|
||||
} elseif($nation['scout'] == 1) {
|
||||
echo "
|
||||
<option value={$nation['nation']} style=color:{$nation['color']};background-color:red;>【 {$nation['name']} 】</option>";
|
||||
} elseif(in_array($nation['nation'], $joinedNations)) {
|
||||
/*
|
||||
echo "
|
||||
<option value={$nation['nation']} style=color:{$nation['color']};background-color:red; disabled>【 {$nation['name']} 】</option>";
|
||||
*/
|
||||
} else {
|
||||
echo "
|
||||
<option value={$nation['nation']} style=color:{$nation['color']};>【 {$nation['name']} 】</option>";
|
||||
}
|
||||
}
|
||||
echo "
|
||||
<?php foreach($nationList as $nation): ?>
|
||||
<?php if(!$nation['availableJoin']): ?>
|
||||
<option value='<?=$nation['nation']?>' style='color:<?=$nation['color']?>;background-color:red;' <?=$onlyRandom?'disabled':''?>>【 <?=$nation['name']?> 】</option>
|
||||
<?php else: ?>
|
||||
<option value='<?=$nation['nation']?>' style='color:<?=$nation['color']?>;' <?=$onlyRandom?'disabled':''?>>【 <?=$nation['name']?> 】</option>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
|
||||
</select>
|
||||
<input type=submit value=임관>
|
||||
<input type=hidden name=command value=$command>";
|
||||
for($i=0; $i < count($turn); $i++) {
|
||||
echo "
|
||||
<input type=hidden name=turn[] value=$turn[$i]>";
|
||||
}
|
||||
|
||||
echo "
|
||||
</form>";
|
||||
<input type=hidden name=command value=<?=$command?>>
|
||||
<?php foreach(range(0, count($turn) - 1) as $i): ?>
|
||||
<input type=hidden name=turn[] value=<?=$turn[$i]?>>
|
||||
<?php endforeach; ?>
|
||||
</form>
|
||||
<?php
|
||||
echo getInvitationList($nationList);
|
||||
|
||||
ender();
|
||||
|
||||
@@ -40,7 +40,7 @@ class GameConstBase
|
||||
/** @var float 훈련시 사기 감소율*/
|
||||
public static $atmosSideEffectByTraining = 1;
|
||||
/** @var float 계략 기본 성공률*/
|
||||
public static $sabotageDefaultProb = 0.15;
|
||||
public static $sabotageDefaultProb = 0.35;
|
||||
/** @var int 계략시 확률 가중치(수치가 클수록 변화가 적음 : (지력차/$firing + $basefiring)*/
|
||||
public static $sabotageProbCoefByStat = 300;
|
||||
/** @var int 계략시 최소 수치 감소량*/
|
||||
@@ -74,6 +74,9 @@ class GameConstBase
|
||||
/** @var int 최대 기술 레벨 */
|
||||
public static $maxTechLevel = 12;
|
||||
|
||||
/** @var int 초기 제한시 장수 제한 */
|
||||
public static $initialNationGenLimitForRandInit = 3;
|
||||
|
||||
/** @var int 초기 제한시 장수 제한 */
|
||||
public static $initialNationGenLimit = 10;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class GameUnitConstBase{
|
||||
100, 100, 7, 0, 0, 99, 9,
|
||||
999999, null, null, 999999,
|
||||
[],//성벽은 공격할 수 없다.
|
||||
[],
|
||||
[self::T_FOOTMAN=>1.2],
|
||||
['성벽입니다.','생성할 수 없습니다.']
|
||||
],
|
||||
|
||||
@@ -68,7 +68,7 @@ class GameUnitConstBase{
|
||||
],
|
||||
[
|
||||
3, self::T_FOOTMAN, '자객병',
|
||||
100, 150, 7, 20, 0, 10, 10,
|
||||
100, 150, 8, 20, 0, 10, 10,
|
||||
2000, ['저'], null, 0,
|
||||
[self::T_ARCHER=>1.2, self::T_CAVALRY=>0.8, self::T_SIEGE=>1.2],
|
||||
[self::T_ARCHER=>0.8, self::T_CAVALRY=>1.2, self::T_SIEGE=>0.8],
|
||||
@@ -84,7 +84,7 @@ class GameUnitConstBase{
|
||||
],
|
||||
[
|
||||
5, self::T_FOOTMAN, '등갑병',
|
||||
100, 250, 7, 5, 0, 13, 10,
|
||||
100, 225, 7, 5, 0, 13, 10,
|
||||
1000, null, ['남중'], 0,
|
||||
[self::T_ARCHER=>1.2, self::T_CAVALRY=>0.8, self::T_SIEGE=>1.2],
|
||||
[self::T_ARCHER=>0.8, self::T_CAVALRY=>1.2, self::T_SIEGE=>0.8],
|
||||
@@ -181,7 +181,7 @@ class GameUnitConstBase{
|
||||
],
|
||||
[
|
||||
26, self::T_CAVALRY, '맹수병',
|
||||
250, 200, 6, 0, 0, 16, 16,
|
||||
250, 175, 6, 0, 0, 16, 16,
|
||||
2000, ['남만'], null, 0,
|
||||
[self::T_FOOTMAN=>1.2, self::T_ARCHER=>0.8, self::T_SIEGE=>1.2],
|
||||
[self::T_FOOTMAN=>0.8, self::T_ARCHER=>1.2, self::T_SIEGE=>0.8],
|
||||
|
||||
@@ -41,6 +41,10 @@ class ResetHelper{
|
||||
];
|
||||
}
|
||||
|
||||
if(!file_exists($servRoot.'/logs/preserved')){
|
||||
mkdir($servRoot.'/logs/preserved', 0755);
|
||||
}
|
||||
|
||||
if(!file_exists($servRoot.'/logs/.htaccess')){
|
||||
@file_put_contents($servRoot.'/logs/.htaccess', 'Deny from all');
|
||||
}
|
||||
@@ -49,6 +53,23 @@ class ResetHelper{
|
||||
@file_put_contents($servRoot.'/data/.htaccess', 'Deny from all');
|
||||
}
|
||||
|
||||
$dir = new \DirectoryIterator($servRoot.'/logs');
|
||||
foreach ($dir as $fileinfo) {
|
||||
/** @var \DirectoryIterator $fileinfo */
|
||||
if (!$fileinfo->isDir() || $fileinfo->isDot()) {
|
||||
continue;
|
||||
}
|
||||
$basename = $fileinfo->getFilename();
|
||||
if($basename == 'preserved'){
|
||||
continue;
|
||||
}
|
||||
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
|
||||
exec("move ".escapeshellarg($servRoot.'/logs/'.$basename)." ".escapeshellarg($servRoot.'/logs/preserved/'.$basename));
|
||||
} else {
|
||||
exec("mv ".escapeshellarg($servRoot.'/logs/'.$basename)." ".escapeshellarg($servRoot.'/logs/preserved/'.$basename));
|
||||
}
|
||||
}
|
||||
|
||||
$prefix = DB::prefix();
|
||||
AppConf::getList()[$prefix]->closeServer();
|
||||
|
||||
@@ -107,7 +128,8 @@ class ResetHelper{
|
||||
int $extend,
|
||||
int $npcmode,
|
||||
int $show_img_level,
|
||||
int $tournament_trig
|
||||
int $tournament_trig,
|
||||
string $join_mode
|
||||
):array{
|
||||
//FIXME: 분리할 것
|
||||
if(120 % $turnterm != 0){
|
||||
@@ -193,6 +215,8 @@ class ResetHelper{
|
||||
'startyear'=>$startyear,
|
||||
'year'=> $year,
|
||||
'month'=> $month,
|
||||
'init_year'=> $year,
|
||||
'init_month'=>$month,
|
||||
'map_theme' => $scenarioObj->getMapTheme(),
|
||||
'msg'=>'공지사항',//TODO:공지사항
|
||||
'maxgeneral'=>GameConst::$defaultMaxGeneral,
|
||||
@@ -207,6 +231,7 @@ class ResetHelper{
|
||||
'killturn'=>$killturn,
|
||||
'genius'=>GameConst::$defaultMaxGenius,
|
||||
'show_img_level'=>$show_img_level,
|
||||
'join_mode'=>$join_mode,
|
||||
'npcmode'=>$npcmode,
|
||||
'extended_general'=>$extend,
|
||||
'fiction'=>$fiction,
|
||||
|
||||
@@ -8,6 +8,9 @@ use \sammo\GameUnitConst;
|
||||
|
||||
class NPC{
|
||||
|
||||
public $generalID = null;
|
||||
public $realName = null;
|
||||
|
||||
public $affinity;
|
||||
public $name;
|
||||
public $picturePath;
|
||||
@@ -24,6 +27,16 @@ class NPC{
|
||||
public $charWar = 0;
|
||||
public $npc = 2;
|
||||
public $text;
|
||||
static $prefixList = [
|
||||
1 => 'ⓝ', //빙의 NPC
|
||||
2 => 'ⓝ', //NPC
|
||||
3 => 'ⓜ', //인탐 장수
|
||||
4 => 'ⓖ', //의병장(전략)
|
||||
5 => '㉥', //부대장
|
||||
6 => 'ⓤ', //unselectable npc, 빙의 불가 npc
|
||||
|
||||
9 => 'ⓞ', //오랑캐?
|
||||
];
|
||||
|
||||
//[ 1, "헌제",1002, 1, null, 17, 13, 61, 0, 170, 250, "안전", null, "산 넘어 산이로구나..."],
|
||||
public function __construct(
|
||||
@@ -156,7 +169,8 @@ class NPC{
|
||||
$charDomestic = 0;
|
||||
}
|
||||
|
||||
$name = 'ⓝ'.$this->name;
|
||||
$name = (static::$prefixList[$this->npc]?:'ⓧ').$this->name;
|
||||
$this->realName = $name;
|
||||
|
||||
$picturePath = $this->picturePath;
|
||||
if($env['show_img_level'] < 3){
|
||||
@@ -260,6 +274,7 @@ class NPC{
|
||||
'bornyear'=>$this->birth,
|
||||
'deadyear'=>$this->death
|
||||
]);
|
||||
$this->generalID = $db->insertId();
|
||||
|
||||
return true; //생성되었다.
|
||||
}
|
||||
|
||||
+15
-8
@@ -337,8 +337,8 @@ class WarUnit{
|
||||
$this->computeWarPower();
|
||||
}
|
||||
|
||||
function checkBattleBeginSkill():bool{
|
||||
return false;
|
||||
function checkBattleBeginSkill(){
|
||||
yield true;
|
||||
}
|
||||
|
||||
function checkBattleBeginItem():bool{
|
||||
@@ -353,6 +353,13 @@ class WarUnit{
|
||||
return $this->activatedSkill[$skillName] ?? false;
|
||||
}
|
||||
|
||||
function hasActivatedSkillOnLog(string $skillName):bool{
|
||||
if(key_exists($skillName, $this->logActivatedSkill)){
|
||||
return true;
|
||||
}
|
||||
return $this->hasActivatedSkill($skillName);
|
||||
}
|
||||
|
||||
function activateSkill(... $skillNames){
|
||||
foreach($skillNames as $skillName){
|
||||
$this->activatedSkill[$skillName] = true;
|
||||
@@ -365,16 +372,16 @@ class WarUnit{
|
||||
}
|
||||
}
|
||||
|
||||
function checkPreActiveSkill():bool{
|
||||
return false;
|
||||
function checkPreActiveSkill(){
|
||||
yield true;
|
||||
}
|
||||
|
||||
function checkActiveSkill():bool{
|
||||
return false;
|
||||
function checkActiveSkill(){
|
||||
yield true;
|
||||
}
|
||||
|
||||
function checkPostActiveSkill():bool{
|
||||
return false;
|
||||
function checkPostActiveSkill(){
|
||||
yield true;
|
||||
}
|
||||
|
||||
function applyActiveSkill(){
|
||||
|
||||
@@ -219,6 +219,9 @@ class WarUnitGeneral extends WarUnit{
|
||||
else if($specialWar == 61){
|
||||
$myWarPowerMultiply *= 1.10;
|
||||
}
|
||||
else if($specialWar == 62){
|
||||
$opposeWarPowerMultiply *= 0.95;
|
||||
}
|
||||
else if($specialWar == 50){
|
||||
if($this->isAttacker){
|
||||
$opposeWarPowerMultiply *= 0.9;
|
||||
@@ -346,22 +349,35 @@ class WarUnitGeneral extends WarUnit{
|
||||
}
|
||||
|
||||
///전투 개시 시에 작동하여 매 장수마다 작동하는 스킬
|
||||
function checkBattleBeginSkill():bool{
|
||||
$skillResult = false;
|
||||
function checkBattleBeginSkill(){
|
||||
$oppose = $this->getOppose();
|
||||
|
||||
$specialWar = $this->getSpecialWar();
|
||||
|
||||
if(
|
||||
$this->getCrewType()->armType == GameUnitConst::T_SIEGE &&
|
||||
$oppose->getCrewType()->armType == GameUnitConst::T_CASTLE
|
||||
){
|
||||
$this->activateSkill('부상무효');
|
||||
}
|
||||
yield true;
|
||||
|
||||
if($specialWar == 62){
|
||||
$oppose->activateSkill('저격불가');
|
||||
$this->activateSkill('부상무효');
|
||||
}
|
||||
yield true;
|
||||
|
||||
if (
|
||||
$specialWar == 70 &&
|
||||
$this->oppose instanceof WarUnitGeneral &&
|
||||
!$this->hasActivatedSkill('저격') &&
|
||||
!$this->hasActivatedSkill('저격불가') &&
|
||||
Util::randBool(1/3)
|
||||
) {
|
||||
$this->activateSkill('저격');
|
||||
$skillResult = true;
|
||||
}
|
||||
|
||||
return $skillResult;
|
||||
yield true;
|
||||
}
|
||||
|
||||
///전투 개시 시에 작동하여 매 장수마다 작동하는 아이템
|
||||
@@ -380,6 +396,7 @@ class WarUnitGeneral extends WarUnit{
|
||||
$item == 2 &&
|
||||
$this->oppose instanceof WarUnitGeneral &&
|
||||
!$this->hasActivatedSkill('저격') &&
|
||||
!$this->hasActivatedSkill('저격불가') &&
|
||||
Util::randBool(1/5)
|
||||
){
|
||||
//수극
|
||||
@@ -491,7 +508,7 @@ class WarUnitGeneral extends WarUnit{
|
||||
return $this->killed;
|
||||
}
|
||||
|
||||
function checkPreActiveSkill():bool{
|
||||
function checkPreActiveSkill(){
|
||||
$activated = false;
|
||||
|
||||
$oppose = $this->getOppose();
|
||||
@@ -499,34 +516,38 @@ class WarUnitGeneral extends WarUnit{
|
||||
$item = $this->getItem();
|
||||
$crewType = $this->getCrewType();
|
||||
|
||||
if($specialWar == 62){
|
||||
$oppose->activateSkill('필살불가');
|
||||
$oppose->activateSkill('위압불가');
|
||||
$oppose->activateSkill('격노불가');
|
||||
$oppose->activateSkill('계략약화');
|
||||
}
|
||||
yield true;
|
||||
|
||||
if($specialWar == 45){
|
||||
$oppose->activateSkill('계략약화');
|
||||
}
|
||||
yield true;
|
||||
|
||||
if(
|
||||
$specialWar == 63 &&
|
||||
$this->getPhase() == 0 &&
|
||||
$this->getHP() >= 1000 &&
|
||||
$this->getComputedAtmos() >= 90 &&
|
||||
$this->getComputedTrain() >= 90
|
||||
$this->getComputedTrain() >= 90 &&
|
||||
!$this->hasActivatedSkill('위압불가')
|
||||
){
|
||||
$this->activateSkill('위압');
|
||||
$activated = true;
|
||||
}
|
||||
|
||||
if($specialWar == 62){
|
||||
$oppose->activateSkill('필살불가');
|
||||
$oppose->activateSkill('계략약화');
|
||||
$activated = true;
|
||||
}
|
||||
yield true;
|
||||
|
||||
if($specialWar == 60){
|
||||
$oppose->activateSkill('회피불가');
|
||||
$oppose->activateSkill('저지불가');
|
||||
}
|
||||
|
||||
return $activated;
|
||||
yield true;
|
||||
}
|
||||
|
||||
function checkActiveSkill():bool{
|
||||
$activated = false;
|
||||
|
||||
function checkActiveSkill(){
|
||||
$oppose = $this->getOppose();
|
||||
$specialWar = $this->getSpecialWar();
|
||||
$item = $this->getItem();
|
||||
@@ -542,9 +563,9 @@ class WarUnitGeneral extends WarUnit{
|
||||
$ratio = $this->getComputedAtmos() + $this->getComputedTrain();
|
||||
if(Util::randBool($ratio / 400)){
|
||||
$this->activateSkill('특수', '저지');
|
||||
$activated = true;
|
||||
}
|
||||
}
|
||||
yield true;
|
||||
|
||||
if(
|
||||
!$this->hasActivatedSkill('특수') &&
|
||||
@@ -552,8 +573,8 @@ class WarUnitGeneral extends WarUnit{
|
||||
Util::randBool($this->getComputedCriticalRatio())
|
||||
){
|
||||
$this->activateSkill('특수', '필살시도', '필살');
|
||||
$activated = true;
|
||||
}
|
||||
yield true;
|
||||
|
||||
if(
|
||||
!$this->hasActivatedSkill('특수') &&
|
||||
@@ -561,8 +582,8 @@ class WarUnitGeneral extends WarUnit{
|
||||
Util::randBool($this->getComputedAvoidRatio())
|
||||
){
|
||||
$this->activateSkill('특수', '회피시도', '회피');
|
||||
$activated = true;
|
||||
}
|
||||
yield true;
|
||||
|
||||
//계략
|
||||
if($crewType->magicCoef){
|
||||
@@ -607,17 +628,16 @@ class WarUnitGeneral extends WarUnit{
|
||||
}
|
||||
}
|
||||
}
|
||||
yield true;
|
||||
|
||||
//의술
|
||||
if($specialWar == 73 && Util::randBool(0.2)){
|
||||
$this->activateSkill('치료');
|
||||
$activated = true;
|
||||
}
|
||||
|
||||
return $activated;
|
||||
yield true;
|
||||
}
|
||||
|
||||
function checkPostActiveSkill():bool{
|
||||
function checkPostActiveSkill(){
|
||||
$activated = false;
|
||||
|
||||
$oppose = $this->getOppose();
|
||||
@@ -625,7 +645,11 @@ class WarUnitGeneral extends WarUnit{
|
||||
$item = $this->getItem();
|
||||
$crewType = $this->getCrewType();
|
||||
|
||||
if($specialWar == 74 && $oppose->hasActivatedSkill('필살')){
|
||||
if(
|
||||
$specialWar == 74 &&
|
||||
$oppose->hasActivatedSkill('필살') &&
|
||||
!$this->hasActivatedSkill('격노불가')
|
||||
){
|
||||
if($this->isAttacker){
|
||||
if(Util::randBool(1/3)){
|
||||
$this->activateSkill('진노', '격노');
|
||||
@@ -643,10 +667,12 @@ class WarUnitGeneral extends WarUnit{
|
||||
}
|
||||
}
|
||||
}
|
||||
yield true;
|
||||
|
||||
if(
|
||||
$specialWar == 74 &&
|
||||
$oppose->hasActivatedSkill('회피')
|
||||
$oppose->hasActivatedSkill('회피') &&
|
||||
!$this->hasActivatedSkill('격노불가')
|
||||
){
|
||||
if($this->isAttacker){
|
||||
if(Util::randBool(1/3)){
|
||||
@@ -668,6 +694,7 @@ class WarUnitGeneral extends WarUnit{
|
||||
}
|
||||
}
|
||||
}
|
||||
yield true;
|
||||
|
||||
if(
|
||||
($item == 23 || $item == 24) &&
|
||||
@@ -677,17 +704,19 @@ class WarUnitGeneral extends WarUnit{
|
||||
$this->activateSkill('치료');
|
||||
$activated = true;
|
||||
}
|
||||
yield true;
|
||||
|
||||
//계략
|
||||
if(
|
||||
$specialWar == 45 &&
|
||||
$oppose->hasActivatedSkill('계략') &&
|
||||
Util::randBool(0.3)
|
||||
Util::randBool(0.4)
|
||||
){
|
||||
$this->activateSkill('반계');
|
||||
$oppose->deactivateSkill('계략');
|
||||
$activated = true;
|
||||
}
|
||||
yield true;
|
||||
|
||||
if(
|
||||
$specialWar == 42 &&
|
||||
@@ -695,6 +724,7 @@ class WarUnitGeneral extends WarUnit{
|
||||
){
|
||||
$this->warPowerMultiply *= 1.3;
|
||||
}
|
||||
yield true;
|
||||
|
||||
if(
|
||||
$specialWar == 43 &&
|
||||
@@ -702,8 +732,7 @@ class WarUnitGeneral extends WarUnit{
|
||||
){
|
||||
$this->warPowerMultiply *= 1.5;
|
||||
}
|
||||
|
||||
return $activated;
|
||||
yield true;
|
||||
}
|
||||
|
||||
function applyActiveSkill(){
|
||||
@@ -717,8 +746,8 @@ class WarUnitGeneral extends WarUnit{
|
||||
|
||||
if($this->hasActivatedSkill('저지')){
|
||||
|
||||
$this->addDex($oppose->getCrewType(), $oppose->getWarPower() * 0.5 * 0.9);
|
||||
$this->addDex($this->getCrewType(), $this->getWarPower() * 0.5 * 0.9);
|
||||
$this->addDex($oppose->getCrewType(), $oppose->getWarPower() * 0.9);
|
||||
$this->addDex($this->getCrewType(), $this->getWarPower() * 0.9);
|
||||
|
||||
$this->setWarPowerMultiply(0);
|
||||
$oppose->setWarPowerMultiply(0);
|
||||
@@ -784,7 +813,7 @@ class WarUnitGeneral extends WarUnit{
|
||||
foreach($table as $skillKey => $skillMultiply){
|
||||
if($oppose->hasActivatedSkill($skillKey)){
|
||||
$josaUl = \sammo\JosaUtil::pick($skillKey, '을');
|
||||
$thisLogger->pushGeneralBattleDetailLog("<C>●</><C>반계</>로 상대의 <D>{$skillKey}</>{$josaUl} 되돌렸다!");
|
||||
$thisLogger->pushGeneralBattleDetailLog("<C>반계</>로 상대의 <D>{$skillKey}</>{$josaUl} 되돌렸다!");
|
||||
$opposeLogger->pushGeneralBattleDetailLog("<D>{$skillKey}</>{$josaUl} <R>역으로</> 당했다!");
|
||||
|
||||
$this->multiplyWarPowerMultiply($skillMultiply);
|
||||
@@ -894,6 +923,9 @@ class WarUnitGeneral extends WarUnit{
|
||||
}
|
||||
|
||||
function tryWound():bool{
|
||||
if($this->hasActivatedSkillOnLog('부상무효')){
|
||||
return false;
|
||||
}
|
||||
if(!Util::randBool(0.05)){
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -13,27 +13,30 @@
|
||||
"npcMax":95
|
||||
},
|
||||
"general":[
|
||||
[0, "흑뢰의라이제", null, 0, null, 91, 71, 93, 0, 160, 300, null, null],
|
||||
[0, "성녀마리안", null, 0, null, 92, 71, 92, 0, 160, 300, null, null],
|
||||
[0, "팔방미녀세정", null, 0, null, 88, 87, 80, 0, 160, 300, null, null],
|
||||
[0, "빛나는아이오네", null, 0, null, 91, 93, 71, 0, 160, 300, null, null],
|
||||
[0, "포근한라유", null, 0, null, 92, 92, 71, 0, 160, 300, null, null],
|
||||
[0, "은랑의제로스", null, 0, null, 93, 91, 71, 0, 160, 300, null, null],
|
||||
[0, "흑뢰의라이제", null, 0, null, 91, 71, 93, 0, 160, 300, "의협", "집중"],
|
||||
[0, "성녀마리안", null, 0, null, 92, 71, 92, 0, 160, 300, null, "환술"],
|
||||
[0, "팔방미녀세정", null, 0, null, 88, 87, 80, 0, 160, 300, "출세", "위압"],
|
||||
[0, "빛나는아이오네", null, 0, null, 91, 93, 71, 0, 160, 300, "패권", "위압"],
|
||||
[0, "포근한라유", null, 0, null, 92, 92, 71, 0, 160, 300, null, "돌격"],
|
||||
[0, "은랑의제로스", null, 0, null, 93, 91, 71, 0, 160, 300, null, "무쌍"],
|
||||
[0, "악몽술사테리온", null, 0, null, 91, 71, 92, 0, 160, 300, null, null],
|
||||
[0, "마검의제시카", null, 0, null, 91, 92, 71, 0, 160, 300, null, null],
|
||||
[0, "분노의슈란", null, 0, null, 91, 92, 71, 0, 160, 300, null, null],
|
||||
[0, "영광의시아레스", null, 0, null, 92, 91, 71, 0, 160, 300, null, null],
|
||||
[0, "마검의제시카", null, 0, null, 91, 92, 71, 0, 160, 300, null, "기병"],
|
||||
[0, "분노의슈란", null, 0, null, 91, 92, 71, 0, 160, 300, null, "궁병"],
|
||||
[0, "영광의시아레스", null, 0, null, 92, 91, 71, 0, 160, 300, null, "돌격"],
|
||||
[0, "홍련의리오스", null, 0, null, 92, 91, 71, 0, 160, 300, null, null],
|
||||
[0, "붉은눈의마모아", null, 0, null, 87, 80, 86, 0, 160, 300, null, null],
|
||||
[0, "블리자드네로스", null, 0, null, 92, 90, 71, 0, 160, 300, null, null],
|
||||
[0, "혈광의바이넨", null, 0, null, 91, 92, 70, 0, 160, 300, null, null],
|
||||
[0, "붉은유성하네드", null, 0, null, 90, 93, 69, 0, 160, 300, null, null],
|
||||
[0, "아랍왕자애버스", null, 0, null, 86, 81, 85, 0, 160, 300, null, null],
|
||||
[0, "성검의알렌시아", null, 0, null, 91, 91, 70, 0, 160, 300, null, null],
|
||||
[0, "뉴페이스마르첼라", null, 0, null, 90, 70, 91, 0, 160, 300, null, null],
|
||||
[0, "환영의에루다", null, 0, null, 88, 73, 90, 0, 160, 300, null, null],
|
||||
[0, "마도사나나리", null, 0, null, 91, 70, 90, 0, 160, 300, null, null],
|
||||
[0, "의유혹의유메리아", null, 0, null, 86, 79, 86, 0, 160, 300, null, null],
|
||||
[0, "유혹의유메리아", null, 0, null, 86, 79, 86, 0, 160, 300, null, null],
|
||||
[0, "풍요로운오리헨", null, 0, null, 92, 91, 68, 0, 160, 300, null, null],
|
||||
[0, "리에하르", null, 0, null, 90, 68, 92, 0, 160, 300, null, null],
|
||||
[0, "유혹의리에하르", null, 0, null, 90, 68, 92, 0, 160, 300, null, null],
|
||||
[0, "용의기사카헬", null, 0, null, 87, 92, 71, 0, 160, 300, null, null],
|
||||
[0, "파괴의바스타레", null, 0, null, 85, 82, 82, 0, 160, 300, null, null],
|
||||
[0, "약속의글로리아", null, 0, null, 90, 92, 67, 0, 160, 300, null, null],
|
||||
[0, "차가운세피럴", null, 0, null, 88, 69, 91, 0, 160, 300, null, null],
|
||||
@@ -51,13 +54,15 @@
|
||||
[0, "약속의카엘", null, 0, null, 85, 89, 70, 0, 160, 300, null, null],
|
||||
[0, "신농가관지평", null, 0, null, 88, 66, 89, 0, 160, 300, null, null],
|
||||
[0, "귀여운리모네", null, 0, null, 85, 79, 79, 0, 160, 300, null, null],
|
||||
[0, "이데아", null, 0, null, 84, 89, 70, 0, 160, 300, null, null],
|
||||
[0, "공포의이데아", null, 0, null, 84, 89, 70, 0, 160, 300, null, null],
|
||||
[0, "현장복귀딘", null, 0, null, 86, 89, 68, 0, 160, 300, null, null],
|
||||
[0, "리나젤", null, 0, null, 86, 90, 67, 0, 160, 300, null, null],
|
||||
[0, "환수사세라자드", null, 0, null, 88, 89, 66, 0, 160, 300, null, null],
|
||||
[0, "섬광의마틸다", null, 0, null, 88, 92, 63, 0, 160, 300, null, null],
|
||||
[0, "건강한꼬마루피나", null, 0, null, 89, 92, 62, 0, 160, 300, null, null],
|
||||
[0, "마법상인비르시아", null, 0, null, 88, 72, 83, 0, 160, 300, null, null],
|
||||
[0, "신탁의하노아", null, 0, null, 89, 93, 60, 0, 160, 300, null, null],
|
||||
[0, "마룡의제크", null, 0, null, 88, 64, 90, 0, 160, 300, null, null],
|
||||
[0, "광역의블레악스", null, 0, null, 86, 67, 88, 0, 160, 300, null, null],
|
||||
[0, "유혹의나룬", null, 0, null, 80, 83, 78, 0, 160, 300, null, null],
|
||||
[0, "정령궁수모니카", null, 0, null, 86, 88, 67, 0, 160, 300, null, null],
|
||||
@@ -65,11 +70,11 @@
|
||||
[0, "저주의네로메루", null, 0, null, 86, 64, 90, 0, 160, 300, null, null],
|
||||
[0, "백련의마르센", null, 0, null, 86, 86, 68, 0, 160, 300, null, null],
|
||||
[0, "풍광의아이리", null, 0, null, 86, 88, 66, 0, 160, 300, null, null],
|
||||
[0, "세르펜스", null, 0, null, 89, 60, 90, 0, 160, 300, null, null],
|
||||
[0, "따뜻한세르펜스", null, 0, null, 89, 60, 90, 0, 160, 300, null, null],
|
||||
[0, "블랙어스카이로스", null, 0, null, 84, 85, 70, 0, 160, 300, null, null],
|
||||
[0, "분란의새논", null, 0, null, 87, 86, 65, 0, 160, 300, null, null],
|
||||
[0, "미소의아스트리아", null, 0, null, 82, 65, 90, 0, 160, 300, null, null],
|
||||
[0, "어맨더", null, 0, null, 83, 87, 67, 0, 160, 300, null, null],
|
||||
[0, "섬광의어맨더", null, 0, null, 83, 87, 67, 0, 160, 300, null, null],
|
||||
[0, "염사의라루아", null, 0, null, 84, 86, 66, 0, 160, 300, null, null],
|
||||
[0, "뿅망치에멜", null, 0, null, 86, 85, 65, 0, 160, 300, null, null],
|
||||
[0, "정보상인미세리아", null, 0, null, 86, 60, 89, 0, 160, 300, null, null],
|
||||
@@ -78,7 +83,7 @@
|
||||
[0, "찰나의아리스", null, 0, null, 82, 84, 69, 0, 160, 300, null, null],
|
||||
[0, "흑랑의리코스", null, 0, null, 83, 87, 65, 0, 160, 300, null, null],
|
||||
[0, "혈광의클라우드", null, 0, null, 84, 88, 63, 0, 160, 300, null, null],
|
||||
[0, "크리디", null, 0, null, 80, 64, 90, 0, 160, 300, null, null],
|
||||
[0, "미룡의크리디", null, 0, null, 80, 64, 90, 0, 160, 300, null, null],
|
||||
[0, "백작부인블론디", null, 0, null, 83, 86, 65, 0, 160, 300, null, null],
|
||||
[0, "기사렌티온", null, 0, null, 87, 88, 59, 0, 160, 300, null, null],
|
||||
[0, "셀루아", null, 0, null, 85, 83, 65, 0, 160, 300, null, null],
|
||||
@@ -86,13 +91,16 @@
|
||||
[0, "순백의티라", null, 0, null, 71, 72, 89, 0, 160, 300, null, null],
|
||||
[0, "교황의기사미라이", null, 0, null, 86, 90, 56, 0, 160, 300, null, null],
|
||||
[0, "맹독의멀독", null, 0, null, 85, 83, 63, 0, 160, 300, null, null],
|
||||
[0, "트롤왕레우기", null, 0, null, 84, 87, 60, 0, 160, 300, null, null],
|
||||
[0, "데이나", null, 0, null, 77, 63, 90, 0, 160, 300, null, null],
|
||||
[0, "바람의무희네바", null, 0, null, 83, 59, 88, 0, 160, 300, null, null],
|
||||
[0, "웨스트윈드아모스", null, 0, null, 73, 70, 87, 0, 160, 300, null, null],
|
||||
[0, "루치아", null, 0, null, 83, 80, 67, 0, 160, 300, null, null],
|
||||
[0, "하이나", null, 0, null, 81, 57, 91, 0, 160, 300, null, null],
|
||||
[0, "환상의사히누스", null, 0, null, 86, 66, 78, 0, 160, 300, null, null],
|
||||
[0, "애정의하이나", null, 0, null, 81, 57, 91, 0, 160, 300, null, null],
|
||||
[0, "스니퍼", null, 0, null, 78, 81, 70, 0, 160, 300, null, null],
|
||||
[0, "오마주", null, 0, null, 82, 87, 60, 0, 160, 300, null, null],
|
||||
[0, "분노의오마주", null, 0, null, 82, 87, 60, 0, 160, 300, null, null],
|
||||
[0, "초록늑대데빌레덤", null, 0, null, 78, 79, 72, 0, 160, 300, null, null],
|
||||
[0, "이로아스", null, 0, null, 82, 76, 70, 0, 160, 300, null, null],
|
||||
[0, "광살의에반", null, 0, null, 80, 88, 60, 0, 160, 300, null, null],
|
||||
[0, "카밀라", null, 0, null, 86, 49, 92, 0, 160, 300, null, null],
|
||||
@@ -100,19 +108,25 @@
|
||||
[0, "바람의레지나", null, 0, null, 77, 64, 86, 0, 160, 300, null, null],
|
||||
[0, "부정의퓨니엄", null, 0, null, 76, 74, 75, 0, 160, 300, null, null],
|
||||
[0, "흑묘샬롯", null, 0, null, 81, 88, 56, 0, 160, 300, null, null],
|
||||
[0, "현자제노에오스", null, 0, null, 78, 58, 89, 0, 160, 300, null, null],
|
||||
[0, "돌풍의루파로", null, 0, null, 78, 66, 81, 0, 160, 300, null, null],
|
||||
[0, "쥬곤을찾는만텔", null, 0, null, 76, 80, 67, 0, 160, 300, null, null],
|
||||
[0, "날뒤는알트", null, 0, null, 73, 62, 87, 0, 160, 300, null, null],
|
||||
[0, "날뛰는알트", null, 0, null, 73, 62, 87, 0, 160, 300, null, null],
|
||||
[0, "달아오른슈롯셔", null, 0, null, 80, 64, 78, 0, 160, 300, null, null],
|
||||
[0, "로즈", null, 0, null, 72, 63, 86, 0, 160, 300, null, null],
|
||||
[0, "막내카라", null, 0, null, 75, 67, 79, 0, 160, 300, null, null],
|
||||
[0, "리치네", null, 0, null, 78, 65, 78, 0, 160, 300, null, null],
|
||||
[0, "블랙하운드암푸스", null, 0, null, 74, 80, 66, 0, 160, 300, null, null],
|
||||
[0, "화염늑대데빌리덤", null, 0, null, 77, 81, 62, 0, 160, 300, null, null],
|
||||
[0, "검은늑대데빌사울", null, 0, null, 70, 84, 66, 0, 160, 300, null, null],
|
||||
[0, "흑월의리베스", null, 0, null, 73, 55, 91, 0, 160, 300, null, null],
|
||||
[0, "혁명의브렉", null, 0, null, 76, 77, 66, 0, 160, 300, null, null],
|
||||
[0, "에클레", null, 0, null, 73, 83, 63, 0, 160, 300, null, null],
|
||||
[0, "만텔을쫒는에클레", null, 0, null, 73, 83, 63, 0, 160, 300, null, null],
|
||||
[0, "타베나", null, 0, null, 77, 80, 62, 0, 160, 300, null, null],
|
||||
[0, "복수의이벤", null, 0, null, 72, 58, 88, 0, 160, 300, null, null],
|
||||
[0, "심연의베르", null, 0, null, 72, 79, 67, 0, 160, 300, null, null],
|
||||
[0, "탐험가로이", null, 0, null, 73, 78, 67, 0, 160, 300, null, null],
|
||||
[0, "독장미야나가", null, 0, null, 67, 86, 65, 0, 160, 300, null, null],
|
||||
[0, "미녀기사쥬니아", null, 0, null, 71, 66, 80, 0, 160, 300, null, null],
|
||||
[0, "스토마", null, 0, null, 69, 69, 79, 0, 160, 300, null, null],
|
||||
[0, "리사", null, 0, null, 70, 71, 76, 0, 160, 300, null, null],
|
||||
@@ -124,18 +138,24 @@
|
||||
[0, "귀환의류나드", null, 0, null, 80, 84, 52, 0, 160, 300, null, null],
|
||||
[0, "라타", null, 0, null, 73, 69, 73, 0, 160, 300, null, null],
|
||||
[0, "정령기사한나", null, 0, null, 70, 73, 72, 0, 160, 300, null, null],
|
||||
[0, "원스", null, 0, null, 77, 82, 56, 0, 160, 300, null, null],
|
||||
[0, "빙결체이서원스", null, 0, null, 77, 82, 56, 0, 160, 300, null, null],
|
||||
[0, "초고속승진리체", null, 0, null, 81, 47, 87, 0, 160, 300, null, null],
|
||||
[0, "푸른늑대데빌덤", null, 0, null, 82, 78, 55, 0, 160, 300, null, null],
|
||||
[0, "악동듀요라", null, 0, null, 76, 69, 69, 0, 160, 300, null, null],
|
||||
[0, "에렌디라", null, 0, null, 82, 80, 52, 0, 160, 300, null, null],
|
||||
[0, "아이스트롤레쿠", null, 0, null, 66, 70, 78, 0, 160, 300, null, null],
|
||||
[0, "파이어트롤레키", null, 0, null, 59, 73, 82, 0, 160, 300, null, null],
|
||||
[0, "은발의야마르", null, 0, null, 73, 73, 67, 0, 160, 300, null, null],
|
||||
[0, "하늘의콜리나", null, 0, null, 74, 77, 62, 0, 160, 300, null, null],
|
||||
[0, "그림자라이넌", null, 0, null, 70, 59, 84, 0, 160, 300, null, null],
|
||||
[0, "어스트롤레크", null, 0, null, 61, 72, 80, 0, 160, 300, null, null],
|
||||
[0, "루이칸", null, 0, null, 73, 66, 73, 0, 160, 300, null, null],
|
||||
[0, "레이첼", null, 0, null, 70, 68, 73, 0, 160, 300, null, null],
|
||||
[0, "테이머존덜링", null, 0, null, 67, 72, 72, 0, 160, 300, null, null],
|
||||
[0, "엘린", null, 0, null, 74, 48, 88, 0, 160, 300, null, null],
|
||||
[0, "에포스", null, 0, null, 76, 48, 86, 0, 160, 300, null, null],
|
||||
[0, "아미르", null, 0, null, 69, 64, 77, 0, 160, 300, null, null],
|
||||
[0, "에타", null, 0, null, 72, 62, 76, 0, 160, 300, null, null],
|
||||
[0, "혹한의에타", null, 0, null, 72, 62, 76, 0, 160, 300, null, null],
|
||||
[0, "정령술사도루숨", null, 0, null, 72, 64, 74, 0, 160, 300, null, null],
|
||||
[0, "차녀카미안", null, 0, null, 72, 76, 62, 0, 160, 300, null, null],
|
||||
[0, "질니아", null, 0, null, 74, 80, 56, 0, 160, 300, null, null],
|
||||
@@ -146,9 +166,11 @@
|
||||
[0, "폭주의란도루", null, 0, null, 70, 51, 87, 0, 160, 300, null, null],
|
||||
[0, "웬디", null, 0, null, 72, 77, 59, 0, 160, 300, null, null],
|
||||
[0, "찰스", null, 0, null, 72, 83, 53, 0, 160, 300, null, null],
|
||||
[0, "윈드트롤레칸", null, 0, null, 57, 75, 76, 0, 160, 300, null, null],
|
||||
[0, "산들바람젤레", null, 0, null, 68, 52, 87, 0, 160, 300, null, null],
|
||||
[0, "요하스", null, 0, null, 69, 65, 73, 0, 160, 300, null, null],
|
||||
[0, "아이노", null, 0, null, 72, 70, 65, 0, 160, 300, null, null],
|
||||
[0, "욕망의타실리", null, 0, null, 67, 54, 86, 0, 160, 300, null, null],
|
||||
[0, "홍염의케이시", null, 0, null, 76, 42, 88, 0, 160, 300, null, null],
|
||||
[0, "소태우스", null, 0, null, 72, 70, 64, 0, 160, 300, null, null],
|
||||
[0, "빙혼마도사카이", null, 0, null, 74, 43, 88, 0, 160, 300, null, null],
|
||||
@@ -169,6 +191,7 @@
|
||||
[0, "레이븐", null, 0, null, 69, 43, 86, 0, 160, 300, null, null],
|
||||
[0, "투말린", null, 0, null, 72, 69, 57, 0, 160, 300, null, null],
|
||||
[0, "게르고", null, 0, null, 72, 69, 57, 0, 160, 300, null, null],
|
||||
[0, "욕망의로이즈", null, 0, null, 73, 37, 88, 0, 160, 300, null, null],
|
||||
[0, "로렌시아", null, 0, null, 70, 42, 85, 0, 160, 300, null, null],
|
||||
[0, "달라니카", null, 0, null, 65, 59, 73, 0, 160, 300, null, null],
|
||||
[0, "레이나", null, 0, null, 66, 56, 74, 0, 160, 300, null, null],
|
||||
@@ -176,10 +199,12 @@
|
||||
[0, "안테리나", null, 0, null, 67, 68, 61, 0, 160, 300, null, null],
|
||||
[0, "쿠벤", null, 0, null, 67, 69, 60, 0, 160, 300, null, null],
|
||||
[0, "이고트리", null, 0, null, 70, 73, 53, 0, 160, 300, null, null],
|
||||
[0, "데브라", null, 0, null, 74, 73, 49, 0, 160, 300, null, null],
|
||||
[0, "데비오스", null, 0, null, 74, 73, 49, 0, 160, 300, null, null],
|
||||
[0, "리로븐", null, 0, null, 67, 48, 81, 0, 160, 300, null, null],
|
||||
[0, "칼리오스", null, 0, null, 58, 53, 84, 0, 160, 300, null, null],
|
||||
[0, "시몬느", null, 0, null, 67, 56, 72, 0, 160, 300, null, null],
|
||||
[0, "추적자주혜", null, 0, null, 67, 73, 55, 0, 160, 300, null, null],
|
||||
[0, "크리슈아", null, 0, null, 78, 85, 32, 0, 160, 300, null, null],
|
||||
[0, "감시자록시", null, 0, null, 58, 56, 80, 0, 160, 300, null, null],
|
||||
[0, "모멘트", null, 0, null, 61, 70, 63, 0, 160, 300, null, null],
|
||||
[0, "올거", null, 0, null, 58, 76, 60, 0, 160, 300, null, null],
|
||||
@@ -187,6 +212,7 @@
|
||||
[0, "비랑카", null, 0, null, 65, 70, 59, 0, 160, 300, null, null],
|
||||
[0, "야쿠", null, 0, null, 66, 69, 59, 0, 160, 300, null, null],
|
||||
[0, "휘크리스", null, 0, null, 70, 74, 50, 0, 160, 300, null, null],
|
||||
[0, "엔사그니", null, 0, null, 67, 72, 55, 0, 160, 300, null, null],
|
||||
[0, "사랑찾는메리아", null, 0, null, 68, 39, 86, 0, 160, 300, null, null],
|
||||
[0, "에벨라", null, 0, null, 62, 46, 85, 0, 160, 300, null, null],
|
||||
[0, "아리엔", null, 0, null, 72, 44, 77, 0, 160, 300, null, null],
|
||||
@@ -213,6 +239,7 @@
|
||||
[0, "모리웬", null, 0, null, 69, 64, 54, 0, 160, 300, null, null],
|
||||
[0, "메니아드", null, 0, null, 67, 67, 53, 0, 160, 300, null, null],
|
||||
[0, "담금질중인칸나", null, 0, null, 75, 84, 28, 0, 160, 300, null, null],
|
||||
[0, "약제사미리움", null, 0, null, 65, 47, 75, 0, 160, 300, null, null],
|
||||
[0, "장녀카나안", null, 0, null, 70, 32, 84, 0, 160, 300, null, null],
|
||||
[0, "하나리", null, 0, null, 59, 62, 65, 0, 160, 300, null, null],
|
||||
[0, "하로데스", null, 0, null, 70, 72, 44, 0, 160, 300, null, null],
|
||||
@@ -268,6 +295,7 @@
|
||||
[0, "토리스", null, 0, null, 58, 43, 73, 0, 160, 300, null, null],
|
||||
[0, "하카세", null, 0, null, 60, 62, 52, 0, 160, 300, null, null],
|
||||
[0, "모코", null, 0, null, 65, 70, 39, 0, 160, 300, null, null],
|
||||
[0, "고트리시", null, 0, null, 53, 47, 74, 0, 160, 300, null, null],
|
||||
[0, "크루피사냐", null, 0, null, 53, 46, 74, 0, 160, 300, null, null],
|
||||
[0, "에리키오먼", null, 0, null, 63, 38, 72, 0, 160, 300, null, null],
|
||||
[0, "로윈터", null, 0, null, 53, 64, 56, 0, 160, 300, null, null],
|
||||
@@ -292,6 +320,7 @@
|
||||
[0, "에스텔", null, 0, null, 59, 64, 47, 0, 160, 300, null, null],
|
||||
[0, "가리먼", null, 0, null, 65, 66, 39, 0, 160, 300, null, null],
|
||||
[0, "타나소스", null, 0, null, 69, 62, 39, 0, 160, 300, null, null],
|
||||
[0, "안티오그나", null, 0, null, 28, 65, 77, 0, 160, 300, null, null],
|
||||
[0, "에리사", null, 0, null, 53, 43, 73, 0, 160, 300, null, null],
|
||||
[0, "미라시아", null, 0, null, 58, 39, 72, 0, 160, 300, null, null],
|
||||
[0, "루카", null, 0, null, 58, 63, 48, 0, 160, 300, null, null],
|
||||
@@ -327,7 +356,20 @@
|
||||
[0, "알리오나", null, 0, null, 53, 34, 72, 0, 160, 300, null, null],
|
||||
[0, "케시아", null, 0, null, 53, 71, 32, 0, 160, 300, null, null],
|
||||
[0, "듀라스", null, 0, null, 48, 26, 78, 0, 160, 300, null, null],
|
||||
[0, "아카시", null, 0, null, 48, 29, 74, 0, 160, 300, null, null]
|
||||
[0, "아카시", null, 0, null, 48, 29, 74, 0, 160, 300, null, null],
|
||||
[0, "코르코슘", null, 0, null, 32, 35, 80, 0, 160, 300, null, null],
|
||||
[0, "휴식의카소아샤", null, 0, null, 33, 77, 33, 0, 160, 300, null, null],
|
||||
[0, "요청의가스우세", null, 0, null, 33, 33, 77, 0, 160, 300, null, null],
|
||||
[0, "칼로아눈", null, 0, null, 39, 19, 82, 0, 160, 300, null, null],
|
||||
[0, "나시루", null, 0, null, 28, 21, 78, 0, 160, 300, null, null],
|
||||
[0, "비로", null, 0, null, 54, 43, 74, 0, 160, 300, null, null],
|
||||
[0, "어둠의질레르", null, 0, null, 68, 65, 87, 0, 160, 300, null, null],
|
||||
[0, "암흑도둑에베넌", null, 0, null, 67, 65, 78, 0, 160, 300, null, null],
|
||||
[0, "뛰노는차이치", null, 0, null, 64, 52, 69, 0, 160, 300, null, null],
|
||||
[0, "운명의페인트", null, 0, null, 82, 63, 84, 0, 160, 300, null, null],
|
||||
[0, "케로베로스바이라", null, 0, null, 79, 73, 72, 0, 160, 300, null, null],
|
||||
[0, "대장장이시이로", null, 0, null, 78, 67, 54, 0, 160, 300, null, null],
|
||||
[0, "병기참모프레인", null, 0, null, 88, 60, 77, 0, 160, 300, null, null]
|
||||
],
|
||||
"general_ex":[
|
||||
|
||||
@@ -336,7 +378,7 @@
|
||||
|
||||
],
|
||||
"history":[
|
||||
"<C>●</>180년 1월:<L><b>【이벤트】</b></>제작자: 촉구.",
|
||||
"<C>●</>180년 1월:<L><b>【이벤트】</b></>제작자: 촉구, 관지평",
|
||||
"<C>●</>180년 1월:<L><b>【가상모드13】</b>소울소드</>",
|
||||
"<C>●</>180년 1월:<L><b>【이벤트】</b></>혼란스러운 세상을 영웅들과 함께 바로잡아라!"
|
||||
],
|
||||
|
||||
@@ -19,7 +19,7 @@ class GameUnitConst extends GameUnitConstBase
|
||||
100, 100, 7, 0, 0, 99, 9,
|
||||
999999, null, null, 999999,
|
||||
[],//성벽은 공격할 수 없다.
|
||||
[],
|
||||
[self::T_FOOTMAN=>1.2],
|
||||
['성벽입니다.','생성할 수 없습니다.']
|
||||
],
|
||||
|
||||
|
||||
+2
-2
@@ -627,8 +627,8 @@ CREATE TABLE IF NOT EXISTS `emperior` (
|
||||
`l6pic` CHAR(32) NULL DEFAULT '',
|
||||
`l5name` CHAR(64) NULL DEFAULT '',
|
||||
`l5pic` CHAR(32) NULL DEFAULT '',
|
||||
`tiger` CHAR(64) NULL DEFAULT '',
|
||||
`eagle` CHAR(64) NULL DEFAULT '',
|
||||
`tiger` VARCHAR(128) NULL DEFAULT '',
|
||||
`eagle` VARCHAR(128) NULL DEFAULT '',
|
||||
`gen` TEXT NULL DEFAULT '',
|
||||
`history` MEDIUMTEXT NULL DEFAULT '',
|
||||
`aux` MEDIUMTEXT NULL DEFAULT '' COMMENT 'json',
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
<div class="world_map map_theme_<?=$mapTheme?> draw_required">
|
||||
<div class="map_title">
|
||||
<span class="map_title_text">
|
||||
<div class="map_title obj_tooltip" data-toggle="tooltip" data-placement="top" data-tooltip-class="map_title_tooltiptext">
|
||||
<span class="map_title_text ">
|
||||
</span>
|
||||
<span class="tooltiptext"></span>
|
||||
</div>
|
||||
<div class="map_body">
|
||||
<div class="map_bglayer1"></div>
|
||||
|
||||
@@ -8,8 +8,6 @@ include "func.php";
|
||||
$type = Util::getReq('type', 'int', 0);
|
||||
$sel = Util::getReq('sel', 'int', 1);
|
||||
|
||||
extractMissingPostToGlobals();
|
||||
|
||||
if($sel <= 0 || $sel > 12){
|
||||
$sel = 1;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ $db = RootDB::db();
|
||||
$notice = $db->queryFirstField('SELECT `NOTICE` FROM `system` WHERE `NO`=1');
|
||||
$userGrade = $session->userGrade;
|
||||
$acl = $session->acl;
|
||||
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
@@ -34,8 +35,6 @@ $acl = $session->acl;
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('../js/func.js')?>
|
||||
<?=WebUtil::printJS('../js/entrance.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/menu.js')?>
|
||||
<?=WebUtil::printJS('../js/title.js')?>
|
||||
|
||||
<?php if ($userGrade >= 5 || $acl): ?>
|
||||
<!-- 운영자 -->
|
||||
@@ -53,6 +52,7 @@ $acl = $session->acl;
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav">
|
||||
<?=WebUtil::drawMenu(ROOT.'/d_shared/menu.json')?>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
@@ -9,7 +9,7 @@ $userID = Session::getUserID();
|
||||
// 외부 파라미터
|
||||
|
||||
$db = RootDB::db();
|
||||
$member = $db->queryFirstRow('SELECT `id`, `name`, `grade`, `picture`, reg_date, third_use, acl FROM `member` WHERE `NO` = %i', $userID);
|
||||
$member = $db->queryFirstRow('SELECT `id`, `name`, `grade`, `picture`, reg_date, third_use, acl, oauth_type, token_valid_until FROM `member` WHERE `NO` = %i', $userID);
|
||||
|
||||
if(!$member['picture']){
|
||||
$picture = ServConfig::getSharedIconPath().'/default.jpg';
|
||||
@@ -30,6 +30,8 @@ else{
|
||||
}
|
||||
}
|
||||
|
||||
$tokenValidUntil = $member['token_valid_until'];
|
||||
|
||||
if($member['grade'] == 6) {
|
||||
$grade = '운영자';
|
||||
} elseif($member['grade'] == 5) {
|
||||
@@ -81,5 +83,8 @@ Json::die([
|
||||
'global_salt'=>RootDB::getGlobalSalt(),
|
||||
'join_date'=>$member['reg_date'],
|
||||
'third_use'=>($member['third_use']!=0),
|
||||
'acl'=>$acl
|
||||
'acl'=>$acl,
|
||||
'oauth_type'=>$member['oauth_type'],
|
||||
'token_valid_until'=>$tokenValidUntil
|
||||
|
||||
]);
|
||||
|
||||
@@ -23,10 +23,9 @@ require(__dir__.'/../vendor/autoload.php');
|
||||
<?=WebUtil::printJS('../e_lib/jquery-3.3.1.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/sha512.min.js')?>
|
||||
<?=WebUtil::printJS('../e_lib/moment.min.js')?>
|
||||
<?=WebUtil::printJS('../js/func.js')?>
|
||||
<?=WebUtil::printJS('../js/user_info.js')?>
|
||||
<?=WebUtil::printJS('../d_shared/menu.js')?>
|
||||
<?=WebUtil::printJS('../js/title.js')?>
|
||||
</head>
|
||||
<body>
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
@@ -36,6 +35,7 @@ require(__dir__.'/../vendor/autoload.php');
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav">
|
||||
<?=WebUtil::drawMenu(ROOT.'/d_shared/menu.json')?>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -87,6 +87,14 @@ require(__dir__.'/../vendor/autoload.php');
|
||||
</td>
|
||||
<td colspan="3">개인정보 3자 제공 동의 : <span id="slot_third_use"></span><button type="button" id="third_use_disallow">철회</button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg1">인증 방식</th>
|
||||
<td colspan="2">
|
||||
<span id="slot_oauth_type"></span>
|
||||
</td>
|
||||
<td colspan="3">
|
||||
<span id="slot_token_valid_until"></span>까지 유효<button type="button" id="expand_login_token">초기화</button></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="bg1"></th>
|
||||
<th class="bg1" colspan="2">회원 탈퇴</th>
|
||||
|
||||
@@ -30,12 +30,16 @@ if ($session->isLoggedIn()) {
|
||||
<?=WebUtil::printJS('e_lib/bootstrap.bundle.min.js')?>
|
||||
<?=WebUtil::printJS('e_lib/jquery.validate.min.js')?>
|
||||
<?=WebUtil::printJS('e_lib/sha512.min.js')?>
|
||||
<?=WebUtil::printJS('d_shared/menu.js')?>
|
||||
<?=WebUtil::printJS('js/common.js')?>
|
||||
<?=WebUtil::printJS('js/login.js')?>
|
||||
<?=WebUtil::printJS('js/title.js')?>
|
||||
<?=WebUtil::printCSS('e_lib/bootstrap.min.css')?>
|
||||
<?=WebUtil::printCSS('css/login.css')?>
|
||||
<meta name="description" content="실시간으로 진행되는 삼국지 웹게임(삼모전)입니다">
|
||||
<meta name="keywords" content="삼국지,삼모전,웹게임,힏체,힏체섭,히데체,히데체섭,HiDCHe,체섭">
|
||||
<meta property="og:type" content="website">
|
||||
<meta property="og:title" content="삼국지 모의전투 HiDCHe">
|
||||
<meta property="og:description" content="실시간으로 진행되는 삼국지 웹게임(삼모전)입니다">
|
||||
<meta property="og:url" content="https://sam.hided.net">
|
||||
<script>
|
||||
|
||||
var oauthMode = null;
|
||||
@@ -64,8 +68,17 @@ function getOAuthToken(mode, scope_list){
|
||||
|
||||
function sendTempPasswordToKakaoTalk(){
|
||||
$.post({
|
||||
url:'j_change_pw.php',
|
||||
url:'oauth_kakao/j_login_oauth.php',
|
||||
dataType:'json'
|
||||
}).then(function(obj){
|
||||
var t = $.Deferred();
|
||||
if(!obj.result){
|
||||
t.reject();
|
||||
}
|
||||
return $.post({
|
||||
url:'oauth_kakao/j_change_pw.php',
|
||||
dataType:'json'
|
||||
});
|
||||
}).then(function(obj){
|
||||
if(!obj.result){
|
||||
alert(obj.reason);
|
||||
@@ -81,12 +94,18 @@ function doLoginUsingOAuth(){
|
||||
url:'oauth_kakao/j_login_oauth.php',
|
||||
dataType:'json'
|
||||
}).then(function(obj){
|
||||
if(!obj.result){
|
||||
alert(obj.reason);
|
||||
}
|
||||
else{
|
||||
if(obj.result){
|
||||
window.location.href = "./";
|
||||
return;
|
||||
}
|
||||
if(!obj.reqOTP){
|
||||
alert(obj.reason);
|
||||
return;
|
||||
}
|
||||
$('#modalOTP').modal().on('shown.bs.modal', function(){
|
||||
$('#otp_code').focus();
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
@@ -94,6 +113,9 @@ function postOAuthResult(result){
|
||||
if(result == 'join'){
|
||||
window.location.href = 'oauth_kakao/join.php';
|
||||
}
|
||||
else if(result == 'req_email'){
|
||||
alert('이메일 정보 공유를 허가해 주셔야 합니다.');
|
||||
}
|
||||
else if(result == 'login'){
|
||||
console.log('로그인모드');
|
||||
if(oauthMode=='change_pw'){
|
||||
@@ -117,6 +139,7 @@ function postOAuthResult(result){
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarNav">
|
||||
<ul class="navbar-nav">
|
||||
<?=WebUtil::drawMenu(ROOT.'/d_shared/menu.json')?>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
@@ -126,7 +149,7 @@ function postOAuthResult(result){
|
||||
<h1 class="row justify-content-md-center">삼국지 모의전투 HiDCHe</h1>
|
||||
<div class="row justify-content-md-center">
|
||||
<div class="col" style="max-width:450px;">
|
||||
<div class="card">
|
||||
<div class="card" id="login_card">
|
||||
<h3 class="card-header">
|
||||
로그인
|
||||
</h3>
|
||||
@@ -152,29 +175,62 @@ function postOAuthResult(result){
|
||||
|
||||
<input type="hidden" id="global_salt" name="global_salt" value="<?=RootDB::getGlobalSalt()?>">
|
||||
<div class="form-group row">
|
||||
<div class="col-5 col-md-4 " style="position:relative;"><button type="button" onclick="getOAuthToken('login');" id="btn_kakao_login" title="카카오톡으로 가입&로그인"></button></div>
|
||||
<div class="col-5 col-md-4 " style="position:relative;"><button type="button" onclick="getOAuthToken('login', ['account_email','talk_message']);" id="btn_kakao_login" title="카카오톡으로 가입&로그인"></button></div>
|
||||
<div class="col-7 col-md-8">
|
||||
<button type="submit" class="btn btn-primary btn-lg btn-block login-button">로그인</button>
|
||||
<div class="btn-group btn-group-lg d-flex login_btn_group" role="group">
|
||||
<button type="submit" class="btn btn-primary login-button w-100">로그인</button>
|
||||
<div class="btn-group" role="group">
|
||||
<button type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> </button>
|
||||
<div class="dropdown-menu dropdown-menu-right" aria-labelledby="btnGroupDrop1">
|
||||
<a class="dropdown-item" href="javascript:getOAuthToken('change_pw', 'talk_message');">비밀번호 초기화</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<!--
|
||||
<div class="form-group row">
|
||||
<div class="col-sm-4"><a href="javascript:getOAuthToken('change_pw', 'talk_message');">비밀번호 찾기<img src="oauth_kakao/kakao_to_me.png"></a></div>
|
||||
<div class="col-sm-8">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="bottom_box">
|
||||
<div class="container"><a href="terms.2.html">개인정보처리방침</a> & <a href="terms.1.html">이용약관</a><br>© 2018 • HideD
|
||||
<br>크롬과 파이어폭스에 최적화되어있습니다.</div></div>
|
||||
</div>
|
||||
|
||||
<div class="modal fade" id="modalOTP" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<form id="otp_form" method="post" action="#">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title" id="exampleModalLabel">인증 코드 필요</h5>
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
|
||||
<span aria-hidden="true">×</span>
|
||||
</button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div>
|
||||
인증 코드가 필요합니다.<br><br>
|
||||
카카오톡의 '나와의 채팅'란을 확인해 주세요.<br>
|
||||
(별도의 알림[소리, 진동, 숫자]이 발생하지 않습니다.)
|
||||
</div>
|
||||
<div class="input-group mt-4" role="group">
|
||||
<div class="input-group-prepend">
|
||||
<span class="input-group-text">인증 코드</span>
|
||||
</div>
|
||||
<input type="number" class="form-control" name='otp' id="otp_code" placeholder="인증 코드">
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-dismiss="modal">취소</button>
|
||||
<button type="submit" class="btn btn-primary">제출</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
+100
-2
@@ -2,7 +2,9 @@
|
||||
namespace sammo;
|
||||
|
||||
require(__dir__.'/vendor/autoload.php');
|
||||
require(__dir__.'/oauth_kakao/lib.join.php');
|
||||
|
||||
use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper;
|
||||
|
||||
$RootDB = RootDB::db();
|
||||
$session = Session::getInstance();
|
||||
@@ -16,12 +18,92 @@ $password = Util::getReq('password');
|
||||
if(!$username || !$password){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reqOTP'=>false,
|
||||
'reason'=>'올바르지 않은 입력입니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
function kakaoOAuthCheck(array $userInfo) : ?array {
|
||||
|
||||
if(!\kakao\KakaoKey::REST_KEY){
|
||||
return [false, '카카오 API 앱이 등록되지 않았습니다. 관리자에게 문의해 주세요.'];
|
||||
}
|
||||
|
||||
$oauthID = $userInfo['oauth_id'];
|
||||
$oauthInfo = Json::decode($userInfo['oauth_info'])??[];
|
||||
if(!$oauthInfo){
|
||||
return [false, 'OAuth 정보가 보관되어 있지 않습니다. 카카오 로그인을 수행해 주세요.'];
|
||||
}
|
||||
|
||||
$accessToken = $oauthInfo['accessToken']??null;
|
||||
$refreshToken = $oauthInfo['refreshToken']??null;
|
||||
$accessTokenValidUntil = $oauthInfo['accessTokenValidUntil']??null;
|
||||
$refreshTokenValidUntil = $oauthInfo['refreshTokenValidUntil']??null;
|
||||
$OTPValue = $oauthInfo['OTPValue']??null;
|
||||
$OTPTrialUntil = $oauthInfo['OTPTrialUntil']??null;
|
||||
$tokenValidUntil = $userInfo['token_valid_until'];
|
||||
|
||||
if(!$accessToken || !$refreshToken || !$accessTokenValidUntil || !$refreshTokenValidUntil){
|
||||
return [false, 'OAuth 정보가 보관되어 있지 않습니다. 카카오 로그인을 수행해 주세요.'];
|
||||
}
|
||||
|
||||
$now = TimeUtil::DatetimeNow();
|
||||
|
||||
if($now > $refreshTokenValidUntil){
|
||||
return [false, '로그인 토큰이 만료되었습니다. 카카오 로그인을 수행해 주세요.'];
|
||||
}
|
||||
|
||||
if($now > $accessTokenValidUntil){
|
||||
$apiHelper = new Kakao_REST_API_Helper($accessToken);
|
||||
$refreshResult = $apiHelper->refresh_access_token($refreshToken);
|
||||
if(!$refreshResult){
|
||||
return [false, '로그인 토큰 자동 갱신을 실패했습니다. 카카오 로그인을 수행해 주세요.'];
|
||||
}
|
||||
|
||||
$accessToken = $refreshResult['access_token']??null;
|
||||
|
||||
if(!$accessToken){
|
||||
trigger_error("refreshToken 에러 ".Json::encode($refreshResult).",".$refreshToken.",".substr(\kakao\KakaoKey::REST_KEY, 0, 6), E_USER_NOTICE);
|
||||
return [false, '로그인 토큰 자동 갱신을 실패했습니다. 카카오 로그인을 수행해 주세요.'];
|
||||
}
|
||||
$accessTokenValidUntil = TimeUtil::DatetimeFromNowSecond($refreshResult['expires_in']);
|
||||
|
||||
$oauthInfo['accessToken'] = $accessToken;
|
||||
$oauthInfo['accessTokenValidUntil'] = $accessTokenValidUntil;
|
||||
|
||||
$refreshToken = $refreshResult['refresh_token']??null;
|
||||
if($refreshToken){
|
||||
$refreshTokenValidUntil = TimeUtil::DatetimeFromNowSecond($refreshResult['refresh_token_expires_in']);
|
||||
|
||||
$oauthInfo['refreshToken'] = $refreshToken;
|
||||
$oauthInfo['refresh_token_expires_in'] = $refresh_token_expires_in;
|
||||
}
|
||||
|
||||
RootDB::db()->update('member', [
|
||||
'oauth_info'=>Json::encode($oauthInfo)
|
||||
], 'no=%i', $userInfo['no']);
|
||||
}
|
||||
|
||||
if($tokenValidUntil && $now <= $tokenValidUntil){
|
||||
return null;
|
||||
}
|
||||
|
||||
//인증 시스템 가동
|
||||
$session = Session::getInstance();
|
||||
$session->access_token = $accessToken;
|
||||
$session->expires = $accessTokenValidUntil;
|
||||
$session->refresh_token = $refreshToken;
|
||||
$session->refresh_token_expires = $refreshTokenValidUntil;
|
||||
|
||||
if(!createOTPbyUserNO($userInfo['no'])){
|
||||
return [false, '인증 코드를 보내는데 실패했습니다.'];
|
||||
}
|
||||
|
||||
return [true, '인증 코드를 입력해주세요'];
|
||||
}
|
||||
|
||||
$userInfo = $RootDB->queryFirstRow(
|
||||
'SELECT `no`, `id`, `name`, `grade`, `delete_after`, `acl` '.
|
||||
'SELECT `no`, `id`, `name`, `grade`, `delete_after`, `acl`, oauth_id, oauth_type, oauth_info, token_valid_until '.
|
||||
'from member where id=%s_username AND '.
|
||||
'pw=sha2(concat(salt, %s_password, salt), 512)',[
|
||||
'username'=>$username,
|
||||
@@ -31,6 +113,7 @@ $userInfo = $RootDB->queryFirstRow(
|
||||
if(!$userInfo){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reqOTP'=>false,
|
||||
'reason'=>'아이디나 비밀번호가 올바르지 않습니다.'
|
||||
]);
|
||||
}
|
||||
@@ -49,12 +132,14 @@ if($userInfo['delete_after']){
|
||||
$RootDB->delete('member', 'no=%i', $userInfo['no']);
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reqOTP'=>false,
|
||||
'reason'=>"기간 만기로 삭제되었습니다. 재 가입을 시도해주세요."
|
||||
]);
|
||||
}
|
||||
else{
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reqOTP'=>false,
|
||||
'reason'=>"삭제 요청된 계정입니다.[{$userInfo['delete_after']}]"
|
||||
]);
|
||||
}
|
||||
@@ -70,10 +155,23 @@ $RootDB->insert('member_log',[
|
||||
])
|
||||
]);
|
||||
|
||||
if($userInfo['oauth_type'] == 'KAKAO'){
|
||||
$oauthFailResult = kakaoOAuthCheck($userInfo);
|
||||
if($oauthFailResult !== null){
|
||||
$session->login($userInfo['no'], $userInfo['id'], $userInfo['grade'], true, $userInfo['token_valid_until'], Json::decode($userInfo['acl']??'{}'));
|
||||
[$oauthReqOTP, $oauthFailReason] = $oauthFailResult;
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reqOTP'=>$oauthReqOTP,
|
||||
'reason'=>$oauthFailReason
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$session->login($userInfo['no'], $userInfo['id'], $userInfo['grade'], Json::decode($userInfo['acl']??'{}'));
|
||||
$session->login($userInfo['no'], $userInfo['id'], $userInfo['grade'], false, $userInfo['token_valid_until'], Json::decode($userInfo['acl']??'{}'));
|
||||
Json::die([
|
||||
'result'=>true,
|
||||
'reqOTP'=>false,
|
||||
'reason'=>'로그인 되었습니다.'
|
||||
]);
|
||||
+1
-1
@@ -47,7 +47,7 @@ var serverReservedTemplate = "\
|
||||
<td colspan='4' class='server_reserved'>\
|
||||
- 오픈 일시 : <%openDatetime%> - <br>\
|
||||
<span style='color:orange;'><%scenarioName%></span> <span style='color:limegreen;'><%turnterm%>분 턴 서버</span><br>\
|
||||
(상성 설정:<%fictionMode%>), (빙의 여부:<%npcMode%>), (최대 스탯:<%gameConf.defaultStatTotal%>)</td>\
|
||||
(상성 설정:<%fictionMode%>), (빙의 여부:<%npcMode%>), (최대 스탯:<%gameConf.defaultStatTotal%>), (기타 설정:<%otherTextInfo%>)</td>\
|
||||
";
|
||||
|
||||
$(function(){
|
||||
|
||||
+1
-1
@@ -111,7 +111,7 @@ $(document).ready( function () {
|
||||
alert(obj.reason);
|
||||
}
|
||||
else{
|
||||
alert('정상적으로 가입되었습니다.');
|
||||
alert('회원 등록되었습니다.\n첫 로그인 과정에서 인증 코드를 입력하는 것으로 계정이 활성화됩니다.');
|
||||
}
|
||||
|
||||
window.location.href = "../";
|
||||
|
||||
+36
-4
@@ -48,14 +48,46 @@ $(document).ready( function () {
|
||||
'password':hash_pw
|
||||
}
|
||||
}).then(function(obj){
|
||||
if(!obj.result){
|
||||
if(obj.result){
|
||||
window.location.href = "./";
|
||||
return;
|
||||
}
|
||||
if(!obj.reqOTP){
|
||||
alert(obj.reason);
|
||||
return;
|
||||
}
|
||||
else{
|
||||
window.location.href = 'i_entrance/entrance.php';
|
||||
}
|
||||
|
||||
var $modal = $('#modalOTP').modal();
|
||||
$modal.on('shown.bs.modal', function(){
|
||||
$('#otp_code').focus();
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
return false;
|
||||
});
|
||||
|
||||
$('#otp_form').submit(function(){
|
||||
$.post({
|
||||
url:'oauth_kakao/j_check_OTP.php',
|
||||
dataType:'json',
|
||||
data:{
|
||||
'otp':$('#otp_code').val(),
|
||||
}
|
||||
}).then(function(obj){
|
||||
if(obj.result){
|
||||
alert(obj.reason);
|
||||
window.location.href = "./";
|
||||
return;
|
||||
}
|
||||
|
||||
alert(obj.reason);
|
||||
|
||||
if(obj.reset){
|
||||
$('#modalOTP').modal('hide')
|
||||
return;
|
||||
}
|
||||
});
|
||||
return false;
|
||||
})
|
||||
} );
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
jQuery(function($){
|
||||
$.each(window.sammo_menu, function(idx){
|
||||
var href = this[0];
|
||||
var name = this[1];
|
||||
var target = (this.length > 2)?this[2]:null;
|
||||
|
||||
var $a = $('<a class="nav-link" href="{0}">{1}</a>'.format(href, name));
|
||||
if(target){
|
||||
$a.attr('target', target);
|
||||
}
|
||||
var $li = $('<li class="nav-item"></li>').append($a);
|
||||
$('#navbarNav .navbar-nav').append($li);
|
||||
console.log(this);
|
||||
});
|
||||
});
|
||||
@@ -20,6 +20,16 @@ function fillUserInfo(result){
|
||||
if(result.third_use){
|
||||
$('#third_use_disallow').show();
|
||||
}
|
||||
$('#slot_oauth_type').text(result.oauth_type);
|
||||
if(result.oauth_type != 'NONE'){
|
||||
$('#slot_token_valid_until').text(result.token_valid_until);
|
||||
}
|
||||
else{
|
||||
$('#slot_token_valid_until').parent().html('');
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function changeIconPreview(){
|
||||
@@ -217,6 +227,37 @@ function deleteMe(){
|
||||
});
|
||||
}
|
||||
|
||||
function extendAuth(){
|
||||
var validUntil = $('#slot_token_valid_until').html();
|
||||
var availableAt = moment(validUntil).subtract(5, 'days').format('YYYY-MM-DD HH:mm:ss');
|
||||
var now = moment().format('YYYY-MM-DD HH:mm:ss');
|
||||
|
||||
if(now < availableAt){
|
||||
alert('{0}부터 초기화할 수 있습니다.'.format(availableAt));
|
||||
return false;
|
||||
}
|
||||
|
||||
if(!confirm('로그아웃됩니다. 진행할까요?')){
|
||||
return;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
type:'post',
|
||||
url:'../oauth_kakao/j_reset_token.php',
|
||||
dataType:'json',
|
||||
}).then(function(result){
|
||||
if(!result.result){
|
||||
alert(result.reason);
|
||||
}
|
||||
else{
|
||||
alert('초기화했습니다. 다시 로그인해 주십시오.');
|
||||
location.href='../';
|
||||
}
|
||||
},function(){
|
||||
alert('알 수 없는 이유로 로그인 토큰 연장에 실패했습니다.');
|
||||
});
|
||||
}
|
||||
|
||||
$(function(){
|
||||
$('#slot_icon, #slot_new_icon').attr('src', pathConfig.sharedIcon+'/default.jpg');
|
||||
$.ajax({
|
||||
@@ -255,4 +296,6 @@ $(function(){
|
||||
deleteMe(e);
|
||||
}
|
||||
});
|
||||
|
||||
$('#expand_login_token').click(extendAuth);
|
||||
})
|
||||
|
||||
@@ -64,6 +64,9 @@ function postOAuthResult(result){
|
||||
if(result == 'join'){
|
||||
window.location.href = 'join.php';
|
||||
}
|
||||
else if(result == 'req_email'){
|
||||
alert('이메일 정보 공유를 허가해 주셔야 합니다.');
|
||||
}
|
||||
else if(result == 'login'){
|
||||
console.log('로그인모드');
|
||||
if(oauthMode=='change_pw'){
|
||||
|
||||
+23
-31
@@ -5,7 +5,7 @@ require(__dir__.'/../vendor/autoload.php');
|
||||
|
||||
use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper;
|
||||
|
||||
$nowDate = TimeUtil::DatetimeNow();
|
||||
$now = TimeUtil::DatetimeNow();
|
||||
|
||||
$session = Session::requireLogin([
|
||||
'reason'=>'로그인이 되어있지 않습니다'
|
||||
@@ -13,8 +13,6 @@ $session = Session::requireLogin([
|
||||
$userID = Session::getUserID();
|
||||
$access_token = $session->access_token;
|
||||
$expires = $session->expires;
|
||||
$refresh_token = $session->refresh_token;
|
||||
$refresh_token_expires = $session->refresh_token_expires;
|
||||
|
||||
if(!$access_token || !$expires){
|
||||
Json::die([
|
||||
@@ -27,44 +25,37 @@ if(!$access_token || !$expires){
|
||||
//TODO: join과 login의 동작이 비슷하다. helper class로 묶자.
|
||||
$restAPI = new Kakao_REST_API_Helper($access_token);
|
||||
|
||||
if($expires < $nowDate && (!$refresh_token || ($refresh_token_expires < $nowDate))){
|
||||
$session->logout();
|
||||
|
||||
if($expires < $now){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'로그인 토큰 만료.'.$refresh_token_expires.' 다시 카카오로그인을 수행해주세요.'
|
||||
'reason'=>'로그인 토큰 만료. 카카오 로그인을 먼저 수행해주세요.'
|
||||
]);
|
||||
}
|
||||
|
||||
if($expires < $nowDate){
|
||||
$session->kaccount_email = null;
|
||||
$email = null;
|
||||
|
||||
$result = $restAPI->refresh_access_token($refresh_token);
|
||||
if(!isset($refresh_token)){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'카카오 로그인 과정 중 추가 갱신 절차를 실패했습니다'
|
||||
]);
|
||||
}
|
||||
|
||||
$access_token = $result['access_token'];
|
||||
$expires = TimeUtil::DatetimeFromNowSecond($result['expires_in']);
|
||||
if(isset($result['refresh_token'])){
|
||||
$refresh_token = Util::array_get($result['refresh_token']);
|
||||
$refresh_token_expires = TimeUtil::DatetimeFromNowSecond($result['refresh_token_expires_in']);
|
||||
}
|
||||
}
|
||||
|
||||
RootDB::db()->query("lock tables member write, member_log write");
|
||||
|
||||
$isUser = RootDB::db()->queryFirstRow(
|
||||
'SELECT count(`no`) from member where no=%i',$userID);
|
||||
if(!$isUser){
|
||||
$oauthInfo = Json::decode(RootDB::db()->queryFirstField('SELECT oauth_info from member where no=%i',$userID))??[];
|
||||
if(!$oauthInfo){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'회원이 아닙니다. 관리자에게 문의해주세요.'
|
||||
'reason'=>'제대로 로그인이 이루어져 있지 않습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$nextPasswordChange = $oauthInfo['nextPasswordChange']??null;
|
||||
if($nextPasswordChange && $now < $nextPasswordChange){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'비밀번호를 초기화한지 얼마 지나지 않았습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$nextPasswordChange = TimeUtil::DatetimeFromNowHour(4);
|
||||
$oauthInfo['nextPasswordChange'] = $nextPasswordChange;
|
||||
|
||||
|
||||
$newPassword = Util::randomStr(6);
|
||||
$tmpPassword = Util::hashPassword(RootDB::getGlobalSalt(), $newPassword);
|
||||
$newSalt = bin2hex(random_bytes(8));
|
||||
@@ -89,12 +80,13 @@ if($sendResult['code'] < 0){
|
||||
|
||||
RootDB::db()->update('member', [
|
||||
'pw'=>$newFinalPassword,
|
||||
'salt'=>$newSalt
|
||||
'salt'=>$newSalt,
|
||||
'oauth_info'=>Json::encode($oauthInfo),
|
||||
],'no=%i', $userID);
|
||||
|
||||
RootDB::db()->insert('member_log', [
|
||||
'member_no'=>$userID,
|
||||
'date'=>$nowDate,
|
||||
'date'=>$now,
|
||||
'action_type'=>'change_pw',
|
||||
'action'=>Json::encode([
|
||||
'type'=>'kakao',
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
namespace sammo;
|
||||
|
||||
require(__dir__.'/../vendor/autoload.php');
|
||||
|
||||
$RootDB = RootDB::db();
|
||||
$session = Session::getInstance();
|
||||
if($session->isLoggedIn()){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reset'=>true,
|
||||
'reason'=>'이미 로그인 되어있습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
if(!$session->isLoggedIn(true)){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reset'=>true,
|
||||
'reason'=>'인증 코드를 입력할 수 있는 상태가 아닙니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$otp = Util::getReq('otp', 'int');
|
||||
if(!$otp){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reset'=>false,
|
||||
'reason'=>'인증 코드가 입력되지 않았습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
$userNo = $session->getUserID();
|
||||
|
||||
$oauthInfo = Json::decode(RootDB::db()->queryFirstField('SELECT oauth_info FROM member WHERE no=%i', $userNo))??[];
|
||||
if(!$oauthInfo){
|
||||
$session->logout();
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reset'=>true,
|
||||
'reason'=>'계정이 정상적으로 등록되어있지 않습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
$OTPValue = $oauthInfo['OTPValue']??null;
|
||||
$OTPTrialUntil = $oauthInfo['OTPTrialUntil']??null;
|
||||
$OTPTrialCount = $oauthInfo['OTPTrialCount']??0;
|
||||
$now = TimeUtil::DatetimeNow();
|
||||
|
||||
if(!$OTPTrialUntil || $OTPTrialUntil <= $now){
|
||||
$session->logout();
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reset'=>true,
|
||||
'reason'=>'인증 기한이 만료되었습니다. 다시 로그인해주세요.'
|
||||
]);
|
||||
}
|
||||
|
||||
if($OTPTrialCount <= 0){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reset'=>false,
|
||||
'reason'=>"인증 실패 횟수를 초과했습니다. {$OTPTrialUntil}까지 기다려주세요."
|
||||
]);
|
||||
}
|
||||
|
||||
if($OTPValue != $otp){
|
||||
$OTPTrialCount -= 1;
|
||||
$oauthInfo['OTPTrialCount'] = $OTPTrialCount;
|
||||
RootDB::db()->update('member', [
|
||||
'oauth_info'=>Json::encode($oauthInfo)
|
||||
], 'no=%i', $userNo);
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reset'=>false,
|
||||
'reason'=>"인증 번호가 틀렸습니다. {$OTPTrialCount}회 더 시도할 수 있습니다."
|
||||
]);
|
||||
}
|
||||
|
||||
$tokenValidUntil = TimeUtil::DatetimeFromNowDay(10);
|
||||
$session->setReqOTP(false, $tokenValidUntil);
|
||||
RootDB::db()->update('member', [
|
||||
'oauth_info'=>Json::encode($oauthInfo),
|
||||
'token_valid_until'=>$tokenValidUntil,
|
||||
], 'no=%i', $userNo);
|
||||
|
||||
Json::die([
|
||||
'result'=>true,
|
||||
'reset'=>false,
|
||||
'reason'=>"로그인을 성공했습니다. {$tokenValidUntil}까지 유효합니다."
|
||||
]);
|
||||
@@ -125,23 +125,35 @@ if(!$kakaoID && Util::array_get($signupResult['msg'])!='already registered'){
|
||||
|
||||
$me = $restAPI->meWithEmail();
|
||||
$me['code'] = Util::array_get($me['code'], 0);
|
||||
$kakao_account = $me['kakao_account']??[];
|
||||
if ($me['code']< 0) {
|
||||
$restAPI->unlink();
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'카카오로그인이 정상적으로 수행되지 않았습니다.'
|
||||
'reason'=>'카카오로그인이 정상적으로 수행되지 않았습니다.',
|
||||
]);
|
||||
}
|
||||
|
||||
if(!Util::array_get($me['kaccount_email_verified'],false)){
|
||||
if(!($kakao_account['has_email']??false)){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reqOTP'=>false,
|
||||
'reason'=>'이메일 정보 공유를 허가해 주셔야 합니다.',
|
||||
]);
|
||||
}
|
||||
|
||||
$validEmail = $kakao_account['is_email_valid']??false;
|
||||
$verifiedEmail = $kakao_account['is_email_verified']??false;
|
||||
|
||||
if(!$validEmail || !$verifiedEmail){
|
||||
$restAPI->unlink();
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'카카오 계정 이메일이 아직 인증되지 않았습니다'
|
||||
'reason'=>'카카오 계정 이메일이 아직 인증되지 않았습니다',
|
||||
]);
|
||||
}
|
||||
|
||||
$email = $me['kaccount_email'];
|
||||
$email = $kakao_account['email']??null;
|
||||
$session->kaccount_email = $email;
|
||||
$emailChk = checkEmailDup($email);
|
||||
if($emailChk !== true){
|
||||
@@ -162,7 +174,13 @@ RootDB::db()->insert('member',[
|
||||
'pw' => $finalPassword,
|
||||
'salt' => $userSalt,
|
||||
'name'=>$nickname,
|
||||
'reg_date'=>$nowDate
|
||||
'reg_date'=>$nowDate,
|
||||
'oauth_info'=>Json::encode([
|
||||
'accessToken'=>$access_token,
|
||||
'refreshToken'=>$refresh_token,
|
||||
'accessTokenValidUntil'=>$expires,
|
||||
'refreshTokenValidUntil'=>$refresh_token_expires
|
||||
])
|
||||
]);
|
||||
$userID = RootDB::db()->insertId();
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
namespace sammo;
|
||||
|
||||
require(__dir__.'/../vendor/autoload.php');
|
||||
|
||||
require('lib.join.php');
|
||||
use \kakao\Kakao_REST_API_Helper as Kakao_REST_API_Helper;
|
||||
|
||||
$RootDB = RootDB::db();
|
||||
@@ -15,12 +15,13 @@ $canLogin = RootDB::db()->queryFirstField('SELECT `LOGIN` FROM `system` WHERE `N
|
||||
if($canLogin != 'Y'){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reqOTP'=>false,
|
||||
'reason'=>'현재는 로그인이 금지되어있습니다!',
|
||||
'noRetry'=>true
|
||||
]);
|
||||
}
|
||||
|
||||
$nowDate = TimeUtil::DatetimeNow();
|
||||
$now = TimeUtil::DatetimeNow();
|
||||
|
||||
$access_token = $session->access_token;
|
||||
$expires = $session->expires;
|
||||
@@ -32,6 +33,7 @@ $email = $session->kaccount_email;
|
||||
if(!$access_token || !$expires){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reqOTP'=>false,
|
||||
'reason'=>'카카오로그인이 이루어지지 않았습니다.'
|
||||
]);
|
||||
}
|
||||
@@ -39,14 +41,15 @@ if(!$access_token || !$expires){
|
||||
//TODO: join과 login의 동작이 비슷하다. helper class로 묶자.
|
||||
$restAPI = new Kakao_REST_API_Helper($access_token);
|
||||
|
||||
if($expires < $nowDate && (!$refresh_token || ($refresh_token_expires < $nowDate))){
|
||||
if($expires < $now && (!$refresh_token || ($refresh_token_expires < $now))){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reqOTP'=>false,
|
||||
'reason'=>'로그인 토큰 만료.'.$refresh_token_expires.' 다시 카카오로그인을 수행해주세요.'
|
||||
]);
|
||||
}
|
||||
|
||||
if($expires < $nowDate){
|
||||
if($expires < $now){
|
||||
$session->kaccount_email = null;
|
||||
$email = null;
|
||||
|
||||
@@ -54,6 +57,7 @@ if($expires < $nowDate){
|
||||
if(!isset($refresh_token)){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reqOTP'=>false,
|
||||
'reason'=>'카카오 로그인 과정 중 추가 갱신 절차를 실패했습니다'
|
||||
]);
|
||||
}
|
||||
@@ -73,43 +77,68 @@ if(!$email){
|
||||
if ($me['code']< 0) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reqOTP'=>false,
|
||||
'reason'=>'카카오로그인이 정상적으로 수행되지 않았습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
if(!Util::array_get($me['kaccount_email_verified'],false)){
|
||||
$kakao_account = $me['kakao_account']??null;
|
||||
if (!$kakao_account) {
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reqOTP'=>false,
|
||||
'reason'=>'카카오 로그인 정보를 제대로 받아오지 못했습니다.'
|
||||
]);
|
||||
}
|
||||
|
||||
if(!($kakao_account['has_email']??false)){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reqOTP'=>false,
|
||||
'reason'=>'이메일 정보 공유를 허가해 주셔야 합니다.',
|
||||
]);
|
||||
}
|
||||
|
||||
$validEmail = $kakao_account['is_email_valid']??false;
|
||||
$verifiedEmail = $kakao_account['is_email_verified']??false;
|
||||
|
||||
if(!$validEmail || !$verifiedEmail){
|
||||
$restAPI->unlink();
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'카카오 계정 이메일이 아직 인증되지 않았습니다'
|
||||
'reqOTP'=>false,
|
||||
'reason'=>'카카오 계정 이메일이 아직 인증되지 않았습니다',
|
||||
]);
|
||||
}
|
||||
|
||||
$email = $me['kaccount_email'];
|
||||
$email = $kakao_account['email'];
|
||||
$session->kaccount_email = $email;
|
||||
}
|
||||
|
||||
|
||||
$userInfo = $RootDB->queryFirstRow(
|
||||
'SELECT `no`, `id`, `name`, `grade`, `delete_after`, `acl` from member where email=%s',$email);
|
||||
'SELECT `no`, `id`, `name`, `grade`, `delete_after`, `acl`, oauth_info, token_valid_until from member where email=%s',$email);
|
||||
|
||||
if(!$userInfo){
|
||||
$restAPI->unlink();
|
||||
$session->access_token = null;
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>'카카오로그인에 해당하는 계정이 없습니다. 재 가입을 시도해주세요.'
|
||||
'reqOTP'=>false,
|
||||
'reason'=>'카카오로그인에 해당하는 계정이 없습니다. 재 가입을 시도해주세요.',
|
||||
'aux'=>$session->tmpx,
|
||||
]);
|
||||
}
|
||||
|
||||
if($userInfo['delete_after']){
|
||||
if($userInfo['delete_after'] < $nowDate){
|
||||
if($userInfo['delete_after'] < $now){
|
||||
$restAPI->unlink();
|
||||
$session->access_token = null;
|
||||
$RootDB->delete('member', 'no=%i', $userInfo['no']);
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reason'=>"기간 만기로 삭제되었습니다. 재 가입을 시도해주세요."
|
||||
'reqOTP'=>false,
|
||||
'reason'=>"기간 만기로 삭제되었습니다. 재 가입을 시도해주세요.",
|
||||
]);
|
||||
}
|
||||
else{
|
||||
@@ -117,12 +146,45 @@ if($userInfo['delete_after']){
|
||||
$session->access_token = null;
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reqOTP'=>false,
|
||||
'reason'=>"삭제 요청된 계정입니다.[{$userInfo['delete_after']}]"
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
$oauthInfo = Json::decode($userInfo['oauth_info'])??[];
|
||||
$oauthInfo['accessToken'] = $access_token;
|
||||
$oauthInfo['accessTokenValidUntil'] = $expires;
|
||||
if($refresh_token){
|
||||
$oauthInfo['refreshToken'] = $refresh_token;
|
||||
$oauthInfo['refreshTokenValidUntil'] = $refresh_token_expires;
|
||||
}
|
||||
|
||||
RootDB::db()->update('member', [
|
||||
'oauth_info'=>Json::encode($oauthInfo)
|
||||
], 'no=%i', $userInfo['no']);
|
||||
|
||||
|
||||
$tokenValidUntil = $userInfo['token_valid_until'];
|
||||
|
||||
if(!$tokenValidUntil || $tokenValidUntil < $now){
|
||||
if(!createOTPbyUserNO($userInfo['no'])){
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reqOTP'=>false,
|
||||
'reason'=>'인증 코드를 보내는데 실패했습니다.'
|
||||
]);
|
||||
}
|
||||
$session->login($userInfo['no'], $userInfo['id'], $userInfo['grade'], true, $userInfo['token_valid_until'], Json::decode($userInfo['acl']??'{}'));
|
||||
Json::die([
|
||||
'result'=>false,
|
||||
'reqOTP'=>true,
|
||||
'reason'=>'인증 코드를 입력해주세요.'
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
$RootDB->insert('member_log',[
|
||||
'member_no'=>$userInfo['no'],
|
||||
'action_type'=>'login',
|
||||
@@ -132,8 +194,9 @@ $RootDB->insert('member_log',[
|
||||
])
|
||||
]);
|
||||
|
||||
$session->login($userInfo['no'], $userInfo['id'], $userInfo['grade'], Json::decode($userInfo['acl']??'{}'));
|
||||
$session->login($userInfo['no'], $userInfo['id'], $userInfo['grade'], false, $userInfo['token_valid_until'], Json::decode($userInfo['acl']??'{}'));
|
||||
Json::die([
|
||||
'result'=>true,
|
||||
'reqOTP'=>false,
|
||||
'reason'=>'로그인 되었습니다.'
|
||||
]);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user