示例#1
0
class RaidEventFlags(BasePerPlayerBase):
    """レイドイベントフラグ.
    """
    class Meta:
        app_label = settings_sub.APP_NAME
        abstract = False
    
    mid = models.PositiveIntegerField(db_index=True, verbose_name=u'イベントのマスターID')
    opvtime = AppDateTimeField(default=OSAUtil.get_now, verbose_name=u'OP演出閲覧時間')
    tbvtime = AppDateTimeField(default=OSAUtil.get_datetime_min, verbose_name=u'タイムボーナス演出閲覧時間')
    destroyprize_flags = ObjectField(default=list, verbose_name=u'討伐回数報酬受取りフラグ')
    destroyprize_big_flags = ObjectField(default=list, verbose_name=u'討伐回数報酬受取りフラグ(大ボス)')
    destroyprize_received = ObjectField(default=list, verbose_name=u'直前に受け取った報酬')
    epvtime = AppDateTimeField(default=OSAUtil.get_datetime_min, verbose_name=u'EP演出閲覧時間')
示例#2
0
class EventScoutPlayData(BasePerPlayerBaseWithMasterID):
    """イベント用スカウトのスカウトイベントの進行情報.
    """
    class Meta:
        app_label = settings_sub.APP_NAME
        abstract = True

    stage = models.PositiveIntegerField(default=0, verbose_name=u'現在のステージ番号')
    cleared = models.PositiveIntegerField(default=0,
                                          verbose_name=u'クリア済みのステージ番号')
    progress = models.PositiveIntegerField(default=0,
                                           verbose_name=u'ステージ実行回数(進行度)')
    seed = models.PositiveIntegerField(default=AppRandom.makeSeed,
                                       verbose_name=u'乱数シード')
    confirmkey = models.CharField(max_length=20,
                                  default=OSAUtil.makeSessionID,
                                  verbose_name=u'重複確認用のキー')
    alreadykey = models.CharField(max_length=20,
                                  default='',
                                  verbose_name=u'重複確認用のキー')
    result = ObjectField(default=dict, verbose_name=u'前回の実行結果')
    ptime = AppDateTimeField(default=OSAUtil.get_datetime_min,
                             verbose_name=u'最終プレイ時間')

    def _setResult(self, result, eventlist, flag_earlybonus=False):
        self.result = {
            'result': result,
            'event': eventlist,
            'earlybonus': flag_earlybonus,
        }
示例#3
0
class ScoutEventPresentNum(BasePerPlayerBase):
    """スカウトイベントプレゼント数レコード.
    """
    class Meta:
        app_label = settings_sub.APP_NAME
        abstract = False

    mid = models.PositiveIntegerField(db_index=True,
                                      verbose_name=u'イベントのマスターID')
    point = PositiveBigIntegerField(default=0, verbose_name=u'未投入のポイント')
    nums = ObjectField(default=dict, verbose_name=u'各プレゼント数のデータ')
    result_number = models.PositiveSmallIntegerField(default=0,
                                                     verbose_name=u'前回投入した項目')
    result_pointpre = PositiveBigIntegerField(default=0,
                                              verbose_name=u'前回投入前のポイント')
    result_pointpost = PositiveBigIntegerField(default=0,
                                               verbose_name=u'前回投入後のポイント')

    def get_num(self, present_number):
        return self.nums.get(present_number, 0)

    def set_num(self, present_number, num):
        self.nums[present_number] = num

    def add_num(self, present_number, num):
        self.set_num(present_number, self.get_num(present_number) + num)
示例#4
0
class ScoutEventPlayStageData(BasePerPlayerBaseWithMasterID):
    """スカウトイベントのプレイ情報.
    """
    class Meta:
        app_label = settings_sub.APP_NAME
        abstract = False

    ctime = AppDateTimeField(default=OSAUtil.get_now, verbose_name=u'クリア時間')
    clevel = models.PositiveIntegerField(default=0, verbose_name=u'クリア時のレベル')
    dropitems = ObjectField(default=list, verbose_name=u'獲得したカード・トロフィー')

    @staticmethod
    def makeDropItemName(itype, mid):
        return (itype << 32) + mid

    def addDropItem(self, itype, mid):
        """ドロップアイテムを追加.
        """
        self.dropitems.append(ScoutEventPlayData.makeDropItemName(itype, mid))
        self.dropitems = list(set(self.dropitems))

    def idDropped(self, itype, mid):
        """ドロップしたことあるか.
        """
        return self.dropitems and ScoutEventPlayData.makeDropItemName(
            itype, mid) in self.dropitems
示例#5
0
class UserLogBase(BaseModel):
    """ユーザログ.
    """
    class Meta:
        app_label = settings_sub.APP_NAME
        abstract = True

    id = PositiveBigAutoField(primary_key=True, verbose_name=u'ID')
    uid = models.PositiveIntegerField(verbose_name=u'ユーザーID')
    ctime = AppDateTimeField(default=OSAUtil.get_now, verbose_name=u'作成した時間')
    data = ObjectField(verbose_name=u'データ')

    @classmethod
    def create(cls, uid, *args, **kwargs):
        ins = cls()
        ins.uid = uid
        ins._setData(*args, **kwargs)
        return ins

    def _setData(self, *args, **kwargs):
        """各ログごとのデータを書き込む.
        """
        raise NotImplementedError()

    def getData(self, key, default=None):
        data = self.data or {}
        return data.get(key, default)
示例#6
0
class CabaClubCastPlayerData(BasePerPlayerBaseWithMasterID):
    """キャバクラ店舗のキャスト配属情報.
    """
    class Meta:
        app_label = settings_sub.APP_NAME
        abstract = False

    cast = ObjectField(default=list, verbose_name=u'配属されているキャスト')
示例#7
0
class EvolutionData(BaseModel):
    """進化合成情報.
    """
    class Meta:
        app_label = settings_sub.APP_NAME
        abstract = False
    
    id = models.PositiveIntegerField(primary_key=True, verbose_name=u'ユーザID')
    mid = models.PositiveIntegerField(default=0, verbose_name=u'マスターID')
    exp = models.PositiveIntegerField(default=0, verbose_name=u'経験値')
    level = models.PositiveIntegerField(default=0, verbose_name=u'レベル')
    skilllevel = models.PositiveSmallIntegerField(default=0, verbose_name=u'サービスレベル')
    takeover = models.PositiveIntegerField(default=0, verbose_name=u'引き継いだ接客力')
    result = ObjectField(default=dict, verbose_name=u'合成結果パラメータ')
    
    def set_to_card(self, card):
        card.mid = self.mid
        card.exp = self.exp
        card.level = self.level
        card.skilllevel = self.skilllevel
        card.takeover = self.takeover
    
    def setBasePreParameter(self, basecard):
        """ベースカードの元のパラメータ.
        """
        self.mid = basecard.mid
        self.exp = basecard.exp
        self.level = basecard.level
        self.skilllevel = basecard.skilllevel
        self.takeover = basecard.takeover
    
    def setResult(self, basecard, materialcard, memories_open, takeover):
        """合成結果を設定.
        """
        self.result = {
            'base' : basecard.id,
            'material' : materialcard.id,
            'is_memories_open' : memories_open,
            'takeover' : takeover,
        }
    
    @property
    def result_baseid(self):
        return self.result.get('base', 0)
    
    @property
    def result_materialid(self):
        return self.result.get('material', 0)
    
    @property
    def result_flag_memories_open(self):
        return self.result.get('is_memories_open', False)
    
    @property
    def result_takeover(self):
        return self.result.get('takeover', 0)
示例#8
0
class BossBattle(BaseModel):
    """ボスバトル情報.
    """
    class Meta:
        app_label = settings_sub.APP_NAME
        abstract = False

    id = models.PositiveIntegerField(primary_key=True, verbose_name=u'ユーザID')
    area = models.PositiveIntegerField(default=0, verbose_name=u'エリアID')
    anim = ObjectField(default=dict, verbose_name=u'バトルの内容')
示例#9
0
class ScoutPlayData(BasePerPlayerBaseWithMasterID):
    """スカウトの進行情報.
    """
    class Meta:
        app_label = settings_sub.APP_NAME
        abstract = False

    progress = models.PositiveIntegerField(default=0,
                                           verbose_name=u'実行回数(進行度)')
    seed = models.PositiveIntegerField(default=AppRandom.makeSeed,
                                       verbose_name=u'乱数シード')
    dropitems = ObjectField(default=list, verbose_name=u'獲得したカード・トロフィー')
    confirmkey = models.CharField(max_length=20,
                                  default=OSAUtil.makeSessionID,
                                  verbose_name=u'重複確認用のキー')
    alreadykey = models.CharField(max_length=20,
                                  default='',
                                  verbose_name=u'重複確認用のキー')
    result = ObjectField(default=dict, verbose_name=u'前回の実行結果')

    @staticmethod
    def makeDropItemName(itype, mid):
        return (itype << 32) + mid

    def addDropItem(self, itype, mid):
        """ドロップアイテムを追加.
        """
        self.dropitems.append(ScoutPlayData.makeDropItemName(itype, mid))
        self.dropitems = list(set(self.dropitems))

    def idDropped(self, itype, mid):
        """ドロップしたことあるか.
        """
        return self.dropitems and ScoutPlayData.makeDropItemName(
            itype, mid) in self.dropitems

    def setResult(self, result, eventlist, champagnecall_started=False):
        self.result = {
            'result': result,
            'event': eventlist,
        }
        if champagnecall_started:
            self.result.update(champagne=1)
示例#10
0
class GachaPlayData(BasePerPlayerBase):
    """ガチャプレイ情報.
    """
    class Meta:
        app_label = settings_sub.APP_NAME
        abstract = False

    mid = models.PositiveIntegerField(db_index=True, verbose_name=u'マスターID')
    seed = models.PositiveIntegerField(default=getSeed, verbose_name=u'乱数シード')
    counts = ObjectField(default=dict, verbose_name=u'グループ選択回数')
    result = ObjectField(default=dict, verbose_name=u'前回の結果')

    def resetGroupCounts(self):
        self.counts = {}

    def addGroupCount(self, groupid, cnt=1):
        self.counts[groupid] = self.getGroupCount(groupid) + cnt

    def getGroupCount(self, groupid):
        return self.counts.get(groupid, 0)
示例#11
0
class PlayerHappening(BaseModel):
    """ハプニング.
    """
    class Meta:
        app_label = settings_sub.APP_NAME
        abstract = False

    id = models.PositiveIntegerField(primary_key=True, verbose_name=u'ユーザID')
    happening = models.PositiveIntegerField(default=0, verbose_name=u'ハプニング番号')
    happening_seed = models.PositiveIntegerField(default=AppRandom.makeSeed,
                                                 verbose_name=u'乱数シード')
    happening_result = ObjectField(default=dict, verbose_name=u'前回の実行結果')
示例#12
0
class PlayerLog(BaseModel):
    """行動履歴.
    """
    class Meta:
        app_label = settings_sub.APP_NAME
        abstract = True

    id = PositiveBigAutoField(primary_key=True, verbose_name=u'ID')
    uid = models.PositiveIntegerField(db_index=True,
                                      verbose_name=u'作成したユーザーID')
    ctime = AppDateTimeField(default=OSAUtil.get_now, verbose_name=u'作成した時間')
    logtype = models.PositiveSmallIntegerField(verbose_name=u'種別')
    data = ObjectField(verbose_name=u'履歴情報')
示例#13
0
class MessageQueue(BaseModel):
    """メッセージAPIのキュー.
    """
    class Meta:
        app_label = settings_sub.APP_NAME
        abstract = False

    id = PositiveAutoField(primary_key=True, verbose_name=u'ID')
    stime = AppDateTimeField(default=OSAUtil.get_now,
                             verbose_name=u'送信開始時間',
                             db_index=True)
    title = models.CharField(max_length=26, verbose_name=u'タイトル')
    body = models.CharField(max_length=100, verbose_name=u'本文')
    recipients = ObjectField(default=list, verbose_name=u'送信先(未指定の場合は全員)')
    jumpto = models.CharField(max_length=100, verbose_name=u'飛び先', blank=True)
示例#14
0
class ScoutEventFlags(BasePerPlayerBase):
    """スカウトイベントフラグ関係.
    """
    class Meta:
        app_label = settings_sub.APP_NAME
        abstract = False

    mid = models.PositiveIntegerField(db_index=True,
                                      verbose_name=u'イベントのマスターID')
    opvtime = AppDateTimeField(default=OSAUtil.get_now,
                               verbose_name=u'OP演出閲覧時間')
    destroyprize_received = ObjectField(default=list,
                                        verbose_name=u'直前に受け取ったポイント報酬')
    epvtime = AppDateTimeField(default=OSAUtil.get_datetime_min,
                               verbose_name=u'EP演出閲覧時間')
示例#15
0
class RaidBattle(BaseModel):
    """レイドバトル情報.
    """
    class Meta:
        app_label = settings_sub.APP_NAME
        abstract = False

    id = models.PositiveIntegerField(primary_key=True, verbose_name=u'ユーザID')
    raidid = PositiveBigIntegerField(default=0, verbose_name=u'レイドID')
    process = ObjectField(default=dict, verbose_name=u'バトルの内容')
    helpcard = ObjectField(default=dict, verbose_name=u'助けてくれたフレンドのカード')
    is_strong = models.BooleanField(default=False, verbose_name=u'3倍攻撃フラグ')

    def setHelpCard(self, cardset):
        """助けてくれたフレンドを設定.
        """
        self.helpcard = {
            'id': cardset.id,
            'oid': cardset.card.uid,
            'mid': cardset.master.id,
            'level': cardset.card.level,
            'skilllevel': cardset.card.skilllevel,
            'takeover': cardset.card.takeover,
        }

    def getHelpCard(self):
        card = None
        if self.helpcard and isinstance(self.helpcard, dict):
            card = Card()
            card.id = self.helpcard['id']
            card.uid = self.helpcard['oid']
            card.mid = self.helpcard['mid']
            card.level = self.helpcard['level']
            card.skilllevel = self.helpcard['skilllevel']
            card.takeover = self.helpcard['takeover']
        return card
示例#16
0
class Raid(BaseModel):
    """レイド本体.
    """
    class Meta:
        app_label = settings_sub.APP_NAME
        abstract = False

    FIXED_COLUMNS = ('oid', 'mid', 'ctime', 'level', 'hprate', 'timebonusflag',
                     'fastflag')

    id = PositiveBigIntegerField(primary_key=True, verbose_name=u'ID')
    oid = models.PositiveIntegerField(db_index=True, verbose_name=u'発見者')
    mid = models.PositiveIntegerField(verbose_name=u'マスターID')
    level = models.PositiveIntegerField(default=1, verbose_name=u'レベル')
    hprate = models.PositiveIntegerField(default=100, verbose_name=u'HPの変動率')
    hp = models.PositiveIntegerField(default=1, verbose_name=u'残りHP')
    damage_record = ObjectField(default=dict, verbose_name=u'ダメージ履歴')
    ctime = AppDateTimeField(default=OSAUtil.get_now, verbose_name=u'発見した時間')
    helpflag = models.BooleanField(default=False, verbose_name=u'救援依頼を送ったか')
    timebonusflag = models.BooleanField(default=False,
                                        verbose_name=u'タイムボーナスフラグ')
    fastflag = models.BooleanField(default=False, verbose_name=u'秘宝ボーナスフラグ')

    def __formatDamageRecord(self):
        if not self.damage_record.has_key('damage'):
            self.damage_record = {
                'damage': self.damage_record,
                'evpointrate': 100,
            }

    def getDamageRecord(self):
        self.__formatDamageRecord()
        return self.damage_record['damage']

    def setDamageRecord(self, damage_record):
        self.__formatDamageRecord()
        self.damage_record['damage'] = damage_record

    @property
    def evpointrate(self):
        self.__formatDamageRecord()
        return self.damage_record['evpointrate']

    def setEvpointrate(self, evpointrate):
        self.__formatDamageRecord()
        self.damage_record['evpointrate'] = evpointrate
示例#17
0
class LoginBonusSugorokuPlayerData(BasePerPlayerBaseWithMasterID):
    """ユーザーのすごろくログインボーナス情報.
    """
    class Meta:
        app_label = settings_sub.APP_NAME
        abstract = False

    ltime = AppDateTimeField(default=OSAUtil.get_datetime_min,
                             verbose_name=u'受取り時間')
    lap = models.PositiveIntegerField(default=0, verbose_name=u'周回数')
    loc = models.PositiveIntegerField(default=1, verbose_name=u'現在のマス')
    lose_turns = models.PositiveIntegerField(default=0, verbose_name=u'残り休み回数')
    result = ObjectField(default=dict, verbose_name=u'演出用の結果保持')

    def setResult(self, number, square_id_list):
        self.result = dict(
            number=number,  # 出た目.
            square_id_list=square_id_list,  # 開始位置を含む、停まったマスのIDのリスト.
        )
示例#18
0
class ProduceEventHappening(BaseModel):
    """プロでハプニング本体.
    """
    class Meta:
        app_label = settings_sub.APP_NAME
        abstract = False

    FIXED_COLUMNS = (
        'oid',
        'mid',
        'ctime',
        'level',
        'hprate',
        'event',
        'gold',
        'items'  # ここはハプニングが無いから固定.
    )

    id = PositiveBigAutoField(primary_key=True, verbose_name=u'ID')
    oid = models.PositiveIntegerField(db_index=True, verbose_name=u'発見者')
    mid = models.PositiveIntegerField(verbose_name=u'マスターID')
    state = TinyIntField(default=Defines.HappeningState.ACTIVE,
                         verbose_name=u'状態')
    ctime = AppDateTimeField(default=OSAUtil.get_now, verbose_name=u'発生時間')
    progress = models.PositiveSmallIntegerField(default=0, verbose_name=u'進行度')
    gold = models.PositiveIntegerField(default=0, verbose_name=u'獲得ポケットマネー')
    items = ObjectField(default=dict, verbose_name=u'獲得アイテム')
    level = models.PositiveIntegerField(default=1, verbose_name=u'発生時のレベル')
    hprate = models.PositiveIntegerField(default=100, verbose_name=u'HPの変動率')
    event = PositiveBigIntegerField(default=0, verbose_name=u'イベントID')

    @staticmethod
    def makeID(uid, number):
        return (uid << 32) + number

    def is_end(self):
        return self.state == Defines.HappeningState.END

    def is_cleared(self):
        return self.state == Defines.HappeningState.CLEAR

    def is_boss_appeared(self):
        return self.state == Defines.HappeningState.BOSS

    def is_active(self):
        return not (self.is_cleared() or self.is_end())

    def is_canceled(self):
        return False

    @staticmethod
    def makeDropItemName(itype, mid):
        return (itype << 32) + mid

    def addDropItem(self, itype, mid):
        """ドロップアイテムを追加.
        """
        if not itype in (Defines.ItemType.ITEM, Defines.ItemType.CARD):
            raise CabaretError(u'ハプニング未対応のドロップです.タイプ=%s' %
                               Defines.ItemType.NAMES.get(itype, itype))
        key = ProduceEventHappening.makeDropItemName(itype, mid)
        num = self.items.get(key, 0)
        self.items[key] = num + 1

    def idDropped(self, itype, mid):
        """ドロップしたか.
        """
        return self.items and ProduceEventHappening.makeDropItemName(
            itype, mid) in self.items
示例#19
0
class CompositionData(BaseModel):
    """強化合成情報.
    """
    class Meta:
        app_label = settings_sub.APP_NAME
        abstract = False
    
    id = models.PositiveIntegerField(primary_key=True, verbose_name=u'ユーザID')
    mid = models.PositiveIntegerField(default=0, verbose_name=u'マスターID')
    exp = models.PositiveIntegerField(default=0, verbose_name=u'経験値')
    level = models.PositiveIntegerField(default=0, verbose_name=u'レベル')
    skilllevel = models.PositiveSmallIntegerField(default=0, verbose_name=u'サービスレベル')
    takeover = models.PositiveIntegerField(default=0, verbose_name=u'引き継いだ接客力')
    result = ObjectField(default=dict, verbose_name=u'合成結果パラメータ')
    
    def set_to_card(self, card):
        card.mid = self.mid
        card.exp = self.exp
        card.level = self.level
        card.skilllevel = self.skilllevel
        card.takeover = self.takeover
    
    def setBasePreParameter(self, basecard):
        """ベースカードの元のパラメータ.
        """
        self.mid = basecard.mid
        self.exp = basecard.exp
        self.level = basecard.level
        self.skilllevel = basecard.skilllevel
        self.takeover = basecard.takeover
    
    def setResult(self, basecardset, materialcardsetlist, is_great_success, gold, exp, exp_pre, lvpre, lvup, skilllvup):
        """合成結果を設定.
        """
        self.result = {
            'base' : basecardset.card.id,
            'material' : [materialcardset.card.id for materialcardset in materialcardsetlist],
            'is_great_success' : is_great_success,
            'gold' : gold,
            'exp' : exp,
            'exp_pre' : exp_pre,
            'lvpre' : lvpre,
            'lvup' : lvup,
            'skilllvup' : skilllvup,
        }
    
    @property
    def result_baseid(self):
        return self.result.get('base', 0)
    
    @property
    def result_materialidlist(self):
        return self.result.get('material', [])
    
    @property
    def result_flag_great_success(self):
        return self.result.get('is_great_success', False)
    
    @property
    def result_cost_gold(self):
        return self.result.get('gold', 0)
    
    @property
    def result_exp(self):
        return self.result.get('exp', 0)
    
    @property
    def result_exp_pre(self):
        return self.result.get('exp_pre', 0)
    
    @property
    def result_lvpre(self):
        return self.result.get('lvpre', 0)
    
    @property
    def result_lvup(self):
        return self.result.get('lvup', 0)
    
    @property
    def result_skilllvup(self):
        return self.result.get('skilllvup', 0)