Skip to content

Commit 0ce0e9e

Browse files
committed
Added upgrade classification attribute and fixed empty item and creature sounds
1 parent d168332 commit 0ce0e9e

6 files changed

Lines changed: 51 additions & 37 deletions

File tree

CHANGELOG.rst

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

5+
.. 6.1.0
6+
7+
6.1.0 (2022-01-04)
8+
==================
9+
10+
- Added ``upgrade_classification`` to item attributes.
11+
- Fixed empty creature and item sounds being saved.
12+
513
.. 6.0.2
614
715
6.0.2 (2021-09-10)

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.2"
21+
__version__ = "6.1.0"
2222

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

tibiawikisql/__main__.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,9 +207,14 @@ def img_show(item):
207207
def article_show(item):
208208
if item is None:
209209
return ""
210-
return item.title
210+
return constraint(item.title, 25)
211211

212212

213+
def constraint(value, limit):
214+
if value is None or len(value) <= limit:
215+
return value
216+
return value[:limit - 1] + "…"
217+
213218
def get_cache_info(table):
214219
try:
215220
with open(f"images/{table}/cache_info.json", 'r') as f:

tibiawikisql/models/item.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -602,6 +602,7 @@ class ItemAttribute(abc.Row, table=schema.ItemAttribute):
602602
"walkable": "walkable",
603603
"walking_speed": "walkingspeed",
604604
"map_color": "mapcolor",
605+
"upgrade_classification": "upgradeclass"
605606
}
606607
__slots__ = (
607608
"item_id",

tibiawikisql/schema.py

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,21 @@ class Achievement(Table):
2929
premium = Column(Boolean)
3030
achievement_id = Column(Integer)
3131
version = Column(Text, index=True)
32-
status = Column(Text, default="active")
33-
timestamp = Column(Integer)
32+
status = Column(Text, default="active", nullable=False)
33+
timestamp = Column(Integer, nullable=False)
3434

3535

3636
class Charm(Table):
3737
article_id = Column(Integer, primary_key=True)
3838
title = Column(Text, unique=True, no_case=True)
3939
name = Column(Text, no_case=True, index=True)
40-
type = Column(Text)
41-
effect = Column(Text)
42-
cost = Column(Integer)
40+
type = Column(Text, nullable=False)
41+
effect = Column(Text, nullable=False)
42+
cost = Column(Integer, nullable=False)
4343
image = Column(Blob)
4444
version = Column(Text, index=True)
45-
status = Column(Text, default="active")
46-
timestamp = Column(Integer)
45+
status = Column(Text, default="active", nullable=False)
46+
timestamp = Column(Integer, nullable=False)
4747

4848

4949
class Creature(Table):
@@ -87,13 +87,13 @@ class Creature(Table):
8787
location = Column(Text)
8888
version = Column(Text, index=True)
8989
image = Column(Blob)
90-
status = Column(Text, default="active")
91-
timestamp = Column(Integer)
90+
status = Column(Text, default="active", nullable=False)
91+
timestamp = Column(Integer, nullable=False)
9292

9393

9494
class CreatureAbility(Table, table_name="creature_ability"):
9595
creature_id = Column(ForeignKey(Integer, table="creature", column="article_id"), index=True)
96-
name = Column(Text)
96+
name = Column(Text, nullable=False)
9797
effect = Column(Text)
9898
element = Column(Text)
9999

@@ -116,7 +116,7 @@ class CreatureMaxDamage(Table, table_name="creature_max_damage"):
116116

117117
class CreatureSound(Table, table_name="creature_sound"):
118118
creature_id = Column(ForeignKey(Integer, table="creature", column="article_id"), index=True)
119-
content = Column(Text)
119+
content = Column(Text, nullable=False)
120120

121121

122122
class Item(Table):
@@ -140,8 +140,8 @@ class Item(Table):
140140
version = Column(Text, index=True)
141141
client_id = Column(Integer)
142142
image = Column(Blob)
143-
status = Column(Text, default="active")
144-
timestamp = Column(Integer)
143+
status = Column(Text, default="active", nullable=False)
144+
timestamp = Column(Integer, nullable=False)
145145

146146

147147
class ItemSound(Table, table_name="item_sound"):
@@ -183,8 +183,8 @@ class Book(Table):
183183
next_book = Column(Text)
184184
text = Column(Text)
185185
version = Column(Text, index=True)
186-
status = Column(Text, default="active")
187-
timestamp = Column(Integer)
186+
status = Column(Text, default="active", nullable=False)
187+
timestamp = Column(Integer, nullable=False)
188188

189189

190190
class DatabaseInfo(Table, table_name="database_info"):
@@ -210,8 +210,8 @@ class House(Table):
210210
z = Column(Integer)
211211
guildhall = Column(Integer, index=True)
212212
version = Column(Text, index=True)
213-
status = Column(Text, default="active")
214-
timestamp = Column(Integer)
213+
status = Column(Text, default="active", nullable=False)
214+
timestamp = Column(Integer, nullable=False)
215215

216216

217217
class Imbuement(Table):
@@ -224,8 +224,8 @@ class Imbuement(Table):
224224
slots = Column(Text)
225225
version = Column(Text, index=True)
226226
image = Column(Blob)
227-
status = Column(Text, default="active")
228-
timestamp = Column(Integer)
227+
status = Column(Text, default="active", nullable=False)
228+
timestamp = Column(Integer, nullable=False)
229229

230230

231231
class ImbuementMaterial(Table, table_name="imbuement_material"):
@@ -245,8 +245,8 @@ class ItemKey(Table, table_name="item_key"):
245245
origin = Column(Text)
246246
notes = Column(Text)
247247
version = Column(Text, index=True)
248-
status = Column(Text, default="active")
249-
timestamp = Column(Integer)
248+
status = Column(Text, default="active", nullable=False)
249+
timestamp = Column(Integer, nullable=False)
250250

251251

252252
class Map(Table):
@@ -280,8 +280,8 @@ class Spell(Table):
280280
paladin = Column(Boolean, default=False)
281281
image = Column(Blob)
282282
version = Column(Text, index=True)
283-
status = Column(Text, default="active")
284-
timestamp = Column(Integer)
283+
status = Column(Text, default="active", nullable=False)
284+
timestamp = Column(Integer, nullable=False)
285285

286286

287287
class Npc(Table):
@@ -296,8 +296,8 @@ class Npc(Table):
296296
y = Column(Integer)
297297
z = Column(Integer)
298298
image = Column(Blob)
299-
status = Column(Text, default="active")
300-
timestamp = Column(Integer)
299+
status = Column(Text, default="active", nullable=False)
300+
timestamp = Column(Integer, nullable=False)
301301

302302

303303
class NpcJob(Table, table_name="npc_job"):
@@ -351,8 +351,8 @@ class Outfit(Table):
351351
full_price = Column(Integer)
352352
achievement = Column(Text)
353353
version = Column(Text)
354-
status = Column(Text, default="active")
355-
timestamp = Column(Integer)
354+
status = Column(Text, default="active", nullable=False)
355+
timestamp = Column(Integer, nullable=False)
356356

357357

358358
class OutfitImage(Table, table_name="outfit_image"):
@@ -377,8 +377,8 @@ class Quest(Table):
377377
estimated_time = Column(Text)
378378
premium = Column(Boolean)
379379
version = Column(Text, index=True)
380-
status = Column(Text, default="active")
381-
timestamp = Column(Integer)
380+
status = Column(Text, default="active", nullable=False)
381+
timestamp = Column(Integer, nullable=False)
382382

383383

384384
class OutfitQuest(Table, table_name="outfit_quest"):
@@ -422,7 +422,7 @@ class World(Table):
422422
protected_since = Column(Text)
423423
world_board = Column(Integer)
424424
trade_board = Column(Integer)
425-
timestamp = Column(Integer)
425+
timestamp = Column(Integer, nullable=False)
426426

427427

428428
class Mount(Table):
@@ -438,8 +438,8 @@ class Mount(Table):
438438
light_radius = Column(Integer)
439439
version = Column(Text, index=True)
440440
image = Column(Blob)
441-
status = Column(Text, default="active")
442-
timestamp = Column(Integer)
441+
status = Column(Text, default="active", nullable=False)
442+
timestamp = Column(Integer, nullable=False)
443443

444444

445445
class Update(Table, table_name="game_update"):
@@ -455,7 +455,7 @@ class Update(Table, table_name="game_update"):
455455
version = Column(Text, index=True)
456456
summary = Column(Text, index=True)
457457
changes = Column(Text, index=True)
458-
timestamp = Column(Integer)
458+
timestamp = Column(Integer, nullable=False)
459459

460460

461461
def create_tables(conn):

tibiawikisql/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
import datetime
1515
import re
1616
from collections import defaultdict
17-
from typing import TYPE_CHECKING, List
17+
from typing import List, TYPE_CHECKING
1818

1919
import mwparserfromhell
2020
from mwparserfromhell.nodes.extras import Parameter
@@ -338,7 +338,7 @@ def parse_sounds(value):
338338
template = find_template(value, "Sound", True)
339339
if not template:
340340
return []
341-
return [strip_code(param) for param in template.params]
341+
return [strip_code(param) for param in template.params if param]
342342

343343

344344
def client_color_to_rgb(value: int):

0 commit comments

Comments
 (0)