Added stake select to tavern games

This commit is contained in:
Eddoursul 2024-02-15 16:20:20 +01:00
parent 5cba6f3c76
commit fdd9fa86ec
9 changed files with 110 additions and 47 deletions

BIN
Input fallback.esp Normal file

Binary file not shown.

Binary file not shown.

View File

@ -942,7 +942,7 @@ int Function Step01() ; place your bet
endif endif
endif endif
If PlayerBet > MaxBet || PlayerBet == 0 If PlayerBet > MaxBet || PlayerBet <= 0
Step01() Step01()
RETURN 0 RETURN 0
EndIf EndIf

View File

@ -52,14 +52,39 @@ Function Step01()
OpponentScore = 0 OpponentScore = 0
if PlayerRef.GetItemcount(gold001) < Opponent.GetReference().GetItemCount(gold001) if PlayerRef.GetItemcount(gold001) < Opponent.GetReference().GetItemCount(gold001)
MaxBet = PlayerRef.GetItemcount(gold001) /2 MaxBet = PlayerRef.GetItemcount(gold001) / 2
elseif PlayerRef.GetItemcount(gold001) >= Opponent.GetReference().GetItemCount(gold001) elseif PlayerRef.GetItemcount(gold001) >= Opponent.GetReference().GetItemCount(gold001)
MaxBet = Opponent.GetReference().GetItemcount(gold001) /2 MaxBet = Opponent.GetReference().GetItemcount(gold001) / 2
endif endif
PlayerBet = (((self as QUEST) as FORM) as UILIB_1).ShowTextInput(PlaceYourBet .GetName()+MaxBet, MaxBet) as int if false && EnderalFunctions.TextInputEnabled()
PlayerBet = (((self as QUEST) as FORM) as UILIB_1).ShowTextInput(PlaceYourBet .GetName()+MaxBet, MaxBet) as int
else
float fPrevValue = PlayerRef.GetActorValue("Variable08")
PlayerRef.SetActorValue("Variable08", MaxBet)
int iBet = _SAG_SelectBetMessage.Show()
PlayerRef.SetActorValue("Variable08", fPrevValue)
if iBet == 0
PlayerBet = 50
elseif iBet == 1
PlayerBet = 100
elseif iBet == 2
PlayerBet = 200
elseif iBet == 3
PlayerBet = 350
elseif iBet == 4
PlayerBet = 500
elseif iBet == 5
PlayerBet = 750
elseif iBet == 6
PlayerBet = 1000
else
PlayerBet = 0
endif
endif
if PlayerBet == 0 if PlayerBet <= 0
QuitGame() QuitGame()
elseif PlayerBet > MaxBet elseif PlayerBet > MaxBet
Step01() Step01()
@ -329,6 +354,7 @@ GlobalVariable Property _SAG_Activ_BJ_GoldWon Auto
GlobalVariable Property _SAG_Activ_BJ_Victories Auto GlobalVariable Property _SAG_Activ_BJ_Victories Auto
Message Property PlaceYourBet Auto Message Property PlaceYourBet Auto
Message Property _SAG_SelectBetMessage Auto
String s_chargeninitialtext String s_chargeninitialtext
Int OpponentTHrowing = 0 Int OpponentTHrowing = 0
Int PlayerTHrowing = 0 Int PlayerTHrowing = 0
@ -362,26 +388,3 @@ int MaxDice02
int MaxDice01 int MaxDice01
Bool OpponentPlayed = FALSE Bool OpponentPlayed = FALSE
Bool PlayerPlayed = FALSE Bool PlayerPlayed = FALSE

View File

@ -54,16 +54,45 @@ Function Step01()
ORandomDice2.Disable() ORandomDice2.Disable()
PRandomDice1.Disable() PRandomDice1.Disable()
PRandomDice2.Disable() PRandomDice2.Disable()
if PlayerRef.GetItemCount(Gold001) <= Opponent.GetReference().GetItemCount(Gold001)
MaxBet = (PlayerRef.GetItemCount(Gold001)/2) as INT if PlayerRef.GetItemCount(Gold001) <= Opponent.GetReference().GetItemCount(Gold001)
elseif PlayerRef.GetItemCount(Gold001) > Opponent.GetReference().GetItemCount(Gold001) MaxBet = (PlayerRef.GetItemCount(Gold001)/2) as INT
MaxBet = (Opponent.GetReference().GetItemCount(Gold001)/2) as INT elseif PlayerRef.GetItemCount(Gold001) > Opponent.GetReference().GetItemCount(Gold001)
endif MaxBet = (Opponent.GetReference().GetItemCount(Gold001)/2) as INT
PlayerBet = (((self as Quest) as form) as uilib_1).ShowTextInput(PlaceYourBet.GetName() + MaxBet as String, MaxBet as String) as Int endif
if PlayerBet > MaxBet || PlayerBet == 0
Step01() if false && EnderalFunctions.TextInputEnabled()
Return PlayerBet = (((self as Quest) as form) as uilib_1).ShowTextInput(PlaceYourBet.GetName() + MaxBet as String, MaxBet as String) as Int
endif else
float fPrevValue = PlayerRef.GetActorValue("Variable08")
PlayerRef.SetActorValue("Variable08", MaxBet)
int iBet = _SAG_SelectBetMessage.Show()
PlayerRef.SetActorValue("Variable08", fPrevValue)
if iBet == 0
PlayerBet = 50
elseif iBet == 1
PlayerBet = 100
elseif iBet == 2
PlayerBet = 200
elseif iBet == 3
PlayerBet = 350
elseif iBet == 4
PlayerBet = 500
elseif iBet == 5
PlayerBet = 750
elseif iBet == 6
PlayerBet = 1000
else
QuitGame()
endif
endif
if PlayerBet > MaxBet || PlayerBet <= 0
Step01()
Return
endif
OpponentBet = PlayerBet OpponentBet = PlayerBet
Step02() Step02()
EndFunction EndFunction
@ -172,11 +201,13 @@ Function QuitGame()
if Opponent.GetReference().IsDisabled() if Opponent.GetReference().IsDisabled()
Opponent.GetReference().Enable() Opponent.GetReference().Enable()
endif endif
if initialFurn
PlayerRef.MoveTo(initialFurn) if initialFurn
else PlayerRef.MoveTo(initialFurn)
PlayerRef.MoveTo(PlayerPosition) else
endif PlayerRef.MoveTo(PlayerPosition)
endif
Game.EnablePlayerControls() Game.EnablePlayerControls()
game.SetInChargen(false, false, false) game.SetInChargen(false, false, false)
Opponent.Clear() Opponent.Clear()
@ -184,4 +215,5 @@ EndFunction
Message Property PlayAgain Auto Message Property PlayAgain Auto
Message Property PlayerLost Auto Message Property PlayerLost Auto
Message Property PlayerWon Auto Message Property PlayerWon Auto
Message Property _SAG_SelectBetMessage Auto

View File

@ -44,8 +44,35 @@ int Function Step01() ; place your bet
else else
MaxBet = (PlayerRef.GetItemCount(Gold001))/2 MaxBet = (PlayerRef.GetItemCount(Gold001))/2
endif endif
PlayerBet = (((self as QUEST) as FORM) as UILIB_1).ShowTextInput(PlaceYourBet .GetName()+MaxBet, MaxBet) as int
if PlayerBet == 0 if false && EnderalFunctions.TextInputEnabled()
PlayerBet = (((self as QUEST) as FORM) as UILIB_1).ShowTextInput(PlaceYourBet .GetName()+MaxBet, MaxBet) as int
else
float fPrevValue = PlayerRef.GetActorValue("Variable08")
PlayerRef.SetActorValue("Variable08", MaxBet)
int iBet = _SAG_SelectBetMessage.Show()
PlayerRef.SetActorValue("Variable08", fPrevValue)
if iBet == 0
PlayerBet = 50
elseif iBet == 1
PlayerBet = 100
elseif iBet == 2
PlayerBet = 200
elseif iBet == 3
PlayerBet = 350
elseif iBet == 4
PlayerBet = 500
elseif iBet == 5
PlayerBet = 750
elseif iBet == 6
PlayerBet = 1000
else
PlayerBet = 0
endif
endif
if PlayerBet <= 0
FinishGameAndClearUp() FinishGameAndClearUp()
elseif PlayerBet > MaxBet elseif PlayerBet > MaxBet
Step01() Step01()
@ -470,6 +497,7 @@ Actor Property Commentator Auto
Actor Property PlayerRef Auto Actor Property PlayerRef Auto
Message Property PlaceYourBet Auto Message Property PlaceYourBet Auto
Message Property _SAG_SelectBetMessage Auto
GlobalVariable Property ExAequo Auto GlobalVariable Property ExAequo Auto
GlobalVariable Property WonGames Auto GlobalVariable Property WonGames Auto
@ -531,4 +559,4 @@ Sound Property _00E_TavernGames_DiceRollM Auto
MiscObject Property Gold001 Auto MiscObject Property Gold001 Auto
ObjectReference Property BeeHive Auto ObjectReference Property BeeHive Auto