Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert units.csv to units.json #9

Draft
wants to merge 18 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
55 changes: 29 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ of the original game.

Similarly, the aim is to include and allow the purchase of ships
not available for purchase in the original Privateer game. The
rationale is that all ships flying around in the wider Wing
Commander Universe should be available for purchase.
rationale is that if a ship is seen flying around in the wider Wing
Commander Universe, it should be available for purchase -- at the
right price (which may include doing someone a personal favour).

It should be noted that Privateer: Wing Commander Universe is
basically a rebranded version of Privateer: Parallel Universe.
Expand All @@ -32,50 +33,50 @@ check out the development thread on the Vega Strike forums:
How to get Privateer: Wing Commander Universe running
-----------------------------------------------------

Priv:WCU is developed on top of the latest SVN version of the
VegaStrike engine. It is not presently in a state suitable for
Priv:WCU is developed on top of the latest stable git branch version
of the VegaStrike engine. It is not presently in a state suitable for
end-users.

It is worth noting that Priv:WCU is developed on Linux.
It is worth noting that Priv:WCU is developed and tested primarily on
Linux.

### Windows:

Priv:WCU does not currently run under Windows. Last I checked, the
VegaStrike development binaries for Windows did not work with the
Priv:WCU code base.
Priv:WCU is not currently tested under Windows, but the VegaStrike
engine should now be running on Windows.

### Linux:

Instructions on how to fetch and compile the newest VegaStrike
engine can be found here:

http://wiki.vega-strike.org/HowTo:Compile_from_SVN_on_Linux
https://github.com/vegastrike/Vega-Strike-Engine-Source#compiling-vegastrike

I've recently ported the codebase to python3.4, but this requires that the user hacks the latest Vega Strike CMake configuration (since the current VS revision only supports python3.3 out of the box). There are instructions on how to accomplish this on the wiki -- it basically involves replacing py3.3 with py3.4 in a section of 20 lines of code.
The Priv:WCU codebase has been ported to py3. Python-3.4 and up is
supported since the 0.8.x branch of the Vega-Strike-Engine-Source project.

Python 2.7 is no longer supported.
Python-2.7 is no longer supported.

### Creating symlinks to the VegaStrike binaries ###

Create a bin/ directory in the root Priv:WCU folder and create
symbolic links to the vegastrike and vssetup binaries respectively.
symbolic links to the `vegastrike-engine` and `vegasettings` binaries respectively.

On my system, it looks like this:


[privateer_wcu/]$ ls -la bin/
total 8
drwx------ 2 ermo ermo 4096 Sep 25 16:16 .
drwxrwxr-x 26 ermo ermo 4096 Sep 25 16:12 ..
lrwxrwxrwx 1 ermo ermo 39 Sep 5 00:46 vegastrike -> ../../trunk/vegastrike/build/vegastrike
lrwxrwxrwx 1 ermo ermo 42 Sep 5 00:46 vssetup -> ../../trunk/vegastrike/build/setup/vssetup
[privateer_wcu/]$
ermo@dante:~/repos/privateer_wcu/bin [master* +0 ~1 -0 !]
$ ls -l
total 0
lrwxrwxrwx 1 ermo ermo 48 Aug 18 18:14 vegasettings -> ../../Vega-Strike-Engine-Source/bin/vegasettings
lrwxrwxrwx 1 ermo ermo 53 Aug 18 18:14 vegastrike-engine -> ../../Vega-Strike-Engine-Source/bin/vegastrike-engine


To start Priv:WCU, navigate to the root Priv:WCU folder and type bin/vegastrike <ENTER>
To start Priv:WCU in development mode, navigate to the Priv:WCU folder
and type `bin/vegastrike-engine -D./` `<ENTER>`

To change the Priv:WCU configuration options, navigate to the root Priv:WCU folder
and type bin/vssetup <ENTER>
To change the Priv:WCU configuration options, navigate to the Priv:WCU folder
and type `bin/vegasettings --target ./` `<ENTER>`


Forking
Expand All @@ -86,6 +87,7 @@ competing projects until such time as it is clear that I (ermo) am no
longer making any attempt to update it. You are however welcome to
fork the project if the intent is to contribute content or bugfixes. :)

Please use only `https://github.com/pwcu/privateer_wcu` as the fork origin.

History
-------
Expand All @@ -98,7 +100,7 @@ here), but also includes content from the Privateer: Gemini Gold mod
engine as one is likely to get) and the Wing Commander Universe project,
which itself spawned the Privateer Remake project.

Wing Commander Universe can be found at http://wcu.solsector.net/
Wing Commander: Universe can be found at http://wcu.solsector.net/

Privateer: Gemini Gold can be found at http://privateer.sourceforge.net/

Expand All @@ -108,6 +110,7 @@ Confused yet?
Credits
-------

* Chuck Starchaser (Privateer: Parallel Universe lead)
* John Cordell (Privateer: Gemini Gold lead)
* (to be filled in as I learn more about the long history this project)
- Chuck Starchaser (Privateer: Parallel Universe lead)
- John Cordell (Privateer: Gemini Gold lead)
- [DMJC](https://github.com/DMJC) (Wing Commander: Universe lead)
- (to be filled in as I learn more about the long history this project)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add @ermo in too as he's the current lead on this

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should get updated for this repo

28 changes: 28 additions & 0 deletions modules/GUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,34 @@ def __init__(self,screenX,screenY,marginX=None,marginY=None):
self.keyTarget = None
Base.GlobalKeyPython('#\nfrom GUI import *\nGUIRootSingleton.keyEvent()\n')

# VS Engine API version check ported verbatim from:
# https://github.com/vegastrike/Assets-Production/blob/master/modules/GUI.py
hasVersion = hasattr(VS, 'EngineVersion')
# get the engine version tuple in a displayable format
# if it needs to be compared, then use the original tuple version
ev = (
VS.EngineVersion().GetVersion()
if hasVersion
else (0, 7, 0, 'unknown') # 0.7.x was the last version without this API
)
engineVersion = '.'.join(
[
str(i)
for i in ev
]
)

apiVersion = (
VS.EngineVersion().GetAssetAPIVersion()
if hasVersion
else 0
)

trace(TRACE_WARNING, "::: What's in VS object %s :::" %(dir(VS)))
trace(TRACE_WARNING, "::: Engine Version {0} :::".format(engineVersion))
trace(TRACE_WARNING, "::: Asset API Version {0} :::".format(apiVersion))
# end VS Engine API version check
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stephengtuggy we (Vegastrike team) should post this code on its own and recommend people copy it in from that source so that we don't have to remember it for each game asset set.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the note


def setScreenDimensions(self,screenX,screenY):
self.screenX=screenX
self.screenY=screenY
Expand Down
2 changes: 1 addition & 1 deletion modules/camptroy.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
("Captain_Stahl","By 'tried' I suppose you mean he failed?"),
("Burrows","Otherwise I wouldn't be standing here."),
("Captain_Stahl","Good. You have proved your abilities, then. But this also shows that we have a traitor in our ranks."),
("Burrows","Oh, come on! You think that the pirates would go such lengths as to plant a spy in your company - just to intercept a shipment?"),
("Burrows","Oh, come on! You think that the pirates would go to such lengths as to plant a spy in your company - just to intercept a shipment?"),
("Captain_Stahl","I think they're worried that the introduction of the TarsusMk2 will turn their way of earning a living into a deadly gamble. And they should worry..."),
("Burrows","So, first thing is we need to stop this guy from transmitting information."),
("Captain_Stahl","You're learning fast. But I've checked the Achilles com logs and found that the information is not being transmitted. I believe one of my affiliates meets the pirates directly in this system."),
Expand Down
24 changes: 12 additions & 12 deletions modules/go_to_adjacent_systems.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ def formatSystemName(ship):
ship=ship[where+1:]
return ship.capitalize()

class go_to_adjacent_systems:
class go_to_adjacent_systems:
def InSystem(self):
return self.arrivedsys

def DestinationSystem (self):
return self.destination

def JumpPoints (self):
return self.jumps

def ChangeObjective(self,newind):
if (self.jumps[-1]!=self.jumps[newind]):
if 0 <= newind < len(self.jumps) and (self.jumps[-1] != self.jumps[newind]):
VS.setObjective(self.obj,"Jump to %s enroute to %s." % (formatSystemName(self.jumps[newind]),formatSystemName(self.jumps[-1])))
else:
VS.setObjective(self.obj,"Jump to final system: %s." % (formatSystemName(self.jumps[-1])))

def __init__ (self,you, numsystemsaway,jumps=(),preffaction=''):
self.arrivedsys=0
self.jumps=()
Expand All @@ -38,7 +38,7 @@ def __init__ (self,you, numsystemsaway,jumps=(),preffaction=''):
self.you = you
sys=VS.getSystemFile()
if len(jumps)>0:
sys=jumps[-1]
sys=jumps[-1]
(self.destination,self.jumps)=universe.getAdjacentSystems(sys,numsystemsaway,jumps,preffaction)
for i in self.jumps:
key = "visited_"+i
Expand All @@ -54,17 +54,17 @@ def __init__ (self,you, numsystemsaway,jumps=(),preffaction=''):
self.ChangeObjective(0)
else:
self.arrivedsys=1

def Print(self,beginstr,midstr,endstr,fro,wait=0):
msgply=universe.getMessagePlayer(self.you)
if (len(self.jumps)>0):
VS.IOmessage(wait,fro,msgply,beginstr % (formatSystemName(VS.getSystemFile())))
for i in range(len(self.jumps)-1):
for i in range(1, len(self.jumps) - 1):
VS.IOmessage(wait,fro,msgply,midstr % (formatSystemName(self.jumps[i])))
VS.IOmessage(wait,fro,msgply,endstr % (formatSystemName(self.jumps[len(self.jumps)-1])))

def HaveArrived(self):
return self.arrivedsys
return self.arrivedsys

def Execute (self):
cursys=VS.getSystemFile()
Expand All @@ -81,7 +81,7 @@ def Execute (self):
else:
VS.setCompleteness(self.obj,self.com*curind)
return self.arrivedsys

def initbriefing(self):
self.jump_ani=0
self.rnd_y=0.0
Expand All @@ -96,7 +96,7 @@ def initbriefing(self):
name=self.you.getName()
self.brief_you=Briefing.addShip(name,self.faction,(0.0,0.0,80.0))
VS.IOmessage (0,"go_to_adjacent_system","briefing","You must go to the %s system. In order to get there, you must follow this route that we have planned out for you." % self.DestinationSystem())

def loopbriefing(self):
size=len(self.JumpPoints())
time = VS.GetGameTime()
Expand Down
4 changes: 2 additions & 2 deletions modules/ship_upgrades.py
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ def get_info(un):
guns : string
turrets : string (N/A)
"""
num_mounts = un.GetNumMounts()
num_mounts = un.getNumMounts()
info = "\n >>> current unit: %s (%s), %d mounts\n" % (un.getName(), un.getFactionName(), num_mounts)
for i in range(num_mounts):
if "weapon_info" in un.GetMountInfo(i):
Expand All @@ -367,7 +367,7 @@ def match_and_upgrade_weapons(un, upgrade_maps):
An upgrade map is a list with tuples of the form ('Laser','mass_driver')
"""
matches = False
num_mounts = un.GetNumMounts()
num_mounts = un.getNumMounts()
for i in range(num_mounts):
for umap in upgrade_maps:
_match, _new = umap
Expand Down
7 changes: 7 additions & 0 deletions units/how_to_convert_to_json.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
A brief guide on how to convert to JSON
=======================================
1. Open the CSV file in some kind of CSV editor (not a text editor).
2. Search and replace all commas in the description with temporary, unused character. I used pipe.
3. Save the file.
4. Run python3 parser.py
5. (Optional) Open the units.json file in a text editor. Search and replace all pipes back to commas.
Loading