Advertisement
Guest User

Untitled

a guest
Nov 20th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.74 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. information.WeaponSubtype = new List<ushort>();
  6. information.OnlyWithThisWeaponSubtype = new List<ushort>();
  7. information.ID = Convert.ToUInt16(strArray2[1]);
  8. information.Name = strArray2[3];
  9. if (Convert.ToByte(strArray2[4]) == 1)
  10. information.CanKill = true;
  11. else
  12. information.CanKill = false;
  13.  
  14. information.Sort = Convert.ToByte(strArray2[2]);
  15. if (Convert.ToByte(strArray2[5]) == 1)
  16. information.OnlyGround = true;
  17. else
  18. information.OnlyGround = false;
  19. if (Convert.ToByte(strArray2[6]) == 1)
  20. information.Multi = true;
  21. else
  22. information.Multi = false;
  23.  
  24. information.Target = Convert.ToByte(strArray2[7]);
  25. information.Level = Convert.ToByte(strArray2[8]);
  26. information.UseMana = Convert.ToUInt16(strArray2[9]);
  27. if (Convert.ToInt32(strArray2[10]) > 0)
  28. {
  29. information.Power = Convert.ToUInt32(strArray2[10]);
  30. }
  31. else
  32. {
  33. information.Power = 0;
  34. }
  35. information.PowerPercent = ((float)information.Power % 1000) / 100;
  36.  
  37. information.Percent = Convert.ToByte(strArray2[12]);
  38. information.Duration = Convert.ToInt32(strArray2[13]);
  39. information.Range = Convert.ToUInt16(strArray2[14]);
  40. information.Sector = information.Range * 20;
  41. information.Distance = Convert.ToUInt16(strArray2[15]);
  42. if (information.Distance >= 4)
  43. {
  44. information.Distance = (ushort)(information.Distance - 1);
  45. }
  46. information.Status = (ulong)Convert.ToInt64(strArray2[16]);
  47. information.NeedExperience = Convert.ToUInt32(strArray2[18]);
  48. information.NeedLevel = Convert.ToByte(strArray2[20]);
  49. uint WeaponSubtype = Convert.ToUInt32(strArray2[22]);
  50. var subtype1 = (ushort)(WeaponSubtype % 1000);
  51. var subtype2 = (ushort)((WeaponSubtype / 1000) % 1000);
  52. if (WeaponSubtype == 60000)
  53. subtype1 = 614;
  54. if (subtype1 != 0)
  55. {
  56. information.WeaponSubtype.Add(subtype1);
  57. information.OnlyWithThisWeaponSubtype.Add(subtype1);
  58. }
  59. if (subtype2 != 0)
  60. {
  61. information.WeaponSubtype.Add(subtype2);
  62. information.OnlyWithThisWeaponSubtype.Add(subtype2);
  63. }
  64.  
  65. if (WeaponSubtype == 50000)
  66. information.WeaponSubtype = information.OnlyWithThisWeaponSubtype = new List<ushort>();
  67. information.NextSpellID = Convert.ToUInt16(strArray2[32]);
  68. information.NeedXP = Convert.ToByte(strArray2[21]);
  69. information.UseStamina = Convert.ToByte(strArray2[29]);
  70. information.SecondDamage = (int)(Convert.ToInt32(strArray2[37]));
  71. information.FirstDamage = (int)(Convert.ToInt32(strArray2[36]));
  72. information.UseArrows = Convert.ToByte(strArray2[34]);
  73. information.HumanPower = (ushort)(Convert.ToUInt32(strArray2[35]));
  74. information.MonsterPower = (ushort)(Convert.ToUInt16(strArray2[44]));
  75. information.SecondWave = ((float)Convert.ToUInt32(strArray2[45]) % 1000) / 100;
  76. information.ThirdWave = ((float)Convert.ToUInt32(strArray2[46]) % 1000) / 100;
  77. if (information.CPCost == 0 && information.Level == 0)
  78. information.CPCost = 27;
  79. if (information.CPCost == 0 && information.Level == 1)
  80. information.CPCost = 81;
  81. if (information.CPCost == 0 && information.Level == 2)
  82. information.CPCost = 122;
  83. if (information.CPCost == 0 && information.Level == 3)
  84. information.CPCost = 181;
  85. if (information.CPCost == 0 && information.Level == 4)
  86. information.CPCost = 274;
  87. if (information.CPCost == 0 && information.Level == 5)
  88. information.CPCost = 411;
  89. if (information.CPCost == 0 && information.Level == 6)
  90. information.CPCost = 617;
  91. if (information.CPCost == 0 && information.Level == 7)
  92. information.CPCost = 926;
  93. if (information.CPCost == 0 && information.Level == 8)
  94. information.CPCost = 1386;
  95. if (information.CPCost == 0 && information.Level == 9)
  96. information.CPCost = 2084;
  97. if (SpellInformations.ContainsKey(information.ID))
  98. {
  99. SpellInformations[information.ID].Add(information.Level, information);
  100. }
  101. else
  102. {
  103. SpellInformations.Add(information.ID, new SafeDictionary<byte, SpellInformation>(10));
  104. SpellInformations[information.ID].Add(information.Level, information);
  105. }
  106. if (information.Distance > 17)
  107. {
  108. information.Distance = 17;
  109. }
  110.  
  111. if (information.WeaponSubtype.Count != 0)
  112. {
  113. switch (information.ID)
  114. {
  115. case 5010:
  116. case 7020:
  117. case 1290:
  118. case 1260:
  119. case 5030:
  120. case 5040:
  121. case 7000:
  122. case 7010:
  123. case 7030:
  124. case 7040:
  125. case 1250:
  126. case 5050:
  127. case 5020:
  128. case 10490:
  129. case 11140:
  130. case 1300:
  131. case 11990:
  132. case 12110:
  133. case 12240:
  134. case 12230:
  135. case 12220:
  136. case 12210:
  137. for (int i = 0; i < information.WeaponSubtype.Count; i++)
  138. {
  139. var subtype = information.WeaponSubtype[i];
  140. if (!WeaponSpells.ContainsKey(subtype))
  141. WeaponSpells.Add(subtype, new List<ushort>());
  142. if (!WeaponSpells[subtype].Contains(information.ID))
  143. WeaponSpells[subtype].Add(information.ID);
  144. }
  145. break;
  146. }
  147. }
  148. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement