├── .gitignore ├── WC3_TOOL.sln └── wc3_tool ├── EventTool.Designer.cs ├── EventTool.cs ├── EventTool.resx ├── MainScreen.Designer.cs ├── MainScreen.cs ├── MainScreen.resx ├── Program.cs ├── Properties └── AssemblyInfo.cs ├── WC3 ├── Decor_editor.Designer.cs ├── Decor_editor.cs ├── Decor_editor.resx ├── ECB.cs ├── ECB_editor.Designer.cs ├── ECB_editor.cs ├── ECB_editor.resx ├── ECT.cs ├── ECT_editor.Designer.cs ├── ECT_editor.cs ├── ECT_editor.resx ├── ECT_editor_text.cs ├── ECT_pkedit.Designer.cs ├── ECT_pkedit.cs ├── ECT_pkedit.resx ├── FILEIO.cs ├── GiveEggOrg.resx ├── Image │ ├── Cards.resx │ └── Icons.resx ├── ME3.cs ├── ME3_editor.Designer.cs ├── ME3_editor.cs ├── ME3_editor.resx ├── PKHEX │ └── PKM.cs ├── SAV3.cs ├── TV.cs ├── TV_editor.Designer.cs ├── TV_editor.cs ├── TV_editor.resx ├── Tickets.resx ├── WC3_editor.Designer.cs ├── WC3_editor.cs ├── WC3_editor.resx ├── WC3_editor_givegg.Designer.cs ├── WC3_editor_givegg.cs ├── WC3_editor_givegg.resx ├── WC3_editor_giveggExt.Designer.cs ├── WC3_editor_giveggExt.cs ├── WC3_editor_giveggExt.resx ├── WCN_editor.Designer.cs ├── WCN_editor.cs ├── WCN_editor.resx └── wc3.cs ├── WC3_TOOL.csproj └── app.config /.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 | bld/ 21 | [Bb]in/ 22 | [Oo]bj/ 23 | 24 | # Visual Studio 2015 cache/options directory 25 | .vs/ 26 | # Uncomment if you have tasks that create the project's static files in wwwroot 27 | #wwwroot/ 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 | # DNX 43 | project.lock.json 44 | artifacts/ 45 | 46 | *_i.c 47 | *_p.c 48 | *_i.h 49 | *.ilk 50 | *.meta 51 | *.obj 52 | *.pch 53 | *.pdb 54 | *.pgc 55 | *.pgd 56 | *.rsp 57 | *.sbr 58 | *.tlb 59 | *.tli 60 | *.tlh 61 | *.tmp 62 | *.tmp_proj 63 | *.log 64 | *.vspscc 65 | *.vssscc 66 | .builds 67 | *.pidb 68 | *.svclog 69 | *.scc 70 | 71 | # Chutzpah Test files 72 | _Chutzpah* 73 | 74 | # Visual C++ cache files 75 | ipch/ 76 | *.aps 77 | *.ncb 78 | *.opendb 79 | *.opensdf 80 | *.sdf 81 | *.cachefile 82 | 83 | # Visual Studio profiler 84 | *.psess 85 | *.vsp 86 | *.vspx 87 | *.sap 88 | 89 | # TFS 2012 Local Workspace 90 | $tf/ 91 | 92 | # Guidance Automation Toolkit 93 | *.gpState 94 | 95 | # ReSharper is a .NET coding add-in 96 | _ReSharper*/ 97 | *.[Rr]e[Ss]harper 98 | *.DotSettings.user 99 | 100 | # JustCode is a .NET coding add-in 101 | .JustCode 102 | 103 | # TeamCity is a build add-in 104 | _TeamCity* 105 | 106 | # DotCover is a Code Coverage Tool 107 | *.dotCover 108 | 109 | # NCrunch 110 | _NCrunch_* 111 | .*crunch*.local.xml 112 | nCrunchTemp_* 113 | 114 | # MightyMoose 115 | *.mm.* 116 | AutoTest.Net/ 117 | 118 | # Web workbench (sass) 119 | .sass-cache/ 120 | 121 | # Installshield output folder 122 | [Ee]xpress/ 123 | 124 | # DocProject is a documentation generator add-in 125 | DocProject/buildhelp/ 126 | DocProject/Help/*.HxT 127 | DocProject/Help/*.HxC 128 | DocProject/Help/*.hhc 129 | DocProject/Help/*.hhk 130 | DocProject/Help/*.hhp 131 | DocProject/Help/Html2 132 | DocProject/Help/html 133 | 134 | # Click-Once directory 135 | publish/ 136 | 137 | # Publish Web Output 138 | *.[Pp]ublish.xml 139 | *.azurePubxml 140 | # TODO: Comment the next line if you want to checkin your web deploy settings 141 | # but database connection strings (with potential passwords) will be unencrypted 142 | *.pubxml 143 | *.publishproj 144 | 145 | # NuGet Packages 146 | *.nupkg 147 | # The packages folder can be ignored because of Package Restore 148 | **/packages/* 149 | # except build/, which is used as an MSBuild target. 150 | !**/packages/build/ 151 | # Uncomment if necessary however generally it will be regenerated when needed 152 | #!**/packages/repositories.config 153 | # NuGet v3's project.json files produces more ignoreable files 154 | *.nuget.props 155 | *.nuget.targets 156 | 157 | # Microsoft Azure Build Output 158 | csx/ 159 | *.build.csdef 160 | 161 | # Microsoft Azure Emulator 162 | ecf/ 163 | rcf/ 164 | 165 | # Microsoft Azure ApplicationInsights config file 166 | ApplicationInsights.config 167 | 168 | # Windows Store app package directory 169 | AppPackages/ 170 | BundleArtifacts/ 171 | 172 | # Visual Studio cache files 173 | # files ending in .cache can be ignored 174 | *.[Cc]ache 175 | # but keep track of directories ending in .cache 176 | !*.[Cc]ache/ 177 | 178 | # Others 179 | ClientBin/ 180 | ~$* 181 | *~ 182 | *.dbmdl 183 | *.dbproj.schemaview 184 | *.pfx 185 | *.publishsettings 186 | node_modules/ 187 | orleans.codegen.cs 188 | 189 | # RIA/Silverlight projects 190 | Generated_Code/ 191 | 192 | # Backup & report files from converting an old project file 193 | # to a newer Visual Studio version. Backup files are not needed, 194 | # because we have git ;-) 195 | _UpgradeReport_Files/ 196 | Backup*/ 197 | UpgradeLog*.XML 198 | UpgradeLog*.htm 199 | 200 | # SQL Server files 201 | *.mdf 202 | *.ldf 203 | 204 | # Business Intelligence projects 205 | *.rdl.data 206 | *.bim.layout 207 | *.bim_*.settings 208 | 209 | # Microsoft Fakes 210 | FakesAssemblies/ 211 | 212 | # GhostDoc plugin setting file 213 | *.GhostDoc.xml 214 | 215 | # Node.js Tools for Visual Studio 216 | .ntvs_analysis.dat 217 | 218 | # Visual Studio 6 build log 219 | *.plg 220 | 221 | # Visual Studio 6 workspace options file 222 | *.opt 223 | 224 | # Visual Studio LightSwitch build output 225 | **/*.HTMLClient/GeneratedArtifacts 226 | **/*.DesktopClient/GeneratedArtifacts 227 | **/*.DesktopClient/ModelManifest.xml 228 | **/*.Server/GeneratedArtifacts 229 | **/*.Server/ModelManifest.xml 230 | _Pvt_Extensions 231 | 232 | # Paket dependency manager 233 | .paket/paket.exe 234 | 235 | # FAKE - F# Make 236 | .fake/ 237 | -------------------------------------------------------------------------------- /WC3_TOOL.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 11.00 3 | # Visual Studio 2010 4 | # SharpDevelop 5.1 5 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "WC3_TOOL", "WC3_TOOL\WC3_TOOL.csproj", "{1E65C335-2DE3-410B-B713-5F7B023106CD}" 6 | EndProject 7 | Global 8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 9 | Debug|Any CPU = Debug|Any CPU 10 | Release|Any CPU = Release|Any CPU 11 | EndGlobalSection 12 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 13 | {1E65C335-2DE3-410B-B713-5F7B023106CD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 14 | {1E65C335-2DE3-410B-B713-5F7B023106CD}.Debug|Any CPU.Build.0 = Debug|Any CPU 15 | {1E65C335-2DE3-410B-B713-5F7B023106CD}.Release|Any CPU.ActiveCfg = Release|Any CPU 16 | {1E65C335-2DE3-410B-B713-5F7B023106CD}.Release|Any CPU.Build.0 = Release|Any CPU 17 | EndGlobalSection 18 | EndGlobal 19 | -------------------------------------------------------------------------------- /wc3_tool/EventTool.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /wc3_tool/MainScreen.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 17, 17 122 | 123 | -------------------------------------------------------------------------------- /wc3_tool/Program.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by SharpDevelop. 3 | * User: suloku 4 | * Date: 28/04/2016 5 | * Time: 21:22 6 | * 7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 8 | */ 9 | using System; 10 | using System.Windows.Forms; 11 | 12 | namespace WC3_TOOL 13 | { 14 | /// 15 | /// Class with program entry point. 16 | /// 17 | internal sealed class Program 18 | { 19 | /// 20 | /// Program entry point. 21 | /// 22 | [STAThread] 23 | private static void Main(string[] args) 24 | { 25 | Application.EnableVisualStyles(); 26 | Application.SetCompatibleTextRenderingDefault(false); 27 | Application.Run(new MainScreen()); 28 | } 29 | 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /wc3_tool/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | #region Using directives 2 | 3 | using System; 4 | using System.Reflection; 5 | using System.Runtime.InteropServices; 6 | 7 | #endregion 8 | 9 | // General Information about an assembly is controlled through the following 10 | // set of attributes. Change these attribute values to modify the information 11 | // associated with an assembly. 12 | [assembly: AssemblyTitle("WC3_TOOL")] 13 | [assembly: AssemblyDescription("")] 14 | [assembly: AssemblyConfiguration("")] 15 | [assembly: AssemblyCompany("")] 16 | [assembly: AssemblyProduct("WC3_TOOL")] 17 | [assembly: AssemblyCopyright("Copyright 2016")] 18 | [assembly: AssemblyTrademark("")] 19 | [assembly: AssemblyCulture("")] 20 | 21 | // This sets the default COM visibility of types in the assembly to invisible. 22 | // If you need to expose a type to COM, use [ComVisible(true)] on that type. 23 | [assembly: ComVisible(false)] 24 | 25 | // The assembly version has following format : 26 | // 27 | // Major.Minor.Build.Revision 28 | // 29 | // You can specify all the values or you can use the default the Revision and 30 | // Build Numbers by using the '*' as shown below: 31 | [assembly: AssemblyVersion("1.0.*")] 32 | -------------------------------------------------------------------------------- /wc3_tool/WC3/Decor_editor.Designer.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by SharpDevelop. 3 | * User: suloku 4 | * Date: 03/05/2016 5 | * Time: 17:34 6 | * 7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 8 | */ 9 | namespace WC3_TOOL 10 | { 11 | partial class Decor_editor 12 | { 13 | /// 14 | /// Designer variable used to keep track of non-visual components. 15 | /// 16 | private System.ComponentModel.IContainer components = null; 17 | private System.Windows.Forms.ComboBox decortypebox; 18 | private System.Windows.Forms.Label label1; 19 | private System.Windows.Forms.NumericUpDown numericUpDown1; 20 | private System.Windows.Forms.Label label2; 21 | private System.Windows.Forms.ComboBox decorationbox; 22 | private System.Windows.Forms.Label Decoration; 23 | private System.Windows.Forms.Button save_but; 24 | private System.Windows.Forms.Button add_but; 25 | private System.Windows.Forms.Button del_but; 26 | 27 | /// 28 | /// Disposes resources used by the form. 29 | /// 30 | /// true if managed resources should be disposed; otherwise, false. 31 | protected override void Dispose(bool disposing) 32 | { 33 | if (disposing) { 34 | if (components != null) { 35 | components.Dispose(); 36 | } 37 | } 38 | base.Dispose(disposing); 39 | } 40 | 41 | /// 42 | /// This method is required for Windows Forms designer support. 43 | /// Do not change the method contents inside the source code editor. The Forms designer might 44 | /// not be able to load this method if it was changed manually. 45 | /// 46 | private void InitializeComponent() 47 | { 48 | this.decortypebox = new System.Windows.Forms.ComboBox(); 49 | this.label1 = new System.Windows.Forms.Label(); 50 | this.label2 = new System.Windows.Forms.Label(); 51 | this.decorationbox = new System.Windows.Forms.ComboBox(); 52 | this.Decoration = new System.Windows.Forms.Label(); 53 | this.save_but = new System.Windows.Forms.Button(); 54 | this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); 55 | this.add_but = new System.Windows.Forms.Button(); 56 | this.del_but = new System.Windows.Forms.Button(); 57 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); 58 | this.SuspendLayout(); 59 | // 60 | // decortypebox 61 | // 62 | this.decortypebox.FormattingEnabled = true; 63 | this.decortypebox.Items.AddRange(new object[] { 64 | "Desk", 65 | "Chair", 66 | "Plant", 67 | "Ornament", 68 | "Mat", 69 | "Poster", 70 | "Doll", 71 | "Cushion"}); 72 | this.decortypebox.Location = new System.Drawing.Point(9, 38); 73 | this.decortypebox.Name = "decortypebox"; 74 | this.decortypebox.Size = new System.Drawing.Size(297, 21); 75 | this.decortypebox.TabIndex = 0; 76 | this.decortypebox.SelectedIndexChanged += new System.EventHandler(this.DecortypeboxSelectedIndexChanged); 77 | // 78 | // label1 79 | // 80 | this.label1.Location = new System.Drawing.Point(9, 16); 81 | this.label1.Name = "label1"; 82 | this.label1.Size = new System.Drawing.Size(100, 19); 83 | this.label1.TabIndex = 1; 84 | this.label1.Text = "Decoration type"; 85 | // 86 | // label2 87 | // 88 | this.label2.Location = new System.Drawing.Point(9, 73); 89 | this.label2.Name = "label2"; 90 | this.label2.Size = new System.Drawing.Size(100, 13); 91 | this.label2.TabIndex = 3; 92 | this.label2.Text = "Slot"; 93 | // 94 | // decorationbox 95 | // 96 | this.decorationbox.FormattingEnabled = true; 97 | this.decorationbox.Items.AddRange(new object[] { 98 | "Empty", 99 | "Small Desk", 100 | "Pokémon Desk", 101 | "Heavy Desk", 102 | "Ragged Desk", 103 | "Comfort Desk", 104 | "Pretty Desk", 105 | "Brick Desk", 106 | "Camp Desk", 107 | "Hard Desk"}); 108 | this.decorationbox.Location = new System.Drawing.Point(135, 88); 109 | this.decorationbox.Name = "decorationbox"; 110 | this.decorationbox.Size = new System.Drawing.Size(171, 21); 111 | this.decorationbox.TabIndex = 4; 112 | this.decorationbox.SelectedIndexChanged += new System.EventHandler(this.DecorationboxSelectedIndexChanged); 113 | // 114 | // Decoration 115 | // 116 | this.Decoration.Location = new System.Drawing.Point(135, 73); 117 | this.Decoration.Name = "Decoration"; 118 | this.Decoration.Size = new System.Drawing.Size(100, 13); 119 | this.Decoration.TabIndex = 5; 120 | this.Decoration.Text = "Decoration"; 121 | // 122 | // save_but 123 | // 124 | this.save_but.Location = new System.Drawing.Point(109, 130); 125 | this.save_but.Name = "save_but"; 126 | this.save_but.Size = new System.Drawing.Size(75, 23); 127 | this.save_but.TabIndex = 6; 128 | this.save_but.Text = "Save"; 129 | this.save_but.UseVisualStyleBackColor = true; 130 | this.save_but.Click += new System.EventHandler(this.Save_butClick); 131 | // 132 | // numericUpDown1 133 | // 134 | this.numericUpDown1.Location = new System.Drawing.Point(9, 89); 135 | this.numericUpDown1.Minimum = new decimal(new int[] { 136 | 1, 137 | 0, 138 | 0, 139 | 0}); 140 | this.numericUpDown1.Name = "numericUpDown1"; 141 | this.numericUpDown1.Size = new System.Drawing.Size(120, 20); 142 | this.numericUpDown1.TabIndex = 2; 143 | this.numericUpDown1.Value = new decimal(new int[] { 144 | 1, 145 | 0, 146 | 0, 147 | 0}); 148 | this.numericUpDown1.ValueChanged += new System.EventHandler(this.NumericUpDown1ValueChanged); 149 | // 150 | // add_but 151 | // 152 | this.add_but.Location = new System.Drawing.Point(312, 73); 153 | this.add_but.Name = "add_but"; 154 | this.add_but.Size = new System.Drawing.Size(37, 23); 155 | this.add_but.TabIndex = 7; 156 | this.add_but.Text = "Add"; 157 | this.add_but.UseVisualStyleBackColor = true; 158 | this.add_but.Click += new System.EventHandler(this.Add_butClick); 159 | // 160 | // del_but 161 | // 162 | this.del_but.Location = new System.Drawing.Point(312, 102); 163 | this.del_but.Name = "del_but"; 164 | this.del_but.Size = new System.Drawing.Size(37, 23); 165 | this.del_but.TabIndex = 8; 166 | this.del_but.Text = "Del"; 167 | this.del_but.UseVisualStyleBackColor = true; 168 | this.del_but.Click += new System.EventHandler(this.Del_butClick); 169 | // 170 | // Decor_editor 171 | // 172 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 173 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 174 | this.ClientSize = new System.Drawing.Size(366, 165); 175 | this.Controls.Add(this.del_but); 176 | this.Controls.Add(this.add_but); 177 | this.Controls.Add(this.save_but); 178 | this.Controls.Add(this.Decoration); 179 | this.Controls.Add(this.decorationbox); 180 | this.Controls.Add(this.label2); 181 | this.Controls.Add(this.numericUpDown1); 182 | this.Controls.Add(this.label1); 183 | this.Controls.Add(this.decortypebox); 184 | this.Name = "Decor_editor"; 185 | this.Text = "Decoration Inventory Editor"; 186 | ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit(); 187 | this.ResumeLayout(false); 188 | 189 | } 190 | } 191 | } 192 | -------------------------------------------------------------------------------- /wc3_tool/WC3/Decor_editor.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by SharpDevelop. 3 | * User: suloku 4 | * Date: 03/05/2016 5 | * Time: 17:34 6 | * 7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 8 | */ 9 | using System; 10 | using System.Collections.Generic; 11 | using System.ComponentModel; 12 | using System.Data; 13 | using System.Drawing; 14 | using System.Linq; 15 | using System.Text; 16 | using System.Windows.Forms; 17 | using System.IO; 18 | 19 | 20 | namespace WC3_TOOL 21 | { 22 | /// 23 | /// Description of Decor_editor. 24 | /// 25 | public partial class Decor_editor : Form 26 | { 27 | byte[] decorbuff; 28 | SAV3 sav3file; 29 | public string savfilter = MainScreen.savfilter; 30 | 31 | public Decor_editor(SAV3 save) 32 | { 33 | // 34 | // The InitializeComponent() call is required for Windows Forms designer support. 35 | // 36 | InitializeComponent(); 37 | sav3file = save; 38 | decorbuff = sav3file.get_decorations(); 39 | 40 | decortypebox.SelectedIndex = 0; 41 | numericUpDown1.Maximum = slots_max[decortypebox.SelectedIndex]; 42 | decorationbox.SelectedIndex = 0; 43 | 44 | load_decor(); 45 | 46 | // 47 | // TODO: Add constructor code after the InitializeComponent() call. 48 | // 49 | } 50 | 51 | void del_item() 52 | { 53 | int i; 54 | int offset = 0; 55 | for (i=0; i 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /wc3_tool/WC3/ECB_editor.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by SharpDevelop. 3 | * User: suloku 4 | * Date: 09/05/2016 5 | * Time: 0:59 6 | * 7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 8 | */ 9 | using System; 10 | using System.Collections.Generic; 11 | using System.ComponentModel; 12 | using System.Data; 13 | using System.Drawing; 14 | using System.Linq; 15 | using System.Text; 16 | using System.Windows.Forms; 17 | using System.IO; 18 | 19 | namespace WC3_TOOL 20 | { 21 | /// 22 | /// Description of ECB_editor. 23 | /// 24 | public partial class ECB_editor : Form 25 | { 26 | public ECB_editor() 27 | { 28 | // 29 | // The InitializeComponent() call is required for Windows Forms designer support. 30 | // 31 | InitializeComponent(); 32 | hap200.Minimum = -127; 33 | hap100.Minimum = -127; 34 | happ0.Minimum = -127; 35 | tr6_val.Minimum = 0; 36 | tr6_val.Maximum = 255; 37 | 38 | // 39 | // TODO: Add constructor code after the InitializeComponent() call. 40 | // 41 | } 42 | public string berryfilter = "e-card Berry file|*.ecb|All Files (*.*)|*.*"; 43 | public string berry_sp_filter = "All Files (*.*)|*.*"; 44 | public byte[] ecbbuffer; 45 | public byte[] spritebuf; 46 | public byte[] paletebuf; 47 | public static ECB ecbfile; 48 | 49 | void Load_ECB(string path) 50 | { 51 | int filesize = FileIO.load_file(ref ecbbuffer, ref path, berryfilter); 52 | if( filesize == ECB.SIZE_ECB ) 53 | { 54 | ecb_path.Text = path; 55 | ecbfile = new ECB(ecbbuffer); 56 | 57 | update_ecbData(); 58 | 59 | save_ecb_but.Enabled = true; 60 | palette_export_but.Enabled = true; 61 | palette_import_but.Enabled = true; 62 | sprite_export_but.Enabled = true; 63 | sprite_import_but.Enabled = true; 64 | 65 | }else{ 66 | MessageBox.Show("Invalid file size."); 67 | } 68 | } 69 | 70 | void Load_ecb_butClick(object sender, EventArgs e) 71 | { 72 | Load_ECB(null); 73 | } 74 | void Save_ecb_butClick(object sender, EventArgs e) 75 | { 76 | set_ecbData(); 77 | ecbfile.fix_berry_checksum(); 78 | //if (ecbfile.Edited) 79 | FileIO.save_data(ecbfile.Data, berryfilter); 80 | //else MessageBox.Show("Save has not been edited"); 81 | } 82 | void update_ecbData() 83 | { 84 | name.Text = ecbfile.NAME; 85 | firm_box.SelectedIndex = ecbfile.FIRMNESS-1; 86 | size.Value = ecbfile.SIZE; 87 | yield_max.Value = ecbfile.YIELD_MAX; 88 | yield_min.Value = ecbfile.YIELD_MIN; 89 | growth.Value = ecbfile.GROWTH; 90 | spicy.Value = ecbfile.SPICY; 91 | dry.Value = ecbfile.DRY; 92 | sweet.Value = ecbfile.SWEET; 93 | bitter.Value = ecbfile.BITTER; 94 | sour.Value = ecbfile.SOUR; 95 | smooth.Value = ecbfile.SMOOTH; 96 | 97 | desc1.Text = ecbfile.DESC_1; 98 | desc2.Text = ecbfile.DESC_2; 99 | 100 | held.Value = ecbfile.HITEM; 101 | 102 | heal_burn.Checked = ecbfile.TR_3_clearBurn; 103 | heal_confu.Checked = ecbfile.TR_3_clearConf; 104 | heal_ice.Checked = ecbfile.TR_3_clearIce; 105 | heal_inf.Checked = ecbfile.TR_0_healinfatuation; 106 | heal_para.Checked = ecbfile.TR_3_clearPar; 107 | heal_poison.Checked = ecbfile.TR_3_clearPoison; 108 | heal_sleep.Checked = ecbfile.TR_3_clearSleep; 109 | 110 | guard.Checked = ecbfile.TR_3_guardspec; 111 | lvlup.Checked = ecbfile.TR_3_lvlUP; 112 | 113 | firstpoke.Checked = ecbfile.TR_0_firstpkm; 114 | 115 | direhit.Value = ecbfile.TR_0_direhit; 116 | atkup.Value = ecbfile.TR_0_attackUP; 117 | defup.Value = ecbfile.TR_1_defUP; 118 | speedup.Value = ecbfile.TR_1_speedUP; 119 | spatkup.Value = ecbfile.TR_2_espUP; 120 | accurup.Value = ecbfile.TR_2_accUP; 121 | 122 | ev_hp.Checked = ecbfile.TR_4_hpEVUP; 123 | ev_atk.Checked = ecbfile.TR_4_atkEVUP; 124 | ev_def.Checked = ecbfile.TR_5_defEVUP; 125 | ev_speed.Checked = ecbfile.TR_5_spEVUP; 126 | ev_speatk.Checked = ecbfile.TR_5_spatkEVUP; 127 | ev_spedef.Checked = ecbfile.TR_5_spdefEVUP; 128 | 129 | if (ecbfile.HPRecovery != 0) 130 | tr6_val.Value = ecbfile.HPRecovery; 131 | else if (ecbfile.PPRecovery != 0) 132 | tr6_val.Value = ecbfile.PPRecovery; 133 | else if (ecbfile.EVchange != 0) 134 | tr6_val.Value = ecbfile.EVchange; 135 | //else if (ecbfile.HPRecovery == 0 && ecbfile.EVchange == 0 && ecbfile.PPRecovery == 0) 136 | // tr6_val.Enabled = false; 137 | 138 | heal_hp.Checked = ecbfile.TR_4_healHP; 139 | heal_pp.Checked = ecbfile.TR_4_healPP; 140 | selectedatk.Checked = ecbfile.TR_4_onlyatack; 141 | maxppUP.Checked = ecbfile.TR_4_maxPPUP; 142 | revive.Checked = ecbfile.TR_4_revive; 143 | stone.Checked = ecbfile.TR_4_stone; 144 | ppup.Checked = ecbfile.TR_5_ppMax; 145 | 146 | happy200.Checked = ecbfile.TR_5_happy200; 147 | happy100.Checked = ecbfile.TR_5_happy100; 148 | happy0.Checked = ecbfile.TR_5_happy0; 149 | 150 | if (happy200.Checked == true) 151 | hap200.Value = ecbfile.Happy200; 152 | else 153 | hap200.Value = 0; 154 | if (happy100.Checked == true) 155 | hap100.Value = ecbfile.Happy100; 156 | else 157 | hap100.Value = 0; 158 | if (happy0.Checked == true) 159 | happ0.Value = ecbfile.Happy0; 160 | else 161 | happ0.Value = 0; 162 | 163 | } 164 | 165 | void set_ecbData() 166 | { 167 | ecbfile.NAME = name.Text; 168 | ecbfile.FIRMNESS = (byte)(firm_box.SelectedIndex+1); 169 | ecbfile.SIZE = (UInt16) size.Value; 170 | ecbfile.YIELD_MAX = (byte)yield_max.Value; 171 | ecbfile.YIELD_MIN = (byte)yield_min.Value; 172 | ecbfile.GROWTH = (byte)growth.Value; 173 | ecbfile.SPICY = (byte)spicy.Value; 174 | ecbfile.DRY = (byte)dry.Value; 175 | ecbfile.SWEET = (byte)sweet.Value; 176 | ecbfile.BITTER = (byte)bitter.Value; 177 | ecbfile.SOUR = (byte)sour.Value; 178 | ecbfile.SMOOTH = (byte)smooth.Value; 179 | 180 | ecbfile.DESC_1 = desc1.Text; 181 | ecbfile.DESC_2 = desc2.Text; 182 | 183 | ecbfile.HITEM = (byte) held.Value; 184 | 185 | ecbfile.TR_3_clearBurn = heal_burn.Checked; 186 | ecbfile.TR_3_clearConf = heal_confu.Checked ; 187 | ecbfile.TR_3_clearIce = heal_ice.Checked; 188 | ecbfile.TR_0_healinfatuation = heal_inf.Checked; 189 | ecbfile.TR_3_clearPar = heal_para.Checked; 190 | ecbfile.TR_3_clearPoison = heal_poison.Checked; 191 | ecbfile.TR_3_clearSleep = heal_sleep.Checked; 192 | 193 | ecbfile.TR_3_guardspec = guard.Checked; 194 | ecbfile.TR_3_lvlUP = lvlup.Checked; 195 | 196 | ecbfile.TR_0_firstpkm = firstpoke.Checked; 197 | 198 | ecbfile.TR_0_direhit = (int)direhit.Value; 199 | ecbfile.TR_0_attackUP = (int)atkup.Value; 200 | ecbfile.TR_1_defUP = (int)defup.Value; 201 | ecbfile.TR_1_speedUP = (int)speedup.Value; 202 | ecbfile.TR_2_espUP = (int)spatkup.Value; 203 | ecbfile.TR_2_accUP = (int)accurup.Value; 204 | 205 | ecbfile.TR_4_hpEVUP = ev_hp.Checked; 206 | ecbfile.TR_4_atkEVUP = ev_atk.Checked; 207 | ecbfile.TR_5_defEVUP = ev_def.Checked; 208 | ecbfile.TR_5_spEVUP = ev_speed.Checked; 209 | ecbfile.TR_5_spatkEVUP = ev_speatk.Checked; 210 | ecbfile.TR_5_spdefEVUP = ev_spedef.Checked; 211 | 212 | ecbfile.TR_4_healHP = heal_hp.Checked; 213 | ecbfile.TR_4_healPP = heal_pp.Checked; 214 | ecbfile.TR_4_onlyatack = selectedatk.Checked; 215 | ecbfile.TR_4_maxPPUP = maxppUP.Checked; 216 | ecbfile.TR_4_revive = revive.Checked; 217 | ecbfile.TR_4_stone = stone.Checked; 218 | ecbfile.TR_5_ppMax = ppup.Checked; 219 | 220 | //Only put the first value found 221 | if (heal_hp.Checked == true) 222 | ecbfile.HPRecovery = (byte)tr6_val.Value; 223 | else if (heal_pp.Checked == true) 224 | ecbfile.PPRecovery = (byte)tr6_val.Value; 225 | else if (ev_hp.Checked == true || ev_atk.Checked == true || ev_def.Checked == true || ev_speed.Checked == true || ev_speatk.Checked == true || ev_spedef.Checked == true) 226 | ecbfile.EVchange = (sbyte)tr6_val.Value; 227 | 228 | ecbfile.TR_5_happy200 = happy200.Checked; 229 | ecbfile.TR_5_happy100 = happy100.Checked; 230 | ecbfile.TR_5_happy0 = happy0.Checked; 231 | 232 | ecbfile.Happy200 = (sbyte)hap200.Value; 233 | ecbfile.Happy100 = (sbyte)hap100.Value; 234 | ecbfile.Happy0 = (sbyte)happ0.Value; 235 | } 236 | void Held_helpClick(object sender, EventArgs e) 237 | { 238 | MessageBox.Show("Known values:\n00: No effect\n04: Cures poison (Drash Berry)\n05: Cures burn (Japanese Yago Berry)\n06: Cures freeze (Pumkin Berry)\n08: Cures confusion (Japanese Touga Berry)\n23: Restores a lowered stat (Japanese Ginema Berry)\n28: Cures infatuation (Eggant Berry)"); 239 | } 240 | void Sprite_export_butClick(object sender, EventArgs e) 241 | { 242 | FileIO.save_data(ecbfile.get_full_sprite(), berry_sp_filter); 243 | } 244 | void Sprite_import_butClick(object sender, EventArgs e) 245 | { 246 | string path = null; 247 | int filesize = FileIO.load_file(ref spritebuf, ref path, berry_sp_filter); 248 | if( filesize == ECB.SIZE_SPRITE+ECB.SIZE_PALETTE) 249 | { 250 | ecbfile.set_full_sprite(spritebuf); 251 | MessageBox.Show("Berry sprite injected."); 252 | 253 | }else if (filesize == -1){ 254 | ; 255 | }else{ 256 | MessageBox.Show("Invalid file size."); 257 | } 258 | } 259 | void Palette_import_butClick(object sender, EventArgs e) 260 | { 261 | string path = null; 262 | int filesize = FileIO.load_file(ref paletebuf, ref path, berry_sp_filter); 263 | if( filesize == ECB.SIZE_PALETTE) 264 | { 265 | ecbfile.set_palette(paletebuf); 266 | MessageBox.Show("Berry palette injected."); 267 | 268 | }else if (filesize == -1){ 269 | ; 270 | }else{ 271 | MessageBox.Show("Invalid file size."); 272 | } 273 | } 274 | void Palette_export_butClick(object sender, EventArgs e) 275 | { 276 | FileIO.save_data(ecbfile.get_palette(), berry_sp_filter); 277 | } 278 | void Sprite_helpClick(object sender, EventArgs e) 279 | { 280 | MessageBox.Show("To edit the berry sprite you may use \"Nameless Sprite Editor (NSE) 2.1 beta\".\nSave the berry sprite as \".gba\" file and open in NSE with \"Load ROM\" option, then click navigate and input this values:\n\tImage offset: 20\n\tPalette ofsset: 0\n\tWidth: 6\n\tHeight: 6\n\nThen click open and edit the sprite. To save it simply use file->save or control+S (palette can be edited too, use the palette editor's save button to save it).\n\nTo inject the berry sprite you can simply import the modified berry \".gba\" file"); 281 | } 282 | void Jap_encodingCheckedChanged(object sender, EventArgs e) 283 | { 284 | ecbfile.isjap = jap_encoding.Checked; 285 | name.Text = ecbfile.NAME; 286 | desc1.Text = ecbfile.DESC_1; 287 | desc2.Text = ecbfile.DESC_2; 288 | } 289 | void PphelpClick(object sender, EventArgs e) 290 | { 291 | MessageBox.Show("Healing HP and PP are mutually exclusive, you cannot heal PP and HP at the same time. HP takes precedence over PP if both are set. "); 292 | } 293 | void Modifier_helpClick(object sender, EventArgs e) 294 | { 295 | MessageBox.Show("PP restoring items have a maximum of 127.\nFor health restoration, 255 means max health, 254 means half max health, 253 is used by rare candy (only increase with level up).\nFor EV items, 0-127 increases EV, 128-255 decreases EV (128 is -1, 255 is -127)."); 296 | } 297 | void NoteClick(object sender, EventArgs e) 298 | { 299 | MessageBox.Show("Keep in mind that there are incompatibilities between flags. For example you can't make an HP restoring berry that also levels up a pokémon and expect it to be usable in battle, since a level up item can only be used from the bag."); 300 | } 301 | 302 | void ECB_editorDragEnter(object sender, DragEventArgs e) 303 | { 304 | e.Effect = DragDropEffects.All; 305 | } 306 | void ECB_editorDragDrop(object sender, DragEventArgs e) 307 | { 308 | string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, false); 309 | Load_ECB(files[0]); 310 | } 311 | } 312 | } 313 | -------------------------------------------------------------------------------- /wc3_tool/WC3/ECB_editor.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /wc3_tool/WC3/ECT.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by SharpDevelop. 3 | * User: suloku 4 | * Date: 03/05/2016 5 | * Time: 20:54 6 | * 7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 8 | */ 9 | using System; 10 | using System.Collections.Generic; 11 | using System.ComponentModel; 12 | using System.Data; 13 | using System.Drawing; 14 | using System.Linq; 15 | using System.Text; 16 | using System.Windows.Forms; 17 | using System.IO; 18 | 19 | namespace WC3_TOOL 20 | { 21 | /// 22 | /// Description of ECT. 23 | /// 24 | public class ECT 25 | { 26 | public const int SIZE_ECT = 188; 27 | 28 | // Global Settings 29 | // Save Data Attributes 30 | public byte[] Data; 31 | public bool Edited; 32 | public readonly bool Exportable; 33 | public readonly byte[] BAK; 34 | public string FileName, FilePath; 35 | public ECT(byte[] data) 36 | { 37 | Data = (byte[])(data ?? new byte[SIZE_ECT]).Clone(); 38 | BAK = (byte[])Data.Clone(); 39 | Exportable = !Data.SequenceEqual(new byte[Data.Length]); 40 | 41 | return; 42 | } 43 | public byte[] getData(int Offset, int Length) 44 | { 45 | return Data.Skip(Offset).Take(Length).ToArray(); 46 | } 47 | public void setData(byte[] input, int Offset) 48 | { 49 | input.CopyTo(Data, Offset); 50 | Edited = true; 51 | } 52 | public static UInt32 ect_checksum(int length, byte[] Data) 53 | { 54 | UInt32 Chk = 0; 55 | int i; 56 | length = length>>2; 57 | Chk=0; 58 | for(i=0; i', 85 | ':', 'Ä', 'Ö', 'Ü', 'ä', 'ö', 'ü', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', '#' 86 | }; 87 | public string gba2text(byte[] input) 88 | { 89 | string texto; 90 | texto = ""; 91 | foreach (byte value in input) 92 | { 93 | if (value == 0xFF) 94 | break; 95 | else{ 96 | string newtext = texto + SYMBOL[value].ToString(); 97 | texto = newtext; 98 | } 99 | } 100 | return texto; 101 | } 102 | public byte[] text2gba(string input, int len) 103 | { 104 | byte[] gbatext = new byte[len]; 105 | byte i = 0; 106 | int count = 0; 107 | foreach (char value in input) 108 | { 109 | 110 | for(i=0;i<0xFF;i++) 111 | { 112 | if (value == SYMBOL[i]) 113 | { 114 | if (i==0) 115 | { 116 | gbatext[count] = 0; 117 | break; 118 | } 119 | else 120 | { 121 | gbatext[count] = i; 122 | break; 123 | } 124 | } 125 | 126 | } 127 | 128 | //MessageBox.Show(gbatext[count].ToString("X")); 129 | count++; 130 | } 131 | if (count < len) 132 | gbatext[count] = 0xFF; 133 | return gbatext; 134 | } 135 | } 136 | } 137 | -------------------------------------------------------------------------------- /wc3_tool/WC3/ECT_editor.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /wc3_tool/WC3/ECT_pkedit.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by SharpDevelop. 3 | * User: suloku 4 | * Date: 04/05/2016 5 | * Time: 13:42 6 | * 7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 8 | */ 9 | using System; 10 | using System.Collections.Generic; 11 | using System.ComponentModel; 12 | using System.Data; 13 | using System.Drawing; 14 | using System.Linq; 15 | using System.Text; 16 | using System.Windows.Forms; 17 | using System.IO; 18 | 19 | namespace WC3_TOOL 20 | { 21 | /// 22 | /// Description of ECT_pkedit. 23 | /// 24 | public partial class ECT_pkedit : Form 25 | { 26 | public ECT_pkedit(int index) 27 | { 28 | // 29 | // The InitializeComponent() call is required for Windows Forms designer support. 30 | // 31 | InitializeComponent(); 32 | pid.Maximum = 0xFFFFFFFF; 33 | pk = 0x34+(index*44); 34 | populate(); 35 | 36 | // 37 | // TODO: Add constructor code after the InitializeComponent() call. 38 | // 39 | } 40 | int pk; 41 | //byte nickname; 42 | 43 | public UInt32 IV32 { get { return BitConverter.ToUInt32(ECT_editor.ectfile.Data, pk+0x18); } set { BitConverter.GetBytes((UInt32)value).CopyTo(ECT_editor.ectfile.Data, 0x18); } } 44 | public int IV_HP { get { return (int)(IV32 >> 00) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 00)) | (uint)((value > 31 ? 31 : value) << 00)); } } 45 | public int IV_ATK { get { return (int)(IV32 >> 05) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 05)) | (uint)((value > 31 ? 31 : value) << 05)); } } 46 | public int IV_DEF { get { return (int)(IV32 >> 10) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 10)) | (uint)((value > 31 ? 31 : value) << 10)); } } 47 | public int IV_SPE { get { return (int)(IV32 >> 15) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 15)) | (uint)((value > 31 ? 31 : value) << 15)); } } 48 | public int IV_SPA { get { return (int)(IV32 >> 20) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 20)) | (uint)((value > 31 ? 31 : value) << 20)); } } 49 | public int IV_SPD { get { return (int)(IV32 >> 25) & 0x1F; } set { IV32 = (uint)((IV32 & ~(0x1F << 25)) | (uint)((value > 31 ? 31 : value) << 25)); } } 50 | public int IV_Ability { get { return (int)((IV32 >> 31) & 1); } set { IV32 = (IV32 & 0x7FFFFFFF) | (value == 1 ? 0x80000000 : 0); } } 51 | 52 | public byte PPUP { get { return ECT_editor.ectfile.Data[pk+0xD]; } set { ECT_editor.ectfile.Data[pk+0xD] = value; } } 53 | public int PPUP_1 { get { return (int)(PPUP >> 00) & 0x03; } set { PPUP = (byte)((PPUP & ~(0x03 << 00)) | (byte)((value > 3 ? 3 : value) << 00)); } } 54 | public int PPUP_2 { get { return (int)(PPUP >> 02) & 0x03; } set { PPUP = (byte)((PPUP & ~(0x03 << 02)) | (byte)((value > 3 ? 3 : value) << 02)); } } 55 | public int PPUP_3 { get { return (int)(PPUP >> 04) & 0x03; } set { PPUP = (byte)((PPUP & ~(0x03 << 04)) | (byte)((value > 3 ? 3 : value) << 04)); } } 56 | public int PPUP_4 { get { return (int)(PPUP >> 06) & 0x03; } set { PPUP = (byte)((PPUP & ~(0x03 << 06)) | (byte)((value > 3 ? 3 : value) << 06)); } } 57 | 58 | void populate() 59 | { 60 | item_box.SelectedIndex = BitConverter.ToUInt16( ECT_editor.ectfile.getData(pk+0x2, 2), 0); 61 | namebox.Text = PKHeX.PKM.getG3Str(ECT_editor.ectfile.getData(pk+0x20, 11), jap_check.Checked); 62 | 63 | move1.SelectedIndex = BitConverter.ToUInt16( ECT_editor.ectfile.getData(pk+0x4, 2), 0); 64 | move2.SelectedIndex = BitConverter.ToUInt16( ECT_editor.ectfile.getData(pk+0x6, 2), 0); 65 | move3.SelectedIndex = BitConverter.ToUInt16( ECT_editor.ectfile.getData(pk+0x8, 2), 0); 66 | move4.SelectedIndex = BitConverter.ToUInt16( ECT_editor.ectfile.getData(pk+0xA, 2), 0); 67 | 68 | pp1.Value = PPUP_1; 69 | pp2.Value = PPUP_2; 70 | pp3.Value = PPUP_3; 71 | pp4.Value = PPUP_4; 72 | 73 | level.Value = ECT_editor.ectfile.Data[pk+0x0C]; 74 | friendship.Value = ECT_editor.ectfile.Data[pk+0x2B]; 75 | 76 | otid.Value = BitConverter.ToUInt16( ECT_editor.ectfile.getData(pk+0x14, 2), 0); 77 | otsid.Value = BitConverter.ToUInt16( ECT_editor.ectfile.getData(pk+0x16, 2), 0); 78 | 79 | pid.Value = BitConverter.ToUInt32( ECT_editor.ectfile.getData(pk+0x1c, 4), 0); 80 | 81 | ev1.Value = ECT_editor.ectfile.Data[pk+0x0E]; 82 | ev2.Value = ECT_editor.ectfile.Data[pk+0x0F]; 83 | ev3.Value = ECT_editor.ectfile.Data[pk+0x10]; 84 | ev4.Value = ECT_editor.ectfile.Data[pk+0x11]; 85 | ev5.Value = ECT_editor.ectfile.Data[pk+0x12]; 86 | ev6.Value = ECT_editor.ectfile.Data[pk+0x13]; 87 | 88 | iv1.Value = IV_HP; 89 | iv2.Value = IV_ATK; 90 | iv3.Value = IV_DEF; 91 | iv4.Value = IV_SPE; 92 | iv5.Value = IV_SPA; 93 | iv6.Value = IV_SPD; 94 | 95 | ability.Value = IV_Ability; 96 | 97 | } 98 | 99 | void save_edits() 100 | { 101 | ECT_editor.ectfile.setData(BitConverter.GetBytes((UInt16)item_box.SelectedIndex).ToArray(),pk+0x2); 102 | 103 | ECT_editor.ectfile.setData(PKHeX.PKM.setG3Str(namebox.Text, jap_check.Checked), pk+0x20); 104 | 105 | ECT_editor.ectfile.setData(BitConverter.GetBytes((UInt16)move1.SelectedIndex).ToArray(),pk+0x4); 106 | ECT_editor.ectfile.setData(BitConverter.GetBytes((UInt16)move2.SelectedIndex).ToArray(),pk+0x6); 107 | ECT_editor.ectfile.setData(BitConverter.GetBytes((UInt16)move3.SelectedIndex).ToArray(),pk+0x8); 108 | ECT_editor.ectfile.setData(BitConverter.GetBytes((UInt16)move4.SelectedIndex).ToArray(),pk+0xA); 109 | 110 | PPUP_1 = (int)pp1.Value; 111 | PPUP_2 = (int)pp1.Value; 112 | PPUP_3 = (int)pp1.Value; 113 | PPUP_4 = (int)pp1.Value; 114 | 115 | ECT_editor.ectfile.Data[pk+0x0C] = (byte) level.Value; 116 | ECT_editor.ectfile.Data[pk+0x2B] = (byte) friendship.Value; 117 | 118 | ECT_editor.ectfile.setData(BitConverter.GetBytes((UInt16)otid.Value).ToArray(), pk+0x14); 119 | ECT_editor.ectfile.setData(BitConverter.GetBytes((UInt16)otsid.Value).ToArray(), pk+0x16); 120 | 121 | ECT_editor.ectfile.setData(BitConverter.GetBytes((UInt32)pid.Value).ToArray(), pk+0x1c); 122 | 123 | 124 | ECT_editor.ectfile.Data[pk+0x0E] = (byte) ev1.Value; 125 | ECT_editor.ectfile.Data[pk+0x0F] = (byte) ev2.Value; 126 | ECT_editor.ectfile.Data[pk+0x10] = (byte) ev3.Value; 127 | ECT_editor.ectfile.Data[pk+0x11] = (byte) ev4.Value; 128 | ECT_editor.ectfile.Data[pk+0x12] = (byte) ev5.Value; 129 | ECT_editor.ectfile.Data[pk+0x13] = (byte) ev6.Value; 130 | 131 | 132 | IV_HP = (int)iv1.Value; 133 | IV_ATK = (int)iv1.Value; 134 | IV_DEF = (int)iv3.Value; 135 | IV_SPE = (int)iv4.Value; 136 | IV_SPA = (int)iv5.Value; 137 | IV_SPD = (int)iv6.Value; 138 | 139 | IV_Ability = (int)ability.Value; 140 | 141 | } 142 | 143 | void CancelClick(object sender, EventArgs e) 144 | { 145 | this.Close(); 146 | } 147 | void SaveClick(object sender, EventArgs e) 148 | { 149 | save_edits(); 150 | this.Close(); 151 | } 152 | void Jap_checkCheckedChanged(object sender, EventArgs e) 153 | { 154 | namebox.Text = PKHeX.PKM.getG3Str(ECT_editor.ectfile.getData(pk+0x20, 11), jap_check.Checked); 155 | } 156 | 157 | } 158 | 159 | } 160 | -------------------------------------------------------------------------------- /wc3_tool/WC3/ECT_pkedit.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /wc3_tool/WC3/FILEIO.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by SharpDevelop. 3 | * User: suloku 4 | * Date: 28/04/2016 5 | * Time: 21:23 6 | * 7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 8 | */ 9 | using System; 10 | using System.Collections.Generic; 11 | using System.ComponentModel; 12 | using System.Data; 13 | using System.Drawing; 14 | using System.Linq; 15 | using System.Text; 16 | using System.Windows.Forms; 17 | using System.IO; 18 | 19 | namespace WC3_TOOL 20 | { 21 | /// 22 | /// Description of FILEIO. 23 | /// 24 | public class FileIO 25 | { 26 | /// 27 | /// Reads data into a complete array, throwing an EndOfStreamException 28 | /// if the stream runs out of data first, or if an IOException 29 | /// naturally occurs. 30 | /// 31 | /// The stream to read data from 32 | /// The array to read bytes into. The array 33 | /// will be completely filled from the stream, so an appropriate 34 | /// size must be given. 35 | private static void ReadWholeArray (Stream stream, ref byte[] data) 36 | { 37 | int offset=0; 38 | int remaining = data.Length; 39 | while (remaining > 0) 40 | { 41 | int read = stream.Read(data, offset, remaining); 42 | if (read <= 0) 43 | throw new EndOfStreamException 44 | (String.Format("End of stream reached with {0} bytes left to read", remaining)); 45 | remaining -= read; 46 | offset += read; 47 | } 48 | } 49 | private static void _read_data(ref byte [] buffer, string path) 50 | { 51 | System.IO.FileStream saveFile; 52 | saveFile = new FileStream(path, FileMode.Open); 53 | if (saveFile.Length < 1){ 54 | MessageBox.Show("Invalid file length", "Error"); 55 | return; 56 | } 57 | buffer = new byte[saveFile.Length]; 58 | //MessageBox.Show(buffer.Length.ToString()); 59 | ReadWholeArray(saveFile, ref buffer); 60 | saveFile.Close(); 61 | return; 62 | } 63 | public static int load_file(ref byte[] buffer, ref string path, string filter) 64 | { 65 | if (path == null) 66 | { 67 | OpenFileDialog openFD = new OpenFileDialog(); 68 | //openFD.InitialDirectory = "c:\\"; 69 | openFD.Filter = filter; 70 | DialogResult result = openFD.ShowDialog(); 71 | if ( result == DialogResult.OK) 72 | { 73 | #region filename 74 | path = openFD.FileName; 75 | //MessageBox.Show(path.ToString()); 76 | #endregion 77 | _read_data(ref buffer, path); 78 | //MessageBox.Show(buffer.Length.ToString()); 79 | return buffer.Length; 80 | }else{ 81 | return -1; 82 | } 83 | }else 84 | { 85 | _read_data(ref buffer, path); 86 | //MessageBox.Show(buffer.Length.ToString()); 87 | return buffer.Length; 88 | } 89 | 90 | } 91 | public static void save_data(byte[] buffer, string filter) 92 | { //if (savegamename.Text.Length < 1) return; 93 | if (buffer == null) return; 94 | SaveFileDialog saveFD = new SaveFileDialog(); 95 | //saveFD.InitialDirectory = "c:\\"; 96 | saveFD.Filter = filter; 97 | if (saveFD.ShowDialog() == DialogResult.OK) 98 | { 99 | System.IO.FileStream saveFile; 100 | saveFile = new FileStream(saveFD.FileName, FileMode.Create); 101 | //Write file 102 | saveFile.Write(buffer, 0, buffer.Length); 103 | saveFile.Close(); 104 | MessageBox.Show("File Saved.", "Save file"); 105 | } 106 | } 107 | } 108 | } 109 | -------------------------------------------------------------------------------- /wc3_tool/WC3/ME3.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by SharpDevelop. 3 | * User: suloku 4 | * Date: 02/05/2016 5 | * Time: 23:22 6 | * 7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 8 | */ 9 | using System; 10 | using System.Collections.Generic; 11 | using System.ComponentModel; 12 | using System.Data; 13 | using System.Drawing; 14 | using System.Linq; 15 | using System.Text; 16 | using System.Windows.Forms; 17 | using System.IO; 18 | 19 | namespace WC3_TOOL 20 | { 21 | /// 22 | /// Description of ME3. 23 | /// 24 | public class ME3 25 | { 26 | 27 | public int isemerald = -1; 28 | 29 | // Global Settings 30 | // Save Data Attributes 31 | public byte[] Data; 32 | public bool Edited; 33 | public readonly bool Exportable; 34 | public readonly byte[] BAK; 35 | public string FileName, FilePath; 36 | private int me3_size; 37 | 38 | public ME3(byte[] data, int size) 39 | { 40 | me3_size = size; 41 | Data = (byte[])(data ?? new byte[me3_size]).Clone(); 42 | BAK = (byte[])Data.Clone(); 43 | Exportable = !Data.SequenceEqual(new byte[Data.Length]); 44 | 45 | isEmerald(); 46 | 47 | return; 48 | } 49 | 50 | public int isEmerald() 51 | { 52 | //Get checksum in script 53 | UInt32 chk_scr = BitConverter.ToUInt32(getData(0, 4), 0); 54 | 55 | //RS checksum 56 | UInt32 chk_RS = me3_checksum(getData(4, me3_size-4-8), me3_size-4-8); 57 | 58 | //E checksum 59 | UInt32 chk_E = (UInt32) wc3.wc_checksum(getData(4, me3_size-4-8), me3_size-4-8, 0); 60 | 61 | if (chk_scr == chk_RS) 62 | { 63 | isemerald = 0; 64 | return isemerald; 65 | }else if (chk_scr == chk_E) 66 | { 67 | isemerald = 1; 68 | return isemerald; 69 | }else{ 70 | DialogResult dialogResult = MessageBox.Show("ME3 file script has wrong checksum. Is this a Ruby/Sapphire mystery event?", "Wrong checksum", MessageBoxButtons.YesNo); 71 | if(dialogResult == DialogResult.Yes) 72 | { 73 | isemerald = 0; 74 | } 75 | else if (dialogResult == DialogResult.No) 76 | { 77 | isemerald = 1; 78 | } 79 | return isemerald; 80 | } 81 | } 82 | 83 | public byte[] getData(int Offset, int Length) 84 | { 85 | return Data.Skip(Offset).Take(Length).ToArray(); 86 | } 87 | public void setData(byte[] input, int Offset) 88 | { 89 | input.CopyTo(Data, Offset); 90 | Edited = true; 91 | } 92 | 93 | public byte MAP_BANK { get { return Data[0x05]; } set { Data[0x05] = (byte) value; } } 94 | public byte MAP_MAP { get { return Data[0x06]; } set { Data[0x06] = (byte) value; } } 95 | public byte MAP_PERSON { get { return Data[0x07]; } set { Data[0x07] = (byte) value; } } 96 | 97 | public byte[] get_script() 98 | { 99 | 100 | int scriptsize=0; 101 | int i = 0; 102 | for (i=0; i 3) 121 | BitConverter.GetBytes(address).CopyTo(xse_export, 0); 122 | MessageBox.Show("Open script in XSE at address 0x"+address.ToString("X")); 123 | //Set script to buffer 124 | getData(0x8, 996).CopyTo(xse_export, address); 125 | return xse_export; 126 | } 127 | public void set_script(byte[] newscript) 128 | { 129 | //Clear existing script 130 | int i = 0; 131 | for (i=8; i<996+8; i++) 132 | { 133 | Data[i] = 0x00; 134 | } 135 | UInt32 header = 0x01010833; 136 | setData(BitConverter.GetBytes(header).ToArray(), 4); 137 | setData(newscript, 8); 138 | } 139 | 140 | public void set_script_XSE(byte[] newscript) 141 | { 142 | //Clear existing script 143 | int i = 0; 144 | for (i=8; i<996+8; i++) 145 | { 146 | Data[i] = 0x00; 147 | } 148 | //Get address to script 149 | UInt32 address = BitConverter.ToUInt32(newscript, 4); 150 | 151 | UInt32 header = 0x01010833; 152 | setData(BitConverter.GetBytes(header).ToArray(), 4); 153 | setData(newscript.Skip((int)address).ToArray(), 8); 154 | } 155 | 156 | public byte get_item_amount() 157 | { 158 | return getData(me3_size-4, 1)[0]; 159 | } 160 | public byte get_item_counter() 161 | { 162 | return getData(me3_size-3, 1)[0]; 163 | } 164 | public UInt16 get_item() 165 | { 166 | return BitConverter.ToUInt16(getData(me3_size-2, 2), 0); 167 | } 168 | public void set_item_amount(byte amount) 169 | { 170 | Data[me3_size-4] = amount; 171 | } 172 | public void set_item_counter(byte counter) 173 | { 174 | Data[me3_size-3] = counter; 175 | } 176 | public void set_item(UInt16 item) 177 | { 178 | setData( BitConverter.GetBytes(item).ToArray(), me3_size-2); 179 | } 180 | 181 | public static UInt32 me3_checksum(byte[] buffer, int length) 182 | { 183 | int i=0; 184 | UInt32 Chk = 0; 185 | for(i=0; i 22 | /// Description of ME3_editor. 23 | /// 24 | public partial class ME3_editor : Form 25 | { 26 | public ME3_editor() 27 | { 28 | // 29 | // The InitializeComponent() call is required for Windows Forms designer support. 30 | // 31 | InitializeComponent(); 32 | 33 | // 34 | // TODO: Add constructor code after the InitializeComponent() call. 35 | // 36 | } 37 | 38 | public string me3filter = "Mystery Event file|*.me3|All Files (*.*)|*.*"; 39 | public string scriptfilter = "Script file|*.script|All Files (*.*)|*.*"; 40 | public string xsescriptfilter = "XSE padded script file|*.gba"; 41 | public byte[] me3buffer; 42 | public byte[] me3script_new; 43 | public static ME3 me3file; 44 | 45 | //private int me3size; 46 | 47 | void get_me3data() 48 | { 49 | amountbox.Value = me3file.get_item_amount(); 50 | counterbox.Value = me3file.get_item_counter(); 51 | itembox.SelectedIndex = me3file.get_item(); 52 | 53 | if(me3file.isemerald == 0)//These items aren't in emerald 54 | { 55 | if (itembox.SelectedIndex > 348) 56 | itembox.SelectedIndex = 348; 57 | }else{ 58 | if (itembox.SelectedIndex > 376) 59 | itembox.SelectedIndex = 376; 60 | } 61 | 62 | map_bank.Value = me3file.MAP_BANK; 63 | map_num.Value = me3file.MAP_MAP; 64 | map_npc.Value = me3file.MAP_PERSON; 65 | 66 | } 67 | 68 | void set_me3data() 69 | { 70 | me3file.set_item( (UInt16)itembox.SelectedIndex); 71 | me3file.set_item_amount( (byte) amountbox.Value); 72 | me3file.set_item_counter( (byte) counterbox.Value); 73 | 74 | me3file.MAP_BANK = (byte)map_bank.Value; 75 | me3file.MAP_MAP = (byte)map_num.Value; 76 | me3file.MAP_PERSON = (byte)map_npc.Value; 77 | 78 | if (radio_E.Checked == true) 79 | me3file.isemerald = 1; 80 | else if (radio_RS.Checked == true) 81 | me3file.isemerald = 0; 82 | } 83 | 84 | void Load_me3(string path) 85 | { 86 | int filesize = FileIO.load_file(ref me3buffer, ref path, me3filter); 87 | if( filesize == SAV3.ME3_SIZE_E || filesize == SAV3.ME3_SIZE_RS ) 88 | { 89 | 90 | radio_RS.Checked = false; 91 | radio_E.Checked = false; 92 | 93 | me3_path.Text = path; 94 | me3file = new ME3(me3buffer, filesize); 95 | 96 | switch (me3file.isemerald) 97 | { 98 | case 0: 99 | radio_RS.Checked = true; 100 | break; 101 | case 1: 102 | radio_E.Checked = true; 103 | break; 104 | } 105 | 106 | get_me3data(); 107 | 108 | save_me3_but.Enabled = true; 109 | removescript_but.Enabled = true; 110 | export_script_but.Enabled = true; 111 | import_script_but.Enabled = true; 112 | custom_script.Checked = false; 113 | script_check.Checked = true; 114 | 115 | }else{ 116 | MessageBox.Show("Invalid file size."); 117 | } 118 | } 119 | 120 | void Load_me3_butClick(object sender, EventArgs e) 121 | { 122 | Load_me3(null); 123 | 124 | } 125 | void ItemboxSelectedIndexChanged(object sender, EventArgs e) 126 | { 127 | if(me3file.isemerald == 0)//These items aren't in RS 128 | { 129 | if (itembox.SelectedIndex > 348){ 130 | itembox.SelectedIndex = 348; 131 | MessageBox.Show("Selected item is not available in Ruby/Sapphire."); 132 | } 133 | }else{ 134 | if (itembox.SelectedIndex > 376) 135 | itembox.SelectedIndex = 376; 136 | } 137 | } 138 | void Save_me3_butClick(object sender, EventArgs e) 139 | { 140 | set_me3data(); 141 | me3file.fix_me_script_checksum(); 142 | me3file.fix_me_item_checksum(); 143 | 144 | if (me3file.Edited) 145 | FileIO.save_data(me3file.Data, me3filter); 146 | else MessageBox.Show("Save has not been edited"); 147 | } 148 | void Export_script_butClick(object sender, EventArgs e) 149 | { 150 | FileIO.save_data(me3file.get_script(), scriptfilter); 151 | } 152 | void Import_script_butClick(object sender, EventArgs e) 153 | { 154 | string path = null; 155 | int filesize = FileIO.load_file(ref me3script_new, ref path, scriptfilter); 156 | if( filesize <= 996 ) 157 | { 158 | me3file.set_script(me3script_new); 159 | custom_script.Checked = true; 160 | script_check.Checked = me3file.has_script(); 161 | MessageBox.Show("Custom script imported."); 162 | 163 | }else{ 164 | MessageBox.Show("Invalid file size."); 165 | } 166 | } 167 | void CounterboxValueChanged(object sender, EventArgs e) 168 | { 169 | //Not sure about this anymore 170 | /*if (counterbox.Value > amountbox.Value) 171 | { 172 | MessageBox.Show("Counter can't be bigger than total amount"); 173 | counterbox.Value = amountbox.Value; 174 | }*/ 175 | } 176 | void Removescript_butClick(object sender, EventArgs e) 177 | { 178 | me3file.removeScript(); 179 | script_check.Checked = me3file.has_script(); 180 | } 181 | void Help_npcClick(object sender, EventArgs e) 182 | { 183 | MessageBox.Show("These values are used to associate the script to a NPC character in the game.\n\nYou can use Advance Map to locate the values for all NPC in the game.\n\nFather at petalburg Gym is Bank 08, Map 01, NPC 01."); 184 | } 185 | void Counter_helpClick(object sender, EventArgs e) 186 | { 187 | MessageBox.Show("Every time you mix records, this number decreases by 1, even if the item isn't transfered due to the other person already having it."); 188 | } 189 | void Amount_helpClick(object sender, EventArgs e) 190 | { 191 | MessageBox.Show("Should always be 1? Changing it has no apparent effect."); 192 | } 193 | void Item_helpClick(object sender, EventArgs e) 194 | { 195 | MessageBox.Show("The item will only be transfered via record mixing if receiver doesn't own the item."); 196 | } 197 | void Xse_exportClick(object sender, EventArgs e) 198 | { 199 | FileIO.save_data(me3file.get_script_XSE(), xsescriptfilter); 200 | } 201 | void Xse_importClick(object sender, EventArgs e) 202 | { 203 | string path = null; 204 | int filesize = FileIO.load_file(ref me3script_new, ref path, xsescriptfilter); 205 | if( filesize <= 1000 ) 206 | { 207 | me3file.set_script_XSE(me3script_new); 208 | custom_script.Checked = true; 209 | MessageBox.Show("Custom script imported."); 210 | 211 | }else{ 212 | MessageBox.Show("Invalid file size."); 213 | } 214 | } 215 | void Xse_helpClick(object sender, EventArgs e) 216 | { 217 | MessageBox.Show("XSE Export: exports the script with padding corresponding to base address of the script and *.gba extension. You can directly load (and edit) the script in XSE, script offset will be shown when using the export button.\nXSE Import: imports a *.gba script generated by this tool after editing (or not) with XSE (importing anything else will not correctly work).\n\nThese options are just for convenience, the scripts are in no way gba roms, but it's the more convenient way to edit them in XSE."); 218 | } 219 | 220 | void ME3_editorDragEnter(object sender, DragEventArgs e) 221 | { 222 | e.Effect = DragDropEffects.All; 223 | } 224 | void ME3_editorDragDrop(object sender, DragEventArgs e) 225 | { 226 | string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, false); 227 | Load_me3(files[0]); 228 | } 229 | } 230 | } 231 | -------------------------------------------------------------------------------- /wc3_tool/WC3/ME3_editor.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /wc3_tool/WC3/TV.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by SharpDevelop. 3 | * User: suloku 4 | * Date: 13/05/2016 5 | * Time: 14:03 6 | * 7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 8 | */ 9 | using System; 10 | using System.Collections.Generic; 11 | using System.ComponentModel; 12 | using System.Data; 13 | using System.Drawing; 14 | using System.Linq; 15 | using System.Text; 16 | using System.Windows.Forms; 17 | using System.IO; 18 | 19 | namespace WC3_TOOL 20 | { 21 | public class TV_EVENTS 22 | { 23 | private int tv_event_size = 0x4*16; 24 | 25 | public byte[] Data; 26 | 27 | public TV_EVENTS(byte[] data) 28 | { 29 | Data = (byte[])(data ?? new byte[tv_event_size]).Clone(); 30 | 31 | load_events(); 32 | 33 | return; 34 | } 35 | public byte[] getData(int Offset, int Length) 36 | { 37 | return Data.Skip(Offset).Take(Length).ToArray(); 38 | } 39 | public void setData(byte[] input, int Offset) 40 | { 41 | input.CopyTo(Data, Offset); 42 | } 43 | 44 | public EVENT[] events = new EVENT[16]; 45 | public void load_events() 46 | { 47 | int i=0; 48 | for(i=0;i<16;i++) 49 | { 50 | events[i] = new EVENT(getData(EVENT.event_size*i, EVENT.event_size)); 51 | } 52 | } 53 | public void set_events() 54 | { 55 | int i=0; 56 | for(i=0;i<16;i++) 57 | { 58 | setData(events[i].Data, EVENT.event_size*i); 59 | } 60 | } 61 | } 62 | public class TV_SHOWS 63 | { 64 | private int tv_size = 0x24*7; 65 | 66 | public byte[] Data; 67 | 68 | public TV_SHOWS(byte[] data) 69 | { 70 | Data = (byte[])(data ?? new byte[tv_size]).Clone(); 71 | 72 | load_shows(); 73 | 74 | return; 75 | } 76 | public byte[] getData(int Offset, int Length) 77 | { 78 | return Data.Skip(Offset).Take(Length).ToArray(); 79 | } 80 | public void setData(byte[] input, int Offset) 81 | { 82 | input.CopyTo(Data, Offset); 83 | } 84 | 85 | public SHOW[] shows = new SHOW[7]; 86 | public void load_shows() 87 | { 88 | int i=0; 89 | for(i=0;i<7;i++) 90 | { 91 | shows[i] = new SHOW(getData(SHOW.show_size*i, SHOW.show_size)); 92 | } 93 | } 94 | public void set_shows() 95 | { 96 | int i=0; 97 | for(i=0;i<7;i++) 98 | { 99 | setData(shows[i].Data, SHOW.show_size*i); 100 | } 101 | } 102 | } 103 | public class EVENT 104 | { 105 | public static int event_size = 0x4; 106 | 107 | public byte[] Data; 108 | public EVENT(byte[] data) 109 | { 110 | Data = (byte[])(data ?? new byte[event_size]).Clone(); 111 | } 112 | public byte[] getData(int Offset, int Length) 113 | { 114 | return Data.Skip(Offset).Take(Length).ToArray(); 115 | } 116 | public void setData(byte[] input, int Offset) 117 | { 118 | input.CopyTo(Data, Offset); 119 | } 120 | public byte ID 121 | { 122 | get{ return Data[0x0];} 123 | set{ Data[0x0] = (byte)value;} 124 | } 125 | public byte status 126 | { 127 | 128 | get{ return Data[0x1];} 129 | set{ Data[0x1] = (byte)value;} 130 | } 131 | public UInt16 days_to_tv 132 | { 133 | get{ return BitConverter.ToUInt16(getData(0x2, 2), 0);} 134 | set{ setData(BitConverter.GetBytes((UInt16)value), 0x2);} 135 | } 136 | } 137 | /* 138 | Offsets 139 | RAM 0x281F0 - 0x2822F (RS) 140 | 0x28550 - 0x2858F (E) 141 | 142 | Save Section 3 0xBBC - 0xBFB (RS) 143 | Section 3 0xC50 - 0xC8F (E) 144 | 145 | 146 | Structure 147 | 0x01 Event ID 148 | 0x02 Status (0 - seen, 1 - not yet seen, 2 - seen + event active) 149 | 0x03 - 0x04 Days remaining until event is active (announcement starts 2 days before) 150 | 151 | Event ID 152 | 1 Big Sale (Slateport Energy Guru) 153 | 2 Service Day (Mauville Game Corner) 154 | 3 Clear-Out-Sale (Lilycove Department Store) 155 | 4 Blend Master (Lilycove Contest Hall) (Emerald only!) 156 | */ 157 | public class SHOW 158 | { 159 | public static int show_size = 0x24; 160 | 161 | public byte[] Data; 162 | public SHOW(byte[] data) 163 | { 164 | Data = (byte[])(data ?? new byte[show_size]).Clone(); 165 | } 166 | public byte[] getData(int Offset, int Length) 167 | { 168 | return Data.Skip(Offset).Take(Length).ToArray(); 169 | } 170 | public void setData(byte[] input, int Offset) 171 | { 172 | input.CopyTo(Data, Offset); 173 | } 174 | 175 | //Data common to all shows 176 | public byte ID 177 | { 178 | get{ return Data[0x0];} 179 | set{ Data[0x0] = (byte)value;} 180 | } 181 | public byte status 182 | { 183 | 184 | get{ return Data[0x1];} 185 | set{ Data[0x1] = (byte)value;} 186 | } 187 | /* 188 | public bool status 189 | { 190 | 191 | get{ if(Data[0x1] == 1) return true; else return false;} 192 | set{ if (value == true) Data[0x1] = 0x01; else Data[0x1] = 0;} 193 | } 194 | */ 195 | public UInt16 TID_own 196 | { 197 | get{ return BitConverter.ToUInt16(getData(0x20, 2), 0);} 198 | set{ setData(BitConverter.GetBytes((UInt16)value), 0x20);} 199 | } 200 | public UInt16 TID_mixed 201 | { 202 | get{ return BitConverter.ToUInt16(getData(0x22, 2), 0);} 203 | set{ setData(BitConverter.GetBytes((UInt16)value), 0x22);} 204 | } 205 | 206 | //Data dependent of show 207 | 208 | //ID 0x29 (Outbreak) 209 | 210 | public UInt16 outbreak_move1 211 | { 212 | get{ return BitConverter.ToUInt16(getData(0x04, 2), 0);} 213 | set{ setData(BitConverter.GetBytes((UInt16)value), 0x04);} 214 | } 215 | public UInt16 outbreak_move2 216 | { 217 | get{ return BitConverter.ToUInt16(getData(0x06, 2), 0);} 218 | set{ setData(BitConverter.GetBytes((UInt16)value), 0x06);} 219 | } 220 | public UInt16 outbreak_move3 221 | { 222 | get{ return BitConverter.ToUInt16(getData(0x08, 2), 0);} 223 | set{ setData(BitConverter.GetBytes((UInt16)value), 0x08);} 224 | } 225 | public UInt16 outbreak_move4 226 | { 227 | get{ return BitConverter.ToUInt16(getData(0x0A, 2), 0);} 228 | set{ setData(BitConverter.GetBytes((UInt16)value), 0x0A);} 229 | } 230 | public UInt16 outbreak_species 231 | { 232 | get{ return BitConverter.ToUInt16(getData(0xC, 2), 0);} 233 | set{ setData(BitConverter.GetBytes((UInt16)value), 0xC);} 234 | } 235 | public UInt16 outbreak_map 236 | { 237 | get{ return BitConverter.ToUInt16(getData(0x10, 2), 0);} 238 | set{ setData(BitConverter.GetBytes((UInt16)value), 0x10);} 239 | } 240 | public byte outbreak_level 241 | { 242 | get{ return Data[0x14];} 243 | set{ Data[0x14] = (byte)value;} 244 | } 245 | public byte outbreak_appearance 246 | { 247 | get{ return Data[0x13];} 248 | set{ Data[0x13] = (byte)value;} 249 | } 250 | public UInt16 outbreak_days_to_tv 251 | { 252 | get{ return BitConverter.ToUInt16(getData(0x16, 2), 0);} 253 | set{ setData(BitConverter.GetBytes((UInt16)value), 0x16);} 254 | } 255 | public UInt16 outbreak_remaining_days 256 | { 257 | get{ return BitConverter.ToUInt16(getData(0x18, 2), 0);} 258 | set{ setData(BitConverter.GetBytes((UInt16)value), 0x18);} 259 | } 260 | //End of outbreak data 261 | } 262 | /* 263 | Outbreak TV Show 264 | When you watched the Outbreak announcement, data gets written to the Extra Data (see below). 265 | 266 | Offsets 267 | RAM 0x27E6C - 0x281CB (RS) 268 | 0x281CC - 0x2852B (E) 269 | Save Section 3 0x838 - 0xB97 (RS) 270 | Section 3 0x8CC - 0xC2B (E) 271 | 272 | Structure 273 | 0x00 Show ID (0x29 for Outbreak) 274 | 0x01 Status (0 - seen, 1 - not yet seen; you can't see the announcement if you already have an active outbreak) 275 | 0x02 - 0x03 00 00 276 | 0x04 - 0x05 Move 1 277 | 0x06 - 0x07 Move 2 278 | 0x08 - 0x09 Move 3 279 | 0x0A - 0x0B Move 4 280 | 0x0C - 0x0D Species ID 281 | 0x0E - 0x0F 00 00 282 | 0x10 - 0x11 Location Map Index (use Advance Map to see them) 283 | 0x12 00 284 | 0x13 Appearance rate (50% (0x32) by default) 285 | 0x14 Level 286 | 0x15 00 287 | 0x16 - 0x17 Days remaining until show is on TV (set to 1 if received via record mixing) 288 | 0x18 - 0x19 Days the outbreak will last (2 by default) 289 | 0x1A - 0x1F 00 00 00 00 00 00 290 | 0x20 - 0x21 Own Trainer ID 291 | 0x22 - 0x23 Trainer ID of the game from which the data was received via record mixing 292 | */ 293 | public class SWARM 294 | { 295 | public static int swarm_size = 0x14; 296 | 297 | public byte[] Data; 298 | public SWARM(byte[] data) 299 | { 300 | Data = (byte[])(data ?? new byte[swarm_size]).Clone(); 301 | } 302 | public byte[] getData(int Offset, int Length) 303 | { 304 | return Data.Skip(Offset).Take(Length).ToArray(); 305 | } 306 | public void setData(byte[] input, int Offset) 307 | { 308 | input.CopyTo(Data, Offset); 309 | } 310 | 311 | public UInt16 species 312 | { 313 | get{ return BitConverter.ToUInt16(getData(0, 2), 0);} 314 | set{ setData(BitConverter.GetBytes((UInt16)value), 0);} 315 | } 316 | public UInt16 map 317 | { 318 | get{ return BitConverter.ToUInt16(getData(2, 2), 0);} 319 | set{ setData(BitConverter.GetBytes((UInt16)value), 2);} 320 | } 321 | public byte level 322 | { 323 | get{ return Data[0x4];} 324 | set{ Data[0x4] = (byte)value;} 325 | } 326 | public UInt16 move1 327 | { 328 | get{ return BitConverter.ToUInt16(getData(0x08, 2), 0);} 329 | set{ setData(BitConverter.GetBytes((UInt16)value), 0x08);} 330 | } 331 | public UInt16 move2 332 | { 333 | get{ return BitConverter.ToUInt16(getData(0x0A, 2), 0);} 334 | set{ setData(BitConverter.GetBytes((UInt16)value), 0x0A);} 335 | } 336 | public UInt16 move3 337 | { 338 | get{ return BitConverter.ToUInt16(getData(0x0C, 2), 0);} 339 | set{ setData(BitConverter.GetBytes((UInt16)value), 0x0C);} 340 | } 341 | public UInt16 move4 342 | { 343 | get{ return BitConverter.ToUInt16(getData(0x0E, 2), 0);} 344 | set{ setData(BitConverter.GetBytes((UInt16)value), 0x0E);} 345 | } 346 | public byte appearance 347 | { 348 | get{ return Data[0x11];} 349 | set{ Data[0x11] = (byte)value;} 350 | } 351 | public byte remaining_days 352 | { 353 | get{ return Data[0x12];} 354 | set{ Data[0x12] = (byte)value;} 355 | } 356 | } 357 | } 358 | 359 | /* 360 | Outbreak Extra Data 361 | When you watched the Outbreak announcement, data gets written here. 362 | It's stored here until the counter at 0x12 reaches 0. 363 | 364 | Offsets 365 | RAM 0x28230 - 0x28243 (RS) 366 | 0x28590 - 0x285A3 (E) 367 | Save Section 3 0xBFC - 0xC0F (RS) 368 | Section 3 0xC90 - 0xCA3 (E) 369 | 370 | Structure 371 | 0x00 - 0x01 Species ID 372 | 0x02 - 0x03 Location Map Index (use Advance Map to see them) 373 | 0x04 Level 374 | 0x05 - 0x07 00 00 00 375 | 0x08 - 0x09 Move 1 376 | 0x0A - 0x0B Move 2 377 | 0x0C - 0x0D Move 3 378 | 0x0E - 0x0F Move 4 379 | 0x10 00 380 | 0x11 Appearance rate (50% (0x32) by default) 381 | 0x12 Days the outbreak will last (2 by default; counts down daily) 382 | */ -------------------------------------------------------------------------------- /wc3_tool/WC3/TV_editor.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by SharpDevelop. 3 | * User: suloku 4 | * Date: 13/05/2016 5 | * Time: 14:03 6 | * 7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 8 | */ 9 | using System; 10 | using System.Drawing; 11 | using System.Windows.Forms; 12 | 13 | namespace WC3_TOOL 14 | { 15 | /// 16 | /// Description of TV_editor. 17 | /// 18 | public partial class TV_editor : Form 19 | { 20 | 21 | SAV3 sav3file; 22 | public string savfilter = MainScreen.savfilter; 23 | 24 | //TV data 25 | TV_EVENTS events; 26 | SHOW ingame_swarm; 27 | TV_SHOWS shows; 28 | SWARM swarm; 29 | 30 | public TV_editor(SAV3 save) 31 | { 32 | InitializeComponent(); 33 | 34 | sav3file = save; 35 | 36 | events = new TV_EVENTS (sav3file.get_TV_EVENT()); 37 | ingame_swarm = new SHOW(sav3file.get_TV_OUTBREAK()); 38 | shows = new TV_SHOWS(sav3file.get_TV_SHOWS()); 39 | swarm = new SWARM(sav3file.get_TV_OUTBREAK_EXTRA()); 40 | 41 | load_data(); 42 | 43 | } 44 | 45 | void load_data() 46 | { 47 | load_event(); 48 | load_swarm(); 49 | load_show(); 50 | } 51 | 52 | void load_event() 53 | { 54 | event_id.SelectedIndex = events.events[(int)event_slot.Value].ID; 55 | event_status.SelectedIndex = events.events[(int)event_slot.Value].status; 56 | event_days.Value = events.events[(int)event_slot.Value].days_to_tv; 57 | } 58 | void set_event() 59 | { 60 | events.events[(int)event_slot.Value].ID = (byte)event_id.SelectedIndex; 61 | events.events[(int)event_slot.Value].status = (byte)event_status.SelectedIndex; 62 | events.events[(int)event_slot.Value].days_to_tv = (UInt16)event_days.Value; 63 | } 64 | 65 | void load_swarm() 66 | { 67 | current_species.SelectedIndex = swarm.species; 68 | current_level.Value = swarm.level; 69 | current_move1.SelectedIndex = swarm.move1; 70 | current_move2.SelectedIndex = swarm.move2; 71 | current_move3.SelectedIndex = swarm.move3; 72 | current_move4.SelectedIndex = swarm.move4; 73 | current_map.Value = swarm.map; 74 | current_appearance.Value = swarm.appearance; 75 | current_remaining.Value = swarm.remaining_days; 76 | } 77 | void set_swarm() 78 | { 79 | swarm.species = (UInt16)current_species.SelectedIndex; 80 | swarm.level = (byte)current_level.Value; 81 | swarm.move1 = (UInt16)current_move1.SelectedIndex; 82 | swarm.move2 = (UInt16)current_move2.SelectedIndex; 83 | swarm.move3 = (UInt16)current_move3.SelectedIndex; 84 | swarm.move4 = (UInt16)current_move4.SelectedIndex; 85 | swarm.map = (UInt16)current_map.Value; 86 | swarm.appearance = (byte)current_appearance.Value; 87 | swarm.remaining_days = (byte)current_remaining.Value; 88 | } 89 | void load_show() 90 | { 91 | 92 | if (tv_slot.Value == 0) 93 | { 94 | tv_id.Value = ingame_swarm.ID; 95 | tv_status.SelectedIndex = ingame_swarm.status; 96 | tv_tid.Value = ingame_swarm.TID_own; 97 | tv_mix_tid.Value = ingame_swarm.TID_mixed; 98 | 99 | }else 100 | { 101 | tv_id.Value = shows.shows[(int)(tv_slot.Value-1)].ID; 102 | tv_status.SelectedIndex = shows.shows[(int)(tv_slot.Value-1)].status; 103 | tv_tid.Value = shows.shows[(int)(tv_slot.Value-1)].TID_own; 104 | tv_mix_tid.Value = shows.shows[(int)(tv_slot.Value-1)].TID_mixed; 105 | } 106 | 107 | load_outbreak(); 108 | } 109 | 110 | void Save_butClick(object sender, EventArgs e) 111 | { 112 | events.set_events(); 113 | shows.set_shows(); 114 | 115 | sav3file.set_TV_EVENT(events.Data); 116 | sav3file.set_TV_OUTBREAK(ingame_swarm.Data); 117 | sav3file.set_TV_SHOWS(shows.Data); 118 | sav3file.set_TV_OUTBREAK_EXTRA(swarm.Data); 119 | sav3file.update_section_chk(3); 120 | FileIO.save_data(sav3file.Data, savfilter); 121 | } 122 | void Event_slotValueChanged(object sender, EventArgs e) 123 | { 124 | load_event(); 125 | } 126 | void Swarm_deleteClick(object sender, EventArgs e) 127 | { 128 | delete_current_swarm(); 129 | load_swarm(); 130 | } 131 | void delete_current_swarm() 132 | { 133 | int i = 0; 134 | for (i=0; i 2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /wc3_tool/WC3/WC3_editor.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by SharpDevelop. 3 | * User: suloku 4 | * Date: 28/04/2016 5 | * Time: 21:22 6 | * 7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 8 | */ 9 | using System; 10 | using System.Collections.Generic; 11 | using System.ComponentModel; 12 | using System.Data; 13 | using System.Drawing; 14 | using System.Linq; 15 | using System.Text; 16 | using System.Windows.Forms; 17 | using System.IO; 18 | 19 | using PKHeX; 20 | 21 | using System.Reflection; 22 | using System.Resources; 23 | 24 | namespace WC3_TOOL 25 | { 26 | /// 27 | /// Description of MainForm. 28 | /// 29 | public partial class WC3_editor : Form 30 | { 31 | public WC3_editor() 32 | { 33 | // 34 | // The InitializeComponent() call is required for Windows Forms designer support. 35 | // 36 | InitializeComponent(); 37 | faketoogle.Checked = true; 38 | regionlab.Text = ""; 39 | GFX = this.CreateGraphics(); 40 | colorbox.SelectedIndex = 0; 41 | icon_num.Value = 0; 42 | 43 | // 44 | // TODO: Add constructor code after the InitializeComponent() call. 45 | // 46 | } 47 | public string wc3filter = "Wonder Card file|*.wc3|All Files (*.*)|*.*"; 48 | public string scriptfilter = "Script file|*.script|All Files (*.*)|*.*"; 49 | public string xsescriptfilter = "XSE padded script file|*.gba"; 50 | public byte[] wc3buffer; 51 | public byte[] wc3script_new; 52 | public static wc3 wc3file; 53 | 54 | public bool japanese = false; 55 | public static bool script_injected = false; 56 | 57 | private Graphics GFX; 58 | 59 | void update_iconbox() 60 | { 61 | iconbox.Enabled = true; 62 | if (icon_num.Value >= 1 && icon_num.Value <= 251){ 63 | iconbox.SelectedIndex = (UInt16)icon_num.Value; 64 | }/*else if (icon_num.Value >= 252 && icon_num.Value <= 276){ 65 | iconbox.Enabled = false; 66 | iconbox.SelectedIndex = 440; 67 | }*/else if (icon_num.Value >= 251 && icon_num.Value <= 440){ 68 | iconbox.SelectedIndex = (UInt16)icon_num.Value; 69 | }else if (icon_num.Value == 0xFFFF){ 70 | iconbox.SelectedIndex = 0; 71 | }else{ 72 | iconbox.Enabled = false; 73 | iconbox.SelectedIndex = 440; 74 | } 75 | } 76 | string fill_line(string line, int index) //Fills string with spaces to "erase" old content. 77 | { 78 | if (japanese == true) 79 | { 80 | switch (index) 81 | { 82 | case 0: 83 | while(line.Length < 18) 84 | { 85 | line = line + " "; 86 | } 87 | break; 88 | case 1: 89 | while(line.Length < 13) 90 | { 91 | line = line + " "; 92 | } 93 | break; 94 | default: 95 | while(line.Length < 20) 96 | { 97 | line = line + " "; 98 | } 99 | break; 100 | } 101 | 102 | }else 103 | { 104 | while(line.Length < 40) 105 | { 106 | line = line + " "; 107 | } 108 | } 109 | 110 | return line; 111 | 112 | } 113 | void update_wcdata() 114 | { 115 | switch (wc3file.distributable) 116 | { 117 | case 0: 118 | distro_but_no.Checked = true; 119 | break; 120 | case 1: 121 | distro_but_always.Checked = true; 122 | break; 123 | case 2: 124 | distro_but_one.Checked = true; 125 | break; 126 | default: 127 | distro_but_no.Checked = true; 128 | break; 129 | } 130 | icon_num.Value = wc3file.get_wc_icon(); 131 | update_iconbox(); 132 | colorbox.SelectedIndex = wc3file.get_wc_color(); 133 | 134 | 135 | header1.Text = wc3file.get_wc_text_2(0); 136 | header2.Text = wc3file.get_wc_text_2(1); 137 | body1.Text = wc3file.get_wc_text_2(2); 138 | body2.Text = wc3file.get_wc_text_2(3); 139 | body3.Text = wc3file.get_wc_text_2(4); 140 | body4.Text = wc3file.get_wc_text_2(5); 141 | footer1.Text = wc3file.get_wc_text_2(6); 142 | footer2.Text = wc3file.get_wc_text_2(7); 143 | /* 144 | header1.Text = wc3file.get_wc_text(0); 145 | header2.Text = wc3file.get_wc_text(1); 146 | body1.Text = wc3file.get_wc_text(2); 147 | body2.Text = wc3file.get_wc_text(3); 148 | body3.Text = wc3file.get_wc_text(4); 149 | body4.Text = wc3file.get_wc_text(5); 150 | footer1.Text = wc3file.get_wc_text(6); 151 | footer2.Text = wc3file.get_wc_text(7); 152 | */ 153 | 154 | map_bank.Value = wc3file.MAP_BANK; 155 | map_map.Value = wc3file.MAP_MAP; 156 | map_npc.Value = wc3file.MAP_NPC; 157 | } 158 | void set_wcdata() 159 | { 160 | wc3file.clear_wc_text(); //instead of clearing line, clear all text 161 | wc3file.insert_wc_text_2(header1.Text, 0); 162 | wc3file.insert_wc_text_2(header2.Text, 1); 163 | wc3file.insert_wc_text_2(body1.Text, 2); 164 | wc3file.insert_wc_text_2(body2.Text, 3); 165 | wc3file.insert_wc_text_2(body3.Text, 4); 166 | wc3file.insert_wc_text_2(body4.Text, 5); 167 | wc3file.insert_wc_text_2(footer1.Text, 6); 168 | wc3file.insert_wc_text_2(footer2.Text, 7); 169 | /* 170 | wc3file.insert_wc_text(header1.Text, 0); 171 | wc3file.insert_wc_text(header2.Text, 1); 172 | wc3file.insert_wc_text(body1.Text, 2); 173 | wc3file.insert_wc_text(body2.Text, 3); 174 | wc3file.insert_wc_text(body3.Text, 4); 175 | wc3file.insert_wc_text(body4.Text, 5); 176 | wc3file.insert_wc_text(footer1.Text, 6); 177 | wc3file.insert_wc_text(footer2.Text, 7); 178 | */ 179 | wc3file.ID = 0x33; 180 | wc3file.MAP_BANK = (byte)map_bank.Value; 181 | wc3file.MAP_MAP = (byte)map_map.Value; 182 | wc3file.MAP_NPC = (byte)map_npc.Value; 183 | } 184 | 185 | void Load_WC3(string path) 186 | { 187 | int filesize = FileIO.load_file(ref wc3buffer, ref path, wc3filter); 188 | if( filesize == wc3.SIZE_WC3 || filesize == wc3.SIZE_WC3_jap) 189 | { 190 | if (filesize == wc3.SIZE_WC3_jap) 191 | { 192 | japanese = true; 193 | regionlab.Text = "JAP"; 194 | header1.MaxLength = 18; 195 | header2.MaxLength = 13; 196 | body1.MaxLength = 20; 197 | body2.MaxLength = 20; 198 | body3.MaxLength = 20; 199 | body4.MaxLength = 20; 200 | footer1.MaxLength = 20; 201 | footer2.MaxLength = 20; 202 | }else{ 203 | japanese = false; 204 | regionlab.Text = "USA/EUR"; 205 | header1.MaxLength = 40; 206 | header2.MaxLength = 40; 207 | body1.MaxLength = 40; 208 | body2.MaxLength = 40; 209 | body3.MaxLength = 40; 210 | body4.MaxLength = 40; 211 | footer1.MaxLength = 40; 212 | footer2.MaxLength = 40; 213 | } 214 | 215 | wc3_path.Text = path; 216 | wc3file = new wc3(wc3buffer); 217 | 218 | update_wcdata(); 219 | 220 | save_wc3_but.Enabled = true; 221 | export_script_but.Enabled = true; 222 | import_script_but.Enabled = true; 223 | xse_export.Enabled = true; 224 | xse_import.Enabled = true; 225 | custom_script.Checked = false; 226 | 227 | drawCard(); 228 | 229 | }else{ 230 | MessageBox.Show("Invalid file size."); 231 | } 232 | } 233 | 234 | void Load_wc3_butClick(object sender, EventArgs e) 235 | { 236 | Load_WC3(null); 237 | } 238 | void Save_wc3_butClick(object sender, EventArgs e) 239 | { 240 | if (faketoogle.Checked == true) 241 | wc3file.fakeWC(); 242 | //wc3file.fakeSCript(); 243 | //wc3file.clean_trash(); 244 | wc3file.set_wc_icon((UInt16)icon_num.Value); 245 | int distro = 0; 246 | if (distro_but_always.Checked == true) 247 | distro = 1; 248 | else if (distro_but_one.Checked == true) 249 | distro = 2; 250 | else 251 | distro = 0; 252 | wc3file.set_wc_color_distro(colorbox.SelectedIndex , distro); 253 | set_wcdata(); 254 | wc3file.fix_script_checksum(); 255 | wc3file.fix_wc_checksum(); 256 | if (wc3file.Edited) 257 | FileIO.save_data(wc3file.Data, wc3filter); 258 | else MessageBox.Show("Save has not been edited"); 259 | } 260 | void Export_script_butClick(object sender, EventArgs e) 261 | { 262 | FileIO.save_data(wc3file.get_script(), scriptfilter); 263 | } 264 | void Import_script_butClick(object sender, EventArgs e) 265 | { 266 | string path = null; 267 | int filesize = FileIO.load_file(ref wc3script_new, ref path, scriptfilter); 268 | if( filesize <= 996 ) 269 | { 270 | wc3file.set_script(wc3script_new); 271 | custom_script.Checked = true; 272 | MessageBox.Show("Custom script imported."); 273 | 274 | }else{ 275 | MessageBox.Show("Invalid file size."); 276 | } 277 | } 278 | void IconboxSelectedIndexChanged(object sender, EventArgs e) 279 | { 280 | if (iconbox.SelectedIndex == 0) 281 | icon_num.Value = 0xFFFF; 282 | else if(iconbox.SelectedIndex > 251) 283 | icon_num.Value = iconbox.SelectedIndex; 284 | else 285 | icon_num.Value = iconbox.SelectedIndex; 286 | } 287 | void Icon_numValueChanged(object sender, EventArgs e) 288 | { 289 | update_iconbox(); 290 | drawCard(); 291 | } 292 | void WC3_editorLoad(object sender, EventArgs e) 293 | { 294 | 295 | } 296 | void GiveEgg_butClick(object sender, EventArgs e) 297 | { 298 | Form giveEeg = new WC3_editor_givegg(); 299 | giveEeg.ShowDialog(); 300 | if (script_injected == true) 301 | { 302 | script_injected = false; 303 | custom_script.Checked = true; 304 | MessageBox.Show("Give Egg script injected."); 305 | } 306 | } 307 | void ColorboxSelectedIndexChanged(object sender, EventArgs e) 308 | { 309 | drawCard(); 310 | } 311 | ResourceManager resources = new ResourceManager("WC3_TOOL.WC3.Image.Cards", Assembly.GetExecutingAssembly()); 312 | ResourceManager resources2 = new ResourceManager("WC3_TOOL.WC3.Image.Icons", Assembly.GetExecutingAssembly()); 313 | Image bitmap2; 314 | Image bitmap; 315 | void drawCard() 316 | { 317 | bitmap = (Image)resources.GetObject("Card_"+colorbox.SelectedIndex.ToString()); 318 | GFX.DrawImage(bitmap, 501, 141, 238, 158); 319 | 320 | if (icon_num.Value <= 251 || (icon_num.Value >= 277 && icon_num.Value <= 411)) 321 | { 322 | bitmap2 = (Image)resources2.GetObject(PKHeX.PKM.getG4Species((int)icon_num.Value).ToString()); 323 | GFX.DrawImage(bitmap2, 700, 140, 40, 40); 324 | }else if ((icon_num.Value >= 412 && icon_num.Value <= 439)) // Egg and unown forms 325 | { 326 | bitmap2 = (Bitmap)resources2.GetObject(icon_num.Value.ToString()); 327 | GFX.DrawImage(bitmap2, 700, 140, 40, 40); 328 | }else 329 | { 330 | bitmap2 = (Bitmap)resources2.GetObject("0"); 331 | GFX.DrawImage(bitmap2, 700, 140, 40, 40); 332 | } 333 | 334 | 335 | GFX.DrawString(header1.Text, new Font("Calibri", 8), Brushes.Black, 500+10+1, 140+12); 336 | GFX.DrawString(header2.Text, new Font("Calibri", 8), Brushes.Black, 500+10+1, 140+28); 337 | GFX.DrawString(body1.Text, new Font("Calibri", 8), Brushes.Black, 500+5+1, 140+50); 338 | GFX.DrawString(body2.Text, new Font("Calibri", 8), Brushes.Black, 500+5+1, 140+66); 339 | GFX.DrawString(body3.Text, new Font("Calibri", 8), Brushes.Black, 500+5+1, 140+82); 340 | GFX.DrawString(body4.Text, new Font("Calibri", 8), Brushes.Black, 500+5+1, 140+98); 341 | GFX.DrawString(footer1.Text, new Font("Calibri", 8), Brushes.Black, 500+5+1, 140+122); 342 | GFX.DrawString(footer2.Text, new Font("Calibri", 8), Brushes.Black, 500+5+1, 140+138); 343 | 344 | } 345 | void Header1TextChanged(object sender, EventArgs e) 346 | { 347 | drawCard(); 348 | } 349 | void Header2TextChanged(object sender, EventArgs e) 350 | { 351 | drawCard(); 352 | } 353 | void Body1TextChanged(object sender, EventArgs e) 354 | { 355 | drawCard(); 356 | } 357 | void Body2TextChanged(object sender, EventArgs e) 358 | { 359 | drawCard(); 360 | } 361 | void Body3TextChanged(object sender, EventArgs e) 362 | { 363 | drawCard(); 364 | } 365 | void Body4TextChanged(object sender, EventArgs e) 366 | { 367 | drawCard(); 368 | } 369 | void Footer1TextChanged(object sender, EventArgs e) 370 | { 371 | drawCard(); 372 | } 373 | void Footer2TextChanged(object sender, EventArgs e) 374 | { 375 | drawCard(); 376 | } 377 | void Map_helpClick(object sender, EventArgs e) 378 | { 379 | MessageBox.Show("These values are used to associate the script to a NPC character in the game.\n\nYou can use Advance Map to locate the values for all NPC in the game.\n\nIn Emerald, father at petalburg Gym is Bank 08, Map 01, NPC 01.\n\n For Wondercard Deliveryman set all to 255"); 380 | } 381 | void Xse_helpClick(object sender, EventArgs e) 382 | { 383 | MessageBox.Show("XSE Export: exports the script with padding corresponding to base address of the script and *.gba extension. You can directly load (and edit) the script in XSE, script offset will be shown when using the export button.\nXSE Import: imports a *.gba script generated by this tool after editing (or not) with XSE (importing anything else will not correctly work).\n\nThese options are just for convenience, the scripts are in no way gba roms, but it's the more convenient way to edit them in XSE."); 384 | } 385 | void Xse_exportClick(object sender, EventArgs e) 386 | { 387 | FileIO.save_data(wc3file.get_script_XSE(), xsescriptfilter); 388 | } 389 | void Xse_importClick(object sender, EventArgs e) 390 | { 391 | string path = null; 392 | int filesize = FileIO.load_file(ref wc3script_new, ref path, xsescriptfilter); 393 | if( filesize <= 1000 ) 394 | { 395 | wc3file.set_script_XSE(wc3script_new); 396 | custom_script.Checked = true; 397 | MessageBox.Show("Custom script imported."); 398 | 399 | }else{ 400 | MessageBox.Show("Invalid file size."); 401 | } 402 | } 403 | void GiveEggExt_butClick(object sender, EventArgs e) 404 | { 405 | Form giveEegExt = new WC3_editor_giveggExt(); 406 | giveEegExt.ShowDialog(); 407 | if (script_injected == true) 408 | { 409 | script_injected = false; 410 | custom_script.Checked = true; 411 | MessageBox.Show("Give Egg script injected."); 412 | } 413 | } 414 | 415 | void WC3_editorDragEnter(object sender, DragEventArgs e) 416 | { 417 | e.Effect = DragDropEffects.All; 418 | } 419 | void WC3_editorDragDrop(object sender, DragEventArgs e) 420 | { 421 | string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, false); 422 | Load_WC3(files[0]); 423 | } 424 | 425 | } 426 | } 427 | -------------------------------------------------------------------------------- /wc3_tool/WC3/WC3_editor.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /wc3_tool/WC3/WC3_editor_givegg.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by SharpDevelop. 3 | * User: suloku 4 | * Date: 07/05/2016 5 | * Time: 21:27 6 | * 7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 8 | */ 9 | using System; 10 | using System.Collections.Generic; 11 | using System.ComponentModel; 12 | using System.Data; 13 | using System.Drawing; 14 | using System.Linq; 15 | using System.Text; 16 | using System.Windows.Forms; 17 | using System.IO; 18 | 19 | using System.Reflection; 20 | using System.Resources; 21 | 22 | namespace WC3_TOOL 23 | { 24 | /// 25 | /// Description of WC3_editor_givegg. 26 | /// 27 | public partial class WC3_editor_givegg : Form 28 | { 29 | public WC3_editor_givegg() 30 | { 31 | // 32 | // The InitializeComponent() call is required for Windows Forms designer support. 33 | // 34 | InitializeComponent(); 35 | game_box.SelectedIndex = 0; 36 | lang_box.SelectedIndex = 1; 37 | species_box.SelectedIndex = 172; 38 | move_box.SelectedIndex = 0x39; 39 | /* 40 | ResourceManager resources = new ResourceManager("Namespace.ResourceFile", Assembly.GetExecutingAssembly()); 41 | byte[] fileData = (byte[])ResourceManager.GetObject("Test.dat"); 42 | Bitmap bitmap = (Bitmap)ResourceManager.GetObject("Image"); 43 | */ 44 | //byte[] fileData = (byte[]) EggScripts.GetObject("ROM"+game+"GiveEgg"+lang); 45 | // 46 | // TODO: Add constructor code after the InitializeComponent() call. 47 | // 48 | } 49 | void Save_butClick(object sender, EventArgs e) 50 | { 51 | string game; 52 | if (game_box.SelectedIndex == 1) 53 | game = "FR"; 54 | else 55 | game = "E"; 56 | 57 | string lang = "Eng"; 58 | switch (lang_box.SelectedIndex) 59 | { 60 | case 0: 61 | lang = "Jap"; 62 | break; 63 | case 1: 64 | lang = "Eng"; 65 | break; 66 | case 2: 67 | lang = "Fre"; 68 | break; 69 | case 3: 70 | lang = "Ita"; 71 | break; 72 | case 4: 73 | lang = "Deu"; 74 | break; 75 | case 5: 76 | lang = "Esp"; 77 | break; 78 | } 79 | //MessageBox.Show("ROM_"+game+"_GiveEgg_"+lang); 80 | ResourceManager EggScripts = new ResourceManager("WC3_tool.WC3.GiveEggOrg", Assembly.GetExecutingAssembly()); 81 | byte[] egg_script = (byte[]) EggScripts.GetObject("ROM_"+game+"_GiveEgg_"+lang); 82 | //byte[] egg_script = (byte[]) EggScripts.GetObject("ROM_FR_GiveEgg_Esp"); 83 | 84 | UInt16 move; 85 | move = (UInt16)move_box.SelectedIndex; 86 | BitConverter.GetBytes(move).ToArray().CopyTo(egg_script, 0x86); 87 | BitConverter.GetBytes(move).ToArray().CopyTo(egg_script, 0x8C); 88 | BitConverter.GetBytes(move).ToArray().CopyTo(egg_script, 0x92); 89 | BitConverter.GetBytes(move).ToArray().CopyTo(egg_script, 0x98); 90 | BitConverter.GetBytes(move).ToArray().CopyTo(egg_script, 0x9E); 91 | 92 | UInt16 species; 93 | species = (UInt16)species_box.SelectedIndex; 94 | BitConverter.GetBytes(species).ToArray().CopyTo(egg_script, 0x42); 95 | 96 | WC3_editor.wc3file.set_script(egg_script); 97 | WC3_editor.script_injected = true; 98 | 99 | this.Close(); 100 | } 101 | void Cancel_butClick(object sender, EventArgs e) 102 | { 103 | this.Close(); 104 | } 105 | } 106 | } 107 | -------------------------------------------------------------------------------- /wc3_tool/WC3/WC3_editor_givegg.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /wc3_tool/WC3/WC3_editor_giveggExt.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by SharpDevelop. 3 | * User: suloku 4 | * Date: 07/05/2016 5 | * Time: 21:27 6 | * 7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 8 | */ 9 | using System; 10 | using System.Collections.Generic; 11 | using System.ComponentModel; 12 | using System.Data; 13 | using System.Drawing; 14 | using System.Linq; 15 | using System.Text; 16 | using System.Windows.Forms; 17 | using System.IO; 18 | 19 | using System.Reflection; 20 | using System.Resources; 21 | 22 | namespace WC3_TOOL 23 | { 24 | /// 25 | /// Description of WC3_editor_givegg. 26 | /// 27 | public partial class WC3_editor_giveggExt : Form 28 | { 29 | public WC3_editor_giveggExt() 30 | { 31 | // 32 | // The InitializeComponent() call is required for Windows Forms designer support. 33 | // 34 | InitializeComponent(); 35 | game_box.SelectedIndex = 0; 36 | lang_box.SelectedIndex = 1; 37 | species_box.SelectedIndex = 172; 38 | move_box.SelectedIndex = 0x39; 39 | move2.SelectedIndex = 0x39; 40 | move3.SelectedIndex = 0x39; 41 | move4.SelectedIndex = 0x39; 42 | /* 43 | ResourceManager resources = new ResourceManager("Namespace.ResourceFile", Assembly.GetExecutingAssembly()); 44 | byte[] fileData = (byte[])ResourceManager.GetObject("Test.dat"); 45 | Bitmap bitmap = (Bitmap)ResourceManager.GetObject("Image"); 46 | */ 47 | //byte[] fileData = (byte[]) EggScripts.GetObject("ROM"+game+"GiveEgg"+lang); 48 | // 49 | // TODO: Add constructor code after the InitializeComponent() call. 50 | // 51 | } 52 | void Save_butClick(object sender, EventArgs e) 53 | { 54 | string game; 55 | if (game_box.SelectedIndex == 1) 56 | game = "FR"; 57 | else 58 | game = "E"; 59 | 60 | string lang = "Eng"; 61 | switch (lang_box.SelectedIndex) 62 | { 63 | case 0: 64 | lang = "Jap"; 65 | break; 66 | case 1: 67 | lang = "Eng"; 68 | break; 69 | case 2: 70 | lang = "Fre"; 71 | break; 72 | case 3: 73 | lang = "Ita"; 74 | break; 75 | case 4: 76 | lang = "Deu"; 77 | break; 78 | case 5: 79 | lang = "Esp"; 80 | break; 81 | } 82 | //MessageBox.Show("ROM_"+game+"_GiveEgg_"+lang); 83 | ResourceManager EggScripts = new ResourceManager("WC3_tool.WC3.GiveEggOrg", Assembly.GetExecutingAssembly()); 84 | byte[] egg_script; 85 | 86 | if (killscript.Checked == true) 87 | egg_script =(byte[]) EggScripts.GetObject("ROM_"+game+"_GiveEgg_"+lang+"_4moves_kill"); 88 | else 89 | egg_script = (byte[]) EggScripts.GetObject("ROM_"+game+"_GiveEgg_"+lang+"_4moves"); 90 | 91 | UInt16 move; 92 | UInt16 move_2; 93 | UInt16 move_3; 94 | UInt16 move_4; 95 | 96 | int offset = 4;//Embedded scripts have a 4 byte padding 97 | if (killscript.Checked == true) 98 | { 99 | egg_script[0x5+offset] = 0x00; //Remove jumpram command, I should technically update the embedded script files instead of doing this... 100 | offset -= 0xF;//Killscript version is 0xF bytes shorter 101 | } 102 | move = (UInt16)move_box.SelectedIndex; 103 | BitConverter.GetBytes(move).ToArray().CopyTo(egg_script, 0xB1+offset); 104 | BitConverter.GetBytes(move).ToArray().CopyTo(egg_script, 0xC7+offset); 105 | BitConverter.GetBytes(move).ToArray().CopyTo(egg_script, 0xDD+offset); 106 | BitConverter.GetBytes(move).ToArray().CopyTo(egg_script, 0xF3+offset); 107 | BitConverter.GetBytes(move).ToArray().CopyTo(egg_script, 0x109+offset); 108 | 109 | offset+=5; 110 | move_2 = (UInt16)move2.SelectedIndex; 111 | BitConverter.GetBytes(move_2).ToArray().CopyTo(egg_script, 0xB1+offset); 112 | BitConverter.GetBytes(move_2).ToArray().CopyTo(egg_script, 0xC7+offset); 113 | BitConverter.GetBytes(move_2).ToArray().CopyTo(egg_script, 0xDD+offset); 114 | BitConverter.GetBytes(move_2).ToArray().CopyTo(egg_script, 0xF3+offset); 115 | BitConverter.GetBytes(move_2).ToArray().CopyTo(egg_script, 0x109+offset); 116 | 117 | offset+=5; 118 | move_3 = (UInt16)move3.SelectedIndex; 119 | BitConverter.GetBytes(move_3).ToArray().CopyTo(egg_script, 0xB1+offset); 120 | BitConverter.GetBytes(move_3).ToArray().CopyTo(egg_script, 0xC7+offset); 121 | BitConverter.GetBytes(move_3).ToArray().CopyTo(egg_script, 0xDD+offset); 122 | BitConverter.GetBytes(move_3).ToArray().CopyTo(egg_script, 0xF3+offset); 123 | BitConverter.GetBytes(move_3).ToArray().CopyTo(egg_script, 0x109+offset); 124 | 125 | offset+=5; 126 | move_4 = (UInt16)move4.SelectedIndex; 127 | BitConverter.GetBytes(move_4).ToArray().CopyTo(egg_script, 0xB1+offset); 128 | BitConverter.GetBytes(move_4).ToArray().CopyTo(egg_script, 0xC7+offset); 129 | BitConverter.GetBytes(move_4).ToArray().CopyTo(egg_script, 0xDD+offset); 130 | BitConverter.GetBytes(move_4).ToArray().CopyTo(egg_script, 0xF3+offset); 131 | BitConverter.GetBytes(move_4).ToArray().CopyTo(egg_script, 0x109+offset); 132 | 133 | UInt16 species; 134 | species = (UInt16)species_box.SelectedIndex; 135 | if (killscript.Checked == true) 136 | BitConverter.GetBytes(species).ToArray().CopyTo(egg_script, 0x5D+4); 137 | else 138 | BitConverter.GetBytes(species).ToArray().CopyTo(egg_script, 0x6C+4); 139 | 140 | //Because script files embedded have a 4 byte padding for XSE editing...and I'm lazy to strip those 4 bytes 141 | WC3_editor.wc3file.set_script(egg_script.Skip(4).Take(996).ToArray()); 142 | WC3_editor.script_injected = true; 143 | 144 | this.Close(); 145 | } 146 | void Cancel_butClick(object sender, EventArgs e) 147 | { 148 | this.Close(); 149 | } 150 | void Script_helpClick(object sender, EventArgs e) 151 | { 152 | MessageBox.Show("Use rom event flag: the script will use the flag that the Egg event found in the ROM uses to mark the EGG as received. The wondercard will be able to be sent and the receiver will be able to receive an egg (if the savegame still has the flag unset).\n\nKillscript: no flags are set in the savegame, so the only outcome is that the egg is received. The script gets erased from the savegame, so sharing the wondercard won't allow receiver to get an egg."); 153 | } 154 | } 155 | } 156 | -------------------------------------------------------------------------------- /wc3_tool/WC3/WC3_editor_giveggExt.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /wc3_tool/WC3/WCN_editor.Designer.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by SharpDevelop. 3 | * User: suloku 4 | * Date: 28/04/2016 5 | * Time: 21:22 6 | * 7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 8 | */ 9 | namespace WC3_TOOL 10 | { 11 | partial class WCN_editor 12 | { 13 | /// 14 | /// Designer variable used to keep track of non-visual components. 15 | /// 16 | private System.ComponentModel.IContainer components = null; 17 | private System.Windows.Forms.Button load_wc3_but; 18 | private System.Windows.Forms.Button save_wc3_but; 19 | private System.Windows.Forms.TextBox wc3_path; 20 | private System.Windows.Forms.Label label1; 21 | private System.Windows.Forms.Label label2; 22 | private System.Windows.Forms.Label label3; 23 | private System.Windows.Forms.Label label4; 24 | private System.Windows.Forms.Label label5; 25 | private System.Windows.Forms.Label label6; 26 | private System.Windows.Forms.Label label7; 27 | private System.Windows.Forms.Label label8; 28 | private System.Windows.Forms.TextBox header1; 29 | private System.Windows.Forms.TextBox body5; 30 | private System.Windows.Forms.TextBox body1; 31 | private System.Windows.Forms.TextBox body2; 32 | private System.Windows.Forms.TextBox body3; 33 | private System.Windows.Forms.TextBox body4; 34 | private System.Windows.Forms.TextBox body6; 35 | private System.Windows.Forms.TextBox body7; 36 | private System.Windows.Forms.CheckBox distrocheck; 37 | private System.Windows.Forms.Label label9; 38 | private System.Windows.Forms.ComboBox colorbox; 39 | private System.Windows.Forms.Label label10; 40 | private System.Windows.Forms.Label label11; 41 | private System.Windows.Forms.Label label12; 42 | private System.Windows.Forms.TextBox body8; 43 | private System.Windows.Forms.TextBox body9; 44 | private System.Windows.Forms.TextBox body10; 45 | private System.Windows.Forms.Label regionlab; 46 | 47 | /// 48 | /// Disposes resources used by the form. 49 | /// 50 | /// true if managed resources should be disposed; otherwise, false. 51 | protected override void Dispose(bool disposing) 52 | { 53 | if (disposing) { 54 | if (components != null) { 55 | components.Dispose(); 56 | } 57 | } 58 | base.Dispose(disposing); 59 | } 60 | 61 | /// 62 | /// This method is required for Windows Forms designer support. 63 | /// Do not change the method contents inside the source code editor. The Forms designer might 64 | /// not be able to load this method if it was changed manually. 65 | /// 66 | private void InitializeComponent() 67 | { 68 | this.load_wc3_but = new System.Windows.Forms.Button(); 69 | this.save_wc3_but = new System.Windows.Forms.Button(); 70 | this.wc3_path = new System.Windows.Forms.TextBox(); 71 | this.label1 = new System.Windows.Forms.Label(); 72 | this.label2 = new System.Windows.Forms.Label(); 73 | this.label3 = new System.Windows.Forms.Label(); 74 | this.label4 = new System.Windows.Forms.Label(); 75 | this.label5 = new System.Windows.Forms.Label(); 76 | this.label6 = new System.Windows.Forms.Label(); 77 | this.label7 = new System.Windows.Forms.Label(); 78 | this.label8 = new System.Windows.Forms.Label(); 79 | this.header1 = new System.Windows.Forms.TextBox(); 80 | this.body5 = new System.Windows.Forms.TextBox(); 81 | this.body1 = new System.Windows.Forms.TextBox(); 82 | this.body2 = new System.Windows.Forms.TextBox(); 83 | this.body3 = new System.Windows.Forms.TextBox(); 84 | this.body4 = new System.Windows.Forms.TextBox(); 85 | this.body6 = new System.Windows.Forms.TextBox(); 86 | this.body7 = new System.Windows.Forms.TextBox(); 87 | this.distrocheck = new System.Windows.Forms.CheckBox(); 88 | this.colorbox = new System.Windows.Forms.ComboBox(); 89 | this.label10 = new System.Windows.Forms.Label(); 90 | this.label9 = new System.Windows.Forms.Label(); 91 | this.label11 = new System.Windows.Forms.Label(); 92 | this.label12 = new System.Windows.Forms.Label(); 93 | this.body8 = new System.Windows.Forms.TextBox(); 94 | this.body9 = new System.Windows.Forms.TextBox(); 95 | this.body10 = new System.Windows.Forms.TextBox(); 96 | this.regionlab = new System.Windows.Forms.Label(); 97 | this.SuspendLayout(); 98 | // 99 | // load_wc3_but 100 | // 101 | this.load_wc3_but.Location = new System.Drawing.Point(49, 11); 102 | this.load_wc3_but.Name = "load_wc3_but"; 103 | this.load_wc3_but.Size = new System.Drawing.Size(75, 23); 104 | this.load_wc3_but.TabIndex = 0; 105 | this.load_wc3_but.Text = "Load WN3"; 106 | this.load_wc3_but.UseVisualStyleBackColor = true; 107 | this.load_wc3_but.Click += new System.EventHandler(this.Load_wc3_butClick); 108 | // 109 | // save_wc3_but 110 | // 111 | this.save_wc3_but.Enabled = false; 112 | this.save_wc3_but.Location = new System.Drawing.Point(130, 11); 113 | this.save_wc3_but.Name = "save_wc3_but"; 114 | this.save_wc3_but.Size = new System.Drawing.Size(75, 23); 115 | this.save_wc3_but.TabIndex = 1; 116 | this.save_wc3_but.Text = "Save WN3"; 117 | this.save_wc3_but.UseVisualStyleBackColor = true; 118 | this.save_wc3_but.Click += new System.EventHandler(this.Save_wc3_butClick); 119 | // 120 | // wc3_path 121 | // 122 | this.wc3_path.Location = new System.Drawing.Point(221, 13); 123 | this.wc3_path.Name = "wc3_path"; 124 | this.wc3_path.ReadOnly = true; 125 | this.wc3_path.Size = new System.Drawing.Size(560, 20); 126 | this.wc3_path.TabIndex = 2; 127 | // 128 | // label1 129 | // 130 | this.label1.Location = new System.Drawing.Point(49, 102); 131 | this.label1.Name = "label1"; 132 | this.label1.Size = new System.Drawing.Size(100, 23); 133 | this.label1.TabIndex = 3; 134 | this.label1.Text = "Header"; 135 | // 136 | // label2 137 | // 138 | this.label2.Location = new System.Drawing.Point(49, 217); 139 | this.label2.Name = "label2"; 140 | this.label2.Size = new System.Drawing.Size(100, 23); 141 | this.label2.TabIndex = 4; 142 | this.label2.Text = "Body 5"; 143 | // 144 | // label3 145 | // 146 | this.label3.Location = new System.Drawing.Point(49, 125); 147 | this.label3.Name = "label3"; 148 | this.label3.Size = new System.Drawing.Size(100, 23); 149 | this.label3.TabIndex = 5; 150 | this.label3.Text = "Body 1"; 151 | // 152 | // label4 153 | // 154 | this.label4.Location = new System.Drawing.Point(49, 148); 155 | this.label4.Name = "label4"; 156 | this.label4.Size = new System.Drawing.Size(100, 23); 157 | this.label4.TabIndex = 6; 158 | this.label4.Text = "Body 2"; 159 | // 160 | // label5 161 | // 162 | this.label5.Location = new System.Drawing.Point(49, 171); 163 | this.label5.Name = "label5"; 164 | this.label5.Size = new System.Drawing.Size(100, 23); 165 | this.label5.TabIndex = 7; 166 | this.label5.Text = "Body 3"; 167 | // 168 | // label6 169 | // 170 | this.label6.Location = new System.Drawing.Point(49, 194); 171 | this.label6.Name = "label6"; 172 | this.label6.Size = new System.Drawing.Size(100, 23); 173 | this.label6.TabIndex = 8; 174 | this.label6.Text = "Body 4"; 175 | // 176 | // label7 177 | // 178 | this.label7.Location = new System.Drawing.Point(49, 240); 179 | this.label7.Name = "label7"; 180 | this.label7.Size = new System.Drawing.Size(100, 23); 181 | this.label7.TabIndex = 9; 182 | this.label7.Text = "Body 6"; 183 | // 184 | // label8 185 | // 186 | this.label8.Location = new System.Drawing.Point(49, 263); 187 | this.label8.Name = "label8"; 188 | this.label8.Size = new System.Drawing.Size(100, 23); 189 | this.label8.TabIndex = 10; 190 | this.label8.Text = "Body 7"; 191 | // 192 | // header1 193 | // 194 | this.header1.Location = new System.Drawing.Point(114, 99); 195 | this.header1.MaxLength = 40; 196 | this.header1.Name = "header1"; 197 | this.header1.Size = new System.Drawing.Size(379, 20); 198 | this.header1.TabIndex = 11; 199 | this.header1.TextChanged += new System.EventHandler(this.Header1TextChanged); 200 | // 201 | // body5 202 | // 203 | this.body5.Location = new System.Drawing.Point(114, 214); 204 | this.body5.MaxLength = 40; 205 | this.body5.Name = "body5"; 206 | this.body5.Size = new System.Drawing.Size(379, 20); 207 | this.body5.TabIndex = 16; 208 | this.body5.TextChanged += new System.EventHandler(this.Body5TextChanged); 209 | // 210 | // body1 211 | // 212 | this.body1.Location = new System.Drawing.Point(114, 122); 213 | this.body1.MaxLength = 40; 214 | this.body1.Name = "body1"; 215 | this.body1.Size = new System.Drawing.Size(379, 20); 216 | this.body1.TabIndex = 12; 217 | this.body1.TextChanged += new System.EventHandler(this.Body1TextChanged); 218 | // 219 | // body2 220 | // 221 | this.body2.Location = new System.Drawing.Point(114, 145); 222 | this.body2.MaxLength = 40; 223 | this.body2.Name = "body2"; 224 | this.body2.Size = new System.Drawing.Size(379, 20); 225 | this.body2.TabIndex = 13; 226 | this.body2.TextChanged += new System.EventHandler(this.Body2TextChanged); 227 | // 228 | // body3 229 | // 230 | this.body3.Location = new System.Drawing.Point(114, 168); 231 | this.body3.MaxLength = 40; 232 | this.body3.Name = "body3"; 233 | this.body3.Size = new System.Drawing.Size(379, 20); 234 | this.body3.TabIndex = 14; 235 | this.body3.TextChanged += new System.EventHandler(this.Body3TextChanged); 236 | // 237 | // body4 238 | // 239 | this.body4.Location = new System.Drawing.Point(114, 191); 240 | this.body4.MaxLength = 40; 241 | this.body4.Name = "body4"; 242 | this.body4.Size = new System.Drawing.Size(379, 20); 243 | this.body4.TabIndex = 15; 244 | this.body4.TextChanged += new System.EventHandler(this.Body4TextChanged); 245 | // 246 | // body6 247 | // 248 | this.body6.Location = new System.Drawing.Point(114, 237); 249 | this.body6.MaxLength = 40; 250 | this.body6.Name = "body6"; 251 | this.body6.Size = new System.Drawing.Size(379, 20); 252 | this.body6.TabIndex = 17; 253 | this.body6.TextChanged += new System.EventHandler(this.Body6TextChanged); 254 | // 255 | // body7 256 | // 257 | this.body7.Location = new System.Drawing.Point(114, 260); 258 | this.body7.MaxLength = 40; 259 | this.body7.Name = "body7"; 260 | this.body7.Size = new System.Drawing.Size(379, 20); 261 | this.body7.TabIndex = 18; 262 | this.body7.TextChanged += new System.EventHandler(this.Body7TextChanged); 263 | // 264 | // distrocheck 265 | // 266 | this.distrocheck.Location = new System.Drawing.Point(364, 69); 267 | this.distrocheck.Name = "distrocheck"; 268 | this.distrocheck.Size = new System.Drawing.Size(85, 24); 269 | this.distrocheck.TabIndex = 22; 270 | this.distrocheck.Text = "Distributable"; 271 | this.distrocheck.UseVisualStyleBackColor = true; 272 | // 273 | // colorbox 274 | // 275 | this.colorbox.FormattingEnabled = true; 276 | this.colorbox.Items.AddRange(new object[] { 277 | "Yellow (0x00)", 278 | "Crystal (0x01)", 279 | "Red (0x02)", 280 | "Green (0x03)", 281 | "Blue (0x04)", 282 | "Brown (0x05)", 283 | "Gold (0x06)", 284 | "Silver (0x07)"}); 285 | this.colorbox.Location = new System.Drawing.Point(115, 58); 286 | this.colorbox.Name = "colorbox"; 287 | this.colorbox.Size = new System.Drawing.Size(243, 21); 288 | this.colorbox.TabIndex = 25; 289 | this.colorbox.SelectedIndexChanged += new System.EventHandler(this.ColorboxSelectedIndexChanged); 290 | // 291 | // label10 292 | // 293 | this.label10.Location = new System.Drawing.Point(46, 60); 294 | this.label10.Name = "label10"; 295 | this.label10.Size = new System.Drawing.Size(63, 19); 296 | this.label10.TabIndex = 26; 297 | this.label10.Text = "Color"; 298 | // 299 | // label9 300 | // 301 | this.label9.Location = new System.Drawing.Point(49, 286); 302 | this.label9.Name = "label9"; 303 | this.label9.Size = new System.Drawing.Size(100, 23); 304 | this.label9.TabIndex = 27; 305 | this.label9.Text = "Body 8"; 306 | // 307 | // label11 308 | // 309 | this.label11.Location = new System.Drawing.Point(49, 309); 310 | this.label11.Name = "label11"; 311 | this.label11.Size = new System.Drawing.Size(100, 23); 312 | this.label11.TabIndex = 28; 313 | this.label11.Text = "Body 9"; 314 | // 315 | // label12 316 | // 317 | this.label12.Location = new System.Drawing.Point(49, 332); 318 | this.label12.Name = "label12"; 319 | this.label12.Size = new System.Drawing.Size(100, 23); 320 | this.label12.TabIndex = 29; 321 | this.label12.Text = "Body 10"; 322 | // 323 | // body8 324 | // 325 | this.body8.Location = new System.Drawing.Point(114, 283); 326 | this.body8.MaxLength = 40; 327 | this.body8.Name = "body8"; 328 | this.body8.Size = new System.Drawing.Size(379, 20); 329 | this.body8.TabIndex = 19; 330 | this.body8.TextChanged += new System.EventHandler(this.Body8TextChanged); 331 | // 332 | // body9 333 | // 334 | this.body9.Location = new System.Drawing.Point(114, 306); 335 | this.body9.MaxLength = 40; 336 | this.body9.Name = "body9"; 337 | this.body9.Size = new System.Drawing.Size(379, 20); 338 | this.body9.TabIndex = 20; 339 | this.body9.TextChanged += new System.EventHandler(this.Body9TextChanged); 340 | // 341 | // body10 342 | // 343 | this.body10.Location = new System.Drawing.Point(114, 329); 344 | this.body10.MaxLength = 40; 345 | this.body10.Name = "body10"; 346 | this.body10.Size = new System.Drawing.Size(379, 20); 347 | this.body10.TabIndex = 21; 348 | this.body10.TextChanged += new System.EventHandler(this.Body10TextChanged); 349 | // 350 | // regionlab 351 | // 352 | this.regionlab.Location = new System.Drawing.Point(364, 50); 353 | this.regionlab.Name = "regionlab"; 354 | this.regionlab.Size = new System.Drawing.Size(100, 16); 355 | this.regionlab.TabIndex = 30; 356 | this.regionlab.Text = "USA/EUR"; 357 | // 358 | // WCN_editor 359 | // 360 | this.AllowDrop = true; 361 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 362 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 363 | this.ClientSize = new System.Drawing.Size(820, 373); 364 | this.Controls.Add(this.regionlab); 365 | this.Controls.Add(this.body10); 366 | this.Controls.Add(this.body9); 367 | this.Controls.Add(this.body8); 368 | this.Controls.Add(this.label12); 369 | this.Controls.Add(this.label11); 370 | this.Controls.Add(this.label9); 371 | this.Controls.Add(this.label10); 372 | this.Controls.Add(this.colorbox); 373 | this.Controls.Add(this.distrocheck); 374 | this.Controls.Add(this.body7); 375 | this.Controls.Add(this.body6); 376 | this.Controls.Add(this.body4); 377 | this.Controls.Add(this.body3); 378 | this.Controls.Add(this.body2); 379 | this.Controls.Add(this.body1); 380 | this.Controls.Add(this.body5); 381 | this.Controls.Add(this.header1); 382 | this.Controls.Add(this.label8); 383 | this.Controls.Add(this.label7); 384 | this.Controls.Add(this.label6); 385 | this.Controls.Add(this.label5); 386 | this.Controls.Add(this.label4); 387 | this.Controls.Add(this.label3); 388 | this.Controls.Add(this.label2); 389 | this.Controls.Add(this.label1); 390 | this.Controls.Add(this.wc3_path); 391 | this.Controls.Add(this.save_wc3_but); 392 | this.Controls.Add(this.load_wc3_but); 393 | this.Name = "WCN_editor"; 394 | this.Text = "WN3 Editor"; 395 | this.Load += new System.EventHandler(this.WCN_editorLoad); 396 | this.DragDrop += new System.Windows.Forms.DragEventHandler(this.WCN_editorDragDrop); 397 | this.DragEnter += new System.Windows.Forms.DragEventHandler(this.WCN_editorDragEnter); 398 | this.ResumeLayout(false); 399 | this.PerformLayout(); 400 | 401 | } 402 | } 403 | } 404 | -------------------------------------------------------------------------------- /wc3_tool/WC3/WCN_editor.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * Created by SharpDevelop. 3 | * User: suloku 4 | * Date: 28/04/2016 5 | * Time: 21:22 6 | * 7 | * To change this template use Tools | Options | Coding | Edit Standard Headers. 8 | */ 9 | using System; 10 | using System.Collections.Generic; 11 | using System.ComponentModel; 12 | using System.Data; 13 | using System.Drawing; 14 | using System.Linq; 15 | using System.Text; 16 | using System.Windows.Forms; 17 | using System.IO; 18 | 19 | using System.Reflection; 20 | using System.Resources; 21 | 22 | namespace WC3_TOOL 23 | { 24 | /// 25 | /// Description of MainForm. 26 | /// 27 | public partial class WCN_editor : Form 28 | { 29 | public WCN_editor() 30 | { 31 | // 32 | // The InitializeComponent() call is required for Windows Forms designer support. 33 | // 34 | InitializeComponent(); 35 | regionlab.Text = ""; 36 | GFX = this.CreateGraphics(); 37 | colorbox.SelectedIndex = 0; 38 | 39 | // 40 | // TODO: Add constructor code after the InitializeComponent() call. 41 | // 42 | } 43 | public string wcnfilter = "Wonder News file|*.wn3|All Files (*.*)|*.*"; 44 | public byte[] wcnbuffer = new byte[SAV3.WCN_SIZE]; 45 | public static wc3 wcnfile; 46 | 47 | public bool japanese = false; 48 | 49 | private Graphics GFX; 50 | 51 | void update_wcdata() 52 | { 53 | switch (wcnfile.distributable) 54 | { 55 | case 0: 56 | distrocheck.Checked = false; 57 | break; 58 | case 1: 59 | distrocheck.Checked = true; 60 | break; 61 | default: 62 | distrocheck.Checked = false; 63 | break; 64 | } 65 | 66 | colorbox.SelectedIndex = wcnfile.cardcolor; 67 | 68 | header1.Text = wcnfile.get_wn_text_2(0); 69 | body1.Text = wcnfile.get_wn_text_2(1); 70 | body2.Text = wcnfile.get_wn_text_2(2); 71 | body3.Text = wcnfile.get_wn_text_2(3); 72 | body4.Text = wcnfile.get_wn_text_2(4); 73 | body5.Text = wcnfile.get_wn_text_2(5); 74 | body6.Text = wcnfile.get_wn_text_2(6); 75 | body7.Text = wcnfile.get_wn_text_2(7); 76 | body8.Text = wcnfile.get_wn_text_2(8); 77 | body9.Text = wcnfile.get_wn_text_2(9); 78 | body10.Text = wcnfile.get_wn_text_2(10); 79 | } 80 | void set_wcndata() 81 | { 82 | wcnfile.clear_wn_text(); 83 | wcnfile.insert_wn_text_2(header1.Text, 0); 84 | wcnfile.insert_wn_text_2(body1.Text, 1); 85 | wcnfile.insert_wn_text_2(body2.Text, 2); 86 | wcnfile.insert_wn_text_2(body3.Text, 3); 87 | wcnfile.insert_wn_text_2(body4.Text, 4); 88 | wcnfile.insert_wn_text_2(body5.Text, 5); 89 | wcnfile.insert_wn_text_2(body6.Text, 6); 90 | wcnfile.insert_wn_text_2(body7.Text, 7); 91 | wcnfile.insert_wn_text_2(body8.Text, 8); 92 | wcnfile.insert_wn_text_2(body9.Text, 9); 93 | wcnfile.insert_wn_text_2(body10.Text,10); 94 | } 95 | 96 | void Load_WCN(string path) 97 | { 98 | int filesize = FileIO.load_file(ref wcnbuffer, ref path, wcnfilter); 99 | if( filesize == SAV3.WCN_SIZE || filesize == SAV3.WCN_SIZE_jap) 100 | { 101 | if (filesize == SAV3.WCN_SIZE_jap) 102 | { 103 | japanese = true; 104 | regionlab.Text = "JAP"; 105 | header1.MaxLength = 20; 106 | body1.MaxLength = 20; 107 | body2.MaxLength = 20; 108 | body3.MaxLength = 20; 109 | body4.MaxLength = 20; 110 | body5.MaxLength = 20; 111 | body6.MaxLength = 20; 112 | body7.MaxLength = 20; 113 | body8.MaxLength = 20; 114 | body9.MaxLength = 20; 115 | body10.MaxLength = 20; 116 | }else 117 | { 118 | japanese = false; 119 | regionlab.Text = "USA/EUR"; 120 | header1.MaxLength = 40; 121 | body1.MaxLength = 40; 122 | body2.MaxLength = 40; 123 | body3.MaxLength = 40; 124 | body4.MaxLength = 40; 125 | body5.MaxLength = 40; 126 | body6.MaxLength = 40; 127 | body7.MaxLength = 40; 128 | body8.MaxLength = 40; 129 | body9.MaxLength = 40; 130 | body10.MaxLength = 40; 131 | } 132 | 133 | wc3_path.Text = path; 134 | wcnfile = new wc3(wcnbuffer); 135 | 136 | update_wcdata(); 137 | 138 | save_wc3_but.Enabled = true; 139 | 140 | }else{ 141 | MessageBox.Show("Invalid file size."); 142 | } 143 | } 144 | void Load_wc3_butClick(object sender, EventArgs e) 145 | { 146 | Load_WCN(null); 147 | } 148 | void Save_wc3_butClick(object sender, EventArgs e) 149 | { 150 | int distro = 0; 151 | if(distrocheck.Checked) 152 | distro = 1; 153 | wcnfile.set_wcn_color_distro(colorbox.SelectedIndex , distro); 154 | set_wcndata(); 155 | wcnfile.fix_wcn_checksum(); 156 | //if (wcnfile.Edited) 157 | FileIO.save_data(wcnfile.Data, wcnfilter); 158 | //else MessageBox.Show("Save has not been edited"); 159 | } 160 | 161 | void WCN_editorLoad(object sender, EventArgs e) 162 | { 163 | 164 | } 165 | ResourceManager resources = new ResourceManager("WC3_TOOL.WC3.Image.Cards", Assembly.GetExecutingAssembly()); 166 | Image bitmap; 167 | void drawCard() 168 | { 169 | //ResourceManager resources = new ResourceManager("WC3_TOOL.WC3.Image.Cards", Assembly.GetExecutingAssembly()); 170 | bitmap = (Image)resources.GetObject("News_"+colorbox.SelectedIndex.ToString()); 171 | GFX.DrawImage(bitmap, 500, 140+26, 260, 140); 172 | GFX.DrawImage(bitmap, 500, 140, 260, 140); 173 | 174 | 175 | GFX.DrawString(header1.Text, new Font("Calibri", 8), Brushes.Black, 500+7, 140+4); 176 | GFX.DrawString(body1.Text, new Font("Calibri", 8), Brushes.Black, 500+7, 140+21); 177 | GFX.DrawString(body2.Text, new Font("Calibri", 8), Brushes.Black, 500+7, 140+21+(14*1)); 178 | GFX.DrawString(body3.Text, new Font("Calibri", 8), Brushes.Black, 500+7, 140+21+(14*2)); 179 | GFX.DrawString(body4.Text, new Font("Calibri", 8), Brushes.Black, 500+7, 140+21+(14*3)); 180 | GFX.DrawString(body5.Text, new Font("Calibri", 8), Brushes.Black, 500+7, 140+21+(14*4)); 181 | GFX.DrawString(body6.Text, new Font("Calibri", 8), Brushes.Black, 500+7, 140+21+(14*5)); 182 | GFX.DrawString(body7.Text, new Font("Calibri", 8), Brushes.Black, 500+7, 140+21+(14*6)); 183 | GFX.DrawString(body8.Text, new Font("Calibri", 8), Brushes.Black, 500+7, 140+21+(14*7)); 184 | GFX.DrawString(body9.Text, new Font("Calibri", 8), Brushes.Black, 500+7, 140+21+(14*8)); 185 | GFX.DrawString(body10.Text, new Font("Calibri", 8), Brushes.Black, 500+7, 140+21+(14*9)); 186 | 187 | } 188 | void ColorboxSelectedIndexChanged(object sender, EventArgs e) 189 | { 190 | drawCard(); 191 | } 192 | void Header1TextChanged(object sender, EventArgs e) 193 | { 194 | drawCard(); 195 | } 196 | void Body1TextChanged(object sender, EventArgs e) 197 | { 198 | drawCard(); 199 | } 200 | void Body2TextChanged(object sender, EventArgs e) 201 | { 202 | drawCard(); 203 | } 204 | void Body3TextChanged(object sender, EventArgs e) 205 | { 206 | drawCard(); 207 | } 208 | void Body4TextChanged(object sender, EventArgs e) 209 | { 210 | drawCard(); 211 | } 212 | void Body5TextChanged(object sender, EventArgs e) 213 | { 214 | drawCard(); 215 | } 216 | void Body6TextChanged(object sender, EventArgs e) 217 | { 218 | drawCard(); 219 | } 220 | void Body7TextChanged(object sender, EventArgs e) 221 | { 222 | drawCard(); 223 | } 224 | void Body8TextChanged(object sender, EventArgs e) 225 | { 226 | drawCard(); 227 | } 228 | void Body9TextChanged(object sender, EventArgs e) 229 | { 230 | drawCard(); 231 | } 232 | void Body10TextChanged(object sender, EventArgs e) 233 | { 234 | drawCard(); 235 | } 236 | 237 | void WCN_editorDragEnter(object sender, DragEventArgs e) 238 | { 239 | e.Effect = DragDropEffects.All; 240 | } 241 | void WCN_editorDragDrop(object sender, DragEventArgs e) 242 | { 243 | string[] files = (string[])e.Data.GetData(DataFormats.FileDrop, false); 244 | Load_WCN(files[0]); 245 | } 246 | } 247 | } 248 | -------------------------------------------------------------------------------- /wc3_tool/WC3/WCN_editor.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /wc3_tool/WC3_TOOL.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | {1E65C335-2DE3-410B-B713-5F7B023106CD} 5 | {FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} 6 | Debug 7 | AnyCPU 8 | WinExe 9 | WC3_TOOL 10 | WC3_TOOL 11 | v4.0 12 | Properties 13 | 14 | 15 | x86 16 | 17 | 18 | bin\Debug\ 19 | True 20 | Full 21 | False 22 | True 23 | DEBUG;TRACE 24 | 25 | 26 | bin\Release\ 27 | False 28 | None 29 | True 30 | False 31 | TRACE 32 | 33 | 34 | 35 | 4.0 36 | 37 | 38 | 39 | 3.5 40 | 41 | 42 | 43 | 3.5 44 | 45 | 46 | 47 | 48 | 49 | 3.5 50 | 51 | 52 | 53 | 54 | 55 | EventTool.cs 56 | 57 | 58 | 59 | MainScreen.cs 60 | 61 | 62 | 63 | Decor_editor.cs 64 | 65 | 66 | 67 | 68 | ECB_editor.cs 69 | 70 | 71 | 72 | 73 | ECT_editor.cs 74 | 75 | 76 | 77 | 78 | ECT_pkedit.cs 79 | 80 | 81 | 82 | 83 | ME3_editor.cs 84 | 85 | 86 | 87 | 88 | 89 | 90 | TV_editor.cs 91 | 92 | 93 | 94 | WC3_editor.cs 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | WC3_editor_givegg.cs 103 | 104 | 105 | 106 | WC3_editor_giveggExt.cs 107 | 108 | 109 | 110 | WCN_editor.cs 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | EventTool.cs 124 | 125 | 126 | MainScreen.cs 127 | 128 | 129 | Decor_editor.cs 130 | 131 | 132 | ECB_editor.cs 133 | 134 | 135 | ECT_editor.cs 136 | 137 | 138 | ECT_pkedit.cs 139 | 140 | 141 | 142 | 143 | 144 | ME3_editor.cs 145 | 146 | 147 | 148 | TV_editor.cs 149 | 150 | 151 | WC3_editor.cs 152 | 153 | 154 | WC3_editor_givegg.cs 155 | 156 | 157 | WC3_editor_giveggExt.cs 158 | 159 | 160 | WCN_editor.cs 161 | 162 | 163 | 164 | -------------------------------------------------------------------------------- /wc3_tool/app.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | --------------------------------------------------------------------------------