Created
February 11, 2013 20:19
-
-
Save cacciatc/4757267 to your computer and use it in GitHub Desktop.
Villager interaction logic.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
proc_quest:function(event,data){ | |
// make sure we are interacting with the quest giver | |
var target = data.getRightClicked(); | |
var player = data.getPlayer(); | |
if(quest.store.npcs[target.getUniqueId()] != null){ | |
// get the player's current quest progress | |
var quest_progress = quest.store.players[player.name]; | |
if(quest_progress == null){ | |
quest.initialize_quest(player.name); | |
} | |
if(quest.store.players[player.name].current > 1){ | |
if(quest.store.players[player.name].skeleton_counter >= 10){ | |
var world = player.getWorld(); | |
quest.store.players[player.name].current = (quest.store.players[player.name].current + 1) % 4; | |
world.spawnEntity(player.getLocation().add(1,0,1), org.bukkit.entity.EntityType.EXPERIENCE_ORB).setExperience(20); | |
world.spawnEntity(player.getLocation().add(2,0,1), org.bukkit.entity.EntityType.EXPERIENCE_ORB).setExperience(10); | |
world.spawnEntity(player.getLocation().add(4,0,1), org.bukkit.entity.EntityType.EXPERIENCE_ORB).setExperience(5); | |
quest.store.players[player.name].skeleton_counter = 0; | |
quest.store.players[player.name].accepted = false; | |
quest.store.players[player.name].current = 3; | |
} | |
} | |
else{ | |
quest.store.players[player.name].current = (quest.store.players[player.name].current + 1) % 4; | |
} | |
player.sendMessage(quest.store.players[player.name].steps[quest.store.players[player.name].current].text); | |
} | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment