This commit is contained in:
@@ -195,13 +195,11 @@ func (Controller) OnPlayerFightNpcMonster(data1 *fight.FightNpcMonsterInboundInf
|
||||
//p.Done.Exec(model.MilestoneMode.Moster, []uint32{p.Info.MapID, monsterInfo.PetList[0].ID, uint32(foi.Reason)}, nil)
|
||||
if foi.Reason == 0 && foi.WinnerId == p.Info.UserID {
|
||||
|
||||
if !p.CanGetExp() {
|
||||
return
|
||||
}
|
||||
exp := uint32(xmlres.PetMAP[int(monster.ID)].YieldingExp) * monster.Level / 7
|
||||
exp = uint32(p.CanGetExp()) * (exp)
|
||||
items := &info.S2C_GET_BOSS_MONSTER{
|
||||
//EV: 45,
|
||||
EXP: exp * 2,
|
||||
EXP: exp/2,
|
||||
}
|
||||
if refPet.Item != 0 {
|
||||
count := int64(grand.Intn(2) + 1)
|
||||
@@ -218,8 +216,8 @@ func (Controller) OnPlayerFightNpcMonster(data1 *fight.FightNpcMonsterInboundInf
|
||||
p.Info.EVPool += lo.Sum(evs) //给予累计学习力
|
||||
foi.Winpet.AddEV(evs)
|
||||
|
||||
p.Info.ExpPool += int64(exp) * 4
|
||||
p.AddPetExp(foi.Winpet, int64((exp)*2))
|
||||
p.Info.ExpPool += int64(exp)
|
||||
p.AddPetExp(foi.Winpet, int64((exp)/2))
|
||||
p.SendPackCmd(8004, items)
|
||||
|
||||
}
|
||||
|
||||
@@ -16,6 +16,9 @@ func (h Controller) CDK(data *user.C2S_GET_GIFT_COMPLETE, player *player.Player)
|
||||
if r == nil {
|
||||
return nil, errorcode.ErrorCodes.ErrMolecularCodeNotExists
|
||||
}
|
||||
if r.BindUserId != 0 && r.BindUserId != data.Head.UserID {
|
||||
return nil, errorcode.ErrorCodes.ErrMolecularCodeFrozen
|
||||
}
|
||||
|
||||
if r.ValidEndTime.Compare(time.Now()) == -1 {
|
||||
return nil, errorcode.ErrorCodes.ErrMolecularCodeExpired
|
||||
|
||||
@@ -113,7 +113,9 @@ func (f *FightC) battleLoop() {
|
||||
defer f.Our.Player.(*player.Player).Service.Done.UpdatePet(f.Opp.Player.GetInfo().PetList[0], 1, 0)
|
||||
|
||||
}
|
||||
f.Our.Player.(*player.Player).GenMonster()
|
||||
// f.Our.Player.(*player.Player).MapNPC.Reset(7 * time.Second)
|
||||
|
||||
f.Our.Player.(*player.Player).Info.FightTime = f.Our.Player.(*player.Player).Info.FightTime + time.Now().Unix() - f.StartTime.Unix()
|
||||
}
|
||||
|
||||
//大乱斗,给个延迟
|
||||
|
||||
@@ -59,7 +59,7 @@ func NewFight(p1, p2 common.PlayerI, fn func(info.FightOverInfo)) (*FightC, erro
|
||||
f.Opp.Finished = true //PVE 默认boss数据直接加载完成
|
||||
loadtime = 60 * time.Second
|
||||
//f.handleNPCFightSpecial(&fightStartInfo)
|
||||
|
||||
f.Our.Player.(*player.Player).GenMonster()
|
||||
if f.Opp.Player.(*player.AI_player).CanCapture > 0 {
|
||||
f.Opp.CanCapture = f.Opp.Player.(*player.AI_player).CanCapture
|
||||
f.FightStartOutboundInfo.Info2.Catchable = 1 //可以捕捉就置1
|
||||
|
||||
@@ -25,8 +25,9 @@ func (p *Player) Save() {
|
||||
|
||||
newtime := time.Now().Unix()
|
||||
p.Info.TimeToday = p.Info.TimeToday + newtime - int64(p.Logintime) //保存电池时间
|
||||
|
||||
p.Info.FightTime = p.Info.FightTime + (newtime - int64(p.Logintime))
|
||||
p.Info.OnlineTime = p.Info.OnlineTime + (newtime-int64(p.Logintime))/60 //每次退出时候保存已经在线的分钟数
|
||||
|
||||
if p.FightC != nil {
|
||||
|
||||
//ov := make(chan struct{})
|
||||
@@ -62,13 +63,21 @@ func (p *Player) Save() {
|
||||
|
||||
}
|
||||
|
||||
// 是否可以获得经验
|
||||
func (p *Player) CanGetExp() bool {
|
||||
// 经验倍数返回
|
||||
func (p *Player) CanGetExp() int {
|
||||
if p.Info.TimeToday >= p.Info.TimeLimit {
|
||||
return false
|
||||
return 0
|
||||
}
|
||||
|
||||
ttt := p.Info.TimeLimit - p.Info.TimeToday
|
||||
islogintime := (int64(time.Now().Unix()) - int64(p.Logintime))
|
||||
if p.Info.FightTime > 0 {
|
||||
return 8
|
||||
}
|
||||
|
||||
if islogintime <= (p.Info.TimeLimit - p.Info.TimeToday) {
|
||||
return 2
|
||||
} else {
|
||||
return 0
|
||||
}
|
||||
|
||||
return (int64(time.Now().Unix()) - int64(p.Logintime)) <= ttt
|
||||
}
|
||||
|
||||
@@ -22,6 +22,8 @@ type CDKConfig struct {
|
||||
ItemRewardIds []uint32 `gorm:"not null;type:jsonb;default:'[]';comment:'绑定奖励物品ID数组,关联item_gift表主键'" json:"item_reward_ids" description:"奖励物品数组"`
|
||||
ElfRewardIds []uint32 `gorm:"not null;type:jsonb;default:'[]';comment:'绑定奖励精灵ID数组,关联config_pet_boss表主键'" json:"elf_reward_ids" description:"奖励精灵数组"`
|
||||
TitleRewardIds uint32 `gorm:"not null;default:0;comment:'绑定奖励称号'" json:"title_reward_ids" description:"绑定奖励称号"`
|
||||
//绑定用户
|
||||
BindUserId uint32 `gorm:"not null;default:0;comment:'绑定用户ID'" json:"bind_user_id" description:"绑定用户ID"`
|
||||
|
||||
ValidEndTime time.Time `gorm:"not null;comment:'CDK有效结束时间'" json:"valid_end_time" description:"有效结束时间"`
|
||||
|
||||
|
||||
@@ -15,8 +15,11 @@ type ShopConfig struct {
|
||||
|
||||
// 核心字段
|
||||
ProductName string `gorm:"not null;size:128;comment:'商品名称'" json:"product_name" description:"商品名称"`
|
||||
//商品类型
|
||||
ProductType uint32 `gorm:"not null;default:0;comment:'商品类型(0-普通商品 1-虚拟商品 2-限时商品)'" json:"product_type" description:"商品类型"`
|
||||
|
||||
//商品ID
|
||||
ProductID int64 `gorm:"not null;uniqueIndex;comment:'商品ID'" json:"product_id" description:"商品ID"`
|
||||
ProductID int64 `gorm:"not null;uniqueIndex;comment:'商品ID'" json:"product_id" description:"商品ID"`
|
||||
Desc string `gorm:"not null;size:512;comment:'商品描述'" json:"desc" description:"商品描述"`
|
||||
|
||||
// 价格信息 -1代表不允许购买,0表示不支持购买
|
||||
|
||||
@@ -122,6 +122,7 @@ type PlayerInfo struct {
|
||||
ExpPool int64 `struc:"skip" json:"exp_pool"` // 累计经验池
|
||||
|
||||
OnlineTime int64 `struc:"skip" json:"online_time"` //在线分钟数
|
||||
FightTime int64 `struc:"skip" json:"fight_time"` //战斗分钟数
|
||||
// OutInfo 字段
|
||||
UserID uint32 `struc:"uint32" json:"user_id"` // 米米号 通过sid拿到
|
||||
RegisterTime uint32 `struc:"uint32" json:"register_time"` // 注册时间(秒时间戳)
|
||||
|
||||
@@ -110,6 +110,7 @@ func (s *InfoService) SetLogin() *model.PlayerInfo {
|
||||
//每天login时候检查重置时间,然后把电池,任务,挖矿重置
|
||||
//挖矿需要单独存,因为防止多开挖矿
|
||||
tt.Data.TimeToday = 0 //重置电池
|
||||
tt.Data.FightTime = 60*60*2//重置战斗次数
|
||||
|
||||
for _, v := range service.NewTaskService().GetDaily() {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user