public static int GetGrantedExperience(this Creep creep) { int exp; if (Experience.TryGetValue(creep.Name, out exp)) { return(creep.AdjustedExperience(exp)); } try { exp = Game.FindKeyValues(creep.Name + "/BountyXP", KeyValueSource.Unit).IntValue; } catch (KeyValuesNotFoundException) { Log.Error("XP value for " + creep.Name + " not found"); exp = 0; } Experience.Add(creep.Name, exp); return(creep.AdjustedExperience(exp)); }