Beispiel #1
0
        public static bool CanLeaveSquad()
        {
            bool            result          = true;
            SquadController squadController = Service.Get <SquadController>();
            CurrentPlayer   currentPlayer   = Service.Get <CurrentPlayer>();
            Squad           currentSquad    = squadController.StateManager.GetCurrentSquad();

            if (currentSquad == null)
            {
                return(result);
            }
            SquadWarStatusType currentStatus = squadController.WarManager.GetCurrentStatus();

            if (currentStatus == SquadWarStatusType.PhaseCooldown)
            {
                return(result);
            }
            SquadMember squadMemberById = SquadUtils.GetSquadMemberById(currentSquad, currentPlayer.PlayerId);

            if (squadController.WarManager.IsMemberInWarParty(squadMemberById.MemberID) || squadController.WarManager.IsSquadMemberInWarOrMatchmaking(squadMemberById))
            {
                result = false;
            }
            return(result);
        }
Beispiel #2
0
        public static void SetSquadMemberRole(Squad squad, string memberId, SquadRole role)
        {
            SquadMember squadMemberById = SquadUtils.GetSquadMemberById(squad, memberId);

            if (squadMemberById != null)
            {
                squadMemberById.Role = role;
            }
        }
Beispiel #3
0
        public static void RemoveSquadMember(Squad squad, string memberId)
        {
            SquadMember squadMemberById = SquadUtils.GetSquadMemberById(squad, memberId);

            if (squadMemberById != null && squad != null)
            {
                squad.MemberList.Remove(squadMemberById);
                squad.BattleScore -= squadMemberById.Score;
                squad.MemberCount--;
            }
        }
Beispiel #4
0
        public static int GetDonatedWarTroopStorageUsedByCurrentPlayer()
        {
            SquadMemberWarData currentMemberWarData = Service.Get <SquadController>().WarManager.GetCurrentMemberWarData();

            if (currentMemberWarData != null)
            {
                List <SquadDonatedTroop> warTroops = currentMemberWarData.WarTroops;
                return(SquadUtils.GetDonatedTroopStorageUsed(warTroops));
            }
            return(0);
        }
Beispiel #5
0
        public static bool IsPlayerSquadWarTroopsAtMaxCapacity()
        {
            SquadMemberWarData currentMemberWarData = Service.Get <SquadController>().WarManager.GetCurrentMemberWarData();

            if (currentMemberWarData != null)
            {
                int donatedWarTroopStorageUsedByCurrentPlayer = SquadUtils.GetDonatedWarTroopStorageUsedByCurrentPlayer();
                int squadStorageCapacity = currentMemberWarData.BaseMap.GetSquadStorageCapacity();
                return(donatedWarTroopStorageUsedByCurrentPlayer >= squadStorageCapacity);
            }
            return(false);
        }
Beispiel #6
0
        public static bool IsTimeWithinSquadWarPhase(SquadWarData data, uint serverTime)
        {
            bool result = false;

            if (data != null && (ulong)serverTime >= (ulong)((long)data.StartTimeStamp) && (ulong)serverTime < (ulong)((long)data.CooldownEndTimeStamp))
            {
                SquadWarStatusType warStatus = SquadUtils.GetWarStatus(data, Service.Get <ServerAPI>().ServerTime);
                int num  = 0;
                int num2 = 0;
                if (SquadUtils.FillOutWarPhaseTimeRange(data, warStatus, out num, out num2))
                {
                    result = ((ulong)serverTime >= (ulong)((long)num) && (ulong)serverTime < (ulong)((long)num2));
                }
            }
            return(result);
        }
Beispiel #7
0
 public unsafe static long $Invoke7(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.GetDonatedWarTroopStorageUsedByCurrentPlayer()));
 }
Beispiel #8
0
 public unsafe static long $Invoke6(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.GetDonatedTroopStorageUsedByWorldOwner()));
 }
Beispiel #9
0
 public unsafe static long $Invoke22(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.SquadMeetsMatchmakingRequirements((SquadController)GCHandledObjects.GCHandleToObject(*args))));
 }
Beispiel #10
0
 public unsafe static long $Invoke18(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.IsPlayerMedalCountHigherThanSquadAvg((Squad)GCHandledObjects.GCHandleToObject(*args), *(int *)(args + 1))));
 }
Beispiel #11
0
 public unsafe static long $Invoke16(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.GetWorldOwnerSquadBuildingTroops()));
 }
Beispiel #12
0
 public unsafe static long $Invoke14(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.GetSquadDonatedTroopsFromObject(GCHandledObjects.GCHandleToObject(*args))));
 }
Beispiel #13
0
 public unsafe static long $Invoke10(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.GetFriendIdsInSquad(Marshal.PtrToStringUni(*(IntPtr *)args), (LeaderboardController)GCHandledObjects.GCHandleToObject(args[1]))));
 }
Beispiel #14
0
        public static int GetDonatedTroopStorageUsedByWorldOwner()
        {
            List <SquadDonatedTroop> worldOwnerSquadBuildingTroops = SquadUtils.GetWorldOwnerSquadBuildingTroops();

            return(SquadUtils.GetDonatedTroopStorageUsed(worldOwnerSquadBuildingTroops));
        }
Beispiel #15
0
 public static bool CanSendFreeTroopRequest(uint currentServerTime, uint troopRequestDate)
 {
     return(SquadUtils.GetTroopRequestTimeLeft(currentServerTime, troopRequestDate) <= 0);
 }
Beispiel #16
0
 public static int GetTroopRequestCrystalCost(uint currentServerTime, uint troopRequestDate)
 {
     return(GameUtils.SecondsToCrystals(SquadUtils.GetTroopRequestTimeLeft(currentServerTime, troopRequestDate)));
 }
Beispiel #17
0
 public unsafe static long $Invoke8(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.GetDonationCount((List <SquadMsg>)GCHandledObjects.GCHandleToObject(*args), Marshal.PtrToStringUni(*(IntPtr *)(args + 1)), Marshal.PtrToStringUni(*(IntPtr *)(args + 2)))));
 }
Beispiel #18
0
 public unsafe static long $Invoke12(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.GetReputationReqForSquadLevel(*(int *)args)));
 }
Beispiel #19
0
 public unsafe static long $Invoke9(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.GetFailureStringIdByScoutState((SquadWarScoutState)(*(int *)args), *(sbyte *)(args + 1) != 0)));
 }
Beispiel #20
0
        public static int GetDonatedTroopStorageUsedByCurrentPlayer()
        {
            List <SquadDonatedTroop> troops = Service.Get <SquadController>().StateManager.Troops;

            return(SquadUtils.GetDonatedTroopStorageUsed(troops));
        }
Beispiel #21
0
 public unsafe static long $Invoke11(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.GetFriendIdsString((List <string>)GCHandledObjects.GCHandleToObject(*args))));
 }
Beispiel #22
0
 public unsafe static long $Invoke0(long instance, long *args)
 {
     SquadUtils.AddSquadMember((Squad)GCHandledObjects.GCHandleToObject(*args), (SquadMember)GCHandledObjects.GCHandleToObject(args[1]));
     return(-1L);
 }
Beispiel #23
0
 public unsafe static long $Invoke13(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.GetRewardForWar(Marshal.PtrToStringUni(*(IntPtr *)args), (SquadMemberWarData)GCHandledObjects.GCHandleToObject(args[1]))));
 }
Beispiel #24
0
 public unsafe static long $Invoke1(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.CanLeaveSquad()));
 }
Beispiel #25
0
 public unsafe static long $Invoke15(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.GetSquadMemberById((Squad)GCHandledObjects.GCHandleToObject(*args), Marshal.PtrToStringUni(*(IntPtr *)(args + 1)))));
 }
Beispiel #26
0
 public unsafe static long $Invoke2(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.CanStartMatchmakingPrep((SquadController)GCHandledObjects.GCHandleToObject(*args), (BuildingLookupController)GCHandledObjects.GCHandleToObject(args[1]))));
 }
Beispiel #27
0
 public unsafe static long $Invoke17(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.IsPlayerInSquad(Marshal.PtrToStringUni(*(IntPtr *)args), (Squad)GCHandledObjects.GCHandleToObject(args[1]))));
 }
Beispiel #28
0
 public unsafe static long $Invoke3(long instance, long *args)
 {
     SquadUtils.ForceCloseSquadWarScreen();
     return(-1L);
 }
Beispiel #29
0
 public unsafe static long $Invoke19(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.IsPlayerSquadWarTroopsAtMaxCapacity()));
 }
Beispiel #30
0
 public unsafe static long $Invoke4(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.GetDonatedTroopStorageUsed((List <SquadDonatedTroop>)GCHandledObjects.GCHandleToObject(*args))));
 }