Advertisement
Guest User

Untitled

a guest
Feb 28th, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.63 KB | None | 0 0
  1. package data;
  2.  
  3. import java.util.Arrays;
  4. import java.util.LinkedHashMap;
  5.  
  6. public enum WeaponClass {
  7.  
  8. UNARMED(0, new String[] {
  9. "Punch", "Kick", "Block"
  10. }, new int[] {
  11. 0, 1, 3
  12. }),
  13. AXE_BATTLEAXE(1, new String[] {
  14. "Chop", "Hack", "Smash", "Block"
  15. }, new int[] {
  16. 0, 1, 2, 3
  17. }),
  18. WARHAMMER(2, new String[] {
  19. "Pound", "Pummel", "Block"
  20. }, new int[] {
  21. 0, 1, 3
  22. }),
  23. BOW(3, new String[] {
  24. "Accurate", "Rapid", "Longrange"
  25. }, new int[] {
  26. 0, 1, 3
  27. }),
  28. CLAWS(4, new String[] {
  29. "Chop", "Slash", "Lunge", "Block"
  30. }, new int[] {
  31. 0, 1, 2, 3
  32. }),
  33. CROSSBOW(5, new String[] {
  34. "Accurate", "Rapid", "Longrange"
  35. }, new int[] {
  36. 0, 1, 3
  37. }),
  38. SALAMANDER(6, new String[] {}, new int[] {}),
  39. CHINCHOMPA(7, new String[] {}, new int[] {}),
  40. LONGSWORD_SCIMITAR(9, new String[] {
  41. "Chop", "Slash", "Lunge", "Block"
  42. }, new int[] {
  43. 0, 1, 2, 3
  44. }),
  45. PICKAXE(11, new String[] {
  46. "Spike", "Impale", "Smash", "Block"
  47. }, new int[] {
  48. 0, 1, 2, 3
  49. }),
  50. HALBERD(12, new String[] {
  51. "Jab", "Swipe", "Fend"
  52. }, new int[] {
  53. 0, 1, 3
  54. }),
  55. SPEAR(15, new String[] {
  56. "Lunge", "Swipe", "Pound", "Block"
  57. }, new int[] {
  58. 0, 1, 2, 3
  59. }),
  60. MACE(16, new String[] {
  61. "Pound", "Pummel", "Spike", "Block"
  62. }, new int[] {
  63. 0, 1, 2, 3
  64. }),
  65. DAGGER_SWORD(17, new String[] {
  66. "Stab", "Lunge", "Slash", "Block"
  67. }, new int[] {
  68. 0, 1, 2, 3
  69. }),
  70. STAFF(18, new String[] {
  71. "Bash", "Pound", "Focus"
  72. }, new int[] {
  73. 0, 1, 3
  74. }),
  75. THROWN(19, new String[] {
  76. "Accurate", "Rapid", "Longrange"
  77. }, new int[] {
  78. 0, 1, 3
  79. }),
  80. WHIP(20, new String[] {}, new int[] {}),
  81. SOTD(21, new String[] {}, new int[] {}),
  82. TWO_HANDED(22, new String[] {
  83. "Chop", "Slash", "Smash", "Block"
  84. }, new int[] {
  85. 0, 1, 2, 3
  86. }),
  87. TOTS(23, new String[] {}, new int[] {}),
  88. GREEGREE(24, new String[] {}, new int[] {});
  89.  
  90. private int id;
  91. private LinkedHashMap<Integer, String> styles;
  92.  
  93. public int getId() {
  94. return id;
  95. }
  96.  
  97. WeaponClass(int id, String[] styles, int[] configs) {
  98. this.id = id;
  99. this.styles = new LinkedHashMap<>();
  100. for (int i = 0; i < styles.length; i++) {
  101. this.styles.put(configs[i], styles[i]);
  102. }
  103. }
  104.  
  105. public static WeaponClass forId(int id) {
  106. return Arrays.asList(values()).stream().filter(c -> c.id == id).findFirst().orElse(null);
  107. }
  108.  
  109. public String getName(int config) {
  110. return styles.get(config);
  111. }
  112.  
  113. public int getConfig(String style) {
  114. return styles.keySet().stream().filter(c -> styles.get(c).equals(style)).findFirst().orElse(-1);
  115. }
  116.  
  117. public String[] styles() {
  118. return styles.values().stream().toArray(String[]::new);
  119. }
  120. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement