Advertisement
Guest User

Untitled

a guest
Apr 18th, 2019
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.53 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.IO;
  7.  
  8. namespace horsing_html
  9. {
  10. class Program
  11. {
  12.  
  13.  
  14. public class horse
  15. {
  16. public string Name = "";
  17. public int Tier = 0;
  18. public int Speed = 0;
  19. public int Health = 0;
  20. public int Stamina = 0;
  21. public int r = 0;
  22. public int y = 0;
  23. public int b = 0;
  24. }
  25.  
  26.  
  27. public static void CreateTab(horse myHorse)
  28. {
  29.  
  30.  
  31. List<string> displayInfo = new List<string> { };
  32.  
  33. if (SkipFirst == false) { SkipFirst = true; } else { displayInfo.Add("<hr style=\"border: 2px solid#5b9aa0; margin:0px\" />"); }
  34. displayInfo.Add("<div class=\"grid-container\" style=\" width: auto; margin: 30 padding-bottom:0\">");
  35. displayInfo.Add("<div>" + myHorse.Name + "</div>");
  36. displayInfo.Add("<div>" + myHorse.Tier + "</div>");
  37. displayInfo.Add("<div>" + myHorse.Speed + "</div>");
  38. displayInfo.Add("<div>" + myHorse.Stamina + "</div>");
  39. displayInfo.Add("<div>" + myHorse.Health + "</div>");
  40. displayInfo.Add("<div>" + myHorse.r + "</div>");
  41. displayInfo.Add("<div>" + myHorse.y + "</div>");
  42. displayInfo.Add("<div>" + myHorse.b + "</div>");
  43. displayInfo.Add("</div>");
  44. lines.AddRange(displayInfo);
  45.  
  46. }
  47.  
  48. public static bool ValidNumberField(int min, int max,string readInfo)
  49. {
  50.  
  51. try {
  52. int num = Convert.ToInt32(readInfo);
  53. if (num >= min & num <= max) { return true; }
  54. } catch { }
  55. return false;
  56. }
  57.  
  58. public static List<string> lines = File.ReadAllLines("style.txt").ToList();
  59. public static bool SkipFirst = false;
  60. static void Main(string[] args)
  61. {
  62. Console.WriteLine("");
  63. Console.WriteLine("");
  64. Console.WriteLine("");
  65. Console.WriteLine("");
  66. Console.WriteLine(" Welcome to the BDO asset display");
  67. Console.WriteLine(" Hit {ENTER} To Get Started");
  68.  
  69. Console.ReadLine();
  70. Console.Clear();
  71.  
  72.  
  73. List<horse> listHorse = new List<horse> { };
  74.  
  75.  
  76.  
  77. while (true)
  78. {
  79.  
  80. horse myHorse = new horse();
  81.  
  82. Console.Clear();
  83.  
  84.  
  85. while (true)
  86. {
  87. Console.Write("Nickname (Must be 3 letters) - ");
  88. myHorse.Name = Console.ReadLine();
  89.  
  90.  
  91. Console.Clear();
  92. if (myHorse.Name.Length == 3) { break; }
  93.  
  94. }
  95.  
  96.  
  97.  
  98.  
  99.  
  100. while (true)
  101. {
  102. Console.Write("Tier (0-9) - ");
  103. string input = Console.ReadLine();
  104.  
  105. Console.Clear();
  106. if (ValidNumberField(0, 9, input))
  107. {
  108. myHorse.Tier = Convert.ToInt32(input);
  109. break;
  110. }
  111.  
  112. }
  113.  
  114.  
  115.  
  116. while (true)
  117. {
  118. Console.Write("Speed (100-150) - ");
  119. string input = Console.ReadLine();
  120. Console.Clear();
  121. if (ValidNumberField(100, 150, input))
  122. {
  123. myHorse.Speed = Convert.ToInt32(input);
  124. break;
  125. }
  126.  
  127. }
  128.  
  129. while (true)
  130. {
  131. Console.Write("Health (1000-2000) - ");
  132. string input = Console.ReadLine();
  133. Console.Clear();
  134. if (ValidNumberField(0, 2000, input))
  135. {
  136. myHorse.Health = Convert.ToInt32(input);
  137. break;
  138. }
  139.  
  140. }
  141.  
  142.  
  143. while (true)
  144. {
  145. Console.Write("Stamina (1000-4000) - ");
  146. string input = Console.ReadLine();
  147. Console.Clear();
  148. if (ValidNumberField(0, 4000, input))
  149. {
  150. myHorse.Stamina = Convert.ToInt32(input);
  151. break;
  152. }
  153.  
  154. }
  155.  
  156.  
  157. while (true)
  158. {
  159. Console.Write("r (0-8) - ");
  160. string input = Console.ReadLine();
  161. Console.Clear();
  162. if (ValidNumberField(0, 8, input))
  163. {
  164. myHorse.Tier = Convert.ToInt32(input);
  165. break;
  166. }
  167.  
  168. }
  169.  
  170. while (true)
  171. {
  172. Console.Write("y (0-8) - ");
  173. string input = Console.ReadLine();
  174. Console.Clear();
  175. if (ValidNumberField(0, 8, input))
  176. {
  177. myHorse.y = Convert.ToInt32(input);
  178. break;
  179. }
  180.  
  181. }
  182.  
  183. while (true)
  184. {
  185. Console.Write("b (0-8) - ");
  186. string input = Console.ReadLine();
  187. Console.Clear();
  188. if (ValidNumberField(0, 8, input))
  189. {
  190. myHorse.b = Convert.ToInt32(input);
  191. break;
  192. }
  193.  
  194. }
  195.  
  196.  
  197.  
  198.  
  199. listHorse.Add(myHorse);
  200. Console.Write("Create Another? (y/n) ");
  201. if (Console.ReadLine() == "n") { break; }
  202. Console.Clear();
  203.  
  204. }
  205.  
  206. foreach(horse h in listHorse)
  207. {
  208. CreateTab(h);
  209. }
  210.  
  211.  
  212.  
  213. lines.Add("<div/>");
  214.  
  215. File.WriteAllLines("index.html", lines);
  216. System.Diagnostics.Process.Start("index.html");
  217. Console.ReadLine();
  218. }
  219. }
  220. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement