12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- function stage.increase(player) {
- $stage++;
- quest.display(player, $quest_name, $stage, $all_stages);
- sound = sound.get("entity.experience_orb.pickup");
- category = sound.getCategory("master");
- sound.spawnForPlayer(player, sound, category);
- }
- function quest.start(player, path) {
- script = script.start(path, "utils/u_quest", "utils/u_general");
- if(script == null) {
- msg("dev", "quest not started");
- return;
- }
- quest.addPlayer(script, player);
- script.setVar(script, "player", player);
- script.setVar(script, "script", script);
- script.callEvent("quest_start", script);
- inv.close(player);
- }
- function player.getShipProgress(player_or_id) {
- config = playerdata.getStory(player_or_id);
- return config.getDouble(config, "ship.progress", 0);
- }
- function player.setShipProgress(player_or_id, progress) {
- config = playerdata.getStory(player_or_id);
- old_progress = config.getDouble(config, "ship.progress", 0);
- if(progress > old_progress) {
- config.set(config, "ship.progress", progress);
- config.saveAsync(config);
- }
- }
- function human.giveItem(human_name, player, needed_type, needed_amount) {
- item = entity.getEquip(player, "hand");
- item_type = item.getType(item);
- if(item_type == "minecraft:air") {
- return null;
- }
- if(item_type == needed_type) {
- rest_item = player.removeItem(player, read.item(item_type, needed_amount));
- rest_item_amount = item.getAmount(rest_item);
- if(rest_item_amount > 0) {
- msg.prefix(player, human_name, concat("Ich brauche bitte noch ", text.number(rest_item_amount), " Stück davon."));
- }
- return rest_item_amount;
- }
- msg.prefix(player, human_name, "Das kann ich nicht gebrauchen.");
- return null;
- }
|