Skip to content

Commit aa2cf16

Browse files
committed
fix: 하드코딩된 폴백값 제거 (v2.8.7)
- data.go: getDefaultOptimalLevel() 0 반환으로 변경 - data.go: GetOptimalLevelsByType() 초기값 0으로 변경 - data.go: CalcOptimalSellLevel() 기본값 0으로 변경 - 서버 데이터 없으면 0 (바로 판매) 표시
1 parent c7088b5 commit aa2cf16

File tree

3 files changed

+170
-135
lines changed

3 files changed

+170
-135
lines changed

cmd/sword-macro/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func init() {
1919
runtime.LockOSThread()
2020
}
2121

22-
const VERSION = "2.8.6"
22+
const VERSION = "2.8.7"
2323

2424
func main() {
2525
// Windows 콘솔 ANSI 지원 활성화 및 UTF-8 설정

internal/game/data.go

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ func CalcOptimalSellLevel(currentGold int) int {
281281
prices := GetAllSwordPrices()
282282

283283
if rates == nil || prices == nil {
284-
return 10 // 기본값
284+
return 0 // 데이터 없으면 바로 판매
285285
}
286286

287287
// 각 목표 레벨별 기대 수익 계산
@@ -433,10 +433,12 @@ func GetOptimalLevelByType(itemType string) (int, bool) {
433433

434434
// GetOptimalLevelsByType 모든 타입의 최적 판매 레벨 조회
435435
// 반환: map[타입]최적레벨 (예: {"normal": 10, "special": 12})
436+
// 서버 데이터 없으면 0 반환 (바로 판매)
436437
func GetOptimalLevelsByType() map[string]int {
438+
// 기본값: 모두 0 (서버 데이터 없으면 바로 판매)
437439
result := map[string]int{
438-
"normal": 10,
439-
"special": 10,
440+
"normal": 0,
441+
"special": 0,
440442
"trash": 0,
441443
}
442444

@@ -445,25 +447,19 @@ func GetOptimalLevelsByType() map[string]int {
445447
return result
446448
}
447449

450+
// 서버 값으로 업데이트 (0도 유효한 값이므로 그대로 사용)
448451
for itemType, typeData := range data.ByType {
449-
if typeData.OptimalLevel > 0 {
450-
result[itemType] = typeData.OptimalLevel
451-
}
452+
result[itemType] = typeData.OptimalLevel
452453
}
453454

454455
return result
455456
}
456457

457458
// getDefaultOptimalLevel 타입별 기본 최적 레벨
459+
// 서버 데이터가 없으면 0 반환 (바로 판매 = 강화 안함)
458460
func getDefaultOptimalLevel(itemType string) int {
459-
switch itemType {
460-
case "trash":
461-
return 0 // 쓰레기는 강화 안함
462-
case "special":
463-
return 10 // 특수 아이템 기본값
464-
default:
465-
return 10 // 일반 아이템 기본값
466-
}
461+
// 데이터 없으면 모두 0 (바로 판매)
462+
return 0
467463
}
468464

469465
// FormatGold 골드를 정확한 콤마 표기로 포맷 (예: 184,331,258)

0 commit comments

Comments
 (0)