コード例 #1
0
 private void SetTroopSlotForPendingShipment(TroopSlot[] troopSlots, ulong shipmentDBID)
 {
     TroopSlot[] troopSlotArray = troopSlots;
     for (int i = 0; i < (int)troopSlotArray.Length; i++)
     {
         if (troopSlotArray[i].GetDBID() == shipmentDBID)
         {
             return;
         }
     }
     TroopSlot[] troopSlotArray1 = troopSlots;
     for (int j = 0; j < (int)troopSlotArray1.Length; j++)
     {
         TroopSlot troopSlot = troopSlotArray1[j];
         if (troopSlot.IsPendingCreate())
         {
             troopSlot.SetCharShipment(this.m_charShipmentRec.ID, shipmentDBID, 0, true, 0);
             return;
         }
     }
     TroopSlot[] troopSlotArray2 = troopSlots;
     for (int k = 0; k < (int)troopSlotArray2.Length; k++)
     {
         TroopSlot troopSlot1 = troopSlotArray2[k];
         if (troopSlot1.IsEmpty())
         {
             troopSlot1.SetCharShipment(this.m_charShipmentRec.ID, shipmentDBID, 0, true, 0);
             return;
         }
     }
 }
コード例 #2
0
 public void Recruit()
 {
     if (this.m_charShipmentRec.GarrFollowerID > 0)
     {
         TroopSlot   troopSlot            = null;
         TroopSlot[] componentsInChildren = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true);
         int         num = 0;
         while (num < (int)componentsInChildren.Length)
         {
             TroopSlot troopSlot1 = componentsInChildren[num];
             if (!troopSlot1.IsEmpty())
             {
                 num++;
             }
             else
             {
                 troopSlot = troopSlot1;
                 break;
             }
         }
         if (troopSlot == null)
         {
             return;
         }
         troopSlot.SetPendingCreate();
         this.UpdateRecruitButtonState();
     }
     LegionCompanionWrapper.CreateShipment(this.m_charShipmentRec.ID, 1);
     Main.instance.m_UISound.Play_RecruitTroop();
 }
コード例 #3
0
 private void SetTroopSlotForExistingFollower(TroopSlot[] troopSlots, WrapperGarrisonFollower follower)
 {
     if (follower.Durability <= 0)
     {
         return;
     }
     TroopSlot[] troopSlotArray = troopSlots;
     for (int i = 0; i < (int)troopSlotArray.Length; i++)
     {
         int ownedFollowerID = troopSlotArray[i].GetOwnedFollowerID();
         if (ownedFollowerID != 0 && ownedFollowerID == follower.GarrFollowerID)
         {
             return;
         }
     }
     TroopSlot[] troopSlotArray1 = troopSlots;
     for (int j = 0; j < (int)troopSlotArray1.Length; j++)
     {
         TroopSlot troopSlot = troopSlotArray1[j];
         if (troopSlot.IsCollected())
         {
             GarrFollowerRec record = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);
             int             num    = (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? record.AllianceIconFileDataID : record.HordeIconFileDataID);
             troopSlot.SetCharShipment(this.m_charShipmentRec.ID, (ulong)0, follower.GarrFollowerID, false, num);
             return;
         }
     }
     TroopSlot[] troopSlotArray2 = troopSlots;
     for (int k = 0; k < (int)troopSlotArray2.Length; k++)
     {
         TroopSlot troopSlot1 = troopSlotArray2[k];
         if (troopSlot1.IsPendingCreate())
         {
             GarrFollowerRec garrFollowerRec = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);
             int             num1            = (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? garrFollowerRec.AllianceIconFileDataID : garrFollowerRec.HordeIconFileDataID);
             troopSlot1.SetCharShipment(this.m_charShipmentRec.ID, (ulong)0, follower.GarrFollowerID, false, num1);
             return;
         }
     }
     TroopSlot[] troopSlotArray3 = troopSlots;
     for (int l = 0; l < (int)troopSlotArray3.Length; l++)
     {
         TroopSlot troopSlot2 = troopSlotArray3[l];
         if (troopSlot2.IsEmpty())
         {
             GarrFollowerRec record1 = StaticDB.garrFollowerDB.GetRecord(follower.GarrFollowerID);
             int             num2    = (GarrisonStatus.Faction() != PVP_FACTION.HORDE ? record1.AllianceIconFileDataID : record1.HordeIconFileDataID);
             troopSlot2.SetCharShipment(this.m_charShipmentRec.ID, (ulong)0, follower.GarrFollowerID, false, num2);
             return;
         }
     }
 }
コード例 #4
0
 private void HandleShipmentAdded(int charShipmentID, ulong shipmentDBID)
 {
     if (charShipmentID == this.m_charShipmentRec.ID)
     {
         TroopSlot[] componentsInChildren = this.m_troopSlotsRootObject.GetComponentsInChildren <TroopSlot>(true);
         TroopSlot[] troopSlotArray       = componentsInChildren;
         for (int i = 0; i < (int)troopSlotArray.Length; i++)
         {
             if (troopSlotArray[i].GetDBID() == shipmentDBID)
             {
                 return;
             }
         }
         TroopSlot[] troopSlotArray1 = componentsInChildren;
         for (int j = 0; j < (int)troopSlotArray1.Length; j++)
         {
             TroopSlot troopSlot = troopSlotArray1[j];
             if (troopSlot.IsPendingCreate())
             {
                 troopSlot.SetCharShipment(charShipmentID, shipmentDBID, 0, true, 0);
                 this.UpdateRecruitButtonState();
                 return;
             }
         }
         TroopSlot[] troopSlotArray2 = componentsInChildren;
         for (int k = 0; k < (int)troopSlotArray2.Length; k++)
         {
             TroopSlot troopSlot1 = troopSlotArray2[k];
             if (troopSlot1.IsEmpty())
             {
                 troopSlot1.SetCharShipment(charShipmentID, shipmentDBID, 0, true, 0);
                 this.UpdateRecruitButtonState();
                 return;
             }
         }
     }
 }