If you have looked through Battleship Craft's code, you may have noticed a 'battleship.sqlite' file that stores your ships. This is a tutorial that will show you how to transfer data from this database into a .plist file that you can upload into your application, and fight it in a custom battle.
It is recommended that you read this tutorial before proceeding if you plan to spawn your ship in a custom battle.
Procuring a .plist File from your Battleship.sqlite database
Grid data for enemy and shop (or template) ships is stored in a .plist file. This first section of the tutorial will show you how to tranfer the .sqlite data into .plist data.
- Using iTools, goto: Battleship.app>Ships, right click on 'Box.plist', and select 'Copy to Local'
- Using iTools, goto: Documents>db, right click on 'Battleship.sqlite', and select 'Copy to Local'
- Open up both the MS Excel and Text documents labeled 'sqlite code'
- Open the SQLite editor by accessing it under the 'Web Developer' dropdown menu
- On the SQLite Editor, under 'Database' on the top menu, select 'Connect Database'
- Select your 'battleship.sqlite' that you copied, and select 'Open'
- Under the 'Execute SQL' tab in the SQLite editor, enter 'SELECT z_pk, ztitle FROM zbsmanagedship' in the 'Enter SQL' box, and hit 'Run SQL'
- You will see two columns, one with the ship name, one with a number. Now enter 'SELECT zcolor, zprototype, zquaternion, ztranslationx, ztranslationy, ztranslationz FROM zbsmanagedunit WHERE zship = ???', replacing the '???' with the corresponding number to the ship you are tranfering.
- You will see a larger gid with several columns. Left click on the top row, scroll down, shift+left click on the bottom row. This will select the entire grid. Right click, and select 'Copy row(s) as CSV (MSExcel compatible)'
- Open up the sqlite code excel sheet. Make sure cell B1 is selected, then hit paste.
- Select all the values from column H, and paste them into the Box.plist file, replacing its <array> <dict>-</dict> entries with the ones you copied fro the excel sheet.
- Under 'File', select 'Save As'. Enter a name that will be used as identification, make sure the format selected is 'Unicode', then select a destination file folder, and hit 'Save'
You now have your .plist file.
Note: the sqlitecode.txt file contains the SQLite editor entry values, I placed them in the tutorial for convenience.
Uploading the .plist File into the Game
This second section will show you how to move the procured .plist into your battleship craft game.
- Using iTools, go to your Ships file folder under Battleship.app, and select upload. Find your new .plist file and upload it.
- Find the Ships.plist file in Battleship.app. Copy the 'AddonAegis' entry, and paste it. Modify it to fit your uploaded .plist file. Note: the <key>-</key> entry above the <dict>-</dict> data should be the same as the .plist file
Your custom ship now has the necessary identification to be spawned in a battle.
Note: if you modify the <key>type</key> <string>-</string> entry to 'template' and specify a cost, your ship will appear in the shop.