コード例 #1
0
 public override void Write(BgoProtocolWriter w)
 {
     base.Write(w);
     w.Write(minYawSpeed);
     w.Write(maxPitch);
     w.Write(maxRoll);
     w.Write(pitchFading);
     w.Write(yawFading);
     w.Write(rollFading);
 }
コード例 #2
0
        private void SetOutpost(uint index)
        {
            BgoProtocolWriter buffer = NewMessage();

            buffer.Write((ushort)Reply.OutpostStateBroadcast);
            buffer.Write((ushort)1000); //outpost points
            buffer.Write((float)1);
            buffer.Write((ushort)1000); //outpost points
            buffer.Write((float)1);
            SendMessageToSector(index, buffer);
        }
コード例 #3
0
        private void SendNewAvatarDescription(int index)
        {
            BgoProtocolWriter buffer = NewMessage();

            buffer.Write((ushort)29);
            buffer.Write(0);
            buffer.Write(0);
            buffer.Write((byte)0);

            SendMessageToUser(index, buffer);
        }
コード例 #4
0
 public override void Write(BgoProtocolWriter w)
 {
     base.Write(w);
     w.Write(Level);
     w.Write(MaxLevel);
     w.Write(next);
     w.Write(cardGUID2);
     w.Write(CounterValue);
     w.Write(Experience);
     w.Write(cardGUID3);
 }
コード例 #5
0
        public void Write(BgoProtocolWriter w)
        {
            int num = ObjStats.Count;

            w.Write((ushort)num);
            foreach (KeyValuePair <ObjectStat, float> pair in ObjStats)
            {
                w.Write((ushort)pair.Key);
                w.Write(pair.Value);
            }
        }
コード例 #6
0
 public void Write(BgoProtocolWriter w)
 {
     w.Write(raysColor);
     w.Write(streakColor);
     w.Write(glowColor);
     w.Write(discColor);
     w.Write(occlusionFade);
     w.Write(rotation);
     w.Write(position);
     w.Write(scale);
 }
コード例 #7
0
 protected void SendMessageToEveryone(BgoProtocolWriter bw)
 {
     if (enabled)
     {
     }
     else
     {
         Log.Add(LogSeverity.ERROR, string.Format("Trying to send message to everyone for disabled protocol \"{0}\"", protocolID));
     }
     bw.Dispose();
 }
コード例 #8
0
        public void SendLocation(int index, uint playerId)
        {
            BgoProtocolWriter buffer = NewMessage();

            buffer.Write((ushort)Reply.PlayerLocation);
            buffer.Write(playerId);
            buffer.Write((byte)1);
            buffer.Write((uint)1427);

            SendMessageToUser(index, buffer);
        }
コード例 #9
0
        private void SendDock(int index, float dockDelay)
        {
            BgoProtocolWriter buffer = NewMessage();

            buffer.Write((ushort)Reply.DockingDelay);

            buffer.Write(dockDelay);

            SendMessageToUser(index, buffer);
            SendRemoveMe(index, 5);
        }
コード例 #10
0
 public void Write(BgoProtocolWriter w)
 {
     w.Write(matSuffix);
     w.Write(modelName);
     w.Write(rotation);
     w.Write(position);
     w.Write(scale);
     w.Write(textureOffset);
     w.Write(textureScale);
     w.Write(color);
 }
コード例 #11
0
        // This is the case that determines where the player is going to be. It will send the
        // TransSceneType and GameLocation.
        // There are multiple locations to send such as Space, Room, Story etc.
        public void SendLoadNextScene(int index)
        {
            BgoProtocolWriter buffer = NewMessage();

            buffer.Write((ushort)Reply.LoadNextScene);

            Character charIndex = Server.GetClientByIndex(index).Character;

            buffer.Write((byte)charIndex.getTransSceneType());
            buffer.Write((byte)charIndex.GameLocation);

            switch (charIndex.GameLocation)
            {
            case GameLocation.Starter:
                buffer.Write((uint)3027);     //ColonialBonusGUID
                buffer.Write((uint)3127);     //CylonBonusGUID
                break;

            case GameLocation.Avatar:
                buffer.Write((ushort)0); // No idea since the game doesn't use this (it does, but for a loop that does nothing).
                buffer.Write(false);     // No idea since the game doesn't use this.
                break;

            case GameLocation.Room:

                break;

            case GameLocation.Space:
            case GameLocation.Story:
            case GameLocation.BattleSpace:
            case GameLocation.Tournament:
            case GameLocation.Tutorial:
            case GameLocation.Teaser:
                // I'm not sure where to send these. I feel like sending every time the user enters the
                // Space is wrong.

                PlayerProtocol.GetProtocol().SendPlayerId(index);
                PlayerProtocol.GetProtocol().SendName(index);
                PlayerProtocol.GetProtocol().SendAvatar(index);
                PlayerProtocol.GetProtocol().SendFaction(index);
                PlayerProtocol.GetProtocol().SendPlayerShips(index, 100, (uint)22131177);

                PlayerProtocol.GetProtocol().SetActivePlayerShip(index, 100);

                // I don't know which values to give so I'm just giving the numbers in order. E.g:
                // ColonialBonusGUID was 3027 and CylonBonusGUID was 3127. So here we have 1327 and 1427 :) lol
                buffer.Write((uint)1327);     // sector id
                buffer.Write((uint)1427);     // cardGuid2
                break;
            }

            SendMessageToUser(index, buffer);
        }
コード例 #12
0
        public override void Write(BgoProtocolWriter w)
        {
            base.Write(w);

            w.Write((ushort)ShipCards.Count);

            foreach (var shipCard in ShipCards)
            {
                w.Write(shipCard.CardGUID);
                w.Write(shipCard.CardGUID); // Should be fixed later
            }
        }
コード例 #13
0
 protected void SendMessageToUser(int index, BgoProtocolWriter bw)
 {
     if (enabled)
     {
         Server.SendDataToClient(index, bw);
         DebugMessage(bw);
     }
     else
     {
         Log.Add(LogSeverity.ERROR, string.Format("Trying to send message to \"{0}\" for disabled protocol \"{1}\"", index, protocolID));
     }
 }
コード例 #14
0
 public override void Write(BgoProtocolWriter w)
 {
     base.Write(w);
     w.Write(Key);
     w.Write(Level);
     w.Write(GUIAtlasTexturePath);
     w.Write(FrameIndex);
     w.Write(GUIIcon);
     w.Write(GUIAvatarSlotTexturePath);
     w.Write(GUITexturePath);
     w.Write(Args);
 }
コード例 #15
0
        private void SendStopJump(int index)
        {
            Client c = Server.GetClientByIndex(index);

            BgoProtocolWriter buffer2 = NewMessage();

            buffer2.Write((ushort)Reply.StopJump);

            c.Character.PlayerShip.requestedJumpSectorId = -1;
            c.Character.PlayerShip.ftlTime = DateTime.Now;

            SendMessageToUser(index, buffer2);
        }
コード例 #16
0
 /// <summary>
 /// Sends the message to the sector by getting the client[index].sector id
 /// </summary>
 /// <param name="index"></param>
 /// <param name="bw"></param>
 protected void SendMessageToSector(int index, BgoProtocolWriter bw)
 {
     if (enabled)
     {
         Server.SendDataToSector(Server.GetClientByIndex(index).Character.PlayerShip.sectorId, bw);
         DebugMessage(bw);
     }
     else
     {
         Log.Add(LogSeverity.ERROR, string.Format("Trying to send message to the Sector \"{0}\" for disabled protocol \"{1}\"", Server.GetSectorById(Server.GetClientByIndex(index).Character.PlayerShip.sectorId).Name, protocolID));
     }
     bw.Dispose();
 }
コード例 #17
0
        public void SendCardToSector(int index, CardView cardView, uint cardGuid)
        {
            BgoProtocolWriter buffer = NewMessage();

            buffer.Write((ushort)Reply.Card);

            Card card = Catalogue.FetchCard(cardGuid, cardView);

            if (card != null)
            {
                card.Write(buffer);
                SendMessageToSector(index, buffer);
            }
        }
コード例 #18
0
        private void SendCard(int index, ushort cardView, uint cardGuid)
        {
            BgoProtocolWriter buffer = NewMessage();

            buffer.Write((ushort)Reply.Card);

            Card card = Catalogue.FetchCard(index, cardGuid, (CardView)cardView);

            if (card != null)
            {
                card.Write(buffer);
                SendMessageToUser(index, buffer);
            }
        }
コード例 #19
0
 public void Write(BgoProtocolWriter w)
 {
     w.Write(Id);
     w.Write(Position);
     w.Write(GUIIndex);
     w.Write((byte)StarFaction);
     w.Write((short)ColonialThreatLevel);
     w.Write((short)CylonThreatLevel);
     w.Write(SectorGUID);
     w.Write(CanColonialOutpost);
     w.Write(CanCylonOutpost);
     w.Write(CanColonialJumpBeacon);
     w.Write(CanCylonJumpBeacon);
 }
コード例 #20
0
        public void SetTimeOrigin(int index)
        {
            BgoProtocolWriter buffer = NewMessage();

            buffer.Write((ushort)Reply.TimeOrigin);

            long timeOrigin = (long)Server.GetSectorByClientIndex(index).CreatedTime.Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds;

            buffer.Write(timeOrigin);

            SendMessageToUser(index, buffer);

            Server.GetClientByIndex(index).Character.PlayerShip.timeOrigin = timeOrigin;
        }
コード例 #21
0
        public override void Write(BgoProtocolWriter w)
        {
            base.Write(w);
            w.Write(ShipObjectKey);
            w.Write(Tier);
            int num = ShipRoles.Length;

            w.Write((ushort)num);
            for (int i = 0; i < num; i++)
            {
                w.Write((byte)ShipRoles[i]);
            }
            w.Write((byte)ShipRoleDeprecated);
        }
コード例 #22
0
        public void SendShipInfo(int index)
        {
            BgoProtocolWriter buffer = NewMessage();

            buffer.Write((ushort)Reply.ShipInfo);

            uint     worldGuid   = Server.GetClientByIndex(index).Character.PlayerShip.WorldGuid;
            ShipCard currentShip = (ShipCard)Catalogue.FetchCard(worldGuid, CardView.Ship);

            buffer.Write((ushort)currentShip.HangarID);
            buffer.Write(currentShip.Durability);

            SendMessageToUser(index, buffer);
        }
コード例 #23
0
        private void WriteProperty(BgoProtocolWriter w, IDictionary <UserSetting, object> settings, UserSetting property)
        {
            object obj = settings[property];

            w.Write((byte)property);
            UserSettingValueType valueType = GetValueType(property);

            w.Write((byte)valueType);
            switch (valueType)
            {
            case UserSettingValueType.Byte:
                w.Write((byte)obj);
                break;

            case UserSettingValueType.Float:
                w.Write((float)obj);
                break;

            case UserSettingValueType.Boolean:
                w.Write((bool)obj);
                break;

            case UserSettingValueType.Integer:
                w.Write((int)obj);
                break;

            case UserSettingValueType.Float2:
            {
                float2 @float = (float2)obj;
                w.Write(@float.x);
                w.Write(@float.y);
                break;
            }

            case UserSettingValueType.HelpScreenType:
            {
                List <HelpScreenType> list = (List <HelpScreenType>)obj;
                w.Write((ushort)list.Count);
                foreach (HelpScreenType item in list)
                {
                    w.Write((ushort)item);
                }
                break;
            }

            default:
                w.Write((byte)0);
                break;
            }
        }
コード例 #24
0
        public void Write(BgoProtocolWriter w)
        {
            w.Write(sex);
            w.Write(race);
            w.Write((ushort)items.Count);

            foreach (KeyValuePair <string, List <string> > pair in items)
            {
                w.Write(pair.Key);
                int pairCount = pair.Value.Count;
                w.Write((ushort)pairCount);
                for (int i = 0; i < pairCount; i++)
                {
                    w.Write(pair.Value[i]);
                }
            }

            w.Write((ushort)materials.Count);

            foreach (KeyValuePair <string, Dictionary <string, List <string> > > pair in materials)
            {
                w.Write(pair.Key);
                w.Write((ushort)pair.Value.Count);

                foreach (KeyValuePair <string, List <string> > pair2 in pair.Value)
                {
                    w.Write(pair2.Key);
                    int pair2Count = pair2.Value.Count;
                    w.Write((ushort)pair2Count);
                    for (int i = 0; i < pair2Count; i++)
                    {
                        w.Write(pair2.Value[i]);
                    }
                }
            }

            w.Write((ushort)textures.Count);

            foreach (KeyValuePair <string, List <string> > pair3 in textures)
            {
                w.Write(pair3.Key);
                int pairCount = pair3.Value.Count;
                w.Write((ushort)pairCount);
                for (int i = 0; i < pairCount; i++)
                {
                    w.Write(pair3.Value[i]);
                }
            }
        }
コード例 #25
0
        // Sends the current milliseconds of the server to the client. It is requested every few seconds
        // 3 times in a row.
        private void SendSync(int index)
        {
            BgoProtocolWriter buffer = NewMessage();

            buffer.Write((ushort)1);
            long currentServerTimeMillis = (long)DateTime.UtcNow.ToUniversalTime().Subtract(new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalMilliseconds;

            buffer.Write((ulong)currentServerTimeMillis);
            SendMessageToUser(index, buffer);

            Client curr = Server.GetClientByIndex(index);

            curr.TimeSync.ReceiveSync();
            curr.TimeSync.ClientReply(currentServerTimeMillis);
        }
コード例 #26
0
        public void SpawnPlanetoid(int connectionId, uint objectId, Vector3 position)
        {
            BgoProtocolWriter buffer = NewMessage();

            buffer.Write((ushort)Reply.WhoIs);
            buffer.Write((uint)SpaceEntityType.Planetoid + objectId);
            buffer.Write((byte)CreatingCause.JumpIn);
            buffer.Write((uint)9988);   // The OwnerGUID
            buffer.Write((uint)270503); // The WorldCardGUID

            buffer.Write(position);
            buffer.Write((float)0.5);
            buffer.Write(0f);
            SendMessageToUser(connectionId, buffer);
        }
コード例 #27
0
        public void SendItems(int index)
        {
            BgoProtocolWriter buffer = NewMessage();

            buffer.Write((ushort)Reply.HoldItems);

            //size
            buffer.Write((ushort)1);
            buffer.Write((ushort)1); //serverId
            buffer.Write((byte)2);   //itemType
            buffer.Write(215278030u);
            buffer.Write(1000000);

            SendMessageToUser(index, buffer);
        }
コード例 #28
0
 public override void Write(BgoProtocolWriter w)
 {
     base.Write(w);
     w.Write(TitaniumRepairCard);
     w.Write(CubitsRepairCard);
     w.Write(CapitalShipPrice);
     w.Write(UndockTimeout);
     w.Write(FriendBonus.CardGUID);
     w.Write(SpecialFriendBonus.Count);
     foreach (KeyValuePair <int, RewardCard> friendBonus in SpecialFriendBonus)
     {
         w.Write((byte)friendBonus.Key);
         w.Write(friendBonus.Value.CardGUID);
     }
 }
コード例 #29
0
        public void SendStatsHullPoints(int index)
        {
            BgoProtocolWriter buffer = NewMessage();

            buffer.Write((ushort)Reply.Stats);

            ShipCard currentShip = ((ShipCard)Catalogue.FetchCard(Server.GetClientByIndex(index).Character.PlayerShip.WorldGuid, CardView.Ship));

            buffer.Write((ushort)1);

            buffer.Write((byte)7);
            buffer.Write(currentShip.Stats.MaxHullPoints);

            SendMessageToUser(index, buffer);
        }
コード例 #30
0
        private void SendNameAvailability(int index, string name)
        {
            BgoProtocolWriter buffer = NewMessage();

            if (Database.Database.CheckCharacterNameAvailability(name))
            {
                buffer.Write((ushort)20);
            }
            else
            {
                buffer.Write((ushort)21);
            }

            SendMessageToUser(index, buffer);
        }