List<LoaderError> LoadTextures (BuffDef def) { var ret = new List<LoaderError>(); var t = def.GetTexture(); if (t == null) { ret.Add(new LoaderError(def.Mod, "GetTexture return value is null for BuffDef " + def + ".")); return ret; } Main.buffTexture[def.Type] = def.GetTexture(); return ret; }
List<LoaderError> CheckTextures(BuffDef def) { var ret = new List<LoaderError>(); if (def.GetTexture == null) ret.Add(new LoaderError(def.Mod, "GetTexture of BuffDef " + def + " is null.")); return ret; }
void CopySetProperties(BuffDef def) { Main.buffNoSave [def.Type] = def.DoesNotSave ; Main.buffNoTimeDisplay[def.Type] = def.HideTimeDisplay ; Main.debuff [def.Type] = def.IsDebuff ; Main.lightPet [def.Type] = def.IsLightPet ; Main.vanityPet [def.Type] = def.IsVanityPet ; Main.meleeBuff [def.Type] = def.IsWeaponImbuement ; Main.persistentBuff [def.Type] = def.PersistsAfterDeath; Main.buffTip [def.Type] = def.Tooltip ; Main.pvpBuff [def.Type] = def.WorksInPvP ; }
internal void FillVanilla() { FillingVanilla = true; int id = 0; var def = new BuffDef(String.Empty); def.InternalName = String.Empty; DefsByType.Add(id, def); VanillaDefsByName.Add(String.Empty, def); var byDisplayName = new Dictionary<string, BuffDef>(); for (id = MinVanillaID; id < MaxVanillaID; id++) { if (id == 0) continue; var index = Array.IndexOf(IDValues, id); if (index == -1) continue; def = new BuffDef(Main.buffName[id], null, () => Main.buffTexture[id]); DefsByType.Add(id, def); VanillaDefsByName.Add(IDNames[index], def); var n = Main.buffName[id]; if (!byDisplayName.ContainsKey(n) && !VanillaDefsByName.ContainsKey(n)) byDisplayName.Add(n, def); def.Mod = PrismApi.VanillaInfo; CopyEntityToDef(id, def); // TEntityDef is a class -> dictionary entries are updated, too def.InternalName = IDNames[index]; } foreach (var kvp in byDisplayName) if (!VanillaDefsByName.ContainsKey(kvp.Key)) VanillaDefsByName.Add(kvp.Key, kvp.Value); FillingVanilla = false; }
void CopyEntityToDef(int id, BuffDef def) { def.Type = id; def.DoesNotSave = Main.buffNoSave [id]; def.HideTimeDisplay = Main.buffNoTimeDisplay[id]; def.IsDebuff = Main.debuff [id]; def.IsLightPet = Main.lightPet [id]; def.IsVanityPet = Main.vanityPet [id]; def.IsWeaponImbuement = Main.meleeBuff [id]; def.PersistsAfterDeath = Main.persistentBuff [id]; def.Tooltip = Main.buffTip [id]; def.WorksInPvP = Main.pvpBuff [id]; }