core.txt 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. event.load("human_hurt");
  2. event.load("entity_click");
  3. event.load("inv_click");
  4. event.load("skill_showshop");
  5. timestamp = map.new(); //TimeStamp for Felsmagier-SkillShop
  6. stable_loc = loc.new(world.getStory(), -1584, 66, -57);
  7. prefix_skill = "§2Skill";
  8. msg("dev", "§bQuests: §rAdmont loaded.");
  9. @wait
  10. wait();
  11. ignoreGoto(event);
  12. goto("wait");
  13. @human_hurt
  14. if(!isPlayer(entity)) {
  15. goto("wait");
  16. }
  17. player = entity;
  18. entity = human;
  19. goto("human_core");
  20. @entity_click
  21. if(hand == "OFF_HAND") {
  22. goto("wait");
  23. }
  24. if(entity.getType(entity) != "human") {
  25. goto("wait");
  26. }
  27. goto("human_core");
  28. @human_core
  29. checkAdmontStable();
  30. if(player.hasQuest2(player)) {
  31. goto("wait");
  32. }
  33. if(quest.isPlayerBlocked(player)) {
  34. quest.removeCooldown(player);
  35. goto("wait");
  36. }
  37. entity_name = entity.getName(entity);
  38. if(entity_name == "Oma") {
  39. inv = inv.new("333333333");
  40. inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fDer Anfang...", "§e...beginnt immer mit einer netten Oma."));
  41. inv.setItem(inv, 8, read.item("minecraft:enchanted_book", 1, "§fMülleimer", "§eOma räumt für dich auf"));
  42. inv.open(inv, player, "Quests: Oma");
  43. goto("wait");
  44. }
  45. if(entity_name == "Dieter") {
  46. inv = inv.new("333333333");
  47. inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fGaumenschmauß...", "§e...für die ganze Familie."));
  48. inv.open(inv, player, "Quests: Dieter");
  49. goto("wait");
  50. }
  51. if(entity_name == "Zauberlehrling") {
  52. inv = inv.new("333333333");
  53. inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fDer Felsmagier...", "§e...hat zauberhafte Skills für dich."));
  54. inv.open(inv, player, "Quests: Zauberlehrling");
  55. goto("wait");
  56. }
  57. if(entity_name == "Felsmagier") {
  58. if(time.getMillis() - map.getOrDefault(timestamp, player.getUuid(player), 0) < 120000) { //2 Minutes
  59. skill.showShop(player, "skill.subcu_inv", "skill.comeback", "skill.head_human", "skill.head_monster", "skill.fly10min", "skill.grow", "skill.haste", "skill.speed", "skill.jump_boost", "skill.dolphin", "skill.block_up", "skill.block_down", "skill.fire_arrow", "skill.cobweb_miner", null, null, null, null);
  60. } else {
  61. msg.prefix(player, "§dFelsmagier", "Du musst zuerst ein paar Aufgaben für mich erledigen. Finde meinen Zauberlehrling, der hilft dir weiter.");
  62. }
  63. goto("wait");
  64. }
  65. if(entity_name == "Peter") {
  66. inv = inv.new("333333333");
  67. inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fErstes Date"));
  68. inv.setItem(inv, 1, read.item("minecraft:enchanted_book", 1, "§fNeue Hose"));
  69. inv.open(inv, player, "Quests: Peter");
  70. goto("wait");
  71. }
  72. if(entity_name == "Merle") {
  73. inv = inv.new("333333333");
  74. inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fMerle in Nöten"));
  75. inv.open(inv, player, "Quests: Merle");
  76. goto("wait");
  77. }
  78. if(entity_name == "Herbert") {
  79. inv = inv.new("333333333");
  80. inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fSchatz von Admont"));
  81. inv.setItem(inv, 1, read.item("minecraft:enchanted_book", 1, "§fAlbtraum"));
  82. inv.open(inv, player, "Quests: Herbert");
  83. goto("wait");
  84. }
  85. if(entity_name == "Gustav") {
  86. inv = inv.new("333333333");
  87. inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fHelfende Hand"));
  88. inv.open(inv, player, "Quests: Gustav");
  89. goto("wait");
  90. }
  91. if(entity_name == "Gertrude") {
  92. inv = inv.new("333333333");
  93. inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fZauberlehrling"));
  94. inv.open(inv, player, "Quests: Gertrude");
  95. goto("wait");
  96. }
  97. if(entity_name == "Bernd") {
  98. inv = inv.new("333333333");
  99. inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fHide and Seek"));
  100. inv.open(inv, player, "Quests: Bernd");
  101. goto("wait");
  102. }
  103. if(entity_name == "Kunibert") {
  104. inv = inv.new("333333333");
  105. inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fKräutermeister"));
  106. inv.open(inv, player, "Quests: Kunibert");
  107. goto("wait");
  108. }
  109. if(entity_name == "Bauer") {
  110. inv = inv.new("333333333");
  111. inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fErntezeit"));
  112. inv.setItem(inv, 1, read.item("minecraft:enchanted_book", 1, "§fSpezialwunsch"));
  113. inv.open(inv, player, "Quests: Bauer");
  114. goto("wait");
  115. }
  116. if(entity_name == "Ulf") {
  117. inv = inv.new("333333333");
  118. inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fIn Eile"));
  119. inv.open(inv, player, "Quests: Ulf");
  120. goto("wait");
  121. }
  122. if(entity_name == "Isabell") {
  123. inv = inv.new("333333333");
  124. inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fFür die Wissenschaft!"));
  125. inv.open(inv, player, "Quests: Isabell");
  126. goto("wait");
  127. }
  128. if(entity_name == "Olaf") {
  129. inv = inv.new("333333333");
  130. inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fReinigung"));
  131. inv.setItem(inv, 1, read.item("minecraft:enchanted_book", 1, "§fMitbringsel"));
  132. inv.open(inv, player, "Quests: Olaf");
  133. goto("wait");
  134. }
  135. if(entity_name == "Rolf") {
  136. inv = inv.new("333333333");
  137. inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fTücher"));
  138. inv.open(inv, player, "Quests: Rolf");
  139. goto("wait");
  140. }
  141. if(entity_name == "Schmied") {
  142. inv = inv.new("333333333");
  143. inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fDie Uhr tickt"));
  144. inv.open(inv, player, "Quests: Schmied");
  145. goto("wait");
  146. }
  147. if(entity_name == "Förster") {
  148. inv = inv.new("333333333");
  149. inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fIch und mein Holz"));
  150. inv.open(inv, player, "Quests: Förster");
  151. goto("wait");
  152. }
  153. goto("wait");
  154. @inv_click
  155. if(inv_name == "Quests: Oma") {
  156. if(inv_slot == 0) {
  157. quest.start(player, "story/admont/der_anfang");
  158. goto("wait");
  159. }
  160. if(inv_slot == 8) {
  161. waste_inv = inv.new("111111111111111111111111111");
  162. inv.open(waste_inv, player, "Mülleimer");
  163. goto("wait");
  164. }
  165. goto("wait");
  166. }
  167. if(inv_name == "Quests: Dieter") {
  168. if(inv_slot == 0) {
  169. quest.start(player, "story/admont/gaumenschmauss");
  170. goto("wait");
  171. }
  172. goto("wait");
  173. }
  174. if(inv_name == "Quests: Zauberlehrling") {
  175. if(inv_slot == 0) {
  176. if(script.isActiveName("scripts/story/admont/felsmagier.txt")) {
  177. msg.prefix(player, "§dZauberlehrling", "Diese Quest ist momentan aktiv und kann nicht vergeben werden.");
  178. goto("wait");
  179. }
  180. quest.start(player, "story/admont/felsmagier");
  181. goto("wait");
  182. }
  183. goto("wait");
  184. }
  185. if(inv_name == "Quests: Peter") {
  186. if(inv_slot == 0) {
  187. quest.start(player, "story/admont/erstes_date");
  188. goto("wait");
  189. }
  190. if(inv_slot == 1) {
  191. quest.start(player, "story/admont/neue_hose");
  192. goto("wait");
  193. }
  194. goto("wait");
  195. }
  196. if(inv_name == "Quests: Merle") {
  197. if(inv_slot == 0) {
  198. quest.start(player, "story/admont/merle_in_noeten");
  199. goto("wait");
  200. }
  201. goto("wait");
  202. }
  203. if(inv_name == "Quests: Herbert") {
  204. if(inv_slot == 0) {
  205. if(script.isActiveName("scripts/story/admont/schatz_von_admont.txt")) {
  206. msg.prefix(player, "§dHerbert", "Diese Quest ist momentan aktiv und kann nicht vergeben werden.");
  207. goto("wait");
  208. }
  209. quest.start(player, "story/admont/schatz_von_admont");
  210. goto("wait");
  211. }
  212. if(inv_slot == 1) {
  213. quest.start(player, "story/admont/albtraum");
  214. goto("wait");
  215. }
  216. goto("wait");
  217. }
  218. if(inv_name == "Quests: Gustav") {
  219. if(inv_slot == 0) {
  220. quest.start(player, "story/admont/helfende_hand");
  221. goto("wait");
  222. }
  223. goto("wait");
  224. }
  225. if(inv_name == "Quests: Gertrude") {
  226. if(inv_slot == 0) {
  227. quest.start(player, "story/admont/zauberlehrling");
  228. goto("wait");
  229. }
  230. goto("wait");
  231. }
  232. if(inv_name == "Quests: Bernd") {
  233. if(inv_slot == 0) {
  234. quest.start(player, "story/admont/hide_and_seek");
  235. goto("wait");
  236. }
  237. goto("wait");
  238. }
  239. if(inv_name == "Quests: Kunibert") {
  240. if(inv_slot == 0) {
  241. quest.start(player, "story/admont/kraeutermeister");
  242. goto("wait");
  243. }
  244. goto("wait");
  245. }
  246. if(inv_name == "Quests: Bauer") {
  247. if(inv_slot == 0) {
  248. quest.start(player, "story/admont/erntezeit");
  249. goto("wait");
  250. }
  251. if(inv_slot == 1) {
  252. quest.start(player, "story/admont/spezialwunsch");
  253. goto("wait");
  254. }
  255. goto("wait");
  256. }
  257. if(inv_name == "Quests: Ulf") {
  258. if(inv_slot == 0) {
  259. quest.start(player, "story/admont/in_eile");
  260. goto("wait");
  261. }
  262. goto("wait");
  263. }
  264. if(inv_name == "Quests: Isabell") {
  265. if(inv_slot == 0) {
  266. quest.start(player, "story/admont/fuer_die_wissenschaft");
  267. goto("wait");
  268. }
  269. goto("wait");
  270. }
  271. if(inv_name == "Quests: Olaf") {
  272. if(inv_slot == 0) {
  273. quest.start(player, "story/admont/reinigung");
  274. goto("wait");
  275. }
  276. if(inv_slot == 1) {
  277. quest.start(player, "story/admont/mitbringsel");
  278. goto("wait");
  279. }
  280. goto("wait");
  281. }
  282. if(inv_name == "Quests: Rolf") {
  283. if(inv_slot == 0) {
  284. quest.start(player, "story/admont/tuecher");
  285. goto("wait");
  286. }
  287. goto("wait");
  288. }
  289. if(inv_name == "Quests: Schmied") {
  290. if(inv_slot == 0) {
  291. quest.start(player, "story/admont/die_uhr_tickt");
  292. goto("wait");
  293. }
  294. goto("wait");
  295. }
  296. if(inv_name == "Quests: Förster") {
  297. if(inv_slot == 0) {
  298. quest.start(player, "story/admont/ich_und_mein_holz");
  299. goto("wait");
  300. }
  301. goto("wait");
  302. }
  303. if(inv_name == "Skillshop") {
  304. if(item.getType(item) == "minecraft:air") {
  305. goto("wait");
  306. }
  307. skill_name = removeFormat(item.getName(item));
  308. tech_name = skill.getTechName(skill_name);
  309. if(skill.isPermanent(skill_name)) {
  310. amount = skill.getAmount(player, tech_name);
  311. if(amount >= 1) {
  312. goto("wait");
  313. }
  314. }
  315. cost = skill.getCost(skill_name);
  316. if(!hasEnoughMoney(player, cost)) {
  317. msg.prefix(player, prefix_skill, "Du hast nicht genug Snuvis.");
  318. goto("wait");
  319. }
  320. subMoney(player, cost);
  321. skill.addAmount(player, tech_name, 1);
  322. inv.setItem(inv, inv_slot, skill.getShopItem(player, tech_name));
  323. inv.update(player);
  324. }
  325. goto("wait");
  326. @skill_showshop
  327. player = getScriptVar("player");
  328. shop_type = getScriptVar("shop_type");
  329. if(shop_type == "foerster") {
  330. skill.showShop(player, "skill.timber", "skill.better_shears", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);
  331. goto("wait");
  332. }
  333. if(shop_type == "felsmagier") {
  334. skill.showShop(player, "skill.subcu_inv", "skill.comeback", "skill.head_human", "skill.head_monster", "skill.fly10min", "skill.grow", "skill.haste", "skill.speed", "skill.jump_boost", "skill.dolphin", "skill.block_up", "skill.block_down", "skill.fire_arrow", "skill.cobweb_miner", null, null, null, null);
  335. }
  336. goto("wait");
  337. function checkAdmontStable() {
  338. list = living.near($stable_loc, 30);
  339. size = list.getSize(list);
  340. entities = 0;
  341. for(i = 0; i < size; i++) {
  342. element = list.getIndex(list, i);
  343. entity_type = entity.getType(element);
  344. if(entity_type == "cow" || entity_type == "pig" || entity_type == "sheep") {
  345. entities++;
  346. }
  347. }
  348. while(entities > 70) {
  349. index = math.random(0, size - 1);
  350. element = list.getIndex(list, index);
  351. entity_type = entity.getType(element);
  352. if(entity_type == "cow" || entity_type == "pig" || entity_type == "sheep") {
  353. entity.remove(element);
  354. list.removeIndex(list, index);
  355. entities--;
  356. size--;
  357. }
  358. }
  359. }