Skip to content

Commit 54bedc8

Browse files
committed
fix: 골드채굴 0강 무한판매 버그 + 모니터링 F9/파서 수정 (v2.8.9)
- 골드채굴: cycleTarget=0일 때 0강 판매 무한루프 수정 (최소 1강) - 모니터링: F9 종료 안되던 버그 수정 (checkStop 폴링 추가) - 모니터링: 강화 파서 유니코드 → 호환 수정 - 모니터링: 판매 레벨 추출 패턴 추가, 게임봇 감지 확장
1 parent 58ea5ad commit 54bedc8

File tree

3 files changed

+35
-12
lines changed

3 files changed

+35
-12
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.8"
22+
const VERSION = "2.8.9"
2323

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

internal/game/engine.go

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1107,7 +1107,8 @@ func (e *Engine) loopGoldMine() {
11071107
}
11081108

11091109
// 이미 목표 달성한 경우 바로 판매 (타입별 목표 기준)
1110-
if e.sessionProfile.Level >= currentTypeTarget {
1110+
// 0강은 판매 불가이므로 1 이상일 때만 판매
1111+
if e.sessionProfile.Level >= currentTypeTarget && e.sessionProfile.Level > 0 {
11111112
if itemType == "special" {
11121113
fmt.Printf("✅ 목표 달성! 특수 아이템 [%s] +%d (목표 +%d) → 보관\n", e.sessionProfile.SwordName, e.sessionProfile.Level, specialTarget)
11131114
overlay.UpdateStatus("💰 골드 채굴\n✅ 특수 +%d 보관!", e.sessionProfile.Level)
@@ -1218,6 +1219,11 @@ func (e *Engine) loopGoldMine() {
12181219
cycleTarget = trashTarget // 쓰레기 목표 (0이면 바로 판매)
12191220
}
12201221

1222+
// 0강은 게임에서 판매 불가 → 최소 1강까지 강화 필요
1223+
if cycleTarget < 1 {
1224+
cycleTarget = 1
1225+
}
1226+
12211227
// 2. 목표 도달 확인 (타입별 목표 기준)
12221228
// 이미 목표 달성이면 강화 스킵하고 바로 판매
12231229
var finalLevel int
@@ -2541,8 +2547,17 @@ func (e *Engine) loopMonitor() {
25412547
ticker := time.NewTicker(3 * time.Second)
25422548
defer ticker.Stop()
25432549

2550+
// F9 체크용 (200ms마다)
2551+
checkTicker := time.NewTicker(200 * time.Millisecond)
2552+
defer checkTicker.Stop()
2553+
25442554
for e.running {
25452555
select {
2556+
case <-checkTicker.C:
2557+
if e.checkStop() {
2558+
return
2559+
}
2560+
continue
25462561
case <-ticker.C:
25472562
// 채팅 텍스트 읽기
25482563
currentText := e.readChatClipboard()

internal/game/parser.go

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1072,14 +1072,14 @@ func (e *MonitorEvent) Hash() string {
10721072

10731073
// 모니터링용 정규식 패턴
10741074
var (
1075-
// 강화 결과 패턴: "+N → +M" 또는 "+N -> +M"
1076-
monitorEnhancePattern = regexp.MustCompile(`\+(\d+)\s*[→\->]+\s*\+(\d+)`)
1075+
// 강화 결과 패턴: "+N → +M" 또는 "+N -> +M" (→는 Unicode라 alternation 사용)
1076+
monitorEnhancePattern = regexp.MustCompile(`\+(\d+)\s*(?:→|->)\s*\+(\d+)`)
10771077
// 강화 성공 패턴 (더 넓은 범위)
1078-
monitorSuccessPattern = regexp.MustCompile(`(?:강화.*성공|레벨.*상승|성공.*강화)`)
1078+
monitorSuccessPattern = regexp.MustCompile(`(?:강화.*성공|레벨.*상승|성공.*강화|강화 성공)`)
10791079
// 강화 파괴 패턴
1080-
monitorDestroyPattern = regexp.MustCompile(`(?:파괴|부서|사라)`)
1080+
monitorDestroyPattern = regexp.MustCompile(`(?:강화 파괴|파괴|부서|사라)`)
10811081
// 강화 유지 패턴
1082-
monitorHoldPattern = regexp.MustCompile(`(?:유지|실패.*유지|레벨.*유지)`)
1082+
monitorHoldPattern = regexp.MustCompile(`(?:강화 유지|유지|실패.*유지|레벨.*유지)`)
10831083
// 배틀 중계 패턴: "〖🎙️ 배틀 중계〗" 감지
10841084
monitorBattleHeaderPattern = regexp.MustCompile(`배틀\s*중계`)
10851085
// 배틀 참가자 패턴: "@유저 『[+N] 검이름』" 또는 "『[+N] 검이름』" (유저명 없을 수 있음)
@@ -1091,11 +1091,13 @@ var (
10911091
// 판매 결과 패턴 (더 넓은 범위)
10921092
monitorSaleGoldPattern = regexp.MustCompile(`획득\s*골드[:\s]*\+?(\d{1,3}(?:,\d{3})*)\s*G`)
10931093
// 판매 태그 패턴
1094-
monitorSaleTagPattern = regexp.MustCompile(`\[판매\]`)
1094+
monitorSaleTagPattern = regexp.MustCompile(`검\s*판매`)
1095+
// 판매 레벨 추출 패턴: '[+N] 검이름' 형식에서 레벨 추출
1096+
monitorSaleLevelPattern = regexp.MustCompile(`'\[\+(\d+)\]\s*[^']+`)
10951097
// 특수 아이템 발견 패턴 (더 넓은 범위)
10961098
monitorSpecialPattern = regexp.MustCompile(`(?:특수|히든|hidden|레어|희귀).*?『([^』]+)』`)
1097-
// 게임 봇 메시지 감지 패턴
1098-
gameBotIndicators = regexp.MustCompile(`(?:━━|──|\[강화\]|\[배틀\]|\[판매\]|\[프로필\]|\[랭킹\]|⚔️|💰|💵|💶|📊)`)
1099+
// 게임 봇 메시지 감지 패턴 (〖〗 추가, ✨💥💦 추가)
1100+
gameBotIndicators = regexp.MustCompile(`(?:━━|──|〖|〗|\[강화\]|\[배틀\]|\[판매\]|\[프로필\]|\[랭킹\]|⚔️|💰|💵|💶|📊|✨|💥|💦)`)
10991101
)
11001102

11011103
// IsGameBotMessage 게임 봇 메시지인지 확인
@@ -1274,8 +1276,14 @@ func parseMonitorBlock(text string) *MonitorEvent {
12741276
evt.GoldEarned, _ = strconv.Atoi(goldStr)
12751277
}
12761278

1277-
// 레벨 및 아이템 정보
1278-
evt.Level = ExtractLevel(text)
1279+
// 레벨 추출 (판매 메시지에서 '[+N] 검이름' 형식)
1280+
if matches := monitorSaleLevelPattern.FindStringSubmatch(text); len(matches) > 1 {
1281+
evt.Level, _ = strconv.Atoi(matches[1])
1282+
} else {
1283+
evt.Level = ExtractLevel(text)
1284+
}
1285+
1286+
// 아이템 정보
12791287
evt.ItemName = ExtractItemName(text)
12801288
if evt.ItemName != "" {
12811289
evt.ItemType = DetermineItemType(evt.ItemName)

0 commit comments

Comments
 (0)