public void Enter(Player player) { player.CurrentWorld = Name; if (!Name.All(x => char.IsLetterOrDigit(x))) { player.SendConsoleMessage("Name can't contains symbols."); player.SendFailedToEnterWorld(); return; } Players.Add(player); var pos = Vector2.Zero; var door = Blocks.FirstOrDefault(x => x.Fg.Id == 6); if (door != null) { pos = new Vector2(door.Pos.X * 32, door.Pos.Y * 32); } SendPacket(player); player.NetId = Core.NetIds++; player.SendSpawn(pos); player.SendClothes(); player.Inventory.Send(); }
public bool IsValid() { return(Name.All(kvp => kvp.Value == false) && Surname.All(kvp => kvp.Value == false) && Login.All(kvp => kvp.Value == false) && Email.All(kvp => kvp.Value == false) && Password.All(kvp => kvp.Value == false)); }
internal override void Write(NpgsqlBuffer buf) { Contract.Requires(Name != null && Name.All(c => c < 128)); buf.WriteByte(Code); buf.WriteInt32(Length - 1); buf.WriteByte((byte)StatementOrPortal); buf.WriteBytesNullTerminated(Encoding.ASCII.GetBytes(Name)); }
internal override void WriteFully(WriteBuffer buf) { Debug.Assert(Name != null && Name.All(c => c < 128)); buf.WriteByte(Code); buf.WriteInt32(Length - 1); buf.WriteByte((byte)StatementOrPortal); buf.WriteNullTerminatedString(Name); }
IEnumerable <ValidationResult> IValidatableObject.Validate(ValidationContext validationContext) { if (Expires < DateTime.Now) { yield return(new ValidationResult("Expires date must be later than today.")); } if (!Name.All(char.IsLetterOrDigit)) { yield return(new ValidationResult("Name must be alphanumeric.")); } }
// Constructor internal SkillItem(long ID, string name, GW2APIController apiController) { this.ID = ID; Name = name.Replace("\0", ""); ApiSkill = apiController.GetAPISkill(ID); // if (_overrideNames.TryGetValue(ID, out string overrideName)) { Name = overrideName; } else if (ApiSkill != null && (UnknownSkill || Name.All(char.IsDigit))) { Name = ApiSkill.Name; } if (_overrideIcons.TryGetValue(ID, out string icon)) { Icon = icon; } else { Icon = ApiSkill != null ? ApiSkill.Icon : DefaultIcon; } if (ApiSkill != null && ApiSkill.Type == "Weapon" && ApiSkill.WeaponType != "None" && ApiSkill.Professions.Count > 0 && (ApiSkill.Categories == null || ApiSkill.Categories.Count == 0 || ApiSkill.Categories.Contains("Clone") || ApiSkill.Categories.Contains("Phantasm") || ApiSkill.Categories.Contains("DualWield"))) { _weaponDescriptor = new WeaponDescriptor(ApiSkill); } AA = (ApiSkill?.Slot == "Weapon_1" || ApiSkill?.Slot == "Downed_1"); if (AA) { if (ApiSkill.Categories != null) { AA = AA && !ApiSkill.Categories.Contains("StealthAttack") && !ApiSkill.Categories.Contains("Ambush"); // Ambush in case one day it's added } if (ApiSkill.Description != null) { AA = AA && !ApiSkill.Description.Contains("Ambush."); } } #if DEBUG Name += " (" + ID + ")"; #endif }