internal override void Decode() { this.ReadHeader(); this.Taunt = this.Stream.ReadDataReference <LogicTauntData>(); }
/// <summary> /// Creates the data for the specified row. /// </summary> internal LogicData Create(Row row) { LogicData data; switch (this.Index) { case 1: { data = new LogicLocaleData(row, this); break; } case 2: { data = new LogicResourceData(row, this); break; } case 3: { data = new LogicEffectData(row, this); break; } case 4: { data = new LogicParticleEmitterData(row, this); break; } case 5: { data = new LogicGlobalData(row, this); break; } case 6: { data = new LogicQuestData(row, this); break; } case 8: { data = new LogicAchievementData(row, this); break; } case 10: { data = new LogicWorldData(row, this); break; } case 11: { data = new LogicHeroData(row, this); break; } case 12: { data = new LogicExperienceLevelData(row, this); break; } case 13: { data = new LogicLeagueData(row, this); break; } case 21: { data = new LogicAllianceBadgeData(row, this); break; } case 24: { data = new LogicTauntData(row, this); break; } case 25: { data = new LogicDecoData(row, this); break; } case 26: { data = new LogicVariableData(row, this); break; } case 28: { data = new LogicBoosterData(row, this); break; } case 32: { data = new LogicEnergyPackageData(row, this); break; } case 35: { data = new LogicSpellData(row, this); break; } case 36: { data = new LogicObstacleData(row, this); break; } case 37: { data = new LogicItemsData(row, this); break; } default: { data = new LogicData(row, this); break; } } return(data); }
internal override void Execute() { if (this.Data != null) { if (this.DataType == 0) { LogicTauntData taunt = (LogicTauntData)this.Data; if (!this.Connection.Avatar.Extras.ContainsKey(taunt.GlobalID)) { if (!string.IsNullOrEmpty(taunt.CharacterUnlock)) { LogicHeroData hero = (LogicHeroData)CSV.Tables.Get(Gamefile.Heroes).GetDataByName(taunt.CharacterUnlock); if (!this.Connection.Avatar.HeroLevels.ContainsKey(hero.GlobalID)) { Debugger.Error($"Unable to buy the taunt. {this.Connection.Avatar.Name} ({this.Connection.Avatar}) doesn't have the hero {taunt.CharacterUnlock}."); return; } } if (taunt.Cost > 0) { LogicResourceData resource = (LogicResourceData)CSV.Tables.Get(Gamefile.Resources).GetDataByName(taunt.Resource); if (this.Connection.Avatar.Resources.GetCount(resource.GlobalID) < taunt.Cost) { Debugger.Error($"Unable to buy the taunt. {this.Connection.Avatar.Name} does not have enough {taunt.Resource}. {taunt.Resource} : {this.Connection.Avatar.Resources.GetCount(resource.GlobalID)}, Require : {taunt.Cost}."); return; } this.Connection.Avatar.Resources.Remove(resource.GlobalID, taunt.Cost); } this.Connection.Avatar.Extras.Set(taunt.GlobalID, 1); } } else { LogicDecoData deco = (LogicDecoData)this.Data; if (!this.Connection.Avatar.Extras.ContainsKey(deco.GlobalID)) { if (deco.UnlockLevel > this.Connection.Avatar.ExpLevel) { Debugger.Error($"Unable to buy the deco. {this.Connection.Avatar.Name} ({this.Connection.Avatar}) is not at the required level."); return; } if (deco.Cost > 0) { LogicResourceData resource = (LogicResourceData)CSV.Tables.Get(Gamefile.Resources).GetDataByName(deco.Resource); if (this.Connection.Avatar.Resources.GetCount(resource.GlobalID) < deco.Cost) { Debugger.Error($"Unable to buy the deco. {this.Connection.Avatar.Name} ({this.Connection.Avatar}) does not have enough {deco.Resource}. ({deco.Resource} : {this.Connection.Avatar.Resources.GetCount(resource.GlobalID)}, Require : {deco.Cost}."); return; } this.Connection.Avatar.Resources.Remove(resource.GlobalID, deco.Cost); } this.Connection.Avatar.Extras.Set(deco.GlobalID, 2); if (this.Connection.Avatar.Extras.Count > 1) { foreach (Item item in this.Connection.Avatar.Extras.Values) { if (item.Id / 1000000 == deco.GetDataType()) { if (item.Count != 1 && item.Id != deco.GlobalID) { item.Count = 1; } } } } } else { if (this.Connection.Avatar.Extras.GetCount(deco.GlobalID) == 1) { this.Connection.Avatar.Extras.Set(deco.GlobalID, 2); foreach (Item item in this.Connection.Avatar.Extras.Values) { if (item.Id / 1000000 == deco.GetDataType()) { if (item.Count != 1 && item.Id != deco.GlobalID) { item.Count = 1; } } } } else { this.Connection.Avatar.Extras.Set(deco.GlobalID, 1); } } } } else { Debugger.Error("Unable to buy the extra. Data is null."); } }