Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function dialog_AuctionHouseRNGHijack() -- replaces dialog 2625 in bank 1, allows forcing magicite at the auction
- local text = [[Looking for something special? Today's<NL>featured auction is just about to start!]]
- if (allowForceAuctionHouse) then
- local ticket = (bit.band(memory.readbyte(0x7E1EBB),0x40) > 0x00)
- local helmet = (bit.band(memory.readbyte(0x7E1EBB),0x80) > 0x00)
- local ruin = (bit.band(memory.readbyte(0x7E1E94),0x10) > 0x00)
- local pupu = (bit.band(memory.readbyte(0x7E1EAD),0x10) > 0x00)
- local golem = (bit.band(memory.readbyte(0x7E1EAD),0x20) > 0x00)
- local missingOptions = {}
- local pupuRNG = 0x9D
- local golemRNG = 0x9E
- -- in the world of ruin, they change if you have the opera ticket but no helmet..
- -- (if you don't have the ticket, the ticket is enforced over magicite)
- if (ruin) then
- if (ticket and not helmet) then
- if (not pupu and not golem) then
- pupuRNG = 0x9C
- golemRNG = 0x9D
- elseif (pupu) then
- golemRNG = 0x9D
- pupuRNG = nil
- elseif (golem) then
- golemRNG = 0x9D -- is swapped with pupu below, leave this here
- end
- end
- end
- -- if you own golem, pupu's rng byte becomes golem's
- if (golem and not pupu) then
- pupuRNG = golemRNG
- golemRNG = nil
- end
- -- if we don't have golem..
- if (golemRNG and not golem) then -- 'bought golem in jidoor' bit is 0x20 (not same as unlocked espers)
- missingOptions[#missingOptions + 1] = golemRNG -- valid rng to force golem
- end
- -- if we don't have pupu..
- if (pupuRNG and not pupu) then -- 'bought pupu in jidoor' bit is 0x10 (not same as unlocked espers)
- missingOptions[#missingOptions + 1] = pupuRNG -- valid rng to force pupu
- end
- if (#missingOptions > 0) then
- local randByte = 0x7E1F6D
- local newVal = missingOptions[math.random(1,#missingOptions+1)]
- if (newVal) then
- memory.writebyte(randByte,newVal)
- if (ruin and not ticket) then
- text = text..[[<NL>Our bosses are pushing this Opera<NL>Ticket really hard right now_]]
- elseif (newVal == pupuRNG) then
- text = text..[[<NL>We've got the amazing PuPu magicite<NL>on offer right now!]]
- elseif (newVal == golemRNG) then
- text = text..[[<NL>We've got the amazing Golem magicite<NL>on offer right now!]]
- end
- else
- newVal = math.random(0x00,0xFF) -- randomize the item on offer if it's not magicite
- memory.writebyte(randByte,newVal) -- prevents it from being magicite anyways if selected after magicite
- if (ruin and not ticket) then
- text = text..[[<NL>Today it's just assorted goods, but we can't<NL>sell magicite as long as we have a Ticket!]]
- else
- text = text..[[<NL>There's no magicite for offer right now, but<NL>talk to me again and I could change my mind!]]
- end
- end
- end
- end
- text = text..[[<EOP><c><bullet> (Join in the bidding.)<NL><c><bullet> (Maybe another time.)]]
- return text
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement