From: Laszlo T. <ave...@us...> - 2005-03-03 22:33:38
|
Update of /cvsroot/gemrb/gemrb/gemrb/GUIScripts/iwd In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6388/GUIScripts/iwd Modified Files: GUISTORE.py Log Message: Added GetStoreCure and LeaveStore guiscript functions improved GUISTORE guiscript (now you can leave it and some screens are almost working) Index: GUISTORE.py =================================================================== RCS file: /cvsroot/gemrb/gemrb/gemrb/GUIScripts/iwd/GUISTORE.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** GUISTORE.py 2 Mar 2005 20:04:13 -0000 1.1 --- GUISTORE.py 3 Mar 2005 22:33:11 -0000 1.2 *************** *** 56,61 **** # 1 - identify # 2 - steal ! # 3 - donate ! # 4 - heal # 5 - drink # 6 - rent --- 56,61 ---- # 1 - identify # 2 - steal ! # 3 - heal ! # 4 - donate # 5 - drink # 6 - rent *************** *** 65,69 **** store_funcs = ( "OpenStoreShoppingWindow", "OpenStoreIdentifyWindow", ! "OpenStoreStealWindow", "OpenStoreDonateWindow", "OpenStoreHealWindow", "OpenStoreRumourWindow", "OpenStoreRentWindow" ) store_update_funcs = None --- 65,69 ---- store_funcs = ( "OpenStoreShoppingWindow", "OpenStoreIdentifyWindow", ! "OpenStoreStealWindow", "OpenStoreHealWindow", "OpenStoreDonateWindow", "OpenStoreRumourWindow", "OpenStoreRentWindow" ) store_update_funcs = None *************** *** 78,91 **** store_update_funcs = (OpenStoreShoppingWindow, OpenStoreIdentifyWindow,OpenStoreStealWindow, ! OpenStoreDonateWindow,OpenStoreHealWindow, OpenStoreRumourWindow,OpenStoreRentWindow ) ! if CloseOtherWindow( StoreWindow ): GemRB.HideGUI () CloseStoreShoppingWindow () CloseStoreIdentifyWindow () CloseStoreStealWindow () - CloseStoreDonateWindow () CloseStoreHealWindow () CloseStoreRumourWindow () CloseStoreRentWindow () --- 78,91 ---- store_update_funcs = (OpenStoreShoppingWindow, OpenStoreIdentifyWindow,OpenStoreStealWindow, ! OpenStoreHealWindow, OpenStoreDonateWindow, OpenStoreRumourWindow,OpenStoreRentWindow ) ! if CloseOtherWindow( OpenStoreWindow ): GemRB.HideGUI () CloseStoreShoppingWindow () CloseStoreIdentifyWindow () CloseStoreStealWindow () CloseStoreHealWindow () + CloseStoreDonateWindow () CloseStoreRumourWindow () CloseStoreRentWindow () *************** *** 94,99 **** --- 94,101 ---- StoreWindow = None GemRB.SetVar ("OtherWindow", -1) + GemRB.SetVar ("TopWindow", -1) SetSelectionChangeHandler( None ) GemRB.UnhideGUI () + GemRB.LeaveStore () return *************** *** 107,116 **** # Done Button = GemRB.GetControl (Window, 0) ! GemRB.SetText (Window, Button, 1403) GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "OpenStoreWindow") #Store type icon Button = GemRB.GetControl (Window, 5) - print storebams[Store['StoreType']] GemRB.SetButtonSprites(Window, Button,storebams[Store['StoreType']],0,0,0,0,0) --- 109,117 ---- # Done Button = GemRB.GetControl (Window, 0) ! GemRB.SetText (Window, Button, 11973) GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "OpenStoreWindow") #Store type icon Button = GemRB.GetControl (Window, 5) GemRB.SetButtonSprites(Window, Button,storebams[Store['StoreType']],0,0,0,0,0) *************** *** 121,125 **** Buttons[i]=Button=GemRB.GetControl (Window, i+1) Action = store_buttons[i] ! GemRB.SetButtonSprites(Window, Button, "GUISTBBC", Action, 0,1,0,0) GemRB.SetVarAssoc (Window, Button, "Action", i) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_RADIOBUTTON, OP_OR) --- 122,126 ---- Buttons[i]=Button=GemRB.GetControl (Window, i+1) Action = store_buttons[i] ! GemRB.SetButtonSprites(Window, Button, "GUISTBBC", Action, 0,1,2,0) GemRB.SetVarAssoc (Window, Button, "Action", i) GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_RADIOBUTTON, OP_OR) *************** *** 131,138 **** GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_DISABLED) - SetSelectionChangeHandler( store_update_funcs[store_buttons[0]] ) - GemRB.SetVar ("StoreRent",0) GemRB.UnhideGUI() - #initializing selected variables store_update_funcs[store_buttons[0]] () --- 132,136 ---- *************** *** 140,147 **** --- 138,147 ---- global StoreShoppingWindow + GemRB.HideGUI() if StoreShoppingWindow != None: Window = StoreShoppingWindow GemRB.SetVar ("TopWindow", Window) UpdateStoreShoppingWindow () + GemRB.UnhideGUI() return *************** *** 151,168 **** # buy price ... Label = GemRB.GetControl (Window, 0x1000002b) ! GemRB.SetText (Window, Label, 'cost') # sell price ... Label = GemRB.GetControl (Window, 0x1000002c) ! GemRB.SetText (Window, Label, 'sell') # Buy Button = GemRB.GetControl (Window, 2) ! GemRB.SetText (Window, Button, 45303) # Sell Button = GemRB.GetControl (Window, 3) ! GemRB.SetText (Window, Button, 45304) # 45374 --- 151,171 ---- # buy price ... Label = GemRB.GetControl (Window, 0x1000002b) ! GemRB.SetText (Window, Label, "0") # sell price ... Label = GemRB.GetControl (Window, 0x1000002c) ! GemRB.SetText (Window, Label, "0") # Buy Button = GemRB.GetControl (Window, 2) ! GemRB.SetText (Window, Button, 13703) # Sell Button = GemRB.GetControl (Window, 3) ! GemRB.SetText (Window, Button, 13704) + Button = GemRB.GetControl (Window, 50) + GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_DISABLED) + GemRB.SetText (Window, Button, 13707) # 45374 *************** *** 173,178 **** --- 176,186 ---- # 25 encumbrance button + # encumbrance + Label = GemRB.CreateLabel (Window, 0x10000043, 15,325,60,15,"NUMBER","0:",IE_FONT_ALIGN_LEFT|IE_FONT_ALIGN_TOP) + Label = GemRB.CreateLabel (Window, 0x10000044, 15,365,80,15,"NUMBER","0:",IE_FONT_ALIGN_RIGHT|IE_FONT_ALIGN_TOP) + SetSelectionChangeHandler( UpdateStoreShoppingWindow ) UpdateStoreShoppingWindow () + GemRB.UnhideGUI() *************** *** 180,187 **** --- 188,197 ---- global StoreIdentifyWindow + GemRB.HideGUI() if StoreIdentifyWindow != None: Window = StoreIdentifyWindow GemRB.SetVar ("TopWindow", Window) UpdateStoreIdentifyWindow () + GemRB.UnhideGUI() return *************** *** 203,206 **** --- 213,217 ---- SetSelectionChangeHandler( UpdateStoreIdentifyWindow ) UpdateStoreIdentifyWindow () + GemRB.UnhideGUI() *************** *** 208,215 **** --- 219,228 ---- global StoreStealWindow + GemRB.HideGUI() if StoreStealWindow != None: Window = StoreStealWindow GemRB.SetVar ("TopWindow", Window) UpdateStoreStealWindow () + GemRB.UnhideGUI() return *************** *** 219,226 **** # Steal Button = GemRB.GetControl (Window, 1) ! GemRB.SetText (Window, Button, 45305) SetSelectionChangeHandler( UpdateStoreStealWindow ) UpdateStoreStealWindow () --- 232,244 ---- # Steal Button = GemRB.GetControl (Window, 1) ! GemRB.SetText (Window, Button, 14179) ! ! # encumbrance ! Label = GemRB.CreateLabel (Window, 0x10000043, 15,325,60,15,"NUMBER","0:",IE_FONT_ALIGN_LEFT|IE_FONT_ALIGN_TOP) ! Label = GemRB.CreateLabel (Window, 0x10000044, 15,365,80,15,"NUMBER","0:",IE_FONT_ALIGN_RIGHT|IE_FONT_ALIGN_TOP) SetSelectionChangeHandler( UpdateStoreStealWindow ) UpdateStoreStealWindow () + GemRB.UnhideGUI() *************** *** 228,235 **** --- 246,255 ---- global StoreDonateWindow + GemRB.HideGUI() if StoreDonateWindow != None: Window = StoreDonateWindow GemRB.SetVar ("TopWindow", Window) UpdateStoreDonateWindow () + GemRB.UnhideGUI() return *************** *** 238,250 **** # Donate ! Button = GemRB.GetControl (Window, 2) ! GemRB.SetText (Window, Button, 45307) # 0 ta ! # 3 donation entry ! # 4 5 +- SetSelectionChangeHandler( UpdateStoreDonateWindow ) UpdateStoreDonateWindow () --- 258,275 ---- # Donate ! Button = GemRB.GetControl (Window, 3) ! GemRB.SetText (Window, Button, 15101) # 0 ta ! # 5 donation entry ! # 6 7 +- ! Button = GemRB.GetControl (Window, 6) ! GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "IncrementDonation") ! Button = GemRB.GetControl (Window, 7) ! GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "DecrementDonation") SetSelectionChangeHandler( UpdateStoreDonateWindow ) UpdateStoreDonateWindow () + GemRB.UnhideGUI() *************** *** 252,259 **** --- 277,286 ---- global StoreHealWindow + GemRB.HideGUI() if StoreHealWindow != None: Window = StoreHealWindow GemRB.SetVar ("TopWindow", Window) UpdateStoreHealWindow () + GemRB.UnhideGUI() return *************** *** 261,280 **** GemRB.SetVar ("TopWindow", Window) ! # price ... ! Label = GemRB.GetControl (Window, 0x10000001) ! GemRB.SetText (Window, Label, str (666)) ! ! # price ... ! Label = GemRB.GetControl (Window, 0x1000000e) ! GemRB.SetText (Window, Label, character_name) # Heal ! Button = GemRB.GetControl (Window, 3) ! GemRB.SetText (Window, Button, 8836) # FIXME: better strref ! ! # 13 ta UpdateStoreHealWindow () --- 288,305 ---- GemRB.SetVar ("TopWindow", Window) ! #spell buttons ! for i in range(4): ! Button = GemRB.GetControl (Window, i+8) ! GemRB.SetVarAssoc (Window, Button, "Index", i) ! GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_RADIOBUTTON, OP_OR) # Heal ! Button = GemRB.GetControl (Window, 5) ! GemRB.SetText (Window, Button, 13703) ! # 23 ta UpdateStoreHealWindow () + GemRB.UnhideGUI() *************** *** 282,285 **** --- 307,311 ---- global StoreRumourWindow + GemRB.HideGUI() GemRB.SetVar ("TopIndex", 0) if StoreRumourWindow != None: *************** *** 287,290 **** --- 313,317 ---- GemRB.SetVar ("TopWindow", Window) UpdateStoreRumourWindow () + GemRB.UnhideGUI() return *************** *** 298,317 **** ScrollBar = GemRB.GetControl (Window, 5) GemRB.SetEvent (Window, ScrollBar, IE_GUI_SCROLLBAR_ON_CHANGE, "UpdateStoreRumourWindow") ! Count=Store['StoreDrinkCount'] if Count<5: Count=1 else: Count=Count-4 ! GemRB.SetVarAssoc(Window, ScrollBar, "TopIndex", Count) UpdateStoreRumourWindow () def OpenStoreRentWindow (): global StoreRentWindow if StoreRentWindow != None: Window = StoreRentWindow GemRB.SetVar ("TopWindow", Window) UpdateStoreRentWindow () return --- 325,348 ---- ScrollBar = GemRB.GetControl (Window, 5) GemRB.SetEvent (Window, ScrollBar, IE_GUI_SCROLLBAR_ON_CHANGE, "UpdateStoreRumourWindow") ! Count=Store['StoreDrinkCount'] if Count<5: Count=1 else: Count=Count-4 ! GemRB.SetVarAssoc(Window, ScrollBar, "TopIndex", Count) UpdateStoreRumourWindow () + GemRB.UnhideGUI() + def OpenStoreRentWindow (): global StoreRentWindow + GemRB.HideGUI() if StoreRentWindow != None: Window = StoreRentWindow GemRB.SetVar ("TopWindow", Window) UpdateStoreRentWindow () + GemRB.UnhideGUI() return *************** *** 320,335 **** # room types ! StoreRent = -1 for i in range(4): ok = Store['StoreRoomPrices'][i] Button = GemRB.GetControl (Window, i) GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "SelectStoreRent") ! GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_RADIOBUTTON, OP_OR) ! GemRB.SetVarAssoc (Window, Button, "StoreRent", i) if ok<0: GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_DISABLED) else: ! if StoreRent==-1: ! StoreRent = i Button = GemRB.GetControl (Window, i+4) --- 351,366 ---- # room types ! Index = -1 for i in range(4): ok = Store['StoreRoomPrices'][i] Button = GemRB.GetControl (Window, i) GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "SelectStoreRent") ! #GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_RADIOBUTTON, OP_OR) ! GemRB.SetVarAssoc (Window, Button, "Index", i) if ok<0: GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_DISABLED) else: ! if Index==-1: ! Index = i Button = GemRB.GetControl (Window, i+4) *************** *** 337,341 **** GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "SelectStoreRent") GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_RADIOBUTTON, OP_OR) ! GemRB.SetVarAssoc (Window, Button, "StoreRent", i) if ok<0: GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_DISABLED) --- 368,372 ---- GemRB.SetEvent (Window, Button, IE_GUI_BUTTON_ON_PRESS, "SelectStoreRent") GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_RADIOBUTTON, OP_OR) ! GemRB.SetVarAssoc (Window, Button, "Index", i) if ok<0: GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_DISABLED) *************** *** 344,348 **** Button = GemRB.GetControl (Window, 11) GemRB.SetText (Window, Button, 14293) ! GemRB.SetVar ("StoreRent",StoreRent) --- 375,382 ---- Button = GemRB.GetControl (Window, 11) GemRB.SetText (Window, Button, 14293) ! GemRB.SetVar ("Index",Index) ! ! UpdateStoreRentWindow() ! GemRB.UnhideGUI() *************** *** 350,356 **** Window = StoreRentWindow ! room = GemRB.GetVar ("StoreRent") Text = GemRB.GetControl (Window, 12) ! GemRB.SetText (Window, Text, roomtypes[room] ) Label = GemRB.GetControl (Window, 0x1000000d) Rent = GemRB.GetVar ("StoreRent") --- 384,390 ---- Window = StoreRentWindow ! Index = GemRB.GetVar ("Index") Text = GemRB.GetControl (Window, 12) ! GemRB.SetText (Window, Text, roomtypes[Index] ) Label = GemRB.GetControl (Window, 0x1000000d) Rent = GemRB.GetVar ("StoreRent") *************** *** 360,364 **** def UpdateStoreCommon (Window, title, name, gold): - GemRB.HideGUI() Label = GemRB.GetControl (Window, title) GemRB.SetText (Window, Label, Store['StoreName']) --- 394,397 ---- *************** *** 371,375 **** Label = GemRB.GetControl (Window, gold) GemRB.SetText (Window, Label, str( GemRB.GameGetPartyGold () ) ) - GemRB.UnhideGUI() --- 404,407 ---- *************** *** 385,391 **** def UpdateStoreDonateWindow (): UpdateStoreCommon (StoreDonateWindow, 0x10000007, 0, 0x10000008) def UpdateStoreHealWindow (): ! UpdateStoreCommon (StoreHealWindow, 0x10000005, 0, 0x10000001) def UpdateStoreRumourWindow (): --- 417,463 ---- def UpdateStoreDonateWindow (): UpdateStoreCommon (StoreDonateWindow, 0x10000007, 0, 0x10000008) + + def IncrementDonation (): + Window = StoreDonateWindow + + Field = GetControl (Window, 5) + donation = val(GemRB.QueryText (Window, Field)) + if donation<GemRB.GetPartyGold(): + GemRB.SetText (Window, Field, str(donation+1) ) + else: + GemRB.SetText (Window, Field, str(GemRB.GetPartyGold()) ) + + def DecrementDonation (): + Window = StoreDonateWindow + Field = GetControl (Window, 5) + donation = val(GemRB.QueryText(Window, Field)) + if donation>0: + GemRB.SetText (Window, Field, str(donation-1) ) + else: + GemRB.SetText (Window, Field, str(0) ) + + def DonateGold (): + Window = StoreDonateWindow + + TextArea = GemRB.GetControl (Window, 0) + GemRB.SetTAAutoScroll(Window, TextArea, 1) + Button = GemRB.GetControl (Window, 10) + GemRB.SetButtonFlags (Window, Button, IE_GUI_BUTTON_ANIMATE) + Field = GetControl (Window, 5) + donation = val(GemRB.QueryText(Window, Field)) + GemRB.SetPartyGold( GemRB.GetPartyGold()-donation) + donation = donation / 1000 + if donation>0: + #GemRB.IncreaseReputation (donation) + GemRB.TextAreaAppend (Window, TextArea, 10468, -1) + GemRB.PlaySound("act_03") + else: + GemRB.TextAreaAppend (Window, TextArea, 10469, -1) + GemRB.PlaySound("act_03e") + + def UpdateStoreHealWindow (): ! UpdateStoreCommon (StoreHealWindow, 0x10000000, 0, 0x10000001) def UpdateStoreRumourWindow (): *************** *** 395,403 **** for i in range(5): Drink = GemRB.GetStoreDrink (i+TopIndex) - print Drink Button = GemRB.GetControl (Window, i) if Drink != None: ! GemRB.SetText (Window, Button, Drink['DrinkName']) GemRB.SetVarAssoc (Window, Button, "Index", i) GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_ENABLED) --- 467,475 ---- for i in range(5): Drink = GemRB.GetStoreDrink (i+TopIndex) Button = GemRB.GetControl (Window, i) if Drink != None: ! txt = "%s (%d)" % (GemRB.GetString(Drink['DrinkName']) , Drink['Price']) ! GemRB.SetText (Window, Button, txt) GemRB.SetVarAssoc (Window, Button, "Index", i) GemRB.SetButtonState (Window, Button, IE_GUI_BUTTON_ENABLED) *************** *** 408,415 **** def GulpDrink (): pc = GemRB.GameGetSelectedPCSingle () intox = GemRB.GetPlayerStat (pc, IE_INTOXICATION) if intox > 80: ! print "Too drunk" return --- 480,491 ---- def GulpDrink (): + Window = StoreRumourWindow + + TextArea = GemRB.GetControl (Window, 13) + GemRB.SetTAAutoScroll(Window, TextArea, 1) pc = GemRB.GameGetSelectedPCSingle () intox = GemRB.GetPlayerStat (pc, IE_INTOXICATION) if intox > 80: ! GemRB.TextAreaAppend (Window, TextArea, 10832, -1) return *************** *** 423,427 **** GemRB.SetPlayerStat (pc, IE_INTOXICATION, intox+Drink['Strength']) #get some rumour ! PlaySound("gulp") --- 499,503 ---- GemRB.SetPlayerStat (pc, IE_INTOXICATION, intox+Drink['Strength']) #get some rumour ! GemRB.PlaySound("gam_07") |