当前位置: 首页>>代码示例>>C#>>正文


C# GSPacketIn.WriteInt方法代码示例

本文整理汇总了C#中Game.Base.Packets.GSPacketIn.WriteInt方法的典型用法代码示例。如果您正苦于以下问题:C# GSPacketIn.WriteInt方法的具体用法?C# GSPacketIn.WriteInt怎么用?C# GSPacketIn.WriteInt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Game.Base.Packets.GSPacketIn的用法示例。


在下文中一共展示了GSPacketIn.WriteInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.CurrentRoom == null)
                return 0;


            int id = packet.ReadInt();
            GamePlayer player = Managers.WorldMgr.GetPlayerById(id);

            if (player == client.Player)
                return 0;

            List<GamePlayer> players = client.Player.CurrentRoom.GetPlayers();
            foreach (GamePlayer p in players)
            {
                if (p == player)
                {
                    client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("friendnotinthesameserver.Sameroom"));
                    return 0;
                }
            }

            GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_INVITE);
            if (player != null && player.CurrentRoom == null)
            {

                pkg.WriteInt(client.Player.PlayerCharacter.ID);
                pkg.WriteInt(client.Player.CurrentRoom.RoomId);
                pkg.WriteInt(client.Player.CurrentRoom.MapId);
                pkg.WriteByte((byte)client.Player.CurrentRoom.TimeMode);
                pkg.WriteByte((byte)client.Player.CurrentRoom.RoomType);
                pkg.WriteByte((byte)client.Player.CurrentRoom.HardLevel);
                pkg.WriteByte((byte)client.Player.CurrentRoom.LevelLimits);
                pkg.WriteString(client.Player.PlayerCharacter.NickName);
                pkg.WriteBoolean(true);
                pkg.WriteInt(5);
                pkg.WriteString(client.Player.CurrentRoom.Name);
                pkg.WriteString(client.Player.CurrentRoom.Password);

                //TrieuLSL BN IMInvite barrierNum
                pkg.WriteInt(50);


                player.Out.SendTCP(pkg);
            }
            else
            {
                if (player != null && player.CurrentRoom != null && player.CurrentRoom != client.Player.CurrentRoom)
                {

                    client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("friendnotinthesameserver.Room"));
                }
                else
                {
                    client.Out.SendMessage(eMessageType.ERROR, LanguageMgr.GetTranslation("friendnotinthesameserver.Fail"));
                }
            }
            return 0;
        }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:59,代码来源:GameInviteHandler.cs

示例2: SendBufferList

 public static GSPacketIn SendBufferList(Player player, List<BufferInfo> infos)
 {
     GSPacketIn pkg = new GSPacketIn((byte)ePackageType.BUFF_OBTAIN, player.Id);
     pkg.WriteInt(infos.Count);
     foreach (BufferInfo info in infos)
     {
         pkg.WriteInt(info.Type);
         pkg.WriteBoolean(info.IsExist);
         pkg.WriteDateTime(info.BeginDate);
         pkg.WriteInt(info.ValidDate);
         pkg.WriteInt(info.Value);
     }
     return pkg;
 }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:14,代码来源:GameMgr.cs

示例3: HandlePacket

 public int HandlePacket(GameClient client, GSPacketIn packet)
 {
     //Lay Danh Sach tat ca cac phong
     GSPacketIn pkg = new GSPacketIn((byte)ePackageType.HOTSPRING_ROOM_LIST_GET);
     pkg.WriteInt(10);
     for (int i = 0; i < 10; i++)
     {
         //loc_2.roomNumber = _loc_3.readInt();
         pkg.WriteInt(i);
         //_loc_2.roomID = _loc_3.readInt();
         pkg.WriteInt(i);
         //_loc_2.roomName = _loc_3.readUTF();
         pkg.WriteString("Room" + i);
         //_loc_2.roomPassword = _loc_3.readUTF();
         pkg.WriteString("");
         //_loc_2.effectiveTime = _loc_3.readInt();
         pkg.WriteInt(1);
         //_loc_2.curCount = _loc_3.readInt();
         pkg.WriteInt(1);
         //_loc_2.playerID = _loc_3.readInt();
         pkg.WriteInt(client.Player.PlayerCharacter.ID);
         //_loc_2.playerName = _loc_3.readUTF();
         pkg.WriteString("abc");
         //_loc_2.startTime = _loc_3.readDate();
         pkg.WriteDateTime(DateTime.Now.AddDays(-50));
         //_loc_2.roomIntroduction = _loc_3.readUTF();
         pkg.WriteString("Room Intro");
         //_loc_2.roomType = _loc_3.readInt();
         pkg.WriteInt(1);
         //_loc_2.maxCount = _loc_3.readInt();
         pkg.WriteInt(10);
     }
     client.SendTCP(pkg);
     return 0;
 }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:35,代码来源:HotSpringEnterHandler.cs

示例4: OnTick

        public override void OnTick(HotSpringRoom room)
        {
            try 
            {
                if(room != null)
                {
                    room.KickAllPlayer();

                    //using(PlayerBussiness db = new PlayerBussiness())
                    //{
                    //    db.DisposeHotSpringRoomInfo(room.Info.ID);
                    //}

                    //GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(room.Info.GroomID);
                    //GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(room.Info.BrideID);

                    //GameServer.Instance.LoginServer.SendHotSpringRoomInfoToPlayer(room.Info.GroomID, false, room.Info);
                    //GameServer.Instance.LoginServer.SendHotSpringRoomInfoToPlayer(room.Info.BrideID, false, room.Info);

                    //HotSpringRoomMgr.RemoveHotSpringRoom(room);

                    GSPacketIn pkg = new GSPacketIn((short)ePackageType.MARRY_ROOM_DISPOSE);
                    pkg.WriteInt(room.Info.ID);
                    WorldMgr.MarryScene.SendToALL(pkg);

                    room.StopTimer();
                }
            }
            catch(Exception ex)
            {
                if (log.IsErrorEnabled)
                    log.Error("OnTick",ex);
            }
        }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:34,代码来源:TankHotSpringLogicProcessor.cs

示例5: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 0;

            int id = client.Player.PlayerCharacter.ConsortiaID;
            string consortiaName = client.Player.PlayerCharacter.ConsortiaName;
            bool result = false;
            string msg = "ConsortiaDisbandHandler.Failed";
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                if (db.DeleteConsortia(client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, ref msg))
                {
                    result = true;
                    msg = "ConsortiaDisbandHandler.Success1";

                    client.Player.ClearConsortia();

                    GameServer.Instance.LoginServer.SendConsortiaDelete(id);
                }
            }

            string temp = LanguageMgr.GetTranslation(msg);
            if (msg == "ConsortiaDisbandHandler.Success1")
            {
                temp += consortiaName + LanguageMgr.GetTranslation("ConsortiaDisbandHandler.Success2");
            }

            packet.WriteBoolean(result);
            packet.WriteInt(client.Player.PlayerCharacter.ID);
            packet.WriteString(temp);
            client.Out.SendTCP(packet);

            return 0;
        }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:35,代码来源:ConsortiaDisbandHandler.cs

示例6: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 0;

            if (client.Player.PlayerCharacter.IsBanChat)
            {
                client.Out.SendMessage(eMessageType.ChatERROR, LanguageMgr.GetTranslation("ConsortiaChatHandler.IsBanChat"));
                return 1;
            }

            packet.ClientID = (client.Player.PlayerCharacter.ID);
            byte channel = packet.ReadByte();
            string nick = packet.ReadString();
            string msg = packet.ReadString();
            packet.WriteInt(client.Player.PlayerCharacter.ConsortiaID);

            GamePlayer[] players = WorldMgr.GetAllPlayers();
            foreach (GamePlayer p in players)
            {
                if (p.PlayerCharacter.ConsortiaID == client.Player.PlayerCharacter.ConsortiaID)
                    p.Out.SendTCP(packet);
            }

            GameServer.Instance.LoginServer.SendPacket(packet);

            return 0;
        }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:28,代码来源:ConsortiaChatHandler.cs

示例7: HandlePacket

 public int HandlePacket(GameClient client, GSPacketIn packet)
 {
     int val = packet.ReadInt();
     GSPacketIn pkg = new GSPacketIn(0xd4);
     pkg.WriteInt(val);
     client.SendTCP(pkg);
     return 0;
 }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:8,代码来源:HotSpringEnterConfirmHandler.cs

示例8: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 0;


            bool result = false;
            string msg = "ConsortiaSmithUpGradeHandler.Failed";

            //using (ConsortiaBussiness db = new ConsortiaBussiness())
            //{
            //    ConsortiaInfo info = db.GetConsortiaSingle(client.Player.PlayerCharacter.ConsortiaID);
            ConsortiaInfo info = Managers.ConsortiaMgr.FindConsortiaInfo(client.Player.PlayerCharacter.ConsortiaID);
            if (info == null)
            {
                msg = "ConsortiaSmithUpGradeHandler.NoConsortia";
            }
            else
            {
                using (ConsortiaBussiness cb = new ConsortiaBussiness())
                {
                    if (cb.UpGradeSmithConsortia(client.Player.PlayerCharacter.ConsortiaID, client.Player.PlayerCharacter.ID, ref msg))
                    {
                        info.SmithLevel++;
                        GameServer.Instance.LoginServer.SendConsortiaSmithUpGrade(info);
                        msg = "ConsortiaSmithUpGradeHandler.Success";
                        result = true;
                    }
                }
            }
            if (info.SmithLevel >= 3)
            {
                string msg1 = LanguageMgr.GetTranslation("ConsortiaSmithUpGradeHandler.Notice", client.Player.PlayerCharacter.ConsortiaName, info.SmithLevel);

                GSPacketIn pkg = new GSPacketIn((byte)ePackageType.SYS_NOTICE);
                pkg.WriteInt(2);
                pkg.WriteString(msg1);

                GameServer.Instance.LoginServer.SendPacket(pkg);

                GamePlayer[] players = Game.Server.Managers.WorldMgr.GetAllPlayers();

                foreach (GamePlayer p in players)
                {
                    if (p != client.Player)
                        p.Out.SendTCP(pkg);
                }
            }
            //}


            packet.WriteBoolean(result);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);


            return 1;
        }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:58,代码来源:ConsortiaSmithUpGradeHandler.cs

示例9: HandleCommand

 public void  HandleCommand(BaseGame game, Player player, GSPacketIn packet)
 {
     if (game.GameState == eGameState.Loading)
     {
         player.LoadingProcess = packet.ReadInt();
         if (player.LoadingProcess >= 100)
         {
             game.CheckState(0);
         }
        var pkg = new GSPacketIn((short)ePackageType.GAME_CMD);
         pkg.WriteByte((byte)eTankCmdType.LOAD);
         //var pkg = packet.Clone();
       //  pkg.ClearContext();
         pkg.WriteInt(player.LoadingProcess);
         pkg.WriteInt(4);
         pkg.WriteInt(player.PlayerDetail.PlayerCharacter.ID);
         game.SendToAll(pkg);
     }
 }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:19,代码来源:LoadCommand.cs

示例10: HandlePacket

 public int HandlePacket(GameClient client, GSPacketIn packet)
 {
     var roomId = packet.ReadInt();
     //if (client.Player.CurrentHotSpringRoom != null)
     //{
     //    client.Player.CurrentHotSpringRoom.ProcessData(client.Player, packet);
     //}
     GSPacketIn pkg = new GSPacketIn((byte)ePackageType.HOTSPRING_ROOM_ENTER_CONFIRM);
     pkg.WriteInt(roomId);
     client.SendTCP(pkg);
     return 0;
 }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:12,代码来源:HotSpringEnterConfirmHandler.cs

示例11: ExecuteImp

        protected override void ExecuteImp(BaseGame game, long tick)
        {
            GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD, m_living.Id);

            pkg.Parameter1 = m_living.Id;
            pkg.WriteByte((byte)eTankCmdType.LIVING_RANGEATTACKING);

            List<Living> playersAround = game.Map.FindPlayers(m_fx, m_tx, m_players);
            int count = playersAround.Count;
            foreach (Living p in playersAround)
            {
                if (m_living.IsFriendly(p) == true)
                    count--;
            }
            pkg.WriteInt(count);
            m_living.SyncAtTime = false;
            try
            {
                foreach (Living p in playersAround)
                {
                    p.SyncAtTime = false;

                    if (m_living.IsFriendly(p) == true)
                        continue;
                    int dander = 0;
                    p.IsFrost = false;
                    game.SendGameUpdateFrozenState(p);
                    int damage = MakeDamage(p);
                    int critical = MakeCriticalDamage(p, damage);
                    int totalDemageAmount = 0;
                    if (p.TakeDamage(m_living, ref damage, ref critical, "范围攻击"))
                    {
                        totalDemageAmount = damage + critical;
                        if (p is Player)
                        {
                            Player player = p as Player;
                            dander = player.Dander;
                        }
                    }
                    pkg.WriteInt(p.Id);
                    pkg.WriteInt(totalDemageAmount);
                    pkg.WriteInt(p.Blood);
                    //同步怒气值
                    pkg.WriteInt(dander);
                    //attackEffect
                    pkg.WriteInt(new Random().Next(2));
                }
                game.SendToAll(pkg);

                Finish(tick);
            }
            finally
            {
                m_living.SyncAtTime = true;
                foreach (Living p in playersAround)
                {
                    p.SyncAtTime = true;
                }
            }
        }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:60,代码来源:LivingRangeAttackingAction.cs

示例12: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID == 0)
                return 0;

            int dutyID = packet.ReadInt();
            int updateType = packet.ReadByte();
            //int level = packet.ReadInt();
            bool result = false;
            string msg = "ConsortiaDutyUpdateHandler.Failed";

            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                ConsortiaDutyInfo info = new ConsortiaDutyInfo();
                info.ConsortiaID = client.Player.PlayerCharacter.ConsortiaID;
                info.DutyID = dutyID;
                info.IsExist = true;
                info.DutyName = "";
                switch (updateType)
                {
                    case 1:
                        return 1;
                    case 2:
                        info.DutyName = packet.ReadString();
                        if (string.IsNullOrEmpty(info.DutyName) || System.Text.Encoding.Default.GetByteCount(info.DutyName) > 10)
                        {
                            client.Out.SendMessage(eMessageType.Normal, LanguageMgr.GetTranslation("ConsortiaDutyUpdateHandler.Long"));
                            return 1;
                        }
                        info.Right = packet.ReadInt();
                        break;
                    case 3:
                        break;
                    case 4:
                        break;
                }

                if (db.UpdateConsortiaDuty(info, client.Player.PlayerCharacter.ID, updateType, ref msg))
                {
                    dutyID = info.DutyID;
                    msg = "ConsortiaDutyUpdateHandler.Success";
                    result = true;
                    GameServer.Instance.LoginServer.SendConsortiaDuty(info, updateType, client.Player.PlayerCharacter.ConsortiaID);
                }
            }
            packet.WriteBoolean(result);
            packet.WriteInt(dutyID);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

            return 0;
        }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:52,代码来源:ConsortiaDutyUpdateHandler.cs

示例13: HandlePacket

        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            if (client.Player.PlayerCharacter.ConsortiaID != 0)
                return 0;

            int id = packet.ReadInt();
            bool result = false;
            int consortiaID = 0;
            string consortiaName = "";
            string msg = "ConsortiaInvitePassHandler.Failed";
            int tempID = 0;
            string tempName = "";
            using (ConsortiaBussiness db = new ConsortiaBussiness())
            {
                int consortiaRepute = 0;
                ConsortiaUserInfo info = new ConsortiaUserInfo();
                if (db.PassConsortiaInviteUsers(id, client.Player.PlayerCharacter.ID, client.Player.PlayerCharacter.NickName, ref consortiaID, ref consortiaName, ref msg, info, ref tempID, ref tempName, ref consortiaRepute))
                {
                    client.Player.PlayerCharacter.ConsortiaID = consortiaID;
                    client.Player.PlayerCharacter.ConsortiaName = consortiaName;
                    client.Player.PlayerCharacter.DutyLevel = info.Level;
                    client.Player.PlayerCharacter.DutyName = info.DutyName;
                    client.Player.PlayerCharacter.Right = info.Right;
                    ConsortiaInfo consotia = ConsortiaMgr.FindConsortiaInfo(consortiaID);
                    if (consotia != null)
                        client.Player.PlayerCharacter.ConsortiaLevel = consotia.Level;
                    msg = "ConsortiaInvitePassHandler.Success";
                    result = true;

                    info.UserID = client.Player.PlayerCharacter.ID;
                    info.UserName = client.Player.PlayerCharacter.NickName;
                    info.Grade = client.Player.PlayerCharacter.Grade;
                    info.Offer = client.Player.PlayerCharacter.Offer;
                    info.RichesOffer = client.Player.PlayerCharacter.RichesOffer;
                    info.RichesRob = client.Player.PlayerCharacter.RichesRob;
                    info.Win = client.Player.PlayerCharacter.Win;
                    info.Total = client.Player.PlayerCharacter.Total;
                    info.Escape = client.Player.PlayerCharacter.Escape;
                    info.ConsortiaID = consortiaID;
                    info.ConsortiaName = consortiaName;

                    GameServer.Instance.LoginServer.SendConsortiaUserPass(tempID, tempName, info, true, consortiaRepute, client.Player.PlayerCharacter.UserName, client.Player.PlayerCharacter.FightPower);
                }
            }
            packet.WriteBoolean(result);
            packet.WriteInt(consortiaID);
            packet.WriteString(consortiaName);
            packet.WriteString(LanguageMgr.GetTranslation(msg));
            client.Out.SendTCP(packet);

            return 0;
        }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:52,代码来源:ConsortiaInvitePassHandler.cs

示例14: OnTimeEvent

 //每两分钟向服务器端报告一次掉落物品数量
 private static void OnTimeEvent(object source, ElapsedEventArgs e)
 {
     Dictionary<int, int> tempDic = new Dictionary<int, int>();
     m_lock.AcquireWriterLock(Timeout.Infinite);
     try
     {
         foreach (KeyValuePair<int, MacroDropInfo> kvp in DropInfoMgr.DropInfo)
         {
             int templateId = kvp.Key;
             MacroDropInfo macroDropInfo = kvp.Value;
             if (macroDropInfo.SelfDropCount > 0)
             {
                 tempDic.Add(templateId, macroDropInfo.SelfDropCount);
                 macroDropInfo.SelfDropCount = 0;
             }
         }
     }
     catch (Exception ex)
     {
         if (log.IsErrorEnabled)
             log.Error("DropInfoMgr OnTimeEvent", ex);
     }
     finally
     {
         m_lock.ReleaseWriterLock();
     }
     if(tempDic.Count > 0)
     {
         GSPacketIn pkg = new GSPacketIn((byte)eChatServerPacket.MACRO_DROP);
         pkg.WriteInt(tempDic.Count);
         foreach (KeyValuePair<int, int> kvp in tempDic)
         {
             pkg.WriteInt(kvp.Key);
             pkg.WriteInt(kvp.Value);
         }
         GameServer.Instance.LoginServer.SendPacket(pkg);
     }
 }
开发者ID:geniushuai,项目名称:DDTank-3.0,代码行数:39,代码来源:MacroDropMgr.cs

示例15: SendAddRoom

        internal void SendAddRoom(Game.Server.Rooms.BaseRoom room)
        {
            GSPacketIn pkg = new GSPacketIn((int)eFightPackageType.GAME_ROOM_CREATE);
            pkg.WriteInt(room.RoomId);
            pkg.WriteInt((int)room.GameType);
            pkg.WriteInt(room.Game.PlayerCount);

            List<GamePlayer> players = room.GetPlayersSafe();
            foreach (GamePlayer p in players)
            {
                pkg.WriteInt(p.PlayerCharacter.ID);//改为唯一ID
                pkg.WriteInt(p.PlayerCharacter.Attack);
                pkg.WriteInt(p.PlayerCharacter.Defence);
                pkg.WriteInt(p.PlayerCharacter.Agility);
                pkg.WriteInt(p.PlayerCharacter.Luck);
                pkg.WriteDouble(p.GetBaseAttack());
                pkg.WriteDouble(p.GetBaseDefence());
                pkg.WriteDouble(p.GetBaseAgility());
                pkg.WriteDouble(p.GetBaseBlood());
                pkg.WriteInt(p.CurrentWeapon.TemplateID);
            }
            SendTCP(pkg, room);
        }
开发者ID:vancourt,项目名称:BaseGunnyII,代码行数:23,代码来源:FightServerConnector.cs


注:本文中的Game.Base.Packets.GSPacketIn.WriteInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。