mirror of
https://github.com/solero/houdini.git
synced 2024-11-08 20:28:20 +00:00
Add member_quantity
attribute to purchased ninja cards
This value is increased if the card was purchased in-game via any member-only purchase method.
This commit is contained in:
parent
a95b237292
commit
ef421dc957
@ -833,6 +833,7 @@ CREATE TABLE penguin_card (
|
||||
penguin_id INT NOT NULL,
|
||||
card_id INT NOT NULL,
|
||||
quantity SMALLINT NOT NULL DEFAULT 1,
|
||||
member_quantity SMALLINT NOT NULL DEFAULT 0,
|
||||
PRIMARY KEY (penguin_id, card_id),
|
||||
CONSTRAINT penguin_card_ibfk_1 FOREIGN KEY (penguin_id) REFERENCES penguin (id) ON DELETE RESTRICT ON UPDATE CASCADE,
|
||||
CONSTRAINT penguin_card_ibfk_2 FOREIGN KEY (card_id) REFERENCES card (id) ON DELETE RESTRICT ON UPDATE CASCADE
|
||||
@ -845,6 +846,7 @@ COMMENT ON TABLE penguin_card IS 'Penguin Card Jitsu decks';
|
||||
COMMENT ON COLUMN penguin_card.penguin_id IS 'Owner penguin ID';
|
||||
COMMENT ON COLUMN penguin_card.card_id IS 'Card type ID';
|
||||
COMMENT ON COLUMN penguin_card.quantity IS 'Quantity owned';
|
||||
COMMENT ON COLUMN penguin_card.member_quantity IS 'Quantity owned as member';
|
||||
|
||||
DROP TABLE IF EXISTS penguin_furniture;
|
||||
CREATE TABLE penguin_furniture (
|
||||
|
@ -22,6 +22,7 @@ class PenguinCard(db.Model):
|
||||
card_id = db.Column(db.ForeignKey('card.id', ondelete='CASCADE', onupdate='CASCADE'), primary_key=True,
|
||||
nullable=False)
|
||||
quantity = db.Column(db.SmallInteger, nullable=False, server_default=db.text("1"))
|
||||
member_quantity = db.Column(db.SmallInteger, nullable=False, server_default=db.text("0"))
|
||||
|
||||
|
||||
class CardCollection(AbstractDataCollection):
|
||||
|
@ -175,12 +175,13 @@ class Penguin(Spheniscidae, penguin.Penguin):
|
||||
|
||||
return True
|
||||
|
||||
async def add_card(self, card, quantity=1):
|
||||
async def add_card(self, card, quantity=1, member_quantity=0):
|
||||
if card.id in self.cards:
|
||||
penguin_card = self.cards[card.id]
|
||||
|
||||
await penguin_card.update(
|
||||
quantity=penguin_card.quantity + quantity).apply()
|
||||
quantity=penguin_card.quantity + quantity,
|
||||
member_quantity=member_quantity).apply()
|
||||
else:
|
||||
await self.cards.insert(card_id=card.id)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user