Difference between revisions of "Poach Inventory Routine"

From Final Fantasy Hacktics Wiki
Jump to navigation Jump to search
(Fifth edition.)
(Redo formatting.)
Line 1: Line 1:
  0018c680: 3c028019 lui r2,0x8019
+
  0018c680: 3c028019 lui r2,0x8019          
  0018c684: 8c42f5fc lw r2,-0x0a04(r2)
+
  0018c684: 8c42f5fc lw r2,-0x0a04(r2)      
  0018c688: 27bdffe8 addiu r29,r29,0xffe8
+
  0018c688: 27bdffe8 addiu r29,r29,0xffe8    
  0018c68c: afbf0014 sw r31,0x0014(r29)
+
  0018c68c: afbf0014 sw r31,0x0014(r29)      
  0018c690: 14400012 bne r2,r0,0x0018c6dc
+
IF r2 == 0:                                If word(0x8018f5fc) == 0
  0018c694: afb00010 sw r16,0x0010(r29)
+
  0018c690: 14400012 bne r2,r0,0x0018c6dc    
  0018c698: 3c028019 lui r2,0x8019
+
  0018c694: afb00010 sw r16,0x0010(r29)      
0018c69c: 8c422d90 lw r2,0x2d90(r2) Load Defender Current Action Data
+
  THEN:
0018c6a0: 00000000 nop
+
  0018c698: 3c028019 lui r2,0x8019          
0018c6a4: 94420010 lhu r2,0x0010(r2) Load Special Flags
+
  0018c69c: 8c422d90 lw r2,0x2d90(r2)         Load Target Current Action Data
0018c6a8: 00000000 nop
+
  0018c6a0: 00000000 nop                    
0018c6ac: 30420020 andi r2,r2,0x0020
+
  0018c6a4: 94420010 lhu r2,0x0010(r2)       Load Special Flags
0018c6b0: 10400024 beq r2,r0,0x0018c744 Branch if attack didn't trigger poach
+
  0018c6a8: 00000000 nop                    
0018c6b4: 00001021 addu r2,r0,r0
+
  0018c6ac: 30420020 andi r2,r2,0x0020      
0018c6b8: 3c038019 lui r3,0x8019
+
  0018c6b0: 10400024 beq r2,r0,0x0018c744     RETURN 0 if attack didn't trigger poach
0018c6bc: 8c632d98 lw r3,0x2d98(r3) Load Defender's Stats
+
  0018c6b4: 00001021 addu r2,r0,r0          
0018c6c0: 00000000 nop
+
    0018c6b8: 3c038019 lui r3,0x8019          
0018c6c4: 90620003 lbu r2,0x0003(r3) Load Defender's Job
+
    0018c6bc: 8c632d98 lw r3,0x2d98(r3)         Load Target's Stats
0018c6c8: 00000000 nop
+
    0018c6c0: 00000000 nop                    
0018c6cc: 2442ffa2 addiu r2,r2,0xffa2 Job ID - 0x5E
+
    0018c6c4: 90620003 lbu r2,0x0003(r3)       Load Target's Job
0018c6d0: 2c420030 sltiu r2,r2,0x0030
+
    0018c6c8: 00000000 nop
0018c6d4: 14400003 bne r2,r0,0x0018c6e4 Branch if 0x5E <= Job ID < 0x8E
+
    0018c6cc: 2442ffa2 addiu r2,r2,0xffa2       Job ID - 0x5E
0018c6d8: 34040100 ori r4,r0,0x0100 r4 = 0x100 or 256
+
    0018c6d0: 2c420030 sltiu r2,r2,0x0030      
  0018c6dc: 080631d1 j 0x0018c744 Jump to End
+
    0018c6d4: 14400003 bne r2,r0,0x0018c6e4     ROLL_POACH if is monster (0x5E <= JobID < 0x8E)
0018c6e0: 00001021 addu r2,r0,r0 r2 = 0x00
+
    0018c6d8: 34040100 ori r4,r0,0x0100         r4 = 0x100 (=256)
  0018c6e4: 90620003 lbu r2,0x0003(r3) Load Unit Job ID
+
  ELSE:
  0018c6e8: 3405001f ori r5,r0,0x001f r5 = 0x1f or 31
+
  0018c6dc: 080631d1 j 0x0018c744             RETURN 0
  0018c6ec: 0c017833 jal 0x0005e0cc Random chance = 31/256
+
  0018c6e0: 00001021 addu r2,r0,r0           r2 = 0x00
  0018c6f0: 2450ffa2 addiu r16,r2,0xffa2 Job ID - 0x5E
+
ROLL_POACH:
  0018c6f4: 10400006 beq r2,r0,0x0018c710
+
  0018c6e4: 90620003 lbu r2,0x0003(r3)       Load Unit Job ID
  0018c6f8: 00101040 sll r2,r16,0x01 Job ID * 2
+
  0018c6e8: 3405001f ori r5,r0,0x001f         r5 = 0x1f (=31)
  0018c6fc: 3c018006 lui r1,0x8006
+
  0018c6ec: 0c017833 jal 0x0005e0cc           Random chance = 31/256
0018c700: 00220821 addu r1,r1,r2
+
  0018c6f0: 2450ffa2 addiu r16,r2,0xffa2     Job ID - 0x5E
0018c704: 90236064 lbu r3,0x6064(r1) Load Common Poach
+
  0018c6f4: 10400006 beq r2,r0,0x0018c710    
0018c708: 080631c7 j 0x0018c71c
+
  0018c6f8: 00101040 sll r2,r16,0x01         Job ID * 2
0018c70c: 00000000 nop
+
  THEN:
  0018c710: 3c018006 lui r1,0x8006
+
  0018c6fc: 3c018006 lui r1,0x8006          
0018c714: 00220821 addu r1,r1,r2
+
  0018c700: 00220821 addu r1,r1,r2          
0018c718: 90236065 lbu r3,0x6065(r1) Load Rare Poach
+
  0018c704: 90236064 lbu r3,0x6064(r1)       Load Common Poach
  0018c71c: 3c018006 lui r1,0x8006
+
  0018c708: 080631c7 j 0x0018c71c            
  0018c720: 00230821 addu r1,r1,r3
+
  0018c70c: 00000000 nop                    
  0018c724: 90249494 lbu r4,-0x6b6c(r1) Load Poach Inventory
+
  ELSE:
  0018c728: 340200ff ori r2,r0,0x00ff
+
  0018c710: 3c018006 lui r1,0x8006          
  0018c72c: 10820005 beq r4,r2,0x0018c744 Branch if Inventory is full
+
  0018c714: 00220821 addu r1,r1,r2          
  0018c730: 00000000 nop
+
  0018c718: 90236065 lbu r3,0x6065(r1)       Load Rare Poach
0018c734: 24820001 addiu r2,r4,0x0001 Inventory + 1
+
# R3 = poached item
0018c738: 3c018006 lui r1,0x8006
+
  0018c71c: 3c018006 lui r1,0x8006          
0018c73c: 00230821 addu r1,r1,r3
+
  0018c720: 00230821 addu r1,r1,r3          
0018c740: a0229494 sb r2,-0x6b6c(r1) Store New Inventory
+
  0018c724: 90249494 lbu r4,-0x6b6c(r1)       Load Fur Shop Inventory for this item.
  0018c744: 8fbf0014 lw r31,0x0014(r29)
+
  0018c728: 340200ff ori r2,r0,0x00ff        
  0018c748: 8fb00010 lw r16,0x0010(r29)
+
  0018c72c: 10820005 beq r4,r2,0x0018c744     RETURN 0 if Fur Shop has 255 of this.
  0018c74c: 27bd0018 addiu r29,r29,0x0018
+
  0018c730: 00000000 nop                    
  0018c750: 03e00008 jr r31
+
  0018c734: 24820001 addiu r2,r4,0x0001       Inventory + 1
 +
  0018c738: 3c018006 lui r1,0x8006          
 +
  0018c73c: 00230821 addu r1,r1,r3          
 +
  0018c740: a0229494 sb r2,-0x6b6c(r1)       Store New Inventory
 +
RETURN:
 +
  0018c744: 8fbf0014 lw r31,0x0014(r29)      
 +
  0018c748: 8fb00010 lw r16,0x0010(r29)      
 +
  0018c74c: 27bd0018 addiu r29,r29,0x0018    
 +
  0018c750: 03e00008 jr r31                  
 
  0018c754: 00000000 nop
 
  0018c754: 00000000 nop

Revision as of 22:49, 28 April 2020

0018c680: 3c028019 lui r2,0x8019            
0018c684: 8c42f5fc lw r2,-0x0a04(r2)        
0018c688: 27bdffe8 addiu r29,r29,0xffe8     
0018c68c: afbf0014 sw r31,0x0014(r29)       
IF r2 == 0:                                 If word(0x8018f5fc) == 0
0018c690: 14400012 bne r2,r0,0x0018c6dc     
0018c694: afb00010 sw r16,0x0010(r29)       
THEN:
  0018c698: 3c028019 lui r2,0x8019            
  0018c69c: 8c422d90 lw r2,0x2d90(r2)         Load Target Current Action Data
  0018c6a0: 00000000 nop                      
  0018c6a4: 94420010 lhu r2,0x0010(r2)        Load Special Flags
  0018c6a8: 00000000 nop                      
  0018c6ac: 30420020 andi r2,r2,0x0020        
  0018c6b0: 10400024 beq r2,r0,0x0018c744     RETURN 0 if attack didn't trigger poach
  0018c6b4: 00001021 addu r2,r0,r0            
    0018c6b8: 3c038019 lui r3,0x8019            
    0018c6bc: 8c632d98 lw r3,0x2d98(r3)         Load Target's Stats
    0018c6c0: 00000000 nop                      
    0018c6c4: 90620003 lbu r2,0x0003(r3)        Load Target's Job
    0018c6c8: 00000000 nop
    0018c6cc: 2442ffa2 addiu r2,r2,0xffa2       Job ID - 0x5E
    0018c6d0: 2c420030 sltiu r2,r2,0x0030       
    0018c6d4: 14400003 bne r2,r0,0x0018c6e4     ROLL_POACH if is monster (0x5E <= JobID < 0x8E)
    0018c6d8: 34040100 ori r4,r0,0x0100         r4 = 0x100 (=256)
ELSE:
  0018c6dc: 080631d1 j 0x0018c744             RETURN 0
  0018c6e0: 00001021 addu r2,r0,r0            r2 = 0x00
ROLL_POACH:
0018c6e4: 90620003 lbu r2,0x0003(r3)        Load Unit Job ID
0018c6e8: 3405001f ori r5,r0,0x001f         r5 = 0x1f (=31)
0018c6ec: 0c017833 jal 0x0005e0cc           Random chance = 31/256
0018c6f0: 2450ffa2 addiu r16,r2,0xffa2      Job ID - 0x5E
0018c6f4: 10400006 beq r2,r0,0x0018c710     
0018c6f8: 00101040 sll r2,r16,0x01          Job ID * 2
THEN:
  0018c6fc: 3c018006 lui r1,0x8006            
  0018c700: 00220821 addu r1,r1,r2            
  0018c704: 90236064 lbu r3,0x6064(r1)        Load Common Poach
  0018c708: 080631c7 j 0x0018c71c             
  0018c70c: 00000000 nop                      
ELSE:
  0018c710: 3c018006 lui r1,0x8006            
  0018c714: 00220821 addu r1,r1,r2            
  0018c718: 90236065 lbu r3,0x6065(r1)        Load Rare Poach
# R3 = poached item
0018c71c: 3c018006 lui r1,0x8006            
0018c720: 00230821 addu r1,r1,r3            
0018c724: 90249494 lbu r4,-0x6b6c(r1)       Load Fur Shop Inventory for this item.
0018c728: 340200ff ori r2,r0,0x00ff         
0018c72c: 10820005 beq r4,r2,0x0018c744     RETURN 0 if Fur Shop has 255 of this.
0018c730: 00000000 nop                      
  0018c734: 24820001 addiu r2,r4,0x0001       Inventory + 1
  0018c738: 3c018006 lui r1,0x8006            
  0018c73c: 00230821 addu r1,r1,r3            
  0018c740: a0229494 sb r2,-0x6b6c(r1)        Store New Inventory
RETURN:
0018c744: 8fbf0014 lw r31,0x0014(r29)       
0018c748: 8fb00010 lw r16,0x0010(r29)       
0018c74c: 27bd0018 addiu r29,r29,0x0018     
0018c750: 03e00008 jr r31                   
0018c754: 00000000 nop