public void loadAbilityDB(string path) { Output.Write("Loading Abilities.."); // load the CSV into an ArrayList collection ArrayList abilityDB = loadCSV(path, ';'); int linecount = 1; // Create a new List foreach (string[] data in abilityDB) { AbilityItem ability = new AbilityItem(); // we want to skip the first line as it should have the Names if (linecount > 1) { ability.setAbilityID(Convert.ToUInt16(data[0])); ability.setGOID(Convert.ToInt32(data[1])); ability.setAbilityName(data[2]); if (data[3].Length > 0) { ability.setIsCastable(bool.Parse(data[3])); } if (data.Length >= 5) { if (data[4].Length > 0) { ability.setCastingTime(float.Parse(data[4], CultureInfo.InvariantCulture)); } } if (data.Length >= 6) { if (data[5].Length > 2) { ability.setCastAnimStart(StringUtils.hexStringToBytes(data[5])); } } if (data.Length >= 7) { if (data[6].Length > 2) { ability.setCastAnimMid(StringUtils.hexStringToBytes((data[6]))); } } if (data.Length >= 8) { if (data[7].Length > 2) { ability.setCastAnimEnd(StringUtils.hexStringToBytes(data[7])); } } if (data.Length >= 9) { if (data[8].Length > 0) { ability.setActivationFX(UInt32.Parse(data[8])); } } if (data.Length >= 10) { if (data[9].Length > 0) { ability.setValueFrom(Int16.Parse(data[9])); } } if (data.Length >= 11) { if (data[10].Length > 0) { ability.setValueTo(UInt16.Parse(data[10])); } } if (data.Length >= 12) { if (data[11].Length > 0) { ability.setIsBuff(bool.Parse(data[11])); } } if (data.Length >= 13) { if (data[12].Length > 0) { CultureInfo ci = (CultureInfo)CultureInfo.CurrentCulture.Clone(); ci.NumberFormat.CurrencyDecimalSeparator = "."; ability.setBuffTime(float.Parse(data[12], NumberStyles.Any, ci)); } } if (data.Length >= 14) { if (data[13].Length > 0) { ability.setAbilityExecutionFX(UInt32.Parse(data[13])); } } AbilityDB.Add(ability); } linecount++; } }
public void loadAbilityDB(string path) { Output.Write("Loading Abilities.."); // load the CSV into an ArrayList collection ArrayList abilityDB = loadCSV(path,';'); int linecount = 1; // Create a new List foreach (string[] data in abilityDB) { //Output.WriteLine("Show Colums for Line : " + linecount.ToString() + " Ability ID: " + data[0].ToString() + " GOID " + data[1].ToString() + " Ability Name : " + data[2].ToString()); AbilityItem ability = new AbilityItem(); // we want to skip the first line as it should have the Names if (linecount > 1) { ability.setAbilityID(Convert.ToUInt16(data[0].ToString())); ability.setGOID(Convert.ToInt32(data[1].ToString())); ability.setAbilityName(data[2].ToString()); if (data[3].ToString().Length > 0) { ability.setIsCastable(bool.Parse(data[3].ToString())); } if (data.Length >= 5) { if (data[4].ToString().Length > 0) { CultureInfo ci = (CultureInfo)CultureInfo.CurrentCulture.Clone(); ci.NumberFormat.CurrencyDecimalSeparator = "."; ability.setCastingTime(float.Parse(data[4].ToString(), NumberStyles.Any, ci)); } } if (data.Length >= 6) { if (data[5].ToString().Length > 2) { ability.setCastAnimStart(StringUtils.hexStringToBytes(data[5].ToString())); } } if (data.Length >= 7) { if (data[6].ToString().Length > 2) { ability.setCastAnimMid(StringUtils.hexStringToBytes((data[6].ToString()))); } } if (data.Length >= 8) { if (data[7].ToString().Length > 2) { ability.setCastAnimEnd(StringUtils.hexStringToBytes(data[7].ToString())); } } if (data.Length >= 9) { if (data[8].ToString().Length > 0) { ability.setActivationFX(UInt32.Parse(data[8].ToString())); } } if (data.Length >= 10) { if (data[9].ToString().Length > 0) { ability.setValueFrom(Int16.Parse(data[9].ToString())); } } if (data.Length >= 11) { if (data[10].ToString().Length > 0) { ability.setValueTo(UInt16.Parse(data[10].ToString())); } } if (data.Length >= 12) { if (data[11].ToString().Length > 0) { ability.setIsBuff(bool.Parse(data[11].ToString())); } } if (data.Length >= 13) { if (data[12].ToString().Length > 0) { CultureInfo ci = (CultureInfo)CultureInfo.CurrentCulture.Clone(); ci.NumberFormat.CurrencyDecimalSeparator = "."; ability.setBuffTime(float.Parse(data[12].ToString(), NumberStyles.Any, ci)); } } if (data.Length >= 14) { if (data[13].ToString().Length > 0) { ability.setAbilityExecutionFX(UInt32.Parse(data[13].ToString())); } } this.AbilityDB.Add(ability); } linecount++; } }