diff --git a/bin/json/game_chatsystem.json b/bin/json/game_chatsystem.json
index c20104caa..2dd850334 100644
--- a/bin/json/game_chatsystem.json
+++ b/bin/json/game_chatsystem.json
@@ -2,9 +2,10 @@
{
"key": 10001,
"type": 1,
- "title": "【系统】",
- "close": "#ff3f3f",
- "test": "阿宝转转转活动还有3分钟开始了!",
+ "text": {
+ "key": "chat_text_10001",
+ "text": "【系统】阿宝转转转活动还有3分钟开始了!"
+ },
"data": 0,
"week": [
1,
@@ -21,9 +22,10 @@
{
"key": 10002,
"type": 1,
- "title": "【系统】",
- "close": "#ff3f3f",
- "test": "阿宝转转转活动还有2分钟开始了!",
+ "text": {
+ "key": "chat_text_10002",
+ "text": "【系统】阿宝转转转活动还有4分钟开始了!"
+ },
"data": 0,
"week": [
1,
@@ -38,9 +40,10 @@
{
"key": 10003,
"type": 1,
- "title": "【系统】",
- "close": "#ff3f3f",
- "test": "阿宝转转转活动还有1分钟开始了!",
+ "text": {
+ "key": "chat_text_10003",
+ "text": "【系统】阿宝转转转活动还有5分钟开始了!"
+ },
"data": 0,
"week": [
1,
@@ -55,54 +58,11 @@
{
"key": 20001,
"type": 2,
- "title": "【传闻】",
- "close": "#ffc73f",
- "test": "[name]经过不懈努力,将[item]强化到了+[data]!",
- "data": 12,
- "week": [],
- "time_h": 0,
- "time_m": 0
- },
- {
- "key": 20002,
- "type": 2,
- "title": "【传闻】",
- "close": "#ffc73f",
- "test": "[name]经过不懈努力,将[item]强化到了+[data]!",
- "data": 13,
- "week": [],
- "time_h": 0,
- "time_m": 0
- },
- {
- "key": 20003,
- "type": 2,
- "title": "【传闻】",
- "close": "#ffc73f",
- "test": "[name]经过不懈努力,将[item]强化到了+[data]!",
- "data": 14,
- "week": [],
- "time_h": 0,
- "time_m": 0
- },
- {
- "key": 20004,
- "type": 2,
- "title": "【传闻】",
- "close": "#ffc73f",
- "test": "[name]经过不懈努力,将[item]强化到了+[data]!",
- "data": 15,
- "week": [],
- "time_h": 0,
- "time_m": 0
- },
- {
- "key": 30001,
- "type": 3,
- "title": "【传闻】",
- "close": "#ffc73f",
- "test": "[name]突破了时空塔第[data]层!",
- "data": 50,
+ "text": {
+ "key": "chat_text_20001",
+ "text": "【系统】欢迎来到梦工厂"
+ },
+ "data": 0,
"week": [],
"time_h": 0,
"time_m": 0
@@ -110,10 +70,11 @@
{
"key": 30002,
"type": 3,
- "title": "【传闻】",
- "close": "#ffc73f",
- "test": "[name]突破了时空塔第[data]层!",
- "data": 100,
+ "text": {
+ "key": "chat_text_30002",
+ "text": "【传闻】%v经过不懈努力,将%v强化到了+13!"
+ },
+ "data": 13,
"week": [],
"time_h": 0,
"time_m": 0
@@ -121,10 +82,11 @@
{
"key": 30003,
"type": 3,
- "title": "【传闻】",
- "close": "#ffc73f",
- "test": "[name]突破了时空塔第[data]层!",
- "data": 150,
+ "text": {
+ "key": "chat_text_30003",
+ "text": "【传闻】%v经过不懈努力,将%v强化到了+14!"
+ },
+ "data": 14,
"week": [],
"time_h": 0,
"time_m": 0
@@ -132,10 +94,23 @@
{
"key": 30004,
"type": 3,
- "title": "【传闻】",
- "close": "#ffc73f",
- "test": "[name]突破了时空塔第[data]层!",
- "data": 200,
+ "text": {
+ "key": "chat_text_30004",
+ "text": "【传闻】%v经过不懈努力,将%v强化到了+15!"
+ },
+ "data": 15,
+ "week": [],
+ "time_h": 0,
+ "time_m": 0
+ },
+ {
+ "key": 40001,
+ "type": 4,
+ "text": {
+ "key": "chat_text_40001",
+ "text": "【传闻】%v%v突破了时空塔第100层!"
+ },
+ "data": 100,
"week": [],
"time_h": 0,
"time_m": 0
diff --git a/bin/json/game_msgdistrib.json b/bin/json/game_msgdistrib.json
index 62654e849..2cb9f3f93 100644
--- a/bin/json/game_msgdistrib.json
+++ b/bin/json/game_msgdistrib.json
@@ -10,7 +10,22 @@
"describe": "论坛系统"
},
{
- "msgid": "chat",
+ "msgid": "chat.chanagechannel",
+ "routrules": "~/worker",
+ "describe": "聊天系统"
+ },
+ {
+ "msgid": "chat.crosschannel",
+ "routrules": "~/worker",
+ "describe": "聊天系统"
+ },
+ {
+ "msgid": "chat.getcrosslist",
+ "routrules": "~/worker",
+ "describe": "聊天系统"
+ },
+ {
+ "msgid": "chat.sendcross",
"routrules": "~/worker",
"describe": "聊天系统"
},
diff --git a/comm/const.go b/comm/const.go
index 573a6c115..bde1c66e8 100644
--- a/comm/const.go
+++ b/comm/const.go
@@ -324,3 +324,14 @@ const (
const (
MaxMainlineIntensity = 3 // 最大难度
)
+
+///聊天消息公告类型
+type ChatSystemType int8
+
+const (
+ UserLoginNotice ChatSystemType = 2
+ ///装备强化公告
+ EquipmentUpgradeNotice ChatSystemType = 3
+ ///爬塔通关公告
+ PagodaPassNotice ChatSystemType = 4
+)
diff --git a/comm/imodule.go b/comm/imodule.go
index e584fa6af..01246c317 100644
--- a/comm/imodule.go
+++ b/comm/imodule.go
@@ -135,9 +135,13 @@ type (
//聊天系统
IChat interface {
//推送消息到世界频道
- SendWorldChat(stag string, msg *pb.DBChat) (code pb.ErrorCode)
+ SendWorldChat(msg *pb.DBChat) (code pb.ErrorCode)
//推送消息到用户
SendUserChat(msg *pb.DBChat) (code pb.ErrorCode)
+ //广播系统消息
+ SendSysChatToWorld(ctype ChatSystemType, value int32, agrs ...interface{}) (code pb.ErrorCode)
+ //广播系统消息
+ SendSysChatToUser(session IUserSession, ctype ChatSystemType, value int32, agrs ...interface{}) (code pb.ErrorCode)
}
//战斗系统
diff --git a/lego/sys/redis/single/list.go b/lego/sys/redis/single/list.go
index 729de07d1..c8d78dae7 100644
--- a/lego/sys/redis/single/list.go
+++ b/lego/sys/redis/single/list.go
@@ -127,6 +127,7 @@ func (this *Redis) LRem(key string, count int, target interface{}) (err error) {
if resultvalue, err = this.codec.Marshal(target); err != nil {
return
}
+
err = this.client.Do(this.client.Context(), "LREM", key, count, resultvalue).Err()
return
}
diff --git a/lego/sys/rpcx/service.go b/lego/sys/rpcx/service.go
index 718279190..2ba304583 100644
--- a/lego/sys/rpcx/service.go
+++ b/lego/sys/rpcx/service.go
@@ -388,6 +388,7 @@ func (this *Service) broadcast(ctx context.Context, clusterTag string, servicePa
this.selectormutex.RUnlock()
if !ok {
err = fmt.Errorf("on found serviceTag:%s", clusterTag)
+ return
}
if clientaddrs = selector.Find(ctx, spath[0], serviceMethod, args); clientaddrs == nil || len(clientaddrs) == 0 {
err = fmt.Errorf("on found servicePath:%s", servicePath)
diff --git a/modules/battle/fight/attribute/attributenumeric.go b/modules/battle/fight/attribute/attributenumeric.go
index 464a56ccc..ade00947a 100644
--- a/modules/battle/fight/attribute/attributenumeric.go
+++ b/modules/battle/fight/attribute/attributenumeric.go
@@ -48,5 +48,5 @@ func (this *AttributeNumeric) SetBase(value float32) float32 {
}
func (this *AttributeNumeric) onChange() {
- // this.FixedValue = (BaseValue.Fixed*(1+ProValue.Fixed)+AppendValue.Fixed)*(1+BuffProValue.Fixed) + BuffValue.Fixed
+ // this.fixedValue = (this.BaseValue.Fixed()*(1+this.ProValue.Fixed())+this.AppendValue.Fixed())*(1+this.BuffProValue.Fixed()) + this.BuffValue.Fixed()
}
diff --git a/modules/battle/fight/attribute/fixednumeric.go b/modules/battle/fight/attribute/fixednumeric.go
index 2b1444ba9..a28b4deaa 100644
--- a/modules/battle/fight/attribute/fixednumeric.go
+++ b/modules/battle/fight/attribute/fixednumeric.go
@@ -14,7 +14,20 @@ func (this *FixedNumeric) Set(value float32) float32 {
this.baseValue = NewFixedPoint(value)
return this.baseValue.Scalar()
}
-
+func (this *FixedNumeric) Fixed() *FixedPoint {
+ return this.baseValue
+}
func (this *FixedNumeric) Value() float32 {
return this.baseValue.Scalar()
}
+
+///
+/// 减少基本值
+///
+func (this *FixedNumeric) Minus(value float32) float32 {
+ // this.baseValue -= value
+ // if this.baseValue.Scalar < 0 {
+ // this.baseValue = 0
+ // }
+ return this.baseValue.Scalar()
+}
diff --git a/modules/battle/fight/attribute/fixedpoint.go b/modules/battle/fight/attribute/fixedpoint.go
index ffbd3a283..6154b7ebc 100644
--- a/modules/battle/fight/attribute/fixedpoint.go
+++ b/modules/battle/fight/attribute/fixedpoint.go
@@ -55,6 +55,3 @@ func (this *FixedPoint) Divide(y *FixedPoint) *FixedPoint {
this.rawValue = (this.rawValue * CARDINAL_NUMBER) / y.rawValue
return this
}
-
-
-
diff --git a/modules/battle/fight/attribute/healthpoint.go b/modules/battle/fight/attribute/healthpoint.go
new file mode 100644
index 000000000..9bb65131b
--- /dev/null
+++ b/modules/battle/fight/attribute/healthpoint.go
@@ -0,0 +1,48 @@
+package attribute
+
+func NewHealthPoint(pHp *FixedNumeric) *HealthPoint {
+ return &HealthPoint{
+ Hp: pHp,
+ MaxHp: NewAttributeNumeric(pHp.Value()),
+ CurrMaxHp: NewAttributeNumeric(pHp.Value()),
+ CurrMaxHpPro: NewAttributeNumeric(0),
+ CurrMaxHpAppend: NewAttributeNumeric(0),
+ }
+}
+
+///
+/// 生命值实体
+///
+type HealthPoint struct {
+ ///
+ /// 生命值
+ ///
+ Hp *FixedNumeric
+ ///
+ /// 最大生命值
+ ///
+ MaxHp *AttributeNumeric
+ ///
+ /// 当前最大生命值
+ ///
+ CurrMaxHp *AttributeNumeric
+ ///
+ /// 当前最大生命百分比加成
+ ///
+ CurrMaxHpPro *AttributeNumeric
+ ///
+ /// 当前最大生命加成
+ ///
+ CurrMaxHpAppend *AttributeNumeric
+}
+
+func (this *HealthPoint) Value() int32 {
+ return int32(this.Hp.Value())
+}
+func (this *HealthPoint) MaxValue() int32 {
+ return int32(this.CurrMaxHp.Value())
+}
+
+func (this *HealthPoint) Minus(value float32) {
+ this.Hp.Minus(value)
+}
diff --git a/modules/battle/fight/core/buffstore.go b/modules/battle/fight/core/buffstore.go
new file mode 100644
index 000000000..02beff722
--- /dev/null
+++ b/modules/battle/fight/core/buffstore.go
@@ -0,0 +1,8 @@
+package core
+
+type BuffStore struct {
+ ///
+ /// 已经添加的buff类型
+ ///
+ HasBuffTypes []int
+}
diff --git a/modules/battle/fight/core/fightroledata.go b/modules/battle/fight/core/fightroledata.go
index d86258cc2..67aa1ebe3 100644
--- a/modules/battle/fight/core/fightroledata.go
+++ b/modules/battle/fight/core/fightroledata.go
@@ -118,4 +118,9 @@ type FightRoleData struct {
/// 在角色初始化时,会根据SkillsInfo实例化对应的技能保存于此
///
Skills map[int32]ISkil
+
+ ///
+ /// BUFF集合
+ ///
+ BuffStore *BuffStore
}
diff --git a/modules/battle/fight/fightrole.go b/modules/battle/fight/fightrole.go
new file mode 100644
index 000000000..25a251664
--- /dev/null
+++ b/modules/battle/fight/fightrole.go
@@ -0,0 +1,45 @@
+package fight
+
+import (
+ "go_dreamfactory/modules/battle/fight/attribute"
+ "go_dreamfactory/modules/battle/fight/core"
+ cfg "go_dreamfactory/sys/configure/structs"
+)
+
+type FightRole struct {
+ ///
+ /// 战斗实例
+ ///
+ fight core.IFight
+ ///
+ /// 角色数据
+ ///
+ data core.FightRoleData
+ CurrentHealth attribute.HealthPoint
+}
+
+///
+/// 接收伤害
+///
+func (this *FightRole) ReceiveDamage(DamageValue float32) {
+ this.CurrentHealth.Minus(DamageValue)
+ // FightDebug.Log($"========接收伤害:{Data.UniqueId} 变化值={DamageValue} 当前血量={CurrentHealth.Value}");
+ if this.IsDead() {
+ //有不死buff生命值设置为1
+ for _, v := range this.data.BuffStore.HasBuffTypes {
+ if v == cfg.GameBuffType_UNDEAD {
+ this.CurrentHealth.Hp.Set(1)
+ break
+ }
+ }
+
+ this.Dead()
+ }
+}
+
+func (this *FightRole) IsDead() bool {
+ return this.CurrentHealth.Value() <= 0
+}
+func (this *FightRole) Dead() {
+ this.data.ALive = false
+}
diff --git a/modules/chat/api_getcrosslist.go b/modules/chat/api_getcrosslist.go
new file mode 100644
index 000000000..f24839fbd
--- /dev/null
+++ b/modules/chat/api_getcrosslist.go
@@ -0,0 +1,77 @@
+package chat
+
+import (
+ "go_dreamfactory/comm"
+ "go_dreamfactory/pb"
+
+ "google.golang.org/protobuf/proto"
+)
+
+//参数校验
+func (this *apiComp) GetCrossListCheck(session comm.IUserSession, req *pb.ChatGetCrossListReq) (code pb.ErrorCode) {
+ if req.Channel == pb.ChatChannel_World && req.ChannelId == 0 {
+ code = pb.ErrorCode_ReqParameterError
+ }
+ return
+}
+
+///获取本服聊天消息记录
+func (this *apiComp) GetCrossList(session comm.IUserSession, req *pb.ChatGetCrossListReq) (code pb.ErrorCode, data proto.Message) {
+ var (
+ err error
+ result *pb.DBUserExpand
+ list []*pb.DBChat
+ )
+
+ if code = this.GetCrossListCheck(session, req); code != pb.ErrorCode_Success {
+ return
+ }
+
+ switch req.Channel {
+ // case pb.ChatChannel_World:
+ // if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), "", 0); err != nil {
+ // code = pb.ErrorCode_DBError
+ // return
+ // }
+ // break
+ // case pb.ChatChannel_Union:
+ // if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), "", 0); err != nil {
+ // code = pb.ErrorCode_DBError
+ // return
+ // }
+ // break
+ // case pb.ChatChannel_Private:
+ // if list, err = this.module.modelChat.QueryUserMsg(session.GetUserId()); err != nil {
+ // code = pb.ErrorCode_DBError
+ // return
+ // }
+ // break
+ case pb.ChatChannel_CrossServer:
+ if result, err = this.module.ModuleUser.GetUserExpand(session.GetUserId()); err != nil {
+ this.module.Errorf("err:%v", err)
+ code = pb.ErrorCode_DBError
+ return
+ }
+ if req.ChannelId != result.Chatchannel {
+ code = pb.ErrorCode_ReqParameterError
+ return
+ }
+ if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), "", req.ChannelId); err != nil {
+ code = pb.ErrorCode_DBError
+ return
+ }
+ break
+ // case pb.ChatChannel_System:
+ // if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), "", 0); err != nil {
+ // code = pb.ErrorCode_DBError
+ // return
+ // }
+ // break
+ default:
+ code = pb.ErrorCode_ReqParameterError
+ this.module.Errorf("getlist no support channel:%d ", req.Channel)
+ return
+ }
+ session.SendMsg(string(this.module.GetType()), "getcrosslist", &pb.ChatGetCrossListResp{Chats: list})
+ return
+}
diff --git a/modules/chat/api_getlist.go b/modules/chat/api_getlist.go
index 19a3c14cf..9c037b5ab 100644
--- a/modules/chat/api_getlist.go
+++ b/modules/chat/api_getlist.go
@@ -18,9 +18,9 @@ func (this *apiComp) GetListCheck(session comm.IUserSession, req *pb.ChatGetList
///获取本服聊天消息记录
func (this *apiComp) GetList(session comm.IUserSession, req *pb.ChatGetListReq) (code pb.ErrorCode, data proto.Message) {
var (
- err error
- result *pb.DBUserExpand
- list []*pb.DBChat
+ err error
+ // result *pb.DBUserExpand
+ list []*pb.DBChat
)
if code = this.GetListCheck(session, req); code != pb.ErrorCode_Success {
@@ -46,27 +46,31 @@ func (this *apiComp) GetList(session comm.IUserSession, req *pb.ChatGetListReq)
return
}
break
- case pb.ChatChannel_CrossServer:
- if result, err = this.module.ModuleUser.GetUserExpand(session.GetUserId()); err != nil {
- this.module.Errorf("err:%v", err)
- code = pb.ErrorCode_DBError
- return
- }
- if req.ChannelId != result.Chatchannel {
- code = pb.ErrorCode_ReqParameterError
- return
- }
- if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), "", req.ChannelId); err != nil {
- code = pb.ErrorCode_DBError
- return
- }
- break
+ // case pb.ChatChannel_CrossServer:
+ // if result, err = this.module.ModuleUser.GetUserExpand(session.GetUserId()); err != nil {
+ // this.module.Errorf("err:%v", err)
+ // code = pb.ErrorCode_DBError
+ // return
+ // }
+ // if req.ChannelId != result.Chatchannel {
+ // code = pb.ErrorCode_ReqParameterError
+ // return
+ // }
+ // if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), "", req.ChannelId); err != nil {
+ // code = pb.ErrorCode_DBError
+ // return
+ // }
+ // break
case pb.ChatChannel_System:
if list, err = this.module.modelChat.getChatQueue(req.Channel, session.GetServiecTag(), "", 0); err != nil {
code = pb.ErrorCode_DBError
return
}
break
+ default:
+ code = pb.ErrorCode_ReqParameterError
+ this.module.Errorf("getlist no support channel:%d ", req.Channel)
+ return
}
session.SendMsg(string(this.module.GetType()), "getlist", &pb.ChatGetListResp{Chats: list})
return
diff --git a/modules/chat/api_send.go b/modules/chat/api_send.go
index d59ff461f..69ddfbd82 100644
--- a/modules/chat/api_send.go
+++ b/modules/chat/api_send.go
@@ -21,11 +21,11 @@ func (this *apiComp) SendCheck(session comm.IUserSession, req *pb.ChatSendReq) (
///消息发送请求
func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code pb.ErrorCode, data proto.Message) {
var (
- err error
- max int32
- msg *pb.DBChat
- userexpand *pb.DBUserExpand
- max_chat int32
+ err error
+ max int32
+ msg *pb.DBChat
+ // userexpand *pb.DBUserExpand
+ max_chat int32
)
if code = this.SendCheck(session, req); code != pb.ErrorCode_Success {
return
@@ -52,7 +52,7 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code
}
switch msg.Channel {
case pb.ChatChannel_World:
- if err = this.module.modelChat.addChatMsg(fmt.Sprintf("%s-%s", worldchatkey, session.GetServiecTag()), int64(max), msg); err != nil {
+ if err = this.module.modelChat.addChatMsg(worldchatkey, int64(max), msg); err != nil {
code = pb.ErrorCode_DBError
return
}
@@ -82,18 +82,22 @@ func (this *apiComp) Send(session comm.IUserSession, req *pb.ChatSendReq) (code
}
session.SendMsg(string(this.module.GetType()), "message", &pb.ChatMessagePush{Chat: msg})
break
- case pb.ChatChannel_CrossServer:
- if userexpand, err = this.module.ModuleUser.GetUserExpand(session.GetUserId()); err != nil {
- code = pb.ErrorCode_DBError
- return
- }
- msg.ChannelId = userexpand.Chatchannel //指定频道
- if err = this.module.modelChat.addChatMsg(fmt.Sprintf("%s-%d", crosschatkey, userexpand.Chatchannel), int64(max_chat), msg); err != nil {
- code = pb.ErrorCode_DBError
- return
- }
- this.module.PushToUsers(userexpand.Chatchannel, msg)
+ // case pb.ChatChannel_CrossServer:
+ // if userexpand, err = this.module.ModuleUser.GetUserExpand(session.GetUserId()); err != nil {
+ // code = pb.ErrorCode_DBError
+ // return
+ // }
+ // msg.ChannelId = userexpand.Chatchannel //指定频道
+ // if err = this.module.modelChat.addChatMsg(fmt.Sprintf("%s-%d", crosschatkey, userexpand.Chatchannel), int64(max_chat), msg); err != nil {
+ // code = pb.ErrorCode_DBError
+ // return
+ // }
+ // this.module.PushToUsers(userexpand.Chatchannel, msg)
break
+ default:
+ code = pb.ErrorCode_ReqParameterError
+ this.module.Errorf("getlist no support channel:%d ", req.Channel)
+ return
}
session.SendMsg(string(this.module.GetType()), "send", &pb.ChatSendResp{Issucc: true})
return
diff --git a/modules/chat/api_sendcross.go b/modules/chat/api_sendcross.go
new file mode 100644
index 000000000..264e8dc0a
--- /dev/null
+++ b/modules/chat/api_sendcross.go
@@ -0,0 +1,104 @@
+package chat
+
+import (
+ "fmt"
+ "go_dreamfactory/comm"
+ "go_dreamfactory/pb"
+ "time"
+
+ "go.mongodb.org/mongo-driver/bson/primitive"
+ "google.golang.org/protobuf/proto"
+)
+
+//参数校验
+func (this *apiComp) SendCrossCheck(session comm.IUserSession, req *pb.ChatSendCrossReq) (code pb.ErrorCode) {
+ if (req.Channel == pb.ChatChannel_Union && req.TargetId == "") || (req.Channel == pb.ChatChannel_Private && req.TargetId == "") {
+ code = pb.ErrorCode_ReqParameterError
+ }
+ return
+}
+
+///消息发送请求
+func (this *apiComp) SendCross(session comm.IUserSession, req *pb.ChatSendCrossReq) (code pb.ErrorCode, data proto.Message) {
+ var (
+ err error
+ // max int32
+ msg *pb.DBChat
+ userexpand *pb.DBUserExpand
+ max_chat int32
+ )
+ if code = this.SendCrossCheck(session, req); code != pb.ErrorCode_Success {
+ return
+ }
+
+ msg = &pb.DBChat{
+ Id: primitive.NewObjectID().Hex(),
+ Channel: req.Channel,
+ Suid: session.GetUserId(),
+ Slv: req.Ulv,
+ Uname: req.Uname,
+ Avatar: req.Avatar,
+ Stag: session.GetServiecTag(),
+ Content: req.Content,
+ Ctime: time.Now().Unix(),
+ }
+ // if max, err = this.module.configure.GetChannelRecordMax(); err != nil {
+ // code = pb.ErrorCode_ConfigNoFound
+ // return
+ // }
+ if max_chat, err = this.module.configure.GetChannelRecordMax(); err != nil {
+ code = pb.ErrorCode_ConfigNoFound
+ return
+ }
+ switch msg.Channel {
+ // case pb.ChatChannel_World:
+ // if err = this.module.modelChat.addChatMsg(fmt.Sprintf("%s-%s", worldchatkey, session.GetServiecTag()), int64(max), msg); err != nil {
+ // code = pb.ErrorCode_DBError
+ // return
+ // }
+ // if err = this.module.PushWorld(msg); err != nil {
+ // code = pb.ErrorCode_DBError
+ // return
+ // }
+ // //随机任务
+ // this.module.ModuleRtask.SendToRtask(session, comm.Rtype62, 1)
+ // break
+ // case pb.ChatChannel_Union:
+ // msg.UnionId = req.TargetId
+ // if err = this.module.modelChat.addChatMsg(fmt.Sprintf("%s:%s", unionchatkey, req.TargetId), int64(max_chat), msg); err != nil {
+ // code = pb.ErrorCode_DBError
+ // return
+ // }
+ // if err = this.module.PushUnion(req.TargetId, msg); err != nil {
+ // code = pb.ErrorCode_DBError
+ // return
+ // }
+ // break
+ // case pb.ChatChannel_Private:
+ // msg.Ruid = req.TargetId
+ // if err = this.module.PushUser(msg); err != nil {
+ // code = pb.ErrorCode_DBError
+ // return
+ // }
+ // session.SendMsg(string(this.module.GetType()), "message", &pb.ChatMessagePush{Chat: msg})
+ // break
+ case pb.ChatChannel_CrossServer:
+ if userexpand, err = this.module.ModuleUser.GetUserExpand(session.GetUserId()); err != nil {
+ code = pb.ErrorCode_DBError
+ return
+ }
+ msg.ChannelId = userexpand.Chatchannel //指定频道
+ if err = this.module.modelChat.addChatMsg(fmt.Sprintf("%s-%d", crosschatkey, userexpand.Chatchannel), int64(max_chat), msg); err != nil {
+ code = pb.ErrorCode_DBError
+ return
+ }
+ this.module.PushToUsers(userexpand.Chatchannel, msg)
+ break
+ default:
+ code = pb.ErrorCode_ReqParameterError
+ this.module.Errorf("getlist no support channel:%d ", req.Channel)
+ return
+ }
+ session.SendMsg(string(this.module.GetType()), "sendcross", &pb.ChatSendCrossResp{Issucc: true})
+ return
+}
diff --git a/modules/chat/configure.go b/modules/chat/configure.go
index c1460a080..2518e81de 100644
--- a/modules/chat/configure.go
+++ b/modules/chat/configure.go
@@ -3,7 +3,9 @@ package chat
import (
"fmt"
"go_dreamfactory/modules"
+ "go_dreamfactory/sys/configure"
cfg "go_dreamfactory/sys/configure/structs"
+ "sync"
"go_dreamfactory/lego/core"
)
@@ -18,7 +20,9 @@ const (
///背包配置管理组件
type configureComp struct {
modules.MCompConfigure
- module *Chat
+ module *Chat
+ lock sync.RWMutex
+ chatsystem map[int32][]*cfg.GameChatSystemData
}
//组件初始化接口
@@ -26,8 +30,22 @@ func (this *configureComp) Init(service core.IService, module core.IModule, comp
this.MCompConfigure.Init(service, module, comp, options)
this.module = module.(*Chat)
this.LoadConfigure(game_chatchannel, cfg.NewGameChatChannel)
- this.LoadConfigure(game_chatsystem, cfg.NewGameChatSystem)
-
+ configure.RegisterConfigure(game_chatsystem, cfg.NewGameChatSystem, func() {
+ this.lock.Lock()
+ if v, err := this.GetConfigure(game_chatsystem); err != nil {
+ this.module.Errorf("err:%v", err)
+ return
+ } else {
+ this.chatsystem = make(map[int32][]*cfg.GameChatSystemData)
+ for _, v := range v.(*cfg.GameChatSystem).GetDataList() {
+ if this.chatsystem[v.Type] == nil {
+ this.chatsystem[v.Type] = make([]*cfg.GameChatSystemData, 0)
+ }
+ this.chatsystem[v.Type] = append(this.chatsystem[v.Type], v)
+ }
+ }
+ this.lock.Unlock()
+ })
this.LoadConfigure(game_chatchannelcom, cfg.NewGameChatChannelCom)
return
}
@@ -127,3 +145,18 @@ func (this *configureComp) GetChannelReadRecordNum() (max int32, err error) {
}
return
}
+
+///获取校验聊天系统推送
+func (this *configureComp) GetCheckChatSystem(ctype int32, value int32) (sitem *cfg.GameChatSystemData, ok bool) {
+ this.lock.RLock()
+ vs, ok := this.chatsystem[ctype]
+ this.lock.RUnlock()
+ if ok {
+ for _, v := range vs {
+ if v.Data == value {
+ return v, true
+ }
+ }
+ }
+ return nil, false
+}
diff --git a/modules/chat/modelChat.go b/modules/chat/modelChat.go
index 9145c43b0..7eb7f36e9 100644
--- a/modules/chat/modelChat.go
+++ b/modules/chat/modelChat.go
@@ -75,7 +75,7 @@ func (this *modelChatComp) getChatQueue(channel pb.ChatChannel, stag, union stri
)
switch channel {
case pb.ChatChannel_World:
- key = fmt.Sprintf("%s-%s", worldchatkey, stag)
+ key = worldchatkey
find = bson.M{"channel": channel}
break
case pb.ChatChannel_Union:
@@ -231,7 +231,7 @@ func (this *modelChatComp) SaveUserMsg(msg *pb.DBChat) (err error) {
}
//发送世界频道聊天
-func (this *modelChatComp) sendWorldChat(stag string, msg *pb.DBChat) (code pb.ErrorCode) {
+func (this *modelChatComp) sendWorldChat(msg *pb.DBChat) (code pb.ErrorCode) {
var (
err error
max int32
@@ -240,7 +240,7 @@ func (this *modelChatComp) sendWorldChat(stag string, msg *pb.DBChat) (code pb.E
code = pb.ErrorCode_ConfigNoFound
return
}
- if err = this.module.modelChat.addChatMsg(fmt.Sprintf("%s-%s", worldchatkey, stag), int64(max), msg); err != nil {
+ if err = this.module.modelChat.addChatMsg(worldchatkey, int64(max), msg); err != nil {
code = pb.ErrorCode_DBError
return
}
@@ -256,6 +256,23 @@ func (this *modelChatComp) sendWorldChat(stag string, msg *pb.DBChat) (code pb.E
return
}
+//发送系统频道聊天
+func (this *modelChatComp) sendSystemChat(msg *pb.DBChat) (code pb.ErrorCode) {
+ var (
+ err error
+ )
+ data, _ := anypb.New(&pb.ChatMessagePush{Chat: msg})
+ if err = this.module.service.AcrossClusterBroadcast(context.Background(), msg.Stag, comm.Service_Gateway, string(comm.Rpc_GatewaySendRadioMsg), pb.UserMessage{
+ MainType: string(this.module.GetType()),
+ SubType: "message",
+ Data: data,
+ }, nil); err != nil {
+ this.module.Errorf("err:%v", err)
+ code = pb.ErrorCode_SystemError
+ }
+ return
+}
+
func (this *modelChatComp) addChatMsg(key string, count int64, msgs ...*pb.DBChat) (err error) {
var (
data map[string]*pb.DBChat = make(map[string]*pb.DBChat, len(msgs))
diff --git a/modules/chat/module.go b/modules/chat/module.go
index 5cbc9746d..339679b8c 100644
--- a/modules/chat/module.go
+++ b/modules/chat/module.go
@@ -2,12 +2,14 @@ package chat
import (
"context"
+ "fmt"
"go_dreamfactory/comm"
"go_dreamfactory/lego/base"
"go_dreamfactory/lego/core"
"go_dreamfactory/lego/sys/event"
"go_dreamfactory/modules"
"go_dreamfactory/pb"
+ "time"
"google.golang.org/protobuf/types/known/anypb"
)
@@ -64,8 +66,8 @@ func (this *Chat) EventUserOffline(session comm.IUserSession) {
//对外接口----------------------------------------------------------------------------------------------------------
//向世界频道发送聊天消息
-func (this *Chat) SendWorldChat(stag string, msg *pb.DBChat) (code pb.ErrorCode) {
- code = this.modelChat.sendWorldChat(stag, msg)
+func (this *Chat) SendWorldChat(msg *pb.DBChat) (code pb.ErrorCode) {
+ code = this.modelChat.sendWorldChat(msg)
return
}
@@ -90,6 +92,33 @@ func (this *Chat) SendUserChat(msg *pb.DBChat) (code pb.ErrorCode) {
return
}
+//广播系统消息
+func (this *Chat) SendSysChatToWorld(ctype comm.ChatSystemType, value int32, agrs ...interface{}) (code pb.ErrorCode) {
+ if st, ok := this.configure.GetCheckChatSystem(int32(ctype), value); ok {
+ msg := &pb.DBChat{
+ Channel: pb.ChatChannel_System,
+ Stag: this.service.GetTag(),
+ Ctime: time.Now().Unix(),
+ Content: fmt.Sprintf(st.Text, agrs...),
+ }
+ code = this.modelChat.sendSystemChat(msg)
+ }
+ return
+}
+
+//广播系统消息
+func (this *Chat) SendSysChatToUser(session comm.IUserSession, ctype comm.ChatSystemType, value int32, agrs ...interface{}) (code pb.ErrorCode) {
+ if st, ok := this.configure.GetCheckChatSystem(int32(ctype), value); ok {
+ msg := &pb.DBChat{
+ Channel: pb.ChatChannel_System,
+ Ctime: time.Now().Unix(),
+ Content: fmt.Sprintf(st.Text, agrs...),
+ }
+ session.SendMsg(string(this.GetType()), "message", &pb.ChatMessagePush{Chat: msg})
+ }
+ return
+}
+
//Push--------------------------------------------------------------------------------------------------------------
//推送消息到世界
func (this *Chat) PushWorld(msg *pb.DBChat) (err error) {
diff --git a/modules/equipment/api_upgrade.go b/modules/equipment/api_upgrade.go
index 0e45994d9..32bd4d971 100644
--- a/modules/equipment/api_upgrade.go
+++ b/modules/equipment/api_upgrade.go
@@ -36,6 +36,7 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
confs []*cfg.GameEquipData
issucc bool
suite1Lv, suite2Lv int32 = math.MaxInt32, math.MaxInt32
+ user *pb.DBUser
)
if code = this.UpgradeCheck(session, req); code != pb.ErrorCode_Success {
return
@@ -164,12 +165,17 @@ func (this *apiComp) Upgrade(session comm.IUserSession, req *pb.EquipmentUpgrade
this.module.ModuleRtask.SendToRtask(session, comm.Rtype48, 1, hero.Suite2Star, hero.Suite2Lv)
}
code = this.module.ModuleHero.UpdateEquipment(session, hero, equipments)
-
}
//随机任务触发
this.module.ModuleRtask.SendToRtask(session, comm.Rtype43, 1, equipment.Lv)
this.module.ModuleRtask.SendToRtask(session, comm.Rtype44, equipment.Lv)
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.Lv, user.Name, conf.Name)
+ } else {
+ this.module.Errorf("no found userdata uid:%s", session.GetUserId())
+ }
}
session.SendMsg(string(this.module.GetType()), "upgrade", &pb.EquipmentUpgradeResp{IsSucc: issucc, Equipment: modifyequipments})
diff --git a/modules/equipment/module.go b/modules/equipment/module.go
index 959ff2084..2b870eead 100644
--- a/modules/equipment/module.go
+++ b/modules/equipment/module.go
@@ -23,6 +23,7 @@ func NewModule() core.IModule {
type Equipment struct {
modules.ModuleBase
service core.IService
+ chat comm.IChat
api *apiComp
configure *configureComp
modelEquipment *modelEquipmentComp
@@ -44,6 +45,11 @@ func (this *Equipment) Init(service core.IService, module core.IModule, options
//模块启动
func (this *Equipment) Start() (err error) {
err = this.ModuleBase.Start()
+ var module core.IModule
+ if module, err = this.service.GetModule(comm.ModuleChat); err != nil {
+ return
+ }
+ this.chat = module.(comm.IChat)
event.RegisterGO(comm.EventUserOffline, this.EventUserOffline)
return
}
diff --git a/modules/moonfantasy/modelDream.go b/modules/moonfantasy/modelDream.go
index 4eb557b57..9704a2d25 100644
--- a/modules/moonfantasy/modelDream.go
+++ b/modules/moonfantasy/modelDream.go
@@ -89,8 +89,7 @@ func (this *modelDreamComp) noticeuserfriend(stag, uid string, chat *pb.DBChat)
//延迟推送到 世界聊天频道
func (this *modelDreamComp) delaynoticeWorld(stag string, chat *pb.DBChat) {
timewheel.Add(time.Minute*15, func(t *timewheel.Task, i ...interface{}) {
- _stag := i[0].(string)
_chat := i[0].(*pb.DBChat)
- this.module.chat.SendWorldChat(_stag, _chat)
- }, stag, chat)
+ this.module.chat.SendWorldChat(_chat)
+ }, chat)
}
diff --git a/modules/user/api.go b/modules/user/api.go
index 25881c94f..09040a34a 100644
--- a/modules/user/api.go
+++ b/modules/user/api.go
@@ -31,6 +31,7 @@ type apiComp struct {
module *User
hero comm.IHero
mail comm.Imail
+ chat comm.IChat
}
func (this *apiComp) Init(service core.IService, module core.IModule, comp core.IModuleComp, options core.IModuleOptions) (err error) {
@@ -54,5 +55,9 @@ func (this *apiComp) Start() (err error) {
return
}
this.mail = module.(comm.Imail)
+ if module, err = this.service.GetModule(comm.ModuleChat); err != nil {
+ return
+ }
+ this.chat = module.(comm.IChat)
return
}
diff --git a/modules/user/api_login.go b/modules/user/api_login.go
index 8476410ea..f87141b85 100644
--- a/modules/user/api_login.go
+++ b/modules/user/api_login.go
@@ -161,5 +161,7 @@ func (this *apiComp) Login(session comm.IUserSession, req *pb.UserLoginReq) (cod
fj = append(fj, atn2)
mail.Items = fj
this.mail.CreateNewMail(session, mail)
+ //推送登录公告
+ this.chat.SendSysChatToUser(session, comm.UserLoginNotice, 0)
return
}
diff --git a/pb/chat_msg.pb.go b/pb/chat_msg.pb.go
index f4f0341ba..9c40be35d 100644
--- a/pb/chat_msg.pb.go
+++ b/pb/chat_msg.pb.go
@@ -363,6 +363,110 @@ func (x *ChatGetListResp) GetChats() []*DBChat {
return nil
}
+//跨服请求聊天消息
+type ChatGetCrossListReq struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Channel ChatChannel `protobuf:"varint,1,opt,name=channel,proto3,enum=ChatChannel" json:"channel"` //频道
+ ChannelId int32 `protobuf:"varint,2,opt,name=channelId,proto3" json:"channelId"` //跨服频道id
+}
+
+func (x *ChatGetCrossListReq) Reset() {
+ *x = ChatGetCrossListReq{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_chat_chat_msg_proto_msgTypes[7]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ChatGetCrossListReq) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ChatGetCrossListReq) ProtoMessage() {}
+
+func (x *ChatGetCrossListReq) ProtoReflect() protoreflect.Message {
+ mi := &file_chat_chat_msg_proto_msgTypes[7]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ChatGetCrossListReq.ProtoReflect.Descriptor instead.
+func (*ChatGetCrossListReq) Descriptor() ([]byte, []int) {
+ return file_chat_chat_msg_proto_rawDescGZIP(), []int{7}
+}
+
+func (x *ChatGetCrossListReq) GetChannel() ChatChannel {
+ if x != nil {
+ return x.Channel
+ }
+ return ChatChannel_World
+}
+
+func (x *ChatGetCrossListReq) GetChannelId() int32 {
+ if x != nil {
+ return x.ChannelId
+ }
+ return 0
+}
+
+//跨服请求聊天消息 回应
+type ChatGetCrossListResp struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Chats []*DBChat `protobuf:"bytes,1,rep,name=chats,proto3" json:"chats"`
+}
+
+func (x *ChatGetCrossListResp) Reset() {
+ *x = ChatGetCrossListResp{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_chat_chat_msg_proto_msgTypes[8]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ChatGetCrossListResp) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ChatGetCrossListResp) ProtoMessage() {}
+
+func (x *ChatGetCrossListResp) ProtoReflect() protoreflect.Message {
+ mi := &file_chat_chat_msg_proto_msgTypes[8]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ChatGetCrossListResp.ProtoReflect.Descriptor instead.
+func (*ChatGetCrossListResp) Descriptor() ([]byte, []int) {
+ return file_chat_chat_msg_proto_rawDescGZIP(), []int{8}
+}
+
+func (x *ChatGetCrossListResp) GetChats() []*DBChat {
+ if x != nil {
+ return x.Chats
+ }
+ return nil
+}
+
//消息发送请求
type ChatSendReq struct {
state protoimpl.MessageState
@@ -380,7 +484,7 @@ type ChatSendReq struct {
func (x *ChatSendReq) Reset() {
*x = ChatSendReq{}
if protoimpl.UnsafeEnabled {
- mi := &file_chat_chat_msg_proto_msgTypes[7]
+ mi := &file_chat_chat_msg_proto_msgTypes[9]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -393,7 +497,7 @@ func (x *ChatSendReq) String() string {
func (*ChatSendReq) ProtoMessage() {}
func (x *ChatSendReq) ProtoReflect() protoreflect.Message {
- mi := &file_chat_chat_msg_proto_msgTypes[7]
+ mi := &file_chat_chat_msg_proto_msgTypes[9]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -406,7 +510,7 @@ func (x *ChatSendReq) ProtoReflect() protoreflect.Message {
// Deprecated: Use ChatSendReq.ProtoReflect.Descriptor instead.
func (*ChatSendReq) Descriptor() ([]byte, []int) {
- return file_chat_chat_msg_proto_rawDescGZIP(), []int{7}
+ return file_chat_chat_msg_proto_rawDescGZIP(), []int{9}
}
func (x *ChatSendReq) GetAvatar() string {
@@ -463,7 +567,7 @@ type ChatSendResp struct {
func (x *ChatSendResp) Reset() {
*x = ChatSendResp{}
if protoimpl.UnsafeEnabled {
- mi := &file_chat_chat_msg_proto_msgTypes[8]
+ mi := &file_chat_chat_msg_proto_msgTypes[10]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
@@ -476,7 +580,7 @@ func (x *ChatSendResp) String() string {
func (*ChatSendResp) ProtoMessage() {}
func (x *ChatSendResp) ProtoReflect() protoreflect.Message {
- mi := &file_chat_chat_msg_proto_msgTypes[8]
+ mi := &file_chat_chat_msg_proto_msgTypes[10]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
@@ -489,7 +593,7 @@ func (x *ChatSendResp) ProtoReflect() protoreflect.Message {
// Deprecated: Use ChatSendResp.ProtoReflect.Descriptor instead.
func (*ChatSendResp) Descriptor() ([]byte, []int) {
- return file_chat_chat_msg_proto_rawDescGZIP(), []int{8}
+ return file_chat_chat_msg_proto_rawDescGZIP(), []int{10}
}
func (x *ChatSendResp) GetIssucc() bool {
@@ -499,6 +603,142 @@ func (x *ChatSendResp) GetIssucc() bool {
return false
}
+//跨服消息发送请求
+type ChatSendCrossReq struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Avatar string `protobuf:"bytes,1,opt,name=avatar,proto3" json:"avatar"` //用户头像
+ Uname string `protobuf:"bytes,2,opt,name=uname,proto3" json:"uname"` //用户名
+ Ulv int32 `protobuf:"varint,3,opt,name=ulv,proto3" json:"ulv"` //用户等级
+ Channel ChatChannel `protobuf:"varint,4,opt,name=channel,proto3,enum=ChatChannel" json:"channel"` //频道
+ TargetId string `protobuf:"bytes,5,opt,name=targetId,proto3" json:"targetId"` //目标用户id
+ Content string `protobuf:"bytes,6,opt,name=content,proto3" json:"content"` //内容
+}
+
+func (x *ChatSendCrossReq) Reset() {
+ *x = ChatSendCrossReq{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_chat_chat_msg_proto_msgTypes[11]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ChatSendCrossReq) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ChatSendCrossReq) ProtoMessage() {}
+
+func (x *ChatSendCrossReq) ProtoReflect() protoreflect.Message {
+ mi := &file_chat_chat_msg_proto_msgTypes[11]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ChatSendCrossReq.ProtoReflect.Descriptor instead.
+func (*ChatSendCrossReq) Descriptor() ([]byte, []int) {
+ return file_chat_chat_msg_proto_rawDescGZIP(), []int{11}
+}
+
+func (x *ChatSendCrossReq) GetAvatar() string {
+ if x != nil {
+ return x.Avatar
+ }
+ return ""
+}
+
+func (x *ChatSendCrossReq) GetUname() string {
+ if x != nil {
+ return x.Uname
+ }
+ return ""
+}
+
+func (x *ChatSendCrossReq) GetUlv() int32 {
+ if x != nil {
+ return x.Ulv
+ }
+ return 0
+}
+
+func (x *ChatSendCrossReq) GetChannel() ChatChannel {
+ if x != nil {
+ return x.Channel
+ }
+ return ChatChannel_World
+}
+
+func (x *ChatSendCrossReq) GetTargetId() string {
+ if x != nil {
+ return x.TargetId
+ }
+ return ""
+}
+
+func (x *ChatSendCrossReq) GetContent() string {
+ if x != nil {
+ return x.Content
+ }
+ return ""
+}
+
+//跨服消息发送请求 回应
+type ChatSendCrossResp struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Issucc bool `protobuf:"varint,1,opt,name=issucc,proto3" json:"issucc"` //是否成功
+}
+
+func (x *ChatSendCrossResp) Reset() {
+ *x = ChatSendCrossResp{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_chat_chat_msg_proto_msgTypes[12]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *ChatSendCrossResp) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*ChatSendCrossResp) ProtoMessage() {}
+
+func (x *ChatSendCrossResp) ProtoReflect() protoreflect.Message {
+ mi := &file_chat_chat_msg_proto_msgTypes[12]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use ChatSendCrossResp.ProtoReflect.Descriptor instead.
+func (*ChatSendCrossResp) Descriptor() ([]byte, []int) {
+ return file_chat_chat_msg_proto_rawDescGZIP(), []int{12}
+}
+
+func (x *ChatSendCrossResp) GetIssucc() bool {
+ if x != nil {
+ return x.Issucc
+ }
+ return false
+}
+
var File_chat_chat_msg_proto protoreflect.FileDescriptor
var file_chat_chat_msg_proto_rawDesc = []byte{
@@ -529,21 +769,45 @@ var file_chat_chat_msg_proto_rawDesc = []byte{
0x6e, 0x65, 0x6c, 0x49, 0x64, 0x22, 0x30, 0x0a, 0x0f, 0x43, 0x68, 0x61, 0x74, 0x47, 0x65, 0x74,
0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x05, 0x63, 0x68, 0x61, 0x74,
0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42, 0x43, 0x68, 0x61, 0x74,
- 0x52, 0x05, 0x63, 0x68, 0x61, 0x74, 0x73, 0x22, 0xab, 0x01, 0x0a, 0x0b, 0x43, 0x68, 0x61, 0x74,
- 0x53, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61,
- 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12,
- 0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05,
- 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x6c, 0x76, 0x18, 0x03, 0x20, 0x01,
- 0x28, 0x05, 0x52, 0x03, 0x75, 0x6c, 0x76, 0x12, 0x26, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e,
- 0x65, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x43,
- 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12,
- 0x1a, 0x0a, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28,
- 0x09, 0x52, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63,
- 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f,
- 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x26, 0x0a, 0x0c, 0x43, 0x68, 0x61, 0x74, 0x53, 0x65, 0x6e,
- 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63, 0x63, 0x18,
- 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63, 0x63, 0x42, 0x06, 0x5a,
- 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0x52, 0x05, 0x63, 0x68, 0x61, 0x74, 0x73, 0x22, 0x5b, 0x0a, 0x13, 0x43, 0x68, 0x61, 0x74, 0x47,
+ 0x65, 0x74, 0x43, 0x72, 0x6f, 0x73, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x71, 0x12, 0x26,
+ 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32,
+ 0x0c, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x07, 0x63,
+ 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x1c, 0x0a, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65,
+ 0x6c, 0x49, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x63, 0x68, 0x61, 0x6e, 0x6e,
+ 0x65, 0x6c, 0x49, 0x64, 0x22, 0x35, 0x0a, 0x14, 0x43, 0x68, 0x61, 0x74, 0x47, 0x65, 0x74, 0x43,
+ 0x72, 0x6f, 0x73, 0x73, 0x4c, 0x69, 0x73, 0x74, 0x52, 0x65, 0x73, 0x70, 0x12, 0x1d, 0x0a, 0x05,
+ 0x63, 0x68, 0x61, 0x74, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x07, 0x2e, 0x44, 0x42,
+ 0x43, 0x68, 0x61, 0x74, 0x52, 0x05, 0x63, 0x68, 0x61, 0x74, 0x73, 0x22, 0xab, 0x01, 0x0a, 0x0b,
+ 0x43, 0x68, 0x61, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x61,
+ 0x76, 0x61, 0x74, 0x61, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61,
+ 0x74, 0x61, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01,
+ 0x28, 0x09, 0x52, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x6c, 0x76,
+ 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x03, 0x75, 0x6c, 0x76, 0x12, 0x26, 0x0a, 0x07, 0x63,
+ 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x43,
+ 0x68, 0x61, 0x74, 0x43, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e,
+ 0x6e, 0x65, 0x6c, 0x12, 0x1a, 0x0a, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x49, 0x64, 0x18,
+ 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x49, 0x64, 0x12,
+ 0x18, 0x0a, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x07, 0x63, 0x6f, 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x22, 0x26, 0x0a, 0x0c, 0x43, 0x68, 0x61,
+ 0x74, 0x53, 0x65, 0x6e, 0x64, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73,
+ 0x75, 0x63, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63,
+ 0x63, 0x22, 0xb0, 0x01, 0x0a, 0x10, 0x43, 0x68, 0x61, 0x74, 0x53, 0x65, 0x6e, 0x64, 0x43, 0x72,
+ 0x6f, 0x73, 0x73, 0x52, 0x65, 0x71, 0x12, 0x16, 0x0a, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72,
+ 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x61, 0x76, 0x61, 0x74, 0x61, 0x72, 0x12, 0x14,
+ 0x0a, 0x05, 0x75, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x75,
+ 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x10, 0x0a, 0x03, 0x75, 0x6c, 0x76, 0x18, 0x03, 0x20, 0x01, 0x28,
+ 0x05, 0x52, 0x03, 0x75, 0x6c, 0x76, 0x12, 0x26, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65,
+ 0x6c, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x0c, 0x2e, 0x43, 0x68, 0x61, 0x74, 0x43, 0x68,
+ 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x52, 0x07, 0x63, 0x68, 0x61, 0x6e, 0x6e, 0x65, 0x6c, 0x12, 0x1a,
+ 0x0a, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x49, 0x64, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x08, 0x74, 0x61, 0x72, 0x67, 0x65, 0x74, 0x49, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x6f,
+ 0x6e, 0x74, 0x65, 0x6e, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x6f, 0x6e,
+ 0x74, 0x65, 0x6e, 0x74, 0x22, 0x2b, 0x0a, 0x11, 0x43, 0x68, 0x61, 0x74, 0x53, 0x65, 0x6e, 0x64,
+ 0x43, 0x72, 0x6f, 0x73, 0x73, 0x52, 0x65, 0x73, 0x70, 0x12, 0x16, 0x0a, 0x06, 0x69, 0x73, 0x73,
+ 0x75, 0x63, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x69, 0x73, 0x73, 0x75, 0x63,
+ 0x63, 0x42, 0x06, 0x5a, 0x04, 0x2e, 0x3b, 0x70, 0x62, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+ 0x33,
}
var (
@@ -558,7 +822,7 @@ func file_chat_chat_msg_proto_rawDescGZIP() []byte {
return file_chat_chat_msg_proto_rawDescData
}
-var file_chat_chat_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 9)
+var file_chat_chat_msg_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
var file_chat_chat_msg_proto_goTypes = []interface{}{
(*ChatMessagePush)(nil), // 0: ChatMessagePush
(*ChatCrossChannelReq)(nil), // 1: ChatCrossChannelReq
@@ -567,21 +831,28 @@ var file_chat_chat_msg_proto_goTypes = []interface{}{
(*ChatChanageChannelResp)(nil), // 4: ChatChanageChannelResp
(*ChatGetListReq)(nil), // 5: ChatGetListReq
(*ChatGetListResp)(nil), // 6: ChatGetListResp
- (*ChatSendReq)(nil), // 7: ChatSendReq
- (*ChatSendResp)(nil), // 8: ChatSendResp
- (*DBChat)(nil), // 9: DBChat
- (ChatChannel)(0), // 10: ChatChannel
+ (*ChatGetCrossListReq)(nil), // 7: ChatGetCrossListReq
+ (*ChatGetCrossListResp)(nil), // 8: ChatGetCrossListResp
+ (*ChatSendReq)(nil), // 9: ChatSendReq
+ (*ChatSendResp)(nil), // 10: ChatSendResp
+ (*ChatSendCrossReq)(nil), // 11: ChatSendCrossReq
+ (*ChatSendCrossResp)(nil), // 12: ChatSendCrossResp
+ (*DBChat)(nil), // 13: DBChat
+ (ChatChannel)(0), // 14: ChatChannel
}
var file_chat_chat_msg_proto_depIdxs = []int32{
- 9, // 0: ChatMessagePush.chat:type_name -> DBChat
- 10, // 1: ChatGetListReq.channel:type_name -> ChatChannel
- 9, // 2: ChatGetListResp.chats:type_name -> DBChat
- 10, // 3: ChatSendReq.channel:type_name -> ChatChannel
- 4, // [4:4] is the sub-list for method output_type
- 4, // [4:4] is the sub-list for method input_type
- 4, // [4:4] is the sub-list for extension type_name
- 4, // [4:4] is the sub-list for extension extendee
- 0, // [0:4] is the sub-list for field type_name
+ 13, // 0: ChatMessagePush.chat:type_name -> DBChat
+ 14, // 1: ChatGetListReq.channel:type_name -> ChatChannel
+ 13, // 2: ChatGetListResp.chats:type_name -> DBChat
+ 14, // 3: ChatGetCrossListReq.channel:type_name -> ChatChannel
+ 13, // 4: ChatGetCrossListResp.chats:type_name -> DBChat
+ 14, // 5: ChatSendReq.channel:type_name -> ChatChannel
+ 14, // 6: ChatSendCrossReq.channel:type_name -> ChatChannel
+ 7, // [7:7] is the sub-list for method output_type
+ 7, // [7:7] is the sub-list for method input_type
+ 7, // [7:7] is the sub-list for extension type_name
+ 7, // [7:7] is the sub-list for extension extendee
+ 0, // [0:7] is the sub-list for field type_name
}
func init() { file_chat_chat_msg_proto_init() }
@@ -676,7 +947,7 @@ func file_chat_chat_msg_proto_init() {
}
}
file_chat_chat_msg_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*ChatSendReq); i {
+ switch v := v.(*ChatGetCrossListReq); i {
case 0:
return &v.state
case 1:
@@ -688,6 +959,30 @@ func file_chat_chat_msg_proto_init() {
}
}
file_chat_chat_msg_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ChatGetCrossListResp); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_chat_chat_msg_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ChatSendReq); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_chat_chat_msg_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*ChatSendResp); i {
case 0:
return &v.state
@@ -699,6 +994,30 @@ func file_chat_chat_msg_proto_init() {
return nil
}
}
+ file_chat_chat_msg_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ChatSendCrossReq); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_chat_chat_msg_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*ChatSendCrossResp); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
}
type x struct{}
out := protoimpl.TypeBuilder{
@@ -706,7 +1025,7 @@ func file_chat_chat_msg_proto_init() {
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_chat_chat_msg_proto_rawDesc,
NumEnums: 0,
- NumMessages: 9,
+ NumMessages: 13,
NumExtensions: 0,
NumServices: 0,
},
diff --git a/sys/configure/structs/game.chatSystemData.go b/sys/configure/structs/game.chatSystemData.go
index 126c576d4..8fd753c4c 100644
--- a/sys/configure/structs/game.chatSystemData.go
+++ b/sys/configure/structs/game.chatSystemData.go
@@ -13,9 +13,7 @@ import "errors"
type GameChatSystemData struct {
Key int32
Type int32
- Title string
- Close string
- Test string
+ Text string
Data int32
Week []int32
TimeH int32
@@ -31,9 +29,7 @@ func (*GameChatSystemData) GetTypeId() int32 {
func (_v *GameChatSystemData)Deserialize(_buf map[string]interface{}) (err error) {
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["key"].(float64); !_ok_ { err = errors.New("key error"); return }; _v.Key = int32(_tempNum_) }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["type"].(float64); !_ok_ { err = errors.New("type error"); return }; _v.Type = int32(_tempNum_) }
- { var _ok_ bool; if _v.Title, _ok_ = _buf["title"].(string); !_ok_ { err = errors.New("title error"); return } }
- { var _ok_ bool; if _v.Close, _ok_ = _buf["close"].(string); !_ok_ { err = errors.New("close error"); return } }
- { var _ok_ bool; if _v.Test, _ok_ = _buf["test"].(string); !_ok_ { err = errors.New("test error"); return } }
+ {var _ok_ bool; var __json_text__ map[string]interface{}; if __json_text__, _ok_ = _buf["text"].(map[string]interface{}) ; !_ok_ { err = errors.New("_v.Text error"); return }; { var _ok_ bool; if _, _ok_ = __json_text__["key"].(string); !_ok_ { err = errors.New("key error"); return } }; { var _ok_ bool; if _v.Text, _ok_ = __json_text__["text"].(string); !_ok_ { err = errors.New("text error"); return } } }
{ var _ok_ bool; var _tempNum_ float64; if _tempNum_, _ok_ = _buf["data"].(float64); !_ok_ { err = errors.New("data error"); return }; _v.Data = int32(_tempNum_) }
{
var _arr_ []interface{}