Exemplo n.º 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);
        }
Exemplo n.º 2
0
        public static void SetSquadMemberRole(Squad squad, string memberId, SquadRole role)
        {
            SquadMember squadMemberById = SquadUtils.GetSquadMemberById(squad, memberId);

            if (squadMemberById != null)
            {
                squadMemberById.Role = role;
            }
        }
Exemplo n.º 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--;
            }
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 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);
        }
Exemplo n.º 7
0
 public unsafe static long $Invoke7(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.GetDonatedWarTroopStorageUsedByCurrentPlayer()));
 }
Exemplo n.º 8
0
 public unsafe static long $Invoke6(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.GetDonatedTroopStorageUsedByWorldOwner()));
 }
Exemplo n.º 9
0
 public unsafe static long $Invoke22(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.SquadMeetsMatchmakingRequirements((SquadController)GCHandledObjects.GCHandleToObject(*args))));
 }
Exemplo n.º 10
0
 public unsafe static long $Invoke18(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.IsPlayerMedalCountHigherThanSquadAvg((Squad)GCHandledObjects.GCHandleToObject(*args), *(int *)(args + 1))));
 }
Exemplo n.º 11
0
 public unsafe static long $Invoke16(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.GetWorldOwnerSquadBuildingTroops()));
 }
Exemplo n.º 12
0
 public unsafe static long $Invoke14(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.GetSquadDonatedTroopsFromObject(GCHandledObjects.GCHandleToObject(*args))));
 }
Exemplo n.º 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]))));
 }
Exemplo n.º 14
0
        public static int GetDonatedTroopStorageUsedByWorldOwner()
        {
            List <SquadDonatedTroop> worldOwnerSquadBuildingTroops = SquadUtils.GetWorldOwnerSquadBuildingTroops();

            return(SquadUtils.GetDonatedTroopStorageUsed(worldOwnerSquadBuildingTroops));
        }
Exemplo n.º 15
0
 public static bool CanSendFreeTroopRequest(uint currentServerTime, uint troopRequestDate)
 {
     return(SquadUtils.GetTroopRequestTimeLeft(currentServerTime, troopRequestDate) <= 0);
 }
Exemplo n.º 16
0
 public static int GetTroopRequestCrystalCost(uint currentServerTime, uint troopRequestDate)
 {
     return(GameUtils.SecondsToCrystals(SquadUtils.GetTroopRequestTimeLeft(currentServerTime, troopRequestDate)));
 }
Exemplo n.º 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)))));
 }
Exemplo n.º 18
0
 public unsafe static long $Invoke12(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.GetReputationReqForSquadLevel(*(int *)args)));
 }
Exemplo n.º 19
0
 public unsafe static long $Invoke9(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.GetFailureStringIdByScoutState((SquadWarScoutState)(*(int *)args), *(sbyte *)(args + 1) != 0)));
 }
Exemplo n.º 20
0
        public static int GetDonatedTroopStorageUsedByCurrentPlayer()
        {
            List <SquadDonatedTroop> troops = Service.Get <SquadController>().StateManager.Troops;

            return(SquadUtils.GetDonatedTroopStorageUsed(troops));
        }
Exemplo n.º 21
0
 public unsafe static long $Invoke11(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.GetFriendIdsString((List <string>)GCHandledObjects.GCHandleToObject(*args))));
 }
Exemplo n.º 22
0
 public unsafe static long $Invoke0(long instance, long *args)
 {
     SquadUtils.AddSquadMember((Squad)GCHandledObjects.GCHandleToObject(*args), (SquadMember)GCHandledObjects.GCHandleToObject(args[1]));
     return(-1L);
 }
Exemplo n.º 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]))));
 }
Exemplo n.º 24
0
 public unsafe static long $Invoke1(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.CanLeaveSquad()));
 }
Exemplo n.º 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)))));
 }
Exemplo n.º 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]))));
 }
Exemplo n.º 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]))));
 }
Exemplo n.º 28
0
 public unsafe static long $Invoke3(long instance, long *args)
 {
     SquadUtils.ForceCloseSquadWarScreen();
     return(-1L);
 }
Exemplo n.º 29
0
 public unsafe static long $Invoke19(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.IsPlayerSquadWarTroopsAtMaxCapacity()));
 }
Exemplo n.º 30
0
 public unsafe static long $Invoke4(long instance, long *args)
 {
     return(GCHandledObjects.ObjectToGCHandle(SquadUtils.GetDonatedTroopStorageUsed((List <SquadDonatedTroop>)GCHandledObjects.GCHandleToObject(*args))));
 }