public override void Deserialize(BigEndianReader reader)
 {
     timestamp = reader.ReadDouble();
     if (timestamp < 0 || timestamp > 9.007199254740992E15)
         throw new Exception("Forbidden value on timestamp = " + timestamp + ", it doesn't respect the following condition : timestamp < 0 || timestamp > 9.007199254740992E15");
     timezoneOffset = reader.ReadShort();
 }
 public override void Deserialize(BigEndianReader reader)
 {
     base.Deserialize(reader);
     guestId = reader.ReadVarInt();
     if (guestId < 0)
         throw new Exception("Forbidden value on guestId = " + guestId + ", it doesn't respect the following condition : guestId < 0");
 }
 public override void Deserialize(BigEndianReader reader)
 {
     base.Deserialize(reader);
     spellId = reader.ReadVarShort();
     if (spellId < 0)
         throw new Exception("Forbidden value on spellId = " + spellId + ", it doesn't respect the following condition : spellId < 0");
 }
 public override void Deserialize(BigEndianReader reader)
 {
     characterId = reader.ReadInt();
     if (characterId < 0)
         throw new Exception("Forbidden value on characterId = " + characterId + ", it doesn't respect the following condition : characterId < 0");
     secretAnswerHash = reader.ReadUTF();
 }
 public override void Deserialize(BigEndianReader reader)
 {
     base.Deserialize(reader);
      byte b= reader.ReadByte();
      this.showExperience = BooleanByteWrapper.GetFlag(b,0);
      this.showExperienceLevelFloor = BooleanByteWrapper.GetFlag(b, 1);
      this.showExperienceNextLevelFloor = BooleanByteWrapper.GetFlag(b, 2);
      this.showExperienceFightDelta = BooleanByteWrapper.GetFlag(b, 3);
      this.showExperienceForGuild = BooleanByteWrapper.GetFlag(b, 4);
      this.showExperienceForMount = BooleanByteWrapper.GetFlag(b, 5);
      this.isIncarnationExperience = BooleanByteWrapper.GetFlag(b, 6);
     experience = reader.ReadVarUhLong();
     if (experience < 0 || experience > 9.007199254740992E15)
         throw new Exception("Forbidden value on experience = " + experience + ", it doesn't respect the following condition : experience < 0 || experience > 9.007199254740992E15");
     experienceLevelFloor = reader.ReadVarUhLong();
     if (experienceLevelFloor < 0 || experienceLevelFloor > 9.007199254740992E15)
         throw new Exception("Forbidden value on experienceLevelFloor = " + experienceLevelFloor + ", it doesn't respect the following condition : experienceLevelFloor < 0 || experienceLevelFloor > 9.007199254740992E15");
     experienceNextLevelFloor = reader.ReadDouble();
     if (experienceNextLevelFloor < 0 || experienceNextLevelFloor > 9.007199254740992E15)
         throw new Exception("Forbidden value on experienceNextLevelFloor = " + experienceNextLevelFloor + ", it doesn't respect the following condition : experienceNextLevelFloor < 0 || experienceNextLevelFloor > 9.007199254740992E15");
     experienceFightDelta = reader.ReadVarInt();
     experienceForGuild = reader.ReadVarInt();
     if (experienceForGuild < 0)
         throw new Exception("Forbidden value on experienceForGuild = " + experienceForGuild + ", it doesn't respect the following condition : experienceForGuild < 0");
     experienceForMount = reader.ReadVarInt();
     if (experienceForMount < 0)
         throw new Exception("Forbidden value on experienceForMount = " + experienceForMount + ", it doesn't respect the following condition : experienceForMount < 0");
     rerollExperienceMul = reader.ReadSByte();
     if (rerollExperienceMul < 0)
         throw new Exception("Forbidden value on rerollExperienceMul = " + rerollExperienceMul + ", it doesn't respect the following condition : rerollExperienceMul < 0");
 }
 public override void Deserialize(BigEndianReader reader)
 {
     base.Deserialize(reader);
     wrongFlagCount = reader.ReadSByte();
     if (wrongFlagCount < 0)
         throw new Exception("Forbidden value on wrongFlagCount = " + wrongFlagCount + ", it doesn't respect the following condition : wrongFlagCount < 0");
 }
 public override void Deserialize(BigEndianReader reader)
 {
     base.Deserialize(reader);
     actorEventId = reader.ReadSByte();
     if (actorEventId < 0)
         throw new Exception("Forbidden value on actorEventId = " + actorEventId + ", it doesn't respect the following condition : actorEventId < 0");
 }
 public override void Deserialize(BigEndianReader reader)
 {
     base.Deserialize(reader);
     cells = reader.ReadVarShort();
     if (cells < 0 || cells > 559)
         throw new Exception("Forbidden value on cells = " + cells + ", it doesn't respect the following condition : cells < 0 || cells > 559");
 }
 public override void Deserialize(BigEndianReader reader)
 {
     byte flag1 = reader.ReadByte();
     enabled = BooleanByteWrapper.GetFlag(flag1, 0);
     abandonnedPaddock = BooleanByteWrapper.GetFlag(flag1, 1);
     level = reader.ReadByte();
     if (level < 0 || level > 255)
         throw new Exception("Forbidden value on level = " + level + ", it doesn't respect the following condition : level < 0 || level > 255");
     expLevelFloor = reader.ReadVarUhLong();
     if (expLevelFloor < 0 || expLevelFloor > 9.007199254740992E15)
         throw new Exception("Forbidden value on expLevelFloor = " + expLevelFloor + ", it doesn't respect the following condition : expLevelFloor < 0 || expLevelFloor > 9.007199254740992E15");
     experience = reader.ReadVarUhLong();
     if (experience < 0 || experience > 9.007199254740992E15)
         throw new Exception("Forbidden value on experience = " + experience + ", it doesn't respect the following condition : experience < 0 || experience > 9.007199254740992E15");
     expNextLevelFloor = reader.ReadVarUhLong();
     if (expNextLevelFloor < 0 || expNextLevelFloor > 9.007199254740992E15)
         throw new Exception("Forbidden value on expNextLevelFloor = " + expNextLevelFloor + ", it doesn't respect the following condition : expNextLevelFloor < 0 || expNextLevelFloor > 9.007199254740992E15");
     creationDate = reader.ReadInt();
     if (creationDate < 0)
         throw new Exception("Forbidden value on creationDate = " + creationDate + ", it doesn't respect the following condition : creationDate < 0");
     nbTotalMembers = reader.ReadVarShort();
     if (nbTotalMembers < 0)
         throw new Exception("Forbidden value on nbTotalMembers = " + nbTotalMembers + ", it doesn't respect the following condition : nbTotalMembers < 0");
     nbConnectedMembers = reader.ReadVarShort();
     if (nbConnectedMembers < 0)
         throw new Exception("Forbidden value on nbConnectedMembers = " + nbConnectedMembers + ", it doesn't respect the following condition : nbConnectedMembers < 0");
 }
Beispiel #10
0
 // Methods
 public static Map FromId(int id)
 {
     lock (MapsManager.CheckLock)
     {
         if (MapsManager.MapId_Map.ContainsKey(id))
         {
             return MapsManager.MapId_Map[id];
         }
         string str = ((id % 10).ToString() + "/" + id.ToString() + ".dlm");
         if (MapsManager.D2pFileManager.MapExists(str))
         {
             MemoryStream stream = new MemoryStream(MapsManager.D2pFileManager.method_1(str)) { Position = 2 };
             DeflateStream stream2 = new DeflateStream(stream, CompressionMode.Decompress);
             byte[] buffer = new byte[50001];
             MemoryStream destination = new MemoryStream(buffer);
             stream2.CopyTo(destination);
             destination.Position = 0;
             BigEndianReader reader = new BigEndianReader(destination);
             Map map2 = new Map();
             map2.Init(reader);
             MapsManager.MapId_Map.Add(id, map2);
             if ((MapsManager.MapId_Map.Count > 1000))
             {
                 MapsManager.MapId_Map.Remove(MapsManager.MapId_Map.Keys.First());
             }
             return map2;
         }
         MapsManager.MapId_Map.Add(id, null);
         if ((MapsManager.MapId_Map.Count > 1000))
         {
             MapsManager.MapId_Map.Remove(MapsManager.MapId_Map.Keys.First());
         }
         return null;
     }
 }
 public override void Deserialize(BigEndianReader reader)
 {
     base.Deserialize(reader);
     storageMaxSlot = reader.ReadVarInt();
     if (storageMaxSlot < 0)
         throw new Exception("Forbidden value on storageMaxSlot = " + storageMaxSlot + ", it doesn't respect the following condition : storageMaxSlot < 0");
 }
 public override void Deserialize(BigEndianReader reader)
 {
     base.Deserialize(reader);
     name = reader.ReadUTF();
     status = new Types.PlayerStatus();
     status.Deserialize(reader);
 }
 public override void Deserialize(BigEndianReader reader)
 {
     base.Deserialize(reader);
     remainingTime = reader.ReadVarInt();
     if (remainingTime < 0)
         throw new Exception("Forbidden value on remainingTime = " + remainingTime + ", it doesn't respect the following condition : remainingTime < 0");
 }
 public virtual void Deserialize(BigEndianReader reader)
 {
     spellId = reader.ReadInt();
     cooldown = reader.ReadSByte();
     if (cooldown < 0)
         throw new Exception("Forbidden value on cooldown = " + cooldown + ", it doesn't respect the following condition : cooldown < 0");
 }
 public override void Deserialize(BigEndianReader reader)
 {
     base.Deserialize(reader);
     monsterCount = reader.ReadVarInt();
     if (monsterCount < 0)
         throw new Exception("Forbidden value on monsterCount = " + monsterCount + ", it doesn't respect the following condition : monsterCount < 0");
 }
 public override void Deserialize(BigEndianReader reader)
 {
     base.Deserialize(reader);
     quantity = reader.ReadVarInt();
     if (quantity < 0)
         throw new Exception("Forbidden value on quantity = " + quantity + ", it doesn't respect the following condition : quantity < 0");
 }
 public virtual void Deserialize(BigEndianReader reader)
 {
     var limit = reader.ReadUShort();
     quantities = new int[limit];
     for (int i = 0; i < limit; i++)
     {
          quantities[i] = reader.ReadVarInt();
     }
     limit = reader.ReadUShort();
     types = new int[limit];
     for (int i = 0; i < limit; i++)
     {
          types[i] = reader.ReadVarInt();
     }
     taxPercentage = reader.ReadFloat();
     taxModificationPercentage = reader.ReadFloat();
     maxItemLevel = reader.ReadByte();
     if (maxItemLevel < 0 || maxItemLevel > 255)
         throw new Exception("Forbidden value on maxItemLevel = " + maxItemLevel + ", it doesn't respect the following condition : maxItemLevel < 0 || maxItemLevel > 255");
     maxItemPerAccount = reader.ReadVarInt();
     if (maxItemPerAccount < 0)
         throw new Exception("Forbidden value on maxItemPerAccount = " + maxItemPerAccount + ", it doesn't respect the following condition : maxItemPerAccount < 0");
     npcContextualId = reader.ReadInt();
     unsoldDelay = reader.ReadVarShort();
     if (unsoldDelay < 0)
         throw new Exception("Forbidden value on unsoldDelay = " + unsoldDelay + ", it doesn't respect the following condition : unsoldDelay < 0");
 }
 public virtual void Deserialize(BigEndianReader reader)
 {
     portalId = reader.ReadVarShort();
     if (portalId < 0)
         throw new Exception("Forbidden value on portalId = " + portalId + ", it doesn't respect the following condition : portalId < 0");
     areaId = reader.ReadShort();
 }
 public override void Deserialize(BigEndianReader reader)
 {
     base.Deserialize(reader);
     targetId = reader.ReadInt();
     entityLook = new Types.EntityLook();
     entityLook.Deserialize(reader);
 }
Beispiel #20
0
 public static void GameActionFightDispellableEffectMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
 {
     GameActionFightDispellableEffectMessage msg = (GameActionFightDispellableEffectMessage)message;
     using (BigEndianReader reader = new BigEndianReader(packetDatas))
     {
         msg.Deserialize(reader);
     }
     if (msg.effect is FightTemporaryBoostStateEffect)
     {
         FightTemporaryBoostStateEffect effect = (FightTemporaryBoostStateEffect)msg.effect;
         if (effect.targetId == account.Fight.Fighter.Id)
         {
             if (account.Fight.DurationByEffect.ContainsKey(effect.stateId))
                 account.Fight.DurationByEffect.Remove(effect.stateId);
             account.Fight.DurationByEffect.Add(effect.stateId, effect.turnDuration);
         }
     }
     else if (msg.effect is FightTemporaryBoostEffect)
     {
         FightTemporaryBoostEffect effect = (FightTemporaryBoostEffect)msg.effect;
         if (msg.actionId == 168)
             ((BFighter)account.Fight.Fighter).ActionPoints = account.Fight.Fighter.ActionPoints - effect.delta;
         else if (msg.actionId == 169)
             ((BFighter)account.Fight.Fighter).MovementPoints = account.Fight.Fighter.MovementPoints - effect.delta;
     }
 }
 public void RecoverGroups()
 {
     foreach (FileInfo file in new DirectoryInfo(m_SavingGroupDirectoryPath).GetFiles())
     {
         //IFormatter binaryFormatter = new BinaryFormatter();
         //using (Stream stream = new FileStream(file.FullName, FileMode.Open, FileAccess.Read))
         //{
         //    BigEndianWriter writer = (BigEndianWriter)binaryFormatter.Deserialize(stream);
         //    using (BigEndianReader reader = new BigEndianReader(writer.Content))
         //    {
         //        int limite = reader.ReadInt();
         //        m_GroupAccounts = new List<AccountUC>();
         //        for (int index = 0; index < limite; index++)
         //            m_GroupAccounts.Add(new AccountUC(reader.ReadUTF(), reader.ReadUTF(), false));
         //        Groups.Add(new Group(m_GroupAccounts, file.Name.Remove((int)file.Name.Length - 3)));
         //        foreach (Account accountObject in m_Accounts)
         //            accountObject.Password = CryptageBS.DecryptBS(accountObject.Password);
         //    }
         //    writer.Dispose();
         //    stream.Close();
         //}
         byte[] content = File.ReadAllBytes(file.FullName);
         using (BigEndianReader reader = new BigEndianReader(content))
         {
             int limite = reader.ReadInt();
             m_GroupAccounts = new List<AccountUC>();
             for (int index = 0; index < limite; index++)
                 m_GroupAccounts.Add(new AccountUC(reader.ReadUTF(), reader.ReadUTF(), false));
             Groups.Add(new Group(m_GroupAccounts, file.Name.Remove((int)file.Name.Length - 3)));
             foreach (AccountUC accountObject in m_GroupAccounts)
                 accountObject.AccountPassword = CryptageBS.DecryptBS(accountObject.AccountPassword);
         }
     }
 }
Beispiel #22
0
 public static void GameActionFightPointsVariationMessageTreatment(Message message, byte[] packetDatas, AccountUC account)
 {
     GameActionFightPointsVariationMessage msg = (GameActionFightPointsVariationMessage)message;
     using (BigEndianReader reader = new BigEndianReader(packetDatas))
     {
         msg.Deserialize(reader);
     }
     BFighter fighter = (BFighter)account.Fight.GetFighter(msg.targetId);
     if (fighter != null)
     {
         switch (msg.actionId)
         {
             case 101:
             case 102:
             case 120:
                 fighter.ActionPoints = (fighter.ActionPoints + msg.delta);
                 break;
             case 78:
             case 127:
             case 129:
                 fighter.MovementPoints = (fighter.MovementPoints + msg.delta);
                 break;
         }
     }
 }
 public override void Deserialize(BigEndianReader reader)
 {
     onlySuccess = reader.ReadBoolean();
     objectUID = reader.ReadVarInt();
     if (objectUID < 0)
         throw new Exception("Forbidden value on objectUID = " + objectUID + ", it doesn't respect the following condition : objectUID < 0");
 }
 public override void Deserialize(BigEndianReader reader)
 {
     base.Deserialize(reader);
     time = reader.ReadByte();
     if (time < 0 || time > 255)
         throw new Exception("Forbidden value on time = " + time + ", it doesn't respect the following condition : time < 0 || time > 255");
 }
 public override void Deserialize(BigEndianReader reader)
 {
     base.Deserialize(reader);
     lifePointsGained = reader.ReadVarInt();
     if (lifePointsGained < 0)
         throw new Exception("Forbidden value on lifePointsGained = " + lifePointsGained + ", it doesn't respect the following condition : lifePointsGained < 0");
 }
 public override void Deserialize(BigEndianReader reader)
 {
     spellId = reader.ReadInt();
     spellLevel = reader.ReadSByte();
     if (spellLevel < 1 || spellLevel > 6)
         throw new Exception("Forbidden value on spellLevel = " + spellLevel + ", it doesn't respect the following condition : spellLevel < 1 || spellLevel > 6");
 }
 public virtual void Deserialize(BigEndianReader reader)
 {
     id = reader.ReadInt();
     if (id < 0)
         throw new Exception("Forbidden value on id = " + id + ", it doesn't respect the following condition : id < 0");
     hash = reader.ReadUTF();
 }
 public override void Deserialize(BigEndianReader reader)
 {
     byte flag1 = reader.ReadByte();
     self = BooleanByteWrapper.GetFlag(flag1, 0);
     verbose = BooleanByteWrapper.GetFlag(flag1, 1);
     position = reader.ReadSByte();
     accountNickname = reader.ReadUTF();
     accountId = reader.ReadInt();
     if (accountId < 0)
         throw new Exception("Forbidden value on accountId = " + accountId + ", it doesn't respect the following condition : accountId < 0");
     playerName = reader.ReadUTF();
     playerId = reader.ReadVarInt();
     if (playerId < 0)
         throw new Exception("Forbidden value on playerId = " + playerId + ", it doesn't respect the following condition : playerId < 0");
     areaId = reader.ReadShort();
     var limit = reader.ReadUShort();
     socialGroups = new Types.AbstractSocialGroupInfos[limit];
     for (int i = 0; i < limit; i++)
     {
          socialGroups[i] = Types.ProtocolTypeManager.GetInstance<Types.AbstractSocialGroupInfos>(reader.ReadShort());
          socialGroups[i].Deserialize(reader);
     }
     playerState = reader.ReadSByte();
     if (playerState < 0)
         throw new Exception("Forbidden value on playerState = " + playerState + ", it doesn't respect the following condition : playerState < 0");
 }
 public override void Deserialize(BigEndianReader reader)
 {
     memberId = reader.ReadVarInt();
     if (memberId < 0)
         throw new Exception("Forbidden value on memberId = " + memberId + ", it doesn't respect the following condition : memberId < 0");
     online = reader.ReadBoolean();
 }
 public override void Deserialize(BigEndianReader reader)
 {
     channel = reader.ReadSByte();
     if (channel < 0)
         throw new Exception("Forbidden value on channel = " + channel + ", it doesn't respect the following condition : channel < 0");
     enable = reader.ReadBoolean();
 }