Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ SortChest()

static void Terraria.UI.ItemSorting.SortChest ( )
inlinestatic

Definition at line 1173 of file ItemSorting.cs.

1174 {
1175 int chest = Main.player[Main.myPlayer].chest;
1176 if (chest == -1)
1177 {
1178 return;
1179 }
1180 Item[] item = Main.player[Main.myPlayer].bank.item;
1181 if (chest == -3)
1182 {
1183 item = Main.player[Main.myPlayer].bank2.item;
1184 }
1185 if (chest == -4)
1186 {
1187 item = Main.player[Main.myPlayer].bank3.item;
1188 }
1189 if (chest == -5)
1190 {
1191 item = Main.player[Main.myPlayer].bank4.item;
1192 }
1193 if (chest > -1)
1194 {
1195 item = Main.chest[chest].item;
1196 }
1198 for (int i = 0; i < 40; i++)
1199 {
1200 array[i] = Tuple.Create(item[i].netID, item[i].stack, (int)item[i].prefix);
1201 }
1202 Sort(item);
1204 for (int j = 0; j < 40; j++)
1205 {
1206 array2[j] = Tuple.Create(item[j].netID, item[j].stack, (int)item[j].prefix);
1207 }
1208 if (Main.netMode != 1 || Main.player[Main.myPlayer].chest <= -1)
1209 {
1210 return;
1211 }
1212 for (int k = 0; k < 40; k++)
1213 {
1214 if (array2[k] != array[k])
1215 {
1216 NetMessage.SendData(32, -1, -1, null, Main.player[Main.myPlayer].chest, k);
1217 }
1218 }
1219 }
static void Sort(Item[] inv, params int[] ignoreSlots)

References System.array, Terraria.Main.chest, System.item, Terraria.Main.myPlayer, Terraria.Main.netMode, Terraria.Main.player, System.prefix, Terraria.NetMessage.SendData(), and Terraria.UI.ItemSorting.Sort().

Referenced by Terraria.UI.ChestUI.DrawButton().