Vega strike Python Modules doc  0.5.1
Documentation of the " Modules " folder of Vega strike
 All Data Structures Namespaces Files Functions Variables
trading Namespace Reference

Data Structures

class  trading
 

Functions

def getImports
 
def getExports
 
def getNoStarshipExports
 

Variables

dictionary production = {}
 

Function Documentation

def trading.getExports (   name,
  faction,
  twice = 1000000 
)

Definition at line 50 of file trading.py.

References debug.debug, getImports(), and locale.str().

50 
51 def getExports(name,faction, twice=1000000):
52  prodlist=getImports(name,faction)
53  for i in range(len(prodlist)-1,-1,-1):
54  if prodlist[i][3]==0 and prodlist[i][4]<=3:
55  del prodlist[i]
56  elif prodlist[i][3]>twice:
57  prodlist.append(prodlist[i])
58  debug.debug("trading.getExports(%s,%s,%s)" %(name,faction,twice))
59  debug.debug("prodlist ="+str(prodlist))
60 
return prodlist
def trading.getImports (   name,
  faction 
)

Definition at line 6 of file trading.py.

References debug.error, and locale.str().

6 
7 def getImports(name,faction):
8  try:
9  prodlist=[]
10  s = VS.LookupUnitStat(name,faction,"Cargo_Import")
11  while (len(s)):
12  where=s.find("{")
13  if (where==-1):
14  s=""
15  break;
16  else:
17  s=s[where+1:]
18  #debug.debug("beg: "+s)
19  where = s.find("}")
20  if (where==-1):
21  s=""
22  break;
23  else:
24  tmp=s[:where]
25  prodlist.append(tmp.split(";"))
26  s=s[where+1:]
27  if (len(prodlist[-1])>4):
28  try:
29  prodlist[-1][1]=float(prodlist[-1][1])
30  except:
31  prodlist[-1][1]=0.0
32  try:
33  prodlist[-1][2]=float(prodlist[-1][2])
34  except:
35  prodlist[-1][2]=0.0
36  try:
37  prodlist[-1][3]=float(prodlist[-1][3])
38  except:
39  prodlist[-1][3]=0.0
40  try:
41  prodlist[-1][4]=float(prodlist[-1][4])
42  except:
43  prodlist[-1][4]=0.0
44  #debug.debug("rest "+s)
45  #debug.debug("whole list: " +str(prodlist))
46  return prodlist
47  except:
48  import sys
49  debug.error("GetImportFailure\n"+str(sys.exc_info()[0])+str(sys.exc_info()[1]))
return []
def trading.getNoStarshipExports (   name,
  faction,
  twice = 10000 
)

Definition at line 61 of file trading.py.

References debug.debug, gettext.find(), getExports(), and locale.str().

61 
62 def getNoStarshipExports(name,faction,twice=10000):
63  prodlist=getExports(name,faction,twice)
64  for i in range(len(prodlist)-1,-1,-1):
65  if prodlist[i][0].find('upgrades')==0:
66  del prodlist[i]
67  elif prodlist[i][0].find('starships')==0:
68  del prodlist[i]
69  debug.debug("trading.getNoStarshipExports(%s,%s,%s)" %(name,faction,twice))
70  debug.debug("prodlist ="+str(prodlist))
71 
return prodlist

Variable Documentation

dictionary production = {}

Definition at line 5 of file trading.py.