├── .gitignore ├── README.md ├── Source ├── CompareOtbForm.Designer.cs ├── CompareOtbForm.cs ├── CompareOtbForm.resx ├── ImageSimilarity │ ├── Complex.cs │ ├── Fourier.cs │ ├── ImageSimilarity.cs │ ├── ImageSimilarity.csproj │ ├── ImageUtils.cs │ └── Properties │ │ └── AssemblyInfo.cs ├── Plugin1010 │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── plugin.cs │ └── plugin1010.csproj ├── Plugin1021 │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── plugin.cs │ └── plugin1021.csproj ├── Plugin1050 │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── plugin.cs │ └── plugin1050.csproj ├── Plugin850 │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── plugin.cs │ └── plugin850.csproj ├── Plugin860 │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── plugin.cs │ └── plugin860.csproj ├── Plugin872 │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── plugin.cs │ └── plugin872.csproj ├── Plugin900 │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── plugin.cs │ └── plugin900.csproj ├── Plugin940 │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── plugin.cs │ └── plugin940.csproj ├── Plugin960 │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── plugin.cs │ └── plugin960.csproj ├── PluginCustom │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── plugin.cs │ └── plugincustom.csproj ├── PluginInterface │ ├── Item.cs │ ├── PluginInterface.cs │ ├── PluginInterface.csproj │ ├── Properties │ │ ├── AssemblyInfo.cs │ │ ├── Resources.Designer.cs │ │ └── Resources.resx │ ├── Settings.cs │ ├── Sprite.cs │ └── otbloader.cs ├── PluginServices.cs ├── Plugins │ ├── plugin1010.xml │ ├── plugin1021.xml │ ├── plugin1050.xml │ ├── plugin850.xml │ ├── plugin860.xml │ ├── plugin872.xml │ ├── plugin900.xml │ ├── plugin940.xml │ ├── plugin960.xml │ └── plugincustom.xml ├── Program.cs ├── ProgressForm.Designer.cs ├── ProgressForm.cs ├── ProgressForm.resx ├── Properties │ ├── AssemblyInfo.cs │ ├── Resources.Designer.cs │ ├── Resources.resx │ ├── Settings.Designer.cs │ └── Settings.settings ├── TextBoxTraceListener.cs ├── UpdateForm.Designer.cs ├── UpdateForm.cs ├── UpdateForm.resx ├── UpdateSettingsForm.Designer.cs ├── UpdateSettingsForm.cs ├── UpdateSettingsForm.resx ├── Utils.cs ├── app.config ├── otitemeditor.Designer.cs ├── otitemeditor.cs ├── otitemeditor.csproj ├── otitemeditor.ico └── otitemeditor.resx ├── build-linux.sh └── otitemeditor.sln /.gitignore: -------------------------------------------------------------------------------- 1 | # Scripts 2 | release/ 3 | debug/ 4 | 5 | # Visual studio intermediate directories 6 | bin/ 7 | obj/ 8 | *.suo 9 | *.csproj.user 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # What is OTItemEditor? 2 | 3 | OTItemEditor is a program used to edit the OTB data files used by OpenTibia 4 | servers and tools to map the item IDs used by the client to a consistent set of 5 | IDs used by the server and tools. This is necessary since CIPSoft changes the 6 | client-side IDs every major version released and remapping of them is required. 7 | 8 | This tool can read the Tibia.dat / Tibia.spr files distrbuted with the client 9 | and either match them up with the server-side IDs via image recognition and also 10 | add new items to the data files. 11 | 12 | 13 | # Download 14 | 15 | There are no builds of OTItemEditor available at the moment. 16 | 17 | 18 | # Compiling 19 | 20 | You can build the project using the provided otitemeditor.sln in Visual 21 | Studio 2010 or later. 22 | 23 | Just run ./build-linux.sh to compile. It uses xbuild from Mono package. 24 | 25 | If somebody can contribute compiling instructions for other platforms, that'd be 26 | great. 27 | 28 | 29 | # Bugs 30 | 31 | If you find a bug use the bug tracker on github to report it. 32 | 33 | 34 | # Contact 35 | 36 | The easiest way to contact the developers is to post to the forums at 37 | [otfans.net](otfans.net). 38 | 39 | 40 | # License 41 | 42 | OTItemEditor is made available under the GPLv2 License, this means that forks 43 | of the project must be distributed with sources available. 44 | -------------------------------------------------------------------------------- /Source/CompareOtbForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace otitemeditor 2 | { 3 | partial class CompareOtbForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.resultTextBox = new System.Windows.Forms.TextBox(); 32 | this.button1 = new System.Windows.Forms.Button(); 33 | this.button2 = new System.Windows.Forms.Button(); 34 | this.file1Text = new System.Windows.Forms.TextBox(); 35 | this.label1 = new System.Windows.Forms.Label(); 36 | this.file2Text = new System.Windows.Forms.TextBox(); 37 | this.label2 = new System.Windows.Forms.Label(); 38 | this.btnCompare = new System.Windows.Forms.Button(); 39 | this.SuspendLayout(); 40 | // 41 | // resultTextBox 42 | // 43 | this.resultTextBox.Location = new System.Drawing.Point(12, 168); 44 | this.resultTextBox.MaxLength = 0; 45 | this.resultTextBox.Multiline = true; 46 | this.resultTextBox.Name = "resultTextBox"; 47 | this.resultTextBox.ScrollBars = System.Windows.Forms.ScrollBars.Vertical; 48 | this.resultTextBox.Size = new System.Drawing.Size(359, 164); 49 | this.resultTextBox.TabIndex = 0; 50 | // 51 | // button1 52 | // 53 | this.button1.Location = new System.Drawing.Point(254, 23); 54 | this.button1.Name = "button1"; 55 | this.button1.Size = new System.Drawing.Size(75, 23); 56 | this.button1.TabIndex = 1; 57 | this.button1.Text = "Select..."; 58 | this.button1.UseVisualStyleBackColor = true; 59 | this.button1.Click += new System.EventHandler(this.button1_Click); 60 | // 61 | // button2 62 | // 63 | this.button2.Location = new System.Drawing.Point(254, 74); 64 | this.button2.Name = "button2"; 65 | this.button2.Size = new System.Drawing.Size(75, 23); 66 | this.button2.TabIndex = 2; 67 | this.button2.Text = "Select..."; 68 | this.button2.UseVisualStyleBackColor = true; 69 | this.button2.Click += new System.EventHandler(this.button2_Click); 70 | // 71 | // file1Text 72 | // 73 | this.file1Text.Location = new System.Drawing.Point(26, 25); 74 | this.file1Text.Name = "file1Text"; 75 | this.file1Text.Size = new System.Drawing.Size(222, 20); 76 | this.file1Text.TabIndex = 3; 77 | // 78 | // label1 79 | // 80 | this.label1.AutoSize = true; 81 | this.label1.Location = new System.Drawing.Point(23, 9); 82 | this.label1.Name = "label1"; 83 | this.label1.Size = new System.Drawing.Size(35, 13); 84 | this.label1.TabIndex = 4; 85 | this.label1.Text = "File 1:"; 86 | // 87 | // file2Text 88 | // 89 | this.file2Text.Location = new System.Drawing.Point(26, 74); 90 | this.file2Text.Name = "file2Text"; 91 | this.file2Text.Size = new System.Drawing.Size(222, 20); 92 | this.file2Text.TabIndex = 5; 93 | // 94 | // label2 95 | // 96 | this.label2.AutoSize = true; 97 | this.label2.Location = new System.Drawing.Point(23, 58); 98 | this.label2.Name = "label2"; 99 | this.label2.Size = new System.Drawing.Size(35, 13); 100 | this.label2.TabIndex = 6; 101 | this.label2.Text = "File 2:"; 102 | // 103 | // btnCompare 104 | // 105 | this.btnCompare.Location = new System.Drawing.Point(147, 127); 106 | this.btnCompare.Name = "btnCompare"; 107 | this.btnCompare.Size = new System.Drawing.Size(75, 23); 108 | this.btnCompare.TabIndex = 7; 109 | this.btnCompare.Text = "Compare!"; 110 | this.btnCompare.UseVisualStyleBackColor = true; 111 | this.btnCompare.Click += new System.EventHandler(this.btnCompare_Click); 112 | // 113 | // CompareOtbForm 114 | // 115 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 116 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 117 | this.ClientSize = new System.Drawing.Size(378, 344); 118 | this.Controls.Add(this.btnCompare); 119 | this.Controls.Add(this.label2); 120 | this.Controls.Add(this.file2Text); 121 | this.Controls.Add(this.label1); 122 | this.Controls.Add(this.file1Text); 123 | this.Controls.Add(this.button2); 124 | this.Controls.Add(this.button1); 125 | this.Controls.Add(this.resultTextBox); 126 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow; 127 | this.Name = "CompareOtbForm"; 128 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 129 | this.Text = "Compare OTB files"; 130 | this.ResumeLayout(false); 131 | this.PerformLayout(); 132 | 133 | } 134 | 135 | #endregion 136 | 137 | private System.Windows.Forms.TextBox resultTextBox; 138 | private System.Windows.Forms.Button button1; 139 | private System.Windows.Forms.Button button2; 140 | private System.Windows.Forms.TextBox file1Text; 141 | private System.Windows.Forms.Label label1; 142 | private System.Windows.Forms.TextBox file2Text; 143 | private System.Windows.Forms.Label label2; 144 | private System.Windows.Forms.Button btnCompare; 145 | } 146 | } -------------------------------------------------------------------------------- /Source/CompareOtbForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Text; 7 | using System.Windows.Forms; 8 | using PluginInterface; 9 | 10 | namespace otitemeditor 11 | { 12 | public partial class CompareOtbForm : Form 13 | { 14 | public CompareOtbForm() 15 | { 16 | InitializeComponent(); 17 | } 18 | 19 | private bool compareItems() 20 | { 21 | if (System.IO.File.Exists(file1Text.Text) && System.IO.File.Exists(file2Text.Text)) 22 | { 23 | OtbList items1 = new OtbList(); 24 | OtbList items2 = new OtbList(); 25 | 26 | bool result; 27 | result = otb.open(file1Text.Text, ref items1, false); 28 | if (!result) 29 | { 30 | MessageBox.Show("Could not open {0}", file1Text.Text); 31 | return false; 32 | } 33 | 34 | result = otb.open(file2Text.Text, ref items2, false); 35 | if (!result) 36 | { 37 | MessageBox.Show("Could not open {0}", file2Text.Text); 38 | return false; 39 | } 40 | 41 | IEnumerator enumerator1 = items1.GetEnumerator(); 42 | IEnumerator enumerator2 = items2.GetEnumerator(); 43 | 44 | if (items1.Count != items2.Count) 45 | { 46 | resultTextBox.AppendText(string.Format("Item count: [{0}]/[{1}]" + Environment.NewLine, items1.Count, items2.Count)); 47 | } 48 | 49 | while(enumerator1.MoveNext()){ 50 | if(!enumerator2.MoveNext()){ 51 | return false; 52 | } 53 | 54 | OtbItem item1 = enumerator1.Current; 55 | OtbItem item2 = enumerator2.Current; 56 | 57 | if (item1.spriteId != item2.spriteId) 58 | { 59 | resultTextBox.AppendText(string.Format("id: {0} Sprite changed [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.spriteId, item2.spriteId)); 60 | continue; 61 | } 62 | 63 | if (item1.spriteHash != null && item2.spriteHash != null && !Utils.ByteArrayCompare(item1.spriteHash, item2.spriteHash)) 64 | { 65 | resultTextBox.AppendText(string.Format("id: {0} Sprite updated" + Environment.NewLine, item1.id)); 66 | } 67 | 68 | if (item1.type != item2.type) 69 | { 70 | resultTextBox.AppendText(string.Format("id: {0} type [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.type, item2.type)); 71 | } 72 | 73 | if (item1.alwaysOnTop != item2.alwaysOnTop) 74 | { 75 | resultTextBox.AppendText(string.Format("id: {0} alwaysOnTop [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.alwaysOnTop, item2.alwaysOnTop)); 76 | } 77 | 78 | if (item1.alwaysOnTopOrder != item2.alwaysOnTopOrder) 79 | { 80 | resultTextBox.AppendText(string.Format("id: {0} alwaysOnTopOrder [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.alwaysOnTopOrder, item2.alwaysOnTopOrder)); 81 | } 82 | 83 | if (item1.blockObject != item2.blockObject) 84 | { 85 | resultTextBox.AppendText(string.Format("id: {0} blockObject [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.blockObject, item2.blockObject)); 86 | } 87 | 88 | if (item1.blockPathFind != item2.blockPathFind) 89 | { 90 | resultTextBox.AppendText(string.Format("id: {0} blockPathFind [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.blockPathFind, item2.blockPathFind)); 91 | } 92 | 93 | if (item1.blockProjectile != item2.blockProjectile) 94 | { 95 | resultTextBox.AppendText(string.Format("id: {0} blockProjectile [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.blockProjectile, item2.blockProjectile)); 96 | } 97 | 98 | if (item1.groundSpeed != item2.groundSpeed) 99 | { 100 | resultTextBox.AppendText(string.Format("id: {0} groundSpeed [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.groundSpeed, item2.groundSpeed)); 101 | } 102 | 103 | if (item1.hasHeight != item2.hasHeight) 104 | { 105 | resultTextBox.AppendText(string.Format("id: {0} hasHeight [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.hasHeight, item2.hasHeight)); 106 | } 107 | 108 | if (item1.hasUseWith != item2.hasUseWith) 109 | { 110 | resultTextBox.AppendText(string.Format("id: {0} Useable [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.hasUseWith, item2.hasUseWith)); 111 | } 112 | 113 | if (item1.isHangable != item2.isHangable) 114 | { 115 | resultTextBox.AppendText(string.Format("id: {0} isHangable [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.isHangable, item2.isHangable)); 116 | } 117 | 118 | if (item1.isHorizontal != item2.isHorizontal) 119 | { 120 | resultTextBox.AppendText(string.Format("id: {0} isHorizontal [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.isHorizontal, item2.isHorizontal)); 121 | } 122 | 123 | if (item1.isMoveable != item2.isMoveable) 124 | { 125 | resultTextBox.AppendText(string.Format("id: {0} isMoveable [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.isMoveable, item2.isMoveable)); 126 | } 127 | 128 | if (item1.isPickupable != item2.isPickupable) 129 | { 130 | resultTextBox.AppendText(string.Format("id: {0} isPickupable [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.isPickupable, item2.isPickupable)); 131 | } 132 | 133 | if (item1.isReadable != item2.isReadable) 134 | { 135 | resultTextBox.AppendText(string.Format("id: {0} isReadable [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.isReadable, item2.isReadable)); 136 | } 137 | 138 | if (item1.isRotatable != item2.isRotatable) 139 | { 140 | resultTextBox.AppendText(string.Format("id: {0} isRotatable [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.isRotatable, item2.isRotatable)); 141 | } 142 | 143 | if (item1.isStackable != item2.isStackable) 144 | { 145 | resultTextBox.AppendText(string.Format("id: {0} isStackable [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.isStackable, item2.isStackable)); 146 | } 147 | 148 | if (item1.isVertical != item2.isVertical) 149 | { 150 | resultTextBox.AppendText(string.Format("id: {0} isVertical [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.isVertical, item2.isVertical)); 151 | } 152 | 153 | if (item1.lightColor != item2.lightColor) 154 | { 155 | resultTextBox.AppendText(string.Format("id: {0} lightColor [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.lightColor, item2.lightColor)); 156 | } 157 | 158 | if (item1.lightLevel != item2.lightLevel) 159 | { 160 | resultTextBox.AppendText(string.Format("id: {0} lightLevel [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.lightLevel, item2.lightLevel)); 161 | } 162 | 163 | if (item1.lookThrough != item2.lookThrough) 164 | { 165 | resultTextBox.AppendText(string.Format("id: {0} lookThrough [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.lookThrough, item2.lookThrough)); 166 | } 167 | 168 | if (item1.maxReadChars != item2.maxReadChars) 169 | { 170 | resultTextBox.AppendText(string.Format("id: {0} maxReadChars [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.maxReadChars, item2.maxReadChars)); 171 | } 172 | 173 | if (item1.maxReadWriteChars != item2.maxReadWriteChars) 174 | { 175 | resultTextBox.AppendText(string.Format("id: {0} maxReadWriteChars [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.maxReadWriteChars, item2.maxReadWriteChars)); 176 | } 177 | 178 | if (item1.minimapColor != item2.minimapColor) 179 | { 180 | resultTextBox.AppendText(string.Format("id: {0} minimapColor [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.minimapColor, item2.minimapColor)); 181 | } 182 | 183 | if (item1.name != item2.name) 184 | { 185 | resultTextBox.AppendText(string.Format("id: {0} name [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.name, item2.name)); 186 | } 187 | 188 | if (item1.walkStack != item2.walkStack) 189 | { 190 | resultTextBox.AppendText(string.Format("id: {0} walkstack [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.walkStack, item2.walkStack)); 191 | } 192 | 193 | if (item1.wareId != item2.wareId) 194 | { 195 | resultTextBox.AppendText(string.Format("id: {0} wareid [{1}]/[{2}]" + Environment.NewLine, item1.id, item1.wareId, item2.wareId)); 196 | } 197 | } 198 | 199 | if (resultTextBox.Text.Length == 0) 200 | { 201 | MessageBox.Show("No differences found!"); 202 | } 203 | 204 | return true; 205 | } 206 | 207 | return false; 208 | } 209 | 210 | private void btnCompare_Click(object sender, EventArgs e) 211 | { 212 | resultTextBox.Clear(); 213 | compareItems(); 214 | } 215 | 216 | private void button1_Click(object sender, EventArgs e) 217 | { 218 | FileDialog dialog = new OpenFileDialog(); 219 | 220 | //Now set the file type 221 | dialog.Filter = "otb files (*.otb)|*.otb|All files (*.*)|*.*"; 222 | 223 | dialog.Title = "Open otb file..."; 224 | 225 | if (dialog.ShowDialog() == DialogResult.OK) 226 | { 227 | if (dialog.FileName.Length == 0) 228 | { 229 | return; 230 | } 231 | } 232 | 233 | file1Text.Text = dialog.FileName; 234 | } 235 | 236 | private void button2_Click(object sender, EventArgs e) 237 | { 238 | FileDialog dialog = new OpenFileDialog(); 239 | 240 | //Now set the file type 241 | dialog.Filter = "otb files (*.otb)|*.otb|All files (*.*)|*.*"; 242 | 243 | dialog.Title = "Open otb file..."; 244 | 245 | if (dialog.ShowDialog() == DialogResult.OK) 246 | { 247 | if (dialog.FileName.Length == 0) 248 | { 249 | return; 250 | } 251 | } 252 | 253 | file2Text.Text = dialog.FileName; 254 | } 255 | } 256 | } 257 | -------------------------------------------------------------------------------- /Source/CompareOtbForm.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 | -------------------------------------------------------------------------------- /Source/ImageSimilarity/Complex.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace ImageSimilarity 6 | { 7 | public class Complex 8 | { 9 | private double m_Re; 10 | 11 | public double Re 12 | { 13 | get { return m_Re; } 14 | set { m_Re = value; } 15 | } 16 | private double m_Im; 17 | 18 | public double Im 19 | { 20 | get { return m_Im; } 21 | set { m_Im = value; } 22 | } 23 | public Complex() 24 | { 25 | } 26 | public Complex(double r, double i) 27 | { 28 | m_Re = r; 29 | m_Im = i; 30 | } 31 | public Complex(double r) 32 | { 33 | m_Re = r; 34 | m_Im = 0; 35 | } 36 | public double GetModulus() 37 | { 38 | return Math.Sqrt(m_Re * m_Re + m_Im * m_Im); 39 | } 40 | public override string ToString() 41 | { 42 | return m_Re + " + " + m_Im + "i"; 43 | } 44 | public static Complex operator -(Complex a) 45 | { 46 | return new Complex(-a.Re, -a.Im); 47 | } 48 | public static Complex operator +(Complex a, Complex b) 49 | { 50 | return new Complex(a.Re + b.Re, a.Im + b.Im); 51 | } 52 | public static Complex operator +(Complex a, double b) 53 | { 54 | return new Complex(a.Re + b, a.Im); 55 | } 56 | public static Complex operator +(double b, Complex a) 57 | { 58 | return new Complex(a.Re + b, a.Im); 59 | } 60 | public static Complex operator -(Complex a, Complex b) 61 | { 62 | return new Complex(a.Re - b.Re, a.Im - b.Im); 63 | } 64 | public static Complex operator -(Complex a, double b) 65 | { 66 | return new Complex(a.Re - b, a.Im); 67 | } 68 | public static Complex operator -(double b, Complex a) 69 | { 70 | return new Complex(b - a.Re, -a.Im); 71 | } 72 | 73 | public static Complex operator *(Complex a, Complex b) 74 | { 75 | return new Complex(a.Re * b.Re - a.Im * b.Im, a.Re * b.Im + a.Im * b.Re); 76 | } 77 | public static Complex operator *(Complex a, double b) 78 | { 79 | return new Complex(a.Re * b, a.Im * b); 80 | } 81 | public static Complex operator *(double b, Complex a) 82 | { 83 | return new Complex(a.Re * b, a.Im * b); 84 | } 85 | public static Complex operator /(Complex a, Complex b) 86 | { 87 | double denom = b.Re * b.Re + b.Im * b.Im; 88 | if (denom == 0) 89 | { 90 | throw new DivideByZeroException(); 91 | } 92 | return new Complex((a.Re * b.Re + a.Im * b.Im) / denom, (a.Im * b.Re - a.Re * b.Im) / denom); 93 | } 94 | public static Complex operator /(Complex a, double b) 95 | { 96 | return new Complex(a.Re / b, a.Im / b); 97 | } 98 | public static Complex operator /(double b, Complex a) 99 | { 100 | return new Complex(b / a.Re, b / a.Im); 101 | } 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /Source/ImageSimilarity/ImageSimilarity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Drawing; 5 | using System.Drawing.Imaging; 6 | 7 | namespace ImageSimilarity 8 | { 9 | public class ImageSimilarity 10 | { 11 | public static void CompareImage(Bitmap bitmap1, Bitmap bitmap2, int blockSize, out double similarity) 12 | { 13 | similarity = 0.0; 14 | 15 | Bitmap ff2dbitmap1 = Fourier.fft2d(bitmap1, false); 16 | Bitmap ff2dbitmap2 = Fourier.fft2d(bitmap2, false); 17 | 18 | double[,] keySignature = ImageUtils.CalculateEuclideanDistance(ff2dbitmap1, blockSize); 19 | double[,] compareSignature = ImageUtils.CalculateEuclideanDistance(ff2dbitmap2, blockSize); 20 | 21 | similarity = ImageUtils.CompareSignature(keySignature, compareSignature); 22 | } 23 | 24 | public static void CompareImageRGB(Bitmap bitmap1, Bitmap bitmap2, int blockSize, out double similarity) 25 | { 26 | similarity = 0.0; 27 | 28 | Bitmap ff2dbitmap1 = Fourier.fft2dRGB(bitmap1, true); 29 | Bitmap ff2dbitmap2 = Fourier.fft2dRGB(bitmap2, true); 30 | 31 | double[,] keySignature = ImageUtils.CalculateEuclideanDistance(ff2dbitmap1, blockSize); 32 | double[,] compareSignature = ImageUtils.CalculateEuclideanDistance(ff2dbitmap2, blockSize); 33 | 34 | similarity = ImageUtils.CompareSignature(keySignature, compareSignature); 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Source/ImageSimilarity/ImageSimilarity.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {2FBAC16E-457D-472B-880D-8D393F8A7827} 9 | Library 10 | Properties 11 | ImageSimilarity 12 | ImageSimilarity 13 | v2.0 14 | 512 15 | 16 | 17 | 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 55 | -------------------------------------------------------------------------------- /Source/ImageSimilarity/ImageUtils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Drawing; 4 | using System.Drawing.Imaging; 5 | using System.IO; 6 | 7 | namespace ImageSimilarity 8 | { 9 | public class ImageUtils 10 | { 11 | public struct RGB 12 | { 13 | public byte r; 14 | public byte g; 15 | public byte b; 16 | } 17 | 18 | public static double CompareSignature(double[,] signature1, double[,] signature2) 19 | { 20 | if (signature1.Length != signature2.Length) 21 | { 22 | return 1.0d; 23 | } 24 | 25 | double rSum = 0.0, gSum = 0.0, bSum = 0; 26 | for (int i = 0; i < signature2.GetLength(1); i++) 27 | { 28 | rSum += (signature1[0, i] - signature2[0, i]) * (signature1[0, i] - signature2[0, i]); 29 | gSum += (signature1[1, i] - signature2[1, i]) * (signature1[1, i] - signature2[1, i]); 30 | bSum += (signature1[2, i] - signature2[2, i]) * (signature1[2, i] - signature2[2, i]); 31 | } 32 | 33 | rSum = Math.Sqrt(rSum); 34 | gSum = Math.Sqrt(gSum); 35 | bSum = Math.Sqrt(bSum); 36 | 37 | return rSum + gSum + bSum; 38 | } 39 | 40 | public static double[,] CalculateEuclideanDistance(Bitmap input, int blockSize) 41 | { 42 | int bitPerPixel = Image.GetPixelFormatSize(input.PixelFormat); 43 | BitmapData bmpData = input.LockBits( 44 | new Rectangle(0, 0, input.Width, input.Height), 45 | ImageLockMode.WriteOnly, input.PixelFormat); 46 | 47 | // Declare an array to hold the bytes of the bitmap. 48 | int bytes = bmpData.Stride * input.Height; 49 | byte[] rgbValues = new byte[bytes]; 50 | 51 | // Copy the RGB values into the array. 52 | System.Runtime.InteropServices.Marshal.Copy(bmpData.Scan0, rgbValues, 0, bytes); 53 | input.UnlockBits(bmpData); 54 | 55 | int blockNum = 0; 56 | double[,] lSignature = new double[3, (input.Width / blockSize) * (input.Height / blockSize)]; 57 | double rSum = 0.0, gSum = 0.0, bSum = 0; 58 | 59 | for (int y = 0; y < input.Height; y += blockSize) 60 | { 61 | for (int x = 0; x < input.Width; x += blockSize) 62 | { 63 | lSignature[0, blockNum] = 0.0; 64 | lSignature[1, blockNum] = 0.0; 65 | lSignature[2, blockNum] = 0.0; 66 | 67 | for (int blocky = 0; blocky < blockSize; ++blocky) 68 | { 69 | for (int blockx = 0; blockx < blockSize; ++blockx) 70 | { 71 | byte r = rgbValues[((y + blocky) * 3 * input.Height) + ((x + blockx) * 3) + 0]; 72 | byte g = rgbValues[((y + blocky) * 3 * input.Height) + ((x + blockx) * 3) + 1]; 73 | byte b = rgbValues[((y + blocky) * 3 * input.Height) + ((x + blockx) * 3) + 2]; 74 | 75 | rSum += (double)r; 76 | gSum += (double)g; 77 | bSum += (double)b; 78 | } 79 | } 80 | 81 | lSignature[0, blockNum] = Math.Sqrt(rSum); 82 | lSignature[1, blockNum] = Math.Sqrt(gSum); 83 | lSignature[2, blockNum] = Math.Sqrt(bSum); 84 | ++blockNum; 85 | } 86 | } 87 | 88 | // Normalize 89 | for (int i = 0; i < lSignature.GetLength(1); i++) 90 | { 91 | rSum += lSignature[0, i]; 92 | gSum += lSignature[1, i]; 93 | bSum += lSignature[2, i]; 94 | } 95 | 96 | for (int i = 0; i < lSignature.GetLength(1); i++) 97 | { 98 | lSignature[0, i] /= rSum; 99 | lSignature[1, i] /= gSum; 100 | lSignature[2, i] /= bSum; 101 | } 102 | 103 | return lSignature; 104 | } 105 | 106 | public static byte[] greyScale(Bitmap input) 107 | { 108 | BitmapData bmpData = input.LockBits(new Rectangle(0, 0, input.Width, input.Height), ImageLockMode.ReadWrite, input.PixelFormat); 109 | int width = input.Width; 110 | int height = input.Height; 111 | byte[] data = new byte[input.Width * input.Height * 3]; 112 | System.Runtime.InteropServices.Marshal.Copy(bmpData.Scan0, data, 0, data.Length); 113 | 114 | input.UnlockBits(bmpData); 115 | 116 | byte[] greyscale = new byte[width * height]; 117 | 118 | int counter = 0; 119 | for (int i = 0; i < data.Length; i += 3) 120 | { 121 | greyscale[counter++] = (byte)(((66 * data[i + 2] + 129 * data[i] + 25 * data[i + 1] + 128) >> 8) + 16); 122 | } 123 | 124 | return greyscale; 125 | } 126 | 127 | public static byte[] CombineColorChannels(RGB[] rgb) 128 | { 129 | byte[] data = new byte[rgb.Length * 3]; 130 | 131 | int counter = 0; 132 | for (int i = 0; i < data.Length; i += 3) 133 | { 134 | data[i] = rgb[counter].r; 135 | data[i + 1] = rgb[counter].g; 136 | data[i + 2] = rgb[counter].b; 137 | 138 | ++counter; 139 | } 140 | 141 | return data; 142 | } 143 | 144 | public static RGB[] SplitColorChannels(Bitmap input) 145 | { 146 | BitmapData bmpData = input.LockBits(new Rectangle(0, 0, input.Width, input.Height), ImageLockMode.ReadWrite, input.PixelFormat); 147 | int width = input.Width; 148 | int height = input.Height; 149 | byte[] data = new byte[input.Width * input.Height * 3]; 150 | System.Runtime.InteropServices.Marshal.Copy(bmpData.Scan0, data, 0, data.Length); 151 | 152 | input.UnlockBits(bmpData); 153 | 154 | RGB[] rgb = new RGB[width * height]; 155 | 156 | int counter = 0; 157 | for (int i = 0; i < data.Length; i += 3) 158 | { 159 | rgb[counter].r = data[i + 0]; 160 | rgb[counter].b = data[i + 1]; 161 | rgb[counter].g = data[i + 2]; 162 | 163 | ++counter; 164 | } 165 | 166 | return rgb; 167 | } 168 | 169 | public static Bitmap getBitmap(byte[] rgbData, PixelFormat pixelFormat, int Width, int Height) 170 | { 171 | int bitPerPixel = Image.GetPixelFormatSize(pixelFormat); 172 | Bitmap bmp = new Bitmap(Width, Height, PixelFormat.Format24bppRgb); 173 | BitmapData bmpData = bmp.LockBits(new Rectangle(0, 0, bmp.Width, bmp.Height), 174 | ImageLockMode.ReadWrite, bmp.PixelFormat); 175 | 176 | if (pixelFormat == PixelFormat.Format24bppRgb) 177 | { 178 | //reverse rgb 179 | for (int y = 0; y < Height; ++y) 180 | { 181 | for (int x = 0; x < Width; ++x) 182 | { 183 | byte r = rgbData[Width * (bitPerPixel / 8) * y + x * (bitPerPixel / 8) + 0]; 184 | byte g = rgbData[Width * (bitPerPixel / 8) * y + x * (bitPerPixel / 8) + 1]; 185 | byte b = rgbData[Width * (bitPerPixel / 8) * y + x * (bitPerPixel / 8) + 2]; 186 | 187 | rgbData[Width * (bitPerPixel / 8) * y + x * (bitPerPixel / 8) + 0] = b; 188 | rgbData[Width * (bitPerPixel / 8) * y + x * (bitPerPixel / 8) + 1] = g; 189 | rgbData[Width * (bitPerPixel / 8) * y + x * (bitPerPixel / 8) + 2] = r; 190 | } 191 | } 192 | 193 | System.Runtime.InteropServices.Marshal.Copy(rgbData, 0, bmpData.Scan0, rgbData.Length); 194 | } 195 | else 196 | { 197 | byte[] grayscale = new byte[Width * Height * 3]; 198 | int n = 0; 199 | for (int y = 0; y < Height; ++y) 200 | { 201 | for (int x = 0; x < Width; ++x) 202 | { 203 | grayscale[n * 3 + 0] = rgbData[n]; 204 | grayscale[n * 3 + 1] = rgbData[n]; 205 | grayscale[n * 3 + 2] = rgbData[n]; 206 | ++n; 207 | } 208 | } 209 | 210 | //bmpData.Stride = -bmpData.Stride; 211 | System.Runtime.InteropServices.Marshal.Copy(grayscale, 0, bmpData.Scan0, grayscale.Length); 212 | } 213 | 214 | 215 | bmp.UnlockBits(bmpData); 216 | return bmp; 217 | } 218 | } 219 | } 220 | -------------------------------------------------------------------------------- /Source/ImageSimilarity/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("ImageSimilarity")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("ImageSimilarity")] 13 | [assembly: AssemblyCopyright("Copyright © 2010")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("38f0e18e-0863-4ee7-bb5f-843c979572af")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Source/Plugin1010/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("plugin1010")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("plugin1010")] 13 | [assembly: AssemblyCopyright("Copyright © 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("bee2d20c-c1c3-4a22-a3e8-8f62fa4295cb")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.1.0")] 36 | [assembly: AssemblyFileVersion("1.0.1.0")] 37 | -------------------------------------------------------------------------------- /Source/Plugin1010/plugin1010.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {D0473665-569C-4205-89DE-23074EBD0DC1} 9 | Library 10 | Properties 11 | plugin1010 12 | plugin1010 13 | v4.0 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | {2FBAC16E-457D-472B-880D-8D393F8A7827} 46 | ImageSimilarity 47 | 48 | 49 | {CEF21172-258C-4D0D-B024-ED7EF99612A2} 50 | PluginInterface 51 | 52 | 53 | 54 | 61 | -------------------------------------------------------------------------------- /Source/Plugin1021/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("plugin1021")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("plugin1021")] 13 | [assembly: AssemblyCopyright("Copyright © 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("bee2d20c-c1c3-4a22-a3e8-8f62fa4295cb")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.2.1")] 36 | [assembly: AssemblyFileVersion("1.0.2.1")] 37 | -------------------------------------------------------------------------------- /Source/Plugin1021/plugin1021.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {D2C9DCC5-05F8-4204-96F9-3231DAE13525} 9 | Library 10 | Properties 11 | plugin1021 12 | plugin1021 13 | v4.0 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | {2FBAC16E-457D-472B-880D-8D393F8A7827} 46 | ImageSimilarity 47 | 48 | 49 | {CEF21172-258C-4D0D-B024-ED7EF99612A2} 50 | PluginInterface 51 | 52 | 53 | 54 | 61 | -------------------------------------------------------------------------------- /Source/Plugin1050/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("plugin1021")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("plugin1021")] 13 | [assembly: AssemblyCopyright("Copyright © 2013")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("bee2d20c-c1c3-4a22-a3e8-8f62fa4295cb")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.2.1")] 36 | [assembly: AssemblyFileVersion("1.0.2.1")] 37 | -------------------------------------------------------------------------------- /Source/Plugin1050/plugin1050.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {8971B039-90A9-4A61-9BE1-3565D5C6332F} 9 | Library 10 | Properties 11 | plugin1050 12 | plugin1050 13 | v3.5 14 | 512 15 | Client 16 | 17 | 18 | true 19 | full 20 | false 21 | bin\Debug\ 22 | DEBUG;TRACE 23 | prompt 24 | 4 25 | 26 | 27 | pdbonly 28 | true 29 | bin\Release\ 30 | TRACE 31 | prompt 32 | 4 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | {2FBAC16E-457D-472B-880D-8D393F8A7827} 47 | ImageSimilarity 48 | 49 | 50 | {CEF21172-258C-4D0D-B024-ED7EF99612A2} 51 | PluginInterface 52 | 53 | 54 | 55 | 62 | -------------------------------------------------------------------------------- /Source/Plugin850/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("otitemeditor.Tibia860")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("otitemeditor.Tibia860")] 13 | [assembly: AssemblyCopyright("Copyright © 2010")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("1c707bc7-809b-4643-a6b6-23b3cb26879e")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Source/Plugin850/plugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.IO; 5 | using System.Collections; 6 | using PluginInterface; 7 | using otitemeditor; 8 | using System.Diagnostics; 9 | 10 | namespace Tibia850 11 | { 12 | public class Item850 : SpriteItem 13 | { 14 | public bool hasCharges; 15 | 16 | public override bool isEqual(Item item) 17 | { 18 | if (item is Item850) 19 | { 20 | if(((Item850)item).hasCharges != hasCharges) 21 | { 22 | return false; 23 | } 24 | } 25 | 26 | return base.isEqual(item); 27 | } 28 | } 29 | 30 | public class Plugin : IPlugin 31 | { 32 | Dictionary sprites = new Dictionary(); 33 | SpriteItems items = new SpriteItems(); 34 | List supportedClients = new List(); 35 | IPluginHost myHost = null; 36 | 37 | //IPlugin implementation 38 | public IPluginHost Host { get { return myHost; } set { myHost = value; } } 39 | 40 | public List SupportedClients { get { return supportedClients; } } 41 | public SpriteItems Items { get { return items; } set { items = value; } } 42 | 43 | public bool LoadClient(SupportedClient client, string datFullPath, string sprFullPath) 44 | { 45 | return loadDat(datFullPath, client.datSignature) && loadSprites(sprFullPath, client.sprSignature); 46 | } 47 | 48 | public void Initialize() 49 | { 50 | settings.Load("plugin850.xml"); 51 | supportedClients = settings.GetSupportedClientList(); 52 | } 53 | 54 | public void Dispose() 55 | { 56 | sprites.Clear(); 57 | items.Clear(); 58 | } 59 | 60 | //internal implementation 61 | public Settings settings = new Settings(); 62 | 63 | public bool loadSprites(string filename, UInt32 signature) 64 | { 65 | return Sprite.loadSprites(filename, ref sprites, signature); 66 | } 67 | 68 | public bool loadDat(string filename, UInt32 signature) 69 | { 70 | FileStream fileStream = new FileStream(filename, FileMode.Open); 71 | try 72 | { 73 | using (BinaryReader reader = new BinaryReader(fileStream)) 74 | { 75 | UInt32 datSignature = reader.ReadUInt32(); 76 | if (signature != 0 && datSignature != signature) 77 | { 78 | return false; 79 | } 80 | 81 | //get max id 82 | UInt16 itemCount = reader.ReadUInt16(); 83 | UInt16 creatureCount = reader.ReadUInt16(); 84 | UInt16 effectCount = reader.ReadUInt16(); 85 | UInt16 distanceCount = reader.ReadUInt16(); 86 | 87 | UInt16 minclientID = 100; //items starts at 100 88 | UInt16 maxclientID = itemCount; 89 | 90 | UInt16 id = minclientID; 91 | while (id <= maxclientID) 92 | { 93 | Item850 item = new Item850(); 94 | item.id = id; 95 | items[id] = item; 96 | 97 | // read the options until we find 0xff 98 | byte optbyte; 99 | do 100 | { 101 | optbyte = reader.ReadByte(); 102 | //Trace.WriteLine(String.Format("{0:X}", optbyte)); 103 | 104 | switch (optbyte) 105 | { 106 | case 0x00: //groundtile 107 | { 108 | item.groundSpeed = reader.ReadUInt16(); 109 | item.type = ItemType.Ground; 110 | } break; 111 | 112 | case 0x01: //all OnTop 113 | { 114 | item.alwaysOnTop = true; 115 | item.alwaysOnTopOrder = 1; 116 | } break; 117 | 118 | case 0x02: //can walk trough (open doors, arces, bug pen fence) 119 | { 120 | item.alwaysOnTop = true; 121 | item.alwaysOnTopOrder = 2; 122 | } break; 123 | 124 | case 0x03: //can walk trough (arces) 125 | { 126 | item.alwaysOnTop = true; 127 | item.alwaysOnTopOrder = 3; 128 | } break; 129 | 130 | case 0x04: //container 131 | { 132 | item.type = ItemType.Container; 133 | } break; 134 | 135 | case 0x05: //stackable 136 | { 137 | item.isStackable = true; 138 | break; 139 | } 140 | 141 | case 0x06: 142 | { 143 | // 144 | } break; 145 | 146 | case 0x07: //useable 147 | { 148 | item.hasUseWith = true; 149 | } break; 150 | 151 | case 0x08: //charges 152 | { 153 | item.hasCharges = true; 154 | } break; 155 | 156 | case 0x09: //read/write-able 157 | { 158 | item.isReadable = true; 159 | //item.isWriteable = true; 160 | item.maxReadWriteChars = reader.ReadUInt16(); 161 | } break; 162 | 163 | case 0x0A: //readable objects 164 | { 165 | item.isReadable = true; 166 | item.maxReadChars = reader.ReadUInt16(); 167 | } break; 168 | 169 | case 0x0B: //fluid containers 170 | { 171 | item.type = ItemType.Fluid; 172 | } break; 173 | 174 | case 0x0C: //splashes 175 | { 176 | item.type = ItemType.Splash; 177 | } break; 178 | 179 | case 0x0D: //blocks solid objects (creatures, walls etc) 180 | { 181 | item.blockObject = true; 182 | } break; 183 | 184 | case 0x0E: //not moveable 185 | { 186 | item.isMoveable = false; 187 | } break; 188 | 189 | case 0x0F: //blocks missiles (walls, magic wall etc) 190 | { 191 | item.blockProjectile = true; 192 | } break; 193 | 194 | case 0x10: //blocks pathfind algorithms (monsters) 195 | { 196 | item.blockPathFind = true; 197 | } break; 198 | 199 | case 0x11: //blocks monster movement (flowers, parcels etc) 200 | { 201 | item.isPickupable = true; 202 | } break; 203 | 204 | case 0x12: //hangable objects (wallpaper etc) 205 | { 206 | item.isHangable = true; 207 | } break; 208 | 209 | case 0x13: //horizontal wall 210 | { 211 | item.isHorizontal = true; 212 | } break; 213 | 214 | case 0x14: //vertical wall 215 | { 216 | item.isVertical = true; 217 | } break; 218 | 219 | case 0x15: //rotatable 220 | { 221 | item.isRotatable = true; 222 | } break; 223 | 224 | case 0x16: //light info 225 | { 226 | item.lightLevel = reader.ReadUInt16(); 227 | item.lightColor = reader.ReadUInt16(); 228 | } break; 229 | 230 | case 0x17: //changes floor 231 | { 232 | } break; 233 | 234 | case 0x18: //unknown 235 | { 236 | } break; 237 | 238 | case 0x19: //unknown 239 | { 240 | reader.BaseStream.Seek(4, SeekOrigin.Current); 241 | } break; 242 | 243 | case 0x1A: // 244 | { 245 | item.hasHeight = true; 246 | UInt16 height = reader.ReadUInt16(); 247 | } break; 248 | 249 | case 0x1B: //draw with height offset for all parts (2x2) of the sprite 250 | { 251 | } break; 252 | 253 | case 0x1C: //unknown 254 | { 255 | break; 256 | } 257 | 258 | case 0x1D: //minimap color 259 | { 260 | item.minimapColor = reader.ReadUInt16(); 261 | } break; 262 | 263 | case 0x1E: //in-game help info 264 | { 265 | UInt16 opt = reader.ReadUInt16(); 266 | if (opt == 1112) 267 | { 268 | item.isReadable = true; 269 | } 270 | } break; 271 | 272 | case 0x1F: //unknown 273 | { 274 | } break; 275 | 276 | case 0x20: //look through (borders) 277 | { 278 | item.lookThrough = true; 279 | } break; 280 | 281 | case 0xFF: //end of attributes 282 | { 283 | } break; 284 | 285 | default: 286 | { 287 | Trace.WriteLine(String.Format("Unknown optbyte {0:X}", optbyte)); 288 | return false; 289 | } 290 | } 291 | } while (optbyte != 0xFF); 292 | 293 | item.width = reader.ReadByte(); 294 | item.height = reader.ReadByte(); 295 | if ((item.width > 1) || (item.height > 1)) 296 | { 297 | reader.BaseStream.Position++; 298 | } 299 | 300 | item.frames = reader.ReadByte(); 301 | item.xdiv = reader.ReadByte(); 302 | item.ydiv = reader.ReadByte(); 303 | item.zdiv = reader.ReadByte(); 304 | item.animationLength = reader.ReadByte(); 305 | 306 | item.numSprites = 307 | (UInt32)item.width * (UInt32)item.height * 308 | (UInt32)item.frames * 309 | (UInt32)item.xdiv * (UInt32)item.ydiv * item.zdiv * 310 | (UInt32)item.animationLength; 311 | 312 | // Read the sprite ids 313 | for (UInt32 i = 0; i < item.numSprites; ++i) 314 | { 315 | UInt16 spriteId = reader.ReadUInt16(); 316 | Sprite sprite; 317 | if (!sprites.TryGetValue(spriteId, out sprite)) 318 | { 319 | sprite = new Sprite(); 320 | sprite.id = spriteId; 321 | sprites[spriteId] = sprite; 322 | } 323 | 324 | item.spriteList.Add(sprite); 325 | } 326 | 327 | ++id; 328 | } 329 | } 330 | } 331 | finally 332 | { 333 | fileStream.Close(); 334 | } 335 | 336 | return true; 337 | } 338 | } 339 | } 340 | -------------------------------------------------------------------------------- /Source/Plugin850/plugin850.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {4624E915-FB86-4DDB-ACA6-A2313F70BA9C} 9 | Library 10 | Properties 11 | plugin850 12 | plugin850 13 | v2.0 14 | 512 15 | 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | {CEF21172-258C-4D0D-B024-ED7EF99612A2} 47 | PluginInterface 48 | False 49 | 50 | 51 | 52 | 59 | -------------------------------------------------------------------------------- /Source/Plugin860/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("otitemeditor.Tibia860")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("otitemeditor.Tibia860")] 13 | [assembly: AssemblyCopyright("Copyright © 2010")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("1c707bc7-809b-4643-a6b6-23b3cb26879e")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Source/Plugin860/plugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.IO; 5 | using System.Collections; 6 | using PluginInterface; 7 | using otitemeditor; 8 | using System.Diagnostics; 9 | 10 | namespace Tibia860 11 | { 12 | public class Plugin : IPlugin 13 | { 14 | Dictionary sprites = new Dictionary(); 15 | SpriteItems items = new SpriteItems(); 16 | List supportedClients = new List(); 17 | 18 | IPluginHost myHost = null; 19 | 20 | //IPlugin implementation 21 | public IPluginHost Host { get { return myHost; } set { myHost = value; } } 22 | 23 | public List SupportedClients { get { return supportedClients; } } 24 | public SpriteItems Items { get { return items; } set { items = value; } } 25 | 26 | public bool LoadClient(SupportedClient client, string datFullPath, string sprFullPath) 27 | { 28 | return loadDat(datFullPath, client.datSignature) && loadSprites(sprFullPath, client.sprSignature); 29 | } 30 | 31 | public void Initialize() 32 | { 33 | settings.Load("plugin860.xml"); 34 | supportedClients = settings.GetSupportedClientList(); 35 | } 36 | 37 | public void Dispose() 38 | { 39 | sprites.Clear(); 40 | items.Clear(); 41 | } 42 | 43 | //internal implementation 44 | public Settings settings = new Settings(); 45 | 46 | public bool loadSprites(string filename, UInt32 signature) { return Sprite.loadSprites(filename, ref sprites, signature); } 47 | 48 | public bool loadDat(string filename, UInt32 signature) 49 | { 50 | FileStream fileStream = new FileStream(filename, FileMode.Open); 51 | try 52 | { 53 | using (BinaryReader reader = new BinaryReader(fileStream)) 54 | { 55 | UInt32 datSignature = reader.ReadUInt32(); 56 | if (signature != 0 && datSignature != signature) 57 | { 58 | return false; 59 | } 60 | 61 | //get max id 62 | UInt16 itemCount = reader.ReadUInt16(); 63 | UInt16 creatureCount = reader.ReadUInt16(); 64 | UInt16 effectCount = reader.ReadUInt16(); 65 | UInt16 distanceCount = reader.ReadUInt16(); 66 | 67 | UInt16 minclientID = 100; //items starts at 100 68 | UInt16 maxclientID = itemCount; 69 | 70 | UInt16 id = minclientID; 71 | while (id <= maxclientID) 72 | { 73 | SpriteItem item = new SpriteItem(); 74 | item.id = id; 75 | items[id] = item; 76 | 77 | // read the options until we find 0xff 78 | byte optbyte; 79 | do 80 | { 81 | optbyte = reader.ReadByte(); 82 | //Trace.WriteLine(String.Format("{0:X}", optbyte)); 83 | 84 | switch (optbyte) 85 | { 86 | case 0x00: //groundtile 87 | { 88 | item.groundSpeed = reader.ReadUInt16(); 89 | item.type = ItemType.Ground; 90 | } break; 91 | 92 | case 0x01: //all OnTop 93 | { 94 | item.alwaysOnTop = true; 95 | item.alwaysOnTopOrder = 1; 96 | } break; 97 | 98 | case 0x02: //can walk trough (open doors, arces, bug pen fence) 99 | { 100 | item.alwaysOnTop = true; 101 | item.alwaysOnTopOrder = 2; 102 | } break; 103 | 104 | case 0x03: //can walk trough (arces) 105 | { 106 | item.alwaysOnTop = true; 107 | item.alwaysOnTopOrder = 3; 108 | } break; 109 | 110 | case 0x04: //container 111 | { 112 | item.type = ItemType.Container; 113 | } break; 114 | 115 | case 0x05: //stackable 116 | { 117 | item.isStackable = true; 118 | break; 119 | } 120 | 121 | case 0x06: //unknown 122 | { 123 | } break; 124 | 125 | case 0x07: //useable 126 | { 127 | item.hasUseWith = true; 128 | } break; 129 | 130 | case 0x08: //read/write-able 131 | { 132 | item.isReadable = true; 133 | //item.isWriteable = true; 134 | item.maxReadWriteChars = reader.ReadUInt16(); 135 | } break; 136 | 137 | case 0x09: //readable 138 | { 139 | item.isReadable = true; 140 | item.maxReadChars = reader.ReadUInt16(); 141 | } break; 142 | 143 | case 0x0A: //fluid containers 144 | { 145 | item.type = ItemType.Fluid; 146 | } break; 147 | 148 | case 0x0B: //splashes 149 | { 150 | item.type = ItemType.Splash; 151 | } break; 152 | 153 | case 0x0C: //blocks solid objects (creatures, walls etc) 154 | { 155 | item.blockObject = true; 156 | } break; 157 | 158 | case 0x0D: //not moveable 159 | { 160 | item.isMoveable = false; 161 | } break; 162 | 163 | case 0x0E: //blocks missiles (walls, magic wall etc) 164 | { 165 | item.blockProjectile = true; 166 | } break; 167 | 168 | case 0x0F: //blocks pathfind algorithms (monsters) 169 | { 170 | item.blockPathFind = true; 171 | } break; 172 | 173 | case 0x10: //blocks monster movement (flowers, parcels etc) 174 | { 175 | item.isPickupable = true; 176 | } break; 177 | 178 | case 0x11: //hangable objects (wallpaper etc) 179 | { 180 | item.isHangable = true; 181 | } break; 182 | 183 | case 0x12: //horizontal wall 184 | { 185 | item.isHorizontal = true; 186 | } break; 187 | 188 | case 0x13: //vertical wall 189 | { 190 | item.isVertical = true; 191 | } break; 192 | 193 | case 0x14: //rotatable 194 | { 195 | item.isRotatable = true; 196 | } break; 197 | 198 | case 0x15: //light info 199 | { 200 | item.lightLevel = reader.ReadUInt16(); 201 | item.lightColor = reader.ReadUInt16(); 202 | } break; 203 | 204 | case 0x16: //unknown 205 | { 206 | } break; 207 | 208 | case 0x17: //changes floor 209 | { 210 | } break; 211 | 212 | case 0x18: //unknown 213 | { 214 | reader.BaseStream.Seek(4, SeekOrigin.Current); 215 | } break; 216 | 217 | case 0x19: 218 | { 219 | item.hasHeight = true; 220 | UInt16 height = reader.ReadUInt16(); 221 | } break; 222 | 223 | case 0x1A: //unknown 224 | { 225 | } break; 226 | 227 | 228 | case 0x1B: //unknown 229 | { 230 | } break; 231 | 232 | case 0x1C: //minimap color 233 | { 234 | item.minimapColor = reader.ReadUInt16(); 235 | break; 236 | } 237 | 238 | case 0x1D: //in-game help info 239 | { 240 | UInt16 opt = reader.ReadUInt16(); 241 | if (opt == 1112) 242 | { 243 | item.isReadable = true; 244 | } 245 | } break; 246 | 247 | case 0x1E: //unknown 248 | { 249 | } break; 250 | 251 | case 0x1F: //look through (borders) 252 | { 253 | item.lookThrough = true; 254 | } break; 255 | 256 | case 0x20: //unknown 257 | { 258 | } break; 259 | 260 | case 0xFF: //end of attributes 261 | { 262 | } break; 263 | 264 | default: 265 | { 266 | Trace.WriteLine(String.Format("Plugin: Error while parsing, unknown optbyte {0:X}", optbyte)); 267 | return false; 268 | } 269 | } 270 | } while (optbyte != 0xFF); 271 | 272 | item.width = reader.ReadByte(); 273 | item.height = reader.ReadByte(); 274 | if ((item.width > 1) || (item.height > 1)) 275 | { 276 | reader.BaseStream.Position++; 277 | } 278 | 279 | item.frames = reader.ReadByte(); 280 | item.xdiv = reader.ReadByte(); 281 | item.ydiv = reader.ReadByte(); 282 | item.zdiv = reader.ReadByte(); 283 | item.animationLength = reader.ReadByte(); 284 | 285 | item.numSprites = 286 | (UInt32)item.width * (UInt32)item.height * 287 | (UInt32)item.frames * 288 | (UInt32)item.xdiv * (UInt32)item.ydiv * item.zdiv * 289 | (UInt32)item.animationLength; 290 | 291 | // Read the sprite ids 292 | for (UInt32 i = 0; i < item.numSprites; ++i) 293 | { 294 | UInt16 spriteId = reader.ReadUInt16(); 295 | Sprite sprite; 296 | if (!sprites.TryGetValue(spriteId, out sprite)) 297 | { 298 | sprite = new Sprite(); 299 | sprite.id = spriteId; 300 | sprites[spriteId] = sprite; 301 | } 302 | 303 | item.spriteList.Add(sprite); 304 | } 305 | 306 | ++id; 307 | } 308 | } 309 | } 310 | finally 311 | { 312 | fileStream.Close(); 313 | } 314 | 315 | return true; 316 | } 317 | } 318 | } 319 | -------------------------------------------------------------------------------- /Source/Plugin860/plugin860.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {3624E915-FB86-4DDB-ACA6-A2313F70BA9C} 9 | Library 10 | Properties 11 | plugin860 12 | plugin860 13 | v2.0 14 | 512 15 | 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | {CEF21172-258C-4D0D-B024-ED7EF99612A2} 47 | PluginInterface 48 | False 49 | 50 | 51 | 52 | 59 | -------------------------------------------------------------------------------- /Source/Plugin872/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("otitemeditor.Tibia872")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("otitemeditor.Tibia872")] 13 | [assembly: AssemblyCopyright("Copyright © 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("1c707bc7-809b-4643-a6b6-23b3cb26879e")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Source/Plugin872/plugin872.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {F1A9A849-66BA-4B7D-AE69-A896B5893418} 9 | Library 10 | Properties 11 | plugin872 12 | plugin872 13 | v3.5 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | {2FBAC16E-457D-472B-880D-8D393F8A7827} 46 | ImageSimilarity 47 | 48 | 49 | {CEF21172-258C-4D0D-B024-ED7EF99612A2} 50 | PluginInterface 51 | 52 | 53 | 54 | 61 | -------------------------------------------------------------------------------- /Source/Plugin900/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("otitemeditor.Tibia900")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("otitemeditor.Tibia900")] 13 | [assembly: AssemblyCopyright("Copyright © 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("1c707bc7-809b-4643-a6b6-23b3cb26879e")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Source/Plugin900/plugin900.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {F1A9A849-66BA-4B7D-AE69-A896B5893419} 9 | Library 10 | Properties 11 | plugin900 12 | plugin900 13 | v3.5 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | {2FBAC16E-457D-472B-880D-8D393F8A7827} 46 | ImageSimilarity 47 | 48 | 49 | {CEF21172-258C-4D0D-B024-ED7EF99612A2} 50 | PluginInterface 51 | 52 | 53 | 54 | 61 | -------------------------------------------------------------------------------- /Source/Plugin940/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("otitemeditor.Tibia940")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("otitemeditor.Tibia940")] 13 | [assembly: AssemblyCopyright("Copyright © 2011")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("1c707bc7-809b-4643-a6b6-23b3cb26879e")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Source/Plugin940/plugin940.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {06A3993C-A9DA-44BE-AE47-13F6503E7A01} 9 | Library 10 | Properties 11 | plugin940 12 | plugin940 13 | v3.5 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | {2FBAC16E-457D-472B-880D-8D393F8A7827} 46 | ImageSimilarity 47 | 48 | 49 | {CEF21172-258C-4D0D-B024-ED7EF99612A2} 50 | PluginInterface 51 | 52 | 53 | 54 | 61 | -------------------------------------------------------------------------------- /Source/Plugin960/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("plugin960")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("plugin960")] 13 | [assembly: AssemblyCopyright("Copyright © 2012")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("bee2d20c-c1c3-4a22-a3e8-8f62fa4295ca")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Source/Plugin960/plugin960.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {D0473665-569C-4205-89DE-23074EBD0DC0} 9 | Library 10 | Properties 11 | plugin960 12 | plugin960 13 | v4.0 14 | 512 15 | 16 | 17 | true 18 | full 19 | false 20 | bin\Debug\ 21 | DEBUG;TRACE 22 | prompt 23 | 4 24 | 25 | 26 | pdbonly 27 | true 28 | bin\Release\ 29 | TRACE 30 | prompt 31 | 4 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | {2FBAC16E-457D-472B-880D-8D393F8A7827} 46 | ImageSimilarity 47 | 48 | 49 | {CEF21172-258C-4D0D-B024-ED7EF99612A2} 50 | PluginInterface 51 | 52 | 53 | 54 | 61 | -------------------------------------------------------------------------------- /Source/PluginCustom/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("otitemeditor.TibiaCustom")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("otitemeditor.TibiaCustom")] 13 | [assembly: AssemblyCopyright("Copyright © 2010")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("1c707bc7-809b-4643-a6b6-23b3cb26879e")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Source/PluginCustom/plugin.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.IO; 5 | using System.Collections; 6 | using PluginInterface; 7 | using otitemeditor; 8 | using System.Diagnostics; 9 | 10 | namespace TibiaCustom 11 | { 12 | public class TibiaCustom : SpriteItem 13 | { 14 | public bool hasCharges; 15 | 16 | public override bool isEqual(Item item) 17 | { 18 | if (item is TibiaCustom) 19 | { 20 | if(((TibiaCustom)item).hasCharges != hasCharges) 21 | { 22 | return false; 23 | } 24 | } 25 | 26 | return base.isEqual(item); 27 | } 28 | } 29 | 30 | public class Plugin : IPlugin 31 | { 32 | Dictionary sprites = new Dictionary(); 33 | SpriteItems items = new SpriteItems(); 34 | List supportedClients = new List(); 35 | IPluginHost myHost = null; 36 | 37 | //IPlugin implementation 38 | public IPluginHost Host { get { return myHost; } set { myHost = value; } } 39 | 40 | public List SupportedClients { get { return supportedClients; } } 41 | public SpriteItems Items { get { return items; } set { items = value; } } 42 | 43 | public bool LoadClient(SupportedClient client, string datFullPath, string sprFullPath) 44 | { 45 | return loadDat(datFullPath, client.datSignature) && loadSprites(sprFullPath, client.sprSignature); 46 | } 47 | 48 | public void Initialize() 49 | { 50 | settings.Load("plugincustom.xml"); 51 | supportedClients = settings.GetSupportedClientList(); 52 | } 53 | 54 | public void Dispose() 55 | { 56 | sprites.Clear(); 57 | items.Clear(); 58 | } 59 | 60 | //internal implementation 61 | public Settings settings = new Settings(); 62 | 63 | public bool loadSprites(string filename, UInt32 signature) 64 | { 65 | return Sprite.loadSprites(filename, ref sprites, signature); 66 | } 67 | 68 | public bool loadDat(string filename, UInt32 signature) 69 | { 70 | FileStream fileStream = new FileStream(filename, FileMode.Open); 71 | try 72 | { 73 | using (BinaryReader reader = new BinaryReader(fileStream)) 74 | { 75 | UInt32 datSignature = reader.ReadUInt32(); 76 | if (signature != 0 && datSignature != signature) 77 | { 78 | return false; 79 | } 80 | 81 | //get max id 82 | UInt16 itemCount = reader.ReadUInt16(); 83 | UInt16 creatureCount = reader.ReadUInt16(); 84 | UInt16 effectCount = reader.ReadUInt16(); 85 | UInt16 distanceCount = reader.ReadUInt16(); 86 | 87 | UInt16 minclientID = 100; //items starts at 100 88 | UInt16 maxclientID = itemCount; 89 | 90 | UInt16 id = minclientID; 91 | while (id <= maxclientID) 92 | { 93 | TibiaCustom item = new TibiaCustom(); 94 | item.id = id; 95 | items[id] = item; 96 | 97 | // read the options until we find 0xff 98 | byte optbyte; 99 | do 100 | { 101 | optbyte = reader.ReadByte(); 102 | //Trace.WriteLine(String.Format("{0:X}", optbyte)); 103 | 104 | switch (optbyte) 105 | { 106 | case 0x00: //groundtile 107 | { 108 | item.groundSpeed = reader.ReadUInt16(); 109 | item.type = ItemType.Ground; 110 | } break; 111 | 112 | case 0x01: //all OnTop 113 | { 114 | item.alwaysOnTop = true; 115 | item.alwaysOnTopOrder = 1; 116 | } break; 117 | 118 | case 0x02: //can walk trough (open doors, arces, bug pen fence) 119 | { 120 | item.alwaysOnTop = true; 121 | item.alwaysOnTopOrder = 2; 122 | } break; 123 | 124 | case 0x03: //can walk trough (arces) 125 | { 126 | item.alwaysOnTop = true; 127 | item.alwaysOnTopOrder = 3; 128 | } break; 129 | 130 | case 0x04: //container 131 | { 132 | item.type = ItemType.Container; 133 | } break; 134 | 135 | case 0x05: //stackable 136 | { 137 | item.isStackable = true; 138 | break; 139 | } 140 | 141 | case 0x06: 142 | { 143 | // 144 | } break; 145 | 146 | case 0x07: //useable 147 | { 148 | item.hasUseWith = true; 149 | } break; 150 | 151 | case 0x08: //charges 152 | { 153 | item.hasCharges = true; 154 | } break; 155 | 156 | case 0x09: //read/write-able 157 | { 158 | item.isReadable = true; 159 | //item.isWriteable = true; 160 | item.maxReadWriteChars = reader.ReadUInt16(); 161 | } break; 162 | 163 | case 0x0A: //readable objects 164 | { 165 | item.isReadable = true; 166 | item.maxReadChars = reader.ReadUInt16(); 167 | } break; 168 | 169 | case 0x0B: //fluid containers 170 | { 171 | item.type = ItemType.Fluid; 172 | } break; 173 | 174 | case 0x0C: //splashes 175 | { 176 | item.type = ItemType.Splash; 177 | } break; 178 | 179 | case 0x0D: //blocks solid objects (creatures, walls etc) 180 | { 181 | item.blockObject = true; 182 | } break; 183 | 184 | case 0x0E: //not moveable 185 | { 186 | item.isMoveable = false; 187 | } break; 188 | 189 | case 0x0F: //blocks missiles (walls, magic wall etc) 190 | { 191 | item.blockProjectile = true; 192 | } break; 193 | 194 | case 0x10: //blocks pathfind algorithms (monsters) 195 | { 196 | item.blockPathFind = true; 197 | } break; 198 | 199 | case 0x11: //blocks monster movement (flowers, parcels etc) 200 | { 201 | item.isPickupable = true; 202 | } break; 203 | 204 | case 0x12: //hangable objects (wallpaper etc) 205 | { 206 | item.isHangable = true; 207 | } break; 208 | 209 | case 0x13: //horizontal wall 210 | { 211 | item.isHorizontal = true; 212 | } break; 213 | 214 | case 0x14: //vertical wall 215 | { 216 | item.isVertical = true; 217 | } break; 218 | 219 | case 0x15: //rotatable 220 | { 221 | item.isRotatable = true; 222 | } break; 223 | 224 | case 0x16: //light info 225 | { 226 | item.lightLevel = reader.ReadUInt16(); 227 | item.lightColor = reader.ReadUInt16(); 228 | } break; 229 | 230 | case 0x17: //changes floor 231 | { 232 | } break; 233 | 234 | case 0x18: //unknown 235 | { 236 | } break; 237 | 238 | case 0x19: //unknown 239 | { 240 | reader.BaseStream.Seek(4, SeekOrigin.Current); 241 | } break; 242 | 243 | case 0x1A: // 244 | { 245 | item.hasHeight = true; 246 | UInt16 height = reader.ReadUInt16(); 247 | } break; 248 | 249 | case 0x1B: //draw with height offset for all parts (2x2) of the sprite 250 | { 251 | } break; 252 | 253 | case 0x1C: //unknown 254 | { 255 | break; 256 | } 257 | 258 | case 0x1D: //minimap color 259 | { 260 | item.minimapColor = reader.ReadUInt16(); 261 | } break; 262 | 263 | case 0x1E: //in-game help info 264 | { 265 | UInt16 opt = reader.ReadUInt16(); 266 | if (opt == 1112) 267 | { 268 | item.isReadable = true; 269 | } 270 | } break; 271 | 272 | case 0x1F: //unknown 273 | { 274 | } break; 275 | 276 | case 0x20: //look through (borders) 277 | { 278 | item.lookThrough = true; 279 | } break; 280 | 281 | case 0xFF: //end of attributes 282 | { 283 | } break; 284 | 285 | default: 286 | { 287 | Trace.WriteLine(String.Format("Unknown optbyte {0:X}", optbyte)); 288 | return false; 289 | } 290 | } 291 | } while (optbyte != 0xFF); 292 | 293 | item.width = reader.ReadByte(); 294 | item.height = reader.ReadByte(); 295 | if ((item.width > 1) || (item.height > 1)) 296 | { 297 | reader.BaseStream.Position++; 298 | } 299 | 300 | item.frames = reader.ReadByte(); 301 | item.xdiv = reader.ReadByte(); 302 | item.ydiv = reader.ReadByte(); 303 | item.zdiv = reader.ReadByte(); 304 | item.animationLength = reader.ReadByte(); 305 | 306 | item.numSprites = 307 | (UInt32)item.width * (UInt32)item.height * 308 | (UInt32)item.frames * 309 | (UInt32)item.xdiv * (UInt32)item.ydiv * item.zdiv * 310 | (UInt32)item.animationLength; 311 | 312 | // Read the sprite ids 313 | for (UInt32 i = 0; i < item.numSprites; ++i) 314 | { 315 | UInt16 spriteId = reader.ReadUInt16(); 316 | Sprite sprite; 317 | if (!sprites.TryGetValue(spriteId, out sprite)) 318 | { 319 | sprite = new Sprite(); 320 | sprite.id = spriteId; 321 | sprites[spriteId] = sprite; 322 | } 323 | 324 | item.spriteList.Add(sprite); 325 | } 326 | 327 | ++id; 328 | } 329 | } 330 | } 331 | finally 332 | { 333 | fileStream.Close(); 334 | } 335 | 336 | return true; 337 | } 338 | } 339 | } 340 | -------------------------------------------------------------------------------- /Source/PluginCustom/plugincustom.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {8624E915-FB86-4DDB-ACA6-A2313F70BA9C} 9 | Library 10 | Properties 11 | plugincustom 12 | plugincustom 13 | v2.0 14 | 512 15 | 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | {CEF21172-258C-4D0D-B024-ED7EF99612A2} 47 | PluginInterface 48 | False 49 | 50 | 51 | 52 | 59 | -------------------------------------------------------------------------------- /Source/PluginInterface/Item.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using otitemeditor; 5 | using System.IO; 6 | 7 | namespace otitemeditor 8 | { 9 | public enum ItemType 10 | { 11 | None, 12 | Ground, 13 | Container, 14 | Fluid, 15 | Splash, 16 | Deprecated 17 | }; 18 | 19 | public class ItemImpl : ICloneable 20 | { 21 | public object Clone() 22 | { 23 | ItemImpl clone = (ItemImpl)this.MemberwiseClone(); 24 | return clone; 25 | } 26 | 27 | public UInt16 id; 28 | public UInt16 groundSpeed; 29 | public ItemType type; 30 | public bool alwaysOnTop; 31 | public UInt16 alwaysOnTopOrder; 32 | public bool hasUseWith; 33 | public UInt16 maxReadChars; 34 | public UInt16 maxReadWriteChars; 35 | public bool hasHeight; 36 | public UInt16 minimapColor; 37 | public bool lookThrough; 38 | public UInt16 lightLevel; 39 | public UInt16 lightColor; 40 | public bool isStackable; 41 | public bool isReadable; 42 | public bool isMoveable; 43 | public bool isPickupable; 44 | public bool isHangable; 45 | public bool isHorizontal; 46 | public bool isVertical; 47 | public bool isRotatable; 48 | public bool blockObject; 49 | public bool blockProjectile; 50 | public bool blockPathFind; 51 | public bool allowDistRead; 52 | public bool isAnimation; 53 | public bool walkStack; 54 | public UInt16 wareId; 55 | public string name; 56 | } 57 | 58 | public class Item 59 | { 60 | public ItemImpl itemImpl = new ItemImpl(); 61 | 62 | public Item() 63 | { 64 | isMoveable = true; 65 | name = ""; 66 | } 67 | 68 | public virtual bool isEqual(Item item) 69 | { 70 | if (type != item.type) 71 | { 72 | return false; 73 | } 74 | 75 | /* 76 | if (compareSprite && !Utils.ByteArrayCompare(spriteHash, item.spriteHash)) 77 | { 78 | return false; 79 | } 80 | */ 81 | 82 | if (name.CompareTo(item.name) != 0) 83 | { 84 | return false; 85 | } 86 | 87 | if (wareId != item.wareId) 88 | { 89 | return false; 90 | } 91 | 92 | if (walkStack != item.walkStack) 93 | { 94 | return false; 95 | } 96 | 97 | if (isAnimation != item.isAnimation) 98 | { 99 | return false; 100 | } 101 | 102 | if (alwaysOnTop != item.alwaysOnTop) 103 | { 104 | return false; 105 | } 106 | 107 | if (alwaysOnTopOrder != item.alwaysOnTopOrder) 108 | { 109 | return false; 110 | } 111 | 112 | if (blockObject != item.blockObject) 113 | { 114 | return false; 115 | } 116 | 117 | if (blockPathFind != item.blockPathFind) 118 | { 119 | return false; 120 | } 121 | 122 | if (blockProjectile != item.blockProjectile) 123 | { 124 | return false; 125 | } 126 | 127 | if (groundSpeed != item.groundSpeed) 128 | { 129 | return false; 130 | } 131 | 132 | if (hasHeight != item.hasHeight) 133 | { 134 | return false; 135 | } 136 | 137 | if (hasUseWith != item.hasUseWith) 138 | { 139 | return false; 140 | } 141 | 142 | if (isHangable != item.isHangable) 143 | { 144 | return false; 145 | } 146 | 147 | if (isHorizontal != item.isHorizontal) 148 | { 149 | return false; 150 | } 151 | 152 | if (isMoveable != item.isMoveable) 153 | { 154 | return false; 155 | } 156 | 157 | if (isPickupable != item.isPickupable) 158 | { 159 | return false; 160 | } 161 | 162 | if (isReadable != item.isReadable) 163 | { 164 | return false; 165 | } 166 | 167 | if (isRotatable != item.isRotatable) 168 | { 169 | return false; 170 | } 171 | 172 | if (isStackable != item.isStackable) 173 | { 174 | return false; 175 | } 176 | 177 | if (isVertical != item.isVertical) 178 | { 179 | return false; 180 | } 181 | 182 | if (lightColor != item.lightColor) 183 | { 184 | return false; 185 | } 186 | 187 | if (lightLevel != item.lightLevel) 188 | { 189 | return false; 190 | } 191 | 192 | if (lookThrough != item.lookThrough) 193 | { 194 | return false; 195 | } 196 | 197 | if (maxReadChars != item.maxReadChars) 198 | { 199 | return false; 200 | } 201 | 202 | if (maxReadWriteChars != item.maxReadWriteChars) 203 | { 204 | return false; 205 | } 206 | 207 | if (minimapColor != item.minimapColor) 208 | { 209 | return false; 210 | } 211 | 212 | return true; 213 | } 214 | 215 | public UInt16 id { get { return itemImpl.id; } set { itemImpl.id = value; } } 216 | public UInt16 groundSpeed { get { return itemImpl.groundSpeed; } set { itemImpl.groundSpeed = value; } } 217 | public ItemType type { get { return itemImpl.type; } set { itemImpl.type = value; } } 218 | public bool alwaysOnTop { get { return itemImpl.alwaysOnTop; } set { itemImpl.alwaysOnTop = value; } } 219 | public UInt16 alwaysOnTopOrder { get { return itemImpl.alwaysOnTopOrder; } set { itemImpl.alwaysOnTopOrder = value; } } 220 | public bool hasUseWith { get { return itemImpl.hasUseWith; } set { itemImpl.hasUseWith = value; } } 221 | public UInt16 maxReadChars { get { return itemImpl.maxReadChars; } set { itemImpl.maxReadChars = value; } } 222 | public UInt16 maxReadWriteChars { get { return itemImpl.maxReadWriteChars; } set { itemImpl.maxReadWriteChars = value; } } 223 | public bool hasHeight { get { return itemImpl.hasHeight; } set { itemImpl.hasHeight = value; } } 224 | public UInt16 minimapColor { get { return itemImpl.minimapColor; } set { itemImpl.minimapColor = value; } } 225 | public bool lookThrough { get { return itemImpl.lookThrough; } set { itemImpl.lookThrough = value; } } 226 | public UInt16 lightLevel { get { return itemImpl.lightLevel; } set { itemImpl.lightLevel = value; } } 227 | public UInt16 lightColor { get { return itemImpl.lightColor; } set { itemImpl.lightColor = value; } } 228 | public bool isStackable { get { return itemImpl.isStackable; } set { itemImpl.isStackable = value; } } 229 | public bool isReadable { get { return itemImpl.isReadable; } set { itemImpl.isReadable = value; } } 230 | public bool isMoveable { get { return itemImpl.isMoveable; } set { itemImpl.isMoveable = value; } } 231 | public bool isPickupable { get { return itemImpl.isPickupable; } set { itemImpl.isPickupable = value; } } 232 | public bool isHangable { get { return itemImpl.isHangable; } set { itemImpl.isHangable = value; } } 233 | public bool isHorizontal { get { return itemImpl.isHorizontal; } set { itemImpl.isHorizontal = value; } } 234 | public bool isVertical { get { return itemImpl.isVertical; } set { itemImpl.isVertical = value; } } 235 | public bool isRotatable { get { return itemImpl.isRotatable; } set { itemImpl.isRotatable = value; } } 236 | public bool blockObject { get { return itemImpl.blockObject; } set { itemImpl.blockObject = value; } } 237 | public bool blockProjectile { get { return itemImpl.blockProjectile; } set { itemImpl.blockProjectile = value; } } 238 | public bool blockPathFind { get { return itemImpl.blockPathFind; } set { itemImpl.blockPathFind = value; } } 239 | public bool allowDistRead { get { return itemImpl.allowDistRead; } set { itemImpl.allowDistRead = value; } } 240 | public bool isAnimation { get { return itemImpl.isAnimation; } set { itemImpl.isAnimation = value; } } 241 | public bool walkStack { get { return itemImpl.walkStack; } set { itemImpl.walkStack = value; } } 242 | public string name 243 | { 244 | get { return itemImpl.name; } 245 | set { itemImpl.name = value; } 246 | } 247 | public UInt16 wareId 248 | { 249 | get { return itemImpl.wareId; } 250 | set { itemImpl.wareId = value; } 251 | } 252 | 253 | //used to find sprites during updates 254 | protected byte[] _spriteHash = null; 255 | public virtual byte[] spriteHash 256 | { 257 | get {return _spriteHash;} 258 | set {_spriteHash = value;} 259 | } 260 | } 261 | 262 | public class SpriteItem : Item 263 | { 264 | //sprite meta-data 265 | public byte width; 266 | public byte height; 267 | public byte frames; 268 | public byte xdiv; 269 | public byte ydiv; 270 | public byte zdiv; 271 | public byte animationLength; 272 | public UInt32 numSprites; 273 | public List spriteList = new List(); 274 | 275 | public override byte[] spriteHash 276 | { 277 | get 278 | { 279 | if (_spriteHash == null) 280 | { 281 | System.Security.Cryptography.MD5 md5 = System.Security.Cryptography.MD5.Create(); 282 | 283 | Int32 spriteSize = (Int32)width * (Int32)height * (Int32)animationLength; 284 | Int32 spriteBase = 0; 285 | 286 | MemoryStream stream = new MemoryStream(); 287 | 288 | for (Int32 frame = 0; frame < frames; frame++) 289 | { 290 | for (Int32 cy = 0; cy < height; cy++) 291 | { 292 | for (Int32 cx = 0; cx < width; cx++) 293 | { 294 | Int32 frameIndex = spriteBase + cx + cy * width + frame * width * height; 295 | Sprite sprite = spriteList[frameIndex]; 296 | if (sprite != null) 297 | { 298 | stream.Write(sprite.getRGBAData(), 0, 32 * 32 * 4); 299 | } 300 | } 301 | } 302 | } 303 | 304 | stream.Position = 0; 305 | _spriteHash = md5.ComputeHash(stream); 306 | } 307 | 308 | return _spriteHash; 309 | } 310 | 311 | set 312 | { 313 | _spriteHash = value; 314 | } 315 | } 316 | 317 | //contains sprite signatures using Euclidean distance (4x4 blocks) on a ff2d generated image of the sprite 318 | private double[,] _spriteSignature = null; 319 | public double[,] spriteSignature 320 | { 321 | get {return _spriteSignature;} 322 | set { _spriteSignature = value; } 323 | } 324 | 325 | //Used to calculate fourier transformation 326 | public byte[] getRGBData() 327 | { 328 | return spriteList[0].getRGBData(); 329 | } 330 | 331 | public byte[] getRGBData(int frameIndex) 332 | { 333 | return spriteList[frameIndex].getRGBData(); 334 | } 335 | 336 | //used for drawing and calculating MD5 337 | public byte[] getRGBAData() 338 | { 339 | return spriteList[0].getRGBAData(); 340 | } 341 | 342 | public byte[] getRGBAData(int frameIndex) 343 | { 344 | return spriteList[frameIndex].getRGBAData(); 345 | } 346 | } 347 | } 348 | -------------------------------------------------------------------------------- /Source/PluginInterface/PluginInterface.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using otitemeditor; 4 | 5 | namespace PluginInterface 6 | { 7 | public class SpriteItems : Dictionary 8 | { 9 | public bool signatureCalculated = false; 10 | } 11 | 12 | public class SupportedClient 13 | { 14 | public SupportedClient( 15 | UInt32 version, 16 | string description, 17 | UInt32 otbVersion, 18 | UInt32 datSignature, 19 | UInt32 sprSignature) 20 | { 21 | this.version = version; 22 | this.description = description; 23 | this.otbVersion = otbVersion; 24 | this.datSignature = datSignature; 25 | this.sprSignature = sprSignature; 26 | } 27 | 28 | public UInt32 version; 29 | public string description; 30 | public UInt32 otbVersion; 31 | public UInt32 datSignature; 32 | public UInt32 sprSignature; 33 | } 34 | 35 | public interface IPlugin 36 | { 37 | IPluginHost Host { get; set; } 38 | 39 | SpriteItems Items { get; } 40 | List SupportedClients { get; } 41 | bool LoadClient(SupportedClient client, string datFullPath, string sprFullPath); 42 | 43 | void Initialize(); 44 | void Dispose(); 45 | } 46 | 47 | public interface IPluginHost 48 | { 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Source/PluginInterface/PluginInterface.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | AnyCPU 6 | 8.0.30703 7 | 2.0 8 | {CEF21172-258C-4D0D-B024-ED7EF99612A2} 9 | Library 10 | Properties 11 | PluginInterface 12 | PluginInterface 13 | v2.0 14 | 512 15 | 16 | 17 | 18 | 19 | true 20 | full 21 | false 22 | bin\Debug\ 23 | DEBUG;TRACE 24 | prompt 25 | 4 26 | 27 | 28 | pdbonly 29 | true 30 | bin\Release\ 31 | TRACE 32 | prompt 33 | 4 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | True 48 | True 49 | Resources.resx 50 | 51 | 52 | 53 | 54 | 55 | 56 | ResXFileCodeGenerator 57 | Resources.Designer.cs 58 | 59 | 60 | 61 | 68 | -------------------------------------------------------------------------------- /Source/PluginInterface/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("PluginInterface")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("PluginInterface")] 13 | [assembly: AssemblyCopyright("Copyright © 2010")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("aa141f25-ccdb-4e8a-b36e-ec3f178810ee")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Source/PluginInterface/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.1 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace PluginInterface.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("PluginInterface.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Source/PluginInterface/Properties/Resources.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | text/microsoft-resx 91 | 92 | 93 | 1.3 94 | 95 | 96 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 97 | 98 | 99 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 100 | 101 | -------------------------------------------------------------------------------- /Source/PluginInterface/Settings.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Xml; 5 | 6 | namespace PluginInterface 7 | { 8 | public class Settings 9 | { 10 | public string SettingFilename = ""; 11 | private XmlDocument xmlDocument = new XmlDocument(); 12 | 13 | public Settings() 14 | { 15 | } 16 | 17 | public bool Load(string filename) 18 | { 19 | string path = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), "plugins"); 20 | try 21 | { 22 | SettingFilename = System.IO.Path.Combine(path, filename); 23 | xmlDocument.Load(SettingFilename); 24 | return true; 25 | } 26 | catch 27 | { 28 | xmlDocument.LoadXml(""); 29 | return false; 30 | } 31 | } 32 | 33 | public List GetSupportedClientList() 34 | { 35 | List list = new List(); 36 | 37 | XmlNodeList nodes = xmlDocument.SelectNodes("/settings/clients/client"); 38 | if (nodes != null) 39 | { 40 | foreach (XmlNode node in nodes) 41 | { 42 | try 43 | { 44 | UInt32 version = UInt32.Parse(node.Attributes["version"].Value); 45 | string description = node.Attributes["description"].Value; 46 | UInt32 otbVersion = UInt32.Parse(node.Attributes["otbversion"].Value); 47 | UInt32 datSignature = (UInt32)System.Int32.Parse(node.Attributes["datsignature"].Value, System.Globalization.NumberStyles.HexNumber); 48 | UInt32 sprSignature = (UInt32)System.Int32.Parse(node.Attributes["sprsignature"].Value, System.Globalization.NumberStyles.HexNumber); 49 | 50 | SupportedClient client = new SupportedClient(version, description, otbVersion, datSignature, sprSignature); 51 | list.Add(client); 52 | } 53 | catch 54 | { 55 | System.Windows.Forms.MessageBox.Show(String.Format("Error loading file {0}", SettingFilename)); 56 | } 57 | } 58 | } 59 | 60 | return list; 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Source/PluginInterface/Sprite.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.IO; 5 | 6 | namespace otitemeditor 7 | { 8 | public class Sprite 9 | { 10 | public static bool loadSprites(string filename, ref Dictionary sprites, UInt32 signature) 11 | { 12 | FileStream fileStream = new FileStream(filename, FileMode.Open); 13 | try 14 | { 15 | using (BinaryReader reader = new BinaryReader(fileStream)) 16 | { 17 | UInt32 sprSignature = reader.ReadUInt32(); 18 | if (signature != 0 && signature != sprSignature) 19 | { 20 | return false; 21 | } 22 | 23 | UInt16 totalPics = reader.ReadUInt16(); 24 | 25 | List spriteIndexes = new List(); 26 | for (uint i = 0; i < totalPics; ++i) 27 | { 28 | UInt32 index = reader.ReadUInt32(); 29 | spriteIndexes.Add(index); 30 | } 31 | 32 | UInt16 id = 1; 33 | foreach (UInt32 element in spriteIndexes) 34 | { 35 | UInt32 index = element + 3; 36 | reader.BaseStream.Seek(index, SeekOrigin.Begin); 37 | UInt16 size = reader.ReadUInt16(); 38 | 39 | Sprite sprite; 40 | if (sprites.TryGetValue(id, out sprite)) 41 | { 42 | if (sprite != null && size > 0) 43 | { 44 | if (sprite.size > 0) 45 | { 46 | //generate warning 47 | } 48 | else 49 | { 50 | sprite.id = id; 51 | sprite.size = size; 52 | sprite.dump = reader.ReadBytes(size); 53 | 54 | sprites[id] = sprite; 55 | } 56 | } 57 | } 58 | else 59 | { 60 | reader.BaseStream.Seek(size, SeekOrigin.Current); 61 | } 62 | 63 | ++id; 64 | } 65 | } 66 | } 67 | finally 68 | { 69 | fileStream.Close(); 70 | } 71 | 72 | return true; 73 | } 74 | 75 | public static bool loadSprites(string filename, ref Dictionary sprites, UInt32 signature) 76 | { 77 | FileStream fileStream = new FileStream(filename, FileMode.Open); 78 | try 79 | { 80 | using (BinaryReader reader = new BinaryReader(fileStream)) 81 | { 82 | UInt32 sprSignature = reader.ReadUInt32(); 83 | if (signature != 0 && signature != sprSignature) 84 | { 85 | return false; 86 | } 87 | 88 | UInt32 totalPics = reader.ReadUInt32(); 89 | 90 | List spriteIndexes = new List(); 91 | for (uint i = 0; i < totalPics; ++i) 92 | { 93 | UInt32 index = reader.ReadUInt32(); 94 | spriteIndexes.Add(index); 95 | } 96 | 97 | UInt32 id = 1; 98 | foreach (UInt32 element in spriteIndexes) 99 | { 100 | UInt32 index = element + 3; 101 | reader.BaseStream.Seek(index, SeekOrigin.Begin); 102 | UInt16 size = reader.ReadUInt16(); 103 | 104 | Sprite sprite; 105 | if (sprites.TryGetValue(id, out sprite)) 106 | { 107 | if (sprite != null && size > 0) 108 | { 109 | if (sprite.size > 0) 110 | { 111 | //generate warning 112 | } 113 | else 114 | { 115 | sprite.id = id; 116 | sprite.size = size; 117 | sprite.dump = reader.ReadBytes(size); 118 | 119 | sprites[id] = sprite; 120 | } 121 | } 122 | } 123 | else 124 | { 125 | reader.BaseStream.Seek(size, SeekOrigin.Current); 126 | } 127 | 128 | ++id; 129 | } 130 | } 131 | } 132 | finally 133 | { 134 | fileStream.Close(); 135 | } 136 | 137 | return true; 138 | } 139 | 140 | public Sprite() 141 | { 142 | id = 0; 143 | size = 0; 144 | dump = null; 145 | } 146 | 147 | public UInt32 id; 148 | public UInt32 size; 149 | public byte[] dump; 150 | 151 | public byte[] getRGBData() 152 | { 153 | const byte transparentColor = 0x11; 154 | return getRGBData(transparentColor); 155 | } 156 | 157 | public byte[] getRGBData(byte transparentColor) 158 | { 159 | byte[] rgb32x32x3 = new byte[32 * 32 * 3]; 160 | UInt32 bytes = 0; 161 | UInt32 x = 0; 162 | UInt32 y = 0; 163 | Int32 chunkSize; 164 | 165 | while (bytes < size) 166 | { 167 | chunkSize = dump[bytes] | dump[bytes + 1] << 8; 168 | bytes += 2; 169 | 170 | for (int i = 0; i < chunkSize; ++i) 171 | { 172 | // Transparent pixel 173 | rgb32x32x3[96 * y + x * 3 + 0] = transparentColor; 174 | rgb32x32x3[96 * y + x * 3 + 1] = transparentColor; 175 | rgb32x32x3[96 * y + x * 3 + 2] = transparentColor; 176 | x++; 177 | if (x >= 32) 178 | { 179 | x = 0; 180 | ++y; 181 | } 182 | } 183 | 184 | if (bytes >= size) break; // We're done 185 | // Now comes a pixel chunk, read it! 186 | chunkSize = dump[bytes] | dump[bytes + 1] << 8; 187 | bytes += 2; 188 | for (int i = 0; i < chunkSize; ++i) 189 | { 190 | byte red = dump[bytes + 0]; 191 | byte green = dump[bytes + 1]; 192 | byte blue = dump[bytes + 2]; 193 | rgb32x32x3[96 * y + x * 3 + 0] = red; 194 | rgb32x32x3[96 * y + x * 3 + 1] = green; 195 | rgb32x32x3[96 * y + x * 3 + 2] = blue; 196 | 197 | bytes += 3; 198 | 199 | x++; 200 | if (x >= 32) 201 | { 202 | x = 0; 203 | ++y; 204 | } 205 | } 206 | } 207 | 208 | // Fill up any trailing pixels 209 | while (y < 32 && x < 32) 210 | { 211 | rgb32x32x3[96 * y + x * 3 + 0] = transparentColor; 212 | rgb32x32x3[96 * y + x * 3 + 1] = transparentColor; 213 | rgb32x32x3[96 * y + x * 3 + 2] = transparentColor; 214 | x++; 215 | if (x >= 32) 216 | { 217 | x = 0; 218 | ++y; 219 | } 220 | } 221 | 222 | return rgb32x32x3; 223 | } 224 | 225 | public byte[] getRGBAData() 226 | { 227 | byte[] rgb32x32x3 = getRGBData(); 228 | byte[] rgbx32x32x4 = new byte[32 * 32 * 4]; 229 | 230 | //reverse rgb 231 | for (int y = 0; y < 32; ++y) 232 | { 233 | for (int x = 0; x < 32; ++x) 234 | { 235 | rgbx32x32x4[128 * y + x * 4 + 0] = rgb32x32x3[(32 - y - 1) * 96 + x * 3 + 2]; //blue 236 | rgbx32x32x4[128 * y + x * 4 + 1] = rgb32x32x3[(32 - y - 1) * 96 + x * 3 + 1]; //green 237 | rgbx32x32x4[128 * y + x * 4 + 2] = rgb32x32x3[(32 - y - 1) * 96 + x * 3 + 0]; //red 238 | rgbx32x32x4[128 * y + x * 4 + 3] = 0; 239 | } 240 | } 241 | 242 | return rgbx32x32x4; 243 | } 244 | } 245 | } 246 | -------------------------------------------------------------------------------- /Source/PluginServices.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.IO; 3 | using System.Reflection; 4 | using PluginInterface; 5 | using otitemeditor; 6 | 7 | namespace Host 8 | { 9 | /// 10 | /// Summary description for PluginServices. 11 | /// 12 | public class PluginServices : IPluginHost 13 | { 14 | /// 15 | /// Constructor of PluginServices 16 | /// 17 | public PluginServices() 18 | { 19 | } 20 | 21 | private Types.PluginCollection colAvailablePlugins = new Types.PluginCollection(); 22 | 23 | /// 24 | /// A collection of all plugins found by FindPlugins() 25 | /// 26 | public Types.PluginCollection AvailablePlugins 27 | { 28 | get { return colAvailablePlugins; } 29 | set { colAvailablePlugins = value; } 30 | } 31 | 32 | /// 33 | /// Searches the Application's startup directory 34 | /// 35 | public void FindPlugins() 36 | { 37 | string path = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "plugins"); 38 | if (Directory.Exists(path) == false) 39 | { 40 | Directory.CreateDirectory(path); 41 | } 42 | 43 | FindPlugins(path); 44 | } 45 | 46 | /// 47 | /// Searches the Path for plugins 48 | /// 49 | /// Directory to search for Plugins in 50 | public void FindPlugins(string Path) 51 | { 52 | colAvailablePlugins.Clear(); 53 | 54 | foreach (string fileOn in Directory.GetFiles(Path)) 55 | { 56 | FileInfo file = new FileInfo(fileOn); 57 | if (file.Extension.Equals(".dll")) 58 | { 59 | this.AddPlugin(fileOn); 60 | } 61 | } 62 | } 63 | 64 | /// 65 | /// Unloads all plugins 66 | /// 67 | public void ClosePlugins() 68 | { 69 | foreach (Types.Plugin pluginOn in colAvailablePlugins) 70 | { 71 | pluginOn.Instance.Dispose(); 72 | pluginOn.Instance = null; 73 | } 74 | 75 | colAvailablePlugins.Clear(); 76 | } 77 | 78 | private void AddPlugin(string FileName) 79 | { 80 | Assembly pluginAssembly = Assembly.LoadFrom(FileName); 81 | 82 | foreach (Type pluginType in pluginAssembly.GetTypes()) 83 | { 84 | if (pluginType.IsPublic) 85 | { 86 | if (!pluginType.IsAbstract) 87 | { 88 | Type typeInterface = pluginType.GetInterface("PluginInterface.IPlugin", true); 89 | if (typeInterface != null) 90 | { 91 | Types.Plugin newPlugin = new Types.Plugin(); 92 | newPlugin.AssemblyPath = FileName; 93 | newPlugin.Instance = (IPlugin)Activator.CreateInstance(pluginAssembly.GetType(pluginType.ToString())); 94 | newPlugin.Instance.Host = this; 95 | newPlugin.Instance.Initialize(); 96 | this.colAvailablePlugins.Add(newPlugin); 97 | 98 | newPlugin = null; 99 | } 100 | 101 | typeInterface = null; 102 | } 103 | } 104 | } 105 | 106 | pluginAssembly = null; 107 | } 108 | } 109 | 110 | namespace Types 111 | { 112 | /// 113 | /// Collection of AvailablePlugin Type 114 | /// 115 | public class PluginCollection : System.Collections.CollectionBase 116 | { 117 | /// 118 | /// Add a plugin 119 | /// 120 | /// The Plugin to Add 121 | public void Add(Types.Plugin pluginToAdd) 122 | { 123 | this.List.Add(pluginToAdd); 124 | } 125 | 126 | /// 127 | /// Removes a plugin 128 | /// 129 | /// The Plugin to Remove 130 | public void Remove(Types.Plugin pluginToRemove) 131 | { 132 | this.List.Remove(pluginToRemove); 133 | } 134 | 135 | /// 136 | /// Search for a plugin by name 137 | /// 138 | /// The name or File path of the plugin to find 139 | /// a plugin, or null if the plugin is not found 140 | public Types.Plugin Find(string pluginNameOrPath) 141 | { 142 | foreach (Types.Plugin plugin in this.List) 143 | { 144 | foreach (SupportedClient client in plugin.Instance.SupportedClients) 145 | { 146 | if ((client.description.Equals(pluginNameOrPath))) 147 | { 148 | return plugin; 149 | } 150 | } 151 | 152 | if (plugin.AssemblyPath.Equals(pluginNameOrPath)) 153 | { 154 | return plugin; 155 | } 156 | } 157 | 158 | return null; 159 | } 160 | 161 | 162 | /// 163 | /// Search for a plugin by compatibility 164 | /// 165 | /// The otb version 166 | /// a plugin, or null if the plugin is not found 167 | public Types.Plugin Find(UInt32 otbVersion) 168 | { 169 | foreach (Types.Plugin plugin in this.List) 170 | { 171 | foreach(SupportedClient client in plugin.Instance.SupportedClients) 172 | { 173 | if (client.otbVersion == otbVersion) 174 | { 175 | return plugin; 176 | } 177 | } 178 | } 179 | 180 | return null; 181 | } 182 | } 183 | 184 | /// 185 | /// Data class for plugins. 186 | /// Holds and instance of the loaded plugin, as well as the plugins assembly path 187 | /// 188 | public class Plugin 189 | { 190 | private IPlugin myInstance = null; 191 | private string myAssemblyPath = ""; 192 | 193 | public IPlugin Instance 194 | { 195 | get { return myInstance; } 196 | set { myInstance = value; } 197 | } 198 | 199 | public string AssemblyPath 200 | { 201 | get { return myAssemblyPath; } 202 | set { myAssemblyPath = value; } 203 | } 204 | } 205 | } 206 | } 207 | 208 | -------------------------------------------------------------------------------- /Source/Plugins/plugin1010.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Source/Plugins/plugin1021.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Source/Plugins/plugin1050.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Source/Plugins/plugin850.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /Source/Plugins/plugin860.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /Source/Plugins/plugin872.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /Source/Plugins/plugin900.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Source/Plugins/plugin940.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Source/Plugins/plugin960.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Source/Plugins/plugincustom.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Source/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Windows.Forms; 4 | using PluginInterface; 5 | 6 | namespace otitemeditor 7 | { 8 | static class Program 9 | { 10 | public static Host.PluginServices plugins = new Host.PluginServices(); 11 | 12 | /// 13 | /// The main entry point for the application. 14 | /// 15 | [STAThread] 16 | static void Main() 17 | { 18 | Application.EnableVisualStyles(); 19 | Application.SetCompatibleTextRenderingDefault(false); 20 | Application.Run(new otitemeditor()); 21 | } 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Source/ProgressForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace otitemeditor 2 | { 3 | partial class ProgressForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.bar = new System.Windows.Forms.ProgressBar(); 32 | this.progressLbl = new System.Windows.Forms.Label(); 33 | this.SuspendLayout(); 34 | // 35 | // bar 36 | // 37 | this.bar.Location = new System.Drawing.Point(42, 49); 38 | this.bar.Name = "bar"; 39 | this.bar.Size = new System.Drawing.Size(257, 23); 40 | this.bar.TabIndex = 0; 41 | // 42 | // progressLbl 43 | // 44 | this.progressLbl.AutoSize = true; 45 | this.progressLbl.Location = new System.Drawing.Point(39, 33); 46 | this.progressLbl.Name = "progressLbl"; 47 | this.progressLbl.Size = new System.Drawing.Size(51, 13); 48 | this.progressLbl.TabIndex = 1; 49 | this.progressLbl.Text = "Progress:"; 50 | // 51 | // ProgressForm 52 | // 53 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 54 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 55 | this.ClientSize = new System.Drawing.Size(355, 127); 56 | this.ControlBox = false; 57 | this.Controls.Add(this.progressLbl); 58 | this.Controls.Add(this.bar); 59 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; 60 | this.MaximizeBox = false; 61 | this.MinimizeBox = false; 62 | this.Name = "ProgressForm"; 63 | this.ShowIcon = false; 64 | this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; 65 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 66 | this.Text = "Progress"; 67 | this.UseWaitCursor = true; 68 | this.ResumeLayout(false); 69 | this.PerformLayout(); 70 | 71 | } 72 | 73 | #endregion 74 | 75 | public System.Windows.Forms.ProgressBar bar; 76 | public System.Windows.Forms.Label progressLbl; 77 | 78 | } 79 | } -------------------------------------------------------------------------------- /Source/ProgressForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Text; 7 | using System.Windows.Forms; 8 | 9 | namespace otitemeditor 10 | { 11 | public partial class ProgressForm : Form 12 | { 13 | public ProgressForm() 14 | { 15 | InitializeComponent(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Source/ProgressForm.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 | -------------------------------------------------------------------------------- /Source/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("otitemeditor")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("otitemeditor")] 13 | [assembly: AssemblyCopyright("Copyright © 2010")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("aac585b7-808b-48fc-83fb-36d28310db6e")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Source/Properties/Resources.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.239 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace otitemeditor.Properties { 12 | using System; 13 | 14 | 15 | /// 16 | /// A strongly-typed resource class, for looking up localized strings, etc. 17 | /// 18 | // This class was auto-generated by the StronglyTypedResourceBuilder 19 | // class via a tool like ResGen or Visual Studio. 20 | // To add or remove a member, edit your .ResX file then rerun ResGen 21 | // with the /str option, or rebuild your VS project. 22 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")] 23 | [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] 24 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 25 | internal class Resources { 26 | 27 | private static global::System.Resources.ResourceManager resourceMan; 28 | 29 | private static global::System.Globalization.CultureInfo resourceCulture; 30 | 31 | [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 32 | internal Resources() { 33 | } 34 | 35 | /// 36 | /// Returns the cached ResourceManager instance used by this class. 37 | /// 38 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 39 | internal static global::System.Resources.ResourceManager ResourceManager { 40 | get { 41 | if (object.ReferenceEquals(resourceMan, null)) { 42 | global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("otitemeditor.Properties.Resources", typeof(Resources).Assembly); 43 | resourceMan = temp; 44 | } 45 | return resourceMan; 46 | } 47 | } 48 | 49 | /// 50 | /// Overrides the current thread's CurrentUICulture property for all 51 | /// resource lookups using this strongly typed resource class. 52 | /// 53 | [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)] 54 | internal static global::System.Globalization.CultureInfo Culture { 55 | get { 56 | return resourceCulture; 57 | } 58 | set { 59 | resourceCulture = value; 60 | } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /Source/Properties/Resources.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 | text/microsoft-resx 107 | 108 | 109 | 2.0 110 | 111 | 112 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 113 | 114 | 115 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | -------------------------------------------------------------------------------- /Source/Properties/Settings.Designer.cs: -------------------------------------------------------------------------------- 1 | //------------------------------------------------------------------------------ 2 | // 3 | // This code was generated by a tool. 4 | // Runtime Version:4.0.30319.239 5 | // 6 | // Changes to this file may cause incorrect behavior and will be lost if 7 | // the code is regenerated. 8 | // 9 | //------------------------------------------------------------------------------ 10 | 11 | namespace otitemeditor.Properties { 12 | 13 | 14 | [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] 15 | [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "10.0.0.0")] 16 | internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { 17 | 18 | private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); 19 | 20 | public static Settings Default { 21 | get { 22 | return defaultInstance; 23 | } 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Source/Properties/Settings.settings: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Source/TextBoxTraceListener.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.Diagnostics; 5 | using System.Windows.Forms; 6 | 7 | namespace otitemeditor 8 | { 9 | public class TextBoxTraceListener : TraceListener 10 | { 11 | const UInt32 updateFrequency = 10; 12 | UInt32 updateCounter = 0; 13 | 14 | private TextBox _target; 15 | private StringSendDelegate _invokeWrite; 16 | 17 | public TextBoxTraceListener(TextBox target) 18 | { 19 | _target = target; 20 | _invokeWrite = new StringSendDelegate(SendString); 21 | } 22 | 23 | public override void Write(string message) 24 | { 25 | _target.Invoke(_invokeWrite, new object[] { message }); 26 | } 27 | 28 | public override void WriteLine(string message) 29 | { 30 | _target.Invoke(_invokeWrite, new object[] { message + Environment.NewLine }); 31 | } 32 | 33 | private delegate void StringSendDelegate(string message); 34 | private void SendString(string message) 35 | { 36 | // No need to lock text box as this function will only 37 | 38 | // ever be executed from the UI thread 39 | 40 | _target.AppendText(message); 41 | 42 | ++updateCounter; 43 | if (updateCounter >= updateFrequency) 44 | { 45 | updateCounter = 0; 46 | Application.DoEvents(); 47 | } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Source/UpdateForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace otitemeditor 2 | { 3 | partial class UpdateForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.pluginsListBox = new System.Windows.Forms.ListBox(); 32 | this.button1 = new System.Windows.Forms.Button(); 33 | this.selectBtn = new System.Windows.Forms.Button(); 34 | this.lblDescription = new System.Windows.Forms.Label(); 35 | this.SuspendLayout(); 36 | // 37 | // pluginsListBox 38 | // 39 | this.pluginsListBox.FormattingEnabled = true; 40 | this.pluginsListBox.Location = new System.Drawing.Point(12, 45); 41 | this.pluginsListBox.Name = "pluginsListBox"; 42 | this.pluginsListBox.Size = new System.Drawing.Size(168, 121); 43 | this.pluginsListBox.TabIndex = 0; 44 | this.pluginsListBox.SelectedIndexChanged += new System.EventHandler(this.pluginsListBox_SelectedIndexChanged); 45 | // 46 | // button1 47 | // 48 | this.button1.DialogResult = System.Windows.Forms.DialogResult.OK; 49 | this.button1.Location = new System.Drawing.Point(186, 74); 50 | this.button1.Name = "button1"; 51 | this.button1.Size = new System.Drawing.Size(96, 23); 52 | this.button1.TabIndex = 3; 53 | this.button1.Text = "&Close"; 54 | this.button1.UseVisualStyleBackColor = true; 55 | // 56 | // selectBtn 57 | // 58 | this.selectBtn.Location = new System.Drawing.Point(186, 45); 59 | this.selectBtn.Name = "selectBtn"; 60 | this.selectBtn.Size = new System.Drawing.Size(96, 23); 61 | this.selectBtn.TabIndex = 1; 62 | this.selectBtn.Text = "&Select"; 63 | this.selectBtn.UseVisualStyleBackColor = true; 64 | this.selectBtn.Click += new System.EventHandler(this.selectBtn_Click); 65 | // 66 | // lblDescription 67 | // 68 | this.lblDescription.Location = new System.Drawing.Point(9, 9); 69 | this.lblDescription.Name = "lblDescription"; 70 | this.lblDescription.Size = new System.Drawing.Size(273, 33); 71 | this.lblDescription.TabIndex = 4; 72 | this.lblDescription.Text = "Select the client you wish to update to then press Select."; 73 | // 74 | // UpdateForm 75 | // 76 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 77 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 78 | this.ClientSize = new System.Drawing.Size(312, 178); 79 | this.Controls.Add(this.lblDescription); 80 | this.Controls.Add(this.button1); 81 | this.Controls.Add(this.selectBtn); 82 | this.Controls.Add(this.pluginsListBox); 83 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 84 | this.MaximizeBox = false; 85 | this.MinimizeBox = false; 86 | this.Name = "UpdateForm"; 87 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 88 | this.Text = "Update OTB"; 89 | this.Load += new System.EventHandler(this.PluginForm_Load); 90 | this.ResumeLayout(false); 91 | 92 | } 93 | 94 | #endregion 95 | 96 | private System.Windows.Forms.ListBox pluginsListBox; 97 | private System.Windows.Forms.Button button1; 98 | private System.Windows.Forms.Button selectBtn; 99 | public System.Windows.Forms.Label lblDescription; 100 | } 101 | } -------------------------------------------------------------------------------- /Source/UpdateForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Text; 7 | using System.Windows.Forms; 8 | using PluginInterface; 9 | 10 | namespace otitemeditor 11 | { 12 | public partial class UpdateForm : Form 13 | { 14 | public otitemeditor mainForm = null; 15 | public Host.Types.Plugin selectedPlugin = null; 16 | public SupportedClient updateClient = null; 17 | 18 | private UInt32 currentClientIndex = 0; 19 | private List clientList = new List(); 20 | 21 | public UpdateForm() 22 | { 23 | InitializeComponent(); 24 | } 25 | 26 | private void PluginForm_Load(object sender, EventArgs e) 27 | { 28 | foreach (Host.Types.Plugin plugin in Program.plugins.AvailablePlugins) 29 | { 30 | foreach (SupportedClient client in plugin.Instance.SupportedClients) 31 | { 32 | UInt32 index = (UInt32)pluginsListBox.Items.Add(client.description); 33 | clientList.Add(client); 34 | 35 | if (client.otbVersion == mainForm.currentOtbVersion) 36 | { 37 | currentClientIndex = index; 38 | } 39 | } 40 | } 41 | 42 | if (pluginsListBox.Items.Count > 0) 43 | { 44 | pluginsListBox.SelectedIndex = (int)currentClientIndex; 45 | } 46 | } 47 | 48 | private void selectBtn_Click(object sender, EventArgs e) 49 | { 50 | if(pluginsListBox.SelectedItem != null){ 51 | selectedPlugin = Program.plugins.AvailablePlugins.Find(pluginsListBox.SelectedItem.ToString()); 52 | updateClient = clientList[(Int32)pluginsListBox.SelectedIndex]; 53 | 54 | this.DialogResult = DialogResult.OK; 55 | Close(); 56 | } 57 | } 58 | 59 | private void pluginsListBox_SelectedIndexChanged(object sender, EventArgs e) 60 | { 61 | if (pluginsListBox.SelectedItem != null && mainForm.currentPlugin != null) 62 | { 63 | selectBtn.Enabled = true; 64 | } 65 | } 66 | 67 | private void btnChangeFolder_Click(object sender, EventArgs e) 68 | { 69 | 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /Source/UpdateForm.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 | -------------------------------------------------------------------------------- /Source/UpdateSettingsForm.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace otitemeditor 2 | { 3 | partial class UpdateSettingsForm 4 | { 5 | /// 6 | /// Required designer variable. 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// Clean up any resources being used. 12 | /// 13 | /// true if managed resources should be disposed; otherwise, false. 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows Form Designer generated code 24 | 25 | /// 26 | /// Required method for Designer support - do not modify 27 | /// the contents of this method with the code editor. 28 | /// 29 | private void InitializeComponent() 30 | { 31 | this.updateSettingsGroupBox = new System.Windows.Forms.GroupBox(); 32 | this.createNewItemsCheck = new System.Windows.Forms.CheckBox(); 33 | this.reloadItemAttributesCheck = new System.Windows.Forms.CheckBox(); 34 | this.generateSignatureCheck = new System.Windows.Forms.CheckBox(); 35 | this.reassignUnmatchedSpritesCheck = new System.Windows.Forms.CheckBox(); 36 | this.closeBtn = new System.Windows.Forms.Button(); 37 | this.updateSettingsGroupBox.SuspendLayout(); 38 | this.SuspendLayout(); 39 | // 40 | // updateSettingsGroupBox 41 | // 42 | this.updateSettingsGroupBox.Controls.Add(this.createNewItemsCheck); 43 | this.updateSettingsGroupBox.Controls.Add(this.reloadItemAttributesCheck); 44 | this.updateSettingsGroupBox.Controls.Add(this.generateSignatureCheck); 45 | this.updateSettingsGroupBox.Controls.Add(this.reassignUnmatchedSpritesCheck); 46 | this.updateSettingsGroupBox.Location = new System.Drawing.Point(12, 12); 47 | this.updateSettingsGroupBox.Name = "updateSettingsGroupBox"; 48 | this.updateSettingsGroupBox.Size = new System.Drawing.Size(298, 131); 49 | this.updateSettingsGroupBox.TabIndex = 0; 50 | this.updateSettingsGroupBox.TabStop = false; 51 | this.updateSettingsGroupBox.Text = "Settings"; 52 | // 53 | // createNewItemsCheck 54 | // 55 | this.createNewItemsCheck.AutoSize = true; 56 | this.createNewItemsCheck.Checked = true; 57 | this.createNewItemsCheck.CheckState = System.Windows.Forms.CheckState.Checked; 58 | this.createNewItemsCheck.Location = new System.Drawing.Point(6, 65); 59 | this.createNewItemsCheck.Name = "createNewItemsCheck"; 60 | this.createNewItemsCheck.Size = new System.Drawing.Size(218, 17); 61 | this.createNewItemsCheck.TabIndex = 2; 62 | this.createNewItemsCheck.Text = "Create new item(s) for unassigned sprites"; 63 | this.createNewItemsCheck.UseVisualStyleBackColor = true; 64 | // 65 | // reloadItemAttributesCheck 66 | // 67 | this.reloadItemAttributesCheck.AutoSize = true; 68 | this.reloadItemAttributesCheck.Checked = true; 69 | this.reloadItemAttributesCheck.CheckState = System.Windows.Forms.CheckState.Checked; 70 | this.reloadItemAttributesCheck.Location = new System.Drawing.Point(6, 42); 71 | this.reloadItemAttributesCheck.Name = "reloadItemAttributesCheck"; 72 | this.reloadItemAttributesCheck.Size = new System.Drawing.Size(128, 17); 73 | this.reloadItemAttributesCheck.TabIndex = 1; 74 | this.reloadItemAttributesCheck.Text = "Reload item attributes"; 75 | this.reloadItemAttributesCheck.UseVisualStyleBackColor = true; 76 | // 77 | // generateSignatureCheck 78 | // 79 | this.generateSignatureCheck.AutoSize = true; 80 | this.generateSignatureCheck.Location = new System.Drawing.Point(6, 88); 81 | this.generateSignatureCheck.Name = "generateSignatureCheck"; 82 | this.generateSignatureCheck.Size = new System.Drawing.Size(182, 17); 83 | this.generateSignatureCheck.TabIndex = 3; 84 | this.generateSignatureCheck.Text = "Generate image signatures (slow)"; 85 | this.generateSignatureCheck.UseVisualStyleBackColor = true; 86 | // 87 | // reassignUnmatchedSpritesCheck 88 | // 89 | this.reassignUnmatchedSpritesCheck.AutoSize = true; 90 | this.reassignUnmatchedSpritesCheck.Checked = true; 91 | this.reassignUnmatchedSpritesCheck.CheckState = System.Windows.Forms.CheckState.Checked; 92 | this.reassignUnmatchedSpritesCheck.Location = new System.Drawing.Point(6, 19); 93 | this.reassignUnmatchedSpritesCheck.Name = "reassignUnmatchedSpritesCheck"; 94 | this.reassignUnmatchedSpritesCheck.Size = new System.Drawing.Size(208, 17); 95 | this.reassignUnmatchedSpritesCheck.TabIndex = 0; 96 | this.reassignUnmatchedSpritesCheck.Text = "Reassign items with unmatched sprites"; 97 | this.reassignUnmatchedSpritesCheck.UseVisualStyleBackColor = true; 98 | // 99 | // closeBtn 100 | // 101 | this.closeBtn.DialogResult = System.Windows.Forms.DialogResult.OK; 102 | this.closeBtn.Location = new System.Drawing.Point(235, 149); 103 | this.closeBtn.Name = "closeBtn"; 104 | this.closeBtn.Size = new System.Drawing.Size(75, 23); 105 | this.closeBtn.TabIndex = 4; 106 | this.closeBtn.Text = "OK"; 107 | this.closeBtn.UseVisualStyleBackColor = true; 108 | // 109 | // UpdateSettingsForm 110 | // 111 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 112 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 113 | this.ClientSize = new System.Drawing.Size(322, 184); 114 | this.Controls.Add(this.closeBtn); 115 | this.Controls.Add(this.updateSettingsGroupBox); 116 | this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; 117 | this.MaximizeBox = false; 118 | this.MinimizeBox = false; 119 | this.Name = "UpdateSettingsForm"; 120 | this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; 121 | this.updateSettingsGroupBox.ResumeLayout(false); 122 | this.updateSettingsGroupBox.PerformLayout(); 123 | this.ResumeLayout(false); 124 | 125 | } 126 | 127 | #endregion 128 | 129 | private System.Windows.Forms.GroupBox updateSettingsGroupBox; 130 | private System.Windows.Forms.Button closeBtn; 131 | public System.Windows.Forms.CheckBox createNewItemsCheck; 132 | public System.Windows.Forms.CheckBox reloadItemAttributesCheck; 133 | public System.Windows.Forms.CheckBox generateSignatureCheck; 134 | public System.Windows.Forms.CheckBox reassignUnmatchedSpritesCheck; 135 | } 136 | } -------------------------------------------------------------------------------- /Source/UpdateSettingsForm.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.ComponentModel; 4 | using System.Data; 5 | using System.Drawing; 6 | using System.Text; 7 | using System.Windows.Forms; 8 | 9 | namespace otitemeditor 10 | { 11 | public partial class UpdateSettingsForm : Form 12 | { 13 | public UpdateSettingsForm() 14 | { 15 | InitializeComponent(); 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Source/UpdateSettingsForm.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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | -------------------------------------------------------------------------------- /Source/Utils.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | using System.IO; 5 | using System.Drawing; 6 | using System.Drawing.Imaging; 7 | 8 | namespace otitemeditor 9 | { 10 | public class Utils 11 | { 12 | public static bool ByteArrayCompare(byte[] a1, byte[] a2) 13 | { 14 | if (a1.Length != a2.Length) 15 | return false; 16 | 17 | for (int i = 0; i < a1.Length; i++) 18 | if (a1[i] != a2[i]) 19 | return false; 20 | 21 | return true; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Source/app.config: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Source/otitemeditor.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | Debug 5 | x86 6 | 8.0.30703 7 | 2.0 8 | {9A90BE1A-4A8F-4BFE-92E7-2C0EF64D850C} 9 | WinExe 10 | Properties 11 | otitemeditor 12 | otitemeditor 13 | v4.0 14 | 15 | 16 | 512 17 | publish\ 18 | true 19 | Disk 20 | false 21 | Foreground 22 | 7 23 | Days 24 | false 25 | false 26 | true 27 | 0 28 | 1.0.0.%2a 29 | false 30 | false 31 | true 32 | 33 | 34 | x86 35 | true 36 | full 37 | false 38 | bin\Debug\ 39 | DEBUG;TRACE 40 | prompt 41 | 4 42 | true 43 | false 44 | 45 | 46 | x86 47 | pdbonly 48 | true 49 | bin\Release\ 50 | TRACE 51 | prompt 52 | 4 53 | false 54 | 55 | 56 | otitemeditor.ico 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | Form 69 | 70 | 71 | CompareOtbForm.cs 72 | 73 | 74 | Form 75 | 76 | 77 | otitemeditor.cs 78 | 79 | 80 | Form 81 | 82 | 83 | UpdateForm.cs 84 | 85 | 86 | 87 | 88 | Form 89 | 90 | 91 | ProgressForm.cs 92 | 93 | 94 | 95 | 96 | Form 97 | 98 | 99 | UpdateSettingsForm.cs 100 | 101 | 102 | 103 | CompareOtbForm.cs 104 | 105 | 106 | otitemeditor.cs 107 | 108 | 109 | UpdateForm.cs 110 | 111 | 112 | ProgressForm.cs 113 | 114 | 115 | ResXFileCodeGenerator 116 | Resources.Designer.cs 117 | Designer 118 | 119 | 120 | True 121 | Resources.resx 122 | True 123 | 124 | 125 | UpdateSettingsForm.cs 126 | 127 | 128 | 129 | SettingsSingleFileGenerator 130 | Settings.Designer.cs 131 | 132 | 133 | True 134 | Settings.settings 135 | True 136 | 137 | 138 | 139 | 140 | {2FBAC16E-457D-472B-880D-8D393F8A7827} 141 | ImageSimilarity 142 | 143 | 144 | {8624E915-FB86-4DDB-ACA6-A2313F70BA9C} 145 | plugincustom 146 | 147 | 148 | {4624E915-FB86-4DDB-ACA6-A2313F70BA9C} 149 | plugin850 150 | 151 | 152 | {3624E915-FB86-4DDB-ACA6-A2313F70BA9C} 153 | plugin860 154 | 155 | 156 | {F1A9A849-66BA-4B7D-AE69-A896B5893418} 157 | plugin872 158 | 159 | 160 | {F1A9A849-66BA-4B7D-AE69-A896B5893419} 161 | plugin900 162 | 163 | 164 | {06A3993C-A9DA-44BE-AE47-13F6503E7A01} 165 | plugin940 166 | 167 | 168 | {D0473665-569C-4205-89DE-23074EBD0DC0} 169 | plugin960 170 | 171 | 172 | {D0473665-569C-4205-89DE-23074EBD0DC1} 173 | plugin1010 174 | 175 | 176 | {D2C9DCC5-05F8-4204-96F9-3231DAE13525} 177 | plugin1021 178 | 179 | 180 | {CEF21172-258C-4D0D-B024-ED7EF99612A2} 181 | PluginInterface 182 | 183 | 184 | 185 | 186 | False 187 | Microsoft .NET Framework 4 Client Profile %28x86 and x64%29 188 | true 189 | 190 | 191 | False 192 | .NET Framework 3.5 SP1 Client Profile 193 | false 194 | 195 | 196 | False 197 | .NET Framework 3.5 SP1 198 | false 199 | 200 | 201 | False 202 | Windows Installer 3.1 203 | true 204 | 205 | 206 | 207 | 208 | 209 | 210 | 217 | -------------------------------------------------------------------------------- /Source/otitemeditor.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/opentibia/item-editor/7538cbdab855e02a328a0a8209be11296f6649c4/Source/otitemeditor.ico -------------------------------------------------------------------------------- /Source/otitemeditor.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 | False 122 | 123 | 124 | 17, 17 125 | 126 | 127 | 233, 17 128 | 129 | -------------------------------------------------------------------------------- /build-linux.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | FINAL_RELEASE_DIR="`pwd`/release" 4 | PLUGIN_XML_DIR="`pwd`/Source/Plugins" 5 | RELEASE_DIR="`pwd`/Source/bin/Release" 6 | 7 | xbuild /p:Configuration=Release otitemeditor.sln 8 | 9 | rm -rf $FINAL_RELEASE_DIR 10 | mkdir -p $FINAL_RELEASE_DIR || exit 11 | mkdir -p $FINAL_RELEASE_DIR/plugins 12 | cp $RELEASE_DIR/*.exe $FINAL_RELEASE_DIR 13 | cp $RELEASE_DIR/ImageSimilarity.dll $FINAL_RELEASE_DIR 14 | cp $RELEASE_DIR/PluginInterface.dll $FINAL_RELEASE_DIR 15 | cp $RELEASE_DIR/plugin*.dll $FINAL_RELEASE_DIR/plugins 16 | cp $PLUGIN_XML_DIR/*.xml $FINAL_RELEASE_DIR/plugins 17 | --------------------------------------------------------------------------------