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--; } } }