Skip to content

Commit 6b0b5fd

Browse files
committed
Fixed bug in creature drops parsing
1 parent 5c20e71 commit 6b0b5fd

4 files changed

Lines changed: 16 additions & 5 deletions

File tree

CHANGELOG.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
Changelog
33
=========
44

5+
.. v6.0.1
6+
7+
6.0.1 (2021-08-18)
8+
==================
9+
10+
- Fixed some creature drops not being parsed properly, resulting in incomplete data.
11+
512
.. v6.0.0
613
714
6.0.0 (2021-08-17)

tibiawikisql/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
__copyright__ = "Copyright 2021 Allan Galarza"
1919

2020
__license__ = "Apache 2.0"
21-
__version__ = "6.0.0"
21+
__version__ = "6.0.1"
2222

2323
from tibiawikisql import models
2424
from tibiawikisql.api import Article, Image, WikiClient, WikiEntry

tibiawikisql/models/creature.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,14 @@ def match(k):
185185
loot = []
186186
for item_template in loot_items_templates:
187187
param_count = len(item_template.params)
188-
if param_count < 3:
188+
if param_count < 2:
189189
loot.append((strip_code(item_template.get(1)), ""))
190190
else:
191-
loot.append((strip_code(item_template.get(2)), (strip_code(item_template.get(1)))))
191+
second_param = strip_code(item_template.get(2))
192+
if second_param in ["always", "common", "uncommon", "semi-rare", "rare", "very rare"]:
193+
loot.append((strip_code(item_template.get(1)), ""))
194+
else:
195+
loot.append((second_param, (strip_code(item_template.get(1)))))
192196
return loot
193197

194198

tibiawikisql/schema.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,8 +157,8 @@ class ItemStoreOffer(Table, table_name="item_store_offer"):
157157

158158

159159
class CreatureDrop(Table, table_name="creature_drop"):
160-
creature_id = Column(ForeignKey(Integer, table="creature", column="article_id"), index=True)
161-
item_id = Column(ForeignKey(Integer, table="item", column="article_id"), index=True)
160+
creature_id = Column(ForeignKey(Integer, table="creature", column="article_id"), index=True, nullable=False)
161+
item_id = Column(ForeignKey(Integer, table="item", column="article_id"), index=True, nullable=False)
162162
chance = Column(Real)
163163
min = Column(Integer)
164164
max = Column(Integer)

0 commit comments

Comments
 (0)