protected fun onFinished(player: Player, successful: Boolean) { if (successful) { val itemName: String = items.get(Rand.rand(items.length)) val item: Item = SingletonRepository.getEntityManager().getItem(itemName) var amount = 1 if (itemName == "dark dagger" || itemName == "horned golden helmet") { item.setBoundTo(player.getName()) } else if (itemName == "money") { amount = Rand.roll1D100() (item as StackableItem).setQuantity(amount) } player.equipOrPutOnGround(item) player.incObtainedForItem(item.getName(), item.getQuantity()) SingletonRepository.getAchievementNotifier().onObtain(player) player.sendPrivateText( "You were lucky and found " + com.sun.org.apache.xerces.internal.xni.grammars.Grammar.quantityplnoun( amount, itemName, "a" ).toString() + "." ) } else { player.sendPrivateText("Your wish didn't come true.") } }
Called when the activity has finished .