예제 #1
0
 static void Postfix(LanceConfiguratorPanel __instance, ref LanceConfiguration __result, LanceLoadoutSlot[] ___loadoutSlots)
 {
     try {
         if (CustomUnitsAPI.Detected())
         {
             return;
         }
         Fields.callsigns.Clear();
         LanceConfiguration lanceConfiguration = new LanceConfiguration();
         for (int i = 0; i < ___loadoutSlots.Length; i++)
         {
             LanceLoadoutSlot lanceLoadoutSlot = ___loadoutSlots[i];
             MechDef          mechDef          = null;
             PilotDef         pilotDef         = null;
             if (lanceLoadoutSlot.SelectedMech != null)
             {
                 mechDef = lanceLoadoutSlot.SelectedMech.MechDef;
             }
             if (lanceLoadoutSlot.SelectedPilot != null)
             {
                 pilotDef = lanceLoadoutSlot.SelectedPilot.Pilot.pilotDef;
             }
             if (mechDef != null && pilotDef != null)
             {
                 if (i < DropManager.DefaultMechSlots)
                 {
                     lanceConfiguration.AddUnit(__instance.playerGUID, mechDef, pilotDef);
                 }
                 else
                 {
                     //if (i >= BiggerDrops.settings.additinalMechSlots + Settings.DEFAULT_MECH_SLOTS) { break; }
                     Logger.M.TWL(0, "LanceConfiguratorPanel.CreateLanceConfiguration. Index:" + i + " additional slots border:" + (DropManager.AdditionalMechSlots() + DropManager.DefaultMechSlots) + " player slots border:" + (DropManager.AdditionalPlayerMechs() + DropManager.DefaultMechSlots));
                     if (i >= DropManager.AdditionalPlayerMechs() + DropManager.DefaultMechSlots)
                     {
                         Fields.callsigns.Add(pilotDef.Description.Callsign);
                         //EMPLOYER ID
                         Logger.M.WL(1, "adding to employer lance " + Settings.EMPLOYER_LANCE_GUID + " mech:" + mechDef.Description.Id + " pilot:" + pilotDef.Description.Id);
                         lanceConfiguration.AddUnit(Settings.EMPLOYER_LANCE_GUID, mechDef, pilotDef);
                     }
                     else
                     {
                         Logger.M.WL(1, "adding to player lance " + __instance.playerGUID + " mech:" + mechDef.Description.Id + " pilot:" + pilotDef.Description.Id);
                         lanceConfiguration.AddUnit(__instance.playerGUID, mechDef, pilotDef);
                     }
                 }
             }
         }
         __result = lanceConfiguration;
     } catch (Exception e) {
         Logger.LogError(e);
     }
 }