berelinde Posted January 5, 2007 Share Posted January 5, 2007 I'll defer to cmorgan on this. I remember going through my abortive attempt at identifying files as being BG/no ToSC SoA/no ToB, and there weren't all that many Tutu spells. In fact, the only ones there were were ones that supported the breaking of items. Tutu uses regular BG2 spells, AFAIK. Edit: How come PINKXAN.spl doesn't ever take affect in my game? I've seen the pink banter several times, but Xan has never turned pink. I'm horribly disappointed. Link to comment
Nythrun Posted January 5, 2007 Author Share Posted January 5, 2007 That's great for me, actually - no need to swap spell names means less work! Much thanks, both of you /edit: Arcane spell assignation done less Bards. 1433 lines of fun fun fun. At one point I typed ADD_KNOWN_SPELL ~spwi118~ #0 ~wizard~ // Cro-Magnon Orb without realising what I'd done Item swapping algorithm is going to take a day or two - not sure how to approach that yet, but it isn't optional. Almost there. Link to comment
Miloch Posted January 5, 2007 Share Posted January 5, 2007 Tutu uses regular BG2 spells, AFAIK.Yes. Or rather, it uses the subset of BG2 spells available in BG1 (though all of them are present). So wizard spells are in the SPWIxxx namespace. Link to comment
Nythrun Posted January 6, 2007 Author Share Posted January 6, 2007 Alrighty, I'm adding some more bounds checking to the above macro so it won't fail on invalid reads when the spells/effects/items don't match the count the count present in the file. Also thought it would be nice to build a spell memorization table from the .2das if the one on the creature was invalid, so that's going in and is almost done Do you want any other bugfixing or value-checking code? It wouldn't take to long to fix thac0 or saves, since I've got code for that in the mod already. Link to comment
Guest Nythrun@work Posted January 8, 2007 Share Posted January 8, 2007 Guess who blew up her modem? Erm, here's an earlier version of the creature checking macro I was using for this mod - it's perhaps overly robust, so you might need to comment out portions (e.g. it deletes spells and items if they don't exist in the game, but if they're things that are going to exist that you've not copied yet, you don't want them scratched). It's also effing huge, so this is going to take several posts, sorry. You may want to do a find PATCH_PRINT replace // PATCH_PRINT to quell the deluge of debug info. DEFINE_PATCH_MACRO ~reorder_cre~ BEGIN PATCH_IF (SOURCE_SIZE < 0x02d4) THEN BEGIN PATCH_PRINT ~%SOURCE_FILE% is corrupt and missing part of its header; cannot be fixed by automation.~ END ELSE PATCH_IF NOT (~%SOURCE_RES%~ STRING_EQUAL_CASE ~CHARBASE~) THEN BEGIN // basic reads for creature manipulation READ_LONG 0x0010 "creature_flags" READ_BYTE 0x0052 "creature_thac0" READ_BYTE 0x0054 "save_vs_death_old" READ_BYTE 0x0055 "save_vs_wands_old" READ_BYTE 0x0056 "save_vs_poly_old" READ_BYTE 0x0057 "save_vs_breath_old" READ_BYTE 0x0058 "save_vs_spell_old" READ_BYTE 0x0066 "creature_lore_old" READ_BYTE 0x0234 "creature_level_a" READ_BYTE 0x0235 "creature_level_b" READ_BYTE 0x0236 "creature_level_c" READ_BYTE 0x0238 "strength" READ_BYTE 0x0239 "exceptional_strength" READ_BYTE 0x023a "intelligence" READ_BYTE 0x023b "wisdom" READ_BYTE 0x023c "dexterity" READ_BYTE 0x023d "constitution" READ_BYTE 0x023e "charisma" READ_LONG 0x0244 "creature_kit" READ_BYTE 0x0272 "creature_race" READ_BYTE 0x0273 "creature_class" READ_LONG 0x02a0 "known_spells_offset" READ_LONG 0x02a4 "known_spells_count" READ_LONG 0x02a8 "spell_memorization_info_offset" READ_LONG 0x02ac "spell_memorization_info_entries_count" READ_LONG 0x02b0 "memorized_spells_offset" READ_LONG 0x02b4 "memorized_spells_count" READ_LONG 0x02b8 "offset_to_item_slots" READ_LONG 0x02bc "offset_to_items" READ_LONG 0x02c0 "count_of_items" READ_LONG 0x02c4 "offset_to_effects" READ_LONG 0x02c8 "count_of_effects" // "helpful" warning PATCH_IF (("known_spells_offset" > "spell_memorization_info_offset") OR ("spell_memorization_info_offset" > "memorized_spells_offset" ) OR ("memorized_spells_offset" > "offset_to_effects" ) OR ("offset_to_effects" > "offset_to_items" ) OR ("offset_to_items" > "offset_to_item_slots" )) THEN BEGIN PATCH_PRINT ~%SOURCE_FILE% is in a non-standard order and will be forced to conform!~ END // statistic out of bound errors (fixing necessary to read some .2das correctly) PATCH_IF NOT ("creature_level_a" > 0x00) THEN BEGIN PATCH_PRINT ~%SOURCE_FILE% has an invalid level of %creature_level_a%, correcting to 1.~ SET "creature_level_a" = 0x01 WRITE_BYTE 0x0234 "creature_level_a" END PATCH_IF NOT ("creature_level_b" > 0x00) THEN BEGIN SET "creature_level_b" = 0x01 WRITE_BYTE 0x0235 "creature_level_b" END PATCH_IF NOT ("creature_level_c" > 0x00) THEN BEGIN SET "creature_level_c" = 0x01 WRITE_BYTE 0x0236 "creature_level_c" END PATCH_IF ("strength" > 0x19) THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s strength reduced from %strength% to 25.~ SET "strength" = 0x19 WRITE_BYTE 0x0238 "strength" END ELSE PATCH_IF ("strength" < 0x01) THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s strength corrected from %strength% to 1.~ SET "strength" = 0x01 WRITE_BYTE 0x0238 "strength" END PATCH_IF (("exceptional_strength" != 0x00) AND ("strength" != 0x12)) THEN BEGIN PATCH_PRINT ~%SOURCE_FILE% has an exceptional strength but its strength is not 18.~ SET "exceptional_strength" = 0x00 WRITE_BYTE 0x0239 "exceptional_strength" END PATCH_IF (("exceptional_strength" > 0x00) OR ("exceptional_strength" > 0x64)) THEN BEGIN PATCH_PRINT ~%SOURCE_FILE% has an exceptional strength of %exceptional_strength%, nulling.~ SET "exceptional_strength" = 0x00 WRITE_BYTE 0x0239 "exceptional_strength" END PATCH_IF ("intelligence" > 0x19) THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s intelligence reduced from %intelligence% to 25.~ SET "intelligence" = 0x19 WRITE_BYTE 0x023a "intelligence" END ELSE PATCH_IF ("intelligence" < 0x01) THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s intelligence corrected from %intelligence% to 1.~ SET "intelligence" = 0x01 WRITE_BYTE 0x023a "intelligence" END PATCH_IF ("wisdom" > 0x19) THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s wisdom reduced from %wisdom% to 25.~ SET "wisdom" = 0x19 WRITE_BYTE 0x023b "wisdom" END ELSE PATCH_IF ("wisdom" < 0x01) THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s wisdom corrected from %wisdom% to 1.~ SET "wisdom" = 0x01 WRITE_BYTE 0x023b "wisdom" END PATCH_IF ("dexterity" > 0x19) THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s dexterity reduced from %dexterity% to 25.~ SET "dexterity" = 0x19 WRITE_BYTE 0x023c "dexterity" END ELSE PATCH_IF ("dexterity" < 0x01) THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s dexterity corrected from %dexterity% to 1.~ SET "dexterity" = 0x01 WRITE_BYTE 0x023c "dexterity" END PATCH_IF ("constitution" > 0x19) THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s constitution reduced from %constitution% to 25.~ SET "constitution" = 0x19 WRITE_BYTE 0x023d "constitution" END ELSE PATCH_IF ("constitution" < 0x01) THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s constitution corrected from %constitution% to 1.~ SET "constitution" = 0x01 WRITE_BYTE 0x023d "constitution" END PATCH_IF ("charisma" > 0x19) THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s charisma reduced from %charisma% to 25.~ SET "charisma" = 0x19 WRITE_BYTE 0x023e "charisma" END ELSE PATCH_IF ("charisma" < 0x01) THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s charisma corrected from %charisma% to 1.~ SET "charisma" = 0x01 WRITE_BYTE 0x023e "charisma" END // figure correct level to use for thac0 and save and lore calculations. // this section must not be commented out for those parts to work correctly. SET "current_level" = 0x00 SET "former_level" = 0x01 SET "former_class" = "creature_class" SET "current_class" = "creature_class" PATCH_IF (("creature_class" = 0x01) OR ("creature_class" = 0x02) OR ("creature_class" = 0x03) OR ("creature_class" = 0x04) OR ("creature_class" = 0x05) OR ("creature_class" = 0x06) OR ("creature_class" = 0x0b) OR ("creature_class" = 0x0c) OR ("creature_class" = 0x13) OR ("creature_class" = 0x14)) THEN BEGIN SET "current_level" = "creature_level_a" SET "former_class_save" = "creature_class" SET "current_class_save" = "creature_class" PATCH_IF ("creature_class" = 0x05) THEN BEGIN SET "current_class_save" = 0x04 SET "former_class_save" = 0x04 END ELSE PATCH_IF ("creature_class" = 0x06) THEN BEGIN SET "current_class_save" = 0x02 SET "former_class_save" = 0x02 END ELSE PATCH_IF ("creature_class" = 0x0b) THEN BEGIN SET "current_class_save" = 0x03 SET "former_class_save" = 0x03 END ELSE PATCH_IF ("creature_class" = 0x0c) THEN BEGIN SET "current_class_save" = 0x02 SET "former_class_save" = 0x02 END ELSE PATCH_IF ("creature_class" = 0x13) THEN BEGIN SET "current_class_save" = 0x01 SET "former_class_save" = 0x01 END END ELSE PATCH_IF (("creature_class" = 0x07) OR ("creature_class" = 0x08) OR ("creature_class" = 0x09) OR ("creature_class" = 0x0d) OR ("creature_class" = 0x0e) OR ("creature_class" = 0x0f) OR ("creature_class" = 0x10) OR ("creature_class" = 0x12)) THEN BEGIN PATCH_IF ("creature_class" = 0x07) THEN BEGIN PATCH_IF (("creature_flags" BAND 0x00000008) = 0x8) THEN BEGIN SET "former_class" = 0x02 SET "former_class_save" = 0x02 PATCH_IF ("creature_level_b" > "creature_level_a") THEN BEGIN SET "former_level" = "creature_level_a" END SET "current_class" = 0x01 SET "current_class_save" = 0x01 SET "current_level" = "creature_level_b" END ELSE PATCH_IF (("creature_flags" BAND 0x00000010) = 0x10) THEN BEGIN SET "former_class" = 0x01 SET "former_class_save" = 0x01 PATCH_IF ("creature_level_a" > "creature_level_b") THEN BEGIN SET "former_level" = "creature_level_b" END SET "current_class" = 0x02 SET "current_class_save" = 0x02 SET "current_level" = "creature_level_a" END ELSE BEGIN SET "current_level" = "creature_level_a" SET "former_level" = "creature_level_b" SET "current_class_save" = 0x02 SET "former_class_save" = 0x01 END END ELSE PATCH_IF ("creature_class" = 0x08) THEN BEGIN PATCH_IF (("creature_flags" BAND 0x00000008) = 0x8) THEN BEGIN SET "former_class" = 0x02 SET "former_class_save" = 0x02 PATCH_IF ("creature_level_b" > "creature_level_a") THEN BEGIN SET "former_level" = "creature_level_a" END SET "current_class" = 0x03 SET "current_class_save" = 0x03 SET "current_level" = "creature_level_b" END ELSE PATCH_IF (("creature_flags" BAND 0x00000020) = 0x20) THEN BEGIN SET "former_class" = 0x03 SET "former_class_save" = 0x03 PATCH_IF ("creature_level_a" > "creature_level_b") THEN BEGIN SET "former_level" = "creature_level_b" END SET "current_class" = 0x02 SET "current_class_save" = 0x02 SET "current_level" = "creature_level_a" END ELSE BEGIN SET "current_level" = "creature_level_a" SET "former_level" = "creature_level_b" SET "current_class_save" = 0x02 SET "former_class_save" = 0x03 END END ELSE PATCH_IF ("creature_class" = 0x09) THEN BEGIN PATCH_IF (("creature_flags" BAND 0x00000008) = 0x8) THEN BEGIN SET "former_class" = 0x02 SET "former_class_save" = 0x02 PATCH_IF ("creature_level_b" > "creature_level_a") THEN BEGIN SET "former_level" = "creature_level_a" END SET "current_class" = 0x04 SET "current_class_save" = 0x04 SET "current_level" = "creature_level_b" END ELSE PATCH_IF (("creature_flags" BAND 0x00000040) = 0x40) THEN BEGIN SET "former_class" = 0x04 SET "former_class_save" = 0x04 PATCH_IF ("creature_level_a" > "creature_level_b") THEN BEGIN SET "former_level" = "creature_level_b" END SET "current_class" = 0x02 SET "current_class_save" = 0x02 SET "current_level" = "creature_level_a" END ELSE BEGIN SET "current_level" = "creature_level_a" SET "former_level" = "creature_level_b" SET "current_class_save" = 0x02 SET "former_class_save" = 0x04 END END ELSE PATCH_IF ("creature_class" = 0x0d) THEN BEGIN PATCH_IF (("creature_flags" BAND 0x00000010) = 0x10) THEN BEGIN SET "former_class" = 0x01 SET "former_class_save" = 0x01 PATCH_IF ("creature_level_b" > "creature_level_a") THEN BEGIN SET "former_level" = "creature_level_a" END SET "current_class" = 0x04 SET "current_class_save" = 0x04 SET "current_level" = "creature_level_b" END ELSE PATCH_IF (("creature_flags" BAND 0x00000040) = 0x40) THEN BEGIN SET "former_class" = 0x04 SET "former_class_save" = 0x04 PATCH_IF ("creature_level_a" > "creature_level_b") THEN BEGIN SET "former_level" = "creature_level_b" END SET "current_class" = 0x01 SET "current_class_save" = 0x01 SET "current_level" = "creature_level_a" END ELSE BEGIN SET "former_level" = "creature_level_b" SET "current_level" = "creature_level_a" SET "current_class_save" = 0x01 SET "former_class_save" = 0x04 END END ELSE PATCH_IF ("creature_class" = 0x0e) THEN BEGIN PATCH_IF (("creature_flags" BAND 0x00000020) = 0x20) THEN BEGIN SET "former_class" = 0x03 SET "former_class_save" = 0x03 PATCH_IF ("creature_level_b" > "creature_level_a") THEN BEGIN SET "former_level" = "creature_level_a" END SET "current_class" = 0x01 SET "current_class_save" = 0x01 SET "current_level" = "creature_level_b" END ELSE PATCH_IF (("creature_flags" BAND 0x00000010) = 0x10) THEN BEGIN SET "former_class" = 0x01 SET "former_class_save" = 0x01 PATCH_IF ("creature_level_a" > "creature_level_b") THEN BEGIN SET "former_level" = "creature_level_b" END SET "current_class" = 0x03 SET "current_class_save" = 0x03 SET "current_level" = "creature_level_a" END ELSE BEGIN SET "current_level" = "creature_level_a" SET "former_level" = "creature_level_b" SET "current_class_save" = 0x03 SET "former_class_save" = 0x01 END END ELSE PATCH_IF ("creature_class" = 0x0f) THEN BEGIN PATCH_IF (("creature_flags" BAND 0x00000020) = 0x20) THEN BEGIN SET "former_class" = 0x03 SET "former_class_save" = 0x03 PATCH_IF ("creature_level_b" > "creature_level_a") THEN BEGIN SET "former_level" = "creature_level_a" END SET "current_class" = 0x04 SET "current_class_save" = 0x04 SET "current_level" = "creature_level_b" END ELSE PATCH_IF (("creature_flags" BAND 0x00000040) = 0x40) THEN BEGIN SET "former_class" = 0x04 SET "former_class_save" = 0x04 PATCH_IF ("creature_level_a" > "creature_level_b") THEN BEGIN SET "former_level" = "creature_level_b" END SET "current_class" = 0x03 SET "current_class_save" = 0x03 SET "current_level" = "creature_level_a" END ELSE BEGIN SET "current_level" = "creature_level_a" SET "former_level" = "creature_level_b" SET "current_class_save" = 0x03 SET "former_class_save" = 0x04 END END ELSE PATCH_IF ("creature_class" = 0x10) THEN BEGIN PATCH_IF (("creature_flags" BAND 0x00000008) = 0x8) THEN BEGIN SET "former_class" = 0x02 SET "former_class_save" = 0x02 PATCH_IF ("creature_level_b" > "creature_level_a") THEN BEGIN SET "former_level" = "creature_level_a" END SET "current_class" = 0x0b SET "current_class_save" = 0x03 SET "current_level" = "creature_level_b" END ELSE PATCH_IF (("creature_flags" BAND 0x00000080) = 0x80) THEN BEGIN SET "former_class" = 0x0b SET "former_class_save" = 0x03 PATCH_IF ("creature_level_a" > "creature_level_b") THEN BEGIN SET "former_level" = "creature_level_b" END SET "current_class" = 0x02 SET "current_class_save" = 0x02 SET "current_level" = "creature_level_a" END ELSE BEGIN SET "current_level" = "creature_level_a" SET "former_level" = "creature_level_b" SET "current_class_save" = 0x02 SET "former_class_save" = 0x03 END END ELSE PATCH_IF ("creature_class" = 0x12) THEN BEGIN PATCH_IF (("creature_flags" BAND 0x00000020) = 0x20) THEN BEGIN SET "former_class" = 0x03 SET "former_class_save" = 0x03 PATCH_IF ("creature_level_b" > "creature_level_a") THEN BEGIN SET "former_level" = "creature_level_a" END SET "current_class" = 0x0c SET "current_class_save" = 0x02 SET "current_level" = "creature_level_b" END ELSE PATCH_IF (("creature_flags" BAND 0x00000100) = 0x100) THEN BEGIN SET "former_class" = 0x0c SET "former_class_save" = 0x02 PATCH_IF ("creature_level_a" > "creature_level_b") THEN BEGIN SET "former_level" = "creature_level_b" END SET "current_class" = 0x03 SET "current_class_save" = 0x03 SET "current_level" = "creature_level_a" END ELSE BEGIN SET "current_level" = "creature_level_a" SET "former_level" = "creature_level_b" SET "current_class_save" = 0x03 SET "former_class_save" = 0x02 END END END ELSE PATCH_IF (("creature_class" = 0x0a) OR ("creature_class" = 0x11)) THEN BEGIN SET "current_level" = "creature_level_a" SET "former_level" = "creature_level_b" END Link to comment
Guest Nythrun@work Posted January 8, 2007 Share Posted January 8, 2007 // consult the Book of Armaments for correct thac0 PATCH_IF ("current_level" > 0x00) THEN BEGIN SET "current_class_thac0" = 0x14 SET "former_class_thac0" = 0x14 SET "thac0" = 0x14 INNER_PATCH_FILE ~thac0.2da~ BEGIN COUNT_2DA_ROWS 0x3 "info_2da_rows" FOR ("thac0_index1" = 0x1; "thac0_index1" < "info_2da_rows"; "thac0_index1" += 0x01) BEGIN READ_2DA_ENTRY "thac0_index1" 0x0 0x3 ~thac0_table_name~ PATCH_IF (~%thac0_table_name%~ STRING_EQUAL_CASE ~MAGE~ ) THEN BEGIN PATCH_IF ("current_class" = 0x01) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "current_level" 0x3 "current_class_thac0" END PATCH_IF ("former_class" = 0x01) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "former_level" 0x3 "former_class_thac0" END END ELSE PATCH_IF (~%thac0_table_name%~ STRING_EQUAL_CASE ~FIGHTER~ ) THEN BEGIN PATCH_IF ("current_class" = 0x02) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "current_level" 0x3 "current_class_thac0" END PATCH_IF ("former_class" = 0x02) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "former_level" 0x3 "former_class_thac0" END END ELSE PATCH_IF (~%thac0_table_name%~ STRING_EQUAL_CASE ~CLERIC~ ) THEN BEGIN PATCH_IF ("current_class" = 0x03) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "current_level" 0x3 "current_class_thac0" END PATCH_IF ("former_class" = 0x03) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "former_level" 0x3 "former_class_thac0" END END ELSE PATCH_IF (~%thac0_table_name%~ STRING_EQUAL_CASE ~THIEF~ ) THEN BEGIN PATCH_IF ("current_class" = 0x04) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "current_level" 0x3 "current_class_thac0" END PATCH_IF ("former_class" = 0x04) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "former_level" 0x3 "former_class_thac0" END END ELSE PATCH_IF (~%thac0_table_name%~ STRING_EQUAL_CASE ~BARD~ ) THEN BEGIN PATCH_IF ("current_class" = 0x05) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "current_level" 0x3 "current_class_thac0" END PATCH_IF ("former_class" = 0x05) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "former_level" 0x3 "former_class_thac0" END END ELSE PATCH_IF (~%thac0_table_name%~ STRING_EQUAL_CASE ~PALADIN~ ) THEN BEGIN PATCH_IF ("current_class" = 0x06) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "current_level" 0x3 "current_class_thac0" END PATCH_IF ("former_class" = 0x06) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "former_level" 0x3 "former_class_thac0" END END ELSE PATCH_IF (~%thac0_table_name%~ STRING_EQUAL_CASE ~DRUID~ ) THEN BEGIN PATCH_IF ("current_class" = 0x0b) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "current_level" 0x3 "current_class_thac0" END PATCH_IF ("former_class" = 0x0b) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "former_level" 0x3 "former_class_thac0" END END ELSE PATCH_IF (~%thac0_table_name%~ STRING_EQUAL_CASE ~RANGER~ ) THEN BEGIN PATCH_IF ("current_class" = 0x0c) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "current_level" 0x3 "current_class_thac0" END PATCH_IF ("former_class" = 0x0c) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "former_level" 0x3 "former_class_thac0" END END ELSE PATCH_IF (~%thac0_table_name%~ STRING_EQUAL_CASE ~FIGHTER_MAGE~ ) THEN BEGIN PATCH_IF ("current_class" = 0x07) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "current_level" 0x3 "current_class_thac0" END PATCH_IF ("former_class" = 0x07) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "former_level" 0x3 "former_class_thac0" END END ELSE PATCH_IF (~%thac0_table_name%~ STRING_EQUAL_CASE ~FIGHTER_CLERIC~ ) THEN BEGIN PATCH_IF ("current_class" = 0x08) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "current_level" 0x3 "current_class_thac0" END PATCH_IF ("former_class" = 0x08) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "former_level" 0x3 "former_class_thac0" END END ELSE PATCH_IF (~%thac0_table_name%~ STRING_EQUAL_CASE ~FIGHTER_THIEF~ ) THEN BEGIN PATCH_IF ("current_class" = 0x09) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "current_level" 0x3 "current_class_thac0" END PATCH_IF ("former_class" = 0x09) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "former_level" 0x3 "former_class_thac0" END END ELSE PATCH_IF (~%thac0_table_name%~ STRING_EQUAL_CASE ~FIGHTER_MAGE_THIEF~ ) THEN BEGIN PATCH_IF ("current_class" = 0x0a) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "current_level" 0x3 "current_class_thac0" END PATCH_IF ("former_class" = 0x0a) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "former_level" 0x3 "former_class_thac0" END END ELSE PATCH_IF (~%thac0_table_name%~ STRING_EQUAL_CASE ~MAGE_THIEF~ ) THEN BEGIN PATCH_IF ("current_class" = 0x0d) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "current_level" 0x3 "current_class_thac0" END PATCH_IF ("former_class" = 0x0d) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "former_level" 0x3 "former_class_thac0" END END ELSE PATCH_IF (~%thac0_table_name%~ STRING_EQUAL_CASE ~CLERIC_MAGE~ ) THEN BEGIN PATCH_IF ("current_class" = 0x0e) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "current_level" 0x3 "current_class_thac0" END PATCH_IF ("former_class" = 0x0e) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "former_level" 0x3 "former_class_thac0" END END ELSE PATCH_IF (~%thac0_table_name%~ STRING_EQUAL_CASE ~CLERIC_THIEF~ ) THEN BEGIN PATCH_IF ("current_class" = 0x0f) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "current_level" 0x3 "current_class_thac0" END PATCH_IF ("former_class" = 0x0f) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "former_level" 0x3 "former_class_thac0" END END ELSE PATCH_IF (~%thac0_table_name%~ STRING_EQUAL_CASE ~FIGHTER_DRUID~ ) THEN BEGIN PATCH_IF ("current_class" = 0x10) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "current_level" 0x3 "current_class_thac0" END PATCH_IF ("former_class" = 0x10) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "former_level" 0x3 "former_class_thac0" END END ELSE PATCH_IF (~%thac0_table_name%~ STRING_EQUAL_CASE ~FIGHTER_MAGE_CLERIC~) THEN BEGIN PATCH_IF ("current_class" = 0x11) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "current_level" 0x3 "current_class_thac0" END PATCH_IF ("former_class" = 0x11) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "former_level" 0x3 "former_class_thac0" END END ELSE PATCH_IF (~%thac0_table_name%~ STRING_EQUAL_CASE ~CLERIC_RANGER~ ) THEN BEGIN PATCH_IF ("current_class" = 0x12) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "current_level" 0x3 "current_class_thac0" END PATCH_IF ("former_class" = 0x12) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "former_level" 0x3 "former_class_thac0" END END ELSE PATCH_IF (~%thac0_table_name%~ STRING_EQUAL_CASE ~MONK~ ) THEN BEGIN PATCH_IF ("current_class" = 0x14) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "current_level" 0x3 "current_class_thac0" END PATCH_IF ("former_class" = 0x14) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "former_level" 0x3 "former_class_thac0" END END ELSE PATCH_IF (~%thac0_table_name%~ STRING_EQUAL_CASE ~SORCERER~ ) THEN BEGIN PATCH_IF ("current_class" = 0x13) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "current_level" 0x3 "current_class_thac0" END PATCH_IF ("former_class" = 0x13) THEN BEGIN READ_2DA_ENTRY "thac0_index1" "former_level" 0x3 "former_class_thac0" END END END END SET "thac0" = ("current_class_thac0" < "former_class_thac0" ? "current_class_thac0" : "former_class_thac0") PATCH_IF ("thac0" != "creature_thac0") THEN BEGIN WRITE_BYTE 0x52 "thac0" PATCH_PRINT ~%SOURCE_FILE%'s THAC0 corrected from %creature_thac0% to %thac0%.~ END END // play with saving throws PATCH_IF ("current_level" > 0x00) THEN BEGIN SET "current_save_vs_death" = 0x14 SET "current_save_vs_wands" = 0x14 SET "current_save_vs_poly" = 0x14 SET "current_save_vs_breath" = 0x14 SET "current_save_vs_spell" = 0x14 SET "former_save_vs_death" = 0x14 SET "former_save_vs_wands" = 0x14 SET "former_save_vs_poly" = 0x14 SET "former_save_vs_breath" = 0x14 SET "former_save_vs_spell" = 0x14 SET "triple_save_vs_death" = 0x14 SET "triple_save_vs_wands" = 0x14 SET "triple_save_vs_poly" = 0x14 SET "triple_save_vs_breath" = 0x14 SET "triple_save_vs_spell" = 0x14 SET "racial_save_vs_death" = 0x00 SET "racial_save_vs_wands" = 0x00 SET "racial_save_vs_poly" = 0x00 SET "racial_save_vs_breath" = 0x00 SET "racial_save_vs_spell" = 0x00 PATCH_IF ("current_class_save" = 0x01) THEN BEGIN SPRINT ~current_saves_table~ ~savewiz.2da~ END ELSE PATCH_IF ("current_class_save" = 0x02) THEN BEGIN SPRINT ~current_saves_table~ ~savewar.2da~ END ELSE PATCH_IF ("current_class_save" = 0x03) THEN BEGIN SPRINT ~current_saves_table~ ~saveprs.2da~ END ELSE PATCH_IF ("current_class_save" = 0x04) THEN BEGIN SPRINT ~current_saves_table~ ~saverog.2da~ END ELSE PATCH_IF ("current_class_save" = 0x14) THEN BEGIN SPRINT ~current_saves_table~ ~savemonk.2da~ END PATCH_IF ("former_class_save" = 0x01 ) THEN BEGIN SPRINT ~former_saves_table~ ~savewiz.2da~ END ELSE PATCH_IF ("former_class_save" = 0x02 ) THEN BEGIN SPRINT ~former_saves_table~ ~savewar.2da~ END ELSE PATCH_IF ("former_class_save" = 0x03 ) THEN BEGIN SPRINT ~former_saves_table~ ~saveprs.2da~ END ELSE PATCH_IF ("former_class_save" = 0x04 ) THEN BEGIN SPRINT ~former_saves_table~ ~saverog.2da~ END ELSE PATCH_IF ("former_class_save" = 0x14 ) THEN BEGIN SPRINT ~former_saves_table~ ~savemonk.2da~ END INNER_PATCH_FILE ~%current_saves_table%~ BEGIN COUNT_2DA_ROWS 0x28 "info_2da_rows" FOR ("saves_table_index1" = 0x1; "saves_table_index1" < "info_2da_rows"; "saves_table_index1" += 0x1) BEGIN READ_2DA_ENTRY "saves_table_index1" 0x0 0x28 ~saving_throw_name~ PATCH_IF (~%saving_throw_name%~ STRING_EQUAL_CASE ~DEATH~ ) THEN BEGIN READ_2DA_ENTRY "saves_table_index1" "current_level" 0x28 "current_save_vs_death" END ELSE PATCH_IF (~%saving_throw_name%~ STRING_EQUAL_CASE ~WANDS~ ) THEN BEGIN READ_2DA_ENTRY "saves_table_index1" "current_level" 0x28 "current_save_vs_wands" END ELSE PATCH_IF (~%saving_throw_name%~ STRING_EQUAL_CASE ~POLY~ ) THEN BEGIN READ_2DA_ENTRY "saves_table_index1" "current_level" 0x28 "current_save_vs_poly" END ELSE PATCH_IF (~%saving_throw_name%~ STRING_EQUAL_CASE ~BREATH~) THEN BEGIN READ_2DA_ENTRY "saves_table_index1" "current_level" 0x28 "current_save_vs_breath" END ELSE PATCH_IF (~%saving_throw_name%~ STRING_EQUAL_CASE ~SPELL~ ) THEN BEGIN READ_2DA_ENTRY "saves_table_index1" "current_level" 0x28 "current_save_vs_spell" END END END INNER_PATCH_FILE ~%former_saves_table%~ BEGIN COUNT_2DA_ROWS 0x28 "info_2da_rows" FOR ("saves_table_index1" = 0x1; "saves_table_index1" < "info_2da_rows"; "saves_table_index1" += 0x1) BEGIN READ_2DA_ENTRY "saves_table_index1" 0x0 0x28 ~saving_throw_name~ PATCH_IF (~%saving_throw_name%~ STRING_EQUAL_CASE ~DEATH~ ) THEN BEGIN READ_2DA_ENTRY "saves_table_index1" "former_level" 0x28 "former_save_vs_death" END ELSE PATCH_IF (~%saving_throw_name%~ STRING_EQUAL_CASE ~WANDS~ ) THEN BEGIN READ_2DA_ENTRY "saves_table_index1" "former_level" 0x28 "former_save_vs_wands" END ELSE PATCH_IF (~%saving_throw_name%~ STRING_EQUAL_CASE ~POLY~ ) THEN BEGIN READ_2DA_ENTRY "saves_table_index1" "former_level" 0x28 "former_save_vs_poly" END ELSE PATCH_IF (~%saving_throw_name%~ STRING_EQUAL_CASE ~BREATH~) THEN BEGIN READ_2DA_ENTRY "saves_table_index1" "former_level" 0x28 "former_save_vs_breath" END ELSE PATCH_IF (~%saving_throw_name%~ STRING_EQUAL_CASE ~SPELL~ ) THEN BEGIN READ_2DA_ENTRY "saves_table_index1" "former_level" 0x28 "former_save_vs_spell" END END END SET "save_vs_death" = ("current_save_vs_death" < "former_save_vs_death" ? "current_save_vs_death" : "former_save_vs_death" ) SET "save_vs_wands" = ("current_save_vs_wands" < "former_save_vs_wands" ? "current_save_vs_wands" : "former_save_vs_wands" ) SET "save_vs_poly" = ("current_save_vs_poly" < "former_save_vs_poly" ? "current_save_vs_poly" : "former_save_vs_poly" ) SET "save_vs_breath" = ("current_save_vs_breath" < "former_save_vs_breath" ? "current_save_vs_breath" : "former_save_vs_breath") SET "save_vs_spell" = ("current_save_vs_spell" < "former_save_vs_spell" ? "current_save_vs_spell" : "former_save_vs_spell" ) PATCH_IF ("current_class" = 0x6) THEN BEGIN SET "save_vs_death" = (("save_vs_death" - 0x2) > 0x00 ? ("save_vs_death" - 0x2) : 0x1) SET "save_vs_wands" = (("save_vs_wands" - 0x2) > 0x00 ? ("save_vs_wands" - 0x2) : 0x1) SET "save_vs_poly" = (("save_vs_poly" - 0x2) > 0x00 ? ("save_vs_poly" - 0x2) : 0x1) SET "save_vs_breath" = (("save_vs_breath" - 0x2) > 0x00 ? ("save_vs_breath" - 0x2) : 0x1) SET "save_vs_spell" = (("save_vs_spell" - 0x2) > 0x00 ? ("save_vs_spell" - 0x2) : 0x1) END PATCH_IF (("current_class" = 0x0a) OR ("current_class" = 0x11)) THEN BEGIN PATCH_IF ("current_class" = 0x0a) THEN BEGIN SPRINT ~triple_class_save~ ~saverog.2da~ END ELSE PATCH_IF ("current_class" = 0x11) THEN BEGIN SPRINT ~triple_class_save~ ~saveprs.2da~ END INNER_PATCH_FILE ~%triple_class_save%~ BEGIN COUNT_2DA_ROWS 0x28 "info_2da_rows" FOR ("saves_table_index1" = 0x1; "saves_table_index1" < "info_2da_rows"; "saves_table_index1" += 0x1) BEGIN READ_2DA_ENTRY "saves_table_index1" 0x0 0x28 ~saving_throw_name~ PATCH_IF (~%saving_throw_name%~ STRING_EQUAL_CASE ~DEATH~ ) THEN BEGIN READ_2DA_ENTRY "saves_table_index1" "creature_level_c" 0x28 "triple_save_vs_death" END ELSE PATCH_IF (~%saving_throw_name%~ STRING_EQUAL_CASE ~WANDS~ ) THEN BEGIN READ_2DA_ENTRY "saves_table_index1" "creature_level_c" 0x28 "triple_save_vs_wands" END ELSE PATCH_IF (~%saving_throw_name%~ STRING_EQUAL_CASE ~POLY~ ) THEN BEGIN READ_2DA_ENTRY "saves_table_index1" "creature_level_c" 0x28 "triple_save_vs_poly" END ELSE PATCH_IF (~%saving_throw_name%~ STRING_EQUAL_CASE ~BREATH~) THEN BEGIN READ_2DA_ENTRY "saves_table_index1" "creature_level_c" 0x28 "triple_save_vs_breath" END ELSE PATCH_IF (~%saving_throw_name%~ STRING_EQUAL_CASE ~SPELL~ ) THEN BEGIN READ_2DA_ENTRY "saves_table_index1" "creature_level_c" 0x28 "triple_save_vs_spell" END END END SET "save_vs_death" = ("save_vs_death" < "triple_save_vs_death" ? "save_vs_death" : "triple_save_vs_death" ) SET "save_vs_wands" = ("save_vs_wands" < "triple_save_vs_wands" ? "save_vs_wands" : "triple_save_vs_wands" ) SET "save_vs_poly" = ("save_vs_poly" < "triple_save_vs_poly" ? "save_vs_poly" : "triple_save_vs_poly" ) SET "save_vs_breath" = ("save_vs_breath" < "triple_save_vs_breath" ? "save_vs_breath" : "triple_save_vs_breath") SET "save_vs_spell" = ("save_vs_spell" < "triple_save_vs_spell" ? "save_vs_spell" : "triple_save_vs_spell" ) END PATCH_IF (("creature_race" = 0x4) OR ("creature_race" = 0x5) OR ("creature_race" = 0x6)) THEN BEGIN PATCH_IF ("creature_race" = 0x6) THEN BEGIN SPRINT ~racial_savebonus_table~ ~savecng.2da~ END ELSE PATCH_IF (("creature_race" = 0x4) OR ("creature_race" = 0x5)) THEN BEGIN SPRINT ~racial_savebonus_table~ ~savecndh.2da~ END PATCH_IF (("constitution" > 0x00) AND ("constitution" < 0x1a)) THEN BEGIN INNER_PATCH_FILE ~%racial_savebonus_table%~ BEGIN COUNT_2DA_ROWS 0x19 "info_2da_rows" FOR ("saves_table_index1" = 0x1; "saves_table_index1" < "info_2da_rows"; "saves_table_index1" += 0x1) BEGIN READ_2DA_ENTRY "saves_table_index1" 0x0 0x19 ~saving_throw_name~ PATCH_IF (~%saving_throw_name%~ STRING_EQUAL_CASE ~DEATH~ ) THEN BEGIN READ_2DA_ENTRY "saves_table_index1" "constitution" 0x19 "racial_save_vs_death" END ELSE PATCH_IF (~%saving_throw_name%~ STRING_EQUAL_CASE ~WANDS~ ) THEN BEGIN READ_2DA_ENTRY "saves_table_index1" "constitution" 0x19 "racial_save_vs_wands" END ELSE PATCH_IF (~%saving_throw_name%~ STRING_EQUAL_CASE ~POLY~ ) THEN BEGIN READ_2DA_ENTRY "saves_table_index1" "constitution" 0x19 "racial_save_vs_poly" END ELSE PATCH_IF (~%saving_throw_name%~ STRING_EQUAL_CASE ~BREATH~) THEN BEGIN READ_2DA_ENTRY "saves_table_index1" "constitution" 0x19 "racial_save_vs_breath" END ELSE PATCH_IF (~%saving_throw_name%~ STRING_EQUAL_CASE ~SPELL~ ) THEN BEGIN READ_2DA_ENTRY "saves_table_index1" "constitution" 0x19 "racial_save_vs_spell" END END END END SET "save_vs_death" = (("save_vs_death" - "racial_save_vs_death" ) > 0x00 ? ("save_vs_death" - "racial_save_vs_death" ) : 0x1) SET "save_vs_wands" = (("save_vs_wands" - "racial_save_vs_wands" ) > 0x00 ? ("save_vs_wands" - "racial_save_vs_wands" ) : 0x1) SET "save_vs_poly" = (("save_vs_poly" - "racial_save_vs_poly" ) > 0x00 ? ("save_vs_poly" - "racial_save_vs_poly" ) : 0x1) SET "save_vs_breath" = (("save_vs_breath" - "racial_save_vs_breath") > 0x00 ? ("save_vs_breath" - "racial_save_vs_breath") : 0x1) SET "save_vs_spell" = (("save_vs_spell" - "racial_save_vs_spell" ) > 0x00 ? ("save_vs_spell" - "racial_save_vs_spell" ) : 0x1) END PATCH_IF ("save_vs_death_old" != "save_vs_death" ) THEN BEGIN WRITE_BYTE 0x0054 "save_vs_death" PATCH_PRINT ~%SOURCE_FILE%'s save versus death corrected from %save_vs_death_old% to %save_vs_death%.~ END PATCH_IF ("save_vs_wands_old" != "save_vs_wands" ) THEN BEGIN WRITE_BYTE 0x0055 "save_vs_wands" PATCH_PRINT ~%SOURCE_FILE%'s save versus wands corrected from %save_vs_wands_old% to %save_vs_wands%.~ END PATCH_IF ("save_vs_poly_old" != "save_vs_poly" ) THEN BEGIN WRITE_BYTE 0x0056 "save_vs_poly" PATCH_PRINT ~%SOURCE_FILE%'s save versus poly corrected from %save_vs_poly_old% to %save_vs_poly%.~ END PATCH_IF ("save_vs_breath_old" != "save_vs_breath") THEN BEGIN WRITE_BYTE 0x0057 "save_vs_breath" PATCH_PRINT ~%SOURCE_FILE%'s save versus breath corrected from %save_vs_breath_old% to %save_vs_breath%.~ END PATCH_IF ("save_vs_spell_old" != "save_vs_spell" ) THEN BEGIN WRITE_BYTE 0x0058 "save_vs_spell" PATCH_PRINT ~%SOURCE_FILE%'s save versus spell corrected from %save_vs_spell_old% to %save_vs_spell%.~ END END Link to comment
Guest Nythrun@work Posted January 8, 2007 Share Posted January 8, 2007 /* // lore! what is it good for? absolutely nothing! yeah! PATCH_IF ("current_level" > 0x00) THEN BEGIN SET "creature_lore" = 0x00 INNER_PATCH_FILE ~lore.2da~ BEGIN COUNT_2DA_ROWS 0x2 "info_2da_rows" FOR ("lore_index1" = 0x1; "lore_index1" < "info_2da_rows"; "lore_index1" += 0x01) BEGIN READ_2DA_ENTRY "lore_index1" 0x0 0x1 ~lore_index_name~ PATCH_IF (~lore_index_name~ STRING_EQUAL_CASE ~MAGE~ ) THEN BEGIN READ_2DA_ENTRY "lore_index1" 0x1 0x1 "mage_lore" END ELSE PATCH_IF (~lore_index_name~ STRING_EQUAL_CASE ~FIGHTER~) THEN BEGIN READ_2DA_ENTRY "lore_index1" 0x1 0x1 "fighter_lore" END ELSE PATCH_IF (~lore_index_name~ STRING_EQUAL_CASE ~CLERIC~ ) THEN BEGIN READ_2DA_ENTRY "lore_index1" 0x1 0x1 "cleric_lore" END ELSE PATCH_IF (~lore_index_name~ STRING_EQUAL_CASE ~THIEF~ ) THEN BEGIN READ_2DA_ENTRY "lore_index1" 0x1 0x1 "thief_lore" END ELSE PATCH_IF (~lore_index_name~ STRING_EQUAL_CASE ~BARD~ ) THEN BEGIN READ_2DA_ENTRY "lore_index1" 0x1 0x1 "bard_lore" END ELSE PATCH_IF (~lore_index_name~ STRING_EQUAL_CASE ~PALADIN~) THEN BEGIN READ_2DA_ENTRY "lore_index1" 0x1 0x1 "paladin_lore" END ELSE PATCH_IF (~lore_index_name~ STRING_EQUAL_CASE ~DRUID~ ) THEN BEGIN READ_2DA_ENTRY "lore_index1" 0x1 0x1 "druid_lore" END ELSE PATCH_IF (~lore_index_name~ STRING_EQUAL_CASE ~RANGER~ ) THEN BEGIN READ_2DA_ENTRY "lore_index1" 0x1 0x1 "ranger_lore" END END END PATCH_IF ("creature_class" = 0x01) THEN BEGIN SET "creature_lore" = ("mage_lore" * "current_level") END ELSE PATCH_IF ("creature_class" = 0x02) THEN BEGIN SET "creature_lore" = ("fighter_lore" * "current_level") END ELSE PATCH_IF ("creature_class" = 0x03) THEN BEGIN SET "creature_lore" = ("cleric_lore" * "current_level") END ELSE PATCH_IF ("creature_class" = 0x04) THEN BEGIN SET "creature_lore" = ("thief_lore" * "current_level") END ELSE PATCH_IF ("creature_class" = 0x05) THEN BEGIN SET "creature_lore" = ("bard_lore" * "current_level") END ELSE PATCH_IF ("creature_class" = 0x06) THEN BEGIN SET "creature_lore" = ("paladin_lore" * "current_level") END ELSE PATCH_IF ("creature_class" = 0x07) THEN BEGIN PATCH_IF (("creature_flags" BAND 0x00000008) = 0x08) THEN BEGIN SET "creature_lore" = ("fighter_lore" * "former_level") > ("mage_lore" * "current_level") ? ("fighter_lore" * "former_level") : ("mage_lore" * "current_level") END ELSE PATCH_IF (("creature_flags" BAND 0x00000010) = 0x10) THEN BEGIN SET "creature_lore" = ("fighter_lore" * "current_level") > ("mage_lore" * "former_level") ? ("fighter_lore" * "current_level") : ("mage_lore" * "former_level") END ELSE BEGIN SET "creature_lore" = ("fighter_lore" * "creature_level_a") > ("mage_lore" * "creature_level_b") ? ("fighter_lore" * "creature_level_a") : ("mage_lore" * "creature_level_b") END END ELSE PATCH_IF ("creature_class" = 0x08) THEN BEGIN PATCH_IF (("creature_flags" BAND 0x00000008) = 0x08) THEN BEGIN SET "creature_lore" = ("fighter_lore" * "former_level") > ("cleric_lore" * "current_level") ? ("fighter_lore" * "former_level") : ("cleric_lore" * "current_level") END ELSE PATCH_IF (("creature_flags" BAND 0x00000020) = 0x20) THEN BEGIN SET "creature_lore" = ("fighter_lore" * "current_level") > ("cleric_lore" * "former_level") ? ("fighter_lore" * "current_level") : ("cleric_lore" * "former_level") END ELSE BEGIN SET "creature_lore" = ("fighter_lore" * "creature_level_a") > ("cleric_lore" * "creature_level_b") ? ("fighter_lore" * "creature_level_a") : ("cleric_lore" * "creature_level_b") END END ELSE PATCH_IF ("creature_class" = 0x09) THEN BEGIN PATCH_IF (("creature_flags" BAND 0x00000008) = 0x08) THEN BEGIN SET "creature_lore" = ("fighter_lore" * "former_level") > ("thief_lore" * "current_level") ? ("fighter_lore" * "former_level") : ("thief_lore" * "current_level") END ELSE PATCH_IF (("creature_flags" BAND 0x00000040) = 0x40) THEN BEGIN SET "creature_lore" = ("fighter_lore" * "current_level") > ("thief_lore" * "former_level") ? ("fighter_lore" * "current_level") : ("thief_lore" * "former_level") END ELSE BEGIN SET "creature_lore" = ("fighter_lore" * "creature_level_a") > ("thief_lore" * "creature_level_b") ? ("fighter_lore" * "creature_level_a") : ("thief_lore" * "creature_level_b") END END ELSE PATCH_IF ("creature_class" = 0x0a) THEN BEGIN SET "creature_lore" = (("fighter_lore" * "creature_level_a") > ("mage_lore" * "creature_level_b") ? (("fighter_lore" * "creature_level_a") > ("thief_lore" * "creature_level_c") ? ("fighter_lore" * "creature_level_a") : ("thief_lore" * "creature_level_c")) : (("mage_lore" * "creature_level_b") > ("thief_lore" * "creature_level_c") ? ("mage_lore" * "creature_level_b") : ("thief_lore" * "creature_level_c"))) END ELSE PATCH_IF ("creature_class" = 0x0b) THEN BEGIN SET "creature_lore" = ("druid_lore" * "current_level") END ELSE PATCH_IF ("creature_class" = 0x0c) THEN BEGIN SET "creature_lore" = ("ranger_lore" * "current_level") END ELSE PATCH_IF ("creature_class" = 0x0d) THEN BEGIN PATCH_IF (("creature_flags" BAND 0x00000010) = 0x10) THEN BEGIN SET "creature_lore" = ("mage_lore" * "former_level") > ("thief_lore" * "current_level") ? ("mage_lore" * "former_level") : ("thief_lore" * "current_level") END ELSE PATCH_IF (("creature_flags" BAND 0x00000040) = 0x40) THEN BEGIN SET "creature_lore" = ("mage_lore" * "current_level") > ("thief_lore" * "former_level") ? ("mage_lore" * "current_level") : ("thief_lore" * "former_level") END ELSE BEGIN SET "creature_lore" = (("mage_lore" * "creature_level_a") > ("thief_lore" * "creature_level_b") ? ("mage_lore" * "creature_level_a") : ("thief_lore" * "creature_level_b")) END END ELSE PATCH_IF ("creature_class" = 0x0e) THEN BEGIN PATCH_IF (("creature_flags" BAND 0x00000040) = 0x40) THEN BEGIN SET "creature_lore" = ("cleric_lore" * "former_level") > ("mage_lore" * "current_level") ? ("cleric_lore" * "former_level") : ("mage_lore" * "current_level") END ELSE PATCH_IF (("creature_flags" BAND 0x00000010) = 0x10) THEN BEGIN SET "creature_lore" = ("cleric_lore" * "current_level") > ("mage_lore" * "former_level") ? ("cleric_lore" * "current_level") : ("mage_lore" * "former_level") END ELSE BEGIN SET "creature_lore" = (("cleric_lore" * "creature_level_a") > ("mage_lore" * "creature_level_b") ? ("cleric_lore" * "creature_level_a") : ("mage_lore" * "creature_level_b")) END ELSE PATCH_IF ("creature_class" = 0x0f) THEN BEGIN PATCH_IF (("creature_flags" BAND 0x00000020) = 0x20) THEN BEGIN SET "creature_lore" = ("cleric_lore" * "former_level") > ("thief_lore" * "current_level") ? ("cleric_lore" * "former_level") : ("thief_lore" * "current_level") END ELSE PATCH_IF (("creature_flags" BAND 0x00000040) = 0x40) THEN BEGIN SET "creature_lore" = ("cleric_lore" * "current_level") > ("thief_lore" * "former_level") ? ("cleric_lore" * "current_level") : ("thief_lore" * "former_level") END ELSE BEGIN SET "creature_lore" = (("cleric_lore" * "creature_level_a") > ("thief_lore" * "creature_level_b") ? ("cleric_lore" * "creature_level_a") : ("thief_lore" * "creature_level_b")) END END ELSE PATCH_IF ("creature_class" = 0x10) THEN BEGIN PATCH_IF (("creature_flags" BAND 0x00000008) = 0x08) THEN BEGIN SET "creature_lore" = ("fighter_lore" * "former_level") > ("druid_lore" * "current_level") ? ("fighter_lore" * "former_level") : ("druid_lore" * "current_level") END ELSE PATCH_IF (("creature_flags" BAND 0x00000080) = 0x80) THEN BEGIN SET "creature_lore" = ("fighter_lore" * "current_level") > ("druid_lore" * "former_level") ? ("fighter_lore" * "current_level") : ("druid_lore" * "former_level") END ELSE BEGIN SET "creature_lore" = (("fighter_lore" * "creature_level_a") > ("druid_lore" * "creature_level_b") ? ("fighter_lore" * "creature_level_a") : ("druid_lore" * "creature_level_b")) END END ELSE PATCH_IF ("creature_class" = 0x11) THEN BEGIN SET "creature_lore" = (("fighter_lore" * "creature_level_a") > ("mage_lore" * "creature_level_b") ? (("fighter_lore" * "creature_level_a") > ("cleric_lore" * "creature_level_c") ? ("fighter_lore" * "creature_level_a") : ("cleric_lore" * "creature_level_c")) : (("mage_lore" * "creature_level_b") > ("cleric_lore" * "creature_level_c") ? ("mage_lore" * "creature_level_b") : ("cleric_lore" * "creature_level_c"))) END ELSE PATCH_IF ("creature_class" = 0x12) THEN BEGIN PATCH_IF (("creature_flags" BAND 0x00000020) = 0x20) THEN BEGIN SET "creature_lore" = ("cleric_lore" * "former_level") > ("ranger_lore" * "current_level") ? ("cleric_lore" * "former_level") : ("ranger_lore" * "current_level") END ELSE PATCH_IF (("creature_flags" BAND 0x00000100) = 0x100) THEN BEGIN SET "creature_lore" = ("cleric_lore" * "current_level") > ("ranger_lore" * "former_level") ? ("cleric_lore" * "current_level") : ("ranger_lore" * "former_level") END ELSE BEGIN SET "creature_lore" = (("cleric_lore" * "creature_level_a") > ("ranger_lore" * "creature_level_b") ? ("cleric_lore" * "creature_level_a") : ("ranger_lore" * "creature_level_b")) END END ELSE PATCH_IF ("creature_class" = 0x13) THEN BEGIN SET "creature_lore" = ("mage_lore" * "current_level") END ELSE PATCH_IF ("creature_class" = 0x14) THEN BEGIN SET "creature_lore" = ("cleric_lore" * "current_level") END INNER_PATCH_FILE ~lorebon.2da~ BEGIN COUNT_2DA_ROWS 0x2 "total_2da_rows" FOR ("lore_bonus_index1" = 0x1; "lore_bonus_index1" < "total_2da_rows"; "lore_bonus_index1" += 0x01) BEGIN READ_2DA_ENTRY "lore_bonus_index1" 0x0 0x1 "stat" PATCH_IF ("stat" = "intelligence") THEN BEGIN READ_2DA_ENTRY "lore_bonus_index1" 0x1 0x1 "lore_bonus" SET "creature_lore" += "lore_bonus" END PATCH_IF ("stat" = "wisdom") THEN BEGIN READ_2DA_ENTRY "lore_bonus_index1" 0x1 0x1 "lore_bonus" SET "creature_lore" += "lore_bonus" END END SET "creature_lore" = (("creature_lore" > 0x00) ? (("creature_lore" < 0x64) ? "creature_lore" : 0x64) : 0x00) END PATCH_IF ("creature_lore_old" != "creature_lore") THEN BEGIN WRITE_BYTE 0x0066 "creature_lore" PATCH_PRINT ~%SOURCE_FILE%'s lore corrected from %creature_lore_old% to %creature_lore%.~ END END */ // rifle through known spells, winnow defective entries, and save the remainer as a block PATCH_IF ("known_spells_count" > 0x00) THEN BEGIN FOR ("known_spells_index1" = ("known_spells_offset" + (0x0c * "known_spells_count")); "known_spells_index1" > "known_spells_offset"; "known_spells_index1" -= 0x0c) BEGIN READ_LONG ("known_spells_index1" - 0x04) "known_spells_check1" ELSE 0xeeeeeeee PATCH_IF NOT ("known_spells_check1" = 0xeeeeeeee) THEN BEGIN SET "known_spells_index1" = "known_spells_offset" READ_ASCII "known_spells_offset" ~known_spells_list~ ("known_spells_count" * 0x0c) INNER_PATCH_SAVE ~revised_known_spells_list~ ~%known_spells_list%~ BEGIN FOR ("known_spells_index2" = ("known_spells_count" * 0x0c); "known_spells_index2" > 0x00; "known_spells_index2" -= 0x0c)BEGIN READ_ASCII ("known_spells_index2" - 0x0c) ~known_spells_check2~ PATCH_IF NOT (FILE_EXISTS_IN_GAME ~%known_spells_check2%.spl~) THEN BEGIN DELETE_BYTES ("known_spells_index2" - 0x0c) 0x0c SET "known_spells_count" -= 0x01 PATCH_PRINT ~%SOURCE_FILE% knows %known_spells_check2%.spl which does not exist in the game.~ END ELSE BEGIN INNER_PATCH_FILE ~%known_spells_check2%.spl~ BEGIN READ_SHORT 0x1c "spell_type" ELSE 0xeeee READ_LONG 0x34 "spell_level" ELSE 0xeeeeeeee READ_LONG 0x6e "lower_bound" ELSE 0xeeeeeeee END PATCH_IF (("spell_type" = 0xeeee) OR ("spell_level" = 0xeeeeeeee) OR ("lower_bound" = 0xeeeeeeee)) THEN BEGIN DELETE_BYTES ("known_spells_index2" - 0x0c) 0x0c SET "known_spells_count" -= 0x01 PATCH_PRINT ~%SOURCE_FILE% knows %known_spells_check2%.spl which is invalid or corrupt.~ END ELSE BEGIN WRITE_SHORT ("known_spells_index2" - 0x04) ("spell_level" - 0x01) PATCH_IF ("spell_type" = 0x01) THEN BEGIN WRITE_SHORT ("known_spells_index2" - 0x02) 0x01 END ELSE PATCH_IF ("spell_type" = 0x02) THEN BEGIN WRITE_SHORT ("known_spells_index2" - 0x02) 0x00 END ELSE PATCH_IF ("spell_type" = 0x04) THEN BEGIN WRITE_SHORT ("known_spells_index2" - 0x02) 0x02 END END END END END END ELSE BEGIN SET "known_spells_count" -= 0x01 PATCH_PRINT ~%SOURCE_FILE% is listed as knowing more spells than it actually does, reducing number.~ END END END // rifle through memorized spells, winnow defective entries, and save the remainder as a block. // also prepares for rewriting the spell memorization table SET "mdspi1" = 0x00 SET "mdspi2" = 0x00 SET "mdspi3" = 0x00 SET "mdspi4" = 0x00 SET "mdspi5" = 0x00 SET "mdspi6" = 0x00 SET "mdspi7" = 0x00 SET "maspi1" = 0x00 SET "maspi2" = 0x00 SET "maspi3" = 0x00 SET "maspi4" = 0x00 SET "maspi5" = 0x00 SET "maspi6" = 0x00 SET "maspi7" = 0x00 SET "maspi8" = 0x00 SET "maspi9" = 0x00 SET "mispi1" = 0x00 PATCH_IF ("memorized_spells_count" > 0x00) THEN BEGIN FOR ("memorized_spells_index1" = ("memorized_spells_offset" + ("memorized_spells_count" * 0x0c)); "memorized_spells_index1" > "memorized_spells_offset"; "memorized_spells_index1" -= 0x0c) BEGIN READ_LONG ("memorized_spells_index1" - 0x04) "memorized_spells_check1" ELSE 0xeeeeeeee PATCH_IF NOT ("memorized_spells_check1" = 0xeeeeeeee) THEN BEGIN SET "memorized_spells_index1" = "memorized_spells_offset" READ_ASCII "memorized_spells_offset" ~memorized_spells_list~ ("memorized_spells_count" * 0x0c) INNER_PATCH_SAVE ~revised_memorized_spells_list~ ~%memorized_spells_list%~ BEGIN FOR ("memorized_spells_index2" = ("memorized_spells_count" * 0x0c); "memorized_spells_index2" > 0x00; "memorized_spells_index2" -= 0x0c) BEGIN READ_ASCII ("memorized_spells_index2" - 0x0c) ~memorized_spells_check2~ PATCH_IF NOT (FILE_EXISTS_IN_GAME ~%memorized_spells_check2%.spl~) THEN BEGIN DELETE_BYTES ("memorized_spells_index2" - 0x0c) 0x0c SET "memorized_spells_count" -= 0x01 PATCH_PRINT ~%SOURCE_FILE% memorizes %memorized_spells_check2%.spl which does not exist in the game.~ END ELSE BEGIN INNER_PATCH_FILE ~%memorized_spells_check2%.spl~ BEGIN READ_SHORT 0x1c "spell_type" ELSE 0xeeee READ_LONG 0x34 "spell_level" ELSE 0xeeeeeeee END PATCH_IF (("spell_type" = 0xeeee) OR ("spell_level" = 0xeeeeeeee)) THEN BEGIN DELETE_BYTES ("memorized_spells_index2" - 0x0c) 0x0c SET "memorized_spells_count" -= 0x01 PATCH_PRINT ~%SOURCE_FILE% memorizes %memorized_spells_check2%.spl which is invalid or corrupt.~ END ELSE BEGIN PATCH_IF (("spell_type" < 0x00) OR ("spell_type" > 0x05)) THEN BEGIN DELETE_BYTES ("memorized_spells_index2" - 0x0c) 0x0c SET "memorized_spells_count" -= 0x01 PATCH_PRINT ~%SOURCE_FILE% memorizes %memorized_spells_check2%.spl which has an unrecognized type.~ END ELSE PATCH_IF ("spell_type" = 0x01) THEN BEGIN PATCH_IF (("spell_level" < 0x01) OR ("spell_level" > 0x09)) THEN BEGIN DELETE_BYTES ("memorized_spells_index2" - 0x0c) 0x0c SET "memorized_spells_count" -= 0x01 PATCH_PRINT ~%SOURCE_FILE% memorizes %memorized_spells_check2%.spl, a wizard spell of level %spell_level%.~ END END ELSE PATCH_IF ("spell_type" = 0x02) THEN BEGIN PATCH_IF (("spell_level" < 0x01) OR ("spell_level" > 0x07)) THEN BEGIN DELETE_BYTES ("memorized_spells_index2" - 0x0c) 0x0c SET "memorized_spells_count" -= 0x01 PATCH_PRINT ~%SOURCE_FILE% memorizes %memorized_spells_check2%.spl, a priest spell of level %spell_level%.~ END END ELSE BEGIN PATCH_IF ("spell_level" != 0x01) THEN BEGIN DELETE_BYTES ("memorized_spells_index2" - 0x0c) 0x0c SET "memorized_spells_count" -= 0x01 PATCH_PRINT ~%SOURCE_FILE% memorizes %memorized_spells_check2%.spl, an innate which is not level one.~ END END END END END FOR ("memorized_spells_index3" = 0x00; "memorized_spells_index3" < ("memorized_spells_count" * 0x0c); "memorized_spells_index3" += 0x0c) BEGIN READ_ASCII "memorized_spells_index3" ~memorized_spells_check3~ INNER_PATCH_FILE ~%memorized_spells_check3%.spl~ BEGIN READ_SHORT 0x1c "spell_type" READ_LONG 0x34 "spell_level" END PATCH_IF ("spell_type" = 0x02) THEN BEGIN PATCH_IF ("spell_level" = 0x01) THEN BEGIN SET "mdspi1" += 0x01 END ELSE PATCH_IF ("spell_level" = 0x02) THEN BEGIN SET "mdspi2" += 0x01 END ELSE PATCH_IF ("spell_level" = 0x03) THEN BEGIN SET "mdspi3" += 0x01 END ELSE PATCH_IF ("spell_level" = 0x04) THEN BEGIN SET "mdspi4" += 0x01 END ELSE PATCH_IF ("spell_level" = 0x05) THEN BEGIN SET "mdspi5" += 0x01 END ELSE PATCH_IF ("spell_level" = 0x06) THEN BEGIN SET "mdspi6" += 0x01 END ELSE PATCH_IF ("spell_level" = 0x07) THEN BEGIN SET "mdspi7" += 0x01 END END ELSE PATCH_IF ("spell_type" = 0x01) THEN BEGIN PATCH_IF ("spell_level" = 0x01) THEN BEGIN SET "maspi1" += 0x01 END ELSE PATCH_IF ("spell_level" = 0x02) THEN BEGIN SET "maspi2" += 0x01 END ELSE PATCH_IF ("spell_level" = 0x03) THEN BEGIN SET "maspi3" += 0x01 END ELSE PATCH_IF ("spell_level" = 0x04) THEN BEGIN SET "maspi4" += 0x01 END ELSE PATCH_IF ("spell_level" = 0x05) THEN BEGIN SET "maspi5" += 0x01 END ELSE PATCH_IF ("spell_level" = 0x06) THEN BEGIN SET "maspi6" += 0x01 END ELSE PATCH_IF ("spell_level" = 0x07) THEN BEGIN SET "maspi7" += 0x01 END ELSE PATCH_IF ("spell_level" = 0x08) THEN BEGIN SET "maspi8" += 0x01 END ELSE PATCH_IF ("spell_level" = 0x09) THEN BEGIN SET "maspi9" += 0x01 END END ELSE BEGIN SET "mispi1" += 0x01 END END END END ELSE BEGIN SET "memorized_spells_count" -= 0x01 PATCH_PRINT ~%SOURCE_FILE% lists more memorized spells than it actually has~ END END END // rebuild spell memorization table from the relevant .2das READ_SHORT ("spell_memorization_info_offset" + 0x100) "spell_memorization_info_entries_count_check1" ELSE 0xeeee READ_SHORT ("spell_memorization_info_offset" + 0x102) "innate_spells_1" ELSE 0x00 READ_SHORT ("spell_memorization_info_offset" + 0x106) "spell_memorization_info_entries_count_check2" ELSE 0xeeee READ_SHORT ("spell_memorization_info_offset" + 0x10e) "spell_memorization_info_entries_count_check3" ELSE 0xeeee PATCH_IF (("spell_memorization_info_entries_count" = 0x0011) AND ("spell_memorization_info_entries_count_check1" = 0x0000) AND ("spell_memorization_info_entries_count_check2" = 0x0002) AND ("spell_memorization_info_entries_count_check3" != 0xeeee)) THEN BEGIN READ_ASCII "spell_memorization_info_offset" ~spell_memorization_info_list~ (0x110) END ELSE BEGIN SET "spell_memorization_info_entries_count" = 0x11 INSERT_BYTES "spell_memorization_info_offset" 0x110 READ_ASCII "spell_memorization_info_offset" ~spell_memorization_info_list~ (0x110) DELETE_BYTES "spell_memorization_info_offset" 0x110 PATCH_PRINT ~Something is seriously wrong with %SOURCE_FILE%'s spell memorization table, rebuilding it from scratch.~ END INNER_PATCH_SAVE ~revised_spell_memorization_info_list~ ~%spell_memorization_info_list%~ BEGIN SET "divine_spells_1" = 0x00 SET "divine_spells_2" = 0x00 SET "divine_spells_3" = 0x00 SET "divine_spells_4" = 0x00 SET "divine_spells_5" = 0x00 SET "divine_spells_6" = 0x00 SET "divine_spells_7" = 0x00 SET "arcane_spells_1" = 0x00 SET "arcane_spells_2" = 0x00 SET "arcane_spells_3" = 0x00 SET "arcane_spells_4" = 0x00 SET "arcane_spells_5" = 0x00 SET "arcane_spells_6" = 0x00 SET "arcane_spells_7" = 0x00 SET "arcane_spells_8" = 0x00 SET "arcane_spells_9" = 0x00 SET "arcane_casting_level" = 0x00 SET "divine_casting_level" = 0x00 SPRINT ~arcane_spellcasting_2da~ ~nothing~ SPRINT ~divine_spellcasting_2da~ ~nothing~ PATCH_IF ("creature_class" = 0x01) THEN BEGIN // mage SET "arcane_casting_level" = "creature_level_a" SPRINT ~arcane_spellcasting_2da~ ~mxsplwiz.2da~ END ELSE PATCH_IF ("creature_class" = 0x02) THEN BEGIN // fighter END ELSE PATCH_IF ("creature_class" = 0x03) THEN BEGIN // cleric SET "divine_casting_level" = "creature_level_a" SPRINT ~divine_spellcasting_2da~ ~mxsplprs.2da~ END ELSE PATCH_IF ("creature_class" = 0x04) THEN BEGIN // thief END ELSE PATCH_IF ("creature_class" = 0x05) THEN BEGIN // bard SET "arcane_casting_level" = "creature_level_a" SPRINT ~arcane_spellcasting_2da~ ~mxsplbrd.2da~ END ELSE PATCH_IF ("creature_class" = 0x06) THEN BEGIN // paladin PATCH_IF NOT ("creature_kit" = 0x40050000) THEN BEGIN SET "divine_casting_level" = "creature_level_a" SPRINT ~divine_spellcasting_2da~ ~mxsplpal.2da~ END END ELSE PATCH_IF ("creature_class" = 0x07) THEN BEGIN // fighter_mage PATCH_IF NOT (("creature_flags" BAND 0x10) = 0x10) AND ("creature_level_a" < "creature_level_b")) THEN BEGIN SET "arcane_casting_level" = "creature_level_b" SPRINT ~arcane_spellcasting_2da~ ~mxsplwiz.2da~ END END ELSE PATCH_IF ("creature_class" = 0x08) THEN BEGIN // fighter_cleric PATCH_IF NOT (("creature_flags" BAND 0x20) = 0x20) AND ("creature_level_a" < "creature_level_b")) THEN BEGIN SET "divine_casting_level" = "creature_level_b" SPRINT ~divine_spellcasting_2da~ ~mxsplprs.2da~ END END ELSE PATCH_IF ("creature_class" = 0x09) THEN BEGIN // fighter_thief END ELSE PATCH_IF ("creature_class" = 0x0a) THEN BEGIN // fighter_mage_thief SET "arcane_casting_level" = "creature_level_b" SPRINT ~arcane_spellcasting_2da~ ~mxsplwiz.2da~ SPRINT ~divine_spellcasting_2da~ ~nothing~ END ELSE PATCH_IF ("creature_class" = 0x0b) THEN BEGIN // druid SET "divine_casting_level" = "creature_level_a" PATCH_IF (FILE_EXISTS_IN_GAME ~mxspldru.2da~) THEN BEGIN SPRINT ~divine_spellcasting_2da~ ~mxspldru.2da~ END ELSE BEGIN SPRINT ~divine_spellcasting_2da~ ~mxsplprs.2da~ END END ELSE PATCH_IF ("creature_class" = 0x0c) THEN BEGIN // ranger SET "divine_casting_level" = "creature_level_a" SPRINT ~divine_spellcasting_2da~ ~mxsplran.2da~ END ELSE PATCH_IF ("creature_class" = 0x0d) THEN BEGIN // mage_thief PATCH_IF NOT (("creature_flags" BAND 0x10) = 0x10) AND ("creature_level_a" < "creature_level_b")) THEN BEGIN SET "arcane_casting_level" = "creature_level_a" SPRINT ~arcane_spellcasting_2da~ ~mxsplwiz.2da~ END END ELSE PATCH_IF ("creature_class" = 0x0e) THEN BEGIN // cleric_mage SET "arcane_casting_level" = "creature_level_b" SET "divine_casting_level" = "creature_level_a" SPRINT ~arcane_spellcasting_2da~ ~mxsplwiz.2da~ SPRINT ~divine_spellcasting_2da~ ~mxsplprs.2da~ END ELSE PATCH_IF ("creature_class" = 0x0f) THEN BEGIN // cleric_thief PATCH_IF NOT (("creature_flags" BAND 0x20) = 0x20) AND ("creature_level_b" < "creature_level_a")) THEN BEGIN SET "divine_casting_level" = "creature_level_a" SPRINT ~divine_spellcasting_2da~ ~mxsplprs.2da~ END END ELSE PATCH_IF ("creature_class" = 0x10) THEN BEGIN // fighter_druid PATCH_IF NOT (("creature_flags" BAND 0x80) = 0x80) AND ("creature_level_a" < "creature_level_b")) THEN BEGIN SET "divine_casting_level" = "creature_level_b" PATCH_IF (FILE_EXISTS_IN_GAME ~mxspldru.2da~) THEN BEGIN SPRINT ~divine_spellcasting_2da~ ~mxspldru.2da~ END ELSE BEGIN SPRINT ~divine_spellcasting_2da~ ~mxsplprs.2da~ END END END ELSE PATCH_IF ("creature_class" = 0x11) THEN BEGIN // fighter_mage_cleric SET "arcane_casting_level" = "creature_level_b" SET "divine_casting_level" = "creature_level_c" SPRINT ~arcane_spellcasting_2da~ ~mxsplwiz.2da~ SPRINT ~divine_spellcasting_2da~ ~mxsplprs.2da~ END ELSE PATCH_IF ("creature_class" = 0x12) THEN BEGIN // cleric_ranger PATCH_IF NOT (("creature_flags" BAND 0x20) = 0x20) AND ("creature_level_b" < "creature_level_a")) THEN BEGIN SET "divine_casting_level" = "creature_level_a" SPRINT ~divine_spellcasting_2da~ ~mxsplprs.2da~ END ELSE BEGIN SET "divine_casting_level" = "creature_level_b" SPRINT ~divine_spellcasting_2da~ ~mxsplran.2da~ END END ELSE PATCH_IF ("creature_class" = 0x13) THEN BEGIN // sorcerer SET "arcane_casting_level" = "creature_level_a" SPRINT ~arcane_spellcasting_2da~ ~mxsplsrc.2da~ END ELSE PATCH_IF ("creature_class" = 0x14) THEN BEGIN // monk END PATCH_IF (("arcane_casting_level" > 0x00) AND (~arcane_spellcasting_2da~ STR_CMP ~nothing~)) THEN BEGIN INNER_PATCH_FILE ~%arcane_spellcasting_2da%~ BEGIN COUNT_2DA_ROWS 0x3 "info_2da_rows" FOR ("2da_column_index1" = 0x3; "2da_column_index1" < 0xa; "2da_column_index1" += 0x1) BEGIN COUNT_2DA_ROWS "2da_column_index1" "2da_column_index2" PATCH_IF ("2da_column_index2" > 0x00) THEN BEGIN SET "2da_columns" = "2da_column_index1" END ELSE BEGIN SET "2da_column_index1" = 0xa END END SET "2da_columns" -= 0x1 FOR ("2da_column_index3" = 0x1; "2da_column_index3" < "info_2da_rows"; "2da_column_index3" += 0x1) BEGIN READ_2DA_ENTRY "2da_column_index3" 0x0 0x3 "2da_casting_ability_level" PATCH_IF ("2da_casting_ability_level" = "arcane_casting_level") THEN BEGIN READ_2DA_ENTRY "2da_column_index3" 0x1 "2da_columns" "arcane_spells_1" READ_2DA_ENTRY "2da_column_index3" 0x2 "2da_columns" "arcane_spells_2" READ_2DA_ENTRY "2da_column_index3" 0x3 "2da_columns" "arcane_spells_3" PATCH_IF ("2da_columns" > 0x3) THEN BEGIN READ_2DA_ENTRY "2da_column_index3" 0x4 "2da_columns" "arcane_spells_4" PATCH_IF ("2da_columns" > 0x4) THEN BEGIN READ_2DA_ENTRY "2da_column_index3" 0x5 "2da_columns" "arcane_spells_5" PATCH_IF ("2da_columns" > 0x5) THEN BEGIN READ_2DA_ENTRY "2da_column_index3" 0x6 "2da_columns" "arcane_spells_6" PATCH_IF ("2da_columns" > 0x6) THEN BEGIN READ_2DA_ENTRY "2da_column_index3" 0x7 "2da_columns" "arcane_spells_7" PATCH_IF ("2da_columns" > 0x7) THEN BEGIN READ_2DA_ENTRY "2da_column_index3" 0x8 "2da_columns" "arcane_spells_8" PATCH_IF ("2da_columns" > 0x8) THEN BEGIN READ_2DA_ENTRY "2da_column_index3" 0x9 "2da_columns" "arcane_spells_9" END END END END END END SET "2da_column_index3" = "info_2da_rows" END END END PATCH_IF (("creature_class" = 0x01) OR ("creature_class" = 0x07) OR ("creature_class" = 0x0a) OR ("creature_class" = 0x0d)) THEN BEGIN PATCH_IF (("creature_kit" != 0x40000000) AND ("creature_kit" != 0x00000000)) THEN BEGIN SET "arcane_spells_1" = ("arcane_spells_1" > 0x00 ? "arcane_spells_1" + 0x01 : 0x00) SET "arcane_spells_2" = ("arcane_spells_2" > 0x00 ? "arcane_spells_2" + 0x01 : 0x00) SET "arcane_spells_3" = ("arcane_spells_3" > 0x00 ? "arcane_spells_3" + 0x01 : 0x00) SET "arcane_spells_4" = ("arcane_spells_4" > 0x00 ? "arcane_spells_4" + 0x01 : 0x00) SET "arcane_spells_5" = ("arcane_spells_5" > 0x00 ? "arcane_spells_5" + 0x01 : 0x00) SET "arcane_spells_6" = ("arcane_spells_6" > 0x00 ? "arcane_spells_6" + 0x01 : 0x00) SET "arcane_spells_7" = ("arcane_spells_7" > 0x00 ? "arcane_spells_7" + 0x01 : 0x00) SET "arcane_spells_8" = ("arcane_spells_8" > 0x00 ? "arcane_spells_8" + 0x01 : 0x00) SET "arcane_spells_9" = ("arcane_spells_9" > 0x00 ? "arcane_spells_9" + 0x01 : 0x00) END END END Link to comment
Guest Nythrun@work Posted January 8, 2007 Share Posted January 8, 2007 PATCH_IF (("divine_casting_level" > 0x00) AND (~divine_spellcasting_2da~ STR_CMP ~nothing~)) THEN BEGIN INNER_PATCH_FILE ~%divine_spellcasting_2da%~ BEGIN COUNT_2DA_ROWS 0x3 "info_2da_rows" FOR ("2da_column_index1" = 0x3; "2da_column_index1" < 0x8; "2da_column_index1" += 0x1) BEGIN COUNT_2DA_ROWS "2da_column_index1" "2da_column_index2" PATCH_IF ("2da_column_index2" > 0x00) THEN BEGIN SET "2da_columns" = "2da_column_index1" END ELSE BEGIN SET "2da_column_index1" = 0x8 END END SET "2da_columns" -= 0x1 FOR ("2da_column_index3" = 0x1; "2da_column_index3" < "info_2da_rows"; "2da_column_index3" += 0x1) BEGIN READ_2DA_ENTRY "2da_column_index3" 0x0 0x3 "2da_casting_ability_level" PATCH_IF ("2da_casting_ability_level" = "divine_casting_level") THEN BEGIN READ_2DA_ENTRY "2da_column_index3" 0x1 "2da_columns" "divine_spells_1" READ_2DA_ENTRY "2da_column_index3" 0x2 "2da_columns" "divine_spells_2" READ_2DA_ENTRY "2da_column_index3" 0x3 "2da_columns" "divine_spells_3" PATCH_IF ("2da_columns" > 0x3) THEN BEGIN READ_2DA_ENTRY "2da_column_index3" 0x4 "2da_columns" "divine_spells_4" PATCH_IF ("2da_columns" > 0x4) THEN BEGIN READ_2DA_ENTRY "2da_column_index3" 0x5 "2da_columns" "divine_spells_5" PATCH_IF ("2da_columns" > 0x5) THEN BEGIN READ_2DA_ENTRY "2da_column_index3" 0x6 "2da_columns" "divine_spells_6" PATCH_IF ("2da_columns" > 0x6) THEN BEGIN READ_2DA_ENTRY "2da_column_index3" 0x7 "2da_columns" "divine_spells_7" END END END END SET "2da_column_index3" = "info_2da_rows" END END END END // lots of warnings to let you know what's going on here READ_SHORT 0x0002 "divine_spells_1_old" PATCH_IF ("divine_spells_1_old" != "divine_spells_1") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s level 1 divine spells are being corrected from %divine_spells_1_old% to %divine_spells_1%~ END READ_SHORT 0x0004 "divine_spells_1_old" PATCH_IF ("divine_spells_1_old" != "divine_spells_1") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s adjusted level 1 divine spells are being corrected from %divine_spells_1_old% to %divine_spells_1%~ END READ_SHORT 0x0012 "divine_spells_2_old" PATCH_IF ("divine_spells_2_old" != "divine_spells_2") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s level 2 divine spells are being corrected from %divine_spells_2_old% to %divine_spells_2%~ END READ_SHORT 0x0014 "divine_spells_2_old" PATCH_IF ("divine_spells_2_old" != "divine_spells_2") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s adjusted level 2 divine spells are being corrected from %divine_spells_2_old% to %divine_spells_2%~ END READ_SHORT 0x0022 "divine_spells_3_old" PATCH_IF ("divine_spells_3_old" != "divine_spells_3") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s level 3 divine spells are being corrected from %divine_spells_3_old% to %divine_spells_3%~ END READ_SHORT 0x0024 "divine_spells_3_old" PATCH_IF ("divine_spells_3_old" != "divine_spells_3") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s adjusted level 3 divine spells are being corrected from %divine_spells_3_old% to %divine_spells_3%~ END READ_SHORT 0x0032 "divine_spells_4_old" PATCH_IF ("divine_spells_4_old" != "divine_spells_4") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s level 4 divine spells are being corrected from %divine_spells_4_old% to %divine_spells_4%~ END READ_SHORT 0x0034 "divine_spells_4_old" PATCH_IF ("divine_spells_4_old" != "divine_spells_4") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s adjusted level 4 divine spells are being corrected from %divine_spells_4_old% to %divine_spells_4%~ END READ_SHORT 0x0042 "divine_spells_5_old" PATCH_IF ("divine_spells_5_old" != "divine_spells_5") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s level 5 divine spells are being corrected from %divine_spells_5_old% to %divine_spells_5%~ END READ_SHORT 0x0044 "divine_spells_5_old" PATCH_IF ("divine_spells_5_old" != "divine_spells_5") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s adjusted level 5 divine spells are being corrected from %divine_spells_5_old% to %divine_spells_5%~ END READ_SHORT 0x0052 "divine_spells_6_old" PATCH_IF ("divine_spells_6_old" != "divine_spells_6") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s level 6 divine spells are being corrected from %divine_spells_6_old% to %divine_spells_6%~ END READ_SHORT 0x0054 "divine_spells_6_old" PATCH_IF ("divine_spells_6_old" != "divine_spells_6") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s adjusted level 6 divine spells are being corrected from %divine_spells_6_old% to %divine_spells_6%~ END READ_SHORT 0x0062 "divine_spells_7_old" PATCH_IF ("divine_spells_7_old" != "divine_spells_7") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s level 7 divine spells are being corrected from %divine_spells_7_old% to %divine_spells_7%~ END READ_SHORT 0x0064 "divine_spells_7_old" PATCH_IF ("divine_spells_7_old" != "divine_spells_7") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s adjusted level 7 divine spells are being corrected from %divine_spells_7_old% to %divine_spells_7%~ END READ_SHORT 0x0072 "arcane_spells_1_old" PATCH_IF ("arcane_spells_1_old" != "arcane_spells_1") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s level 1 arcane spells are being corrected from %arcane_spells_1_old% to %arcane_spells_1%~ END READ_SHORT 0x0074 "arcane_spells_1_old" PATCH_IF ("arcane_spells_1_old" != "arcane_spells_1") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s adjusted level 1 arcane spells are being corrected from %arcane_spells_1_old% to %arcane_spells_1%~ END READ_SHORT 0x0082 "arcane_spells_2_old" PATCH_IF ("arcane_spells_2_old" != "arcane_spells_2") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s level 2 arcane spells are being corrected from %arcane_spells_2_old% to %arcane_spells_2%~ END READ_SHORT 0x0084 "arcane_spells_2_old" PATCH_IF ("arcane_spells_2_old" != "arcane_spells_2") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s adjusted level 2 arcane spells are being corrected from %arcane_spells_2_old% to %arcane_spells_2%~ END READ_SHORT 0x0092 "arcane_spells_3_old" PATCH_IF ("arcane_spells_3_old" != "arcane_spells_3") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s level 3 arcane spells are being corrected from %arcane_spells_3_old% to %arcane_spells_3%~ END READ_SHORT 0x0094 "arcane_spells_3_old" PATCH_IF ("arcane_spells_3_old" != "arcane_spells_3") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s adjusted level 3 arcane spells are being corrected from %arcane_spells_3_old% to %arcane_spells_3%~ END READ_SHORT 0x00a2 "arcane_spells_4_old" PATCH_IF ("arcane_spells_4_old" != "arcane_spells_4") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s level 4 arcane spells are being corrected from %arcane_spells_4_old% to %arcane_spells_4%~ END READ_SHORT 0x00a4 "arcane_spells_4_old" PATCH_IF ("arcane_spells_4_old" != "arcane_spells_4") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s adjusted level 4 arcane spells are being corrected from %arcane_spells_4_old% to %arcane_spells_4%~ END READ_SHORT 0x00b2 "arcane_spells_5_old" PATCH_IF ("arcane_spells_5_old" != "arcane_spells_5") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s level 5 arcane spells are being corrected from %arcane_spells_5_old% to %arcane_spells_5%~ END READ_SHORT 0x00b4 "arcane_spells_5_old" PATCH_IF ("arcane_spells_5_old" != "arcane_spells_5") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s adjusted level 5 arcane spells are being corrected from %arcane_spells_5_old% to %arcane_spells_5%~ END READ_SHORT 0x00c2 "arcane_spells_6_old" PATCH_IF ("arcane_spells_6_old" != "arcane_spells_6") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s level 6 arcane spells are being corrected from %arcane_spells_6_old% to %arcane_spells_6%~ END READ_SHORT 0x00c4 "arcane_spells_6_old" PATCH_IF ("arcane_spells_6_old" != "arcane_spells_6") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s adjusted level 6 arcane spells are being corrected from %arcane_spells_6_old% to %arcane_spells_6%~ END READ_SHORT 0x00d2 "arcane_spells_7_old" PATCH_IF ("arcane_spells_7_old" != "arcane_spells_7") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s level 7 arcane spells are being corrected from %arcane_spells_7_old% to %arcane_spells_7%~ END READ_SHORT 0x00d4 "arcane_spells_7_old" PATCH_IF ("arcane_spells_7_old" != "arcane_spells_7") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s adjusted level 7 arcane spells are being corrected from %arcane_spells_7_old% to %arcane_spells_7%~ END READ_SHORT 0x00e2 "arcane_spells_8_old" PATCH_IF ("arcane_spells_8_old" != "arcane_spells_8") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s level 8 arcane spells are being corrected from %arcane_spells_8_old% to %arcane_spells_8%~ END READ_SHORT 0x00e4 "arcane_spells_8_old" PATCH_IF ("arcane_spells_8_old" != "arcane_spells_8") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s adjusted level 8 arcane spells are being corrected from %arcane_spells_8_old% to %arcane_spells_8%~ END READ_SHORT 0x00f2 "arcane_spells_9_old" PATCH_IF ("arcane_spells_9_old" != "arcane_spells_9") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s level 9 arcane spells are being corrected from %arcane_spells_9_old% to %arcane_spells_9%~ END READ_SHORT 0x00f4 "arcane_spells_9_old" PATCH_IF ("arcane_spells_9_old" != "arcane_spells_9") THEN BEGIN PATCH_PRINT ~%SOURCE_FILE%'s adjusted level 9 arcane spells are being corrected from %arcane_spells_9_old% to %arcane_spells_9%~ END // spell memorization table gets rewritten here SET "memorized_spells_index_final" = 0x00 WRITE_SHORT 0x0000 0x0000 WRITE_SHORT 0x0002 "divine_spells_1" WRITE_SHORT 0x0004 "divine_spells_1" WRITE_SHORT 0x0006 0x0000 WRITE_LONG 0x0008 "memorized_spells_index_final" WRITE_LONG 0x000c "mdspi1" SET "memorized_spells_index_final" += "mdspi1" WRITE_SHORT 0x0010 0x0001 WRITE_SHORT 0x0012 "divine_spells_2" WRITE_SHORT 0x0014 "divine_spells_2" WRITE_SHORT 0x0016 0x0000 WRITE_LONG 0x0018 "memorized_spells_index_final" WRITE_LONG 0x001c "mdspi2" SET "memorized_spells_index_final" += "mdspi2" WRITE_SHORT 0x0020 0x0002 WRITE_SHORT 0x0022 "divine_spells_3" WRITE_SHORT 0x0024 "divine_spells_3" WRITE_SHORT 0x0026 0x0000 WRITE_LONG 0x0028 "memorized_spells_index_final" WRITE_LONG 0x002c "mdspi3" SET "memorized_spells_index_final" += "mdspi3" WRITE_SHORT 0x0030 0x0003 WRITE_SHORT 0x0032 "divine_spells_4" WRITE_SHORT 0x0034 "divine_spells_4" WRITE_SHORT 0x0036 0x0000 WRITE_LONG 0x0038 "memorized_spells_index_final" WRITE_LONG 0x003c "mdspi4" SET "memorized_spells_index_final" += "mdspi4" WRITE_SHORT 0x0040 0x0004 WRITE_SHORT 0x0042 "divine_spells_5" WRITE_SHORT 0x0044 "divine_spells_5" WRITE_SHORT 0x0046 0x0000 WRITE_LONG 0x0048 "memorized_spells_index_final" WRITE_LONG 0x004c "mdspi5" SET "memorized_spells_index_final" += "mdspi5" WRITE_SHORT 0x0050 0x0005 WRITE_SHORT 0x0052 "divine_spells_6" WRITE_SHORT 0x0054 "divine_spells_6" WRITE_SHORT 0x0056 0x0000 WRITE_LONG 0x0058 "memorized_spells_index_final" WRITE_LONG 0x005c "mdspi6" SET "memorized_spells_index_final" += "mdspi6" WRITE_SHORT 0x0060 0x0006 WRITE_SHORT 0x0062 "divine_spells_7" WRITE_SHORT 0x0064 "divine_spells_7" WRITE_SHORT 0x0066 0x0000 WRITE_LONG 0x0068 "memorized_spells_index_final" WRITE_LONG 0x006c "mdspi7" SET "memorized_spells_index_final" += "mdspi7" WRITE_SHORT 0x0070 0x0000 WRITE_SHORT 0x0072 "arcane_spells_1" WRITE_SHORT 0x0074 "arcane_spells_1" WRITE_SHORT 0x0076 0x0001 WRITE_LONG 0x0078 "memorized_spells_index_final" WRITE_LONG 0x007c "maspi1" SET "memorized_spells_index_final" += "maspi1" WRITE_SHORT 0x0080 0x0001 WRITE_SHORT 0x0082 "arcane_spells_2" WRITE_SHORT 0x0084 "arcane_spells_2" WRITE_SHORT 0x0086 0x0001 WRITE_LONG 0x0088 "memorized_spells_index_final" WRITE_LONG 0x008c "maspi2" SET "memorized_spells_index_final" += "maspi2" WRITE_SHORT 0x0090 0x0002 WRITE_SHORT 0x0092 "arcane_spells_3" WRITE_SHORT 0x0094 "arcane_spells_3" WRITE_SHORT 0x0096 0x0001 WRITE_LONG 0x0098 "memorized_spells_index_final" WRITE_LONG 0x009c "maspi3" SET "memorized_spells_index_final" += "maspi3" WRITE_SHORT 0x00a0 0x0003 WRITE_SHORT 0x00a2 "arcane_spells_4" WRITE_SHORT 0x00a4 "arcane_spells_4" WRITE_SHORT 0x00a6 0x0001 WRITE_LONG 0x00a8 "memorized_spells_index_final" WRITE_LONG 0x00ac "maspi4" SET "memorized_spells_index_final" += "maspi4" WRITE_SHORT 0x00b0 0x0004 WRITE_SHORT 0x00b2 "arcane_spells_5" WRITE_SHORT 0x00b4 "arcane_spells_5" WRITE_SHORT 0x00b6 0x0001 WRITE_LONG 0x00b8 "memorized_spells_index_final" WRITE_LONG 0x00bc "maspi5" SET "memorized_spells_index_final" += "maspi5" WRITE_SHORT 0x00c0 0x0005 WRITE_SHORT 0x00c2 "arcane_spells_6" WRITE_SHORT 0x00c4 "arcane_spells_6" WRITE_SHORT 0x00c6 0x0001 WRITE_LONG 0x00c8 "memorized_spells_index_final" WRITE_LONG 0x00cc "maspi6" SET "memorized_spells_index_final" += "maspi6" WRITE_SHORT 0x00d0 0x0006 WRITE_SHORT 0x00d2 "arcane_spells_7" WRITE_SHORT 0x00d4 "arcane_spells_7" WRITE_SHORT 0x00d6 0x0001 WRITE_LONG 0x00d8 "memorized_spells_index_final" WRITE_LONG 0x00dc "maspi7" SET "memorized_spells_index_final" += "maspi7" WRITE_SHORT 0x00e0 0x0007 WRITE_SHORT 0x00e2 "arcane_spells_8" WRITE_SHORT 0x00e4 "arcane_spells_8" WRITE_SHORT 0x00e6 0x0001 WRITE_LONG 0x00e8 "memorized_spells_index_final" WRITE_LONG 0x00ec "maspi8" SET "memorized_spells_index_final" += "maspi8" WRITE_SHORT 0x00f0 0x0008 WRITE_SHORT 0x00f2 "arcane_spells_9" WRITE_SHORT 0x00f4 "arcane_spells_9" WRITE_SHORT 0x00f6 0x0001 WRITE_LONG 0x00f8 "memorized_spells_index_final" WRITE_LONG 0x00fc "maspi9" SET "memorized_spells_index_final" += "maspi9" WRITE_SHORT 0x0100 0x0000 WRITE_SHORT 0x0102 "innate_spells_1" WRITE_SHORT 0x0104 "innate_spells_1" WRITE_SHORT 0x0106 0x0002 WRITE_LONG 0x0108 "memorized_spells_index_final" WRITE_LONG 0x010c "mispi1" END // what have you got in your pocketses? READ_LONG ("offset_to_item_slots" + 0x4c) "item_slot_check" ELSE 0xeeeeeeee PATCH_IF ("item_slot_check" != 0xeeeeeeee) THEN BEGIN READ_SHORT ("offset_to_item_slots" + 0x4c) "item_slot_check" PATCH_IF (("item_slot_check" = 0x0000) OR ("item_slot_check" = 0x0001) OR ("item_slot_check" = 0x0002) OR ("item_slot_check" = 0x0003) OR ("item_slot_check" = 0x03e8) OR ("item_slot_check" = 0xffe8) OR ("item_slot_check" = 0xffe9) OR ("item_slot_check" = 0xffea) OR ("item_slot_check" = 0xffff)) THEN BEGIN READ_ASCII "offset_to_item_slots" ~item_slots_list~ (0x50) END ELSE BEGIN WRITE_LONG ("offset_to_item_slots" + 0x4c) 0x0000 READ_ASCII "offset_to_item_slots" ~item_slots_list~ (0x50) PATCH_PRINT ~%SOURCE_FILE% has an unrecognized equpping slot, correcting.~ END END ELSE BEGIN INSERT_BYTES "offset_to_item_slots" 0x50 WRITE_LONG ("offset_to_item_slots" + 0x4c) 0xeeeeeeee READ_ASCII "offset_to_item_slots" ~item_slots_list~ (0x50) DELETE_BYTES "offset_to_item_slots" 0x50 PATCH_PRINT ~%SOURCE_FILE% has a corrupted or nonexistent item slot table, rebuilding from scratch.~ END INNER_PATCH_SAVE ~revised_item_slots_list~ ~%item_slots_list%~ BEGIN READ_LONG 0x4c "lower_bound" ELSE 0xeeeeeeee PATCH_IF ("lower_bound" = 0xeeeeeeee) THEN BEGIN FOR ("item_slot_index1" = 0x00; "item_slot_index1" < 0x4c; "item_slot_index1" += 0x02) BEGIN WRITE_SHORT "item_slot_index1" 0xffff END WRITE_LONG 0x4c 0x00 END END // item list is read, contraband removed PATCH_IF ("count_of_items" > 0x00) THEN BEGIN FOR ("count_of_items_index1" = ("offset_to_items" + ("count_of_items" * 0x14)); "count_of_items_index1" > "offset_to_items"; "count_of_items_index1" -= 0x14) BEGIN READ_LONG ("count_of_items_index1" - 0x04) "count_of_items_check" ELSE 0xeeeeeeee PATCH_IF ("count_of_items_check" != 0xeeeeeeee) THEN BEGIN READ_ASCII "offset_to_items" ~items_list~ ("count_of_items" * 0x14) INNER_PATCH_SAVE ~revised_items_list~ ~%items_list%~ BEGIN FOR ("count_of_items_index2" = ("count_of_items" * 0x14); "count_of_items_index2" > 0x00; "count_of_items_index2" -= 0x14) BEGIN READ_ASCII ("count_of_items_index2" - 0x14) ~carried_item_check1~ PATCH_IF (FILE_EXISTS_IN_GAME ~%carried_item_check1%.itm~) THEN BEGIN INNER_PATCH_FILE ~%carried_item_check1%.itm~ BEGIN READ_LONG 0x6e "lower_bound" ELSE 0xeeeeeeee END PATCH_IF ("lower_bound" = 0xeeeeeeee) THEN BEGIN DELETE_BYTES ("count_of_items_index2" - 0x14) 0x14 SET "count_of_items" -= 0x01 PATCH_PRINT ~%SOURCE_FILE% carries %carried_item_check1% which is invalid or corrupt.~ INNER_PATCH_SAVE ~revised_item_slots_list~ ~%revised_item_slots_list%~ BEGIN SET "deletable_threshold" = (("count_of_items_index2" / 0x14) - 0x01) FOR ("deletable_threshold_index" = 0x00; "deletable_threshold_index" < 0x4c; "deletable_threshold_index" += 0x02) BEGIN READ_SHORT "deletable_threshold_index" "equipped_item_number" PATCH_IF ("equipped_item_number" = "deletable_threshold") THEN BEGIN WRITE_SHORT "deletable_threshold_index" 0xffff END ELSE PATCH_IF ("equipped_item_number" > "deletable_threshold") THEN BEGIN WRITE_SHORT "deletable_threshold_index" ("equipped_item_number" - 0x01) END END END END END ELSE BEGIN DELETE_BYTES ("count_of_items_index2" - 0x14) 0x14 SET "count_of_items" -= 0x01 PATCH_PRINT ~%SOURCE_FILE% carries %carried_item_check1% which does not exist in game.~ INNER_PATCH_SAVE ~revised_item_slots_list~ ~%revised_item_slots_list%~ BEGIN SET "deletable_threshold" = ("count_of_items_index2" / 0x14) FOR ("deletable_threshold_index" = 0x00; "deletable_threshold_index" < 0x4c; "deletable_threshold_index" += 0x02) BEGIN READ_SHORT "deletable_threshold_index" "equipped_item_number" PATCH_IF ("equipped_item_number" = "deletable_threshold") THEN BEGIN WRITE_SHORT "deletable_threshold_index" 0xffff END ELSE PATCH_IF ("equipped_item_number" > "deletable_threshold") THEN BEGIN WRITE_SHORT "deletable_threshold_index" ("equipped_item_number" - 0x01) END END END END END END SET "count_of_items_index1" = "offset_to_items" END ELSE BEGIN SET "count_of_items" -= 0x01 PATCH_PRINT ~%SOURCE_FILE% is listed as having more items than it actually has.~ END END END // just the effects ma'am PATCH_IF ("count_of_effects" > 0x00) THEN BEGIN FOR ("count_of_effects_index1" = ("offset_to_effects" + ("count_of_effects" * 0x108)); "count_of_effects_index1" > "offset_to_effects"; "count_of_effects_index1" -= 0x108) BEGIN READ_LONG ("count_of_effects_index1" - 0x04) "count_of_effects_check" ELSE 0xeeeeeeee PATCH_IF ("count_of_effects_check" != 0xeeeeeeee) THEN BEGIN READ_ASCII "offset_to_effects" ~effects_list~ ("count_of_effects" * 0x108) INNER_PATCH_SAVE ~revised_effects_list~ ~%effects_list%~ BEGIN END SET "count_of_effects_index1" = "offset_to_effects" END ELSE BEGIN SET "count_of_effects" -= 0x01 PATCH_PRINT ~%SOURCE_FILE% is listed as having more embedded effects than it actually has.~ END END END // replace old info DELETE_BYTES 0x02d4 (%SOURCE_SIZE% - 0x02d4) SET "known_spells_offset" = 0x2d4 SET "spell_memorization_info_offset" = (0x2d4 + ("known_spells_count" * 0x0c)) SET "memorized_spells_offset" = ("spell_memorization_info_offset" + 0x110) SET "offset_to_effects" = ("memorized_spells_offset" + ("memorized_spells_count" * 0x0c)) SET "offset_to_items" = ("offset_to_effects" + ("count_of_effects" * 0x108)) SET "offset_to_item_slots" = ("offset_to_items" + ("count_of_items" * 0x14)) WRITE_LONG 0x02a0 "known_spells_offset" WRITE_LONG 0x02a4 "known_spells_count" WRITE_LONG 0x02a8 "spell_memorization_info_offset" WRITE_LONG 0x02ac "spell_memorization_info_entries_count" WRITE_LONG 0x02b0 "memorized_spells_offset" WRITE_LONG 0x02b4 "memorized_spells_count" WRITE_LONG 0x02b8 "offset_to_item_slots" WRITE_LONG 0x02bc "offset_to_items" WRITE_LONG 0x02c0 "count_of_items" WRITE_LONG 0x02c4 "offset_to_effects" WRITE_LONG 0x02c8 "count_of_effects" PATCH_IF ("known_spells_count" > 0x00) THEN BEGIN INSERT_BYTES "known_spells_offset" ("known_spells_count" * 0x0c) WRITE_ASCIIE "known_spells_offset" ~%revised_known_spells_list%~ END INSERT_BYTES "spell_memorization_info_offset" 0x110 WRITE_ASCIIE "spell_memorization_info_offset" ~%revised_spell_memorization_info_list%~ PATCH_IF ("memorized_spells_count" > 0x00) THEN BEGIN INSERT_BYTES "memorized_spells_offset" ("memorized_spells_count" * 0x0c) WRITE_ASCIIE "memorized_spells_offset" ~%revised_memorized_spells_list%~ END PATCH_IF ("count_of_effects" > 0x00) THEN BEGIN INSERT_BYTES "offset_to_effects" ("count_of_effects" * 0x108) WRITE_ASCIIE "offset_to_effects" ~%revised_effects_list%~ END PATCH_IF ("count_of_items" > 0x00) THEN BEGIN INSERT_BYTES "offset_to_items" ("count_of_items" * 0x14) WRITE_ASCIIE "offset_to_items" ~%revised_items_list%~ END INSERT_BYTES "offset_to_item_slots" 0x50 WRITE_ASCIIE "offset_to_item_slots" ~%revised_item_slots_list%~ END END Be back later. Link to comment
Guest Guest_Nythrun_* Posted January 9, 2007 Share Posted January 9, 2007 Hope this one is a little more helpful Tutu item research is on hold until I get a new modem, sadly. At least OMG HRAD DISK CRASH didn't eat the files Link to comment
cmorgan Posted January 10, 2007 Share Posted January 10, 2007 Nythrun, if I want to try to correct the creatures we distribute with the BG1 NPC Project, should I be trying the robust version? I think I would need some support materials to make it work... Link to comment
Guest Guest_Nythrun_* Posted January 10, 2007 Share Posted January 10, 2007 Hmm - you shouldn't need anything else, unless I put the wrong file on a floppy and posted it by mistake. You may want to hand-vett any changes though - ACTION_BASH_FOR ~somedirectorywhereyoukeepcreatures/temp~ ~^.+\.cre$~ BEGIN COPY ~somedirectorywhereyoukeepcreatures/temp/%BASH_FOR_FILE%~ ~somepostmodificationdirectory~ LAUNCH_PATCH_MACRO ~reorder_cre~ END or some such. If you happen to see any bugs or values that don't look right, please let me know Link to comment
Guest Guest_Nythrun_* Posted January 12, 2007 Share Posted January 12, 2007 Yikes, that was like a month old version that I posted. Still, I think it's the last completely independant one. Did notice one error - in the "item does not exist in game, deleting" bit, the "deleteable_threshold" variable needs to be set to ("count_of_items_index2" / 0x14) - 0x1 like it is in the corrupt item removal section. Didn't realize I hadn't fixed it there. Sorry, guest posting means I can't correct it, though it's right in the .tp2 I'm using Also, it would have been better to brace the whole bit after the "equipped_item_number" is read in a PATCH_IF ("equipped_item_number" != 0xffff) THEN BEGIN .... END. Shouldn't have any in game effect but it might confuse editors - also did that bit locally. Everything else looks okay, but that's a lot of code and lunch is short. Bleh - I hate debugging the same thing multiple times for the same bugs because of carelessness. Link to comment
Nythrun Posted January 13, 2007 Author Share Posted January 13, 2007 Yay, modem. Probably going to have to go back and blank out the tutu item assignation for now - if it's inconsistent enough with the file names to have sw1h04.itm with no underscore, I can't really write it blind. Link to comment
cmorgan Posted January 13, 2007 Share Posted January 13, 2007 to double check, in items, INNER_PATCH_SAVE ~revised_effects_list~ ~%effects_list%~ BEGIN END is correct, right? /Edit- actually, failed with a parse error (possibly my cut antd paste. It seems not to want to have some nesting here: [NYTHRUNSCRES.TP2] ERROR at line 1058 column 103-103 Near Text: ) Parsing.Parse_error ERROR: parsing [NYTHRUNSCRES.TP2]: Parsing.Parse_error ERROR: problem parsing TP file [NYTHRUNSCRES.TP2]: Parsing.Parse_error relevant code, lines 1057-1059: END ELSE PATCH_IF ("creature_class" = 0x07) THEN BEGIN // fighter_mage PATCH_IF NOT (("creature_flags" BAND 0x10) = 0x10) AND ("creature_level_a" < "creature_level_b")) THEN BEGIN SET "arcane_casting_level" = "creature_level_b" Full tp2 attached here: Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.