123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367 |
- event.load("human_hurt");
- event.load("entity_click");
- event.load("inv_click");
- event.load("skill_showshop");
- timestamp = map.new(); //TimeStamp for Felsmagier-SkillShop
- stable_loc = loc.new(world.getStory(), -1584, 66, -57);
- prefix_skill = "§2Skill";
- msg("dev", "§bQuests: §rAdmont loaded.");
- @wait
- wait();
- ignoreGoto(event);
- goto("wait");
- @human_hurt
- if(!isPlayer(entity)) {
- goto("wait");
- }
- player = entity;
- entity = human;
- goto("human_core");
- @entity_click
- if(hand == "OFF_HAND") {
- goto("wait");
- }
- if(entity.getType(entity) != "human") {
- goto("wait");
- }
- goto("human_core");
- @human_core
- checkAdmontStable();
- if(player.hasQuest2(player)) {
- goto("wait");
- }
- if(quest.isPlayerBlocked(player)) {
- quest.removeCooldown(player);
- goto("wait");
- }
- entity_name = entity.getName(entity);
- if(entity_name == "Oma") {
- inv = inv.new("333333333");
- inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fDer Anfang...", "§e...beginnt immer mit einer netten Oma."));
- inv.setItem(inv, 8, read.item("minecraft:enchanted_book", 1, "§fMülleimer", "§eOma räumt für dich auf"));
- inv.open(inv, player, "Quests: Oma");
- goto("wait");
- }
- if(entity_name == "Dieter") {
- inv = inv.new("333333333");
- inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fGaumenschmauß...", "§e...für die ganze Familie."));
- inv.open(inv, player, "Quests: Dieter");
- goto("wait");
- }
- if(entity_name == "Zauberlehrling") {
- inv = inv.new("333333333");
- inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fDer Felsmagier...", "§e...hat zauberhafte Skills für dich."));
- inv.open(inv, player, "Quests: Zauberlehrling");
- goto("wait");
- }
- if(entity_name == "Felsmagier") {
- if(time.getMillis() - map.getOrDefault(timestamp, player.getUuid(player), 0) < 120000) { //2 Minutes
- 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);
- } else {
- msg.prefix(player, "§dFelsmagier", "Du musst zuerst ein paar Aufgaben für mich erledigen. Finde meinen Zauberlehrling, der hilft dir weiter.");
- }
- goto("wait");
- }
- if(entity_name == "Peter") {
- inv = inv.new("333333333");
- inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fErstes Date"));
- inv.setItem(inv, 1, read.item("minecraft:enchanted_book", 1, "§fNeue Hose"));
- inv.open(inv, player, "Quests: Peter");
- goto("wait");
- }
- if(entity_name == "Merle") {
- inv = inv.new("333333333");
- inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fMerle in Nöten"));
- inv.open(inv, player, "Quests: Merle");
- goto("wait");
- }
- if(entity_name == "Herbert") {
- inv = inv.new("333333333");
- inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fSchatz von Admont"));
- inv.setItem(inv, 1, read.item("minecraft:enchanted_book", 1, "§fAlbtraum"));
- inv.open(inv, player, "Quests: Herbert");
- goto("wait");
- }
- if(entity_name == "Gustav") {
- inv = inv.new("333333333");
- inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fHelfende Hand"));
- inv.open(inv, player, "Quests: Gustav");
- goto("wait");
- }
- if(entity_name == "Gertrude") {
- inv = inv.new("333333333");
- inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fZauberlehrling"));
- inv.open(inv, player, "Quests: Gertrude");
- goto("wait");
- }
- if(entity_name == "Bernd") {
- inv = inv.new("333333333");
- inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fHide and Seek"));
- inv.open(inv, player, "Quests: Bernd");
- goto("wait");
- }
- if(entity_name == "Kunibert") {
- inv = inv.new("333333333");
- inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fKräutermeister"));
- inv.open(inv, player, "Quests: Kunibert");
- goto("wait");
- }
- if(entity_name == "Bauer") {
- inv = inv.new("333333333");
- inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fErntezeit"));
- inv.setItem(inv, 1, read.item("minecraft:enchanted_book", 1, "§fSpezialwunsch"));
- inv.open(inv, player, "Quests: Bauer");
- goto("wait");
- }
- if(entity_name == "Ulf") {
- inv = inv.new("333333333");
- inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fIn Eile"));
- inv.open(inv, player, "Quests: Ulf");
- goto("wait");
- }
- if(entity_name == "Isabell") {
- inv = inv.new("333333333");
- inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fFür die Wissenschaft!"));
- inv.open(inv, player, "Quests: Isabell");
- goto("wait");
- }
- if(entity_name == "Olaf") {
- inv = inv.new("333333333");
- inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fReinigung"));
- inv.setItem(inv, 1, read.item("minecraft:enchanted_book", 1, "§fMitbringsel"));
- inv.open(inv, player, "Quests: Olaf");
- goto("wait");
- }
- if(entity_name == "Rolf") {
- inv = inv.new("333333333");
- inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fTücher"));
- inv.open(inv, player, "Quests: Rolf");
- goto("wait");
- }
- if(entity_name == "Schmied") {
- inv = inv.new("333333333");
- inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fDie Uhr tickt"));
- inv.open(inv, player, "Quests: Schmied");
- goto("wait");
- }
- if(entity_name == "Förster") {
- inv = inv.new("333333333");
- inv.setItem(inv, 0, read.item("minecraft:enchanted_book", 1, "§fIch und mein Holz"));
- inv.open(inv, player, "Quests: Förster");
- goto("wait");
- }
- goto("wait");
- @inv_click
- if(inv_name == "Quests: Oma") {
- if(inv_slot == 0) {
- quest.start(player, "story/admont/der_anfang");
- goto("wait");
- }
- if(inv_slot == 8) {
- waste_inv = inv.new("111111111111111111111111111");
- inv.open(waste_inv, player, "Mülleimer");
- goto("wait");
- }
- goto("wait");
- }
- if(inv_name == "Quests: Dieter") {
- if(inv_slot == 0) {
- quest.start(player, "story/admont/gaumenschmauss");
- goto("wait");
- }
- goto("wait");
- }
- if(inv_name == "Quests: Zauberlehrling") {
- if(inv_slot == 0) {
- if(script.isActiveName("scripts/story/admont/felsmagier.txt")) {
- msg.prefix(player, "§dZauberlehrling", "Diese Quest ist momentan aktiv und kann nicht vergeben werden.");
- goto("wait");
- }
- quest.start(player, "story/admont/felsmagier");
- goto("wait");
- }
- goto("wait");
- }
- if(inv_name == "Quests: Peter") {
- if(inv_slot == 0) {
- quest.start(player, "story/admont/erstes_date");
- goto("wait");
- }
- if(inv_slot == 1) {
- quest.start(player, "story/admont/neue_hose");
- goto("wait");
- }
- goto("wait");
- }
- if(inv_name == "Quests: Merle") {
- if(inv_slot == 0) {
- quest.start(player, "story/admont/merle_in_noeten");
- goto("wait");
- }
- goto("wait");
- }
- if(inv_name == "Quests: Herbert") {
- if(inv_slot == 0) {
- if(script.isActiveName("scripts/story/admont/schatz_von_admont.txt")) {
- msg.prefix(player, "§dHerbert", "Diese Quest ist momentan aktiv und kann nicht vergeben werden.");
- goto("wait");
- }
- quest.start(player, "story/admont/schatz_von_admont");
- goto("wait");
- }
- if(inv_slot == 1) {
- quest.start(player, "story/admont/albtraum");
- goto("wait");
- }
- goto("wait");
- }
- if(inv_name == "Quests: Gustav") {
- if(inv_slot == 0) {
- quest.start(player, "story/admont/helfende_hand");
- goto("wait");
- }
- goto("wait");
- }
- if(inv_name == "Quests: Gertrude") {
- if(inv_slot == 0) {
- quest.start(player, "story/admont/zauberlehrling");
- goto("wait");
- }
- goto("wait");
- }
- if(inv_name == "Quests: Bernd") {
- if(inv_slot == 0) {
- quest.start(player, "story/admont/hide_and_seek");
- goto("wait");
- }
- goto("wait");
- }
- if(inv_name == "Quests: Kunibert") {
- if(inv_slot == 0) {
- quest.start(player, "story/admont/kraeutermeister");
- goto("wait");
- }
- goto("wait");
- }
- if(inv_name == "Quests: Bauer") {
- if(inv_slot == 0) {
- quest.start(player, "story/admont/erntezeit");
- goto("wait");
- }
- if(inv_slot == 1) {
- quest.start(player, "story/admont/spezialwunsch");
- goto("wait");
- }
- goto("wait");
- }
- if(inv_name == "Quests: Ulf") {
- if(inv_slot == 0) {
- quest.start(player, "story/admont/in_eile");
- goto("wait");
- }
- goto("wait");
- }
- if(inv_name == "Quests: Isabell") {
- if(inv_slot == 0) {
- quest.start(player, "story/admont/fuer_die_wissenschaft");
- goto("wait");
- }
- goto("wait");
- }
- if(inv_name == "Quests: Olaf") {
- if(inv_slot == 0) {
- quest.start(player, "story/admont/reinigung");
- goto("wait");
- }
- if(inv_slot == 1) {
- quest.start(player, "story/admont/mitbringsel");
- goto("wait");
- }
- goto("wait");
- }
- if(inv_name == "Quests: Rolf") {
- if(inv_slot == 0) {
- quest.start(player, "story/admont/tuecher");
- goto("wait");
- }
- goto("wait");
- }
- if(inv_name == "Quests: Schmied") {
- if(inv_slot == 0) {
- quest.start(player, "story/admont/die_uhr_tickt");
- goto("wait");
- }
- goto("wait");
- }
- if(inv_name == "Quests: Förster") {
- if(inv_slot == 0) {
- quest.start(player, "story/admont/ich_und_mein_holz");
- goto("wait");
- }
- goto("wait");
- }
- if(inv_name == "Skillshop") {
- if(item.getType(item) == "minecraft:air") {
- goto("wait");
- }
- skill_name = removeFormat(item.getName(item));
- tech_name = skill.getTechName(skill_name);
- if(skill.isPermanent(skill_name)) {
- amount = skill.getAmount(player, tech_name);
- if(amount >= 1) {
- goto("wait");
- }
- }
- cost = skill.getCost(skill_name);
- if(!hasEnoughMoney(player, cost)) {
- msg.prefix(player, prefix_skill, "Du hast nicht genug Snuvis.");
- goto("wait");
- }
- subMoney(player, cost);
- skill.addAmount(player, tech_name, 1);
- inv.setItem(inv, inv_slot, skill.getShopItem(player, tech_name));
- inv.update(player);
- }
- goto("wait");
- @skill_showshop
- player = getScriptVar("player");
- shop_type = getScriptVar("shop_type");
- if(shop_type == "foerster") {
- skill.showShop(player, "skill.timber", "skill.better_shears", null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null);
- goto("wait");
- }
- if(shop_type == "felsmagier") {
- 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);
- }
- goto("wait");
- function checkAdmontStable() {
- list = living.near($stable_loc, 30);
- size = list.getSize(list);
- entities = 0;
- for(i = 0; i < size; i++) {
- element = list.getIndex(list, i);
- entity_type = entity.getType(element);
- if(entity_type == "cow" || entity_type == "pig" || entity_type == "sheep") {
- entities++;
- }
- }
- while(entities > 70) {
- index = math.random(0, size - 1);
- element = list.getIndex(list, index);
- entity_type = entity.getType(element);
- if(entity_type == "cow" || entity_type == "pig" || entity_type == "sheep") {
- entity.remove(element);
- list.removeIndex(list, index);
- entities--;
- size--;
- }
- }
- }
|