Parcourir la source

events for paper snuvi docu updated

mloeschenkohl il y a 2 ans
Parent
commit
39569d2f64
6 fichiers modifiés avec 618 ajouts et 268 suppressions
  1. 219 243
      docu_minecraft_paper.php
  2. 55 3
      survival/survival.txt
  3. 0 2
      system/chat.txt
  4. 0 3
      system/doors.txt
  5. 16 16
      system/skills.txt
  6. 328 1
      utils/u_skills.txt

Fichier diff supprimé car celui-ci est trop grand
+ 219 - 243
docu_minecraft_paper.php


+ 55 - 3
survival/survival.txt

@@ -95,6 +95,13 @@ sound_drink_milk = sound.get("entity.wandering_trader.drink_milk");
 sound_slime_place = sound.get("block.slime_block.place");
 sound_eating = sound.get("entity.generic.eat");
 
+music_chirp = sound.get("music_disc.chirp");
+
+Sound_Pitch_List = list.new();
+for(a = -12; a <= 12; a++){
+	list.add(Sound_Pitch_List, math.pow(2, -a / 12));
+}
+
 gambler_inv = inv.new("020202020");
 gambler_inv_id = inv.getId(gambler_inv);
 inv.setItem(gambler_inv, 0, read.item("km:coin_copper", 1, "§f1 snuvi"));
@@ -368,12 +375,57 @@ if(entity.getType(entity) == "human") {
 		goto("wait");
 	}
 	if(entity_name == "Moderator\n§9SirTerence7") {
-		rand_number = math.roundup(math.random(0,5));
-		if(rand_number > 1){
+		rand_number = math.roundup(math.random(0,7));
+		if(rand_number < 4){
 			msg.prefix(player, "§9SirTerence7", "Mathe bla... bla... bla...");
-		}else{
+		}
+		if(rand_number == 4){
 			msg.prefix(player, "§9SirTerence7", "Fraktale bla... bla... bla...");
 		}
+		if(rand_number == 5){
+			msg.prefix(player, "§9SirTerence7", "Höhere Dimensionen bla... bla... bla...");
+		}
+		if(rand_number == 6){
+			msg.prefix(player, "§9SirTerence7", "*redet mit Händen weiter*");
+		}
+		if(rand_number == 7){
+			msg.prefix(player, "§9SirTerence7", "*wechselt voller Faszination zwischen scheinbar zusammenhangslosen Themen hin und her*");
+		}
+
+
+		rand_number = math.roundup(math.random(0,500));
+		if(rand_number <= 2){
+			sound.spawnForPlayer(player, $music_chirp, $sound_category_master, 1, 1);
+		}else{
+			rand_pitch = math.roundup(math.random(4, list.getSize(Sound_Pitch_List)-5));
+			if(rand_number < 200){
+				pitch1 = list.getIndex(Sound_Pitch_List, rand_pitch-4);
+				pitch2 = list.getIndex(Sound_Pitch_List, rand_pitch);
+				pitch3 = list.getIndex(Sound_Pitch_List, rand_pitch+3);
+			}else{
+				if(rand_number < 300){
+					pitch1 = list.getIndex(Sound_Pitch_List, rand_pitch-4);
+					pitch1_2 = list.getIndex(Sound_Pitch_List, rand_pitch-2);
+					pitch2 = list.getIndex(Sound_Pitch_List, rand_pitch);
+					pitch3_2 = list.getIndex(Sound_Pitch_List, rand_pitch+1);
+					pitch3 = list.getIndex(Sound_Pitch_List, rand_pitch+3);
+					sound.spawnForPlayer(player, $sound_harp, $sound_category_master, 0.5, pitch1_2);
+					sound.spawnForPlayer(player, $sound_harp, $sound_category_master, 0.5, pitch3_2);
+					sound.spawnForPlayer(player, $sound_flute, $sound_category_master, 0.75, pitch1_2);
+					sound.spawnForPlayer(player, $sound_flute, $sound_category_master, 0.75, pitch3_2);
+				}else{
+					pitch1 = list.getIndex(Sound_Pitch_List, rand_pitch-3);
+					pitch2 = list.getIndex(Sound_Pitch_List, rand_pitch);
+					pitch3 = list.getIndex(Sound_Pitch_List, rand_pitch+4);
+				}
+			}
+			sound.spawnForPlayer(player, $sound_harp, $sound_category_master, 0.8, pitch1);
+			sound.spawnForPlayer(player, $sound_harp, $sound_category_master, 0.9, pitch2);
+			sound.spawnForPlayer(player, $sound_harp, $sound_category_master, 0.8, pitch2);
+			sound.spawnForPlayer(player, $sound_flute, $sound_category_master, 0.9, pitch1);
+			sound.spawnForPlayer(player, $sound_flute, $sound_category_master, 1, pitch2);
+			sound.spawnForPlayer(player, $sound_flute, $sound_category_master, 0.9, pitch3);
+		}
 		goto("wait");
 	}
 	if(entity_name == "Moderator\n§9Mareeeen") {

+ 0 - 2
system/chat.txt

@@ -5,8 +5,6 @@ event.load("player_login");
 event.load("player_logout");
 event.load("living_death");
 
-setMoney(42, 42);
-
 cookie_time = 0;
 cookie = read.item("minecraft:cookie");
 serverspawn = world.getServerSpawn();

+ 0 - 3
system/doors.txt

@@ -125,9 +125,6 @@ function door.open(location) {
 }
 
 function door.close(location) {
-	if(location == null) {
-		return;
-	}
 	block.property.setBool(location, $open_prop, false);
 	//half
 	half_value = block.property.getValue(location, $half_prop);

+ 16 - 16
system/skills.txt

@@ -8,22 +8,22 @@ event.load("player_post_respawn");
 prefix_skill = "§2Skill";
 
 setScriptVar("skills", list.new());
-skill.add("Keep Inventory", "skill.subcu_inv", "minecraft:chest", "Keeps the inventory on death", 100, false, false, true);
-skill.add("Comeback", "skill.comeback", "km:skill55", "Respawn at your death location", 100, false, false, true);
-skill.add("Head Hunter", "skill.head_human", "minecraft:player_head", "Drops a player's head with a 20% chance if you kill a player (5% if a staff member is killed)", 1000, true, false, false);
-skill.add("Mobheads", "skill.head_monster", "minecraft:zombie_head", "Drops a mobs's head with a 20% chance (zombie / skeleton / creeper)", 500, true, false, false);
-skill.add("Fly 10min", "skill.fly10min", "minecraft:elytra", "You can fly for 10 minutes", 500, false, true, false);
-skill.add("Grow", "skill.grow", "minecraft:farmland", "Grow seeds in radius 5", 25, false, true, false);
-skill.add("Haste", "skill.haste", "minecraft:iron_pickaxe", "Haste for 2 minutes", 25, false, true, false);
-skill.add("Speed", "skill.speed", "minecraft:iron_boots", "Speed for 2 minutes", 25, false, true, false);
-skill.add("Jump Boost", "skill.jump_boost", "minecraft:rabbit_foot", "JumpBoost Lvl.2 for 2 minutes", 25, false, true, false);
-skill.add("Dolphin", "skill.dolphin", "minecraft:fire_coral", "Swim like a dolphin for a minute", 25, false, true, false);
-skill.add("Block Up", "skill.block_up", "minecraft:diamond_pickaxe", "Break a block and the block above for a minute", 25, false, true, false);
-skill.add("Block Down", "skill.block_down", "minecraft:diamond_pickaxe", "Break a block and the block below for a minute", 25, false, true, false);
-skill.add("Timber", "skill.timber", "minecraft:iron_axe", "Break whole trees with an axe for a minute", 128, false, true, false);
-skill.add("Fire Arrow", "skill.fire_arrow", "minecraft:arrow", "For a minute with an flame enchanted bow your arrows ignite hit blocks", 50, false, true, false);
-skill.add("Better Shears", "skill.better_shears", "minecraft:shears", "Sharpness enchanted shears increase the radius for destruction of leaves", 500, true, false, true);
-skill.add("Cobweb Miner", "skill.cobweb_miner", "minecraft:cobweb", "Swords increase the radius for destruction of cobwebs", 250, true, false, true);
+skill.add("Keep Inventory", "skill.subcu_inv", "minecraft:chest", "Keeps the inventory on death", 100, false, false, true, 0, 0, null);
+skill.add("Comeback", "skill.comeback", "km:skill55", "Respawn at your death location", 100, false, false, true, 0, 0, null);
+skill.add("Head Hunter", "skill.head_human", "minecraft:player_head", "Drops a player's head with a 20% chance if you kill a player (5% if a staff member is killed)", 1000, true, false, false, 0, 0, null);
+skill.add("Mobheads", "skill.head_monster", "minecraft:zombie_head", "Drops a mobs's head with a 20% chance (zombie / skeleton / creeper)", 500, true, false, false, 0, 0, null);
+skill.add("Fly 10min", "skill.fly10min", "minecraft:elytra", "You can fly for 10 minutes", 500, false, true, false, 0, 0, 600);
+skill.add("Grow", "skill.grow", "minecraft:farmland", "Grow seeds in radius 5", 25, false, true, false, 0, 0, null);
+skill.add("Haste", "skill.haste", "minecraft:iron_pickaxe", "Haste for 2 minutes", 25, false, true, false, 0, 0, 120);
+skill.add("Speed", "skill.speed", "minecraft:iron_boots", "Speed for 2 minutes", 25, false, true, false, 0, 0, 120);
+skill.add("Jump Boost", "skill.jump_boost", "minecraft:rabbit_foot", "JumpBoost Lvl.2 for 2 minutes", 25, false, true, false, 0, 0, 120);
+skill.add("Dolphin", "skill.dolphin", "minecraft:fire_coral", "Swim like a dolphin for a minute", 25, false, true, false, 0, 0, 60);
+skill.add("Block Up", "skill.block_up", "minecraft:diamond_pickaxe", "Break a block and the block above for a minute", 25, false, true, false, 0, 0, 60);
+skill.add("Block Down", "skill.block_down", "minecraft:diamond_pickaxe", "Break a block and the block below for a minute", 25, false, true, false, 0, 0, 60);
+skill.add("Timber", "skill.timber", "minecraft:iron_axe", "Break whole trees with an axe for a minute", 128, false, true, false, 0, 0, 60);
+skill.add("Fire Arrow", "skill.fire_arrow", "minecraft:arrow", "For a minute with an flame enchanted bow your arrows ignite hit blocks", 50, false, true, false, 0, 0, 60);
+skill.add("Better Shears", "skill.better_shears", "minecraft:shears", "Sharpness enchanted shears increase the radius for destruction of leaves", 500, true, false, true, 0, 0, null);
+skill.add("Cobweb Miner", "skill.cobweb_miner", "minecraft:cobweb", "Swords increase the radius for destruction of cobwebs", 250, true, false, true, 0, 0, null);
 
 msg("dev", "§bSurvival §rloaded.");
 @wait

+ 328 - 1
utils/u_skills.txt

@@ -1,3 +1,330 @@
-function executeSkill(player, skillname) {
+/*
+Rückgabewerte:
+0 ...... skill executed
+1 ...... skill not existing
+2 ...... skill already active
+3 ...... not enough
+4 ...... cooldown not reached
+*/
+
+function executeSkill(player, tech_name) {
+	if(!skill.exists(tech_name)) {
+		return 1;
+	}
+	if(skill.isInUse(player, tech_name)) {
+		return 2;
+	}
+	if(skill.hasEnough(player, tech_name)) {
+		return 3;
+	}
+	if(skill.isTimed(tech_name)) {
+		skill_time = skill.getTime(tech_name) * 20;
+		skill_name = skill.getTime(tech_name);
+		id = 50 + skill.getIndex(tech_name);
+		status.addTimed(player, id, skill_time, skill_name);
+		data.setTimer(player, tech_name, skill_time);
+	}
+	skill.subAmount(player, tech_name, 1);
+	skill.msg(player, tech_name);
+	ignoreGoto(tech_name);
+	return 1;
 	
+	@skill.fly10min
+	player.setFly(player, true);
+	return 0;
+}
+
+function skill.isTimed(tech_name) {
+	return skill.getTime == null;
+}
+
+function skill.isInUse(player, tech_name) {
+	return data.getTimer(player, tech_name) > 0;
+}
+
+function skill.hasEnough(player, tech_name) {
+	return skill.getAmount(player, tech_name) > 0;
+}
+
+function skill.msg(player, tech_name) {
+	skill_name = skill.getName(tech_name);
+	msg.prefix(player, prefix_skill, concat("Used ", skill_name, ". New amount: ", text.number(skill.getAmount(player, tech_name))));
+}
+
+function skill.getAmount(player_or_id, tech_name) {
+	config = playerdata.getSurvival(player_or_id);
+	return config.getDouble(config, tech_name, 0);
+}
+
+function skill.setAmount(player_or_id, tech_name, amount) {
+	config = playerdata.getSurvival(player_or_id);
+	config.set(config, tech_name, amount);
+	config.saveAsync(config);
+}
+
+function skill.addAmount(player_or_id, tech_name, amount) {
+	config = playerdata.getSurvival(player_or_id);
+	config.set(config, tech_name, config.getDouble(config, tech_name, 0) + amount);
+	config.saveAsync(config);
+}
+
+function skill.subAmount(player_or_id, tech_name, amount) {
+	config = playerdata.getSurvival(player_or_id);
+	config.set(config, tech_name, config.getDouble(config, tech_name, 0) - amount);
+	config.saveAsync(config);
+}
+
+function skill.isActivated(player_or_id, tech_name) {
+	config = playerdata.getSurvival(player_or_id);
+	return config.getBool(config, concat(tech_name, ".active"), true);
+}
+
+function skill.setActivated(player_or_id, tech_name, bool) {
+	config = playerdata.getSurvival(player_or_id);
+	config.set(config, concat(tech_name, ".active"), bool);
+}
+
+function skill.add(skill_name, tech_name, item, description, cost, permanent, active, toggleable, cooldown, mana, time) {
+	skill = array.new(11);
+	skill[0] = skill_name;
+	skill[1] = tech_name;
+	skill[2] = item;
+	skill[3] = description;
+	skill[4] = cost;
+	skill[5] = permanent;
+	skill[6] = active;
+	skill[7] = toggleable;
+	skill[8] = cooldown; //s
+	skill[9] = mana;
+	skill[10] = time; //s
+	list.add(skill.getList(), skill);
+}
+
+function skill.getList() {
+	return getScriptVar("skills");
+}
+
+function skill.exists(tech_name) {
+	return skill.get(tech_name) == null;
+}
+
+function skill.get(tech_name) {
+	skill_list  = skill.getList()
+	for(i = 0; i < list.getSize(skill_list); i++) {
+		array = list.getIndex(skill_list, i);
+		temp_tech_name = array[1];
+		if(temp_tech_name == tech_name) {
+			return array;
+		}
+	}
+}
+
+function skill.getIndex(tech_name) {
+	skill_list  = skill.getList()
+	for(i = 0; i < list.getSize(skill_list); i++) {
+		array = list.getIndex(skill_list, i);
+		temp_tech_name = array[1];
+		if(temp_tech_name == tech_name) {
+			return i;
+		}
+	}
+	return -1;
+}
+
+function skill.getShopItem(player_or_id, tech_name) {
+	if(tech_name == null) {
+		return item.getAir();
+	}
+	skill = skill.get(tech_name);
+	amount = skill.getAmount(player_or_id, tech_name);
+	permanent = skill[5];
+	if(permanent) {
+		if(amount == 0) {
+			text_property = concat("§fBought: §cNo §f(Permanent)");
+		} else {
+			text_property = concat("§fBought: §aYes §f(Permanent)");
+		}
+	} else {
+		text_property = concat("§fAmount you have: §e", text.number(amount));
+	}
+	active = skill[6];
+	if(active) {
+		type = "§fActive skill";
+	} else {
+		type = "§fPassive skill";
+	}
+	toggleable = skill[7];
+	if(toggleable) {
+		if(skill.isActivated(player_or_id, tech_name)) {
+			tog = "§fToggleable: §aActive";
+		} else {
+			tog = "§fToggleable: §cInactive";
+		}
+	} else {
+		tog = "§fNot toggleable";
+	}
+	skill_name = skill.getName(tech_name);
+	item = read.item(skill[2], 1, concat("§e§o", skill_name), concat("§fCost: §e", text.number(skill[4])), skill[3], type, tog, text_property);
+	return item;
+}
+
+function skill.getName(tech_name) {
+	skill_list  = skill.getList()
+	for(i = 0; i < list.getSize(skill_list); i++) {
+		array = list.getIndex(skill_list, i);
+		temp_tech_name = array[1];
+		if(temp_tech_name == tech_name) {
+			return array[0];
+		}
+	}
+}
+
+function skill.getTechName(tech_name) {
+	skill_list  = skill.getList()
+	for(i = 0; i < list.getSize(skill_list); i++) {
+		array = list.getIndex(skill_list, i);
+		temp_tech_name = array[1];
+		if(temp_tech_name == tech_name) {
+			return array[1];
+		}
+	}
+}
+
+function skill.getItem(tech_name) {
+	skill_list  = skill.getList()
+	for(i = 0; i < list.getSize(skill_list); i++) {
+		array = list.getIndex(skill_list, i);
+		temp_tech_name = array[1];
+		if(temp_tech_name == tech_name) {
+			return array[2];
+		}
+	}
+}
+
+function skill.getDescription(tech_name) {
+	skill_list  = skill.getList()
+	for(i = 0; i < list.getSize(skill_list); i++) {
+		array = list.getIndex(skill_list, i);
+		temp_tech_name = array[1];
+		if(temp_tech_name == tech_name) {
+			return array[3];
+		}
+	}
+}
+
+function skill.getCost(tech_name) {
+	skill_list  = skill.getList()
+	for(i = 0; i < list.getSize(skill_list); i++) {
+		array = list.getIndex(skill_list, i);
+		temp_tech_name = array[1];
+		if(temp_tech_name == tech_name) {
+			return array[4];
+		}
+	}
+}
+
+function skill.isPermanent(tech_name) {
+	skill_list  = skill.getList()
+	for(i = 0; i < list.getSize(skill_list); i++) {
+		array = list.getIndex(skill_list, i);
+		temp_tech_name = array[1];
+		if(temp_tech_name == tech_name) {
+			return array[5];
+		}
+	}
+}
+
+function skill.isActive(tech_name) {
+	skill_list  = skill.getList()
+	for(i = 0; i < list.getSize(skill_list); i++) {
+		array = list.getIndex(skill_list, i);
+		temp_tech_name = array[1];
+		if(temp_tech_name == tech_name) {
+			return array[6];
+		}
+	}
+}
+
+function skill.isToggleable(tech_name) {
+	skill_list  = skill.getList()
+	for(i = 0; i < list.getSize(skill_list); i++) {
+		array = list.getIndex(skill_list, i);
+		temp_tech_name = array[1];
+		if(temp_tech_name == tech_name) {
+			return array[7];
+		}
+	}
+}
+
+function skill.getCooldown(tech_name) {
+	skill_list  = skill.getList()
+	for(i = 0; i < list.getSize(skill_list); i++) {
+		array = list.getIndex(skill_list, i);
+		temp_tech_name = array[1];
+		if(temp_tech_name == tech_name) {
+			return array[8];
+		}
+	}
+}
+
+function skill.getMana(tech_name) {
+	skill_list  = skill.getList()
+	for(i = 0; i < list.getSize(skill_list); i++) {
+		array = list.getIndex(skill_list, i);
+		temp_tech_name = array[1];
+		if(temp_tech_name == tech_name) {
+			return array[9];
+		}
+	}
+}
+
+function skill.getTime(tech_name) {
+	skill_list  = skill.getList()
+	for(i = 0; i < list.getSize(skill_list); i++) {
+		array = list.getIndex(skill_list, i);
+		temp_tech_name = array[1];
+		if(temp_tech_name == tech_name) {
+			return array[10];
+		}
+	}
+}
+
+function skill.showShop(player, tech_name1, tech_name2, tech_name3, tech_name4, tech_name5, tech_name6, tech_name7, tech_name8, tech_name9, tech_name10, tech_name11, tech_name12, tech_name13, tech_name14, tech_name15, tech_name16, tech_name17, tech_name18) {
+	inv = inv.new("333333333333333333");
+	inv.setItem(inv, 0, skill.getShopItem(player, tech_name1));
+	inv.setItem(inv, 1, skill.getShopItem(player, tech_name2));
+	inv.setItem(inv, 2, skill.getShopItem(player, tech_name3));
+	inv.setItem(inv, 3, skill.getShopItem(player, tech_name4));
+	inv.setItem(inv, 4, skill.getShopItem(player, tech_name5));
+	inv.setItem(inv, 5, skill.getShopItem(player, tech_name6));
+	inv.setItem(inv, 6, skill.getShopItem(player, tech_name7));
+	inv.setItem(inv, 7, skill.getShopItem(player, tech_name8));
+	inv.setItem(inv, 8, skill.getShopItem(player, tech_name9));
+	inv.setItem(inv, 9, skill.getShopItem(player, tech_name10));
+	inv.setItem(inv, 10, skill.getShopItem(player, tech_name11));
+	inv.setItem(inv, 11, skill.getShopItem(player, tech_name12));
+	inv.setItem(inv, 12, skill.getShopItem(player, tech_name13));
+	inv.setItem(inv, 13, skill.getShopItem(player, tech_name14));
+	inv.setItem(inv, 14, skill.getShopItem(player, tech_name15));
+	inv.setItem(inv, 15, skill.getShopItem(player, tech_name16));
+	inv.setItem(inv, 16, skill.getShopItem(player, tech_name17));
+	inv.setItem(inv, 17, skill.getShopItem(player, tech_name18));
+	inv.open(inv, player, "Skillshop");
+}
+
+function skill.showAll(from_player_or_id, to_player) {
+	inv = inv.new("333333333333333333333333333");
+	skill_list  = skill.getList()
+	for(i = 0; i < list.getSize(skill_list); i++) {
+		a = list.getIndex(skill_list, i);
+		tech_name = a[1];
+		inv.setItem(inv, i, skill.getShopItem(from_player_or_id, tech_name));
+	}
+	from_player_id = player.getValidId(from_player_or_id);
+	if(from_player_id == player.getValidId(to_player)) {
+		inv_name = "Skills";
+	} else {
+		inv_name = concat("Skills von ", player.getNameFromId(from_player_id));
+	}
+	inv.open(inv, to_player, inv_name);
 }

Certains fichiers n'ont pas été affichés car il y a eu trop de fichiers modifiés dans ce diff