private void WriteStatToMap(Dictionary <StatBase, int> par1Map, StatBase par2StatBase, int par3) { int integer = 0; if (par1Map.ContainsKey(par2StatBase)) { integer = par1Map[par2StatBase]; } par1Map[par2StatBase] = integer + par3; }
static StatList() { MinutesPlayedStat = (new StatBasic(1100, "stat.playOneMinute", StatBase.TimeStatType)).InitIndependentStat().RegisterStat(); DistanceWalkedStat = (new StatBasic(2000, "stat.walkOneCm", StatBase.DistanceStatType)).InitIndependentStat().RegisterStat(); DistanceSwumStat = (new StatBasic(2001, "stat.swimOneCm", StatBase.DistanceStatType)).InitIndependentStat().RegisterStat(); DistanceFallenStat = (new StatBasic(2002, "stat.fallOneCm", StatBase.DistanceStatType)).InitIndependentStat().RegisterStat(); DistanceClimbedStat = (new StatBasic(2003, "stat.climbOneCm", StatBase.DistanceStatType)).InitIndependentStat().RegisterStat(); DistanceFlownStat = (new StatBasic(2004, "stat.flyOneCm", StatBase.DistanceStatType)).InitIndependentStat().RegisterStat(); DistanceDoveStat = (new StatBasic(2005, "stat.diveOneCm", StatBase.DistanceStatType)).InitIndependentStat().RegisterStat(); DistanceByMinecartStat = (new StatBasic(2006, "stat.minecartOneCm", StatBase.DistanceStatType)).InitIndependentStat().RegisterStat(); DistanceByBoatStat = (new StatBasic(2007, "stat.boatOneCm", StatBase.DistanceStatType)).InitIndependentStat().RegisterStat(); DistanceByPigStat = (new StatBasic(2008, "stat.pigOneCm", StatBase.DistanceStatType)).InitIndependentStat().RegisterStat(); AchievementList.Init(); }
public virtual int Func_27297_a(StatCrafting par1StatCrafting, StatCrafting par2StatCrafting) { int i = par1StatCrafting.GetItemID(); int j = par2StatCrafting.GetItemID(); StatBase statbase = null; StatBase statbase1 = null; if (SlotStatsBlockGUI.Field_27271_e == 2) { statbase = StatList.MineBlockStatArray[i]; statbase1 = StatList.MineBlockStatArray[j]; } else if (SlotStatsBlockGUI.Field_27271_e == 0) { statbase = StatList.ObjectCraftStats[i]; statbase1 = StatList.ObjectCraftStats[j]; } else if (SlotStatsBlockGUI.Field_27271_e == 1) { statbase = StatList.ObjectUseStats[i]; statbase1 = StatList.ObjectUseStats[j]; } if (statbase != null || statbase1 != null) { if (statbase == null) { return(1); } if (statbase1 == null) { return(-1); } int k = GuiStats.GetStatsFileWriter(SlotStatsBlockGUI.Field_27274_a).WriteStat(statbase); int l = GuiStats.GetStatsFileWriter(SlotStatsBlockGUI.Field_27274_a).WriteStat(statbase1); if (k != l) { return((k - l) * SlotStatsBlockGUI.Field_27270_f); } } return(i - j); }
private static StatBase[] InitBreakStats(StatBase[] par0ArrayOfStatBase, string par1Str, int par2, int par3, int par4) { if (par0ArrayOfStatBase == null) { par0ArrayOfStatBase = new StatBase[32000]; } for (int i = par3; i < par4; i++) { if (Item.ItemsList[i] != null && Item.ItemsList[i].IsDamageable()) { string s = StatCollector.TranslateToLocalFormatted(par1Str, new object[] { Item.ItemsList[i].GetStatName() }); par0ArrayOfStatBase[i] = new StatCrafting(par2 + i, s, i).RegisterStat(); } } ReplaceAllSimilarBlocks(par0ArrayOfStatBase); return(par0ArrayOfStatBase); }
/// <summary> /// Initializes statistic fields related to minable items and blocks. /// </summary> private static StatBase[] InitMinableStats(string par0Str, int par1) { StatBase[] astatbase = new StatBase[256]; for (int i = 0; i < 256; i++) { var block = Block.BlocksList[i]; if (block != null && block.GetEnableStats()) { string s = StatCollector.TranslateToLocalFormatted(par0Str, new object[] { Block.BlocksList[i].TranslateBlockName() }); astatbase[i] = new StatCrafting(par1 + i, s, i).RegisterStat(); ObjectMineStats.Add((StatCrafting)astatbase[i]); } } ReplaceAllSimilarBlocks(astatbase); return(astatbase); }
/// <summary> /// Formats a given stat for human consumption. /// </summary> public string Format(int par1) { int i = par1; double d = (double)i / 100D; double d1 = d / 1000D; if (d1 > 0.5D) { return((new StringBuilder()).Append(d1.ToString(StatBase.GetNumberFormat())).Append(" km").ToString()); } if (d > 0.5D) { return((new StringBuilder()).Append(d.ToString(StatBase.GetNumberFormat())).Append(" m").ToString()); } else { return((new StringBuilder()).Append(par1).Append(" cm").ToString()); } }
public virtual void ReadStat(StatBase par1StatBase, int par2) { WriteStatToMap(field_25101_b, par1StatBase, par2); WriteStatToMap(field_25102_a, par1StatBase, par2); field_27189_c = true; }
public virtual int WriteStat(StatBase par1StatBase) { int integer = field_25102_a[par1StatBase]; return(integer != null ? integer : 0); }