Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 50 additions & 13 deletions instructions.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
<title>Quackhead - Duck Game Hat Pack Creation Tool - Instructions</title>
</head>
<body>
<h2>Quackhead Instructions</h3>
<h2>Quackhead Instructions</h2>
<p>
Quackhead will allow you to create hat packs without doing any coding at all!<br/>
This page provides instructions detailing the process of creating a hat pack.
</p>
<h3>1. Understanding the hat images</h4>
<h3>1. Understanding the hat images</h3>
<p>
First, choose an image editor. Use anything except MS Paint.<br/>
I recommend Paint.NET if you are new to image editing, get it <a href="http://www.dotpdn.com/downloads/pdn.html">Here</a>. (The download page has ads that look like download links, so use adblock or be careful not to click them.)<br/>
Expand Down Expand Up @@ -45,10 +45,25 @@ <h3>3. Exporting as .hat files</h3>
Then start duck game, your hats should be in your hat selector.<br/>
If you don't need to export as a mod pack, you're done! Otherwise read on.
</p>
<h3>4. Exporting as a Mod Pack</h3>
<h3>4. Exporting as a Hat Mania Package</h3>
<p>
Mod packs allow people using the mod to wear the hat, but currently they can ONLY play with other people using the mod.<br/>
You may not want to use this unless you have a group of people who will play using your mod.<br/>
Hat Mania packages allow people using the mod "Hat File Mania" to wear and save the hat.<br/>
While in-game, people using the mod <abbr title="Hat File Mania">HFM</abbr> can directly copy hats as .hat files via the F11 menu added by <abbr title="Hat File Mania">HFM</abbr><br/>
A Hat Mania package is a mod that carries .hat files across the workshop, and automatically disables itself when downloaded.<br/>
To generate a Hat Mania package:<br/>
Click "Export as Modpack" at the top.<br/>
Fill in the following fields, described below:<br/>
"Name" - Unique Name for your mod<br/>
"Description" - One line description of your mod<br/>
"Author" - Name / Username of the mod creator<br/>
"Version" - Must be a number, describes the version of your mod. If you leave it blank it will say "1.0.0.0" when you download it.<br/>
Once done, click "Download as Hat Mania package"
</p>
<h3>5. Exporting as a Standard Mod Pack</h3>
<p>
Standard mod packs allow people using the mod to wear the hat, but currently they can ONLY play with other people using the mod.<br/>
You may not want to use this unless you have a group of people who will agree to play using your mod.<br/>
To generate a Standard Mod Pack:<br/>
Click "Export as Modpack" at the top.<br/>
Fill in the following fields, described below:<br/>
"Name" - Unique Name for your mod<br/>
Expand All @@ -57,23 +72,45 @@ <h3>4. Exporting as a Mod Pack</h3>
"Version" - Must be a number, describes the version of your mod.<br/>
Once done, click "Download Exported Modpack"
</p>
<h3>5. Testing your mod pack</h3>
<h3>6. Testing your mod pack</h3>
<p>
Open the .zip file, and copy the folder inside to your Documents/Duck Game/Mods folder</br>
Start duck game, and as soon as you can, try to change your hat. Check that your new hats work correctly.<br/>
For any Mod type: Open the .zip file, and copy the folder inside to your Documents/Duck Game/Mods folder<br/>
<br/>
For Hat Mania Packages:<br/>
Subscribe to Hat File Mania on the Steam workshop before continuing:<br/>
<a href="http://steamcommunity.com/workshop/filedetails/?id=877990149">http://steamcommunity.com/workshop/filedetails/?id=877990149</a><br/>
Then start Duck Game and press the F11 key.<br/>
Navigate through "Save Hat Mania" and find your modpack in the list, (it should be at the top) then select it.<br/>
Make sure all your hats are visible.<br/>
If you have problems, you can remove the mod from your Mods folder to get things back to normal.<br/>
<br/>
For Standard Mod Packs:
Start Duck Game, and as soon as you can, try to change your hat. Check that your new hats work correctly.<br/>
Be aware that with mod packs, you can ONLY play with people that have the exact same combination of mod packs<br/>
If you have problems, you can remove the mod from your Mods folder to get things back to normal.<br/>
</p>
<h3>6. Adding a thumbnail</h3>
<h3>7. Adding a thumbnail</h3>
<p>
(this step is completely optional, but recommended)<br/>
The thumbnail is a square image that will be shown on the workshop and mod browser.<br/>
Create a 256x256 png file and name it "preview.png", put it in the "content" folder inside the mod directory.
The thumbnail is a square image that will be shown on the mod browser.<br/>
Create a 1:1 png file (256x256 is a good resolution for this) and name it "preview.png".<br/>
Put it in the "Content" folder inside the mod directory, replacing the existing image.
</p>
<h3>8. Adding a screenshot</h3>
<p>
(this step is also completely optional, but recommended)<br/>
The screenshot is a high resolution image that will be shown on the workshop.<br/>
Create a 16:9 png file (something like 1280x720 or 1920x1080) and name it "screenshot.png".<br/>
Put in the "Content" folder inside the mod directory, replacing the existing image.
</p>
<h3>7. Publishing</h3>
<h3>9. Publishing</h3>
<p>
You can publish your mod so other people can use it. In the settings page, go to "Manage Mods".<br/>
From there, you can publish your mod.
From there, you can publish your mod.<br/>
<br/>
Once you have published your Mod:<br/>
If it is a Hat Mania package, it is recommended that you click "Add/Remove Required Items" in the OWNER CONTROLS panel,
then add Hat File Mania as a required item to ensure that people will see your hats in-game.
</p>
</body>
</html>
1 change: 1 addition & 0 deletions quackhead.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
<input type="text" class="form-control" id="moddescbox" placeholder="Description"></input>
<input type="text" class="form-control" id="modauthorbox" placeholder="Author (or your username)"></input>
<input type="text" class="form-control" id="modverbox" placeholder="Version"></input>
<button type="button" class="btn btn-default" id="downloadhatmaniapackbtn">Download as Hat Mania package (recommended)</button>
<button type="button" class="btn btn-default" id="downloadmodpackbtn">Download Exported Modpack</button>
</div>
<div id="errorbox" style="display: none;margin-bottom: 5px;background-color: #B20000;position: relative;border-radius:6px;box-sizing: border-box;width: 500px;padding: 15px 15px 15px 15px;color: #ffffff">
Expand Down
51 changes: 51 additions & 0 deletions quackhead.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var teams = [];
var modPackData = {
"team": " Teams.core.teams.Add(new Team(\"TEAMNAME\", Mod.GetPath<SMODNAME>(\"FILENAMENOEXT\"), false, false, new Vec2()));\n",
"modcs": "using DuckGame;\n\nnamespace DuckGame.SMODNAME\n{\n public class SMODNAME : Mod\n {\n protected override void OnPostInitialize()\n {\nTEAMCODE\n base.OnPostInitialize();\n }\n }\n }\n",
"hfm_modcs":`using DuckGame;\nusing System.Xml;\n\nnamespace HatFileMania.SMODNAME\n{\n public class SMODNAME : Mod\n {\n protected override void OnPostInitialize()\n {\n XmlDocument doc = new XmlDocument();\n doc.Load(DuckFile.modsDirectory + "/mods.conf");\n XmlElement root = doc["Mods"];\n if (root["Disabled"] == null)\n {\n root.AppendChild(doc.CreateElement("Disabled"));\n }\n root["Disabled"].InnerText = string.Join("|",new string[] {root["Disabled"].InnerText,this.configuration.name});\n doc.Save(DuckFile.modsDirectory + "/mods.conf");\n string compiled = string.Concat(new string[]{\n this.configuration.directory,"/",\n this.configuration.name,\n "_compiled.dll"});\n if (System.IO.File.Exists(compiled))\n System.IO.File.SetAttributes(compiled, System.IO.FileAttributes.Normal);\n System.IO.File.Delete(compiled);\n string hash = string.Concat(new string[]{\n this.configuration.directory,"/",\n this.configuration.name,\n "_compiled.hash"});\n if (System.IO.File.Exists(hash))\n System.IO.File.SetAttributes(hash, System.IO.FileAttributes.Normal);\n System.IO.File.Delete(hash);\n base.OnPostInitialize();\n }\n }\n}`,
"asminfocs": "using System.Reflection;\n\n[assembly: AssemblyTitle(\"MODNAME\")]\n[assembly: AssemblyCompany(\"MODAUTHOR\")]\n[assembly: AssemblyDescription(\"MODDESC\")]\n[assembly: AssemblyVersion(\"MODVER\")]\n",
"modconf": "<Mod>\n\n</Mod>\n"
}
Expand Down Expand Up @@ -57,6 +58,15 @@ function init() {
exportModpack(modname, moddesc, modauthor, modver);
e.preventDefault();
});

document.getElementById("downloadhatmaniapackbtn").addEventListener("click", function(e) {
var modname = document.getElementById("modnamebox").value;
var moddesc = document.getElementById("moddescbox").value;
var modauthor = document.getElementById("modauthorbox").value;
var modver = document.getElementById("modverbox").value;
exportHatManiaPackage(modname, moddesc, modauthor, modver);
e.preventDefault();
});

PIXI.SCALE_MODES.DEFAULT = PIXI.SCALE_MODES.NEAREST;
duckDemoDiv = document.getElementById("teambox");
Expand Down Expand Up @@ -189,6 +199,7 @@ function replaceAll(str, find, replace) {
}

function exportModpack(name, desc, author, ver) {
if (ver === "") {ver = "1.0.0.0";}
var sName = makeSafeName(name);
var zip = new JSZip();
var modFolder = zip.folder(sName)
Expand Down Expand Up @@ -307,4 +318,44 @@ function exportHatFiles() {
}
}

function exportHatManiaPackage(name, desc, author, ver) {
if (ver === "") {ver = "1.0.0.0";}
name = "[HatMania] "+name
var sName = makeSafeName(name);
var zip = new JSZip();

var modFolder = zip.folder(sName)
var contentFolder = modFolder.folder("Content");

var modcs = modPackData.hfm_modcs;
modcs = replaceAll(modcs, "SMODNAME", sName);
modFolder.file("Mod.cs", modcs);

var asm = modPackData.asminfocs;
asm = replaceAll(asm, "MODNAME", name);
asm = replaceAll(asm, "MODDESC", desc);
asm = replaceAll(asm, "MODAUTHOR", author);
asm = replaceAll(asm, "MODVER", ver);
modFolder.file("AssemblyInfo.cs", asm);

modFolder.file("place hat files here", "");

contentFolder.file("preview.png","iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwMy8wNi8xN40hBsMAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzbovLKMAAAAvElEQVRYhe2U3QqAMAiFLXpXn+k8bd1kjDWdjsUIPCDV/vw050ZEJy3UvtJ5AiTAvwEArAWISgPeaLARlQcyszleOy/X0w0QNgDN9+iaYyR6S9HacNUAANfBAIiZH/MATs0AM6ugMleDDRfhLP23EX0CoBWb9l9ndUPznlo2sqc21y1oVa+1VtTrkET3NZRJeXqd9UDl2wrgEIeRKHsQIjmv7g+vDMyUFkQrMyEALUPluBWpNp6dMAESIAEuMdarJk1qxl8AAAAASUVORK5CYII=", {base64: true})

contentFolder.file("screenshot.png","iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABZ0RVh0Q3JlYXRpb24gVGltZQAwMy8wNi8xN40hBsMAAAAcdEVYdFNvZnR3YXJlAEFkb2JlIEZpcmV3b3JrcyBDUzbovLKMAAAAvElEQVRYhe2U3QqAMAiFLXpXn+k8bd1kjDWdjsUIPCDV/vw050ZEJy3UvtJ5AiTAvwEArAWISgPeaLARlQcyszleOy/X0w0QNgDN9+iaYyR6S9HacNUAANfBAIiZH/MATs0AM6ugMleDDRfhLP23EX0CoBWb9l9ndUPznlo2sqc21y1oVa+1VtTrkET3NZRJeXqd9UDl2wrgEIeRKHsQIjmv7g+vDMyUFkQrMyEALUPluBWpNp6dMAESIAEuMdarJk1qxl8AAAAASUVORK5CYII=", {base64: true})

if (teams.length == 0) {
return;
} else {
teams.forEach(function(team) {
var hat = generateHatFile(team);
var shName = makeSafeName(team.tile.children[0].children[0].value);
modFolder.file(shName + ".hat", btoa(toStr(hat)), {base64: true});
});
}

var zipDL = zip.generate({type:"blob"});
saveAs(zipDL, sName + ".zip");
}

window.onload = init;