Difference between revisions of "Item quantity increment for steal/break?"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
0018e9e8: 3c028019 lui r2,0x8019            |
 
 
  Parameters : r4 = Unit data pointer
 
  Parameters : r4 = Unit data pointer
 
               r5 = Item ID
 
               r5 = Item ID
Line 11: Line 10:
 
   - If = 99 : Add 25% of Item price to war funds
 
   - If = 99 : Add 25% of Item price to war funds
 
  --------------------------------------------------------------------------------
 
  --------------------------------------------------------------------------------
 +
0018e9e8: 3c028019 lui r2,0x8019            |
 
  0018e9ec: 8c42f5fc lw r2,-0x0a04(r2)        |{{f/load|<nowiki>r2 = Action Stata</nowiki>}}
 
  0018e9ec: 8c42f5fc lw r2,-0x0a04(r2)        |{{f/load|<nowiki>r2 = Action Stata</nowiki>}}
 
  0018e9f0: 27bdffe0 addiu r29,r29,-0x0020    |
 
  0018e9f0: 27bdffe0 addiu r29,r29,-0x0020    |
Line 59: Line 59:
 
  '''Battle.bin'''
 
  '''Battle.bin'''
 
  00180948: [[Learn_from_Crystal]] ??
 
  00180948: [[Learn_from_Crystal]] ??
  0018bf24: [[Main_Reaction_Routine_-_performs_ability_effects]]
+
  0018bf24: [[Attack_Finalisation_%26_Reaction_Flagging]]
  0018c1a8: [[Main_Reaction_Routine_-_performs_ability_effects]]
+
  0018c1a8: [[Attack_Finalisation_%26_Reaction_Flagging]]
 
  0018d498: [[Steal_Routine]]
 
  0018d498: [[Steal_Routine]]

Latest revision as of 13:01, 25 November 2022

Parameters : r4 = Unit data pointer
             r5 = Item ID

Returns : r2 = Item price / 4 if item is maxed
          r2 = 0x00 if not or nothing is done
          
             
Checks number of Items in inventory.
 - If < 99 : Add one Item
 - If = 99 : Add 25% of Item price to war funds
--------------------------------------------------------------------------------
0018e9e8: 3c028019 lui r2,0x8019            |
0018e9ec: 8c42f5fc lw r2,-0x0a04(r2)        |r2 = Action Stata
0018e9f0: 27bdffe0 addiu r29,r29,-0x0020    |
0018e9f4: afb10014 sw r17,0x0014(r29)       |
0018e9f8: 00808821 addu r17,r4,r0           |r17 = Targeted Unit Data pointer
0018e9fc: afbf0018 sw r31,0x0018(r29)       |
0018ea00: 1440000a bne r2,r0,0x0018ea2c     #If Action is being Executed /Else Branch to jump to END (r2 = 0x00)
0018ea04: afb00010 sw r16,0x0010(r29)           |
0018ea08: 922201ba lbu r2,0x01ba(r17)           |r2 = Targeted Unit modified ENTD flags
0018ea0c: 00000000 nop                          |
0018ea10: 30420030 andi r2,r2,0x0030            |r2 <> 0x00 If Targeted Unit is not in player Team
0018ea14: 14400005 bne r2,r0,0x0018ea2c         #If Targeted Unit is in player Team /Else Branch to jump to END (r2 = 0x00)
0018ea18: 30b000ff andi r16,r5,0x00ff           |r16 = Targeted Unit 0x1b2 (supposed to be last received attack - seems to be received Item here)
0018ea1c: 12000003 beq r16,r0,0x0018ea2c            #If Targeted Unit 0x1b2 <> 0x00 /Else Branch to jump to END (r2 = 0x00)
0018ea20: 340200ff ori r2,r0,0x00ff                     |r2 =0x0ff
0018ea24: 16020003 bne r16,r2,0x0018ea34                #If Targeted Unit 0x1b2 = 0x0ff /Else Avoid the jump to END
0018ea28: 02002021 addu r4,r16,r0                           |
0018ea2c: 08063aa0 j 0x0018ea80             #E   #E   #E    >>Jump to  END r2 = 0x00
0018ea30: 00001021 addu r2,r0,r0                            |r2 = 0x00
                                            #Else (All checks are OK)
0018ea34: 0c0178a2 jal 0x0005e288           |-->Get_Total_Equipment_Quantity
0018ea38: 34050001 ori r5,r0,0x0001         |r5 = 0x01
0018ea3c: 28420063 slti r2,r2,0x0063        |r2 = 0x01 if Quantity < 0x63 (99)
0018ea40: 1040000b beq r2,r0,0x0018ea70     #If Item Quantity is less than 99
0018ea44: 00001021 addu r2,r0,r0            |r2 = 0x00
0018ea48: 3c018006 lui r1,0x8006                |
0018ea4c: 00300821 addu r1,r1,r16               |
0018ea50: 902396e0 lbu r3,-0x6920(r1)           |r3 = Item quantity 0x800596e0 + Item offset
0018ea54: 00000000 nop                          |
0018ea58: 24630001 addiu r3,r3,0x0001           |r3 = Item quantity + 1
0018ea5c: 3c018006 lui r1,0x8006                |
0018ea60: 00300821 addu r1,r1,r16               |
0018ea64: a02396e0 sb r3,-0x6920(r1)            |store new item quantity
0018ea68: 08063aa0 j 0x0018ea80                 >>jump to end
0018ea6c: 00000000 nop                          |
                                            #Else (Item at 99)
0018ea70: 02202021 addu r4,r17,r0           |r4 = Targeted Unit Data pointer
0018ea74: 00002821 addu r5,r0,r0            |r5 = 0x00
0018ea78: 0c063aa6 jal 0x0018ea98           |-->Add_price_of_item_/_4_to_total_gil
0018ea7c: 02003021 addu r6,r16,r0           |r6 = Item ID
0018ea80: 8fbf0018 lw r31,0x0018(r29)       
0018ea84: 8fb10014 lw r17,0x0014(r29)       
0018ea88: 8fb00010 lw r16,0x0010(r29)       
0018ea8c: 27bd0020 addiu r29,r29,0x0020     
0018ea90: 03e00008 jr r31                   
0018ea94: 00000000 nop

Return locations

Battle.bin
00180948: Learn_from_Crystal ??
0018bf24: Attack_Finalisation_&_Reaction_Flagging
0018c1a8: Attack_Finalisation_&_Reaction_Flagging
0018d498: Steal_Routine