public static void DrawSavings(SpriteBatch sb, int currencyIndex, float shopx, float shopy, bool horizontal = false) { CustomCurrencySystem currency = CustomCurrencyManager._currencies[currencyIndex]; Player player = Main.player[Main.myPlayer]; bool overFlowing; long num1 = currency.CountCurrency(out overFlowing, player.bank.item); long num2 = currency.CountCurrency(out overFlowing, player.bank2.item); long num3 = currency.CountCurrency(out overFlowing, player.bank3.item); long totalCoins = currency.CombineStacks(out overFlowing, num1, num2, num3); if (totalCoins <= 0L) { return; } if (num3 > 0L) { sb.Draw(Main.itemTexture[3813], Utils.CenteredRectangle(new Vector2(shopx + 80f, shopy + 50f), Vector2.op_Multiply(Main.itemTexture[3813].Size(), 0.65f)), new Rectangle?(), Color.get_White()); } if (num2 > 0L) { sb.Draw(Main.itemTexture[346], Utils.CenteredRectangle(new Vector2(shopx + 80f, shopy + 50f), Vector2.op_Multiply(Main.itemTexture[346].Size(), 0.65f)), new Rectangle?(), Color.get_White()); } if (num1 > 0L) { sb.Draw(Main.itemTexture[87], Utils.CenteredRectangle(new Vector2(shopx + 70f, shopy + 60f), Vector2.op_Multiply(Main.itemTexture[87].Size(), 0.65f)), new Rectangle?(), Color.get_White()); } Utils.DrawBorderStringFourWay(sb, Main.fontMouseText, Lang.inter[66].Value, shopx, shopy + 40f, Color.op_Multiply(Color.get_White(), (float)Main.mouseTextColor / (float)byte.MaxValue), Color.get_Black(), Vector2.get_Zero(), 1f); currency.DrawSavingsMoney(sb, Lang.inter[66].Value, shopx, shopy, totalCoins, horizontal); }
// Token: 0x0600103E RID: 4158 RVA: 0x003FEA4C File Offset: 0x003FCC4C public static void DrawSavings(SpriteBatch sb, int currencyIndex, float shopx, float shopy, bool horizontal = false) { CustomCurrencySystem customCurrencySystem = CustomCurrencyManager._currencies[currencyIndex]; Player player = Main.player[Main.myPlayer]; bool flag; long num = customCurrencySystem.CountCurrency(out flag, player.bank.item, new int[0]); long num2 = customCurrencySystem.CountCurrency(out flag, player.bank2.item, new int[0]); long num3 = customCurrencySystem.CountCurrency(out flag, player.bank3.item, new int[0]); long num4 = customCurrencySystem.CombineStacks(out flag, new long[] { num, num2, num3 }); if (num4 > 0L) { if (num3 > 0L) { sb.Draw(Main.itemTexture[3813], Utils.CenteredRectangle(new Vector2(shopx + 80f, shopy + 50f), Main.itemTexture[3813].Size() * 0.65f), null, Color.White); } if (num2 > 0L) { sb.Draw(Main.itemTexture[346], Utils.CenteredRectangle(new Vector2(shopx + 80f, shopy + 50f), Main.itemTexture[346].Size() * 0.65f), null, Color.White); } if (num > 0L) { sb.Draw(Main.itemTexture[87], Utils.CenteredRectangle(new Vector2(shopx + 70f, shopy + 60f), Main.itemTexture[87].Size() * 0.65f), null, Color.White); } Utils.DrawBorderStringFourWay(sb, Main.fontMouseText, Lang.inter[66].Value, shopx, shopy + 40f, Color.White * ((float)Main.mouseTextColor / 255f), Color.Black, Vector2.Zero, 1f); customCurrencySystem.DrawSavingsMoney(sb, Lang.inter[66].Value, shopx, shopy, num4, horizontal); } }
public static bool BuyItem(Player player, int price, int currencyIndex) { CustomCurrencySystem currency = CustomCurrencyManager._currencies[currencyIndex]; bool overFlowing; long num1 = currency.CountCurrency(out overFlowing, player.inventory, 58, 57, 56, 55, 54); long num2 = currency.CountCurrency(out overFlowing, player.bank.item); long num3 = currency.CountCurrency(out overFlowing, player.bank2.item); long num4 = currency.CountCurrency(out overFlowing, player.bank3.item); long num5 = currency.CountCurrency(out overFlowing, player.bank4.item); if (currency.CombineStacks(out overFlowing, num1, num2, num3, num4, num5) < (long)price) { return(false); } List <Item[]> objArrayList = new List <Item[]>(); Dictionary <int, List <int> > slotsToIgnore = new Dictionary <int, List <int> >(); List <Point> pointList1 = new List <Point>(); List <Point> slotCoins = new List <Point>(); List <Point> pointList2 = new List <Point>(); List <Point> pointList3 = new List <Point>(); List <Point> pointList4 = new List <Point>(); List <Point> pointList5 = new List <Point>(); objArrayList.Add(player.inventory); objArrayList.Add(player.bank.item); objArrayList.Add(player.bank2.item); objArrayList.Add(player.bank3.item); objArrayList.Add(player.bank4.item); for (int index = 0; index < objArrayList.Count; ++index) { slotsToIgnore[index] = new List <int>(); } slotsToIgnore[0] = new List <int>() { 58, 57, 56, 55, 54 }; for (int x = 0; x < objArrayList.Count; ++x) { for (int y = 0; y < objArrayList[x].Length; ++y) { if (!slotsToIgnore[x].Contains(y) && currency.Accepts(objArrayList[x][y])) { slotCoins.Add(new Point(x, y)); } } } CustomCurrencyManager.FindEmptySlots(objArrayList, slotsToIgnore, pointList1, 0); CustomCurrencyManager.FindEmptySlots(objArrayList, slotsToIgnore, pointList2, 1); CustomCurrencyManager.FindEmptySlots(objArrayList, slotsToIgnore, pointList3, 2); CustomCurrencyManager.FindEmptySlots(objArrayList, slotsToIgnore, pointList4, 3); CustomCurrencyManager.FindEmptySlots(objArrayList, slotsToIgnore, pointList5, 4); return(currency.TryPurchasing(price, objArrayList, slotCoins, pointList1, pointList2, pointList3, pointList4, pointList5)); }
public static void DrawSavings( SpriteBatch sb, int currencyIndex, float shopx, float shopy, bool horizontal = false) { CustomCurrencySystem currency = CustomCurrencyManager._currencies[currencyIndex]; Player player = Main.player[Main.myPlayer]; bool overFlowing; long num1 = currency.CountCurrency(out overFlowing, player.bank.item); long num2 = currency.CountCurrency(out overFlowing, player.bank2.item); long num3 = currency.CountCurrency(out overFlowing, player.bank3.item); long num4 = currency.CountCurrency(out overFlowing, player.bank4.item); long totalCoins = currency.CombineStacks(out overFlowing, num1, num2, num3, num4); if (totalCoins <= 0L) { return; } Main.instance.LoadItem(4076); Main.instance.LoadItem(3813); Main.instance.LoadItem(346); Main.instance.LoadItem(87); if (num4 > 0L) { sb.Draw(TextureAssets.Item[4076].get_Value(), Utils.CenteredRectangle(new Vector2(shopx + 96f, shopy + 50f), TextureAssets.Item[4076].get_Value().Size() * 0.65f), new Rectangle?(), Color.White); } if (num3 > 0L) { sb.Draw(TextureAssets.Item[3813].get_Value(), Utils.CenteredRectangle(new Vector2(shopx + 80f, shopy + 50f), TextureAssets.Item[3813].get_Value().Size() * 0.65f), new Rectangle?(), Color.White); } if (num2 > 0L) { sb.Draw(TextureAssets.Item[346].get_Value(), Utils.CenteredRectangle(new Vector2(shopx + 80f, shopy + 50f), TextureAssets.Item[346].get_Value().Size() * 0.65f), new Rectangle?(), Color.White); } if (num1 > 0L) { sb.Draw(TextureAssets.Item[87].get_Value(), Utils.CenteredRectangle(new Vector2(shopx + 70f, shopy + 60f), TextureAssets.Item[87].get_Value().Size() * 0.65f), new Rectangle?(), Color.White); } Utils.DrawBorderStringFourWay(sb, FontAssets.MouseText.get_Value(), Lang.inter[66].Value, shopx, shopy + 40f, Color.White * ((float)Main.mouseTextColor / (float)byte.MaxValue), Color.Black, Vector2.Zero, 1f); currency.DrawSavingsMoney(sb, Lang.inter[66].Value, shopx, shopy, totalCoins, horizontal); }
public static void DrawSavings(SpriteBatch sb, int currencyIndex, float shopx, float shopy, bool horizontal = false) { CustomCurrencySystem customCurrencySystem = _currencies[currencyIndex]; Player player = Main.player[Main.myPlayer]; bool overFlowing; long num = customCurrencySystem.CountCurrency(out overFlowing, player.bank.item); long num2 = customCurrencySystem.CountCurrency(out overFlowing, player.bank2.item); long num3 = customCurrencySystem.CountCurrency(out overFlowing, player.bank3.item); long num4 = customCurrencySystem.CountCurrency(out overFlowing, player.bank4.item); long num5 = customCurrencySystem.CombineStacks(out overFlowing, num, num2, num3, num4); if (num5 > 0) { Main.instance.LoadItem(4076); Main.instance.LoadItem(3813); Main.instance.LoadItem(346); Main.instance.LoadItem(87); if (num4 > 0) { sb.Draw(TextureAssets.Item[4076].Value, Utils.CenteredRectangle(new Vector2(shopx + 96f, shopy + 50f), TextureAssets.Item[4076].Value.Size() * 0.65f), null, Color.White); } if (num3 > 0) { sb.Draw(TextureAssets.Item[3813].Value, Utils.CenteredRectangle(new Vector2(shopx + 80f, shopy + 50f), TextureAssets.Item[3813].Value.Size() * 0.65f), null, Color.White); } if (num2 > 0) { sb.Draw(TextureAssets.Item[346].Value, Utils.CenteredRectangle(new Vector2(shopx + 80f, shopy + 50f), TextureAssets.Item[346].Value.Size() * 0.65f), null, Color.White); } if (num > 0) { sb.Draw(TextureAssets.Item[87].Value, Utils.CenteredRectangle(new Vector2(shopx + 70f, shopy + 60f), TextureAssets.Item[87].Value.Size() * 0.65f), null, Color.White); } Utils.DrawBorderStringFourWay(sb, FontAssets.MouseText.Value, Lang.inter[66].Value, shopx, shopy + 40f, Color.White * ((float)(int)Main.mouseTextColor / 255f), Color.Black, Vector2.Zero); customCurrencySystem.DrawSavingsMoney(sb, Lang.inter[66].Value, shopx, shopy, num5, horizontal); } }
// Token: 0x06001040 RID: 4160 RVA: 0x003FEC60 File Offset: 0x003FCE60 public static bool BuyItem(Player player, int price, int currencyIndex) { CustomCurrencySystem customCurrencySystem = CustomCurrencyManager._currencies[currencyIndex]; bool flag; long num = customCurrencySystem.CountCurrency(out flag, player.inventory, new int[] { 58, 57, 56, 55, 54 }); long num2 = customCurrencySystem.CountCurrency(out flag, player.bank.item, new int[0]); long num3 = customCurrencySystem.CountCurrency(out flag, player.bank2.item, new int[0]); long num4 = customCurrencySystem.CountCurrency(out flag, player.bank3.item, new int[0]); if (customCurrencySystem.CombineStacks(out flag, new long[] { num, num2, num3, num4 }) < (long)price) { return(false); } List <Item[]> list = new List <Item[]>(); Dictionary <int, List <int> > dictionary = new Dictionary <int, List <int> >(); List <Point> list2 = new List <Point>(); List <Point> list3 = new List <Point>(); List <Point> list4 = new List <Point>(); List <Point> list5 = new List <Point>(); List <Point> list6 = new List <Point>(); list.Add(player.inventory); list.Add(player.bank.item); list.Add(player.bank2.item); list.Add(player.bank3.item); for (int i = 0; i < list.Count; i++) { dictionary[i] = new List <int>(); } dictionary[0] = new List <int> { 58, 57, 56, 55, 54 }; for (int j = 0; j < list.Count; j++) { for (int k = 0; k < list[j].Length; k++) { if (!dictionary[j].Contains(k) && customCurrencySystem.Accepts(list[j][k])) { list3.Add(new Point(j, k)); } } } CustomCurrencyManager.FindEmptySlots(list, dictionary, list2, 0); CustomCurrencyManager.FindEmptySlots(list, dictionary, list4, 1); CustomCurrencyManager.FindEmptySlots(list, dictionary, list5, 2); CustomCurrencyManager.FindEmptySlots(list, dictionary, list6, 3); return(customCurrencySystem.TryPurchasing(price, list, list3, list2, list4, list5, list6)); }