コード例 #1
0
        public void SendBoxDisappear(List <int> BoxID, BaseSceneGame game)
        {
            GSPacketIn pkgMsg = new GSPacketIn((byte)ePackageType.GAME_CMD);

            pkgMsg.WriteByte((byte)TankCmdType.DISAPPEAR);
            pkgMsg.WriteInt(BoxID.Count);
            foreach (int id in BoxID)
            {
                pkgMsg.WriteInt(id);
            }

            game.SendToAll(pkgMsg);
        }
コード例 #2
0
        /// <summary>
        /// 用户批量上线
        /// </summary>
        /// <param name="users"></param>
        /// <returns></returns>
        public GSPacketIn SendUserOnline(Dictionary <int, int> users)
        {
            GSPacketIn pkg = new GSPacketIn((byte)eChatServerPacket.USER_ONLINE);

            pkg.WriteInt(users.Count);
            foreach (KeyValuePair <int, int> i in users)
            {
                pkg.WriteInt(i.Key);
                pkg.WriteInt(i.Value);
            }
            SendTCP(pkg);
            return(pkg);
        }
コード例 #3
0
        private void UpdateLimitShopCount(GamePlayer player, Dictionary <int, int> changeLimitShopID)
        {
            GSPacketIn pkg = new GSPacketIn(168);

            pkg.WriteInt(changeLimitShopID.Count);
            foreach (int key in changeLimitShopID.Keys)
            {
                pkg.WriteInt(key);
                pkg.WriteInt(changeLimitShopID[key]);
            }
            player.SendTCP(pkg);
            GameServer.Instance.LoginServer.SendPacket(pkg);
        }
コード例 #4
0
        public GSPacketIn SendUserOnline(Dictionary <int, int> users)
        {
            GSPacketIn pkg = new GSPacketIn(5);

            pkg.WriteInt(users.Count);
            foreach (KeyValuePair <int, int> i in users)
            {
                pkg.WriteInt(i.Key);
                pkg.WriteInt(i.Value);
            }
            this.SendTCP(pkg);
            return(pkg);
        }
コード例 #5
0
        public void SendConsortiaAlly(int consortiaID1, int consortiaID2, int state)
        {
            GSPacketIn pkg = new GSPacketIn((byte)eChatServerPacket.CONSORTIA_RESPONSE);

            pkg.WriteByte(7);
            pkg.WriteInt(consortiaID1);
            pkg.WriteInt(consortiaID2);
            pkg.WriteInt(state);

            SendTCP(pkg);

            ConsortiaMgr.UpdateConsortiaAlly(consortiaID1, consortiaID2, state);
        }
コード例 #6
0
        public void SendConsortiaBanChat(int playerid, string playerName, int handleID, string handleName, bool isBan)
        {
            GSPacketIn pkg = new GSPacketIn((byte)eChatServerPacket.CONSORTIA_RESPONSE);

            pkg.WriteByte(5);
            pkg.WriteBoolean(isBan);
            pkg.WriteInt(playerid);
            pkg.WriteString(playerName);
            pkg.WriteInt(handleID);
            pkg.WriteString(handleName);

            SendTCP(pkg);
        }
コード例 #7
0
        public void SendPlayerConsortiaFight(int playerId, int consortiaWin, int consortiaLose, eRoomType roomType, eGameType gameClass, int totalKillHealth, int count)
        {
            GSPacketIn pkg = new GSPacketIn(42, playerId);

            pkg.WriteInt(consortiaWin);
            pkg.WriteInt(consortiaLose);
            pkg.WriteInt(count);
            pkg.WriteByte((byte)roomType);
            pkg.WriteByte((byte)gameClass);
            pkg.WriteInt(totalKillHealth);
            pkg.WriteInt(totalKillHealth);
            this.SendTCP(pkg);
        }
コード例 #8
0
        public GSPacketIn SendUserOnline(Dictionary <int, int> users)
        {
            GSPacketIn gSPacketIn = new GSPacketIn(5);

            gSPacketIn.WriteInt(users.Count);
            foreach (KeyValuePair <int, int> current in users)
            {
                gSPacketIn.WriteInt(current.Key);
                gSPacketIn.WriteInt(current.Value);
            }
            this.SendTCP(gSPacketIn);
            return(gSPacketIn);
        }
コード例 #9
0
ファイル: ChargeMgr.cs プロジェクト: SkelletonX/DDTServer
        public static void Do()
        {
            try {
                using (PlayerBussiness db = new PlayerBussiness())
                {
                    ChargeInfo[] a = db.GetUserChargeList();
                    if (a.Length != 0)
                    {
                        foreach (var b in a)
                        {
                            PlayerInfo info = db.GetUserSingleByUserID(b.UserID);

                            MailInfo c = new MailInfo();
                            c.Content    = "充值成功!";
                            c.Title      = "充值成功!";
                            c.Gold       = 0;
                            c.IsExist    = true;
                            c.Money      = Convert.ToInt32(b.Money * 100 * (GetRate(info)));
                            c.GiftToken  = 0;
                            c.Receiver   = info.NickName;
                            c.ReceiverID = b.UserID;
                            c.Sender     = "充值系统";
                            c.SenderID   = 0;
                            c.Type       = 1;
                            if (db.SendMail(c))
                            {
                                if (db.DoUserCharge(b.ID))
                                {
                                    ServerClient client = LoginMgr.GetServerClient(b.UserID);
                                    if (client != null)
                                    {
                                        GSPacketIn pkgMsg = new GSPacketIn(118);
                                        pkgMsg.WriteInt(b.UserID);
                                        pkgMsg.WriteInt(1);
                                        client.SendTCP(pkgMsg);

                                        // result = true;
                                        // return result;
                                    }
                                    ChargeMgr.log.Warn("用户" + info.UserName + "充值" + b.Money + "成功");
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ChargeMgr.log.Error(ex);
            }
        }
コード例 #10
0
        private static void MacroDropSync()
        {
            bool flag = true;

            ServerClient[] allClients = CenterServer.Instance.GetAllClients();
            ServerClient[] array      = allClients;
            for (int i = 0; i < array.Length; i++)
            {
                ServerClient serverClient = array[i];
                if (!serverClient.NeedSyncMacroDrop)
                {
                    flag = false;
                    break;
                }
            }
            if (allClients.Length > 0 && flag)
            {
                GSPacketIn gSPacketIn = new GSPacketIn(178);
                int        count      = MacroDropMgr.m_DropInfo.Count;
                gSPacketIn.WriteInt(count);
                MacroDropMgr.m_lock.AcquireReaderLock(-1);
                try
                {
                    foreach (KeyValuePair <int, DropInfo> current in MacroDropMgr.m_DropInfo)
                    {
                        DropInfo value = current.Value;
                        gSPacketIn.WriteInt(value.ID);
                        gSPacketIn.WriteInt(value.Count);
                        gSPacketIn.WriteInt(value.MaxCount);
                    }
                }
                catch (Exception exception)
                {
                    if (MacroDropMgr.log.IsErrorEnabled)
                    {
                        MacroDropMgr.log.Error("DropInfoMgr MacroDropReset", exception);
                    }
                }
                finally
                {
                    MacroDropMgr.m_lock.ReleaseReaderLock();
                }
                ServerClient[] array2 = allClients;
                for (int j = 0; j < array2.Length; j++)
                {
                    ServerClient serverClient2 = array2[j];
                    serverClient2.NeedSyncMacroDrop = false;
                    serverClient2.SendTCP(gSPacketIn);
                }
            }
        }
コード例 #11
0
        public void SendConsortiaInvite(int ID, int playerid, string playerName, int inviteID, string intviteName, string consortiaName, int consortiaID)
        {
            GSPacketIn pkg = new GSPacketIn(128);

            pkg.WriteByte(4);
            pkg.WriteInt(ID);
            pkg.WriteInt(playerid);
            pkg.WriteString(playerName);
            pkg.WriteInt(inviteID);
            pkg.WriteString(intviteName);
            pkg.WriteInt(consortiaID);
            pkg.WriteString(consortiaName);
            this.SendTCP(pkg);
        }
コード例 #12
0
 public void SendPlayerAddTemplate(int playerId, ItemInfo cloneItem, eBageType bagType, int count)
 {
     if (cloneItem != null)
     {
         GSPacketIn gSPacketIn = new GSPacketIn(48, playerId);
         gSPacketIn.WriteInt(cloneItem.TemplateID);
         gSPacketIn.WriteByte((byte)bagType);
         gSPacketIn.WriteInt(count);
         gSPacketIn.WriteInt(cloneItem.ValidDate);
         gSPacketIn.WriteBoolean(cloneItem.IsBinds);
         gSPacketIn.WriteBoolean(cloneItem.IsUsed);
         this.SendTCP(gSPacketIn);
     }
 }
コード例 #13
0
 public void SendPlayerAddTemplate(int playerId, ItemInfo cloneItem, eBageType bagType, int count)
 {
     if (cloneItem != null)
     {
         GSPacketIn pkg = new GSPacketIn((byte)eFightPackageType.PLAYER_ADD_TEMPLATE1, playerId);
         pkg.WriteInt(cloneItem.TemplateID);
         pkg.WriteByte((byte)bagType);
         pkg.WriteInt(count);
         pkg.WriteInt(cloneItem.ValidDate);
         pkg.WriteBoolean(cloneItem.IsBinds);
         pkg.WriteBoolean(cloneItem.IsUsed);
         SendTCP(pkg);
     }
 }
コード例 #14
0
 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);
         }
         packet.WriteInt(player.PlayerDetail.AreaID);
         packet.WriteInt(player.PlayerDetail.PlayerCharacter.ID);
         game.SendToAll(packet);
     }
 }
コード例 #15
0
        private void HandleAreaBigBugle(GSPacketIn pkg)
        {
            var x = new GSPacketIn(25);

            x.WriteInt(pkg.ReadInt());
            x.WriteInt(pkg.ReadInt());
            x.WriteString(Name);
            x.WriteString(pkg.ReadString());
            x.WriteString(pkg.ReadString());
            foreach (var a in server.GetAllClients())
            {
                a.SendTCP(x);
            }
        }
コード例 #16
0
    public void UsingProp(byte type, int place, int templateId)
    {
        GSPacketIn pkg = new GSPacketIn((short)GAME_CMD);

        pkg.Parameter1 = this.m_playerId;
        //pkg.Parameter2 = -1;
        Debug.Log("pkg.Parameter1: " + pkg.Parameter1.ToString() + " lifeTime: " + m_lifeTime.ToString());
        pkg.WriteByte((byte)eTankCmdType.USING_PROP);
        pkg.WriteByte(type);
        pkg.WriteInt(place);
        pkg.WriteInt(templateId);
        this.SendTCP(pkg);
        Debug.Log("Send USING_PROP successfully");
    }
コード例 #17
0
ファイル: MacroDropMgr.cs プロジェクト: uvbs/DDTank-3.0
        private static void MacroDropSync()
        {
            bool syncMacroDrop = true;

            ServerClient[] serverClients = CenterServer.Instance.GetAllClients();
            foreach (ServerClient serverClient in serverClients)
            {
                if (!serverClient.NeedSyncMacroDrop)
                {
                    syncMacroDrop = false;
                    break;
                }
            }

            if (serverClients.Length > 0 && syncMacroDrop)
            {
                GSPacketIn pkg   = new GSPacketIn((byte)ePackageType.MACRO_DROP);
                int        count = m_DropInfo.Count;
                pkg.WriteInt(count);
                m_lock.AcquireReaderLock(Timeout.Infinite);
                try
                {
                    foreach (KeyValuePair <int, DropInfo> kvp in m_DropInfo)
                    {
                        DropInfo di = kvp.Value;
                        pkg.WriteInt(di.ID);
                        pkg.WriteInt(di.Count);
                        pkg.WriteInt(di.MaxCount);
                    }
                }
                catch (Exception e)
                {
                    if (log.IsErrorEnabled)
                    {
                        log.Error("DropInfoMgr MacroDropReset", e);
                    }
                }
                finally
                {
                    m_lock.ReleaseReaderLock();
                }

                foreach (ServerClient serverClient in serverClients)
                {
                    serverClient.NeedSyncMacroDrop = false;
                    serverClient.SendTCP(pkg);
                }
            }
        }
コード例 #18
0
        public void SendRSALogin(RSACryptoServiceProvider rsa, string key)
        {
            GSPacketIn pkg = new GSPacketIn(1);
            var        x   = rsa.Encrypt(Encoding.UTF8.GetBytes(key), false);

            pkg.WriteInt(x.Length);
            pkg.Write(x);
            var config = GameServer.Instance.Config;

            pkg.WriteInt(config.ServerID);
            pkg.WriteString(config.GameIP);
            pkg.WriteString(config.ServerName);
            pkg.WriteInt(config.GamePort);
            this.SendTCP(pkg);
        }
コード例 #19
0
        public void SendConsortiaInvite(int ID, int playerid, string playerName, int inviteID, string intviteName, string consortiaName, int consortiaID)
        {
            GSPacketIn pkg = new GSPacketIn((byte)eChatServerPacket.CONSORTIA_RESPONSE);

            pkg.WriteByte(4);
            pkg.WriteInt(ID);
            pkg.WriteInt(playerid);
            pkg.WriteString(playerName);
            pkg.WriteInt(inviteID);
            pkg.WriteString(intviteName);
            pkg.WriteInt(consortiaID);
            pkg.WriteString(consortiaName);

            SendTCP(pkg);
        }
コード例 #20
0
        public void HandleCharge(GSPacketIn packet)
        {
            int        playerID = packet.ReadInt();
            GamePlayer client   = WorldMgr.GetPlayerById(playerID);

            if (client != null)
            {
                client.UpdateVIP();
                //гЪМўЬсаб
                GSPacketIn pkgMsg = new GSPacketIn(117);
                pkgMsg.WriteInt(playerID);
                pkgMsg.WriteInt(1);
                client.Out.SendTCP(pkgMsg);
            }
        }
コード例 #21
0
        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);
        }
コード例 #22
0
    public void Move(int x, int y, byte dir)
    {
        // Debug.Log("Main Player Moving "+x+" - "+y+" d: "+dir);
        GSPacketIn pkg = new GSPacketIn(GAME_CMD);

        pkg.Parameter1 = this.m_playerId;
        pkg.WriteByte((byte)eTankCmdType.MOVESTART);
        pkg.WriteByte(0);
        pkg.WriteInt(x);
        pkg.WriteInt(y);
        pkg.WriteByte(dir);
        pkg.WriteBoolean(m_blood > 0);
        this.SendTCP(pkg);
        Debug.Log("Send MOVE successfully");
    }
コード例 #23
0
        public static GSPacketIn SendBufferList(Player player, List <BufferInfo> infos)
        {
            GSPacketIn gSPacketIn = new GSPacketIn(168, player.Id);

            gSPacketIn.WriteInt(infos.Count);
            foreach (BufferInfo current in infos)
            {
                gSPacketIn.WriteInt(current.Type);
                gSPacketIn.WriteBoolean(current.IsExist);
                gSPacketIn.WriteDateTime(current.BeginDate);
                gSPacketIn.WriteInt(current.ValidDate);
                gSPacketIn.WriteInt(current.Value);
            }
            return(gSPacketIn);
        }
コード例 #24
0
ファイル: BaseGame.cs プロジェクト: uvbs/DDTank-3.0
        /// <summary>
        ///
        /// </summary>
        /// <param name="player"></param>
        /// <param name="type">0:加血 1:减血 5:不显示 6:死亡,不播放动画</param>
        internal void SendGameUpdateHealth(Living player, int type, int value)
        {
            //Console.WriteLine("SendGameUpdateHealth {0} : {1} : {2}", player.Name, player.Blood, type);
            GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD, player.Id);

            pkg.Parameter1 = player.Id;

            pkg.WriteByte((byte)eTankCmdType.HEALTH);
            pkg.WriteByte((byte)type);
            pkg.WriteInt(player.Blood);
            pkg.WriteInt(value);
            pkg.WriteInt(0);

            SendToAll(pkg);
        }
コード例 #25
0
ファイル: BaseGame.cs プロジェクト: uvbs/DDTank-3.0
        internal void SendLivingJump(Living living, int toX, int toY, int speed, string action, int type)
        {
            GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD, living.Id);

            pkg.Parameter1 = living.Id;

            pkg.WriteByte((byte)eTankCmdType.LIVING_JUMP);
            pkg.WriteInt(toX);
            pkg.WriteInt(toY);
            pkg.WriteInt(speed);
            pkg.WriteString(!string.IsNullOrEmpty(action) ? action : "");//怪物资源的动作
            pkg.WriteInt(type);

            SendToAll(pkg);
        }
コード例 #26
0
        public bool SendReload(string str)
        {
            try
            {
                eReloadType type = (eReloadType)Enum.Parse(typeof(eReloadType), str, true);
                switch (type)
                {
                case eReloadType.server:
                    _config.Refresh();
                    InitGlobalTimers();
                    LoadConfig();
                    ServerMgr.ReLoadServerList();
                    SendConfigState();
                    break;

                default:
                    break;
                }

                GSPacketIn pkg = new GSPacketIn((byte)ePackageType.SYS_RELOAD);
                pkg.WriteInt((int)type);
                SendToALL(pkg, null);
                return(true);
            }
            catch (Exception ex)
            {
                //Console.WriteLine("请检查是否存在此指令!" + ex.ToString());
                log.Error("Order is not Exist!", ex);
            }
            return(false);
        }
コード例 #27
0
 public override void OnTick(MarryRoom room)
 {
     try
     {
         if (room != null)
         {
             room.KickAllPlayer();
             using (PlayerBussiness playerBussiness = new PlayerBussiness())
             {
                 playerBussiness.DisposeMarryRoomInfo(room.Info.ID);
             }
             GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(room.Info.GroomID);
             GameServer.Instance.LoginServer.SendUpdatePlayerMarriedStates(room.Info.BrideID);
             GameServer.Instance.LoginServer.SendMarryRoomInfoToPlayer(room.Info.GroomID, false, room.Info);
             GameServer.Instance.LoginServer.SendMarryRoomInfoToPlayer(room.Info.BrideID, false, room.Info);
             MarryRoomMgr.RemoveMarryRoom(room);
             GSPacketIn gSPacketIn = new GSPacketIn(254);
             gSPacketIn.WriteInt(room.Info.ID);
             WorldMgr.MarryScene.SendToALL(gSPacketIn);
             room.StopTimer();
         }
     }
     catch (Exception exception)
     {
         if (TankMarryLogicProcessor.log.IsErrorEnabled)
         {
             TankMarryLogicProcessor.log.Error("OnTick", exception);
         }
     }
 }
コード例 #28
0
        public int HandlePacket(GameClient client, GSPacketIn packet)
        {
            ItemInfo itemByCategoryID = client.Player.PropBag.GetItemByCategoryID(0, 11, 4);

            if (itemByCategoryID != null)
            {
                client.Player.PropBag.RemoveCountFromStack(itemByCategoryID, 1);
                packet.ReadInt();
                packet.ReadString();
                string str = packet.ReadString();
                if (DateTime.Compare(client.Player.LastChatTime.AddSeconds(15.0), DateTime.Now) > 0)
                {
                    client.Out.SendMessage(eMessageType.ChatERROR, LanguageMgr.GetTranslation("Quá nhiều thao tác!", new object[0]));
                    return(1);
                }
                GSPacketIn gSPacketIn = new GSPacketIn(71);
                gSPacketIn.WriteInt(client.Player.PlayerCharacter.ID);
                gSPacketIn.WriteString(client.Player.PlayerCharacter.NickName);
                gSPacketIn.WriteString(str);
                GameServer.Instance.LoginServer.SendPacket(gSPacketIn);
                client.Player.LastChatTime = DateTime.Now;
                GamePlayer[] allPlayers = WorldMgr.GetAllPlayers();
                for (int i = 0; i < allPlayers.Length; i++)
                {
                    GamePlayer gamePlayer = allPlayers[i];
                    gSPacketIn.ClientID = gamePlayer.PlayerCharacter.ID;
                    gamePlayer.Out.SendTCP(gSPacketIn);
                }
            }
            return(0);
        }
コード例 #29
0
        public void SendPickUpNPC(int roomid)
        {
            GSPacketIn pkg = new GSPacketIn(73);

            pkg.WriteInt(roomid);
            this.SendTCP(pkg);
        }
コード例 #30
0
ファイル: BaseGame.cs プロジェクト: uvbs/DDTank-3.0
        internal void SendPlayerMove(Player player, int type, int x, int y, byte dir, bool isLiving, string action)
        {
            GSPacketIn pkg = new GSPacketIn((byte)ePackageType.GAME_CMD, player.Id);

            pkg.Parameter1 = player.Id;

            pkg.WriteByte((byte)eTankCmdType.MOVESTART);
            pkg.WriteByte((byte)type);
            pkg.WriteInt(x);
            pkg.WriteInt(y);
            pkg.WriteByte(dir);
            pkg.WriteBoolean(isLiving);
            pkg.WriteString(!string.IsNullOrEmpty(action) ? action : "move");//怪物资源的动作

            SendToAll(pkg);
        }