From: Laszlo T. <ave...@us...> - 2010-08-01 18:39:45
|
gemrb: Infinity Engine emulator The branch master has been updated via 97171b38cc3c7cc1863e14434f4a14cca2c5d3c5 (commit) Summary of changes: gemrb/GUIScripts/GUICommon.py | 4 +- gemrb/GUIScripts/bg2/GUIINV.py | 49 +++++++++++++++++++++++++-------------- gemrb/GUIScripts/ie_slots.py | 3 +- gemrb/core/Interface.cpp | 3 +- 4 files changed, 37 insertions(+), 22 deletions(-) from 19bdf0a6f14dfe06c94f67222101cf54c1181024 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=97171b38cc3c7cc1863e14434f4a14cca2c5d3c5 commit 97171b38cc3c7cc1863e14434f4a14cca2c5d3c5 Author: Avenger <ave...@so...> Date: Sun Aug 1 20:38:44 2010 +0200 better learning from scrolls (oddly, charges should come from Usage[0]) diff --git a/gemrb/GUIScripts/GUICommon.py b/gemrb/GUIScripts/GUICommon.py index 8090761..ce9ea7b 100644 --- a/gemrb/GUIScripts/GUICommon.py +++ b/gemrb/GUIScripts/GUICommon.py @@ -27,7 +27,7 @@ from ie_spells import LS_MEMO, LSR_KNOWN, LSR_LEVEL, LSR_STAT from GUIDefines import * from ie_stats import * from ie_action import ACT_QSLOT1, ACT_QSLOT2, ACT_QSLOT3, ACT_QSLOT4, ACT_QSLOT5 -from ie_slots import SLOT_ANY +from ie_slots import SLOT_ALL OtherWindowFn = None @@ -433,7 +433,7 @@ def UpdateInventorySlot (pc, Button, Slot, Type, Equipped=False): else: Button.EnableBorder (1, 0) - if GemRB.CanUseItemType (SLOT_ANY, Slot['ItemResRef'], pc, Equipped): + if GemRB.CanUseItemType (SLOT_ALL, Slot['ItemResRef'], pc, Equipped): Button.EnableBorder (2, 0) else: Button.EnableBorder (2, 1) diff --git a/gemrb/GUIScripts/bg2/GUIINV.py b/gemrb/GUIScripts/bg2/GUIINV.py index 600cfbc..2b07931 100644 --- a/gemrb/GUIScripts/bg2/GUIINV.py +++ b/gemrb/GUIScripts/bg2/GUIINV.py @@ -675,45 +675,54 @@ def CloseErrorWindow (): return def ReadItemWindow (): + global level, spell_ref """Tries to learn the mage scroll.""" pc = GemRB.GameGetSelectedPCSingle () slot = GemRB.GetVar ("ItemButton") - ret = 0 + ret = GUICommon.CannotLearnSlotSpell() + + if ret: + strref = 72873 + CloseItemInfoWindow () + OpenErrorWindow (strref) + return slot_item = GemRB.GetSlotItem (pc, slot) spell_ref = GemRB.GetItem (slot_item['ItemResRef'], pc)['Spell'] spell = GemRB.GetSpell (spell_ref) if spell: # can we learn more spells of this level? - spell_count = GemRB.GetKnownSpellsCount (pc, IE_SPELL_TYPE_WIZARD, spell['SpellLevel']-1) + level = spell['SpellLevel']-1 + spell_count = GemRB.GetKnownSpellsCount (pc, IE_SPELL_TYPE_WIZARD, level) if spell_count > GemRB.GetAbilityBonus (IE_INT, 2, GemRB.GetPlayerStat (pc, IE_INT)): ret = LSR_FULL strref = 32097 else: - if GemRB.LearnSpell (pc, spell_ref, LS_STATS|LS_ADDXP): - ret = LSR_FAILED - strref = 10831 # failure - else: - strref = 10830 # success - - # HACK: above is broken because we *must* do the below, - # since the header can contain other things - - # the learn scroll header is always the second - # 5 is TARGET_SELF, because some scrolls are buggy GemRB.UseItem (pc, slot, 1, 5) - #GemRB.RemoveItem (pc, slot) + GemRB.SetTimedEvent(DelayedReadItemWindow, 1) + return else: print "WARNING: invalid spell header in item", slot_item['ItemResRef'] - CloseItemInfoWindow () - return -1 + return CloseItemInfoWindow () OpenErrorWindow (strref) + return - return ret +def DelayedReadItemWindow (): + global level, spell_ref + pc = GemRB.GameGetSelectedPCSingle () + if GUICommon.HasSpell (pc, IE_SPELL_TYPE_WIZARD, level, spell_ref): + strref = 10830 + else: + ret = LSR_FAILED + strref = 10831 + CloseItemInfoWindow () + OpenErrorWindow (strref) + return + def OpenItemWindow (): """Displays information about an item.""" @@ -923,13 +932,17 @@ def DisplayItem (itemresref, type): Button = Window.GetControl (9) drink = (type&1) and (item["Function"]&1) read = (type&1) and (item["Function"]&2) + #sorcerors cannot learn spells + pc = GemRB.GameGetSelectedPCSingle () + if GemRB.GetPlayerStat (pc, IE_CLASS) == 19: + read = 0 container = (type&1) and (item["Function"]&4) dialog = (type&1) and (item["Dialog"]!="") familiar = (type&1) and (item["Type"] == 38) if drink: Button.SetText (19392) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, DrinkItemWindow) - elif read and not GUICommon.CannotLearnSlotSpell (): + elif read: Button.SetText (17104) Button.SetEvent (IE_GUI_BUTTON_ON_PRESS, ReadItemWindow) elif container: diff --git a/gemrb/GUIScripts/ie_slots.py b/gemrb/GUIScripts/ie_slots.py index 8fba18c..8b0c868 100644 --- a/gemrb/GUIScripts/ie_slots.py +++ b/gemrb/GUIScripts/ie_slots.py @@ -37,7 +37,8 @@ SLOT_SCROLL = 4096 SLOT_BAG = 8192 SLOT_POTION = 16384 SLOT_INVENTORY = 32768 -SLOT_ANY = 32767 +SLOT_ANY = 32767 #any except inventory +SLOT_ALL = 65535 #all including inventory TYPE_NORMAL = 0 #inventory TYPE_ARMOR = 1 #normal armor diff --git a/gemrb/core/Interface.cpp b/gemrb/core/Interface.cpp index 49e888f..775f8b1 100644 --- a/gemrb/core/Interface.cpp +++ b/gemrb/core/Interface.cpp @@ -3880,7 +3880,8 @@ bool Interface::InitItemTypes() } k <<= 1; } - slotmatrix[i] = (ieDword) value; + //we let any items in the inventory + slotmatrix[i] = (ieDword) value | SLOT_INVENTORY; } } ----------------------------------------------------------------------- This is an automated email from the git hooks/post-receive script. -- gemrb: Infinity Engine emulator |