Advertisement
XConquer

Parse

Apr 16th, 2021
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.05 KB | None | 0 0
  1. public static void Parse(string Line)
  2. {
  3. string[] strArray2 = Line.Split(new string[] { "@@", " " }, StringSplitOptions.RemoveEmptyEntries);
  4. SpellInformation information = new SpellInformation();
  5.  
  6. information.ID = Convert.ToUInt16(strArray2[1]);
  7. information.Name = strArray2[3];
  8. information.Level = Convert.ToByte(strArray2[8]);
  9.  
  10. if (Convert.ToByte(strArray2[4]) == 1)
  11. information.CanKill = true;
  12. else
  13. information.CanKill = false;
  14.  
  15. information.Sort = Convert.ToByte(strArray2[2]);
  16. if (Convert.ToByte(strArray2[5]) == 1)
  17. information.OnlyGround = true;
  18. else
  19. information.OnlyGround = false;
  20. if (Convert.ToByte(strArray2[6]) == 1)
  21. information.Multi = true;
  22. else
  23. information.Multi = false;
  24.  
  25. information.Target = Convert.ToByte(strArray2[7]);
  26. information.Level = Convert.ToByte(strArray2[8]);
  27.  
  28. information.TimeOpenSkill = Convert.ToUInt32(strArray2[47]);
  29. information.UseMana = Convert.ToUInt16(strArray2[9]);
  30. if (Convert.ToInt32(strArray2[10]) > 0)
  31. {
  32. information.Power = Convert.ToInt32(strArray2[10]);
  33. }
  34. //else
  35. //{
  36. // information.Power = 0;
  37. //}
  38. information.PowerPercent = ((float)information.Power % 1000) / 100;
  39.  
  40. information.Percent = Convert.ToByte(strArray2[12]);
  41. information.Duration = Convert.ToInt32(strArray2[13]);
  42. information.Range = Convert.ToUInt16(strArray2[14]);
  43. information.Sector = information.Range * 20;
  44. information.Distance = Convert.ToUInt16(strArray2[15]);
  45. if (information.Distance >= 4)
  46. {
  47. information.Distance = (ushort)(information.Distance - 1);
  48. }
  49. information.Status = (ulong)Convert.ToInt64(strArray2[16]);
  50. information.NeedExperience = Convert.ToUInt32(strArray2[18]);
  51. information.NeedLevel = Convert.ToByte(strArray2[20]);
  52. var WeaponSubtype = Convert.ToUInt32(strArray2[22]);
  53. //if (wepsubtype.Length == 6)
  54. //{
  55. // information.WeaponSubtype =
  56. // information.OnlyWithThisWeaponSubtype = Convert.ToUInt16(wepsubtype.Substring(0, 3));
  57. // information.WeaponSubtype2 =
  58. // information.OnlyWithThisWeaponSubtype2 = Convert.ToUInt16(wepsubtype.Substring(3, 3));
  59. //}
  60. //if (wepsubtype.Length == 8)
  61. //{
  62. // information.WeaponSubtype =
  63. // information.OnlyWithThisWeaponSubtype = Convert.ToUInt16(wepsubtype.Substring(2, 3));
  64. // information.WeaponSubtype2 =
  65. // information.OnlyWithThisWeaponSubtype2 = Convert.ToUInt16(wepsubtype.Substring(5, 3));
  66. //}
  67. //else if (wepsubtype.Length == 3)
  68. //{
  69. // information.WeaponSubtype = information.OnlyWithThisWeaponSubtype = Convert.ToUInt16(wepsubtype);
  70. //}
  71. information.WeaponSubtype = new List<ushort>();
  72. information.OnlyWithThisWeaponSubtype = new List<ushort>();
  73. var subtype1 = (ushort)(WeaponSubtype % 1000);
  74. var subtype2 = (ushort)((WeaponSubtype / 1000) % 1000);
  75. var subtype3 = (ushort)((WeaponSubtype / 1000000) % 1000);
  76. if (WeaponSubtype == 60000)
  77. subtype1 = 614;
  78. if (subtype1 != 0)
  79. {
  80. information.WeaponSubtype.Add(subtype1);
  81. information.OnlyWithThisWeaponSubtype.Add(subtype1);
  82. }
  83. if (subtype2 != 0)
  84. {
  85. information.WeaponSubtype.Add(subtype2);
  86. information.OnlyWithThisWeaponSubtype.Add(subtype2);
  87. }
  88. if (subtype3 != 0)
  89. {
  90. information.WeaponSubtype.Add(subtype3);
  91. information.OnlyWithThisWeaponSubtype.Add(subtype3);
  92. }
  93.  
  94. if (WeaponSubtype == 50000)
  95. information.WeaponSubtype = information.OnlyWithThisWeaponSubtype = new List<ushort>();
  96. information.NextSpellID = Convert.ToUInt16(strArray2[32]);
  97. information.NeedXP = Convert.ToByte(strArray2[21]);
  98. information.UseStamina = Convert.ToByte(strArray2[29]);
  99. information.UseArrows = Convert.ToByte(strArray2[34]);
  100. information.FirstDamage = (int)(Convert.ToInt32(strArray2[36]));
  101. information.SecondDamage = (int)(Convert.ToInt32(strArray2[37]));
  102. //information.CoolDown = Convert.ToUInt32(strArray2[47]);
  103. information.CPCost = Convert.ToUInt16(strArray2[48]);
  104. if (information.CPCost == 0 && information.Level == 0)
  105. information.CPCost = 27;
  106. if (information.CPCost == 0 && information.Level == 1)
  107. information.CPCost = 81;
  108. if (information.CPCost == 0 && information.Level == 2)
  109. information.CPCost = 122;
  110. if (information.CPCost == 0 && information.Level == 3)
  111. information.CPCost = 181;
  112. if (information.CPCost == 0 && information.Level == 4)
  113. information.CPCost = 274;
  114. if (information.CPCost == 0 && information.Level == 5)
  115. information.CPCost = 411;
  116. if (information.CPCost == 0 && information.Level == 6)
  117. information.CPCost = 617;
  118. if (information.CPCost == 0 && information.Level == 7)
  119. information.CPCost = 926;
  120. if (information.CPCost == 0 && information.Level == 8)
  121. information.CPCost = 1386;
  122. if (information.CPCost == 0 && information.Level == 9)
  123. information.CPCost = 2084;
  124. if (SpellInformations.ContainsKey(information.ID))
  125. {
  126. SpellInformations[information.ID].Add(information.Level, information);
  127. }
  128. else
  129. {
  130. SpellInformations.Add(information.ID, new SafeDictionary<byte, SpellInformation>(10));
  131. SpellInformations[information.ID].Add(information.Level, information);
  132. }
  133. if (information.Distance > 18)
  134. {
  135. information.Distance = 18;
  136. }
  137.  
  138. if (information.WeaponSubtype.Count != 0)
  139. {
  140. switch (information.ID)
  141. {
  142. case 5010:
  143. case 7020:
  144. case 1290:
  145. case 1260:
  146. case 5030:
  147. case 5040:
  148. case 7000:
  149. case 7010:
  150. case 7030:
  151. case 7040:
  152. case 1250:
  153. case 5050:
  154. case 5020:
  155. case 10490:
  156. case 11140:
  157. case 1300:
  158. case 11990:
  159. case 12110:
  160. case 12240:
  161. case 12230:
  162. case 12220:
  163. case 12210:
  164. case 12570:
  165. case 12580:
  166. case 12590:
  167. case 12600:
  168. case 11230:
  169. for (int i = 0; i < information.WeaponSubtype.Count; i++)
  170. {
  171. var subtype = information.WeaponSubtype[i];
  172. if (!WeaponSpells.ContainsKey(subtype))
  173. WeaponSpells.Add(subtype, new List<ushort>());
  174. if (!WeaponSpells[subtype].Contains(information.ID))
  175. WeaponSpells[subtype].Add(information.ID);
  176. }
  177. break;
  178. }
  179. }
  180. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement