game: 유산 포인트로 도시와 턴 시간을 동시에 설정할 수 없도록 변경

This commit is contained in:
2022-07-05 20:18:02 +09:00
parent 048d71920c
commit 2b483749bc
2 changed files with 51 additions and 7 deletions
+5
View File
@@ -75,6 +75,7 @@ class Join extends \sammo\BaseAPI
if (!$v->validate()) {
return $v->errorStr();
}
return null;
}
@@ -104,6 +105,10 @@ class Join extends \sammo\BaseAPI
$inheritCity = $this->args['inheritCity'] ?? null;
$inheritBonusStat = $this->args['inheritBonusStat'] ?? null;
if($inheritTurntime !== null && $inheritCity !== null){
return '턴과 도시를 동시에 지정할 수 없습니다.';
}
$rootDB = RootDB::db();
//회원 테이블에서 정보확인
$member = $rootDB->queryFirstRow('SELECT `no`, id, picture, grade, `name`, imgsvr FROM member WHERE no=%i', $userID);
+46 -7
View File
@@ -174,7 +174,7 @@
<div class="row">
<div class="col col-6 a-right align-self-center">도시</div>
<div class="col col-6 align-self-center">
<select v-model.number="args.inheritCity" class="form-select form-inline" style="max-width: 20ch">
<select v-model.number="inheritCity" class="form-select form-inline" style="max-width: 20ch">
<option :value="undefined">사용안함</option>
<option v-for="city in availableInheritCity" :key="city.id" :value="city.id">
{{ `[${city.region}] ${city.name}` }}
@@ -216,13 +216,25 @@
<div class="a-center">추가 능력치 고정</div>
<div class="row">
<div class="col">
<NumberInputWithInfo v-model="(args.inheritBonusStat ?? [0, 0, 0])[0]" :max="stats.bonusMax" title="통솔" />
<NumberInputWithInfo
v-model="(args.inheritBonusStat ?? [0, 0, 0])[0]"
:max="stats.bonusMax"
title="통솔"
/>
</div>
<div class="col">
<NumberInputWithInfo v-model="(args.inheritBonusStat ?? [0, 0, 0])[1]" :max="stats.bonusMax" title="무력" />
<NumberInputWithInfo
v-model="(args.inheritBonusStat ?? [0, 0, 0])[1]"
:max="stats.bonusMax"
title="무력"
/>
</div>
<div class="col">
<NumberInputWithInfo v-model="(args.inheritBonusStat ?? [0, 0, 0])[2]" :max="stats.bonusMax" title="지력" />
<NumberInputWithInfo
v-model="(args.inheritBonusStat ?? [0, 0, 0])[2]"
:max="stats.bonusMax"
title="지력"
/>
</div>
</div>
</div>
@@ -346,7 +358,7 @@ watch(gameConstStore, (gameConst) => {
total: gameConst.gameConst.defaultStatTotal,
bonusMin: gameConst.gameConst.defaultStatMin,
bonusMax: gameConst.gameConst.defaultStatMax,
}
};
args.value = {
name: member.name,
@@ -361,8 +373,6 @@ watch(gameConstStore, (gameConst) => {
inheritSpecial: undefined,
inheritTurntime: undefined,
};
});
onMounted(async () => {
@@ -466,6 +476,17 @@ watch(displayInherit, (newValue: boolean) => {
localStorage.setItem(`conf.${serverID}.join.displayInherit`, JSON.stringify(newValue));
});
const inheritCity = ref<number>();
watch(inheritCity, (newValue: undefined | number) => {
if (!args.value) throw "nyc";
if (!newValue) {
args.value.inheritCity = undefined;
return;
}
args.value.inheritCity = inheritCity.value;
});
const inheritTurnTimeSet = ref(false);
watch(inheritTurnTimeSet, (newValue: boolean) => {
if (!args.value) throw "nyc";
@@ -477,6 +498,24 @@ watch(inheritTurnTimeSet, (newValue: boolean) => {
args.value.inheritTurntime = inheritTurnTimeMinute.value * 60 + inheritTurnTimeSecond.value;
});
watch(
[inheritCity, inheritTurnTimeSet],
([newInheritCity, newInheritTurnTimeSet], [oldInheritCity, oldInheritTurnTimeSet]) => {
if (newInheritCity === undefined || newInheritTurnTimeSet === false) {
return;
}
alert("도시와 턴 시간을 동시에 설정할 수 없습니다.");
if (newInheritCity !== oldInheritCity) {
inheritCity.value = undefined;
}
if (newInheritTurnTimeSet !== oldInheritTurnTimeSet) {
inheritTurnTimeSet.value = false;
}
},
{ immediate: true }
);
const inheritTurnTimeMinute = ref(0);
watch(inheritTurnTimeMinute, (newValue: number) => {
if (!args.value) throw "nyc";