Compare commits

..

No commits in common. "88e34954ad0e76209711b4536b55315b584e66d2" and "fa28e3233c77f504f5b377acfbbb14dd2a750b0b" have entirely different histories.

12 changed files with 454 additions and 14 deletions

Binary file not shown.

Binary file not shown.

View File

@ -103,7 +103,7 @@
}, },
{ {
"Id": 300006, "Id": 300006,
"SkinClass": 4, "SkinClass": 3,
"Model": "juese", "Model": "juese",
"SkinPic": "icon_300006", "SkinPic": "icon_300006",
"SkinName": "潜水员", "SkinName": "潜水员",
@ -124,7 +124,7 @@
}, },
{ {
"Id": 300007, "Id": 300007,
"SkinClass": 3, "SkinClass": 4,
"Model": "juese", "Model": "juese",
"SkinPic": "icon_300007", "SkinPic": "icon_300007",
"SkinName": "冲浪健将", "SkinName": "冲浪健将",

Binary file not shown.

2
public

@ -1 +1 @@
Subproject commit d0050dca3692969a89485f47b947e9965fd63911 Subproject commit 2c948396939e6ef55aff4579f848089d9b840668

View File

@ -2985,7 +2985,6 @@ func CSAwardLog(s *netlib.Session, packetId int, data interface{}, sid int64) er
} }
} }
p.SendToClient(int(player_proto.PlayerPacketID_PACKET_SCAwardLog), ret) p.SendToClient(int(player_proto.PlayerPacketID_PACKET_SCAwardLog), ret)
logger.Logger.Tracef("SCAwardLog:%v", ret)
return nil return nil
} }
func CSPopUpWindowsConfig(s *netlib.Session, packetId int, data interface{}, sid int64) error { func CSPopUpWindowsConfig(s *netlib.Session, packetId int, data interface{}, sid int64) error {

88
worldsrv/gameallconfig.go Normal file
View File

@ -0,0 +1,88 @@
package main
//import (
// "mongo.games.com/game/model"
// "mongo.games.com/game/srvdata"
// "mongo.games.com/goserver/core/logger"
// "github.com/globalsign/mgo/bson"
//)
//
//func InitGameAllConfigData() error {
// c := model.GameConfigCollection()
// if c != nil {
// var datas []model.GameGlobalState
// err := c.Find(nil).All(&datas)
// if err != nil {
// logger.Logger.Trace("InitGameAllConfigData err:", err)
// return err
// }
// for i := 0; i < len(datas); i++ {
// model.GameAllConfig[datas[i].LogicId] = &datas[i]
// }
// logger.Logger.Trace("InitGameAllConfigData:", model.GameAllConfig)
//
// //把dbFree中的数据写入数据库
// arr := srvdata.PBDB_GameFreeMgr.Datas.GetArr()
// for _, dbGame := range arr {
// if dbGame.GetGameId() > 0 {
// name := dbGame.GetName()
// if name != dbGame.GetTitle() {
// name = dbGame.GetName() + dbGame.GetTitle()
// }
// if data, exist := model.GameAllConfig[dbGame.GetId()]; exist {
// data.Name = name
// data.GameId = dbGame.GetGameId()
// data.GameMode = dbGame.GetGameMode()
// cu := model.GameConfigCollection()
// if cu != nil {
// info, err := cu.Upsert(bson.M{"logicid": dbGame.GetId()}, data)
// if err != nil {
// logger.Logger.Trace("InitGameAllConfigData :", info, err)
// return err
// }
// }
// } else {
// name := dbGame.GetName()
// if name != dbGame.GetTitle() {
// name = dbGame.GetName() + dbGame.GetTitle()
// }
// data := &model.GameGlobalState{
// Id: bson.NewObjectId(),
// LogicId: dbGame.GetId(),
// Name: name,
// GameId: dbGame.GetGameId(),
// GameMode: dbGame.GetGameMode(),
// State: 0,
// }
// model.GameAllConfig[dbGame.GetId()] = data
// ci := model.GameConfigCollection()
// if ci != nil {
// info, err := ci.Upsert(bson.M{"logicid": dbGame.GetId()}, data)
// if err != nil {
// logger.Logger.Trace("InitGameAllConfigData :", info, err)
// return err
// }
// }
// }
// }
// }
//
// //dbfree表中删除后操作
// for k, _ := range model.GameAllConfig {
// gc := srvdata.PBDB_GameFreeMgr.GetData(k)
// if gc == nil {
// cgc := model.GameConfigCollection()
// if cgc != nil {
// err := cgc.Remove(bson.M{"logicid": k})
// if err != nil {
// logger.Logger.Warn("RemoveGameConfig error:", err)
// return err
// } else {
// delete(model.GameAllConfig, k)
// }
// }
// }
// }
// }
// return nil
//}

30
worldsrv/gamedata.go Normal file
View File

@ -0,0 +1,30 @@
package main
import (
"mongo.games.com/goserver/core/logger"
)
type GameDataMgr struct {
}
func (this *GameDataMgr) ModuleName() string {
return "GameDataMgr"
}
func (this *GameDataMgr) Init() {
//model.InitGameData()
}
func (this *GameDataMgr) Update() {
logger.Logger.Trace("(this *GameDataMgr) Update()")
//model.SaveGameData()
}
func (this *GameDataMgr) Shutdown() {
//model.SaveGameData()
//module.UnregisteModule(this)
}
func init() {
//module.RegisteModule(&GameDataMgr{}, time.Minute, 0)
}

211
worldsrv/jackpotlist.go Normal file
View File

@ -0,0 +1,211 @@
package main
//
//import (
// "mongo.games.com/game/common"
// "mongo.games.com/game/proto"
// "mongo.games.com/game/protocol/gamehall"
// "mongo.games.com/goserver/core/logger"
// "mongo.games.com/goserver/core/timer"
// "math/rand"
// "strconv"
// "time"
//)
//
//var jackpotInterval = time.Hour * common.SCENE_BIGWINHISTORY_TIMEINTERVAL
//
//var JackpotListMgrSington = &JackpotListMgr{
// BigWinHistoryByGameID: make(map[int][]*gamehall.BigWinHistoryInfo),
// jackpotListHandle: make(map[int]timer.TimerHandle), // 新的爆奖记录生成
//}
//
//type JackpotListMgr struct {
// BigWinHistoryByGameID map[int][]*gamehall.BigWinHistoryInfo
// jackpotListHandle map[int]timer.TimerHandle // 新的爆奖记录生成
//}
//
//func (this *JackpotListMgr) AddJackpotList(gameid int, data *gamehall.BigWinHistoryInfo) {
// this.BigWinHistoryByGameID[gameid] = append(this.BigWinHistoryByGameID[gameid], data)
// if len(this.BigWinHistoryByGameID[gameid]) > common.SCENE_BIGWINHISTORY_MAXNUMBER {
// this.BigWinHistoryByGameID[gameid] = this.BigWinHistoryByGameID[gameid][1:]
// }
//}
//
//func (this *JackpotListMgr) GetJackpotList(gameid int) []*gamehall.BigWinHistoryInfo {
// if this.BigWinHistoryByGameID[gameid] == nil {
// this.BigWinHistoryByGameID[gameid] = make([]*gamehall.BigWinHistoryInfo, 0)
// }
// return this.BigWinHistoryByGameID[gameid]
//}
//
//func genRandTime(sec int, circleTime time.Time) time.Time {
// //随机时间间隔
// rand.Seed(time.Now().UnixNano() + int64(sec))
// interval := rand.Intn(60) + 60*sec // 分钟
// circleTime = circleTime.Add(time.Duration(-interval) * time.Minute)
// s := rand.Intn(60) //随机一个秒数
// circleTime = circleTime.Add(time.Duration(-s) * time.Second)
// return circleTime
//}
//
//func genRoomIDAndScore(gameid int) (roomID int64, score int64) {
// // 随机从房间内读取一个场数据
// var scenes = make([]*Scene, 0)
// for _, s := range SceneMgrSington.scenes {
// if s != nil && s.dbGameFree.GetGameId() == int32(gameid) {
// scenes = append(scenes, s)
// }
// }
// if len(scenes) < 1 {
// return
// }
// s := scenes[rand.Intn(len(scenes))]
// jackpot := s.dbGameFree.GetJackpot()
// roomID = int64(s.dbGameFree.GetBaseScore())
// baseScore := int64(jackpot[0]) * roomID
// score = int64(baseScore) + int64(rand.Int31n(int32(baseScore/2)))
// logger.Logger.Infof("genjackpot %v score %v roomID%v baseScore%v", jackpot[0], score, s.dbGameFree.GetBaseScore(), baseScore)
// return
//}
//
//// 生成爆奖记录
//func (this *JackpotListMgr) GenJackpot(gameid int) {
// // 首次生成初始化爆奖信息
// if len(this.BigWinHistoryByGameID[gameid]) == 0 {
// // 直接从大厅取机器人
// circleTime := time.Now()
// sec := common.SCENE_BIGWINHISTORY_LIMITNUMBER
// for _, p := range PlayerMgrSington.sidMap {
// if len(this.BigWinHistoryByGameID[gameid]) >= common.SCENE_BIGWINHISTORY_LIMITNUMBER {
// break
// }
// if p.IsRob {
// p.RobotRandName()
// genedTime := genRandTime(sec, circleTime).Unix()
// spinid := strconv.FormatInt(int64(p.SnId), 10) // 用户id转换成字符串
// baseBet, priceValue := genRoomIDAndScore(gameid)
// if baseBet == 0 || priceValue == 0 {
// return
// }
// newJackpot := &gamehall.BigWinHistoryInfo{
// SpinID: spinid,
// CreatedTime: genedTime,
// BaseBet: baseBet,
// TotalBet: baseBet,
// PriceValue: priceValue,
// UserName: p.Name,
// }
// this.AddJackpotList(gameid, newJackpot)
// sec--
// }
// }
// } else {
// lastRecord := this.BigWinHistoryByGameID[gameid][len(this.BigWinHistoryByGameID[gameid])-1] // 当中奖纪录>10条时随机时间差, 满足当前时间-最后一次爆奖记录时间 > 随机时间差 时重新生成一条记录
// lastTime := time.Unix(lastRecord.GetCreatedTime(), 0)
// genNewJackpotFlag := lastTime.Add(jackpotInterval).Before(time.Now())
// if genNewJackpotFlag {
// for _, p := range PlayerMgrSington.sidMap {
// if p.IsRob {
// p.RobotRandName()
// genedTime := time.Now().Unix()
// spinid := strconv.FormatInt(int64(p.SnId), 10) // 用户id转换成字符串
// baseBet, priceValue := genRoomIDAndScore(gameid)
// if baseBet == 0 || priceValue == 0 {
// return
// }
// newJackpot := &gamehall.BigWinHistoryInfo{
// SpinID: spinid,
// CreatedTime: genedTime,
// BaseBet: baseBet,
// TotalBet: baseBet,
// PriceValue: priceValue,
// UserName: p.Name,
// }
// this.AddJackpotList(gameid, newJackpot)
// break
// }
// }
// this.after(gameid)
// }
// }
//}
//
//// AddVirtualJackpot 添加虚拟爆奖记录(名字+用户id, 使用大厅机器人信息)
//func (this *JackpotListMgr) AddVirtualJackpot(gameid int, data *gamehall.BigWinHistoryInfo) {
// if len(PlayerMgrSington.sidMap) < 1 {
// logger.Logger.Error("AddVirtualJackpot not found robot")
// return
// }
//
// for _, p := range PlayerMgrSington.sidMap {
// if p.IsRob {
// p.RobotRandName()
// spinid := strconv.FormatInt(int64(p.SnId), 10) // 用户id转换成字符串
// data.SpinID = spinid
// data.UserName = p.Name
// this.AddJackpotList(gameid, data)
// break
// }
// }
//}
//
//func (this *JackpotListMgr) start(gameid int) {
// this.jackpotListHandle[gameid], _ = timer.StartTimer(timer.TimerActionWrapper(func(h timer.TimerHandle, ud interface{}) bool {
// this.GenJackpot(gameid)
// return true
// }), nil, jackpotInterval, 1)
//}
//
//func (this *JackpotListMgr) after(gameid int) {
// interval := jackpotInterval + time.Duration(rand.Intn(2))*time.Hour + time.Duration(rand.Intn(60))*time.Minute + time.Duration(rand.Intn(60))
// this.jackpotListHandle[gameid], _ = timer.AfterTimer(func(h timer.TimerHandle, ud interface{}) bool {
// this.GenJackpot(gameid)
//
// jackpotList := JackpotListMgrSington.GetJackpotList(gameid)
// msg := this.GetStoCMsg(jackpotList)
// logger.Logger.Infof("jackpotlist timer after gameid(%v) %v", gameid, msg)
// return true
// }, nil, interval)
//}
//
//func (this *JackpotListMgr) StopTimer(gameid int) bool {
// return timer.StopTimer(this.jackpotListHandle[gameid])
//}
//
//func (this *JackpotListMgr) ResetAfterTimer(gameid int) {
// if this.StopTimer(gameid) {
// this.after(gameid)
// }
//}
//
//func (this *JackpotListMgr) GetStoCMsg(jackpotList []*gamehall.BigWinHistoryInfo) *gamehall.SCBigWinHistory {
// pack := &gamehall.SCBigWinHistory{}
// for i := len(jackpotList) - 1; i >= 0; i-- {
// v := jackpotList[i]
// player := &gamehall.BigWinHistoryInfo{
// SpinID: proto.String(v.GetSpinID()),
// CreatedTime: proto.Int64(v.GetCreatedTime()),
// BaseBet: proto.Int64(v.GetBaseBet()),
// TotalBet: proto.Int64(v.GetTotalBet()),
// PriceValue: proto.Int64(int64(v.GetPriceValue())),
// UserName: proto.String(v.GetUserName()),
// Cards: v.GetCards(),
// }
// pack.BigWinHistory = append(pack.BigWinHistory, player)
// }
//
// //pack := &avengers.SCAvengersBigWinHistory{}
// //for i := len(jackpotList) - 1; i >= 0; i-- {
// // v := jackpotList[i]
// // player := &avengers.AvengersBigWinHistoryInfo{
// // SpinID: proto.String(v.GetSpinID()),
// // CreatedTime: proto.Int64(v.GetCreatedTime()),
// // RoomID: proto.Int64(v.GetRoomID()),
// // PriceValue: proto.Int64(int64(v.GetPriceValue())),
// // UserName: proto.String(v.GetUserName()),
// // }
// // pack.BigWinHistory = append(pack.BigWinHistory, player)
// //}
// proto.SetDefaults(pack)
// return pack
//}

121
worldsrv/logiclevelmgr.go Normal file
View File

@ -0,0 +1,121 @@
package main
//
//import (
// "encoding/json"
// "mongo.games.com/game/common"
// "mongo.games.com/game/model"
// "mongo.games.com/game/webapi"
// "mongo.games.com/goserver/core/logger"
// "io/ioutil"
// "net/http"
// "net/url"
// "strconv"
// "time"
//)
//
//var LogicLevelMgrSington = &LogicLevelMgr{
// config: make(map[string]*LogicLevelConfig),
// client: &http.Client{Timeout: 30 * time.Second},
//}
//
//type LogicLevelMgr struct {
// config map[string]*LogicLevelConfig
// client *http.Client
//}
//type LogicLevelConfig struct {
// Platform string
// LogicLevelInfo map[int32]*LogicLevelInfo
//}
//type LogicLevelInfo struct {
// Id int32 //分层id
// ClusterName string //分层名称
// StartAct int32 //分层开关 1开启 0关闭
// CheckActIds []int32 //分层包含的活动id
// CheckPay []string //分层包含的充值类型
//}
//
//func (this *LogicLevelMgr) GetConfig(platform string) *LogicLevelConfig {
// return this.config[platform]
//}
//
//func (this *LogicLevelMgr) UpdateConfig(cfg *LogicLevelConfig) {
// logger.Logger.Trace("++++++++++++++UpdateConfig++++++++++++++")
// this.config[cfg.Platform] = cfg
//
// if playersOL, ok := PlayerMgrSington.playerOfPlatform[cfg.Platform]; ok {
// for _, player := range playersOL {
// if player != nil && !player.IsRob {
// player.layered = make(map[int]bool)
// for _, v := range player.layerlevels {
// if td, ok := cfg.LogicLevelInfo[int32(v)]; ok {
// if td.StartAct == 1 {
// for _, id := range td.CheckActIds {
// player.layered[int(id)] = true
// }
// }
// }
// }
// //player.ActStateSend2Client()
// }
// }
// }
//}
//
//type NewMsg struct {
// Platform string
// SnId int
// Levels []int
//}
//
//func (this *LogicLevelMgr) SendPostBySnIds(platform string, snids []int32) []NewMsg {
// client := this.client
// form := make(url.Values)
// form.Set("Platform", platform)
// str := ""
// for k, snid := range snids {
// str += strconv.Itoa(int(snid))
// if k+1 < len(snids) {
// str += ","
// }
// }
// form.Set("SnIds", str)
// form.Set("PltName", common.CustomConfig.GetString("PltName"))
// logicLevelUrl := common.CustomConfig.GetString("LogicLevelUrl")
// resp, err := client.PostForm(logicLevelUrl+"/QueryDataBySnIds", form)
// if resp != nil && resp.Status == "200 OK" && err == nil {
// defer resp.Body.Close()
// body, _ := io.ReadAll(resp.Body)
// logger.Logger.Trace(string(body))
// var data []NewMsg
// json.Unmarshal(body, &data)
// return data
// }
// return nil
//}
//func (this *LogicLevelMgr) LoadConfig() {
// logger.Logger.Trace("++++++++++++++LoadConfig++++++++++++++")
// type LogicLevelConfigData struct {
// Tag int
// Msg []*LogicLevelConfig
// }
// if !model.GameParamData.UseEtcd {
// logger.Logger.Trace("API_GetGradeShopConfigData")
// buff, err := webapi.API_GetLogicLevelConfigData(common.GetAppId())
// if err == nil {
// var data LogicLevelConfigData
// err = json.Unmarshal(buff, &data)
// if err == nil && data.Tag == 0 {
// for _, cfg := range data.Msg {
// this.UpdateConfig(cfg)
// }
// } else {
// logger.Logger.Error("Unmarshal LogicLevelConfigData config data error:", err, string(buff))
// }
// } else {
// logger.Logger.Error("Get LogicLevelConfigData config data error:", err)
// }
// } else {
// EtcdMgrSington.InitLogicLevelConfig()
// }
//}

View File

@ -3756,6 +3756,7 @@ func (this *Player) SCVIPInfo() {
VipId: cfg.VipId, VipId: cfg.VipId,
VipEx: cfg.VipEx, VipEx: cfg.VipEx,
Price: cfg.Price, Price: cfg.Price,
Privilege1: cfg.Privilege1,
Privilege2: cfg.Privilege2, Privilege2: cfg.Privilege2,
Privilege3: cfg.Privilege3, Privilege3: cfg.Privilege3,
Privilege4: cfg.Privilege4, Privilege4: cfg.Privilege4,
@ -3768,15 +3769,6 @@ func (this *Player) SCVIPInfo() {
ShopId7: cfg.ShopId7, ShopId7: cfg.ShopId7,
MatchFreeTimes: cfg.MatchFreeTimes, MatchFreeTimes: cfg.MatchFreeTimes,
} }
money := cfg.Privilege1[0]
// 皮肤技能加成
add := this.GetSkillAdd(common.SkillIdVipGift)
if add > 0 {
money += int32((float64(money) * float64(add)) / 100.00)
}
data.Privilege1 = make([]int32, len(cfg.Privilege1))
copy(data.Privilege1, cfg.Privilege1)
data.Privilege1[0] = money
for itemId, itemNum := range cfg.Award { for itemId, itemNum := range cfg.Award {
data.Item = append(data.Item, &playerproto.ItemInfo{ data.Item = append(data.Item, &playerproto.ItemInfo{
ItemId: int32(itemId), ItemId: int32(itemId),
@ -3810,7 +3802,6 @@ func (this *Player) SCVIPInfo() {
//pack.VipId = append(pack.VipId, this.WelfData.VIPGift...) //pack.VipId = append(pack.VipId, this.WelfData.VIPGift...)
} }
this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SC_VIPINFO), pack) this.SendToClient(int(playerproto.PlayerPacketID_PACKET_SC_VIPINFO), pack)
logger.Logger.Tracef("send vipinfo to client:%v", pack)
} }
func (this *Player) GetVIPExpByPay(payTotal int32) int32 { func (this *Player) GetVIPExpByPay(payTotal int32) int32 {
vips := VipMgrSington.GetVIPcfg(this.Platform) vips := VipMgrSington.GetVIPcfg(this.Platform)

Binary file not shown.