You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

75 lines
1.6 KiB

scn EBxMilkBrahmin
ref rBrahmin
ref rActionRef
ref rOwner
int iChance
int iTimestamp
int iLastMilked
begin function { rBrahmin, rActionRef }
if playerRef.IsSneaking || rBrahmin.GetDead ; Keep tipping intact
return
endif
if playerRef.GetItemCount EBxUpgradableToPuraList == 0
ShowMessage EBxMsgNoBottles
return
endif
if playerRef.GetItemCount caps001 == 0
ShowMessage EBxMsgNoCaps
return
endif
let iTimestamp := (GetUserTime)["Hour"]
if iTimestamp == 0
let iTimestamp := 24
endif
let iLastMilked := rBrahmin.GetAV Variable09
if iLastMilked != 0
if iLastMilked == iTimestamp
ShowMessage EBxMsgBrahminMilked
return
elseif iTimestamp < iLastMilked
rBrahmin.SetAV Variable09 0
endif
endif
let iChance := playerRef.GetAV luck * 10 - GetRandomPercent + 1
if iChance < 0
ShowMessage EBxMsgBrahminMilked
rBrahmin.SetAV Variable09 iTimestamp
return
endif
rBrahmin.PlaySound NPCBrahminIdleMoo
call EBxReplaceFormListWithItem EBxBrahminMilk EBxUpgradableToPuraList
if EBxCanteenSipsMax > 0
call EBxReplenishCanteen EBxBrahminMilk 0
endif
rBrahmin.SetAV Variable09 iTimestamp
; TODO: Show owned brahmin's prompt in red
;
; set rOwner to rBrahmin.GetOwner
; if IsFormValid rOwner == 0
; set rOwner to rBrahmin.GetParentCellOwner
; endif
; if IsFormValid rOwner
; if rOwner != PlayerFaction && rOwner != playerRef.GetBaseForm
; if eval GetType rOwner != 8 || PlayerRef.GetInFaction rOwner != 1 || rBrahmin.GetOwningFactionRequiredRank > PlayerRef.GetFactionRank rOwner
; playerRef.SendStealingAlarm rBrahmin
; endif
; endif
; endif
end