This commit is contained in:
wh_zcy 2022-09-22 21:27:58 +08:00
commit c1c76649d4
7 changed files with 78 additions and 59 deletions

View File

@ -15,6 +15,7 @@ import (
const (
game_global = "game_global.json" //全局配置表
game_initial = "game_initial.json" //初始化表
game_gamecolor = "game_gamecolor.json" //颜色表
game_playerlv = "game_playerlv.json" //玩家等级
game_facemod = "game_facemod.json" //形象配置表
game_drop = "game_drop.json" //掉落
@ -231,3 +232,17 @@ func (this *MCompConfigure) GetDropReward(dropId int32, Items []*cfg.Gameatn) {
return
}
func (this *MCompConfigure) GetColor(id int32) (item *cfg.GameGameColorData, err error) {
var (
v interface{}
ok bool
)
if v, err = this.GetConfigure(game_gamecolor); err != nil {
return
} else {
if item, ok = v.(*cfg.GameGameColor).GetDataMap()[id]; !ok {
err = fmt.Errorf("on found color:%d", id)
}
}
return
}

View File

@ -2,6 +2,7 @@ package equipment
import (
"crypto/rand"
"fmt"
"go_dreamfactory/comm"
"go_dreamfactory/lego/sys/log"
"go_dreamfactory/pb"
@ -182,7 +183,10 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
this.module.ModuleRtask.SendToRtask(session, comm.Rtype47, 1)
//聊天系统通知
if user = this.module.ModuleUser.GetUser(session.GetUserId()); user != nil {
this.module.chat.SendSysChatToWorld(comm.EquipmentUpgradeNotice, equipment, equipment.Lv, user.Name, conf.Name)
var color *cfg.GameGameColorData
if color, err = this.module.configure.GetColor(conf.Color); err == nil {
this.module.chat.SendSysChatToWorld(comm.EquipmentUpgradeNotice, equipment, equipment.Lv, fmt.Sprintf("[color=%s]%s[/color]", color.Color, user.Name), conf.Name)
}
} else {
this.module.Errorf("no found userdata uid:%s", session.GetUserId())
}

View File

@ -1,42 +0,0 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
type GameColor struct {
_dataMap map[int32]*GameColorData
_dataList []*GameColorData
}
func NewGameColor(_buf []map[string]interface{}) (*GameColor, error) {
_dataList := make([]*GameColorData, 0, len(_buf))
dataMap := make(map[int32]*GameColorData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameColorData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Star] = _v
}
}
return &GameColor{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameColor) GetDataMap() map[int32]*GameColorData {
return table._dataMap
}
func (table *GameColor) GetDataList() []*GameColorData {
return table._dataList
}
func (table *GameColor) Get(key int32) *GameColorData {
return table._dataMap[key]
}

View File

@ -0,0 +1,42 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
package cfg
type GameGameColor struct {
_dataMap map[int32]*GameGameColorData
_dataList []*GameGameColorData
}
func NewGameGameColor(_buf []map[string]interface{}) (*GameGameColor, error) {
_dataList := make([]*GameGameColorData, 0, len(_buf))
dataMap := make(map[int32]*GameGameColorData)
for _, _ele_ := range _buf {
if _v, err2 := DeserializeGameGameColorData(_ele_); err2 != nil {
return nil, err2
} else {
_dataList = append(_dataList, _v)
dataMap[_v.Star] = _v
}
}
return &GameGameColor{_dataList:_dataList, _dataMap:dataMap}, nil
}
func (table *GameGameColor) GetDataMap() map[int32]*GameGameColorData {
return table._dataMap
}
func (table *GameGameColor) GetDataList() []*GameGameColorData {
return table._dataList
}
func (table *GameGameColor) Get(key int32) *GameGameColorData {
return table._dataMap[key]
}

View File

@ -10,25 +10,25 @@ package cfg
import "errors"
type GameColorData struct {
type GameGameColorData struct {
Star int32
Color string
}
const TypeId_GameColorData = -608833871
const TypeId_GameGameColorData = -304680737
func (*GameColorData) GetTypeId() int32 {
return -608833871
func (*GameGameColorData) GetTypeId() int32 {
return -304680737
}
func (_v *GameColorData)Deserialize(_buf map[string]interface{}) (err error) {
func (_v *GameGameColorData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["star"].(float64); !_ok_ { err = errors.New("star error"); return }; _v.Star = int32(_tempNum_) }
{ var _ok_ bool; if _v.Color, _ok_ = _buf["color"].(string); !_ok_ { err = errors.New("color error"); return } }
return
}
func DeserializeGameColorData(_buf map[string]interface{}) (*GameColorData, error) {
v := &GameColorData{}
func DeserializeGameGameColorData(_buf map[string]interface{}) (*GameGameColorData, error) {
v := &GameGameColorData{}
if err := v.Deserialize(_buf); err == nil {
return v, nil
} else {

View File

@ -98,7 +98,7 @@ type Tables struct {
LibraryFavor *GameLibraryFavor
Robot *GameRobot
Ip *GameIp
Color *GameColor
GameColor *GameGameColor
}
func NewTables(loader JsonLoader) (*Tables, error) {
@ -628,10 +628,10 @@ func NewTables(loader JsonLoader) (*Tables, error) {
if tables.Ip, err = NewGameIp(buf) ; err != nil {
return nil, err
}
if buf, err = loader("game_color") ; err != nil {
if buf, err = loader("game_gamecolor") ; err != nil {
return nil, err
}
if tables.Color, err = NewGameColor(buf) ; err != nil {
if tables.GameColor, err = NewGameGameColor(buf) ; err != nil {
return nil, err
}
return tables, nil