mirror of
https://github.com/solero/houdini.git
synced 2024-11-21 21:17:21 +00:00
Add support for treasure items
This commit is contained in:
parent
1dc3bf9f34
commit
e94993a71f
@ -10,6 +10,7 @@ CREATE TABLE item (
|
||||
epf BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
tour BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
release_date DATE NOT NULL,
|
||||
treasure BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
@ -27,6 +28,7 @@ COMMENT ON COLUMN item.patched IS 'Is item patched?';
|
||||
COMMENT ON COLUMN item.epf IS 'Is EPF item?';
|
||||
COMMENT ON COLUMN item.tour IS 'Gives tour status?';
|
||||
COMMENT ON COLUMN item.release_date IS 'Release date of item';
|
||||
COMMENT ON COLUMN item.treasure IS 'Is a treasure item?';
|
||||
|
||||
DROP TABLE IF EXISTS postcard;
|
||||
CREATE TABLE postcard (
|
||||
|
@ -14,6 +14,7 @@ class Item(db.Model):
|
||||
epf = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))
|
||||
tour = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))
|
||||
release_date = db.Column(db.Date, nullable=False, server_default=db.text("now()"))
|
||||
treasure = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))
|
||||
|
||||
def is_color(self):
|
||||
return self.type == 1
|
||||
|
@ -61,8 +61,11 @@ async def handle_code(p, redemption_code: str):
|
||||
return await p.send_error(726)
|
||||
|
||||
if code.type == 'CATALOG':
|
||||
owned_ids = ','.join((item.item_id for item in code.items if item.item_id in p.inventory))
|
||||
return await p.send_xt('rsc', 'treasurebook', 3, owned_ids, 0)
|
||||
num_redeemed_codes = await PenguinRedemptionCode.join(RedemptionCode).count().where(
|
||||
(PenguinRedemptionCode.penguin_id == p.id) & (RedemptionCode.type == 'CATALOG')
|
||||
).gino.scalar()
|
||||
owned_ids = ','.join((str(item.item_id) for item in code.items if item.item_id in p.inventory and p.server.items[item.item_id].treasure))
|
||||
return await p.send_xt('rsc', 'treasurebook', 3, owned_ids, num_redeemed_codes)
|
||||
|
||||
await p.send_xt('rsc', code.type, '', code.coins)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user