Skip to content

Instantly share code, notes, and snippets.

@volgar1x
Created July 31, 2012 15:56
Show Gist options
  • Save volgar1x/3218021 to your computer and use it in GitHub Desktop.
Save volgar1x/3218021 to your computer and use it in GitHub Desktop.
essai d'une commande en Ruby
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