PageRenderTime 49ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/Trunk/src/net/sf/odinms/client/NinjaMS/SuperShuriken.java

https://github.com/system32/NinjaMS
Java | 242 lines | 222 code | 12 blank | 8 comment | 57 complexity | ed8e9b7601bdaf3ef1c7ed91693e9870 MD5 | raw file
Possible License(s): AGPL-3.0
  1. /*
  2. * To change this template, choose Tools | Templates
  3. * and open the template in the editor.
  4. */
  5. package net.sf.odinms.client.NinjaMS;
  6. import net.sf.odinms.client.MapleCharacter;
  7. import net.sf.odinms.server.MapleItemInformationProvider;
  8. import net.sf.odinms.server.constants.Items;
  9. /**
  10. *
  11. * @author Admin
  12. */
  13. public class SuperShuriken {
  14. static int[] capreq = {200, 4000017, //Pig Head
  15. 1500, 4000077, //Dark Cloud Foxtail
  16. 69, 4031241, //- Swallow's Lost Seed ( Quest Item )
  17. 1500, 4000150 // Ice Piece
  18. };
  19. static int[] capereq = {200, 4031309,// - Cloud Piece ( Quest Item )
  20. 2000, 4000205,// Dirty Bandage
  21. 1000, 4000228 //Anesthetic Powder
  22. };
  23. static int[] coatreq = {250, 4000125, //- Chief Gray's Sign
  24. 2500, 4000137, //- Subordinate D Fingernail
  25. 300, 4031458 //- Thanatos's Black Tornado ( Quest Item )
  26. };
  27. static int[] glovereq = {1000, 4000061, // - Luster Pixie's Sunpiece
  28. 1669, 4000075, //- Triangular Bandana of the Nightghost
  29. 250, 4031098 //- All-purpose Clock Spring ( Quest Item )
  30. };
  31. static int[] longcoatreq = {1337, 4000437, // - Black Mushroom Spore
  32. 250, 4001006,// - Flaming Feather
  33. 500, 4001075, // - Cornian's Marrow ( Quest Item )
  34. 1337, 4000041 // - Malady's Experimental Frog
  35. };
  36. static int[] pantsreq = {2000, 4000153, //- Snorkle
  37. 150, 4031215, // - Taurospear's Spirit Rock ( Quest Item )
  38. 2000, 4000128 // - Buffy Hat
  39. };
  40. static int[] peteqreq = {250, 4031460,// - Cold Heart of a Wolf ( Quest Item )
  41. 250, 4000415,// - Ice Tear
  42. 250, 4001000,// - Arwen's Glass Shoes
  43. 1500, 4032005 // - Typhon Feather
  44. };
  45. static int[] shoesreq = {300, 4031253, //- Pianus's Scream ( Quest Item )
  46. 2000, 4000066,// - Cloud Foxtail
  47. 2000, 4032010 // - Elder Ashes
  48. };
  49. static int[] tamingreq = {350, 4031195, //- Aurora Marble ( Quest Item )
  50. 350, 4000082, //- Zombie's Lost Gold Tooth
  51. 350, 4000124, //- Rombot's Memory Card
  52. 700, 4000336 //- Bible of the Corrupt
  53. };
  54. static int[] accessoryreq = {350, 4000240, //- Small Flaming Feather
  55. 250, 4000224, //- Sabots
  56. 350, 4031674, //- Elpam Magnet ( Quest Item )
  57. 2500, 4000325 //- Carrot
  58. };
  59. public static int getItemType(int itemId) {
  60. int cat = 0;
  61. if (itemId >= 1010000 && itemId < 1040000) {
  62. cat = 1; //"Accessory";
  63. } else if (itemId >= 1000000 && itemId < 1010000) {
  64. cat = 2; // "Cap";
  65. } else if (itemId >= 1102000 && itemId < 1103000) {
  66. cat = 3; // "Cape";
  67. } else if (itemId >= 1040000 && itemId < 1050000) {
  68. cat = 4; //"Coat";
  69. } else if (itemId >= 1080000 && itemId < 1090000) {
  70. cat = 5;// "Glove";
  71. } else if (itemId >= 1050000 && itemId < 1060000) {
  72. cat = 6; //"Longcoat";
  73. } else if (itemId >= 1060000 && itemId < 1070000) {
  74. cat = 7; //"Pants";
  75. } else if (itemId >= 1802000 && itemId < 1810000) {
  76. cat = 8; //"PetEquip";
  77. } else if (itemId >= 1070000 && itemId < 1080000) {
  78. cat = 9; //"Shoes";
  79. } else if (itemId >= 1900000 && itemId < 2000000) {
  80. cat = 10; //"Taming";
  81. }
  82. int[] blockedItems = {1812006,// Magic scales
  83. 1002140, // - Wizet Invincible Hat
  84. 1042003,// - Wizet Plain Suit
  85. 1062007,// - Wizet Plain Suit Pants
  86. 1322013,// - Wizet Secret Agent Suitcase
  87. 1002959 //- Junior GM Cap
  88. };
  89. for (int i = 0; i < blockedItems.length; i++) {
  90. if (blockedItems[1] == itemId) {
  91. cat = 1337;
  92. break;
  93. }
  94. }
  95. if (MapleItemInformationProvider.getInstance().isCashEquip(itemId)) {
  96. cat += 100;
  97. }
  98. return cat;
  99. }
  100. public static int checkRequirements(MapleCharacter player, int itemId) {
  101. int cat = getItemType(itemId);
  102. if (cat > 1000) {
  103. return 1;
  104. } else if (MapleItemInformationProvider.getInstance().getSlotMax(itemId) < 1) {
  105. return 2;
  106. } else {
  107. int taocount = player.getMaxStatItems() * 200;
  108. if (cat > 100) {
  109. taocount *= 2;
  110. }
  111. if (!player.hasAllStatMax()){
  112. return 3;
  113. } else if (!player.haveSight(taocount)) {
  114. return 4;
  115. } else if (!checkEtcItems(player, cat)) {
  116. return 5;
  117. } else if (player.getBossPoints() < (taocount * 1000)) {
  118. return 6;
  119. } else {
  120. return 7;
  121. }
  122. }
  123. }
  124. public static void removeItems(MapleCharacter player, int itemId) {
  125. int cat = getItemType(itemId);
  126. int taocount = player.getMaxStatItems() * 200;
  127. if (cat > 100) {
  128. taocount *= 2;
  129. }
  130. player.gainItem(Items.currencyType.Sight, -taocount);
  131. player.setBossPoints(player.getBossPoints() - (taocount * 1000));
  132. removeEtcItems(player, itemId);
  133. }
  134. public static int[] getEtcArray(int cat) {
  135. int[] etcarray;
  136. if (cat > 100) {
  137. cat -= 100;
  138. }
  139. switch (cat) {
  140. case 1:
  141. etcarray = accessoryreq;
  142. break;
  143. case 2:
  144. etcarray = capreq;
  145. break;
  146. case 3:
  147. etcarray = capereq;
  148. break;
  149. case 4:
  150. etcarray = coatreq;
  151. break;
  152. case 5:
  153. etcarray = glovereq;
  154. break;
  155. case 6:
  156. etcarray = longcoatreq;
  157. break;
  158. case 7:
  159. etcarray = pantsreq;
  160. break;
  161. case 8:
  162. etcarray = peteqreq;
  163. break;
  164. case 9:
  165. etcarray = shoesreq;
  166. break;
  167. default:
  168. etcarray = tamingreq;
  169. break;
  170. }
  171. return etcarray;
  172. }
  173. public static boolean checkEtcItems(MapleCharacter player, int itemid) {
  174. int cat = getItemType(itemid);
  175. int[] etcarray = getEtcArray(cat);
  176. for (int i = 0; i < etcarray.length; i++) {
  177. int amt = etcarray[i];
  178. if (cat > 100) {
  179. amt *= 2;
  180. }
  181. if (player.haveItem(etcarray[i + 1], amt)) {
  182. return false;
  183. }
  184. i++;
  185. }
  186. return true;
  187. }
  188. public static String getReQItems(MapleCharacter player, int itemid) {
  189. int cat = getItemType(itemid);
  190. int[] etcarray = getEtcArray(cat);
  191. StringBuilder lol = new StringBuilder();
  192. lol.append(" There are the items you need for the selected Item");
  193. for (int i = 0; i < etcarray.length; i++) {
  194. int amt = etcarray[i];
  195. if (cat > 100) {
  196. amt *= 2;
  197. }
  198. lol.append("\r\n ");
  199. lol.append(amt);
  200. lol.append(" of #v");
  201. lol.append(etcarray[i + 1]);
  202. lol.append("# - #t");
  203. lol.append(etcarray[i + 1]);
  204. lol.append("# . \r\n");
  205. i++;
  206. }
  207. lol.append("\r\n You will also need ");
  208. int taocount = player.getMaxStatItems() * 200;
  209. if (cat > 100) {
  210. taocount *= 2;
  211. }
  212. lol.append(taocount);
  213. lol.append(" amount of Tao of Sights and ");
  214. lol.append(taocount * 1000);
  215. lol.append(" boss points. ");
  216. return lol.toString();
  217. }
  218. private static void removeEtcItems(MapleCharacter player, int itemId) {
  219. int cat = getItemType(itemId);
  220. int[] etcarray = getEtcArray(cat);
  221. for (int i = 0; i < etcarray.length; i++) {
  222. int amt = etcarray[i];
  223. if (cat > 100) {
  224. amt *= 2;
  225. }
  226. player.gainItem(etcarray[i+1], amt);
  227. i++;
  228. }
  229. }
  230. }