Merge remote-tracking branch 'origin/develop' into dev_slots
This commit is contained in:
commit
2ab2ffafdd
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
@ -71,7 +71,7 @@
|
||||||
"Name": "十三张(四人场)",
|
"Name": "十三张(四人场)",
|
||||||
"GameId": 211,
|
"GameId": 211,
|
||||||
"Params": [
|
"Params": [
|
||||||
0,
|
4,
|
||||||
0,
|
0,
|
||||||
30,
|
30,
|
||||||
50,
|
50,
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
"Name": "十三张(八人场)",
|
"Name": "十三张(八人场)",
|
||||||
"GameId": 212,
|
"GameId": 212,
|
||||||
"Params": [
|
"Params": [
|
||||||
1,
|
8,
|
||||||
0,
|
0,
|
||||||
30,
|
30,
|
||||||
50,
|
50,
|
||||||
|
@ -97,7 +97,7 @@
|
||||||
"Name": "十三张(自由场经典场)",
|
"Name": "十三张(自由场经典场)",
|
||||||
"GameId": 213,
|
"GameId": 213,
|
||||||
"Params": [
|
"Params": [
|
||||||
1,
|
8,
|
||||||
0,
|
0,
|
||||||
30,
|
30,
|
||||||
50,
|
50,
|
||||||
|
@ -110,7 +110,7 @@
|
||||||
"Name": "十三张(自由场癞子场)",
|
"Name": "十三张(自由场癞子场)",
|
||||||
"GameId": 214,
|
"GameId": 214,
|
||||||
"Params": [
|
"Params": [
|
||||||
1,
|
8,
|
||||||
0,
|
0,
|
||||||
30,
|
30,
|
||||||
50,
|
50,
|
||||||
|
@ -250,6 +250,18 @@
|
||||||
"GameId": 312,
|
"GameId": 312,
|
||||||
"GameDif": "312"
|
"GameDif": "312"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"Id": 31300,
|
||||||
|
"Name": "CashMania",
|
||||||
|
"GameId": 313,
|
||||||
|
"GameDif": "313"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"Id": 31400,
|
||||||
|
"Name": "GatesOfOlympus",
|
||||||
|
"GameId": 314,
|
||||||
|
"GameDif": "314"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"Id": 60800,
|
"Id": 60800,
|
||||||
"Name": "娃娃机",
|
"Name": "娃娃机",
|
||||||
|
|
Binary file not shown.
Binary file not shown.
BIN
data/DB_Task.dat
BIN
data/DB_Task.dat
Binary file not shown.
|
@ -34,6 +34,7 @@ const (
|
||||||
ThirteenWaterPlayerOpTest = 3 // test
|
ThirteenWaterPlayerOpTest = 3 // test
|
||||||
ThirteenWaterPlayerOpReset = 4 // 重新选牌
|
ThirteenWaterPlayerOpReset = 4 // 重新选牌
|
||||||
ThirteenWaterPlayerJoin = 5 // 加入游戏
|
ThirteenWaterPlayerJoin = 5 // 加入游戏
|
||||||
|
ThirteenWaterPlayerOpSelect = 6 // 预选牌
|
||||||
)
|
)
|
||||||
const (
|
const (
|
||||||
ThirteenWaterSceneWaitTimeout = time.Second * 2 //等待倒计时
|
ThirteenWaterSceneWaitTimeout = time.Second * 2 //等待倒计时
|
||||||
|
|
|
@ -1471,7 +1471,7 @@ func (this *Scene) SaveGameDetailedLog(param *SaveGameDetailedParam) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if param.GameTime < 0 {
|
if param.GameTime <= 0 {
|
||||||
param.GameTime = int64(time.Now().Sub(this.GameNowTime).Seconds())
|
param.GameTime = int64(time.Now().Sub(this.GameNowTime).Seconds())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,7 @@ type PlayerEx struct {
|
||||||
cards [13]int //手牌信息
|
cards [13]int //手牌信息
|
||||||
allGroup map[int]*thirteen.Group //玩家所有牌型
|
allGroup map[int]*thirteen.Group //玩家所有牌型
|
||||||
cardsO *thirteen.Group //确定的牌型信息
|
cardsO *thirteen.Group //确定的牌型信息
|
||||||
|
preCardsO *thirteen.Group //预确定的牌型
|
||||||
isDP bool // 是否倒排
|
isDP bool // 是否倒排
|
||||||
gainCoin int64 //本局赢的金币
|
gainCoin int64 //本局赢的金币
|
||||||
taxCoin int64 //本局税收
|
taxCoin int64 //本局税收
|
||||||
|
@ -36,6 +37,7 @@ func (this *PlayerEx) Clear() {
|
||||||
}
|
}
|
||||||
this.allGroup = make(map[int]*thirteen.Group)
|
this.allGroup = make(map[int]*thirteen.Group)
|
||||||
this.cardsO = &thirteen.Group{Head: [3]int{-1, -1, -1}, Mid: [5]int{-1, -1, -1, -1, -1}, End: [5]int{-1, -1, -1, -1, -1}, PokerType: -1}
|
this.cardsO = &thirteen.Group{Head: [3]int{-1, -1, -1}, Mid: [5]int{-1, -1, -1, -1, -1}, End: [5]int{-1, -1, -1, -1, -1}, PokerType: -1}
|
||||||
|
this.preCardsO = &thirteen.Group{Head: [3]int{-1, -1, -1}, Mid: [5]int{-1, -1, -1, -1, -1}, End: [5]int{-1, -1, -1, -1, -1}, PokerType: -1}
|
||||||
this.isDP = false
|
this.isDP = false
|
||||||
this.gainCoin = 0
|
this.gainCoin = 0
|
||||||
this.taxCoin = 0
|
this.taxCoin = 0
|
||||||
|
|
|
@ -870,6 +870,7 @@ func (this *StateOp) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, param
|
||||||
} else {
|
} else {
|
||||||
sceneEx.SendSelectCards(playerEx, int(params[0]), int64(opcode))
|
sceneEx.SendSelectCards(playerEx, int(params[0]), int64(opcode))
|
||||||
}
|
}
|
||||||
|
playerEx.preCardsO = &rule.Group{Head: [3]int{-1, -1, -1}, Mid: [5]int{-1, -1, -1, -1, -1}, End: [5]int{-1, -1, -1, -1, -1}, PokerType: -1}
|
||||||
playerEx.Trusteeship = 0
|
playerEx.Trusteeship = 0
|
||||||
playerEx.UnmarkFlag(base.PlayerState_Auto)
|
playerEx.UnmarkFlag(base.PlayerState_Auto)
|
||||||
playerEx.deterMine = true
|
playerEx.deterMine = true
|
||||||
|
@ -886,6 +887,34 @@ func (this *StateOp) OnPlayerOp(s *base.Scene, p *base.Player, opcode int, param
|
||||||
//提前进入亮牌阶段
|
//提前进入亮牌阶段
|
||||||
s.ChangeSceneState(rule.ThirteenWaterSceneStateShowCards)
|
s.ChangeSceneState(rule.ThirteenWaterSceneStateShowCards)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case rule.ThirteenWaterPlayerOpSelect:
|
||||||
|
playerEx.deterMine = false
|
||||||
|
playerEx.cardsO = &rule.Group{Head: [3]int{-1, -1, -1}, Mid: [5]int{-1, -1, -1, -1, -1}, End: [5]int{-1, -1, -1, -1, -1}, PokerType: -1}
|
||||||
|
playerEx.Trusteeship = 0
|
||||||
|
playerEx.UnmarkFlag(base.PlayerState_Auto)
|
||||||
|
pack := &thirteen.SCThirteenPlayerOp{
|
||||||
|
OpRetCode: thirteen.OpResultCode_OPRC_Sucess,
|
||||||
|
OpCode: int32(opcode),
|
||||||
|
OpParam: params,
|
||||||
|
Pos: int32(playerEx.GetPos()),
|
||||||
|
}
|
||||||
|
if len(params) == 13 {
|
||||||
|
//校验牌
|
||||||
|
a := rule.DelCards(playerEx.cards[:], common.Int64Toint(params))
|
||||||
|
if len(a) != 0 {
|
||||||
|
logger.Logger.Error("the cards is error.")
|
||||||
|
returnFunc(thirteen.OpResultCode_OPRC_Error)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
//牌赋值
|
||||||
|
copy(playerEx.preCardsO.Head[:], common.Int64Toint(params[:3]))
|
||||||
|
copy(playerEx.preCardsO.Mid[:], common.Int64Toint(params[3:8]))
|
||||||
|
copy(playerEx.preCardsO.End[:], common.Int64Toint(params[8:]))
|
||||||
|
playerEx.preCardsO.PokerType = 0
|
||||||
|
}
|
||||||
|
playerEx.SendToClient(int(thirteen.TWMmoPacketID_PACKET_SCThirteenPlayerOp), pack)
|
||||||
|
|
||||||
case rule.ThirteenWaterPlayerOpReset:
|
case rule.ThirteenWaterPlayerOpReset:
|
||||||
// 取消确认
|
// 取消确认
|
||||||
playerEx.deterMine = false
|
playerEx.deterMine = false
|
||||||
|
@ -913,6 +942,11 @@ func (this *StateOp) OnLeave(s *base.Scene) {
|
||||||
|
|
||||||
for _, player := range sceneEx.players {
|
for _, player := range sceneEx.players {
|
||||||
if player != nil && player.IsGameing() {
|
if player != nil && player.IsGameing() {
|
||||||
|
// 使用预选牌
|
||||||
|
if player.preCardsO != nil && player.preCardsO.PokerType != -1 && (player.cardsO == nil || player.cardsO.PokerType == -1) {
|
||||||
|
player.cardsO = player.preCardsO
|
||||||
|
}
|
||||||
|
// 判断是否倒水
|
||||||
if player.cardsO != nil && player.cardsO.PokerType != -1 {
|
if player.cardsO != nil && player.cardsO.PokerType != -1 {
|
||||||
if player.cardsO.PokerType < 1000000 {
|
if player.cardsO.PokerType < 1000000 {
|
||||||
player.isDP = sceneEx.logic.IsDP(player.cardsO.Head, player.cardsO.Mid, player.cardsO.End)
|
player.isDP = sceneEx.logic.IsDP(player.cardsO.Head, player.cardsO.Mid, player.cardsO.End)
|
||||||
|
@ -1234,11 +1268,8 @@ func (this *StateHit) OnEnter(s *base.Scene) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if sceneEx.isCanAllHitPos != -1 {
|
// 每个打枪加2秒,全垒打再加2秒
|
||||||
hitNum++
|
sceneEx.hitTime += time.Second * 2 * (time.Duration(hitNum))
|
||||||
}
|
|
||||||
// 每个打枪加1秒,全垒打再加1秒
|
|
||||||
sceneEx.hitTime += time.Second * (time.Duration(hitNum))
|
|
||||||
sceneEx.ShowCards()
|
sceneEx.ShowCards()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1334,7 +1365,7 @@ func (this *StateBilled) OnEnter(s *base.Scene) {
|
||||||
RoomType: sceneEx.GetSceneType(),
|
RoomType: sceneEx.GetSceneType(),
|
||||||
BaseScore: int32(sceneEx.GetBaseScore()),
|
BaseScore: int32(sceneEx.GetBaseScore()),
|
||||||
NowRound: int32(sceneEx.NumOfGames),
|
NowRound: int32(sceneEx.NumOfGames),
|
||||||
ClubRate: sceneEx.Scene.PumpCoin,
|
TaxRate: s.GetDBGameFree().GetTaxRate(),
|
||||||
}
|
}
|
||||||
var person []model.ThirteenWaterPerson
|
var person []model.ThirteenWaterPerson
|
||||||
for _, o_player := range sceneEx.players {
|
for _, o_player := range sceneEx.players {
|
||||||
|
|
|
@ -168,8 +168,8 @@ type ThirteenWaterType struct {
|
||||||
NowRound int32 //当前局数
|
NowRound int32 //当前局数
|
||||||
PlayerCount int //玩家数量
|
PlayerCount int //玩家数量
|
||||||
BaseScore int32 //底分
|
BaseScore int32 //底分
|
||||||
|
TaxRate int32 //税率(万分比)
|
||||||
PlayerData []ThirteenWaterPerson //玩家信息
|
PlayerData []ThirteenWaterPerson //玩家信息
|
||||||
ClubRate int32 //俱乐部抽水比例
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type ThirteenWaterPoker struct {
|
type ThirteenWaterPoker struct {
|
||||||
|
|
|
@ -4238,10 +4238,10 @@ type DB_GameFree struct {
|
||||||
FreeMode int32 `protobuf:"varint,6,opt,name=FreeMode,proto3" json:"FreeMode,omitempty"`
|
FreeMode int32 `protobuf:"varint,6,opt,name=FreeMode,proto3" json:"FreeMode,omitempty"`
|
||||||
GameRule int32 `protobuf:"varint,7,opt,name=GameRule,proto3" json:"GameRule,omitempty"`
|
GameRule int32 `protobuf:"varint,7,opt,name=GameRule,proto3" json:"GameRule,omitempty"`
|
||||||
GameType int32 `protobuf:"varint,8,opt,name=GameType,proto3" json:"GameType,omitempty"`
|
GameType int32 `protobuf:"varint,8,opt,name=GameType,proto3" json:"GameType,omitempty"`
|
||||||
SceneType int32 `protobuf:"varint,9,opt,name=SceneType,proto3" json:"SceneType,omitempty"`
|
Desc string `protobuf:"bytes,9,opt,name=Desc,proto3" json:"Desc,omitempty"`
|
||||||
RankType int32 `protobuf:"varint,10,opt,name=RankType,proto3" json:"RankType,omitempty"`
|
SceneType int32 `protobuf:"varint,10,opt,name=SceneType,proto3" json:"SceneType,omitempty"`
|
||||||
SceneAdd int32 `protobuf:"varint,11,opt,name=SceneAdd,proto3" json:"SceneAdd,omitempty"`
|
RankType int32 `protobuf:"varint,11,opt,name=RankType,proto3" json:"RankType,omitempty"`
|
||||||
Desc string `protobuf:"bytes,12,opt,name=Desc,proto3" json:"Desc,omitempty"`
|
SceneAdd int32 `protobuf:"varint,12,opt,name=SceneAdd,proto3" json:"SceneAdd,omitempty"`
|
||||||
ShowType int32 `protobuf:"varint,13,opt,name=ShowType,proto3" json:"ShowType,omitempty"`
|
ShowType int32 `protobuf:"varint,13,opt,name=ShowType,proto3" json:"ShowType,omitempty"`
|
||||||
SubShowType int32 `protobuf:"varint,14,opt,name=SubShowType,proto3" json:"SubShowType,omitempty"`
|
SubShowType int32 `protobuf:"varint,14,opt,name=SubShowType,proto3" json:"SubShowType,omitempty"`
|
||||||
Flag int32 `protobuf:"varint,15,opt,name=Flag,proto3" json:"Flag,omitempty"`
|
Flag int32 `protobuf:"varint,15,opt,name=Flag,proto3" json:"Flag,omitempty"`
|
||||||
|
@ -4393,6 +4393,13 @@ func (x *DB_GameFree) GetGameType() int32 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (x *DB_GameFree) GetDesc() string {
|
||||||
|
if x != nil {
|
||||||
|
return x.Desc
|
||||||
|
}
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
func (x *DB_GameFree) GetSceneType() int32 {
|
func (x *DB_GameFree) GetSceneType() int32 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.SceneType
|
return x.SceneType
|
||||||
|
@ -4414,13 +4421,6 @@ func (x *DB_GameFree) GetSceneAdd() int32 {
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
func (x *DB_GameFree) GetDesc() string {
|
|
||||||
if x != nil {
|
|
||||||
return x.Desc
|
|
||||||
}
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
|
|
||||||
func (x *DB_GameFree) GetShowType() int32 {
|
func (x *DB_GameFree) GetShowType() int32 {
|
||||||
if x != nil {
|
if x != nil {
|
||||||
return x.ShowType
|
return x.ShowType
|
||||||
|
@ -11426,14 +11426,14 @@ var file_protocol_server_pbdata_proto_rawDesc = []byte{
|
||||||
0x65, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x47, 0x61, 0x6d, 0x65, 0x52, 0x75,
|
0x65, 0x65, 0x4d, 0x6f, 0x64, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x47, 0x61, 0x6d, 0x65, 0x52, 0x75,
|
||||||
0x6c, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x47, 0x61, 0x6d, 0x65, 0x52, 0x75,
|
0x6c, 0x65, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x47, 0x61, 0x6d, 0x65, 0x52, 0x75,
|
||||||
0x6c, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x47, 0x61, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x08,
|
0x6c, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x47, 0x61, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x08,
|
||||||
0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x47, 0x61, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1c,
|
0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x47, 0x61, 0x6d, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12,
|
||||||
0x0a, 0x09, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18, 0x09, 0x20, 0x01, 0x28,
|
0x0a, 0x04, 0x44, 0x65, 0x73, 0x63, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x44, 0x65,
|
||||||
0x05, 0x52, 0x09, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08,
|
0x73, 0x63, 0x12, 0x1c, 0x0a, 0x09, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65, 0x18,
|
||||||
0x52, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08,
|
0x0a, 0x20, 0x01, 0x28, 0x05, 0x52, 0x09, 0x53, 0x63, 0x65, 0x6e, 0x65, 0x54, 0x79, 0x70, 0x65,
|
||||||
0x52, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x63, 0x65, 0x6e,
|
0x12, 0x1a, 0x0a, 0x08, 0x52, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x18, 0x0b, 0x20, 0x01,
|
||||||
0x65, 0x41, 0x64, 0x64, 0x18, 0x0b, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x53, 0x63, 0x65, 0x6e,
|
0x28, 0x05, 0x52, 0x08, 0x52, 0x61, 0x6e, 0x6b, 0x54, 0x79, 0x70, 0x65, 0x12, 0x1a, 0x0a, 0x08,
|
||||||
0x65, 0x41, 0x64, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x44, 0x65, 0x73, 0x63, 0x18, 0x0c, 0x20, 0x01,
|
0x53, 0x63, 0x65, 0x6e, 0x65, 0x41, 0x64, 0x64, 0x18, 0x0c, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08,
|
||||||
0x28, 0x09, 0x52, 0x04, 0x44, 0x65, 0x73, 0x63, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x68, 0x6f, 0x77,
|
0x53, 0x63, 0x65, 0x6e, 0x65, 0x41, 0x64, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x53, 0x68, 0x6f, 0x77,
|
||||||
0x54, 0x79, 0x70, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x53, 0x68, 0x6f, 0x77,
|
0x54, 0x79, 0x70, 0x65, 0x18, 0x0d, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x53, 0x68, 0x6f, 0x77,
|
||||||
0x54, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x53, 0x75, 0x62, 0x53, 0x68, 0x6f, 0x77, 0x54,
|
0x54, 0x79, 0x70, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x53, 0x75, 0x62, 0x53, 0x68, 0x6f, 0x77, 0x54,
|
||||||
0x79, 0x70, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x53, 0x75, 0x62, 0x53, 0x68,
|
0x79, 0x70, 0x65, 0x18, 0x0e, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0b, 0x53, 0x75, 0x62, 0x53, 0x68,
|
||||||
|
|
|
@ -709,13 +709,13 @@ message DB_GameFree {
|
||||||
|
|
||||||
int32 GameType = 8;
|
int32 GameType = 8;
|
||||||
|
|
||||||
int32 SceneType = 9;
|
string Desc = 9;
|
||||||
|
|
||||||
int32 RankType = 10;
|
int32 SceneType = 10;
|
||||||
|
|
||||||
int32 SceneAdd = 11;
|
int32 RankType = 11;
|
||||||
|
|
||||||
string Desc = 12;
|
int32 SceneAdd = 12;
|
||||||
|
|
||||||
int32 ShowType = 13;
|
int32 ShowType = 13;
|
||||||
|
|
||||||
|
|
|
@ -511,7 +511,7 @@ func (this *FriendMgr) FriendApply(p *Player, destP *model.BindFriend) {
|
||||||
// p 同意者
|
// p 同意者
|
||||||
// destP 申请者
|
// destP 申请者
|
||||||
func (this *FriendMgr) FriendAgree(p *Player, destP *model.BindFriend) {
|
func (this *FriendMgr) FriendAgree(p *Player, destP *model.BindFriend) {
|
||||||
var applyList []int32
|
var applyList, meApplyList []int32
|
||||||
SendToClick := func(retCode friend.OpResultCode, self ...bool) {
|
SendToClick := func(retCode friend.OpResultCode, self ...bool) {
|
||||||
pack := &friend.SCFriendOp{
|
pack := &friend.SCFriendOp{
|
||||||
OpCode: proto.Int32(OpTypeAgree),
|
OpCode: proto.Int32(OpTypeAgree),
|
||||||
|
@ -534,6 +534,10 @@ func (this *FriendMgr) FriendAgree(p *Player, destP *model.BindFriend) {
|
||||||
RoleId: int32(roleId),
|
RoleId: int32(roleId),
|
||||||
}
|
}
|
||||||
p.SendToClient(int(friend.FriendPacketID_PACKET_SCFriendOp), pack)
|
p.SendToClient(int(friend.FriendPacketID_PACKET_SCFriendOp), pack)
|
||||||
|
if meApplyList != nil {
|
||||||
|
p.ApplyList = meApplyList
|
||||||
|
this.SendApplyList(p)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
destPs := PlayerMgrSington.GetPlayerBySnId(destP.SnId)
|
destPs := PlayerMgrSington.GetPlayerBySnId(destP.SnId)
|
||||||
if destPs != nil && destPs.IsOnLine() {
|
if destPs != nil && destPs.IsOnLine() {
|
||||||
|
@ -608,52 +612,73 @@ func (this *FriendMgr) FriendAgree(p *Player, destP *model.BindFriend) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ret, err := model.QueryFriendApplyBySnid(p.Platform, p.SnId)
|
// 删除申请者的申请列表
|
||||||
if err != nil {
|
delApplyListFunc := func(plt string, snid int32, applySnid int32) friend.OpResultCode {
|
||||||
return friend.OpResultCode_OPRC_Error
|
// 删除被申请者的申请列表
|
||||||
}
|
list1, err := model.QueryFriendApplyBySnid(plt, snid)
|
||||||
// 维护申请放和被申请方的申请列表
|
if err != nil {
|
||||||
//查看是否在申请列表
|
logger.Logger.Errorf("QueryFriendApplyBySnid %v error: %v", snid, err)
|
||||||
if ret != nil {
|
return friend.OpResultCode_OPRC_Error
|
||||||
if ret.ApplySnids != nil {
|
}
|
||||||
for i, as := range ret.ApplySnids {
|
if list1 != nil {
|
||||||
if as.SnId == destP.SnId {
|
k := 0
|
||||||
// 删除被申请者的申请列表
|
for k < len(list1.ApplySnids) {
|
||||||
ret.ApplySnids = append(ret.ApplySnids[:i], ret.ApplySnids[i+1:]...)
|
if list1.ApplySnids[k].SnId == applySnid {
|
||||||
model.UpsertFriendApply(p.Platform, p.SnId, ret)
|
list1.ApplySnids = append(list1.ApplySnids[:k], list1.ApplySnids[k+1:]...)
|
||||||
|
model.UpsertFriendApply(plt, snid, list1)
|
||||||
// 删除发起方的申请列表
|
} else {
|
||||||
data, err := model.QueryFriendApplyListBySnid(p.Platform, destP.SnId)
|
k++
|
||||||
if err != nil {
|
|
||||||
logger.Logger.Errorf("QueryFriendApplyListBySnid err:%v", err)
|
|
||||||
} else {
|
|
||||||
if data == nil {
|
|
||||||
data = model.NewApplyList(destP.SnId)
|
|
||||||
}
|
|
||||||
for k, v := range data.List {
|
|
||||||
if v == p.SnId {
|
|
||||||
data.List = append(data.List[:k], data.List[k+1:]...)
|
|
||||||
model.UpsertApplyList(p.Platform, data)
|
|
||||||
applyList = data.List
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 保存好友关系
|
|
||||||
if friendDB != nil {
|
|
||||||
friendDB.BindFriend = append(friendDB.BindFriend, &model.BindFriend{
|
|
||||||
SnId: p.SnId,
|
|
||||||
CreateTime: time.Now().Unix(),
|
|
||||||
})
|
|
||||||
model.UpsertFriend(friendDB)
|
|
||||||
}
|
|
||||||
return nil
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 删除发起方的申请列表
|
||||||
|
list2, err := model.QueryFriendApplyListBySnid(plt, applySnid)
|
||||||
|
if err != nil {
|
||||||
|
logger.Logger.Errorf("QueryFriendApplyListBySnid %v error: %v", applySnid, err)
|
||||||
|
return friend.OpResultCode_OPRC_Error
|
||||||
|
}
|
||||||
|
if list2 != nil {
|
||||||
|
k := 0
|
||||||
|
for k < len(list2.List) {
|
||||||
|
if list2.List[k] == snid {
|
||||||
|
list2.List = append(list2.List[:k], list2.List[k+1:]...)
|
||||||
|
model.UpsertApplyList(plt, list2)
|
||||||
|
} else {
|
||||||
|
k++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if applySnid == destP.SnId && list2 != nil {
|
||||||
|
applyList = list2.List
|
||||||
|
}
|
||||||
|
|
||||||
|
if applySnid == p.SnId && list2 != nil {
|
||||||
|
meApplyList = list2.List
|
||||||
|
}
|
||||||
|
|
||||||
|
return friend.OpResultCode_OPRC_Sucess
|
||||||
}
|
}
|
||||||
return friend.OpResultCode_OPRC_Error
|
|
||||||
|
//查看是否在申请列表
|
||||||
|
code := delApplyListFunc(p.Platform, p.SnId, destP.SnId)
|
||||||
|
if code != friend.OpResultCode_OPRC_Sucess {
|
||||||
|
return code
|
||||||
|
}
|
||||||
|
code = delApplyListFunc(p.Platform, destP.SnId, p.SnId)
|
||||||
|
if code != friend.OpResultCode_OPRC_Sucess {
|
||||||
|
return code
|
||||||
|
}
|
||||||
|
// 保存好友关系
|
||||||
|
if friendDB != nil {
|
||||||
|
friendDB.BindFriend = append(friendDB.BindFriend, &model.BindFriend{
|
||||||
|
SnId: p.SnId,
|
||||||
|
CreateTime: time.Now().Unix(),
|
||||||
|
})
|
||||||
|
model.UpsertFriend(friendDB)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}), task.CompleteNotifyWrapper(func(data interface{}, tt task.Task) {
|
}), task.CompleteNotifyWrapper(func(data interface{}, tt task.Task) {
|
||||||
if data != nil {
|
if data != nil {
|
||||||
logger.Logger.Error("FriendAgree data:", data)
|
logger.Logger.Error("FriendAgree data:", data)
|
||||||
|
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue