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)
class CabaClubScorePlayerDataWeekly(BaseModel): """キャバクラ店舗の週間スコア情報. """ class Meta: app_label = settings_sub.APP_NAME abstract = False id = PositiveBigIntegerField(primary_key=True, verbose_name=u'ID') uid = models.PositiveIntegerField(default=0, verbose_name=u'ユーザID') week = models.PositiveIntegerField(default=0, verbose_name=u'年と週') proceeds = PositiveBigIntegerField(default=0, verbose_name=u'売上') customer = PositiveBigIntegerField(default=0, verbose_name=u'集客数') flag_aggregate = models.BooleanField(default=False, verbose_name=u'集計フラグ') view_result = models.BooleanField(default=False, verbose_name=u'結果閲覧フラグ') @staticmethod def makeID(uid, etime): week = int(etime.strftime("%Y%W")) return (uid << 32) + week @classmethod def makeInstance(cls, key): ins = cls() ins.id = key ins.uid = int(key >> 32) ins.week = int(key & 0xffffffff) return ins
class ScoutEventScore(BasePerPlayerBaseWithMasterID): """スカウトイベントランキング用スコア. """ class Meta: app_label = settings_sub.APP_NAME abstract = False point = PositiveBigIntegerField(default=0, verbose_name=u'所持ポイント') point_total = PositiveBigIntegerField(default=0, verbose_name=u'累計ポイント') point_gacha = PositiveBigIntegerField(default=0, verbose_name=u'専用ガチャポイント') tip = PositiveBigIntegerField(default=0, verbose_name=u'チップ所持数')
class DeckBase(BaseModel): """デッキ. """ class Meta: app_label = settings_sub.APP_NAME abstract = True id = models.PositiveIntegerField(primary_key=True, verbose_name=u'ユーザID'); leader = PositiveBigIntegerField(verbose_name=u'リーダー') member1 = PositiveBigIntegerField(default=0, verbose_name=u'デッキメンバー1') member2 = PositiveBigIntegerField(default=0, verbose_name=u'デッキメンバー2') member3 = PositiveBigIntegerField(default=0, verbose_name=u'デッキメンバー3') member4 = PositiveBigIntegerField(default=0, verbose_name=u'デッキメンバー4') member5 = PositiveBigIntegerField(default=0, verbose_name=u'デッキメンバー5') member6 = PositiveBigIntegerField(default=0, verbose_name=u'デッキメンバー6') member7 = PositiveBigIntegerField(default=0, verbose_name=u'デッキメンバー7') member8 = PositiveBigIntegerField(default=0, verbose_name=u'デッキメンバー8') member9 = PositiveBigIntegerField(default=0, verbose_name=u'デッキメンバー9') __deck_arr = None def to_array(self): if self.__deck_arr is None: arr = [] if self.leader: arr.append(self.leader) for i in xrange(Defines.DECK_CARD_NUM_MAX-1): cid = getattr(self, 'member%d' % (i+1)) if cid: arr.append(cid) self.__deck_arr = arr return self.__deck_arr def set_from_array(self, arr): """配列をデッキに設定. """ if len(arr) < 1 or arr[0] < 1: raise CabaretError(u'デッキにはリーダーが必要です', CabaretError.Code.ILLEGAL_ARGS) self.leader = arr[0] idx = 1 for i in xrange(Defines.DECK_CARD_NUM_MAX-1): cid = 0 if (i+1) < len(arr): cid = arr[i+1] setattr(self, 'member%d' % (i+1), 0) if 0 < cid: setattr(self, 'member%d' % idx, cid) idx += 1 self.__deck_arr = None def is_member(self, cardid): return cardid in self.to_array()
class RankingGachaPlayLog(BaseModel): """ランキングガチャ全体履歴. """ class Meta: app_label = settings_sub.APP_NAME abstract = False id = PositiveBigAutoField(primary_key=True, verbose_name=u'ID') uid = models.PositiveIntegerField(verbose_name=u'ユーザID') boxid = models.PositiveIntegerField(verbose_name=u'BoxID') point = PositiveBigIntegerField(verbose_name=u'総計pt') point_whole = PositiveBigIntegerField(verbose_name=u'総計pt') ctime = AppDateTimeField(default=OSAUtil.get_now, verbose_name=u'作成時間')
class RaidEventScore(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'所持ポイント') point_total = PositiveBigIntegerField(default=0, verbose_name=u'累計ポイント') destroy = models.PositiveIntegerField(default=0, verbose_name=u'討伐回数') destroy_big = models.PositiveIntegerField(default=0, verbose_name=u'討伐回数(大ボス)') ticket = models.PositiveIntegerField(default=0, verbose_name=u'チケット')
class RankingGachaScore(BasePerPlayerBaseWithMasterID): """ランキングガチャスコア情報. """ class Meta: app_label = settings_sub.APP_NAME abstract = False single = models.PositiveIntegerField(default=0, verbose_name=u'単発ポイント') total = PositiveBigIntegerField(default=0, verbose_name=u'累計ポイント') firstpoint = PositiveBigIntegerField(default=0, verbose_name=u'初めてプレイした時の総計pt') firsttime = AppDateTimeField(default=OSAUtil.get_now, verbose_name=u'初めてプレイした時間')
class CabaClubEventRankMaster(BaseModel): """経営イベントのプレーヤーのランク情報 """ class Meta: app_label = settings_sub.APP_NAME abstract = False id = PositiveBigIntegerField(primary_key=True, verbose_name=u'ID((ユーザID<<32)+イベントID(mid)') uid = models.PositiveIntegerField(db_index=True, verbose_name=u'ユーザID') mid = models.PositiveIntegerField(verbose_name=u'経営イベントID') proceeds = models.PositiveIntegerField(default=0, verbose_name=u'プレーヤーの総売上') today_proceeds = models.PositiveIntegerField(default=0, verbose_name=u'プレーヤーの本日の総売上') @classmethod def makeID(cls, uid, mid): return (uid << 32) + mid @classmethod def createInstance(cls, key, uid): ins = CabaClubEventRankMaster.makeInstance(key) ins.uid = uid ins.mid = key & 0xfffffff return ins
class ScoutEventHappeningTableMaster(BaseMaster): """スカウトイベントの曜日別ハプニング発生テーブルマスターデータ. """ class Meta: app_label = settings_sub.APP_NAME abstract = False id = PositiveBigIntegerField(primary_key=True, verbose_name=u'ID') eventid = models.PositiveIntegerField(db_index=True, verbose_name=u'イベントマスターID') wday = models.PositiveSmallIntegerField( default=0, verbose_name=u'曜日', choices=[(w, u'{}:{}'.format(w, Defines.WeekDay.NAMES[w])) for w in Defines.WeekDay.LIST]) happenings = JsonCharField(default=list, verbose_name=u'発生するハプニング') @staticmethod def makeID(eventid, wday): return (eventid << 32) + wday @staticmethod def makeInstance(key): ins = ScoutEventHappeningTableMaster() ins.id = key ins.eventid = int(key >> 32) ins.wday = int(key & 0xffffffff) return ins
class CardMaster(BaseMasterWithThumbnail): """カードマスターデータ. """ class Meta: app_label = settings_sub.APP_NAME abstract = False id = models.PositiveIntegerField(primary_key=True, verbose_name=u'ID') ckind = models.PositiveSmallIntegerField(default=Defines.CardKind.NORMAL, choices=dict_to_choices(Defines.CardKind.NAMES), verbose_name=u'カードの種類(通常or教育or進化)') gtype = models.PositiveSmallIntegerField(default=Defines.CardGrowthType.BALANCE, choices=dict_to_choices(Defines.CardGrowthType.NAMES), verbose_name=u'成長タイプ(早熟orバランスor晩成)') cost = models.PositiveSmallIntegerField(default=0, verbose_name=u'コスト') basepower = models.PositiveIntegerField(default=1, verbose_name=u'接客力(基礎値)') maxpower = models.PositiveIntegerField(default=1, verbose_name=u'接客力(最大値)') maxlevel = models.PositiveIntegerField(default=1, verbose_name=u'最大レベル') skill = models.PositiveIntegerField(verbose_name=u'サービス(スキル)') albumhklevel = PositiveBigIntegerField(unique=True, verbose_name=u'(アルバム番号<<32)+ハメ管理レベル') basematerialexp = models.PositiveIntegerField(verbose_name=u'強化素材経験値(基礎)') maxmaterialexp = models.PositiveIntegerField(verbose_name=u'強化素材経験値(最大)') baseprice = models.PositiveIntegerField(verbose_name=u'売値(基礎)') maxprice = models.PositiveIntegerField(verbose_name=u'売値(最大)') evolcost = models.PositiveIntegerField(verbose_name=u'進化費用') dmmurl = JsonCharField(verbose_name=u'DMMの動画ページのURL', default=list, blank=True) @classmethod def makeAlbumHklevel(cls, album, hklevel): return (album << 32) + hklevel @property def album(self): return int(self.albumhklevel >> 32) @property def hklevel(self): return int(self.albumhklevel & 0xffffffff)
class Friend(BaseModel): """仲間. """ class Meta: app_label = settings_sub.APP_NAME abstract = False FIXED_COLUMNS = ( 'uid','fid' ) id = PositiveBigIntegerField(primary_key=True, verbose_name=u'ID((ユーザID<<32)+フレンドID)') uid = models.PositiveIntegerField(verbose_name=u'ユーザID') fid = models.PositiveIntegerField(db_index=True, verbose_name=u'フレンドID') state = models.PositiveSmallIntegerField(verbose_name=u'状態', choices=dict_to_choices(Defines.FriendState.NAMES)) ctime = AppDateTimeField(default=OSAUtil.get_now, verbose_name=u'更新時間') @staticmethod def makeID(uid, fid): return (uid << 32) + fid @staticmethod def create(uid, fid, state): ins = Friend() ins.id = Friend.makeID(uid, fid) ins.uid = uid ins.fid = fid ins.state = state return ins @classmethod def makeInstance(cls, key): uid = (key >> 32) fid = (key & 0xffffffff) return Friend.create(uid, fid, 0)
class ScoutEventCastPerformanceResult(BaseModel): """スカウトイベント業績の最終結果. """ class Meta: app_label = settings_sub.APP_NAME abstract = False id = models.PositiveIntegerField(primary_key=True, verbose_name=u'イベントマスターID') tip_0 = PositiveBigIntegerField(default=0, verbose_name=u'チップ投入数0') tip_1 = PositiveBigIntegerField(default=0, verbose_name=u'チップ投入数1') tip_2 = PositiveBigIntegerField(default=0, verbose_name=u'チップ投入数2') tip_3 = PositiveBigIntegerField(default=0, verbose_name=u'チップ投入数3') tip_4 = PositiveBigIntegerField(default=0, verbose_name=u'チップ投入数4') def get_tip(self, number): return getattr(self, 'tip_{}'.format(number)) def get_tip_all(self): arr = [] while True: number = len(arr) attr = 'tip_{}'.format(number) if not hasattr(self, attr): break tip = self.get_tip(number) arr.append((number, tip)) return dict(arr) def get_winner(self): """勝者を取得. """ arr = self.get_tip_all().items() # チップ数の多い順にソート. arr.sort(key=lambda x: x[1], reverse=True) winner = [] tip_max = None for number, tip in arr: if tip < 1 or (tip_max is not None and tip < tip_max): # 投入されていない or 最大値でなくなった. break winner.append(number) tip_max = tip return winner
class ScoutEventTanzakuCastMaster(BaseMaster): """スカウトイベント逢引システムキャストマスターデータ. """ class Meta: app_label = settings_sub.APP_NAME abstract = False id = PositiveBigIntegerField(primary_key=True, verbose_name=u'ID') eventid = models.PositiveIntegerField(db_index=True, verbose_name=u'イベントマスターID') number = models.PositiveSmallIntegerField(default=0, verbose_name=u'イベント別通し番号', choices=[(i, i) for i in xrange(5)]) castname = models.CharField(max_length=64, verbose_name=u'キャストの名前') castthumb = models.CharField(max_length=128, verbose_name=u'キャスト画像(.png)', blank=True) castbg = models.CharField(max_length=128, verbose_name=u'キャスト背景画像(.png)', blank=True) castthumb_small = models.CharField(max_length=128, verbose_name=u'キャスト画像小(.png)', blank=True) tanzakuname = models.CharField(max_length=48, default=u'短冊', blank=True, verbose_name=u'短冊の名前') tanzakuunit = models.CharField(max_length=48, default=u'枚', blank=True, verbose_name=u'短冊の単位') tanzakuthumb = models.CharField(max_length=128, verbose_name=u'短冊画像(.png)', blank=True) prizes = JsonCharField(default=list, verbose_name=u'業績報酬テーブル') prize_text = models.PositiveIntegerField(default=0, verbose_name=u'業績報酬テキスト') tanzaku = models.PositiveSmallIntegerField(default=0, verbose_name=u'指名に必要な短冊数') tip_rate = models.PositiveSmallIntegerField(default=0, verbose_name=u'短冊1枚のチップ交換レート') tip_quota = models.PositiveSmallIntegerField(default=0, verbose_name=u'業績報酬のチップ規定数') @staticmethod def makeID(eventid, number): return (eventid << 32) + number @staticmethod def makeInstance(key): ins = ScoutEventTanzakuCastMaster() ins.id = key ins.eventid = int(key >> 32) ins.number = int(key & 0xffffffff) return ins
class RaidPrizeDistributeQueue(BaseModel): """レイド成功報酬配布キュー. """ class Meta: app_label = settings_sub.APP_NAME abstract = False id = PositiveBigAutoField(primary_key=True, verbose_name=u'ID') uid = models.PositiveIntegerField(default=0, verbose_name=u'このキューの作成者') raidid = PositiveBigIntegerField(verbose_name=u'レイドID')
class RankingGachaWholeData(BaseModel): """ランキングガチャ全体のデータ. """ class Meta: app_label = settings_sub.APP_NAME abstract = False id = models.PositiveIntegerField(primary_key=True, verbose_name=u'ID(BoxID)') point = PositiveBigIntegerField(default=0, verbose_name=u'総計pt')
class RaidEventSpecialBonusScoreLog(BaseModel): id = PositiveBigIntegerField(primary_key=True, verbose_name=u'ID') bonusscore = models.PositiveSmallIntegerField(default=0, verbose_name=u'裏社会の秘宝ボーナス獲得UP倍率') ctime = AppDateTimeField(default=OSAUtil.get_now, verbose_name=u'ログ生成時間') @classmethod def makeInstance(cls, raidlogid, bonusscore=0): ins = cls() ins.id = raidlogid ins.bonusscore = bonusscore return ins
class RaidLog(BaseModel): """レイドログ. """ class Meta: app_label = settings_sub.APP_NAME abstract = False id = PositiveBigAutoField(primary_key=True, verbose_name=u'ID') uid = models.PositiveIntegerField(verbose_name=u'ログの所有者') raidid = PositiveBigIntegerField(db_index=True, verbose_name=u'レイドID') ctime = AppDateTimeField(default=OSAUtil.get_now, verbose_name=u'発見した時間')
class RankingGachaWholePrizeQueue(BaseModel): """ランキングガチャ総計pt報酬配布キュー. """ class Meta: app_label = settings_sub.APP_NAME abstract = False id = PositiveAutoField(primary_key=True, verbose_name=u'ID') boxid = models.PositiveIntegerField(verbose_name=u'BoxID') point = PositiveBigIntegerField(verbose_name=u'総計pt') prizes = JsonCharField(default=list, verbose_name=u'総計pt報酬') ctime = AppDateTimeField(default=OSAUtil.get_now, verbose_name=u'作成時間')
class RaidEventMaterialData(BaseModel): """キャスト交換の素材の所持数. """ class Meta: app_label = settings_sub.APP_NAME abstract = False id = models.PositiveIntegerField(primary_key=True, verbose_name=u'ユーザID') eventid = models.PositiveIntegerField(default=0, verbose_name=u'イベントID') material0 = PositiveBigIntegerField(default=0, verbose_name=u'材料0の所持数') material1 = PositiveBigIntegerField(default=0, verbose_name=u'材料1の所持数') material2 = PositiveBigIntegerField(default=0, verbose_name=u'材料2の所持数') def __updateEventId(self, eventid): if eventid == self.eventid: return self.eventid = eventid for i in xrange(Defines.RAIDEVENT_MATERIAL_KIND_MAX): setattr(self, 'material%d' % i, 0) def getMaterialNum(self, eventid, material): """材料の所持数を取得. """ self.__updateEventId(eventid) return getattr(self, 'material%d' % material, 0) def setMaterialNum(self, eventid, material, num): """材料の所持数を取得. """ self.__updateEventId(eventid) num = min(num, Defines.VALUE_MAX) setattr(self, 'material%d' % material, num) def addMaterialNum(self, eventid, material, num): """材料の所持数を加算. """ self.setMaterialNum(eventid, material, self.getMaterialNum(eventid, material) + num)
class RaidEventHelpSpecialBonusScore(BaseModel): id = PositiveBigAutoField(primary_key=True, verbose_name=u'ID') raidid = PositiveBigIntegerField(db_index=True, verbose_name=u'レイドID') uid = models.PositiveIntegerField(verbose_name=u'救援時ボーナスの所有者') bonusscore = models.PositiveSmallIntegerField(default=0, verbose_name=u'裏社会の秘宝ボーナス獲得UP倍率') ctime = AppDateTimeField(default=OSAUtil.get_now, verbose_name=u'ログ生成時間') @classmethod def makeInstance(cls, raidid, uid, bonusscore=0): ins = cls() ins.raidid = raidid ins.uid = uid ins.bonusscore = bonusscore return ins
class CabaClubStorePlayerData(BasePerPlayerBaseWithMasterID): """キャバクラ店舗のプレイヤーデータ. """ class Meta: app_label = settings_sub.APP_NAME abstract = False rtime = AppDateTimeField(default=OSAUtil.get_now, verbose_name=u'借りた時間') ltime = AppDateTimeField(default=OSAUtil.get_now, verbose_name=u'借用期限') etime = AppDateTimeField(default=OSAUtil.get_now, verbose_name=u'最後にイベントを確認した日時') utime = AppDateTimeField(default=OSAUtil.get_now, verbose_name=u'最後に集客を更新した日時') event_id = models.PositiveIntegerField(default=0, verbose_name=u'発生中のイベント') scoutman_add = models.PositiveSmallIntegerField( default=0, verbose_name=u'増加したスカウトマン数') is_open = models.BooleanField(default=False, verbose_name=u'開店フラグ') octime = AppDateTimeField(default=OSAUtil.get_now, verbose_name=u'最後に状態を更新した日時') ua_flag = models.BooleanField(default=False, verbose_name=u'ユーザーアクション実行フラグ') proceeds = PositiveBigIntegerField(default=0, verbose_name=u'総売上') customer = PositiveBigIntegerField(default=0, verbose_name=u'総集客数')
class LoginBonusTimeLimitedDaysMaster(BaseMaster): """期限付きログインボーナス. """ class Meta: app_label = settings_sub.APP_NAME abstract = False id = PositiveBigIntegerField(primary_key=True, verbose_name=u'ID') mid = models.PositiveIntegerField(verbose_name=u'マスターID') day = models.PositiveSmallIntegerField(verbose_name=u'日数') thumb = models.CharField(default='', max_length=128, verbose_name=u'サムネイル') prizes = JsonCharField(default=list, verbose_name=u'報酬') # 演出用パラメータ. bg = models.CharField(max_length=96, verbose_name=u'背景画像', blank=True) text_logo = models.CharField(max_length=128, verbose_name=u'演出文言(ロゴ表示時)', blank=True) text_start = models.CharField(max_length=128, verbose_name=u'演出文言(開始)', blank=True) text_itemlist = models.CharField(max_length=128, verbose_name=u'演出文言(報酬一覧)', blank=True) text_itemget = models.CharField(max_length=128, verbose_name=u'演出文言(アイテム獲得)', blank=True) text_itemnext = models.CharField(max_length=128, verbose_name=u'演出文言(明日のアイテム)', blank=True) text_end = models.CharField(max_length=128, verbose_name=u'演出文言(終了,タッチ待ち)', blank=True) item_x = models.PositiveSmallIntegerField(verbose_name=u'アイテムの表示位置(x)', default=80) item_y = models.PositiveSmallIntegerField(verbose_name=u'アイテムの表示位置(y)', default=200) @staticmethod def makeID(mid, day): return (mid << 32) + day @classmethod def makeInstance(cls, key): model = cls() model.id = key model.mid = int(key >> 32) model.day = int(key & 0xffffffff) return model
class RaidHelp(BaseModel): """救援依頼. """ class Meta: app_label = settings_sub.APP_NAME abstract = False id = PositiveBigAutoField(primary_key=True, verbose_name=u'ID') fromid = models.PositiveIntegerField(db_index=True, verbose_name=u'ログの所有者') toid = models.PositiveIntegerField(verbose_name=u'ログの所有者') raidid = PositiveBigIntegerField(db_index=True, verbose_name=u'レイドID') raidevent_specialbonusscore = models.PositiveSmallIntegerField( default=0, verbose_name='レイドイベント時ボーナス特攻獲得UP倍率') ctime = AppDateTimeField(default=OSAUtil.get_now, verbose_name=u'発見した時間') etime = AppDateTimeField(default=OSAUtil.get_now, verbose_name=u'終了時間')
class BattleEventPresentMaster(BaseMasterWithThumbnail): """バトルイベントのポイントプレゼントのマスターデータ. """ class Meta: app_label = settings_sub.APP_NAME abstract = False id = PositiveBigIntegerField(primary_key=True, verbose_name=u'ID') eventid = models.PositiveIntegerField(db_index=True, verbose_name=u'バトルイベントマスターID') number = models.PositiveSmallIntegerField(verbose_name=u'通し番号') contents = JsonCharField( default=list, verbose_name=u'中身のリスト', help_text=u'[[battleeventpresentcontentmasterのID,odds],...]') point = models.PositiveIntegerField(default=0, verbose_name=u'必要ポイント') rate = models.PositiveSmallIntegerField(default=0, verbose_name=u'出現率') specialnum0 = models.PositiveSmallIntegerField( default=0, verbose_name=u'特別な出現条件0の通し番号') specialcnt0 = models.PositiveSmallIntegerField(default=0, verbose_name=u'特別な出現条件0の個数') specialnum1 = models.PositiveSmallIntegerField( default=0, verbose_name=u'特別な出現条件1の通し番号') specialcnt1 = models.PositiveSmallIntegerField(default=0, verbose_name=u'特別な出現条件1の個数') @staticmethod def makeID(eventid, number): return (eventid << 32) + number @classmethod def makeInstance(cls, key): ins = cls() ins.id = key ins.eventid = int(key >> 32) ins.number = int(key & 0xffffffff) return ins CONDITION_NUM_MAX = 2 def getConditionDict(self): dest = {} for idx in xrange(BattleEventPresentMaster.CONDITION_NUM_MAX): number = getattr(self, 'specialnum%d' % idx, 0) cnt = getattr(self, 'specialcnt%d' % idx, 0) if number and cnt: dest[number] = cnt return dest
class ProduceEventRaidMaster(BaseMaster): """プロデュースレイドのマスターデータ """ class Meta: app_label = settings_sub.APP_NAME abstract = False id = PositiveBigIntegerField(verbose_name=u'ID', primary_key=True) eventid = models.PositiveIntegerField(verbose_name=u'プロデュースイベントマスターID', db_index=True) mid = models.PositiveIntegerField(verbose_name=u'レイドマスターID', db_index=True) ptbase = models.PositiveIntegerField(verbose_name=u'基礎獲得値') good_coefficient = models.PositiveIntegerField(verbose_name=u'成功係数') perfect_coefficient = models.PositiveIntegerField(verbose_name=u'大成功係数') perfect_probability = models.PositiveIntegerField(verbose_name=u'大成功確率') big = models.BooleanField(default=False, verbose_name=u'大ボスフラグ')
class RaidEventRaidMaster(BaseMaster): """イベント用レイドデータ. RaidMasterのイベント用拡張. """ class Meta: app_label = settings_sub.APP_NAME abstract = False id = PositiveBigIntegerField(primary_key=True, verbose_name=u'ID') eventid = models.PositiveIntegerField(db_index=True, verbose_name=u'レイドイベントマスターID') mid = models.PositiveIntegerField(db_index=True, verbose_name=u'レイドマスターID') specialcard = JsonCharField(default=list, verbose_name=u'特効キャスト') specialcard_treasure = JsonCharField(default=list, verbose_name=u'特攻ボーナス秘宝獲得率UP') ownerpoint = models.PositiveIntegerField(default=0, verbose_name=u'発見者報酬ポイント基本値') ownerpoint_growth = models.PositiveIntegerField(default=0, verbose_name=u'発見者報酬ポイント成長度') mvppoint = models.PositiveIntegerField(default=0, verbose_name=u'MVP報酬ポイント基本値') mvppoint_growth = models.PositiveIntegerField(default=0, verbose_name=u'MVP報酬ポイント成長度') ownerpoint_timebonus = models.PositiveIntegerField(default=0, verbose_name=u'発見者報酬ポイント(タイムボーナス)基本値') ownerpoint_timebonus_growth = models.PositiveIntegerField(default=0, verbose_name=u'発見者報酬ポイント(タイムボーナス)成長度') mvppoint_timebonus = models.PositiveIntegerField(default=0, verbose_name=u'MVP報酬ポイント(タイムボーナス)基本値') mvppoint_timebonus_growth = models.PositiveIntegerField(default=0, verbose_name=u'MVP報酬ポイント(タイムボーナス)成長度') big = models.BooleanField(default=False, verbose_name=u'大ボスフラグ') pointrandmin = models.PositiveSmallIntegerField(default=100, verbose_name=u'報酬ポイント乱数下限(%)') pointrandmax = models.PositiveSmallIntegerField(default=100, verbose_name=u'報酬ポイント乱数上限(%)') # エイプリルフール. champagne = TinyIntField(default=0, verbose_name=u'獲得できるシャンパンの数') material = TinyIntField(default=0, verbose_name=u'発見者の材料番号(0〜2)', choices=[(i, i) for i in xrange(Defines.RAIDEVENT_MATERIAL_KIND_MAX)]) material_droprate = models.PositiveSmallIntegerField(default=0, verbose_name=u'発見者の材料ドロップ率(0〜1000)') material_num_min = models.PositiveSmallIntegerField(default=0, verbose_name=u'発見者の材料個数の最小') material_num_max = models.PositiveSmallIntegerField(default=0, verbose_name=u'発見者の材料個数の最大') material_help = TinyIntField(default=0, verbose_name=u'救援者の材料番号(0〜2)', choices=[(i, i) for i in xrange(Defines.RAIDEVENT_MATERIAL_KIND_MAX)]) material_droprate_help = models.PositiveSmallIntegerField(default=0, verbose_name=u'救援者の材料ドロップ率(0〜1000)') material_num_min_help = models.PositiveSmallIntegerField(default=0, verbose_name=u'救援者の材料個数の最小') material_num_max_help = models.PositiveSmallIntegerField(default=0, verbose_name=u'救援者の材料個数の最大') @staticmethod def makeID(eventid, mid): return (eventid << 32) + mid @staticmethod def makeInstance(key): ins = RaidEventRaidMaster() ins.id = key ins.eventid = int(key>>32) ins.mid = int(key&0xffffffff) return ins
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
class PresentReceived(PresentBase): """受取済みのプレゼント. """ class Meta: app_label = settings_sub.APP_NAME abstract = False id = PositiveBigIntegerField(primary_key=True, verbose_name=u'ID') ctime = AppDateTimeField(default=OSAUtil.get_now, verbose_name=u'受け取った時間') @staticmethod def createByPresent(present): ins = PresentReceived() for field in Present.get_fields(): setattr(ins, field.name, getattr(present, field.name)) ins.id = present.id ins.ctime = OSAUtil.get_now() return ins
class BasePerPlayerBase(BaseModel): """ユーザー*アイテムでユニークな情報. """ class Meta: abstract = True FIXED_COLUMNS = ( 'uid', 'mid', ) id = PositiveBigIntegerField(primary_key=True, verbose_name=u'ID((ユーザID<<32)+アイテムID') uid = models.PositiveIntegerField(db_index=True, verbose_name=u'ユーザID') mid = None # それぞれのテーブルで実装しないとダメ. @classmethod def makeID(cls, uid, mid): return (uid << 32) + mid @classmethod def makeInstance(cls, key): model = cls() primary_key_column = cls.get_primarykey_column() setattr(model, primary_key_column, key) model.uid = (key >> 32) model.mid = key & 0xffffffff return model def get_write_end_methods(self): """書き込み(更新、削除)がされたら呼ばれるメソッド. """ pass @classmethod def fetchByOwner(cls, uid, using=settings.DB_READONLY): filters = { 'uid': uid, } ret = cls.fetchValues(filters=filters, using=using) return ret
class PlayerTradeShop(BaseModel): """Pt 交換所に関するユーザに紐づくポイント. """ class Meta: app_label = settings_sub.APP_NAME abstract = False id = PositiveBigIntegerField(primary_key=True, verbose_name=u'ユーザID)') point = models.PositiveIntegerField(default=0, verbose_name=u'point') @classmethod def get(cls, model_mgr, id): model_mgr.get_model(cls, id, using=settings.DB_READONLY) @classmethod def createInstance(cls, uid): ins = cls() ins.point = 0 ins.id = uid return ins