예제 #1
0
        public EntityHttpResponse Register(string email, string password, string username)
        {
            IUser         user  = null;
            StringBuilder error = new StringBuilder();

            user = _usermanager.Get(x => x.TagName == username);
            if (user != null)
            {
                error.AppendLine("Denne brugernavn er allerede i brug");
            }
            user = _usermanager.Get(x => x.Email == email);
            if (user != null)
            {
                error.AppendLine("Denne email er allerede i brug");
            }
            //todo: Check om Password kvalitet er god nok
            if (user != null)
            {
                return(new EntityHttpResponse(System.Net.HttpStatusCode.BadRequest, error.ToString(), false));
            }
            else
            {
                try
                {
                    User newuser = new User()
                    {
                        TagName  = username,
                        Email    = email,
                        Password = password,
                    };
                    newuser.Team = TeamMethods.CreateFinishedTeam(
                        newuser,
                        _teamManager,
                        _stadiumManager,
                        _playerManager,
                        _playerskillManager,
                        _nationManager
                        //_coachManager,
                        /*_coachSkillManager*/);


                    _usermanager.Add(newuser);
                    _usermanager.Save();
                }
                catch (Exception E)
                {
                    return(new EntityHttpResponse(System.Net.HttpStatusCode.InternalServerError, "Der kunne desværre ikke oprettes en forbindelse til databasen. Prøv venligst igen senere.", false));
                }
                return(new EntityHttpResponse(System.Net.HttpStatusCode.NoContent, null, true));
            }
        }
예제 #2
0
 public static void Postfix(ref Respawning.SpawnableTeamType __result)
 {
     try
     {
         if (!Instance.EventHandlers.HasReference)
         {
             TeamMethods.RefNextTeamSpawn(__result);
         }
     }
     catch (Exception e)
     {
         Log.Error(e);
     }
 }
    public TeamController(CityCheckContext context)
    {
        this.context = context;

        this.teamMethods = new TeamMethods(context);
    }
예제 #4
0
 public static void SetAdvancedTeamSubteam(this Player ply, AdvancedTeam team, SubTeam subclass, bool KeepInv = false)
 {
     TeamMethods.ChangeTeam(ply, team, subclass, KeepInv);
 }
예제 #5
0
        public void OnRespawning(RespawningTeamEventArgs ev)
        {
            if (ev.IsAllowed == false)
            {
                return;
            }

            // Need this, because ev.Players isn't working for methods
            List <Player> tempPlayers = new List <Player>(ev.Players);

            if (teamedPlayers.Count == 0)
            {
                TeamMethods.RemoveTeamReference();
                return;
            }

            if (ForcedTeam && HasReference)
            {
                ForcedTeam = false;

                ev.NextKnownTeam = chosenTeam.SpawnTypes.FirstOrDefault();

                if (assemblyUIU)
                {
                    if (Methods.IsUIU())
                    {
                        Methods.SpawneableUIUToFalse();
                    }
                }

                if (assemblySerpentHands)
                {
                    if (Methods.IsSerpentHand())
                    {
                        Methods.SpawneableSerpentToFalse();
                    }
                }
            }

            if (ev.NextKnownTeam == Respawning.SpawnableTeamType.NineTailedFox)
            {
                respawns++;
            }

            if (assemblyUIU)
            {
                if (Methods.IsUIU())
                {
                    if (plugin.Config.DominantPlugin)
                    {
                        Methods.SpawneableUIUToFalse();
                    }
                    else
                    {
                        TeamMethods.RemoveTeamReference();
                        coroutineHandle.Add(Timing.CallDelayed(0.2f, () =>
                        {
                            Extensions.SetAdvancedTeam(tempPlayers, Methods.UiUTeam);
                        }));
                        return;
                    }
                }
            }

            if (assemblySerpentHands == true)
            {
                if (Methods.IsSerpentHand())
                {
                    if (plugin.Config.DominantPlugin)
                    {
                        Methods.SpawneableSerpentToFalse();
                    }
                    else
                    {
                        TeamMethods.RemoveTeamReference();
                        coroutineHandle.Add(Timing.CallDelayed(0.2f, () =>
                        {
                            Extensions.SetAdvancedTeam(tempPlayers, Methods.SerpentHandsTeam);
                        }));
                        return;
                    }
                }
            }

            if (!HasReference)
            {
                TeamMethods.RefNextTeamSpawn(ev.NextKnownTeam);
                Log.Debug("Possible admin spawn due to No Team Reference yet", this.plugin.Config.Debug);
            }

            latestSpawn       = chosenTeam;
            spawnableTeamType = ev.NextKnownTeam;
            if (chosenTeam != null)
            {
                Log.Debug("Spawned " + chosenTeam.Name, this.plugin.Config.Debug);

                coroutineHandle.Add(Timing.CallDelayed(0.01f, () => TeamMethods.ChangePlysToTeam(tempPlayers, chosenTeam)));

                if (Rand.Next(0, 100) <= chosenTeam.CassieMessageChaosAnnounceChance && ev.NextKnownTeam == Respawning.SpawnableTeamType.ChaosInsurgency)
                {
                    Cassie.DelayedGlitchyMessage(chosenTeam.CassieMessageChaosMessage, 0, 0.25f, 0.25f);
                }
            }

            TeamMethods.RemoveTeamReference();
        }