Advertisement
Guest User

Untitled

a guest
Jul 30th, 2016
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.10 KB | None | 0 0
  1. // ☺ Created by Mohamed L. Tommi
  2. // ☺ Copyright © 2010 - 2016 TQ Digital
  3. // ☺ Test Conquer - Project
  4.  
  5. using System;
  6. using System.Linq;
  7. using System.Text;
  8. using COServer.Game;
  9. using System.Collections.Generic;
  10.  
  11. namespace COServer.Network.GamePackets
  12. {
  13. public unsafe class MsgDetainItemInfo : Writer, Interfaces.IPacket
  14. {
  15. public const ushort DetainPage = 0, ClaimPage = 1;
  16. public byte[] Buffer;
  17. private MsgItemInfo item;
  18. public MsgDetainItemInfo(bool Create)
  19. {
  20. if (Create)
  21. {
  22. Buffer = new byte[176 + 8];
  23. WriteUInt16(176, 0, Buffer);
  24. WriteUInt16((ushort)MsgTypes.MsgDetainItemInfo, 2, Buffer);
  25. }
  26. }
  27. public uint UID
  28. {
  29. get { return BitConverter.ToUInt32(Buffer, 4); }
  30. set { WriteUInt32(value, 4, Buffer); }
  31. }
  32. public uint ItemUID
  33. {
  34. get { return BitConverter.ToUInt32(Buffer, 8); }
  35. set { WriteUInt32(value, 8, Buffer); }
  36. }
  37. public uint ItemID
  38. {
  39. get { return BitConverter.ToUInt32(Buffer, 12); }
  40. set { WriteUInt32(value, 12, Buffer); }
  41. }
  42. public ushort Durability
  43. {
  44. get { return BitConverter.ToUInt16(Buffer, 16); }
  45. set { WriteUInt16(value, 16, Buffer); }
  46. }
  47. public ushort MaximDurability
  48. {
  49. get { return BitConverter.ToUInt16(Buffer, 18); }
  50. set { WriteUInt16(value, 18, Buffer); }
  51. }
  52. public byte Page
  53. {
  54. get { return Buffer[20]; }
  55. set { Buffer[20] = value; }
  56. }
  57. public uint SocketProgress
  58. {
  59. get { return BitConverter.ToUInt32(Buffer, 24); }
  60. set { WriteUInt32(value, 24, Buffer); }
  61. }
  62. public Enums.Gem SocketOne
  63. {
  64. get { return (Enums.Gem)Buffer[28]; }
  65. set { Buffer[28] = (byte)value; }
  66. }
  67. public Enums.Gem SocketTwo
  68. {
  69. get { return (Enums.Gem)Buffer[29]; }
  70. set { Buffer[29] = (byte)value; }
  71. }
  72. public Enums.ItemEffect Effect
  73. {
  74. get { return (Enums.ItemEffect)BitConverter.ToUInt16(Buffer, 30); }
  75. set { WriteUInt16((ushort)value, 30, Buffer); }
  76. }
  77. public byte Plus
  78. {
  79. get { return Buffer[37]; }
  80. set { Buffer[37] = value; }
  81. }
  82. public byte Bless
  83. {
  84. get { return Buffer[38]; }
  85. set { Buffer[38] = value; }
  86. }
  87. public bool Bound
  88. {
  89. get { return Buffer[39] == 0 ? false : true; }
  90. set { Buffer[39] = (byte)(value ? 1 : 0); }
  91. }
  92. public byte Enchant
  93. {
  94. get { return Buffer[40]; }
  95. set { Buffer[40] = value; }
  96. }
  97. public bool Suspicious
  98. {
  99. get { return Buffer[40] == 0 ? false : true; }
  100. set { Buffer[40] = (byte)(value ? 1 : 0); }
  101. }
  102. public byte Lock
  103. {
  104. get { return Buffer[47]; }
  105. set { Buffer[47] = value; }
  106. }
  107. public Game.Enums.Color ItemColor
  108. {
  109. get { return (Game.Enums.Color)BitConverter.ToUInt32(Buffer, 52); }
  110. set { WriteUInt32((uint)value, 52, Buffer); }
  111. }
  112. public uint OwnerUID
  113. {
  114. get { return BitConverter.ToUInt32(Buffer, 120); }
  115. set { WriteUInt32(value, 120, Buffer); }
  116. }
  117. public string OwnerName
  118. {
  119. get
  120. {
  121. return Encoding.Default.GetString(Buffer, 124, 16).Split('\0')[0];
  122. }
  123. set
  124. {
  125. if (value.Length > 16)
  126. value = value.Remove(16);
  127. for (int count = 0; count < value.Length; count++)
  128. Buffer[124 + count] = (byte)(value[count]);
  129. }
  130. }
  131. public uint GainerUID
  132. {
  133. get { return BitConverter.ToUInt32(Buffer, 140); }
  134. set { WriteUInt32(value, 140, Buffer); }
  135. }
  136.  
  137. public string GainerName
  138. {
  139. get
  140. {
  141. return Encoding.Default.GetString(Buffer, 144, 16).Split('\0')[0];
  142. }
  143. set
  144. {
  145. if (value.Length > 16)
  146. value = value.Remove(16);
  147. for (int count = 0; count < value.Length; count++)
  148. Buffer[144 + count] = (byte)(value[count]);
  149. }
  150. }
  151. public uint Date2
  152. {
  153. get { return BitConverter.ToUInt32(Buffer, 88); }
  154. set { WriteUInt32(value, 88, Buffer); }
  155. }
  156. public uint ConquerPointsCost
  157. {
  158. get { return BitConverter.ToUInt32(Buffer, 168); }
  159. set { WriteUInt32(value, 168, Buffer); }
  160. }
  161. public uint DaysLeft
  162. {
  163. get { return (BitConverter.ToUInt32(Buffer, 108)); }
  164. set { WriteUInt32(value, 108, Buffer); }
  165. }
  166. public DateTime Date
  167. {
  168. get;
  169. set;
  170. }
  171. public ItemAdding.Refinery_ ExtraEffect
  172. {
  173. get;
  174. set;
  175. }
  176. public ItemAdding.Purification_ Purification
  177. {
  178. get;
  179. set;
  180. }
  181. public void Send(Client.GameState client)
  182. {
  183. client.Send(Buffer);
  184. }
  185. public MsgItemInfo Item
  186. {
  187. get { return item; }
  188. set
  189. {
  190. item = value;
  191. ItemUID = item.UID;
  192. ItemID = item.ID;
  193. ItemColor = item.Color;
  194. Durability = item.Durability;
  195. MaximDurability = item.MaximDurability;
  196. SocketOne = item.SocketOne;
  197. SocketTwo = item.SocketTwo;
  198. Effect = item.Effect;
  199. Plus = item.Plus;
  200. Bless = item.Bless;
  201. Enchant = item.Enchant;
  202. SocketProgress = item.SocketProgress;
  203. Bound = item.Bound;
  204. Lock = item.Lock;
  205. Purification = item.Purification;
  206. ExtraEffect = item.ExtraEffect;
  207. }
  208. }
  209. public void MakeItReadyToClaim()
  210. {
  211. ItemID = 0;
  212. ItemColor = 0;
  213. Durability = 0;
  214. MaximDurability = 0;
  215. SocketOne = Enums.Gem.NoSocket;
  216. SocketTwo = Enums.Gem.NoSocket;
  217. Effect = Enums.ItemEffect.None;
  218. Plus = 0;
  219. Bless = 0;
  220. Enchant = 0;
  221. SocketProgress = 0;
  222. Bound = false;
  223. Lock = 0;
  224. WriteUInt32(ConquerPointsCost, 100, Buffer);
  225. Page = 2;
  226. }
  227. public byte[] ToArray()
  228. {
  229. return Buffer;
  230. }
  231. public void Deserialize(byte[] buffer)
  232. {
  233. Buffer = buffer;
  234. }
  235. }
  236. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement