package mapped;

import net.runelite.mapping.ObfuscatedGetter;
import net.runelite.mapping.ObfuscatedName;
import net.runelite.mapping.ObfuscatedSignature;

@ObfuscatedName("lp")
public class class302 {
   @ObfuscatedName("wx")
   @ObfuscatedSignature(
      descriptor = "Lrg;"
   )
   static ArchiveDisk masterDisk;
   @ObfuscatedName("up")
   @ObfuscatedGetter(
      intValue = -616078041
   )
   static int field3119;

   @ObfuscatedName("bo")
   @ObfuscatedSignature(
      descriptor = "(Lnn;IIB)V",
      garbageValue = "47"
   )
   public static void method5908(Widget var0, int var1, int var2) {
      PlayerComposition var3 = var0.field3717;
      boolean var4 = var2 != var3.gender;
      var3.gender = var2;
      if(var4) {
         int var5;
         int var6;
         if(var3.gender == var1) {
            for(var5 = 0; var5 < PlayerComposition.equipmentIndices.length; ++var5) {
               var6 = PlayerComposition.equipmentIndices[var5];
               if(var3.equipment[var6] > 0 && var3.equipment[var6] < 512) {
                  var3.equipment[var6] = var3.field3596[var6];
               }
            }
         } else {
            label68: {
               if(var3.equipment[0] >= 512) {
                  boolean var8;
                  if(var3.equipment[0] < 512) {
                     var8 = false;
                  } else {
                     ItemComposition var7 = class214.method4226(var3.equipment[0] - 512);
                     var8 = var7.maleModel1 != class205.field2231.field2245 && var7.maleModel2 != class205.field2231.field2245;
                  }

                  if(!var8) {
                     break label68;
                  }
               }

               var3.equipment[class205.field2231.field2245] = 1;
            }

            for(var5 = 0; var5 < 7; ++var5) {
               var6 = PlayerComposition.equipmentIndices[var5];
               if(var3.equipment[var6] > 0 && var3.equipment[var6] < 512) {
                  class228.method4438_base(var2, var3.equipment, var5);
               }
            }
         }
      }

      var3.method6323_base();
   }

   @ObfuscatedName("nb")
   @ObfuscatedSignature(
      descriptor = "(Ldc;ZB)V",
      garbageValue = "-113"
   )
   static final void method5909(InterfaceParent var0, boolean var1) {
      Client.preCloseInterface(var0, var1);
      int var2 = var0.group;
      int var3 = (int)var0.key;
      var0.remove_base();
      if(var1) {
         HealthBarDefinition.widgetDefinition.method6283_base(var2);
      }

      for(IntegerNode var4 = (IntegerNode)Client.widgetFlags.method8977(); var4 != null; var4 = (IntegerNode)Client.widgetFlags.method8978()) {
         if((var4.key >> 48 & 65535L) == (long)var2) {
            var4.remove_base();
         }
      }

      Widget var5 = HealthBarDefinition.widgetDefinition.method6287(var3);
      if(var5 != null) {
         class159.method3423(var5);
      }

      if(Client.rootInterface != -1) {
         class514.runIntfCloseListeners_base(Client.rootInterface, 1);
      }

   }
}
