Пример #1
0
        private static void Register(Packet inPacket)
        {
            ServerRegsitrationResponse response = (ServerRegsitrationResponse)inPacket.ReadByte();

            switch (response)
            {
            case ServerRegsitrationResponse.Valid:
            {
                WvsGame.WorldID        = inPacket.ReadByte();
                WvsGame.WorldName      = inPacket.ReadString();
                WvsGame.TickerMessage  = inPacket.ReadString();
                WvsGame.ChannelID      = inPacket.ReadByte();
                WvsGame.RemoteEndPoint = new IPEndPoint(IPAddress.Loopback, inPacket.ReadUShort());
                WvsGame.Listen();

                WvsGame.AllowMultiLeveling = inPacket.ReadBool();
                Log.Inform("Characters will {0}be able to continuously level-up.", WvsGame.AllowMultiLeveling ? "" : "not ");

                WvsGame.ExperienceRate           = inPacket.ReadInt();
                WvsGame.QuestExperienceRate      = inPacket.ReadInt();
                WvsGame.PartyQuestExperienceRate = inPacket.ReadInt();
                WvsGame.MesoRate = inPacket.ReadInt();
                WvsGame.DropRate = inPacket.ReadInt();
                Log.Inform("Rates: \n ExpRate: {0}x \n QuestExpRate: {1}x \n PartyQuestExpRate: {2}x \n MesoRate: {3}x \n DropRate: {4}x",
                           WvsGame.ExperienceRate,
                           WvsGame.QuestExperienceRate,
                           WvsGame.PartyQuestExperienceRate,
                           WvsGame.MesoRate,
                           WvsGame.DropRate);

                Log.SkipLine();
                Log.Success("Registered Channel: {0}-{2} on World: {0}-{1}.", WvsGame.WorldName, WvsGame.WorldID, (WvsGame.ChannelID + 1));
                Log.SkipLine();
            }
            break;

            case ServerRegsitrationResponse.InvalidType:
                break;

            case ServerRegsitrationResponse.InvalidCode:
                break;

            case ServerRegsitrationResponse.Full:
                break;

            default:
            {
                Log.SkipLine();
                Log.Error("Unable to register as Channel Server: {0}", ServerRegistrationResponseResolver.Explain(response));
                Log.SkipLine();

                WvsGame.Stop();
            }
            break;
            }

            WvsGame.CenterConnectionDone.Set();
        }