forked from harliq/AceCreator
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAceCreator.cs
907 lines (722 loc) · 40.7 KB
/
AceCreator.cs
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
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Reflection;
using System.Text.RegularExpressions;
using Decal.Adapter;
using Decal.Adapter.Wrappers;
using MyClasses.MetaViewWrappers;
using VirindiViewService;
using VirindiViewService.Controls;
namespace AceCreator
{
//Attaches events from core
[WireUpBaseEvents]
//View (UI) handling
[MVView("AceCreator.mainView.xml")]
[MVWireUpControlEvents]
// FriendlyName is the name that will show up in the plugins list of the decal agent (the one in windows, not in-game)
// View is the path to the xml file that contains info on how to draw our in-game plugin. The xml contains the name and icon our plugin shows in-game.
// The view here is SamplePlugin.mainView.xml because our projects default namespace is SamplePlugin, and the file name is mainView.xml.
// The other key here is that mainView.xml must be included as an embeded resource. If its not, your plugin will not show up in-game.
[FriendlyName("AceCreator")]
public partial class AceCreator : PluginBase
{
// For seeing ID has completed
WorldObject WO;
private readonly AceItem aceItem = new AceItem();
private ChatMessages cm = new ChatMessages();
public static HudTabView TabView { get; private set; }
private static VirindiViewService.ViewProperties properties;
private static VirindiViewService.ControlGroup controls;
private static VirindiViewService.HudView view;
/// <summary>
/// This is called when the plugin is started up. This happens only once.
/// </summary>
protected override void Startup()
{
try
{
// This initializes our static Globals class with references to the key objects your plugin will use, Host and Core.
// The OOP way would be to pass Host and Core to your objects, but this is easier.
System.IO.Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.Personal) + @"\Decal Plugins\AceContentCreator\");
CoreManager.Current.ChatBoxMessage += new EventHandler<ChatTextInterceptEventArgs>(Current_ChatBoxMessage);
Globals.Init("AceCreator", Host, Core);
LoadWindow();
LoadPathSettings();
//JsonChoiceListLoadFiles();
//SqlChoiceListLoadFiles();
RefreshAllLists();
LoadParentObjectsFile();
//Initialize the view.
// MVWireupHelper.WireupStart(this, Host);
}
catch (Exception ex) { Util.LogError(ex); }
}
/// <summary>
/// This is called when the plugin is shut down. This happens only once.
/// </summary>
protected override void Shutdown()
{
try
{
// Save Path Settings
//Destroy the view.
MVWireupHelper.WireupEnd(this);
}
catch (Exception ex) { Util.LogError(ex); }
}
public void LoadWindow()
{
// Create the view
VirindiViewService.XMLParsers.Decal3XMLParser parser = new VirindiViewService.XMLParsers.Decal3XMLParser();
parser.ParseFromResource("AceCreator.mainView.xml", out properties, out controls);
view = new VirindiViewService.HudView(properties, controls);
// view.Title = "ACE Content Creator - Version " + typeof(AceCreator).Assembly.GetName().Version;
// Get the file version for the notepad.
string assemblyFolder = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
FileVersionInfo myFileVersionInfo = FileVersionInfo.GetVersionInfo( assemblyFolder+ @"\AceCreator.dll");
//view.Title = "ACE Content Creator - Version " + typeof(AceCreator).Assembly.GetName().Version;
view.Title = "ACE Content Creator - Version " + myFileVersionInfo.FileVersion + " Dekaru Fork";
// In order to have some sort of organization and to keep the clutter down,
// the varibles for each tab are declared in their corresponding TabFiles, along with the other control events.
// ***** Content Tab *****
ChoiceJSON = (HudCombo)view["ChoiceJSON"];
ChoiceJSON.Change += new EventHandler(ChoiceJSON_Change);
CommandConvertJSON = view != null ? (HudButton)view["CommandConvertJSON"] : new HudButton();
CommandConvertJSON.Hit += new EventHandler(ButtonConvertJSON_Click);
ButtonOpenJSON = view != null ? (HudButton)view["ButtonOpenJSON"] : new HudButton();
ButtonOpenJSON.Hit += new EventHandler(ButtonOpenJSON_Click);
ChoiceSQL = (HudCombo)view["ChoiceSQL"];
ChoiceSQL.Change += new EventHandler(ChoiceSQL_Change);
CommandConvertSQL = view != null ? (HudButton)view["CommandConvertSQL"] : new HudButton();
CommandConvertSQL.Hit += new EventHandler(ButtonConvertSQL_Click);
ButtonOpenSQL = view != null ? (HudButton)view["ButtonOpenSQL"] : new HudButton();
ButtonOpenSQL.Hit += new EventHandler(ButtonOpenSQL_Click);
TextboxCreateWCID = (HudTextBox)view["TextboxCreateWCID"];
ButtonCreateWCID = view != null ? (HudButton)view["ButtonCreateWCID"] : new HudButton();
ButtonCreateWCID.Hit += new EventHandler(ButtonCreateWCID_Click);
ButtonCreateInvWCID = view != null ? (HudButton)view["ButtonCreateInvWCID"] : new HudButton();
ButtonCreateInvWCID.Hit += new EventHandler(ButtonCreateInvWCID_Click);
ButtonCreateInstantWCID = view != null ? (HudButton)view["ButtonCreateInstantWCID"] : new HudButton();
ButtonCreateInstantWCID.Hit += new EventHandler(ButtonCreateInstantWCID_Click);
TextboxExportJsonWCID = (HudTextBox)view["TextboxExportJsonWCID"];
ButtonExportJSON = view != null ? (HudButton)view["ButtonExportJSON"] : new HudButton();
ButtonExportJSON.Hit += new EventHandler(ButtonExportJSON_Click);
TextboxExportSQLWCID = (HudTextBox)view["TextboxExportSQLWCID"];
ButtonExportSQL = view != null ? (HudButton)view["ButtonExportSQL"] : new HudButton();
ButtonExportSQL.Hit += new EventHandler(ButtonExportSQL_Click);
ButtonYotesWCIDLookUp = view != null ? (HudButton)view["ButtonYotesWCIDLookUp"] : new HudButton();
ButtonYotesWCIDLookUp.Hit += new EventHandler(ButtonYotesWCIDLookUp_Click);
ButtonPCAPSWCIDLookUp = view != null ? (HudButton)view["ButtonPCAPSWCIDLookUp"] : new HudButton();
ButtonPCAPSWCIDLookUp.Hit += new EventHandler(ButtonPCAPSWCIDLookUp_Click);
LabelGetInfo = (HudStaticText)view["LabelGetInfo"];
ButtonRemoveInstace = view != null ? (HudButton)view["ButtonRemoveInstace"] : new HudButton();
ButtonRemoveInstace.Hit += new EventHandler(ButtonRemoveInstace_Click);
ButtonMyLocation = view != null ? (HudButton)view["ButtonMyLocation"] : new HudButton();
ButtonMyLocation.Hit += new EventHandler(ButtonMyLocation_Click);
ButtonDeleteItem = view != null ? (HudButton)view["ButtonDeleteItem"] : new HudButton();
ButtonDeleteItem.Hit += new EventHandler(ButtonDeleteItem_Click);
CommandRefreshFilesList = view != null ? (HudButton)view["CommandRefreshFilesList"] : new HudButton();
CommandRefreshFilesList.Hit += new EventHandler(ButtonRefreshFilesList_Click);
ButtonGetInfo = view != null ? (HudButton)view["ButtonGetInfo"] : new HudButton();
ButtonGetInfo.Hit += new EventHandler(ButtonGetInfo_Click);
// ***** Nudge Tab *****
ButtonNudgeN = view != null ? (HudButton)view["ButtonNudgeN"] : new HudButton();
ButtonNudgeN.Hit += new EventHandler(ButtonNudgeN_Click);
ButtonNudgeNE = view != null ? (HudButton)view["ButtonNudgeNE"] : new HudButton();
ButtonNudgeNE.Hit += new EventHandler(ButtonNudgeNE_Click);
ButtonNudgeE = view != null ? (HudButton)view["ButtonNudgeE"] : new HudButton();
ButtonNudgeE.Hit += new EventHandler(ButtonNudgeE_Click);
ButtonNudgeSE = view != null ? (HudButton)view["ButtonNudgeSE"] : new HudButton();
ButtonNudgeSE.Hit += new EventHandler(ButtonNudgeSE_Click);
ButtonNudgeS = view != null ? (HudButton)view["ButtonNudgeS"] : new HudButton();
ButtonNudgeS.Hit += new EventHandler(ButtonNudgeS_Click);
ButtonNudgeSW = view != null ? (HudButton)view["ButtonNudgeSW"] : new HudButton();
ButtonNudgeSW.Hit += new EventHandler(ButtonNudgeSW_Click);
ButtonNudgeW = view != null ? (HudButton)view["ButtonNudgeW"] : new HudButton();
ButtonNudgeW.Hit += new EventHandler(ButtonNudgeW_Click);
ButtonNudgeNW = view != null ? (HudButton)view["ButtonNudgeNW"] : new HudButton();
ButtonNudgeNW.Hit += new EventHandler(ButtonNudgeNW_Click);
ButtonNudgeUp = view != null ? (HudButton)view["ButtonNudgeUp"] : new HudButton();
ButtonNudgeUp.Hit += new EventHandler(ButtonNudgeUp_Click);
ButtonNudgeDown = view != null ? (HudButton)view["ButtonNudgeDown"] : new HudButton();
ButtonNudgeDown.Hit += new EventHandler(ButtonNudgeDown_Click);
TextboxNudgeValueCustom = (HudTextBox)view["TextboxNudgeValueCustom"];
ButtonRotateN = view != null ? (HudButton)view["ButtonRotateN"] : new HudButton();
ButtonRotateN.Hit += new EventHandler(ButtonRotateN_Click);
ButtonRotateE = view != null ? (HudButton)view["ButtonRotateE"] : new HudButton();
ButtonRotateE.Hit += new EventHandler(ButtonRotateE_Click);
ButtonRotateS = view != null ? (HudButton)view["ButtonRotateS"] : new HudButton();
ButtonRotateS.Hit += new EventHandler(ButtonRotateS_Click);
ButtonRotateW = view != null ? (HudButton)view["ButtonRotateW"] : new HudButton();
ButtonRotateW.Hit += new EventHandler(ButtonRotateW_Click);
ButtonRotateNE = view != null ? (HudButton)view["ButtonRotateNE"] : new HudButton();
ButtonRotateNE.Hit += new EventHandler(ButtonRotateNE_Click);
ButtonRotateSE = view != null ? (HudButton)view["ButtonRotateSE"] : new HudButton();
ButtonRotateSE.Hit += new EventHandler(ButtonRotateSE_Click);
ButtonRotateSW = view != null ? (HudButton)view["ButtonRotateSW"] : new HudButton();
ButtonRotateSW.Hit += new EventHandler(ButtonRotateSW_Click);
ButtonRotateNW = view != null ? (HudButton)view["ButtonRotateNW"] : new HudButton();
ButtonRotateNW.Hit += new EventHandler(ButtonRotateNW_Click);
ButtonFreeRotate = view != null ? (HudButton)view["ButtonFreeRotate"] : new HudButton();
ButtonFreeRotate.Hit += new EventHandler(ButtonFreeRotate_Click);
TextboxFreeRotate = (HudTextBox)view["TextboxFreeRotate"];
ButtonNudgeHere = view != null ? (HudButton)view["ButtonNudgeHere"] : new HudButton();
ButtonNudgeHere.Hit += new EventHandler(ButtonNudgeHere_Click);
ButtonRotateHere = view != null ? (HudButton)view["ButtonRotateHere"] : new HudButton();
ButtonRotateHere.Hit += new EventHandler(ButtonRotateHere_Click);
ButtonNudgeValueInc = view != null ? (HudButton)view["ButtonNudgeValueInc"] : new HudButton();
ButtonNudgeValueInc.Hit += new EventHandler(ButtonNudgeValueInc_Click);
ButtonNudgeValueDec = view != null ? (HudButton)view["ButtonNudgeValueDec"] : new HudButton();
ButtonNudgeValueDec.Hit += new EventHandler(ButtonNudgeValueDec_Click);
ButtonNudgeValueLargeInc = view != null ? (HudButton)view["ButtonNudgeValueLargeInc"] : new HudButton();
ButtonNudgeValueLargeInc.Hit += new EventHandler(ButtonNudgeValueLargeInc_Click);
ButtonNudgeValueLargeDec = view != null ? (HudButton)view["ButtonNudgeValueLargeDec"] : new HudButton();
ButtonNudgeValueLargeDec.Hit += new EventHandler(ButtonNudgeValueLargeDec_Click);
ButtonNudgeValueReset = view != null ? (HudButton)view["ButtonNudgeValueReset"] : new HudButton();
ButtonNudgeValueReset.Hit += new EventHandler(ButtonNudgeValueReset_Click);
// ***** LandBlocks Tab *****
ChoiceLandblockJSON = (HudCombo)view["ChoiceLandblockJSON"];
//ChoiceLandblockJSON.Change += new EventHandler(ChoiceLandblockJSON_Change);
ButtonImportLandblockJSON = view != null ? (HudButton)view["ButtonImportLandblockJSON"] : new HudButton();
ButtonImportLandblockJSON.Hit += new EventHandler(ButtonImportLandblockJSON_Click);
ButtonEditLandblockJSON = view != null ? (HudButton)view["ButtonEditLandblockJSON"] : new HudButton();
ButtonEditLandblockJSON.Hit += new EventHandler(ButtonEditLandblockJSON_Click);
ChoiceLandblockSQL = (HudCombo)view["ChoiceLandblockSQL"];
//ChoiceLandblockSQL.Change += new EventHandler(ChoiceLandblockSQL_Change);
ButtonImportLandblockSQL = view != null ? (HudButton)view["ButtonImportLandblockSQL"] : new HudButton();
ButtonImportLandblockSQL.Hit += new EventHandler(ButtonImportLandblockSQL_Click);
ButtonEditLandblockSQL = view != null ? (HudButton)view["ButtonEditLandblockSQL"] : new HudButton();
ButtonEditLandblockSQL.Hit += new EventHandler(ButtonEditLandblockSQL_Click);
ButtonReloadLandblock = view != null ? (HudButton)view["ButtonReloadLandblock"] : new HudButton();
ButtonReloadLandblock.Hit += new EventHandler(ButtonReloadLandblock_Click);
ButtonClearCache = view != null ? (HudButton)view["ButtonClearCache"] : new HudButton();
ButtonClearCache.Hit += new EventHandler(ButtonClearCache_Click);
ButtonGetCurrentLandblock = view != null ? (HudButton)view["ButtonGetCurrentLandblock"] : new HudButton();
ButtonGetCurrentLandblock.Hit += new EventHandler(ButtonGetCurrentLandblock_Click);
ButtonExportLandblock = view != null ? (HudButton)view["ButtonExportLandblock"] : new HudButton();
ButtonExportLandblock.Hit += new EventHandler(ButtonExportLandblock_Click);
TextboxFreeRotate = (HudTextBox)view["TextboxFreeRotate"];
// ***** Quests/Recipes Tab *****
ChoiceQuestJSON = (HudCombo)view["ChoiceQuestJSON"];
ButtonImportQuestJSON = view != null ? (HudButton)view["ButtonImportQuestJSON"] : new HudButton();
ButtonImportQuestJSON.Hit += new EventHandler(ButtonImportQuestJSON_Click);
ButtonEditQuestJSON = view != null ? (HudButton)view["ButtonEditQuestJSON"] : new HudButton();
ButtonEditQuestJSON.Hit += new EventHandler(ButtonEditQuestJSON_Click);
ChoiceQuestSQL = (HudCombo)view["ChoiceQuestSQL"];
ButtonImportQuestSQL = view != null ? (HudButton)view["ButtonImportQuestSQL"] : new HudButton();
ButtonImportQuestSQL.Hit += new EventHandler(ButtonImportQuestSQL_Click);
ButtonEditQuestSQL = view != null ? (HudButton)view["ButtonEditQuestSQL"] : new HudButton();
ButtonEditQuestSQL.Hit += new EventHandler(ButtonEditQuestSQL_Click);
ChoiceRecipeJSON = (HudCombo)view["ChoiceRecipeJSON"];
ButtonImportRecipeJSON = view != null ? (HudButton)view["ButtonImportRecipeJSON"] : new HudButton();
ButtonImportRecipeJSON.Hit += new EventHandler(ButtonImportRecipeJSON_Click);
ButtonEditRecipeJSON = view != null ? (HudButton)view["ButtonEditRecipeJSON"] : new HudButton();
ButtonEditRecipeJSON.Hit += new EventHandler(ButtonEditRecipeJSON_Click);
ChoiceRecipeSQL = (HudCombo)view["ChoiceRecipeSQL"];
ButtonImportRecipeSQL = view != null ? (HudButton)view["ButtonImportRecipeSQL"] : new HudButton();
ButtonImportRecipeSQL.Hit += new EventHandler(ButtonImportRecipeSQL_Click);
ButtonEditRecipeSQL = view != null ? (HudButton)view["ButtonEditRecipeSQL"] : new HudButton();
ButtonEditRecipeSQL.Hit += new EventHandler(ButtonEditRecipeSQL_Click);
// ***** Advanced Tab *****
ChoiceGenerator = (HudCombo)view["ChoiceGenerator"];
ChoiceGenerator.Change += new EventHandler(ChoiceGenerator_Change);
TextboxGeneratorWCID = (HudTextBox)view["TextboxGeneratorWCID"];
ButtonCreateGenerator = view != null ? (HudButton)view["ButtonCreateGenerator"] : new HudButton();
ButtonCreateGenerator.Hit += new EventHandler(ButtonCreateGenerator_Click);
ButtonEditGeneratorList = view != null ? (HudButton)view["ButtonEditGeneratorList"] : new HudButton();
ButtonEditGeneratorList.Hit += new EventHandler(ButtonEditGeneratorList_Click);
ButtonRefreshGeneratorList = view != null ? (HudButton)view["ButtonRefreshGeneratorList"] : new HudButton();
ButtonRefreshGeneratorList.Hit += new EventHandler(ButtonRefreshGeneratorList_Click);
ChoiceChildList = (HudCombo)view["ChoiceChildList"];
ChoiceChildList.Change += new EventHandler(ChoiceChildList_Change);
ButtonGetParentGUID = view != null ? (HudButton)view["ButtonGetParentGUID"] : new HudButton();
ButtonGetParentGUID.Hit += new EventHandler(ButtonGetParentGUID_Click);
ButtonLinkChild = view != null ? (HudButton)view["ButtonLinkChild"] : new HudButton();
ButtonLinkChild.Hit += new EventHandler(ButtonLinkChild_Click);
TextboxParentGUID = (HudTextBox)view["TextboxParentGUID"];
TextboxChildWCID = (HudTextBox)view["TextboxChildWCID"];
ButtonCreateMob = view != null ? (HudButton)view["ButtonCreateMob"] : new HudButton();
ButtonCreateMob.Hit += new EventHandler(ButtonCreateMob_Click);
ButtonAdvancedRemoveInst = view != null ? (HudButton)view["ButtonAdvancedRemoveInst"] : new HudButton();
ButtonAdvancedRemoveInst.Hit += new EventHandler(ButtonRemoveInstace_Click);
ButtonAdvancedAddEncounter = view != null ? (HudButton)view["ButtonAdvancedAddEncounter"] : new HudButton();
ButtonAdvancedAddEncounter.Hit += new EventHandler(ButtonAdvancedAddEncounter_Click);
TextBoxEncounterWCID = (HudTextBox)view["TextBoxEncounterWCID"];
ButtonAdvancedRemoveEncounter = view != null ? (HudButton)view["ButtonAdvancedRemoveEncounter"] : new HudButton();
ButtonAdvancedRemoveEncounter.Hit += new EventHandler(ButtonAdvancedRemoveEncounter_Click);
// ***** Paths Tab *****
TextBoxPathJSON = (HudTextBox)view["TextboxPathJSON"];
TextBoxPathSQL = (HudTextBox)view["TextboxPathSQL"];
TextboxPathLandBlockJSON = (HudTextBox)view["TextboxPathLandBlockJSON"];
TextboxPathLandBlockSQL = (HudTextBox)view["TextboxPathLandBlockSQL"];
TextboxPathQuestJSON = (HudTextBox)view["TextboxPathQuestJSON"];
TextboxPathQuestSQL = (HudTextBox)view["TextboxPathQuestSQL"];
TextboxPathRecipeJSON = (HudTextBox)view["TextboxPathRecipeJSON"];
TextboxPathRecipeSQL = (HudTextBox)view["TextboxPathRecipeSQL"];
ButtonSavePaths = view != null ? (HudButton)view["ButtonSavePaths"] : new HudButton();
ButtonSavePaths.Hit += new EventHandler(ButtonSavePaths_Click);
ButtonLoadINI = view != null ? (HudButton)view["ButtonLoadINI"] : new HudButton();
ButtonLoadINI.Hit += new EventHandler(ButtonLoadINI_Click);
ButtonOpenINI = view != null ? (HudButton)view["ButtonOpenINI"] : new HudButton();
ButtonOpenINI.Hit += new EventHandler(ButtonOpenINI_Click);
// ***** Help Tab *****
ButtonACCWiki = view != null ? (HudButton)view["ButtonACCWiki"] : new HudButton();
ButtonACCWiki.Hit += new EventHandler(ButtonACCWiki_Click);
ButtonACEWiki = view != null ? (HudButton)view["ButtonACEWiki"] : new HudButton();
ButtonACEWiki.Hit += new EventHandler(ButtonACEWiki_Click);
// *** Making some stuff not seen ***
// ButtonYotesWCIDLookUp.Visible = false;
ButtonCreateMob.Visible = false;
}
[BaseEvent("LoginComplete", "CharacterFilter")]
private void CharacterFilter_LoginComplete(object sender, EventArgs e)
{
try
{
Util.WriteToChat("Plugin now online. Server population: " + Core.CharacterFilter.ServerPopulation);
Util.WriteToChat("CharacterFilter_LoginComplete");
//InitSampleList();
// Subscribe to events here
// Globals.Core.WorldFilter.ChangeObject += new EventHandler<ChangeObjectEventArgs>(WorldFilter_ChangeObject2);
}
catch (Exception ex) { Util.LogError(ex); }
}
[BaseEvent("Logoff", "CharacterFilter")]
private void CharacterFilter_Logoff(object sender, Decal.Adapter.Wrappers.LogoffEventArgs e)
{
try
{
// Unsubscribe to events here, but know that this event is not gauranteed to happen. I've never seen it not fire though.
// This is not the proper place to free up resources, but... its the easy way. It's not proper because of above statement.
Globals.Core.WorldFilter.ChangeObject -= new EventHandler<ChangeObjectEventArgs>(WorldFilter_ChangeObject);
}
catch (Exception ex) { Util.LogError(ex); }
}
// Note that there are several ways to latch on to decals events.
// You can use the BaseEvent attribute, or you can latch on to the same event as shown in CharacterFilter_LoginComplete, above.
// The BaseEvent method will only work in this class as it is derived from PluginBase. You will need to use the += and -= method in your other objects.
[BaseEvent("ChangeObject", "WorldFilter")]
public void WorldFilter_ChangeObject(object sender, ChangeObjectEventArgs e)
{
try
{
// This can get very spammy so I filted it to just print on ident received
// Util.WriteToChat("WorldFilter_ChangeObject: " + e.Changed.Name + " " + e.Change);
}
catch (Exception ex) { Util.LogError(ex); }
}
// Methods
private void Current_ChatBoxMessage(object sender, ChatTextInterceptEventArgs e)
{
try
{
if (ChatMessages.GetWeenieInfo(e.Text, out string wcid, out string guid))
{
TextboxExportJsonWCID = (HudTextBox)view["TextboxExportJsonWCID"];
TextboxExportSQLWCID = (HudTextBox)view["TextboxExportSQLWCID"];
TextboxParentGUID = (HudTextBox)view["TextboxParentGUID"];
LabelGetInfo = (HudStaticText)view["LabelGetInfo"];
LabelGetInfo.Text = e.Text;
TextboxExportJsonWCID.Text = wcid;
TextboxExportSQLWCID.Text = wcid;
TextboxParentGUID.Text = guid;
Globals.YotesWCID = wcid;
if (Globals.ButtonCommand == "YotesLookup")
{
Util.WriteToChat("Opening Browser");
Globals.ButtonCommand = "";
System.Diagnostics.Process.Start("http://ac.yotesfan.com/weenies/items/" + wcid);
Globals.ButtonCommand = "NONE";
}
if (Globals.ButtonCommand == "PCAPsLookup")
{
Util.WriteToChat("Opening Browser");
Globals.ButtonCommand = "";
System.Diagnostics.Process.Start("https://github.com/ACEmulator/ACE-PCAP-Exports/search?q=filename:" + wcid);
Globals.ButtonCommand = "NONE";
}
// Util.WriteToChat(e.Text);
}
if (ChatMessages.FileExport(e.Text))
{
JsonChoiceListLoadFiles();
SqlChoiceListLoadFiles();
LoadLandBlockJSONChoiceList();
LoadLandBlockSQLChoiceList();
//LoadQuestJSONChoiceList();
//LoadQuestSQLChoiceList();
//LoadRecipeJSONChoiceList();
//LoadRecipeSQLChoiceList();
//Util.WriteToChat("ListRefresh");
}
if (ChatMessages.LogMyLocations(e.Text, out string location))
{
if (TextboxCreateWCID.Text == "")
Util.LogLocation("BlankWCID, " + location);
else
Util.LogLocation(TextboxCreateWCID.Text + ", " + location);
}
if (ChatMessages.GetCurrentLandblock(e.Text, out string landblock))
{
TextboxCurrentLandblock = (HudTextBox)view["TextboxCurrentLandblock"];
TextboxCurrentLandblock.Text = landblock;
}
}
catch (Exception ex)
{
Util.WriteToChat("ChatBoxMessage Error - " + ex);
}
}
private void JsonChoiceListLoadFiles()
{
ChoiceJSON = (HudCombo)view["ChoiceJSON"];
//Util.WriteToChat(Globals.PathJSON);
ChoiceJSON.Clear();
string filespath = Globals.PathJSON;
DirectoryInfo d = new DirectoryInfo(filespath);
FileInfo[] files = d.GetFiles("*.json");
var current = 0;
var counter = 0;
string weenieId = null;
if (TextboxExportJsonWCID != null && int.TryParse(TextboxExportJsonWCID.Text, out var weenieIdInt))
weenieId = weenieIdInt.ToString("00000");
foreach (var file in files)
{
// Util.WriteToChat(file.Name);
ChoiceJSON.AddItem(file.Name, file);
if (weenieId != null && file.Name.StartsWith(weenieId))
current = counter;
counter++;
}
ChoiceJSON.Current = current;
}
private void SqlChoiceListLoadFiles()
{
//Util.WriteToChat(Globals.PathSQL);
ChoiceSQL = (HudCombo)view["ChoiceSQL"];
ChoiceChildList = (HudCombo)view["ChoiceChildList"];
// ICombo addfile = JSONFileList.Add(File.AppendAllText)
ChoiceSQL.Clear();
ChoiceChildList.Clear();
string filespath = Globals.PathSQL;
DirectoryInfo d = new DirectoryInfo(filespath);
FileInfo[] files = d.GetFiles("*.sql");
var current = 0;
var counter = 0;
string weenieId = null;
if (TextboxExportSQLWCID != null && int.TryParse(TextboxExportSQLWCID.Text, out var weenieIdInt))
weenieId = weenieIdInt.ToString("00000");
foreach (var file in files)
{
// Util.WriteToChat(file.Name);
ChoiceSQL.AddItem(file.Name, file.Name);
ChoiceChildList.AddItem(file.Name, file.Name);
if (weenieId != null && file.Name.StartsWith(weenieId))
current = counter;
counter++;
}
ChoiceSQL.Current = current;
ChoiceChildList.Current = current;
}
private void LoadPathSettings()
{
Dictionary<string, string> pathsettings = Util.LoadSetttings();
TextBoxPathJSON = (HudTextBox)view["TextboxPathJSON"];
TextBoxPathSQL = (HudTextBox)view["TextboxPathSQL"];
TextboxPathLandBlockJSON = (HudTextBox)view["TextboxPathLandBlockJSON"];
TextboxPathLandBlockSQL = (HudTextBox)view["TextboxPathLandBlockSQL"];
if (pathsettings.ContainsKey("weenie_jsonpath")) // && pathsettings["jsonpath"] != "")
{
TextBoxPathJSON.Text = pathsettings["weenie_jsonpath"];
Globals.PathJSON = pathsettings["weenie_jsonpath"];
Util.WriteToChat(pathsettings["weenie_jsonpath"]);
}
if (pathsettings.ContainsKey("weenie_sqlpath")) // && pathsettings["sqlpath"] != "")
{
TextBoxPathSQL.Text = pathsettings["weenie_sqlpath"];
Globals.PathSQL = pathsettings["weenie_sqlpath"];
Util.WriteToChat(pathsettings["weenie_sqlpath"]);
}
if (pathsettings.ContainsKey("landblock_jsonpath")) // && pathsettings["sqlpath"] != "")
{
TextboxPathLandBlockJSON.Text = pathsettings["landblock_jsonpath"];
Globals.PathLandBlockJSON = pathsettings["landblock_jsonpath"];
Util.WriteToChat(pathsettings["landblock_jsonpath"]);
}
if (pathsettings.ContainsKey("landblock_sqlpath")) // && pathsettings["sqlpath"] != "")
{
TextboxPathLandBlockSQL.Text = pathsettings["landblock_sqlpath"];
Globals.PathLandBlockSQL = pathsettings["landblock_sqlpath"];
Util.WriteToChat(pathsettings["landblock_sqlpath"]);
}
if (pathsettings.ContainsKey("quest_jsonpath"))
{
TextboxPathQuestJSON.Text = pathsettings["quest_jsonpath"];
Globals.PathQuestJSON = pathsettings["quest_jsonpath"];
Util.WriteToChat(pathsettings["quest_jsonpath"]);
}
if (pathsettings.ContainsKey("quest_sqlpath"))
{
TextboxPathQuestSQL.Text = pathsettings["quest_sqlpath"];
Globals.PathQuestSQL = pathsettings["quest_sqlpath"];
Util.WriteToChat(pathsettings["quest_sqlpath"]);
}
if (pathsettings.ContainsKey("recipe_jsonpath"))
{
TextboxPathRecipeJSON.Text = pathsettings["recipe_jsonpath"];
Globals.PathRecipeJSON = pathsettings["recipe_jsonpath"];
Util.WriteToChat(pathsettings["recipe_jsonpath"]);
}
if (pathsettings.ContainsKey("recipe_sqlpath"))
{
TextboxPathRecipeSQL.Text = pathsettings["recipe_sqlpath"];
Globals.PathRecipeSQL = pathsettings["recipe_sqlpath"];
Util.WriteToChat(pathsettings["recipe_sqlpath"]);
}
RefreshAllLists();
}
private void SavePathSettings(object sender, EventArgs e)
{
Util.SaveIni(TextBoxPathJSON.Text, TextBoxPathSQL.Text, TextboxPathLandBlockJSON.Text, TextboxPathLandBlockSQL.Text,
TextboxPathQuestJSON.Text, TextboxPathQuestSQL.Text, TextboxPathRecipeJSON.Text, TextboxPathRecipeSQL.Text);
}
private void GetInfoWaitForItemUpdate(object sender, ChangeObjectEventArgs e)
{
try
{
if (e.Changed.Id == aceItem.id)
{
Util.SendChatCommand("/getinfo");
CoreManager.Current.WorldFilter.ChangeObject -= GetInfoWaitForItemUpdate;
}
}
catch (Exception ex) { Util.LogError(ex); }
}
private void DeleteItemWaitForItemUpdate(object sender, ChangeObjectEventArgs e)
{
try
{
if (e.Changed.Id == aceItem.id)
{
Util.SendChatCommand(Globals.ButtonCommand);
CoreManager.Current.WorldFilter.ChangeObject -= DeleteItemWaitForItemUpdate;
Globals.ButtonCommand = "NONE";
}
}
catch (Exception ex) { Util.LogError(ex); }
}
private void WaitForItemUpdate(object sender, ChangeObjectEventArgs e)
{
try
{
if (e.Changed.Id == aceItem.id)
{
Util.SendChatCommand(Globals.ButtonCommand);
CoreManager.Current.WorldFilter.ChangeObject -= WaitForItemUpdate;
Globals.ButtonCommand = "NONE";
}
}
catch (Exception ex) { Util.LogError(ex); }
}
private void LookupYotesWaitForItemUpdate(object sender, ChangeObjectEventArgs e)
{
try
{
if (e.Changed.Id == aceItem.id)
{
CoreManager.Current.WorldFilter.ChangeObject -= LookupYotesWaitForItemUpdate;
}
}
catch (Exception ex) { Util.LogError(ex); }
}
private void LoadLandBlockJSONChoiceList()
{
if (Globals.PathLandBlockJSON == "")
{
//Util.WriteToChat("JSON Landblock Path blank, Ignoring");
return;
}
ChoiceLandblockJSON = (HudCombo)view["ChoiceLandblockJSON"];
//Util.WriteToChat(Globals.PathLandBlockJSON);
ChoiceLandblockJSON.Clear();
string filespath = Globals.PathLandBlockJSON;
DirectoryInfo d = new DirectoryInfo(filespath);
FileInfo[] files = d.GetFiles("*.json");
var current = 0;
var counter = 0;
string landblockId = null;
if (TextboxCurrentLandblock != null && int.TryParse(TextboxCurrentLandblock.Text, NumberStyles.HexNumber, null, out var landblockIdInt))
landblockId = landblockIdInt.ToString("X4");
foreach (var file in files)
{
// Util.WriteToChat(file.Name);
ChoiceLandblockJSON.AddItem(file.Name, file);
if (landblockId != null && file.Name.StartsWith(landblockId))
current = counter;
counter++;
}
ChoiceLandblockJSON.Current = current;
}
private void LoadLandBlockSQLChoiceList()
{
if (Globals.PathLandBlockSQL == "")
{
//Util.WriteToChat("SQL Landblock Path blank, Ignoring");
return;
}
ChoiceLandblockSQL = (HudCombo)view["ChoiceLandblockSQL"];
//Util.WriteToChat(Globals.PathLandBlockSQL);
ChoiceLandblockSQL.Clear();
string filespath = Globals.PathLandBlockSQL;
DirectoryInfo d = new DirectoryInfo(filespath);
FileInfo[] files = d.GetFiles("*.sql");
var current = 0;
var counter = 0;
string landblockId = null;
if (TextboxCurrentLandblock != null && int.TryParse(TextboxCurrentLandblock.Text, NumberStyles.HexNumber, null, out var landblockIdInt))
landblockId = landblockIdInt.ToString("X4");
foreach (var file in files)
{
// Util.WriteToChat(file.Name);
ChoiceLandblockSQL.AddItem(file.Name, file);
if (landblockId != null && file.Name.StartsWith(landblockId))
current = counter;
counter++;
}
ChoiceLandblockSQL.Current = current;
}
private void LoadQuestJSONChoiceList()
{
if (Globals.PathQuestJSON == "")
{
//Util.WriteToChat("JSON Quest Path blank, Ignoring");
return;
}
ChoiceQuestJSON = (HudCombo)view["ChoiceQuestJSON"];
//Util.WriteToChat(Globals.PathQuestJSON);
ChoiceQuestJSON.Clear();
string filespath = Globals.PathQuestJSON;
DirectoryInfo d = new DirectoryInfo(filespath);
FileInfo[] files = d.GetFiles("*.json");
foreach (var file in files)
{
// Util.WriteToChat(file.Name);
ChoiceQuestJSON.AddItem(file.Name, file);
}
}
private void LoadQuestSQLChoiceList()
{
if (Globals.PathQuestSQL == "")
{
//Util.WriteToChat("SQL Quest Path blank, Ignoring");
return;
}
ChoiceQuestSQL = (HudCombo)view["ChoiceQuestSQL"];
//Util.WriteToChat(Globals.PathQuestSQL);
ChoiceQuestSQL.Clear();
string filespath = Globals.PathQuestSQL;
DirectoryInfo d = new DirectoryInfo(filespath);
FileInfo[] files = d.GetFiles("*.sql");
foreach (var file in files)
{
// Util.WriteToChat(file.Name);
ChoiceQuestSQL.AddItem(file.Name, file);
}
}
private void LoadRecipeJSONChoiceList()
{
if (Globals.PathRecipeJSON == "")
{
//Util.WriteToChat("JSON Recipe Path blank, Ignoring");
return;
}
ChoiceRecipeJSON = (HudCombo)view["ChoiceRecipeJSON"];
//Util.WriteToChat(Globals.PathRecipeJSON);
ChoiceRecipeJSON.Clear();
string filespath = Globals.PathRecipeJSON;
DirectoryInfo d = new DirectoryInfo(filespath);
FileInfo[] files = d.GetFiles("*.json");
foreach (var file in files)
{
// Util.WriteToChat(file.Name);
ChoiceRecipeJSON.AddItem(file.Name, file);
}
}
private void LoadRecipeSQLChoiceList()
{
if (Globals.PathRecipeSQL == "")
{
//Util.WriteToChat("SQL Recipe Path blank, Ignoring");
return;
}
ChoiceRecipeSQL = (HudCombo)view["ChoiceRecipeSQL"];
//Util.WriteToChat(Globals.PathRecipeSQL);
ChoiceRecipeSQL.Clear();
string filespath = Globals.PathRecipeSQL;
DirectoryInfo d = new DirectoryInfo(filespath);
FileInfo[] files = d.GetFiles("*.sql");
foreach (var file in files)
{
// Util.WriteToChat(file.Name);
ChoiceRecipeSQL.AddItem(file.Name, file);
}
}
private void RefreshAllLists()
{
JsonChoiceListLoadFiles();
SqlChoiceListLoadFiles();
LoadLandBlockJSONChoiceList();
LoadLandBlockSQLChoiceList();
LoadQuestJSONChoiceList();
LoadQuestSQLChoiceList();
LoadRecipeJSONChoiceList();
LoadRecipeSQLChoiceList();
}
public void LoadParentObjectsFile()
{
ChoiceGenerator = (HudCombo)view["ChoiceGenerator"];
ChoiceGenerator.Clear();
try
{
string assemblyFolder = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string filePath = System.IO.Path.Combine(assemblyFolder, "parentobjects.ini");
if (!File.Exists(filePath))
{
File.Create(filePath).Close();
using (StreamWriter writer = new StreamWriter(filePath, false))
{
// Monster Gens
writer.WriteLine("28282 Linkable Monster Generator - 10 Secs");
writer.WriteLine("15274 Linkable Monster Generator - 1 Min");
writer.WriteLine("24129 Linkable Monster Generator - 2 Min");
writer.WriteLine("07923 Linkable Monster Generator - 3 Min");
writer.WriteLine("07932 Linkable Monster Generator - 4 Min");
writer.WriteLine("07924 Linkable Monster Generator - 5 Min");
writer.WriteLine("04219 Linkable Monster Generator - 7 Min");
writer.WriteLine("07925 Linkable Monster Generator - 10 Min");
writer.WriteLine("03955 Linkable Monster Generator - 15 Min");
writer.WriteLine("07926 Linkable Monster Generator - 20 Min");
// Item Gens
writer.WriteLine("15759 Linkable Item Generator - 10 Secs");
writer.WriteLine("05085 Linkable Item Generator - 25 Secs");
writer.WriteLine("04142 Linkable Item Generator - 2 Min");
writer.Close();
}
}
string[] lines = File.ReadAllLines(filePath);
foreach (string line in File.ReadAllLines(filePath))
{
ChoiceGenerator.AddItem(line, line);
}
}
catch (Exception ex)
{
Util.WriteToChat(ex.Message);
}
}
}
}