Created
July 31, 2012 15:56
-
-
Save volgar1x/3218021 to your computer and use it in GitHub Desktop.
essai d'une commande en Ruby
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
import org.shivas.server.core.commands.Command | |
import org.shivas.server.core.commands.types.PlayerType | |
import org.shivas.common.params.Conditions | |
import org.shivas.common.params.Types | |
class GiveKamasCommand < Command | |
def name | |
"give_kamas" | |
end | |
def help | |
"Give kamas" | |
end | |
def conditions | |
conds = Conditions.new | |
conds.add "n", Types.INTEGER, "The amount of kamas to give" | |
conds.add "target", PlayerType.new Shivas.repos.players, "The player to give kamas" | |
conds | |
end | |
def use(client, log, params) | |
target = params.get "target" | |
kamas = params.get "n" | |
target.bag.kamas.plus kamas | |
log.info "You successfully give #{n} kamas to #{target.urlize}." | |
end | |
end | |
Shivas.addCommand GivasKamasCommand.new |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment