/// <summary> /// Processes this instance. /// </summary> internal override void Process() { if (!this.Device.GameMode.Level.Player.InAlliance) { if (this.Description != null) { this.Description = Resources.Regex.Replace(this.Description, " "); if (this.Description.StartsWith(" ")) { this.Description = this.Description.Remove(0, 1); } if (this.Description.Length > 128) { this.Description = this.Description.Substring(0, 128); } } AllianceBadgeLayerData Background = (AllianceBadgeLayerData)CSV.Tables.Get(Gamefile.AllianceBadgeLayer).GetDataWithInstanceID(this.AllianceBadge % 0x100); AllianceBadgeLayerData Middle = (AllianceBadgeLayerData)CSV.Tables.Get(Gamefile.AllianceBadgeLayer).GetDataWithInstanceID(this.AllianceBadge % 0x1000000 / 0x100); AllianceBadgeLayerData Foreground = (AllianceBadgeLayerData)CSV.Tables.Get(Gamefile.AllianceBadgeLayer).GetDataWithInstanceID(this.AllianceBadge / 0x1000000); if (Background != null) { if (Middle != null) { if (Foreground != null) { Alliance Alliance = new Alliance(); Alliance.Description = this.Description; Alliance.Header.Badge = this.AllianceBadge; Alliance.Header.Type = this.AllianceType; Alliance.Header.Origin = this.Origin?.GlobalID ?? 0; Alliance.Header.PublicWarLog = this.PublicWarLog; Alliance.Header.RequiredScore = this.RequiredScore; Alliance.Header.AmicalWar = this.AmicalWar; foreach (Player Player in Alliance.Members.Connected.Values.ToArray()) { if (Player.Connected) { Player.Level.GameMode.CommandManager.AddCommand(new Alliance_Settings_Changed_Command(Alliance.AllianceID, Alliance.Header.Badge)); } else { Alliance.Members.Connected.TryRemove(Player.PlayerID, out _); } } } } } } }
/// <summary> /// Creates the data for the specified row. /// </summary> /// <param name="Row">The row.</param> internal Data Create(Row Row) { Data Data; switch (this.Index) { case 1: { Data = new BuildingData(Row, this); break; } case 2: { Data = new LocaleData(Row, this); break; } case 3: { Data = new ResourceData(Row, this); break; } case 4: { Data = new CharacterData(Row, this); break; } case 6: { Data = new ProjectileData(Row, this); break; } case 7: { Data = new BuildingClassData(Row, this); break; } case 8: { Data = new ObstacleData(Row, this); break; } case 9: { Data = new EffectData(Row, this); break; } case 10: { Data = new ParticleEmitterData(Row, this); break; } case 11: { Data = new ExperienceLevelData(Row, this); break; } case 12: { Data = new TrapData(Row, this); break; } case 13: { Data = new AllianceBadgeData(Row, this); break; } case 14: { Data = new GlobalData(Row, this); break; } case 15: { Data = new TownhallLevelData(Row, this); break; } case 16: { Data = new AlliancePortalData(Row, this); break; } case 17: { Data = new NpcData(Row, this); break; } case 18: { Data = new DecoData(Row, this); break; } case 19: { Data = new ResourcePackData(Row, this); break; } case 20: { Data = new ShieldData(Row, this); break; } case 21: { Data = new MissionData(Row, this); break; } case 22: { Data = new BillingPackageData(Row, this); break; } case 23: { Data = new AchievementData(Row, this); break; } case 25: { Data = new FaqData(Row, this); break; } case 26: { Data = new SpellData(Row, this); break; } case 27: { Data = new HintData(Row, this); break; } case 28: { Data = new HeroData(Row, this); break; } case 29: { Data = new LeagueData(Row, this); break; } case 30: { Data = new NewData(Row, this); break; } case 34: { Data = new AllianceBadgeLayerData(Row, this); break; } case 37: { Data = new VariableData(Row, this); break; } case 38: { Data = new GemBundleData(Row, this); break; } case 39: { Data = new VillageObjectData(Row, this); break; } default: { Data = new Data(Row, this); break; } } return(Data); }
internal Data Create(Row _Row) { Data _Data; switch ((Gamefile)this.Index) { case Gamefile.Buildings: _Data = new BuildingData(_Row, this); break; case Gamefile.Locales: _Data = new LocaleData(_Row, this); break; case Gamefile.Resources: _Data = new ResourceData(_Row, this); break; case Gamefile.Characters: _Data = new CharacterData(_Row, this); break; case Gamefile.Building_Classes: _Data = new BuildingClassData(_Row, this); break; case Gamefile.Obstacles: _Data = new ObstacleData(_Row, this); break; case Gamefile.Traps: _Data = new TrapData(_Row, this); break; case Gamefile.Globals: _Data = new GlobalData(_Row, this); break; case Gamefile.Experience_Levels: _Data = new ExperienceLevelData(_Row, this); break; case Gamefile.Townhall_Levels: _Data = new TownhallLevelData(_Row, this); break; case Gamefile.Npcs: _Data = new NpcData(_Row, this); break; case Gamefile.Decos: _Data = new DecoData(_Row, this); break; case Gamefile.Shields: _Data = new ShieldData(_Row, this); break; case Gamefile.Missions: _Data = new MissionData(_Row, this); break; case Gamefile.Achievements: _Data = new AchievementData(_Row, this); break; case Gamefile.Spells: _Data = new SpellData(_Row, this); break; case Gamefile.Heroes: _Data = new HeroData(_Row, this); break; case Gamefile.Leagues: _Data = new LeagueData(_Row, this); break; case Gamefile.Regions: _Data = new RegionData(_Row, this); break; case Gamefile.AllianceBadgeLayer: _Data = new AllianceBadgeLayerData(_Row, this); break; case Gamefile.Variables: _Data = new VariableData(_Row, this); break; case Gamefile.Village_Objects: _Data = new VillageObjectData(_Row, this); break; default: _Data = new Data(_Row, this); break; } return(_Data); }
/// <summary> /// Processes this instance. /// </summary> internal override void Process() { if (!this.Device.GameMode.Level.Player.InAlliance) { if (!string.IsNullOrWhiteSpace(this.Name)) { if (this.Name.Length <= 16) { this.Name = Resources.Regex.Replace(this.Name, " "); if (this.Name.StartsWith(" ")) { this.Name = this.Name.Remove(0, 1); } if (this.Name.Length >= 2) { if (this.Description != null) { this.Description = Resources.Regex.Replace(this.Description, " "); if (this.Description.StartsWith(" ")) { this.Description = this.Description.Remove(0, 1); } if (this.Description.Length > 128) { this.Description = this.Description.Substring(0, 128); } } AllianceBadgeLayerData Background = (AllianceBadgeLayerData)CSV.Tables.Get(Gamefile.AllianceBadgeLayer).GetDataWithInstanceID(this.AllianceBadge % 0x100); AllianceBadgeLayerData Middle = (AllianceBadgeLayerData)CSV.Tables.Get(Gamefile.AllianceBadgeLayer).GetDataWithInstanceID(this.AllianceBadge % 0x1000000 / 0x100); AllianceBadgeLayerData Foreground = (AllianceBadgeLayerData)CSV.Tables.Get(Gamefile.AllianceBadgeLayer).GetDataWithInstanceID(this.AllianceBadge / 0x1000000); if (Background != null) { if (Middle != null) { if (Foreground != null) { Alliance Alliance = new Alliance(); Alliance.Header.Name = this.Name; Alliance.Description = this.Description; // Alliance.Header.Locale = this.Device.Player.Locale; Alliance.Header.Badge = this.AllianceBadge; Alliance.Header.Type = this.AllianceType; if (this.Origin != null) { Alliance.Header.Origin = this.Origin.GlobalID; } Alliance.Header.PublicWarLog = this.PublicWarLog; Alliance.Header.RequiredScore = this.RequiredScore; Alliance.Header.AmicalWar = this.AmicalWar; if (Alliance.Members.Join(this.Device.GameMode.Level.Player, out Member Member)) { Member.Role = Role.Leader; Resources.Clans.New(Alliance); this.Device.GameMode.CommandManager.AddCommand(new Join_Alliance_Command(Alliance.AllianceID, Alliance.Header.Name, Alliance.Header.Badge, Alliance.Header.ExpLevel, true)); } } } } } } } } }