示例#1
0
        public PACKET_EXPIRE_ITEM(ReBornWarRock_PServer.GameServer.Virtual_Objects.User.virtualUser User)
        {
            newPacket(30976);
            addBlock(1);
            addBlock(User.getSlots()); //Slots Enable
            // Player Equipment //
            for (int Class = 0; Class < 5; Class++)
            {
                StringBuilder ClassBuilder = new StringBuilder();

                for (int Slot = 0; Slot < 8; Slot++)
                {
                    ClassBuilder.Append(User.Equipment[Class, Slot]);
                    if (Slot != 7)
                    {
                        ClassBuilder.Append(",");
                    }
                }
                addBlock(ClassBuilder.ToString());
            }
            // Build Inventory //
            addBlock(User.rebuildWeaponList());
            addBlock(User.LeftItems.Count);
            foreach (string Item in User.LeftItems)
            {
                addBlock(Item);
            }
            User.LeftItems.Clear();
        }
示例#2
0
 public PACKET_JOIN_ROOM(ReBornWarRock_PServer.GameServer.Virtual_Objects.User.virtualUser User, Virtual_Objects.Room.virtualRoom Room)
 {
     newPacket(29456);
     addBlock(1);
     addBlock(User.RoomSlot);
     addRoomInfo(Room);
 }
示例#3
0
 public PACKET_SIGN_UP(ReBornWarRock_PServer.GameServer.Virtual_Objects.User.virtualUser User)
 {
     newPacket(30777);
     addBlock(1);
     addBlock(User.rebuildWeaponList());
     addBlock("^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^,^");
 }
示例#4
0
 public PACKET_ROOM_DATA(ReBornWarRock_PServer.GameServer.Virtual_Objects.User.virtualUser User, params object[] Params)
 {
     newPacket(30000);
     addBlock(1);
     for (int i = 0; i < Params.Length; i++)
     {
         addBlock(Params[i]);
     }
 }
示例#5
0
 public override void Handle(ReBornWarRock_PServer.GameServer.Virtual_Objects.User.virtualUser User)
 {
     try
     {
         User.Page = Convert.ToInt32(getNextBlock());
         User.send(new PACKET_ROOM_LIST(User, User.Page));
     }
     catch { }
 }
示例#6
0
 public PACKET_COSTUME_EQUIPMENT(ReBornWarRock_PServer.GameServer.Virtual_Objects.User.virtualUser User, int Class, string Code)
 {
     //29971 0 3 B 0 BA04 0
     newPacket(29971);
     addBlock(1);
     addBlock(Class);
     // Costume Inventory //
     addBlock(Code);
 }
示例#7
0
 public PACKET_LEAVE_ROOM(ReBornWarRock_PServer.GameServer.Virtual_Objects.User.virtualUser User, virtualRoom Room, int oldPlace, int newMaster)
 {
     newPacket(29504);
     addBlock(1);
     addBlock(User.SessionID); // SessionID
     addBlock(oldPlace);       // Position in currentRoom
     addBlock(0);              // ?
     addBlock(newMaster);      // Master Slot
     addBlock(User.Exp);       // Exp
     addBlock(User.Dinar);     // Dinar
 }
示例#8
0
 public PACKET_ROOM_UDP_SPECTATE(ReBornWarRock_PServer.GameServer.Virtual_Objects.User.virtualUser User, Virtual_Objects.Room.virtualRoom Room) // Leave UDP
 {
     newPacket(29953);
     addBlock(1);
     addBlock(0);
     addBlock(User.SpectatorID);
     addBlock(User.UserID);
     addBlock(User.SessionID);
     addBlock(User.Nickname);
     addBlock(999);
 }
示例#9
0
 public PACKET_COSTUME_BUY(ReBornWarRock_PServer.GameServer.Virtual_Objects.User.virtualUser User, string WeaponString)
 {
     newPacket(30209);
     addBlock(1);
     addBlock(1118);
     addBlock(-1);
     addBlock(1);
     addBlock(0);
     addBlock(WeaponString);
     addBlock(0);
     addBlock(User.Dinar);
 }
示例#10
0
 public PACKET_ROOM_UDP_SPECTATE(ReBornWarRock_PServer.GameServer.Virtual_Objects.User.virtualUser User) // Join UDP
 {
     newPacket(29953);
     addBlock(1);
     addBlock(1);
     addBlock(User.SpectatorID);
     addBlock(User.UserID);
     addBlock(User.SessionID);
     addBlock("0");
     addBlock(999);
     addBlock(User.nIP);
     addBlock(User.nPort);
     addBlock(User.lIP);
     addBlock(User.lPort);
     addBlock(0);
 }
示例#11
0
        public override void Handle(ReBornWarRock_PServer.GameServer.Virtual_Objects.User.virtualUser User)
        {
            virtualRoom currentRoom   = User.Room;
            int         num1          = Convert.ToInt32(getBlock(0));
            int         num2          = Convert.ToInt32(getBlock(1));
            int         num3          = Convert.ToInt32(getBlock(2));
            int         num4          = Convert.ToInt32(getBlock(3));
            int         num5          = Convert.ToInt32(getBlock(4));
            int         num6          = Convert.ToInt32(getBlock(5));
            int         ThisTimeStamp = 0;

            if (num2 == 1 && num3 == 6)
            {
                User.send(new PACKET_CHAT("SYSTEM", PACKET_CHAT.ChatType.Room_ToAll, "SYSTEM >> Vai CAzzo ;)!", 999, "NULL"));
                User.send(new PACKET_3(num4, currentRoom));
            }
            if (num1 == 0 && num2 == 0 && num3 == 0 || num3 == 1 && num5 != 0)
            {
                ThisTimeStamp = Structure.timestamp;
            }
            {
                if (num5 == 0 && ThisTimeStamp >= Structure.timestamp)
                {
                    currentRoom.InHacking = true;
                    User.send(new PACKET_HACKING_ESCAPE(0, currentRoom.EscapeHack, 0));
                    currentRoom.EscapeHack += 10;
                    ThisTimeStamp          += 2;
                    User.send(new PACKET_HACKING_ESCAPE(2, currentRoom.EscapeHack, 0));
                }
                else if (num5 == currentRoom.EscapeHack)
                {
                    if (currentRoom.HackingPause % 3 == 0)
                    {
                        currentRoom.EscapeHack += 10;
                    }
                    User.send(new PACKET_HACKING_ESCAPE(2, currentRoom.EscapeHack, 0));
                }
            }
        }
示例#12
0
        public override void Handle(ReBornWarRock_PServer.GameServer.Virtual_Objects.User.virtualUser User)
        {
            try
            {
                if (User.Room != null)
                {
                    return;
                }
                int    RoomID   = Convert.ToInt32(getNextBlock());
                string Password = getNextBlock();
                int    Side     = Convert.ToInt32(getBlock(2));//FreeWar > 0 Derb/ 1 NIU/ 2 Random

                virtualRoom Room = RoomManager.getRoom(User.Channel, RoomID);

                if (Room != null)
                {
                    bool LevelLimit = true;
                    switch (Room.LevelLimit)
                    {
                    case 0: { LevelLimit = false; break; }

                    case 1: { if (LevelCalculator.getLevelforExp(User.Exp) <= 4)
                              {
                                  LevelLimit = false;
                              }
                              break; }

                    case 2: { if (LevelCalculator.getLevelforExp(User.Exp) > 5)
                              {
                                  LevelLimit = false;
                              }
                              break; }

                    case 3: { if (LevelCalculator.getLevelforExp(User.Exp) > 13)
                              {
                                  LevelLimit = false;
                              }
                              break; }

                    case 4: { if (LevelCalculator.getLevelforExp(User.Exp) > 23)
                              {
                                  LevelLimit = false;
                              }
                              break; }

                    case 5: { if (LevelCalculator.getLevelforExp(User.Exp) > 33)
                              {
                                  LevelLimit = false;
                              }
                              break; }
                    }

                    bool canJoinPing = false;
                    switch (Room.Ping)
                    {
                    case 0: if (User.Ping < 150)
                        {
                            canJoinPing = true;
                        }
                        else
                        {
                            canJoinPing = false;
                        } break;

                    case 1: if (User.Ping < 250)
                        {
                            canJoinPing = true;
                        }
                        else
                        {
                            canJoinPing = false;
                        } break;

                    case 2: canJoinPing = true; break;
                    }

                    if ((Room.Players.Count >= Room.MaxPlayers || Room.RoomType == 1 && (User.ClanRank == -1 || User.ClanRank == 9) || (Room.RoomType == 1 && (Room.getSideCount(0) > 0 && Room.getSideCount(1) > 0 && Room.isMyClan(User) == false)) || Room.RoomType == 1 && User.ClanID == -1 || canJoinPing == false && User.Rank < 2 || Room.UserLimit || Room.isJoinAble() == false || User.pingOK == false) && User.Rank < 2)
                    {
                        User.send(new PACKET_JOIN_ROOM(PACKET_JOIN_ROOM.ErrorCodes.GenericError));
                    }
                    else if (Password != "NULL" && (Password != Room.Password))
                    {
                        User.send(new PACKET_JOIN_ROOM(PACKET_JOIN_ROOM.ErrorCodes.InvalidPassword));
                    }
                    else if (LevelLimit == true)
                    {
                        User.send(new PACKET_JOIN_ROOM(PACKET_JOIN_ROOM.ErrorCodes.BadLevel));
                    }
                    else if (User.Premium == 0 && Room.PremiumOnly == 1)
                    {
                        User.send(new PACKET_JOIN_ROOM(PACKET_JOIN_ROOM.ErrorCodes.OnlyPremium));
                    }
                    else
                    {
                        if (User.Room != null)
                        {
                            return;
                        }
                        if (Room.joinUser(User, Side) == true)
                        {
                            ArrayList tempPlayers = new ArrayList();
                            User.isReady      = false;
                            User.isSpawned    = false;
                            User.BackedToRoom = false;
                            User.Health       = 0;
                            foreach (virtualUser RoomUser in Room.Players)
                            {
                                if (RoomUser.Equals(User) == false)
                                {
                                    tempPlayers.Add(RoomUser);
                                }
                            }
                            User.send(new PACKET_ROOM_UDP(User, tempPlayers));

                            foreach (virtualUser tempSpectator in Room.Spectators)
                            {
                                User.send(new PACKET_ROOM_UDP_SPECTATE(tempSpectator));
                            }

                            // User.send(new PACKET_JOIN_ROOM(User, Room));

                            tempPlayers.Clear();
                            tempPlayers.Add(User);

                            foreach (virtualUser RoomUser in Room.Players)
                            {
                                RoomUser.send(new PACKET_ROOM_UDP(RoomUser, tempPlayers));
                            }

                            foreach (virtualUser SpectatorUser in Room.Spectators)
                            {
                                SpectatorUser.send(new PACKET_ROOM_UDP(SpectatorUser, tempPlayers));
                            }

                            /* Send out changed Room Data */
                            foreach (virtualUser _User in UserManager.getUsersInChannel(Room.Channel, false))
                            {
                                if (_User.Page == Math.Floor(Convert.ToDecimal(Room.ID / 14)))
                                {
                                    _User.send(new PACKET_ROOMLIST_UPDATE(Room));
                                }
                            }
                        }
                        else
                        {
                            User.send(new PACKET_JOIN_ROOM(PACKET_JOIN_ROOM.ErrorCodes.GenericError));
                        }
                    }
                }
                else
                {
                    User.send(new PACKET_JOIN_ROOM(PACKET_JOIN_ROOM.ErrorCodes.GenericError));
                }
            }
            catch { User.send(new PACKET_JOIN_ROOM(PACKET_JOIN_ROOM.ErrorCodes.GenericError)); }
        }
示例#13
0
        public override void Handle(ReBornWarRock_PServer.GameServer.Virtual_Objects.User.virtualUser User)
        {
            virtualRoom currentRoom = User.Room;
            int         value       = 0;
            int         totPerc     = (currentRoom.HackPercentageA + currentRoom.HackPercentageB);

            if (!currentRoom.GameActive || totPerc >= 100)
            {
                return;
            }

            //0 1 6 0 99 0
            User.hackingBase = Convert.ToInt32(getBlock(3));
            int sType = 2;

            if (getBlock(1) == "0" && getBlock(2) == "0" && (getBlock(3) == "0" || getBlock(3) == "1")) // Starting to hack send animation
            {
                User.send(new SP_RoomHackMission(User.RoomSlot, (User.hackingBase == 0 ? currentRoom.HackPercentageA : currentRoom.HackPercentageB), 0, User.hackingBase, value));
                return;
            }
            else if (getBlock(1) == "1" && getBlock(2) == "6" && getBlock(3) == "0" && currentRoom.PickuppedC4 == false) // Pickup the C4
            {
                if (currentRoom.MapID == 56)
                {
                    if (currentRoom.getSide(User) != (int)currentRoom.getSide(User))
                    {
                        return;
                    }
                    currentRoom.PickuppedC4 = true;
                    User.hasC4 = true;
                    currentRoom.send(new SP_Unknown(29985, 0, 0, 1, 6, 0, 0, -1, 0));                                              // Remove the C4 from table
                    currentRoom.send(new SP_Unknown(30000, 1, User.RoomSlot, User.UserID, 2, 155, 0, 0, 92, 0, 0, 0, 0, 0, 0, 0)); // Switch to C4
                }
                else
                {
                    Log.AppendError("Tried to pickup C4 in room " + currentRoom.MapID);
                }
                return;
            }
            else if (getBlock(1) == "1" && getBlock(2) == "0" && getBlock(3) == "0") // Use the C4
            {
                if (currentRoom.MapID == 58)
                {
                    //30000 1 -1 4 2 104 0 1 1 0 0 92 0 92 -1 0 0 1333333 -1166666 1333333 0 2845.7510 205.0797 3374.0964 -70.9974 45.4165 -287.9179 0 0 DP05
                    currentRoom.PickuppedC4 = false;
                    User.hasC4 = false;
                    //currentRoom.SiegeWarC4User = User.UserID.ToString();
                    currentRoom.send(new SP_Unknown(29985, 0, 0, 1, 0, 0, 0, 0, 0)); // Remove C4 from the user
                    currentRoom.SiegeWarTime = 5;
                }
                else
                {
                    Log.AppendError("Tried to use C4 in room " + currentRoom.MapID);
                }
                return;
            }
            else if (Convert.ToInt32(getBlock(2)) == 3) // Stop to hack
            {
                User.isHacking = false;
                sType          = 3;
                currentRoom.send(new SP_RoomHackMission(User.RoomSlot, (User.hackingBase == 0 ? currentRoom.HackPercentageA : currentRoom.HackPercentageB), sType, User.hackingBase, value));
                return;
            }

            //if (currentRoom == null || User.LastHackTick > currentRoom.InitialTime && User.LastHackTick > 0) return;

            if (User.hackingBase != User.LastHackBase)
            {
                User.hackTick = 0;
            }

            if ((User.LastHackTick < currentRoom.InitialTime) || (User.LastHackTick == 0))
            {
                User.LastHackTick = 0;
                User.hackTick++;
                User.rPoints++;
                User.hackTick = 0;

                if (User.hackingBase == 0)
                {
                    currentRoom.HackPercentageA++;
                }
                else
                {
                    currentRoom.HackPercentageB++;
                }
            }

            int totalPercentage = (currentRoom.HackPercentageA + currentRoom.HackPercentageB);

            if (User.GodMode)
            {
                totalPercentage = 100;
            }

            User.LastHackBase = User.hackingBase;

            User.hackPercentage++;
            User.isHacking = true;

            if (totalPercentage >= 100)
            {
                if (currentRoom.MapID == 58)
                {
                    if (currentRoom.Mission1 == null)
                    {
                        currentRoom.Mission1 = User.Nickname;
                        User.rPoints        += 1;
                        currentRoom.send(new SP_Unknown(29985, 0, 0, 1, 1, 99, 0));         // Go to mission 2
                        currentRoom.send(new SP_Unknown(29985, 0, 0, 0, 4, 1, 100, -1, 0)); // Go to mission 2
                        currentRoom.send(new SP_Unknown(29985, 0, -1, 1, 5, -1, 0, -1, 0)); // Spawn the C4
                        currentRoom.Flags[2] = 1;
                        currentRoom.Flags[3] = 0;
                        currentRoom.Flags[0] = currentRoom.Flags[1] = -1;
                        currentRoom.send(new SP_Unknown(30000, 1, -1, currentRoom.ID, 2, 156, 0, 1, 2, 1, -1, 2, 0, 92, -1, 0, 0, 1333333, -1166666, 1333333, 0, 3689.6670, 969.9617, 4332.0752, 64.4469, 37.4174, -290.5969, 0, 0, "DU02"));
                        currentRoom.send(new SP_Unknown(30000, 1, -1, currentRoom.ID, 2, 156, 0, 1, 3, 0, -1, 2, 0, 92, -1, 0, 0, 1333333, -1166666, 1333333, 0, 3689.6670, 969.9617, 4332.0752, 64.4469, 37.4174, -290.5969, 0, 0, "DU02"));
                        currentRoom.send(new SP_Unknown(30000, 1, -1, currentRoom.ID, 2, 156, 0, 1, 0, -1, 0, 0, 0, 92, -1, 0, 0, 1333333, -1166666, 1333333, 0, 3689.6670, 969.9617, 4332.0752, 64.4469, 37.4174, -290.5969, 0, 0, "DU02"));
                        currentRoom.send(new SP_Unknown(30000, 1, -1, currentRoom.ID, 2, 156, 0, 1, 1, -1, 1, 1, 0, 92, -1, 0, 0, 1333333, -1166666, 1333333, 0, 3689.6670, 969.9617, 4332.0752, 64.4469, 37.4174, -290.5969, 0, 0, "DU02"));
                        currentRoom.PickuppedC4 = false;
                    }
                }
                else if (totalPercentage >= 100 && currentRoom.Mode == 11)
                {
                    currentRoom.InitialTime += 480000;
                    //S=> 250048643 29985 0 0 0 4 1 100 -1 0
                    sType = 4;
                    currentRoom.send(new SP_RoomHackMission(User.RoomSlot, totalPercentage, sType, User.hackingBase, value));

                    //250048643 30053 3 131487 0 100 -1 0
                    currentRoom.Stage2.Stop();
                    currentRoom.milliSec = currentRoom.Stage2.ElapsedMilliseconds;

                    //currentRoom.send(new PACKET_TIMEATTACK_ALL(0, 3, totalPercentage, -1, currentRoom.milliSec, 0));
                    currentRoom.send(new PACKET_SCORE_BOARD_AI_TIMEATTACK(currentRoom, User, currentRoom.milliSec));
                    currentRoom.milliSec      = 0;
                    currentRoom.freezeZombies = false;

                    //250048643 29985 0 -1 1 5 -1 0 -1 0
                    sType            = 5;
                    value            = 0;
                    totalPercentage  = 0;
                    User.hackingBase = -1;
                    currentRoom.send(new SP_RoomHackMission(User.RoomSlot, totalPercentage, sType, User.hackingBase, value));
                    //currentRoom.timeattack.PrepareNewStage(3);
                }
            }
            currentRoom.send(new SP_RoomHackMission(User.RoomSlot, (User.hackingBase == 0 ? currentRoom.HackPercentageA : currentRoom.HackPercentageB), sType, User.hackingBase, value));

            //currentRoom.send(new SP_RoomHackMission(User.RoomSlot, (User.hackingBase == 0 ? currentRoom.HackPercentageA : currentRoom.HackPercentageB), sType, User.hackingBase));
        }
示例#14
0
        public override void Handle(ReBornWarRock_PServer.GameServer.Virtual_Objects.User.virtualUser User)
        {
            try
            {
                int ChatType = Convert.ToInt32(getBlock(0));
                int TargetID = Convert.ToInt32(getBlock(1));

                string TargetName = getBlock(2);
                string exMessage  = getBlock(3);
                string Message    = WordManager.GetBadWord(exMessage);

                string sMessage = Message.Split(new string[] { ">>" + Convert.ToChar(0x1D).ToString() }, StringSplitOptions.None)[1].Replace(Convert.ToChar(0x1D), Convert.ToChar(0x20));
                if (User.isCommand(sMessage))
                {
                    return;
                }

                int  MuteTime      = 60;
                long ChatTimeCheck = Structure.currTimeStamp;
                if (User.isMuted == true && User.MutedTime > ChatTimeCheck)
                {
                    User.send(new PACKET_CHAT("SERVER", PACKET_CHAT.ChatType.Whisper, "SERVER >> You are muted, please try it later again!", User.SessionID, User.Nickname));
                    return;
                }
                else
                {
                    User.isMuted = false; User.MutedTime = 0;
                }
                DB.runQuery("INSERT INTO chatlogs (`userid`, `roomid`, `message`, `timestamp`) VALUES ('" + User.UserID + "', '" + ((User.Room == null) ? -1 : User.Room.ID) + "', '" + DB.Stripslash(sMessage) + "', '" + Structure.currTimeStamp + "')");
                if (User.LastChatTick == 0)
                {
                    User.LastChatTick = Environment.TickCount;
                }

                long ChatTime = Environment.TickCount - User.LastChatTick;

                if (ChatTime != 0 && ChatTime < 1000)
                {
                    User.ChatWarnings++;
                    if (User.ChatWarnings >= 5 && User.Rank < 3)
                    {
                        User.MutedTime = Structure.currTimeStamp + MuteTime;
                        User.send(new PACKET_CHAT("SERVER", PACKET_CHAT.ChatType.Whisper, "SERVER >> You have been muted!", User.SessionID, User.Nickname));
                        User.isMuted = true;
                        return;
                    }
                }

                User.LastChatTick = Environment.TickCount;

                switch (ChatType)
                {
                case 2:
                {
                    ReBornWarRock_PServer.GameServer.Virtual_Objects.User.virtualUser Target = UserManager.getUser(TargetName);
                    if (Target is ReBornWarRock_PServer.GameServer.Virtual_Objects.User.virtualUser && Target.SessionID > 0)
                    {
                        User.send(new PACKET_CHAT(User, PACKET_CHAT.ChatType.Whisper, Message, Target.SessionID, Target.Nickname));
                        if (!User.Equals(Target))
                        {
                            Target.send(new PACKET_CHAT(User, PACKET_CHAT.ChatType.Whisper, Message, Target.SessionID, Target.Nickname));
                        }
                    }
                    else
                    {
                        User.send(new PACKET_CHAT(PACKET_CHAT.ErrorCodes.ErrorUser, TargetName + Convert.ToChar(0x1D)));
                    }
                    break;
                }

                case 3:     // Lobby2Channel
                {
                    if (User.ColorChat == System.Drawing.Color.Empty || User.Rank < 2)
                    {
                        if (User.Rank > 2)
                        {
                            TargetID = 999;
                        }
                        UserManager.sendToChannel(User.Channel, false, new PACKET_CHAT(User, PACKET_CHAT.ChatType.Lobby_ToChannel, Message, (User.Rank > 4) ? 999 : TargetID, TargetName));
                    }
                    else
                    {
                        UserManager.sendToChannel(User.Channel, false, new PACKET_CHAT_COLOR(Message, PACKET_CHAT_COLOR.ChatType.Normal, User.ColorChat));
                        //UserManager.sendToChannel(usr.channel, false, new SP_ColoredChat(message, SP_ColoredChat.ChatType.Normal, usr.chatColor));
                    }
                    break;
                }

                case 4:     // Room2All
                {
                    if (User.Room != null)
                    {
                        if (User.ColorChat != System.Drawing.Color.Empty && !User.Room.GameActive && User.Rank >= 2)
                        {
                            User.Room.send(new PACKET_CHAT_COLOR(Message, PACKET_CHAT_COLOR.ChatType.Normal, User.ColorChat));
                        }
                        else
                        {
                            if (User.hasItem("CC02") && User.Room.RoomStatus == 1 && User.RoomSlot == User.Room.RoomMasterSlot && User.Rank < 3)
                            {
                                TargetID = 998;
                            }
                            else if (User.Rank > 2)
                            {
                                TargetID = 999;
                            }

                            User.Room.send(new PACKET_CHAT(User, PACKET_CHAT.ChatType.Room_ToAll, Message, TargetID, TargetName));
                        }
                    }
                    else
                    {
                        User.disconnect();
                    }
                    break;
                }

                case 5:     // Room2Team
                {
                    if (User.Room != null)
                    {
                        foreach (ReBornWarRock_PServer.GameServer.Virtual_Objects.User.virtualUser RoomUser in User.Room.Players)
                        {
                            if (User.Room.getSide(User) == User.Room.getSide(RoomUser))
                            {
                                RoomUser.send(new PACKET_CHAT(User, PACKET_CHAT.ChatType.Room_ToTeam, Message, (User.Rank > 2) ? 999 : TargetID, TargetName));
                            }
                        }
                        foreach (ReBornWarRock_PServer.GameServer.Virtual_Objects.User.virtualUser SpectatorUser in User.Room.Spectators)
                        {
                            SpectatorUser.send(new PACKET_CHAT(User, PACKET_CHAT.ChatType.Room_ToTeam, Message, (User.Rank > 2) ? 999 : TargetID, TargetName));
                        }
                    }
                    else
                    {
                        User.disconnect();
                    }
                    break;
                }

                case 6:     // Whisper
                {
                    ReBornWarRock_PServer.GameServer.Virtual_Objects.User.virtualUser Target = UserManager.getUser(TargetName);
                    if (Target is ReBornWarRock_PServer.GameServer.Virtual_Objects.User.virtualUser && Target.SessionID > 0 && Target.GMMode == false)
                    {
                        User.send(new PACKET_CHAT(User, PACKET_CHAT.ChatType.Whisper, Message, Target.SessionID, Target.Nickname));
                        if (!User.Equals(Target))
                        {
                            Target.send(new PACKET_CHAT(User, PACKET_CHAT.ChatType.Whisper, Message, Target.SessionID, Target.Nickname));
                        }
                    }
                    else
                    {
                        User.send(new PACKET_CHAT(PACKET_CHAT.ErrorCodes.ErrorUser, TargetName + Convert.ToChar(0x1D)));
                    }
                    break;
                }

                case 8:     //Lobby2AllChannels
                {
                    UserManager.sendToChannel(1, false, new PACKET_CHAT(User, PACKET_CHAT.ChatType.Lobby_ToChannel, Message, TargetID, TargetName));
                    UserManager.sendToChannel(2, false, new PACKET_CHAT(User, PACKET_CHAT.ChatType.Lobby_ToChannel, Message, TargetID, TargetName));
                    UserManager.sendToChannel(3, false, new PACKET_CHAT(User, PACKET_CHAT.ChatType.Lobby_ToChannel, Message, TargetID, TargetName));
                    break;
                }

                case 9:     //RadioChat
                {
                    if (User.Room == null)
                    {
                        return;
                    }

                    //byte[] buffer = (new PACKET_CHAT(User, PACKET_CHAT.ChatType.RadioChat, Message, TargetID, TargetName)).GetBytes();

                    int mySide = User.Room.getSide(User);

                    foreach (virtualUser u in User.Room.Players)
                    {
                        if (User.Room.getSide(User) == User.Room.getSide(u))
                        {
                            u.send(new PACKET_CHAT(User, PACKET_CHAT.ChatType.RadioChat, Message, (User.Rank > 2) ? 999 : TargetID, TargetName));
                        }

                        // u.send(buffer);
                    }

                    break;
                }

                case 10:     // Clan
                {
                    if (User.ClanID != -1 && User.ClanRank != -1)
                    {
                        ClanManager.sendToClan(User, new PACKET_CHAT(User, PACKET_CHAT.ChatType.Clan, Message, TargetID, TargetName));
                    }
                    else
                    {
                        User.send(new PACKET_CHAT("SYSTEM", PACKET_CHAT.ChatType.Whisper, "SYSTEM >> Chat available after creating or get accepted from a clan", User.SessionID, User.Nickname));
                    }
                    break;
                }

                default:
                {
                    Log.WriteDebug("New unknow operation for chat: " + ChatType);
                    Log.WriteDebug("Blocks: " + string.Join(" ", getAllBlocks()));
                    break;
                }
                }
                string[] args = sMessage.Split(Convert.ToChar(0x20));
                if (args.Length >= 2)
                {
                    if (args[0] == "I" && args[1] == "Hate" && args[2] == "WarRock")
                    {
                        if (User.CheckForEvent(5) == false)
                        {
                            string ItemCode = "CB27";
                            User.AddItem(ItemCode, -1, 1);
                            User.send(new PACKET_CHAT_EVENT(User, ItemCode));
                            DB.runQuery("INSERT INTO users_events (userid, eventid) VALUES ('" + User.UserID + "', '5')");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Log.AppendError(ex.Message);
            }
        }
示例#15
0
 public PACKET_SKILL_POINT(ReBornWarRock_PServer.GameServer.Virtual_Objects.User.virtualUser User)
 {
     newPacket(31945);
     addBlock(User.RoomSlot);
     addBlock(User.rSkillPoints);
 }
示例#16
0
        public override void Handle(ReBornWarRock_PServer.GameServer.Virtual_Objects.User.virtualUser User)
        {
            try
            {
                int ResultID = RoomManager.getOpenID(User.Channel);

                if (User.Channel != 3)
                {
                    if (ResultID >= 0 && (User.Channel >= 1 && User.Channel <= 3))
                    {
                        if (User.Room == null)
                        {
                            virtualRoom Room = new virtualRoom();
                            /*ToXiiC's Noob Stuff*/
                            Room.ID             = ResultID;
                            Room.Channel        = User.Channel;
                            Room.Name           = getBlock(0);
                            Room.EnablePassword = Convert.ToInt32(getBlock(1));
                            Room.Password       = getBlock(2);
                            Room.MaxPlayers     = (Convert.ToInt32(getBlock(3)) + 1);
                            Room.MapID          = Convert.ToInt32(getBlock(4));
                            Room.SuperMaster    = User.hasItem("CC02");

                            switch (Room.Channel)
                            {
                            case 1:
                            {
                                switch (Room.MaxPlayers)
                                {
                                case 1: Room.MaxPlayers = 8; break;

                                case 2: Room.MaxPlayers = 16; break;

                                case 3: Room.MaxPlayers = 20; break;

                                case 4: Room.MaxPlayers = 24; break;
                                }
                                break;
                            }

                            case 2:
                            {
                                switch (Room.MaxPlayers)
                                {
                                case 1: Room.MaxPlayers = 8; break;

                                case 2: Room.MaxPlayers = 16; break;

                                case 3: Room.MaxPlayers = 20; break;

                                case 4: Room.MaxPlayers = 24; break;

                                case 5: Room.MaxPlayers = 32; break;
                                }
                                break;
                            }
                            }
                            if (Room.MapID == 66)
                            {
                                Room.MaxPlayers = 32;
                            }
                            Room.Mode     = Convert.ToInt32(getBlock(5));
                            Room.RoomType = Convert.ToInt32(getBlock(7));

                            if (Room.Name.StartsWith("E|") && User.Rank > 2 && Room.Name.Length > 2)
                            {
                                Room.Name     = Room.Name.Substring(2);
                                Room.RoomType = 3;
                            }
                            Room.LevelLimit  = Convert.ToInt32(getBlock(8));
                            Room.PremiumOnly = Convert.ToInt32(getBlock(9));
                            Room.VoteKick    = Convert.ToInt32(getBlock(10));
                            if (Room.Mode == 0)
                            {
                                Room.Rounds = Convert.ToInt32(getBlock(12));
                            }
                            else
                            {
                                Room.Rounds = Convert.ToInt32(getBlock(11));
                            }
                            Room.TimeLimit = Convert.ToInt32(getBlock(14));
                            Room.Ping      = Convert.ToInt32(getBlock(15));

                            int isAutoStart = Convert.ToInt32(getBlock(16));
                            if (isAutoStart == 1)
                            {
                                Room.AutoStart = true;
                            }
                            if (Room.RoomType == 1 && Room.Mode == 1 && Room.Channel == 1)
                            {
                                Room.Mode = 0;
                            }
                            Room.NewMode    = Convert.ToInt32(getBlock(17));
                            Room.SubNewMode = Convert.ToInt32(getBlock(18));
                            if (Room.joinUser(User, 0))
                            {
                                if (RoomManager.addRoom(Room.Channel, Room.ID, Room))
                                {
                                    User.isReady  = User.isSpawned = false;
                                    User.RoomSlot = 0;
                                    User.send(new PACKET_CREATE_ROOM(Room));
                                    Room.UserLimitCount = Room.MaxPlayers;
                                    foreach (virtualUser _User in UserManager.getUsersInChannel(Room.Channel, false))
                                    {
                                        if (_User.Page == Math.Floor(Convert.ToDecimal(Room.ID / 14)))
                                        {
                                            _User.send(new PACKET_ROOMLIST_UPDATE(Room, 0));
                                            _User.send(new PACKET_ROOMLIST_UPDATE(Room));
                                        }
                                    }
                                }
                                else
                                {
                                    Log.AppendError("Couldn't Add Room" + Room.ID + ":" + Room.Name + " To the Room Pool");
                                    //Error Joining Room?
                                    User.disconnect();
                                }
                            }
                            else
                            {
                                Log.AppendError("Couldn't Join Room" + Room.ID + ":" + Room.Name + " As Master");
                                //Error Joining Room?
                                User.disconnect();
                            }
                        }
                    }
                }
                else
                {
                    if (ResultID >= 0 && User.Room == null)
                    {
                        virtualRoom Room = new virtualRoom()
                        {
                            ID             = ResultID,
                            Channel        = User.Channel,
                            Name           = getNextBlock(),
                            EnablePassword = Convert.ToInt32(getNextBlock()),
                            Password       = getNextBlock(),
                            MaxPlayers     = 4,
                            MapID          = Convert.ToInt32(getBlock(4)),
                        };

                        Room.Mode             = Convert.ToInt32(getBlock(5));
                        Room.LevelLimit       = Convert.ToInt32(getBlock(8));
                        Room.ZombieDifficulty = Convert.ToInt32(getBlock(13));
                        Room.Ping             = Convert.ToInt32(getBlock(15));
                        if (Room.Channel == 3 && Room.Mode != 12)
                        {
                            for (int i = 0; i < 26; i++)
                            {
                                Room.Zombies.Add(i + 4, new virtualZombie((i + 4), 0, 0, 0));
                            }
                        }
                        int isAutoStart = Convert.ToInt32(getBlock(16));
                        if (isAutoStart == 1)
                        {
                            Room.AutoStart = true;
                        }

                        if (Room.joinUser(User, 0))
                        {
                            if (RoomManager.addRoom(Room.Channel, Room.ID, Room))
                            {
                                User.send(new PACKET_CREATE_ROOM(Room));
                                Room.UserLimitCount = Room.MaxPlayers;
                                foreach (virtualUser _User in UserManager.getUsersInChannel(Room.Channel, false))
                                {
                                    if (_User.Page == Math.Floor(Convert.ToDecimal(Room.ID / 14)))
                                    {
                                        _User.send(new PACKET_ROOMLIST_UPDATE(Room, 0));
                                        _User.send(new PACKET_ROOMLIST_UPDATE(Room));
                                    }
                                }
                            }
                            else
                            {
                                Log.AppendError("Couldn't Add Room" + Room.ID + ":" + Room.Name + " To the Room Pool");
                                User.disconnect();
                            }
                        }
                        else
                        {
                            Log.AppendError("Couldn't Join Room" + Room.ID + ":" + Room.Name + " As Master");
                            User.disconnect();
                        }
                    }
                }
            }
            catch (Exception ex) { Log.AppendError(ex.Message); }
        }
示例#17
0
        public override void Handle(ReBornWarRock_PServer.GameServer.Virtual_Objects.User.virtualUser User)
        {
            try
            {
                ArrayList Rooms = RoomManager.getRoomsInChannel(User.Channel, new Random().Next(0, RoomManager.RoomToPageCount(User.Channel)));
                foreach (virtualRoom Room in Rooms)
                {
                    if (User.Room != null)
                    {
                        return;
                    }
                    if (Room.Players.Count >= Room.MaxPlayers)
                    {
                        return;
                    }
                    if (Room.EnablePassword == 1)
                    {
                        return;
                    }
                    if (Room.UserLimit == true)
                    {
                        return;
                    }
                    if (Room.LevelLimit > 0)
                    {
                        return;
                    }
                    if (Room.RoomType == 1)
                    {
                        return;
                    }

                    int Side = Convert.ToInt32(getBlock(2));
                    if (Room.joinUser(User, Side) == true)
                    {
                        ArrayList tempPlayers = new ArrayList();
                        User.isReady      = false;
                        User.isSpawned    = false;
                        User.Health       = 0;
                        User.BackedToRoom = false;
                        foreach (virtualUser RoomUser in Room.Players)
                        {
                            if (RoomUser.Equals(User) == false)
                            {
                                tempPlayers.Add(RoomUser);
                            }
                        }
                        User.send(new PACKET_ROOM_UDP(User, tempPlayers));

                        foreach (virtualUser tempSpectator in Room.Spectators)
                        {
                            User.send(new PACKET_ROOM_UDP_SPECTATE(tempSpectator));
                        }

                        User.send(new PACKET_JOIN_ROOM(User, Room));

                        tempPlayers.Clear();
                        tempPlayers.Add(User);

                        foreach (virtualUser RoomUser in Room.Players)
                        {
                            RoomUser.send(new PACKET_ROOM_UDP(RoomUser, tempPlayers));
                        }

                        foreach (virtualUser SpectatorUser in Room.Spectators)
                        {
                            SpectatorUser.send(new PACKET_ROOM_UDP(SpectatorUser, tempPlayers));
                        }

                        /* Send out changed Room Data */

                        foreach (virtualUser _User in UserManager.getUsersInChannel(Room.Channel, false))
                        {
                            if (_User.Page == Math.Floor(Convert.ToDecimal(Room.ID / 14)))
                            {
                                _User.send(new PACKET_ROOMLIST_UPDATE(Room));
                            }
                        }
                        return;
                    }
                }
            }
            catch (Exception ex)
            {
                Log.AppendError("Error at QuickJoin: " + ex.Message);
            }
        }