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

◆ OpenBossBag()

void Terraria.Player.OpenBossBag ( int type)
inline

Definition at line 6274 of file Player.cs.

6275 {
6276 GameModeData gameModeInfo = Main.GameModeInfo;
6277 float strength = 1f;
6278 if (gameModeInfo.IsJourneyMode)
6279 {
6281 if (power != null && power.GetIsUnlocked())
6282 {
6283 strength = power.StrengthMultiplierToGiveNPCs;
6284 }
6285 }
6286 bool flag = new NPCStrengthHelper(gameModeInfo, strength, Main.getGoodWorld).IsMasterMode || Main.masterMode;
6288 switch (type)
6289 {
6290 case 3318:
6291 {
6292 if (Main.rand.Next(2) == 0)
6293 {
6295 }
6296 if (Main.rand.Next(7) == 0)
6297 {
6299 }
6300 int num4 = Main.rand.Next(256, 259);
6301 int num5;
6302 for (num5 = Main.rand.Next(256, 259); num5 == num4; num5 = Main.rand.Next(256, 259))
6303 {
6304 }
6307 if (Main.rand.Next(2) == 0)
6308 {
6310 }
6311 else
6312 {
6314 }
6317 break;
6318 }
6319 case 3319:
6320 if (Main.rand.Next(7) == 0)
6321 {
6323 }
6324 if (Main.rand.Next(30) == 0)
6325 {
6327 }
6328 if (WorldGen.crimson)
6329 {
6330 int num9 = Main.rand.Next(20) + 10;
6331 num9 += Main.rand.Next(20) + 10;
6332 num9 += Main.rand.Next(20) + 10;
6334 num9 = Main.rand.Next(3) + 1;
6336 }
6337 else
6338 {
6339 int num10 = Main.rand.Next(20) + 10;
6340 num10 += Main.rand.Next(20) + 10;
6341 num10 += Main.rand.Next(20) + 10;
6343 num10 = Main.rand.Next(3) + 1;
6345 num10 = Main.rand.Next(30) + 20;
6347 }
6349 break;
6350 case 3320:
6351 {
6352 int num3 = Main.rand.Next(15, 30);
6353 if (flag)
6354 {
6355 num3 = Main.rand.Next(110, 136);
6357 }
6358 else
6359 {
6360 num3 = Main.rand.Next(80, 111);
6362 }
6363 if (flag)
6364 {
6365 num3 = Main.rand.Next(30, 51);
6367 }
6368 else
6369 {
6370 num3 = Main.rand.Next(20, 41);
6372 }
6373 if (Main.rand.Next(20) == 0)
6374 {
6376 }
6377 if (Main.rand.Next(7) == 0)
6378 {
6380 }
6382 break;
6383 }
6384 case 3321:
6385 {
6386 int num8 = Main.rand.Next(20, 46);
6387 if (flag)
6388 {
6389 num8 = Main.rand.Next(110, 136);
6391 }
6392 else
6393 {
6394 num8 = Main.rand.Next(80, 111);
6396 }
6397 if (flag)
6398 {
6399 num8 = Main.rand.Next(30, 51);
6401 }
6402 else
6403 {
6404 num8 = Main.rand.Next(20, 41);
6406 }
6407 if (Main.rand.Next(7) == 0)
6408 {
6410 }
6411 if (Main.rand.Next(20) == 0)
6412 {
6414 }
6416 break;
6417 }
6418 case 3322:
6419 {
6420 if (Main.rand.Next(7) == 0)
6421 {
6423 }
6424 int num6 = Main.rand.Next(3);
6425 switch (num6)
6426 {
6427 case 0:
6428 num6 = 1121;
6429 break;
6430 case 1:
6431 num6 = 1123;
6432 break;
6433 case 2:
6434 num6 = 2888;
6435 break;
6436 }
6439 if (Main.rand.Next(3) == 0)
6440 {
6442 }
6443 if (Main.rand.Next(9) == 0)
6444 {
6446 }
6447 if (Main.rand.Next(9) == 0)
6448 {
6450 }
6452 QuickSpawnItem(itemSource_OpenItem, Main.rand.Next(842, 845));
6453 QuickSpawnItem(itemSource_OpenItem, 1130, Main.rand.Next(10, 30));
6454 QuickSpawnItem(itemSource_OpenItem, 2431, Main.rand.Next(17, 30));
6455 break;
6456 }
6457 case 3323:
6459 switch (Main.rand.Next(3))
6460 {
6461 case 0:
6463 break;
6464 case 1:
6466 break;
6467 default:
6469 break;
6470 }
6471 break;
6472 case 3324:
6473 {
6474 if (Main.rand.Next(7) == 0)
6475 {
6477 }
6479 if (!extraAccessory)
6480 {
6482 }
6483 int num7 = Main.rand.Next(4);
6484 num7 = ((num7 != 3) ? (489 + num7) : 2998);
6486 switch (Main.rand.Next(4))
6487 {
6488 case 0:
6490 break;
6491 case 1:
6493 break;
6494 case 2:
6496 break;
6497 case 3:
6499 break;
6500 }
6501 break;
6502 }
6503 case 3325:
6505 if (Main.rand.Next(7) == 0)
6506 {
6508 }
6509 QuickSpawnItem(itemSource_OpenItem, 548, Main.rand.Next(25, 41));
6510 QuickSpawnItem(itemSource_OpenItem, 1225, Main.rand.Next(20, 36));
6512 break;
6513 case 3326:
6515 if (Main.rand.Next(7) == 0)
6516 {
6518 }
6519 QuickSpawnItem(itemSource_OpenItem, 549, Main.rand.Next(25, 41));
6520 QuickSpawnItem(itemSource_OpenItem, 1225, Main.rand.Next(20, 36));
6522 break;
6523 case 3327:
6525 if (Main.rand.Next(7) == 0)
6526 {
6528 }
6529 QuickSpawnItem(itemSource_OpenItem, 547, Main.rand.Next(25, 41));
6530 QuickSpawnItem(itemSource_OpenItem, 1225, Main.rand.Next(20, 36));
6532 break;
6533 case 3328:
6535 if (Main.rand.Next(7) == 0)
6536 {
6538 }
6541 if (Main.rand.Next(15) == 0)
6542 {
6544 }
6545 if (Main.rand.Next(20) == 0)
6546 {
6548 }
6549 if (Main.rand.Next(2) == 0)
6550 {
6552 }
6553 if (Main.rand.Next(10) == 0)
6554 {
6556 }
6557 switch (Main.rand.Next(7))
6558 {
6559 case 0:
6561 QuickSpawnItem(itemSource_OpenItem, 771, Main.rand.Next(50, 150));
6562 break;
6563 case 1:
6565 break;
6566 case 2:
6568 break;
6569 case 3:
6571 break;
6572 case 4:
6574 break;
6575 case 5:
6577 break;
6578 case 6:
6580 break;
6581 }
6582 break;
6583 case 3329:
6586 if (Main.rand.Next(7) == 0)
6587 {
6589 }
6590 if (Main.rand.Next(3) == 0)
6591 {
6593 }
6594 switch (Main.rand.Next(7))
6595 {
6596 case 0:
6598 QuickSpawnItem(itemSource_OpenItem, 1261, Main.rand.Next(60, 100));
6599 break;
6600 case 1:
6602 break;
6603 case 2:
6605 break;
6606 case 3:
6608 break;
6609 case 4:
6611 break;
6612 case 5:
6614 break;
6615 default:
6617 break;
6618 }
6619 QuickSpawnItem(itemSource_OpenItem, 2218, Main.rand.Next(18, 24));
6620 break;
6621 case 3330:
6624 if (Main.rand.Next(7) == 0)
6625 {
6627 }
6628 if (Main.rand.Next(10) == 0)
6629 {
6631 }
6632 switch (Main.rand.Next(5))
6633 {
6634 case 0:
6636 break;
6637 case 1:
6639 break;
6640 case 2:
6642 break;
6643 case 3:
6645 break;
6646 case 4:
6647 if (Main.remixWorld)
6648 {
6650 }
6651 else
6652 {
6654 }
6655 break;
6656 }
6657 break;
6658 case 3331:
6660 if (Main.rand.Next(7) == 0)
6661 {
6663 }
6664 break;
6665 case 3860:
6667 if (Main.rand.Next(7) == 0)
6668 {
6670 }
6671 switch (Main.rand.Next(4))
6672 {
6673 case 0:
6675 break;
6676 case 1:
6678 break;
6679 case 2:
6681 break;
6682 default:
6684 break;
6685 }
6686 if (Main.rand.Next(4) == 0)
6687 {
6689 }
6690 QuickSpawnItem(itemSource_OpenItem, 3817, Main.rand.Next(30, 50));
6691 break;
6692 case 4782:
6695 if (Main.rand.Next(7) == 0)
6696 {
6698 }
6699 if (Main.rand.Next(10) == 0)
6700 {
6702 }
6703 if (Main.rand.Next(20) == 0)
6704 {
6706 }
6707 if (Main.rand.Next(4) == 0)
6708 {
6710 }
6711 if (Main.rand.Next(20) == 0)
6712 {
6714 }
6715 switch (Main.rand.Next(4))
6716 {
6717 case 0:
6719 break;
6720 case 1:
6722 break;
6723 case 2:
6725 break;
6726 case 3:
6728 break;
6729 }
6730 break;
6731 case 4957:
6732 {
6734 QuickSpawnItem(itemSource_OpenItem, 4986, Main.rand.Next(25, 75));
6735 if (Main.rand.Next(7) == 0)
6736 {
6738 }
6739 if (Main.rand.Next(2) == 0)
6740 {
6742 }
6743 if (Main.rand.Next(3) == 0)
6744 {
6746 }
6747 if (Main.rand.Next(2) == 0)
6748 {
6750 }
6751 int num = Main.rand.Next(4982, 4985);
6752 int num2 = Main.rand.Next(4982, 4985);
6753 while (num2 == num)
6754 {
6755 num = Main.rand.Next(4982, 4985);
6756 }
6759 break;
6760 }
6761 }
6762 switch (type)
6763 {
6764 case 5111:
6766 if (Main.rand.Next(7) == 0)
6767 {
6769 }
6770 if (Main.rand.Next(14) == 0)
6771 {
6773 }
6774 if (Main.rand.Next(3) == 0)
6775 {
6777 }
6778 if (Main.rand.Next(3) == 0)
6779 {
6781 }
6782 if (Main.rand.Next(3) == 0)
6783 {
6785 }
6786 switch (Main.rand.Next(4))
6787 {
6788 case 0:
6790 break;
6791 case 1:
6793 break;
6794 case 2:
6796 break;
6797 case 3:
6799 break;
6800 }
6801 break;
6802 case 3332:
6803 {
6805 if (Main.rand.Next(7) == 0)
6806 {
6808 }
6809 if (Main.rand.Next(10) == 0)
6810 {
6812 }
6813 if (!HasItem(3384))
6814 {
6816 }
6817 QuickSpawnItem(itemSource_OpenItem, 3460, Main.rand.Next(90, 111));
6821 List<int> list = new List<int> { 3063, 3389, 3065, 1553, 3930, 3541, 3570, 3571, 3569 };
6822 for (int i = 0; i < 2; i++)
6823 {
6824 int index = Main.rand.Next(list.Count);
6825 int item = list[index];
6827 list.RemoveAt(index);
6828 }
6829 break;
6830 }
6831 }
6832 int num11 = -1;
6833 if (type == 3318)
6834 {
6835 num11 = 50;
6836 }
6837 if (type == 3319)
6838 {
6839 num11 = 4;
6840 }
6841 if (type == 3320)
6842 {
6843 num11 = 13;
6844 }
6845 if (type == 3321)
6846 {
6847 num11 = 266;
6848 }
6849 if (type == 3322)
6850 {
6851 num11 = 222;
6852 }
6853 if (type == 3323)
6854 {
6855 num11 = 35;
6856 }
6857 if (type == 3324)
6858 {
6859 num11 = 113;
6860 }
6861 if (type == 3325)
6862 {
6863 num11 = 134;
6864 }
6865 if (type == 3326)
6866 {
6867 num11 = 125;
6868 }
6869 if (type == 3327)
6870 {
6871 num11 = 127;
6872 }
6873 if (type == 3328)
6874 {
6875 num11 = 262;
6876 }
6877 if (type == 3329)
6878 {
6879 num11 = 245;
6880 }
6881 if (type == 3330)
6882 {
6883 num11 = 370;
6884 }
6885 if (type == 3331)
6886 {
6887 num11 = 439;
6888 }
6889 if (type == 3332)
6890 {
6891 num11 = 398;
6892 }
6893 if (type == 3860)
6894 {
6895 num11 = 551;
6896 }
6897 if (type == 3861)
6898 {
6899 num11 = 576;
6900 }
6901 if (type == 3862)
6902 {
6903 num11 = 564;
6904 }
6905 if (type == 4782)
6906 {
6907 num11 = 636;
6908 }
6909 if (type == 4957)
6910 {
6911 num11 = 657;
6912 }
6913 if (type == 5111)
6914 {
6915 num11 = 668;
6916 }
6917 if (num11 <= 0)
6918 {
6919 return;
6920 }
6921 NPC nPC = new NPC();
6922 nPC.SetDefaults(num11);
6923 float value = nPC.value;
6924 value *= 1f + (float)Main.rand.Next(-20, 21) * 0.01f;
6925 if (Main.rand.Next(5) == 0)
6926 {
6927 value *= 1f + (float)Main.rand.Next(5, 11) * 0.01f;
6928 }
6929 if (Main.rand.Next(10) == 0)
6930 {
6931 value *= 1f + (float)Main.rand.Next(10, 21) * 0.01f;
6932 }
6933 if (Main.rand.Next(15) == 0)
6934 {
6935 value *= 1f + (float)Main.rand.Next(15, 31) * 0.01f;
6936 }
6937 if (Main.rand.Next(20) == 0)
6938 {
6939 value *= 1f + (float)Main.rand.Next(20, 41) * 0.01f;
6940 }
6941 while ((int)value > 0)
6942 {
6943 if (value > 1000000f)
6944 {
6945 int num12 = (int)(value / 1000000f);
6946 value -= (float)(1000000 * num12);
6948 continue;
6949 }
6950 if (value > 10000f)
6951 {
6952 int num13 = (int)(value / 10000f);
6953 value -= (float)(10000 * num13);
6955 continue;
6956 }
6957 if (value > 100f)
6958 {
6959 int num14 = (int)(value / 100f);
6960 value -= (float)(100 * num14);
6962 continue;
6963 }
6964 int num15 = (int)value;
6965 if (num15 < 1)
6966 {
6967 num15 = 1;
6968 }
6969 value -= (float)num15;
6971 }
6972 }
IEntitySource GetItemSource_OpenItem(int itemType)
Definition Player.cs:9277
bool HasItem(int type)
Definition Player.cs:52305
bool extraAccessory
Definition Player.cs:659
void QuickSpawnItem(IEntitySource source, int item, int stack=1)
Definition Player.cs:6265
void TryGettingDevArmor(IEntitySource source)
Definition Player.cs:6974

References Terraria.WorldGen.crimson, Terraria.Player.extraAccessory, Terraria.Main.GameModeInfo, Terraria.Main.getGoodWorld, Terraria.Player.GetItemSource_OpenItem(), Terraria.Player.HasItem(), System.index, Terraria.GameContent.Creative.CreativePowerManager.Instance, Terraria.DataStructures.NPCStrengthHelper.IsMasterMode, System.item, System.list, Terraria.Main.masterMode, Terraria.Enums.NPC, Terraria.Player.QuickSpawnItem(), Terraria.Main.rand, Terraria.Main.remixWorld, Terraria.Player.TryGettingDevArmor(), System.type, and System.value.

Referenced by Terraria.UI.ItemSlot.TryOpenContainer().