void UpdateAllowVisit() { if (!IsVisit || lvl == Server.mainLevel) { return; } Player[] players = PlayerInfo.Online.Items; foreach (Player p in players) { if (p.level != lvl) { continue; } LevelAccess access = Check(p); bool allowVisit = access == LevelAccess.Whitelisted || access == LevelAccess.Allowed; if (allowVisit) { continue; } Player.Message(p, "&cNo longer allowed to visit %S{0}", lvl.ColoredName); PlayerActions.ChangeMap(p, Server.mainLevel, false); } }
static GlobalVar() { //Тут мы должны получить из базы название зала и тогдалее GymName = "Test"; GymID = 18; LevelAccess2 = LevelAccess.SuperAdmin; }
internal static void ChangeRank(string name, Group oldRank, Group newRank, Player who, bool saveToNewRank = true) { Server.reviewlist.Remove(name); oldRank.playerList.Remove(name); oldRank.playerList.Save(); if (saveToNewRank) { newRank.playerList.Add(name); newRank.playerList.Save(); } if (who == null) { return; } Entities.DespawnEntities(who, false); if (who.color == "" || who.color == who.group.color) { who.color = newRank.color; } who.group = newRank; LevelAccess access = who.level.BuildAccess.Check(who); who.AllowBuild = access == LevelAccess.Whitelisted || access == LevelAccess.Allowed; who.SetPrefix(); who.Send(Packet.UserType(who)); Entities.SpawnEntities(who, false); }
void Start() { player = LevelAccess.GetPlayerPos(); visibility = player.GetComponent <PlayerVisibility>(); //resetPlayerPosition = GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerPos>(); //resetEnemiesPosition = GameObject.FindGameObjectsWithTag("Enemy"); gameFlowController = GameObject.FindGameObjectWithTag("GameFlowController").GetComponent <GameFlowController>(); }
void Start() { playerDetected = false; playerLocation = LevelAccess.GetPlayerPos(); playerVisibility = playerLocation.GetComponent <PlayerVisibility>(); destination = GetComponent <AIDestinationSetter>(); waitTime = startWaitTime; Init(); }
// Start is called before the first frame update void Start() { slider = transform.parent.Find("EnemyAnimator/Canvas/Slider").gameObject.GetComponent <Slider>(); player = LevelAccess.GetPlayerPos(); patrol = GetComponent <EnemyPatrol>(); visibility = player.GetComponent <PlayerVisibility>(); catchAmount = 0f; caught = false; outside = true; slider.gameObject.SetActive(false); gfc = GameObject.FindGameObjectWithTag("GameFlowController").GetComponent <GameFlowController>(); }
static string FormatMap(Player p, Level lvl) { bool canVisit = Player.IsSuper(p); if (!canVisit) { LevelAccess access = lvl.VisitAccess.Check(p); canVisit = access == LevelAccess.Allowed || access == LevelAccess.Whitelisted; } string physics = " [" + lvl.physics + "]"; string visit = canVisit ? "" : " &c[no]"; return(lvl.ColoredName + physics + visit); }
public Level(int width, int height, LevelType type) { number = 0; this.width = width; this.height = height; this.type = type; score = 0; backCells = new int[height, width]; access = LevelAccess.LP_LOCKED; steps = 0; chipGen = 0; chipStartGen = 0; }
bool CheckRank(Player p) { if (p.ZoneSpam <= DateTime.UtcNow) { BuildAccess.CheckDetailed(p); p.ZoneSpam = DateTime.UtcNow.AddSeconds(2); } if (p.level == this) { return(p.AllowBuild); } LevelAccess access = BuildAccess.Check(p); return(access == LevelAccess.Whitelisted || access == LevelAccess.Allowed); }
void UpdateAllowBuild() { if (IsVisit) { return; } Player[] players = PlayerInfo.Online.Items; foreach (Player p in players) { if (p.level != lvl) { continue; } LevelAccess access = Check(p); p.AllowBuild = access == LevelAccess.Whitelisted || access == LevelAccess.Allowed; } }
static bool CheckVisitPerm(Player p, Player who, bool confirmed) { LevelAccess result = p.level.VisitAccess.Check(who); if (result == LevelAccess.Allowed) { return(true); } if (result == LevelAccess.Whitelisted) { return(true); } if (result == LevelAccess.AboveMaxRank && confirmed) { return(true); } if (result == LevelAccess.BelowMinRank && confirmed) { return(true); } if (result == LevelAccess.Blacklisted) { Player.Message(p, "{0} %Sis blacklisted from visiting this map.", who.ColoredName); return(false); } else if (result == LevelAccess.BelowMinRank) { Player.Message(p, "Only {0}%S+ may normally visit this map. {1}%S is ranked {2}", Group.GetColoredName(p.level.permissionvisit), who.ColoredName, who.group.ColoredName); } else if (result == LevelAccess.AboveMaxRank) { Player.Message(p, "Only {0}%S and below may normally visit this map. {1}%S is ranked {2}", Group.GetColoredName(p.level.pervisitmax), who.ColoredName, who.group.ColoredName); } Player.Message(p, "If you still want to summon them, type %T/summon {0} confirm", who.name); return(false); }
/// <summary> Returns whether the given player is allowed for these access permissions. </summary> /// <remarks> If the player is not allowed by these access permissions, /// sends a message to the player describing why they are not. </remarks> public bool CheckDetailed(Player p, bool ignoreRankPerm = false) { LevelAccess result = Check(p); if (result == LevelAccess.Allowed) { return(true); } if (result == LevelAccess.Whitelisted) { return(true); } if (result == LevelAccess.AboveMaxRank && ignoreRankPerm) { return(true); } if (result == LevelAccess.BelowMinRank && ignoreRankPerm) { return(true); } if (result == LevelAccess.Blacklisted) { string action = IsVisit ? "going to" : "building in"; Player.Message(p, "You are blacklisted from {1} {0}%S.", lvl.ColoredName, action); } else if (result == LevelAccess.BelowMinRank) { string action = IsVisit? "go to" : "build in"; Player.Message(p, "Only {2}%S+ may {1} {0}%S.", lvl.ColoredName, action, Group.GetColoredName(Min)); } else if (result == LevelAccess.AboveMaxRank) { string action = IsVisit? "go to" : "build in"; Player.Message(p, "Only {2} %Sand below may {1} {0}%S.", lvl.ColoredName, action, Group.GetColoredName(Max)); } return(false); }
bool SendRawMapCore(Level oldLevel, Level level) { if (level.blocks == null) { return(false); } bool success = true; useCheckpointSpawn = false; lastCheckpointIndex = -1; LevelAccess access = level.BuildAccess.Check(this); AllowBuild = access == LevelAccess.Whitelisted || access == LevelAccess.Allowed; try { if (hasBlockDefs) { if (oldLevel != null && oldLevel != level) { RemoveOldLevelCustomBlocks(oldLevel); } BlockDefinition.SendLevelCustomBlocks(this); } SendRaw(Opcode.LevelInitialise); using (LevelChunkStream s = new LevelChunkStream(this)) LevelChunkStream.CompressMap(this, s); byte[] buffer = new byte[7]; buffer[0] = Opcode.LevelFinalise; NetUtils.WriteI16((short)level.Width, buffer, 1); NetUtils.WriteI16((short)level.Height, buffer, 3); NetUtils.WriteI16((short)level.Length, buffer, 5); Send(buffer); AFKCooldown = DateTime.UtcNow.AddSeconds(2); Loading = false; if (HasCpeExt(CpeExt.EnvWeatherType)) { Send(Packet.EnvWeatherType((byte)level.Weather)); } if (HasCpeExt(CpeExt.EnvColors)) { SendCurrentEnvColors(); } SendCurrentMapAppearance(); if (HasCpeExt(CpeExt.BlockPermissions)) { SendCurrentBlockPermissions(); } if (OnSendMap != null) { OnSendMap(this, buffer); } if (!level.guns && aiming) { aiming = false; ClearBlockchange(); } } catch (Exception ex) { success = false; PlayerActions.ChangeMap(this, Server.mainLevel); SendMessage("There was an error sending the map data, you have been sent to the main level."); Server.ErrorLog(ex); } finally { GC.Collect(); GC.WaitForPendingFinalizers(); } return(success); }