diff --git a/comm/const.go b/comm/const.go index 4a454beef..8469fcbbe 100644 --- a/comm/const.go +++ b/comm/const.go @@ -936,25 +936,6 @@ const ( ChatSystem15 ChatSystemType = 15 ///狩猎 【玩家名称】通关了巨型猩猩难度8! ) -// 巨兽列车 -const ( - TrollBuyCount int32 = iota + 1 // 单日最大交易次数 - - TrollAIBuyCount //离线最多交易次数 - - TrollItemCount //货物最大存储上限 - - TrollGridCount //背包格子 - - TrollBuy //挂机卖出标准/千分比 - - TrollSell //挂机进货标准/千分比 - - TrollCantSell //不让交易的前后时间/S - - TrollSurprise //惊喜货物售价系数 -) - // 邮件ID const ( Yueka_1 string = "Activity_PrivilegeCardDailyReward_lv1" //月卡1 @@ -963,6 +944,7 @@ const ( Welcomemail string = "Welcomemail" // 欢迎邮件 Venturegifts string = "Venturegifts" // 转盘活动 CaravanLvReward string = "CaravanLvReward" // 商队升级 + CaravanReward string = "CaravanReward" // 商队进度 ) // open funcName diff --git a/comm/imodule.go b/comm/imodule.go index 3987a7918..7661a319c 100644 --- a/comm/imodule.go +++ b/comm/imodule.go @@ -51,11 +51,11 @@ type ( //邮件业务模块对外接口定义 提供给其他模块使用的 Imail interface { + IGetReddot // 注意 此接口逐步废弃 SendMailByCid(session IUserSession, cid string, res []*pb.UserAssets) bool SendNewMail(mail *pb.DBMailData, uid ...string) bool // 批量发送邮件 支持跨服 SendMailByUID(uid string, cid string, res []*cfg.Gameatn, Param []string) bool - IGetReddot // 所有邮件奖励统一调这个接口 SendRewardMailByCid(session IUserSession, cid string, res []*cfg.Gameatn) bool // 批量发邮件结果: cid 邮件表ID, 没有附件 res 传空 diff --git a/modules/caravan/api_buyorsell.go b/modules/caravan/api_buyorsell.go index c867279ce..cac80c710 100644 --- a/modules/caravan/api_buyorsell.go +++ b/modules/caravan/api_buyorsell.go @@ -54,7 +54,6 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe // special 城市卖给玩家的商品 // exspecial 城市想要玩家卖给他的商品库 if !req.IsBuy { // 卖给npc - for k, v := range req.Items { // 校验背包数据够不够 caravan.Items[k].Count -= v @@ -92,8 +91,9 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe } sellValue += price * v - addScore = sellValue } + + addScore = sellValue if errdata = this.module.DispenseRes(session, []*cfg.Gameatn{{ A: "attr", T: "merchantmoney", @@ -146,15 +146,7 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe if v.Key > 0 { if caravan.Profit > int64(v.Key) { if _, ok := caravan.Reward[v.Key]; !ok { - var res []*pb.UserAssets - for _, v1 := range v.Reward { - res = append(res, &pb.UserAssets{ - A: v1.A, - T: v1.T, - N: v1.N, - }) - } - this.module.ModuleMail.SendMailByCid(session, "CaravanProfitRewards", res) + this.module.mail.SendRewardMailByCid(session, comm.CaravanLvReward, v.Reward) caravan.Reward[v.Key] = true update["reward"] = caravan.Reward } @@ -255,7 +247,7 @@ func (this *apiComp) BuyOrSell(session comm.IUserSession, req *pb.CaravanBuyOrSe // Rtype211 TaskType = 211 // 向指定X城市,贩卖价值X虚拟币以上的对应城市急需货物 szTask = append(szTask, comm.GetBuriedParam(comm.Rtype211, req.City, sellSpValue)) } - szTask = append(szTask, comm.GetBuriedParam(comm.Rtype212, req.City)) // 接取任务后,商队抵达指定城市 + go this.module.ModuleBuried.TriggerBuried(session.Clone(), szTask...) return } diff --git a/modules/caravan/api_getlist.go b/modules/caravan/api_getlist.go index ef721c0e6..f29988a9b 100644 --- a/modules/caravan/api_getlist.go +++ b/modules/caravan/api_getlist.go @@ -38,8 +38,10 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.CaravanGetListRe if errdata = this.module.InitCaravanTicket(session, conf); errdata != nil { return } - // list.Merchantmoney = conf.Moneynumtop.N update := make(map[string]interface{}) + // 清除玩家货物信息 + list.Items = make(map[string]*pb.BagInfo, 0) + update["items"] = list.Items list.Reward = make(map[int32]bool, 0) list.Profit = 0 update["reward"] = list.Reward // 初始化利润奖励 diff --git a/modules/caravan/api_gotocity.go b/modules/caravan/api_gotocity.go index fab7b2e67..df915b3e4 100644 --- a/modules/caravan/api_gotocity.go +++ b/modules/caravan/api_gotocity.go @@ -127,5 +127,9 @@ func (this *apiComp) GotoCity(session comm.IUserSession, req *pb.CaravanGotoCity resp.Data = list resp.Newtask = bNewTask session.SendMsg(string(this.module.GetType()), "gotocity", resp) + // 任务统计 + var szTask []*pb.BuriedParam + szTask = append(szTask, comm.GetBuriedParam(comm.Rtype212, req.City)) // 接取任务后,商队抵达指定城市 + go this.module.ModuleBuried.TriggerBuried(session.Clone(), szTask...) return } diff --git a/modules/caravan/api_refreshcity.go b/modules/caravan/api_refreshcity.go index be0f8b32a..22c0258b2 100644 --- a/modules/caravan/api_refreshcity.go +++ b/modules/caravan/api_refreshcity.go @@ -26,7 +26,8 @@ func (this *apiComp) RefreshCity(session comm.IUserSession, req *pb.CaravanRefre this.module.refreshCaravanCityInfo(session.GetUserId(), list) resp.Goods = list.Goods resp.City = list.City - resp.Resettime = list.Resettime + resp.Citytime = list.Citystime + resp.Itemtime = list.Itemtime session.SendMsg(string(this.module.GetType()), "refreshcity", resp) return } diff --git a/modules/caravan/module.go b/modules/caravan/module.go index cc010de28..e32b9507a 100644 --- a/modules/caravan/module.go +++ b/modules/caravan/module.go @@ -124,8 +124,6 @@ func (this *Caravan) InitCaravanCityData(uid string, data *pb.DBCaravan) { } data.Citystime = utils.GetZeroTime(configure.Now().Unix()) data.Rtime = configure.Now().Unix() // 修改时间 - - //data.Itemtime = configure.Now().Unix() + } // 初始化货物信息 @@ -205,7 +203,7 @@ func (this *Caravan) refreshCaravanCityInfo(uid string, caravan *pb.DBCaravan) { changeTime = this.configure.GetCityRefreshTime() // 刷新城市货物信息 - if !utils.IsNextToday(caravan.Citystime) { + if utils.IsNextToday(caravan.Citystime) { list := this.configure.GetAllCaravanCity() for _, conf := range list { if v, ok := caravan.City[conf.Id]; ok { @@ -227,7 +225,7 @@ func (this *Caravan) refreshCaravanCityInfo(uid string, caravan *pb.DBCaravan) { } else { // 初始化今天 v.Exspecial = make([]string, 0) // 初始化下一天的信息 - if len(v.Exspecial) > int(conf.ExspecialNum) { + if len(conf.Exspecial) > int(conf.ExspecialNum) { ids := utils.RandomNumbers(0, len(conf.Exspecial), int(conf.ExspecialNum)) for _, id := range ids { v.Exspecial = append(v.Exspecial, conf.Exspecial[id]) @@ -257,14 +255,12 @@ func (this *Caravan) refreshCaravanCityInfo(uid string, caravan *pb.DBCaravan) { update["city"] = caravan.City update["citystime"] = caravan.Citystime bChange = true + caravan.Itemtime = curTime } - subTime := int32(curTime - caravan.Itemtime) if subTime >= 0 { bChange = true - icount := int32(subTime/changeTime) + 1 // 循环周期 - caravan.Itemtime += int64(changeTime * icount) update["itemtime"] = caravan.Itemtime for k, v := range caravan.Goods { @@ -453,7 +449,7 @@ func (this *Caravan) CheckOverweight(data *pb.DBCaravan) (b bool) { func (this *Caravan) CheckCaravavLvUp(data *pb.DBCaravan) (curLv int32) { curLv = data.Lv for { - if conf, err := this.configure.GetCaravanLv(curLv + 1); err == nil { + if conf, err := this.configure.GetCaravanLv(curLv); err == nil { if conf.Newmoneyexp <= int32(data.Profit) { //data.Profit -= int64(conf.Newmoneyexp) curLv++ diff --git a/pb/caravan_msg.pb.go b/pb/caravan_msg.pb.go index 938f5299f..301fd3b56 100644 --- a/pb/caravan_msg.pb.go +++ b/pb/caravan_msg.pb.go @@ -648,10 +648,11 @@ type CaravanRefreshCityResp struct { sizeCache protoimpl.SizeCache unknownFields protoimpl.UnknownFields - Goods map[string]*Goods `protobuf:"bytes,1,rep,name=goods,proto3" json:"goods" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // key 货物ID - City map[int32]*CityInfo `protobuf:"bytes,2,rep,name=city,proto3" json:"city" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // 城市信息 - Oldprice map[string]int32 `protobuf:"bytes,3,rep,name=Oldprice,proto3" json:"Oldprice" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` - Resettime int64 `protobuf:"varint,4,opt,name=resettime,proto3" json:"resettime"` // 赛季结算时间 + Goods map[string]*Goods `protobuf:"bytes,1,rep,name=goods,proto3" json:"goods" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // key 货物ID + City map[int32]*CityInfo `protobuf:"bytes,2,rep,name=city,proto3" json:"city" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` // 城市信息 + Oldprice map[string]int32 `protobuf:"bytes,3,rep,name=Oldprice,proto3" json:"Oldprice" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"varint,2,opt,name=value,proto3"` + Itemtime int64 `protobuf:"varint,4,opt,name=itemtime,proto3" json:"itemtime"` // 道具刷新时间 + Citytime int64 `protobuf:"varint,5,opt,name=citytime,proto3" json:"citytime"` // 城市刷新时间 } func (x *CaravanRefreshCityResp) Reset() { @@ -707,9 +708,16 @@ func (x *CaravanRefreshCityResp) GetOldprice() map[string]int32 { return nil } -func (x *CaravanRefreshCityResp) GetResettime() int64 { +func (x *CaravanRefreshCityResp) GetItemtime() int64 { if x != nil { - return x.Resettime + return x.Itemtime + } + return 0 +} + +func (x *CaravanRefreshCityResp) GetCitytime() int64 { + if x != nil { + return x.Citytime } return 0 } @@ -778,7 +786,7 @@ var file_caravan_caravan_msg_proto_rawDesc = []byte{ 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x10, 0x2e, 0x43, 0x61, 0x72, 0x61, 0x76, 0x61, 0x6e, 0x52, 0x61, 0x6e, 0x6b, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x08, 0x75, 0x73, 0x65, 0x72, 0x69, 0x6e, 0x66, 0x6f, 0x22, 0x17, 0x0a, 0x15, 0x43, 0x61, 0x72, 0x61, 0x76, 0x61, 0x6e, 0x52, 0x65, 0x66, - 0x72, 0x65, 0x73, 0x68, 0x43, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x22, 0xad, 0x03, 0x0a, 0x16, + 0x72, 0x65, 0x73, 0x68, 0x43, 0x69, 0x74, 0x79, 0x52, 0x65, 0x71, 0x22, 0xc7, 0x03, 0x0a, 0x16, 0x43, 0x61, 0x72, 0x61, 0x76, 0x61, 0x6e, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x43, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x12, 0x38, 0x0a, 0x05, 0x67, 0x6f, 0x6f, 0x64, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x22, 0x2e, 0x43, 0x61, 0x72, 0x61, 0x76, 0x61, 0x6e, 0x52, @@ -791,22 +799,24 @@ var file_caravan_caravan_msg_proto_rawDesc = []byte{ 0x69, 0x63, 0x65, 0x18, 0x03, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x43, 0x61, 0x72, 0x61, 0x76, 0x61, 0x6e, 0x52, 0x65, 0x66, 0x72, 0x65, 0x73, 0x68, 0x43, 0x69, 0x74, 0x79, 0x52, 0x65, 0x73, 0x70, 0x2e, 0x4f, 0x6c, 0x64, 0x70, 0x72, 0x69, 0x63, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, - 0x52, 0x08, 0x4f, 0x6c, 0x64, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x72, 0x65, - 0x73, 0x65, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x72, - 0x65, 0x73, 0x65, 0x74, 0x74, 0x69, 0x6d, 0x65, 0x1a, 0x40, 0x0a, 0x0a, 0x47, 0x6f, 0x6f, 0x64, - 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, - 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, - 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x06, 0x2e, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x52, - 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x42, 0x0a, 0x09, 0x43, 0x69, - 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, - 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x1f, 0x0a, 0x05, 0x76, 0x61, 0x6c, - 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x43, 0x69, 0x74, 0x79, 0x49, - 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, - 0x0a, 0x0d, 0x4f, 0x6c, 0x64, 0x70, 0x72, 0x69, 0x63, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, - 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, - 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, - 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, - 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x52, 0x08, 0x4f, 0x6c, 0x64, 0x70, 0x72, 0x69, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x69, 0x74, + 0x65, 0x6d, 0x74, 0x69, 0x6d, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x69, 0x74, + 0x65, 0x6d, 0x74, 0x69, 0x6d, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x63, 0x69, 0x74, 0x79, 0x74, 0x69, + 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x08, 0x63, 0x69, 0x74, 0x79, 0x74, 0x69, + 0x6d, 0x65, 0x1a, 0x40, 0x0a, 0x0a, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x45, 0x6e, 0x74, 0x72, 0x79, + 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, + 0x65, 0x79, 0x12, 0x1c, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x0b, 0x32, 0x06, 0x2e, 0x47, 0x6f, 0x6f, 0x64, 0x73, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, + 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x42, 0x0a, 0x09, 0x43, 0x69, 0x74, 0x79, 0x45, 0x6e, 0x74, 0x72, + 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, + 0x6b, 0x65, 0x79, 0x12, 0x1f, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x0b, 0x32, 0x09, 0x2e, 0x43, 0x69, 0x74, 0x79, 0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x3a, 0x02, 0x38, 0x01, 0x1a, 0x3b, 0x0a, 0x0d, 0x4f, 0x6c, 0x64, 0x70, + 0x72, 0x69, 0x63, 0x65, 0x45, 0x6e, 0x74, 0x72, 0x79, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, + 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x76, 0x61, 0x6c, 0x75, + 0x65, 0x3a, 0x02, 0x38, 0x01, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x33, } var (