event.load("entity_click"); event.load("item_air_click"); beer = read.item("{id:\"minecraft:player_head\",Count:1b,tag:{SkullOwner:{Properties:{textures:[{Value:\"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNDE2OGI5ODA5OGEwYzRhMjllMjA0NjcwNDYzMDkxZGI2MDcwZTc3ZDg2NzY5ZDk4NWY2YmVmNDA3NWU1In19fQ==\"}]},Id:[I;-919099029,-843296815,-1978014726,-1632767213]},display:{Name:'{\"text\":\"§FBeer\"}'}}}"); bread = read.item("{id:\"minecraft:player_head\",Count:1b,tag:{SkullOwner:{Properties:{textures:[{Value:\"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvZjM0ODdkNDU3ZjkwNjJkNzg3YTNlNmNlMWM0NjY0YmY3NDAyZWM2N2RkMTExMjU2ZjE5YjM4Y2U0ZjY3MCJ9fX0=\"}]},Id:[I;-1486995616,574768169,-1899053858,2001973348]},display:{Name:'{\"text\":\"§FBread\"}'}}}"); gem = read.item("{id:\"km:flawless_gem_stone\",Count:1b,tag:{color:16724530,display:{Name:'{\"text\":\"§fRuby\"}'}}}"); gem2 = read.item("{id:\"km:flawless_gem_stone\",Count:1b,tag:{color:3289855,display:{Name:'{\"text\":\"§fSapphire\"}'}}}"); gem3 = read.item("{id:\"km:flawless_gem_stone\",Count:1b,tag:{color:13664802,display:{Name:'{\"text\":\"§fAmber\"}'}}}"); potion = read.item("{id:\"minecraft:splash_potion\",Count:1b,tag:{CustomPotionEffects:[{Duration:400,Id:7b,Amplifier:100b}],Potion:\"minecraft:haste\",HideFlags:32,display:{Name:'{\"text\":\"§f?\"}'}}}"); haste = read.item("{id:\"minecraft:potion\",Count:1b,tag:{CustomPotionEffects:[{Duration:2400,Id:3b,Amplifier:10b}],Potion:\"minecraft:water\",HideFlags:32,display:{Name:'{\"text\":\"§f?\"}'}}}"); allPotion = read.item("{id:\"minecraft:splash_potion\",Count:1b,tag:{CustomPotionEffects:[{Id:2b,Amplifier:5,Duration:4000}, {Id:3b,Amplifier:5,Duration:4000},{Id:4b,Amplifier:5,Duration:4000},{Id:5b,Amplifier:5,Duration:4000}, {Id:6b,Amplifier:5,Duration:4000},{Id:7b,Amplifier:5,Duration:4000},{Id:8b,Amplifier:5,Duration:4000},{Id:9b,Amplifier:5,Duration:4000}, {Id:10b,Amplifier:5,Duration:4000},{Id:11b,Amplifier:5,Duration:4000},{Id:12b,Amplifier:5,Duration:4000}, {Id:13b,Amplifier:5,Duration:4000},{Id:14b,Amplifier:5,Duration:4000},{Id:15b,Amplifier:5,Duration:4000}, {Id:16b,Amplifier:5,Duration:4000},{Id:17b,Amplifier:5,Duration:4000},{Id:18b,Amplifier:5,Duration:4000},{Id:19b,Amplifier:5,Duration:4000}, {Id:20b,Amplifier:5,Duration:4000},{Id:21b,Amplifier:5,Duration:4000},{Id:22b,Amplifier:5,Duration:4000},{Id:23b,Amplifier:5,Duration:4000}, {Id:24b,Amplifier:5,Duration:4000},{Id:25b,Amplifier:5,Duration:4000},{Id:26b,Amplifier:5,Duration:4000}, {Id:27b,Amplifier:5,Duration:4000},{Id:28b,Amplifier:5,Duration:4000},{Id:29b,Amplifier:5,Duration:4000},{Id:30b,Amplifier:5,Duration:4000}, {Id:31b,Amplifier:5,Duration:4000},{Id:32b,Amplifier:5,Duration:4000}],Potion:\"minecraft:water\",HideFlags:32,display:{Name:'{\"text\":\"§f?\"}'}}}"); luck = read.item("{id:\"minecraft:potion\",Count:1b,tag:{CustomPotionEffects:[{Duration:4000,Id:26b,Amplifier:10b}],CustomPotionColor:-1,HideFlags:32,display:{Name:'{\"text\":\"§f?\"}'}}}"); shoes = read.item("{id:\"minecraft:leather_boots\",Count:1b,tag:{Damage:0,Unbreakable:true,Enchantments:[{lvl:5s,id:\"minecraft:protection\"}],display:{color:1908001,Name:'{\"text\":\"§bKajetans Boots\"}'}}}"); item.addAttribute(shoes, "generic.armor", read.slot("feet"), 5, 0); item.addAttribute(shoes, "generic.armor_toughness", read.slot("feet"), 5, 0); item.addAttribute(shoes, "generic.knockback_resistance", read.slot("feet"), 0.5, 0); item.addAttribute(shoes, "generic.movement_speed", read.slot("feet"), 0.05, 0); chest = read.item("{id:\"minecraft:leather_chestplate\",Count:1b,tag:{Damage:0,Unbreakable:true,Enchantments:[{lvl:5s,id:\"minecraft:protection\"}],display:{color:1908001,Name:'{\"text\":\"§bKajetans Tunic\"}'}}}"); item.addAttribute(chest, "generic.armor", read.slot("chest"), 5, 0); item.addAttribute(chest, "generic.armor_toughness", read.slot("chest"), 5, 0); item.addAttribute(chest, "generic.knockback_resistance", read.slot("chest"), 0.5, 0); item.addAttribute(chest, "generic.attack_speed", read.slot("chest"), 5, 0); head = read.item("{id:\"minecraft:leather_helmet\",Count:1b,tag:{Damage:0,Unbreakable:true,Enchantments:[{lvl:5s,id:\"minecraft:protection\"}],display:{color:1908001,Name:'{\"text\":\"§bKajetans Cap\"}'}}}"); item.addAttribute(head, "generic.armor", read.slot("head"), 5, 0); item.addAttribute(head, "generic.armor_toughness", read.slot("head"), 5, 0); item.addAttribute(head, "generic.knockback_resistance", read.slot("head"), 0.5, 0); pants = read.item("{id:\"minecraft:leather_leggings\",Count:1b,tag:{Damage:0,Unbreakable:true,Enchantments:[{lvl:5s,id:\"minecraft:protection\"}],display:{color:11546150,Name:'{\"text\":\"§bKajetans Pants\"}'}}}"); item.addAttribute(pants, "generic.armor", read.slot("legs"), 5, 0); item.addAttribute(pants, "generic.armor_toughness", read.slot("legs"), 5, 0); item.addAttribute(pants, "generic.knockback_resistance", read.slot("legs"), 0.5, 0); item.addAttribute(pants, "generic.max_health", read.slot("legs"), 20, 0); elytra = read.item("{id:\"minecraft:elytra\",Count:1b,tag:{Damage:0,Unbreakable:true}}"); msg("dev", "§bTrader §rloaded."); @wait wait(); if(event == "item_air_click" && hand == "MAIN_HAND") { item = living.getEquip(player, "hand"); beer_amount = item.clone(beer); item.setAmount(beer_amount, item.getAmount(item)); if(text.item(item) == text.item(beer_amount)) { entity.addEffect(player, "nausea", 400, 0); entity.addEffect(player, "luck", 1200, 1); item.setAmount(item, item.getAmount(item) - 1); } } if(event == "entity_click") { if(hand == "OFF_HAND") { goto("wait"); } entity_type = entity.getType(entity); if(entity_type != "human") { goto("wait"); } entity_name = entity.getName(entity); shop_name = concat(entity_name, "'s shop"); if(entity_name == "Alena") { shop = shop.new(); buy_item = read.item("km:coin_copper", 32); shop.addOffer(shop, buy_item, beer, 999); shop.open(shop, player, shop_name); goto("wait"); } if(entity_name == "Franz") { shop = shop.new(); buy_item = read.item("km:coin_copper", 32); shop.addOffer(shop, buy_item, beer, 999); shop.open(shop, player, shop_name); goto("wait"); } if(entity_name == "Berta") { shop = shop.new(); buy_item = read.item("km:coin_copper", 16); shop.addOffer(shop, buy_item, bread, 999); shop.open(shop, player, shop_name); goto("wait"); } if(entity_name == "Hans") { shop = shop.new(); shop.addOffer(shop, read.item("minecraft:string", 2), read.item("km:coin_copper", 1), 999); shop.addOffer(shop, read.item("minecraft:rotten_flesh", 1), read.item("km:coin_copper", 1), 999); shop.addOffer(shop, read.item("minecraft:bone", 2), read.item("km:coin_copper", 1), 999); shop.addOffer(shop, read.item("minecraft:gunpowder", 1), read.item("km:coin_copper", 1), 999); shop.addOffer(shop, read.item("minecraft:ender_pearl", 1), read.item("km:coin_copper", 1), 999); shop.open(shop, player, shop_name); goto("wait"); } if(entity_name == "Frieda") { shop = shop.new(); shop.addOffer(shop, read.item("km:coin_silver", 4), read.item("km:cherry_sapling", 1), 999); shop.addOffer(shop, read.item("km:coin_silver", 2), read.item("km:apricot_sapling", 1), 999); shop.addOffer(shop, read.item("km:coin_silver", 2), read.item("km:pear_sapling", 1), 999); shop.addOffer(shop, read.item("km:coin_silver", 2), read.item("km:plum_sapling", 1), 999); shop.open(shop, player, shop_name); goto("wait"); } if(entity_name == "Bartholomäus Tilg") { shop = shop.new(); shop.addOffer(shop, read.item("minecraft:diamond", 2), read.item("km:coin_silver", 3), 999); shop.addOffer(shop, gem3, read.item("km:coin_gold", 1), 999); shop.addOffer(shop, gem2, read.item("km:coin_gold", 2), 999); shop.addOffer(shop, gem, read.item("km:coin_gold", 5), 999); shop.addDoubleOffer(shop, read.item("km:coin_gold", 64), read.item("km:coin_gold", 64), read.item("minecraft:trident"), 999); //shop.addOffer(shop, read.item("km:coin_gold", 1), gem3, 999); //shop.addOffer(shop, read.item("km:coin_gold", 2), gem2, 999); //shop.addOffer(shop, read.item("km:coin_gold", 5), gem, 999); shop.open(shop, player, shop_name); goto("wait"); } if(entity_name == "Alchemis Bartl") { shop = shop.new(); shop.addOffer(shop, read.item("minecraft:glass_bottle", 3), read.item("km:coin_copper", 10), 999); shop.addOffer(shop, read.item("minecraft:nether_wart", 1), read.item("km:coin_copper", 2), 999); shop.addOffer(shop, read.item("minecraft:sugar", 2), read.item("km:coin_copper", 1), 999); shop.addOffer(shop, read.item("minecraft:spider_eye", 1), read.item("km:coin_copper", 10), 999); shop.addOffer(shop, read.item("minecraft:blaze_powder", 1), read.item("km:coin_copper", 10), 999); shop.addOffer(shop, read.item("minecraft:magma_cream", 1), read.item("km:coin_copper", 30), 999); shop.addOffer(shop, read.item("minecraft:redstone", 1), read.item("km:coin_copper", 1), 999); shop.addOffer(shop, read.item("minecraft:glowstone_dust", 1), read.item("km:coin_copper", 5), 999); shop.addOffer(shop, read.item("minecraft:phantom_membrane", 1), read.item("km:coin_copper", 40), 999); shop.addOffer(shop, read.item("minecraft:ghast_tear", 1), read.item("km:coin_copper", 55), 999); shop.addOffer(shop, read.item("minecraft:rabbit_foot", 1), read.item("km:coin_silver", 1), 999); shop.addOffer(shop, read.item("minecraft:golden_carrot", 1), read.item("km:coin_silver", 1), 999); shop.addOffer(shop, read.item("minecraft:glistering_melon_slice", 1), read.item("km:coin_silver", 1), 999); shop.addOffer(shop, read.item("minecraft:turtle_helmet", 1), read.item("km:coin_silver", 5), 999); shop.addOffer(shop, read.item("km:coin_copper", 3), read.item("minecraft:bone", 1), 999); shop.open(shop, player, shop_name); goto("wait"); } if(entity_name == "Sven") { shop = shop.new(); shop.addOffer(shop, read.item("km:coin_copper", 30), read.item("minecraft:experience_bottle", 1), 999); shop.addOffer(shop, read.item("km:coin_gold", 8), potion, 999); shop.addOffer(shop, read.item("km:coin_gold", 1), haste, 999); shop.addOffer(shop, read.item("km:coin_gold", 64), allPotion, 999); shop.addOffer(shop, read.item("km:coin_gold", 2), luck, 999); shop.addOffer(shop, read.item("km:coin_gold", 35), head, 999); shop.addOffer(shop, read.item("km:coin_gold", 40), chest, 999); shop.addOffer(shop, read.item("km:coin_gold", 40), pants, 999); shop.addOffer(shop, read.item("km:coin_gold", 40), shoes, 999); shop.open(shop, player, shop_name); goto("wait"); } if(entity_name == "Alfred Nabel") { shop = shop.new(); shop.addOffer(shop, read.item("km:coin_copper", 6), read.item("minecraft:gunpowder", 1), 999); shop.addOffer(shop, read.item("km:coin_copper", 40), read.item("minecraft:tnt", 1), 999); shop.addOffer(shop, read.item("km:coin_copper", 2), read.item("minecraft:paper", 1), 999); shop.addOffer(shop, read.item("km:coin_copper", 20), read.item("minecraft:fire_charge", 1), 999); shop.open(shop, player, shop_name); goto("wait"); } if(entity_name == "Tree") { shop = shop.new(); shop.addOffer(shop, read.item("km:coin_gold", 32), read.item("minecraft:beacon", 1), 999); shop.addOffer(shop, read.item("minecraft:dragon_head", 1), read.item("km:coin_gold", 20), 999); shop.addOffer(shop, read.item("km:coin_silver", 20), read.item("minecraft:end_crystal", 1), 999); //shop.addOffer(shop, read.item("minecraft:dragon_egg", 1), read.item("km:coin_gold", 10), 999); shop.addDoubleOffer(shop, read.item("km:coin_gold", 64), read.item("km:coin_gold", 64), elytra, 999); shop.open(shop, player, shop_name); goto("wait"); } } goto("wait");