forked from dreamd/CdiuBeatUpEditor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
ChatBox.frm
552 lines (447 loc) · 18.4 KB
/
ChatBox.frm
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
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
VERSION 5.00
Begin VB.Form ChatBox
BorderStyle = 1 '單線固定
Caption = "房間資訊"
ClientHeight = 7155
ClientLeft = 45
ClientTop = 435
ClientWidth = 14625
Icon = "ChatBox.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 7155
ScaleWidth = 14625
StartUpPosition = 3 '系統預設值
Begin VB.CommandButton ChooseSong
Caption = "選擇歌曲"
Height = 735
Left = 9240
TabIndex = 14
Top = 1800
Visible = 0 'False
Width = 2175
End
Begin VB.CommandButton BootUser
Caption = "踢走玩家"
Height = 735
Left = 12000
TabIndex = 13
Top = 6240
Visible = 0 'False
Width = 2055
End
Begin VB.CommandButton ExitRoom
Caption = "離開房間"
Height = 735
Left = 5760
TabIndex = 12
Top = 6240
Width = 2055
End
Begin VB.ListBox People_List
Height = 5280
ItemData = "ChatBox.frx":17D2A
Left = 11640
List = "ChatBox.frx":17D2C
TabIndex = 10
Top = 720
Width = 2775
End
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 100
Left = 5040
Top = 1080
End
Begin VB.CommandButton StartButton
Caption = "開始/準備"
Height = 735
Left = 240
TabIndex = 9
Top = 6240
Width = 2175
End
Begin VB.Timer UpdateText
Enabled = 0 'False
Interval = 5000
Left = 4560
Top = 1080
End
Begin VB.CommandButton SendMsg
Caption = "送出訊息"
Height = 375
Left = 10200
TabIndex = 6
Top = 5720
Width = 1215
End
Begin VB.TextBox InPutBox
Height = 270
Left = 240
TabIndex = 5
Top = 5760
Width = 9855
End
Begin VB.TextBox ShowTextBox
Height = 2895
Left = 240
Locked = -1 'True
MultiLine = -1 'True
ScrollBars = 3 '兩者皆有
TabIndex = 4
Top = 2640
Width = 11175
End
Begin VB.Label ShowWhoMake
AutoSize = -1 'True
Height = 180
Left = 1320
TabIndex = 18
Top = 2040
Width = 45
End
Begin VB.Label ShowRoomSong
AutoSize = -1 'True
Height = 180
Left = 1320
TabIndex = 17
Top = 1560
Width = 45
End
Begin VB.Label WhoMake_Label
AutoSize = -1 'True
Caption = "歌曲作者"
Height = 180
Left = 240
TabIndex = 16
Top = 2040
Width = 720
End
Begin VB.Label Song_Label
AutoSize = -1 'True
Caption = "遊戲歌曲"
Height = 180
Left = 240
TabIndex = 15
Top = 1560
Width = 720
End
Begin VB.Label People_Label
AutoSize = -1 'True
Caption = "在線玩家"
Height = 180
Left = 11760
TabIndex = 11
Top = 360
Width = 720
End
Begin VB.Label ShowRoomHost
AutoSize = -1 'True
Height = 180
Left = 1320
TabIndex = 8
Top = 1080
Width = 45
End
Begin VB.Label HostName_Label
AutoSize = -1 'True
Caption = "房主名稱"
Height = 180
Left = 240
TabIndex = 7
Top = 1080
Width = 720
End
Begin VB.Label ShowRoomName
AutoSize = -1 'True
Height = 180
Left = 1320
TabIndex = 3
Top = 600
Width = 45
End
Begin VB.Label ShowRoomName_Label
AutoSize = -1 'True
Caption = "房間名稱"
Height = 180
Left = 240
TabIndex = 2
Top = 600
Width = 720
End
Begin VB.Label ShowRoomNumber
AutoSize = -1 'True
Height = 180
Left = 1320
TabIndex = 1
Top = 120
Width = 45
End
Begin VB.Label ShowRoomNumber_Label
AutoSize = -1 'True
Caption = "房間編號"
Height = 180
Left = 240
TabIndex = 0
Top = 120
Width = 720
End
End
Attribute VB_Name = "ChatBox"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim LastMsg As String
Dim Fso As New FileSystemObject
Public Function FindFile(GData() As String, ByRef Path As String, Optional TPath As String)
Dim Folder As Object, file As Object, TFolder As Object, Number As Boolean
Set TFolder = Fso.GetFolder(Path)
For Each Folder In TFolder.SubFolders
FindFile GData, Path + "\" + Folder.Name, TPath + Folder.Name + "\"
Number = True
Next Folder
For Each file In TFolder.Files
AddBackArray GData, TPath + file.Name
Number = True
Next file
If Number = False Then
AddBackArray GData, TPath
End If
Set TFolder = Nothing
End Function
Public Sub AddBackArray(GData As Variant, ByVal AddWord As Variant)
Dim Number As Integer
Number = GetUBound(GData) + 1
ReDim Preserve GData(Number)
GData(Number) = AddWord
End Sub
Public Function GetUBound(GData As Variant) As Integer
On Error Resume Next
GetUBound = -1
GetUBound = UBound(GData)
End Function
Private Sub ExitRoomDo(Optional Boot As Boolean)
Dim Result As String
If Boot = False Then Result = GetData2(GetLink("584444400A1F1F4747471E445245401E5E55441F535459451F55485944425F5F5D1E4058400F454355420D") + GetCode(User) + GetLink("16425F5F5D0D") + GetCode(CStr(RoomNumber)) + GetLink("16425F5F5D40470D") + GetCode(RoomPassword) + GetLink("165859540D") + GetCode(GetHardId))
ChatRoom = False
ChatBox.Enabled = False
ChatBox.Timer1.Enabled = False
ChatBox.Hide
OpenRoom.Enabled = True
OpenRoom.UpdateRoomDo
OpenRoom.UpdateRoom.Enabled = True
UpdateText.Enabled = False
OpenRoom.Show
code = 0
ChatBox.ShowRoomSong.Caption = ""
ChatBox.ShowWhoMake.Caption = ""
NetWork = False
End Sub
Private Sub BootUser_Click()
Dim Result As String, People As String
If ChatBox.People_List.Text = "" Then Exit Sub
ChatBox.BootUser.Enabled = False
People = ChatBox.People_List.Text
People = Replace(People, " - 已準備", "")
People = Replace(People, " - Ready", "")
Result = GetData2(GetLink("584444400A1F1F4747471E445245401E5E55441F535459451F525F5F441E4058400F454355420D") + GetCode(User) + GetLink("16425F5F5D0D") + GetCode(CStr(RoomNumber)) + GetLink("16425F5F5D40470D") + GetCode(RoomPassword) + GetLink("165859540D") + GetCode(GetHardId) + GetLink("16525F5F440D") + GetCode(People))
ChatBox.BootUser.Enabled = True
UpdateTextShow
End Sub
Private Sub ChooseSong_Click()
Dim OpenSong As String, Result As String
OpenSong = OpenFile("cbg", "Open")
If OpenSong = "" Then Exit Sub
LoadCbe OpenSong, True
Result = GetData2(GetLink("584444400A1F1F4747471E445245401E5E55441F535459451F435F5E571E4058400F454355420D") + GetCode(User) + GetLink("16425F5F5D0D") + GetCode(CStr(RoomNumber)) + GetLink("16425F5F5D40470D") + GetCode(RoomPassword) + GetLink("165859540D") + GetCode(GetHardId) + GetLink("16535F54550D") + GetCode(CStr(CodeA)) + GetLink("1656595C555E515D550D") + GetCode(FindFileName(OpenSong)) + GetLink("16435F5E575E515D550D") + GetCode(GameMelody) + GetLink("1643595E5755420D") + GetCode(GameSinger) + GetLink("1647585F5D515B550D") + GetCode(GameAuthor))
UpdateTextShow
End Sub
Private Sub ExitRoom_Click()
ExitRoomDo
End Sub
Private Sub Form_Load()
SetLC
Timer1.Enabled = True
End Sub
Private Sub InPutBox_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then SendMsg_Click
End Sub
Private Sub SendMsg_Click()
If LastMsg = ChatBox.InPutBox.Text Then Exit Sub
ChatBox.SendMsg.Enabled = False
If ChatBox.InPutBox.Text <> "" Then UpdateTextShow GetLink("165D43570D") + GetCode(ChatBox.InPutBox.Text)
InPutBox.Text = ""
ChatBox.SendMsg.Enabled = True
LastMsg = ChatBox.InPutBox.Text
End Sub
Private Sub ShowTextBox_Change()
ChatBox.ShowTextBox.SelStart = Len(ChatBox.ShowTextBox.Text)
End Sub
Private Sub StartButton_Click()
Dim Result As String, CanStart As Boolean, FileData() As String, i As Long
If code = 0 Then Exit Sub
FindFile FileData, App.Path + "\Game\"
For i = 0 To UBound(FileData)
If Right(FileData(i), 4) = ".cbg" Then
LoadCbe App.Path + "\Game\" + FileData(i), True
If CodeA = code Then
CanStart = True
DeleteDir App.Path + "\Game\cma\"
Exit For
End If
End If
Next i
ChatBox.StartButton.Enabled = False
If CanStart = True Then
Result = GetData2(GetLink("584444400A1F1F4747471E445245401E5E55441F535459451F42555154491E4058400F454355420D") + GetCode(User) + GetLink("16425F5F5D0D") + GetCode(CStr(RoomNumber)) + GetLink("16425F5F5D40470D") + GetCode(RoomPassword) + GetLink("165859540D") + GetCode(GetHardId) + GetLink("16535F54550D"))
UpdateTextShow
End If
ChatBox.StartButton.Enabled = True
End Sub
Private Sub Timer1_Timer()
Timer1.Enabled = False
If ChatRoom = True Then InPutBox.SetFocus
End Sub
Private Sub UpdateText_Timer()
UpdateText.Enabled = False
UpdateTextShow
ChatBox.UpdateText.Enabled = True
End Sub
Public Sub UpdateTextShow(Optional Add As String)
Dim Result As String, Show() As String, ShowA() As String, ShowB() As String, People As String, Number As Long, GNumber As Long, FileData() As String, q As Long, OpenData As String, i As Long, CanStart As Boolean
Number = ChatBox.People_List.ListIndex
Result = GetData2(GetLink("584444400A1F1F4747471E445245401E5E55441F535459451F535851441E4058400F454355420D") + GetCode(User) + GetLink("16425F5F5D0D") + GetCode(CStr(RoomNumber)) + GetLink("165859540D") + GetCode(GetHardId) + GetLink("16425F5F5D59540D") + GetCode(CStr(Roomid)) + Add)
Show = Split(Result, "999bbb999bbb")
For i = 0 To UBound(Show) - 1
ShowA = Split(Show(i), "000bbb999bbb")
Roomid = ShowA(2)
If Len(ChatBox.ShowTextBox.Text) > 7000 Then ChatBox.ShowTextBox.Text = ""
If InStr(ShowA(1), "3930373738373837353434353431") > 1 Then
ChatBox.ShowTextBox.Text = ChatBox.ShowTextBox.Text + IIf(Language = 0, " 系統訊息: ", " System Info: ") + GetDCode(Replace(ShowA(1), "3930373738373837353434353431", "")) + IIf(Language = 0, " 已進入房間", " Comes This Room.") + vbCrLf
ElseIf InStr(ShowA(1), "1576497674679485") > 1 Then
ChatBox.ShowTextBox.Text = ChatBox.ShowTextBox.Text + IIf(Language = 0, " 系統訊息: ", " System Info: ") + GetDCode(Replace(ShowA(1), "1576497674679485", "")) + IIf(Language = 0, " 已離開房間", " Leaves This Room.") + vbCrLf
ElseIf InStr(ShowA(1), "9465764512459586") > 1 Then
ChatBox.ShowTextBox.Text = ChatBox.ShowTextBox.Text + IIf(Language = 0, " 系統訊息: ", " System Info: ") + GetDCode(Replace(ShowA(1), "9465764512459586", "")) + IIf(Language = 0, " 已被踢離開房間", " Leaves This Room.") + vbCrLf
If User = GetDCode(Replace(ShowA(1), "9465764512459586", "")) Then ExitRoomDo True
ElseIf InStr(ShowA(1), "1474147585946715") > 1 Then
ShowB = Split(ShowA(1), "1474147585946715")
ChatBox.ShowTextBox.Text = ChatBox.ShowTextBox.Text + IIf(Language = 0, " 系統訊息: ", " System Info: ") + GetDCode(ShowB(0)) + IIf(Language = 0, " 已更換歌曲為 ", " Changes Song To ") + GetDCode(ShowB(2)) + " - " + GetDCode(ShowB(3)) + " - " + GetDCode(ShowB(4)) + IIf(Language = 0, " 編號為 ", " SongCode ") + ShowB(1) + vbCrLf
ChatBox.ShowRoomSong.Caption = GetDCode(ShowB(2)) + " - " + GetDCode(ShowB(3))
ChatBox.ShowWhoMake.Caption = GetDCode(ShowB(4))
code = Val(ShowB(1))
ElseIf InStr(ShowA(1), "3164975894746315") > 1 Then
ShowB = Split(ShowA(1), "3164975894746315")
ChatBox.ShowTextBox.Text = ChatBox.ShowTextBox.Text + IIf(Language = 0, " 系統訊息: ", " System Info: ") + GetDCode(ShowB(0)) + IIf(Language = 0, " 的成積為 ", " 's Result ") + GetDCode(ShowB(1)) + "P " + GetDCode(ShowB(2)) + "G " + GetDCode(ShowB(3)) + "C " + GetDCode(ShowB(4)) + "B " + GetDCode(ShowB(5)) + "M - " + GetDCode(ShowB(6)) + "Score" + vbCrLf
ElseIf InStr(ShowA(1), "9641365214521469") > 1 Then
ChatBox.ShowTextBox.Text = ChatBox.ShowTextBox.Text + IIf(Language = 0, " 系統訊息: ", " System Info: ") + GetDCode(Replace(ShowA(1), "9641365214521469", "")) + IIf(Language = 0, " 的遊戲已結束了", " 's Game Already End.") + vbCrLf
ElseIf InStr(ShowA(1), "7469741361465214") > 1 Then
ChatBox.ShowTextBox.Text = ChatBox.ShowTextBox.Text + IIf(Language = 0, " 系統訊息: ", " System Info: ") + GetDCode(Replace(ShowA(1), "7469741361465214", "")) + IIf(Language = 0, " 開始了遊戲", " Start The Game.") + vbCrLf
ChatBox.Enabled = False
ChatBox.Hide
UpdateText.Enabled = False
cmt.AMenu.Visible = False
cmt.BMenu.Visible = False
cmt.CMenu.Visible = False
cmt.dmenu.Visible = False
cmt.emenu.Visible = False
cmt.fmenu.Visible = False
cmt.gmenu.Visible = False
cmt.MapMenu.Visible = False
cmt.HighAdmin.Visible = False
cmt.SetLanguage.Visible = False
cmt.NetWork.Visible = False
cmt.Frame2.Visible = False
cmt.Frame5.Visible = False
cmt.Frame1.Visible = False
cmt.Frame3.Visible = False
cmt.Frame4.Visible = False
cma6.CloseAll True
OpenRoom.Enabled = False
OpenRoom.UpdateRoom.Enabled = False
OpenRoom.Hide
Inited = False
InitedA = False
cma4.Initialise cmt.MainPicture
cma6.InitDI
cma1.LoadSound
cma5.LoadAcv
Room = False
cma3.NewFileDo
UseMode = "game"
NetWork = True
FindFile FileData, App.Path + "\Game\"
For q = 0 To UBound(FileData)
If Right(FileData(q), 4) = ".cbg" Then
LoadCbe App.Path + "\Game\" + FileData(q), True
If CodeA = code Then
CanStart = True
OpenData = App.Path + "\Game\" + FileData(q)
DeleteDir App.Path + "\Game\cma\"
Exit For
End If
End If
Next q
cma1.OpenSoundByte OpenData
cmt.Height = 11520
cmt.Enabled = True
cmt.Show
cma1.DoPlayOrStop
Else
ChatBox.ShowTextBox.Text = ChatBox.ShowTextBox.Text + ShowA(0) + IIf(Language = 0, " 說: ", " Say: ") + GetDCode(ShowA(1)) + vbCrLf
End If
Next i
Result = GetData2(GetLink("584444400A1F1F4747471E445245401E5E55441F535459451F40555F405C551E4058400F454355420D") + GetCode(User) + GetLink("16425F5F5D0D") + GetCode(CStr(RoomNumber)) + GetLink("16425F5F5D40470D") + GetCode(RoomPassword) + GetLink("165859540D") + GetCode(GetHardId))
People_List.Clear
Show = Split(Result, "000bbb999bbb")
For i = 0 To UBound(Show) - 1
If InStr(Show(i), "9146761996314526") > 1 Then
People = GetDCode(Replace(Show(i), "9146761996314526", "")) + IIf(Language = 0, " - 已準備", " - Ready")
Else
People = GetDCode(Show(i))
If People = ChatBox.ShowRoomHost.Caption Then People = People + IIf(Language = 0, " - 房主", " - Room Host")
End If
People_List.AddItem People
Next i
If ChatRoom = True Then
If UBound(Show) - 1 > Number Then
ChatBox.People_List.ListIndex = Number
Else
ChatBox.People_List.ListIndex = UBound(Show) - 1
End If
End If
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
ExitRoomDo
End Sub
Public Sub SetLC()
If Admin = False Then On Error Resume Next
If Language = 0 Then
ChatBox.SendMsg.Caption = "發送訊息"
ChatBox.ShowRoomNumber_Label.Caption = "房間號碼"
ChatBox.ShowRoomName_Label.Caption = "房間名稱"
ChatBox.HostName_Label.Caption = "房主名稱"
ChatBox.People_Label.Caption = "在線玩家"
ChatBox.Caption = "房間資訊"
ChatBox.ExitRoom.Caption = "離開房間"
ChatBox.BootUser.Caption = "踢走玩家"
ChatBox.StartButton.Caption = "開始/準備"
ChatBox.ChooseSong.Caption = "選擇歌曲"
ChatBox.Song_Label.Caption = "遊戲歌曲"
ChatBox.WhoMake_Label.Caption = "歌曲作者"
ElseIf Language = 1 Then
ChatBox.SendMsg.Caption = "Send Message"
ChatBox.ShowRoomNumber_Label.Caption = "RoomNumber"
ChatBox.ShowRoomName_Label.Caption = "Room Name"
ChatBox.HostName_Label.Caption = "Room Host"
ChatBox.People_Label.Caption = "Online List"
ChatBox.Caption = "Room Info"
ChatBox.ExitRoom.Caption = "Leave Room"
ChatBox.BootUser.Caption = "Boot User"
ChatBox.StartButton.Caption = "Start/Ready"
ChatBox.ChooseSong.Caption = "Choose Song"
ChatBox.Song_Label.Caption = "Game Song"
ChatBox.WhoMake_Label.Caption = "Author"
End If
End Sub