123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- package model
- import (
- "leafstalk/otherutils/deepcopy"
- "strconv"
- "xorm.io/xorm"
- )
- type ForagePointsSetting struct {
- Count int64 `json:"count"` // 总点数
- PointsAllocation map[int64]int64 `json:"pointsAllocation"` // 点数分配 {配置表id:分配点数} 点数-1表示未激活
- }
- type ForagePrivilegeCard struct {
- Typ int64 `json:"typ"` // 特权卡类型 1战斗特权卡 2钻石特权卡
- PurchaseTime int64 `json:"purchaseTime"` // 购买时间
- }
- type ForageSetting struct {
- Points ForagePointsSetting `json:"points"`
- PrivilegeCards map[int64]int64 `json:"privilegeCards"`
- // 超值月卡购买时间
- MonthCardsBuyTs map[int64]int64 `json:"monthCardsBuyTs"` // {月卡id:购买时间}
- }
- // type RewardInfo struct {
- // Id int64 `json:"id"`
- // Type int64 `json:"type"`
- // Count int64 `json:"count"`
- // }
- // type RewardData struct {
- // Exp int64 `json:"userExp"`
- // Items map[int64]*RewardInfo `json:"items"`
- // Runes map[int64]*BagRune `json:"runes"`
- // }
- type RewardRemainder struct {
- Exp float64 `json:"exp"`
- Gold float64 `json:"gold"`
- Diamond float64 `json:"diamond"`
- Rune float64 `json:"rune"`
- Legend float64 `json:"legend"`
- Resonance float64 `json:"resonance"`
- RuneMaterial float64 `json:"runeMaterial"`
- Other float64 `json:"other"`
- }
- func NewForagePlayer() *ForagePlayer {
- return &ForagePlayer{
- ForageSetting: &ForageSetting{
- Points: ForagePointsSetting{
- Count: 0,
- PointsAllocation: make(map[int64]int64),
- },
- PrivilegeCards: map[int64]int64{},
- MonthCardsBuyTs: map[int64]int64{},
- },
- Reward: make(map[int64]*DropedItem),
- RewardRemainder: &RewardRemainder{},
- }
- }
- type ForagePlayer struct {
- Id int64
- PlayerId int64 `xorm:"BIGINT index 'playerid'"`
- Level int64 `xorm:"int 'level'"`
- ForageSetting *ForageSetting `xorm:"Text json 'forageSetting'"` // 巡逻配置
- AdNum int64 `xorm:"int 'adNum'"` // 广告使用次数
- FastNum int64 `xorm:"int 'fastNum'"` // 快速巡逻使用次数
- LastFastTime int64 `xorm:"BIGINT 'lastFastTime'"` // 最后一次使用广告或快速巡逻时间(用来重置次数)
- Reward map[int64]*DropedItem `xorm:"Text json 'reward'"` // 已获得奖励
- RewardRemainder *RewardRemainder `xorm:"Text json 'rewardRemainder'"` // 未满1的奖励余数
- StartTime int64 `xorm:"BIGINT 'startTime'"` // 开始时间
- LastRewardTime int64 `xorm:"BIGINT 'lastRewardTime'"` // 最后一次计算奖励的时间
- TimeLen int64 `xorm:"BIGINT 'timeLen'"` // 已经巡逻时长 防止调系统时间
- }
- func (m ForagePlayer) TableName() string {
- return "player_forage"
- }
- // 需要保存的数据需确保在这里能复制到new1 中
- //func (m *ForagePlayer) DeepCopy() interface{} {
- // new1 := new(ForagePlayer)
- // *new1 = *m
- //
- // return new1
- //}
- func (m *ForagePlayer) QueryExist(eng *xorm.Engine) (bool, error) {
- player := new(ForagePlayer)
- player.PlayerId = m.PlayerId
- return eng.Exist(player)
- }
- func (m *ForagePlayer) UpdateDB(eng *xorm.Engine) (int64, error) {
- return eng.Where("playerid=?", m.PlayerId).AllCols().Update(m)
- }
- func (m *ForagePlayer) GetUniqueKey() string {
- //return m.UserId
- return strconv.FormatInt(m.PlayerId, 10)
- }
- // 实现DeepCopy接口
- func CopyForagePlayer(old *ForagePlayer) *ForagePlayer {
- new2, err := deepcopy.Copy(old) //
- if err != nil {
- return nil
- }
- return new2.(*ForagePlayer)
- }
- const (
- OutputBase = 1000 //产出量分母
- //巡逻加成类型
- PatrolBonusTypeExp = 1
- PatrolBonusTypeGold = 2
- PatrolBonusTypeDiamond = 3
- PatrolBonusTypeOther = 4
- PatrolBonusTypeRune = 5
- PatrolBonusTypeLegend = 6
- )
- // 巡逻Base-PatrolBase exported from 巡逻配置.xlsx
- type PatrolBase struct {
- PatrolTimeMax int64 `json:"PatrolTimeMax"` // 巡逻基础 上限时间 /小时
- DiamondOutput int64 `json:"DiamondOutput"` // 钻石产出基础量 /小时
- FastPatrolNum int64 `json:"FastPatrolNum"` // 每日快速巡逻次数
- FastPatrolConsume int64 `json:"FastPatrolConsume"` // 快速巡逻消耗体力量
- ADNum int64 `json:"ADNum"` // 每日广告巡逻次数
- ADID int64 `json:"ADID"` // 广告点ID
- RewardCycle float64 `json:"RewardCycle"` // 可领取时间 生成奖励周期 /小时
- } // package model
- // 巡逻基础产出-PatrolOutput exported from 巡逻配置.xlsx
- type PatrolOutput struct {
- Grade int64 `json:"Grade"` // 等级
- LevelID int64 `json:"LevelID"` // 解锁关卡编号
- GoldNum int64 `json:"GoldNum"` // 金币量 (千分位) /分钟
- ExpNum int64 `json:"ExpNum"` // 经验量 (千分位) /分钟
- EquipGroup int64 `json:"EquipGroup"` // 符文(装备) 随机掉落组号
- EquipNum int64 `json:"EquipNum"` // 符文(装备) (千分位) /分钟
- LegendGroup int64 `json:"LegendGroup"` // 铭文 随机掉落组号
- LegendNum int64 `json:"LegendNum"` // 铭文 (千分位) /分钟
- MaterialGroup1 int64 `json:"MaterialGroup1"` // 共鸣材料 随机掉落组号
- MaterialNum1 int64 `json:"MaterialNum1"` // 共鸣材料 (千分位) /分钟
- MaterialGroup2 int64 `json:"MaterialGroup2"` // 符文升级材料 随机掉落组号
- MaterialNum2 int64 `json:"MaterialNum2"` // 符文升级材料 (千分位) /分钟
- MaterialGroup3 int64 `json:"MaterialGroup3"` // 其它道具 随机掉落组号
- MaterialNum3 int64 `json:"MaterialNum3"` // 其它道具 (千分位) /分钟
- } // package model
- // 加成点数-PatrolBonusDot exported from 巡逻配置.xlsx
- type PatrolBonusDot struct {
- Num int64 `json:"Num"` // 加成点数数量
- LevelID int64 `json:"LevelID"` // 解锁关卡
- } // package model
- // 巡逻加成量-PatrolBonus exported from 巡逻配置.xlsx
- type PatrolBonus struct {
- Type int64 `json:"Type"` // 类型
- TypeName string `json:"TypeName"` // 类型名字
- DanNum int64 `json:"DanNum"` // 基础档位数量
- DanBonus float64 `json:"DanBonus"` // 每档增加 /百分比
- Icon string `json:"Icon"` // 图标
- }
|