예제 #1
0
 public override void Decode()
 {
     if (Client.CState == 1)
     {
         using (var reader = new CoCSharpPacketReader(new MemoryStream(GetData())))
         {
             UserID                       = reader.ReadInt64();
             UserToken                    = reader.ReadString();
             MajorVersion                 = reader.ReadInt32();
             ContentVersion               = reader.ReadInt32();
             MinorVersion                 = reader.ReadInt32();
             MasterHash                   = reader.ReadString();
             Unknown1                     = reader.ReadString();
             OpenUDID                     = reader.ReadString();
             MacAddress                   = reader.ReadString();
             DeviceModel                  = reader.ReadString();
             LocaleKey                    = reader.ReadInt32();
             Language                     = reader.ReadString();
             AdvertisingGUID              = reader.ReadString();
             OSVersion                    = reader.ReadString();
             Unknown2                     = reader.ReadByte();
             Unknown3                     = reader.ReadString();
             AndroidDeviceID              = reader.ReadString();
             FacebookDistributionID       = reader.ReadString();
             IsAdvertisingTrackingEnabled = reader.ReadBoolean();
             VendorGUID                   = reader.ReadString();
             Seed          = reader.ReadInt32();
             Unknown4      = reader.ReadByte();
             Unknown5      = reader.ReadString();
             Unknown6      = reader.ReadString();
             ClientVersion = reader.ReadString();
         }
     }
 }
예제 #2
0
 public CastSpellCommand(CoCSharpPacketReader br)
 {
     X        = br.ReadInt32WithEndian();
     Y        = br.ReadInt32WithEndian();
     Spell    = (SpellData)br.ReadDataReference();
     Unknown1 = br.ReadUInt32WithEndian();
 }
예제 #3
0
 public KickAllianceMemberCommand(CoCSharpPacketReader br)
 {
     m_vAvatarId = br.ReadInt64WithEndian();
     br.ReadByte();
     m_vMessage = br.ReadScString();
     br.ReadInt32WithEndian();
 }
예제 #4
0
 public PlaceAttackerCommand(CoCSharpPacketReader br)
 {
     X        = br.ReadInt32WithEndian();
     Y        = br.ReadInt32WithEndian();
     Unit     = (CharacterData)br.ReadDataReference();
     Unknown1 = br.ReadUInt32WithEndian();
 }
예제 #5
0
 public SpeedUpHeroHealthCommand(CoCSharpPacketReader br)
 {
     /*
      * m_vBuildingId = br.ReadInt32WithEndian();
      * br.ReadInt32WithEndian();
      */
 }
예제 #6
0
 public BuyTrapCommand(CoCSharpPacketReader br)
 {
     X        = br.ReadInt32WithEndian();
     Y        = br.ReadInt32WithEndian();
     TrapId   = br.ReadInt32WithEndian();
     Unknown1 = br.ReadUInt32WithEndian();
 }
예제 #7
0
 public CancelUpgradeUnitCommand(CoCSharpPacketReader br)
 {
     /*
      * BuildingId = br.ReadUInt32WithEndian(); //buildingId - 0x1DCD6500;
      * Unknown1 = br.ReadUInt32WithEndian();
      */
 }
예제 #8
0
        public bool TryGetPacket(out Message p)
        {
            p = null;
            bool result = false;

            if (DataStream.Count >= 5)
            {
                int    length = (0x00 << 24) | (DataStream[2] << 16) | (DataStream[3] << 8) | DataStream[4];
                ushort type   = (ushort)((DataStream[0] << 8) | DataStream[1]);
                if (DataStream.Count - 7 >= length)
                {
                    object obj;
                    byte[] packet = DataStream.Take(7 + length).ToArray();
                    using (CoCSharpPacketReader br = new CoCSharpPacketReader(new MemoryStream(packet)))
                        obj = MessageFactory.Read(this, br, type);
                    if (obj != null)
                    {
                        p      = (Message)obj;
                        result = true;
                    }
                    DataStream.RemoveRange(0, 7 + length);
                }
            }
            return(result);
        }
예제 #9
0
 public MoveBuildingCommand(CoCSharpPacketReader br)
 {
     X          = br.ReadInt32WithEndian();
     Y          = br.ReadInt32WithEndian();
     BuildingId = br.ReadInt32WithEndian(); //buildingId - 0x1DCD6500;
     Unknown1   = br.ReadUInt32WithEndian();
 }
예제 #10
0
        public override void Process(Level level)
        {
            try
            {
                level.Tick();

                if (NumberOfCommands > 0 && NumberOfCommands < 20)
                {
                    using (var br = new CoCSharpPacketReader(new MemoryStream(NestedCommands)))
                        for (var i = 0; i < NumberOfCommands; i++)
                        {
                            var obj = CommandFactory.Read(br);
                            if (obj != null)
                            {
                                ((Command)obj).Execute(level);
                            }
                            else
                            {
                                break;
                            }
                        }
                }
            }
            catch (Exception ex)
            {
            }
        }
예제 #11
0
 public BuyBuildingCommand(CoCSharpPacketReader br)
 {
     X          = br.ReadInt32WithEndian();
     Y          = br.ReadInt32WithEndian();
     BuildingId = br.ReadInt32WithEndian();
     Unknown1   = br.ReadUInt32WithEndian();
 }
예제 #12
0
 public UpgradeUnitCommand(CoCSharpPacketReader br)
 {
     BuildingId = br.ReadInt32WithEndian();
     Unknown1   = br.ReadUInt32WithEndian();
     UnitData   = (CombatItemData)br.ReadDataReference();
     Unknown2   = br.ReadUInt32WithEndian();
 }
예제 #13
0
 public SetActiveVillageLayoutCommand(CoCSharpPacketReader br)
 {
     br.ReadInt32();
     br.ReadInt32();
     br.ReadInt32();
     // Not done
 }
예제 #14
0
 public virtual void Decode(byte[] baseData)
 {
     using (var br = new CoCSharpPacketReader(new MemoryStream(baseData)))
     {
         m_vUnknown1 = br.ReadInt32WithEndian();
     }
 }
예제 #15
0
 public override void Decode()
 {
     using (var br = new CoCSharpPacketReader(new MemoryStream(GetData())))
     {
         m_vId   = br.ReadInt64WithEndian();
         m_vRole = br.ReadInt32WithEndian();
     }
 }
예제 #16
0
 public SaveVillageLayoutCommand(CoCSharpPacketReader br)
 {
     br.Read();
     br.ReadInt32();
     br.ReadInt32();
     br.ReadInt32();
     // Note done yet
 }
예제 #17
0
 public DonateAllianceUnitCommand(CoCSharpPacketReader br)
 {
     Unknown1 = br.ReadUInt32WithEndian();
     PlayerId = br.ReadUInt32WithEndian();
     UnitType = br.ReadUInt32WithEndian();
     Unknown2 = br.ReadUInt32WithEndian();
     Unknown3 = br.ReadUInt32WithEndian();
 }
예제 #18
0
 public static object Read(Client c, CoCSharpPacketReader br, int packetType)
 {
     if (m_vMessages.ContainsKey(packetType))
     {
         return(Activator.CreateInstance(m_vMessages[packetType], c, br));
     }
     return(null);
 }
예제 #19
0
 public TrainUnitCommand(CoCSharpPacketReader br)
 {
     BuildingId = br.ReadInt32WithEndian();
     Unknown1   = br.ReadUInt32WithEndian();
     UnitType   = br.ReadInt32WithEndian();
     Count      = br.ReadInt32WithEndian();
     Unknown3   = br.ReadUInt32WithEndian();
     br.ReadInt32WithEndian();
 }
예제 #20
0
 public EditVillageLayoutCommand(CoCSharpPacketReader br)
 {
     br.ReadInt32();
     br.ReadInt32();
     br.ReadInt32();
     br.ReadInt32();
     br.ReadInt32();
     // Not 100% Done
 }
예제 #21
0
 public BoostBuildingCommand(CoCSharpPacketReader br)
 {
     BuildingIds           = new List <int>();
     BoostedBuildingsCount = br.ReadInt32WithEndian();
     for (var i = 0; i < BoostedBuildingsCount; i++)
     {
         BuildingIds.Add(br.ReadInt32WithEndian());
     }
 }
예제 #22
0
 public ToggleAttackModeCommand(CoCSharpPacketReader br)
 {
     /*
      * BuildingId = br.ReadUInt32WithEndian(); //buildingId - 0x1DCD6500;
      * Unknown1 = br.ReadByte();
      * Unknown2 = br.ReadUInt32WithEndian();
      * Unknown3 = br.ReadUInt32WithEndian();
      */
 }
예제 #23
0
 public CancelUnitProductionCommand(CoCSharpPacketReader br)
 {
     BuildingId = br.ReadInt32WithEndian(); //buildingId - 0x1DCD6500;
     Unknown1   = br.ReadUInt32WithEndian();
     UnitType   = br.ReadInt32WithEndian();
     Count      = br.ReadInt32WithEndian();
     Unknown3   = br.ReadUInt32WithEndian();
     Unknown4   = br.ReadUInt32WithEndian();
 }
예제 #24
0
 public JoinAllianceCommand(CoCSharpPacketReader br)
 {
     br.ReadInt64();
     br.ReadString();
     br.ReadInt32();
     br.ReadByte();
     br.ReadInt32();
     br.ReadInt32();
     br.ReadInt32();
 }
예제 #25
0
        public static object Read(CoCSharpPacketReader br)
        {
            var cm = br.ReadUInt32WithEndian();

            if (m_vCommands.ContainsKey(cm))
            {
                //Console.WriteLine("[UCS]    Processing " + m_vCommands[cm]);
                return(Activator.CreateInstance(m_vCommands[cm], br));
            }
            //Console.WriteLine("\t The command '" + cm + "' has been ignored");
            return(null);
        }
예제 #26
0
파일: CommandFactory.cs 프로젝트: skwbr/UCS
        public static object Read(CoCSharpPacketReader br)
        {
            var cm = br.ReadUInt32WithEndian();

            if (m_vCommands.ContainsKey(cm))
            {
                _Logger.Print("[UCS]    Processing " + m_vCommands[cm], Types.INFO);
                return(Activator.CreateInstance(m_vCommands[cm], br));
            }
            _Logger.Print("\t The command '" + cm + "' has been ignored", Types.INFO);
            return(null);
        }
예제 #27
0
 public RequestAllianceUnitsCommand(CoCSharpPacketReader br)
 {
     Unknown1 = br.ReadUInt32WithEndian();
     FlagHasRequestMessage = br.ReadByte();
     if (FlagHasRequestMessage == 0x01)
     {
         Message = br.ReadScString();
     }
     else
     {
         Message = "I need reinforcements !";
     }
 }
예제 #28
0
        public UpgradeMultipleBuildingsCommand(CoCSharpPacketReader br)
        {
            m_vIsAltResource  = br.ReadByte();
            m_vBuildingIdList = new List <int>();
            var buildingCount = br.ReadInt32WithEndian();

            for (var i = 0; i < buildingCount; i++)
            {
                var buildingId = br.ReadInt32WithEndian();
                m_vBuildingIdList.Add(buildingId);
            }
            br.ReadInt32WithEndian();
        }
예제 #29
0
        public override void Decode()
        {
            using (var br = new CoCSharpPacketReader(new MemoryStream(GetData())))
            {
                Subtick          = br.ReadUInt32WithEndian();
                Checksum         = br.ReadUInt32WithEndian();
                NumberOfCommands = br.ReadUInt32WithEndian();

                if (NumberOfCommands > 0 && NumberOfCommands < 20)
                {
                    NestedCommands = br.ReadBytes(GetLength());
                }
            }
        }
예제 #30
0
 public override void Decode()
 {
     using (CoCSharpPacketReader br = new CoCSharpPacketReader(new MemoryStream(GetData())))
     {
         m_vAllianceName        = br.ReadString();
         m_vAllianceDescription = br.ReadString();
         m_vAllianceBadgeData   = br.ReadInt32WithEndian();
         m_vAllianceType        = br.ReadInt32WithEndian();
         m_vRequiredScore       = br.ReadInt32WithEndian();
         m_vWarFrequency        = br.ReadInt32WithEndian();
         m_vAllianceOrigin      = br.ReadInt32WithEndian();
         m_vWarLogPublic        = br.ReadByte();
     }
 }