private void AetherShop(CommandArgs e) { if (!dropOpt || !shopOpt) { return; } string cmd = e.Message.Substring(e.Message.IndexOf(' ') + 1); string opt = string.Empty; if (cmd.Contains(' ')) { opt = cmd.Substring(cmd.IndexOf(' ') + 1); } string text = string.Empty; int who = e.Player.Index; foreach (Item inv in Main.player[who].inventory) { foreach (var ai in invp[who].aether) { if (ai.item.IsTheSameAs(inv)) { ai.item.owner = who; } } } switch (cmd.Contains(" ") ? cmd.Substring(0, cmd.IndexOf(" ")) : cmd) { case "list": foreach (var ai in invp[who].aether) { if (ai.newOwner == who || !NotCoin(ai.item) || ai.newOwner != 255) { ai.unbuyable = true; continue; } if (!string.IsNullOrEmpty(ai.item.Name)) { text += string.Concat(ai.item.Name, " (", ai.item.value, " copper) "); } } e.Player.SendInfoMessage(text == string.Empty ? "The items have expired or been reacquired." : text); break; case "buy": foreach (var ai in invp[who].aether) { if (ai.unbuyable || ai.newOwner == who || ai.newOwner != 255 || !NotCoin(ai.item)) { continue; } invp[who].coinBank = CoinPurse.CoinInit(who); buyBack[who] = true; int value = ai.item.shopCustomPrice.HasValue ? ai.item.shopCustomPrice.Value : ai.item.value; if (opt.ToLower().Replace(" ", "") == ai.item.Name.ToLower().Replace(" ", "")) { if (CoinPurse.ShopItem(who, value)) { Item clone = ai.item.Clone(); foreach (Item i in Main.item) { if (i.IsTheSameAs(ai.item)) { i.active = false; i.SetDefaults(0); break; } } e.Player.GiveItem(clone.type, clone.Name, clone.width, clone.height, clone.stack, clone.prefix); e.Player.SendSuccessMessage(string.Concat("Reacquiring ", ai.item.Name, " complete.")); invp[who].aether.Remove(ai); break; } else { e.Player.SendInfoMessage("The cost necessary for this item has not been acquired."); } } } break; default: break; } }