Package games.stendhal.server.script
Class BetManager
java.lang.Object
games.stendhal.server.core.scripting.ScriptImpl
games.stendhal.server.script.BetManager
- All Implemented Interfaces:
TurnListener
,Script
Creates an NPC which manages bets.
A game master has to tell him on what the players can bet:
/script BetManager.class accept fire water earth
Then players can bet by saying something like
bet 50 ham on fire bet 5 cheese on waterThe NPC retrieves the items from the player and registers the bet.
The game master starts the action closing the betting time:
/script BetManager.class action
After the game the game master has to tell the NPC who won:
/script BetManager.class winner fire.
The NPC will than tell all players the results and give it to winners:
mort bet 50 ham on fire and won an additional 50 ham hendrik lost 5 cheese betting on waterNote: Betting is possible in "idle conversation state" to enable interaction of a large number of players in a short time. (The last time i did a show-fight i was losing count because there where more than 15 players)
- Author:
- hendrik
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
handles a bet.protected class
Do we accept bets at the moment?protected static class
Stores information about a bet.protected class
Do we NOT accept bets at the moment? -
Field Summary
Modifier and TypeFieldDescriptionprotected List<BetManager.BetInfo>
List of bets.protected ScriptingNPC
The NPC.protected games.stendhal.server.script.BetManager.State
Holds the current state.Possible targets.protected String
Winner (in state State.PAYING_BETS).Fields inherited from class games.stendhal.server.core.scripting.ScriptImpl
sandbox
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Executes this script.void
load(Player admin, List<String> args, ScriptingSandbox sandbox)
Initial load of this script.void
onTurnReached(int currentTurn)
This method is called when the turn number is reached.Methods inherited from class games.stendhal.server.core.scripting.ScriptImpl
unload
-
Field Details
-
npc
The NPC. -
state
protected games.stendhal.server.script.BetManager.State stateHolds the current state. -
betInfos
List of bets. -
targets
Possible targets. -
winner
Winner (in state State.PAYING_BETS).
-
-
Constructor Details
-
BetManager
public BetManager()
-
-
Method Details
-
onTurnReached
public void onTurnReached(int currentTurn)Description copied from interface:TurnListener
This method is called when the turn number is reached.- Specified by:
onTurnReached
in interfaceTurnListener
- Parameters:
currentTurn
- current turn number
-
load
Description copied from interface:Script
Initial load of this script.- Specified by:
load
in interfaceScript
- Overrides:
load
in classScriptImpl
- Parameters:
admin
- the admin who load it ornull
on server start.args
- the arguments the admin specified ornull
on server start.sandbox
- all modifications to the game must be done using this object in order for the script to be unloadable
-
execute
Description copied from interface:Script
Executes this script.- Specified by:
execute
in interfaceScript
- Overrides:
execute
in classScriptImpl
- Parameters:
admin
- the admin who load it ornull
on server start.args
- the arguments the admin specified ornull
on server start.
-