Advertisement
Guest User

Stardew Valley Fishing Treasure Code

a guest
Apr 4th, 2016
1,581
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.32 KB | None | 0 0
  1. public void openTreasureMenuEndFunction(int extra)
  2. {
  3. this.lastUser.gainExperience(5, 10 * (this.clearWaterDistance + 1));
  4. this.doneFishing(this.lastUser, true);
  5. this.lastUser.completelyStopAnimatingOrDoingAction();
  6. List<Item> list = new List<Item>();
  7. if (extra == 1)
  8. {
  9. list.Add(new Object(this.whichFish, 1, false, -1, this.fishQuality));
  10. }
  11. float num = 1f;
  12. while (Game1.random.NextDouble() <= (double)num)
  13. {
  14. num *= 0.4f;
  15. switch (Game1.random.Next(4))
  16. {
  17. case 0:
  18. if (this.clearWaterDistance >= 5 && Game1.random.NextDouble() < 0.03)
  19. {
  20. list.Add(new Object(386, Game1.random.Next(1, 3), false, -1, 0));
  21. }
  22. else
  23. {
  24. List<int> list2 = new List<int>();
  25. if (this.clearWaterDistance >= 4)
  26. {
  27. list2.Add(384);
  28. }
  29. if (this.clearWaterDistance >= 3 && (list2.Count<int>() == 0 || Game1.random.NextDouble() < 0.6))
  30. {
  31. list2.Add(380);
  32. }
  33. if (list2.Count<int>() == 0 || Game1.random.NextDouble() < 0.6)
  34. {
  35. list2.Add(378);
  36. }
  37. if (list2.Count<int>() == 0 || Game1.random.NextDouble() < 0.6)
  38. {
  39. list2.Add(388);
  40. }
  41. if (list2.Count<int>() == 0 || Game1.random.NextDouble() < 0.6)
  42. {
  43. list2.Add(390);
  44. }
  45. list2.Add(382);
  46. list.Add(new Object(list2.ElementAt(Game1.random.Next(list2.Count<int>())), Game1.random.Next(2, 7) * ((Game1.random.NextDouble() < 0.05 + (double)this.lastUser.luckLevel * 0.015) ? 2 : 1), false, -1, 0));
  47. if (Game1.random.NextDouble() < 0.05 + (double)this.lastUser.LuckLevel * 0.03)
  48. {
  49. list.Last<Item>().Stack *= 2;
  50. }
  51. }
  52. break;
  53. case 1:
  54. if (this.clearWaterDistance >= 4 && Game1.random.NextDouble() < 0.1 && this.lastUser.FishingLevel >= 6)
  55. {
  56. list.Add(new Object(687, 1, false, -1, 0));
  57. }
  58. else if (this.lastUser.FishingLevel >= 6)
  59. {
  60. list.Add(new Object(685, 1, false, -1, 0));
  61. }
  62. else
  63. {
  64. list.Add(new Object(685, 10, false, -1, 0));
  65. }
  66. break;
  67. case 2:
  68. if (Game1.random.NextDouble() < 0.1 && this.lastUser != null && this.lastUser.archaeologyFound != null && this.lastUser.archaeologyFound.ContainsKey(102) && this.lastUser.archaeologyFound[102][0] < 19)
  69. {
  70. list.Add(new Object(102, 1, false, -1, 0));
  71. Game1.showGlobalMessage("You found a lost book. The library has been expanded.");
  72. }
  73. else if (Game1.player.archaeologyFound.Count<KeyValuePair<int, int[]>>() > 0)
  74. {
  75. if (Game1.random.NextDouble() < 0.25 && this.lastUser.FishingLevel > 1)
  76. {
  77. list.Add(new Object(Game1.random.Next(585, 588), 1, false, -1, 0));
  78. }
  79. else if (Game1.random.NextDouble() < 0.5 && this.lastUser.FishingLevel > 1)
  80. {
  81. list.Add(new Object(Game1.random.Next(103, 120), 1, false, -1, 0));
  82. }
  83. else
  84. {
  85. list.Add(new Object(535, 1, false, -1, 0));
  86. }
  87. }
  88. else
  89. {
  90. list.Add(new Object(382, Game1.random.Next(1, 3), false, -1, 0));
  91. }
  92. break;
  93. case 3:
  94. switch (Game1.random.Next(3))
  95. {
  96. case 0:
  97. if (this.clearWaterDistance >= 4)
  98. {
  99. list.Add(new Object(537 + ((Game1.random.NextDouble() < 0.4) ? Game1.random.Next(-2, 0) : 0), Game1.random.Next(1, 4), false, -1, 0));
  100. }
  101. else if (this.clearWaterDistance >= 3)
  102. {
  103. list.Add(new Object(536 + ((Game1.random.NextDouble() < 0.4) ? -1 : 0), Game1.random.Next(1, 4), false, -1, 0));
  104. }
  105. else
  106. {
  107. list.Add(new Object(535, Game1.random.Next(1, 4), false, -1, 0));
  108. }
  109. if (Game1.random.NextDouble() < 0.05 + (double)this.lastUser.LuckLevel * 0.03)
  110. {
  111. list.Last<Item>().Stack *= 2;
  112. }
  113. break;
  114. case 1:
  115. if (this.lastUser.FishingLevel < 2)
  116. {
  117. list.Add(new Object(382, Game1.random.Next(1, 4), false, -1, 0));
  118. }
  119. else
  120. {
  121. if (this.clearWaterDistance >= 4)
  122. {
  123. list.Add(new Object((Game1.random.NextDouble() < 0.3) ? 82 : ((Game1.random.NextDouble() < 0.5) ? 64 : 60), Game1.random.Next(1, 3), false, -1, 0));
  124. }
  125. else if (this.clearWaterDistance >= 3)
  126. {
  127. list.Add(new Object((Game1.random.NextDouble() < 0.3) ? 84 : ((Game1.random.NextDouble() < 0.5) ? 70 : 62), Game1.random.Next(1, 3), false, -1, 0));
  128. }
  129. else
  130. {
  131. list.Add(new Object((Game1.random.NextDouble() < 0.3) ? 86 : ((Game1.random.NextDouble() < 0.5) ? 66 : 68), Game1.random.Next(1, 3), false, -1, 0));
  132. }
  133. if (Game1.random.NextDouble() < 0.028 * (double)((float)this.clearWaterDistance / 5f))
  134. {
  135. list.Add(new Object(72, 1, false, -1, 0));
  136. }
  137. if (Game1.random.NextDouble() < 0.05)
  138. {
  139. list.Last<Item>().Stack *= 2;
  140. }
  141. }
  142. break;
  143. case 2:
  144. if (this.lastUser.FishingLevel < 2)
  145. {
  146. list.Add(new Object(770, Game1.random.Next(1, 4), false, -1, 0));
  147. }
  148. else
  149. {
  150. float num2 = (1f + (float)Game1.dailyLuck) * ((float)this.clearWaterDistance / 5f);
  151. if (Game1.random.NextDouble() < 0.05 * (double)num2 && !this.lastUser.specialItems.Contains(14))
  152. {
  153. list.Add(new MeleeWeapon(14)
  154. {
  155. specialItem = true
  156. });
  157. }
  158. if (Game1.random.NextDouble() < 0.05 * (double)num2 && !this.lastUser.specialItems.Contains(51))
  159. {
  160. list.Add(new MeleeWeapon(51)
  161. {
  162. specialItem = true
  163. });
  164. }
  165. if (Game1.random.NextDouble() < 0.07 * (double)num2)
  166. {
  167. switch (Game1.random.Next(3))
  168. {
  169. case 0:
  170. list.Add(new Ring(516 + ((Game1.random.NextDouble() < (double)((float)this.lastUser.LuckLevel / 11f)) ? 1 : 0)));
  171. break;
  172. case 1:
  173. list.Add(new Ring(518 + ((Game1.random.NextDouble() < (double)((float)this.lastUser.LuckLevel / 11f)) ? 1 : 0)));
  174. break;
  175. case 2:
  176. list.Add(new Ring(Game1.random.Next(529, 535)));
  177. break;
  178. }
  179. }
  180. if (Game1.random.NextDouble() < 0.02 * (double)num2)
  181. {
  182. list.Add(new Object(166, 1, false, -1, 0));
  183. }
  184. if (this.lastUser.FishingLevel > 5 && Game1.random.NextDouble() < 0.001 * (double)num2)
  185. {
  186. list.Add(new Object(74, 1, false, -1, 0));
  187. }
  188. if (Game1.random.NextDouble() < 0.01 * (double)num2)
  189. {
  190. list.Add(new Object(127, 1, false, -1, 0));
  191. }
  192. if (Game1.random.NextDouble() < 0.01 * (double)num2)
  193. {
  194. list.Add(new Object(126, 1, false, -1, 0));
  195. }
  196. if (Game1.random.NextDouble() < 0.01 * (double)num2)
  197. {
  198. list.Add(new Ring(527));
  199. }
  200. if (Game1.random.NextDouble() < 0.01 * (double)num2)
  201. {
  202. list.Add(new Boots(Game1.random.Next(504, 514)));
  203. }
  204. if (list.Count<Item>() == 1)
  205. {
  206. list.Add(new Object(72, 1, false, -1, 0));
  207. }
  208. }
  209. break;
  210. }
  211. break;
  212. }
  213. }
  214. if (list.Count<Item>() == 0)
  215. {
  216. list.Add(new Object(685, Game1.random.Next(1, 4) * 5, false, -1, 0));
  217. }
  218. Game1.activeClickableMenu = new ItemGrabMenu(list);
  219. (Game1.activeClickableMenu as ItemGrabMenu).source = 3;
  220. this.lastUser.completelyStopAnimatingOrDoingAction();
  221. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement