Jump to content

Infinite Items


SimDing0

Recommended Posts

Right, I've coded up the patch for the items on Sim's list.

 

I also noticed that most of the items were unidentified and some have a faulty quantity/charges-flag, so I fixed that as well.

 

I also included:

 

THUMB

Infinite flag set for stocked item #33. History Of The Fateful Coin

LEHTINAN

Infinite flag set for stocked item #50. History Of The Fateful Coin

FFBART

Infinite flag set for stocked item #33. History Of The Fateful Coin

BDBART01

Infinite flag set for stocked item #33. History of the Fateful Coin

 

...as I don't think books are infinite in FR.

 

SARTEM01

Infinite flag set for stocked item #13. Elven Holy Water

 

...definitely a bug - number in stock is set to 20

 

PPSTOR01

Infinite flag set for stocked item #43. Dart +1

 

...enchanted.

 

SHOP03

Infinite flag set for stocked item #40. Bullet +1

 

...also enchanted.

 

Other than this, we have spears and healing-potions and other junk. I think we'll need a decision on what to do with these.

 

What about the uhinn01.sto? Should I fix it, yes or no?

 

Anyway, the coding so far:

 

// Monster code for disabling infinite items.
COPY_EXISTING ~25spell2.sto~ ~override~
             ~arled.sto~    ~override~
             ~hgkar01.sto~  ~override~
             ~trmer04a.sto~ ~override~
             ~trgeni01.sto~ ~override~
             ~type2.sto~    ~override~
             ~ribald.sto~   ~override~
             ~trmer04.sto~  ~override~
             ~uddrow23.sto~ ~override~
             ~ribald2.sto~  ~override~
             ~ribald3.sto~  ~override~
             ~ppstor01.sto~ ~override~
             ~thumb.sto~    ~override~
             ~lehtinan.sto~ ~override~
             ~ffbart.sto~   ~override~
             ~sartem01.sto~ ~override~
             ~bdbart01.sto~ ~override~
             ~shop03.sto~   ~override~
READ_LONG 0x34 "itm_off"
READ_LONG 0x38 "itm_num"
WHILE ("%itm_num%" > 0) BEGIN
  SET "itm_num" = ("%itm_num%" - 1)
  READ_ASCII ("%itm_off%" + (0x1c * "%itm_num%")) "item"
  PATCH_IF (("%item%" STRING_COMPARE_CASE "scrl2h" = 0) AND ("25spell2" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    READ_BYTE  ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) "itm_flags"
    WRITE_BYTE ("%itm_off%" + 0xA  + (0x1c * "%itm_num%")) 1 // Set quantity/charges of item to 1
    WRITE_BYTE ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) ("%itm_flags%" BOR 0b00000001) // Set item flags to identified
    WRITE_BYTE ("%itm_off%" + 0x14 + (0x1c * "%itm_num%")) 2 // Set number in stock to 2
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "sw1h44" = 0) AND ("arled" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    READ_BYTE  ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) "itm_flags"
    WRITE_BYTE ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) ("%itm_flags%" BOR 0b00000001) // Set item flags to identified
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "sw2h02" = 0) AND ("arled" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    READ_BYTE  ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) "itm_flags"
    WRITE_BYTE ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) ("%itm_flags%" BOR 0b00000001) // Set item flags to identified
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "halb02" = 0) AND ("arled" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    READ_BYTE  ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) "itm_flags"
    WRITE_BYTE ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) ("%itm_flags%" BOR 0b00000001) // Set item flags to identified
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "blun21" = 0) AND ("gorch" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    READ_BYTE  ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) "itm_flags"
    WRITE_BYTE ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) ("%itm_flags%" BOR 0b00000001) // Set item flags to identified
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "blun31" = 0) AND ("hgkar01" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    READ_BYTE  ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) "itm_flags"
    WRITE_BYTE ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) ("%itm_flags%" BOR 0b00000001) // Set item flags to identified
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "potn19" = 0) AND ("trmer04" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "sw2h11" = 0) AND ("trmer04a" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    READ_BYTE  ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) "itm_flags"
    WRITE_BYTE ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) ("%itm_flags%" BOR 0b00000001) // Set item flags to identified
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "sw1h44" = 0) AND ("trgeni01" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    READ_BYTE  ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) "itm_flags"
    WRITE_BYTE ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) ("%itm_flags%" BOR 0b00000001) // Set item flags to identified
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "sw2h02" = 0) AND ("trgeni01" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    READ_BYTE  ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) "itm_flags"
    WRITE_BYTE ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) ("%itm_flags%" BOR 0b00000001) // Set item flags to identified
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "halb02" = 0) AND ("trgeni01" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    READ_BYTE  ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) "itm_flags"
    WRITE_BYTE ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) ("%itm_flags%" BOR 0b00000001) // Set item flags to identified
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "chan05" = 0) AND ("type2" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    READ_BYTE  ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) "itm_flags"
    WRITE_BYTE ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) ("%itm_flags%" BOR 0b00000001) // Set item flags to identified
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "sw1h44" = 0) AND ("type2" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    READ_BYTE  ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) "itm_flags"
    WRITE_BYTE ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) ("%itm_flags%" BOR 0b00000001) // Set item flags to identified
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "potn19" = 0) AND ("type2" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "ring28" = 0) AND ("ribald" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    READ_BYTE  ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) "itm_flags"
    WRITE_BYTE ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) ("%itm_flags%" BOR 0b00000001) // Set item flags to identified
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "ring03" = 0) AND ("ribald" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    READ_BYTE  ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) "itm_flags"
    WRITE_BYTE ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) ("%itm_flags%" BOR 0b00000001) // Set item flags to identified
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "sw2h07" = 0) AND ("uddrow23" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    READ_BYTE  ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) "itm_flags"
    WRITE_BYTE ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) ("%itm_flags%" BOR 0b00000001) // Set item flags to identified
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "potn19" = 0) AND ("ribald2" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "bow10" = 0)  AND ("ribald3" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    WRITE_BYTE ("%itm_off%" + 0xA  + (0x1c * "%itm_num%")) 0 // Set quantity/charges of item to 0
    READ_BYTE  ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) "itm_flags"
    WRITE_BYTE ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) ("%itm_flags%" BOR 0b00000001) // Set item flags to identified
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "scrl9z" = 0) AND ("ribald3" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "sw2h09" = 0) AND ("ribald3" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    READ_BYTE  ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) "itm_flags"
    WRITE_BYTE ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) ("%itm_flags%" BOR 0b00000001) // Set item flags to identified
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "sw2h11" = 0) AND ("ribald3" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    READ_BYTE  ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) "itm_flags"
    WRITE_BYTE ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) ("%itm_flags%" BOR 0b00000001) // Set item flags to identified
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "dart02" = 0) AND ("ppstor01" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "book40" = 0) AND ("thumb" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "book40" = 0) AND ("lehtinan" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "book40" = 0) AND ("ffbart" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "miscau" = 0) AND ("sartem01" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "book40" = 0) AND ("bdbart01" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END ELSE
  PATCH_IF (("%item%" STRING_COMPARE_CASE "bull02" = 0) AND ("shop03" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
  END
END
BUT_ONLY_IF_IT_CHANGES

Link to comment

Well, isn't it part of the story that the Umar Hills people don't have anything for sale? Therefore, I'd suggest creating a separate STO file which doesn't sell things, and having buying/selling activated only when the Shade Lord has been dealt with.

Link to comment

Direction about what?

 

UHINN is used as a tavern/inn only (you can drink and sleep, but not buy/sell), so it doesn't really matter what you do. Trademeet merchants won't sell to you at all until the druid and djinni problems are dealt with, so there's no issue there.

 

As for the patch, I'm sure Cam will decide whether it can go in as written or if it should be improved. I'd suggest looking into ADD_STORE_ITEM, though, instead of all the WRITE_THISANDTHATs.

Link to comment

I believe UHINN should have the sales flag set. It seems likely to be an error that they create a store for it then forgot to set the flag.

 

For the others, I believe none of the items should be infinite. Most should be obvious (in a lot of cases, there are stock numbers already assigned), but ask if there are any specific problems.

Link to comment
Direction about what?

How 'bout the numerous questions I've wrote a little bit here and there? I can even quote it:

 

Other than this, we have spears and healing-potions and other junk. I think we'll need a decision on what to do with these.

 

What about the uhinn01.sto? Should I fix it, yes or no?

In both cases, there has just been some random thoughts and no real decisions. :)

 

UHINN is used as a tavern/inn only (you can drink and sleep, but not buy/sell), so it doesn't really matter what you do. Trademeet merchants won't sell to you at all until the druid and djinni problems are dealt with, so there's no issue there.

Let me get you another pair of quotes:

 

This is not Trademeet. This is Umar Hills.

Okay, so I made that one up. In any case;

 

UHINN01

Store selling flag not set, but there is stock.

There's a different bug cunningly concealed here. Set the flag so it sells stuff. Oh, except not having anything for sale is part of the whole Umar Hills quest thing isn't it?

It has stock, which in my eyes makes it an issue.

 

As for the patch, I'm sure Cam will decide whether it can go in as written or if it should be improved. I'd suggest looking into ADD_STORE_ITEM, though, instead of all the WRITE_THISANDTHATs.

I can manage to code without the need for supervision, thankyouverymuch.

 

As for ADD_STORE_ITEM, I'm really not sure how it would solve the problems with existing items in the store by adding new ones.

Link to comment

UHINN is Vincenzo in the Umar Hills. He does not offer items for sale, ever. That the STO file has items is simply due to the fact that BioWare used templates for all the stores. You can check every inn in the game: their STOs all have items to sell and item types to buy, but it will never be accessible in-game (which I why I said you can pretty much do what you want, since it won't make any difference in-game).

 

The Trademeet comment was intended to clear up the SConrad/SimDing0/Kish triangle of confusion, not to try and suggest that UHINN is somehow related to Trademeet (basically, I wanted to say there's no need to make extra STOs for Trademeet, since you can't actually buy anything until the problems are solved; even then their stock is limited, as appropriate, and they will both buy/sell items).

 

From memory, the criteria I used was:

- Any item with a stock of > 1 that was set to unlimited, change to limited

- Any unique magical item with an unlimited stock, change to limited

- Any place where a relevant value was 0 and there were values in the unknowns, change something (I can't remember if this was related to problems with the Identified flag, or the stock)

- All items, except for two cursed potions, should be sold identified

 

In a lot of places, this means no unlimited antidote potions, no unlimited darts, and so on. But that doesn't seem to be a very popular idea here, so I'd wait for the official word (or, just do whatever seems right).

 

I can manage to code without the need for supervision, thankyouverymuch.
I wasn't suggesting that Cam was going to be looking over your shoulder or that you'd need him to help you along, just that he'll either suggest changes, or change it himself when he goes to put it in.

 

As for ADD_STORE_ITEM, I'm really not sure how it would solve the problems

 

PATCH_IF (("%item%" STRING_COMPARE_CASE "scrl2h" = 0) AND ("25spell2" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
    READ_BYTE  ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) "itm_flags"
    WRITE_BYTE ("%itm_off%" + 0xA  + (0x1c * "%itm_num%")) 1 // Set quantity/charges of item to 1
    WRITE_BYTE ("%itm_off%" + 0x10 + (0x1c * "%itm_num%")) ("%itm_flags%" BOR 0b00000001) // Set item flags to identified
    WRITE_BYTE ("%itm_off%" + 0x14 + (0x1c * "%itm_num%")) 2 // Set number in stock to 2
    WRITE_BYTE ("%itm_off%" + 0x18 + (0x1c * "%itm_num%")) 0 // Set infinite flag to zero
END ELSE

becomes

PATCH_IF (("%item%" STRING_COMPARE_CASE "scrl2h" = 0) AND ("25spell2" STRING_COMPARE_CASE ~%SOURCE_RES%~ = 0)) BEGIN
   ADD_STORE_ITEM + ~SCRL2H~ #1 #1 #0 ~IDENTIFIED~ #2 ~LIMITED~
END ELSE

Or something similar (you don't really need to iterate through the items, just to check the STO name and that the relevant item reference exists in the STO).

Link to comment

Yes, it finds the item in the store, and then updates the values at that location.

 

I use it exclusively for this purpose, with great success (this is the reason I added support for the infinite supply value to WeiDU).

Link to comment

Something I'm wondering, is how much of a 'fix' is this over 'cool-but-not-a-fix'? I can see it being a fix for certain items which have unique descriptions, but I wouldn't classify it as a fix for non-unique description items. Non-uniques would include the wide variety of MagicItem+1, MagicItem+2, MagicItem+3, potions of healing, normal non-magical equipment.

 

Any item with a stock of > 1 that was set to unlimited, change to limited

While it might be cool to have merchants with limited items, I wouldn't classify all the unlimited items as bugs. Having values greater than 1 could also just be sloppy redundant coding.

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...