├── .gitattributes
├── .gitignore
├── README.md
├── TrinityCreator.Shared
├── DBC
│ ├── DBCQuery.cs
│ ├── DBCViewer
│ │ ├── ADBReader.cs
│ │ ├── BinaryFormatter.cs
│ │ ├── BinaryFormatterExtensions.cs
│ │ ├── DB2Reader.cs
│ │ ├── DB3Reader.cs
│ │ ├── DB4Reader.cs
│ │ ├── DBCReader.cs
│ │ ├── DBCReaderGeneric.cs
│ │ ├── DBReaderFactory.cs
│ │ ├── IWowClientDBReader.cs
│ │ ├── STLReader.cs
│ │ └── WDBReader.cs
│ └── DbcHandler.cs
├── Data
│ ├── CExceptions.cs
│ ├── Coordinate.cs
│ ├── CreatureFamily.cs
│ ├── Currency.cs
│ ├── CustomDisplayField.cs
│ ├── Damage.cs
│ ├── DamageType.cs
│ ├── ICreator.cs
│ ├── IKeyValue.cs
│ ├── ItemClass.cs
│ ├── ItemInventoryType.cs
│ ├── ItemMaterial.cs
│ ├── ItemQuality.cs
│ ├── ItemSubClass.cs
│ ├── Socket.cs
│ └── TrainerData.cs
├── Database
│ ├── Connection.cs
│ ├── DataType.cs
│ ├── LookupQuery.cs
│ └── SaveQuery.cs
├── Global.cs
├── Helpers
│ ├── GHelper.cs
│ ├── Logger.cs
│ ├── ProfileHelper.cs
│ ├── UiHelper.cs
│ └── Updater.cs
├── Profiles
│ ├── ExpKvp.cs
│ ├── Export.cs
│ └── Profile.cs
├── Properties
│ ├── AssemblyInfo.cs
│ ├── Resources.Designer.cs
│ ├── Resources.resx
│ ├── Settings.Designer.cs
│ └── Settings.settings
├── Resources
│ ├── ARIALN.TTF
│ ├── Credits.txt
│ ├── DailyActiveQuestIcon.png
│ ├── DailyQuestIcon.png
│ ├── FRIZQT__.TTF
│ ├── IncompleteQuestIcon.png
│ ├── MORPHEUS.TTF
│ ├── QuestGreeting.png
│ ├── RandomTips.txt
│ ├── SKURRI.TTF
│ ├── add-icon.png
│ ├── bluesocket.png
│ ├── cb_data.xml
│ ├── copper.gif
│ ├── dbclayout.xml
│ ├── gold.gif
│ ├── metasocket.png
│ ├── redsocket.png
│ ├── remove-icon.png
│ ├── silver.gif
│ ├── tclogo.ico
│ ├── tclogo.png
│ ├── weapon-notice.rtf
│ └── yellowsocket.png
├── Tools
│ ├── CreatureCreator
│ │ ├── CreatureCreatorPage.xaml
│ │ ├── CreatureCreatorPage.xaml.cs
│ │ ├── CreatureTemplateWindow.xaml
│ │ ├── CreatureTemplateWindow.xaml.cs
│ │ ├── Templates
│ │ │ ├── BeastEnemyTemplate.cs
│ │ │ ├── BlankTemplate.cs
│ │ │ ├── BossTemplate.cs
│ │ │ ├── ClassTrainerTemplate.cs
│ │ │ ├── DeadQuestgiverTemplate.cs
│ │ │ ├── EscorteeTemplate.cs
│ │ │ ├── ExampleTemplate.cs
│ │ │ ├── HumanoidEnemyTemplate.cs
│ │ │ ├── MountTrainerTemplate.cs
│ │ │ ├── ProfessionTrainerTemplate.cs
│ │ │ ├── QuestgiverTemplate.cs
│ │ │ ├── RepairVendorTemplate.cs
│ │ │ ├── TemplateBase.cs
│ │ │ ├── TemplateHandler.cs
│ │ │ ├── TrainerTemplate.cs
│ │ │ └── VendorTemplate.cs
│ │ └── TrinityCreature.cs
│ ├── ItemCreator
│ │ ├── ItemPage.xaml
│ │ ├── ItemPage.xaml.cs
│ │ ├── ItemPreview.xaml
│ │ ├── ItemPreview.xaml.cs
│ │ ├── TrinityItem.cs
│ │ ├── WeaponExportWindow.xaml
│ │ └── WeaponExportWindow.xaml.cs
│ ├── LookupTool
│ │ ├── LookupToolControl.xaml
│ │ ├── LookupToolControl.xaml.cs
│ │ └── TargetEnum.cs
│ ├── LootCreator
│ │ ├── LootPage.xaml
│ │ ├── LootPage.xaml.cs
│ │ ├── LootRowControl.xaml
│ │ └── LootRowControl.xaml.cs
│ ├── ModelViewer
│ │ ├── ModelViewerPage.xaml
│ │ └── ModelViewerPage.xaml.cs
│ ├── ProfileCreator
│ │ ├── ProfileCreatorDefinition.xaml
│ │ ├── ProfileCreatorDefinition.xaml.cs
│ │ ├── ProfileCreatorEntry.xaml
│ │ ├── ProfileCreatorEntry.xaml.cs
│ │ ├── ProfileCreatorWindow.xaml
│ │ └── ProfileCreatorWindow.xaml.cs
│ ├── QuestCreator
│ │ ├── QuestPage.xaml
│ │ ├── QuestPage.xaml.cs
│ │ ├── QuestPreview.xaml
│ │ ├── QuestPreview.xaml.cs
│ │ └── TrinityQuest.cs
│ └── VendorCreator
│ │ ├── VendorEntryControl.xaml
│ │ ├── VendorEntryControl.xaml.cs
│ │ ├── VendorPage.xaml
│ │ └── VendorPage.xaml.cs
├── TrinityCreator.Shared.csproj
├── UI
│ ├── Converters
│ │ ├── BoolInverter.cs
│ │ ├── ValueToVisibilityConverter.cs
│ │ └── WeaponSpeedToStringConverter.cs
│ ├── CreditsWindow.xaml
│ ├── CreditsWindow.xaml.cs
│ ├── DbConfigWindow.xaml
│ ├── DbConfigWindow.xaml.cs
│ ├── DbcConfigWindow.xaml
│ ├── DbcConfigWindow.xaml.cs
│ ├── MainWindow.xaml
│ ├── MainWindow.xaml.cs
│ ├── ProfileOptionControl.xaml
│ ├── ProfileOptionControl.xaml.cs
│ ├── ProfileSelectionWindow.xaml
│ ├── ProfileSelectionWindow.xaml.cs
│ └── UIElements
│ │ ├── BitmaskStackPanel.cs
│ │ ├── Browser.xaml
│ │ ├── Browser.xaml.cs
│ │ ├── CustomDisplayFieldControl.xaml
│ │ ├── CustomDisplayFieldControl.xaml.cs
│ │ ├── DynamicDataControl.xaml
│ │ ├── DynamicDataControl.xaml.cs
│ │ └── XmlKeyValue.cs
└── app.config
├── TrinityCreator.Tests
├── Data
│ └── CustomDisplayFieldTests.cs
├── Properties
│ └── AssemblyInfo.cs
├── TrinityCreator.Tests.csproj
├── app.config
└── packages.config
├── TrinityCreator.sln
├── TrinityCreator
├── App.config
├── App.xaml
├── App.xaml.cs
├── Properties
│ └── AssemblyInfo.cs
├── ReleaseToZip.ps1
├── Resources
│ └── tclogo.ico
├── TrinityCreator.csproj
├── app.manifest
└── bin
│ └── Publish
│ └── TrinityCreator.zip
└── TrinityCreatorInstaller
└── TrinityCreatorInstaller.vdproj
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 | # Custom for Visual Studio
4 | *.cs diff=csharp
5 | # Standard to msysgit
6 | *.doc diff=astextplain
7 | *.DOC diff=astextplain
8 | *.docx diff=astextplain
9 | *.DOCX diff=astextplain
10 | *.dot diff=astextplain
11 | *.DOT diff=astextplain
12 | *.pdf diff=astextplain
13 | *.PDF diff=astextplain
14 | *.rtf diff=astextplain
15 | *.RTF diff=astextplain
16 | *.zip filter=lfs diff=lfs merge=lfs -text
17 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | ## Ignore Visual Studio temporary files, build results, and
2 | ## files generated by popular Visual Studio add-ons.
3 |
4 | # User-specific files
5 | *.suo
6 | *.user
7 | *.userosscache
8 | *.sln.docstates
9 |
10 | # User-specific files (MonoDevelop/Xamarin Studio)
11 | *.userprefs
12 |
13 | # Build results
14 | [Dd]ebug/
15 | [Dd]ebugPublic/
16 | [Rr]elease/
17 | [Rr]eleases/
18 | x64/
19 | x86/
20 | build/
21 | bld/
22 | [Bb]in/Debug/
23 | [Bb]in/Release/
24 | [Oo]bj/
25 |
26 | # Visual Studo 2015 cache/options directory
27 | .vs/
28 |
29 | # MSTest test Results
30 | [Tt]est[Rr]esult*/
31 | [Bb]uild[Ll]og.*
32 |
33 | # NUNIT
34 | *.VisualState.xml
35 | TestResult.xml
36 |
37 | # Build Results of an ATL Project
38 | [Dd]ebugPS/
39 | [Rr]eleasePS/
40 | dlldata.c
41 |
42 | *_i.c
43 | *_p.c
44 | *_i.h
45 | *.ilk
46 | *.meta
47 | *.obj
48 | *.pch
49 | *.pdb
50 | *.pgc
51 | *.pgd
52 | *.rsp
53 | *.sbr
54 | *.tlb
55 | *.tli
56 | *.tlh
57 | *.tmp
58 | *.tmp_proj
59 | *.log
60 | *.vspscc
61 | *.vssscc
62 | .builds
63 | *.pidb
64 | *.svclog
65 | *.scc
66 |
67 | # Chutzpah Test files
68 | _Chutzpah*
69 |
70 | # Visual C++ cache files
71 | ipch/
72 | *.aps
73 | *.ncb
74 | *.opensdf
75 | *.sdf
76 | *.cachefile
77 |
78 | # Visual Studio profiler
79 | *.psess
80 | *.vsp
81 | *.vspx
82 |
83 | # TFS 2012 Local Workspace
84 | $tf/
85 |
86 | # Guidance Automation Toolkit
87 | *.gpState
88 |
89 | # ReSharper is a .NET coding add-in
90 | _ReSharper*/
91 | *.[Rr]e[Ss]harper
92 | *.DotSettings.user
93 |
94 | # JustCode is a .NET coding addin-in
95 | .JustCode
96 |
97 | # TeamCity is a build add-in
98 | _TeamCity*
99 |
100 | # DotCover is a Code Coverage Tool
101 | *.dotCover
102 |
103 | # NCrunch
104 | _NCrunch_*
105 | .*crunch*.local.xml
106 |
107 | # MightyMoose
108 | *.mm.*
109 | AutoTest.Net/
110 |
111 | # Web workbench (sass)
112 | .sass-cache/
113 |
114 | # Installshield output folder
115 | [Ee]xpress/
116 |
117 | # DocProject is a documentation generator add-in
118 | DocProject/buildhelp/
119 | DocProject/Help/*.HxT
120 | DocProject/Help/*.HxC
121 | DocProject/Help/*.hhc
122 | DocProject/Help/*.hhk
123 | DocProject/Help/*.hhp
124 | DocProject/Help/Html2
125 | DocProject/Help/html
126 |
127 |
128 | # Publish Web Output
129 | *.[Pp]ublish.xml
130 | *.azurePubxml
131 | # TODO: Comment the next line if you want to checkin your web deploy settings
132 | # but database connection strings (with potential passwords) will be unencrypted
133 | *.pubxml
134 | *.publishproj
135 |
136 | # NuGet Packages
137 | *.nupkg
138 | # The packages folder can be ignored because of Package Restore
139 | **/packages/*
140 | # except build/, which is used as an MSBuild target.
141 | !**/packages/build/
142 | # Uncomment if necessary however generally it will be regenerated when needed
143 | #!**/packages/repositories.config
144 |
145 | # Windows Azure Build Output
146 | csx/
147 | *.build.csdef
148 |
149 | # Windows Store app package directory
150 | AppPackages/
151 |
152 | # Others
153 | *.[Cc]ache
154 | ClientBin/
155 | [Ss]tyle[Cc]op.*
156 | ~$*
157 | *~
158 | *.dbmdl
159 | *.dbproj.schemaview
160 | *.pfx
161 | *.publishsettings
162 | node_modules/
163 | bower_components/
164 |
165 | # RIA/Silverlight projects
166 | Generated_Code/
167 |
168 | # Backup & report files from converting an old project file
169 | # to a newer Visual Studio version. Backup files are not needed,
170 | # because we have git ;-)
171 | _UpgradeReport_Files/
172 | Backup*/
173 | UpgradeLog*.XML
174 | UpgradeLog*.htm
175 |
176 | # SQL Server files
177 | *.mdf
178 | *.ldf
179 |
180 | # Business Intelligence projects
181 | *.rdl.data
182 | *.bim.layout
183 | *.bim_*.settings
184 |
185 | # Microsoft Fakes
186 | FakesAssemblies/
187 |
188 | # Node.js Tools for Visual Studio
189 | .ntvs_analysis.dat
190 |
191 | # Visual Studio 6 build log
192 | *.plg
193 |
194 | # Visual Studio 6 workspace options file
195 | *.opt
196 |
197 |
198 | # Windows image file caches
199 | Thumbs.db
200 | ehthumbs.db
201 |
202 | # Folder config file
203 | Desktop.ini
204 |
205 | # Recycle Bin used on file shares
206 | $RECYCLE.BIN/
207 |
208 | # Windows Installer files
209 | *.cab
210 | *.msm
211 | *.msp
212 |
213 | # Windows shortcuts
214 | *.lnk
215 |
216 | # =========================
217 | # Operating System Files
218 | # =========================
219 |
220 | # OSX
221 | # =========================
222 |
223 | .DS_Store
224 | .AppleDouble
225 | .LSOverride
226 |
227 | # Thumbnails
228 | ._*
229 |
230 | # Files that might appear on external disk
231 | .Spotlight-V100
232 | .Trashes
233 |
234 | # Directories potentially created on remote AFP share
235 | .AppleDB
236 | .AppleDesktop
237 | Network Trash Folder
238 | Temporary Items
239 | .apdisk
240 |
241 | # Manually added
242 | *.wixpdb
243 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Trinity Creator #
2 | [](https://github.com/NotCoffee418/TrinityCreator/releases)
3 | [](https://github.com/NotCoffee418/TrinityCreator/releases)
4 | [](https://discord.gg/gUXwShK)
5 | [](https://liberapay.com/NotCoffee418/donate)
6 |
7 | Trinity Creator is a database interface that helps World of Warcraft server developers with creating items, creatures, quests and more.
8 | This tool is useful for both beginners; supporting a variety of vanilla through Wrath of the Lich King emulators.
9 | It is possible to add support for custom emulators, specific versions of emulators or repacks.
10 |
11 | ### Preview ###
12 | [](https://user-images.githubusercontent.com/9306304/83596693-921ee680-a565-11ea-87c2-9d975710b577.png)
13 |
14 | ### Before you download ###
15 | Trinity Creator is NOT a hack. You cannot use it to insert items in the private server you play on.
16 | It's strictly used to help server admins with custom content development.
17 |
18 | ### Getting started ###
19 | * [Download & install the latest version](https://github.com/NotCoffee418/TrinityCreator/releases/latest)
20 | * Use the top menu to select your emulator
21 | * Enter your database info & DBC directory (optional, adds extra features)
22 | * Start creating!
23 | NOTE: You need to reload tables or restart your server before you can see your new creation.
24 |
25 | ### Currently supported emulators ###
26 | * TrinityCore WotLK 3.3.5a (2020-01 database)
27 | * TrinityCore WotLK 3.3.5a (2016-06 database)
28 | * AzerothCore WotLK 3.3.5a
29 | * cMangos WotLK 303.5a (Latest compiled)
30 | * Light's Hope Emulator 1.12.2 (Brotalnia repack v16)
31 | * VMaNGOS 1.12.2 (Brotalnia Repack v17)
32 |
33 | ***V1.1 Update:*** You can add support for any emulator as long as it's WotLK or lower, by using the Profile Creator tool.
34 | Making edits to existing profiles for slightly newer or older versions of a specific emulator has also been made easy.
35 |
36 | Known issues: There are specific fields set up for 1.12 emulators as well. But you may have issues with Cataclysm and newer versions of WoW.
37 |
38 | You can contribute any profiles you create at [NotCoffe418/TrinityCreatorProfiles](https://github.com/NotCoffee418/TrinityCreatorProfiles).
39 |
40 | ### Documentation ###
41 | - [Installing & Using Trinity Creator](https://github.com/NotCoffee418/TrinityCreator/wiki/Installing-&-Using-Trinity-Creator)
42 | - [Adding Emulator Support](https://github.com/NotCoffee418/TrinityCreator/wiki/Adding-Emulator-Support)
43 |
44 | ### Support ###
45 | If you need help setting up or using Trinity Creator, you can join us on [Discord](https://discord.gg/gUXwShK).
46 | Please ***DO NOT share private information*** such as database login or public IP adress with anyone.
47 | [](https://discord.gg/gUXwShK)
48 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/DBC/DBCQuery.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Data;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace TrinityCreator.Shared.DBC
9 | {
10 | class DBCQuery
11 | {
12 | ///
13 | /// Negative values from QuestSort & positive values from AreaTable
14 | ///
15 | ///
16 | public static DataTable GetQuestSort()
17 | {
18 | DataTable result = new DataTable();
19 | result.Columns.Add(new DataColumn("ID"));
20 | result.Columns.Add(new DataColumn("Name"));
21 |
22 | // Make quest sort id's negative
23 | DataRow newRow = null;
24 | try
25 | {
26 | foreach (DataRow dr in GetQuestSortNames().Rows)
27 | {
28 | newRow = result.NewRow();
29 | newRow["ID"] = -Math.Abs(Convert.ToInt32(dr[0])); // QuestSort's values should negative
30 | newRow["Name"] = dr[1];
31 | result.Rows.Add(newRow);
32 | }
33 |
34 | // Add AreaTable values
35 | foreach (DataRow dr in GetAreaTableNames().Rows)
36 | {
37 | newRow = result.NewRow();
38 | newRow["ID"] = dr[0];
39 | newRow["Name"] = dr[1];
40 | result.Rows.Add(newRow);
41 | }
42 | }
43 | catch {
44 | newRow = result.NewRow();
45 | newRow["ID"] = "DBC not configured.";
46 | result.Rows.Add(newRow);
47 | }
48 |
49 | return result;
50 | }
51 |
52 | public static DataTable GetAreaTableNames()
53 | {
54 | return DbcHandler.LoadDbc("AreaTable",
55 | new string[] { "m_ID", "m_AreaName_lang" });
56 | }
57 |
58 | public static DataTable GetQuestSortNames()
59 | {
60 | return DbcHandler.LoadDbc("QuestSort",
61 | new string[] { "id", "name" });
62 | }
63 |
64 | public static DataTable GetSpells()
65 | {
66 | return DbcHandler.LoadDbc("Spell",
67 | new string[] { "m_ID", "m_name_lang_1", "m_description_lang_1" });
68 | }
69 |
70 | public static DataTable GetMap()
71 | {
72 | return DbcHandler.LoadDbc("Map",
73 | new string[] { "m_ID", "m_MapName_lang1" });
74 | }
75 |
76 | public static DataTable GetFaction()
77 | {
78 | // basic factions
79 | var result = DbcHandler.LoadDbc("Faction", new string[] { "m_ID", "m_name_lang_1" });
80 | result.Rows.Add(35, "Friendly to all");
81 | result.Rows.Add(168, "Enemy to all");
82 | result.Rows.Add(7, "Neutral Attackable");
83 | result.Rows.Add(14, "Unfriendly Attackable");
84 | return result;
85 | }
86 |
87 | public static DataTable GetCharTitles()
88 | {
89 | return DbcHandler.LoadDbc("CharTitles",
90 | new string[] { "field0", "field2" });
91 | }
92 |
93 |
94 | public static DataTable GetEmotes()
95 | {
96 | return DbcHandler.LoadDbc("Emotes",
97 | new string[] { "id", "description" });
98 | }
99 | }
100 | }
101 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/DBC/DBCViewer/ADBReader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Text;
5 |
6 | namespace DBCViewer
7 | {
8 | class ADBReader : IWowClientDBReader
9 | {
10 | private const int HeaderSize = 48;
11 | private const uint ADBFmtSig = 0x32484357; // WCH2
12 |
13 | public int RecordsCount { get; private set; }
14 | public int FieldsCount { get; private set; }
15 | public int RecordSize { get; private set; }
16 | public int StringTableSize { get; private set; }
17 |
18 | public Dictionary StringTable { get; private set; }
19 |
20 | private byte[][] m_rows;
21 |
22 | public IEnumerable Rows
23 | {
24 | get
25 | {
26 | for (int i = 0; i < RecordsCount; ++i)
27 | {
28 | yield return new BinaryReader(new MemoryStream(m_rows[i]), Encoding.UTF8);
29 | }
30 | }
31 | }
32 |
33 | public ADBReader(string fileName)
34 | {
35 | using (var reader = BinaryReaderExtensions.FromFile(fileName))
36 | {
37 | if (reader.BaseStream.Length < HeaderSize)
38 | {
39 | throw new InvalidDataException(String.Format("File {0} is corrupted!", fileName));
40 | }
41 |
42 | var signature = reader.ReadUInt32();
43 |
44 | if (signature != ADBFmtSig)
45 | {
46 | throw new InvalidDataException(String.Format("File {0} isn't valid DBC file!", fileName));
47 | }
48 |
49 | RecordsCount = reader.ReadInt32();
50 | FieldsCount = reader.ReadInt32(); // not fields count in WCH2
51 | RecordSize = reader.ReadInt32();
52 | StringTableSize = reader.ReadInt32();
53 |
54 | // WCH2 specific fields
55 | uint tableHash = reader.ReadUInt32(); // new field in WCH2
56 | uint build = reader.ReadUInt32(); // new field in WCH2
57 |
58 | int unk1 = reader.ReadInt32(); // Unix time in WCH2
59 | int unk2 = reader.ReadInt32(); // new field in WCH2
60 | int unk3 = reader.ReadInt32(); // new field in WCH2 (index table?)
61 | int locale = reader.ReadInt32(); // new field in WCH2
62 | int unk5 = reader.ReadInt32(); // new field in WCH2
63 |
64 | if (unk3 != 0)
65 | {
66 | reader.ReadBytes(unk3 * 4 - HeaderSize); // an index for rows
67 | reader.ReadBytes(unk3 * 2 - HeaderSize * 2); // a memory allocation bank
68 | }
69 |
70 | m_rows = new byte[RecordsCount][];
71 |
72 | for (int i = 0; i < RecordsCount; i++)
73 | m_rows[i] = reader.ReadBytes(RecordSize);
74 |
75 | int stringTableStart = (int)reader.BaseStream.Position;
76 |
77 | StringTable = new Dictionary();
78 |
79 | while (reader.BaseStream.Position != reader.BaseStream.Length)
80 | {
81 | int index = (int)reader.BaseStream.Position - stringTableStart;
82 | StringTable[index] = reader.ReadStringNull();
83 | }
84 | }
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/DBC/DBCViewer/DB2Reader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Text;
5 |
6 | namespace DBCViewer
7 | {
8 | class DB2Reader : IWowClientDBReader
9 | {
10 | private const int HeaderSize = 48;
11 | private const uint DB2FmtSig = 0x32424457; // WDB2
12 |
13 | public int RecordsCount { get; private set; }
14 | public int FieldsCount { get; private set; }
15 | public int RecordSize { get; private set; }
16 | public int StringTableSize { get; private set; }
17 |
18 | public Dictionary StringTable { get; private set; }
19 |
20 | private byte[][] m_rows;
21 |
22 | public IEnumerable Rows
23 | {
24 | get
25 | {
26 | for (int i = 0; i < RecordsCount; ++i)
27 | {
28 | yield return new BinaryReader(new MemoryStream(m_rows[i]), Encoding.UTF8);
29 | }
30 | }
31 | }
32 |
33 | public DB2Reader(string fileName)
34 | {
35 | using (var reader = BinaryReaderExtensions.FromFile(fileName))
36 | {
37 | if (reader.BaseStream.Length < HeaderSize)
38 | {
39 | throw new InvalidDataException(String.Format("File {0} is corrupted!", fileName));
40 | }
41 |
42 | if (reader.ReadUInt32() != DB2FmtSig)
43 | {
44 | throw new InvalidDataException(String.Format("File {0} isn't valid DBC file!", fileName));
45 | }
46 |
47 | RecordsCount = reader.ReadInt32();
48 | FieldsCount = reader.ReadInt32();
49 | RecordSize = reader.ReadInt32();
50 | StringTableSize = reader.ReadInt32();
51 |
52 | // WDB2 specific fields
53 | uint tableHash = reader.ReadUInt32(); // new field in WDB2
54 | uint build = reader.ReadUInt32(); // new field in WDB2
55 | uint unk1 = reader.ReadUInt32(); // new field in WDB2
56 |
57 | if (build > 12880) // new extended header
58 | {
59 | int MinId = reader.ReadInt32(); // new field in WDB2
60 | int MaxId = reader.ReadInt32(); // new field in WDB2
61 | int locale = reader.ReadInt32(); // new field in WDB2
62 | int unk5 = reader.ReadInt32(); // new field in WDB2
63 |
64 | if (MaxId != 0)
65 | {
66 | var diff = MaxId - MinId + 1; // blizzard is weird people...
67 | reader.ReadBytes(diff * 4); // an index for rows
68 | reader.ReadBytes(diff * 2); // a memory allocation bank
69 | }
70 | }
71 |
72 | m_rows = new byte[RecordsCount][];
73 |
74 | for (int i = 0; i < RecordsCount; i++)
75 | m_rows[i] = reader.ReadBytes(RecordSize);
76 |
77 | int stringTableStart = (int)reader.BaseStream.Position;
78 |
79 | StringTable = new Dictionary();
80 |
81 | while (reader.BaseStream.Position != reader.BaseStream.Length)
82 | {
83 | int index = (int)reader.BaseStream.Position - stringTableStart;
84 | StringTable[index] = reader.ReadStringNull();
85 | }
86 | }
87 | }
88 | }
89 | }
90 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/DBC/DBCViewer/DBCReader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Text;
5 |
6 | namespace DBCViewer
7 | {
8 | class DBCReader : IWowClientDBReader
9 | {
10 | private const uint HeaderSize = 20;
11 | private const uint DBCFmtSig = 0x43424457; // WDBC
12 |
13 | public int RecordsCount { get; private set; }
14 | public int FieldsCount { get; private set; }
15 | public int RecordSize { get; private set; }
16 | public int StringTableSize { get; private set; }
17 |
18 | public Dictionary StringTable { get; private set; }
19 |
20 | private byte[] Strings;
21 |
22 | private byte[][] m_rows;
23 |
24 | public IEnumerable Rows
25 | {
26 | get
27 | {
28 | for (int i = 0; i < RecordsCount; ++i)
29 | {
30 | yield return new BinaryReader(new MemoryStream(m_rows[i]), Encoding.UTF8);
31 | }
32 | }
33 | }
34 |
35 | public DBCReader(string fileName)
36 | {
37 | using (var reader = BinaryReaderExtensions.FromFile(fileName))
38 | {
39 | if (reader.BaseStream.Length < HeaderSize)
40 | {
41 | throw new InvalidDataException(String.Format("File {0} is corrupted!", fileName));
42 | }
43 |
44 | if (reader.ReadUInt32() != DBCFmtSig)
45 | {
46 | throw new InvalidDataException(String.Format("File {0} isn't valid DBC file!", fileName));
47 | }
48 |
49 | RecordsCount = reader.ReadInt32();
50 | FieldsCount = reader.ReadInt32();
51 | RecordSize = reader.ReadInt32();
52 | StringTableSize = reader.ReadInt32();
53 |
54 | m_rows = new byte[RecordsCount][];
55 |
56 | for (int i = 0; i < RecordsCount; i++)
57 | m_rows[i] = reader.ReadBytes(RecordSize);
58 |
59 | int stringTableStart = (int)reader.BaseStream.Position;
60 |
61 | StringTable = new Dictionary();
62 |
63 | while (reader.BaseStream.Position != reader.BaseStream.Length)
64 | {
65 | int index = (int)reader.BaseStream.Position - stringTableStart;
66 | StringTable[index] = reader.ReadStringNull();
67 | }
68 |
69 | reader.BaseStream.Position = stringTableStart;
70 | Strings = reader.ReadBytes(StringTableSize);
71 | }
72 | }
73 |
74 | public string GetString(int offset)
75 | {
76 | unsafe
77 | {
78 | fixed (byte* b = Strings)
79 | {
80 | int len = 0;
81 |
82 | while (*(b + offset) != 0)
83 | len++;
84 |
85 | return new string((sbyte*)b, offset, len, Encoding.UTF8);
86 | }
87 | }
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/DBC/DBCViewer/DBReaderFactory.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.IO;
3 |
4 | namespace DBCViewer
5 | {
6 | class DBReaderFactory
7 | {
8 | public static IWowClientDBReader GetReader(string file)
9 | {
10 | IWowClientDBReader reader;
11 |
12 | var ext = Path.GetExtension(file).ToUpperInvariant();
13 | if (ext == ".DBC")
14 | reader = new DBCReader(file);
15 | else if (ext == ".DB2")
16 | try
17 | {
18 | reader = new DB2Reader(file);
19 | }
20 | catch
21 | {
22 | try
23 | {
24 | reader = new DB3Reader(file);
25 | }
26 | catch
27 | {
28 | reader = new DB4Reader(file);
29 | }
30 | }
31 | else if (ext == ".ADB")
32 | reader = new ADBReader(file);
33 | else if (ext == ".WDB")
34 | reader = new WDBReader(file);
35 | else if (ext == ".STL")
36 | reader = new STLReader(file);
37 | else
38 | throw new InvalidDataException(String.Format("Unknown file type {0}", ext));
39 |
40 | return reader;
41 | }
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/DBC/DBCViewer/IWowClientDBReader.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.IO;
3 |
4 | namespace DBCViewer
5 | {
6 | interface IWowClientDBReader
7 | {
8 | int RecordsCount { get; }
9 | int FieldsCount { get; }
10 | int RecordSize { get; }
11 | int StringTableSize { get; }
12 | Dictionary StringTable { get; }
13 | IEnumerable Rows { get; }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/DBC/DBCViewer/WDBReader.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Text;
6 |
7 | namespace DBCViewer
8 | {
9 | class WDBReader : IWowClientDBReader
10 | {
11 | private const int HeaderSize = 24;
12 | private uint[] WDBSigs = new uint[]
13 | {
14 | 0x574D4F42, // creaturecache.wdb
15 | 0x57474F42, // gameobjectcache.wdb
16 | 0x57494442, // itemcache.wdb
17 | 0x574E4442, // itemnamecache.wdb
18 | 0x57495458, // itemtextcache.wdb
19 | 0x574E5043, // npccache.wdb
20 | 0x57505458, // pagetextcache.wdb
21 | 0x57515354, // questcache.wdb
22 | 0x5752444E // wowcache.wdb
23 | };
24 |
25 | public int RecordsCount { get; private set; }
26 | public int FieldsCount { get; private set; }
27 | public int RecordSize { get; private set; }
28 | public int StringTableSize { get; private set; }
29 |
30 | public Dictionary StringTable { get; private set; }
31 |
32 | private Dictionary m_rows;
33 |
34 | public IEnumerable Rows
35 | {
36 | get
37 | {
38 | for (int i = 0; i < RecordsCount; ++i)
39 | {
40 | yield return new BinaryReader(new MemoryStream(m_rows[i]), Encoding.UTF8);
41 | }
42 | }
43 | }
44 |
45 | public WDBReader(string fileName)
46 | {
47 | using (var reader = BinaryReaderExtensions.FromFile(fileName))
48 | {
49 | if (reader.BaseStream.Length < HeaderSize)
50 | {
51 | throw new InvalidDataException(String.Format("File {0} is corrupted!", fileName));
52 | }
53 |
54 | var signature = reader.ReadUInt32();
55 |
56 | if (!WDBSigs.Contains(signature))
57 | {
58 | throw new InvalidDataException(String.Format("File {0} isn't valid WDB file!", fileName));
59 | }
60 |
61 | uint build = reader.ReadUInt32();
62 | uint locale = reader.ReadUInt32();
63 | var unk1 = reader.ReadInt32();
64 | var unk2 = reader.ReadInt32();
65 | var version = reader.ReadInt32();
66 |
67 | m_rows = new Dictionary();
68 |
69 | while (reader.BaseStream.Position != reader.BaseStream.Length)
70 | {
71 | var entry = reader.ReadInt32();
72 | var size = reader.ReadInt32();
73 | if (entry == 0 && size == 0 && reader.BaseStream.Position == reader.BaseStream.Length)
74 | break;
75 | var row = new byte[0]
76 | .Concat(BitConverter.GetBytes(entry))
77 | .Concat(reader.ReadBytes(size))
78 | .ToArray();
79 | m_rows.Add(entry, row);
80 | }
81 |
82 | RecordsCount = m_rows.Count;
83 | }
84 | }
85 | }
86 | }
87 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Data/CExceptions.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace TrinityCreator.Shared.Data
8 | {
9 | class CExceptions
10 | {
11 | public class DatabaseOffline : Exception { }
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Data/Coordinate.cs:
--------------------------------------------------------------------------------
1 |
2 | using System;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using TrinityCreator.Shared.Database;
8 |
9 | namespace TrinityCreator.Shared.Data
10 | {
11 | public class Coordinate
12 | {
13 | private int _x;
14 | private int _y;
15 | private int _z;
16 | private int _mapId;
17 |
18 | public Coordinate()
19 | : this(0, 0, 0, 0) { }
20 | public Coordinate(int x, int y, int z)
21 | : this(x, y, z, 0) { }
22 | public Coordinate(int x, int y)
23 | : this(x, y, 0, 0) { }
24 | public Coordinate(int x = 0, int y = 0, int z = 0, int mapid = 0)
25 | {
26 | X = x;
27 | Y = y;
28 | Z = z;
29 | MapId = mapid;
30 | }
31 | public int X
32 | {
33 | get
34 | {
35 | return _x;
36 | }
37 | set
38 | {
39 | _x = DataType.LimitLength(value, "int(10)");
40 | }
41 | }
42 | public int Y
43 | {
44 | get
45 | {
46 | return _y;
47 | }
48 | set
49 | {
50 | _y = DataType.LimitLength(value, "int(10)");
51 | }
52 | }
53 | public int Z
54 | {
55 | get
56 | {
57 | return _z;
58 | }
59 | set
60 | {
61 | _z = DataType.LimitLength(value, "int(10)");
62 | }
63 | }
64 | public int MapId
65 | {
66 | get
67 | {
68 | return _mapId;
69 | }
70 | set
71 | {
72 | _mapId = DataType.LimitLength(value, "smallint(5)");
73 | }
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Data/CreatureFamily.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace TrinityCreator.Shared.Data
4 | {
5 | public class CreatureFamily : IKeyValue
6 | {
7 | public CreatureFamily(int id, string description, int petSpellDataId = 0)
8 | {
9 | Id = id;
10 | Description = description;
11 | PetSpellDataId = petSpellDataId;
12 | }
13 | public int PetSpellDataId { get; set; }
14 | public override string ToString()
15 | {
16 | return Description;
17 | }
18 |
19 | public static CreatureFamily[] GetCreatureFamilies()
20 | {
21 | return new CreatureFamily[]
22 | {
23 | new CreatureFamily(0, "None"),
24 | new CreatureFamily(1, "Wolf", 5938),
25 | new CreatureFamily(2, "Cat", 5828),
26 | new CreatureFamily(3, "Spider", 5880),
27 | new CreatureFamily(4, "Bear", 5797),
28 | new CreatureFamily(5, "Boar", 9081),
29 | new CreatureFamily(6, "Crocolisk", 5847),
30 | new CreatureFamily(7, "Carrion Bird", 8311),
31 | new CreatureFamily(8, "Crab", 5835),
32 | new CreatureFamily(9, "Gorilla", 9055),
33 | new CreatureFamily(11, "Raptor", 5830),
34 | new CreatureFamily(12, "Tallstrider", 5830),
35 | new CreatureFamily(29, "Felguard"),
36 | new CreatureFamily(20, "Scorpid", 5864),
37 | new CreatureFamily(21, "Turtle", 13466),
38 | new CreatureFamily(24, "Bat", 5786),
39 | new CreatureFamily(25, "Hyena", 8280),
40 | new CreatureFamily(26, "Owl", 5859),
41 | new CreatureFamily(27, "Wind Serpent", 8905),
42 | new CreatureFamily(30, "Dragonhawk", 10391),
43 | new CreatureFamily(31, "Ravager", 5949),
44 | new CreatureFamily(32, "Warp Stalker", 10525),
45 | new CreatureFamily(33, "Sporebat", 12957),
46 | new CreatureFamily(34, "Nether Ray", 12887),
47 | new CreatureFamily(35, "Serpent", 8905),
48 | new CreatureFamily(37, "Moth", 13099),
49 | new CreatureFamily(41, "Silithid", 8849),
50 | new CreatureFamily(42, "Worm", 12947),
51 | new CreatureFamily(44, "Wasp", 5874),
52 | new CreatureFamily(43, "Rhino"), // not tamable by default
53 | new CreatureFamily(38, "Chimaera"), // none with pet spell ID in db
54 | new CreatureFamily(39, "Devilsaur"), // none with pet spell ID in db
55 | new CreatureFamily(45, "Core Hound"), // none with pet spell ID in db
56 | new CreatureFamily(46, "Spirit Beast"), // needs to be set manually
57 | new CreatureFamily(23, "Imp"),
58 | new CreatureFamily(15, "Felhunter"),
59 | new CreatureFamily(16, "Voidwalker"),
60 | new CreatureFamily(17, "Succubus"),
61 | new CreatureFamily(19, "Doomguard"),
62 | new CreatureFamily(40, "Ghoul"),
63 | new CreatureFamily(28, "Remote Control"),
64 | };
65 | }
66 | }
67 | }
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Data/Currency.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Linq;
4 | using System.Windows;
5 |
6 | namespace TrinityCreator.Shared.Data
7 | {
8 | public class Currency : INotifyPropertyChanged
9 | {
10 | private int _copper;
11 | private int _gold;
12 | private int _silver;
13 | private int _amount;
14 |
15 | public Currency(string g, string s, string c)
16 | {
17 | StringsToCurrency(g, s, c);
18 | }
19 |
20 | public Currency(int amount)
21 | {
22 | SetCurrencyFromAmount(amount);
23 | }
24 |
25 | public int Gold
26 | {
27 | get { return _gold; }
28 | set
29 | {
30 | _gold = value;
31 | UpdateAmount();
32 | RaisePropertyChanged("Gold");
33 | RaisePropertyChanged("Amount");
34 | }
35 | }
36 |
37 | public int Silver
38 | {
39 | get { return _silver; }
40 | set
41 | {
42 | _silver = value;
43 | UpdateAmount();
44 | RaisePropertyChanged("Silver");
45 | RaisePropertyChanged("Amount");
46 | }
47 | }
48 |
49 | public int Copper
50 | {
51 | get { return _copper; }
52 | set
53 | {
54 | _copper = value;
55 | UpdateAmount();
56 | RaisePropertyChanged("Copper");
57 | RaisePropertyChanged("Amount");
58 | }
59 | }
60 |
61 | ///
62 | /// integer value as it should be placed in the database
63 | ///
64 | public int Amount {
65 | get { return _amount; }
66 | set {
67 | _amount = value;
68 | SetCurrencyFromAmount(value);
69 | RaisePropertyChanged("Gold");
70 | RaisePropertyChanged("Silver");
71 | RaisePropertyChanged("Copper");
72 | RaisePropertyChanged("Amount");
73 | }
74 | }
75 |
76 | public event PropertyChangedEventHandler PropertyChanged;
77 |
78 |
79 | private void UpdateAmount()
80 | {
81 | StringsToCurrency(Gold.ToString(), Silver.ToString(), Copper.ToString());
82 | }
83 |
84 | private void StringsToCurrency(string g, string s, string c)
85 | {
86 | if (s.Count() > 2 || c.Count() > 2)
87 | throw new Exception("Silver and copper can only contain two numbers characters each.");
88 | if (g.Length == 0) g = "00";
89 | if (s.Length == 0) s = "00";
90 | if (c.Length == 0) c = "00";
91 | try
92 | {
93 | _gold = int.Parse(g);
94 | _silver = int.Parse(s);
95 | _copper = int.Parse(c);
96 |
97 | // add 0 for correct value on blank or single character values
98 | for (var i = s.Count(); s.Count() < 2; i++)
99 | s = "0" + s;
100 | for (var i = c.Count(); c.Count() < 2; i++)
101 | c = "0" + c;
102 |
103 | try
104 | {
105 | _amount = int.Parse(g + s + c);
106 | }
107 | catch // too big, set max
108 | {
109 | _gold = 214748;
110 | _silver = 36;
111 | _copper = 47;
112 | _amount = int.MaxValue;
113 | }
114 | }
115 | catch
116 | {
117 | throw new Exception("Currency must be numeric.");
118 | }
119 | }
120 |
121 | private void SetCurrencyFromAmount(int amount)
122 | {
123 | string g = "", s = "", c = "", amountstr = amount.ToString();
124 | if (amountstr.Length > 4)
125 | g = amountstr.Substring(0, amountstr.Length - 4);
126 | if (amountstr.Length > 3)
127 | s += amountstr[amountstr.Length - 4];
128 | if (amountstr.Length > 2)
129 | s += amountstr[amountstr.Length - 3];
130 | if (amountstr.Length > 1)
131 | c += amountstr[amountstr.Length - 2];
132 | c += amountstr[amountstr.Length - 1];
133 |
134 | // Set values
135 | StringsToCurrency(g, s, c);
136 | }
137 |
138 | public override string ToString()
139 | {
140 | return Amount.ToString();
141 | }
142 |
143 | private void RaisePropertyChanged(string property)
144 | {
145 | if (PropertyChanged != null)
146 | PropertyChanged(this, new PropertyChangedEventArgs(property));
147 | }
148 | }
149 | }
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Data/CustomDisplayField.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.ComponentModel;
3 | using System.Text.RegularExpressions;
4 | using TrinityCreator.Shared.Profiles;
5 |
6 | namespace TrinityCreator.Shared.Data
7 | {
8 | ///
9 | /// See documentation for more info on how to use this
10 | ///
11 | public class CustomDisplayField : INotifyPropertyChanged
12 | {
13 | // field
14 | private string _inputValue = string.Empty;
15 |
16 | ///
17 | /// Table Name
18 | ///
19 | public string Table { get; private set; }
20 |
21 | ///
22 | /// Column Name
23 | ///
24 | public string Column { get; private set; }
25 |
26 | ///
27 | /// Display Name
28 | ///
29 | public string DisplayName { get; private set; }
30 |
31 | ///
32 | /// Full custom field name, used by Exporter
33 | ///
34 | public string FullCustomFieldName { get; private set; }
35 |
36 | ///
37 | /// Export type
38 | ///
39 | public Export.C ExportType { get; private set; }
40 |
41 | ///
42 | /// Value input by user for export
43 | ///
44 | public string InputValue
45 | {
46 | get
47 | {
48 | return _inputValue;
49 | }
50 | set
51 | {
52 | _inputValue = value;
53 | RaisePropertyChanged("InputValue");
54 | }
55 | }
56 |
57 |
58 | public event PropertyChangedEventHandler PropertyChanged;
59 |
60 | ///
61 | /// Creates a CustomDisplayField using the information defined in profile
62 | ///
63 | /// database real table name
64 | /// database real table column
65 | /// eg. Creature.CustomInt.MyCustomDisplayName
66 | ///
67 | public static CustomDisplayField Create(
68 | string databaseTable,
69 | string databaseColumn,
70 | string fullCustomFieldName)
71 | {
72 | Regex regex = new Regex(
73 | @"(Creature|Item|Quest|Vendor)\.Custom(Int|Float|Text)\.(.+)");
74 |
75 | // return null if not valid or not custom DISPLAY
76 | if (!regex.IsMatch(fullCustomFieldName))
77 | return null;
78 | var result = new CustomDisplayField()
79 | {
80 | Table = databaseTable,
81 | Column = databaseColumn,
82 | FullCustomFieldName = fullCustomFieldName
83 | };
84 |
85 | var match = regex.Match(fullCustomFieldName);
86 |
87 | // Deternine the creator / export type
88 | switch (match.Groups[1].Value)
89 | {
90 | case "Item":
91 | result.ExportType = Export.C.Item;
92 | break;
93 | case "Quest":
94 | result.ExportType = Export.C.Quest;
95 | break;
96 | case "Creature":
97 | result.ExportType = Export.C.Creature;
98 | break;
99 | case "Vendor":
100 | result.ExportType = Export.C.Vendor;
101 | break;
102 | default:
103 | throw new ArgumentException(
104 | match.Groups[1].Value + " is not a supported creator for custom display fields.");
105 | }
106 |
107 | // Grab DisplayName
108 | result.DisplayName = match.Groups[3].Value;
109 |
110 | // Set default value to 0 if type is numeric
111 | if (match.Groups[2].Value == "Int" || match.Groups[2].Value == "Float")
112 | result.InputValue = "0";
113 |
114 | // Create object and return
115 | return result;
116 | }
117 |
118 | private void RaisePropertyChanged(string property)
119 | {
120 | if (PropertyChanged != null)
121 | PropertyChanged(this, new PropertyChangedEventArgs(property));
122 | }
123 | }
124 | }
125 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Data/Damage.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 |
3 | namespace TrinityCreator.Shared.Data
4 | {
5 | public class Damage : INotifyPropertyChanged
6 | {
7 | private int _maxDamage;
8 | private int _minDamage;
9 | private int _speed;
10 | private DamageType _type;
11 |
12 | public int MinDamage
13 | {
14 | get { return _minDamage; }
15 | set
16 | {
17 | _minDamage = Database.DataType.LimitLength(value, "int(10)");
18 | RaisePropertyChanged("MinDamage");
19 | RaisePropertyChanged("Dps");
20 | RaisePropertyChanged("DpsInfo");
21 | }
22 | }
23 |
24 | public int MaxDamage
25 | {
26 | get { return _maxDamage; }
27 | set
28 | {
29 | _maxDamage = Database.DataType.LimitLength(value, "int(10)");
30 | RaisePropertyChanged("MaxDamage");
31 | RaisePropertyChanged("Dps");
32 | RaisePropertyChanged("DpsInfo");
33 | }
34 | }
35 |
36 | public int Speed
37 | {
38 | get { return _speed; }
39 | set
40 | {
41 | _speed = Database.DataType.LimitLength(value, "smallint(5)");
42 | RaisePropertyChanged("Speed");
43 | RaisePropertyChanged("Dps");
44 | RaisePropertyChanged("DpsInfo");
45 | }
46 | }
47 |
48 | public DamageType Type
49 | {
50 | get { return _type; }
51 | set
52 | {
53 | _type = value;
54 | RaisePropertyChanged("Type");
55 | RaisePropertyChanged("Dps");
56 | RaisePropertyChanged("DpsInfo");
57 | }
58 | }
59 |
60 | public double Dps
61 | {
62 | get
63 | {
64 | var avgDmg = (MinDamage + MaxDamage)/2.0;
65 | return avgDmg/(Speed/1000.0);
66 | }
67 | }
68 |
69 | public string DpsInfo
70 | {
71 | get
72 | {
73 | try
74 | {
75 | return "(" + Dps.ToString("0.00") + " damage per second)";
76 | }
77 | catch
78 | {
79 | return "(INVALID damage per second)";
80 | }
81 | }
82 | }
83 |
84 | public event PropertyChangedEventHandler PropertyChanged;
85 |
86 | public void RaisePropertyChanged(string property)
87 | {
88 | if (PropertyChanged != null)
89 | {
90 | PropertyChanged(this, new PropertyChangedEventArgs(property));
91 | }
92 | }
93 |
94 | }
95 | }
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Data/DamageType.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace TrinityCreator.Shared.Data
4 | {
5 | public class DamageType : IKeyValue
6 | {
7 | public DamageType(int id, string description)
8 | {
9 | Id = id;
10 | Description = description;
11 | }
12 |
13 | public override string ToString()
14 | {
15 | return Description;
16 | }
17 |
18 | public static DamageType[] GetDamageTypes(bool magicOnly = false)
19 | {
20 | var list = new List();
21 | if (!magicOnly)
22 | list.Add(new DamageType(0, "Physical"));
23 |
24 | list.AddRange(new[]
25 | {
26 | new DamageType(1, "Holy"),
27 | new DamageType(2, "Fire"),
28 | new DamageType(3, "Nature"),
29 | new DamageType(4, "Frost"),
30 | new DamageType(5, "Shadow"),
31 | new DamageType(6, "Arcane")
32 | });
33 |
34 | return list.ToArray();
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Data/ICreator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using TrinityCreator.Shared.Profiles;
7 |
8 | namespace TrinityCreator.Shared.Data
9 | {
10 | public interface ICreator
11 | {
12 | ///
13 | /// Creator export type
14 | ///
15 | Export.C ExportType { get; }
16 |
17 | ///
18 | /// Defines data for custom display fields
19 | ///
20 | List CustomDisplayFields { get; }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Data/IKeyValue.cs:
--------------------------------------------------------------------------------
1 | namespace TrinityCreator.Shared.Data
2 | {
3 | public abstract class IKeyValue
4 | {
5 | public IKeyValue() { }
6 | public IKeyValue(int id, string description)
7 | {
8 | Id = id;
9 | Description = description;
10 | }
11 |
12 | public int Id { get; set; }
13 |
14 | public string Description { get; set; }
15 |
16 | public override string ToString()
17 | {
18 | return Description;
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Data/ItemClass.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace TrinityCreator.Shared.Data
4 | {
5 | public class ItemClass : IKeyValue
6 | {
7 | public ItemClass(int id, string description)
8 | : base(id, description) { }
9 |
10 | public ItemSubClass[] AvailableSubClasses
11 | {
12 | get
13 | {
14 | switch (Id)
15 | {
16 | case 0:
17 | return ItemSubClass.GetConsumableList();
18 | case 1:
19 | return ItemSubClass.GetContainerList();
20 | case 2:
21 | return ItemSubClass.GetWeaponList();
22 | case 3:
23 | return ItemSubClass.GetGemList();
24 | case 4:
25 | return ItemSubClass.GetArmorList();
26 | case 5:
27 | return ItemSubClass.GetReagentList();
28 | case 6:
29 | return ItemSubClass.GetProjectileList();
30 | case 7:
31 | return ItemSubClass.GetTradeGoodsList();
32 | case 9:
33 | return ItemSubClass.GetRecipeList();
34 | case 11:
35 | return ItemSubClass.GetQuiverList();
36 | case 12:
37 | return ItemSubClass.GetQuestList();
38 | case 13:
39 | return ItemSubClass.GetKeyList();
40 | case 15:
41 | return ItemSubClass.GetMiscellaneousList();
42 | default:
43 | throw new Exception("No correct item class was given to list subclasses.");
44 | }
45 | }
46 | }
47 |
48 |
49 | ///
50 | /// Return list of supported itemclasses
51 | ///
52 | ///
53 | public static ItemClass[] GetClassList()
54 | {
55 | return new[]
56 | {
57 | new ItemClass(4, "Armor"),
58 | new ItemClass(2, "Weapon"),
59 | new ItemClass(0, "Consumable"),
60 | new ItemClass(1, "Container"),
61 | new ItemClass(3, "Gem"),
62 | new ItemClass(5, "Reagent"),
63 | new ItemClass(6, "Projectile"),
64 | new ItemClass(7, "Trade Goods"),
65 | new ItemClass(9, "Recipe"),
66 | new ItemClass(11, "Quiver"),
67 | new ItemClass(12, "Quest"),
68 | new ItemClass(13, "Key"),
69 | new ItemClass(15, "Miscellaneous"),
70 | new ItemClass(16, "Glyph")
71 | };
72 | }
73 | }
74 | }
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Data/ItemInventoryType.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace TrinityCreator.Shared.Data
4 | {
5 | public class ItemInventoryType : IKeyValue
6 | {
7 | public ItemInventoryType(int id, string description, int sheath = 0)
8 | : base(id, description) {
9 | Sheath = sheath;
10 | }
11 |
12 | public int Sheath { get; set; }
13 |
14 | public static ItemInventoryType[] GetAllInventoryTypes()
15 | {
16 | var result = new List();
17 | result.AddRange(GetNonEquipable());
18 | result.AddRange(GetArmor());
19 | result.AddRange(GetOneHandWeapon());
20 | result.AddRange(GetShield());
21 | result.AddRange(GetRangedWandGun());
22 | result.AddRange(GetRangedBow());
23 | result.AddRange(GetTwoHandWeapon());
24 | result.AddRange(GetBag());
25 | result.AddRange(GetThrown());
26 | result.AddRange(GetAmmo());
27 | return result.ToArray();
28 | }
29 |
30 | public static ItemInventoryType[] GetNonEquipable()
31 | {
32 | return new[]
33 | {
34 | new ItemInventoryType(0, "Non equipable")
35 | };
36 | }
37 |
38 | public static ItemInventoryType[] GetOneHandWeapon()
39 | {
40 | return new[]
41 | {
42 | new ItemInventoryType(13, "One-Hand", 3),
43 | new ItemInventoryType(21, "Main Hand", 3),
44 | new ItemInventoryType(22, "Off hand", 6),
45 | new ItemInventoryType(23, "Holdable (Tome)", 6)
46 | };
47 | }
48 |
49 | public static ItemInventoryType[] GetShield()
50 | {
51 | return new[]
52 | {
53 | new ItemInventoryType(14, "Shield", 4)
54 | };
55 | }
56 |
57 | public static ItemInventoryType[] GetRangedWandGun()
58 | {
59 | return new[]
60 | {
61 | new ItemInventoryType(26, "Ranged")
62 | };
63 | }
64 |
65 | public static ItemInventoryType[] GetRangedBow()
66 | {
67 | return new[]
68 | {
69 | new ItemInventoryType(15, "Ranged")
70 | };
71 | }
72 |
73 |
74 | public static ItemInventoryType[] GetTwoHandWeapon()
75 | {
76 | return new[]
77 | {
78 | new ItemInventoryType(17, "Two-Hand", 1)
79 | };
80 | }
81 |
82 | public static ItemInventoryType[] GetBag()
83 | {
84 | return new[]
85 | {
86 | new ItemInventoryType(18, "Bag")
87 | };
88 | }
89 |
90 | public static ItemInventoryType[] GetThrown()
91 | {
92 | return new[]
93 | {
94 | new ItemInventoryType(25, "Thrown")
95 | };
96 | }
97 |
98 | public static ItemInventoryType[] GetAmmo()
99 | {
100 | return new[]
101 | {
102 | new ItemInventoryType(24, "Ammo")
103 | };
104 | }
105 |
106 | public static ItemInventoryType[] GetArmor()
107 | {
108 | return new[]
109 | {
110 | new ItemInventoryType(1, "Head"),
111 | new ItemInventoryType(2, "Neck"),
112 | new ItemInventoryType(3, "Shoulder"),
113 | new ItemInventoryType(4, "Shirt"),
114 | new ItemInventoryType(5, "Chest"),
115 | new ItemInventoryType(6, "Waist"),
116 | new ItemInventoryType(7, "Legs"),
117 | new ItemInventoryType(8, "Feet"),
118 | new ItemInventoryType(9, "Wrists"),
119 | new ItemInventoryType(10, "Hands"),
120 | new ItemInventoryType(11, "Finger"),
121 | new ItemInventoryType(12, "Trinket"),
122 | new ItemInventoryType(16, "Cloak")
123 | };
124 | }
125 |
126 | public static ItemInventoryType[] GetRelic()
127 | {
128 | return new[]
129 | {
130 | new ItemInventoryType(28, "Relic")
131 | };
132 | }
133 | }
134 | }
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Data/ItemMaterial.cs:
--------------------------------------------------------------------------------
1 | namespace TrinityCreator.Shared.Data
2 | {
3 | public class ItemMaterial : IKeyValue
4 | {
5 | public ItemMaterial(int id, string description)
6 | : base(id, description) { }
7 |
8 | public static ItemMaterial GetConsumable()
9 | {
10 | return new ItemMaterial(-1, "Consumable");
11 | }
12 |
13 | public static ItemMaterial GetUndefined()
14 | {
15 | return new ItemMaterial(1, "Not Defined");
16 | }
17 |
18 | public static ItemMaterial GetPlate()
19 | {
20 | return new ItemMaterial(6, "Plate");
21 | }
22 |
23 | public static ItemMaterial GetChain()
24 | {
25 | return new ItemMaterial(5, "Chainmail");
26 | }
27 |
28 | public static ItemMaterial GetLeather()
29 | {
30 | return new ItemMaterial(8, "Leather");
31 | }
32 |
33 | public static ItemMaterial GetCloth()
34 | {
35 | return new ItemMaterial(7, "Cloth");
36 | }
37 | }
38 | }
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Data/ItemQuality.cs:
--------------------------------------------------------------------------------
1 | using System.ComponentModel;
2 | using System.Linq;
3 | using System.Windows.Media;
4 |
5 | namespace TrinityCreator.Shared.Data
6 | {
7 | public class ItemQuality : IKeyValue, INotifyPropertyChanged
8 | {
9 | private Color _color;
10 |
11 | public ItemQuality(int id, string name, Color color)
12 | {
13 | Id = id;
14 | Description = name;
15 | QualityColor = color;
16 | }
17 |
18 | public Color QualityColor
19 | {
20 | get { return _color; }
21 | set
22 | {
23 | _color = value;
24 | RaisePropertyChanged("QualityColor");
25 | }
26 | }
27 |
28 | public int Id
29 | {
30 | get { return base.Id; }
31 | set
32 | {
33 | base.Id = value;
34 | RaisePropertyChanged("Id");
35 | }
36 | }
37 |
38 | public string Description
39 | {
40 | get { return base.Description; }
41 | set
42 | {
43 | base.Description = value;
44 | RaisePropertyChanged("Description");
45 | }
46 | }
47 |
48 | public override string ToString()
49 | {
50 | return Description;
51 | }
52 |
53 | public event PropertyChangedEventHandler PropertyChanged;
54 |
55 | private void RaisePropertyChanged(string property)
56 | {
57 | if (PropertyChanged != null)
58 | PropertyChanged(this, new PropertyChangedEventArgs(property));
59 | }
60 |
61 | public static int FindQualityId(string name)
62 | {
63 | var found = from q in GetQualityList() where q.Description == name select q.Id;
64 | return found.First();
65 | }
66 |
67 | public string FindQualityName(int id)
68 | {
69 | var found = from q in GetQualityList() where q.Id == id select q.Description;
70 | return found.First();
71 | }
72 |
73 | public static ItemQuality[] GetQualityList()
74 | {
75 | return new[]
76 | {
77 | new ItemQuality(0, "Poor", Color.FromRgb(157, 157, 157)),
78 | new ItemQuality(1, "Common", Color.FromRgb(255, 255, 255)),
79 | new ItemQuality(2, "Uncommon", Color.FromRgb(30, 255, 0)),
80 | new ItemQuality(3, "Rare", Color.FromRgb(0, 112, 221)),
81 | new ItemQuality(4, "Epic", Color.FromRgb(163, 53, 238)),
82 | new ItemQuality(5, "Legendary", Color.FromRgb(255, 128, 0)),
83 | new ItemQuality(6, "Artifact", Colors.Red),
84 | new ItemQuality(7, "Bind to Account", Color.FromRgb(229, 204, 128))
85 | };
86 | }
87 | }
88 | }
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Data/Socket.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Media.Imaging;
3 |
4 | namespace TrinityCreator.Shared.Data
5 | {
6 | public class Socket : IKeyValue
7 | {
8 | public Socket(int id, string description, BitmapImage socketImage)
9 | {
10 | Id = id;
11 | Description = description;
12 | SocketImage = socketImage;
13 | }
14 |
15 | public BitmapImage SocketImage { get; set; }
16 |
17 | public override string ToString()
18 | {
19 | return Description;
20 | }
21 |
22 | public static Socket[] GetSocketList()
23 | {
24 | return new[]
25 | {
26 | new Socket(1, "Meta",
27 | new BitmapImage(new Uri("pack://application:,,,/TrinityCreator.Shared;component/Resources/metasocket.png",
28 | UriKind.Absolute))),
29 | new Socket(2, "Red",
30 | new BitmapImage(new Uri("pack://application:,,,/TrinityCreator.Shared;component/Resources/redsocket.png",
31 | UriKind.Absolute))),
32 | new Socket(4, "Yellow",
33 | new BitmapImage(new Uri(
34 | "pack://application:,,,/TrinityCreator.Shared;component/Resources/yellowsocket.png", UriKind.Absolute))),
35 | new Socket(8, "Blue",
36 | new BitmapImage(new Uri("pack://application:,,,/TrinityCreator.Shared;component/Resources/bluesocket.png",
37 | UriKind.Absolute)))
38 | };
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Data/TrainerData.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace TrinityCreator.Shared.Data
5 | {
6 | public class TrainerData : IKeyValue
7 | {
8 | public TrainerData(int id, string description, int trainerType, int trainerSpell, int trainerClass, int trainerRace)
9 | {
10 | Id = id;
11 | Description = description;
12 | TrainerType = trainerType;
13 | TrainerSpell = trainerSpell;
14 | TrainerClass = trainerClass;
15 | TrainerRace = trainerRace;
16 | }
17 |
18 | public int TrainerType { get; set; }
19 | public int TrainerSpell { get; set; }
20 | public int TrainerClass { get; set; }
21 | public int TrainerRace { get; set; } // mount trainer
22 |
23 |
24 | public override string ToString()
25 | {
26 | return Description;
27 | }
28 |
29 | public static TrainerData[] GetTrainerData()
30 | {
31 | return new TrainerData[]
32 | {
33 | new TrainerData(0, "Not a trainer", 0, 0, 0, 0),
34 | new TrainerData(1, "Profession Trainer", 2, 0, 0, 0),
35 | new TrainerData(2, "Pet Trainer for hunters", 3, 0, 3, 0), // hunter only
36 | new TrainerData(4, "Warrior Trainer", 0, 0, 1, 0),
37 | new TrainerData(5, "Paladin Trainer", 0, 0, 2, 0),
38 | new TrainerData(6, "Hunter Trainer", 0, 0, 3, 0),
39 | new TrainerData(7, "Rogue Trainer", 0, 0, 4, 0),
40 | new TrainerData(8, "Priest Trainer", 0, 0, 5, 0),
41 | new TrainerData(9, "Death Knight Trainer", 0, 0, 6, 0),
42 | new TrainerData(10, "Shaman Trainer", 0, 0, 7, 0),
43 | new TrainerData(11, "Mage Trainer", 0, 0, 8, 0),
44 | new TrainerData(12, "Warlock Trainer", 0, 0, 9, 0),
45 | new TrainerData(13, "Monk (5.x) Trainer", 0, 0, 10, 0),
46 | new TrainerData(14, "Druid Trainer", 0, 0, 11, 0),
47 | new TrainerData(16, "Human Mount Trainer", 1, 0, 0, 1),
48 | new TrainerData(17, "Orc Mount Trainer", 1, 0, 0, 2),
49 | new TrainerData(18, "Dwarf Mount Trainer", 1, 0, 0, 3),
50 | new TrainerData(19, "Night Elf Mount Trainer", 1, 0, 0, 4),
51 | new TrainerData(20, "Undead Mount Trainer", 1, 0, 0, 5),
52 | new TrainerData(21, "Tauren Mount Trainer", 1, 0, 0, 6),
53 | new TrainerData(22, "Gnome Mount Trainer", 1, 0, 0, 7),
54 | new TrainerData(23, "Troll Mount Trainer", 1, 0, 0, 8),
55 | new TrainerData(24, "Blood Elf Mount Trainer", 1, 0, 0, 10),
56 | new TrainerData(25, "Draenei Mount Trainer", 1, 0, 0, 11),
57 | new TrainerData(26, "Goblin Mount Trainer", 1, 0, 0, 9),
58 | new TrainerData(27, "Worgen Mount Trainer", 1, 0, 0, 22),
59 | };
60 | }
61 | }
62 | }
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Database/DataType.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace TrinityCreator.Shared.Database
8 | {
9 | class DataType
10 | {
11 | ///
12 | /// Limits value to max supported by mysql column
13 | ///
14 | /// input value
15 | /// dataType eg: tinyint(3)
16 | ///
17 | public static int LimitLength(int value, string mySqlDt, int overrideMaxValue = 0)
18 | {
19 | // handle negative numbers
20 | bool wasNegative = false;
21 | if (value < 0)
22 | {
23 | wasNegative = true;
24 | value = Math.Abs(value);
25 | }
26 |
27 | // calculate maxValue
28 | int maxValue = 0;
29 | if (overrideMaxValue != 0)
30 | maxValue = overrideMaxValue;
31 | else
32 | {
33 | string[] parts = mySqlDt.Split('(');
34 | string type = parts[0];
35 | int maxLength = int.Parse(parts[1].Substring(0, parts[1].Length - 1));
36 |
37 | switch (type) // Assumes unsigned, limit to int.
38 | {
39 | case "tinyint":
40 | maxValue = 255;
41 | break;
42 | case "smallint":
43 | maxValue = 65535;
44 | break;
45 | case "mediumint":
46 | maxValue = 16777215;
47 | break;
48 | case "int":
49 | maxValue = 2147483647;
50 | break;
51 | case "bigint":
52 | maxValue = 2147483647;
53 | break;
54 | }
55 |
56 | // check length limit
57 | if (maxValue.ToString().Length > maxLength)
58 | {
59 | string newMaxValue = string.Empty;
60 | for (int i = 0; i < maxLength; i++)
61 | newMaxValue += '9';
62 | maxValue = int.Parse(newMaxValue);
63 | }
64 | }
65 |
66 | // Check if value is allowed
67 | if (maxValue != 0 && value > maxValue) // limit by max value when set
68 | value = maxValue;
69 |
70 | // back to negative
71 | if (wasNegative)
72 | value = 0 - value;
73 |
74 | return value;
75 | }
76 |
77 | ///
78 | /// Chop off part of the string when too long
79 | ///
80 | ///
81 | ///
82 | ///
83 | public static string LimitLength(string value, int length)
84 | {
85 | if (value.Length > length)
86 | value = value.Substring(0, length); // Chop off ending when too long
87 | return value;
88 | }
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Global.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using TrinityCreator.Shared.Tools.LookupTool;
7 | using TrinityCreator.Shared.Tools.ModelViewer;
8 | using TrinityCreator.Shared.UI;
9 |
10 | namespace TrinityCreator.Shared
11 | {
12 | public static class Global
13 | {
14 | ///
15 | /// Global propertries
16 | ///
17 | public static Dictionary Properties { get; }
18 | = new Dictionary();
19 |
20 | public static LookupToolControl LookupTool { get; set; }
21 |
22 | public static MainWindow _MainWindow { get; set; }
23 |
24 | public static ModelViewerPage ModelViewer { get; set; }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Helpers/GHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Concurrent;
3 | using System.Collections.Generic;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading;
7 | using System.Threading.Tasks;
8 |
9 | namespace TrinityCreator.Shared.Helpers
10 | {
11 | class GHelper
12 | {
13 | private static ConcurrentBag _threadBag = new ConcurrentBag();
14 | public static void SafeThreadStart(ThreadStart method)
15 | {
16 | // Create the thread & start it
17 | Thread thread = new Thread(method);
18 | thread.Start();
19 |
20 | // Add to the list (so garbagecollection doesn't eat them)
21 | _threadBag.Add(thread);
22 | }
23 |
24 | public static List EnumToList()
25 | {
26 | return Enum.GetValues(typeof(T)).Cast().ToList();
27 | }
28 |
29 | public static string RandomString(int length)
30 | {
31 | Random random = new Random();
32 | const string chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
33 | return new string(Enumerable.Repeat(chars, length)
34 | .Select(s => s[random.Next(s.Length)]).ToArray());
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Helpers/UiHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using TrinityCreator.Shared.Data;
9 | using TrinityCreator.Shared.Profiles;
10 | using TrinityCreator.Shared.UI.UIElements;
11 |
12 | namespace TrinityCreator.Shared.Helpers
13 | {
14 | public static class UiHelper
15 | {
16 | ///
17 | /// Display CustomDisplayFields to a groupbox
18 | ///
19 | public static void PrepareCustomDisplayFields(GroupBox cdfGb, ICreator creator)
20 | {
21 | // Clear groupbox, hide if CustomDisplayFields is not applicable
22 | cdfGb.Content = null;
23 | if (!creator.CustomDisplayFields.Any())
24 | {
25 | cdfGb.Visibility = Visibility.Collapsed;
26 | return;
27 | }
28 |
29 | // Display all relevant customdisplayfields
30 | cdfGb.Visibility = Visibility.Visible;
31 | StackPanel content = new StackPanel();
32 | foreach (var field in creator.CustomDisplayFields)
33 | content.Children.Add(new CustomDisplayFieldControl(field));
34 | cdfGb.Content = content;
35 | }
36 | }
37 | }
38 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Profiles/ExpKvp.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using TrinityCreator.Shared.Helpers;
7 |
8 | namespace TrinityCreator.Shared.Profiles
9 | {
10 | ///
11 | /// Exportable key and value information for SQL exports
12 | ///
13 | public class ExpKvp
14 | {
15 | ///
16 | /// Constructor for default fields. Runs gtk to define properties
17 | ///
18 | /// Column name
19 | /// Cell data to insert
20 | /// Creator type
21 | /// ???
22 | public ExpKvp(string appKey, dynamic value, Export.C c, string specialTableName = "")
23 | {
24 | Value = value;
25 | gtk(c, appKey, specialTableName);
26 | }
27 |
28 | ///
29 | /// Constructor for custom fields. Manually define key, value and table
30 | ///
31 | ///
32 | ///
33 | ///
34 | public ExpKvp(string sqlKey, dynamic value, string table)
35 | {
36 | SqlKey = sqlKey;
37 | Value = value;
38 | SqlTableName = table;
39 | IsValid = true;
40 | }
41 |
42 | ///
43 | /// True: Key can be exported, there is a corresponding sqlKey to the given appKey and it's been defined.
44 | ///
45 | public bool IsValid { get; private set; }
46 |
47 | public string SqlTableName { get; private set; }
48 |
49 | public string SqlKey { get; private set; }
50 |
51 | public dynamic Value { get; private set; }
52 |
53 | ///
54 | /// Stands for "Get Table name and Key"
55 | /// Returns the correct key for the current profile based on the app's equivalent of that key
56 | ///
57 | ///
58 | ///
59 | /// For table names that vary based on a setting, replaces %t with this string
60 | /// :0:Table - 1: Sql key
61 | public void gtk(Export.C creationType, string appKey, string specialTableName = "")
62 | {
63 | // Select correct dictionary to searchfor creation
64 | Dictionary> targetDict = null;
65 | switch (creationType)
66 | {
67 | case Export.C.Creature:
68 | targetDict = Profile.Active.Creature;
69 | break;
70 | case Export.C.Quest:
71 | targetDict = Profile.Active.Quest;
72 | break;
73 | case Export.C.Item:
74 | targetDict = Profile.Active.Item;
75 | break;
76 | case Export.C.Loot:
77 | targetDict = Profile.Active.Loot;
78 | break;
79 | case Export.C.Vendor:
80 | targetDict = Profile.Active.Vendor;
81 | break;
82 | }
83 |
84 | // Check if the key exists in the profile
85 | var table = targetDict.Where(t =>
86 | // equals in this case is equivalent to null check
87 | t.Value.Where(keysDic => keysDic.Key.ToLower() == appKey.ToLower()).FirstOrDefault().Key != null
88 | ).FirstOrDefault();
89 |
90 | // Key didn't exist in any table, ignore column
91 | IsValid = table.Key != null;
92 | if (!IsValid)
93 | {
94 | Logger.Log($"Notice: Export: {creationType.ToString()}.{appKey} not in profile. This isn't always an problem.");
95 | return;
96 | }
97 |
98 | // Key exists, generate result
99 | SqlTableName = table.Key; // Return table name
100 |
101 | // Handle unusual table names
102 | if (specialTableName != "")
103 | SqlTableName = SqlTableName.Replace("%t", specialTableName);
104 |
105 | // Find appkey again and put sqlkey in result
106 | SqlKey = table.Value.Where(keys => keys.Key.ToLower() == appKey.ToLower()).First().Value;
107 | }
108 | }
109 | }
110 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 | [assembly: AssemblyTitle("TrinityCreator.Shared")]
9 | [assembly: AssemblyDescription("")]
10 | [assembly: AssemblyConfiguration("")]
11 | [assembly: AssemblyCompany("")]
12 | [assembly: AssemblyProduct("TrinityCreator.Shared")]
13 | [assembly: AssemblyCopyright("Copyright © 2021")]
14 | [assembly: AssemblyTrademark("")]
15 | [assembly: AssemblyCulture("")]
16 |
17 | // Setting ComVisible to false makes the types in this assembly not visible
18 | // to COM components. If you need to access a type in this assembly from
19 | // COM, set the ComVisible attribute to true on that type.
20 | [assembly: ComVisible(false)]
21 |
22 | // The following GUID is for the ID of the typelib if this project is exposed to COM
23 | [assembly: Guid("15f1b410-5835-43b1-89b8-197cc6105535")]
24 |
25 | // Version information for an assembly consists of the following four values:
26 | //
27 | // Major Version
28 | // Minor Version
29 | // Build Number
30 | // Revision
31 | //
32 | // You can specify all the values or you can default the Build and Revision Numbers
33 | // by using the '*' as shown below:
34 | // [assembly: AssemblyVersion("1.0.*")]
35 | [assembly: AssemblyVersion("1.1.4.127")]
36 | [assembly: AssemblyFileVersion("1.1.4.127")]
37 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Properties/Settings.Designer.cs:
--------------------------------------------------------------------------------
1 | //------------------------------------------------------------------------------
2 | //
3 | // This code was generated by a tool.
4 | // Runtime Version:4.0.30319.42000
5 | //
6 | // Changes to this file may cause incorrect behavior and will be lost if
7 | // the code is regenerated.
8 | //
9 | //------------------------------------------------------------------------------
10 |
11 | namespace TrinityCreator.Shared.Properties {
12 |
13 |
14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.0.3.0")]
16 | public sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
17 |
18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
19 |
20 | public static Settings Default {
21 | get {
22 | return defaultInstance;
23 | }
24 | }
25 |
26 | [global::System.Configuration.UserScopedSettingAttribute()]
27 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
28 | [global::System.Configuration.DefaultSettingValueAttribute("False")]
29 | public bool viewUnfinishedCreators {
30 | get {
31 | return ((bool)(this["viewUnfinishedCreators"]));
32 | }
33 | set {
34 | this["viewUnfinishedCreators"] = value;
35 | }
36 | }
37 |
38 | [global::System.Configuration.UserScopedSettingAttribute()]
39 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
40 | [global::System.Configuration.DefaultSettingValueAttribute("True")]
41 | public bool UpgradeRequired {
42 | get {
43 | return ((bool)(this["UpgradeRequired"]));
44 | }
45 | set {
46 | this["UpgradeRequired"] = value;
47 | }
48 | }
49 |
50 | [global::System.Configuration.UserScopedSettingAttribute()]
51 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
52 | [global::System.Configuration.DefaultSettingValueAttribute("")]
53 | public string worldDb {
54 | get {
55 | return ((string)(this["worldDb"]));
56 | }
57 | set {
58 | this["worldDb"] = value;
59 | }
60 | }
61 |
62 | [global::System.Configuration.UserScopedSettingAttribute()]
63 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
64 | [global::System.Configuration.DefaultSettingValueAttribute("")]
65 | public string DbcDir {
66 | get {
67 | return ((string)(this["DbcDir"]));
68 | }
69 | set {
70 | this["DbcDir"] = value;
71 | }
72 | }
73 |
74 | [global::System.Configuration.UserScopedSettingAttribute()]
75 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
76 | [global::System.Configuration.DefaultSettingValueAttribute("400")]
77 | public double lookupToolWidth {
78 | get {
79 | return ((double)(this["lookupToolWidth"]));
80 | }
81 | set {
82 | this["lookupToolWidth"] = value;
83 | }
84 | }
85 |
86 | [global::System.Configuration.UserScopedSettingAttribute()]
87 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
88 | [global::System.Configuration.DefaultSettingValueAttribute("")]
89 | public string ActiveProfilePath {
90 | get {
91 | return ((string)(this["ActiveProfilePath"]));
92 | }
93 | set {
94 | this["ActiveProfilePath"] = value;
95 | }
96 | }
97 |
98 | [global::System.Configuration.UserScopedSettingAttribute()]
99 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
100 | [global::System.Configuration.DefaultSettingValueAttribute("False")]
101 | public bool disableWeaponCreationNotice {
102 | get {
103 | return ((bool)(this["disableWeaponCreationNotice"]));
104 | }
105 | set {
106 | this["disableWeaponCreationNotice"] = value;
107 | }
108 | }
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Properties/Settings.settings:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | False
7 |
8 |
9 | True
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 | 400
19 |
20 |
21 |
22 |
23 |
24 | False
25 |
26 |
27 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Resources/ARIALN.TTF:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NotCoffee418/TrinityCreator/d1bb3315388f68edb176338720ac081f9251f448/TrinityCreator.Shared/Resources/ARIALN.TTF
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Resources/Credits.txt:
--------------------------------------------------------------------------------
1 | Creator NotCoffee418
2 |
3 | External libraries by:
4 | DBC Viewer tomrus88
5 | DBC & maps extractor cMangos
6 | Model Viewer Wowhead
7 | Web browser CefSharp
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Resources/DailyActiveQuestIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NotCoffee418/TrinityCreator/d1bb3315388f68edb176338720ac081f9251f448/TrinityCreator.Shared/Resources/DailyActiveQuestIcon.png
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Resources/DailyQuestIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NotCoffee418/TrinityCreator/d1bb3315388f68edb176338720ac081f9251f448/TrinityCreator.Shared/Resources/DailyQuestIcon.png
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Resources/FRIZQT__.TTF:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NotCoffee418/TrinityCreator/d1bb3315388f68edb176338720ac081f9251f448/TrinityCreator.Shared/Resources/FRIZQT__.TTF
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Resources/IncompleteQuestIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NotCoffee418/TrinityCreator/d1bb3315388f68edb176338720ac081f9251f448/TrinityCreator.Shared/Resources/IncompleteQuestIcon.png
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Resources/MORPHEUS.TTF:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NotCoffee418/TrinityCreator/d1bb3315388f68edb176338720ac081f9251f448/TrinityCreator.Shared/Resources/MORPHEUS.TTF
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Resources/QuestGreeting.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NotCoffee418/TrinityCreator/d1bb3315388f68edb176338720ac081f9251f448/TrinityCreator.Shared/Resources/QuestGreeting.png
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Resources/RandomTips.txt:
--------------------------------------------------------------------------------
1 | Type $N to display a player's name or $C for a player's class in a quest.
2 | Leave the value at 0 if you don't want to use a feature.
3 | Use the lookup tool on the right to find ID's.
4 | Please report any bugs and suggestions on GitHub.
5 | Configure your database & dbc in settings to use the lookup tool and other features.
6 | You need to restart TrinityCore and sometimes delete your WoW Cache to view your creations.
7 | Doubleclick a row in the Lookup Tool to view it's in-game model if possible.
8 | You can click-drag the border of Lookup Tool to resize it.
9 | ---
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Resources/SKURRI.TTF:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NotCoffee418/TrinityCreator/d1bb3315388f68edb176338720ac081f9251f448/TrinityCreator.Shared/Resources/SKURRI.TTF
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Resources/add-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NotCoffee418/TrinityCreator/d1bb3315388f68edb176338720ac081f9251f448/TrinityCreator.Shared/Resources/add-icon.png
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Resources/bluesocket.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NotCoffee418/TrinityCreator/d1bb3315388f68edb176338720ac081f9251f448/TrinityCreator.Shared/Resources/bluesocket.png
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Resources/copper.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NotCoffee418/TrinityCreator/d1bb3315388f68edb176338720ac081f9251f448/TrinityCreator.Shared/Resources/copper.gif
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Resources/gold.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NotCoffee418/TrinityCreator/d1bb3315388f68edb176338720ac081f9251f448/TrinityCreator.Shared/Resources/gold.gif
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Resources/metasocket.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NotCoffee418/TrinityCreator/d1bb3315388f68edb176338720ac081f9251f448/TrinityCreator.Shared/Resources/metasocket.png
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Resources/redsocket.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NotCoffee418/TrinityCreator/d1bb3315388f68edb176338720ac081f9251f448/TrinityCreator.Shared/Resources/redsocket.png
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Resources/remove-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NotCoffee418/TrinityCreator/d1bb3315388f68edb176338720ac081f9251f448/TrinityCreator.Shared/Resources/remove-icon.png
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Resources/silver.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NotCoffee418/TrinityCreator/d1bb3315388f68edb176338720ac081f9251f448/TrinityCreator.Shared/Resources/silver.gif
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Resources/tclogo.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NotCoffee418/TrinityCreator/d1bb3315388f68edb176338720ac081f9251f448/TrinityCreator.Shared/Resources/tclogo.ico
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Resources/tclogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NotCoffee418/TrinityCreator/d1bb3315388f68edb176338720ac081f9251f448/TrinityCreator.Shared/Resources/tclogo.png
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Resources/weapon-notice.rtf:
--------------------------------------------------------------------------------
1 | {\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Calibri;}}
2 | {\*\generator Riched20 10.0.18362}\viewkind4\uc1
3 | \pard\sa200\sl276\slmult1\b\f0\fs28\lang9 MUST READ WHEN CREATING WEAPONS!\fs22\par
4 | \fs24 Problem:\b0\fs22\par
5 | When creating weapons for WoW 3.3.5a or higher with a new ID will result in the weapon not working. You will not be able to use class skills and other weird issues that makes the item not act as a weapon. You will pretty much only be able to use autoattack.\par
6 | This is because weapons are partially defined in the DBC files, the client database which is shipped with the game.\par
7 | \b\par
8 | \fs24 Solution 1 (Not recommended for most people):\fs22\par
9 | \b0 Modify the DBC files manually acoording to the weapons you add and ship a client patch with your server somehow.\par
10 | This is really only recommended if your server heavily relies on modded client-side content.\par
11 | If you're using this approach, click "Just Export" below.\par
12 | \par
13 | \b\fs24 Solution 2\b0\par
14 | \fs22 You can bypass this issue by overriding an existing weapon. A weapon that does already exist in the DBC files but is unused in the game.\par
15 | You can find plenty of these by simply typing "sword" or "mace" in the lookup tool under Item. Look for the ones that have obvious unused names like "QA Test Slow Two-Handed Mace" for example.\par
16 | \b When you find a weapon to replace:\b0\par
17 | - Make sure the weapon has the same subclass (eg. don't use a 1h mace ID for a 2h sword)\par
18 | - The displayID you use is irrelevant. It will use the displayID of the original item. So pick a look you like & modify it. The icon will also remain the same as the original.\par
19 | - Test this weapon in-game to see if it acts normally before using it's ID.\par
20 | - Click "Delete and export" below, restart the server, delete the Cache folder in your wow client folder and try it out.\par
21 | Keep in mind that "Delete and export" will attempt to remove the item with the given ID if it exists.\par
22 | }
23 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Resources/yellowsocket.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NotCoffee418/TrinityCreator/d1bb3315388f68edb176338720ac081f9251f448/TrinityCreator.Shared/Resources/yellowsocket.png
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/CreatureCreator/CreatureTemplateWindow.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/CreatureCreator/CreatureTemplateWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 | using TrinityCreator.Shared.Tools.CreatureCreator.Templates;
16 |
17 | namespace TrinityCreator.Shared.Tools.CreatureCreator
18 | {
19 | ///
20 | /// Interaction logic for CreatureTemplatePage.xaml
21 | ///
22 | public partial class CreatureTemplateWindow : Window
23 | {
24 | public CreatureTemplateWindow()
25 | {
26 | InitializeComponent();
27 | if (openWindow != null)
28 | openWindow.Close();
29 | openWindow = this;
30 | Closing += CreatureTemplateWindow_Closing;
31 |
32 | templateListBox.ItemsSource = TemplateHandler.ListTemplateDescriptions();
33 | templateListBox.MouseDoubleClick += TemplateListBox_MouseDoubleClick;
34 | templateListBox.SelectedIndex = 0;
35 | }
36 |
37 | public static CreatureTemplateWindow openWindow = null;
38 |
39 | private void CreatureTemplateWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
40 | {
41 | openWindow = null;
42 | }
43 |
44 | private void TemplateListBox_MouseDoubleClick(object sender, MouseButtonEventArgs e)
45 | {
46 | LoadSelectedTemplate();
47 | }
48 |
49 | private void loadTemplateBtn_Click(object sender, RoutedEventArgs e)
50 | {
51 | LoadSelectedTemplate();
52 | }
53 |
54 | private void LoadSelectedTemplate()
55 | {
56 | string description = (string)templateListBox.SelectedValue;
57 | TemplateHandler.LoadTemplateByDescription(description);
58 | Close();
59 | }
60 |
61 | private void cancelBtn_Click(object sender, RoutedEventArgs e)
62 | {
63 | Close();
64 | }
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/CreatureCreator/Templates/BeastEnemyTemplate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using TrinityCreator.Shared;
7 |
8 | namespace TrinityCreator.Shared.Tools.CreatureCreator.Templates
9 | {
10 | class BeastEnemyTemplate : TemplateBase
11 | {
12 | public BeastEnemyTemplate() : base() { }
13 |
14 | public override void LoadTemplate()
15 | {
16 | Name = "Beast Enemy";
17 | MinLevel = 80;
18 | MaxLevel = 80;
19 | Faction = 168;
20 | SetIKVPValue(Page.movementCb, 1); // Random movement
21 | SetIKVPValue(Page.creatureTypeCb, 1); // beast type
22 | SetBmspValues(DynamicFlags, new int[] { 1 }); // lootable
23 | SetBmspValues(TypeFlags, new int[] { 1 }); // tamable
24 | SetBmspValues(UnitFlags, new int[] { 67108864 }); // skinnable
25 | }
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/CreatureCreator/Templates/BlankTemplate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using TrinityCreator.Shared;
7 |
8 | namespace TrinityCreator.Shared.Tools.CreatureCreator.Templates
9 | {
10 | class BlankTemplate : TemplateBase
11 | {
12 | public BlankTemplate() : base() { }
13 |
14 | public override void LoadTemplate()
15 | {
16 | // Blank
17 | }
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/CreatureCreator/Templates/BossTemplate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using TrinityCreator.Shared;
7 |
8 | namespace TrinityCreator.Shared.Tools.CreatureCreator.Templates
9 | {
10 | class BossTemplate : TemplateBase
11 | {
12 | public BossTemplate() : base() { }
13 |
14 | public override void LoadTemplate()
15 | {
16 | Name = "Raid Boss";
17 | MinLevel = 83;
18 | MaxLevel = 83;
19 | Faction = 168;
20 | SetIKVPValue(Page.movementCb, 1); // Random movement
21 | Scale = 2.5f; // They tend to get pretty big
22 | SetIKVPValue(Page.rankCb, 3); // boss rank
23 | SetBmspValues(DynamicFlags, new int[] { 1 }); // lootable
24 | SetBmspValues(TypeFlags, new int[] { 4, 8 }); // Level ??, no parry animation
25 | SetBmspValues(MechanicImmuneMask, new int[] {
26 | 1, 2, 4, 8, 16, 32, 64, 128, 256,
27 | 512, 1024, 2048, 4096, 8192, 65536, 131072, 524288,
28 | 4194304, 8388608, 33554432, 67108864, 536870912}); // Relevant immunities
29 | SetBmspValues(FlagsExtra, new int[] { 1, 1073741824 }); // Bind to instance group & immune to knockback again?
30 | HealthModifier = 400;
31 | DamageModifier = 35;
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/CreatureCreator/Templates/ClassTrainerTemplate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using TrinityCreator.Shared;
7 |
8 | namespace TrinityCreator.Shared.Tools.CreatureCreator.Templates
9 | {
10 | class ClassTrainerTemplate : TrainerTemplate
11 | {
12 | public ClassTrainerTemplate() : base() { }
13 |
14 | public override void LoadTemplate()
15 | {
16 | base.LoadTemplate();
17 | Name = "Class Trainer";
18 | SetBmspValues(NpcFlags, new int[] { 32 }); // Class Trainer
19 | SetIKVPValue(Page.trainerCb, 4); // Any class
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/CreatureCreator/Templates/DeadQuestgiverTemplate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using TrinityCreator.Shared;
7 |
8 | namespace TrinityCreator.Shared.Tools.CreatureCreator.Templates
9 | {
10 | class DeadQuestgiverTemplate : QuestgiverTemplate
11 | {
12 | public DeadQuestgiverTemplate() : base() { }
13 |
14 | public override void LoadTemplate()
15 | {
16 | base.LoadTemplate();
17 | Name = "Dead Questgiver";
18 | SetBmspValues(TypeFlags, new int[] { 128 }); // Dead interact
19 | SetBmspValues(DynamicFlags, new int[] { 4, 32 }); // Appear dead
20 | Emote = 65; // state_dead
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/CreatureCreator/Templates/EscorteeTemplate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using TrinityCreator.Shared;
7 |
8 | namespace TrinityCreator.Shared.Tools.CreatureCreator.Templates
9 | {
10 | class EscorteeTemplate : TemplateBase
11 | {
12 | public EscorteeTemplate() : base() { }
13 |
14 | public override void LoadTemplate()
15 | {
16 | Name = "Escort NPC";
17 | MinLevel = 80;
18 | MaxLevel = 80;
19 | Faction = 250; // Escort faction
20 | SetBmspValues(NpcFlags, new int[] { 1, 2 }); // Gossip, Questgiver
21 | SetBmspValues(FlagsExtra, new int[] { 2 }); // Civilian
22 | SetBmspValues(TypeFlags, new int[] { 4096 }); // Aid players
23 | SetIKVPValue(Page.creatureTypeCb, 7); // Humanoid
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/CreatureCreator/Templates/ExampleTemplate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using TrinityCreator.Shared;
7 |
8 | namespace TrinityCreator.Shared.Tools.CreatureCreator.Templates
9 | {
10 | class ExampleTemplate : TemplateBase
11 | {
12 | public ExampleTemplate() : base() { }
13 |
14 | public override void LoadTemplate()
15 | {
16 | MinLevel = 80;
17 | SetBmspValues(NpcFlags, new int[] { 1, 2, 4 });
18 | SetComboboxValue(Page.rankCb, 2); // Elite
19 | SetIKVPValue(Page.movementCb, 1);
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/CreatureCreator/Templates/HumanoidEnemyTemplate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using TrinityCreator.Shared;
7 |
8 | namespace TrinityCreator.Shared.Tools.CreatureCreator.Templates
9 | {
10 | class HumanoidEnemyTemplate : TemplateBase
11 | {
12 | public HumanoidEnemyTemplate() : base() { }
13 |
14 | public override void LoadTemplate()
15 | {
16 | Name = "Humanoid Enemy";
17 | MinLevel = 80;
18 | MaxLevel = 80;
19 | Faction = 168;
20 | SetIKVPValue(Page.movementCb, 1); // Random movement
21 | SetIKVPValue(Page.creatureTypeCb, 7); // humanoid type
22 | SetBmspValues(DynamicFlags, new int[] { 1 }); // lootable
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/CreatureCreator/Templates/MountTrainerTemplate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using TrinityCreator.Shared;
7 |
8 | namespace TrinityCreator.Shared.Tools.CreatureCreator.Templates
9 | {
10 | class MountTrainerTemplate : TrainerTemplate
11 | {
12 | public MountTrainerTemplate() : base() { }
13 |
14 | public override void LoadTemplate()
15 | {
16 | base.LoadTemplate();
17 | Name = "Mount Trainer";
18 | SetIKVPValue(Page.trainerCb, 16); // Any race
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/CreatureCreator/Templates/ProfessionTrainerTemplate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using TrinityCreator.Shared;
7 |
8 | namespace TrinityCreator.Shared.Tools.CreatureCreator.Templates
9 | {
10 | class ProfessionTrainerTemplate : TrainerTemplate
11 | {
12 | public ProfessionTrainerTemplate() : base() { }
13 |
14 | public override void LoadTemplate()
15 | {
16 | base.LoadTemplate();
17 | Name = "Profession Trainer";
18 | SetBmspValues(NpcFlags, new int[] { 64 }); // Class Trainer
19 | SetIKVPValue(Page.trainerCb, 1); // Any profession
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/CreatureCreator/Templates/QuestgiverTemplate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using TrinityCreator.Shared;
7 |
8 | namespace TrinityCreator.Shared.Tools.CreatureCreator.Templates
9 | {
10 | class QuestgiverTemplate : TemplateBase
11 | {
12 | public QuestgiverTemplate() : base() { }
13 |
14 | public override void LoadTemplate()
15 | {
16 | Name = "Questgiver";
17 | MinLevel = 80;
18 | MaxLevel = 80;
19 | Faction = 35;
20 | SetBmspValues(NpcFlags, new int[] { 1, 2 }); // Gossip, Questgiver
21 | SetBmspValues(FlagsExtra, new int[] { 2 }); // Civilian
22 | SetIKVPValue(Page.creatureTypeCb, 7); // Humanoid
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/CreatureCreator/Templates/RepairVendorTemplate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using TrinityCreator.Shared;
7 |
8 | namespace TrinityCreator.Shared.Tools.CreatureCreator.Templates
9 | {
10 | class RepairVendorTemplate : VendorTemplate
11 | {
12 | public RepairVendorTemplate() : base() { }
13 |
14 | public override void LoadTemplate()
15 | {
16 | base.LoadTemplate(); // Vendor
17 | Name = "Repair Vendor";
18 | SetBmspValues(NpcFlags, new int[] { 4096 }); // Gossip, Vendor
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/CreatureCreator/Templates/TemplateBase.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows.Controls;
7 | using TrinityCreator.Shared;
8 | using TrinityCreator.Shared.Data;
9 | using TrinityCreator.Shared.UI.UIElements;
10 |
11 | namespace TrinityCreator.Shared.Tools.CreatureCreator.Templates
12 | {
13 | class TemplateBase : TrinityCreature
14 | {
15 | public TemplateBase() : base() { }
16 |
17 | public CreatureCreatorPage Page
18 | {
19 | get
20 | {
21 | return (CreatureCreatorPage)Global._MainWindow.CreatureCreatorTab.Content;
22 | }
23 | }
24 |
25 | public virtual void LoadTemplate()
26 | {
27 | throw new Exception("TemplateLoad() was not called.");
28 | }
29 |
30 | ///
31 | /// Set flags for the given BMSP
32 | ///
33 | ///
34 | ///
35 | public void SetBmspValues(BitmaskStackPanel bmsp, int[] flags)
36 | {
37 | foreach (int flag in flags)
38 | bmsp.SetValueIsChecked(flag, true);
39 | }
40 |
41 | ///
42 | /// Set Select combobox's index based on ID
43 | ///
44 | /// Value of selected item
45 | ///
46 | public void SetComboboxValue(ComboBox cb, int id)
47 | {
48 | for (int i = 0; i < cb.Items.Count; i++)
49 | {
50 | if (((IKeyValue)cb.Items[i]).Id == id)
51 | {
52 | cb.SelectedIndex = i;
53 | break;
54 | }
55 | }
56 | }
57 |
58 | public void SetIKVPValue(ComboBox cb, int idValue)
59 | {
60 | for (int i = 0; i < cb.Items.Count; i++)
61 | if (((IKeyValue)cb.Items[i]).Id == idValue)
62 | {
63 | cb.SelectedIndex = i;
64 | break;
65 | }
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/CreatureCreator/Templates/TemplateHandler.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Reflection;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 |
9 | namespace TrinityCreator.Shared.Tools.CreatureCreator.Templates
10 | {
11 | class TemplateHandler
12 | {
13 | private static Dictionary _d;
14 |
15 | // Register templates here
16 | public static Dictionary AllTemplates
17 | {
18 | get
19 | {
20 | if (_d == null)
21 | {
22 | _d = new Dictionary();
23 | _d.Add("BlankTemplate", "Default");
24 | _d.Add("HumanoidEnemyTemplate", "Humanoid Enemy");
25 | _d.Add("BeastEnemyTemplate", "Beast Enemy");
26 | _d.Add("BossTemplate", "Raid Boss");
27 | _d.Add("QuestgiverTemplate", "Questgiver");
28 | _d.Add("DeadQuestgiverTemplate", "Dead Questgiver");
29 | _d.Add("EscorteeTemplate", "Quest Escort NPC");
30 | _d.Add("VendorTemplate", "Vendor");
31 | _d.Add("RepairVendorTemplate", "Repair Vendor");
32 | //_d.Add("ClassTrainerTemplate", "Class Trainer");
33 | //_d.Add("ProfessionTrainerTemplate", "Profession Trainer");
34 | //_d.Add("MountTrainerTemplate", "Mount Trainer");
35 | }
36 | return _d;
37 | }
38 | }
39 |
40 | public static IEnumerable ListTemplateDescriptions()
41 | {
42 | return from tData in AllTemplates select tData.Value;
43 | }
44 |
45 | public static void LoadTemplateByDescription(string description)
46 | {
47 | var kvp = from tData in AllTemplates where tData.Value == description select tData.Key;
48 | LoadTemplate(kvp.FirstOrDefault());
49 | }
50 |
51 | public static void LoadTemplate(string className)
52 | {
53 | CreatureCreatorPage page = (CreatureCreatorPage)Global._MainWindow.CreatureCreatorTab.Content;
54 | if (page.IsCreatureModified)
55 | {
56 | var r = MessageBox.Show("Do you want to discard your unsaved creature changes to load " + className + "?",
57 | "Overwrite creature", MessageBoxButton.YesNoCancel, MessageBoxImage.Warning, MessageBoxResult.No);
58 | if (r != MessageBoxResult.Yes)
59 | return; // Don't load template
60 | }
61 |
62 | Type type = Assembly.GetExecutingAssembly().GetTypes().First(t => t.Name == className);
63 | TrinityCreature creature = (TemplateBase)Activator.CreateInstance(type);
64 | page.Creature = creature;
65 | page.DataContext = null;
66 | page.DataContext = page.Creature;
67 | ((TemplateBase)page.Creature).LoadTemplate();
68 | page.PrepareCreaturePage();
69 | }
70 |
71 |
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/CreatureCreator/Templates/TrainerTemplate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using TrinityCreator.Shared;
7 |
8 | namespace TrinityCreator.Shared.Tools.CreatureCreator.Templates
9 | {
10 | class TrainerTemplate : TemplateBase
11 | {
12 | public TrainerTemplate() : base() { }
13 |
14 | public override void LoadTemplate()
15 | {
16 | MinLevel = 80;
17 | MaxLevel = 80;
18 | Faction = 35;
19 | SetBmspValues(NpcFlags, new int[] { 1, 2, 16 }); // Gossip, questgiver, Trainer
20 | SetBmspValues(FlagsExtra, new int[] { 2 }); // Civilian
21 | SetBmspValues(TypeFlags, new int[] { 134217728 }); // Force gossip
22 | SetIKVPValue(Page.creatureTypeCb, 7); // Humanoid
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/CreatureCreator/Templates/VendorTemplate.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using TrinityCreator.Shared;
7 |
8 | namespace TrinityCreator.Shared.Tools.CreatureCreator.Templates
9 | {
10 | class VendorTemplate : TemplateBase
11 | {
12 | public VendorTemplate() : base() { }
13 |
14 | public override void LoadTemplate()
15 | {
16 | Name = "Vendor";
17 | MinLevel = 75; // He's seen some bad days but isn't exactly a legendary adventurer
18 | MaxLevel = 75;
19 | Faction = 35;
20 | SetBmspValues(NpcFlags, new int[] { 1, 128 }); // Gossip, Vendor
21 | SetBmspValues(TypeFlags, new int[] { 134217728 }); // Force gossip
22 | SetBmspValues(FlagsExtra, new int[] { 2 }); // Civilian
23 | SetIKVPValue(Page.creatureTypeCb, 7); // Humanoid
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/ItemCreator/ItemPreview.xaml.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Win32;
2 | using System;
3 | using System.ComponentModel;
4 | using System.Drawing;
5 | using System.IO;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Media;
9 | using System.Windows.Media.Imaging;
10 |
11 | namespace TrinityCreator.Shared.Tools.ItemCreator
12 | {
13 | ///
14 | /// Interaction logic for ItemPreview.xaml
15 | ///
16 | public partial class ItemPreview : UserControl, INotifyPropertyChanged
17 | {
18 | private readonly TrinityItem _item;
19 |
20 | public ItemPreview(TrinityItem item)
21 | {
22 | InitializeComponent();
23 | this._item = item;
24 | DataContext = _item;
25 | }
26 |
27 | public event PropertyChangedEventHandler PropertyChanged;
28 |
29 |
30 | private void screenshotClipboardBtn_Click(object sender, RoutedEventArgs e)
31 | {
32 | BitmapSource bmp = ConvertToBitmapSource(TakeScreenshot());
33 | Clipboard.SetImage(bmp);
34 | MessageBox.Show("Your screenshot has been saved to your clipboard.", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
35 | }
36 |
37 | private void screenshotDiskBtn_Click(object sender, RoutedEventArgs e)
38 | {
39 | Bitmap bmp = TakeScreenshot(); // screenshot first so UI doesn't overlap
40 | SaveFileDialog sfd = new SaveFileDialog();
41 | sfd.Title = "Save screenshot";
42 | sfd.FileName = _item.Name;
43 | sfd.Filter = "Bitmap File|*.bmp";
44 | if (sfd.ShowDialog() == true)
45 | {
46 | using (FileStream fs = File.Open(sfd.FileName, FileMode.OpenOrCreate))
47 | bmp.Save(fs, System.Drawing.Imaging.ImageFormat.Bmp);
48 | MessageBox.Show("Your screenshot has been saved to a file", "Success", MessageBoxButton.OK, MessageBoxImage.Information);
49 | }
50 | }
51 |
52 | private Bitmap TakeScreenshot()
53 | {
54 | // Get position
55 | System.Windows.Point pos = itemTooltipGrid.PointToScreen(new System.Windows.Point(0, 0));
56 | int width = Convert.ToInt32(itemTooltipGrid.ActualWidth);
57 | int height = Convert.ToInt32(itemTooltipGrid.ActualHeight);
58 |
59 | // Bitmap in right size
60 | Bitmap Screenshot = new Bitmap(width, height);
61 | Graphics G = Graphics.FromImage(Screenshot);
62 | // snip wanted area
63 | G.CopyFromScreen(Convert.ToInt32(pos.X), Convert.ToInt32(pos.Y), 0, 0, new System.Drawing.Size(width, height), CopyPixelOperation.SourceCopy);
64 | return Screenshot;
65 | }
66 |
67 | public BitmapSource ConvertToBitmapSource(Bitmap bitmap)
68 | {
69 | var bitmapData = bitmap.LockBits(
70 | new System.Drawing.Rectangle(0, 0, bitmap.Width, bitmap.Height),
71 | System.Drawing.Imaging.ImageLockMode.ReadOnly, bitmap.PixelFormat);
72 |
73 | var bitmapSource = BitmapSource.Create(
74 | bitmapData.Width, bitmapData.Height, 96, 96, PixelFormats.Bgr32, null,
75 | bitmapData.Scan0, bitmapData.Stride * bitmapData.Height, bitmapData.Stride);
76 |
77 | bitmap.UnlockBits(bitmapData);
78 | return bitmapSource;
79 | }
80 | }
81 | }
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/ItemCreator/WeaponExportWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/ItemCreator/WeaponExportWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.IO;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Shapes;
15 | using TrinityCreator.Shared.Helpers;
16 | using TrinityCreator.Shared.Profiles;
17 |
18 | namespace TrinityCreator.Shared.Tools.ItemCreator
19 | {
20 | ///
21 | /// Interaction logic for WeaponExportWindow.xaml
22 | ///
23 | public partial class WeaponExportWindow : Window
24 | {
25 | ///
26 | /// This window provides information about exporting weapons since it's broken on new ids since lich king.
27 | /// It'll grab the query generated in ItemPage and optionally add a delete query for the same id, then export as it would before
28 | /// if the user chooses to do so.
29 | ///
30 | /// insert query
31 | /// item id
32 | /// where to
33 | public WeaponExportWindow(string query, int itemId, SaveType _saveType)
34 | {
35 | InitializeComponent();
36 | Query = query;
37 | ItemId = itemId;
38 | _SaveType = _saveType;
39 | }
40 |
41 | // For testing UI, it will break if you try to export with this constructor
42 | public WeaponExportWindow()
43 | {
44 | InitializeComponent();
45 | }
46 |
47 | public enum SaveType
48 | {
49 | File = 0,
50 | Database = 1
51 | }
52 |
53 | public string Query { get; set; }
54 | public int ItemId { get; set; }
55 | public SaveType _SaveType { get; set; }
56 |
57 | private void Window_Loaded(object sender, RoutedEventArgs e)
58 | {
59 | // Load the RTF document from resources
60 | var documentBytes = Encoding.UTF8.GetBytes(Properties.Resources.weapon_notice);
61 | using (var reader = new MemoryStream(documentBytes))
62 | {
63 | reader.Position = 0;
64 | weaponNoticeRtb.SelectAll();
65 | weaponNoticeRtb.Selection.Load(reader, DataFormats.Rtf);
66 | }
67 |
68 | // Readonly after load
69 | weaponNoticeRtb.IsReadOnly = true;
70 | }
71 |
72 | private void justExportBtn_Click(object sender, RoutedEventArgs e)
73 | {
74 | DoExport();
75 | }
76 |
77 | private void deleteExportBtn_Click(object sender, RoutedEventArgs e)
78 | {
79 | // Generate delete query
80 | var ek = new ExpKvp("EntryId", ItemId, Export.C.Item);
81 | string deleteQuery = $"DELETE FROM {ek.SqlTableName} WHERE {ek.SqlKey} = {ItemId};";
82 |
83 | // Add it to query and DoExport
84 | Query = deleteQuery + Environment.NewLine + Query;
85 | DoExport();
86 | }
87 |
88 | ///
89 | /// Export to chosen output and close window
90 | ///
91 | private void DoExport()
92 | {
93 | try
94 | {
95 | if (_SaveType == SaveType.Database)
96 | SaveQuery.ToDatabase(Query);
97 | else SaveQuery.ToFile($"Item {ItemId}", Query);
98 |
99 | // Change never show setting if checked
100 | Properties.Settings.Default.disableWeaponCreationNotice = neverShowAgainCb.IsChecked == true;
101 | Properties.Settings.Default.Save();
102 | }
103 | catch
104 | {
105 | Logger.Log("WeaponExportWindow: Failed to generate query.", Logger.Status.Error, true);
106 | }
107 | Close();
108 | }
109 | }
110 | }
111 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/LookupTool/LookupToolControl.xaml:
--------------------------------------------------------------------------------
1 |
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 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/LookupTool/TargetEnum.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 |
7 | namespace TrinityCreator.Shared.Tools.LookupTool
8 | {
9 | public enum Target
10 | {
11 | QuestSort = 0,
12 | Map = 1,
13 | Faction = 2,
14 | Title = 3,
15 | Item = 4,
16 | Quest = 5,
17 | Creature = 6,
18 | GameObject = 7,
19 | Spell = 8,
20 | Emotes = 9,
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/LootCreator/LootPage.xaml:
--------------------------------------------------------------------------------
1 |
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 |
39 |
40 |
42 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/LootCreator/LootPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 | using TrinityCreator.Shared.Database;
16 | using TrinityCreator.Shared.Profiles;
17 |
18 | namespace TrinityCreator.Shared.Tools.LootCreator
19 | {
20 | ///
21 | /// Interaction logic for LootPage.xaml
22 | ///
23 | public partial class LootPage : Page
24 | {
25 | public LootPage()
26 | {
27 | InitializeComponent();
28 | AddLootRow();
29 | }
30 |
31 | public void AddLootRow()
32 | {
33 | var lrc = new LootRowControl();
34 | lootRowSp.Children.Add(lrc);
35 | lrc.RemoveRequestEvent += Lrc_RemoveRequestEvent;
36 | }
37 |
38 | private void Lrc_RemoveRequestEvent(object sender, EventArgs e)
39 | {
40 | if (lootRowSp.Children.Count > 1)
41 | lootRowSp.Children.Remove((LootRowControl)sender);
42 | }
43 |
44 | public void RemoveLootRow()
45 | {
46 | if (lootRowSp.Children.Count > 1)
47 | lootRowSp.Children.RemoveAt(lootRowSp.Children.Count - 1);
48 | }
49 |
50 | private void addLineBtn_Click(object sender, RoutedEventArgs e)
51 | {
52 | AddLootRow();
53 | }
54 |
55 | private void removeLineBtn_Click(object sender, RoutedEventArgs e)
56 | {
57 | RemoveLootRow();
58 | }
59 |
60 | private void exportSqlBtn_Click(object sender, RoutedEventArgs e)
61 | {
62 | string query = Export.Loot(this);
63 | SaveQuery.ToFile(((ComboBoxItem)lootTypeCb.SelectedValue).Content.ToString() + " Loot Template " + entryTb.Text + ".sql", query);
64 | }
65 |
66 | private void exportDbBtn_Click(object sender, RoutedEventArgs e)
67 | {
68 | try
69 | {
70 | // Ensure connection is set up
71 | if (!Connection.Open(true))
72 | return;
73 |
74 | // Export
75 | string query = Export.Loot(this);
76 | SaveQuery.ToDatabase(query);
77 | }
78 | catch (Exception ex) {
79 | MessageBox.Show(ex.Message, "Failed to generate query", MessageBoxButton.OK, MessageBoxImage.Error);
80 | }
81 | }
82 | }
83 | }
84 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/LootCreator/LootRowControl.xaml:
--------------------------------------------------------------------------------
1 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/LootCreator/LootRowControl.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Navigation;
15 | using System.Windows.Shapes;
16 | using TrinityCreator.Shared.Database;
17 |
18 | namespace TrinityCreator.Shared.Tools.LootCreator
19 | {
20 | ///
21 | /// Interaction logic for LootRowControl.xaml
22 | ///
23 | public partial class LootRowControl : UserControl, INotifyPropertyChanged
24 | {
25 | public LootRowControl()
26 | {
27 | InitializeComponent();
28 | DataContext = this;
29 | }
30 |
31 |
32 | public event EventHandler RemoveRequestEvent;
33 | public event PropertyChangedEventHandler PropertyChanged;
34 | private int _item;
35 | private float _chance = 100;
36 | private bool _questRequired;
37 | private int _minCount = 1;
38 | private int _maxCount = 1;
39 |
40 | public int Item
41 | {
42 | get { return _item; }
43 | set
44 | {
45 | _item = DataType.LimitLength(value, "mediumint(8)");
46 | RaisePropertyChanged("Item");
47 | }
48 | }
49 | // Reference - reference to another ID + item
50 | public float Chance
51 | {
52 | get { return _chance; }
53 | set
54 | {
55 | _chance = value;
56 | RaisePropertyChanged("Chance");
57 | }
58 | }
59 | public bool QuestRequired
60 | {
61 | get { return _questRequired; }
62 | set
63 | {
64 | _questRequired = value;
65 | RaisePropertyChanged("QuestRequired");
66 | }
67 | }
68 | public int MinCount
69 | {
70 | get { return _minCount; }
71 | set
72 | {
73 | if (value == 0)
74 | value = 1;
75 | _minCount = DataType.LimitLength(value, "tinyint(3)");
76 | RaisePropertyChanged("MinCount");
77 | }
78 | }
79 | public int MaxCount
80 | {
81 | get { return _maxCount; }
82 | set
83 | {
84 | if (value == 0)
85 | value = 1;
86 | _maxCount = DataType.LimitLength(value, "tinyint(3)");
87 | RaisePropertyChanged("MaxCount");
88 | }
89 | }
90 |
91 | public void RaisePropertyChanged(string property)
92 | {
93 | if (PropertyChanged != null)
94 | PropertyChanged(this, new PropertyChangedEventArgs(property));
95 | }
96 |
97 | private void removeMeBtn_Click(object sender, RoutedEventArgs e)
98 | {
99 | RemoveRequestEvent(this, e);
100 | }
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/ModelViewer/ModelViewerPage.xaml:
--------------------------------------------------------------------------------
1 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/ModelViewer/ModelViewerPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 | using TrinityCreator.Shared.Database;
16 |
17 | namespace TrinityCreator.Shared.Tools.ModelViewer
18 | {
19 | ///
20 | /// Interaction logic for ModelViewerPage.xaml
21 | ///
22 | public partial class ModelViewerPage : Page
23 | {
24 | public ModelViewerPage()
25 | {
26 | InitializeComponent();
27 | Global.ModelViewer = this;
28 | }
29 |
30 | private void loadBtn_Click(object sender, RoutedEventArgs e)
31 | {
32 | LoadModel();
33 | }
34 |
35 | public void LoadModel(int displayId = 0, string type = "", string idType = "")
36 | {
37 | // Sync with UI
38 | if (displayId == 0)
39 | {
40 | try
41 | {
42 | displayId = int.Parse(displayIdTxt.Text);
43 | }
44 | catch
45 | {
46 | MessageBox.Show("Invalid Display Id", "Failed", MessageBoxButton.OK, MessageBoxImage.Error);
47 | return;
48 | }
49 | }
50 | else displayIdTxt.Text = displayId.ToString();
51 |
52 | if (type == "")
53 | type = ((ComboBoxItem)displayTypeCb.SelectedValue).Content.ToString();
54 | else
55 | {
56 | switch (type)
57 | {
58 | case "Item":
59 | displayTypeCb.SelectedIndex = 0;
60 | break;
61 | case "Creature":
62 | displayTypeCb.SelectedIndex = 1;
63 | break;
64 | }
65 | }
66 |
67 | if (idType == "")
68 | idType = ((ComboBoxItem)inputIdCb.SelectedValue).Content.ToString();
69 | else
70 | {
71 | switch (idType)
72 | {
73 | case "Display ID":
74 | inputIdCb.SelectedIndex = 0;
75 | break;
76 | case "Entry ID":
77 | inputIdCb.SelectedIndex = 1;
78 | break;
79 | }
80 | }
81 |
82 |
83 | // load model
84 | switch (type)
85 | {
86 | case "Item":
87 | if (idType == "Entry ID")
88 | displayId = LookupQuery.GetItemDisplayFromEntry(displayId);
89 | mvBrowser.LoadUrl("http://www.wowhead.com/#modelviewer:4:13;" + displayId, blankFirst:true);
90 | break;
91 | case "Creature": // input should be entry instead of display
92 | if (Connection.IsConfigured())
93 | {
94 | if (idType == "Display ID")
95 | displayId = LookupQuery.GetCreatureIdFromDisplayId(displayId);
96 | mvBrowser.LoadUrl("http://www.wowhead.com/npc=" + displayId + "/#modelviewer:10+0");
97 | }
98 | break;
99 | }
100 | }
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/ProfileCreator/ProfileCreatorDefinition.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/ProfileCreator/ProfileCreatorDefinition.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Navigation;
15 | using System.Windows.Shapes;
16 |
17 | namespace TrinityCreator.Shared.Tools.ProfileCreator
18 | {
19 | ///
20 | /// Interaction logic for ProfileCreatorSetting.xaml
21 | ///
22 | public partial class ProfileCreatorDefinition : UserControl, INotifyPropertyChanged
23 | {
24 | public ProfileCreatorDefinition(string settingKey, string tooltip = "")
25 | {
26 | InitializeComponent();
27 | DataContext = this;
28 | DefinitionKey = settingKey;
29 | Tooltip = tooltip;
30 | }
31 |
32 | private string _definitionKey;
33 | private string _definitionValue;
34 | private bool _isIncluded = true;
35 |
36 | public string DefinitionKey
37 | {
38 | get { return _definitionKey; }
39 | set
40 | {
41 | _definitionKey = value;
42 | RaisePropertyChanged("DefinitionKey");
43 | }
44 | }
45 | public string DefinitionValue
46 | {
47 | get { return _definitionValue; }
48 | set
49 | {
50 | _definitionValue = value;
51 | RaisePropertyChanged("DefinitionValue");
52 | }
53 | }
54 | public bool IsIncluded
55 | {
56 | get { return _isIncluded; }
57 | set
58 | {
59 | _isIncluded = value;
60 | RaisePropertyChanged("IsIncluded");
61 | }
62 | }
63 | public string Tooltip { get; set; }
64 |
65 | public event PropertyChangedEventHandler PropertyChanged;
66 | private void RaisePropertyChanged(string property)
67 | {
68 | if (PropertyChanged != null)
69 | PropertyChanged(this, new PropertyChangedEventArgs(property));
70 | }
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/ProfileCreator/ProfileCreatorEntry.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/ProfileCreator/ProfileCreatorEntry.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Navigation;
15 | using System.Windows.Shapes;
16 |
17 | namespace TrinityCreator.Shared.Tools.ProfileCreator
18 | {
19 | ///
20 | /// Interaction logic for ProfileCreatorEntry.xaml
21 | ///
22 | public partial class ProfileCreatorEntry : UserControl, INotifyPropertyChanged
23 | {
24 | ///
25 | /// Constructor for default fields using defined appkey
26 | ///
27 | ///
28 | ///
29 | public ProfileCreatorEntry(string appKey, string tooltip = "")
30 | {
31 | InitializeComponent();
32 | DataContext = this;
33 | AppKey = appKey;
34 | Tooltip = tooltip == "" ? "AppKey" : tooltip;
35 | }
36 |
37 | ///
38 | /// Contructor for custom fields. Non-readonly AppKey, manually defined instead.
39 | ///
40 | public ProfileCreatorEntry()
41 | {
42 | InitializeComponent();
43 | DataContext = this;
44 | appKeyTb.IsReadOnly = false;
45 | appKeyTb.ToolTip = "AppKey for custom - eg. Quest.EntryId - Case Sensitive!";
46 | }
47 |
48 | private string _appKey;
49 | private string _sqlKey;
50 | private string _tableName;
51 | private bool _isIncluded = true;
52 |
53 | public string AppKey
54 | {
55 | get { return _appKey; }
56 | set
57 | {
58 | _appKey = value;
59 | RaisePropertyChanged("AppKey");
60 | }
61 | }
62 | public string SqlKey
63 | {
64 | get { return _sqlKey; }
65 | set
66 | {
67 | _sqlKey = value;
68 | RaisePropertyChanged("SqlKey");
69 | }
70 | }
71 | public string TableName
72 | {
73 | get { return _tableName; }
74 | set
75 | {
76 | _tableName = value;
77 | RaisePropertyChanged("TableName");
78 | }
79 | }
80 | public bool IsIncluded
81 | {
82 | get { return _isIncluded; }
83 | set
84 | {
85 | _isIncluded = value;
86 | RaisePropertyChanged("IsIncluded");
87 | }
88 | }
89 | public string Tooltip { get; set; }
90 |
91 | public event PropertyChangedEventHandler PropertyChanged;
92 | private void RaisePropertyChanged(string property)
93 | {
94 | if (PropertyChanged != null)
95 | PropertyChanged(this, new PropertyChangedEventArgs(property));
96 | }
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/QuestCreator/QuestPreview.xaml:
--------------------------------------------------------------------------------
1 |
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 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/QuestCreator/QuestPreview.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.ComponentModel;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Navigation;
15 | using System.Windows.Shapes;
16 |
17 | namespace TrinityCreator.Shared.Tools.QuestCreator
18 | {
19 | ///
20 | /// Interaction logic for QuestPreview.xaml
21 | ///
22 | public partial class QuestPreview : UserControl, INotifyPropertyChanged
23 | {
24 | public QuestPreview()
25 | {
26 | InitializeComponent();
27 | }
28 |
29 | private string _questStatusIcon;
30 |
31 | public event PropertyChangedEventHandler PropertyChanged;
32 |
33 | public string QuestStatusIcon
34 | {
35 | get { return "Resources/" + _questStatusIcon + ".png"; }
36 | set { _questStatusIcon = value; }
37 | }
38 |
39 | }
40 | }
41 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/VendorCreator/VendorEntryControl.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/VendorCreator/VendorEntryControl.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 | using TrinityCreator.Shared.Data;
16 | using TrinityCreator.Shared.Helpers;
17 | using TrinityCreator.Shared.Profiles;
18 |
19 | namespace TrinityCreator.Shared.Tools.VendorCreator
20 | {
21 | ///
22 | /// Interaction logic for VendorEntryControl.xaml
23 | ///
24 | public partial class VendorEntryControl : UserControl, ICreator
25 | {
26 | public VendorEntryControl()
27 | {
28 | InitializeComponent();
29 | CustomDisplayFields = Profile.Active.GetCustomDisplayFields(Export.C.Vendor);
30 | Profile.ActiveProfileChangedEvent += Profile_ActiveProfileChangedEvent;
31 | UiHelper.PrepareCustomDisplayFields(customDisplayFieldGb, this);
32 | }
33 |
34 |
35 |
36 | public Export.C ExportType { get; } = Export.C.Creature;
37 | public List CustomDisplayFields { get; set; }
38 | = new List();
39 |
40 | private void Profile_ActiveProfileChangedEvent(object sender, EventArgs e)
41 | {
42 | UiHelper.PrepareCustomDisplayFields(customDisplayFieldGb, this);
43 | }
44 |
45 | public event EventHandler RemoveRequestEvent;
46 |
47 | private void removeMeBtn_Click(object sender, RoutedEventArgs e)
48 | {
49 | Profile.ActiveProfileChangedEvent -= Profile_ActiveProfileChangedEvent;
50 | RemoveRequestEvent(this, e);
51 | }
52 |
53 | private void itemLookupBtn_Click(object sender, RoutedEventArgs e)
54 | {
55 | Global.LookupTool.SelectedTarget = LookupTool.Target.Item;
56 | }
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/VendorCreator/VendorPage.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
36 |
37 |
38 |
39 |
40 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/Tools/VendorCreator/VendorPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 | using TrinityCreator.Shared.Database;
16 | using TrinityCreator.Shared.Profiles;
17 |
18 | namespace TrinityCreator.Shared.Tools.VendorCreator
19 | {
20 | ///
21 | /// Interaction logic for VendorPage.xaml
22 | ///
23 | public partial class VendorPage : Page
24 | {
25 | public VendorPage()
26 | {
27 | InitializeComponent();
28 | addItemBtn_Click(null, null); // Create an item on first load
29 | }
30 |
31 | private void addItemBtn_Click(object sender, RoutedEventArgs e)
32 | {
33 | var vec = new VendorEntryControl();
34 | vec.RemoveRequestEvent += Vec_RemoveRequestEvent; ;
35 | vendorEntriesWp.Children.Add(vec);
36 | }
37 |
38 | private void Vec_RemoveRequestEvent(object sender, EventArgs e)
39 | {
40 | // Remove the sender if it's not the last one
41 | if (vendorEntriesWp.Children.Count > 1)
42 | {
43 | var vec = (VendorEntryControl)sender;
44 | vendorEntriesWp.Children.Remove(vec);
45 | }
46 | }
47 |
48 | private void removeItemBtn_Click(object sender, RoutedEventArgs e)
49 | {
50 | vendorEntriesWp.Children.RemoveAt(vendorEntriesWp.Children.Count - 1);
51 | }
52 |
53 | private void exportSqlBtn_Click(object sender, RoutedEventArgs e)
54 | {
55 | try
56 | {
57 | string query = Export.Vendor(this);
58 | SaveQuery.ToFile("Vendor "+ npcTb.Text + ".sql", query);
59 | }
60 | catch (Exception ex)
61 | {
62 | MessageBox.Show(ex.Message, "Failed to generate query", MessageBoxButton.OK, MessageBoxImage.Error);
63 | }
64 | }
65 |
66 | private void exportDbBtn_Click(object sender, RoutedEventArgs e)
67 | {
68 | try
69 | {
70 | // Ensure connection is set up
71 | if (!Connection.Open(true))
72 | return;
73 |
74 | // Export
75 | string query = Export.Vendor(this);
76 | SaveQuery.ToDatabase(query);
77 | }
78 | catch (Exception ex)
79 | {
80 | MessageBox.Show(ex.Message, "Failed to generate query", MessageBoxButton.OK, MessageBoxImage.Error);
81 | }
82 | }
83 |
84 | private void npcLookupBtn_Click(object sender, RoutedEventArgs e)
85 | {
86 | Global.LookupTool.SelectedTarget = LookupTool.Target.Creature;
87 | }
88 |
89 | }
90 | }
91 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/UI/Converters/BoolInverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows;
4 | using System.Windows.Data;
5 |
6 | namespace TrinityCreator.Shared.UI.Converters
7 | {
8 | [Localizability(LocalizationCategory.NeverLocalize)]
9 | public class BoolInverter : IValueConverter
10 | {
11 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
12 | {
13 | return (bool)value ? false : true;
14 | }
15 |
16 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
17 | {
18 | return null;
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/UI/Converters/ValueToVisibilityConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows;
4 | using System.Windows.Data;
5 |
6 | namespace TrinityCreator.Shared.UI.Converters
7 | {
8 | [Localizability(LocalizationCategory.NeverLocalize)]
9 | public class ValueToVisibilityConverter : IValueConverter
10 | {
11 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
12 | {
13 | var flag = false;
14 | if (value is bool)
15 | {
16 | flag = (bool) value;
17 | }
18 | else if (value is bool?)
19 | {
20 | var nullable = (bool?) value;
21 | flag = nullable.HasValue ? nullable.Value : false;
22 | }
23 | else if (value is string && (string) value != "")
24 | flag = true;
25 | else if (value is int && (int) value != 0)
26 | flag = true;
27 | else if (value is long && (long) value != 0)
28 | flag = true;
29 | else if (value is double && (double) value != 0 && !double.IsNaN((double) value) &&
30 | !double.IsInfinity((double) value))
31 | flag = true;
32 |
33 | return flag ? Visibility.Visible : Visibility.Collapsed;
34 | }
35 |
36 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
37 | {
38 | return null;
39 | }
40 | }
41 | }
--------------------------------------------------------------------------------
/TrinityCreator.Shared/UI/Converters/WeaponSpeedToStringConverter.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Windows;
4 | using System.Windows.Data;
5 |
6 | namespace TrinityCreator.Shared.UI.Converters
7 | {
8 | [Localizability(LocalizationCategory.NeverLocalize)]
9 | public class WeaponSpeedToStringConverter : IValueConverter
10 | {
11 | public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
12 | {
13 | if (value is int)
14 | {
15 | var r = (int) value/1000.0;
16 | return r.ToString("0.00");
17 | }
18 | return "INVALID";
19 | }
20 |
21 | public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
22 | {
23 | return null;
24 | }
25 | }
26 | }
--------------------------------------------------------------------------------
/TrinityCreator.Shared/UI/CreditsWindow.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/UI/CreditsWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Reflection;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 | using System.Windows;
8 | using System.Windows.Controls;
9 | using System.Windows.Data;
10 | using System.Windows.Documents;
11 | using System.Windows.Input;
12 | using System.Windows.Media;
13 | using System.Windows.Media.Imaging;
14 | using System.Windows.Shapes;
15 |
16 | namespace TrinityCreator.Shared.UI
17 | {
18 | ///
19 | /// Interaction logic for CreditsWindow.xaml
20 | ///
21 | public partial class CreditsWindow : Window
22 | {
23 | public CreditsWindow()
24 | {
25 | InitializeComponent();
26 | creditsTxt.Text = "Version\t\t\tv" + Assembly.GetExecutingAssembly().GetName().Version +
27 | Environment.NewLine + Properties.Resources.Credits;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/UI/DbConfigWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
33 |
34 |
36 |
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/UI/DbConfigWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System.Windows;
2 | using System.Windows.Media;
3 | using TrinityCreator.Shared.Database;
4 | using TrinityCreator.Shared.Properties;
5 |
6 | namespace TrinityCreator.Shared.UI
7 | {
8 | ///
9 | /// Interaction logic for DbConfigWindow.xaml
10 | ///
11 | public partial class DbConfigWindow : Window
12 | {
13 | public DbConfigWindow()
14 | {
15 | InitializeComponent();
16 |
17 | LoadSavedInfo();
18 | }
19 |
20 | // Load saved connection info
21 | private void LoadSavedInfo()
22 | {
23 | string connStr = Settings.Default.worldDb;
24 | if (connStr != "")
25 | {
26 | string[] connData = connStr.Split(';');
27 | foreach (string part in connData)
28 | {
29 | string[] sub = part.Split('=');
30 | switch (sub[0])
31 | {
32 | case "server":
33 | HostTxt.Text = sub[1];
34 | break;
35 | case "port":
36 | PortTxt.Text = sub[1];
37 | break;
38 | case "user":
39 | UserTxt.Text = sub[1];
40 | break;
41 | case "password":
42 | PasswordTxt.Text = sub[1];
43 | break;
44 | case "database":
45 | DatabaseTxt.Text = sub[1];
46 | break;
47 | }
48 | }
49 | }
50 | }
51 |
52 | private void saveBtn_Click(object sender, RoutedEventArgs e)
53 | {
54 | string connString = "server=" + HostTxt.Text + ";user=" + UserTxt.Text + ";password=" + PasswordTxt.Text + ";database=" + DatabaseTxt.Text + ";port=" + PortTxt.Text + ";";
55 |
56 | StatusLbl.Text = "Testing connection...";
57 | StatusLbl.Foreground = Brushes.Black;
58 |
59 | var testException = Connection.Test(connString);
60 | if (testException == null) // Success
61 | {
62 | StatusLbl.Text = "Connection test successful. Saved to settings.";
63 | StatusLbl.Foreground = Brushes.Green;
64 |
65 | Settings.Default.worldDb = connString;
66 | Settings.Default.Save();
67 | }
68 | else // failed
69 | {
70 | StatusLbl.Text = "Connection test failed: " + testException.Message;
71 | StatusLbl.Foreground = Brushes.Red;
72 | }
73 | }
74 |
75 | private void closeBtn_Click(object sender, RoutedEventArgs e)
76 | {
77 | Close();
78 | }
79 |
80 | private void restoreDefaultBtn_Click(object sender, RoutedEventArgs e)
81 | {
82 | if (MessageBox.Show("Are you sure you want to clear your database settings? This will not affect your database.",
83 | "Reset database settings?", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
84 | {
85 | Settings.Default.worldDb = "";
86 | Settings.Default.Save();
87 | HostTxt.Text = "";
88 | PortTxt.Text = "";
89 | UserTxt.Text = "";
90 | PasswordTxt.Text = "";
91 | DatabaseTxt.Text = "";
92 | }
93 | }
94 | }
95 | }
--------------------------------------------------------------------------------
/TrinityCreator.Shared/UI/DbcConfigWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/UI/DbcConfigWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 | using System.IO;
15 | using TrinityCreator.Shared.DBC;
16 |
17 | namespace TrinityCreator.Shared.UI
18 | {
19 | ///
20 | /// Interaction logic for DbcConfigWindow.xaml
21 | ///
22 | public partial class DbcConfigWindow : Window
23 | {
24 | public DbcConfigWindow()
25 | {
26 | InitializeComponent();
27 | dbcDirTxt.Text = Properties.Settings.Default.DbcDir;
28 | ShowInfo();
29 | }
30 |
31 | private void ShowInfo()
32 | {
33 | infoTxt.Text = string.Format("This setting is optional and only used by the Lookup Tool in some instances.{0}" +
34 | "If you already have a DBC directory, you should point this setting there.{0}" +
35 | "Alternatively you can point to your WoW directory to extract the DBC files automatically.{0}{0}" +
36 | "This must point to 3.3.5a DBC files to work correctly. Leaving this empty is fine as well."
37 | , Environment.NewLine);
38 | }
39 |
40 | private void selectBtn_Click(object sender, RoutedEventArgs e)
41 | {
42 | var d = new System.Windows.Forms.FolderBrowserDialog();
43 | var r = d.ShowDialog();
44 | if (r == System.Windows.Forms.DialogResult.OK)
45 | {
46 | dbcDirTxt.Text = d.SelectedPath;
47 | }
48 | }
49 |
50 | private void saveBtn_Click(object sender, RoutedEventArgs e)
51 | {
52 | string dir = dbcDirTxt.Text;
53 | if (File.Exists(dir + @"\Wow.exe")) // Is wow dir, add dbc to path
54 | dir += @"\dbc";
55 |
56 | // Save path for verification
57 | string oldDbcPath = Properties.Settings.Default.DbcDir;
58 | Properties.Settings.Default.DbcDir = dir;
59 | Properties.Settings.Default.Save();
60 |
61 | // Verify & notify or undo
62 | if (DbcHandler.VerifyDbcDir(openConfigWindowOnError: false))
63 | {
64 | MessageBox.Show("DBC Directory is configured correctly.", "Settings saved", MessageBoxButton.OK, MessageBoxImage.Information);
65 | Close();
66 | }
67 | else
68 | {
69 | Properties.Settings.Default.DbcDir = oldDbcPath;
70 | Properties.Settings.Default.Save();
71 | }
72 | }
73 | }
74 | }
75 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/UI/ProfileOptionControl.xaml:
--------------------------------------------------------------------------------
1 |
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 | Source Link
45 |
46 |
47 |
48 |
49 |
50 |
51 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/UI/ProfileOptionControl.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 | using TrinityCreator.Shared.Profiles;
16 |
17 | namespace TrinityCreator.Shared.UI
18 | {
19 | ///
20 | /// Interaction logic for ProfileSelectionControl.xaml
21 | ///
22 | public partial class ProfileSelectionControl : UserControl
23 | {
24 | public ProfileSelectionControl(Profile profile)
25 | {
26 | InitializeComponent();
27 | _Profile = profile;
28 | DataContext = profile;
29 | HighlightOnActive();
30 |
31 | // Hide link if not available
32 | if (profile.UpdateUrl == null || profile.UpdateUrl == string.Empty)
33 | linkSp.Visibility = Visibility.Collapsed;
34 |
35 | Profile.ActiveProfileChangedEvent += Profile_ActiveProfileChangedEvent;
36 | }
37 |
38 | public Profile _Profile { get; private set; }
39 |
40 |
41 | ///
42 | /// Open url if it's valid
43 | ///
44 | ///
45 | ///
46 | private void Hyperlink_RequestNavigate(object sender, RequestNavigateEventArgs e)
47 | {
48 | Uri uriResult;
49 | bool valid = Uri.TryCreate(e.Uri.ToString(), UriKind.Absolute, out uriResult)
50 | && uriResult.Scheme == Uri.UriSchemeHttp;
51 | if (valid)
52 | System.Diagnostics.Process.Start(uriResult.ToString());
53 | }
54 |
55 | private void activateBrn_Click(object sender, RoutedEventArgs e)
56 | {
57 | Profile.Active = _Profile;
58 | }
59 |
60 | private void Profile_ActiveProfileChangedEvent(object sender, EventArgs e)
61 | {
62 | HighlightOnActive();
63 | }
64 |
65 | private void HighlightOnActive()
66 | {
67 | if (_Profile.Equals(Profile.Active))
68 | {
69 | // todo: Change background color if this is the active profile, have changed eventhandler on Profile.Active to run this
70 | this.Background = Brushes.LightBlue;
71 | }
72 | else this.Background = Brushes.White;
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/UI/ProfileSelectionWindow.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/UI/ProfileSelectionWindow.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Shapes;
14 | using TrinityCreator.Shared.Helpers;
15 | using TrinityCreator.Shared.Profiles;
16 |
17 | namespace TrinityCreator.Shared.UI
18 | {
19 | ///
20 | /// Interaction logic for ProfileSelectionWindow.xaml
21 | ///
22 | public partial class ProfileSelectionWindow : Window
23 | {
24 | public ProfileSelectionWindow()
25 | {
26 | InitializeComponent();
27 |
28 | // Load & list profiles
29 | foreach (Profile p in Profile.ListProfiles())
30 | profileControlsSp.Children.Add(new ProfileSelectionControl(p));
31 |
32 | // ActiveProfile changed handler
33 | Profile.ActiveProfileChangedEvent += Profile_ActiveProfileChangedEvent;
34 | }
35 |
36 | private void Profile_ActiveProfileChangedEvent(object sender, EventArgs e)
37 | {
38 | // Store the local path of selected profile in Settings to remember between sessions
39 | Properties.Settings.Default.ActiveProfilePath = Profile.Active.LocalPath;
40 | Properties.Settings.Default.Save();
41 |
42 | // Log the change
43 | Logger.Log("User has chosen a new active profile: " + Profile.Active.LocalPath);
44 |
45 | // Close the window once a profile has been selected
46 | this.Close();
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/UI/UIElements/Browser.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/UI/UIElements/Browser.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 |
16 | namespace TrinityCreator.Shared.UI.UIElements
17 | {
18 | ///
19 | /// Interaction logic for Browser.xaml
20 | ///
21 | public partial class Browser : UserControl
22 | {
23 | // Don't use cefsharp. Default browser control might work in the future, who knows.
24 | public Browser()
25 | {
26 | InitializeComponent();
27 | }
28 |
29 | ///
30 | /// Load url
31 | ///
32 | ///
33 | /// modelViewer requires blank page first because js
34 | public void LoadUrl(string url, bool blankFirst = false)
35 | {
36 | //System.Diagnostics.Process.Start(url);
37 | webViewControl.Source = new Uri(url);
38 | webViewControl.BringIntoView();
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/UI/UIElements/CustomDisplayFieldControl.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
12 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/UI/UIElements/CustomDisplayFieldControl.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Windows;
7 | using System.Windows.Controls;
8 | using System.Windows.Data;
9 | using System.Windows.Documents;
10 | using System.Windows.Input;
11 | using System.Windows.Media;
12 | using System.Windows.Media.Imaging;
13 | using System.Windows.Navigation;
14 | using System.Windows.Shapes;
15 | using TrinityCreator.Shared.Data;
16 |
17 | namespace TrinityCreator.Shared.UI.UIElements
18 | {
19 | ///
20 | /// Interaction logic for CustomDisplayFieldControl.xaml
21 | ///
22 | public partial class CustomDisplayFieldControl : UserControl
23 | {
24 | public CustomDisplayFieldControl(CustomDisplayField field)
25 | {
26 | InitializeComponent();
27 | DataContext = field;
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/UI/UIElements/DynamicDataControl.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
11 |
12 |
13 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/UI/UIElements/XmlKeyValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Text;
5 | using System.Threading.Tasks;
6 | using System.Xml;
7 | using TrinityCreator.Shared.Data;
8 |
9 | namespace TrinityCreator.Shared.UI.UIElements
10 | {
11 | public class XmlKeyValue : IKeyValue
12 | {
13 | public XmlKeyValue(int id, string description)
14 | : base(id, description) { }
15 |
16 | public static IKeyValue[] FromXml(string name)
17 | {
18 | List result = new List();
19 | XmlDocument xml = new XmlDocument();
20 | xml.LoadXml(Properties.Resources.cb_data);
21 | XmlElement target = (XmlElement)xml.SelectSingleNode("/KeyValues/" + name);
22 | foreach (XmlElement element in target.ChildNodes)
23 | {
24 | int id = 0;
25 | string description = "";
26 |
27 | foreach (XmlAttribute attr in element.Attributes)
28 | {
29 | if (attr.Name == "Id")
30 | id = int.Parse(attr.Value);
31 | else if (attr.Name == "Description")
32 | description = attr.Value;
33 | }
34 | result.Add(new XmlKeyValue(id, description));
35 | }
36 | return result.ToArray();
37 | }
38 | }
39 | }
40 |
--------------------------------------------------------------------------------
/TrinityCreator.Shared/app.config:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/TrinityCreator.Tests/Data/CustomDisplayFieldTests.cs:
--------------------------------------------------------------------------------
1 | using TrinityCreator.Shared.Data;
2 | using Xunit;
3 |
4 | namespace TrinityCreator.Tests.Data
5 | {
6 | public class CustomDisplayFieldTests
7 | {
8 | [Theory]
9 | [InlineData("Item.CustomInt.SomeName")]
10 | [InlineData("Quest.CustomInt.SomeName")]
11 | [InlineData("Creature.CustomInt.SomeName")]
12 | [InlineData("Item.CustomFloat.SomeName")]
13 | [InlineData("Item.CustomText.SomeName")]
14 | [InlineData("Item.CustomText.SomeName with spaces")]
15 | [InlineData("Item.CustomText.SomeName.with.more.dots")]
16 | public void Create_ValidateCustomFieldName_SuccessfulCreate(string fullCustomFieldName)
17 | {
18 | CustomDisplayField result = CustomDisplayField.Create(
19 | "_", "_", fullCustomFieldName);
20 | Assert.NotNull(result);
21 | }
22 |
23 | [Theory]
24 | [InlineData("Shoe.CustomInt.SomeName")] // invalid creator
25 | [InlineData("quest.CustomInt.SomeName")] // case
26 | [InlineData("Creature.CustomBool.SomeName")] // Invalid type
27 | [InlineData("Item.Float.SomeName")] // without the word custom
28 | [InlineData("Item.CustomText")] // no display name
29 | public void Create_ValidateCustomFieldName_ExpectFail(string fullCustomFieldName)
30 | {
31 | CustomDisplayField result = CustomDisplayField.Create(
32 | "_", "_", fullCustomFieldName);
33 | Assert.Null(result);
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/TrinityCreator.Tests/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 |
5 | [assembly: AssemblyTitle("TrinityCreator.Tests")]
6 | [assembly: AssemblyDescription("")]
7 | [assembly: AssemblyConfiguration("")]
8 | [assembly: AssemblyCompany("")]
9 | [assembly: AssemblyProduct("TrinityCreator.Tests")]
10 | [assembly: AssemblyCopyright("Copyright © 2021")]
11 | [assembly: AssemblyTrademark("")]
12 | [assembly: AssemblyCulture("")]
13 |
14 | [assembly: ComVisible(false)]
15 |
16 | [assembly: Guid("97940c3d-3e5a-40f0-a97b-bbcde2fb6cfd")]
17 |
18 | // [assembly: AssemblyVersion("1.0.*")]
19 | [assembly: AssemblyVersion("1.0.0.0")]
20 | [assembly: AssemblyFileVersion("1.0.0.0")]
21 |
--------------------------------------------------------------------------------
/TrinityCreator.Tests/app.config:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/TrinityCreator.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/TrinityCreator.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio Version 17
4 | VisualStudioVersion = 17.0.31825.309
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrinityCreator", "TrinityCreator\TrinityCreator.csproj", "{47CB1223-637A-4CBE-8842-CE204B2395B6}"
7 | EndProject
8 | Project("{54435603-DBB4-11D2-8724-00A0C9A8B90C}") = "TrinityCreatorInstaller", "TrinityCreatorInstaller\TrinityCreatorInstaller.vdproj", "{3A2CF424-F9FF-48F5-AA36-AD3701DC4DC6}"
9 | EndProject
10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrinityCreator.Tests", "TrinityCreator.Tests\TrinityCreator.Tests.csproj", "{97940C3D-3E5A-40F0-A97B-BBCDE2FB6CFD}"
11 | EndProject
12 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TrinityCreator.Shared", "TrinityCreator.Shared\TrinityCreator.Shared.csproj", "{15F1B410-5835-43B1-89B8-197CC6105535}"
13 | EndProject
14 | Global
15 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
16 | Debug|Any CPU = Debug|Any CPU
17 | Release|Any CPU = Release|Any CPU
18 | EndGlobalSection
19 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
20 | {47CB1223-637A-4CBE-8842-CE204B2395B6}.Debug|Any CPU.ActiveCfg = Debug|x86
21 | {47CB1223-637A-4CBE-8842-CE204B2395B6}.Debug|Any CPU.Build.0 = Debug|x86
22 | {47CB1223-637A-4CBE-8842-CE204B2395B6}.Release|Any CPU.ActiveCfg = Release|x86
23 | {47CB1223-637A-4CBE-8842-CE204B2395B6}.Release|Any CPU.Build.0 = Release|x86
24 | {3A2CF424-F9FF-48F5-AA36-AD3701DC4DC6}.Debug|Any CPU.ActiveCfg = Debug
25 | {3A2CF424-F9FF-48F5-AA36-AD3701DC4DC6}.Debug|Any CPU.Build.0 = Debug
26 | {3A2CF424-F9FF-48F5-AA36-AD3701DC4DC6}.Release|Any CPU.ActiveCfg = Release
27 | {3A2CF424-F9FF-48F5-AA36-AD3701DC4DC6}.Release|Any CPU.Build.0 = Release
28 | {97940C3D-3E5A-40F0-A97B-BBCDE2FB6CFD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
29 | {97940C3D-3E5A-40F0-A97B-BBCDE2FB6CFD}.Debug|Any CPU.Build.0 = Debug|Any CPU
30 | {97940C3D-3E5A-40F0-A97B-BBCDE2FB6CFD}.Release|Any CPU.ActiveCfg = Release|Any CPU
31 | {97940C3D-3E5A-40F0-A97B-BBCDE2FB6CFD}.Release|Any CPU.Build.0 = Release|Any CPU
32 | {15F1B410-5835-43B1-89B8-197CC6105535}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
33 | {15F1B410-5835-43B1-89B8-197CC6105535}.Debug|Any CPU.Build.0 = Debug|Any CPU
34 | {15F1B410-5835-43B1-89B8-197CC6105535}.Release|Any CPU.ActiveCfg = Release|Any CPU
35 | {15F1B410-5835-43B1-89B8-197CC6105535}.Release|Any CPU.Build.0 = Release|Any CPU
36 | EndGlobalSection
37 | GlobalSection(SolutionProperties) = preSolution
38 | HideSolutionNode = FALSE
39 | EndGlobalSection
40 | GlobalSection(ExtensibilityGlobals) = postSolution
41 | SolutionGuid = {7E577C51-067D-4C8B-A6A1-DEEBF517E130}
42 | EndGlobalSection
43 | EndGlobal
44 |
--------------------------------------------------------------------------------
/TrinityCreator/App.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | False
15 |
16 |
17 | True
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 | 400
27 |
28 |
29 |
30 |
31 |
32 | False
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 |
--------------------------------------------------------------------------------
/TrinityCreator/App.xaml:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
--------------------------------------------------------------------------------
/TrinityCreator/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Globalization;
3 | using System.Threading;
4 | using System.Windows;
5 | using System.Windows.Markup;
6 | using TrinityCreator.Shared.Tools.LookupTool;
7 | using TrinityCreator.Shared.Tools.ModelViewer;
8 | using TrinityCreator.Shared.UI;
9 | using TrinityCreator.Shared.Helpers;
10 | using TrinityCreator.Shared.Profiles;
11 | using TrinityCreator.Shared.Properties;
12 | using TrinityCreator.Shared;
13 |
14 | namespace TrinityCreator
15 | {
16 | ///
17 | /// Interaction logic for App.xaml
18 | ///
19 | public partial class App : Application
20 | {
21 | public App()
22 | {
23 | // Related to not breaking float input on different locales
24 | Thread.CurrentThread.CurrentCulture = new CultureInfo("en-US");
25 | Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-US");
26 | FrameworkElement.LanguageProperty.OverrideMetadata(typeof (FrameworkElement), new FrameworkPropertyMetadata(
27 | XmlLanguage.GetLanguage(CultureInfo.CurrentCulture.IetfLanguageTag)));
28 |
29 | // Indicate that the app has started to shut down background thread when application closes
30 | App.Current.Properties["IsRunning"] = true;
31 | Logger.Log("Application Starting...");
32 |
33 | // Upgrade settings
34 | if (Settings.Default.UpgradeRequired)
35 | {
36 | Logger.Log("First run or version has changed since last run. Running Settings.Upgrade()");
37 | Settings.Default.Upgrade();
38 | Settings.Default.UpgradeRequired = false;
39 | Settings.Default.Save();
40 | }
41 |
42 | // Handle startup args
43 | HandleArgs();
44 |
45 | // Check for application update
46 | Updater.Run();
47 |
48 | // Check for and install profile updates
49 | Updater.UpdateProfiles();
50 |
51 | // Ensure we have a valid profile before loading MainWindow
52 | Profile.ActiveProfileChangedEvent += Profile_ActiveProfileChangedEvent;
53 |
54 | // Force profile input if it doesn't know a working one
55 | string knownActiveProfilePath = Settings.Default.ActiveProfilePath;
56 | if (knownActiveProfilePath == String.Empty ||
57 | !System.IO.File.Exists(knownActiveProfilePath) ||
58 | Profile.LoadFile(knownActiveProfilePath) == null)
59 | {
60 | Logger.Log("First run or corrupt profile. Prompting user to select a profile before starting.");
61 | var pwin = new ProfileSelectionWindow();
62 | pwin.Show();
63 | }
64 | else Profile.Active = Profile.LoadFile(knownActiveProfilePath);
65 | }
66 |
67 | // Open mainwindow when we have a valid profile active
68 | private void Profile_ActiveProfileChangedEvent(object sender, EventArgs e)
69 | {
70 | var x = Profile.Active;
71 | if (Profile.Active != null)
72 | {
73 | Global._MainWindow = new MainWindow();
74 | Global._MainWindow.Show();
75 |
76 | // Only once on launch.
77 | Profile.ActiveProfileChangedEvent -= Profile_ActiveProfileChangedEvent;
78 | }
79 | }
80 |
81 | private void HandleArgs() // 0 is current exe path
82 | {
83 | string[] args = Environment.GetCommandLineArgs();
84 | // niy
85 | }
86 | }
87 | }
--------------------------------------------------------------------------------
/TrinityCreator/Properties/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Reflection;
2 | using System.Runtime.InteropServices;
3 | using System.Windows;
4 |
5 | // General Information about an assembly is controlled through the following
6 | // set of attributes. Change these attribute values to modify the information
7 | // associated with an assembly.
8 |
9 | [assembly: AssemblyTitle("TrinityCreator")]
10 | [assembly: AssemblyDescription("Easily create content for a 3.3.5a TrinityCore emulator server.")]
11 | [assembly: AssemblyConfiguration("")]
12 | [assembly: AssemblyCompany("NotCoffee418")]
13 | [assembly: AssemblyProduct("TrinityCreator")]
14 | [assembly: AssemblyCopyright("Copyright © NotCoffee418 2020")]
15 | [assembly: AssemblyTrademark("")]
16 | [assembly: AssemblyCulture("")]
17 | [assembly: Guid("7F3D3555-6622-43BB-A57B-3ADD4D2AFB0F")]
18 |
19 | // Setting ComVisible to false makes the types in this assembly not visible
20 | // to COM components. If you need to access a type in this assembly from
21 | // COM, set the ComVisible attribute to true on that type.
22 |
23 | [assembly: ComVisible(false)]
24 |
25 | //In order to begin building localizable applications, set
26 | //CultureYouAreCodingWith in your .csproj file
27 | //inside a . For example, if you are using US english
28 | //in your source files, set the to en-US. Then uncomment
29 | //the NeutralResourceLanguage attribute below. Update the "en-US" in
30 | //the line below to match the UICulture setting in the project file.
31 |
32 | //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
33 |
34 |
35 | [assembly: ThemeInfo(
36 | ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
37 | //(used if a resource is not found in the page,
38 | // or application resource dictionaries)
39 | ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
40 | //(used if a resource is not found in the page,
41 | // app, or any theme specific resource dictionaries)
42 | )]
43 |
44 |
45 | // Version information for an assembly consists of the following four values:
46 | //
47 | // Major Version
48 | // Minor Version
49 | // Build Number
50 | // Revision
51 | //
52 | // You can specify all the values or you can default the Build and Revision Numbers
53 | // by using the '*' as shown below:
54 | // [assembly: AssemblyVersion("1.0.*")]
55 |
56 |
57 | // change shared version also
58 | [assembly: AssemblyVersion("1.1.5.128")]
59 | [assembly: AssemblyFileVersion("1.1.5.128")]
--------------------------------------------------------------------------------
/TrinityCreator/ReleaseToZip.ps1:
--------------------------------------------------------------------------------
1 | New-Item -ItemType Directory -Force -Path ..\Publish
2 |
3 | $appPath = (get-item $pwd).parent.parent.FullName
4 | $fileName = (Split-Path -Leaf -Path $appPath) + ".zip"
5 | $fullName = $pwd.Path + "\..\Publish\" + $fileName
6 |
7 | Compress-Archive *.dll -Force $fullName
8 | Compress-Archive *.exe -Update $fullName
--------------------------------------------------------------------------------
/TrinityCreator/Resources/tclogo.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/NotCoffee418/TrinityCreator/d1bb3315388f68edb176338720ac081f9251f448/TrinityCreator/Resources/tclogo.ico
--------------------------------------------------------------------------------
/TrinityCreator/app.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
52 |
53 |
54 |
55 | PerMonitor
56 | true/PM
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/TrinityCreator/bin/Publish/TrinityCreator.zip:
--------------------------------------------------------------------------------
1 | version https://git-lfs.github.com/spec/v1
2 | oid sha256:306e90b7d98b0b908cfdef4377bb7e7b5455b85d82bd6c9af23ead995618c64a
3 | size 2006795
4 |
--------------------------------------------------------------------------------