Ejemplo n.º 1
0
    private void MobileClientGarrisonDataRequestResultHandler(MobileClientGarrisonDataRequestResult msg)
    {
        PersistentFollowerData.ClearData();
        PersistentMissionData.ClearData();
        PersistentTalentData.ClearData();
        if (this.GarrisonDataResetStartedAction != null)
        {
            this.GarrisonDataResetStartedAction.Invoke();
        }
        GarrisonStatus.SetFaction(msg.PvpFaction);
        GarrisonStatus.SetGarrisonServerConnectTime(msg.ServerTime);
        GarrisonStatus.SetCurrencies(msg.GoldCurrency, msg.OilCurrency, msg.OrderhallResourcesCurrency);
        GarrisonStatus.SetCharacterName(msg.CharacterName);
        GarrisonStatus.SetCharacterLevel(msg.CharacterLevel);
        GarrisonStatus.SetCharacterClass(msg.CharacterClassID);
        uint num = 0u;

        while ((ulong)num < (ulong)((long)msg.Follower.GetLength(0)))
        {
            JamGarrisonFollower jamGarrisonFollower = msg.Follower[(int)((UIntPtr)num)];
            PersistentFollowerData.AddOrUpdateFollower(jamGarrisonFollower);
            bool flag = (jamGarrisonFollower.Flags & 8) != 0;
            if (flag && jamGarrisonFollower.Durability <= 0)
            {
                Debug.Log("Follower " + jamGarrisonFollower.GarrFollowerID + " has expired.");
                if (this.TroopExpiredAction != null)
                {
                    this.TroopExpiredAction.Invoke(jamGarrisonFollower);
                }
            }
            num += 1u;
        }
        uint num2 = 0u;

        while ((ulong)num2 < (ulong)((long)msg.Mission.GetLength(0)))
        {
            PersistentMissionData.AddMission(msg.Mission[(int)((UIntPtr)num2)]);
            num2 += 1u;
        }
        for (int i = 0; i < msg.Talent.GetLength(0); i++)
        {
            PersistentTalentData.AddOrUpdateTalent(msg.Talent[i]);
        }
        if (this.GarrisonDataResetFinishedAction != null)
        {
            this.GarrisonDataResetFinishedAction.Invoke();
        }
        if (this.FollowerDataChangedAction != null)
        {
            this.FollowerDataChangedAction.Invoke();
        }
    }