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

◆ RightClick() [1/2]

static void Terraria.UI.ItemSlot.RightClick ( Item[] inv,
int context = 0,
int slot = 0 )
inlinestatic

Definition at line 1320 of file ItemSlot.cs.

1321 {
1322 Player player = Main.player[Main.myPlayer];
1323 inv[slot].newAndShiny = false;
1324 if (player.itemAnimation > 0)
1325 {
1326 return;
1327 }
1328 if (context == 15)
1329 {
1330 HandleShopSlot(inv, slot, rightClickIsValid: true, leftClickIsValid: false);
1331 }
1332 else
1333 {
1334 if (!Main.mouseRight)
1335 {
1336 return;
1337 }
1338 if (context == 0 && Main.mouseRightRelease)
1339 {
1340 TryItemSwap(inv[slot]);
1341 }
1342 if (context == 0 && ItemID.Sets.OpenableBag[inv[slot].type])
1343 {
1344 if (Main.mouseRightRelease)
1345 {
1346 TryOpenContainer(inv[slot], player);
1347 }
1348 return;
1349 }
1350 switch (context)
1351 {
1352 case 9:
1353 case 11:
1354 if (Main.mouseRightRelease)
1355 {
1356 SwapVanityEquip(inv, context, slot, player);
1357 }
1358 break;
1359 case 12:
1360 case 25:
1361 case 27:
1362 case 33:
1363 if (Main.mouseRightRelease)
1364 {
1365 TryPickupDyeToCursor(context, inv, slot, player);
1366 }
1367 break;
1368 case 0:
1369 case 3:
1370 case 4:
1371 case 32:
1372 if (inv[slot].maxStack == 1)
1373 {
1374 if (Main.mouseRightRelease)
1375 {
1376 SwapEquip(inv, context, slot);
1377 }
1378 break;
1379 }
1380 goto default;
1381 default:
1382 {
1383 if (Main.stackSplit > 1)
1384 {
1385 break;
1386 }
1387 bool flag = true;
1388 bool flag2 = inv[slot].maxStack <= 1 && inv[slot].stack <= 1;
1389 if (context == 0 && flag2)
1390 {
1391 flag = false;
1392 }
1393 if (context == 3 && flag2)
1394 {
1395 flag = false;
1396 }
1397 if (context == 4 && flag2)
1398 {
1399 flag = false;
1400 }
1401 if (context == 32 && flag2)
1402 {
1403 flag = false;
1404 }
1405 if (!flag)
1406 {
1407 break;
1408 }
1409 int num = Main.superFastStack + 1;
1410 for (int i = 0; i < num; i++)
1411 {
1412 if ((Main.mouseItem.IsTheSameAs(inv[slot]) || Main.mouseItem.type == 0) && (Main.mouseItem.stack < Main.mouseItem.maxStack || Main.mouseItem.type == 0))
1413 {
1414 PickupItemIntoMouse(inv, context, slot, player);
1417 }
1418 }
1419 break;
1420 }
1421 }
1422 }
1423 }
static void PlaySound(int type, Vector2 position, int style=1)
static bool[] OpenableBag
Definition ItemID.cs:1125
static void HandleShopSlot(Item[] inv, int slot, bool rightClickIsValid, bool leftClickIsValid)
Definition ItemSlot.cs:1718
static void SwapEquip(ref Item inv, int context=0)
Definition ItemSlot.cs:2544
static void PickupItemIntoMouse(Item[] inv, int context, int slot, Player player)
Definition ItemSlot.cs:1425
static void SwapVanityEquip(Item[] inv, int context, int slot, Player player)
Definition ItemSlot.cs:1555
static void TryPickupDyeToCursor(int context, Item[] inv, int slot, Player player)
Definition ItemSlot.cs:1603
static void RefreshStackSplitCooldown()
Definition ItemSlot.cs:1478
static void TryItemSwap(Item item)
Definition ItemSlot.cs:1633
static void TryOpenContainer(Item item, Player player)
Definition ItemSlot.cs:1490

References Terraria.UI.ItemSlot.HandleShopSlot(), Terraria.Player.itemAnimation, Terraria.Item.maxStack, Terraria.Main.mouseItem, Terraria.Main.mouseRight, Terraria.Main.mouseRightRelease, Terraria.Main.myPlayer, Terraria.Item.newAndShiny, Terraria.ID.ItemID.Sets.OpenableBag, Terraria.UI.ItemSlot.PickupItemIntoMouse(), Terraria.Main.player, Terraria.Audio.SoundEngine.PlaySound(), Terraria.UI.ItemSlot.RefreshStackSplitCooldown(), Terraria.Item.stack, Terraria.Main.stackSplit, Terraria.UI.ItemSlot.SwapEquip(), Terraria.UI.ItemSlot.SwapVanityEquip(), Terraria.UI.ItemSlot.TryItemSwap(), Terraria.UI.ItemSlot.TryOpenContainer(), Terraria.UI.ItemSlot.TryPickupDyeToCursor(), and Terraria.Item.type.