Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using Stump.DofusProtocol.Types;
  5. using Stump.Core.IO;
  6.  
  7. namespace Stump.DofusProtocol.Messages
  8. {
  9.  
  10. public class SpellUpgradeRequestMessage : NetworkMessage
  11. {
  12.  
  13. public const uint Id = 5608;
  14. public override uint MessageId
  15. {
  16. get { return Id; }
  17. }
  18.  
  19. public ushort spellId;
  20. public sbyte spellLevel;
  21.  
  22.  
  23. public SpellUpgradeRequestMessage()
  24. {
  25. }
  26.  
  27. public SpellUpgradeRequestMessage(ushort spellId, sbyte spellLevel)
  28. {
  29. this.spellId = spellId;
  30. this.spellLevel = spellLevel;
  31. }
  32.  
  33.  
  34. public override void Serialize(ICustomDataWriter writer)
  35. {
  36.  
  37. writer.WriteVaruhshort(spellId);
  38. writer.WriteSByte(spellLevel);
  39.  
  40.  
  41. }
  42.  
  43. public override void Deserialize(ICustomDataReader reader)
  44. {
  45.  
  46. spellId = reader.ReadVaruhshort();
  47. if (spellId < 0)
  48. throw new Exception("Forbidden value on spellId = " + spellId + ", it doesn't respect the following condition : spellId < 0");
  49. spellLevel = reader.ReadSByte();
  50. if (spellLevel < 1 || spellLevel > 6)
  51. throw new Exception("Forbidden value on spellLevel = " + spellLevel + ", it doesn't respect the following condition : spellLevel < 1 || spellLevel > 6");
  52.  
  53.  
  54. }
  55. public override void Serialize(BigEndianWriter writer)
  56. {
  57. throw new NotImplementedException();
  58. }
  59.  
  60. }
  61.  
  62.  
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement