mirror of
https://github.com/veekun/pokedex.git
synced 2024-08-20 18:16:34 +00:00
Drop PickupSlot
This commit is contained in:
parent
b473c66d95
commit
41e8c4df9c
5 changed files with 677 additions and 770 deletions
|
@ -177,7 +177,6 @@ Mics tables
|
||||||
.. dex-table:: Experience
|
.. dex-table:: Experience
|
||||||
.. dex-table:: PalPark
|
.. dex-table:: PalPark
|
||||||
.. dex-table:: PickupItem
|
.. dex-table:: PickupItem
|
||||||
.. dex-table:: PickupSlot
|
|
||||||
.. dex-table:: StatHint
|
.. dex-table:: StatHint
|
||||||
|
|
||||||
Conquest tables
|
Conquest tables
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,67 +0,0 @@
|
||||||
id,version_group_id,slot,rarity
|
|
||||||
1,6,0,30
|
|
||||||
2,6,1,10
|
|
||||||
3,6,2,10
|
|
||||||
4,6,3,10
|
|
||||||
5,6,4,10
|
|
||||||
6,6,5,10
|
|
||||||
7,6,6,10
|
|
||||||
8,6,7,5
|
|
||||||
9,6,8,3
|
|
||||||
10,6,9,1
|
|
||||||
11,6,10,1
|
|
||||||
12,8,0,30
|
|
||||||
13,8,1,10
|
|
||||||
14,8,2,10
|
|
||||||
15,8,3,10
|
|
||||||
16,8,4,10
|
|
||||||
17,8,5,10
|
|
||||||
18,8,6,10
|
|
||||||
19,8,7,5
|
|
||||||
20,8,8,3
|
|
||||||
21,8,9,1
|
|
||||||
22,8,10,1
|
|
||||||
23,9,0,30
|
|
||||||
24,9,1,10
|
|
||||||
25,9,2,10
|
|
||||||
26,9,3,10
|
|
||||||
27,9,4,10
|
|
||||||
28,9,5,10
|
|
||||||
29,9,6,10
|
|
||||||
30,9,7,5
|
|
||||||
31,9,8,3
|
|
||||||
32,9,9,1
|
|
||||||
33,9,10,1
|
|
||||||
34,10,0,30
|
|
||||||
35,10,1,10
|
|
||||||
36,10,2,10
|
|
||||||
37,10,3,10
|
|
||||||
38,10,4,10
|
|
||||||
39,10,5,10
|
|
||||||
40,10,6,10
|
|
||||||
41,10,7,5
|
|
||||||
42,10,8,3
|
|
||||||
43,10,9,1
|
|
||||||
44,10,10,1
|
|
||||||
45,11,0,30
|
|
||||||
46,11,1,10
|
|
||||||
47,11,2,10
|
|
||||||
48,11,3,10
|
|
||||||
49,11,4,10
|
|
||||||
50,11,5,10
|
|
||||||
51,11,6,10
|
|
||||||
52,11,7,4
|
|
||||||
53,11,8,4
|
|
||||||
54,11,9,1
|
|
||||||
55,11,10,1
|
|
||||||
56,14,0,30
|
|
||||||
57,14,1,10
|
|
||||||
58,14,2,10
|
|
||||||
59,14,3,10
|
|
||||||
60,14,4,10
|
|
||||||
61,14,5,10
|
|
||||||
62,14,6,10
|
|
||||||
63,14,7,4
|
|
||||||
64,14,8,4
|
|
||||||
65,14,9,1
|
|
||||||
66,14,10,1
|
|
|
|
@ -1467,43 +1467,30 @@ create_translation_table('pal_park_area_names', PalParkArea, 'names',
|
||||||
)
|
)
|
||||||
|
|
||||||
class PickupItem(TableBase):
|
class PickupItem(TableBase):
|
||||||
u"""Items which can be found with the Pickup ability.
|
u"""An item which can be found with the Pickup ability.
|
||||||
|
|
||||||
Level ranges are assumed not to overlap, and max_level is assumed to be
|
Level ranges form tiers. Ranges should not overlap and max_level should be
|
||||||
constant with respect to min_level.
|
constant with respect to min_level and the version group.
|
||||||
|
|
||||||
|
Rarity shall be constant with respect to slot and version_group, and
|
||||||
|
the rarities for a given version group and level tier shall sum to 100.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
__tablename__ = 'pickup_items'
|
__tablename__ = 'pickup_items'
|
||||||
__singlename__ = 'pickup_item'
|
__singlename__ = 'pickup_item'
|
||||||
|
|
||||||
slot_id = Column(Integer, ForeignKey('pickup_slots.id'), primary_key=True,
|
version_group_id = Column(Integer, ForeignKey('version_groups.id'), primary_key=True,
|
||||||
info=dict(description="The slot"))
|
info=dict(description="The version group"))
|
||||||
min_level = Column(Integer, nullable=False, primary_key=True,
|
min_level = Column(Integer, nullable=False, primary_key=True,
|
||||||
info=dict(description="Minimum level at which this slot applies"))
|
info=dict(description="Minimum level at which this slot applies"))
|
||||||
max_level = Column(Integer, nullable=False,
|
max_level = Column(Integer, nullable=False,
|
||||||
info=dict(description="Maximum level at which this slot applies"))
|
info=dict(description="Maximum level at which this slot applies"))
|
||||||
|
slot = Column(Integer, nullable=False, primary_key=True,
|
||||||
|
info=dict(description="Index of the slot"))
|
||||||
item_id = Column(Integer, ForeignKey('items.id'),
|
item_id = Column(Integer, ForeignKey('items.id'),
|
||||||
info=dict(description="The item"))
|
info=dict(description="The item"))
|
||||||
|
|
||||||
class PickupSlot(TableBase):
|
|
||||||
u"""The chance of finding a particular item with Pickup."""
|
|
||||||
|
|
||||||
__tablename__ = 'pickup_slots'
|
|
||||||
__singlename__ = 'pickup_slot'
|
|
||||||
|
|
||||||
id = Column(Integer, primary_key=True,
|
|
||||||
info=dict(description=""))
|
|
||||||
version_group_id = Column(Integer, ForeignKey('version_groups.id'),
|
|
||||||
info=dict(description="The version group"))
|
|
||||||
slot = Column(Integer, nullable=False,
|
|
||||||
info=dict(description="Index of the slot + 1"))
|
|
||||||
rarity = Column(Integer, nullable=False,
|
rarity = Column(Integer, nullable=False,
|
||||||
info=dict(description="Percent chance of this slot being chosen"))
|
info=dict(description="Percent chance of this item being found"))
|
||||||
|
|
||||||
__table_args__ = (
|
|
||||||
UniqueConstraint(version_group_id, slot),
|
|
||||||
{},
|
|
||||||
)
|
|
||||||
|
|
||||||
class PokeathlonStat(TableBase):
|
class PokeathlonStat(TableBase):
|
||||||
u"""A Pokéathlon stat, such as "Stamina" or "Jump".
|
u"""A Pokéathlon stat, such as "Stamina" or "Jump".
|
||||||
|
@ -2510,10 +2497,8 @@ PalPark.area = relationship(PalParkArea,
|
||||||
innerjoin=True, lazy='joined')
|
innerjoin=True, lazy='joined')
|
||||||
|
|
||||||
|
|
||||||
PickupItem.slot = relationship(PickupSlot)
|
|
||||||
PickupItem.item = relationship(Item)
|
PickupItem.item = relationship(Item)
|
||||||
|
PickupItem.version_group = relationship(VersionGroup)
|
||||||
PickupSlot.version_group = relationship(VersionGroup)
|
|
||||||
|
|
||||||
|
|
||||||
Pokedex.region = relationship(Region,
|
Pokedex.region = relationship(Region,
|
||||||
|
|
|
@ -131,21 +131,8 @@ def get_item(generation_id, item_index):
|
||||||
.one())
|
.one())
|
||||||
return item
|
return item
|
||||||
|
|
||||||
def add_slot(version_group, index, rarity):
|
|
||||||
ps = t.PickupSlot()
|
|
||||||
ps.version_group = version_group
|
|
||||||
ps.slot = index
|
|
||||||
ps.rarity = rarity
|
|
||||||
|
|
||||||
sess.add(ps)
|
|
||||||
return ps
|
|
||||||
|
|
||||||
for pickup in pickups:
|
for pickup in pickups:
|
||||||
version_group = version_groups[pickup.version_group]
|
version_group = version_groups[pickup.version_group]
|
||||||
slots = []
|
|
||||||
for i, rarity in enumerate(pickup.rates + [1, 1]):
|
|
||||||
slot = add_slot(version_group, i, rarity)
|
|
||||||
slots.append(slot)
|
|
||||||
|
|
||||||
def get_items(items):
|
def get_items(items):
|
||||||
return [get_item(version_group.generation_id, item_index)
|
return [get_item(version_group.generation_id, item_index)
|
||||||
|
@ -153,6 +140,7 @@ for pickup in pickups:
|
||||||
|
|
||||||
common_items = get_items(pickup.common_items)
|
common_items = get_items(pickup.common_items)
|
||||||
rare_items = get_items(pickup.rare_items)
|
rare_items = get_items(pickup.rare_items)
|
||||||
|
rates = pickup.rates + [1, 1]
|
||||||
|
|
||||||
for tier in range(10):
|
for tier in range(10):
|
||||||
min_level = 1 + tier * 10
|
min_level = 1 + tier * 10
|
||||||
|
@ -161,12 +149,14 @@ for pickup in pickups:
|
||||||
items = common_items[tier:tier+len(pickup.rates)]
|
items = common_items[tier:tier+len(pickup.rates)]
|
||||||
items += reversed(rare_items[tier:tier+2])
|
items += reversed(rare_items[tier:tier+2])
|
||||||
|
|
||||||
for slot, item in zip(slots, items):
|
for rarity, slot, item in zip(rates, range(len(rates)), items):
|
||||||
pi = t.PickupItem()
|
pi = t.PickupItem()
|
||||||
|
pi.version_group = version_group
|
||||||
pi.min_level = min_level
|
pi.min_level = min_level
|
||||||
pi.max_level = max_level
|
pi.max_level = max_level
|
||||||
pi.slot = slot
|
pi.slot = slot
|
||||||
pi.item = item
|
pi.item = item
|
||||||
|
pi.rarity = rarity
|
||||||
sess.add(pi)
|
sess.add(pi)
|
||||||
|
|
||||||
sess.commit()
|
sess.commit()
|
||||||
|
|
Loading…
Reference in a new issue