diff --git a/config-dev.yml b/config-dev.yml index d0b58de..c993a01 100644 --- a/config-dev.yml +++ b/config-dev.yml @@ -1,6 +1,6 @@ Server: Debug: false - Listen: 0.0.0.0:11111 + Listen: 0.0.0.0:22222 UserCenterRpc: Etcd: Hosts: @@ -113,7 +113,7 @@ Game: Zhgww2: GiftEffect: # 辣条 - FreeRestoreHealth: [ 1 ] + Free: [ 1 ] # 小花花 RestoreHealth: [ 31036, 31476 ] SupportSkill: [ ] @@ -121,9 +121,12 @@ Game: Paratroops: [ 31702, 31639, 30758, 30971, 31213, 31478 ] # 打call Reborn: [ 31485, 31641, 31212, 31037, 31278 ] + # 牛哇牛哇 + Overtime: [31039, 31477, 31225, 31214, 31202] TankRatio: 0.1 TankMulThreshold: 40000 TankMulRatio: 0.2 + OvertimeRatio: 6 Log: Console: Level: debug diff --git a/config/zhgww2_config.go b/config/zhgww2_config.go index fddf22c..49cf327 100644 --- a/config/zhgww2_config.go +++ b/config/zhgww2_config.go @@ -4,32 +4,35 @@ package config type ( Zhgww2 struct { GiftEffect struct { - FreeRestoreHealth []int64 // 免费回血 - RestoreHealth []int64 // 恢复生命值 - SupportSkill []int64 // 技能 - Paratroops []int64 // 空降小队 - Reborn []int64 // 复活 + Free []int64 // 免费礼物 + RestoreHealth []int64 // 恢复生命值 + SupportSkill []int64 // 技能 + Paratroops []int64 // 空降小队 + Reborn []int64 // 复活 + Overtime []int64 // 加时道具 } TankMulThreshold int64 // 坦克血量比例阈值 TankMulRatio float32 // 坦克血量阈值内对于金瓜子比例 TankRatio float32 // 坦克血量对于金瓜子比例 + OvertimeRatio int64 // 加时时长比例 电池*ratio = s } GiftType int32 ) const ( GiftTypeUnknown GiftType = iota - GiftFreeRestoreHealth + GiftFree GiftRestoreHealth GiftSupportSkill GiftReborn GiftTank GiftSpecial + GiftOvertime ) func (z Zhgww2) ParseGiftType(id int64) GiftType { - if z.isContains(id, z.GiftEffect.FreeRestoreHealth) { - return GiftFreeRestoreHealth + if z.isContains(id, z.GiftEffect.Free) { + return GiftFree } else if z.isContains(id, z.GiftEffect.RestoreHealth) { return GiftRestoreHealth } else if z.isContains(id, z.GiftEffect.SupportSkill) { @@ -38,6 +41,8 @@ func (z Zhgww2) ParseGiftType(id int64) GiftType { return GiftReborn } else if z.isContains(id, z.GiftEffect.Paratroops) { return GiftSpecial + } else if z.isContains(id, z.GiftEffect.Overtime) { + return GiftOvertime } return GiftTypeUnknown } diff --git a/game/live_logic/ww2_handler.go b/game/live_logic/ww2_handler.go index 88126f8..0494473 100644 --- a/game/live_logic/ww2_handler.go +++ b/game/live_logic/ww2_handler.go @@ -235,15 +235,19 @@ func (h *WW2GameLogic) handleMockGift(liveRoom *LiveRoom, _ string, content []ru case "hp": h.restoreHealth(room, user, count) case "fh": - h.reborn(room, user, 1) + h.reborn(room, user) case "hz": h.supportSpecialBomber(room, user, count*100) case "p": for i := 0; i < int(count); i++ { - h.supportSpecialParatroops(room, user) + h.supportSpecialParatroops(room, user, 1000) } case "tk": h.chargeTank(room, user, count*100) + case "t": + h.overtime(room, user, count*100) + case "b": + h.becomeCommander(room, user) } } @@ -288,23 +292,32 @@ func (h *WW2GameLogic) handleGift(liveRoom *LiveRoom, user *pbCommon.PbUser, gif case config.GiftTypeUnknown: // 空投 h.airdrop(room, user, gift.Price*gift.GiftNum) - case config.GiftFreeRestoreHealth: - h.restoreHealth(room, user, 5*gift.GiftNum) + case config.GiftFree: + for i := 0; i < int(gift.GiftNum); i++ { + h.airdrop(room, user, 1) + } case config.GiftRestoreHealth: h.restoreHealth(room, user, 20*gift.GiftNum) case config.GiftSupportSkill: // TODO 技能 case config.GiftSpecial: - h.supportSpecialParatroops(room, user) + h.supportSpecialParatroops(room, user, gift.Price*gift.GiftNum) case config.GiftReborn: - h.reborn(room, user, gift.GiftNum) + h.reborn(room, user) + case config.GiftOvertime: + h.overtime(room, user, gift.Price*gift.GiftNum) } case pbMq.MqGift_PACK: // 宝箱 h.chargeTank(room, user, gift.Price*gift.GiftNum) case pbMq.MqGift_RED_PACK: // 红包 - h.supportSpecialBomber(room, user, gift.Price*gift.GiftNum) + if gift.Price == 100*100 { + // 100电池 + h.becomeCommander(room, user) + } else { + h.supportSpecialBomber(room, user, gift.Price*gift.GiftNum) + } } } else { // 所有礼物-空投 @@ -336,12 +349,28 @@ func (h *WW2GameLogic) restoreHealth(room *manager.Room, user *pbCommon.PbUser, }) } -func (h *WW2GameLogic) reborn(room *manager.Room, user *pbCommon.PbUser, num int64) { - for i := 0; i < int(num); i++ { - room.Broadcast(pb.PushZhgww2Reborn, &pbGameZhgWW2.Reborn{ - User: user, - }) - } +func (h *WW2GameLogic) reborn(room *manager.Room, user *pbCommon.PbUser) { + room.Broadcast(pb.PushZhgww2Reborn, &pbGameZhgWW2.Reborn{ + User: user, + }) +} + +func (h *WW2GameLogic) overtime(room *manager.Room, user *pbCommon.PbUser, price int64) { + cfg := h.svcCtx.Config.Game.Zhgww2 + + battery := price / 100 + room.Broadcast(pb.PushZhgww2Overtime, &pbGameZhgWW2.Overtime{ + User: user, + Duration: int32(battery * cfg.OvertimeRatio), + }) +} + +func (h *WW2GameLogic) becomeCommander(room *manager.Room, user *pbCommon.PbUser) { + logger.SLog.Debugf("用户 [%s] 暂时成为指挥官", user.Username) + room.Broadcast(pb.PushZhgww2BecomeCommander, &pbGameZhgWW2.BecomeCommander{ + User: user, + Rand: 0, + }) } func (h *WW2GameLogic) chargeTank(room *manager.Room, user *pbCommon.PbUser, price int64) { @@ -359,11 +388,12 @@ func (h *WW2GameLogic) chargeTank(room *manager.Room, user *pbCommon.PbUser, pri }) } -func (h *WW2GameLogic) supportSpecialParatroops(room *manager.Room, user *pbCommon.PbUser) { +func (h *WW2GameLogic) supportSpecialParatroops(room *manager.Room, user *pbCommon.PbUser, price int64) { + battery := price / 100 room.Broadcast(pb.PushZhgww2SupportSpecial, &pbGameZhgWW2.SupportSpecial{ User: user, Type: pbGameZhgWW2.SupportSpecial_PARATROOPS, - Count: 10, + Count: int32(battery / 2), }) } diff --git a/game/pb/game/zhgww2/Command.cs b/game/pb/game/zhgww2/Command.cs index 2b00c2f..6386996 100644 --- a/game/pb/game/zhgww2/Command.cs +++ b/game/pb/game/zhgww2/Command.cs @@ -44,8 +44,11 @@ namespace Pb.Game.Zhgww2 { "cGIuZ2FtZS56aGd3dzIuU3VwcG9ydFNwZWNpYWwuVHlwZRINCgVjb3VudBgD", "IAEoBSIiCgRUeXBlEg4KClBBUkFUUk9PUFMQABIKCgZCT01CRVIQASJACg5T", "dXBwb3J0QWlyZHJvcBIfCgR1c2VyGAEgASgLMhEucGIuY29tbW9uLlBiVXNl", - "chINCgVsZXZlbBgCIAEoBUImWiRkY2cvZ2FtZS9wYi9nYW1lL3poZ3d3Mjtw", - "YkdhbWVaaGdXVzJiBnByb3RvMw==")); + "chINCgVsZXZlbBgCIAEoBSI9CghPdmVydGltZRIfCgR1c2VyGAEgASgLMhEu", + "cGIuY29tbW9uLlBiVXNlchIQCghkdXJhdGlvbhgCIAEoBSJACg9CZWNvbWVD", + "b21tYW5kZXISHwoEdXNlchgBIAEoCzIRLnBiLmNvbW1vbi5QYlVzZXISDAoE", + "cmFuZBgCIAEoBUImWiRkY2cvZ2FtZS9wYi9nYW1lL3poZ3d3MjtwYkdhbWVa", + "aGdXVzJiBnByb3RvMw==")); descriptor = pbr::FileDescriptor.FromGeneratedCode(descriptorData, new pbr::FileDescriptor[] { global::Pb.Common.CommonReflection.Descriptor, }, new pbr::GeneratedClrTypeInfo(null, null, new pbr::GeneratedClrTypeInfo[] { @@ -59,7 +62,9 @@ namespace Pb.Game.Zhgww2 { new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhgww2.SupportSkill), global::Pb.Game.Zhgww2.SupportSkill.Parser, new[]{ "User", "Skill" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhgww2.ChargeTank), global::Pb.Game.Zhgww2.ChargeTank.Parser, new[]{ "User", "Value" }, null, null, null, null), new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhgww2.SupportSpecial), global::Pb.Game.Zhgww2.SupportSpecial.Parser, new[]{ "User", "Type", "Count" }, null, new[]{ typeof(global::Pb.Game.Zhgww2.SupportSpecial.Types.Type) }, null, null), - new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhgww2.SupportAirdrop), global::Pb.Game.Zhgww2.SupportAirdrop.Parser, new[]{ "User", "Level" }, null, null, null, null) + new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhgww2.SupportAirdrop), global::Pb.Game.Zhgww2.SupportAirdrop.Parser, new[]{ "User", "Level" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhgww2.Overtime), global::Pb.Game.Zhgww2.Overtime.Parser, new[]{ "User", "Duration" }, null, null, null, null), + new pbr::GeneratedClrTypeInfo(typeof(global::Pb.Game.Zhgww2.BecomeCommander), global::Pb.Game.Zhgww2.BecomeCommander.Parser, new[]{ "User", "Rand" }, null, null, null, null) })); } #endregion @@ -2933,6 +2938,488 @@ namespace Pb.Game.Zhgww2 { } + /// + /// 加时 push -> game.control.overtime + /// + public sealed partial class Overtime : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new Overtime()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pb.Game.Zhgww2.CommandReflection.Descriptor.MessageTypes[11]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Overtime() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Overtime(Overtime other) : this() { + user_ = other.user_ != null ? other.user_.Clone() : null; + duration_ = other.duration_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public Overtime Clone() { + return new Overtime(this); + } + + /// Field number for the "user" field. + public const int UserFieldNumber = 1; + private global::Pb.Common.PbUser user_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Pb.Common.PbUser User { + get { return user_; } + set { + user_ = value; + } + } + + /// Field number for the "duration" field. + public const int DurationFieldNumber = 2; + private int duration_; + /// + /// 具体加时时长,单位:秒 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Duration { + get { return duration_; } + set { + duration_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as Overtime); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(Overtime other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(User, other.User)) return false; + if (Duration != other.Duration) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (user_ != null) hash ^= User.GetHashCode(); + if (Duration != 0) hash ^= Duration.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (user_ != null) { + output.WriteRawTag(10); + output.WriteMessage(User); + } + if (Duration != 0) { + output.WriteRawTag(16); + output.WriteInt32(Duration); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (user_ != null) { + output.WriteRawTag(10); + output.WriteMessage(User); + } + if (Duration != 0) { + output.WriteRawTag(16); + output.WriteInt32(Duration); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (user_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(User); + } + if (Duration != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Duration); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(Overtime other) { + if (other == null) { + return; + } + if (other.user_ != null) { + if (user_ == null) { + User = new global::Pb.Common.PbUser(); + } + User.MergeFrom(other.User); + } + if (other.Duration != 0) { + Duration = other.Duration; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (user_ == null) { + User = new global::Pb.Common.PbUser(); + } + input.ReadMessage(User); + break; + } + case 16: { + Duration = input.ReadInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (user_ == null) { + User = new global::Pb.Common.PbUser(); + } + input.ReadMessage(User); + break; + } + case 16: { + Duration = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + + /// + /// 成为指挥官 push -> game.become.commander + /// + public sealed partial class BecomeCommander : pb::IMessage + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + , pb::IBufferMessage + #endif + { + private static readonly pb::MessageParser _parser = new pb::MessageParser(() => new BecomeCommander()); + private pb::UnknownFieldSet _unknownFields; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pb::MessageParser Parser { get { return _parser; } } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public static pbr::MessageDescriptor Descriptor { + get { return global::Pb.Game.Zhgww2.CommandReflection.Descriptor.MessageTypes[12]; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + pbr::MessageDescriptor pb::IMessage.Descriptor { + get { return Descriptor; } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public BecomeCommander() { + OnConstruction(); + } + + partial void OnConstruction(); + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public BecomeCommander(BecomeCommander other) : this() { + user_ = other.user_ != null ? other.user_.Clone() : null; + rand_ = other.rand_; + _unknownFields = pb::UnknownFieldSet.Clone(other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public BecomeCommander Clone() { + return new BecomeCommander(this); + } + + /// Field number for the "user" field. + public const int UserFieldNumber = 1; + private global::Pb.Common.PbUser user_; + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public global::Pb.Common.PbUser User { + get { return user_; } + set { + user_ = value; + } + } + + /// Field number for the "rand" field. + public const int RandFieldNumber = 2; + private int rand_; + /// + /// 随机到的数值 + /// + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int Rand { + get { return rand_; } + set { + rand_ = value; + } + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override bool Equals(object other) { + return Equals(other as BecomeCommander); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public bool Equals(BecomeCommander other) { + if (ReferenceEquals(other, null)) { + return false; + } + if (ReferenceEquals(other, this)) { + return true; + } + if (!object.Equals(User, other.User)) return false; + if (Rand != other.Rand) return false; + return Equals(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override int GetHashCode() { + int hash = 1; + if (user_ != null) hash ^= User.GetHashCode(); + if (Rand != 0) hash ^= Rand.GetHashCode(); + if (_unknownFields != null) { + hash ^= _unknownFields.GetHashCode(); + } + return hash; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public override string ToString() { + return pb::JsonFormatter.ToDiagnosticString(this); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void WriteTo(pb::CodedOutputStream output) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + output.WriteRawMessage(this); + #else + if (user_ != null) { + output.WriteRawTag(10); + output.WriteMessage(User); + } + if (Rand != 0) { + output.WriteRawTag(16); + output.WriteInt32(Rand); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(output); + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalWriteTo(ref pb::WriteContext output) { + if (user_ != null) { + output.WriteRawTag(10); + output.WriteMessage(User); + } + if (Rand != 0) { + output.WriteRawTag(16); + output.WriteInt32(Rand); + } + if (_unknownFields != null) { + _unknownFields.WriteTo(ref output); + } + } + #endif + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public int CalculateSize() { + int size = 0; + if (user_ != null) { + size += 1 + pb::CodedOutputStream.ComputeMessageSize(User); + } + if (Rand != 0) { + size += 1 + pb::CodedOutputStream.ComputeInt32Size(Rand); + } + if (_unknownFields != null) { + size += _unknownFields.CalculateSize(); + } + return size; + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(BecomeCommander other) { + if (other == null) { + return; + } + if (other.user_ != null) { + if (user_ == null) { + User = new global::Pb.Common.PbUser(); + } + User.MergeFrom(other.User); + } + if (other.Rand != 0) { + Rand = other.Rand; + } + _unknownFields = pb::UnknownFieldSet.MergeFrom(_unknownFields, other._unknownFields); + } + + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + public void MergeFrom(pb::CodedInputStream input) { + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + input.ReadRawMessage(this); + #else + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, input); + break; + case 10: { + if (user_ == null) { + User = new global::Pb.Common.PbUser(); + } + input.ReadMessage(User); + break; + } + case 16: { + Rand = input.ReadInt32(); + break; + } + } + } + #endif + } + + #if !GOOGLE_PROTOBUF_REFSTRUCT_COMPATIBILITY_MODE + [global::System.Diagnostics.DebuggerNonUserCodeAttribute] + [global::System.CodeDom.Compiler.GeneratedCode("protoc", null)] + void pb::IBufferMessage.InternalMergeFrom(ref pb::ParseContext input) { + uint tag; + while ((tag = input.ReadTag()) != 0) { + switch(tag) { + default: + _unknownFields = pb::UnknownFieldSet.MergeFieldFrom(_unknownFields, ref input); + break; + case 10: { + if (user_ == null) { + User = new global::Pb.Common.PbUser(); + } + input.ReadMessage(User); + break; + } + case 16: { + Rand = input.ReadInt32(); + break; + } + } + } + } + #endif + + } + #endregion } diff --git a/game/pb/game/zhgww2/command.pb.go b/game/pb/game/zhgww2/command.pb.go index 8826e7c..cf3fc3c 100644 --- a/game/pb/game/zhgww2/command.pb.go +++ b/game/pb/game/zhgww2/command.pb.go @@ -723,6 +723,118 @@ func (x *SupportAirdrop) GetLevel() int32 { return 0 } +// 加时 push -> game.control.overtime +type Overtime struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *common.PbUser `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + Duration int32 `protobuf:"varint,2,opt,name=duration,proto3" json:"duration,omitempty"` // 具体加时时长,单位:秒 +} + +func (x *Overtime) Reset() { + *x = Overtime{} + if protoimpl.UnsafeEnabled { + mi := &file_game_zhgww2_command_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Overtime) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Overtime) ProtoMessage() {} + +func (x *Overtime) ProtoReflect() protoreflect.Message { + mi := &file_game_zhgww2_command_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 Overtime.ProtoReflect.Descriptor instead. +func (*Overtime) Descriptor() ([]byte, []int) { + return file_game_zhgww2_command_proto_rawDescGZIP(), []int{11} +} + +func (x *Overtime) GetUser() *common.PbUser { + if x != nil { + return x.User + } + return nil +} + +func (x *Overtime) GetDuration() int32 { + if x != nil { + return x.Duration + } + return 0 +} + +// 成为指挥官 push -> game.become.commander +type BecomeCommander struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + User *common.PbUser `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"` + Rand int32 `protobuf:"varint,2,opt,name=rand,proto3" json:"rand,omitempty"` // 随机到的数值 +} + +func (x *BecomeCommander) Reset() { + *x = BecomeCommander{} + if protoimpl.UnsafeEnabled { + mi := &file_game_zhgww2_command_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BecomeCommander) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BecomeCommander) ProtoMessage() {} + +func (x *BecomeCommander) ProtoReflect() protoreflect.Message { + mi := &file_game_zhgww2_command_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 BecomeCommander.ProtoReflect.Descriptor instead. +func (*BecomeCommander) Descriptor() ([]byte, []int) { + return file_game_zhgww2_command_proto_rawDescGZIP(), []int{12} +} + +func (x *BecomeCommander) GetUser() *common.PbUser { + if x != nil { + return x.User + } + return nil +} + +func (x *BecomeCommander) GetRand() int32 { + if x != nil { + return x.Rand + } + return 0 +} + var File_game_zhgww2_command_proto protoreflect.FileDescriptor var file_game_zhgww2_command_proto_rawDesc = []byte{ @@ -795,10 +907,20 @@ var file_game_zhgww2_command_proto_rawDesc = []byte{ 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x62, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, - 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x42, 0x26, 0x5a, 0x24, 0x64, 0x63, 0x67, 0x2f, 0x67, 0x61, - 0x6d, 0x65, 0x2f, 0x70, 0x62, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x7a, 0x68, 0x67, 0x77, 0x77, - 0x32, 0x3b, 0x70, 0x62, 0x47, 0x61, 0x6d, 0x65, 0x5a, 0x68, 0x67, 0x57, 0x57, 0x32, 0x62, 0x06, - 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, + 0x05, 0x6c, 0x65, 0x76, 0x65, 0x6c, 0x22, 0x4d, 0x0a, 0x08, 0x4f, 0x76, 0x65, 0x72, 0x74, 0x69, + 0x6d, 0x65, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, + 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, 0x6f, 0x6e, 0x2e, 0x50, 0x62, 0x55, + 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x64, 0x75, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x64, 0x75, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x4c, 0x0a, 0x0f, 0x42, 0x65, 0x63, 0x6f, 0x6d, 0x65, 0x43, + 0x6f, 0x6d, 0x6d, 0x61, 0x6e, 0x64, 0x65, 0x72, 0x12, 0x25, 0x0a, 0x04, 0x75, 0x73, 0x65, 0x72, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x11, 0x2e, 0x70, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x6d, + 0x6f, 0x6e, 0x2e, 0x50, 0x62, 0x55, 0x73, 0x65, 0x72, 0x52, 0x04, 0x75, 0x73, 0x65, 0x72, 0x12, + 0x12, 0x0a, 0x04, 0x72, 0x61, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x72, + 0x61, 0x6e, 0x64, 0x42, 0x26, 0x5a, 0x24, 0x64, 0x63, 0x67, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, + 0x70, 0x62, 0x2f, 0x67, 0x61, 0x6d, 0x65, 0x2f, 0x7a, 0x68, 0x67, 0x77, 0x77, 0x32, 0x3b, 0x70, + 0x62, 0x47, 0x61, 0x6d, 0x65, 0x5a, 0x68, 0x67, 0x57, 0x57, 0x32, 0x62, 0x06, 0x70, 0x72, 0x6f, + 0x74, 0x6f, 0x33, } var ( @@ -814,7 +936,7 @@ func file_game_zhgww2_command_proto_rawDescGZIP() []byte { } var file_game_zhgww2_command_proto_enumTypes = make([]protoimpl.EnumInfo, 1) -var file_game_zhgww2_command_proto_msgTypes = make([]protoimpl.MessageInfo, 11) +var file_game_zhgww2_command_proto_msgTypes = make([]protoimpl.MessageInfo, 13) var file_game_zhgww2_command_proto_goTypes = []interface{}{ (SupportSpecial_Type)(0), // 0: pb.game.zhgww2.SupportSpecial.Type (*JoinGame)(nil), // 1: pb.game.zhgww2.JoinGame @@ -828,26 +950,30 @@ var file_game_zhgww2_command_proto_goTypes = []interface{}{ (*ChargeTank)(nil), // 9: pb.game.zhgww2.ChargeTank (*SupportSpecial)(nil), // 10: pb.game.zhgww2.SupportSpecial (*SupportAirdrop)(nil), // 11: pb.game.zhgww2.SupportAirdrop - (*common.PbUser)(nil), // 12: pb.common.PbUser + (*Overtime)(nil), // 12: pb.game.zhgww2.Overtime + (*BecomeCommander)(nil), // 13: pb.game.zhgww2.BecomeCommander + (*common.PbUser)(nil), // 14: pb.common.PbUser } var file_game_zhgww2_command_proto_depIdxs = []int32{ - 12, // 0: pb.game.zhgww2.JoinGame.user:type_name -> pb.common.PbUser - 12, // 1: pb.game.zhgww2.JoinGameReq.user:type_name -> pb.common.PbUser - 12, // 2: pb.game.zhgww2.JoinGameResp.user:type_name -> pb.common.PbUser - 12, // 3: pb.game.zhgww2.ChangeUnit.user:type_name -> pb.common.PbUser - 12, // 4: pb.game.zhgww2.Attack.user:type_name -> pb.common.PbUser - 12, // 5: pb.game.zhgww2.RestoreHealth.user:type_name -> pb.common.PbUser - 12, // 6: pb.game.zhgww2.Reborn.user:type_name -> pb.common.PbUser - 12, // 7: pb.game.zhgww2.SupportSkill.user:type_name -> pb.common.PbUser - 12, // 8: pb.game.zhgww2.ChargeTank.user:type_name -> pb.common.PbUser - 12, // 9: pb.game.zhgww2.SupportSpecial.user:type_name -> pb.common.PbUser + 14, // 0: pb.game.zhgww2.JoinGame.user:type_name -> pb.common.PbUser + 14, // 1: pb.game.zhgww2.JoinGameReq.user:type_name -> pb.common.PbUser + 14, // 2: pb.game.zhgww2.JoinGameResp.user:type_name -> pb.common.PbUser + 14, // 3: pb.game.zhgww2.ChangeUnit.user:type_name -> pb.common.PbUser + 14, // 4: pb.game.zhgww2.Attack.user:type_name -> pb.common.PbUser + 14, // 5: pb.game.zhgww2.RestoreHealth.user:type_name -> pb.common.PbUser + 14, // 6: pb.game.zhgww2.Reborn.user:type_name -> pb.common.PbUser + 14, // 7: pb.game.zhgww2.SupportSkill.user:type_name -> pb.common.PbUser + 14, // 8: pb.game.zhgww2.ChargeTank.user:type_name -> pb.common.PbUser + 14, // 9: pb.game.zhgww2.SupportSpecial.user:type_name -> pb.common.PbUser 0, // 10: pb.game.zhgww2.SupportSpecial.type:type_name -> pb.game.zhgww2.SupportSpecial.Type - 12, // 11: pb.game.zhgww2.SupportAirdrop.user:type_name -> pb.common.PbUser - 12, // [12:12] is the sub-list for method output_type - 12, // [12:12] is the sub-list for method input_type - 12, // [12:12] is the sub-list for extension type_name - 12, // [12:12] is the sub-list for extension extendee - 0, // [0:12] is the sub-list for field type_name + 14, // 11: pb.game.zhgww2.SupportAirdrop.user:type_name -> pb.common.PbUser + 14, // 12: pb.game.zhgww2.Overtime.user:type_name -> pb.common.PbUser + 14, // 13: pb.game.zhgww2.BecomeCommander.user:type_name -> pb.common.PbUser + 14, // [14:14] is the sub-list for method output_type + 14, // [14:14] is the sub-list for method input_type + 14, // [14:14] is the sub-list for extension type_name + 14, // [14:14] is the sub-list for extension extendee + 0, // [0:14] is the sub-list for field type_name } func init() { file_game_zhgww2_command_proto_init() } @@ -988,6 +1114,30 @@ func file_game_zhgww2_command_proto_init() { return nil } } + file_game_zhgww2_command_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Overtime); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_game_zhgww2_command_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BecomeCommander); 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{ @@ -995,7 +1145,7 @@ func file_game_zhgww2_command_proto_init() { GoPackagePath: reflect.TypeOf(x{}).PkgPath(), RawDescriptor: file_game_zhgww2_command_proto_rawDesc, NumEnums: 1, - NumMessages: 11, + NumMessages: 13, NumExtensions: 0, NumServices: 0, }, diff --git a/game/pb/game/zhgww2/command.proto b/game/pb/game/zhgww2/command.proto index a310d0e..bb0e2be 100644 --- a/game/pb/game/zhgww2/command.proto +++ b/game/pb/game/zhgww2/command.proto @@ -81,4 +81,16 @@ message SupportSpecial { message SupportAirdrop { pb.common.PbUser user = 1; int32 level = 2; // 档次 1 -> 2 -> 3 +} + +// 加时 push -> game.control.overtime +message Overtime { + pb.common.PbUser user = 1; + int32 duration = 2; // 具体加时时长,单位:秒 +} + +// 成为指挥官 push -> game.become.commander +message BecomeCommander { + pb.common.PbUser user = 1; + int32 rand = 2; // 随机到的数值 } \ No newline at end of file diff --git a/game/pb/routes.go b/game/pb/routes.go index de39f2c..aefcf6b 100644 --- a/game/pb/routes.go +++ b/game/pb/routes.go @@ -47,10 +47,12 @@ const ( PushZhgww2ChangeUnit = "game.unit.change" PushZhgww2Attack = "game.attack" - PushZhgww2RestoreHealth = "game.restoreHealth" - PushZhgww2SupportSkill = "game.support.skill" - PushZhgww2ChargeTank = "game.chargeTank" - PushZhgww2SupportSpecial = "game.support.special" - PushZhgww2SupportAirdrop = "game.support.airdrop" - PushZhgww2Reborn = "game.reborn" + PushZhgww2RestoreHealth = "game.restoreHealth" + PushZhgww2SupportSkill = "game.support.skill" + PushZhgww2ChargeTank = "game.chargeTank" + PushZhgww2SupportSpecial = "game.support.special" + PushZhgww2SupportAirdrop = "game.support.airdrop" + PushZhgww2Reborn = "game.reborn" + PushZhgww2Overtime = "game.control.overtime" + PushZhgww2BecomeCommander = "game.become.commander" )