-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.lua
More file actions
385 lines (331 loc) · 13.5 KB
/
main.lua
File metadata and controls
385 lines (331 loc) · 13.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
REPKOR = RegisterMod("Repentance+ Korean", 1)
local mod = REPKOR
mod.version = "2.25"
Isaac.DebugString("Starting Repentance+ Korean v" .. mod.version) -- 디버깅
mod.isRepentancePlus = REPENTANCE_PLUS or FontRenderSettings ~= nil
mod.runningRep = REPENTANCE and not REPENTANCE_PLUS
mod.isTruePatch = Options.Language == "kr"
mod.rgon = REPENTOGON
if mod.isRepentancePlus and mod.isTruePatch then
Isaac.DebugString("Yay! The game language is already set to Korean!")
elseif not mod.isRepentancePlus then
Isaac.DebugString("Nuh Uh! It did not run with Repentance+!")
return
end
local function GetCurrentModPath()
if debug then
return string.sub(debug.getinfo(GetCurrentModPath).source,2) .. "/../"
end
--use some very hacky trickery to get the path to this mod
local _, err = pcall(require, "")
local _, basePathStart = string.find(err, "no file '", 1)
local _, modPathStart = string.find(err, "no file '", basePathStart)
local modPathEnd, _ = string.find(err, ".lua'", modPathStart)
local modPath = string.sub(err, modPathStart+1, modPathEnd-1)
modPath = string.gsub(modPath, "\\", "/")
modPath = string.gsub(modPath, "//", "/")
modPath = string.gsub(modPath, ":/", ":\\")
return modPath
end
mod.modPath = GetCurrentModPath()
------ EID ------
mod:AddCallback(
"EID_EVALUATE_AUTO_LANG",
function()
return "ko_kr"
end
)
------ 경고 메시지 ------
local HUD = Game():GetHUD()
local warningFontBlack = Font()
warningFontBlack:Load("font/cjk/lanapixel.fnt")
local warningFont12 = Font()
warningFont12:Load(mod.modPath .. "resources/font/teammeatex/teammeatex12.fnt")
local warningFont16 = Font()
warningFont16:Load(mod.modPath .. "resources/font/teammeatex/teammeatex16.fnt")
local installDocs = "'바닐라에 설치'"
if mod.rgon then
installDocs = "'RGON에 설치'"
end
local function DrawWarningString(font, text, offset, color)
if HUD:IsVisible() then
HUD:SetVisible(false)
end
for i = 0, Game():GetNumPlayers() - 1 do
if (Isaac.GetPlayer(i).ControlsEnabled) then
Isaac.GetPlayer(i).ControlsEnabled = false
end
end
local x = Isaac.GetScreenWidth() / 2 - font:GetStringWidthUTF8(text) / 2
local y = Isaac.GetScreenHeight() / 2 - offset
font:DrawStringUTF8(text, x, y, color or KColor(1, 1, 1, 1), 0, true)
end
mod:AddCallback(ModCallbacks.MC_POST_RENDER, function()
if mod.isRepentancePlus and mod.isTruePatch then return end
warningFontBlack:DrawStringScaledUTF8("쀏", 400, -1500, 400, 400, KColor(0, 0, 0, 1), 0, true)
DrawWarningString(warningFont16, "리펜턴스+ 한글패치가 설치되지 않았습니다.", 55, KColor(1, 0.5, 0.5, 1))
DrawWarningString(warningFont12, "https://ohy.kr/korean에서 " .. installDocs .. " 부분의", 18)
DrawWarningString(warningFont12, "안내를 따라 한글패치를 적용해 주십시오.", 0)
DrawWarningString(warningFont12, "(Windows 환경이 아닌 경우 Q&A 부분을 참조하십시오)", -24, KColor(1, 1, 1, 0.5))
end)
------ 스크롤 공지 ------
--[[
local MOVE_DURATION = 1600 -- 메시지 이동 시간
local warningFontScroll = Font()
warningFontScroll:Load(mod.modPath .. "resources/font/old_kr/kr_font12.fnt")
mod.messageFrame = nil
mod.startX = nil
mod.already = false
mod:AddCallback(ModCallbacks.MC_POST_RENDER, function()
if not mod.rgon then return end
if Isaac.GetString("Items", "DATAMINER_NAME") == "데이터마이너" then return end
if Game():GetRoom():IsClear() and mod.messageFrame ~= nil and mod.messageFrame <= MOVE_DURATION then
local t = mod.messageFrame
local x = mod.startX - (Isaac.GetScreenWidth() + 1250) * (t / MOVE_DURATION)
local y = Isaac.GetScreenHeight() * 0.1
local color = KColor(1, 1, 1, 1)
warningFontBlack:DrawStringScaledUTF8("쀏", 400, Isaac.GetScreenHeight() * 0.1 - 5, 400, 1.4, KColor(0, 0, 0, 2/3), 0, true)
warningFontScroll:DrawStringUTF8(
"리펜턴스+ 한글패치는 REPENTOGON+와 호환되지 않습니다." ..
"강제로 REPENTOGON+에 한글패치를 적용할 경우 게임이 손상될 수 있습니다. " ..
"자세한 내용은 한글패치 창작마당 페이지(https://ohy.kr/korean)를 참고하십시오.",
x + 50,
y,
color,
0
)
if not Game():IsPaused() then
mod.messageFrame = mod.messageFrame + 1
end
mod.already = true
else
if not mod.already then
mod.messageFrame = 0
mod.startX = Isaac.GetScreenWidth()
end
end
end)]]
------ MCM + 아빠의 쪽지 자막 ------
local json = require('json')
local MCMLoaded, MCM = pcall(require, "scripts.modconfig")
mod.config = {
dubbing = true,
subtitles = true,
subOffset = 45,
subOpacity = 2/3,
}
if MCMLoaded and MCM then
local data_str = Isaac.LoadModData(mod)
if data_str and data_str ~= "" then
local success, decoded = pcall(json.decode, data_str)
if success and type(decoded) == "table" then
mod.config = decoded
else
Isaac.DebugString("[REPKOR] Json decode failed: " .. (decoded or "unknown error") .. " | Configs are set by default.")
Isaac.SaveModData(mod, json.encode(mod.config))
end
end
local function save()
mod.config.hint = "koca" .. (mod.config.dubbing and "1" or "0") ..
"kocb" .. (mod.config.subtitles and "1" or "0") ..
"kocc" .. (mod.config.subOffset and "1" or "0") ..
"kocd" .. (mod.config.subOpacity and "1" or "0")
Isaac.SaveModData(mod, json.encode(mod.config))
end
MCM.AddText("Rep+ Korean", "CC", " ");
MCM.AddSetting("Rep+ Korean", "CC", {
Type = MCM.OptionType.BOOLEAN,
Attribute = "Toggle subtitles",
CurrentSetting = function()
return mod.config.subtitles
end,
Display = function()
return "승천 시퀀스 자막: " .. (mod.config.subtitles and "켜기" or "끄기")
end,
OnChange = function(newOption)
mod.config.subtitles = newOption;
save()
end,
Info = "'아빠의 쪽지' 아이템을 획득 후 나오는 승천 시퀀스의 자막을 표시할지 설정합니다."
});
MCM.AddSetting("Rep+ Korean", "CC", {
Type = MCM.OptionType.NUMBER,
Attribute = "Subtitles Y offset",
Minimum = -10,
Maximum = 1000,
ModifyBy = 5,
CurrentSetting = function()
return mod.config.subOffset
end,
Display = function() return
"자막 오프셋: " .. mod.config.subOffset
end,
OnChange = function(newOption)
mod.config.subOffset = newOption
save()
end,
Info = "자막이 화면 하단으로부터 얼마나 떨어져 있는지 조정합니다. (기본값: 45)"
});
MCM.AddSetting("Rep+ Korean", "CC", {
Type = MCM.OptionType.NUMBER,
Attribute = "Subtitles opacity",
Minimum = 0,
Maximum = 1,
ModifyBy = 0.01,
CurrentSetting = function()
return mod.config.subOpacity
end,
Display = function() return
"자막 불투명도: " .. string.format("%.0f", mod.config.subOpacity * 100) .. "%"
end,
OnChange = function(newOption)
mod.config.subOpacity = newOption
save()
end,
Info = "자막의 불투명도를 설정합니다. (기본값: 67%)"
});
MCM.AddText("Rep+ Korean", "Dub", " ");
MCM.AddText("Rep+ Korean", "Dub", "게임을 재시작해야 설정이 적용됩니다.");
MCM.AddText("Rep+ Korean", "Dub", " ");
MCM.AddSetting("Rep+ Korean", "Dub", {
Type = MCM.OptionType.BOOLEAN,
Attribute = "Toggle dubbing",
CurrentSetting = function()
return mod.config.dubbing
end,
Display = function()
return "한국어 더빙: " .. (mod.config.dubbing and "켜기" or "끄기")
end,
OnChange = function(newOption)
mod.config.dubbing = newOption
save()
end,
Info = "한국어 더빙을 켜고 끕니다."
});
end
local subtitleFont = Font()
subtitleFont:Load( mod.modPath .. "resources/font/pftempestasevencondensed.fnt", true)
mod.Subtitles = include('res.dadsnote_sub')
mod.subStart = {} -- 실제 시작 시각(초)
mod.playingSounds = {} -- 이전 프레임에서의 상태
function mod:RenderSub(scene)
local startTime = mod.subStart[scene]
if not startTime then return end
local now = Isaac.GetTime() / 1000
local elapsed = now - startTime
if elapsed < 0 then return end
local subs = mod.Subtitles[scene]
if not subs then return end
for _, entry in ipairs(subs) do
if elapsed >= entry.start and elapsed < (entry.start + entry.dur) then
local text = entry.text
local x = Isaac.GetScreenWidth() / 2 - subtitleFont:GetStringWidthUTF8(text) / 2
local y = Isaac.GetScreenHeight() - mod.config.subOffset
subtitleFont:DrawStringUTF8(text, x, y, KColor(1, 1, 1, mod.config.subOpacity), 0, true)
break
end
end
end
mod:AddCallback(ModCallbacks.MC_POST_RENDER, function()
if not mod.config then return end
if not mod.config.subtitles then return end
local VoiceSFX = SFXManager()
for i = 598, 601 do
local scene = i - 597
local soundId = i
if KoreanVoiceDubbing then
soundId = Isaac.GetSoundIdByName("DADS_NOTE_KOREAN_" .. scene)
end
local nowPlaying = VoiceSFX:IsPlaying(soundId)
if nowPlaying and not mod.playingSounds[scene] then
mod.playingSounds[scene] = true
mod.subStart[scene] = Isaac.GetTime() / 1000
end
if not nowPlaying and mod.playingSounds[scene] then
mod.playingSounds[scene] = nil
end
if nowPlaying then
mod:RenderSub(scene)
end
end
end)
------ G FUEL! ------
local i_queueLastFrame = {}
local i_queueNow = {}
local gFuelDesc = {
["FASTER UP!"] = "더 빠른 증가!",
["GENEROSITY UP!"] = "관대함 증가!",
["G UP!"] = "G 증가!",
["WISDOM UP!"] = "지혜 증가!",
["GAMER SPEED UP!"] = "게이머 속도 증가!",
["REACTION UP!"] = "반응 증가!",
["A STAT UP!"] = "능력치 하나 증가!",
["GOOD UP!"] = "좋음 증가!",
["BUILDING SPEED UP!"] = "건축 속도 증가!",
["MIX UP!"] = "혼합 증가!",
["SLEEP HOURS DOWN!"] = "수면 시간 감소!",
["MISERY UP!"] = "비참함 증가!",
["MANA UP!"] = "마력 증가!",
["MOVEMENT UP!"] = "움직임 증가!",
["RESPECT UP!"] = "존경 증가!",
["SHOTS UP!"] = "발사량 증가!",
["SENTIENCE UP!"] = "지각력 증가!",
["WHITE BLOOD CELLS UP!"] = "백혈구 증가!",
["FAME UP!"] = "명성 증가!",
["THOU ART HERO!"] = "너는 영웅이다!",
["BLOOD UP!"] = "혈액 증가!",
["POPULATION UP!"] = "인구 증가!",
["FAVOR UP!"] = "호의 증가!",
["RANK UP! REACHED RANK: ISAAC'S FACE"] = "랭크 상승! 도달 랭크: 아이작의 얼굴",
["STRENGTH UP!"] = "힘 증가!",
["RISK UP!"] = "위험 증가!",
["EXPLOSIONS UP!"] = "폭발력 증가!",
["FEAR UP!"] = "공포 증가!",
["BONES UP!"] = "뼈 증가!",
["SHARPNESS UP!"] = "날카로움 증가!",
["BUILDING SPEED UP!"] = "건축 속도 증가!",
["SOUL UP!"] = "영혼 증가!",
["VITALITY UP!"] = "생명력 증가!",
["SUNSHINE UP!"] = "햇살 증가!",
["VOLUME UP!"] = "볼륨 증가!",
["SUSPICION UP!"] = "의심 증가!",
["MORALITY UP!"] = "도덕성 증가!",
["AMBITION UP!"] = "야망 증가!",
["DISC SPEED UP!"] = "디스크 속도 증가!",
["HURTFUL WORDS RESISTANCE UP!"] = "언어폭력 저항성 증가!",
["AMMO CAPACITY UP!"] = "탄약 용량 증가!",
["ACIDITY UP!"] = "산성도 증가!",
["HEIGHT UP!"] = "키 증가!",
["GOD'S LIGHT UP!"] = "신의 빛 증가!",
["TEAR TASTE UP!"] = "눈물 맛 증가!",
["AIR RESISTANCE UP!"] = "공기 저항 증가!",
["SHUTTER SPEED UP!"] = "셔터 속도 증가!",
["MOMENTUM UP!"] = "운동량 증가!",
["ACCEPTANCE UP!"] = "수용력 증가!",
["HUMOR UP!"] = "유머 증가!",
}
mod:AddCallback(ModCallbacks.MC_POST_PLAYER_UPDATE,
---@param player EntityPlayer
function(_, player)
local playerKey = tostring(player.InitSeed)
i_queueNow[playerKey] = player.QueuedItem.Item
if i_queueNow[playerKey] and i_queueNow[playerKey]:IsCollectible() and i_queueLastFrame[playerKey] == nil then
local itemID = i_queueNow[playerKey].ID
if itemID == -1 and i_queueNow[playerKey].Name == "G FUEL!" then -- G FUEL!
local g_origin = i_queueNow[playerKey].Description
local g_description = ""
if g_origin and g_origin ~= "" then
g_description = gFuelDesc[g_origin]
else
g_description = gFuelDesc[(player:GetCollectibleRNG(itemID):RandomInt(50) + 1)]
end
if g_description then
HUD:ShowItemText("G FUEL!", g_description or "한글패치 제작자에게 연락주세요")
end
end
end
i_queueLastFrame[playerKey] = i_queueNow[playerKey]
end
)
------ 버전 출력 ------
print("Repentance+ Korean " .. string.format("%.2f", mod.version) .. " loaded.")