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
Nested ClassesModifier and TypeClassDescriptionprotected classhandles a bet.protected classDo we accept bets at the moment?protected static classStores information about a bet.protected classDo we NOT accept bets at the moment? -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected List<BetManager.BetInfo>List of bets.protected ScriptingNPCThe NPC.protected games.stendhal.server.script.BetManager.StateHolds the current state.Possible targets.protected StringWinner (in state State.PAYING_BETS).Fields inherited from class games.stendhal.server.core.scripting.ScriptImpl
sandbox -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidExecutes this script.voidload(Player admin, List<String> args, ScriptingSandbox sandbox) Initial load of this script.voidonTurnReached(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:TurnListenerThis method is called when the turn number is reached.- Specified by:
onTurnReachedin interfaceTurnListener- Parameters:
currentTurn- current turn number
-
load
Description copied from interface:ScriptInitial load of this script.- Specified by:
loadin interfaceScript- Overrides:
loadin classScriptImpl- Parameters:
admin- the admin who load it ornullon server start.args- the arguments the admin specified ornullon 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:ScriptExecutes this script.- Specified by:
executein interfaceScript- Overrides:
executein classScriptImpl- Parameters:
admin- the admin who load it ornullon server start.args- the arguments the admin specified ornullon server start.
-