Пример #1
0
        public void Load(string GridName)
        {
            var FolderDirectory = ReferralCore.Instance.StoragePath;
            var myIdentity      = ((MyPlayer)Context.Player).Identity;
            var TargetIdentity  = myIdentity.IdentityId;
            var myCharacter     = myIdentity.Character;

            GridMethods methods = new GridMethods(FolderDirectory, GridName);
            Task        T       = new Task(() => methods.LoadGrid(GridName, myCharacter, TargetIdentity));

            T.Start();
        }
Пример #2
0
        public static bool Dostuff(User user, IMyPlayer player, bool promo, bool claimed)
        {
            try
            {
                var folderDirectory = Instance.StoragePath;
                var myIdentity      = ((MyPlayer)player).Identity;
                var targetIdentity  = myIdentity.IdentityId;
                var myCharacter     = myIdentity.Character;
                if (Instance.Config.GiveMoney)
                {
                    if (!FinancialService.GivePlayerCredits(targetIdentity, Instance.Config.CreditAmount))
                    {
                        return(false);
                    }
                }

                if (!Instance.Config.GiveGrid)
                {
                    return(true);
                }

                if (claimed)
                {
                    var  methods = new GridMethods(folderDirectory, Instance.Config.PlayerReferralGrid);
                    Task T       = new Task(() => methods.LoadGrid(Instance.Config.PlayerReferralGrid, myCharacter, targetIdentity));
                    T.Start();
                    return(true);
                }


                if (promo)
                {
                    var  methods = new GridMethods(folderDirectory, Instance.Config.PromotionRewardsGrid);
                    Task T       = new Task(() => methods.LoadGrid(Instance.Config.PromotionRewardsGrid, myCharacter, targetIdentity));
                    T.Start();
                    return(true);
                }

                if (user.ReferralByUser != null)
                {
                    if ((bool)user.ReferralByUser)
                    {
                        var  methods = new GridMethods(folderDirectory, Instance.Config.PlayerReferralGrid);
                        Task T       = new Task(() => methods.LoadGrid(Instance.Config.PlayerReferralGrid, myCharacter, targetIdentity));
                        T.Start();
                        return(true);
                    }
                }

                if (user.ReferralByCode == null)
                {
                    return(false);
                }
                {
                    if (!(bool)user.ReferralByCode)
                    {
                        return(false);
                    }
                    var  methods = new GridMethods(folderDirectory, Instance.Config.ServerReferralGrid);
                    Task T       = new Task(() => methods.LoadGrid(Instance.Config.ServerReferralGrid, myCharacter, targetIdentity));
                    T.Start();
                    return(true);
                }
            }
            catch (Exception e)
            {
                Log.Error("Do Stuff" + e);
            }

            return(false);
        }