cyberware-2281/src/CWxPanelUpdatePrice.gek
2024-04-27 00:30:12 +02:00

47 lines
2.3 KiB
Plaintext

scn CWxPanelUpdatePrice
; Refresh caps, costs and accept button
short changedSlots
float price
short caps
begin function {}
set changedSlots to 0
set changedSlots to changedSlots + (CWxImplantsPanel.newHeadImplant1 != CWxImplants.headImplant1)
set changedSlots to changedSlots + (CWxImplantsPanel.newHeadImplant2 != CWxImplants.headImplant2)
set changedSlots to changedSlots + (CWxImplantsPanel.newHeadImplant3 != CWxImplants.headImplant3)
set changedSlots to changedSlots + (CWxImplantsPanel.newHeadImplant4 != CWxImplants.headImplant4)
set changedSlots to changedSlots + (CWxImplantsPanel.newTorsoImplant1 != CWxImplants.torsoImplant1)
set changedSlots to changedSlots + (CWxImplantsPanel.newTorsoImplant2 != CWxImplants.torsoImplant2)
set changedSlots to changedSlots + (CWxImplantsPanel.newTorsoImplant3 != CWxImplants.torsoImplant3)
set changedSlots to changedSlots + (CWxImplantsPanel.newTorsoImplant4 != CWxImplants.torsoImplant4)
set changedSlots to changedSlots + (CWxImplantsPanel.newRightArmImplant1 != CWxImplants.rightArmImplant1)
set changedSlots to changedSlots + (CWxImplantsPanel.newRightArmImplant2 != CWxImplants.rightArmImplant2)
set changedSlots to changedSlots + (CWxImplantsPanel.newLeftArmImplant1 != CWxImplants.leftArmImplant1)
set changedSlots to changedSlots + (CWxImplantsPanel.newLeftArmImplant2 != CWxImplants.leftArmImplant2)
set changedSlots to changedSlots + (CWxImplantsPanel.newRightLegImplant1 != CWxImplants.rightLegImplant1)
set changedSlots to changedSlots + (CWxImplantsPanel.newRightLegImplant2 != CWxImplants.rightLegImplant2)
set changedSlots to changedSlots + (CWxImplantsPanel.newLeftLegImplant1 != CWxImplants.leftLegImplant1)
set changedSlots to changedSlots + (CWxImplantsPanel.newLeftLegImplant2 != CWxImplants.leftLegImplant2)
printd "Changed " + $changedSlots + " slots"
set price to changedSlots * (CWxSurgeryBasePrice + (CWxSurgeryBarterMult * player.getAV Barter))
set caps to player.getItemCount Caps001
setUIFloat "TutorialMenu\_PNxImplantsPanelCaps" caps
setUIFloat "TutorialMenu\_PNxImplantsPanelPrice" price
if caps < price || changedSlots == 0
setUIFloat "TutorialMenu\_PNxImplantsPanelAcceptEnabled" 0
else
setUIFloat "TutorialMenu\_PNxImplantsPanelAcceptEnabled" 1
endif
set CWxImplantsPanel.price to price
set CWxImplantsPanel.changedSlots to changedSlots
end