mirror of
https://github.com/solero/houdini.git
synced 2024-11-21 21:17:21 +00:00
Add support for innocent items
This commit is contained in:
parent
3deba275fe
commit
de605410ce
@ -11,6 +11,7 @@ CREATE TABLE item (
|
||||
tour BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
release_date DATE NOT NULL,
|
||||
treasure BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
innocent BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
PRIMARY KEY (id)
|
||||
);
|
||||
|
||||
@ -29,6 +30,7 @@ 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?';
|
||||
COMMENT ON COLUMN item.innocent IS 'Is a innocent item?';
|
||||
|
||||
DROP TABLE IF EXISTS postcard;
|
||||
CREATE TABLE postcard (
|
||||
@ -87,6 +89,7 @@ CREATE TABLE furniture (
|
||||
patched BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
bait BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
max_quantity SMALLINT NOT NULL DEFAULT 100,
|
||||
innocent BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
PRIMARY KEY(id)
|
||||
);
|
||||
|
||||
@ -100,6 +103,7 @@ COMMENT ON COLUMN furniture.member IS 'Is member-only?';
|
||||
COMMENT ON COLUMN furniture.patched IS 'Is furniture patched?';
|
||||
COMMENT ON COLUMN furniture.bait IS 'Is furniture bait?';
|
||||
COMMENT ON COLUMN furniture.max_quantity IS 'Max inventory quantity';
|
||||
COMMENT ON COLUMN furniture.innocent IS 'Is furniture innocent?';
|
||||
|
||||
DROP TABLE IF EXISTS flooring;
|
||||
CREATE TABLE flooring (
|
||||
|
@ -22,6 +22,7 @@ class Furniture(db.Model):
|
||||
patched = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))
|
||||
bait = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))
|
||||
max_quantity = db.Column(db.SmallInteger, nullable=False, server_default=db.text("100"))
|
||||
innocent = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))
|
||||
|
||||
|
||||
class Igloo(db.Model):
|
||||
|
@ -15,6 +15,7 @@ class Item(db.Model):
|
||||
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"))
|
||||
innocent = db.Column(db.Boolean, nullable=False, server_default=db.text("false"))
|
||||
|
||||
def is_color(self):
|
||||
return self.type == 1
|
||||
|
@ -64,8 +64,15 @@ async def handle_code(p, redemption_code: str):
|
||||
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))
|
||||
owned_ids = ','.join((str(item.id) for item in p.server.items.values() if item.treasure and item.id in p.inventory))
|
||||
p.tb_validation = True
|
||||
return await p.send_xt('rsc', 'treasurebook', 3, owned_ids, num_redeemed_codes)
|
||||
|
||||
if code.type == 'INNOCENT':
|
||||
innocent_items = [item.id for item in p.server.items.values() if item.id in p.inventory and item.innocent]
|
||||
innocent_furniture = [item.id for item in p.server.furniture.values() if item.id in p.furniture and item.innocent]
|
||||
innocent_items = innocent_items + innocent_furniture
|
||||
|
||||
await p.send_xt('rsc', code.type, '', code.coins)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user