Advertisement
Guest User

Untitled

a guest
Nov 26th, 2015
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.74 KB | None | 0 0
  1. package org.Deathwish.world.content.minigames.impl;
  2.  
  3. import org.Deathwish.util.MathUtils;
  4. import org.Deathwish.util.Misc;
  5. import org.Deathwish.world.entity.player.Player;
  6. import org.Deathwish.world.entity.player.PlayerHandler;
  7. /**
  8. * TriviaBot asks random questions and rewards players
  9. *
  10. * @author nand0
  11. */
  12. public class TriviaBot {
  13.  
  14. /**
  15. * The current selected question.
  16. */
  17.  
  18. public static String currentQuestion = null;
  19.  
  20. /**
  21. * The current selected answer.
  22. */
  23.  
  24. public static String currentAnswer = null;
  25.  
  26. /**
  27. * This will hold all of the different variety of questions, and answers
  28. * which the trivia bot could ask in-game.
  29. */
  30.  
  31. public static final String[][] data = {
  32. { "What defence level requirement does a bandos armour piece have?","65" },
  33. { "What do you get when you type backwards reversed?", "sdrawkcab" },
  34. { "Who is Nando's favorite artist?", "eminem" },
  35. { "Fuck that lil mouse couse im an!", "albatroaz" },
  36. { "What was the first planet to be discovered using the telescope, in 1781?","uranus" },
  37. { "Which forum software we are currently using?", "vbulletin" },
  38. { "What level is required to equip corrupt items?", "20" },
  39. { "What element begins with the letter K?", "krypton" },
  40. { "What drug is getting more poplair also reffered to as Special K?", "ketamine" },
  41. { "What should be the main substance of an xtc pill?", "mdma" },
  42. { "What is sushi traditionally wrapped in?", "seaweed" },
  43. { "Couse everbody knows that ****? is the word. **** **** **** is the word","bird" },
  44. { "An expulsion of wind from the vulva during coitus, what is this named?","queef" },
  45. { "Name the world's largest ocean", "pacific" },
  46. { "What is the name of princess super mario is always trying to safe?","peach" },
  47. { "What is the capital city of Spain?", "madrid" },
  48. { "What is the capital city of Russia?", "moscow" },
  49. { "Who flew too close to the sun and had his wings melted?", "icarus" },
  50. { "Who forgets, will be destined to remember?", "nothingman" },
  51. { "What helped a lot of underage drinkers get drunk?", "alcopop" },
  52. { "20% of what is in the metal part at the end of a pencil", "sulphur" },
  53. { "24-karat gold has to have a amount of ? in it to keep it from being too soft", "copper" },
  54. { "3.26 light years is equal to one", "parsec" },
  55. { "3-D that can be seen without glasses is also known as this", "stereoscopic" },
  56. { "What is the name of the main character in the legend of zelda games?","link" },
  57. { "What fish can you catch at level 76?","shark" },
  58. { "What another name used for the super nintendo?", "snes" },
  59. { "What game console was used back in the days to play sonic the hedgehock on?","sega" },
  60. { "What is Deathwish spelled backwards?", "hsiwhtaed" },
  61. { "Which summoned npc holds the most items for you?", "packyak" },
  62. { "Don't forget to ::****? every 12 hours or more if you got a vpn", "vote" },
  63. { "What colour is Absynth?", "green" },
  64. { "Which country has the largest area: Australia, Brazil or India??", "brazil" },
  65. { "Where is Notre Dame?", "paris" },
  66. { "What Spanish artist said he would eat his wife when she died??", "dali" },
  67. { "How many oscars did Alfred Hitchcock win?", "none" },
  68. { "What's the capital of Ecuador?", "quito" },
  69. { "What's the capital of Denmark?", "copenhagen" },
  70. { "What's the capital of Finland?", "helsinki" },
  71. { "How many wives did Henry the Eighth have?", "six" },
  72. { "What's the name of the main airport in Madrid?", "barajas" },
  73. { "Where is the smallest bone in the body?", "ear" },
  74. { "Which is the only mammal that can't jump?", "elephant" },
  75. { "What's the hardest rock?", "diamond" },
  76. { "What horoscope sign has a crab?", "cancer" },
  77. { "Where did the first atomic bomb explode for the first time in Japan?", "hiroshima" },
  78. { "Which is the smallest ocean?", "artic" },
  79. { "What's the highest mountain in Africa?", "kilimanjaro" },
  80. { "How many states are there in the United States of America??", "50" },
  81. { "What's the highest mountain in the world?", "everest" },
  82. { "What's the capital of Scotland?", "edinburgh" },
  83. { "What is the capital city of the netherlands?", "amsterdam" },
  84. { "What is the name of the ranged avatar that can drop handcannon", "arzinian" },
  85. { "What is the capital city of germany?", "berlin" },
  86. { "Which country gave the USA the 'Statute of Liberty?", "france" },
  87. { "What is the dutch word for cancer often taken offensive by usa/uk?", "kanker" },
  88. { "Which skill is not trainable on Deathwish?", "construction" },
  89. { "What process involves heating an ore to obtain a metal?","smelting" },
  90. { "What prayer level is required to use the hawk eye prayer?","26" },
  91. { "What prayer is used to drain your oppenents prayer?", "smite" },
  92. { "How many k tokkul is required to upgrade your fire cape to TokHaar-Kal?","50k" },
  93. { "What framework is Deathwish build on?", "niobe" },
  94. { "How much of a percentage does a bgs special requires?", "100" },
  95. { "Vegita! What does the scouter say about his powerlevel? it's over???","9000" },
  96. { "What is the maximum number of unstackable items in your inventory? ","28" },
  97. { "What is maximum combat level in Deathwish", "138" },
  98. { "What 3 letters are commenly used to describe king black dragon?","kbd" },
  99. { "What was the highest highest combat possible before summoning came out?","126" },
  100. { "What year did jagex remove the wilderness?", "2007" },
  101. { "Who caused the Falador Masacre on 6/6/6?", "durial321" },
  102. { "Which herb is required to make agility potions?", "toadflax" },
  103. { "Which herb is required with an eye of newt when you start training herblore?","guam" },
  104. { "How many runes does blood barrage use per cast??", "9" },
  105. { "What skill would you need to train in order to obtain iron ores?","mining" },
  106. { "Which armour set lower a players run energy? ", "torags" },
  107. { "How much is 9+2+6+2-10+16-8+4+2-1+3-1+16? ", "40" },
  108. { "How much is 9+2+6+2-10-8+4+2-1+3-1+6? ", "14" },
  109. { "How much is 9*2-16+2-1+7+115-25? ", "100" },
  110. { "What is the substance name which is sold as speed ?","amphetamine" },
  111. { "What substance gave way to the term melting face?","acid" },
  112. { "What drug is also known as moonrocks?","mdma" },
  113. { "Who was ranked #1 on runescape for many years?", "zezima" } };
  114.  
  115. private static int tick;
  116. public static void process() {
  117. if(tick >= 2600) {
  118. tick = 0;
  119. if (currentQuestion != null) {
  120. yell("<shad=0EBFE9>@red@[TRIVIA]@mag@ " + currentQuestion);
  121. return;
  122. }
  123. assignQuestion();
  124. }
  125. tick++;
  126. }
  127.  
  128. /**
  129. * This will generate a new current answer, and question.
  130. */
  131.  
  132. public static void assignQuestion() {
  133. for (int i = 0; i < data.length; i++) {
  134. if (Misc.getRandom(i) == i) {
  135. currentQuestion = data[i][0];
  136. currentAnswer = data[i][1];
  137. }
  138. }
  139. yell("<shad=0EBFE9>@red@[TRIVIA]@mag@ " + currentQuestion);
  140. yell("<shad=0EBFE9>@red@[TRIVIA]@mag@If you think you know the answer simply ");
  141. yell("<shad=0EBFE9>@red@[TRIVIA]@mag@use the command ::answer with the answer after it");
  142. }
  143.  
  144. /**
  145. * It will reset the current question, and answer.
  146. */
  147.  
  148. public static void resetQuestion() {
  149. currentAnswer = null;
  150. currentQuestion = null;
  151. }
  152.  
  153. /**
  154. * This will check whether the player's answer entered is incorrect, or
  155. * correct.
  156. *
  157. * @param message
  158. * The player's answer.
  159. */
  160.  
  161. public static void attemptQuestion(Player c, String message) {
  162. if (currentQuestion == null) {
  163. c.getPacketSender().sendMessage(
  164. "@red@There is no question assigned to the trivia bot..");
  165. return;
  166. }
  167. if (message.equalsIgnoreCase(currentAnswer)) {
  168. final int random = MathUtils.random(20);
  169. switch (random) {
  170. case 0:
  171. c.getPointsHandler().setPkPoints(+25, true);
  172. PlayerHandler.sendGlobalPlayerMessage("<shad=0EBFE9>@red@[TRIVIA]@mag@"+ c.getUsername()+ " entered the correct answer, and received 25 pk points!");
  173. resetQuestion();
  174. return;
  175. case 1:
  176. c.getInventory().add(989, 1);
  177. PlayerHandler.sendGlobalPlayerMessage("<shad=0EBFE9>@red@[TRIVIA]@mag@"+ c.getUsername()+ " entered the correct answer, and received a crystal key!");
  178. resetQuestion();
  179. return;
  180. case 2:
  181. c.getInventory().add(995, 5000000);
  182. PlayerHandler.sendGlobalPlayerMessage("<shad=0EBFE9>@red@[TRIVIA]@mag@"+ c.getUsername()+ " entered the correct answer, and received 5m!");
  183. resetQuestion();
  184. return;
  185. case 3:
  186. c.getInventory().add(989, 1);
  187. PlayerHandler.sendGlobalPlayerMessage("<shad=0EBFE9>@red@[TRIVIA]@mag@"+ c.getUsername()+ " entered the correct answer, and received a crystal key!");
  188. resetQuestion();
  189. return;
  190. case 4:
  191. c.getInventory().add(995, 5000000);
  192. PlayerHandler.sendGlobalPlayerMessage("<shad=0EBFE9>@red@[TRIVIA]@mag@"+ c.getUsername()+ " entered the correct answer, and received 5m!");
  193. resetQuestion();
  194. return;
  195. case 5:
  196. c.getInventory().add(13853, 1);
  197. PlayerHandler.sendGlobalPlayerMessage("<shad=0EBFE9>@red@[TRIVIA]@mag@"+ c.getUsername()+ " entered the correct answer, and received a brawling gloves(hunter)!");
  198. resetQuestion();
  199. return;
  200. case 6:
  201. c.getInventory().add(7774, 5);
  202. PlayerHandler.sendGlobalPlayerMessage("<shad=0EBFE9>@red@[TRIVIA]@mag@"+ c.getUsername()+ " entered the correct answer, and received 5 voting certificates!");
  203. resetQuestion();
  204. return;
  205. case 7:
  206. c.getInventory().add(7774, 2);
  207. PlayerHandler.sendGlobalPlayerMessage("<shad=0EBFE9>@red@[TRIVIA]@mag@"+ c.getUsername()+ " entered the correct answer, and received 2 voting certificates!");
  208. resetQuestion();
  209. return;
  210. case 8:
  211. c.getInventory().add(989, 1);
  212. PlayerHandler.sendGlobalPlayerMessage("<shad=0EBFE9>@red@[TRIVIA]@mag@"+ c.getUsername()+ " entered the correct answer, and received a crystal key!");
  213. resetQuestion();
  214. return;
  215. case 9:
  216. c.getInventory().add(995, 10000000);
  217. PlayerHandler.sendGlobalPlayerMessage("<shad=0EBFE9>@red@[TRIVIA]@mag@"+ c.getUsername()+ " entered the correct answer, and recieved 10m coins!");
  218. resetQuestion();
  219. return;
  220. case 10:
  221. c.getInventory().add(995, 10000000);
  222. PlayerHandler.sendGlobalPlayerMessage("<shad=0EBFE9>@red@[TRIVIA]@mag@"+ c.getUsername()+ " entered the correct answer, and recieved 10m coins!");
  223. resetQuestion();
  224. return;
  225. case 11:
  226. c.getInventory().add(995, 5000000);
  227. PlayerHandler.sendGlobalPlayerMessage("<shad=0EBFE9>@red@[TRIVIA]@mag@"+ c.getUsername()+ " entered the correct answer, and received 5m!");
  228. resetQuestion();
  229. return;
  230. case 12:
  231. c.getInventory().add(1631, 1);
  232. PlayerHandler.sendGlobalPlayerMessage("<shad=0EBFE9>@red@[TRIVIA]@mag@"+ c.getUsername()+ " entered the correct answer, and an uncut dragon stone!");
  233. resetQuestion();
  234. return;
  235. case 13:
  236. c.getInventory().add(995, 5000000);
  237. PlayerHandler.sendGlobalPlayerMessage("<shad=0EBFE9>@red@[TRIVIA]@mag@"+ c.getUsername()+ " entered the correct answer, and received 5m!");
  238. resetQuestion();
  239. return;
  240. case 15:
  241. c.getInventory().add(995, 5000000);
  242. PlayerHandler.sendGlobalPlayerMessage("<shad=0EBFE9>@red@[TRIVIA]@mag@"+ c.getUsername()+ " entered the correct answer, and received 5m!");
  243. resetQuestion();
  244. return;
  245. case 16:
  246. c.getInventory().add(13849, 1);
  247. PlayerHandler.sendGlobalPlayerMessage("<shad=0EBFE9>@red@[TRIVIA]@mag@"+ c.getUsername()+ " entered the correct answer, and received a brawling gloves(agility)!");
  248. resetQuestion();
  249. return;
  250. case 17:
  251. c.getInventory().add(13856, 1);
  252. PlayerHandler.sendGlobalPlayerMessage("<shad=0EBFE9>@red@[TRIVIA]@mag@"+ c.getUsername()+ " entered the correct answer, and recieved brawling gloves(fishing)!");
  253. resetQuestion();
  254. return;
  255. case 18:
  256. c.getInventory().add(13854, 1);
  257. PlayerHandler.sendGlobalPlayerMessage("<shad=0EBFE9>@red@[TRIVIA]@mag@"+ c.getUsername() + " entered the correct answer, and recieved brawling gloves(thieving)!");
  258. resetQuestion();
  259. return;
  260. case 19:
  261. c.getInventory().add(995, 5000000);
  262. PlayerHandler.sendGlobalPlayerMessage("<shad=0EBFE9>@red@[TRIVIA]@mag@"+ c.getUsername()+ " entered the correct answer, and received 5m!");
  263. resetQuestion();
  264. return;
  265. case 20:
  266. c.getInventory().add(989, 1);
  267. PlayerHandler.sendGlobalPlayerMessage("<shad=0EBFE9>@red@[TRIVIA]@mag@"+ c.getUsername()+ " entered the correct answer, and received a crystal key!");
  268. resetQuestion();
  269. return;
  270. }
  271. } else {
  272. c.getPacketSender().sendMessage("@red@The answer entered was incorrect!");
  273. }
  274. }
  275.  
  276. /**
  277. * Sends a global message to the server.
  278. *
  279. * @param s
  280. * The message which is going to be sent.
  281. */
  282.  
  283. public static void yell(String s) {
  284.  
  285. PlayerHandler.sendGlobalPlayerMessage(s);
  286. }
  287. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement