Added new traits tab to Ship Basic Stats window
This commit is contained in:
@@ -23,7 +23,7 @@ from sqlalchemy.ext.associationproxy import association_proxy
|
||||
from sqlalchemy.orm.collections import attribute_mapped_collection
|
||||
|
||||
from eos.db import gamedata_meta
|
||||
from eos.types import Icon, Attribute, Item, Effect, MetaType, Group
|
||||
from eos.types import Icon, Attribute, Item, Effect, MetaType, Group, Traits
|
||||
|
||||
items_table = Table("invtypes", gamedata_meta,
|
||||
Column("typeID", Integer, primary_key = True),
|
||||
@@ -38,9 +38,8 @@ items_table = Table("invtypes", gamedata_meta,
|
||||
Column("iconID", Integer, ForeignKey("icons.iconID")),
|
||||
Column("groupID", Integer, ForeignKey("invgroups.groupID"), index=True))
|
||||
|
||||
|
||||
|
||||
from .metaGroup import metatypes_table
|
||||
from .traits import traits_table
|
||||
|
||||
mapper(Item, items_table,
|
||||
properties = {"group" : relation(Group, backref = "items"),
|
||||
@@ -52,6 +51,11 @@ mapper(Item, items_table,
|
||||
uselist = False),
|
||||
"ID" : synonym("typeID"),
|
||||
"name" : synonym("typeName"),
|
||||
"description" : deferred(items_table.c.description)})
|
||||
"description" : deferred(items_table.c.description),
|
||||
"traits" : relation(Traits,
|
||||
primaryjoin = traits_table.c.typeID == items_table.c.typeID,
|
||||
order_by = traits_table.c.typeID,
|
||||
uselist = True)
|
||||
})
|
||||
|
||||
Item.category = association_proxy("group", "category")
|
||||
|
||||
31
eos/db/gamedata/traits.py
Normal file
31
eos/db/gamedata/traits.py
Normal file
@@ -0,0 +1,31 @@
|
||||
|
||||
from sqlalchemy import Column, Table, Integer, Float, String, ForeignKey, and_, select
|
||||
from sqlalchemy.orm import mapper, column_property
|
||||
from eos.types import Item, Traits
|
||||
from eos.db import gamedata_meta
|
||||
|
||||
traits_table = Table("invtraits", gamedata_meta,
|
||||
Column("traitID", Integer, primary_key=True),
|
||||
Column("typeID", Integer, ForeignKey("invtypes.typeID")),
|
||||
Column("skillID", Integer, ForeignKey("invtypes.typeID")),
|
||||
Column("bonus", Float),
|
||||
Column("bonusText", String),
|
||||
Column("unitID", Integer))
|
||||
|
||||
|
||||
from .item import items_table
|
||||
from .unit import groups_table
|
||||
|
||||
mapper(Traits, traits_table,
|
||||
properties = {"skillName" : column_property(
|
||||
select([items_table.c.typeName],
|
||||
and_(
|
||||
items_table.c.typeID == traits_table.c.skillID,
|
||||
traits_table.c.skillID != -1
|
||||
))),
|
||||
"unit" : column_property(
|
||||
select([groups_table.c.displayName],
|
||||
and_(
|
||||
groups_table.c.unitID == traits_table.c.unitID
|
||||
)))
|
||||
});
|
||||
@@ -357,3 +357,6 @@ class MetaType(EqBase):
|
||||
|
||||
class Unit(EqBase):
|
||||
pass
|
||||
|
||||
class Traits(EqBase):
|
||||
pass
|
||||
@@ -18,7 +18,7 @@
|
||||
#===============================================================================
|
||||
|
||||
from eos.gamedata import Attribute, Category, Effect, Group, Icon, Item, MarketGroup, \
|
||||
MetaGroup, AttributeInfo, Unit, EffectInfo, MetaType, MetaData
|
||||
MetaGroup, AttributeInfo, Unit, EffectInfo, MetaType, MetaData, Traits
|
||||
from eos.saveddata.price import Price
|
||||
from eos.saveddata.user import User
|
||||
from eos.saveddata.damagePattern import DamagePattern
|
||||
|
||||
Reference in New Issue
Block a user